function isInCharset(string,stripit) { //steps through string looking for occurance of charset stripit
        var i;
        var whattoreturn;
        whattoreturn=true;
        for (i = 0; i < string.length; i++) {
                if (!stripit.test(string.charAt(i))) {
                        whattoreturn = false;
                        }
                }
        return whattoreturn;
}

var emailallow = /^[a-z_0-9\.\-]+@[a-z_0-9\.]+\.[a-z]{2,3}$/i

function submitthis() {
        
		if (document.form.esname.value=='') { alert('Your Establishment Name is required.'); document.form.esname.focus(); } else
        if (document.form.esname.value.length < 2) { alert('Your Establishment Name must be at least 2 characters.'); document.form.esname.focus(); } else
        if (!isInCharset(document.form.esname.value,/^[a-z&'\s]$/i)) { alert('Your Establishment Name contains illegal characters.  Please enter only letters.'); document.form.esname.focus(); } else

        if (document.form.wname.value=='') { alert('Your Web Site is required. Enter NA if you don not have one.'); document.form.wname.focus(); } else
        if (document.form.wname.value.length < 3) { alert('Your Web Site must be at least 3 characters.'); document.form.wname.focus(); } else
        if (!isInCharset(document.form.wname.value,/^[a-z&'\s\-.]$/i)) { alert('Your Web Site contains illegal characters.  Please enter only letters.'); document.form.wname.focus(); } else

        if (document.form.conname.value=='') { alert('Your Contact Name is required.'); document.form.conname.focus(); } else
        if (document.form.conname.value.length < 2) { alert('Your Contact Name must be at least 2 characters.'); document.form.conname.focus(); } else
        if (!isInCharset(document.form.conname.value,/^[a-z&0-9'\s\-.]$/i)) { alert('Your Contact Name contains illegal characters.'); document.form.conname.focus(); } else

		if (document.form.email.value=='') { alert('Your E-mail address is required.'); document.form.email.focus(); } else
        if (!emailallow.test(document.form.email.value)) { alert('Your E-mail address is invalid. E-mail addresses should follow the form: your-userid@domain-name.domain-type.  Your userid and domain name should contain only letters, numbers, the hyphen, and the underscore.'); document.form.email.focus(); } else
        if (!isInCharset(document.form.email.value,/^[a-z&0-9_\-\.@]$/i)) { alert('Your E-mail address contains illegal characters. E-mail addresses should follow the form: your-userid@domain-name.domain-type.  Your userid and domain name should contain only letters, numbers, the hyphen, and the underscore.'); document.form.email.focus(); } else
		
		if (document.form.addr.value=='') { alert('Your Address is required.'); document.form.addr.focus(); } else
		if (document.form.addr.value.length < 5) { alert('Your Address must be at least 5 characters.'); document.form.addr.focus(); } else
		if (!isInCharset(document.form.addr.value,/^[a-z0-9_ \-\.@&]$/i)) { alert('Your Address contains illegal characters.  Please enter only letters.'); document.form.addr.focus(); } else
		
		if (document.form.cross.value=='') { alert('Your Cross Streets are required.'); document.form.cross.focus(); } else
		if (document.form.cross.value.length < 5) { alert('Your Cross Streets must be at least 5 characters.'); document.form.cross.focus(); } else
		if (!isInCharset(document.form.cross.value,/^[a-z0-9_ \-\.@&]$/i)) { alert('Your Cross Streets contains illegal characters.  Please enter only letters.'); document.form.cross.focus(); } else
		
		if (document.form.city.value=='') { alert('Your City is required.'); document.form.city.focus(); } else
		if (document.form.city.value.length < 2) { alert('Your City must be at least 2 characters.'); document.form.city.focus(); } else
		if (!isInCharset(document.form.city.value,/^[a-z'\s\-.]$/i)) { alert('Your City contains illegal characters.  Please enter only letters.'); document.form.city.focus(); } else
		
		if (document.form.state.value!='Arizona') { alert('Your State is required.'); document.form.state.focus(); } else
		if (!isInCharset(document.form.state.value,/^[a-z'\s\-.]$/i)) { alert('Your State contains illegal characters.  Please enter only letters.'); document.form.state.focus(); } else
		
		if (document.form.zcode.value=='') { alert('Your Zip Code is required.'); document.form.zcode.focus(); } else
		if (document.form.zcode.value.length < 5) { alert('Your Zip Code must be at least 5 characters.'); document.form.zcode.focus(); } else
		if (!isInCharset(document.form.zcode.value,/^[0-9'\s\-.]$/i)) { alert('Your Zip Code contains illegal characters.  Please enter only letters.'); document.form.zcode.focus(); } else
		
        if (document.form.hcode.value=='') { alert('Your phone area code is required.'); document.form.hcode.focus(); } else
        if (document.form.hcode.value.length != 3) { alert('Your phone area code must be exactly 3 digits.'); document.form.hcode.focus(); } else
        if (!isInCharset(document.form.hcode.value,/^[0-9&]$/i)) { alert('Your phone area code contains illegal characters.  Please enter only numbers.'); document.form.hcode.focus(); } else
        if (document.form.hpre.value=='') { alert('Your phone is required.  Please enter 3 numbers in the second box (between the area code and the hyphen).'); document.form.hpre.focus(); } else
        if (document.form.hpre.value.length != 3) { alert('Your phone prefix (part 2 of 3) must be exactly 3 digits.'); document.form.hpre.focus(); } else
        if (!isInCharset(document.form.hpre.value,/^[0-9&]$/i)) { alert('Your phone prefix (part 2 of 3) contains illegal characters.  Please enter only numbers.'); document.form.hpre.focus(); } else
        if (document.form.hdigits.value=='') { alert('Your phone is required.  Please enter 4 numbers in the third box (after the hyphen).'); document.form.hdigits.focus(); } else
        if (document.form.hdigits.value.length != 4) { alert('Your phone suffix (part 3 of 3) must be exactly 4 digits.'); document.form.hdigits.focus(); } else
        if (!isInCharset(document.form.hdigits.value,/^[0-9&]$/i)) { alert('Your phone suffix (part 3 of 3) contains illegal characters.  Please enter only numbers.'); document.form.hdigits.focus(); } else

        if ((document.form.fdigits.value=='') || (document.form.fpre.value!='') || (document.form.fdigits.value!='')) {
                if (document.form.fdigits.value=='') { alert('Since you entered something into your fax number, the area code is required.'); document.form.fdigits.focus(); } else
                if (document.form.fdigits.value.length < 3) { alert('Your fax area code must be exactly 3 digits.'); document.form.fdigits.focus(); } else
                if (!isInCharset(document.form.fdigits.value,/^[0-9]$/i)) { alert('Your fax area code contains illegal characters.  Please enter only numbers.'); document.form.fdigits.focus(); } else
                if (document.form.fpre.value=='') { alert('Since you entered something into your fax number, the prefix is required.  Please enter 3 numbers in the second box (between the area code and the suffix).'); document.form.fpre.focus(); } else
                if (document.form.fpre.value.length < 3) { alert('Your fax prefix (part 2 of 3) must be exactly 3 digits.'); document.form.fpre.focus(); } else
                if (!isInCharset(document.form.fpre.value,/^[0-9]$/i)) { alert('Your fax prefix (part 2 of 3) contains illegal characters.  Please enter only numbers.'); document.form.fpre.focus(); } else
                if (document.form.fdigits.value=='') { alert('Since you entered something into your fax number, the suffix is required.  Please enter 4 numbers in the third box (after the prefix).'); document.form.fdigits.focus(); } else
                if (document.form.fdigits.value.length < 4) { alert('Your fax suffix (part 3 of 3) must be exactly 4 digits.'); document.form.fdigits.focus(); } else
                if (!isInCharset(document.form.fdigits.value,/^[0-9]$/i)) { alert('Your fax suffix (part 3 of 3) contains illegal characters.  Please enter only numbers.'); document.form.fdigits.focus(); } else
                        {
                                document.form.submit();
                        }
        } else
        
        {
        document.form.submit();
        }
}


function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
