function GetAjaxStr(strurl)
{
	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.open("Get",strurl,false);
	xmlhttp.send();
	var strret=unescape(xmlhttp.ResponseText);
	return strret;
}
function send_Pricerequest(url,obj) 
  {
	http_Pricerequest = false;
	
	if(window.XMLHttpRequest) 
	{ 
		http_Pricerequest = new XMLHttpRequest();
		if (http_Pricerequest.overrideMimeType) 
		{
			http_Pricerequest.overrideMimeType("text/xml");
		}
	}
	else if (window.ActiveXObject) 
	{ 
		try 
		{
			http_Pricerequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
			{
				http_Pricerequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e) 
			{}
		}
	}
	if (!http_Pricerequest) 
	{ 
		return false;
	}
		http_Pricerequest.onreadystatechange = obj;

		http_Pricerequest.open("GET", url, true);
		http_Pricerequest.send(null);
}
  

function getCoupon(Coupon)
{
	if (Coupon!="")
	{
		send_Pricerequest("getCoupon.asp?Coupon="+Coupon+"&timestamp=" + new Date().getTime(),ShowResultP);	
	}
}

function ShowResultP()
{
  	  
	var rText="";
	
	if (http_Pricerequest.readyState == 4) 
	{
		if (http_Pricerequest.status == 200) 
		{
			rText=http_Pricerequest.responseText.replace(/^\s*/,"");
			
            if(rText=="")
			{
				document.getElementById("CouponText").innerHTML =  "Coupon Error";
			}
			else
			{

				document.getElementById("CouponText").innerHTML =  "";
				document.getElementById("discount").innerHTML=  parseInt(document.getElementById("discount").innerHTML, 10) +  parseInt(rText, 10);
				document.getElementById("Submits").disabled=true;
				var obj=document.getElementsByName("payment");
			    for (var i=0; i<obj.length; i++)
				{

					if (obj[i].checked==true)
					{
						 if(obj[i].value=='paypal')
						  {
							 document.getElementById("discount").innerHTML = parseInt(document.getElementById("discount").innerHTML, 10) + 5;
						  }
						  else
						  { 
							 document.getElementById("discount").innerHTML =  parseInt(document.getElementById("discount").innerHTML, 10) - 5;
							 price = (price * 0.95).toFixed(2);
						  }
					}
				}

				SetPrice();
			}
		}	
	}
	else
	{

	}
}

