var image1 = new Image();
image1.src = "images/submit_button.png";
var image2 = new Image();
image2.src = "images/submit_button_hover.png";

function val_form_this_page()
	{
	if (document.form1.name.value.length==0)
	{
		alert("Please Insert your Name");
		return false;
	}
	if (!ValidEmail(document.form1.email.value))
	{
      alert("Please enter a valid email address!");
      return false;
    }
	if (document.form1.phone.value.length==0)
	{
		alert("Please Insert your Phone No.");
		return false;
	}
	if (!valid_length(document.form1.query.value,10))
	{
		alert("Query must have minimum 10 characters!");
		return false;
	}	
}
function valid_length(item,len)
{
	return(item.length >=len);
}	
function ValidEmail(item) {
		emailcheck=item;
		//check for disallowed characters
		invalids=" -/:;,";
		for(i=0; i<invalids.length; i++){
			characto=(invalids.charAt(i));
			if (emailcheck.indexOf(characto) != -1){
				return false; }
		}
		//check for @, skip first character
		atindex= emailcheck.indexOf("@",1)
		if (atindex == -1){
			return false; }
		//check for only one @
		if (emailcheck.indexOf("@",atindex+1) != -1){
			return false;; 		}
		//check for dot after @
		dotindex=emailcheck.indexOf(".",atindex+1)
		if (dotindex == -1){
			return false; }
		//check for at least 2 chars after dot
		if ((dotindex+3) > emailcheck.length) {
			return false;;}
   return true;
	}

