// JavaScript Document

var xmlHttp;
function getXmlHttp()
{
	xmlHttp = null;
	try
	{	// For firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch(ex)
	{	// For Internet Explorer
		try
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(ex)
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
	return xmlHttp;
}

//////// Functions begin for toggle display username/password ////////
function uname_blur(val)
{
		xmlHttp=getXmlHttp()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		var url="select_username.php"
		url=url+"?q="+val
		
		//url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=validUsername
		xmlHttp.open("GET",url,true)		
		xmlHttp.send(null)
		if(document.getElementById("uname_res").innerHTML!="")
		{
			document.getElementById("uname").focus();
			return false;
		}
}
function validUsername() 
{
	var flag=0;
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 		
		document.getElementById("uname_res").innerHTML=xmlHttp.responseText
		flag=1		
	}
	if(document.getElementById("uname_res").innerHTML!="" && flag==1)
		{
			document.getElementById("uname").focus();
			return false;
		}
}

/////////// Function for cookie set/reset as a part of Remember me //////////////
function cky_one()
{
	if(document.login.coo_email.value==document.login.uname.value)
	{
		var a = document.login.coo_pword.value;
		document.login.passwd.value=a;
	}
}