/*
	purpose:
		used in the account signup area
	page:
		/account/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckAccountInquiryForm(theform)
{
	if (!IsWordNumberSpecial(theform.accountinquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.accountinquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.accountinquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.accountinquirylastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.accountinquirybusinessname.value))
	{
		alert("Please enter your business name.");
		theform.accountinquirybusinessname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.accountinquiryaddress.value))
	{
		alert("Please enter your address.");
		theform.accountinquiryaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.accountinquirycity.value))
	{
		alert("Please enter your city.");
		theform.accountinquirycity.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.accountinquirypostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.accountinquirypostal.focus();
		return false;
	}

	if (!IsPhone(theform.accountinquiryphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx OR xxx-xxx-xxxx ext xxx");
		theform.accountinquiryphone.focus();
		return false;
	}
	
	if (!IsEmail(theform.accountinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.accountinquiryemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.accountinquiryconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.accountinquiryconfirmemail.focus();
		return false;
	}
	
	if (theform.accountinquiryemail.value != theform.accountinquiryconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.accountinquiryconfirmemail.focus();
		return false;
	}
	
	if (theform.accountinquirydescription.value.length < 4)
	{
		alert("Please enter a brief description of your business.");
		theform.accountinquirydescription.focus();
		return false;
	}
	
	return true;
}

/*
	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 OR xxx-xxx-xxxx ext xxx");
		theform.loginphone.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 (!IsDescription(theform.careerdescription.value))
	{
		alert("Please enter a valid career description.");
		theform.careerdescription.focus();
		return false;
	}
	
	if (theform.careernatureofwork.value.length > 0)
	{
		if (!IsDescription(theform.careernatureofwork.value))
		{
			alert("Please enter the type of work.");
			theform.careernatureofwork.focus();
			return false;
		}
	}
	
	if (theform.careerworkingconditions.value.length > 0)
	{
		if (!IsDescription(theform.careerworkingconditions.value))
		{
			alert("Please enter the working conditions.");
			theform.careerworkingconditions.focus();
			return false;
		}
	}
	
	if (theform.careereducation.value.length > 0)
	{
		if (!IsDescription(theform.careereducation.value))
		{
			alert("Please enter the required education.");
			theform.careereducation.focus();
			return false;
		}
	}
	
	if (theform.careertasks.value.length > 0)
	{
		if (!IsDescription(theform.careertasks.value))
		{
			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 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.careerinquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.careerinquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.careerinquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.careerinquirylastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.careerinquiryaddress.value))
	{
		alert("Please enter your address.");
		theform.careerinquiryaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.careerinquirycity.value))
	{
		alert("Please enter your city.");
		theform.careerinquirycity.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.careerinquirypostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.careerinquirypostal.focus();
		return false;
	}

	if (!IsPhone(theform.careerinquiryphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx OR xxx-xxx-xxxx ext xxx");
		theform.careerinquiryphone.focus();
		return false;
	}
	
	if (theform.careerinquiryfax.value.length > 0)
	{
		if (!IsPhone(theform.careerinquiryfax.value))
		{
			alert("Please enter a valid fax number. I.e. xxx-xxx-xxxx");
			theform.careerinquiryfax.focus();
			return false;
		}
	}
	
	if (!IsEmail(theform.careerinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.careerinquiryemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.careerinquiryconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.careerinquiryconfirmemail.focus();
		return false;
	}
	
	if (theform.careerinquiryemail.value != theform.careerinquiryconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.careerinquiryconfirmemail.focus();
		return false;
	}
	
	//check for resume file
	if (theform.careerinquiryresume.value.length > 0)
	{
		temp_file=theform.careerinquiryresume.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.careerinquiryresume.focus();
			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)
{
	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.contactcompany.value))
	{
		alert("Please enter your business name.");
		theform.contactcompany.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 OR xxx-xxx-xxxx ext xxx");
		theform.contactphone.focus();
		return false;
	}
	
	if (theform.contactfax.value.length > 0)
	{
		if (!IsPhone(theform.contactfax.value))
		{
			alert("Please enter a valid fax number. I.e. xxx-xxx-xxxx");
			theform.contactfax.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:
		used in the control panel
	page:
		/admin/event/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckEventForm(theform)
{
	var file_value="";
	var file_value_thumb="";
	
	if (!IsWordNumberSpecial(theform.eventtitle.value))
	{
		alert("Please enter a title.");
		theform.eventtitle.focus();
		return false;
	}
	
	
	if (theform.eventdescription.value.length <= 4)
	{
		alert("Please enter a description.");
		theform.eventdescription.focus();
		return false;
	}
	
	//if we are supposed to upload a thumbnail
	if (theform.uploadimage.value == 1)
	{
		file_value_thumb=theform.eventimage_file.value;
		
		if (file_value_thumb.length > 0)
		{
			if (!IsImageExtension(file_value_thumb.substring(file_value_thumb.lastIndexOf("."),file_value_thumb.length)))
			{
				alert("Please select a valid image for uploading (must be .jpg or .gif).");
				theform.eventimage_file.focus();
				return false;
			}
			
			//check for an image title
			if (!IsWordNumberSpecial(theform.eventimagetitle.value))
			{
				alert("Please enter an image title.");
				theform.eventimagetitle.focus();
				return false;
			}
		}
	}
	
	//if we are supposed to upload a file
	if (theform.uploadfile.value == 1)
	{
		file_value=theform.eventattachment_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.eventattachment_file.focus();
				return false;
			}
			
			//check for an attachment title
			if (!IsWordNumberSpecial(theform.eventattachmenttitle.value))
			{
				alert("Please enter an attachment title.");
				theform.eventattachmenttitle.focus();
				return false;
			}
		}
	}
	
	
	//optional
	if (theform.eventlocation.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.eventlocation.value))
		{
			alert("Please enter a location.");
			theform.eventlocation.focus();
			return false;
		}
	}
	
	//optional
	if (theform.eventcity.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.eventcity.value))
		{
			alert("Please enter a city.");
			theform.eventcity.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;
	}
	
	//optional
	if (theform.eventcontactperson.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.eventcontactperson.value))
		{
			alert("Please enter a contact person.");
			theform.eventcontactperson.focus();
			return false;
		}
	}
	
	if (theform.eventcontactphone.value.length > 0)
	{
		if (!IsPhone(theform.eventcontactphone.value))
		{
			alert("Please enter a contact phone number. I.e. xxx-xxx-xxxx OR xxx-xxx-xxxx ext xxx");
			theform.eventcontactphone.focus();
			return false;
		}
	}
	
	if (theform.eventcontactfax.value.length > 0)
	{
		if (!IsPhone(theform.eventcontactfax.value))
		{
			alert("Please enter a contact fax number. I.e. xxx-xxx-xxxx");
			theform.eventcontactfax.focus();
			return false;
		}
	}
	
	if (theform.eventcontactemail.value.length > 0)
	{
		if (!IsEmail(theform.eventcontactemail.value))
		{
			alert("Please enter a valid email address.");
			theform.eventcontactemail.focus();
			return false;
		}
	}
	
	
	if (!CheckDate(theform,'eventstartdate','Event Start Date'))
		return false;

	if (!CheckDate(theform,'eventenddate','Event End Date'))
		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 (!IsDescription(theform.faqquestion.value))
	{
		alert("Please enter a valid question.");
		theform.faqquestion.focus();
		return false;
	}
				
	if (!IsDescription(theform.faqanswer.value))
	{
		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 (!IsAnyFileExtension(temp_image.substring(temp_image.lastIndexOf("."),temp_image.length)))
		{
			alert("Please select a file for uploading (must be .doc, .txt, .pdf, .ppt,.xls,.jpg,.gif,.tif,.eps,.dst).");
			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 franchise signup area
	page:
		/franchise/apply_for_franchise/
	Parameters:
		theform - object reference to the form being passed
*/

function CheckFranchiseInquiryForm(theform)
{
	if (!IsWordNumberSpecial(theform.franchiseinquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.franchiseinquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.franchiseinquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.franchiseinquirylastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.franchiseinquiryaddress.value))
	{
		alert("Please enter your address.");
		theform.franchiseinquiryaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.franchiseinquirycity.value))
	{
		alert("Please enter your city.");
		theform.franchiseinquirycity.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.franchiseinquirypostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.franchiseinquirypostal.focus();
		return false;
	}

	if (!IsPhone(theform.franchiseinquiryphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx OR xxx-xxx-xxxx ext xxx");
		theform.franchiseinquiryphone.focus();
		return false;
	}
	
	if (theform.franchiseinquiryfax.value.length > 0)
	{
		if (!IsPhone(theform.franchiseinquiryfax.value))
		{
			alert("Please enter a valid fax number. I.e. xxx-xxx-xxxx");
			theform.franchiseinquiryfax.focus();
			return false;
		}
	}
	
	
	if (!IsEmail(theform.franchiseinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.franchiseinquiryemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.franchiseinquiryconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.franchiseinquiryconfirmemail.focus();
		return false;
	}
	
	if (theform.franchiseinquiryemail.value != theform.franchiseinquiryconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.franchiseinquiryconfirmemail.focus();
		return false;
	}
	
	//if they haven't filled out the work history information
	if ((theform.franchiseinquirycompanyname1.value.length < 2) || (theform.franchiseinquirycurrentposition1.value.length < 2) || (theform.franchiseinquiryresponsibilities1.value.length < 2) || (theform.franchiseinquirycomments1.value.length < 2))
	{
		if (!IsWordNumberSpecial(theform.franchiseinquirycompanyname1.value))
		{
			alert("Please enter your work history information: company name.");
			theform.franchiseinquirycompanyname1.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.franchiseinquirycurrentposition1.value))
		{
			alert("Please enter your work history information: position.");
			theform.franchiseinquirycurrentposition1.focus();
			return false;
		}
		
		if (theform.franchiseinquiryresponsibilities1.value.length < 4)
		{
			alert("Please enter your work history information: duties and responsibilities.");
			theform.franchiseinquiryresponsibilities1.focus();
			return false;
		}
		
		/*
			if (theform.franchiseinquirycomments1.value.length < 4)
			{
				alert("Please enter your work history information: comments.");
				theform.franchiseinquirycomments1.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:
		used in the control panel
	page:
		/admin/location/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckLocationForm(theform)
{
	if (!IsWordNumberSpecial(theform.locationname.value))
	{
		alert("Please enter a valid location name.");
		theform.locationname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.locationaddress.value))
	{
		alert("Please enter a valid address.");
		theform.locationaddress.focus();
		return false;
	}
	
	if (theform.locationaddress2.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.locationaddress2.value))
		{
			alert("Please enter a valid address 2 value.");
			theform.locationaddress2.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.locationcity.value))
	{
		alert("Please enter a valid city value.");
		theform.locationcity.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.locationpostal.value))
	{
		alert("Please enter a valid zip/postal code value.");
		theform.locationpostal.focus();
		return false;
	}
	
	if (!IsPhone(theform.locationphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx OR xxx-xxx-xxxx ext xxx");
		theform.locationphone.focus();
		return false;
	}

	if (theform.locationfax.value.length > 0)
	{
		if (!IsPhone(theform.locationfax.value))
		{
			alert("Please enter a valid fax number. I.e. xxx-xxx-xxxx");
			theform.locationfax.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 OR xxx-xxx-xxxx ext xxx");
		theform.loginphone.focus();
		return false;
	}
	
	if (theform.loginfax.value.length > 0)
	{
		if (!IsPhone(theform.loginfax.value))
		{
			alert("Please enter a valid fax number. I.e. xxx-xxx-xxxx");
			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;
	}
	
	
	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 (!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.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/mytrade/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckMyTradeForm(theform)
{
	var file_value="";
	var file_value_thumb="";
	var file_value_large="";
	
	if (!IsWordNumberSpecial(theform.mytradetitle.value))
	{
		alert("Please enter a title.");
		theform.mytradetitle.focus();
		return false;
	}
	
	//if we are supposed to upload a thumbnail
	if (theform.uploadimage.value == 1)
	{
		file_value_thumb=theform.mytradecover_file.value;
		
		if (file_value_thumb.length > 0)
		{
			if (!IsImageExtension(file_value_thumb.substring(file_value_thumb.lastIndexOf("."),file_value_thumb.length)))
			{
				alert("Please select a valid cover image for uploading (must be .jpg or .gif).");
				theform.mytradecover_file.focus();
				return false;
			}
		}
	}
	
	//if we are supposed to upload a large image
	if (theform.uploadlargeimage.value == 1)
	{
		file_value_large=theform.mytradecoverlarge_file.value;
		
		if (file_value_large.length > 0)
		{
			if (!IsImageExtension(file_value_large.substring(file_value_large.lastIndexOf("."),file_value_large.length)))
			{
				alert("Please select a valid cover image for uploading (must be .jpg or .gif).");
				theform.mytradecoverlarge_file.focus();
				return false;
			}
		}
	}
	
	//if we are supposed to upload a file
	if (theform.uploadfile.value == 1)
	{
		file_value=theform.mytradefile_file.value;
		
		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.mytradefile_file.focus();
			return false;
		}
	}
	
	if (!CheckDate(theform,'mytradedate','Issue Date'))
		return false;

	return true;
}



/*
	purpose:
		used in the control panel
	page:
		/admin/news/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckNewsForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.newstitle.value))
	{
		alert("Please enter a valid title.");
		theform.newstitle.focus();
		return false;
	}
	
	if (!IsDescription(theform.newstagline.value))
	{
		alert("Please enter a valid newstagline.");
		theform.newstagline.focus();
		return false;
	}

	if (theform.newsstory.value.length < 4)
	{
		alert("Please enter a valid story.");
		theform.newsstory.focus();
		return false;
	}
	
	//if we are supposed to upload a file
	if (theform.uploadfile.value == 1)
	{
		file_value=theform.newsattachment_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsFileExtensionPdfDoc(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid attachment for uploading (must be .pdf or .doc).");
				theform.newsattachment_file.focus();
				return false;
			}
			
			//check for an attachment title
			if (!IsWordNumberSpecial(theform.newsattachmenttitle.value))
			{
				alert("Please enter an attachment title.");
				theform.newsattachmenttitle.focus();
				return false;
			}
		}
	}
	
	//if we are supposed to upload a thumbnail
	if (theform.uploadthumbnail.value == 1)
	{
		file_value_thumb=theform.newsthumbnail_file.value;
		
		if (file_value_thumb.length > 0)
		{
			if (!IsImageExtension(file_value_thumb.substring(file_value_thumb.lastIndexOf("."),file_value_thumb.length)))
			{
				alert("Please select a valid image for uploading (must be .jpg or .gif).");
				theform.newsthumbnail_file.focus();
				return false;
			}
		}
	}
	
	file_value_thumb="";
	
	//if we are supposed to upload a thumbnail
	if (theform.uploadimage.value == 1)
	{
		file_value_thumb=theform.newsimage_file.value;
		
		if (file_value_thumb.length > 0)
		{
			if (!IsImageExtension(file_value_thumb.substring(file_value_thumb.lastIndexOf("."),file_value_thumb.length)))
			{
				alert("Please select a valid image for uploading (must be .jpg or .gif).");
				theform.newsimage_file.focus();
				return false;
			}
			
			//check for an image title
			if (!IsWordNumberSpecial(theform.newsimagetitle.value))
			{
				alert("Please enter an image title.");
				theform.newsimagetitle.focus();
				return false;
			}
		}
	}
	
	if (!CheckDate(theform,'newsdate','News Date'))
		return false;
		
	
	if (!CheckDate(theform,'newsstartdate','News Start Date'))
		return false;
		
	
	if (!CheckDate(theform,'newsenddate','News End Date'))
		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 control panel
	page:
		/admin/strategicalliance/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckStrategicAllianceForm(theform)
{
	var file_value="";
	
	if (!IsWordNumberSpecial(theform.strategicalliancecompanyname.value))
	{
		alert("Please enter a valid company name.");
		theform.strategicalliancecompanyname.focus();
		return false;
	}
	
	if (!IsDescription(theform.strategicalliancetitle.value))
	{
		alert("Please enter valid title.");
		theform.strategicalliancetitle.focus();
		return false;
	}
	
	if (!IsDescription(theform.strategicalliancedescription.value))
	{
		alert("Please enter valid description.");
		theform.strategicalliancedescription.focus();
		return false;
	}
	
	//if we are supposed to upload an image
	if (theform.uploadsmallimage.value == 1)
	{
		file_value=theform.strategicalliancelogosmall_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsImageExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid small logo file for uploading (must be .jpg or .gif).");
				theform.strategicalliancelogosmall_file.focus();
				return false;
			}
		}
	}
	
	//reset value
	file_value="";
	
	//if we are supposed to upload an image
	if (theform.uploadimage.value == 1)
	{
		file_value=theform.strategicalliancelogo_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsImageExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid logo file for uploading (must be .jpg or .gif).");
				theform.strategicalliancelogo_file.focus();
				return false;
			}
		}
	}
	
				
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/testimonial/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckTestimonialForm(theform)
{
	var file_value_thumb="";
	
	
	
	if (!IsDescription(theform.testimonialcontent.value))
	{
		alert("Please enter valid content.");
		theform.testimonialcontent.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.testimonialsource.value))
	{
		alert("Please enter a valid testimonial source.");
		theform.testimonialsource.focus();
		return false;
	}
	
	//if we are supposed to upload an image
	if (theform.uploadimage.value == 1)
	{
		file_value_thumb=theform.testimonialphoto_file.value;
		
		if (file_value_thumb.length > 0)
		{
			if (!IsImageExtension(file_value_thumb.substring(file_value_thumb.lastIndexOf("."),file_value_thumb.length)))
			{
				alert("Please select a valid image for uploading (must be .jpg or .gif).");
				theform.testimonialphoto_file.focus();
				return false;
			}
		}
	}
	
				
	return true;
}



/*
	purpose:
		used in the control panel
	page:
		/admin/tradewins/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckTradeWinsForm(theform)
{
	var temp_file="";
	
	if (!IsWordNumberSpecial(theform.tradewinstitle.value))
	{
		alert("Please enter a valid title.");
		theform.tradewinstitle.focus();
		return false;
	}


	//check if there is an upload field
	if (theform.uploadfile.value == 1)
	{
		temp_file=theform.tradewinsattachment_file.value;
		
		if (!IsFileExtension(temp_file.substring(temp_file.lastIndexOf("."),temp_file.length)))
		{
			alert("Please select a file for uploading (must be .doc, .txt, .pdf, or .xls).");
			theform.tradewinsattachment_file.focus();
			return false;
		}
	}
	
	if (!CheckDate(theform,'tradewinsdate','Date'))
		return false;
		
	if (!CheckDate(theform,'tradewinsstartdate','Display Start Date'))
		return false;
		
	if (!CheckDate(theform,'tradewinsenddate','Display End Date'))
		return false;
		
	return true;
}




/*
	purpose:
		used in the control panel
	page:
		/admin/tradewinscontent/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckTradeWinsContentForm(theform)
{
	
	if (!IsDescription(theform.tradewinscontenttext.value))
	{
		alert("Please enter valid content.");
		theform.tradewinscontenttext.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 front end
	page:
		/
	Parameters:
		theform - object reference to the form being passed
*/

function CheckSearchForm(theform)
{
	
	if (theform.keyword.value.length<=0)
	{
		alert("Please enter a keyword.");
		theform.keyword.focus();
		return false;
	}

	return true;
}