var xmlHttp;

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;
}


function GetNavi()
{
  var inf = document.getElementById("txtSkupinaID").value;
  if (inf.length!=0)
  {
	  xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
   var url="ajax_getnavi.asp";
   url=url+"?SkupinaID="+ inf;
   xmlHttp.onreadystatechange=DataSubNaviReady;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);
 	}
}

function PrikaziAvto(carid, cena, lan)
{
  xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
 	{
 		alert ("Your browser does not support AJAX!");
 		return;
 	} 
  var url="ajax_getavto.asp";
  url=url+"?carid="+ carid + "&cena=" + cena + "&mid=" + lan;
  xmlHttp.onreadystatechange=DataAvtoReady;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function ShowInfoDetailed(whichone)
{
	var poslovalnica ="";
	if (whichone==0)
	{
  	poslovalnica = document.getElementById("poslovalnicafrom").value;
  }
  else
 	{
  	poslovalnica = document.getElementById("poslovalnicato").value;
 	}
 	
 	if (poslovalnica.length!=0)
  {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		
		 var url="ajax_pinfodetailed.asp";
		 url=url+"?poslovalnicaid="+ poslovalnica + "&mid=sl";
		
		 if (whichone==0)
		 {
		 	  xmlHttp.onreadystatechange=PoslovalnicaDetailedReady;
		 }
		 else
		 {
		 	  xmlHttp.onreadystatechange=PoslovalnicaDetailedReady2;
		 }
		 xmlHttp.open("GET",url,true);
		 xmlHttp.send(null);
	}
}
function ShowInfoDetailedEN(whichone)
{
	var poslovalnica ="";
	if (whichone==0)
	{
  	poslovalnica = document.getElementById("poslovalnicafrom").value;
  }
  else
 	{
  	poslovalnica = document.getElementById("poslovalnicato").value;
 	}
 	
 	if (poslovalnica.length!=0)
  {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		
		 var url="ajax_pinfodetailed.asp";
		 url=url+"?poslovalnicaid="+ poslovalnica + "&mid=en";
		
		 if (whichone==0)
		 {
		 	  xmlHttp.onreadystatechange=PoslovalnicaDetailedReadyEN;
		 }
		 else
		 {
		 	  xmlHttp.onreadystatechange=PoslovalnicaDetailedReadyEN2;
		 }
		 xmlHttp.open("GET",url,true);
		 xmlHttp.send(null);
	}
}
function PoslovalnicaDetailedReady()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("divposlovalnicafrom").innerHTML=xmlHttp.responseText;
	  ShowInfoDetailed(1);
	}
}
function PoslovalnicaDetailedReady2()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("divposlovalnicato").innerHTML=xmlHttp.responseText;
	}
}

function PoslovalnicaDetailedReadyEN()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("divposlovalnicafrom").innerHTML=xmlHttp.responseText;
	  ShowInfoDetailedEN(1);
	}
}
function PoslovalnicaDetailedReadyEN2()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("divposlovalnicato").innerHTML=xmlHttp.responseText;
	}
}
function ShowInfo(whichone, lan)
{
	var poslovalnica ="";
	if (whichone==0)
	{
  	poslovalnica = document.getElementById("poslovalnicafrom").value;
  }
  else
 	{
  	poslovalnica = document.getElementById("poslovalnicato").value;
 	}
  if (poslovalnica.length!=0)
  {
	  xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
   var url="ajax_pinfo.asp";
   url=url+"?poslovalnicaid="+ poslovalnica + "&mid=" + lan;

   if (whichone==0)
   {
   	  xmlHttp.onreadystatechange=DataDostavaReady;
   }
   else
   {
   	  xmlHttp.onreadystatechange=DataDostavaReady2;
   }
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);
 	}
}

function DataAvtoReady()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("carpreview").innerHTML=xmlHttp.responseText;
	}
}
function DataDostavaReady2()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("ShowInfo2").innerHTML=xmlHttp.responseText;
	}
}
function DataVelikostReady()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("VelikostPrikazi").innerHTML=xmlHttp.responseText;
	}
}
function DataDostavaReady()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("ShowInfo").innerHTML=xmlHttp.responseText;
	}
}
function DataSubNaviReady() 
{ 
	if (xmlHttp.readyState==4)
	{
		//alert(xmlHttp.responseText);
		document.getElementById("commentFormVrsta").innerHTML=xmlHttp.responseText;
	}
}
