// JavaScript Document

function getmake(caryear)
  {  
  	var xmlHttp;
  try
    {    // Firefox, Opera 8.0+, Safari    
	xmlHttp=new XMLHttpRequest();    
	}
  catch (e)
    {    // Internet Explorer    
	try
      {     
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  }
    catch (e)
      {     
	  try
        {        
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");       
		}
      catch (e)
        {       
		alert("Your browser does not support AJAX!");        
		return false;        
		}
		}
		}
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        var theresponse = xmlHttp.responseText;
		if (theresponse != ''){
				var x
				var theresponse_array = theresponse.split("|");
				document.search3.make.options.length=theresponse_array.length+1;
				document.search3.make.options[0].value="";
				document.search3.make.options[0].text="-Select-";
				for (x in theresponse_array){
					var thevalue = theresponse_array[x];
					//alert(thevalue);
					document.search3.make.options[parseInt(x)+1].value=thevalue;
					document.search3.make.options[parseInt(x)+1].text=thevalue;
				}
		}
		
				
				
        }else{
			document.search3.make.options.length=1;
			document.search3.make.options[0].value="";
			document.search3.make.options[0].text="-None Found-";
		}
			
      }
    xmlHttp.open("GET","../dealerfiles/ajax.asp?getwhat=Make&caryear="+caryear,true);
    xmlHttp.send(null);  
	
	
	
}

function gemodel(caryear,make)
	
  {  
  	var xmlHttp;
  try
    {    // Firefox, Opera 8.0+, Safari    
	xmlHttp=new XMLHttpRequest();    
	}
  catch (e)
    {    // Internet Explorer    
	try
      {     
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  }
    catch (e)
      {     
	  try
        {        
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");       
		}
      catch (e)
        {       
		alert("Your browser does not support AJAX!");        
		return false;        
		}
		}
		}
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        var theresponse = xmlHttp.responseText;
		//alert(theresponse);
		
		if (theresponse != ''){
				if (theresponse.indexOf("|") > 0){
					var x
						var theresponse_array = theresponse.split("|");
						document.search3.model.options.length=theresponse_array.length+1;
						document.search3.model.options[0].value="";
						document.search3.model.options[0].text="-Select-";
						for (x in theresponse_array){
							var thevalue = theresponse_array[x];
							//alert(thevalue);
							document.search3.model.options[parseInt(x)+1].value=thevalue;
							document.search3.model.options[parseInt(x)+1].text=thevalue;
					}
				}else{
					document.search3.model.options.length=2;
					document.search3.model.options[0].value="";
					document.search3.model.options[0].text="-Select-";
					document.search3.model.options[1].value=theresponse;
					document.search3.model.options[1].text=theresponse;
				}
						
		}
		
				
				
        }else{
			document.search3.model.options.length=1;
			document.search3.model.options[0].value="";
			document.search3.model.options[0].text="-None Found-";
		}
			
      }
	  
    xmlHttp.open("GET","../dealerfiles/ajax.asp?getwhat=model&caryear="+caryear +"&make=" + make,true);
    xmlHttp.send(null);  
	
	
	
}
