var xmlHttp;
function stateChanged() 
{ 
	
	if (xmlHttp.readyState==4  || xmlHttp.readyState=="complete")
	{ 
		if (parent.document.getElementById("shoppingCart")) {
		parent.document.getElementById("shoppingCart").innerHTML=xmlHttp.responseText }
		 
		
	}
		
} 
function image_preloader(divname)
{
	if(parent.document.getElementById(divname)) parent.document.getElementById(divname).innerHTML="<div id='loading'><img src='http://ecatavencu.arxia.ro/preloader/ajax-loader.gif' /><p>se incarca...</p></div>";
}
function  productsAddToCart()
{
	 alert("intru");
	image_preloader_mic('shoppingCart');
    xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	else if(str=="add_product") quantity=selectId;
	else quantity=selectId;
	
	var url="checkout.php"
	
	url=url+"?sid="+Math.random()
	
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function  productsRemove()
{
	 alert("intru");
	image_preloader_mic('shoppingCart');
    xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	else if(str=="cart_remove") quantity=selectId;
	else quantity=selectId;
	
	var url="checkout.php"
	
	url=url+"?sid="+Math.random()
	
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function GetXmlHttpObject()
{ 
	
	var A;
 			
 			var msxmlhttp = new Array(
				'Msxml2.XMLHTTP.5.0',
				'Msxml2.XMLHTTP.4.0',
				'Msxml2.XMLHTTP.3.0',
				'Msxml2.XMLHTTP',
				'Microsoft.XMLHTTP');
			for (var i = 0; i < msxmlhttp.length; i++) {
				try {
					A = new ActiveXObject(msxmlhttp[i]);
				} catch (e) {
					A = null;
				}
			}
 			
			if(!A && typeof XMLHttpRequest != "undefined")
				A = new XMLHttpRequest();
			if (!A)
				sajax_debug("Could not create connection object.");
			return A;
}
