var xmlhttp

function getOrase(str)
{
if (str.length==0)
  {
  document.getElementById("ors_select").innerHTML="";
  return;
  }
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
var url=site_url;
url=url+"?index.php&type=getCities&id="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("ors_select").innerHTML=xmlhttp.responseText;
  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

var xmlhttp

function getOrase1(str)
{
if (str.length==0)
  {
  document.getElementById("ors_select1").innerHTML="";
  return;
  }
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
var url=site_url;
url=url+"?index.php&type=getCities1&id="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged1;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged1()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("ors_select1").innerHTML=xmlhttp.responseText;
  }
}


//ajax pentru cautare jante
function getmodels(str)
{
if (str.length==0)
  { 
  document.getElementById("modele1").innerHTML=""
  return
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/index.php?type=cardimensiuni"
url=url+"&brand="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedJan
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChangedJan() 
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("modele1").innerHTML=xmlHttp.responseText
 } 
}

function getdesignuri(car, str)
{
if (str.length==0)
  { 
  document.getElementById("designuri1").innerHTML=""
  return
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/index.php?type=cardimensiuni"
url=url+"&brand="+car
url=url+"&model="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged1Jan
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChanged1Jan() 
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("designuri1").innerHTML=xmlHttp.responseText
 } 
}

function getmotorizari(car, model, str)
{
if (str.length==0)
  { 
  document.getElementById("motorizari1").innerHTML=""
  return
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/index.php?type=cardimensiuni"
url=url+"&brand="+car
url=url+"&model="+model
url=url+"&design="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged2Jan
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChanged2Jan()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("motorizari1").innerHTML=xmlHttp.responseText
 } 
}

function getdiametre(car, model, design, str)
{
if (str.length==0)
  { 
  document.getElementById("diametre1").innerHTML=""
  return
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/index.php?type=cardimensiuni"
url=url+"&brand="+car
url=url+"&model="+model
url=url+"&design="+design
url=url+"&motorizare="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged3Jan
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged3Jan()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("diametre1").innerHTML=xmlHttp.responseText
 } 
}

function getsubmit(car, model, design, motorizare, str)
{
if (str.length==0)
  { 
  document.getElementById("submit").innerHTML=""
  return
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/index.php?type=cardimensiuni"
url=url+"&brand="+car
url=url+"&model="+model
url=url+"&design="+design
url=url+"&motorizare="+motorizare
url=url+"&diametru="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged4Jan
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged4Jan()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("submit").innerHTML=xmlHttp.responseText 
 } 
}



//cautare stanga
$(document).ready(function()
  {
    $("#div1link").click(function()
    {
        $("#div2").hide("fast");
        $("#div1").show("medium");
        $("#div3").hide("fast");
        $(".active").removeClass('active');
        $("#div1").addClass('active');
    });
    $("#div2link").click(function()
    {
        $("#div1").hide("fast");
        $("#div3").hide("fast");
        $("#div2").show("medium");
        $(".active").removeClass('active');
        $("#div2").addClass('active');
    });
    $("#div3link").click(function()
    {
        $("#div1").hide("fast");
        $("#div2").hide("fast");
        $("#div3").show("medium");
        $(".active").removeClass('active');
        $("#div3").addClass('active');
    });
  });

//comanda - utilizator nou
  $(document).ready(function()
  {
    $(".pjarea").hide("fast");
    $(".pf").click(function()
    {
        $(".pjarea").hide("fast");
        $(".pfarea").show("medium");
    });
    $(".pj").click(function()
    {
        $(".pfarea").hide("fast");
        $(".pjarea").show("medium");
    });
  });