var name;var email;var message;function setVariables(){	name = document.contactForm.name;	email = document.contactForm.email;	message = document.contactForm.message;}function validateForm(){	setVariables();	return checkName();}function checkName(){		if(name.value == "" || name.value == "Type your name here" || name.value == "This field is required!" ){		document.getElementById("name").style.color = "#FF6600";		name.value = "This field is required!"		return false;	}else{		return checkEmail();	}}function checkEmail(){			if ((email.value=="")||(email.value=="Type your email here")||(email.value=="This field is required!")){		document.getElementById("email").style.color = "#FF6600";		email.value = "This field is required!";				return false;	}	if (echeck(email.value)==false){		document.getElementById("email").style.color = "#FF6600";		email.value = "Invalid email address!";				return false	}	return checkMessage(); }   function checkMessage(){		if(message.value == "" || message.value == "Type your message here" || message.value == "This field is required!" ){		document.getElementById("message").style.color = "#FF6600";		document.contactForm.message.value = "This field is required!";				return false;	}else{		return true;	} }  function resetField(fieldName){	setVariables();	if(fieldName == "name" && name.value =="Type your name here" || name.value =="This field is required!"){		document.getElementById("name").style.color = "#000000";		name.value = "";	}		if(fieldName == "email" && email.value =="Type your email here" || email.value =="This field is required!"  || email.value =="Invalid email address!"){		document.getElementById("email").style.color = "#000000";		email.value = "";	}		if(fieldName == "message" && message.value =="Type your message here" || message.value =="This field is required!"){		document.getElementById("message").style.color = "#000000";		message.value = "";	}}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						}function clearAll(){	document.getElementById("name").style.color = "#999999";	document.getElementById("email").style.color = "#999999";	document.getElementById("message").style.color = "#999999";		document.contactForm.name.value = "Type your name here";	document.contactForm.email.value = "Type your email here";	document.contactForm.company.value = "";	document.contactForm.phone.value = "";	document.contactForm.message.value = "Type your message here";}