 
// declare a global  XMLHTTP Request object
var XmlHttpObj;
function checkEmail(Email)
{
    var form1 = document.form1;
  
   var strURL="/findEmail.asp?Email="+form1.EmailAddress.value;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
   //alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('emaildiv').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}
function getYearCatalogSearchPart(CatCatalog, varkeyword)
{
    if (CatCatalog.length <= 0) {
	        document.getElementById('yearsearch').innerHTML="<select name='vyear' class='thisstyle3' disabled><option> </option></select>";
   } else {
   //alert(Rec_id);
   var strURL="/findYearCatalogSearchPart.asp?KeyWord="+varkeyword+"&CatCatalog="+CatCatalog;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
   //alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('yearsearch').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
   }
}
function getYearCatalog(CatCatalog, page, variableName, variableValue)
{
    if (CatCatalog.length <= 0) {
	        document.getElementById('yearsearch').innerHTML="<select name='vyear' class='thisstyle3' disabled><option> </option></select>";
   } else {
       //alert(page);
       var strURL="/findYearCatalog.asp?CatCatalog="+CatCatalog+"&page="+page+"&variableName="+variableName+"&variableValue="+variableValue;
       //alert(strURL);
       var req = getXMLHTTP();
       if (req)
       {
         req.onreadystatechange = function()
         {
          if (req.readyState == 4)
          {
	     // only if "OK"
       //alert(req.status);
	     if (req.status == 200)
             {
	        document.getElementById('yearsearch').innerHTML=req.responseText;
	     } else {
   	       alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	     }
           }
          }
       req.open("GET", strURL, true);
       req.send(null);
       }
    }
}
function getYearCatalogHeaderMenu(CatCatalog, page, variableName, variableValue)
{
    if (CatCatalog.length <= 0) {
	        document.getElementById('yearsearchheader').innerHTML="<select name='vyear' class='thisstyle3' disabled><option>Rocky</option></select>";
   } else {
   //alert(page);
   var strURL="/findYearCatalog.asp?CatCatalog="+CatCatalog+"&page="+page+"&variableName="+variableName+"&variableValue="+variableValue;
   //alert(strURL);
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
   //alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('yearsearchheader').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
   }
}
function getYearCatalog2(CatCatalog, page, variableName, variableValue)
{
    if (CatCatalog.length <= 0) {
	        document.getElementById('yearsearch2').innerHTML="<select name='vyear' class='thisstyle3' disabled><option> </option></select>";
   } else {
   //alert(page);
   var strURL="/findYearCatalog.asp?CatCatalog="+CatCatalog+"&page="+page+"&variableName="+variableName+"&variableValue="+variableValue;
   //alert(strURL);
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
   //alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('yearsearch2').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
   }
}
function getYearCatalog3(CatCatalog, page, variableName, variableValue, variableName2, variableValue2, variableName3, variableValue3)
{
    if (CatCatalog.length <= 0) {
	        document.getElementById('yearsearchproddetail').innerHTML="<select name='vyear' class='thisstyle3' disabled><option> </option></select>";
   } else {
   //alert(page);
   var strURL="/findYearCatalog.asp?CatCatalog="+CatCatalog+"&page="+page+"&variableName="+variableName+"&variableValue="+variableValue+"&variableName2="+variableName2+"&variableValue2="+variableValue2+"&variableName3="+variableName3+"&variableValue3="+variableValue3;
   //alert(strURL);
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
   //alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('yearsearchproddetail').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
   }
}
function getYearCatalogByCategory(CatCatalog, page, variableName, variableValue, variableName2, variableValue2)
{
    if (CatCatalog.length <= 0) {
	        document.getElementById('yearsearch2').innerHTML="<select name='vyear' class='thisstyle3' disabled><option> </option></select>";
   } else {
   //alert(page);
   var strURL="/findYearCatalogByCategory.asp?CatCatalog="+CatCatalog+"&page="+page+"&variableName="+variableName+"&variableValue="+variableValue+"&variableName2="+variableName2+"&variableValue2="+variableValue2;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
   //alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('yearsearch2').innerHTML=req.responseText;
	    //alert(req.responseText);
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
   }
}
function getYears(Make)
{
   //alert(Make);
   var strURL="/findYears.asp?Make="+Make;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
   //alert(req.status);
	 if (req.status == 200)
         {
           //  alert(req.responseText);
	    document.getElementById('yeardiv').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}

function getDoors(Make, Year)
{
   //alert(Make);
   //alert(Year);
   var strURL="/findDoors.asp?Make="+Make+"&Year="+Year;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
    //alert(req.status);
	 if (req.status == 200) {
	  //   alert(req.responseText);
	    document.getElementById('doordiv').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}

function getBodyStyle(Make, Year)
{
   alert(Make);
   alert(Year);
   var strURL="/findBodyStyle.asp?Make="+Make+"&Year="+Year;
   var req = getXMLHTTP();
   if (req)
   {
       req.onreadystatechange = function () {
           if (req.readyState == 4) {
               // only if "OK"
               //alert(req.status);
               if (req.status == 200) {
               //    alert(req.responseText);
                   document.getElementById('bodystylediv').innerHTML = req.responseText;
               } else {
                   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
               }
           }
       }
   req.open("GET", strURL, true);
   req.send(null);
   }
}

function getVehicleOption(Make, Year)
{
  // alert(Make);
   var strURL="/findVehicleOption.asp?Make="+Make+"&Year="+Year;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
    //alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('vehicleoptiondiv').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}

function saveInteriorStyle(InteriorStyle) {
   var strURL="/saveInteriorStyle.asp?InteriorStyle=" + InteriorStyle;
   //alert(strURL);
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
    //alert(req.status);
	 if (req.status == 200)
         {
	    //document.getElementById('interiorstylediv').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}
function saveBodyStyle(BodyStyle) {
   var strURL="/saveBodyStyle.asp?BodyStyle=" + BodyStyle;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {

	 if (req.status == 200)
         {
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}
function saveVehicleOption(VehicleOption) {
   var strURL="/saveVehicleOption.asp?VehicleOption=" + VehicleOption;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {

	 if (req.status == 200)
         {
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}

function saveDoor(Door) {
   var strURL="/saveDoor.asp?Door=" + Door;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {

	 if (req.status == 200)
         {
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}
function saveColor(Color) {
   var strURL="/saveColor.asp?Color=" + Color;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {

	 if (req.status == 200)
         {
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}
function saveTransmission(Transmission) {
   var strURL="/saveTransmission.asp?Transmission=" + Transmission;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {

	 if (req.status == 200)
         {
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}

function saveEngine(Engine) {
    //alert(Engine);
   var strURL="/saveEngine.asp?Engine=" + Engine;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {

	 if (req.status == 200)
         {
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}
/* new line -- do 2nd phase */
function getInteriorStyle(Make, Year)
{
   //alert(Make);
   //alert(Year);
   var strURL="/findInteriorStyle.asp?Make="+Make+"&Year="+Year;
   //alert(strURL);
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
    //alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('interiorstylediv').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}

function getInteriorColor(Make, Year)
{
   alert(Make);
   var strURL="/findInteriorColor.asp?Make="+Make+"&Year="+Year;
   alert (strURL);
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
    alert(req.status);
	 //if (req.status == 200)
         //{
	    document.getElementById('interiorcolordiv').innerHTML=req.responseText;
	 //} else {
   	  // alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	// }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}

function getTransmission(Make, Year)
{
   //alert(Make);
   var strURL="/findTransmission.asp?Make="+Make+"&Year="+Year;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
    alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('transmissiondiv').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}
function getEngine()
{
   //alert(Make);
   var strURL="/findEngine.asp?";
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
    alert(req.status);
	 if (req.status == 200)
         {
	    document.getElementById('enginediv').innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}

function getXMLHTTP()
{
var xmlhttp=null;
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
// code for IE
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

return xmlhttp;
}


/* If Catalog and Year selected, send to parts.html */
/*function checkCatalogYear(CatCatalog, sYear, sURL) {
    if (CatCatalog.length > 0 && sYear.length > 0) {
        
    }
}*/
