//var secureURL = "http://localhost:8080/MySpaceAfter";
//var insecureURL = "http://localhost:8080/MySpaceAfter";
function MemorialCheck(userName,secureURL)
{
	if(userName != "null")
	{
		 var URL = "./MemorialModuleControllerURL?Action=personalMemorialPage";
		 
		 window.location = URL; 
		
	}
	else
	{
		/*var result = confirm("Login Required");
		if(result == true)
		{*/
		var newURL = secureURL+"/CommonActionServletURL?Action=login";
		window.location=newURL;
		/*}
		else
		{
		}*/
	}
} 


/*function LegacyCheck(userId)
{
	if(userId != "null")
	{
		 var URL = "./LegacymoduleControllerURL?Action=funeraljsp";
		 
		 window.location = URL; 
		
	}
	else
	{
		var result = confirm("Login Required");
		if(result == true)
		{
		var newURL = "./CommonActionServletURL?Action=login";
		window.location=newURL;
		}
		else
		{
		}
	}
}*/ 


function LegacyCheck(userId,secureURL)
{
	if(userId != "null")
	{
		 //Ajax call for checking payment
		 var xmlHttpEx;
	
		try
		{
			//Firefox, Opera 8.0+, Safari
			xmlHttpEx = new XMLHttpRequest();
		}
		catch(e)
		{
			//Internet Explorer
			try
			{
				xmlHttpEx = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e)
			{
				try
				{
					xmlHttpEx = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e)
				{
					alert("Your browser doesnot support AJAX");
					return false;
				}
			}
		}
	
		xmlHttpEx.onreadystatechange = function()
		{
			//alert(xmlHttpEx.readyState);
			//alert(xmlHttpEx.status);
		
			if(xmlHttpEx.readyState == 4 && xmlHttpEx.status == 200)
			{
				//alert(xmlHttpEx.responseText);
			
				if(xmlHttpEx.responseText > 0)
				{
					//alert("You have already subscribed for legacy");
					//return false;
					var URL = secureURL+"/LegacymoduleControllerURL?Action=funeraljsp";
		 			window.location = URL; 	
				}
				else
				{
					//window.location="./PaymentModuleControllerURL?Action=legacy";
					legacyUrl = secureURL+"/PaymentModuleControllerURL?Action=legacy";
					window.open(legacyUrl,'LegacyWindow','width=800,height=600,scrollbars=yes,left=100,top=120');
				}
			}
		
		}
		var rand = Math.random();
	
		var url="./PaymentCheckServletURL";
		url = url+"?userId="+userId;
		url = url+"&rand="+rand;
		xmlHttpEx.open("GET",url,true);
		xmlHttpEx.send(null);
	
	    
		 
	}
	else
	{
		/*var result = confirm("Login Required");
		if(result == true)
		{*/
		var newURL = secureURL+"/CommonActionServletURL?Action=login";
		window.location=newURL;
		/*}
		else
		{
		}*/
	}
} 
