

/*
	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;
		
		
	
}


/*
	purpose:
		used in the billing_shipping checkout page
	page:
		/login/checkout/billing_shipping.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckBillingShippingForm(theform)
{
	//check if we want to add a new billing addresss
	
	
	if (!IsWordNumberSpecial(theform.billingfirstname.value))
	{
		alert("Please enter a valid billing first name.");
		theform.billingfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billinglastname.value))
	{
		alert("Please enter a valid billing last name.");
		theform.billinglastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billingaddress.value))
	{
		alert("Please enter a valid billing address.");
		theform.billingaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billingcity.value))
	{
		alert("Please enter a valid billing city.");
		theform.billingcity.focus();
		return false;
	}

	if (theform.billingstateid[theform.billingstateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.billingstateid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billingpostal.value))
	{
		alert("Please enter a valid billing postal/zip code.");
		theform.billingpostal.focus();
		return false;
	}

	if (!IsPhone(theform.billingphone.value))
	{
		alert("Please enter a valid billing phone number.");
		theform.billingphone.focus();
		return false;
	}
	
	if (!IsEmail(theform.billingemail.value))
	{
		alert("Please enter a valid billing email address.");
		theform.billingemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.billingemailconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.billingemailconfirm.focus();
		return false;
	}
	
	if (theform.billingemail.value != theform.billingemailconfirm.value)
	{
		alert("Sorry, your billing email and confirmation email are not the same.");
		theform.billingemailconfirm.focus();
		return false;
	}



	//if the shipping address is NOT the same
	if (theform.shippingaddresssame.checked == 0)
	{
		if (!IsWordNumberSpecial(theform.shippingfirstname.value))
		{
			alert("Please enter a valid shipping first name.");
			theform.shippingfirstname.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.shippinglastname.value))
		{
			alert("Please enter a valid shipping last name.");
			theform.shippinglastname.focus();
			return false;
		}
					
		if (!IsWordNumberSpecial(theform.shippingaddress.value))
		{
			alert("Please enter a valid shipping address.");
			theform.shippingaddress.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.shippingcity.value))
		{
			alert("Please enter a valid shipping city.");
			theform.shippingcity.focus();
			return false;
		}
	
		if (theform.shippingstateid[theform.shippingstateid.selectedIndex].value == "")
		{
			alert("Please select a valid state/province.");
			theform.shippingstateid.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.shippingpostal.value))
		{
			alert("Please enter a valid shipping postal/zip code.");
			theform.shippingpostal.focus();
			return false;
		}
	
		if (!IsPhone(theform.shippingphone.value))
		{
			alert("Please enter a valid shipping phone number.");
			theform.shippingphone.focus();
			return false;
		}
		
		if (!IsEmail(theform.shippingemail.value))
		{
			alert("Please enter a valid shipping email address.");
			theform.shippingemail.focus();
			return false;
		}
		
		if (!IsEmail(theform.shippingemailconfirm.value))
		{
			alert("Please enter a valid confirm email address.");
			theform.shippingemailconfirm.focus();
			return false;
		}
		
		if (theform.shippingemail.value != theform.shippingemailconfirm.value)
		{
			alert("Sorry, your shipping email and confirmation email are not the same.");
			theform.shippingemailconfirm.focus();
			return false;
		}
	}
		
	/*
	if (theform.CardType[theform.CardType.selectedIndex].value == 0)
	{
		alert("Please select a credit card type.");
		theform.CardType.focus();
		return false;
	}
	
	//check the credit card number
	if (!CheckCardNumber(theform))
		return false;
	
	
	//check cc_name
	if ((theform.nameoncard.value.length < 4) || (theform.nameoncard.value.length > 32))
	{
		alert("Please enter the name on your credit card (must be between 4 and 32 characters).");
		theform.nameoncard.focus();
		return false;
	}
	
	//check if american express
	if (theform.CardType[theform.CardType.selectedIndex].value == 3)
	{
		//four digit code required
		if (!Is4DigitNumber(theform.card_cvv2.value))
		{
			alert("Please enter your CCV/CVV2 number, this is a four digit code on the front of your American Express card.");
			theform.card_cvv2.focus();
			return false;
		}
	}
	
	//check if Visa, MasterCard or Discover Card.
	if (theform.CardType[theform.CardType.selectedIndex].value != 3)
	{
		//three digit code required
		if (!Is3DigitNumber(theform.card_cvv2.value))
		{
			alert("Please enter your CCV/CVV2 number, this is is the last three digits of the code on the signature line, on the back of a Visa, MasterCard or Discover Card.");
			theform.card_cvv2.focus();
			return false;
		}
	}
	
	
	if (theform.policyagree.checked==false)
	{
		alert("Please indicate that you have read and agree to the above policies.");
		theform.policyagree.focus();
		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 inquiryt page
	page:
		/inquirytus/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckInquiryForm(theform)
{
	var item_checked=false;

	if (!IsWordNumberSpecial(theform.inquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.inquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.inquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.inquirylastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.inquiryaddress.value))
	{
		alert("Please enter your address.");
		theform.inquiryaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.inquirycity.value))
	{
		alert("Please enter your city.");
		theform.inquirycity.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.inquirypostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.inquirypostal.focus();
		return false;
	}

	if (!IsPhone(theform.inquiryphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.inquiryphone.focus();
		return false;
	}
	

	if (theform.inquiryfax.value.length > 0)
	{
		if (!IsPhone(theform.inquiryfax.value))
		{
			alert("Please enter a valid fax number.");
			theform.inquiryfax.focus();
			return false;
		}
	}
	
	if (!IsEmail(theform.inquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.inquiryemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.inquiryconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.inquiryconfirmemail.focus();
		return false;
	}
	
	if (theform.inquiryemail.value != theform.inquiryconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.inquiryconfirmemail.focus();
		return false;
	}
	
	
	
	//make sure at least one check box is selected 
	for (var i=0;i<theform.inquiryproductinterest.length;i++)
	{
		if (theform.inquiryproductinterest[i].checked)
			item_checked=true;
	}

	if (item_checked == false)
	{
		alert("Please select an interest.");
		theform.inquiryproductinterest[0].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.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 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 gallery name.");
		theform.galleryname.focus();
		return false;
	}

	if (theform.gallerydate.value.length > 2)
	{
		if (!IsWordNumberSpecial(theform.gallerydate.value))
		{
			alert("Please enter a valid date for this project.");
			theform.gallerydate.focus();
			return false;
		}
	}


	if (theform.gallerylocation.value.length > 2)
	{
		if (!IsWordNumberSpecial(theform.gallerylocation.value))
		{
			alert("Please enter a valid location for this gallery.");
			theform.gallerylocation.focus();
			return false;
		}
	}
	
	if (theform.gallerydescription.value.length > 2)
	{
		if (!IsDescription(theform.gallerydescription.value))
		{
			alert("Please enter valid gallery description.");
			theform.gallerydescription.focus();
			return false;
		}
	}
	
	/*
	if (theform.gallerycontractwork.value.length > 2)
	{
		if (!IsDescription(theform.gallerycontractwork.value))
		{
			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/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 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 control panel
	page:
		/admin/seminarinquiry/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckseminarinquiryForm(theform)
{
	var file_value="";
	
	if (!IsWordNumberSpecial(theform.seminarinquirytitle.value))
	{
		alert("Please enter a seminarinquirytitle.");
		theform.seminarinquirytitle.focus();
		return false;
	}
	
	//optional
	if (theform.seminarinquirylocation.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.seminarinquirylocation.value))
		{
			alert("Please enter a location.");
			theform.seminarinquirylocation.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.seminarinquirycity.value))
	{
		alert("Please enter a city.");
		theform.seminarinquirycity.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarinquiryaddress.value))
	{
		alert("Please enter an address value.");
		theform.seminarinquiryaddress.focus();
		return false;
	}
		
	if (!IsWordNumberSpecial(theform.seminarinquiryaddress2.value))
	{
		alert("Please enter an address 2 value.");
		theform.seminarinquiryaddress2.focus();
		return false;
	}
			
	//optional
	if (theform.seminarinquirypostal.value.length > 0)
	{
		if (!IsPostalCode(theform.seminarinquirypostal.value))
		{
			alert("Please enter a zip/postal code.");
			theform.seminarinquirypostal.focus();
			return false;
		}
	}
	
	
	if (theform.seminarinquiryshortdescription.value.length <= 4)
	{
		alert("Please enter a short description.");
		theform.seminarinquiryshortdescription.focus();
		return false;
	}
	
	
	if (theform.seminarinquirydescription.value.length <= 4)
	{
		alert("Please enter a description.");
		theform.seminarinquirydescription.focus();
		return false;
	}
	
	
	//if we are supposed to upload a file
	if (theform.uploadfile.value == 1)
	{
		file_value=theform.seminarinquiryattachment_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.seminarinquiryattachment_file.focus();
				return false;
			}
		}
	}
	
	
	//if we are to use the date
	if (theform.seminarinquiryshowdate[theform.seminarinquiryshowdate.selectedIndex].value == 1)
	{
		
		if (!CheckDate(theform,'seminarinquirydate','seminarinquiry Date'))
			return false;
			
		//double check for blank selections 
		if (theform.seminarinquirydate_month[theform.seminarinquirydate_month.selectedIndex].value == "")
		{
			alert("Please select an seminarinquiry date.");
			return false;
		}

		if (theform.seminarinquirydate_day[theform.seminarinquirydate_day.selectedIndex].value == "")
		{
			alert("Please select an seminarinquiry date.");
			return false;
		}

		if (theform.seminarinquirydate_year[theform.seminarinquirydate_year.selectedIndex].value == "")
		{
			alert("Please select an seminarinquiry date.");
			return false;
		}

	}

	if (!CheckDate(theform,'seminarinquirystartdate','seminarinquiry Start Date'))
		return false;

	if (!CheckDate(theform,'seminarinquiryenddate','seminarinquiry End Date'))
		return false;
	
	return true;
}



/*
	purpose:
		used in the seminarinquiry inquiry page
	page:
		/seminarinquirys/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckSeminarInquiryForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.seminarinquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.seminarinquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarinquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.seminarinquirylastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarinquiryaddress.value))
	{
		alert("Please enter your address.");
		theform.seminarinquiryaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarinquirycity.value))
	{
		alert("Please enter your city.");
		theform.seminarinquirycity.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.seminarinquirypostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.seminarinquirypostal.focus();
		return false;
	}

	if (!IsPhone(theform.seminarinquiryphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.seminarinquiryphone.focus();
		return false;
	}
	
	
	if (!IsEmail(theform.seminarinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.seminarinquiryemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.seminarinquiryconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.seminarinquiryconfirmemail.focus();
		return false;
	}
	
	if (theform.seminarinquiryemail.value != theform.seminarinquiryconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.seminarinquiryconfirmemail.focus();
		return false;
	}
	
	
	return true;
}





/*
	purpose:
		used in the seminarinquiry signup page
	page:
		/seminarinquirys/seminarinquiry_signup.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckseminarinquirySignupForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.seminarinquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.seminarinquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarinquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.seminarinquirylastname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarinquiryaddress.value))
	{
		alert("Please enter your address.");
		theform.seminarinquiryaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.seminarinquirycity.value))
	{
		alert("Please enter your city.");
		theform.seminarinquirycity.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.seminarinquirypostal.value))
	{
		alert("Please enter your postal/zip code.");
		theform.seminarinquirypostal.focus();
		return false;
	}

	if (!IsPhone(theform.seminarinquiryphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.seminarinquiryphone.focus();
		return false;
	}
	
	if (theform.seminarinquiryphoneextension.value.length > 0)
	{
		if (!IsPhoneExtension(theform.seminarinquiryphoneextension.value))
		{
			alert("Please enter a valid extension. i.e. 222");
			theform.seminarinquiryphoneextension.focus();
			return false;
		}
	}
	
	
	if (!IsEmail(theform.seminarinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.seminarinquiryemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.seminarinquiryconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.seminarinquiryconfirmemail.focus();
		return false;
	}
	
	if (theform.seminarinquiryemail.value != theform.seminarinquiryconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.seminarinquiryconfirmemail.focus();
		return false;
	}
	
	//if this person found out from a mortgage broker
	if (theform.seminarinquiryfoundout[theform.seminarinquiryfoundout.selectedIndex].value == "A Mortgage Broker")
	{
		//fill out the mortgage broker name and email
		if (!IsWordNumberSpecial(theform.seminarinquiryfoundoutbroker.value))
		{
			alert("Please enter the Mortgage Broker name.");
			theform.seminarinquiryfoundoutbroker.focus();
			return false;
		}
		if (!IsEmail(theform.seminarinquiryfoundoutemail.value))
		{
			alert("Please enter the Mortgage Broker email address.");
			theform.seminarinquiryfoundoutemail.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/photo/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckPhotoForm(theform)
{
	var thumbnail_value="";
	var image_value="";
	
	/*
	if (!IsWordNumberSpecial(theform.photoname.value))
	{
		alert("Please enter a valid Photo Name.");
		theform.photoname.focus();
		return false;
	}
	

	if (!IsDescription(theform.photodescription.value))
	{
		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 (thumbnail_value.length > 0)
		{
			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 cart page
	page:
		/checkout/index.cfm
	Parameters:
		theorderdetailid - orderdetail id
		thepage - step in the checkout process hte person came from
*/
	
function RemoveItem(theorderdetailid,orderid)
{
	var delete_item=true;
	
	delete_item=confirm("Do you really want to remove this item from your cart?");
	
	if (delete_item)
		window.location.href="/form_action/cf_remove_from_cart.cfm?requesttimeout=5000&orderid="+orderid+"&recordid="+theorderdetailid
}