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


	return true;
}

/*
	purpose:
		used in the cart page	
	Parameters:
		theorderdetailid - orderdetail id
		thepage - step in the checkout process hte person came from
*/
	
function RemoveItem(theorderdetailid,thepage)
{
	var delete_item=true;
	
	delete_item=confirm("Do you really want to remove this item from your cart?");
	
	if (delete_item)
		window.location.href="/form_action/delete_from_cart.php?requesttimeout=5000&recordid="+theorderdetailid+"&from="+thepage;
}


function SameAsBilling(thecheckbox,theform)
{
	if(thecheckbox.checked)
	{
		theform.shippingfirstname.value=theform.billingfirstname.value;
		theform.shippinglastname.value=theform.billinglastname.value;
		theform.shippingaddress.value=theform.billingaddress.value;
		theform.shippingaddress2.value=theform.billingaddress2.value;
		theform.shippingcity.value=theform.billingcity.value;
		theform.shippingstateid.selectedIndex=theform.billingstateid.selectedIndex;
		theform.shippingcountryid.selectedIndex=theform.billingcountryid.selectedIndex;
		theform.shippingpostal.value=theform.billingpostal.value;
		theform.shippingphone.value=theform.billingphone.value;
		theform.shippingemail.value=theform.billingemail.value;
		theform.shippingemailconfirm.value=theform.billingemailconfirm.value;
		
	} else {
		
		theform.shippingfirstname.value='';
		theform.shippinglastname.value='';
		theform.shippingaddress.value='';
		theform.shippingaddress2.value='';
		theform.shippingcity.value='';
		theform.shippingpostal.value='';
		theform.shippingphone.value='';
		theform.shippingemail.value='';
		theform.shippingemailconfirm.value='';
	}
}



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

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

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

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

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

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

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

function CheckBookingInquiryForm(theform)
{
	var item_checked=false;
	
	if (!IsWordNumberSpecial(theform.bookinginquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.bookinginquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.bookinginquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.bookinginquirylastname.focus();
		return false;
	}
	
	if (!IsEmail(theform.bookinginquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.bookinginquiryemail.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.bookinginquirycity.value))
	{
		alert("Please enter your city.");
		theform.bookinginquirycity.focus();
		return false;
	}
	
	if (!IsEmail(theform.bookinginquiryemailconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.bookinginquiryemailconfirm.focus();
		return false;
	}
	
	if (theform.bookinginquiryemail.value != theform.bookinginquiryemailconfirm.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.bookinginquiryemailconfirm.focus();
		return false;
	}
	
	
	if (!IsWordNumberSpecial(theform.bookinginquirypickuptime.value))
	{
		alert("Please enter a pickup time.");
		theform.bookinginquirypickuptime.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.bookinginquirypickuplocation.innerHTML))
	{
		alert("Please enter a pickup location.");
		theform.bookinginquirypickuplocation.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.bookinginquirypickupdestination.innerHTML))
	{
		alert("Please enter a pickup destination.");
		theform.bookinginquirypickupdestination.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.bookinginquiryreturndetails.innerHTML))
	{
		alert("Please enter return details.");
		theform.bookinginquiryreturndetails.focus();
		return false;
	}
	
	
	return true;
}

function CheckBeadealerInquiryForm(theform)
{
	var item_checked=false;
	
	if (!IsWordNumberSpecial(theform.beadealerinquirycompanyname.value))
	{
		alert("Please enter a company name.");
		theform.beadealerinquirycompanyname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.beadealerinquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.beadealerinquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.beadealerinquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.beadealerinquirylastname.focus();
		return false;
	}
	
	
	if (!IsWordNumberSpecial(theform.beadealerinquirycity.value))
	{
		alert("Please enter your city.");
		theform.beadealerinquirycity.focus();
		return false;
	}
	
	
	if (!IsEmail(theform.beadealerinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.beadealerinquiryemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.beadealerinquiryconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.beadealerinquiryconfirmemail.focus();
		return false;
	}
	
	if (theform.beadealerinquiryemail.value != theform.beadealerinquiryconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.beadealerinquiryconfirmemail.focus();
		return false;
	}
	
	
	if (theform.beadealerapproveemails.checked==false)
	{
		alert("You must approve sending you emails before submitting.");
		theform.beadealerapproveemails.focus();
		return false;
	}
	
	return true;
}


function CheckCareerInquiryForm(theform)
{
	var item_checked=false;
	
	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.careerinquirycity.value))
	{
		alert("Please enter your city.");
		theform.careerinquirycity.focus();
		return false;
	}
	
	if (!IsEmail(theform.careerinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.careerinquiryemail.focus();
		return false;
	}
	
	
	
	if (!IsEmail(theform.careerinquiryemailconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.careerinquiryemailconfirm.focus();
		return false;
	}
	
	if (theform.careerinquiryemail.value != theform.careerinquiryemailconfirm.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.careerinquiryemailconfirm.focus();
		return false;
	}
	
	
	
	
	file_value=theform.careerinquiryresume.value;
		
	if (file_value.length > 0)
	{
		if (!IsFileExtensionResume(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
		{
			alert("Please select a valid file for uploading (must be be .rtf, .txt, .doc or .pdf).");
			theform.careerinquiryresume.focus();
			return false;
		}
		
	}
	
	return true;
}



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

function CheckContactForm(theform)
{
	var item_checked=false;
	
	if (!IsWordNumberSpecial(theform.contactfirstname.value))
	{
		alert("Please enter your first name.");
		theform.contactfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactlastname.value))
	{
		alert("Please enter your last name.");
		theform.contactlastname.focus();
		return false;
	}
	
	/*
	if (!IsWordNumberSpecial(theform.contactaddress.value))
	{
		alert("Please enter your address.");
		theform.contactaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.contactcity.value))
	{
		alert("Please enter your city.");
		theform.contactcity.focus();
		return false;
	}
	*/
	if (!IsPhone(theform.contactphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx");
		theform.contactphone.focus();
		return false;
	}
	
	if (!IsEmail(theform.contactemail.value))
	{
		alert("Please enter a valid email address.");
		theform.contactemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.contactemailconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.contactemailconfirm.focus();
		return false;
	}
	
	if (theform.contactemail.value != theform.contactemailconfirm.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.contactemailconfirm.focus();
		return false;
	}
	
	
	return true;
}

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

function ChecknewsletterInquiryForm(theform)
{
	var item_checked=false;
	
	if (!IsWordNumberSpecial(theform.newsletterinquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.newsletterinquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.newsletterinquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.newsletterinquirylastname.focus();
		return false;
	}
	
	
	if (!IsWordNumberSpecial(theform.newsletterinquirycity.value))
	{
		alert("Please enter your city.");
		theform.newsletterinquirycity.focus();
		return false;
	}
	
	
	if (!IsEmail(theform.newsletterinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.newsletterinquiryemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.newsletterinquiryemailconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.newsletterinquiryemailconfirm.focus();
		return false;
	}
	
	if (theform.newsletterinquiryemail.value != theform.newsletterinquiryemailconfirm.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.newsletterinquiryemailconfirm.focus();
		return false;
	}
	
	
	
	file_value=theform.newsletterinquiryresume.value;
		
	if (file_value.length > 0)
	{
		if (!IsFileExtensionResume(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
		{
			alert("Please select a valid file for uploading (must be be .rtf, .txt, .doc or .pdf).");
			theform.newsletterinquiryresume.focus();
			return false;
		}
		
	}
	
	return true;
}

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

function CheckNewsletterInquiryForm(theform)
{
	var item_checked=false;
	
	if (!IsWordNumberSpecial(theform.newsletterinquiryfirstname.value))
	{
		alert("Please enter your first name.");
		theform.newsletterinquiryfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.newsletterinquirylastname.value))
	{
		alert("Please enter your last name.");
		theform.newsletterinquirylastname.focus();
		return false;
	}
	
	
	if (!IsWordNumberSpecial(theform.newsletterinquirycity.value))
	{
		alert("Please enter your city.");
		theform.newsletterinquirycity.focus();
		return false;
	}
	
	
	if (!IsEmail(theform.newsletterinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.newsletterinquiryemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.newsletterinquiryconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.newsletterinquiryconfirmemail.focus();
		return false;
	}
	
	if (theform.newsletterinquiryemail.value != theform.newsletterinquiryconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.newsletterinquiryconfirmemail.focus();
		return false;
	}
	
	
	if (theform.newsletterapproveemails.checked==false)
	{
		alert("You must approve sending you emails before submitting.");
		theform.newsletterapproveemails.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;
}


function CheckNewsForm(theform)
{
	var file_value="";
	
	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 tagline.");
		theform.newstagline.focus();
		return false;
	}
	*/
	/*
	if (!IsDescription(theform.newsstory.value))
	{
		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 file for uploading (must be .pdf or .doc).");
				theform.newsattachment_file.focus();
				return false;
			}
			
			if (!IsWordNumberSpecial(theform.newsattachmenttitle.value))
			{
				alert("Please enter a valid title.");
				theform.newsattachmenttitle.focus();
				return false;
			}
		}
	}
	
	/*
	if (theform.newsimage_file && theform.newsimage_file.value != '')
	{
		file_value=theform.newsimage_file.value;
		
		if (file_value.length > 0)
		{
			if (!IsImageExtension(file_value.substring(file_value.lastIndexOf("."),file_value.length)))
			{
				alert("Please select a valid image for uploading (must be .jpg or .gif).");
				theform.newsimage_file.focus();
				return false;
			}
			
			if (!IsWordNumberSpecial(theform.newsimagetitle.value))
			{
				alert("Please enter a valid 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/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/product/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckProductForm(theform)
{
	var test=false;
	
	if (!IsWordNumberSpecial(theform.productname.value))
	{
		alert("Please enter a valid product name.");
		theform.productname.focus();
		return false;
	}
	
	if (theform.productmanufacturerid[theform.productmanufacturerid.selectedIndex].value == 0)
	{
		alert("Please select a valid manufacturer.");
		theform.productmanufacturerid.focus();
		return false;
	}
	
	if (theform.productcategoryid[theform.productcategoryid.selectedIndex].value == 0)
	{
		alert("Please select a valid category.");
		theform.productcategoryid.focus();
		return false;
	}
	if (!IsWordNumberSpecial(theform.productpartnumber.value))
	{
		alert("Please enter a valid part number.");
		theform.productpartnumber.focus();
		return false;
	}
	
	if (theform.productmodelgroup[theform.productmodelgroup.selectedIndex].value == 0)
	{
		alert("Please select a valid model group.");
		theform.productmodelgroup.focus();
		return false;
	} 
	else if (theform.productmodelgroup[theform.productmodelgroup.selectedIndex].value == "------")
	{
		
		if (!IsWordNumberSpecial(theform.productmodelgroupother.value))
		{
			alert("Please enter a valid other model group.");
			theform.productmodelgroupother.focus();
			return false;
		}
	}
	
	/*
	if (theform.productintro.value.length < 4)
	{
		alert("Please enter a valid listing short description.");
		theform.productintro.focus();
		return false;
	}
	
	if (theform.productshortdescription.value.length < 4)
	{
		alert("Please enter a valid short description.");
		theform.productshortdescription.focus();
		return false;
	}
	
	if (theform.productdescription.value.length < 4)
	{
		alert("Please enter a valid full description.");
		theform.productdescription.focus();
		return false;
	}*/
	
	
	if (!IsPrice(theform.productprice.value))
	{
		alert("Please enter a valid price.");
		theform.productprice.focus();
		return false;
	}
	
	
	//if we are supposed to upload an image
	if (theform.uploadimage.value == 1 && theform.photo_file.value.length > 4)
	{
	 	image_value=theform.photo_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.photo_file.focus();
			return false;
		}
	}
		
	return true;
}

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

function CheckProductTabForm(theform)
{
	var test=false;
	
	if (!IsWordNumberSpecial(theform.productdetailtabname.value))
	{
		alert("Please enter a valid tab name.");
		theform.productdetailtabname.focus();
		return false;
	}
	
	if (theform.productid[theform.productid.selectedIndex].value == 0)
	{
		alert("Please select a valid product.");
		theform.productid.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;
}