	var errormessage, setfocus;
	
	function CheckRequiredNum(field,fieldlabel,errormsg,minimumsize)
	{
		if((eval(field + ".value.length") < minimumsize) || isNaN(eval(field + ".value")))
		{
			if (!setfocus)
			{
				setfocus = true;
				eval(field + ".focus()");
			}
			return fieldlabel + " - " + errormsg + "\n";
		}
		return "";
	}
	
	function CheckRequiredField(field,fieldlabel,errormsg,minimumsize)
	{
		if(eval(field + ".value.length") < minimumsize)
		{
			if (!setfocus)
			{
				setfocus = true;
				eval(field + ".focus()");
			}
			return fieldlabel + " - " + errormsg + "\n";
		}
		return "";
	}
	
	function CheckTextAreaLength(field,fieldlabel,errormsg,minlen,maxlen)
	{
		if(eval(field + ".value.length") > maxlen || eval(field + ".value.length") < minlen)
		{
			if (!setfocus)
			{
				setfocus = true;
				eval(field + ".focus()");
			}
			return fieldlabel + " - " + errormsg + "\n";
		}
		return "";
	}
	
	function CheckState()
	{
	var statevalue = document.EditForm.state.options[document.EditForm.state.selectedIndex].value;
	var countryvalue = document.EditForm.country.options[document.EditForm.country.selectedIndex].value;

		if(statevalue == 0 && countryvalue == "United States")
		{
			if (!setfocus)
			{
				setfocus = true;
				document.EditForm.state.focus();
			}
			return "State - if not from the United States select a different country\n";
		}
		return "";
	}
	
	function CheckRequiredSelect(field,fieldlabel,errormsg,match)
	{
		if(eval(field + ".selectedIndex") == match)
		{
			if (!setfocus)
			{
				setfocus = true;
				eval(field + ".focus()");
			}
			return fieldlabel + " - " + errormsg + "\n";
		}
		return "";
	}
	
	function CheckEmail(field,fieldlabel,errormsg)
	{
		var emailstring =  eval(field+".value");
		var regex=/^[-.\w]+@[-.\w]+\.[a-zA-Z]{2,4}$/i;
		
		if( !(emailstring.match(regex)) )
		{
			if (!setfocus)
			{
				setfocus = true;
				eval(field+".focus()");
			}
			return fieldlabel + " - " + errormsg + "\n";
		}
		return "";
	}

	function CheckPhone(field,fieldlabel,errormsg)
	{
		var phonestring =  eval(field+".value");
		phonestring=phonestring.replace(/[-+() ]/g, "");
		var regex=/\d{10}\d?/g;
		
		if( !(phonestring.match(regex)) )
		{
			if (!setfocus)
			{
				setfocus = true;
				eval(field+".focus()");
			}
			return fieldlabel + " - " + errormsg + "\n";
		}
		return "";
	}
	
	function CheckZip(field,fieldlabel,errormsg)
	{
		var zipvalue = eval(field+".value");
		var regex=/^\d{5}(-?\d{4})?$/g;
		
		var countryvalue = document.EditForm.country.options[document.EditForm.country.selectedIndex].value;
		if( !(zipvalue.match(regex)) && (countryvalue == "United States" || countryvalue == "Canada"))
		{
			if (!setfocus)
			{
				setfocus = true;
				eval(field+".focus()");
			}
			return fieldlabel + " - " + errormsg + "\n";
		}
		return "";
	}
	
	function onReset()
	{
		document.EditForm.reset();
	}
	
	function HandleLoaded()
	{
		document.EditForm.Contact_FirstName.focus();
	}
	
	function EnableDisableSubmitButtons(bDisabled)
	{
		var oSubmitButtons = document.all.tags("INPUT");
		var sElementType;
		
		for (var i = 0 ; i < oSubmitButtons.length ; i++)
		{
			 sElementType = oSubmitButtons[i].type.toLowerCase();
			
			 if ((sElementType == "submit") || (sElementType == "image"))
			 {
			  oSubmitButtons[i].disabled = bDisabled;
			 }
		}
	}