var _shortEntityName;
var _entityAction;
var _entityTerm;
function setConstants(shortEntityName, entityAction, entityTerm) {
	_shortEntityName = shortEntityName;
	_entityAction = entityAction;
	_entityTerm = entityTerm;
}
function findMyExpert() {
	if (!checkCode(selectForm.code.value) ||
			!CheckForZeroLength(selectForm.firstName, "First Name") || 
			!CheckForZeroLength(selectForm.lastName, "Last Name") || 
			!CheckForZeroLength(selectForm.city, "City") || 
			!CheckForSelection(selectForm.state, "State") ||
			!CheckForZeroLength(selectForm.zip, "Zip") || 
			!CheckForZeroLength(selectForm.phoneHome, "Home Phone") || 
			!CheckForZeroLength(selectForm.phoneCell, "Cell Phone") || 
			!(selectForm.country.value == "US" && isValidUSPhoneNumber(selectForm.phoneHome,"Home Phone")) ||
			!(selectForm.country.value == "US" && isValidUSPhoneNumber(selectForm.phoneCell,"Cell Phone")) ||
			!CheckForZeroLength(selectForm.email, "Email") || 
			!CheckForZeroLength(selectForm.birthDay, "Birthday") ||
			!CheckForSelectionAndSetHiddenValue(selectForm.topServiceGoalSelecter, "What is your top " + _entityTerm + " Goal", selectForm.topServiceGoal) ||
			!CheckMaxLength(selectForm.describeYourInjury, "Describe your injury", 500) ||
			!ValidateTextInput(selectForm.additionalGoals, "Additional " + _entityTerm + " Goals", 500) || 
			!CheckForSelectionAndSetHiddenValue(selectForm.howOftenMeetServiceProviderSelecter, "How often would you like to meet with your " + _shortEntityName, selectForm.howOftenMeetServiceProvider) ||
			!CheckForSelectionAndSetHiddenValue(selectForm.whenStartServiceSelecter, "When would you like to start " + _entityAction, selectForm.whenStartService) ||
			!CheckForSelectionAndSetHiddenValue(selectForm.howFlexibleScheduleSelecter, "How flexible is your schedule", selectForm.howFlexibleSchedule) ||
			!CheckForSelectionAndSetHiddenValue(selectForm.preferenceLocationSelecter, "Where would you like to get " + _entityAction, selectForm.preferenceLocation) ||
			!CheckForSelectionAndSetHiddenValue(selectForm.preferMaleFemaleSelecter, "Do you prefer a male or female " + _shortEntityName, selectForm.preferMaleFemale) ||
			!CheckForSelectionAndSetHiddenValue(selectForm.numberServiceSessionsSelecter, "How many sessions are you interested in", selectForm.numberServiceSessions) ||
			!CheckForSelectionAndSetHiddenValue(selectForm.bestTimeToContactSelecter, "When is the best time to contact you", selectForm.bestTimeToContact) ||
			!CheckForSelectionAndSetHiddenValue(selectForm.longDistanceServiceSelecter, "Are you interested in alternative forms of service", selectForm.longDistanceService) ||
			!CheckForSelectionAndSetHiddenValue(selectForm.howFindNetworkSelecter, "How did you find our " + _shortEntityName + " Network", selectForm.howFindNetwork) ||
			!validateDate(selectForm.birthDay, "Birthday") ||
			!validateBirthday(selectForm.birthDay, 18)
			) {
		return;
	}
	if (!check_email(selectForm.email.value)) {
		selectForm.email.focus();
		return;
	}
	if (!selectForm.chkMon1.checked && !selectForm.chkTues1.checked && !selectForm.chkWed1.checked && !selectForm.chkThurs1.checked && !selectForm.chkFri1.checked && !selectForm.chkSat1.checked && !selectForm.chkSun1.checked && 
		!selectForm.chkMon2.checked && !selectForm.chkTues2.checked && !selectForm.chkWed2.checked && !selectForm.chkThurs2.checked && !selectForm.chkFri2.checked && !selectForm.chkSat2.checked && !selectForm.chkSun2.checked && 
		!selectForm.chkMon3.checked && !selectForm.chkTues3.checked && !selectForm.chkWed3.checked && !selectForm.chkThurs3.checked && !selectForm.chkFri3.checked && !selectForm.chkSat3.checked && !selectForm.chkSun3.checked && 
		!selectForm.chkMon4.checked && !selectForm.chkTues4.checked && !selectForm.chkWed4.checked && !selectForm.chkThurs4.checked && !selectForm.chkFri4.checked && !selectForm.chkSat4.checked && !selectForm.chkSun4.checked && 
		!selectForm.chkMon5.checked && !selectForm.chkTues5.checked && !selectForm.chkWed5.checked && !selectForm.chkThurs5.checked && !selectForm.chkFri5.checked && !selectForm.chkSat5.checked && !selectForm.chkSun5.checked) {
		alert("Please select a time that is best for you to get " + _entityAction + ".");
		selectForm.chkMon1.focus();
		return;
	}
	if (!selectForm.chkAgreeToInformationSharing.checked || !selectForm.chkAgreeToTerms.checked || !selectForm.chkAgreeToDisclaimer.checked || !selectForm.chkAgreeToCostNotice.checked) {
		alert("You must agree to all of the Terms & Conditions before proceeding.");
		return;
	}
	selectForm.monday.value = GetCheckValue(selectForm.chkMon1)+GetCheckValue(selectForm.chkMon2)+GetCheckValue(selectForm.chkMon3)+GetCheckValue(selectForm.chkMon4)+GetCheckValue(selectForm.chkMon5);
	selectForm.tuesday.value = GetCheckValue(selectForm.chkTues1)+GetCheckValue(selectForm.chkTues2)+GetCheckValue(selectForm.chkTues3)+GetCheckValue(selectForm.chkTues4)+GetCheckValue(selectForm.chkTues5);
	selectForm.wednesday.value = GetCheckValue(selectForm.chkWed1)+GetCheckValue(selectForm.chkWed2)+GetCheckValue(selectForm.chkWed3)+GetCheckValue(selectForm.chkWed4)+GetCheckValue(selectForm.chkWed5);
	selectForm.thursday.value = GetCheckValue(selectForm.chkThurs1)+GetCheckValue(selectForm.chkThurs2)+GetCheckValue(selectForm.chkThurs3)+GetCheckValue(selectForm.chkThurs4)+GetCheckValue(selectForm.chkThurs5);
	selectForm.friday.value = GetCheckValue(selectForm.chkFri1)+GetCheckValue(selectForm.chkFri2)+GetCheckValue(selectForm.chkFri3)+GetCheckValue(selectForm.chkFri4)+GetCheckValue(selectForm.chkFri5);
	selectForm.saturday.value = GetCheckValue(selectForm.chkSat1)+GetCheckValue(selectForm.chkSat2)+GetCheckValue(selectForm.chkSat3)+GetCheckValue(selectForm.chkSat4)+GetCheckValue(selectForm.chkSat5);
	selectForm.sunday.value = GetCheckValue(selectForm.chkSun1)+GetCheckValue(selectForm.chkSun2)+GetCheckValue(selectForm.chkSun3)+GetCheckValue(selectForm.chkSun4)+GetCheckValue(selectForm.chkSun5);

	selectForm.equipmentOwned.value = GetCheckValue(selectForm.chkStandardDumbbells)+GetCheckValue(selectForm.chkBowflexTreadClimber)+GetCheckValue(selectForm.chkBowflexSelectTechDumbbells)+GetCheckValue(selectForm.chkStandardTreadmill)+
		GetCheckValue(selectForm.chkPowerBlockDumbbells)+GetCheckValue(selectForm.chkEllipticalMachine)+GetCheckValue(selectForm.chkBarbellSet)+GetCheckValue(selectForm.chkSkiMachine)+GetCheckValue(selectForm.chkKettleBells)+
		GetCheckValue(selectForm.chkEncumbentBike)+GetCheckValue(selectForm.chkTheTotalGym)+GetCheckValue(selectForm.chkUprightBike)+GetCheckValue(selectForm.chkBowflexGym)+GetCheckValue(selectForm.chkRowingMachine)+
		GetCheckValue(selectForm.chkBrandXGym)+GetCheckValue(selectForm.chkStairClimber)+GetCheckValue(selectForm.chkFlatorInclineBench)+GetCheckValue(selectForm.chkExerciseBall)+GetCheckValue(selectForm.chkBosuBall)+
		GetCheckValue(selectForm.chkFitnessBands);

	selectForm.submit();
}
function GetCheckValue(field) {
	if (field.checked) {
		return "1";
	} else {
		return "0";
	}
}
function init() {
	var state = "--Select--";
	if (selectForm.selectedState.value.length > 0) {
		state = selectForm.selectedState.value;
	}
	fillStateOptions(selectForm.country.value, state);
	disableStatuses();
	if (focusFirstName) {
		selectForm.firstName.focus();
	}
}

