// JavaScript Document

function addToCart(id)
{
	var xmlHttp;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		try
		  {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e)
		  {
		  alert("Your browser does not support AJAX!");
		  return false;
		  }
		}
	  }
	  xmlHttp.onreadystatechange=function()
		{
		if(xmlHttp.readyState==4){  
			window.location.href='https://www.braunbloodpressuremonitors.com/heart-health/order-now/'; 
		  }
		}
	  xmlHttp.open("GET","/ajax/Cart.php?passed=addToCart&productId="+id,true);
	  xmlHttp.send(null);
}

function updateCart(id, quant){
	var xmlHttp;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		try
		  {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e)
		  {
		  alert("Your browser does not support AJAX!");
		  return false;
		  }
		}
	  }
	  xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){  
			window.location.href='https://www.braunbloodpressuremonitors.com/heart-health/order-now/'; 
		  }
	   }
	   xmlHttp.open("GET","/ajax/Cart.php?passed=updateCart&productId="+id+"&quant="+quant,true);
	   xmlHttp.send(null);
}

function deleteItem(id)
{
	var xmlHttp;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		try
		  {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e)
		  {
		  alert("Your browser does not support AJAX!");
		  return false;
		  }
		}
	  }
	  xmlHttp.onreadystatechange=function()
		{
		if(xmlHttp.readyState==4){
		  	window.location.href='https://www.braunbloodpressuremonitors.com/heart-health/order-now/';
		  }
		}
	  xmlHttp.open("GET","/ajax/Cart.php?passed=deleteItem&productId="+id,true);
	  xmlHttp.send(null);
}
/* create a popup with the provided link, window, width and height */
function sizedPopup( linkname, windowname, ww, wh ) {
	var href;

	if( !window.focus ) return true;

	if( typeof( linkname ) == 'string' ) { href = linkname; }
	else { href = linkname.href; }

	window.open( href, windowname, 'width='+ ww +', height= '+ wh +' ,scrollbars=no, resizable=no');

	return false;
}
