//Validation
function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var i,a=0,b=0;
		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 ValidateForm(){
	var emailID=document.contact.email
	/*if (document.getElementById("subject-select").selectedIndex == 0){
		alert("Subject field required")
		return false;
		}*/
	if (checkspaces(document.contact.ytext.value) == false){
		alert("Your text  field required")
		return false;
	}
	if (checkspaces(document.contact.name.value) == false){
		alert("Name field required")
		return false;
	}
	if (checkspaces(document.contact.fname.value) == false){
		alert("First Name field required")
		return false;
	}
	if (checkspaces(document.contact.company.value) == false){
		alert("Company field required")
		return false;
	}
	if (checkspaces(document.contact.zcode.value) == false){
		alert("Zip Code field required")
		return false;
	}
	if (checkspaces(document.contact.city.value) == false){
		alert("City field required")
		return false;
	}
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Email field required")
		return false
	}
	if (echeck(emailID.value)==false){
		return false
	}
	return true
 }
function checkspaces(field){
	var compare=0;
	for (var i = 0; i < field.length; i++){
		if (field.charCodeAt(i)==32)
			compare++;
	}
	if (compare == field.length)
		return false
	else
		return true
}