// JavaScript Document
function ajaxlogin(url, containerid)
{
	var page_request = false
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject)
	{ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e)
		{
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
		catch (e){}
		}
	}
	else
		return false
	page_request.onreadystatechange=function()
	{
		loadpagelogin(page_request, containerid)
	}
	page_request.open('GET', url, true)
	page_request.send(null)
}

function loadpagelogin(page_request, containerid)
{
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
	{
		arr_resp = page_request.responseText.split('|');
		resp_code = arr_resp[0];
		if(resp_code =="0")
		{
			document.getElementById(containerid).innerHTML="<font color='red'>Incorrect Username or Password. Please reenter correct username/password.</font>";
		}
		if(resp_code =="1")
		{
			window.location.href="overview_myaccount.php";
		}
		if(resp_code =="2")
		{
			window.location.href="delivery_details.php";
		}
		if(resp_code =="3")
		{
			window.location.href="buy_did.php";
		}
		if(resp_code =="4")
		{
			window.location.href="sim_recharge.php";
		}
		if(resp_code =="5")
		{
			window.location.href="products.php?id=4";
		}
		//if(resp_code =="6")
		//{
		//	document.getElementById(containerid).innerHTML="<font color='red'>This Account has Sim Card so you cant buy the Product with Sim.If you want to buy the product please register with another user name and EmailId.</font>";
		//}
		if(resp_code =="9999")
		{
			window.location.href = arr_resp[1];
		}
		if(resp_code =="10")
		{
			window.location.href = "overview_aff_myaccount.php";
		}
	}
}