function hide_all(){
	hide_div('jeep_div');
	hide_div('dodge_div');
	hide_div('chrysler_div');
	hide_div('gmc_div');
	hide_div('pontiac_div');
	hide_div('chevy_div');
	hide_div('buick_div');
	hide_div('left_details_Buick_Pontiac');
	hide_div('left_details_chrysler');
	hide_div('left_details_allegan');
	hide_div('left_details_Grandville');
	hide_div('left_details_Wittenbach');
	hide_div('left_visit_div');
	hide_div('left_news_div');
	hide_div('left_maps_div');
	hide_div('maps_Buick_Pontiac');
	hide_div('maps_Chrysler');
	hide_div('maps_Allegan');
	hide_div('maps_Grandville');
	hide_div('maps_Wittenbach');
}
function hide_maps(){
	hide_div('maps_Buick_Pontiac');
	hide_div('maps_Chrysler');
	hide_div('maps_Allegan');
	hide_div('maps_Grandville');
	hide_div('maps_Wittenbach');
}
function show_div(div_id){
	var objDiv=document.getElementById(div_id).style;
	objDiv.display="block";
}
function hide_div(div_id){
	var objDiv=document.getElementById(div_id).style;
	objDiv.display="none";
}
function open_new_window(url_open){
	window.open(url_open);
}

//Begin auto tab script

var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}

//  End auto tab script

// Start numerals only script
	function disableKey(e) 
		{var key; 
			if(window.event) 
	          key = window.event.keyCode;     //IE 
	     	else 
	          key = e.which;     //firefox 
	  		if((key  < 48 || key > 57)) 
	          return false; 
	     	else 
	          return true; 
		} 
// End numerals only script

// email validator
	function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}	
// end email validator

function quick_quote_submit(){
	var themessage = "There was an error in your submission:\n ";
	if (Quick_Quote.First_Name.value.length == 0){
		themessage = themessage + "\n- First Name cannot be blank!";
	}
	if (Quick_Quote.Last_Name.value.length == 0){
		themessage = themessage + "\n- Last Name cannot be blank!";
	}
	if (echeck(Quick_Quote.Email.value)==false){
		themessage = themessage + "\n- Email is invalid!";
	}
	if (Quick_Quote.Zip.value.length == 0){
		themessage = themessage + "\n- Zip cannot be blank!";
	}
	if(Quick_Quote.LocationDealercode.value == -1) {
		themessage = themessage + "\n- Please Select a Dealership!";
	}
	if (themessage == "There was an error in your submission:\n ") {
		Quick_Quote.submit();
	}
	else {
		alert(themessage);
  	}
}