function checkEmail (strng) {
  if (strng == "") {
	return "Please enter an email address.\n";
  }
  var emailFilter=/^.+@.+\..{2,4}$/;
  if (!(emailFilter.test(strng))) { 
	return "Please enter a valid email address.\n";
  }
  var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/;
  if (strng.match(illegalChars)) {
	return "The email address contains illegal characters.\n";
  }
  return "";
}

function checkDropdown(choice, name) {
  if (choice == 0) {
	return "Please choose a " + name + ".\n";
  }   
  return "";
}

function checkSame(one, two, name) {
  if (one != two) {
	return "Your " + name + " must be the same.\n";
  }   
  return "";
}

function checkText(strng, name) {
  if (strng == "") {
	return "Please enter a " + name + ".\n";
  }   
  return "";
}

function checkNumber(strng, name) {
  var ValidChars = "0123456789";
  var Char;
  if (strng == "") {
	return "Please enter a " + name + ".\n";
  }   
  for (i = 0; i < strng.length; i++) { 
	Char = strng.charAt(i); 
	if (ValidChars.indexOf(Char) == -1) {
		return "Please enter a number for " + name + ".\n";
	}
  }
  return "";
}

function checkRadio(radiobuttons, name, verb) {
	var checkradio = 0;
	verb = typeof(verb) != 'undefined' ? verb : "had";
	for (i=radiobuttons.length-1; i > -1; i--) {
		if (radiobuttons[i].checked) {
			checkradio = 1;
			i = -1;
		}
	}
	if (!checkradio) {
		return "Please clarify whether you " + verb + " " + name + ".\n";
	}
	return "";
}
