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 email address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid email address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid email address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid email address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid email address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid email address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid email address")
		    return false
		 }

 		 return true					
	}


function checkRegistrationForm()
	{
	
	if ((RegistrationForm.username.value==null)||(RegistrationForm.username.value=="")){
		alert("Please enter your username.")
		RegistrationForm.username.focus()
		return false
	}
	if ((RegistrationForm.title.value==null)||(RegistrationForm.title.value=="")){
		alert("Please enter title.")
		RegistrationForm.title.focus()
		return false
	}
	if ((RegistrationForm.firstname.value==null)||(RegistrationForm.firstname.value=="")){
		alert("Please enter your firstname.")
		RegistrationForm.firstname.focus()
		return false
	}
	if ((RegistrationForm.lastname.value==null)||(RegistrationForm.lastname.value=="")){
		alert("Please enter your lastname.")
		RegistrationForm.lastname.focus()
		return false
	}
	if ((RegistrationForm.company.value==null)||(RegistrationForm.company.value=="")){
		alert("Please enter your company.")
		RegistrationForm.company.focus()
		return false
	}
	
	if ((RegistrationForm.address.value==null)||(RegistrationForm.address.value=="")){
		alert("Please enter native address.")
		RegistrationForm.address.focus()
		return false
	}
	if ((RegistrationForm.city.value==null)||(RegistrationForm.city.value=="")){
		alert("Please enter city.")
		RegistrationForm.city.focus()
		return false
	}
	if ((RegistrationForm.state.value==null)||(RegistrationForm.state.value=="")){
		alert("Please enter state.")
		RegistrationForm.state.focus()
		return false
	}
	if ((RegistrationForm.country.value==null)||(RegistrationForm.country.value=="")){
		alert("Please enter country.")
		RegistrationForm.country.focus()
		return false
	}
	
	
	if ((RegistrationForm.zipcode.value==null)||(RegistrationForm.zipcode.value=="")){
		alert("Please enter zipcode.")
		RegistrationForm.zipcode.focus()
		return false
	}
	if ((RegistrationForm.phone.value==null)||(RegistrationForm.phone.value=="")){
		alert("Please enter phone.")
		RegistrationForm.phone.focus()
		return false
	}
	
	
	if ((RegistrationForm.email.value==null)||(RegistrationForm.email.value=="")){
		alert("Please enter email address.")
		RegistrationForm.email.focus()
		return false
	}

	if (echeck(RegistrationForm.email.value)==false){
		RegistrationForm.email.value=""
		RegistrationForm.email.focus()
		return false
	}
	if ((RegistrationForm.department.value==null)||(RegistrationForm.department.value=="")){
		alert("Please enter department.")
		RegistrationForm.department.focus()
		return false
	}
	if ((RegistrationForm.subject.value==null)||(RegistrationForm.subject.value=="")){
		alert("Please enter subject.")
		RegistrationForm.subject.focus()
		return false
	}
	if ((RegistrationForm.message.value==null)||(RegistrationForm.message.value=="")){
		alert("Please enter message.")
		RegistrationForm.message.focus()
		return false
	}
	else
		return true;
}

