// client mouseover
var menuids=["mainNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
	
	function buildsubmenus_horizontal()
	{
		
		for (var i=0; i<menuids.length; i++)
		{
			if (document.getElementById(menuids[i])) 
			{
			var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
			for (var t=0; t<ultags.length; t++)
			{
				if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
					ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
					ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
				}
				else{ //else if this is a sub level menu (ul)
				  ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
				  ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
				}
				ultags[t].parentNode.onmouseover=function(){
					this.getElementsByTagName("ul")[0].style.visibility="visible";
					this.getElementsByTagName("a")[0].className += " mnHover";
					
					this.className+="mnHover";
					if (this.id.length > 0 && this.id.indexOf("btn") > -1)
					{
						var imageName = "/images/" + this.id + "-over.gif";
						changeImages(this.id, imageName);
					}
					
				}
				ultags[t].parentNode.onmouseout=function()	{
					this.getElementsByTagName("ul")[0].style.visibility="hidden";
					this.getElementsByTagName("a")[0].className = this.getElementsByTagName("a")[0].className.replace(new RegExp(" mnHover"), "");
					this.className=this.className.replace(new RegExp("mnHover"), "");
					if (this.id.length > 0  && this.id.indexOf("btn") > -1)
					{
						var imageName = "/images/" + this.id + ".gif";
						changeImages(this.id, imageName);
					}
				}
			}
			}
		}
	}
	  
	
	if (window.addEventListener) {
		window.addEventListener("load", buildsubmenus_horizontal, false)
	} else if (window.attachEvent) {
		window.attachEvent("onload", buildsubmenus_horizontal);
	}

/********************* 
PreLoad Images Script
**********************/	
		function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		btn_schService_over = newImage("images/schedule_service_over.jpg");
		btn_ads_over = newImage("images/our_advertisment_over.jpg");
		btn_coupons_over = newImage("images/online_coupons_over.jpg");
		btn_finance_over = newImage("images/online_financing_over.jpg");
		preloadFlag = true;
	}
}


function writeHomePageFlash()
{
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,14,0' width='538' height='207'");
	document.write(">");
	document.write("<param name='wmode' value='transparent'>");
	document.write(" <param name='src' value='/images/cortesemainheader.swf'>");
	document.write("<PARAM NAME=bgcolor VALUE=#FFFFFF>");
	document.write(" <embed pluginspage='http://www.macromedia.com/go/getflashplayer' width='538' height='207' wmode='transparent' bgcolor=#FFFFFF");
	document.write(" src='/images/cortesemainheader.swf'");
	document.write(" />");
	document.write("</object>");
}

function writeHome()
{
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,14,0' width='802' height='207'");
	document.write(">");
	document.write("<param name='wmode' value='transparent'>");
	document.write(" <param name='src' value='/images/dodgeheader.swf'>");
	document.write("<PARAM NAME=bgcolor VALUE=#FFFFFF>");
	document.write(" <embed pluginspage='http://www.macromedia.com/go/getflashplayer' width='802' height='207' wmode='transparent' bgcolor=#FFFFFF");
	document.write(" src='/images/dodgeheader.swf'");
	document.write(" />");
	document.write("</object>");
}