var xmlHttp
var showCart=document.getElementById('showCart')

function shoppingCart(inventory, quantity, action, destination)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 
if (destination=='cart') {
var url="includes/shopping_panel.php"
}

if (destination=='checkout') {
var url="includes/checkout_panel.php"
}

if (destination=='home') {
var url="includes/shopping_panel_home.php"
}

url=url+"?invID="+inventory
url=url+"&qty="+quantity
url=url+"&action="+action
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged2
xmlHttp.open("GET",url,true)
xmlHttp.send(null)


}

function stateChanged2() 
{ 
if(xmlHttp.readyState == 1) 
	{
       document.getElementById('showCart').innerHTML = '<div align="center" class=""><br><img src="images/ajax-loader.gif"><br><br>Shopping Cart<br>Loading</div>';
	}
	
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById('showCart').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;
}
