var xmlHttp
function adddigitalproduct(trackid, imageid, price, currency)
{
	//alert('adddigitalproductproduct id'+trackid+price+currency);
	document.getElementById("buyimage"+imageid).style.cursor= "default";
	document.getElementById("buyimage"+imageid).src = "../store/wp-content/themes/default/images/bt_small_bought.gif";
	if (trackid.length==0)
	{ 
		return
	}
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="../store/wp-content/themes/default/buy-tracks-ajax.php"
	url=url+"?product_id="+trackid
	url=url+"&price="+price
	url=url+"&currency="+currency
	url=url+"&param=adddigitalproduct"
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged2
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function deletedigitalproduct(str)
{
	 // alert(str);
	 
	 
	  if (str.length==0)
		  { 
			  document.getElementById("digitalcartdisplay").innerHTML=""
			  return
		  }
		  
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null)
	  {
	  alert ("Browser does not support HTTP Request")
	  return
	  } 
	  
	var url="../store/wp-content/themes/default/buy-tracks-ajax.php"
	url=url+"?q="+str
	url=url+"&param=deletedigitalproduct"
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged2 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function addalldigitalproduct(prodid, num, currency)
{
	// alert('addalldigitalproduct'+prodid+currency);
	 for(var i=1; i<=num; i++)
	 {
	 document.getElementById("buyimage"+i).style.cursor= "default";
	 document.getElementById("buyimage"+i).src = "../store/wp-content/themes/default/images/bt_small_bought.gif";
	 }
	 
	 if (prodid.length==0)
	 { 
		return
	 }
		  
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null)
	  {
	  alert ("Browser does not support HTTP Request")
	  return
	  } 
	  
	var url="../store/wp-content/themes/default/buy-tracks-ajax.php"
	url=url+"?product_id="+prodid
	url=url+"&currency="+currency
	url=url+"&param=addalldigitalproduct"
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged2 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 



function stateChanged2() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 	 //alert(xmlHttp.responseText);
		 document.getElementById("smallcart").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;
}