function validate_email(field){
         if (field.length < 6) return false;
         var filter=/^.+@.+\..{2,3}$/
         if (filter.test(field))
             return true;
         return false;
}
function isValidNumber(str){
        regex =  /[^0-9]/i;
        if (regex.test(str))
                return true;
        else
                return false;
}
function validatercquoteform(){
        var alertMsg = 'Please complete the following fields:\n';
        var l_Msg = alertMsg.length;
         var myroomcount = document.forms["requestquote"].elements["numrooms"].selectedIndex + 1;
         var mynumpax = document.forms["requestquote"].elements["adults"].selectedIndex + 1;
         var mycontacttype = document.forms["requestquote"].elements["contactmethod"].selectedIndex;
         var myfirstname = document.forms["requestquote"].elements["first"].value;
         var mylastname = document.forms["requestquote"].elements["last"].value;
         var mypostalcode = document.forms["requestquote"].elements["tpostalcode"].value;
         var myemail = document.forms["requestquote"].elements["email"].value;
         var myreemail = document.forms["requestquote"].elements["reemail"].value;
         var myphoneareacode = document.forms["requestquote"].elements["tcodearea"].value;
         var myphonenumber = document.forms["requestquote"].elements["tnumberphone"].value;
         if (myfirstname.length < 3)
             alertMsg += '- First Name\n';
         if (mylastname.length < 3)
             alertMsg += '- Last Name\n';
         if (mypostalcode.length == 0)
            alertMsg += '- Postal Code Missing\n';
         if (mypostalcode.length > 0 && mypostalcode.length < 5)
            alertMsg += '- Incorrect Postal Code.  You need at least 5 characters. If your country does not support at least 5 characters or does not have postal codes, then please try one of the following: \n 1) Pad zeros before your postal code to make into 5 characters \n 2) Put the name of your country\n';
         if (!validate_email(myemail) || myemail != myreemail)
             alertMsg += '- Email Address\n';
         if (myroomcount > mynumpax)
             alertMsg += "- There are more cabins than the number of passengers\n";
         if (mycontacttype == 2 && (myphoneareacode.length < 3 || myphonenumber.length < 7 || isValidNumber(myphoneareacode) || isValidNumber(myphonenumber)))
             alertMsg += '- Contact Number\n';
         if (alertMsg.length == l_Msg){
                requestquote.mysubmitbttn.disabled = true;
                return true;
         }
        alert(alertMsg);
        return false;

}
function changecontacttype(){
         var mycontacttype = document.getElementById("contactmethod").selectedIndex;
     if (mycontacttype == 2)
          document.getElementById("scontacttype").style.display = '';
     else
         document.getElementById("scontacttype").style.display = 'none';
}
