pendingClear = "false";
clearTimer = "";


if(document.images){

}
		

function killMenu(menu) { 
	clearTimer = setTimeout("clearMenu('" + menu + "')",2000);
}


function showMenu(menu){
	if (document.getElementById){
		document.getElementById('aboutMenu').style.visibility = "hidden";
		document.getElementById('productsMenu').style.visibility = "hidden";
		document.getElementById('watteduMenu').style.visibility = "hidden";
		document.getElementById('pressMenu').style.visibility = "hidden";
		document.getElementById(menu).style.visibility = 'visible';
		clearTimeout(clearTimer);
	} else {
		document.all.aboutMenu.style.visibility = "hidden";
		document.all.productsMenu.style.visibility = "hidden";
		document.all.watteduMenu.style.visibility = "hidden";
		document.all.pressMenu.style.visibility = "hidden";
		eval('document.all.' + menu).style.visibility = 'visible';
		clearTimeout(clearTimer);
	}
}

function clearMenu(menu){
	// turn off the last selected menu
	
		if (document.getElementById){
			document.getElementById(menu).style.visibility = 'hidden';
		}else{
			eval('document.all.' + menu).style.visibility = 'hidden';
		}
	/*if (document.getElementById){
		document.getElementById('HomeMenu').style.visibility = 'visible';
	}else{
		document.all.HomeMenu.style.visibility = 'visible';
	}*/
}


function waxOn(imgName,mode){
	if(document.images){
		if(document.all){
			document.all[imgName].src = eval(imgName+mode+'.src');
		}else{
			document[imgName].src = eval(imgName+mode+'.src');
		}
	}	
}


	xWidth=screen.width;
	yHeight=screen.height;
	xCenter = (xWidth/2)-(460/2);
	yCenter = (yHeight/2)-(390/2);

function popUp(url){
	var winName = "popup";
	myWin = window.open( url, winName,'width=460,height=390,left=' + xCenter + ',top=' + yCenter + ',directories=no,location=yes,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes');
}

function confirmDelete(url){
	if(confirm("Are you sure you want to delete this record? Deletions cannot be undone. Continue?")){
		document.location.href = url;
	}
}

function confirmCancel(url){
	if(confirm("Are you sure you want to cancel your account? To re-establish your account, you will need to contact support. Continue?")){
		document.location.href = url;
	}
}

function confirmPassSend(url){
	if(confirm("This will reset the user's password and e-mail it to their e-mail address if they have supplied one. Continue?")){
		document.location.href = url;
	}
}



function validateForm(){
	//theForm = "document.form";
	if(document.form.car_year.value == "" || document.form.car_make.value == "" || document.form.car_model.value == "" || document.form.mileage.value == "" || document.form.car_stock_number.value == "" || document.form.car_price.value == ""){
		alert("Please make sure all required fields are filled out before saving. Required fields are preceded by and asterisk (*)");
	}else{
		document.form.submit();	
	}
}

function GoToStats() {
document.statsform.submit();
}

function showNotify(){
	thisDiv = document.getElementById('notifyDiv');
	if(document.form.APPROVED.checked){
		document.form.NOTIFY.checked = true;
		thisDiv.style.display = "inline";
	}else{
		document.form.NOTIFY.checked = false;
		thisDiv.style.display = "none";
	}
	
}

function showOther(){
	thisDiv = document.getElementById('certOtherDiv');
	if(thisDiv.style.display == "none"){
		thisDiv.style.display = "inline";
	}else{
		thisDiv.style.display = "none";
	}
	
}

function viewCart(){
	document.forms.viewcart.submit();

}

function checkOut(){
	document.forms.checkoutform.submit();

}


function createMarker(point,paddress,pcity,pstate,pzipcode,pname,index) {
		var baseIcon = new GIcon();
		baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		baseIcon.iconSize = new GSize(20, 34);
		baseIcon.shadowSize = new GSize(37, 34);
		baseIcon.iconAnchor = new GPoint(9, 34);
		baseIcon.infoWindowAnchor = new GPoint(9, 2);
		baseIcon.infoShadowAnchor = new GPoint(18, 25);
	  	// Create a lettered icon for this point using our icon class from above
		//var letter = String.fromCharCode("A".charCodeAt(0) + index);
		var icon = new GIcon(baseIcon);
		icon.image = "http://www.google.com/mapfiles/marker" + index + ".png";
		var marker = new GMarker(point, icon);
	  	map.addOverlay(marker);
	  	var pfulladdress = paddress + ', ' + pcity + ', ' + pstate + ' ' + pzipcode; 
		var html = '<form action="http://maps.google.com/maps" method="get" target="_blank" style="margin:0px; width:200px;font-size:10px;line-height:12px;">'; 
		html += '<b>' + pname + '</b><br />' + paddress + '<br />' + pcity + ', ' + pstate + ' ' + pzipcode + '<br /><br />'; 
        html += '<b>Get Directions From: <br /></b><input type="text" name="saddr" value="address,city,state" style="font-size:10px; width:120px; height:21px;">'; 
		//html += '<input type="hidden" name="saddr" value="" />';
        html += '<input type="hidden" name="daddr" value="' + pfulladdress + '" />'; 
        html += '<input type="submit" value="Go"/></form><br />'; 
	  	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
	  });
}

function loadVideo(url){
	$("div#player").load(url);
	$("div#player").show("slow");
}

function closeVideo(){
	$("div#player").load("media/blank.html");
	$("div#player").hide("slow");
}

function jump(url){
	document.location.href=url;
}
