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 checkContactForm()
	{
	
	if ((contactForm.firstname.value==null)||(contactForm.firstname.value=="")){
		alert("Please enter your first name.")
		contactForm.firstname.focus()
		return false
	}

	if ((contactForm.lastname.value==null)||(contactForm.lastname.value=="")){
		alert("Please enter your last name.")
		contactForm.lastname.focus()
		return false
	}

	if ((contactForm.email.value==null)||(contactForm.email.value=="")){
		alert("Please enter email address.")
		contactForm.email.focus()
		return false
	}

	if (echeck(contactForm.email.value)==false){
		contactForm.email.value=""
		contactForm.email.focus()
		return false
	}

	if ((contactForm.phone.value==null)||(contactForm.phone.value=="")){
		alert("Please enter your phone number.")
		contactForm.phone.focus()
		return false
	}

	if ((contactForm.message.value==null)||(contactForm.message.value=="")){
		alert("Please enter your message.")
		contactForm.message.focus()
		return false
	}

	else
		return true;
 }


function checkDownloadForm()
	{
	
	if ((downloadForm.name.value==null)||(downloadForm.name.value=="")){
		alert("Please enter name.")
		downloadForm.name.focus()
		return false
	}

	if ((downloadForm.email.value==null)||(downloadForm.email.value=="")){
		alert("Please enter email address.")
		downloadForm.email.focus()
		return false
	}

	if (echeck(downloadForm.email.value)==false){
		downloadForm.email.value=""
		downloadForm.email.focus()
		return false
	}

	if ((downloadForm.phone.value==null)||(downloadForm.phone.value=="")){
		alert("Please enter phone number.")
		downloadForm.phone.focus()
		return false
	}

	if ((downloadForm.organisation.value==null)||(downloadForm.organisation.value=="")){
		alert("Please enter organisation.")
		downloadForm.organisation.focus()
		return false
	}

	else
		return true;
 }


function checkRegistrationForm()
	{
	
	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.password.value==null)||(registrationForm.password.value=="")){
		alert("Please enter password.")
		registrationForm.password.focus()
		return false
	}

	if (registrationForm.repassword.value!=registrationForm.password.value){
		alert("Entered password and re-type password is note same.")
		registrationForm.repassword.focus()
		return false
	}

	if ((registrationForm.firstname.value==null)||(registrationForm.firstname.value=="")){
		alert("Please enter first name.")
		registrationForm.firstname.focus()
		return false
	}
	
	if ((registrationForm.lastname.value==null)||(registrationForm.lastname.value=="")){
		alert("Please enter last name.")
		registrationForm.lastname.focus()
		return false
	}
	
	if ((registrationForm.phone.value==null)||(registrationForm.phone.value=="")){
		alert("Please enter phone number.")
		registrationForm.phone.focus()
		return false
	}

	if ((registrationForm.address1.value==null)||(registrationForm.address1.value=="")){
		alert("Please enter address.")
		registrationForm.address1.focus()
		return false
	}

	if ((registrationForm.city.value==null)||(registrationForm.city.value=="")){
		alert("Please enter city/town.")
		registrationForm.city.focus()
		return false
	}

	if ((registrationForm.state.value==null)||(registrationForm.state.value=="")){
		alert("Please enter province/state.")
		registrationForm.state.focus()
		return false
	}

	if ((registrationForm.postal.value==null)||(registrationForm.postal.value=="")){
		alert("Please enter postal/zip code.")
		registrationForm.postal.focus()
		return false
	}

	if ((registrationForm.country.value==null)||(registrationForm.country.value=="")){
		alert("Please enter country name.")
		registrationForm.country.focus()
		return false
	}

	else
		return true;
 }

 
 function checkHelpForm()
	{
	
	if ((helpForm.message.value==null)||(helpForm.message.value=="")){
		alert("Please enter your message.")
		helpForm.message.focus()
		return false
	}

	else
		return true;
 }