
       <!-- Hide Script
       function onloadfocus()
       {
          document.myform.name.focus();
       }

       function resetWhite(theForm)
       {
          theForm.name.style.background = 'white';
          theForm.email.style.background = 'white';
          theForm.tel.style.background = 'white';
          theForm.message.style.background = 'white';
          theForm.captchaHTML.style.background = 'white';
          theForm.name.focus();
       }

    function validateFormOnSubmit(theForm) {
    var reason = "";


      reason += validateName(theForm.name);
      reason += validateEmail(theForm.email);
      //reason += validatePhone(theForm.tel);
      reason += validateEmpty(theForm.message);
      reason += validateCaptchaHTML(theForm.captchaHTML);
         
      if (reason != "") {
        //alert("Some fields need correction:\n\n\n" + reason);
        return false;
      }

      //alert("All fields are filled correctly");
      return true;
    }
    function validateEmpty(fld) {
        var error = "";

        if (fld.value.length == 0) {
            fld.style.background = '#f1f453';
            error = "The required message field has not been filled in.\n\n\n"
        } else {
            fld.style.background = 'White';
        }
        return error; 
    }
    function validateName(fld) {
        var error = "";
        var illegalChars = /\W\ /; // allow letters, numbers, and underscores

        if (fld.value == "") {
            fld.style.background = '#f1f453';
            error = "Please enter your full name.\n\n";
        } else if (fld.value.length < 3) {
            fld.style.background = '#f1f453';
            error = "Your name should be in full and over 5 characters in length.\n\n";
        } else if (illegalChars.test(fld.value)) {
            fld.style.background = '#f1f453';
            error = "The name contains illegal characters.\n\n";
        } else {
            fld.style.background = 'White';
        }
        return error;
    }

    function trim(s)
    {
      return s.replace(/^\s+|\s+$/, '');
    }
    function validateEmail(fld) {
        var error="";
        var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
        var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
        var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
       
        if (fld.value == "") {
            fld.style.background = '#f1f453';
            error = "Please enter a valid email address.\n\n";
        } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
            fld.style.background = '#f1f453';
            error = "Please enter a valid email address.\n\n";
        } else if (fld.value.match(illegalChars)) {
            fld.style.background = '#f1f453';
            error = "The email address contains illegal characters.\n\n";
        } else {
            fld.style.background = 'White';
        }
        return error;
    }
    function validatePhone(fld) {
        var error = "";
        var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');   

       if (fld.value == "") {
            error = "Please enter your phone number including area code and omit spaces.\n\n";
            fld.style.background = '#f1f453';
        } else if (isNaN(parseInt(stripped))) {
            error = "The phone number contains illegal characters.\n\n";
            fld.style.background = '#f1f453';
        } else if (!(stripped.length == 11)) {
            error = "Make sure you included an area code and omit spaces. \nThe phone number should be 11 numbers in length.\n\n";
            fld.style.background = '#f1f453';
        }
          else {
            fld.style.background = 'White';
        }
        return error;
    }
    function validateCaptchaHTML(fld) {
        var error = "";
        var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');   

       if (fld.value == "") {
            error = "Please enter the result of the sum.\n\n";
            fld.style.background = '#f1f453';
        } else if (isNaN(parseInt(stripped))) {
            error = "The number is wrong.\n\n";
            fld.style.background = '#f1f453';
        } else if (!(stripped.length == 2)) {
            error = "The number is wrong.\n\n";
            fld.style.background = '#f1f453';
        }
          else {
            fld.style.background = 'White';
        }
        return error;
    }
    //End Hide Script-->
