 
/*
	purpose:
		used in the contact page
	page:
		/contactus/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckContactForm(theform)
{
	var temp_checkbox=0;
	
	if (!IsWordNumberSpecial(theform.contactfirstname.value))
	{
		alert("Please enter your first name.");
		theform.contactfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactlastname.value))
	{
		alert("Please enter your last name.");
		theform.contactlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactaddress.value))
	{
		alert("Please enter your address.");
		theform.contactaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactcity.value))
	{
		alert("Please enter your city.");
		theform.contactcity.focus();
		return false;
	}
	
	if (theform.stateid[theform.stateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid.focus();
		return false;
	}
	
	if (theform.countryid[theform.countryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.contactpostal.focus();
		return false;
	}

	if (!IsPhone(theform.contactphone.value))
	{
		alert("Please enter a valid phone number (xxx-xxx-xxxx).");
		theform.contactphone.focus();
		return false;
	}
	
	if (!IsEmail(theform.contactemail.value))
	{
		alert("Please enter a valid email address.");
		theform.contactemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.contactconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.contactconfirmemail.focus();
		return false;
	}
	
	if (theform.contactemail.value != theform.contactconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.contactconfirmemail.focus();
		return false;
	}
	
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		all /module_setorder.cfm pages
	Parameters:
		theform - object reference to the form being passed
*/
function CheckDisplayOrderForm(theform)
{
	if (theform.orderlist.value <= 0)
	{
		alert("The order has not changed, no update required.");
		return false;
	}

	return true;
}


/*
	purpose:
		checks the post job form.
	page:
		job seeker post job
	Parameters:
		theform - object reference to the form being passed
*/

function CheckEmployerCheckoutForm(theform)
{
if (!IsWordNumberSpecial(theform.billingfirstname.value))
	{
		alert("Please enter the contact's first name.");
		theform.billingfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billinglastname.value))
	{
		alert("Please enter the contact's last name.");
		theform.billinglastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billingaddress.value))
	{
		alert("Please enter the contact's address.");
		theform.billingaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billingcity.value))
	{
		alert("Please enter the contact's city.");
		theform.billingcity.focus();
		return false;
	}
	
	if (theform.billingstateid[theform.billingstateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.contactstateid.focus();
		return false;
	}
	
	if (theform.billingcountryid[theform.billingcountryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.contactcountryid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billingpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.billingpostal.focus();
		return false;
	}

	if (!IsPhone(theform.billingphone.value))
	{
		alert("Please enter a valid business phone number. (xxx-xxx-xxxx)");
		theform.billingphone.focus();
		return false;
	}
	
	if (!IsEmail(theform.billingemail.value))
	{
		alert("Please enter a valid email address.");
		theform.billingemail.focus();
		return false;
	}
	
	if (theform.CardType[theform.CardType.selectedIndex].value == 0)
	{
		alert("Please select a valid payment type.");
		theform.CardType.focus();
		return false;
	}
	
	if (!IsNumber(theform.CardNumber.value))
	{
		alert("Please enter a valid credit card number.");
		theform.CardNumber.focus();
		return false;
	}
	
	if (!IsWordSpace(theform.nameoncard.value))
	{
		alert("Please enter a valid cardholder's name.");
		theform.nameoncard.focus();
		return false;
	}	
	
	/*
	if (!IsNumber(theform.card_cvv2.value))
	{
		alert("Please enter a valid CCV/CVV2.");
		theform.card_cvv2.focus();
		return false;
	}
	*/
	
	if (theform.policyagree.checked == false) {
		alert("Please agree to the policies before proceeding.");
		theform.policyagree.focus();
		return false;
	}
	
	return true;
}

/*
	purpose:
		checks the post job form.
	page:
		job seeker post job
	Parameters:
		theform - object reference to the form being passed
*/

function checkEmployerPostJobFormJobTypesChecked(theform,checkbox)
{
	var jobtypecheckedamount=0;
	
	for(i=0; i<theform.jobtypeid.length; i++)
	{
		if (theform.jobtypeid[i].checked==true) 
		{
			jobtypecheckedamount=jobtypecheckedamount+1;
			
		}
	}
	if (jobtypecheckedamount > 5) {
		alert("You cannot have more than 5 job types selected.");	
		checkbox.focus();
		checkbox.checked=false;
		
	}	
}

/*
	purpose:
		checks the post job form.
	page:
		job seeker post job
	Parameters:
		theform - object reference to the form being passed
*/

function CheckEmployerPostJobForm(theform)
{
	var jobtypechecked=false;
	var jobtypecheckedamount=0;

	if (!IsWordNumberSpecial(theform.jobtitle.value))
	{
		alert("Please a valid job title.");
		theform.jobtitle.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.jobcity.value))
	{
		alert("Please enter the city.");
		theform.jobcity.focus();
		return false;
	}
	
	if (theform.stateid[theform.stateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid.focus();
		return false;
	}
	
	if (theform.countryid[theform.countryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid.focus();
		return false;
	}
	
	for(i=0; i<theform.jobtypeid.length; i++)
	{
		if (theform.jobtypeid[i].checked==true) 
		{
			jobtypechecked=true;
			break;
		}
	}
	
	if (!jobtypechecked) {
		alert("You must have at least one job type checked.");	
		theform.jobtypeid[0].focus();
		return false;
	}
	
	for(i=0; i<theform.jobtypeid.length; i++)
	{
		if (theform.jobtypeid[i].checked==true) 
		{
			jobtypecheckedamount=jobtypecheckedamount+1;
		}
	}
	
	if (jobtypecheckedamount > 5) {
		alert("You cannot have more than 5 job types selected.");	
		theform.jobtypeid[0].focus();
		return false;
	}
	
	//CONTACT INFORMATION
	
	if (theform.jobcontactpersonid[theform.jobcontactpersonid.selectedIndex].value == "")
	{
		
		
		if (!IsWordNumberSpecial(theform.contactfirstname.value))
		{
			alert("Please enter the contact's first name.");
			theform.contactfirstname.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.contactlastname.value))
		{
			alert("Please enter the contact's last name.");
			theform.contactlastname.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.contactcompanyname.value))
		{
			alert("Please enter the contact's company name.");
			theform.contactcompanyname.focus();
			return false;
		}
			
		
		if (!IsWordNumberSpecial(theform.contactaddress1.value))
		{
			alert("Please enter the contact's address.");
			theform.contactaddress1.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.contactcity.value))
		{
			alert("Please enter the contact's city.");
			theform.contactcity.focus();
			return false;
		}
		
		if (theform.contactstateid[theform.contactstateid.selectedIndex].value == "")
		{
			alert("Please select a valid state/province.");
			theform.contactstateid.focus();
			return false;
		}
		
		if (theform.contactcountryid[theform.contactcountryid.selectedIndex].value == "")
		{
			alert("Please select a valid country.");
			theform.contactcountryid.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.contactpostalcode.value))
		{
			alert("Please enter your postal/zip code.");
			theform.contactpostalcode.focus();
			return false;
		}
	
		if (!IsPhone(theform.contactphone.value))
		{
			alert("Please enter a valid business phone number. (xxx-xxx-xxxx)");
			theform.contactphone.focus();
			return false;
		}
		
		if (!IsEmail(theform.contactemail.value))
		{
			alert("Please enter a valid email address.");
			theform.contactemail.focus();
			return false;
		}
		
		if (!IsEmail(theform.contactemailconfirm.value))
		{
			alert("Please enter a valid confirmation email address.");
			theform.contactemailconfirm.focus();
			return false;
		}
		
		if (theform.contactemail.value != theform.contactemailconfirm.value)
		{
			alert("Your email address and confirmation email address do not match.");
			theform.contactemailconfirm.focus();
			return false;
		}
		
	}
	
	
	return true;
}

/*
	purpose:
		checks the post job form in control panel
	page:
		job seeker post job
	Parameters:
		theform - object reference to the form being passed
*/

function CheckEmployerPostJobFormCP(theform)
{
	var jobtypechecked=false;
	var jobtypecheckedamount=0;
	
	if (!IsWordNumberSpecial(theform.jobtitle.value))
	{
		alert("Please a valid job title.");
		theform.jobtitle.focus();
		return false;
	}
	
	if (theform.stateid[theform.stateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid.focus();
		return false;
	}
	
	if (theform.countryid[theform.countryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid.focus();
		return false;
	}
	
	
	for(i=0; i<theform.jobtypeid.length; i++)
	{
		if (theform.jobtypeid[i].checked==true) 
		{
			jobtypechecked=true;
			break;
		}
	}
	
	if (!jobtypechecked) {
		alert("You must have at least one job type checked.");	
		theform.jobtypeid[0].focus();
		return false;
	}
	
	
	for(i=0; i<theform.jobtypeid.length; i++)
	{
		if (theform.jobtypeid[i].checked==true) 
		{
			jobtypecheckedamount=jobtypecheckedamount+1;
		}
	}
	
	if (jobtypecheckedamount > 5) {
		alert("You cannot have more than 5 job types selected.");	
		theform.jobtypeid[0].focus();
		return false;
	}
	
	
	//CONTACT INFORMATION
	
	if (theform.contactemail.value != '') {
		if (!IsEmail(theform.contactemail.value))
		{
			alert("Please enter a valid contact email address.");
			theform.contactemail.focus();
			return false;
		}
	}
	
	if (theform.contactemailconfirm.value != '') {
		if (!IsEmail(theform.contactemailconfirm.value))
		{
			alert("Please enter a valid confirmation email address.");
			theform.contactemailconfirm.focus();
			return false;
		}
		
		if (theform.contactemail.value != theform.contactemailconfirm.value)
		{
			alert("Your email address and confirmation email address do not match.");
			theform.contactemailconfirm.focus();
			return false;
		}
	}
	
	
	return true;
}


/*
	purpose:
		checks the registration form.
	page:
		job seeker regiestation
	Parameters:
		theform - object reference to the form being passed
*/

function CheckEmployerProfileEdit(theform)
{
	
	if (!IsWordNumberSpecial(theform.companyname.value))
	{
		alert("Please enter the company name.");
		theform.companyname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.companyaddress.value))
	{
		alert("Please enter the company address.");
		theform.companyaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.companycity.value))
	{
		alert("Please enter the city.");
		theform.companycity.focus();
		return false;
	}
	
	if (theform.stateid[theform.stateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid.focus();
		return false;
	}
	
	if (theform.countryid[theform.countryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.companypostal.value))
	{
		alert("Please enter the postal/zip code.");
		theform.companypostal.focus();
		return false;
	}

	if (!IsPhone(theform.companyphone.value))
	{
		alert("Please enter a valid company phone number. (xxx-xxx-xxxx)");
		theform.companyphone.focus();
		return false;
	}
	
	if (theform.companylogofile_file.value != "")
	{
	 	image_value=theform.companylogofile_file.value;
		
		if (!IsImageExtension(image_value.substring(image_value.lastIndexOf("."),image_value.length)))
		{
			alert("Please select a valid image file for uploading (must be .jpg or .gif).");
			theform.companylogofile_file.focus();
			return false;
		}
	}
	
	/* User login information */
		
	
	if (theform.userinfopassword.value != theform.userinfopasswordconfirm.value)
	{
		alert ("You Password and Confirm Password do not match");
		theform.userinfopasswordconfirm.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.userinfosecretquestion.value))
	{
		alert("Please enter your secret question.");
		theform.userinfosecretquestion.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.userinfosecretanswer.value))
	{
		alert("Please enter your secret answer.");
		theform.userinfosecretanswer.focus();
		return false;
	}
	
	if (!IsEmail(theform.userinfoemail.value))
	{
		alert("Please enter a valid email address.");
		theform.userinfoemail.focus();
		return false;
	}
	
	if (theform.userinfoemailconfirm.value != '') {
		if (!IsEmail(theform.userinfoemailconfirm.value))
		{
			alert("Please enter a valid confirmation email address.");
			theform.userinfoemailconfirm.focus();
			return false;
		}
		
		if (theform.userinfoemailconfirm.value != '' && theform.userinfoemail.value != theform.userinfoemailconfirm.value)
		{
			alert("Your email address and confirmation email address do not match.");
			theform.userinfoemail.focus();
			return false;
		}
	}
	
	//CONTACT INFORMATION
	
	if (!IsWordNumberSpecial(theform.contactfirstname_1.value))
	{
		alert("Please enter the contact's first name.");
		theform.contactfirstname_1.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactlastname_1.value))
	{
		alert("Please enter the contact's last name.");
		theform.contactlastname_1.focus();
		return false;
	}	
	
	if (!IsWordNumberSpecial(theform.contactcompanyname_1.value))
	{
		alert("Please enter the contact's company name.");
		theform.contactcompanyname_1.focus();
		return false;
	}
		
	
	if (!IsWordNumberSpecial(theform.contactaddress1_1.value))
	{
		alert("Please enter the contact's address.");
		theform.contactaddress1_1.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactcity_1.value))
	{
		alert("Please enter the contact's city.");
		theform.contactcity_1.focus();
		return false;
	}
	
	if (theform.stateid_1[theform.stateid_1.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid_1.focus();
		return false;
	}
	
	if (theform.countryid_1[theform.countryid_1.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid_1.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactpostalcode_1.value))
	{
		alert("Please enter your postal/zip code.");
		theform.contactpostalcode_1.focus();
		return false;
	}

	if (!IsPhone(theform.contactphone_1.value))
	{
		alert("Please enter a valid business phone number. (xxx-xxx-xxxx)");
		theform.contactphone_1.focus();
		return false;
	}
	
	if (!IsEmail(theform.contactemail_1.value))
	{
		alert("Please enter a valid email address.");
		theform.contactemail_1.focus();
		return false;
	}
	
	if (theform.userinfoemailconfirm.value != '') {
		if (!IsEmail(theform.contactemailconfirm_1.value))
		{
			alert("Please enter a valid confirmation email address.");
			theform.contactemailconfirm_1.focus();
			return false;
		}
		
		if (theform.contactemail_1.value != theform.contactemailconfirm_1.value)
		{
			alert("Your email address and confirmation email address do not match.");
			theform.contactemailconfirm_1.focus();
			return false;
		}
	}
		
	return true;
}

/*
	purpose:
		checks the registration form.
	page:
		job seeker regiestation
	Parameters:
		theform - object reference to the form being passed
*/

function CheckEmployerRegister(theform)
{
	if (!IsWordNumberSpecial(theform.companyname.value))
	{
		alert("Please enter the company name.");
		theform.companyname.focus();
		return false;
	}
	
	
	if (theform.companytypeid[theform.companytypeid.selectedIndex].value == "")
	{
		alert("Please select a valid company Type.");
		theform.companytypeid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.companyaddress.value))
	{
		alert("Please enter the company address.");
		theform.companyaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.companycity.value))
	{
		alert("Please enter the city.");
		theform.companycity.focus();
		return false;
	}
	
	if (theform.stateid[theform.stateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid.focus();
		return false;
	}
	
	if (theform.countryid[theform.countryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.companypostal.value))
	{
		alert("Please enter the postal/zip code.");
		theform.companypostal.focus();
		return false;
	}

	if (!IsPhone(theform.companyphone.value))
	{
		alert("Please enter a valid company phone number. (xxx-xxx-xxxx)");
		theform.companyphone.focus();
		return false;
	}
	
	if (theform.companylogofile_file.value != "")
	{
	 	image_value=theform.companylogofile_file.value;
		
		if (!IsImageExtension(image_value.substring(image_value.lastIndexOf("."),image_value.length)))
		{
			alert("Please select a valid image file for uploading (must be .jpg or .gif).");
			theform.companylogofile_file.focus();
			return false;
		}
	}
	
	// User login information 
	
	if (!IsUsername(theform.userinfousername.value))
	{
		alert("Please enter a valid username. (MIN. 5 characters)");
		theform.userinfousername.focus();
		return false;
	}
	
	if (!IsPassword(theform.userinfopassword.value))
	{
		alert("Please enter a valid password.");
		theform.userinfopassword.focus();
		return false;
	}	
	
	if (!IsPassword(theform.userinfopasswordconfirm.value))
	{
		alert("Please enter a valid password confirmation password.");
		theform.userinfopasswordconfirm.focus();
		return false;
	}
	
	if (theform.userinfopassword.value != theform.userinfopasswordconfirm.value)
	{
		alert ("You Password and Confirm Password do not match");
		theform.userinfopasswordconfirm.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.userinfosecretquestion.value))
	{
		alert("Please enter your secret question.");
		theform.userinfosecretquestion.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.userinfosecretanswer.value))
	{
		alert("Please enter your secret answer.");
		theform.userinfosecretanswer.focus();
		return false;
	}
	
	if (!IsEmail(theform.userinfoemail.value))
	{
		alert("Please enter a valid email address.");
		theform.userinfoemail.focus();
		return false;
	}
	
	
	if (!IsEmail(theform.userinfoemailconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.userinfoemailconfirm.focus();
		return false;
	}
	
	if (theform.userinfoemail.value != theform.userinfoemailconfirm.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.userinfoemail.focus();
		return false;
	}
	
	//CONTACT INFORMATION
	
	if (!IsWordNumberSpecial(theform.contactfirstname_1.value))
	{
		alert("Please enter the contact's first name.");
		theform.contactfirstname_1.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactlastname_1.value))
	{
		alert("Please enter the contact's last name.");
		theform.contactlastname_1.focus();
		return false;
	}	
	
	if (!IsWordNumberSpecial(theform.contactcompanyname_1.value))
	{
		alert("Please enter the contact's company name.");
		theform.contactcompanyname_1.focus();
		return false;
	}
		
	/*
	if (!IsWordNumberSpecial(theform.contactaddress1_1.value))
	{
		alert("Please enter the contact's address.");
		theform.contactaddress1_1.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactcity_1.value))
	{
		alert("Please enter the contact's city.");
		theform.contactcity_1.focus();
		return false;
	}
	
	if (theform.stateid_1[theform.stateid_1.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid_1.focus();
		return false;
	}
	
	if (theform.countryid_1[theform.countryid_1.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid_1.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactpostalcode_1.value))
	{
		alert("Please enter your postal/zip code.");
		theform.contactpostalcode_1.focus();
		return false;
	}

	if (!IsPhone(theform.contactphone_1.value))
	{
		alert("Please enter a valid business phone number. (xxx-xxx-xxxx)");
		theform.contactphone_1.focus();
		return false;
	}
	
	if (!IsEmail(theform.contactemail_1.value))
	{
		alert("Please enter a valid email address.");
		theform.contactemail_1.focus();
		return false;
	}
	
	if (!IsEmail(theform.contactemailconfirm_1.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.contactemailconfirm_1.focus();
		return false;
	}
	
	if (theform.contactemail_1.value != theform.contactemailconfirm_1.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.contactemailconfirm_1.focus();
		return false;
	}
	*/
	if (theform.termsconfirm.checked == false) {
		alert("Please agree to the terms and conditions before proceeding.");
		theform.terms_conditions.focus();
		return false;
	}
}


/*
	purpose:
		used in the control panel
	page:
		main control panel login page
	Parameters:
		theform - object reference to the form being passed
*/
function CheckEnvirojobLogin(theform)
{

	if (!IsUsername(theform.username.value))
	{
		alert("Please enter a valid username. (MIN. 5 characters)");
		theform.username.focus();
		return false;
	}

	if (!IsPassword(theform.password.value))
	{
		alert("Please enter a valid password. (MIN. 5 characters)");
		theform.password.focus();
		return false;
	}

	return true;
}

/*
	purpose:
		to make sure the password fields are the same and secret answer has been typed
	pages:
		/envirojobs/login/jobseekerforgotpass.cfm
		/envirojobs/login/employerforgotpass.cfm
	
*/

function CheckForgotpass(theform)
{
		
	/**/
	if (!IsEmail(theform.email.value))
	{
		alert("Please enter a valid email.");
		theform.email.focus();
		return false;
	}

	/**/
	if (!IsPassword(theform.password.value))
	{
		alert("Please enter a valid password.");
		theform.password.focus();
		return false;
	}
	
	if (!IsPassword(theform.confirmpassword.value))
	{
		alert("Please enter a valid password confirmation password.");
		theform.confirmpassword.focus();
		return false;
	}
	
	if (theform.password.value != theform.confirmpassword.value)
	{
		alert ("You Password and Confirm Password do not match");
		theform.confirmpassword.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.secretanswer.value))
	{
		alert("Please enter your secret answer.");
		theform.secretanswer.focus();
		return false;
	}
	
	
	return true;

}




/*
	purpose:
		used in the control panel
	page:
		/admin/group/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckGroupForm(theform)
{
	var test=false;
	
	if (!IsWordSpace(theform.groupinfoname.value))
	{
		alert("Please enter a valid group name.");
		theform.groupinfoname.focus();
		return false;
	}

	if (!IsDescription(theform.groupinfodescription.value))
	{
		alert("Please enter a valid group description.");
		theform.groupinfodescription.focus();
		return false;
	}
						
	return true;
}




/*
	purpose:
		checks the job seeker account contact form.
	page:
		job seeker CheckJobSeekerAccountContactForm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckJobSeekerAccountContactForm(theform)
{
	if (!IsWordNumberSpecial(theform.applicantfirstname.value))
	{
		alert("Please enter your first name.");
		theform.applicantfirstname.focus();
		return false;
	}
	
	if (theform.applicantmiddlename.value != '') 
	{
		if (!IsWordNumberSpecial(theform.applicantmiddlename.value))
		{
			alert("Please enter your middle name.");
			theform.applicantmiddlename.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.applicantlastname.value))
	{
		alert("Please enter your last name.");
		theform.applicantlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.applicantaddress.value))
	{
		alert("Please enter your address.");
		theform.applicantaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.applicantcity.value))
	{
		alert("Please enter your city.");
		theform.applicantcity.focus();
		return false;
	}
	
	if (theform.stateid[theform.stateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid.focus();
		return false;
	}
	
	if (theform.countryid[theform.countryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.applicantpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.applicantpostal.focus();
		return false;
	}

	if (!IsPhone(theform.applicantphone.value))
	{
		alert("Please enter a valid phone number. (xxx-xxx-xxxx)");
		theform.applicantphone.focus();
		return false;
	}
	
	if (!IsEmail(theform.applicantemail.value))
	{
		alert("Please enter a valid email address.");
		theform.applicantemail.focus();
		return false;
	}
	
	return true;	
}



/*
	purpose:
		checks the job seeker account login form.
	page:
		job seeker CheckJobSeekerAccountLoginForm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckJobSeekerAccountLoginForm(theform)
{
	if (theform.userinfopassword.value != theform.userinfopasswordconfirm.value)
	{
		alert ("You Password and Confirm Password do not match");
		theform.userinfopasswordconfirm.focus();
		return false;
	}
	
	if (theform.userinfoemail.value != theform.userinfoemailconfirm.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.userinfoemail.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.userinfosecretquestion.value))
	{
		alert("Please enter your secret question.");
		theform.userinfosecretquestion.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.userinfosecretanswer.value))
	{
		alert("Please enter your secret answer.");
		theform.userinfosecretanswer.focus();
		return false;
	}
	
	return true;
}


/*
	purpose:
		checks the registration form.
	page:
		job seeker regiestation
	Parameters:
		theform - object reference to the form being passed
*/

function CheckJobSeekerRegister(theform)
{
	
	if (!IsWordNumberSpecial(theform.applicantfirstname.value))
	{
		alert("Please enter your first name.");
		theform.applicantfirstname.focus();
		return false;
	}
	
	if (theform.applicantmiddlename.value != '')
	{
		if (!IsWordNumberSpecial(theform.applicantmiddlename.value))
		{
			alert("Please enter your middle name.");
			theform.applicantmiddlename.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.applicantlastname.value))
	{
		alert("Please enter your last name.");
		theform.applicantlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.applicantaddress.value))
	{
		alert("Please enter your address.");
		theform.applicantaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.applicantcity.value))
	{
		alert("Please enter your city.");
		theform.applicantcity.focus();
		return false;
	}
	
	if (theform.stateid[theform.stateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid.focus();
		return false;
	}
	
	if (theform.countryid[theform.countryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.applicantpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.applicantpostal.focus();
		return false;
	}

	if (!IsPhone(theform.applicantphone.value))
	{
		alert("Please enter a valid phone number. (xxx-xxx-xxxx)");
		theform.applicantphone.focus();
		return false;
	}
	
	if (!IsUsername(theform.userinfousername.value))
	{
		alert("Please enter a valid username. (MIN. 5 characters)");
		theform.userinfousername.focus();
		return false;
	}
	
	if (!IsPassword(theform.userinfopassword.value))
	{
		alert("Please enter a valid password.");
		theform.userinfopassword.focus();
		return false;
	}	
	
	if (!IsPassword(theform.userinfopasswordconfirm.value))
	{
		alert("Please enter a valid password confirmation password.");
		theform.userinfopasswordconfirm.focus();
		return false;
	}
	
	if (theform.userinfopassword.value != theform.userinfopasswordconfirm.value)
	{
		alert ("You Password and Confirm Password do not match");
		theform.userinfopasswordconfirm.focus();
		return false;
	}
	
	if (!IsEmail(theform.userinfoemail.value))
	{
		alert("Please enter a valid email address.");
		theform.userinfoemail.focus();
		return false;
	}
	
	
	if (!IsEmail(theform.userinfoemailconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.userinfoemailconfirm.focus();
		return false;
	}
	
	if (theform.userinfoemail.value != theform.userinfoemailconfirm.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.userinfoemail.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.userinfosecretquestion.value))
	{
		alert("Please enter your secret question.");
		theform.userinfosecretquestion.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.userinfosecretanswer.value))
	{
		alert("Please enter your secret answer.");
		theform.userinfosecretanswer.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.applicantcareerlevel.value))
	{
		alert("Please enter your career level.");
		theform.applicantcareerlevel.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.applicantjobtitle.value))
	{
		alert("Please enter your target job title.");
		theform.applicantjobtitle.focus();
		return false;
	}
	
	if (theform.termsconfirm.checked == false) {
		alert("Please agree to the terms and conditions before proceeding.");
		theform.terms_conditions.focus();
		return false;
	}
	
	return true;

}

/*
	purpose:
		used in the control panel
	page:
		main control panel login page
	Parameters:
		theform - object reference to the form being passed
*/
function CheckLoginForm(theform)
{

	if (!IsUsername(theform.username.value))
	{
		alert("Please enter a valid username. (MIN. 5 characters)");
		theform.username.focus();
		return false;
	}

	if (!IsPassword(theform.password.value))
	{
		alert("Please enter a valid password. (MIN. 5 characters)");
		theform.password.focus();
		return false;
	}

	return true;
}



function CheckProductForm(theform)
{
	if (!IsWordNumberSpecial(theform.productname.value))
	{
		alert("Please enter a product name");
		theform.productname.focus();
		return false;
	}
	
	if (!IsNumber(theform.productprice.value))
	{
		alert("Please enter a price.");
		theform.productprice.focus();
		return false;
	}
	
	return true;	
}


/*
	Job Seeker Upload Resume Form.
*/

function CheckUploadResume(theform)
{
	if (!IsWordNumberSpecial(theform.resumetitle.value))
	{
		alert("Please enter a resume title.");
		theform.resumetitle.focus();
		return false;
	}
	
	if (theform.resumeeducationdatemonth[theform.resumeeducationdatemonth.selectedIndex].value == "00")
	{
		alert("Please select a graduated month.");
		theform.resumeeducationdatemonth.focus();
		return false;
	}
	
	if (theform.resumeeducationdateyear[theform.resumeeducationdateyear.selectedIndex].value == "0000")
	{
		alert("Please select a graduated year.");
		theform.resumeeducationdateyear.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.resumeeducationcoursename.value))
	{
		alert("Please enter a field of study / course name.");
		theform.resumeeducationcoursename.focus();
		return false;
	}
	
	if (theform.resumefile.value != "")
	{
	 	image_value=theform.resumefile.value;
		
		if (!IsFileExtensionPdfDoc(image_value.substring(image_value.lastIndexOf("."),image_value.length)))
		{
			alert("Please select a valid document file for uploading (must be .doc or .pdf).");
			theform.resumefile.focus();
			return false;
		}
	}
	
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/user/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckUserForm(theform)
{
	
	if (!IsWordSpace(theform.userinfofirstname.value))
	{
		alert("Please enter a valid first name.");
		theform.userinfofirstname.focus();
		return false;
	}
	
	if (!IsWordSpace(theform.userinfolastname.value))
	{
		alert("Please enter a valid last name.");
		theform.userinfolastname.focus();
		return false;
	}

	if (!IsUsername(theform.userinfousername.value))
	{
		alert("Please enter a valid username.");
		theform.userinfousername.focus();
		return false;
	}

	if ((theform.updatepassword.checked == 1) || (theform.submit_type.value == "add"))
	{
		if (!IsPassword(theform.userinfopassword.value))
		{
			alert("Please enter a valid password.");
			theform.userinfopassword.focus();
			return false;
		}
		
		if (!IsPassword(theform.userinfopasswordconfirm.value))
		{
			alert("Please enter a valid password confirmation password.");
			theform.userinfopasswordconfirm.focus();
			return false;
		}
	 	
		if (theform.userinfopassword.value != theform.userinfopasswordconfirm.value)
		{
		 	alert ("You Password and Confirm Password do not match");
			theform.userinfopasswordconfirm.focus();
			return false;
		}
	}

	if (!IsWordSpace(theform.userinfojobtitle.value))
	{
		alert("Please enter a valid job title.");
		theform.userinfojobtitle.focus();
		return false;
	}
	
	if (!IsEmail(theform.userinfoemailaddress.value))
	{
		alert("Please enter a valid email address.");
		theform.userinfoemailaddress.focus();
		return false;
	}

	if (theform.groupinfoid.selectedIndex == -1)
	{
		alert("Please select at least one group.");
		theform.groupinfoid[0].focus();
		return false;
	}

	return true;
}



/*
	purpose:
		used in the cart page
	page:
		/checkout/index.cfm
	Parameters:
		theorderdetailid - orderdetail id
		thepage - step in the checkout process hte person came from
*/
	
function RemoveItem(theorderdetailid,thepage)
{
	var delete_item=true;
	
	delete_item=confirm("Do you really want to remove this item from your cart?");
	
	if (delete_item)
		window.location.href="/envirojobs/form_action/cf_remove_from_cart.cfm?requesttimeout=5000&recordid="+theorderdetailid+"&from="+thepage;
}
