// Base
/*

last updated: 1-22-2009 EJR

note:
This file contains some default scripts that are used throughout the site.
1. add <head> link to this file
2. call AddDOMLoadEvent function
3. call loadBaseDefaults function

*/


// AddDOMLoadEvent, compressed, reference: http://www.thefutureoftheweb.com/blog/adddomloadevent
// * (c)2006 Jesse Skinner/Dean Edwards/Matthias Miller/John Resig
// * Special thanks to Dan Webb's domready.js Prototype extension
// * and Simon Willison's addLoadEvent
// use in place of window.onload
addDOMLoadEvent=(function(){var e=[],t,s,n,i,o,d=document,w=window,r='readyState',c='onreadystatechange',x=function(){n=1;clearInterval(t);while(i=e.shift())i();if(s)s[c]=''};return function(f){if(n)return f();if(!e[0]){d.addEventListener&&d.addEventListener("DOMContentLoaded",x,false);/*@cc_on@*//*@if(@_win32)d.write("<script id=__ie_onload defer src=//0><\/scr"+"ipt>");s=d.getElementById("__ie_onload");s[c]=function(){s[r]=="complete"&&x()};/*@end@*/if(/WebKit/i.test(navigator.userAgent))t=setInterval(function(){/loaded|complete/.test(d[r])&&x()},10);o=w.onload;w.onload=function(){x();o&&o()}}e.push(f)}})();


// the rest of the functions in this file should be added here
function loadBase(quickContact) {
	setJS();
	initMenus(); // accordion menus from 'accordion.js'	
	
	// quick contact form
	quickContact = typeof(quickContact) != 'undefined' ? quickContact : true; // sets default value of 'quickContact' to true	
	if (quickContact == true) { // if true, loads quick contact form
		$("#quick_contact_wrap").load("/wp-content/themes/ramseysubaru/includes/form_quick_contact.php", {limit: 25}, function(){
			setFormValidation(['quick_contact']);
		});
	}
}


// adds class="js" to body to simplify coding of CSS styles written for javascript
function setJS() {
	var addClass = document.getElementsByTagName("body");
	for (var i=0; i<addClass.length; i++) {
		addClass[i].className = "js";
	}
}
