// JavaScript Document
//j script for with out registration
	function chk()
	{ 
	 if(val1())
		{
			document.loginfrmr.submit();
		} 
		else return false;
		
	}
	function val1()
	{ 
	 if(document.loginfrmr.txt_email2.value=="")
		{
			document.loginfrmr.txt_email2.focus();
			document.getElementById("err_lg1").innerHTML = "Enter your Email id";
			return false;
		}
		else if(!(document.loginfrmr.txt_email2.value.match (/^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/)))
			{
				document.getElementById("err_lg1").innerHTML = "Enter a valid E-mail";
				document.loginfrmr.txt_email2.focus();
				return false;
			} 
		else
		return true
	}
	function check_valid()
	{
		if(document.regfrm.txt_fname.value=="")
		{
		document.regfrm.txt_fname.focus();
		document.getElementById("err").innerHTML="Enter the First name!";
		return false;
		}
		if(document.regfrm.txt_lname.value=="")
		{
		document.regfrm.txt_lname.focus();
		document.getElementById("err").innerHTML="Enter the Last name!";
		return false;
		}
		
		var emailID=document.regfrm.txt_emailid;

		if ((emailID.value==null)||(emailID.value==""))
		{
			document.getElementById("err").innerHTML="Enter the Email Id!";
			emailID.focus()
			return false
		}
		if (echeck(emailID.value)==false)
		{
			emailID.value=""
			emailID.focus()
			return false
		}
		
		if(document.regfrm.txt_pass.value=="")
		{
		document.regfrm.txt_pass.focus();
		document.getElementById("err").innerHTML="Enter the Password!";
		return false;
		}
		if((document.regfrm.txt_pass.value.length) < 6)
		{
		document.regfrm.txt_pass.focus();
		document.regfrm.txt_pass.value="";
		document.regfrm.txt_cpass.value="";
		document.getElementById("err").innerHTML="Password is too short!";
		return false;
		}
		if(document.regfrm.txt_cpass.value=="")
		{
		document.regfrm.txt_cpass.focus();
		document.getElementById("err").innerHTML="Enter the Confirm Password!";
		return false;
		}
		if((document.regfrm.txt_pass.value)!=(document.regfrm.txt_cpass.value))
		{
		document.regfrm.txt_pass.focus();
		document.getElementById("err").innerHTML="Password and Confirm password not matching.!";
		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){
		   document.getElementById("err").innerHTML="Invalid E-mail ID!";
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		  document.getElementById("err").innerHTML="Invalid E-mail ID!";
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			document.getElementById("err").innerHTML="Invalid E-mail ID!";
			return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
			document.getElementById("err").innerHTML="Invalid E-mail ID!";
			return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			document.getElementById("err").innerHTML="Invalid E-mail ID!";
			return false
		 }

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

		return true					
	}
						
	function echeck1(str) 
	{
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   document.getElementById("err_lg").innerHTML="Invalid E-mail ID!";
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		  document.getElementById("err_lg").innerHTML="Invalid E-mail ID!";
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			document.getElementById("err_lg").innerHTML="Invalid E-mail ID!";
			return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
			document.getElementById("err_lg").innerHTML="Invalid E-mail ID!";
			return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			document.getElementById("err_lg").innerHTML="Invalid E-mail ID!";
			return false
		 }

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

		return true					
	} 				
						
	function chkNumeric(strString)
	   //  check for valid numeric strings	
	   {
		   var strValidChars = "0123456789";
		   var strChar;
		   var blnResult = true;		
		   if (strString.length == 0) return false;		
		   //  test strString consists of valid characters listed above
		   for (i = 0; i < strString.length && blnResult == true; i++)
			  {
				  strChar = strString.charAt(i);
				  if (strValidChars.indexOf(strChar) == -1)
					 {
					 blnResult = false;
					 }
			  }
   			return blnResult;
   		}

//for Form Check
						 
  function chk_login()
  {
	if(document.loginfrm.txt_email.value=="")
	{
	document.loginfrm.txt_email.focus();
	document.getElementById("err_lg").innerHTML="Enter  Email id!";
	return false;
	}
	
	var emailID=document.loginfrm.txt_email;

	if ((emailID.value==null)||(emailID.value==""))
	{
		document.getElementById("err").innerHTML="Enter the Email Id!";
		emailID.focus()
		return false
	}
	if (echeck1(emailID.value)==false)
	{
		emailID.value=""
		emailID.focus()
		return false
	}
	
	else if(document.loginfrm.txt_pwd.value=="")
	{
	document.loginfrm.txt_pwd.focus();
	document.getElementById("err_lg").innerHTML="Enter Password!";
	return false;
	}
}