function checkEmpty (strng,err) { var error =""; if (strng == "") { error = "* " + err; } return error; } function checkState (strng) { var stateArray = new Array(); stateArray[0] = "AR"; stateArray[1] = "AS"; stateArray[2] = "AZ"; stateArray[3] = "CA"; stateArray[4] = "CO"; stateArray[5] = "CT"; stateArray[6] = "DC"; stateArray[7] = "DE"; stateArray[8] = "FL"; stateArray[9] = "GA"; stateArray[10] = "HI"; stateArray[11] = "IA"; stateArray[12] = "ID"; stateArray[13] = "IL"; stateArray[14] = "IN"; stateArray[15] = "KS"; stateArray[16] = "KY"; stateArray[17] = "LA"; stateArray[18] = "MA"; stateArray[19] = "MD"; stateArray[20] = "ME"; stateArray[21] = "MH"; stateArray[22] = "MI"; stateArray[23] = "MN"; stateArray[24] = "MO"; stateArray[25] = "MP"; stateArray[26] = "MS"; stateArray[27] = "MT"; stateArray[28] = "NC"; stateArray[29] = "ND"; stateArray[30] = "NE"; stateArray[31] = "NH"; stateArray[32] = "NJ"; stateArray[33] = "NM"; stateArray[34] = "NV"; stateArray[35] = "NY"; stateArray[36] = "OH"; stateArray[37] = "OK"; stateArray[38] = "OR"; stateArray[39] = "PA"; stateArray[40] = "PR"; stateArray[41] = "PW"; stateArray[42] = "RI"; stateArray[43] = "SC"; stateArray[44] = "SD"; stateArray[45] = "TN"; stateArray[46] = "TX"; stateArray[47] = "UT"; stateArray[48] = "VA"; stateArray[49] = "VI"; stateArray[50] = "VT"; stateArray[51] = "WA"; stateArray[52] = "WI"; stateArray[53] = "WV"; stateArray[54] = "WY"; stateArray[55] = "AL"; stateArray[56] = "AK"; var error = ""; if (strng == "") { error = "* State is a required field.\n"; } else { var stateFilter= /^[A-Za-z][A-Za-z]$/ if (!(stateFilter.test(strng))) { error = "* State must contain 2 alphabetical characters (e.g. NY for New York, TX for Texas)\n"; }else{ for( var i=0; i [ ] , ; : \ / " var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ if (strng.match(illegalChars)) { error = "- The e-mail address contains illegal characters.\n"; } } } return error; } // phone number - strip out delimiters and check for 10 digits function checkOfficePhone (strng) { var error = ""; if (strng == "") { error = "* Office Phone is a required field.\n"; } else { var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters if (isNaN(parseInt(stripped))) { error = "- The phone number contains illegal characters."; } if (!(stripped.length == 10)) { error = "- The phone number is the wrong length. Please, make sure you included an area code.\n"; } } return error; }