
// JavaScript Document var url="getcustomer.asp?sid=" + Math.random() + "&q=" + str


	var xmlHttp
	
	function showListCheck(gift_code,gift_amount)
	{ 
	
		var url="./gift_coupon_payment_check_ajax.php?coupon_code=" + gift_code + "&coupon_amount=" + gift_amount;
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
		
	} 
	
	
	
	function stateChanged() 
	{ 
	
		var confirm_status;
			
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 

						
			if(xmlHttp.responseText == 1)
			{
								
								
				alert('Please enter a valid Gift Certificate code !!');
				document.frmGiftCouponPayment.gift_coupon_code.focus();
									
			}
			else if(xmlHttp.responseText == 2)
			{
				
				alert('Insufficient amount in the gift coupon,\nPlease choose other payment options !!');
			}
			else if(xmlHttp.responseText == 3)
			{
				
				alert('You cannot purchase some items in the cart using this Gift Certificate !!');
			}
			else
			{
				
				confirm_status = confirm('Are you sure you want to proceed with Gift Certificate payment !!');
												
				if(confirm_status == true)
				{
					
					document.frmGiftCouponPayment.submit();		
					
				}
				
				
			}
			
			
		} 
	} 
	
	
	
	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
			}
	} 