function validateForm(){
	if (validateName()==true && ValidateEmail()==true && validatePhone()==true && validateCountry()==true && validateService()==true && validateProjDesc()==true){
		return true;
	}else{
		return false;
	}
}

function validateName(){
	var name=document.contact.uname;
	if ((name.value==null)||(name.value=="")){
		alert("Please Enter your name");
		name.focus();
		return false;
	}else{
		return true;
	}
}

function ValidateEmail(){
	var emailID=document.contact.uemail;
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your email address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		//emailID.value=""
		emailID.focus();
		emailID.select();
		return false
	}
	return true
 }

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 validatePhone(){
	var phone=document.contact.utnumber;
	if ((phone.value==null)||(phone.value=="")){
		alert("Please Enter your telephone number");
		phone.focus();
		return false;
	}else{
		return true;
	}
}

function validateCountry(){
	var country=document.contact.ucountry.options[document.contact.ucountry.selectedIndex].text;
	if ((country=="SELECT")){
		alert("Please select your country");
		document.contact.ucountry.focus();
		return false;
	}else{
		return true;
	}
}

function validateService(){
	var country=document.contact.whatyou.options[document.contact.whatyou.selectedIndex].text;
	if ((country=="Choose one")){
		alert("Please select the service that you wish to try");
		document.contact.whatyou.focus();
		return false;
	}else{
		return true;
	}
}

function validateProjDesc(){
	var projDesc=document.contact.uprojdetails;
	if ((projDesc.value==null)||(projDesc.value=="")){
		alert("Please provide us with a description about your requirement?");
		projDesc.focus();
		return false;
	}else{
		return true;
	}
}
