

/* -- Dropdown Nav Scripts -- */
// Copyright 2006-2007 javascript-array.com

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 








/* -- Quick Menu Nav Scripts (n is the groun number -- l is the link number)  -- */
function showGroup(n, l) {
	// Set the selected DIV group and content variable
	var theGroup = document.getElementById('g'+n);
	var theContents = theGroup.getElementsByTagName('span')[0];
	var theImagePath = theGroup.style.backgroundImage;
	var theImageName = theImagePath.substring(theImagePath.lastIndexOf('/') + 1,theImagePath.lastIndexOf('.'));


	// Check to see if the Link variable is set
	if (l) {
		var theLink = theGroup.getElementsByTagName('a')[l];
		if (n == 9 || n == 10){
			theLink.style.color = '000000';
		} else {
			theLink.style.color = 'ff0000';
		}
		theGroup.getElementsByTagName('a')[0].style.color = '#000000';
	}
	
	
	// Check to see if the selected group is closed
	if (theImageName == "quickMenuDark" || theImageName == "quickMenuRed" || theImageName == "quickMenuGrey") {
		// The group was closed
		//alert (theImageName);
		closeGroups();
				
		if (n == 9){
			theGroup.style.backgroundImage="url(/images/backgrounds/quickMenuRed2.jpg)";
		} else if (n == 10){
			theGroup.style.backgroundImage="url(/images/backgrounds/quickMenuGrey2.jpg)";
		} else {
			theGroup.style.backgroundImage="url(/images/backgrounds/quickMenuLight.jpg)";
		}
				
		theContents.style.display = 'block';
	} else {
		// The group was open
		closeGroups();
	}
}


function closeGroups() {
	
	for(i=1;i<9;i++)
		{
			document.getElementById('g'+i).style.backgroundImage = "url(/images/backgrounds/quickMenuDark.jpg)";
			document.getElementById('g'+i).getElementsByTagName('span')[0].style.display = 'none';
		}
			
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function showNews(theURL) { //v2.0
  window.open('/news/'+theURL,'','scrollbars=yes,resizable=yes,width=550,height=550');
}

function showPop(theURL) { //v2.0
  window.open(theURL,'','scrollbars=yes,resizable=yes,width=550,height=550');
}

function gotoStore(theURL) {
  window.open(theURL, '_blank');
}


function showModelImg(modelNum){
	document.getElementById('lgImage').src = 'images/'+ modelNum +'.jpg';
}




function showExtra(theDiv){
	//alert(theDiv);
	var divs = document.getElementsByTagName("div");
	for (var i=0; i<divs.length; i++)
	if (divs[i].id.indexOf("e_") == 0) divs[i].style.display = "none"; 
	
	document.getElementById('e_' + theDiv).style.display = "block";
}


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 swapImage(obj, img) {
	obj.src = img;
}