function display(id,src)
{
	var element1 = document.getElementById("brand");
	var strbrand=element1.value;
	if(src==2)
		window.location.href="clreq.jsp?brand="+strbrand;
	else
		window.location.href="clreq.jsp?src=1&brand="+strbrand;
}
function Validate()
{
	var y = document.getElementById("mobile").value;

	if(y=="")
	{
		alert("Please enter your mobile no.");
		return false;
	}
	if(isNaN(y)||y.indexOf(" ")!=-1)
	{
		alert("Mobile number can not be alpha numeric");
		return false;  
	}
	if (y.length<10)
	{
		alert("Please enter mobile number eg 9363600001");
		return false;
	}

	if(y.length==10)
	{
		if(y.substring(0,1)!="9")
		{
			alert("Number should begin with 9");
			return false;
		}
	}
	return true;
}
function vlidateEmail()
{

   //return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

	var y = document.getElementById("email").value;	 
	var z = document.getElementById("password").value;	 
	if(z != "")
		return echeck(y);
	else
		return false;

}

function echeck(str)
{

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert("Invalid E-mail ID")
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Invalid E-mail ID")
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Invalid E-mail ID")
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    alert("Invalid E-mail ID")
	    return false
	 }
	
	 if (str.indexOf(" ")!=-1){
	    alert("Invalid E-mail ID")
	    return false
	 }

	 return true					
}


function submitform()
{
	if(Validate())
	{
		document.form1.submit();
	}
}
function logout()
{
	top.location.href="logout.jsp";
}
function submitform2()
{
	if(vlidateEmail())
	{
		//document.form2.submit();
		//window.location="index2.php?ui=0&ua=0&opt=forum"
		var y = document.getElementById("email").value;	
		var z = document.getElementById("password").value;	
		//window.location = "fetchuser.jsp?email=" + y + "&password=" + z;
		top.location.href= "fetchuser.jsp?email=" + y + "&password=" + z;
	}
}
function manage(email,pwd)
{
		var y = email;	
		var z = pwd;	
		top.location.href= "fetchuser.jsp?email=" + y + "&password=" + z;

}

function dwn()
{
top.location.href= "download.jsp";
}
