

var urlstart = "ascripts/pprocess.php?"; // The server-side script
function updateMake() {
	var fueltype 	= document.getElementById('fueltype');
	var year		= document.getElementById('year');
	var url			= urlstart + "app=make&fueltype=" + fueltype.value + "&year=" + year.value;		
function handleHttpResponseMake() {	
 if (http.readyState == 4){
	results = http.responseText.split(",");  
	    document.forms["prodlocat"].make.options.length = 1;
		 document.forms["prodlocat"].model.options.length = 1;
		 document.forms["prodlocat"].engine.options.length = 1;		
  for (o=1; o < results.length+1; o++)
   {
	   var i;	   
	   i = o - 1;	   
     document.forms["prodlocat"].make.options[o] = new Option(results[i],results[i]);
   }}}				
  http.open("GET", url, true);
  http.onreadystatechange = handleHttpResponseMake;
  http.send(null);   
}





function updateModel() {
	var fueltype 	= document.getElementById('fueltype');
	var year		= document.getElementById('year');
	var make		= document.getElementById('make');
	var url			= urlstart + "app=model&fueltype=" + fueltype.value + "&year=" + year.value + "&make=" + make.value;		
function handleHttpResponseModel() {	
 if (http.readyState == 4){
	results = http.responseText.split(",");  
	    document.forms["prodlocat"].model.options.length = 1;
		document.forms["prodlocat"].engine.options.length = 1;		
  for (o=1; o < results.length+1; o++)
   {
	   var i;	   
	   i = o - 1;	   
     document.forms["prodlocat"].model.options[o] = new Option(results[i],results[i]);
   }}}				
  http.open("GET", url, true);
  http.onreadystatechange = handleHttpResponseModel;
  http.send(null);
}


function updateEngine() {
	
	var fueltype 	= document.getElementById('fueltype');
	var year		= document.getElementById('year');
	var make		= document.getElementById('make');
	var model		= document.getElementById('model');
	var url			= urlstart + "app=engine&fueltype=" + fueltype.value + "&year=" + year.value + "&make=" + make.value + "&model=" + model.value;
		
function handleHttpResponseEngine() {	
 if (http.readyState == 4){
	results = http.responseText.split(",");  
 
    
	
	reDirect(results[0]);
	

	    document.forms["prodlocat"].engine.options.length = 1;
		
  for (o=1; o < results.length+1; o++)
   {
	   
	   var i;	   
	   i = o - 1;	   
     document.forms["prodlocat"].engine.options[o] = new Option(results[i],results[i]);
   }}}		
		

  http.open("GET", url, true);
  http.onreadystatechange = handleHttpResponseEngine;
  http.send(null); 
}

function processSelect() {
	
	var fueltype 	= document.getElementById('fueltype');
	var year		= document.getElementById('year');
	var make		= document.getElementById('make');
	var model		= document.getElementById('model');
	var engine		= document.getElementById('engine');
	var url			= urlstart + "app=process&fueltype=" + fueltype.value + "&year=" + year.value + "&make=" + make.value + "&model=" + model.value + "&engine=" + engine.value;
	
	
		
function handleHttpResponsesSelect() {	
 if (http.readyState == 4){
	results = http.responseText.split(",");  
 
   
	
	reDirect(results[0]);
		
}}		
		

  http.open("GET", url, true);
  http.onreadystatechange = handleHttpResponsesSelect;
  http.send(null); 
}



function reDirect(results){
	
	var results;
	if (results == 'U7130'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=72";}
	if (results == 'U7131'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=100";}
	if (results == 'U7134'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=144";}
	if (results == 'U7135'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=118";}
	if (results == 'U7136'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=125";}
	if (results == 'U7137'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=150";}
	if (results == 'U7140'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=51";}
	if (results == 'U7141'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=164";}
	if (results == 'U7142'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=53";}
	if (results == 'U7144'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=54";}
	if (results == 'U7145'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=85";}
	if (results == 'U7146'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=55";}
	if (results == 'U7147'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=111";}
	if (results == 'U7150'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=70";}
	if (results == 'U7151'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=56";}
	if (results == 'U7152'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=76";}
	if (results == 'U7153'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=57";}
	if (results == 'U7155'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=105";}
	if (results == 'U7157'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=123";}
	if (results == 'U7158'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=58";}
	if (results == 'U7164'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=127";}
	if (results == 'U7165'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=59";}
	if (results == 'U7170'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=60";}
	if (results == 'U7180'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=61";}
	if (results == 'U7185'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=62";}
	if (results == 'U7186'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=75";}
	if (results == 'U7191'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=63";}
	if (results == 'U7192'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=64";}
	if (results == 'U7193'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=65";}
	if (results == 'U7194'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=83";}
	if (results == 'U7195'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=65";}
	if (results == 'U7198'){ parent.location.href = "../index.php?module=htmlpages&func=display&pid=67";}
	
}



function getHTTPObject() {
  var http;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      http = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        http = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        http = false;
      }
    }
  @else
  http = false;
  @end @*/
  

  
  if (!http && typeof XMLHttpRequest != 'undefined') {
    try {
      http = new XMLHttpRequest();
    } catch (e) {
      http = false;
    }
  }
  return http;
}
var http = getHTTPObject(); // We create the HTTP Object




