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 stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("productdetails_id").innerHTML=xmlHttp.responseText;
	}
}


function productdetails(product_id)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="product_details.php";
	url=url+"?product_id="+product_id;
	
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function add_product(product_id)	//product_id
{
	//alert("hi");
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var prod_qty   = document.shop.prod_qty.value;
	var url="add_product.php";
	url=url+"?product_id="+product_id+"&prod_qty="+prod_qty;
	
	
	xmlHttp.onreadystatechange=addProdstateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



function addProdstateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("addprod").innerHTML=xmlHttp.responseText;
	//document.getElementById("addprod").innerHTML="Product Added";
	}
}
function form_submit()
{
	document.shop.submit();
}
