/**************************************************************************************************************/
// Create xmlhttp object based on browsertype
function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
	  xmlhttp.overrideMimeType("text/xml"); 
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
/**************************************************************************************************************/
// Define global variables to be used throughout
var tableBusy = false;
var tableHttp = getHTTPObject();
var step1Over = false;
var row = "";
/**************************************************************************************************************/


function SaveToCart(form2,ProdNum)
{
	var strpull;
   var textval ="document.form1.qty_"+ProdNum;
	var strqty = eval(textval+".value");
	
	var textCheckval ="document.form1.pull_"+ProdNum;
		
		if (eval(textCheckval+".checked"))
			{
				strpull = eval(textCheckval+".value");
			}
		else
			{
				strpull = "n";
			}
				
	if (strqty > 0)
		{
			if (!tableBusy)
			{
				var url = "processSpecials1.asp?id="+ProdNum+"&qty="+strqty+"&pull="+strpull;
				tableHttp.open("POST", url, true);
				tableHttp.onreadystatechange = checkDivisionResponseCode;
				tableBusy = true;
				tableHttp.send(null);
			}
		}
		else
		{
		}	
   
}

function checkDivisionResponseCode()
{
	if (tableHttp.readyState == 4)
	
	{
		if (tableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var output = tableHttp.responseText;
				
				//document.write (output);
				
				if (output == "")
				{
					//document.form1.RssDeparment.options.length = 0;				
				}
				else
				{
					var stroutput = output.split(":");
					
					var TotalItems = stroutput[0];
					var TotalPrice = stroutput[1];
					document.getElementById("TotalItems").innerText=TotalItems
					document.getElementById("TotalPrice").innerText=TotalPrice
				}
				tableBusy = false;
				
			} // end try 
			catch(e)
			{
			alert("Error: " + e.description) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

