
function validEntry(item, len){
	return (item.length >= len);
}
function validEntry(item, len){
	return (item.length >= len);
}

function validEmail(item) {
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (item.indexOf(".") > 2) && (item.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(item) && r2.test(item));
  return true;
}

function checkAge(){
/*		today = new Date();
		birth = new Date();
		
		birth.setYear(document.emailForm.birth_year.value);		
		age = today.getFullYear() - birth.getFullYear();		
					
		if (age<1) {
			document.location = "http://www.nba.com/kids/";
			return false;
		}*/
		return formValidation();
}		


function error(elem, text){
if (errorfound) return;
window.alert(text);
//elem.select();
//elem.focus();
errorfound = true;
}

function PAHformValidation(){
errorfound = false;
if(!validEmail(document.inputMobilePAH.C_EmailAddress.value))
	error(document.inputMobilePAH.C_EmailAddress,"E-mail address is not valid.");
if(!validEntry(document.inputMobilePAH.phone.value, 11))
	error(document.inputMobilePAH.phone,"Phone is not a valid length.");

return !errorfound;
}

function DTEformValidation(){
errorfound = false;
if(!validEmail(document.inputMobileDTE.C_EmailAddress.value))
	error(document.inputMobileDTE.C_EmailAddress,"E-mail address is not valid.");
if(!validEntry(document.inputMobileDTE.phone.value, 11))
	error(document.inputMobileDTE.phone,"Phone is not a valid length.");

return !errorfound;
}

function MBformValidation(){
errorfound = false;
if(!validEmail(document.inputMobileMB.C_EmailAddress.value))
	error(document.inputMobileMB.C_EmailAddress,"E-mail address is not valid.");
if(!validEntry(document.inputMobileMB.phone.value, 11))
	error(document.inputMobileMB.phone,"Phone is not a valid length.");

return !errorfound;
}

