<!--
// ROLL-OVER JAVASCRIPT
//-->
Home_over = new Image();
Home_over.src = "./images/nav/home-over.gif";
Home_off = new Image();
Home_off.src = "./images/nav/home.gif";

Internet_over = new Image();
Internet_over.src = "./images/nav/internet-over.gif";
Internet_off = new Image();
Internet_off.src = "./images/nav/internet.gif";

UsedInventory_over = new Image();
UsedInventory_over.src = "./images/nav/used-over.gif";
UsedInventory_off = new Image();
UsedInventory_off.src = "./images/nav/used.gif";

UsedInventory1_over = new Image();
UsedInventory1_over.src = "./images/nav/used1-over.gif";
UsedInventory1_off = new Image();
UsedInventory1_off.src = "./images/nav/used1.gif";

NewQuote_over = new Image();
NewQuote_over.src = "./images/nav/new-over.gif";
NewQuote_off = new Image();
NewQuote_off.src = "./images/nav/new.gif";

NewModel_over = new Image();
NewModel_over.src = "./images/nav/years-over.gif";
NewModel_off = new Image();
NewModel_off.src = "./images/nav/years.gif";

Payment_over = new Image();
Payment_over.src = "./images/nav/payment-over.gif";
Payment_off = new Image();
Payment_off.src = "./images/nav/payment.gif";

Parts_over = new Image();
Parts_over.src = "./images/nav/parts-over.gif";
Parts_off = new Image();
Parts_off.src = "./images/nav/parts.gif";

Finance_over = new Image();
Finance_over.src = "./images/nav/finance-over.gif";
Finance_off = new Image();
Finance_off.src = "./images/nav/finance.gif";

Credit_over = new Image();
Credit_over.src = "./images/nav/credit-over.gif";
Credit_off = new Image();
Credit_off.src = "./images/nav/credit.gif";

About_over = new Image();
About_over.src = "./images/nav/about-over.gif";
About_off = new Image();
About_off.src = "./images/nav/about.gif";

Espanol_over = new Image();
Espanol_over.src="./images/nav/espanol-over.gif";
Espanol_off = new Image();
Espanol_off.src="./images/nav/espanol.gif";

View_over = new Image();
View_over.src = "./images/nav/view-over.gif";
View_off = new Image();
View_off.src = "./images/nav/view.gif";

Search_over = new Image();
Search_over.src = "./images/nav/search-over.gif";
Search_off = new Image();
Search_off.src = "./images/nav/search.gif";

Parts2_over = new Image();
Parts2_over.src = "./images/nav/parts2-over.gif";
Parts2_off = new Image();
Parts2_off.src = "./images/nav/parts2.gif";

Service_over = new Image();
Service_over.src = "./images/nav/service-over.gif";
Service_off = new Image();
Service_off.src = "./images/nav/service.gif";

marketing_over = new Image();
marketing_over.src="./images/nav/marketing-over.gif";
marketing_off = new Image();
marketing_off.src="./images/nav/marketing.gif";

events_over = new Image();
events_over.src="./images/nav/events-over.gif";
events_off = new Image();
events_off.src="./images/nav/events.gif";

scholarships_over = new Image();
scholarships_over.src="./images/nav/scholarships-over.gif";
scholarships_off = new Image();
scholarships_off.src="./images/nav/scholarships.gif";

function imgAct(imgName) {
	document[imgName].src = eval(imgName + "_over.src");
}

function imgInact(imgName) {
	document[imgName].src = eval(imgName + "_off.src");
}

function swapImage(name,id) {
  if (document.images) {document.images[id].src=eval(name+".src"); }
}

var testresults
function checkemail()
{
   var str=document.frm.email.value
   var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
   if (filter.test(str))
      testresults=true
   else
   {
      alert("Please input a valid email address!")
      document.frm.email.focus();
      testresults=false
   }

   return (testresults)
}

	function checkLevNavFields()
	{
		if( document.leftNav.FirstName.value == "" )
		{
	        alert("Please enter your first name!");
			document.leftNav.FirstName.focus();		        
			return(false);		        
		}
		if( document.leftNav.LastName.value == "" )
		{
	        alert("Please enter your last name!");
			document.leftNav.LastName.focus();		        
			return(false);		        
		}
		        
		if( document.leftNav.email.value == "" )
		{
	        alert("Please enter your email address!");
			document.leftNav.email.focus();		        
			return(false);		        
		}
		if( emailCheck(document.leftNav.email.value) == false )
		{			
			document.leftNav.email.focus();		        
			return false ;
		}
		if( document.leftNav.Phone.value == "" )
		{
	        alert("Please enter your day phone number!");
			document.leftNav.Phone.focus();		        
			return(false);		        
		}
		document.leftNav.submit();
	}
	
function emailCheck (emailStr)
{
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);

	if (matchArray==null)
	{
		alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings (0-127).

	for (i=0; i<user.length; i++)
	{
		if (user.charCodeAt(i)>127)
		{
			alert("Ths username contains invalid characters.");
			return false;
	    }
	}
	for (i=0; i<domain.length; i++)
	{
		if (domain.charCodeAt(i)>127)
		{
			alert("Ths domain name contains invalid characters.");
			return false;
	    }
	}

	// See if "user" is valid 

	if (user.match(userPat)==null)
	{
		alert("The username doesn't seem to be valid.");
		return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {

	// this is an IP address

	for (var i=1;i<=4;i++) {
	if (IPArray[i]>255) {
	alert("Destination IP address is invalid!");
	return false;
	   }
	}
	return true;
	}

	// Domain is symbolic name.  Check if it's valid.
	 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
	if (domArr[i].search(atomPat)==-1) {
	alert("The domain name does not seem to be valid.");
	return false;
	   }
	}

	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */

	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].search(knownDomsPat)==-1) {
	alert("The address must end in a well-known domain or two letter " + "country.");
	return false;
	}

	// Make sure there's a host name preceding the domain.

	if (len<2) {
	alert("This address is missing a hostname!");
	return false;
	}

	// If we've gotten this far, everything's valid!
	return true;
}

function AddItem(objListBox, strText, strValue)
{
	var myOption;
	myOption = document.createElement("Option");
	myOption.text = strText;
	myOption.value = strValue;
	objListBox.options.add(myOption);
}

function buildModelList( modelYear, model )
{
	if( modelYear == 2010 )
	{
		while(model.length < 19 )
		{
		   AddItem(model, "strText" , "strValue" );
		}		
		model.options[0].value = "";
		model.options[0].text  = "Select a Model";    
		model.options[1].value = "insight-hybrid";
		model.options[1].text  = "Insight Hybrid";
		model.options[2].value = "odyssey";
		model.options[2].text  = "Odyssey Minivan";
		model.options[3].value = "pilot";
		model.options[3].text  = "Pilot SUV";
		model.options[4].value = "accord-coupe";
		model.options[4].text  = "Accord Coupe";
		model.options[5].value = "accord-sedan";
		model.options[5].text  = "Accord Sedan";
		model.options[6].value = "civic-coupe";
		model.options[6].text  = "Civic Coupe";
		model.options[7].value = "civic-gx";
		model.options[7].text  = "Civic GX NGV";
		model.options[8].value = "civic-hybrid";
		model.options[8].text  = "Civic Hybrid";
		model.options[9].value = "civic-sedan";
		model.options[9].text  = "Civic Sedan";
		model.options[10].value = "civic-si-coupe";
		model.options[10].text  = "Civic Si Coupe";
		model.options[11].value = "civic-si-sedan";
		model.options[11].text  = "Civic Si Sedan";
		model.options[12].value = "cr-v";
		model.options[12].text  = "CR-V SUV";
		model.options[13].value = "element";
		model.options[13].text  = "Element";
		model.options[14].value = "element-sc";
		model.options[14].text  = "Element SC";
		model.options[15].value = "fcx-clarity";
		model.options[15].text  = "FCX Clarity";
		model.options[16].value = "fit";
		model.options[16].text  = "Fit 5-Door";
		model.options[17].value = "ridgeline";
		model.options[17].text  = "Ridgeline Truck";
		model.options[18].value = "s2000";
		model.options[18].text  = "S2000 Roadster";
	 }
	 else if( modelYear == 2009 )
	 {
		while(model.length > 10)
		{
		   model.remove(0);
		}		

		model.options[0].value = "";
		model.options[0].text  = "Select a Model";    

		model.options[1].value = "accord-coupe";
		model.options[1].text  = "Accord Coupe";
		model.options[2].value = "accord-sedan";
		model.options[2].text  = "Accord Sedan";
		model.options[3].value = "civic-coupe";
		model.options[3].text  = "Civic Coupe";
		model.options[4].value = "civic-gx";
		model.options[4].text  = "Civic GX NGV";
		model.options[5].value = "civic-hybrid";
		model.options[5].text  = "Civic Hybrid";
		model.options[6].value = "civic-sedan";
		model.options[6].text  = "Civic Sedan";
		model.options[7].value = "civic-si-coupe";
		model.options[7].text  = "Civic Si Coupe";
		model.options[8].value = "civic-si-sedan";
		model.options[8].text  = "Civic Si Sedan";
		model.options[9].value = "ridgeline";
		model.options[9].text  = "Ridgeline Truck";
	 }
}