//Short Form Validation Script.
function validateShortForm() {
    var msgString = "";
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';
	if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
		msgString += "* Your first name must contain at least 2 letters.<br>"; 
		document.getElementById("nameFirst").className='errorStyle';
	}
	if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
		msgString += "* Your last name must contain at least 2 letters.<br>"; 
		document.getElementById("nameLast").className='errorStyle';
	}
	if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
    		msgString += "* Enter your valid email.<br>";
			document.getElementById("email").className='errorStyle';
    }
	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
			msgString += "* Enter a valid phone number.<br>"; 
			document.getElementById("primaryPhone").className='errorStyle';
    }
	if( !isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
		msgString += "* Enter your zip.<br>"; 
		document.getElementById("addressZip").className='errorStyle';
	}
	
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = msgString;  
		return false; 
	} else {
		document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
	}
    return true;
}
//Short Form Validation Script.
function validateShortForm2() {
    var msgString = "";
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("programOfInterest").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("addressState").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';
	if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
		msgString += "* Your first name must contain at least 2 letters.<br>"; 
		document.getElementById("nameFirst").className='errorStyle';
	}
	if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
		msgString += "* Your last name must contain at least 2 letters.<br>"; 
		document.getElementById("nameLast").className='errorStyle';
	}
	if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
		msgString += "* Please Select a Program of Interest.<br>"; 
		document.getElementById("programOfInterest").className='errorStyle'; 
	} 
	if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
    		msgString += "* Enter your valid email.<br>";
			document.getElementById("email").className='errorStyle';
    }
	if( document.getElementById("addressState").value == ""){
			msgString += "* Select your state.";
			document.getElementById("addressState").className='errorStyle';
	}
	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
			msgString += "* Enter a valid phone number.<br>"; 
			document.getElementById("primaryPhone").className='errorStyle';
    } 
	if( !isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
		msgString += "* Enter your zip.<br>"; 
		document.getElementById("addressZip").className='errorStyle';
	}
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = msgString;  
		return false; 
	} else {
		document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
	}
    return true;
}

//Imagini Short Form Validation Script.
function validateShortImgForm() {
    var msgString = "";
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("programOfInterest").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("addressState").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';
	if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
		msgString += "* Your first name must contain at least 2 letters.<br>"; 
		document.getElementById("nameFirst").className='errorStyle';
	}
	if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
		msgString += "* Your last name must contain at least 2 letters.<br>"; 
		document.getElementById("nameLast").className='errorStyle';
	}
	if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
		msgString += "* Please Select a Program of Interest.<br>"; 
		document.getElementById("programOfInterest").className='errorStyle'; 
	} 
	if(document.Request.addressState[document.Request.addressState.selectedIndex].value=="") {
		msgString += "* Please Select a State of residency.<br>"; 
		document.getElementById("addressState").className='errorStyle'; 
	} 	
	if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
    		msgString += "* Enter your valid email.<br>";
			document.getElementById("email").className='errorStyle';
    }
	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
			msgString += "* Enter a valid phone number.<br>"; 
			document.getElementById("primaryPhone").className='errorStyle';
    } 
	if( !isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
		msgString += "* Enter your zip.<br>"; 
		document.getElementById("addressZip").className='errorStyle';
	}
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = msgString;  
		return false; 
	} else {
		document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
	}
    return true;
}

//Form Revision - Long Form Changed to Shorter Version - redesign :: Created on 4/24/08, modified on 5/28/08
function validateLongToShortFormRed() {
    var msgString = "";

  	document.getElementById("programOfInterest").className='nonErrorStyle';
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("otherPhone").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';

	if(document.getElementById("USYes").checked){
		if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
			msgString += "* Please select a program of interest.<br>"; 
			document.getElementById("programOfInterest").className='errorStyle'; 
		} 
		if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
			msgString += "* Your first name must contain at least 2 letters.<br>"; 
			document.getElementById("nameFirst").className='errorStyle';
		}
		if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
			msgString += "* Your last name must contain at least 2 letters.<br>"; 
			document.getElementById("nameLast").className='errorStyle';
		}
		if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
				msgString += "* Enter your valid email.<br>";
				document.getElementById("email").className='errorStyle';
	  	}	
	  	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
				msgString += "* Enter a valid home phone number.<br>"; 
				document.getElementById("primaryPhone").className='errorStyle';
	  	}
	  	if( document.Request.otherPhone.value == "" || !isPhoneNumber( document.Request.otherPhone.value ) ) {
				msgString += "* Enter a valid secondary phone number.<br>"; 
				document.getElementById("otherPhone").className='errorStyle';
	  	}
		if(!isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
			msgString += "* Enter your zip.<br>"; 
			document.getElementById("addressZip").className='errorStyle';
		}
		if( msgString.length > 0 ) { 
			document.getElementById('error').innerHTML = msgString;  
			return false; 
		} else {
			document.Request.primaryPhone.value = correctPhoneNumber(document.Request.homePhone.value);
		}
		return true;
	}else{
		if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
			msgString += "* Please select a program of interest.<br>"; 
			document.getElementById("programOfInterest").className='errorStyle'; 
		} 
		if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
			msgString += "* Your first name must contain at least 2 letters.<br>"; 
			document.getElementById("nameFirst").className='errorStyle';
		}
		if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
			msgString += "* Your last name must contain at least 2 letters.<br>"; 
			document.getElementById("nameLast").className='errorStyle';
		}
		if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
				msgString += "* Enter your valid email.<br>";
				document.getElementById("email").className='errorStyle';
	  	}	
		if( msgString.length > 0 ) { 
			document.getElementById('error').innerHTML = msgString;  
			return false; 
		}
		return true;
	}
}


function validateLongSEM08() {
    var msgString = "";

  	document.getElementById("programOfInterest").className='nonErrorStyle';
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("internationalPhone").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';
	document.getElementById("addressState").className='nonErrorStyle';

	if(document.getElementById("USYes").checked){
		if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
			msgString += "* Please select a program of interest.<br>"; 
			document.getElementById("programOfInterest").className='errorStyle'; 
		} 
		if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
			msgString += "* Your first name must contain at least 2 letters.<br>"; 
			document.getElementById("nameFirst").className='errorStyle';
		}
		if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
			msgString += "* Your last name must contain at least 2 letters.<br>"; 
			document.getElementById("nameLast").className='errorStyle';
		}
		if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
				msgString += "* Enter your valid email.<br>";
				document.getElementById("email").className='errorStyle';
	  	}	
	  	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
				msgString += "* Enter a valid home phone number.<br>"; 
				document.getElementById("primaryPhone").className='errorStyle';
	  	}
		if(!isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
			msgString += "* Enter your zip.<br>"; 
			document.getElementById("addressZip").className='errorStyle';
		}
		if( document.getElementById("addressState").value == ""){
			msgString += "* Select your state.";
			document.getElementById("addressState").className='errorStyle';
		}
		if( msgString.length > 0 ) { 
			document.getElementById('error').innerHTML = msgString;  
			return false; 
		} else {
			document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
		}
		return true;
	}else{
		if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
			msgString += "* Please select a program of interest.<br>"; 
			document.getElementById("programOfInterest").className='errorStyle'; 
		} 
		if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
			msgString += "* Your first name must contain at least 2 letters.<br>"; 
			document.getElementById("nameFirst").className='errorStyle';
		}
		if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
			msgString += "* Your last name must contain at least 2 letters.<br>"; 
			document.getElementById("nameLast").className='errorStyle';
		}
		if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
				msgString += "* Enter your valid email.<br>";
				document.getElementById("email").className='errorStyle';
	  	}
	  	if( document.Request.internationalPhone.value == "" || !isPhoneNumber( document.Request.internationalPhone.value ) ) {
				msgString += "* Enter a valid phone number.<br>"; 
				document.getElementById("internationalPhone").className='errorStyle';
	  	}	
		if( msgString.length > 0 ) { 
			document.getElementById('error').innerHTML = msgString;  
			return false; 
		}
		return true;
	}
}


function validateMicrosite08() {
    var msgString = "";

  	document.getElementById("programOfInterest").className='nonErrorStyle';
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';
	document.getElementById("addressState").className='nonErrorStyle';
	
	if(document.getElementById("isUSA").checked){
		if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
			document.getElementById("programOfInterest").className='errorStyle'; 
		} 
		if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
			msgString += " "; 
			document.getElementById("nameFirst").className='errorStyle';
		}
		if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
			msgString += " "; 
			document.getElementById("nameLast").className='errorStyle';
		}
		if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
			msgString += " ";
			document.getElementById("email").className='errorStyle';
	  	}	
	  	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
			msgString += " "; 
			document.getElementById("primaryPhone").className='errorStyle';
	  	}
		if(!isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
			msgString += " "; 
			document.getElementById("addressZip").className='errorStyle';
		}
		if( document.getElementById("addressState").value == ""){
			msgString += " ";
			document.getElementById("addressState").className='errorStyle';
		}
		if( msgString.length > 0 ) { 
			document.getElementById('error').innerHTML = msgString;  
			return false; 
		} else {
			document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
		}
		return true;
	}else{
			if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
			document.getElementById("programOfInterest").className='errorStyle'; 
		} 
		if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
			msgString += " "; 
			document.getElementById("nameFirst").className='errorStyle';
		}
		if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
			msgString += " "; 
			document.getElementById("nameLast").className='errorStyle';
		}
		if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
			msgString += " ";
			document.getElementById("email").className='errorStyle';
	  	}	
		if( document.Request.primaryPhone.value == "" ) {
			msgString += " "; 
			document.getElementById("primaryPhone").className='errorStyle';
	  	}
		if( msgString.length > 0 ) { 
			document.getElementById('error').innerHTML = msgString;  
			return false; 
		} else {
			document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
		}
		return true;
	}
}



function validateShortForm2NoProgram() {
    var msgString = "";
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';
	if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
		msgString += "* Your first name must contain at least 2 letters.<br>"; 
		document.getElementById("nameFirst").className='errorStyle';
	}
	if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
		msgString += "* Your last name must contain at least 2 letters.<br>"; 
		document.getElementById("nameLast").className='errorStyle';
	}
	if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
    		msgString += "* Enter your valid email.<br>";
			document.getElementById("email").className='errorStyle';
    }
	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
			msgString += "* Enter a valid phone number.<br>"; 
			document.getElementById("primaryPhone").className='errorStyle';
    } 
	if( !isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
		msgString += "* Enter your zip.<br>"; 
		document.getElementById("addressZip").className='errorStyle';
	}
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = msgString;  
		return false; 
	} else {
		document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
	}
    return true;
}
function validateShortFormWelcome() {
    var msgString = "";
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("programOfInterest").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';
	if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
		msgString += "* Your first name must contain at least 2 letters.<br>"; 
		document.getElementById("nameFirst").className='errorStyle';
	}

	if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
		msgString += "* Your last name must contain at least 2 letters.<br>"; 
		document.getElementById("nameLast").className='errorStyle';
	}
	if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
		msgString += "* Please Select a Program of Interest.<br>"; 
		document.getElementById("programOfInterest").className='errorStyle'; 
	} 
	if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
    		msgString += "* Enter your valid email.<br>";
			document.getElementById("email").className='errorStyle';
    }
	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
			msgString += "* Enter a valid phone number.<br>"; 
			document.getElementById("primaryPhone").className='errorStyle';
    } 
	if(!isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
		msgString += "* Enter your zip.<br>"; 
		document.getElementById("addressZip").className='errorStyle';
	}
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = msgString;  
		return false; 
	} else {
		document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
	}
    return true;
}
function validateShortForm3() {
    var msgString = "";
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("addressLine1").className='nonErrorStyle';
	document.getElementById("addressCity").className='nonErrorStyle';
	document.getElementById("addressState").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';
	document.getElementById("addressCountryCode").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("workPhone").className='nonErrorStyle';
	document.getElementById("educationCompleted").className='nonErrorStyle';
	document.getElementById("highSchoolGradYear").className='nonErrorStyle';
	document.getElementById("programOfInterest").className='nonErrorStyle';

	if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
		msgString += "* Your first name must contain at least 2 letters.<br>"; 
		document.getElementById("nameFirst").className='errorStyle';
	}

	if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
		msgString += "* Your last name must contain at least 2 letters.<br>"; 
		document.getElementById("nameLast").className='errorStyle';
	}
	if( !isFourLetters( trim(document.Request.addressLine1.value) ) ) {
		msgString += "* Your address must contain at least 4 characters.<br>";
		document.getElementById("addressLine1").className='errorStyle'; 
	}
	if( document.Request.addressCity.value == "" ) { 
		msgString += "* Enter your city.<br>";
		document.getElementById("addressCity").className='errorStyle'; 
	}
	if(document.Request.addressState[document.Request.addressState.selectedIndex].value=="") {
		msgString += "* Please select your state.<br>"; 
		document.getElementById("addressState").className='errorStyle'; 
	}	
	if(!isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
		msgString += "* Enter your zip.<br>"; 
		document.getElementById("addressZip").className='errorStyle';
	}
	if(document.Request.addressCountryCode[document.Request.addressCountryCode.selectedIndex].value=="") {
		msgString += "* Please select your country.<br>"; 
		document.getElementById("addressCountryCode").className='errorStyle'; 
	}
	if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
    		msgString += "* Enter your valid email.<br>";
			document.getElementById("email").className='errorStyle';
    }
	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
			msgString += "* Enter a valid phone number.<br>"; 
			document.getElementById("primaryPhone").className='errorStyle';
    } 
	if(document.Request.workPhone.value != "" && !isPhoneNumber( document.Request.workPhone.value )) {
			msgString += "* Enter a valid work phone.<br>"; 
			document.getElementById("workPhone").className='errorStyle';
    }
	if(document.Request.educationCompleted[document.Request.educationCompleted.selectedIndex].value=="") {
		msgString += "* Please select your level of education.<br>"; 
		document.getElementById("educationCompleted").className='errorStyle'; 
	} 
	if(document.Request.highSchoolGradYear[document.Request.highSchoolGradYear.selectedIndex].value=="") {
		msgString += "* Please select your year of high school graduation.<br>"; 
		document.getElementById("highSchoolGradYear").className='errorStyle'; 
	} 
	if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
		msgString += "* Please select a program of interest.<br>"; 
		document.getElementById("programOfInterest").className='errorStyle'; 
	} 
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = msgString;  
		return false; 
	} else {
		document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
		document.Request.workPhone.value = correctPhoneNumber(document.Request.workPhone.value);
	}
    return true;
}



//Form Revision - Long Form Changed to Shorter Version :: Created on 12/03/2007
function validateLongToShortForm() {
    var msgString = "";
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("addressState").className='nonErrorStyle';
	document.getElementById("addressZip").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	document.getElementById("programOfInterest").className='nonErrorStyle';

	if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
		msgString += "* Your first name must contain at least 2 letters.<br>"; 
		document.getElementById("nameFirst").className='errorStyle';
	}
	if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
		msgString += "* Your last name must contain at least 2 letters.<br>"; 
		document.getElementById("nameLast").className='errorStyle';
	}
	if(document.Request.addressState[document.Request.addressState.selectedIndex].value=="") {
		msgString += "* Please select your state.<br>"; 
		document.getElementById("addressState").className='errorStyle'; 
	}	
	if(!isPostalCode( document.Request.addressZip.value ) && !isZip( document.Request.addressZip.value ) ) {
		msgString += "* Enter your zip.<br>"; 
		document.getElementById("addressZip").className='errorStyle';
	}
	if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
    		msgString += "* Enter your valid email.<br>";
			document.getElementById("email").className='errorStyle';
    }
	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
			msgString += "* Enter a valid phone number.<br>"; 
			document.getElementById("primaryPhone").className='errorStyle';
    }
	if(document.Request.programOfInterest[document.Request.programOfInterest.selectedIndex].value=="") {
		msgString += "* Please select a program of interest.<br>"; 
		document.getElementById("programOfInterest").className='errorStyle'; 
	} 
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = msgString;  
		return false; 
	} else {
		document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
	}
    return true;
}





function validateReferForm() {
    var msgString = "";
	document.getElementById("name").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("friendname").className='nonErrorStyle';
	document.getElementById("friendemail").className='nonErrorStyle';
	if( document.referral.name.value == "" ) { 
		msgString += "* Enter your first name.<br>"; 
		document.getElementById("name").className='errorStyle';
	}
	if( document.referral.email.value == "" || !isEmail( document.referral.email.value ) ) {
    		msgString += "* Enter your valid email.<br>";
			document.getElementById("email").className='errorStyle';
    }
	if( document.referral.friendname.value == "" ) { 
		msgString += "* Enter your friend's first name.<br>"; 
		document.getElementById("friendname").className='errorStyle';
	}
	if( document.referral.friendemail.value == "" || !isEmail( document.referral.friendemail.value ) ) {
    		msgString += "* Enter your friend's valid email.<br>";
			document.getElementById("friendemail").className='errorStyle';
    }
	
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = "<p style='color: #990000;'>" + msgString + "</p>";  
		return false; 
	}
    return true;
}

function validateReferFriendForm() {
	
    var msgString = "";
	
	document.getElementById("referNameFirst").className='nonErrorStyle';
	document.getElementById("referNameLast").className='nonErrorStyle';
	document.getElementById("referEmail").className='nonErrorStyle';
	document.getElementById("refeeNameFirst").className='nonErrorStyle';
	document.getElementById("refeeNameLast").className='nonErrorStyle';
	document.getElementById("refeeEmail").className='nonErrorStyle';
	if( !isTwoLetters( trim(document.refer_friend.referNameFirst.value) ) ) { 
		msgString += "* Your first name must contain at least 2 letters.<br>"; 
		document.getElementById("referNameFirst").className='errorStyle';
	}
	if( !isTwoLetters( trim(document.refer_friend.referNameLast.value) ) ) { 
		msgString += "* Your last name must contain at least 2 letters.<br>"; 
		document.getElementById("referNameLast").className='errorStyle';
	}
	if( document.refer_friend.referEmail.value == "" || !isEmail( document.refer_friend.referEmail.value ) ) {
    	msgString += "* Enter your valid email.<br>";
		document.getElementById("referEmail").className='errorStyle';
    }
	if( !isTwoLetters( trim(document.refer_friend.refeeNameFirst.value) ) ) { 
		msgString += "* Friend's first name must contain at least 2 letters.<br>"; 
		document.getElementById("refeeNameFirst").className='errorStyle';
	}
	if( !isTwoLetters( trim(document.refer_friend.refeeNameLast.value) ) ) { 
		msgString += "* Friend's last name must contain at least 2 letters.<br>"; 
		document.getElementById("refeeNameLast").className='errorStyle';
	}
	if( document.refer_friend.refeeEmail.value == "" || !isEmail( document.refer_friend.refeeEmail.value ) ) {
    	msgString += "* Enter friend's valid email.<br>";
		document.getElementById("refeeEmail").className='errorStyle';
    }
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = "<p style='color:#CC0000; margin-top: 5px;'>" + msgString + "</p>";  
		return false; 
	}else{
	}
    return true;
}



function validateShortFormRecontact() {
    var msgString = "";
	document.getElementById("nameFirst").className='nonErrorStyle';
	document.getElementById("nameLast").className='nonErrorStyle';
	document.getElementById("email").className='nonErrorStyle';
	document.getElementById("primaryPhone").className='nonErrorStyle';
	if( !isTwoLetters( trim(document.Request.nameFirst.value) ) ) { 
		msgString += "* Your first name must contain at least 2 letters.<br>"; 
		document.getElementById("nameFirst").className='errorStyle';
	}

	if( !isTwoLetters( trim(document.Request.nameLast.value) ) ) { 
		msgString += "* Your last name must contain at least 2 letters.<br>"; 
		document.getElementById("nameLast").className='errorStyle';
	}
	if( document.Request.email.value == "" || !isEmail( document.Request.email.value ) ) {
    		msgString += "* Enter your valid email.<br>";
			document.getElementById("email").className='errorStyle';
    }
	if( document.Request.primaryPhone.value == "" || !isPhoneNumber( document.Request.primaryPhone.value ) ) {
			msgString += "* Enter a valid phone number.<br>"; 
			document.getElementById("primaryPhone").className='errorStyle';
    } 
	if( msgString.length > 0 ) { 
		document.getElementById('error').innerHTML = msgString;  
		return false; 
	} else {
		document.Request.primaryPhone.value = correctPhoneNumber(document.Request.primaryPhone.value);
	}
    return true;
}
//Validation Functions//
function isEmail(string) {
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}
function isPhone(string) {
    if (string.search(/^\d{10}/) != -1)
        return true;
    else
        return false;
}
function isPhoneNumber(string) {
    if (string.search(/^(1\s*[-\/\.]?)?(\((\d{3})\)|(\d{3}))\s*[-\/\.]?\s*(\d{3})\s*[-\/\.]?\s*(\d{4})\s*(([xX]|[eE][xX][tT])\.?\s*(\d+))*$/) != -1)
        return true;
    else
        return false;
}
function isZip(string) {
    if (string.search(/^\d{5}/) != -1)
        return true;
    else
        return false;
}
function isArea(string) {
    if (string.search(/^\d{3}/) != -1)
        return true;
    else
        return false;
}
function isTwoLetters(string) {
    if (string.length > 1)
        return true;
    else
        return false;
}
function isPhoneSeven(string) {
    if (string.search(/^(\((\d{3})\)|(\d{3}))\s*[-\/\.]?\s*(\d{4})\s*(([xX]|[eE][xX][tT])\.?\s*(\d+))*$/) != -1)
        return true;
    else
        return false;
}
function isFourLetters(string) {
    if (string.length > 3)
        return true;
    else
        return false;
}
function isPostalCode(string) {
    if (string.search(/^\s*[a-ceghj-npr-tvxy]\d[a-ceghj-npr-tv-z](\s)?\d[a-ceghj-npr-tv-z]\d\s*$/i) != -1) {
        return true;
	} else {
        return false;
	}
}
function correctPhoneNumber (string) {
	 phoneNumber = string.replace(/ /g,"");
	 phoneNumber = phoneNumber.replace(/\(/g,"");
	 phoneNumber = phoneNumber.replace(/\)/g,"");
	 phoneNumber = phoneNumber.replace(/-/g,"");
	 phoneNumber = phoneNumber.replace(/\./g,"");
	 return phoneNumber;
}
function trim(str){
	while(''+str.charAt(0)==' ')
	str=str.substring(1,str.length);
	while(''+str.charAt(str.length-1)==' ')
	str=str.substring(0,str.length-1);
	return str;
}