/*function GetXmlHttpObject(handler) { 
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0) {
		alert("This example doesn't work in Opera") 
		return; 
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)	{ 
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP"
		} 
		try	{ 
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler 
			return objXmlHttp
		} catch(e) { 
			alert("Error. Scripting for ActiveX might be disabled") 
			return;
		} 
	} 
	if (navigator.userAgent.indexOf("Mozilla")>=0) {
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
}
*/

/*function _doCalculateDiscount(obj,sess_id) {
	alert(obj)
	var discount_code=document.getElementById('discount_code').value;
	if(discount_code!="")
	{
		var url="discountcalculation.php?obj=" + obj+"&sess_id="+sess_id+"&discount_code="+discount_code;
		ajaxRequest = GetXmlHttpObject(ReturnPrice);
		ajaxRequest.open("GET", url , true);
		ajaxRequest.send(null);
	}
	else
	{
		alert("Please enter a valid Discount Code");
	}
}

function ReturnPrice() {
	if (ajaxRequest.readyState==4 || ajaxRequest.readyState=="complete") {
		alert(ajaxRequest.responseText);
		document.getElementById("discountresult").style.display='';
		document.getElementById("idCost").innerHTML = ajaxRequest.responseText;
	}	
}
*/

var ajaxRequest;
var ajaxRequest = getXHTTP(); // This executes when the page first loads.

// JavaScript Document
function _doCalculateDiscount(sess_id,j_son) {
  //  Set our destination PHP page "ajaxpost.php"…
  ajaxRequest.open('POST', 'discountcalculation.php', true);
  ajaxRequest.onreadystatechange = ReturnPrice;
  alert(j_son);
  // Make our POST parameters string…
  var params = "obj=" +encodeURI(j_son)+
	"&sess_id=" + encodeURI(sess_id)+
	"&discount_code=" + encodeURI(document.getElementById("discount_code").value);

  // Set our POST header correctly…
  ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  ajaxRequest.setRequestHeader("Content-length", params.length);
  ajaxRequest.setRequestHeader("Connection", "close");

  // Send the parms data…
  ajaxRequest.send(params);
}

function ReturnPrice() {
	if (ajaxRequest.readyState==4 || ajaxRequest.readyState=="complete") {
		alert(ajaxRequest.responseText);
		document.getElementById("discountresult").style.display='';
		document.getElementById("idCost").innerHTML = ajaxRequest.responseText;
	}	
}


function getXHTTP( ) {
  var xhttp;
   try {   // The following "try" blocks get the XMLHTTP object for various browsers…
      xhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
 		 // This block handles Mozilla/Firefox browsers...
	    try {
	      xhttp = new XMLHttpRequest();
	    } catch (e3) {
	      xhttp = false;
	    }
      }
    }
  return xhttp; // Return the XMLHTTP object
}




/*var ajaxRequest = getXHTTP(); // This executes when the page first loads.
var strLoading = '<div align="center" style="padding-top:30px;" class="text11">Loading<br />Please wait...<br />\n';
	strLoading += '<img src="'+IMG_G_DIR+'loading.gif" />\n';
	strLoading += '</div>\n';
*/



