
// catcher
function doNothing() {};

// get base url
with (this.location) { baseURL = href.substring(0, href.lastIndexOf ("/") + 1) }

// global variables

var num = null;

// image name construction
imageDir	= "/images/nav/";
offSuffix	= "_off.gif";
onSuffix	= "_on.gif";

var totalMice = 0;
var mausArray = new Array();

// create new mausover objects
function mausObj (width, height, name, statusText) {

  this.width		= width;
  this.height		= height;
  this.name			= name;
  this.statusText	= statusText;
  this.off			= new Image (width, height);
  this.off.src		= imageDir + name + offSuffix;
  this.on			= new Image (width, height);
  this.on.src		= imageDir + name + onSuffix;

}

function makeMausObj(width, height, name, statusText) {

   mausArray[totalMice] = new mausObj(width, height, name, statusText);

  totalMice++;

}


// mouseover
function doMausOver(num) {

	document.images[mausArray[num].name].src = mausArray[num].on.src;
	self.status = mausArray[num].statusText;

}


// mouseout
function doMausOut (num) {

	document.images[mausArray[num].name].src = mausArray[num].off.src;

	self.status = "";

}


// rollover image array (width, height, name, statusText)
makeMausObj(86, 18, "btn_nav_home", "Home");
makeMausObj(95, 18, "btn_nav_about", "About Us");
makeMausObj(78, 18, "btn_nav_locations", "Find Us");
makeMausObj(99, 18, "btn_nav_products", "Our Products");
makeMausObj(90, 18, "btn_nav_specials", "Specials");
makeMausObj(91, 18, "btn_nav_coupons", "Coupons");
makeMausObj(90, 18, "btn_nav_benefits", "Benefits");
makeMausObj(121, 18, "btn_nav_quote", "Online Quote");



// popup window

	function thisIsPop (url, pWidth, pHeight, scrollSet) {

		var popWindow = null;

		if (!pWidth) {
			var pWidth = 490;
		}

		if (!pHeight) {
			var pHeight = 610;
		}

		if (!scrollSet) {
			var scrollSet = 1;
		}

			var displayString = "left=0,screenX=0,top=0,screenY=0,width=" + pWidth + ",height=" + pHeight + ",scrollbars=" + scrollSet +",resizable";

    		popWindow = window.open(url,'PopWindow',displayString);

				if (popWindow != null) {
					if (popWindow.opener == null) { popWindow.opener = self; }
					popWindow.opener.name = "popDaddy";
				}

	}

function ucw(str){
	str = str.replace('_',' ');
	strArray = str.split(' ');
	for(j=0; j<strArray.length; j++){
		strArray[j] = strArray[j].charAt(0).toUpperCase() + strArray[j].substring(1);
	}
	return strArray.join(' ');
}

function validate(form){
        var jumpto = "";
        var errors = "";
        var requiredField = "";
        var display = "";
        var form_el = "";
        var form_el_val = "";

		if(typeof(form.required) != 'undefined' && form.required.value != ""){

			requiredArray = form.required.value.split(",");

			for(i=0; i<requiredArray.length; i++){
				requiredField = requiredArray[i];
				display = ucw(requiredField);

				form_el = "document.getElementById('"+form.name+"["+requiredField+"]')";

				form_el_val = "document.getElementById('"+form.name+"["+requiredField+"]').value";

				if (eval(form_el_val) == "") {
					errors = 'Please fill in all required fields:\n';
					if (!jumpto) {
						jumpto = eval(form_el);
					}
				}
				else if(requiredField == 'email_address' || requiredField == 'email'){

					var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
					var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
					var reg1 = new RegExp(reg1str);
					var reg2 = new RegExp(reg2str);
					if (reg1.test(eval(form_el_val)) || !reg2.test(eval(form_el_val))) {
						errors += 'Please use a valid Email Address:\n';
						if (!jumpto) {
							jumpto = eval(form_el);
						}
					}
				}
			}
		}

		if (errors) {
			string = errors;
			alert(string);
			jumpto.focus();
			return false;
		}
		else {
			return true;
		}
}

function showBrands(){
	if(document.getElementById('brands_1').style.display=='block'){
		document.getElementById('brands_1').style.display='none';
		document.getElementById('more').innerHTML = "&laquo; prev";
	}
	else{
		document.getElementById('brands_1').style.display='block';
		document.getElementById('more').innerHTML = "more &raquo;";
	}
	if(document.getElementById('brands_2').style.display=='block'){
		document.getElementById('brands_2').style.display='none';
	}
	else{
		document.getElementById('brands_2').style.display='block';
	}
}



