var xmlHttp;

function ShowModels( brand )
{
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url = "ajax.html";
var params = "brand="+brand;
xmlHttp.open("POST", url, true);

//Send the proper header information along with the request
xmlHttp.onreadystatechange = alertContents;
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(params);
}

   function alertContents() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            //alert(http_request.responseText);
            result = xmlHttp.responseText;
            document.getElementById('form_right').innerHTML = result;
         } else {
            alert('There was a problem with the request.');
         }
      }
   }


function ShowEngine( brand, model )
{
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url = "ajax.html";
//var brand = document.getElementById('brands').value;
//var model = document.getElementById('models').value;
var params = "brand="+brand+"&model="+model;
xmlHttp.open("POST", url, true);

//Send the proper header information along with the request
xmlHttp.onreadystatechange = alertContents;
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(params);
}

function ShowYears( brand, model,engine )
{
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url = "ajax.html";
//var brand = document.getElementById('brands').value;
//var model = document.getElementById('models').value;
var params = "brand="+brand+"&model="+model+"&engine="+engine;
xmlHttp.open("POST", url, true);

//Send the proper header information along with the request
xmlHttp.onreadystatechange = alertContents;
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(params);
}

function ShowParametrs( brand, model,engine,year )
{
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url = "ajax.html";
//var brand = document.getElementById('brands').value;
//var model = document.getElementById('models').value;
var params = "brand="+brand+"&model="+model+"&engine="+engine+"&year="+year;
xmlHttp.open("POST", url, true);

//Send the proper header information along with the request
xmlHttp.onreadystatechange = alertContents;
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(params);
}

   function alertContents() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            //alert(http_request.responseText);
            result = xmlHttp.responseText;
            document.getElementById('form_right').innerHTML = result;
         } else {
            alert('There was a problem with the request.');
         }
      }
   }

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
 document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
 }
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

