// JavaScript Document
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 ValidateFormLogin(){

	if ( ( document.loginform.account_type[0].checked == false )
    && ( document.loginform.account_type[1].checked == false ))
    {
        alert ( "Please choose Your Account Type: Individual Account or Corporate Account" );
        return false;
    }

//for input name
	
	var name=document.loginform.name
	if(name.value.length == 0){
		alert("Please Enter Your Name");
		name.focus(); // set the focus to this input
		return false;
	}
//for from email
	var semail=document.loginform.semail	
	if ((semail.value==null)||(semail.value=="")){
		alert("Please Enter your Email ID")
		semail.focus()
		return false
	}
	if (echeck(semail.value)==false){
		semail.value=""
		semail.focus()
		return false
	}
	var password=document.loginform.password
	if(password.value.length == 0){
		alert("Please Enter Your Password");
		password.focus(); // set the focus to this input
		return false;
	}
	var cpassword=document.loginform.cpassword
	if(cpassword.value.length == 0){
		alert("Please Enter Your Password");
		cpassword.focus(); // set the focus to this input
		return false;
	}	
	password1 = document.loginform.password.value;
	cpassword2 = document.loginform.cpassword.value;
	if(password1!=cpassword2)
		{
		alert("Password and Re-Password are Not Equal");
		return false;
		cpassword2.focus();
		}
return true
 }

function ValidateFormLogin2()
{
	var Email=document.loginform2.Email	
	if ((Email.value==null)||(Email.value=="")){
		alert("Please Enter your Email ID")
		Email.focus()
		return false
	}
	if (echeck(Email.value)==false){
		Email.value=""
		Email.focus()
		return false
	}
	var Password=document.loginform2.Password
	if(Password.value.length == 0){
		alert("Please Enter Your Password");
		Password.focus(); // set the focus to this input
		return false;
	}
  document.form.submit();	
}
function forgotemailcheck()
{
	var bill_email=document.forgotpassword.bill_email	
	if ((bill_email.value==null)||(bill_email.value=="")){
		alert("Please Enter your Email ID")
		bill_email.focus()
		return false
	}
	if (echeck(bill_email.value)==false){
		bill_email.value=""
		bill_email.focus()
		return false
	}
}