        //______________________________
        //Function for checking number fields for empty and nonnumeric values.
        //______________________________
        function isNum(str)	{
	        for(i=0; i <str.length ; i++)	{
		   if(str.charAt(i) > "9")	{
			return false;
	           }
		if (str.charAt(i) < "0")	{
			return false;
	        }

        	}
		return true;
	}

	function validEmail(email) {
		var invalidChars =" /:,;";

		if (email.length == "") {
			alert("Your email address shouldn't be empty!");
			document.ContactUs.email.focus();
			return false;
		}
   
                for (i=0; i<invalidChars.length; i++) {
			badChar = invalidChars.charAt(i);
			if (email.indexOf(badChar,0) > -1) { 	//it searches invalidChars string
				alert("Your email contains invalid characters!");
				document.ContactUs.email.focus();
				return false;
			}
		}

		var atPos = email.indexOf("@",1);
		if (atPos == -1) {				 //it checks if email contains any @ character.
			alert("Your email address doesn't contain @ character!");
			document.ContactUs.email.focus();
			return false;
		}

		if (email.indexOf("@",atPos+1) > -1) {		//it checks if email contains more than one @ character, if there is gives an error message.
			alert("Your email contains more than one @ character!");
			document.ContactUs.email.focus();
			return false;
		}

		var periodPos = email.indexOf(".",atPos);
		if (periodPos == -1) {				//it checks that there is a period after the @ sign, if not gives an error message.
			alert("Your email doesn't contain dot character after the @ character!");
			document.ContactUs.email.focus();
			return false;
		}

		if (periodPos+3 > email.length) {		//it checks if is there at least two characters after the dot character.
			alert("Your email should contain at least two characters after the dot character.");
			document.ContactUs.email.focus();
			return false;
		}
		return true;
	}
	

        function checkForm() {
	   	   
		var name = document.ContactUs.name.value;
		if(name <= 0)	{
			alert("Please enter your name");
			document.ContactUs.name.focus();
			return false;
		}
 		var phone = document.ContactUs.phone.value;
		if(phone.length <= 7)	{
			alert("Phone must be at least 8 digits");
			document.ContactUs.phone.focus();
			return false;
		}
		else {
			if(isNum(phone) == false)  {
				alert("Phone is not numeric");
				document.ContactUs.phone.focus();
				return false;
			}
      		}
  		var message = document.ContactUs.message.value;
		if(message <= 0)	{
			alert("Please enter your message");
			document.ContactUs.message.focus();
			return false;
		}
		var email = document.ContactUs.email.value;
		if (validEmail(email) == false) {
			return false;
		}
    		return true;

	} 

         
	// End hiding script from old browsers -->
 