function validateForm(){
	if ( validateName() && email_Length() && email_Valid(document.aweberform.from.value) && validateClickBankId() && validatePassword() ){
		return true;
	}else{
		return false;
	}
}


function validateName(){
	var name=document.aweberform.name.value;
	
	if (name==null || name==""){
		alert ("Please enter your Name");
		document.aweberform.name.focus();
		return false;
	}
	return true;
}

function email_Length(){

	var emailID=document.aweberform.from.value;
	if ((emailID==null)||(emailID=="")){
		alert("Please enter your Email address.");
		document.aweberform.from.focus();
		return false;
	}
	if ((emailID.length < 5)){
		alert("Email address should be a valid one and more than 5 characters.");
		document.aweberform.from.focus();
		return false;
	}
	return true;
	
}

function email_Valid(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 Email address. Please try again.");
	   document.aweberform.from.focus();
	   return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		alert("Invalid Email address. Please try again.");
		document.aweberform.from.focus();
		return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Invalid Email address. Please try again.");
		document.aweberform.from.focus();
		return false;
	}

	if (str.indexOf(at,(lat+1))!=-1){
		alert("Invalid Email address. Please try again.");
		document.aweberform.from.focus();
		return false;
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Invalid Email address. Please try again.");
		document.aweberform.from.focus();
		return false;
	}

	if (str.indexOf(dot,(lat+2))==-1){
		alert("Invalid Email address. Please try again.");
		document.aweberform.from.focus();
		return false;
	}
		
	if (str.indexOf(" ")!=-1){
		alert("Invalid Email address. Please try again.");
		document.aweberform.from.focus();
		return false;
	}

 	return true;
}


function validateClickBankId(){
	var cbid=document.getElementById("nick").value;
	
	if (cbid==null || cbid==""){
		alert ("Please enter your Clickbank ID");
		document.getElementById("nick").focus();
		return false;
	}
	return true;
}

function validatePassword(){
	var pword=document.getElementById("passwd").value;
	
	if (pword==null || pword==""){
		alert ("Please enter your Password");
		document.getElementById("passwd").focus();
		return false;
	}
	return true;
}