var xmlHttp


function showOrder(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="p_order.php"
url=url+"?id="+str
url=url+"&sid="+Math.random()
xmlHttp.open("GET",url,true)
xmlHttp.onreadystatechange=function() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if (document.getElementById(str).innerHTML!='') 
 {
	 document.getElementById(str).innerHTML=''
	 } 
 else 
 {
 document.getElementById(str).innerHTML=xmlHttp.responseText }
 } 
}
xmlHttp.send(null)
}

function showInvoice(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="p.php"
url=url+"?id="+str
url=url+"&sid="+Math.random()
xmlHttp.open("GET",url,true)
xmlHttp.onreadystatechange=function() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if (document.getElementById(str).innerHTML!='') 
 {
	 document.getElementById(str).innerHTML=''
	 } 
 else 
 {
 document.getElementById(str).innerHTML=xmlHttp.responseText }
 } 
}
xmlHttp.send(null)
}


function showProd2(str2)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="p1.php"
url=url+"?id="+str2
url=url+"&sid="+Math.random()+"&sorti="+document.getElementById("sortiraj").value
xmlHttp.open("GET",url,true)
xmlHttp.onreadystatechange=function() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("proizvodi").innerHTML=xmlHttp.responseText 
 } 
}
xmlHttp.send(null)
}




function showProd(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
iner='<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">'
  iner=iner+'<tr><td height="200">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td align="center" valign="middle">'
  iner=iner+'<img src="images/loading.gif" width="32" height="32"></td>  <td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>'
  window.parent.document.getElementById("proizvodi").innerHTML=iner
var iner,url="p1.php"
url=url+"?id="+str
url=url+"&sid="+Math.random()
xmlHttp.open("GET",url,true)
xmlHttp.onreadystatechange=function() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

 
window.parent.document.getElementById("proizvodi").innerHTML=xmlHttp.responseText 
 } 
}
xmlHttp.send(null)
}
 


function dodadicart(pid)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="cart.php"
kol=document.getElementById(pid).value
url=url+"?id="+pid+"&kol="+kol
url=url+"&sid="+Math.random()
xmlHttp.open("GET",url,true)
xmlHttp.onreadystatechange=function() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("showcart").innerHTML=''
 document.getElementById("showcart").innerHTML=xmlHttp.responseText 
 } 
}
xmlHttp.send(null)
}



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 showTable(id) { 
		table = document.getElementById(id); 
		if(table.style.display == 'none') { 
			//	bid=id+'1';
			//	document.images[bid].src='images/minus.jpg';
				table.style.display = 'block';
		} else { 
			//bid=id+'1';
			//	document.images[bid].src='images/plus.jpg';
					table.style.display = 'none'; 
		} 
} 



function isprati(){
	var Odgovor = confirm("Дали сте сигурни дека ја завршувате порачката!");
	if (Odgovor == true)
	{
		location='potvrdi.php';
	}
}



function otkazi(partner){
	var Odgovor = confirm("Дали сте сигурни дека ја откажувате порачката!");
	if (Odgovor == true)
	{
		xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			 {
			 alert ("Browser does not support HTTP Request")
			 return
			 }
			var url="otkazi_cart.php?id="+partner
			url=url+"&sid="+Math.random()
			xmlHttp.open("GET",url,true)
			xmlHttp.onreadystatechange=function() 
			{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			 { 
			 document.getElementById("showcart").innerHTML=''
			 } 
			}
			xmlHttp.send(null)
	}
}




function izbrisicart(id){
	var Odgovor = confirm("Дали сте сигурни?");
	if (Odgovor == true)
	{
		xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			 {
			 alert ("Browser does not support HTTP Request")
			 return
			 }
			var url="izbrisi_cart.php"
			url=url+"?id="+id
			url=url+"&sid="+Math.random()
			xmlHttp.open("GET",url,true)
			xmlHttp.onreadystatechange=function() 
			{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			 { 
			 document.getElementById("showcart").innerHTML=''
			 document.getElementById("showcart").innerHTML=xmlHttp.responseText 
			 } 
			}
			xmlHttp.send(null)
	}
}



function popap(id)
{
	window.open("detail.php?id="+id,"detail","left=300, top=300, scrollbars=yes,HEIGHT=400,WIDTH=600")
	
	}