function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}

function isEmpty(strng,thename) {
var error = "";
  if (strng.length == 0) {
     error = "Please fill in the " + thename + " field.\n"
  }
return error;     
}

function checkBox(thestatus,msg)

 {
 var error = "";
 if (!thestatus) {
 error = msg;
 }
return error;
 }

function checkDropdown(choice,thename) {
var error = "";
    if (choice == 0) {
    error = "Please choose and option from the "+thename+" drop-down.\n";
    }    
return error;
}

function checkDate(strng,lgth,top,thename,bot) {
var error = "";
if (strng.length > lgth) {
    error = "The " +thename+ " field has too many characters.\n";
}
if (isNaN(parseInt(strng))) {
    error = "Please enter only numbers in the " + thename + "field.\n";
} else {
	if (parseInt(strng) > top) {
		error = "The highest number you can enter in the " +thename+ " field is " +top + ".\n";
	}
	if (parseInt(strng) < bot) {
		error = "The lowest number you can enter in the " +thename+ " field is " +bot + ".\n";
	}
}
return error;
}

