
function register_enduserform(form){
	
	var errors="";
	var emailID=form.email;
	
	if(((form.fullname.value)==0)||
		((form.lastname.value)==0)||
		((form.country.value)==0)||
		((form.email.value)==0)||
		((form.profession.value)==0)||
		((form.username.value)==0)||
		((form.formalpassword.value)==0)||
		((form.cpassword.value)==0))
	{
		alert("Please complete all the mandatory fields!");
        
		return false;
	}
	
	
	if((form.cpassword.value)!=(form.formalpassword.value))
		{
			alert("Please Re-enter Confirm Password");
			form.cpassword.focus();
			return false;
		}
	
	
	if (echeck(emailID.value)==false){
		emailID.value="";
		emailID.focus();
		return false;
		}
	
	
}

function register_userform(form){
	
	var errors="";
	var emailID=form.email;
	
	if(((form.legalname.value)==0)||
		((form.organisation.value)==0)||
		((form.country.value)==0)||
		((form.address.value)==0)||
		((form.city.value)==0)||
		((form.postcode.value)==0)||
		((form.phone.value)==0)||
		((form.fax.value)==0)||
		((form.website.value)==0)||
		((form.email.value)==0)||
		((form.contactperson.value)==0)||
		((form.username.value)==0)||
		((form.formalpassword.value)==0)||
		((form.cpassword.value)==0))
	{
		alert("Please complete all the mandatory fields!");
        
		return false;
	}
	
	
	if((form.cpassword.value)!=(form.formalpassword.value))
		{
			alert("Please Re-enter Confirm Password");
			form.cpassword.focus();
			return false;
		}
	
	
	if (echeck(emailID.value)==false){
		emailID.value="";
		emailID.focus();
		return false;
		}
	
	
}

function login_form(form){
	
		
	if(((form.username.value)==0)||
		((form.password.value)==0))
	{
		alert("Please fill in Username and Password");
        
		return false;
	}
	
			
}

function password_form(form){
	
		
	if(((form.username.value)==0)||
		((form.email.value)==0))
	{
		alert("Please complete all the mandatory fields!");
        
		return false;
	}
	
			
}

function insert_announc(form){
	if(((form.announctitle.value)==0)||
		((form.announcdesc.value)==0))
	{
		alert("You have not complete all fields!");
        
		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;					
	}

