			function hidecontactresult(){
			document.getElementById("contactresult").innerHTML="";
			}
	

			function sendcontact() { 
			   var validate= true;
			   var fname=document.contact.fname.value; var lname=document.contact.lname.value;
				var email=document.contact.email.value; var phone=document.contact.phone.value;
				var fax=document.contact.fax.value;
				 var country=document.contact.country.value;
				var comments=document.contact.comments.value;
				if(fname== ""){ alert("enter your first name!");
				document.contact.fname.focus(); validate=false; }
				else if(lname== ""){ alert("enter your last name!");
				document.contact.lname.focus(); validate=false; }
				else if(email== ""){ alert("enter an email!");
				document.contact.email.focus(); validate=false;  }
				else if(validateEmailv2(email)== false){ alert("enter a valid email!");
				document.contact.email.focus(); validate=false;  }
				else if(phone== ""){ alert("enter your phone number!");
				document.contact.phone.focus(); validate=false; }
				else if(ValidPhone(phone)==false){alert("your phone number must be only digits!");
				document.contact.phone.focus(); validate=false;}
				else if(ValidPhone(fax)==false){alert("your fax number must be only digits!");
				document.contact.fax.focus(); validate=false;
					}
				else if(country==""){ alert("choose your country!");
				document.contact.country.focus(); validate=false; }
				
				
				if(validate==true){
				
				
				
					var xmlHTTP;

	try
	{
		xmlHTTP = new XMLHttpRequest();
	}
	catch(err)
	{
		try
		{
			xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(err)
		{
			try
			{
				xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(err)
			{
				return false;
			}
		}
	}
		
var url = "contact.php";
var params = "fname="+fname+"&lname="+lname+"&email="+email+"&phone="+phone+"&fax="+fax+"&country="+country+"&comments="+comments;
xmlHTTP.open("POST", url, true);

//Send the proper header information along with the request
xmlHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHTTP.setRequestHeader("Content-length", params.length);
xmlHTTP.setRequestHeader("Connection", "close");

xmlHTTP.onreadystatechange = function()
	{
		if(xmlHTTP.readyState == 4)
		{
			var resp;
			//var aResponse = new Array();
			//var buffer;
			resp = xmlHTTP.responseText;
			document.getElementById("contactresult").innerHTML = resp;

		}
		if(xmlHTTP.readyState == 1)
		{
		document.getElementById("contactresult").innerHTML ="<div align=center><img src=\"images/loader.gif\"></div>";
					document.contact.fname.value=""; document.contact.lname.value=""; document.contact.phone.value=""; document.contact.email.value=""; document.contact.fax.value=""; document.contact.comments.value=""; document.contact.country.options[0].selected=true;
			
		}
	}

xmlHTTP.send(params);
				
				
				}
				

setTimeout("hidecontactresult()",5000);
		
				
			}
			
			
			
			function ValidPhone(aphone)
{
// declare valid variable as a string with all valid characters (digits from 0 to 9 )
    var valid = "0123456789";
//if phone field is empty - display a warning and return false
        
        //check each character entered in the phone field 
         for (var i=0; i < aphone.length; i++)
         {
         //put in temp variable each character, one at a time.
         temp = "" + aphone.substring(i, i+1);
    //check index of a phone character in the "valid" variable.
    // if temp contains a character which is not in "valid" variable, 
    //then valid.indexOf(temp) will be -1, otherwise it may be 0.1.2.3.4.5.6.7.8 or 9

         if (valid.indexOf(temp) == "-1") 
         {
 
          return false;
         }
    }
    //if all conditions are passed, then return true
    return true;
}