

/*
	purpose:
		used in the control panel
	page:
		/admin/login/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckAdminLoginForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.logincompanyname.value))
	{
		alert("Please enter a valid company name.");
		theform.logincompanyname.focus();
		return false;
	}
	
	if (!IsUsername(theform.loginusername.value))
	{
		alert("Please enter a valid username.");
		theform.loginusername.focus();
		return false;
	}

	if ((theform.updatepassword.checked == 1) || (theform.submit_type.value == "add"))
	{
		if (!IsPassword(theform.loginpassword.value))
		{
			alert("Please enter a valid password.");
			theform.loginpassword.focus();
			return false;
		}
		
		if (!IsPassword(theform.loginpasswordconfirm.value))
		{
			alert("Please enter a valid password confirmation password.");
			theform.loginpasswordconfirm.focus();
			return false;
		}
	 	
		if (theform.loginpassword.value != theform.loginpasswordconfirm.value)
		{
		 	alert ("You Password and Confirm Password do not match");
			theform.loginpasswordconfirm.focus();
			return false;
		}
	}

	
	if (!IsWordSpace(theform.loginfirstname.value))
	{
		alert("Please enter a valid first name.");
		theform.loginfirstname.focus();
		return false;
	}
	
	if (!IsWordSpace(theform.loginlastname.value))
	{
		alert("Please enter a valid last name.");
		theform.loginlastname.focus();
		return false;
	}
	
	
	if (!IsWordNumberSpecial(theform.loginaddress.value))
	{
		alert("Please enter a valid address.");
		theform.loginaddress.focus();
		return false;
	}
	
	if (theform.loginaddress2.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.loginaddress2.value))
		{
			alert("Please enter a valid address 2 value.");
			theform.loginaddress2.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.logincity.value))
	{
		alert("Please enter a valid city value.");
		theform.logincity.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.loginpostal.value))
	{
		alert("Please enter a valid zip/postal code value.");
		theform.loginpostal.focus();
		return false;
	}
	
	if (!IsEmail(theform.loginemail.value))
	{
		alert("Please enter a valid email address.");
		theform.loginemail.focus();
		return false;
	}

	if (!IsPhone(theform.loginphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.loginphone.focus();
		return false;
	}
	
	if (theform.loginphoneextension.value.length > 0)
	{
		if (!IsPhoneExtension(theform.loginphoneextension.value))
		{
			alert("Please enter a valid extension. i.e. 222");
			theform.loginphoneextension.focus();
			return false;
		}
	}

	if (!IsPhone(theform.loginfax.value))
	{
		alert("Please enter a valid fax number. I.e. xxx-xxx-xxxx");
		theform.loginfax.focus();
		return false;
	}
		
	if (!CheckDate(theform,'expiry','Expiration Date',1))
		return false;
		
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/career/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckCareerForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.careername.value))
	{
		alert("Please enter a valid career name.");
		theform.careername.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.careerlocation.value))
	{
		alert("Please enter a valid career location.");
		theform.careerlocation.focus();
		return false;
	}


	if (theform.careerdescription.value.length < 4)
	{
		alert("Please enter a valid career description.");
		theform.careerdescription.focus();
		return false;
	}
	
	if (theform.careernatureofwork.value.length > 0)
	{
		if (theform.careernatureofwork.value.length < 4)
		{
			alert("Please enter the type of work.");
			theform.careernatureofwork.focus();
			return false;
		}
	}
	
	if (theform.careerworkingconditions.value.length > 0)
	{
		if (theform.careerworkingconditions.value.length < 4)
		{
			alert("Please enter the working conditions.");
			theform.careerworkingconditions.focus();
			return false;
		}
	}
	
	if (theform.careereducation.value.length > 0)
	{
		if (theform.careereducation.value.length < 4)
		{
			alert("Please enter the required education.");
			theform.careereducation.focus();
			return false;
		}
	}
	
	if (theform.careertasks.value.length > 0)
	{
		if (theform.careertasks.value.length < 4)
		{
			alert("Please enter the tasks.");
			theform.careertasks.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.careerreportsto.value))
	{
		alert("Please enter the reports to value.");
		theform.careerreportsto.focus();
		return false;
	}
	
	if (!CheckDate(theform,'careerclosingdate','Closing Date',1))
		return false;
		
	return true;
}


/*
	purpose:
		used in the contact page
	page:
		/contactus/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckContactForm(theform)
{
	var item_checked=false;

	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. I.e. 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 career inquiry page
	page:
		/careers/career_inquiry.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckCareerInquiryForm(theform)
{
	var temp_file="";
	
	if (!IsWordNumberSpecial(theform.careerfirstname.value))
	{
		alert("Please enter your first name.");
		theform.careerfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.careerlastname.value))
	{
		alert("Please enter your last name.");
		theform.careerlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.careeraddress.value))
	{
		alert("Please enter your address.");
		theform.careeraddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.careercity.value))
	{
		alert("Please enter your city.");
		theform.careercity.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.careerpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.careerpostal.focus();
		return false;
	}

	if (!IsPhone(theform.careerphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.careerphone.focus();
		return false;
	}
	
	if (theform.careerphoneextension.value.length > 0)
	{
		if (!IsPhoneExtension(theform.careerphoneextension.value))
		{
			alert("Please enter a valid extension. i.e. 222");
			theform.careerphoneextension.focus();
			return false;
		}
	}
	
	if (theform.careerfax.value.length > 0)
	{
		if (!IsPhone(theform.careerfax.value))
		{
			alert("Please enter a valid fax number.");
			theform.careerfax.focus();
			return false;
		}
	}
	
	if (!IsEmail(theform.careeremail.value))
	{
		alert("Please enter a valid email address.");
		theform.careeremail.focus();
		return false;
	}
	
	if (!IsEmail(theform.careerconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.careerconfirmemail.focus();
		return false;
	}
	
	if (theform.careeremail.value != theform.careerconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.careerconfirmemail.focus();
		return false;
	}
	
	//check for resume file
	if (theform.careerresume.value.length > 0)
	{
		temp_file=theform.careerresume.value;
		
		if (!IsFileExtensionResume(temp_file.substring(temp_file.lastIndexOf("."),temp_file.length)))
		{
			alert("Please select a resume document in either rtf, txt, doc or pdf format.");
			theform.careerresume.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:
		used in the control panel
	page:
		/admin/faq/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckFaqForm(theform)
{
	
	if (theform.faqquestion.value.length < 4)
	{
		alert("Please enter a valid question.");
		theform.faqquestion.focus();
		return false;
	}
				
	if (theform.faqanswer.value.length < 4)
	{
		alert("Please enter a valid answer.");
		theform.faqanswer.focus();
		return false;
	}

return true;
}




/*
	purpose:
		used in the control panel
	page:
		/admin/filecategory/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckFileCategoryForm(theform)
{
	if (!IsWordNumberSpecial(theform.filecategoryname.value))
	{
		alert("Please enter a valid category name.");
		theform.filecategoryname.focus();
		return false;
	}

	return true;
}

/*
	purpose:
		used in the control panel
	page:
		/admin/file/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckFileForm(theform)
{
	if (!IsWordNumberSpecial(theform.filetitle.value))
	{
		alert("Please enter a valid file name.");
		theform.filetitle.focus();
		return false;
	}


	//check if there is an upload field
	if (theform.uploadfile.value == 1)
	{
		temp_image=theform.filename_file.value;
		
		if (!IsFileExtension(temp_image.substring(temp_image.lastIndexOf("."),temp_image.length)))
		{
			alert("Please select a file for uploading (must be .doc, .txt, .pdf, .ppt or .xls).");
			theform.filename_file.focus();
			return false;
		}
	}
	
	if (theform.filedescription.value.length > 0)
	{
		if (!IsDescription(theform.filedescription.value))
		{
			alert("Please enter a valid file description.");
			theform.filedescription.focus();
			return false;
		}
	}
	

	return true;
}





/*
	purpose:
		used in the financial planner inquiry page
	page:
		/services/for_financial_planners/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckFinancialPlannerInquiryForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.financialplannerfirstname.value))
	{
		alert("Please enter your first name.");
		theform.financialplannerfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.financialplannerlastname.value))
	{
		alert("Please enter your last name.");
		theform.financialplannerlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.financialplannercompany.value))
	{
		alert("Please enter your company name.");
		theform.financialplannercompany.focus();
		return false;
	}
	
	if (theform.financialplannerdesignation[theform.financialplannerdesignation.selectedIndex].value == "Other")
	{
		if (!IsWordNumberSpecial(theform.financialplannerdesignationother.value))
		{
			alert("Please enter your designation.");
			theform.financialplannerdesignationother.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.financialplanneraddress.value))
	{
		alert("Please enter your address.");
		theform.financialplanneraddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.financialplannercity.value))
	{
		alert("Please enter your city.");
		theform.financialplannercity.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.financialplannerpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.financialplannerpostal.focus();
		return false;
	}

	if (!IsPhone(theform.financialplannerphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.financialplannerphone.focus();
		return false;
	}
	
	if (theform.financialplannerphoneextension.value.length > 0)
	{
		if (!IsPhoneExtension(theform.financialplannerphoneextension.value))
		{
			alert("Please enter a valid extension. i.e. 222");
			theform.financialplannerphoneextension.focus();
			return false;
		}
	}
	
	if (theform.financialplannerfax.value.length > 0)
	{
		if (!IsPhone(theform.financialplannerfax.value))
		{
			alert("Please enter a valid fax number.");
			theform.financialplannerfax.focus();
			return false;
		}
	}
	
	if (!IsEmail(theform.financialplanneremail.value))
	{
		alert("Please enter a valid email address.");
		theform.financialplanneremail.focus();
		return false;
	}
	
	if (!IsEmail(theform.financialplannerconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.financialplannerconfirmemail.focus();
		return false;
	}
	
	if (theform.financialplanneremail.value != theform.financialplannerconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.financialplannerconfirmemail.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 (theform.groupinfodescription.value.length < 4)
	{
		alert("Please enter a valid group description.");
		theform.groupinfodescription.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;
}




/*
	purpose:
		used in the login inquiry page
	page:
		/login/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckLoginInquiryForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.loginfirstname.value))
	{
		alert("Please enter your first name.");
		theform.loginfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.loginlastname.value))
	{
		alert("Please enter your last name.");
		theform.loginlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.logincompany.value))
	{
		alert("Please enter your company name.");
		theform.logincompany.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.loginmutualdealer.value))
	{
		alert("Please enter the name of your Mutual Fund Dealer.");
		theform.loginmutualdealer.focus();
		return false;
	}

	
	
	if (!IsWordNumberSpecial(theform.loginaddress.value))
	{
		alert("Please enter your address.");
		theform.loginaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.logincity.value))
	{
		alert("Please enter your city.");
		theform.logincity.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.loginpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.loginpostal.focus();
		return false;
	}

	if (!IsPhone(theform.loginphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.loginphone.focus();
		return false;
	}
	
	if (theform.loginphoneextension.value.length > 0)
	{
		if (!IsPhoneExtension(theform.loginphoneextension.value))
		{
			alert("Please enter a valid extension. i.e. 222");
			theform.loginphoneextension.focus();
			return false;
		}
	}
	
	if (theform.loginfax.value.length > 0)
	{
		if (!IsPhone(theform.loginfax.value))
		{
			alert("Please enter a valid fax number.");
			theform.loginfax.focus();
			return false;
		}
	}
	
	if (!IsEmail(theform.loginemail.value))
	{
		alert("Please enter a valid email address.");
		theform.loginemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.loginconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.loginconfirmemail.focus();
		return false;
	}
	
	if (theform.loginemail.value != theform.loginconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.loginconfirmemail.focus();
		return false;
	}
	
	if (theform.logininquiryiam[theform.logininquiryiam.selectedIndex].value == "Other")
	{
		if (!IsWordNumberSpecial(theform.logininquiryiamother.value))
		{
			alert("Please tell us your profession (Other).");
			theform.logininquiryiamother.focus();
			return false;
		}
			
	}

	return true;
}



/*
	purpose:
		used in the front end 
	page:
		/enews/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckMailingListForm(theform)
{
	
	if (!IsWordSpace(theform.mailinglistfirstname.value))
	{
		alert("Please enter a valid first name.");
		theform.mailinglistfirstname.focus();
		return false;
	}
	
	if (!IsWordSpace(theform.mailinglistlastname.value))
	{
		alert("Please enter a valid last name.");
		theform.mailinglistlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.mailinglistaddress.value))
	{
		alert("Please enter your address.");
		theform.mailinglistaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.mailinglistcity.value))
	{
		alert("Please enter your city.");
		theform.mailinglistcity.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.mailinglistpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.mailinglistpostal.focus();
		return false;
	}

	if (!IsPhone(theform.mailinglistphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.mailinglistphone.focus();
		return false;
	}
	
	if (theform.mailinglistphoneextension.value.length > 0)
	{
		if (!IsPhoneExtension(theform.mailinglistphoneextension.value))
		{
			alert("Please enter a valid extension. i.e. 222");
			theform.mailinglistphoneextension.focus();
			return false;
		}
	}
	
	if (theform.mailinglistfax.value.length > 0)
	{
		if (!IsPhone(theform.mailinglistfax.value))
		{
			alert("Please enter a valid fax number.");
			theform.mailinglistfax.focus();
			return false;
		}
	}
	
	if (!IsEmail(theform.mailinglistemailaddress.value))
	{
		alert("Please enter a valid email address.");
		theform.mailinglistemailaddress.focus();
		return false;
	}
	
	if (!IsEmail(theform.mailinglistemailaddressconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.mailinglistemailaddressconfirm.focus();
		return false;
	}
	
	if (theform.mailinglistemailaddress.value != theform.mailinglistemailaddressconfirm.value)
	{
		alert("Sorry, your email address and confirmation email address do not match, please try again.");
		theform.mailinglistemailaddress.focus();
		return false;
	}
	
	
	if (theform.mailinglistiam[theform.mailinglistiam.selectedIndex].value == "Other")
	{
		if (!IsWordNumberSpecial(theform.mailinglistiamother.value))
		{
			alert("Please tell us your profession (Other).");
			theform.mailinglistiamother.focus();
			return false;
		}
			
	}
	
	if (theform.mailinglistoptin.checked == false)
	{
		alert("Please check the box indicating you have read and agree to our privacy policy.");
		theform.mailinglistoptin.focus();
		return false;
	}

	return true;
}


/*
	purpose:
		used in the front end 
	page:
		/enews/removal.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckMailingListRemovalForm(theform)
{
	
	if (!IsEmail(theform.emailaddress.value))
	{
		alert("Please enter a valid email address.");
		theform.emailaddress.focus();
		return false;
	}
	
	if (!IsEmail(theform.emailaddressconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.emailaddressconfirm.focus();
		return false;
	}
	
	if (theform.emailaddress.value != theform.emailaddressconfirm.value)
	{
		alert("Sorry, your email address and confirmation email address do not match, please try again.");
		theform.emailaddress.focus();
		return false;
	}
	
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/media/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckMediaForm(theform)
{
	if (!IsWordNumberSpecial(theform.medianame.value))
	{
		alert("Please enter a valid name.");
		theform.medianame.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.mediasource.value))
	{
		alert("Please enter a valid source.");
		theform.mediasource.focus();
		return false;
	}



	//check if there is an upload field
	if (theform.uploadfile.value == 1)
	{
		temp_image=theform.filename_file.value;
		
		if (!IsFileExtension(temp_image.substring(temp_image.lastIndexOf("."),temp_image.length)))
		{
			alert("Please select a file for uploading (must be .doc or .pdf).");
			theform.filename_file.focus();
			return false;
		}
	}
	
	if (!CheckDate(theform,'mediadate','Media Date'))
		return false;

	return true;
}



/*
	purpose:
		used in the mortgage broker inquiry page
	page:
		/services/for_mortgage_brokers/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckMortgageBrokerInquiryForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.mortgagebrokerfirstname.value))
	{
		alert("Please enter your first name.");
		theform.mortgagebrokerfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.mortgagebrokerlastname.value))
	{
		alert("Please enter your last name.");
		theform.mortgagebrokerlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.mortgagebrokercompany.value))
	{
		alert("Please enter your company name.");
		theform.mortgagebrokercompany.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.mortgagebrokeraddress.value))
	{
		alert("Please enter your address.");
		theform.mortgagebrokeraddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.mortgagebrokercity.value))
	{
		alert("Please enter your city.");
		theform.mortgagebrokercity.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.mortgagebrokerpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.mortgagebrokerpostal.focus();
		return false;
	}

	if (!IsPhone(theform.mortgagebrokerphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.mortgagebrokerphone.focus();
		return false;
	}
	
	if (theform.mortgagebrokerphoneextension.value.length > 0)
	{
		if (!IsPhoneExtension(theform.mortgagebrokerphoneextension.value))
		{
			alert("Please enter a valid extension. i.e. 222");
			theform.mortgagebrokerphoneextension.focus();
			return false;
		}
	}
	
	if (theform.mortgagebrokerfax.value.length > 0)
	{
		if (!IsPhone(theform.mortgagebrokerfax.value))
		{
			alert("Please enter a valid fax number.");
			theform.mortgagebrokerfax.focus();
			return false;
		}
	}
	
	if (!IsEmail(theform.mortgagebrokeremail.value))
	{
		alert("Please enter a valid email address.");
		theform.mortgagebrokeremail.focus();
		return false;
	}
	
	if (!IsEmail(theform.mortgagebrokerconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.mortgagebrokerconfirmemail.focus();
		return false;
	}
	
	if (theform.mortgagebrokeremail.value != theform.mortgagebrokerconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.mortgagebrokerconfirmemail.focus();
		return false;
	}
	
	
	return true;
}



/*
	purpose:
		used in the control panel
	page:
		/admin/seminar/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckSeminarForm(theform)
{
	var file_value="";
	
	if (!IsWordNumberSpecial(theform.seminartitle.value))
	{
		alert("Please enter a seminartitle.");
		theform.seminartitle.focus();
		return false;
	}
	
	//optional
	if (theform.seminarlocation.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.seminarlocation.value))
		{
			alert("Please enter a location.");
			theform.seminarlocation.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.seminarcity.value))
	{
		alert("Please enter a city.");
		theform.seminarcity.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminaraddress.value))
	{
		alert("Please enter an address value.");
		theform.seminaraddress.focus();
		return false;
	}
		
	if (!IsWordNumberSpecial(theform.seminaraddress2.value))
	{
		alert("Please enter an address 2 value.");
		theform.seminaraddress2.focus();
		return false;
	}
			
	//optional
	if (theform.seminarpostal.value.length > 0)
	{
		if (!IsPostalCode(theform.seminarpostal.value))
		{
			alert("Please enter a zip/postal code.");
			theform.seminarpostal.focus();
			return false;
		}
	}
	
	
	if (theform.seminarshortdescription.value.length <= 4)
	{
		alert("Please enter a short description.");
		theform.seminarshortdescription.focus();
		return false;
	}
	
	
	if (theform.seminardescription.value.length <= 4)
	{
		alert("Please enter a description.");
		theform.seminardescription.focus();
		return false;
	}
	
	
	//if we are supposed to upload a file
	if (theform.uploadfile.value == 1)
	{
		file_value=theform.seminarattachment_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsFileExtensionPdfDoc(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid file for uploading (must be .pdf or .doc).");
				theform.seminarattachment_file.focus();
				return false;
			}
		}
	}
	
	
	//if we are to use the date
	if (theform.seminarshowdate[theform.seminarshowdate.selectedIndex].value == 1)
	{
		
		if (!CheckDate(theform,'seminardate','Seminar Date'))
			return false;
			
		//double check for blank selections 
		if (theform.seminardate_month[theform.seminardate_month.selectedIndex].value == "")
		{
			alert("Please select an seminar date.");
			return false;
		}

		if (theform.seminardate_day[theform.seminardate_day.selectedIndex].value == "")
		{
			alert("Please select an seminar date.");
			return false;
		}

		if (theform.seminardate_year[theform.seminardate_year.selectedIndex].value == "")
		{
			alert("Please select an seminar date.");
			return false;
		}

	}

	if (!CheckDate(theform,'seminarstartdate','Seminar Start Date'))
		return false;

	if (!CheckDate(theform,'seminarenddate','Seminar End Date'))
		return false;
	
	return true;
}



/*
	purpose:
		used in the seminar inquiry page
	page:
		/seminars/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckSeminarInquiryForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.seminarfirstname.value))
	{
		alert("Please enter your first name.");
		theform.seminarfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarlastname.value))
	{
		alert("Please enter your last name.");
		theform.seminarlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminaraddress.value))
	{
		alert("Please enter your address.");
		theform.seminaraddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarcity.value))
	{
		alert("Please enter your city.");
		theform.seminarcity.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.seminarpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.seminarpostal.focus();
		return false;
	}

	if (!IsPhone(theform.seminarphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.seminarphone.focus();
		return false;
	}
	
	if (theform.seminarphoneextension.value.length > 0)
	{
		if (!IsPhoneExtension(theform.seminarphoneextension.value))
		{
			alert("Please enter a valid extension. i.e. 222");
			theform.seminarphoneextension.focus();
			return false;
		}
	}
	
	if (theform.seminarfax.value.length > 0)
	{
		if (!IsPhone(theform.seminarfax.value))
		{
			alert("Please enter a valid fax number. i.e. 2223334444 or 222-333-4444");
			theform.seminarfax.focus();
			return false;
		}
	}
	
	if (!IsEmail(theform.seminaremail.value))
	{
		alert("Please enter a valid email address.");
		theform.seminaremail.focus();
		return false;
	}
	
	if (!IsEmail(theform.seminarconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.seminarconfirmemail.focus();
		return false;
	}
	
	if (theform.seminaremail.value != theform.seminarconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.seminarconfirmemail.focus();
		return false;
	}
	
	
	return true;
}





/*
	purpose:
		used in the seminar signup page
	page:
		/seminars/seminar_signup.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckSeminarSignupForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.seminarfirstname.value))
	{
		alert("Please enter your first name.");
		theform.seminarfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarlastname.value))
	{
		alert("Please enter your last name.");
		theform.seminarlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminaraddress.value))
	{
		alert("Please enter your address.");
		theform.seminaraddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarcity.value))
	{
		alert("Please enter your city.");
		theform.seminarcity.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.seminarpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.seminarpostal.focus();
		return false;
	}

	if (!IsPhone(theform.seminarphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.seminarphone.focus();
		return false;
	}
	
	if (theform.seminarphoneextension.value.length > 0)
	{
		if (!IsPhoneExtension(theform.seminarphoneextension.value))
		{
			alert("Please enter a valid extension. i.e. 222");
			theform.seminarphoneextension.focus();
			return false;
		}
	}
	
	
	if (!IsEmail(theform.seminaremail.value))
	{
		alert("Please enter a valid email address.");
		theform.seminaremail.focus();
		return false;
	}
	
	if (!IsEmail(theform.seminarconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.seminarconfirmemail.focus();
		return false;
	}
	
	if (theform.seminaremail.value != theform.seminarconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.seminarconfirmemail.focus();
		return false;
	}
	
	//if this person found out from a mortgage broker
	if (theform.seminarfoundout[theform.seminarfoundout.selectedIndex].value == "A Mortgage Broker")
	{
		//fill out the mortgage broker name and email
		if (!IsWordNumberSpecial(theform.seminarfoundoutbroker.value))
		{
			alert("Please enter the Mortgage Broker name.");
			theform.seminarfoundoutbroker.focus();
			return false;
		}
		if (!IsEmail(theform.seminarfoundoutemail.value))
		{
			alert("Please enter the Mortgage Broker email address.");
			theform.seminarfoundoutemail.focus();
			return false;
		}
	}
	
	return true;
}

/*
	purpose:
		used in the login section
	page:
		/login/login_reminder.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckStaffForgotPasswordForm(theform)
{
	
	if (!IsEmail(theform.loginemailaddress.value))
	{
		alert("Please enter a valid email address.");
		theform.loginemailaddress.focus();
		return false;
	}
	
	return true;
}



/*
	purpose:
		used in the front of site
	page:
		/login/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckStaffLoginForm(theform)
{

	if (theform.loginusername.value.length < 5)
	{
		alert("Please enter a valid username.");
		theform.loginusername.focus();
		return false;
	}

	if (!IsPassword(theform.loginpassword.value))
	{
		alert("Please enter a valid password. (MIN. 5 characters)");
		theform.loginpassword.focus();
		return false;
	}

	return true;
}



/*
	purpose:
		used in the tell others section
	page:
		/admin/tell_others/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckTellOthersForm(theform)
{
		
	if (!IsWordNumberSpecial(theform.recipientname.value))
	{
		alert("Please enter the recipients name.");
		theform.recipientname.focus();
		return false;
	}
	
	if (!IsEmail(theform.recipientemail.value))
	{
		alert("Please enter a valid recipient email address.");
		theform.recipientemail.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.sendername.value))
	{
		alert("Please enter your name.");
		theform.sendername.focus();
		return false;
	}
	
	if (!IsEmail(theform.senderemail.value))
	{
		alert("Please enter a valid email address.");
		theform.senderemail.focus();
		return false;
	}
	
}



/*
	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;
}