<SCRIPT LANGUAGE="JavaScript">
//* Begin Date Check!
function isValidDate(date, dateStr) {
// check if the box is empty
if (dateStr == "") {
return false;
}
var datePat = /^(\d{1,2})(\/|-|.|. | |,|, )(\d{1,2})\2(\d{2}|\d{4})$/;
// 4 digit year entry
// var datePat = /^(\d{1,2})(\/|-|.|. | |,|, )(\d{1,2})\2(\d{4})$/;
var matchArray = dateStr.match(datePat); // Check Format!
if (matchArray == null) {
alert("Date is not in a valid format.")
date.focus();
date.select();
return false;
}
month = matchArray[3]; // parse date into variables
day = matchArray[1];
year = matchArray[4];
if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
date.focus();
date.select();
return false;
}
if (day < 1 || day > 31) {
alert("Day must be between 1 and 31.");
date.focus();
date.select();
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Month "+month+" doesn't have 31 days!");
date.focus();
date.select();
return false
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
alert("February " + year + " doesn't have " + day + " days!");
date.focus();
date.select();
return false;
}
}
return true; // date is valid
}
//* Begin Numeric Check!
function validnum(field) {
var valid = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry! Only numbers are accepted!");
field.focus();
field.select();
}
}
//* Begin Character Check!
function validchar(field) {
var valid = "&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry! Only characters are accepted!");
field.focus();
field.select();
}
}
//* Begin E-mail Check!
function emailCheck(email, emailStr) {
if (emailStr.indexOf("@")<3){
alert("I'm sorry. This email address seems wrong. Please check the prefix and '@' sign.");
email.focus();
email.select();
return false;
}
return true;
}
//* Begin Phone Check!
function validphone(field) {
var valid = " +-/0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry! Only numbers, spaces, /, + and - are accepted!");
field.focus();
field.select();
}
}
//* begin Submission Agreement Check!
function checksub()
{
if (document.getElementById('accept').checked == true ){
document.getElementById('sub').disabled=false;}
if (document.getElementById('accept').checked == false ){
document.getElementById('sub').disabled=true;}
}
// End -->
</script>


