function MakeSelected(make)
{
  var httpxml;
  try
  {
    // Firefox, Opera 8.0+, Safari
    httpxml=new XMLHttpRequest();
  }
  catch (e)
  {
      // Internet Explorer
      try
   	{
   	  httpxml=new ActiveXObject("Msxml2.XMLHTTP");
    	}
      catch (e)
    	{
    	  try
      	    {
      	      httpxml=new ActiveXObject("Microsoft.XMLHTTP");
     	    }
    	  catch (e)
      	    {
      	      alert("Your browser does not support AJAX!");
      	      return false;
      	    }
    	}
  }
  function modelck() 
    {
      if(httpxml.readyState==4)
        {
          var myarray=eval(httpxml.responseText);

          // Before adding new we must remove previously loaded elements
          for(j=document.testform.model.options.length-1;j>=0;j--)
          {
            document.testform.model.remove(j);
          }
           for(j=document.testform.year.options.length-1;j>=0;j--)
          {
            document.testform.year.remove(j);
          }
           for(j=document.testform.description.options.length-1;j>=0;j--)
          {
            document.testform.description.remove(j);
          } 
           for(j=document.testform.exact.options.length-1;j>=0;j--)
          {
            document.testform.exact.remove(j);
          } 
          
          var optn = document.createElement("OPTION");
          optn.text = "Select one...";
          optn.value = " ";
          document.testform.model.options.add(optn);
          
          for (i=0;i<myarray.length;i++)
          {
            var optn = document.createElement("OPTION");
            optn.text = myarray[i];
            optn.value = myarray[i];
            document.testform.model.options.add(optn);
          } 
        }
    }

var url="get_model.php";
url=url+"?make="+make;
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=modelck;
httpxml.open("GET",url,true);
httpxml.send(null);
}


function ModelSelected(make, model)
{

  var httpxml;
  try
  {
    // Firefox, Opera 8.0+, Safari
    httpxml=new XMLHttpRequest();
  }
  catch (e)
  {
      // Internet Explorer
      try
   	{
   	  httpxml=new ActiveXObject("Msxml2.XMLHTTP");
    	}
      catch (e)
    	{
    	  try
      	    {
      	      httpxml=new ActiveXObject("Microsoft.XMLHTTP");
     	    }
    	  catch (e)
      	    {
      	      alert("Your browser does not support AJAX!");
      	      return false;
      	    }
    	}
  }
  function yearck() 
    {
      if(httpxml.readyState==4)
        {
          var myarray=eval(httpxml.responseText);

          // Before adding new we must remove previously loaded elements
          for(j=document.testform.year.options.length-1;j>=0;j--)
          {
            document.testform.year.remove(j);
          }
          for(j=document.testform.description.options.length-1;j>=0;j--)
          {
            document.testform.description.remove(j);
          } 
          for(j=document.testform.exact.options.length-1;j>=0;j--)
          {
            document.testform.exact.remove(j);
          } 

          var optn = document.createElement("OPTION");
          optn.text = "Select one...";
          optn.value = " ";
          document.testform.year.options.add(optn);
 
          for (i=0;i<myarray.length;i++)
          {
            var optn = document.createElement("OPTION");
            optn.text = myarray[i];
            optn.value = myarray[i];
            document.testform.year.options.add(optn);
          } 
        }
    }

var url="get_year.php";
url=url+"?make="+make+"&model="+model;
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=yearck;
httpxml.open("GET",url,true);
httpxml.send(null);
}

function YearSelected(make, model, year)
{

  var httpxml;
  try
  {
    // Firefox, Opera 8.0+, Safari
    httpxml=new XMLHttpRequest();
  }
  catch (e)
  {
      // Internet Explorer
      try
   	{
   	  httpxml=new ActiveXObject("Msxml2.XMLHTTP");
    	}
      catch (e)
    	{
    	  try
      	    {
      	      httpxml=new ActiveXObject("Microsoft.XMLHTTP");
     	    }
    	  catch (e)
      	    {
      	      alert("Your browser does not support AJAX!");
      	      return false;
      	    }
    	}
  }
  function descriptionck() 
    {
      if(httpxml.readyState==4)
        {
          var myarray=eval(httpxml.responseText);

          // Before adding new we must remove previously loaded elements
          for(j=document.testform.description.options.length-1;j>=0;j--)
          {
            document.testform.description.remove(j);
          }
          for(j=document.testform.exact.options.length-1;j>=0;j--)
          {
            document.testform.exact.remove(j);
          }
          var optn = document.createElement("OPTION");
          optn.text = "Select one...";
          optn.value = " ";
          document.testform.description.options.add(optn);

          for (i=0;i<myarray.length;i++)
          {
            var optn = document.createElement("OPTION");
            optn.text = myarray[i];
            optn.value = myarray[i];
            document.testform.description.options.add(optn);
          } 
        }
    }

var url="get_description.php";
url=url+"?make="+make+"&model="+model+"&year="+year;
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=descriptionck;
httpxml.open("GET",url,true);
httpxml.send(null);
}


function DescriptionSelected(make, model, year, description)
{

  var httpxml;
  try
  {
    // Firefox, Opera 8.0+, Safari
    httpxml=new XMLHttpRequest();
  }
  catch (e)
  {
      // Internet Explorer
      try
   	{
   	  httpxml=new ActiveXObject("Msxml2.XMLHTTP");
    	}
      catch (e)
    	{
    	  try
      	    {
      	      httpxml=new ActiveXObject("Microsoft.XMLHTTP");
     	    }
    	  catch (e)
      	    {
      	      alert("Your browser does not support AJAX!");
      	      return false;
      	    }
    	}
  }
  function exactck() 
    {
      if(httpxml.readyState==4)
        {
          var myarray=eval(httpxml.responseText);

          // Before adding new we must remove previously loaded elements
          for(j=document.testform.exact.options.length-1;j>=0;j--)
          {
            document.testform.exact.remove(j);
          }
          var optn = document.createElement("OPTION");
          optn.text = "Select one...";
          optn.value = " ";
          document.testform.exact.options.add(optn);
  
          for (i=0;i<myarray.length;i++)
          {
            var optn = document.createElement("OPTION");
            optn.text = myarray[i];
            optn.value = myarray[i];
            document.testform.exact.options.add(optn);
          } 
        }
    }

var url="get_exact.php";
url=url+"?make="+make+"&model="+model+"&year="+year+"&description="+description;
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=exactck;
httpxml.open("GET",url,true);
httpxml.send(null);
}


