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


	var xmlHttp
	var prdcode
	
	function showListCheckDownload(username,password,download_code,p_flag)
	{ 
	  
		prdcode = download_code;
	
		var url="./product_download_check_ajax.php?user_name=" + username + "&password=" + password + "&download_product_code=" + download_code+ "&p_flag=" + p_flag;
						
		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(INVALID_USER_MSG);
													
			}
			else if(xmlHttp.responseText == 2)
			{
								
				//alert('Download count exceeded, you cannot download the product anymore !!');
				alert(INVALID_USER_AUTH);
													
			}
			else if(xmlHttp.responseText == 3)
			{
								
				alert(DOWNLOAD_COUNT_EXCEED);
																	
			}
			else if(xmlHttp.responseText == 4)
			{
								
				alert(DOWNLOAD_DATE_EXPIRED);
																	
			}
			else if(xmlHttp.responseText == 5)
			{
								
				alert(INVALID_DOWNLOAD_LINK);
																	
			}
			else
			{
				
                              window.location = ('./digital_product_download_access.php?download_code=' + prdcode);


				/*confirm_status = confirm('Are you sure you want to download the product !!');
												
				if(confirm_status == true)
				{
					
					window.location = ('./digital_product_download_access.php?download_code=' + prdcode);
															
				}*/
				
				
			}
			
			
		} 
	} 
	
	
	
	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
			}
	} 