// JavaScript Document
function account_validation()
{
var obj=document.signup;


if(obj.login_id.value=="")
{
alert("user name field should not blank.");
obj.login_id.focus();
return false;
}

if(obj.password.value=="")
{
alert("password field should not blank.");
obj.password.focus();
return false;
}
if(obj.cpd.value=="" || obj.cpd.value!=obj.password.value)
{
alert("Confirm password field should match the password field.");
obj.cpd.focus();
return false;
}


if(obj.fname.value=="")
{
alert("First Name field should not blank.");
obj.fname.focus();
return false;
}



if(obj.email_id.value=="")
{
alert("email should not blank.");
obj.email_id.focus();
return false;
}

var str=obj.email_id.value
		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")
		   obj.email_id.value="";
		   obj.email_id.focus();
		   return false
		}

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

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

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

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

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

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    obj.email_id.value="";
		    obj.email_id.focus();
		    return false
		 }
		 
		 
		 
		 
		 if(obj.ph_no.value=="")
{
alert("Phone number should not blank.");
obj.ph_no.focus();
return false;
}
if ((parseInt(obj.ph_no.value) != obj.ph_no.value) || parseInt(obj.ph_no.value) < 1)
{ 
alert("plz give a number between 0 to 9");
obj.ph_no.value="";
obj.ph_no.focus();
return false; 
}
if(parseInt( obj.ph_no.value.length) > 20 )
{
alert("plz give a number between 0 to 9");
obj.ph_no.value="";
obj.ph_no.focus();
return false; 	
}




}











