	function isTextFieldValNaN(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		if(isNaN(strCont)) {
			alert(Description + " must be a number.");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}
	
	function isTextFieldValTaxID(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		var arrCont = strCont.split("-");
		if((isNaN(arrCont[0]) || isNaN(arrCont[1]) || arrCont[0].length != 2 || arrCont[1].length != 7 || strCont.charAt(2) != "-") && (isNaN(arrCont[0]) || isNaN(arrCont[1]) || isNaN(arrCont[2]) || arrCont[0].length != 3 || arrCont[1].length != 2 || arrCont[2].length != 4 || strCont.charAt(3) != "-" || strCont.charAt(6) != "-")) {
			alert(Description + " should be formatted as: 00-0000000\n or as 000-00-0000");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}
	
	function isTextFieldValCurrency(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		if (!isNaN(strCont)) {return true}
		strCont = strCont.replace("$", "")
		strCont = strCont.replace(",", "")
		if (strCont.split(".")[1]) {
			if(isNaN(strCont) && "$".replace("$", "") == "" || strCont.split(".")[1].length > 2) {
				alert(Description + " must be currency.\nSuch as $1.00");
				eval("document." + formname + "." + fieldname + ".focus()");
				return false;
			}else{
			return true;
		}
		}
	}
	
	function isChainFieldVal(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		if(strCont.length < 1) {
			alert("You must select a " + Description);
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}
	
	function isStoreFieldVal(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		if(strCont.length < 1) {
			alert("You must select a " + Description);
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}
	
	function isTextFieldValPhone(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		if(strCont.length < 10) {
			alert(Description + "must include the area-code and phone number.");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}

	function TextFieldVal(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		if(strCont == "") {
			alert(Description + " is a required field.");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}
	
	function SelectFieldVal(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		if(strCont == "0") {
			alert(Description + " must have a selection.");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}
	
	function ValidEmail(formname,fieldname,Description) {
		var strEmail
		strEmail = eval("document." + formname + "." + fieldname + ".value");	
		if(strEmail.indexOf("@") == -1 || strEmail.indexOf(".") == -1 || strEmail.indexOf(" ") > -1) {
			alert("Please enter a valid E-Mail Address.\nFor example: johndoe@domain.com\nAlso, there should be no spaces\nin your E-Mail Address.");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;		
		} else {
			return true;
		}
	
	}
	
  function CheckLength(myForm, myelement, myDescription, mLength) {
	var intLen;
	var strContents = eval("document." + myForm + "." + myelement + ".value");
	intLen = strContents.length;
	if(intLen > mLength) {
	   strReplace = strContents.substring(0,mLength);
	   TargetElement= eval("document." + myForm + "." + myelement)
	   TargetElement.value = strReplace;
	   alert("The text you have just entered for " + myDescription + " is too long.\nThis field must contain no more than " + mLength + " characters.\nThe field currently contains " + intLen + " characters.\n\nYour text has been truncated to fit within " + mLength + " characters.");
	   eval("document." + myForm + "." + myelement + ".focus()");
	   return false;
	}  else {
		return true;
	}
  }	
  
  function checkdate(tYear, tMonth, tDay) {
	tMonth = tMonth - 1
	var testdate = new Date(tYear,tMonth,tDay)
  	var endmonth=testdate.getMonth();
	
	if(tMonth != endmonth) {
		return false;
	} else {
		return true;
	}

  }
  
function CloseSelfRefParent(){
	/************************************
	no good way to confirm opener exists
	onError = null does not hide error
	************************************/
	//window.opener.location.href = window.opener.location.href
	//window.close()
	opener.document.location.reload();
	self.close();
}



function AddAddress(formname, fieldname, LocationTypeID) {
// 	function do call add location popup window, pass it form name and field
//	name to update once new address is inserted 	
	var index = eval("document." + formname + "." + fieldname + ".selectedIndex");
	var CurID = eval("document." + formname + "." + fieldname + ".options[index].value");
	windetail=window.open("AddAddrFromCheckout.asp?ID=" + CurID + "&formname=" + formname + "&fieldname=" + fieldname + "&NewLocationTypeID=" + LocationTypeID,"","width=350,height=450,left=25,top=25,scrollbars=yes,menubar=no,resizable=yes;location=no")
}
  
 function MandatoryCheckBox(formname, fieldname, Description) {
 /* This functions role in life is to determine whether or not at least one checkbox or radio button,
	has been selected out of a series of checkboxes or radio buttons. */
	var arrLength = eval("document." + formname + "." + fieldname + ".length")-1;
	if (isNaN(arrLength)) { //in case there's only one option
		if(eval("document." + formname + "." + fieldname + ".checked") == true) {
			return true;
			eval("document." + formname + "." + fieldname + ".focus()");
		}
	} else { //multiple options
		for(i=0; i<=arrLength; i++) {
			if(eval("document." + formname + "." + fieldname + "[" + i + "].checked") == true) {
				return true;
				eval("document." + formname + "." + fieldname + "[0].focus()");
			}
		}
	}
	alert(Description);
	return false;
 }
 
 
 
function ViewRetailerAddress(RetailerLocationID) {
	windetail=window.open("/Retailer/Shopping/ViewAddressWindow.asp?RetailerLocationID=" + RetailerLocationID,"","width=350,height=50,left=25,top=25,scrollbars=yes,menubar=no,resizable=yes;location=no")

}

function InvalidOrder(CartShippingID) {
	winInvalid=window.open("/Retailer/Shopping/InvalidOrder.asp?ID=" + CartShippingID,"","width=300,height=200,left=25,top=25,scrollbars=yes,menubar=no,resizable=yes;location=no")

}

 function CheckAddress(FormName, FieldName) {
	var LocationID=eval("document." + FormName + "." + FieldName + ".options[document." + FormName + "." + FieldName + ".selectedIndex].value");	 
	ViewRetailerAddress(LocationID)
 }

function OpenDetailWindow(ProductID, GrowerID) {
	windetail=window.open("ComboBoxDetails.asp?ProductID=" + ProductID + "&GrowerID=" + GrowerID,"","width=300,height=300,left=25,top=25,scrollbars=yes,menubar=no,resizable=yes;location=no")
}

function ShowCalendar(formname, fieldname, displayarea) {
	var selDate = eval("document." + formname + "." + fieldname + ".value");
	winCal=window.open("/Retailer/Shopping/Calendar.asp?date=" + escape(selDate) + "&form=" + escape(formname) + "&field=" + fieldname + "&darea=" + displayarea,"","width=230,height=220,left=25,top=25,scrollbars=yes,menubar=no,resizable=yes;location=no");
	//winCal=window.open("/Retailer/Shopping/Calendar.asp?date=" + selDate + "&form=" + escape(formname) + "&field=" + fieldname + "&darea=" + displayarea,"");
}

//emulates the function w/ the same name in vbscript
function FormatCurrency(Expression ,NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigits){
	//convert parameter variables
	num = (isNaN(Expression)) ? alert("FormatCurrency() only excepts numbers!") : Expression
	decimals = (NumDigitsAfterDecimal) ? NumDigitsAfterDecimal : 2
	lead = (IncludeLeadingDigit) ? IncludeLeadingDigit : true
	parens = (UseParensForNegativeNumbers) ? UseParensForNegativeNumbers : false
	commas = (GroupDigits) ? GroupDigits : false
	//round to int & make string
	var str = Math.round(num * Math.pow(10, decimals)).toString()
	//0 padding for small #s
	while (str.length <= decimals){
		str = "0" + str
	}
	//get decimal offset in string
	var point = str.length - decimals
	str = str.substring(0, point) + "." + str.substring(point, str.length)
	//add commas long enough & is wanted
	if (str.length > 6 && commas){ //more than 3 chars left of decimal
		var index = str.indexOf(".") - 3		
		while (index > 0){
			str = str.substring(0, index) + "," + str.substring(index, str.length)
			index = str.indexOf(",") - 3
		}
	}
	//clip leading 0 if exists & is unwanted
	if (str.substring(0, 1) == "0" && !(lead)){
		str = str.substring(1, str.length)
	}
	//add $
	str = "$" + str
	//put parens around negatives
	if (str.indexOf("-") > 0 && parens){
		str = "-(" + str.replace("-", "") + ")"
	}
	//show me the money!
	return str
}	
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10179331-1");
pageTracker._trackPageview();
} catch(err) {}</script>