/*
	purpose:
		used in the control panel
	page:
		/admin/advocacy_content/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckAdvocacyContentForm(theform)
{
	if (theform.advocacycontenttop.value.length < 4)
	{
		alert("Please enter a valid advocacy content top value.");
		theform.advocacycontenttop.focus();
		return false;
	}

	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/advocacy_item/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckAdvocacyItemForm(theform)
{
	var file_value="";
	
	if (!IsWordNumberSpecial(theform.advocacyitemname.value))
	{
		alert("Please enter a valid advocacy item name.");
		theform.advocacyitemname.focus();
		return false;
	}
	
	/*
	if (theform.resourcedescription.value.length < 4)
	{
		alert("Please enter valid advocacy item description.");
		theform.resourcedescription.focus();
		return false;
	}
	*/
	//if we are supposed to upload a file
	if (theform.uploadfile.value == 1)
	{
		file_value=theform.advocacyitemattachment_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsFileExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid file for uploading (must be .pdf or .doc).");
				theform.advocacyitemattachment_file.focus();
				return false;
			}
		}			
	}

	return true;
}


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

function CheckAdminMemberForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.membercompanyname.value))
	{
		alert("Please enter a valid company name.");
		theform.membercompanyname.focus();
		return false;
	}
	
	if (theform.membercategoryid[theform.membercategoryid.selectedIndex].value == "")
	{
		alert("Please select a business category.");
		theform.membercategoryid.focus();
		return false;
	}
	
	if (theform.memberdescription.value.length < 4)
	{
		alert("Please enter a valid description.");
		theform.memberdescription.focus();
		return false;
	}
	
	/*
	if (!IsWordNumberSpecial(theform.membermailaddress.value))
	{
		alert("Please enter a valid mail address.  i.e. P.O. Box xxx.");
		theform.membermailaddress.focus();
		return false;
	}
	*/
	
	if (!IsWordNumberSpecial(theform.memberstreet.value))
	{
		alert("Please enter a valid street address. i.e. 123 this street");
		theform.memberstreet.focus();
		return false;
	}

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

	if (theform.stateid[theform.stateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.memberpostalcode.value))
	{
		alert("Please enter a valid postal/zip code.");
		theform.memberpostalcode.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.memberphoneareacode.value))
	{
		alert("Please enter a valid phone area code.");
		theform.memberphoneareacode.focus();
		return false;
	}


	if (!IsWordNumberSpecial(theform.memberphonenumber.value))
	{
		alert("Please enter a valid phone number.");
		theform.memberphonenumber.focus();
		return false;
	}
	
	if (theform.memberphonemobile.value.length > 0)
	{
		if (!IsPhone(theform.memberphonemobile.value))
		{
			alert("Please enter a valid mobile phone number.");
			theform.memberphonemobile.focus();
			return false;
		}
	}


	if (theform.membertollfree.value.length > 0)
	{
		if (!IsTollFree(theform.membertollfree.value))
		{
			alert("Please enter a valid toll free number.");
			theform.membertollfree.focus();
			return false;
		}
	}
	
	if ((theform.memberfaxareacode.value.length > 0) || (theform.memberfaxnumber.value.length > 0))
	{
		if (!IsWordNumberSpecial(theform.memberfaxareacode.value))
		{
			alert("Please enter a valid fax area code.");
			theform.memberfaxareacode.focus();
			return false;
		}
	
	
		if (!IsWordNumberSpecial(theform.memberfaxnumber.value))
		{
			alert("Please enter a valid fax number.");
			theform.memberfaxnumber.focus();
			return false;
		}
	}
	
/*
	if (!IsEmail(theform.memberemailaddress.value))
	{
		alert("Please enter a valid email address.");
		theform.memberemailaddress.focus();
		return false;
	}
*/

	if (!IsWordNumberSpecial(theform.memberyearestablished.value))
	{
		alert("Please enter the year your business was established.");
		theform.memberyearestablished.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.membernumberemployees.value))
	{
		alert("Please enter a the number of employees at your business.");
		theform.membernumberemployees.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.memberprimarycontactsalutation.value))
	{
		alert("Please enter a valid primary contact salutation.");
		theform.memberprimarycontactsalutation.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.memberprimarycontactfirstname.value))
	{
		alert("Please enter a valid primary contact first name.");
		theform.memberprimarycontactfirstname.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.memberprimarycontactlastname.value))
	{
		alert("Please enter a valid primary contact last name.");
		theform.memberprimarycontactlastname.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.memberprimarycontacttitle.value))
	{
		alert("Please enter a valid primary contact title.");
		theform.memberprimarycontacttitle.focus();
		return false;
	}
	
	if ((theform.membersecondarycontactsalutation.value.length > 0) || (theform.membersecondarycontactfirstname.value.length > 0) || (theform.membersecondarycontactlastname.value.length > 0) || (theform.membersecondarycontacttitle.value.length > 0))
	{
		if (!IsWordNumberSpecial(theform.membersecondarycontactsalutation.value))
		{
			alert("Please enter a valid secondary contact salutation.");
			theform.membersecondarycontactsalutation.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.membersecondarycontactfirstname.value))
		{
			alert("Please enter a valid secondary contact first name.");
			theform.membersecondarycontactfirstname.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.membersecondarycontactlastname.value))
		{
			alert("Please enter a valid secondary contact last name.");
			theform.membersecondarycontactlastname.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.membersecondarycontacttitle.value))
		{
			alert("Please enter a valid secondary contact title.");
			theform.membersecondarycontacttitle.focus();
			return false;
		}
	}

	if ((theform.memberthirdcontactsalutation.value.length > 0) || (theform.memberthirdcontactfirstname.value.length > 0) || (theform.memberthirdcontactlastname.value.length > 0) || (theform.memberthirdcontacttitle.value.length > 0))
	{
		if (!IsWordNumberSpecial(theform.memberthirdcontactsalutation.value))
		{
			alert("Please enter a valid third contact salutation.");
			theform.memberthirdcontactsalutation.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.memberthirdcontactfirstname.value))
		{
			alert("Please enter a valid third contact first name.");
			theform.memberthirdcontactfirstname.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.memberthirdcontactlastname.value))
		{
			alert("Please enter a valid third contact last name.");
			theform.memberthirdcontactlastname.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.memberthirdcontacttitle.value))
		{
			alert("Please enter a valid third contact title.");
			theform.memberthirdcontacttitle.focus();
			return false;
		}
	}

	return true;
}




/*
	purpose:
		used in the control panel
	page:
		/admin/pollanswer/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckAdminPollAnswerForm(theform)
{
	if (!IsWordNumberSpecial(theform.pollanswername.value))
	{
		alert("Please enter a valid poll answer.");
		theform.pollanswername.focus();
		return false;
	}
	
	return true;
}



/*
	purpose:
		used in the control panel
	page:
		/admin/pollquestion/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckAdminPollQuestionForm(theform)
{
	if (!IsWordNumberSpecial(theform.pollquestionname.value))
	{
		alert("Please enter a valid poll question name.");
		theform.pollquestionname.focus();
		return false;
	}
	
	if (theform.pollquestiondescription.value.length < 4)
	{
		alert("Please enter a valid poll question.");
		theform.pollquestiondescription.focus();
		return false;
	}
	
	if (!CheckDate(theform,'pollquestionstartdate','Start Date'))
		return false;

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

	return true;
}



/*
	purpose:
		used in the control panel search lookup pages
	page:
		/admin/search/module_viewall.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckAdminSearchMember(theform)
{
	//check 
	if (theform.membername.value.length < 1)
	{
		alert("Please enter the member name.");
		theform.membername.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 company name.");
		theform.contactcompany.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.");
		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:
		/admin/committee/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckCommitteeForm(theform)
{

	if (!IsWordNumberSpecial(theform.committeename.value))
	{
		alert("Please enter a valid committee name.");
		theform.committeename.focus();
		return false;
	}
	
	if (theform.committeedescription.value.length < 4)
	{
		alert("Please enter valid committee description.");
		theform.committeedescription.focus();
		return false;
	}

	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/events/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckEventForm(theform)
{
	var file_value="";

	if (!IsWordNumberSpecial(theform.eventtitle.value))
	{
		alert("Please enter a valid event title.");
		theform.eventtitle.focus();
		return false;
	}
	
	if (theform.eventsubtitle.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.eventsubtitle.value))
		{
			alert("Please enter a valid event sub title.");
			theform.eventsubtitle.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.eventlocation.value))
	{
		alert("Please enter a valid event location.");
		theform.eventlocation.focus();
		return false;
	}
	
	if (theform.eventaddress1.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.eventaddress1.value))
		{
			alert("Please enter a valid event address 1.");
			theform.eventaddress1.focus();
			return false;
		}
	}
	
	if (theform.eventaddress2.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.eventaddress2.value))
		{
			alert("Please enter a valid event address 2.");
			theform.eventaddress2.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.eventcity.value))
	{
		alert("Please enter a valid event city.");
		theform.eventcity.focus();
		return false;
	}
	
	//if we are supposed to upload a file
	if (theform.uploadfile1.value == 1)
	{
		file_value=theform.eventattachment1file_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsFileExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid file for uploading (must be .pdf or .doc).");
				theform.eventattachment1file_file.focus();
				return false;
			}
		}
	}

	//if we are supposed to upload a file
	if (theform.uploadfile2.value == 1)
	{
		file_value=theform.eventattachment2file_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsFileExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid file for uploading (must be .pdf or .doc).");
				theform.eventattachment2file_file.focus();
				return false;
			}
			
		}
	}
	
	//if we are supposed to upload a file
	if (theform.uploadfile3.value == 1)
	{
		file_value=theform.eventattachment3file_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsFileExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid file for uploading (must be .pdf or .doc).");
				theform.eventattachment3file_file.focus();
				return false;
			}
			
		}
	}

	if (!CheckDate(theform,'eventdate','Event Date'))
		return false;

	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/gallery/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckGalleryForm(theform)
{

	if (!IsWordNumberSpecial(theform.galleryname.value))
	{
		alert("Please enter a valid project gallery name.");
		theform.galleryname.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.gallerydate.value))
	{
		alert("Please enter a valid date for this project.");
		theform.gallerydate.focus();
		return false;
	}


	if (!IsWordNumberSpecial(theform.gallerylocation.value))
	{
		alert("Please enter a valid location for this project.");
		theform.gallerylocation.focus();
		return false;
	}
	
	if (theform.gallerydescription.value.length<4)
	{
		alert("Please enter valid project gallery description.");
		theform.gallerydescription.focus();
		return false;
	}
	
	
	if (theform.gallerycontractwork.value.length < 4)
	{
		alert("Please enter valid project gallery contract work completed (separate by commas).");
		theform.gallerycontractwork.focus();
		return false;
	}

	return true;
}


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

function CheckMemberCategoryForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.membercategoryname.value))
	{
		alert("Please enter a valid member category name.");
		theform.membercategoryname.focus();
		return false;
	}
	
	return true;
}


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

function CheckMemberChangeApprovalForm(theform)
{

	if (theform.memberid[theform.memberid.selectedIndex].value == "")
	{
		alert("Please select a member to replace.");
		theform.memberid.focus();
		return false;
	}

	return confirm("Are you sure you wish to update this companies information? (this cannot be reversed).");
}




/*
	purpose:
		used in the member change form
	page:
		/jointhechamber/jointhechamber_request_a_change.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckMemberChangeForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.membercompanyname.value))
	{
		alert("Please enter a valid company name.");
		theform.membercompanyname.focus();
		return false;
	}
	
	/*
	if (!IsWordNumberSpecial(theform.membermailaddress.value))
	{
		alert("Please enter a valid mail address.  i.e. P.O. Box xxx.");
		theform.membermailaddress.focus();
		return false;
	}
	*/
	
	if (!IsWordNumberSpecial(theform.memberstreet.value))
	{
		alert("Please enter a valid street address. i.e. 123 this street");
		theform.memberstreet.focus();
		return false;
	}

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

	if (theform.stateid[theform.stateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.stateid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.memberpostalcode.value))
	{
		alert("Please enter a valid postal/zip code.");
		theform.memberpostalcode.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.memberphoneareacode.value))
	{
		alert("Please enter a valid phone area code.");
		theform.memberphoneareacode.focus();
		return false;
	}


	if (!IsWordNumberSpecial(theform.memberphonenumber.value))
	{
		alert("Please enter a valid phone number.");
		theform.memberphonenumber.focus();
		return false;
	}
	
	if (theform.memberphonemobile.value.length > 0)
	{
		if (!IsPhone(theform.memberphonemobile.value))
		{
			alert("Please enter a valid mobile phone number.");
			theform.memberphonemobile.focus();
			return false;
		}
	}


	if (theform.membertollfree.value.length > 0)
	{
		if (!IsTollFree(theform.membertollfree.value))
		{
			alert("Please enter a valid toll free number.");
			theform.membertollfree.focus();
			return false;
		}
	}
	
	if ((theform.memberfaxareacode.value.length > 0) || (theform.memberfaxnumber.value.length > 0))
	{
		if (!IsWordNumberSpecial(theform.memberfaxareacode.value))
		{
			alert("Please enter a valid fax area code.");
			theform.memberfaxareacode.focus();
			return false;
		}
	
	
		if (!IsWordNumberSpecial(theform.memberfaxnumber.value))
		{
			alert("Please enter a valid fax number.");
			theform.memberfaxnumber.focus();
			return false;
		}
	}
	
	if (!IsEmail(theform.memberemailaddress.value))
	{
		alert("Please enter a valid email address.");
		theform.memberemailaddress.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.memberyearestablished.value))
	{
		alert("Please enter the year your business was established.");
		theform.memberyearestablished.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.membernumberemployees.value))
	{
		alert("Please enter a the number of employees at your business.");
		theform.membernumberemployees.focus();
		return false;
	}


	if (theform.membercategoryid[theform.membercategoryid.selectedIndex].value == "")
	{
		alert("Please select a business category.");
		theform.membercategoryid.focus();
		return false;
	}

	if (theform.memberdescription.value.length < 4)
	{
		alert("Please enter a valid description.");
		theform.memberdescription.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.memberprimarycontactsalutation.value))
	{
		alert("Please enter a valid primary contact salutation.");
		theform.memberprimarycontactsalutation.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.memberprimarycontactfirstname.value))
	{
		alert("Please enter a valid primary contact first name.");
		theform.memberprimarycontactfirstname.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.memberprimarycontactlastname.value))
	{
		alert("Please enter a valid primary contact last name.");
		theform.memberprimarycontactlastname.focus();
		return false;
	}

	if (!IsWordNumberSpecial(theform.memberprimarycontacttitle.value))
	{
		alert("Please enter a valid primary contact title.");
		theform.memberprimarycontacttitle.focus();
		return false;
	}
	
	if ((theform.membersecondarycontactsalutation.value.length > 0) || (theform.membersecondarycontactfirstname.value.length > 0) || (theform.membersecondarycontactlastname.value.length > 0) || (theform.membersecondarycontacttitle.value.length > 0))
	{
		if (!IsWordNumberSpecial(theform.membersecondarycontactsalutation.value))
		{
			alert("Please enter a valid secondary contact salutation.");
			theform.membersecondarycontactsalutation.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.membersecondarycontactfirstname.value))
		{
			alert("Please enter a valid secondary contact first name.");
			theform.membersecondarycontactfirstname.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.membersecondarycontactlastname.value))
		{
			alert("Please enter a valid secondary contact last name.");
			theform.membersecondarycontactlastname.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.membersecondarycontacttitle.value))
		{
			alert("Please enter a valid secondary contact title.");
			theform.membersecondarycontacttitle.focus();
			return false;
		}
	}

	if ((theform.memberthirdcontactsalutation.value.length > 0) || (theform.memberthirdcontactfirstname.value.length > 0) || (theform.memberthirdcontactlastname.value.length > 0) || (theform.memberthirdcontacttitle.value.length > 0))
	{
		if (!IsWordNumberSpecial(theform.memberthirdcontactsalutation.value))
		{
			alert("Please enter a valid third contact salutation.");
			theform.memberthirdcontactsalutation.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.memberthirdcontactfirstname.value))
		{
			alert("Please enter a valid third contact first name.");
			theform.memberthirdcontactfirstname.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.memberthirdcontactlastname.value))
		{
			alert("Please enter a valid third contact last name.");
			theform.memberthirdcontactlastname.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.memberthirdcontacttitle.value))
		{
			alert("Please enter a valid third contact title.");
			theform.memberthirdcontacttitle.focus();
			return false;
		}
	}

	return true;
}




/*
	purpose:
		used in the control panel
	page:
		/admin/member_program/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckMemberProgramForm(theform)
{
	var file_value="";
	
	if (!IsWordNumberSpecial(theform.memberprogramname.value))
	{
		alert("Please enter a valid program name.");
		theform.memberprogramname.focus();
		return false;
	}
	
	if (theform.memberprogramdescription.value.length < 4)
	{
		alert("Please enter valid program description.");
		theform.memberprogramdescription.focus();
		return false;
	}
	
	//if we are supposed to upload a file
	if (theform.uploadfile.value == 1)
	{
	
		file_value=theform.memberprogramattachment_file.value;
		
		if (file_value.length > 0)	
		{
			if (!IsFileExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid file for uploading (must be .pdf or .doc).");
				theform.memberprogramattachment_file.focus();
				return false;
			}
		}
	}

	return true;
}


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

function CheckMemberSearch(theform)
{
	var bNoCategory=0;
	var bNoKeyword=0;
	
	if (theform.membercategoryid[theform.membercategoryid.selectedIndex].value == 0)
		bNoCategory=1;
	
	
	if (!IsWordNumberSpecial(theform.keyword.value))
		bNoKeyword=1;


	if (bNoCategory && bNoKeyword)
	{
		alert("Please enter a keyword or select a category.");
		theform.keyword.focus();
		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 (theform.newstagline.value.length < 4)
	{
		alert("Please enter a valid tagline.");
		theform.newstagline.focus();
		return false;
	}

	if (theform.newsstory.value.length < 4)
	{
		alert("Please enter a valid story.");
		theform.newsstory.focus();
		return false;
	}
	
	if (!CheckDate(theform,'newsdate','News Date'))
		return false;
		

	return true;
}




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

function CheckPollForm(theform)
{
	var bAnswerChosen=0;
	
	//we need to check to see if at least one value is selected
	for (var i=0;i<theform.pollanswerid.length;i++)
	{
		if (theform.pollanswerid[i].checked)
		{
			bAnswerChosen=1;
			break;
		}
	}
	
	if (!bAnswerChosen)
	{
		alert("Please select one of the poll question responses.");
		theform.pollanswerid[0].focus();
		return false;
	}
	
	//open the processing and result window
	NewWind('',415,318,1);
	
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/publication/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckPublicationForm(theform)
{
	var file_value="";
	
	if (!IsWordNumberSpecial(theform.publicationname.value))
	{
		alert("Please enter a valid publication name.");
		theform.publicationname.focus();
		return false;
	}
	
	if (theform.publicationdescription.value.length < 4)
	{
		alert("Please enter valid publication description.");
		theform.publicationdescription.focus();
		return false;
	}
	
	//if we are supposed to upload a file
	if (theform.uploadfile.value == 1)
	{
		file_value=theform.publicationattachment_file.value;
		
		if (!IsFileExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
		{
			alert("Please select a valid file for uploading (must be .pdf or .doc).");
			theform.publicationattachment_file.focus();
			return false;
		}
	}

	return true;
}



/*
	purpose:
		used in the control panel
	page:
		/admin/resource/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckResourceForm(theform)
{
	var file_value="";
	
	if (!IsWordNumberSpecial(theform.resourcename.value))
	{
		alert("Please enter a valid resource name.");
		theform.resourcename.focus();
		return false;
	}
	
	if (theform.resourcedescription.value.length < 4)
	{
		alert("Please enter valid resource description.");
		theform.resourcedescription.focus();
		return false;
	}
	
	//if we are supposed to upload a file
	if (theform.uploadfile.value == 1)
	{
		file_value=theform.resourceattachment_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsFileExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid file for uploading (must be .pdf or .doc).");
				theform.resourceattachment_file.focus();
				return false;
			}
		}			
	}

	return true;
}


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

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

	return true;
}


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

function CheckSponsorCampaignForm(theform)
{
	var submit_type=theform.submit_type.value;
	var image_value="";
	
	if (submit_type == "add")
	{
		if (!CheckDate(theform,'sponsorcampaignstartdate','Campaign Start Date'))
			return false;
	}
	
	//if we are supposed to upload an thumbnail
	if (theform.uploadimage.value == 1)
	{
		image_value=theform.sponsorcampaignimage_file.value;
		
		if (!IsImageExtension(image_value.substring(image_value.lastIndexOf("."),image_value.length)))
		{
			alert("Please select a campaign image file for uploading (must be .jpg or .gif).");
			theform.sponsorcampaignimage_file.focus();
			return false;
		}
	}
	
	//if this is the first time (adding a campaign) we set all the dates for it.
	if (submit_type == "add")
	{
		return confirm("Are you sure these are the settings you want, this cannot be undone.  Click 'OK' to proceed.");
	}
	else
	{
		return true;	
	}
}


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

function CheckStaffForm(theform)
{
	var staff_type=0;
	
	staff_type=theform.stafftypeid[theform.stafftypeid.selectedIndex].value;
	
	if (!IsWordNumberSpecial(theform.stafffirstname.value))
	{
		alert("Please enter a valid first name.");
		theform.stafffirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.stafflastname.value))
	{
		alert("Please enter a valid last name.");
		theform.stafflastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.stafftitle.value))
	{
		alert("Please enter a valid title.");
		theform.stafftitle.focus();
		return false;
	}
	
	
	if (theform.staffbiography.value.length > 0)
	{
		if (theform.staffbiography.value.length < 4)
		{
			alert("Please enter a valid biography.");
			theform.staffbiography.focus();
			return false;
		}
	}
	
	if (theform.staffaddress1.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.staffaddress1.value))
		{
			alert("Please enter a valid address 1.");
			theform.staffaddress1.focus();
			return false;
		}
	}
	
	if (theform.staffaddress2.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.staffaddress2.value))
		{
			alert("Please enter a valid address 2.");
			theform.staffaddress2.focus();
			return false;
		}
	}
	
	if (theform.staffcity.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.staffcity.value))
		{
			alert("Please enter a valid city.");
			theform.staffcity.focus();
			return false;
		}
	}
	
	if (theform.staffpostalcode.value.length > 0)
	{
		if (!IsPostalCode(theform.staffpostalcode.value))
		{
			alert("Please enter a valid postal code.");
			theform.staffpostalcode.focus();
			return false;
		}
	}
	
	if (theform.staffphone.value.length > 0)
	{
		if (!IsPhone(theform.staffphone.value))
		{
			alert("Please enter a valid phone number.");
			theform.staffphone.focus();
			return false;
		}
	}
	
	if (theform.stafffax.value.length > 0)
	{
		if (!IsPhone(theform.stafffax.value))
		{
			alert("Please enter a valid fax number.");
			theform.stafffax.focus();
			return false;
		}
	}
	
	if (theform.staffemail.value.length > 0)
	{
		if (!IsEmail(theform.staffemail.value))
		{
			alert("Please enter a valid email address.");
			theform.staffemail.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/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 control panel
	page:
		/admin/photo/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckPhotoForm(theform)
{
	var thumbnail_value="";
	var image_value="";
	var gallery_checked=false;
	
	if (!IsWordNumberSpecial(theform.photoname.value))
	{
		alert("Please enter a valid Photo Name.");
		theform.photoname.focus();
		return false;
	}
	
	if (theform.photodescription.value.length < 4)
	{
		alert("Please enter some valid Photo Description.");
		theform.photodescription.focus();
		return false;
	}

	
	//if we are supposed to upload an thumbnail
	if (theform.uploadthumbnail.value == 1)
	{
		thumbnail_value=theform.photothumbnailfile_file.value;
		
		if (!IsImageExtension(thumbnail_value.substring(thumbnail_value.lastIndexOf("."),thumbnail_value.length)))
		{
			alert("Please select an thumbnail file for uploading (must be .jpg or .gif).");
			theform.photothumbnailfile_file.focus();
			return false;
		}
	}
						
	//if we are supposed to upload an image
	if (theform.uploadimage.value == 1)
	{
	 	image_value=theform.photoimagefile_file.value;
		
		if (!IsImageExtension(image_value.substring(image_value.lastIndexOf("."),image_value.length)))
		{
			alert("Please select an image file for uploading (must be .jpg or .gif).");
			theform.photoimagefile_file.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 volunteer page
	page:
		/board/volunteer_request.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckVolunteerForm(theform)
{
	var committee_selected=0;
	var general_selected=0;
	
	if (!IsWordNumberSpecial(theform.volunteerfirstname.value))
	{
		alert("Please enter your first name.");
		theform.volunteerfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.volunteerlastname.value))
	{
		alert("Please enter your last name.");
		theform.volunteerlastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.volunteeraddress.value))
	{
		alert("Please enter your address.");
		theform.volunteeraddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.volunteercity.value))
	{
		alert("Please enter your city.");
		theform.volunteercity.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.volunteerpostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.volunteerpostal.focus();
		return false;
	}

	if (!IsPhone(theform.volunteerphone.value))
	{
		alert("Please enter a valid phone number.");
		theform.volunteerphone.focus();
		return false;
	}
	
	if (!IsEmail(theform.volunteeremail.value))
	{
		alert("Please enter a valid email address.");
		theform.volunteeremail.focus();
		return false;
	}
	
	if (!IsEmail(theform.volunteeremailconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.volunteeremailconfirm.focus();
		return false;
	}
	
	if (theform.volunteeremail.value != theform.volunteeremailconfirm.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.volunteeremailconfirm.focus();
		return false;
	}
	
	
	if (theform.volunteercommitteeid.selectedIndex == -1)
	{
		alert("Please select at least one group.");
		theform.volunteercommitteeid[0].focus();
		return false;
	}
	
	//loop over all the check boxes 
	for (var i=0;i<theform.volunteercommitteeid.length;i++)
	{
		if (theform.volunteercommitteeid[i].checked)
			committee_selected=1;
	}
	
	//check if general tab is checked
	general_selected=theform.volunteergeneral.checked;

	if ((committee_selected == 0) &&(general_selected==0))
	{
		alert("Please select a committee OR choose to be a general volunteer.");
		theform.volunteercommitteeid[0].focus();
		return false;
	}
	
	return true;
}
