// JavaScript Document


function add2cartP(item)
{
new Ajax.Updater('orderdetails', 'add2cart.php', {
	method: 'post',
	parameters: { newitem: item },
	evalJSON: true
});

}


function delitemP(item)
{
new Ajax.Updater('orderdetails', 'delfromcart.php', {
	method: 'post',
	parameters: { delitem: item },
	evalJSON: true
});

}


function hidecart()
{
		// use jquery to set style of cart div to display:none
		document.OrderForm.PHTDM.checked = false;
		return true;
}


function add2cart(item)
{
	$("#orderdetails").load("add2cart.php", { 'newitem': item } );

}


function delitem(item)
{
		$("#orderdetails").load("delfromcart.php", { 'delitem': item } );

}


var xmlHttp;
function additem(item)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url="add2cart.php";
url=escape(url+"?newitem="+item);
url=url+"&rid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("POST",url,true);
xmlHttp.send(null);
}
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("orderdetails").innerHTML=xmlHttp.responseText;
 } 
 else
 {
 document.getElementById("orderdetails").innerHTML='Processing request...';
 }
}
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;
}