function add_to_favorites()
{

	val = 0;
	if(document.login.email.value == ""){
		document.getElementById("email").style.backgroundColor = "#ECF9F9";
		document.getElementById("usernamemsgid").innerHTML = "<br/>User ID must be entered.";
		document.getElementById("email").focus();
		err = 0;
	 }else{
		
		document.getElementById("email").style.backgroundColor = "white";
		document.getElementById("usernamemsgid").innerHTML = "";
		val = 1;
	}


	if(document.login.password.value == ""){
		document.getElementById("passwordid").style.backgroundColor = "#ECF9F9";
		document.getElementById("passwordmsgid").innerHTML = "<br/>Password must be entered.";
		document.getElementById("passwordid").focus();
		val = 0;
	 }else{
		document.getElementById("passwordid").style.backgroundColor = "white";
		document.getElementById("passwordmsgid").innerHTML = "";
		val = 1;
	}

	if(val == 0){
		return false;
	}else{
		return true;
	}
	 
	 
}



function validateEmail(emailId){
	xmlHttp = GetXmlHttpObject();
	
	if(xmlHttp == null) { 
		alert("Browser does not support HTTP Request");
		return;
	}
	
	var url = "http://login.expressindia.com/validateEmail.php"
	url = url+"?username="+emailId
	xmlHttp.onreadystatechange = stateChangedEmail
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)	
}
// to validate email in signup
function valEmail(emailid)
	{
	//alert(emailid);
	if(emailid=="")
		{
			document.getElementById("txtEmail").innerHTML = "<font color='red'><b>Email cann't be blank!</b></font>";
		}
	else
		{
					xmlHttp = GetXmlHttpObject();
				
				if(xmlHttp == null) { 
					alert("Browser does not support HTTP Request");
					return;
				}
				//alert(emailid);
				var url = "validateSignupEmail.php"
				url = url+"?emailid="+emailid
				xmlHttp.onreadystatechange = stateChangedsignUpEmail
				xmlHttp.open("GET",url,true)
				xmlHttp.send(null)
		}
	}

// to validate username for sign up
function validateUser(userid){
	
	if(userid=="")
	{
		document.getElementById("txtMess").innerHTML = "<font color='red'><b>Username cann't be blank!</b></font>";
	}
	else
	{
		xmlHttp = GetXmlHttpObject();
		
		if(xmlHttp == null) { 
			alert("Browser does not support HTTP Request");
			return;
		}
		
		var url = "validateEmail.php"
		url = url+"?username="+userid
		xmlHttp.onreadystatechange = stateChanged
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
}

// State Changed  username signup
function stateChanged() 
{ 
	
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{ 
		//alert(xmlHttp.responseText);
		if(xmlHttp.responseText == 1)
		{
			document.getElementById("txtMess").innerHTML = "<font color='red'><b>Username already exists!</b></font>";
			document.frmReg.username.value = "";
			
		}
		else
		{
			document.getElementById("txtMess").innerHTML = "";
			return true;
		}

	}
	else{
		document.getElementById("txtMess").innerHTML = "<img src='http://static.indianexpress.com/frontend/loginv2/images/search_process.gif' />";
	} 

}