/*=======================================================
image preloading
=======================================================*/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function preloadImages(){
	MM_preloadImages('/images/nav/main/cars-hi.gif','/images/nav/main/trade_in-hi.gif','/images/nav/main/insurance-hi.gif','/images/nav/main/finance-hi.gif','/images/nav/main/licensing-hi.gif','/images/nav/main/staff-hi.gif','/images/nav/main/service_center-hi.gif','/images/nav/main/front_adjust-hi.gif','/images/nav/main/about-hi.gif','/images/nav/main/contact-hi.gif','/images/nav/side/cars-hi.gif','/images/nav/side/price_list-hi.gif','/images/nav/side/catalogs-hi.gif','/images/nav/side/articles-hi.gif','/images/nav/side/club-hi.gif','/images/nav/side/test_drive-hi.gif','/images/nav/side/garage_schedule-hi.gif','/images/nav/side/insurance_quote-hi.gif','/images/nav/side/sales-hi.gif');
}

/*=======================================================
email hiding
=======================================================*/
function unhideEmail(a,sx,dm,nm,ihtml){
	document.getElementById(a).href='mai' + 'lto:' + nm + String.fromCharCode(64) + dm  + String.fromCharCode(46) + sx;
	if (ihtml){
		document.getElementById(a).innerHTML=nm + String.fromCharCode(64) + dm  + String.fromCharCode(46) + sx;
	}
}
function hideEmail(a,ihtml){
	document.getElementById(a).href='javascript:;';
	if (ihtml)
		document.getElementById(a).innerHTML=ihtml;
}

/*=======================================================
slding menu. written by Arie Zonshine, Lionways.com, Jan 2009
=======================================================*/
var pStatus=0;	// 0:idle, 1:opening, -1:closing
var maxW=109;	// maximum width to grow div to
var step=5;	// pixels to grow/shrink on each step
var m;	// menu container

function openSlidingMenu(){
	pStatus=1;	// enter opening mode
	m.style.display='block';
	m.style.zIndex=1000;
}

function closeSlidingMenu(){
	pStatus=-1;		// enter closing mode
}

function slidingMenuMonitor(){
	var w;
	if (pStatus==1){		// opening mode
		w=m.clientWidth+step;	// get current menu width and grow a little
		if (w<maxW)							// still haven't reach max?
			m.style.width=w+'px';		// set new width
		else{
			m.style.width=maxW+'px';		// set final width
			pStatus=0;		// end opening mode
		}
	}
	if (pStatus==-1){		// closing mode
		w=m.clientWidth-step;		// get current menu width and shrink a little
		if (w>0)		// still not closed
			m.style.width=w+'px';		// set new width
		else{		// done
			m.style.width='0px';		// set final width
			m.style.display='none';	// hide menu
			pStatus=0;		// end closing mode
		}
	}
}

function slidingMenuInit(){
	m=document.getElementById("side-car-menu");
	setInterval('slidingMenuMonitor()',10);
}
