function openPictureWindow(imageName, imageWidth, imageHeight, alt) {
	var windowHeight=parseInt(imageHeight)+35;
	// calculate position on screen - hopefully, the center of the screen
	posLeft=(screen.width/2)-(imageWidth/2);
	posTop=(screen.height/2)-(windowHeight/2);
	// show image
	newWindow=window.open("", "newWindow", "width="+imageWidth+",height="+windowHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="" marginheight="0" marginwidth="0" onClick="self.close()">');
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">');
	newWindow.document.write('<div style="font-family: \'Trebuchet MS\', Helvetica, sans-serif; font-size: 0.9em; font-weight: normal; padding-top: 3px; text-align: center;">');
	newWindow.document.write('Click to close window...<br>');
	newWindow.document.write('</div>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}
function validatesearch() {
	// function to validate the products search form
	if(trim(document.frmSearch.txtSearch.value)=="") { return false; }
}
function validate_email(field) {
	// function to validate an email address
	with(field) {
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if(apos<1||dotpos-apos<2)
		{ return false }
		else
		{ return true }
	}
}
function isValidDate(dateStr, format) {
	// function to validate a date
	if(format==null) { format="MDY"; }
	format=format.toUpperCase();
	if(format.length!=3) { format="MDY"; }
	if((format.indexOf("M")== -1)||(format.indexOf("D")== -1)||(format.indexOf("Y")== -1)) { format="MDY"; }
	if(format.substring(0, 1)=="Y") { // If the year is first
		var reg1=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
		var reg2=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
	} else if(format.substring(1, 2)=="Y") { // If the year is second
		var reg1=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/
		var reg2=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/
	} else { // The year must be third
		var reg1=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/
		var reg2=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
	}
	// If it doesn't conform to the right format (with either a 2 digit year or 4 digit year), fail
	if((reg1.test(dateStr)==false)&&(reg2.test(dateStr)==false)) { return false; }
	var parts=dateStr.split(RegExp.$1); // Split into 3 parts based on what the divider was
	// Check to see if the 3 parts end up making a valid date
	if(format.substring(0, 1)=="M") { var mm=parts[0]; } else if(format.substring(1, 2)=="M") { var mm=parts[1]; } else { var mm=parts[2]; }
	if(format.substring(0, 1)=="D") { var dd=parts[0]; } else if(format.substring(1, 2)=="D") { var dd=parts[1]; } else { var dd=parts[2]; }
	if(format.substring(0, 1)=="Y") { var yy=parts[0]; } else if(format.substring(1, 2)=="Y") { var yy=parts[1]; } else { var yy=parts[2]; }
	if(parseFloat(yy)<=50) { yy=(parseFloat(yy)+2000).toString(); }
	if(parseFloat(yy)<=99) { yy=(parseFloat(yy)+1900).toString(); }
	var dt=new Date(parseFloat(yy), parseFloat(mm)-1, parseFloat(dd), 0, 0, 0, 0);
	if(parseFloat(dd)!=dt.getDate()) { return false; }
	if(parseFloat(mm)-1!=dt.getMonth()) { return false; }
	return true;
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g, "");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/, "");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/, "");
}
function PageRedirect(strPage, strTime) {
	setTimeout('window.location = "'+strPage+'"', strTime);
}
function MsgBox(tMsg) {
	alert(tMsg);
}
function MsgOkCancel() {
	return confirm('Are you sure?');
}
function MsgOkCancel_Custom(tMsg) {
	return confirm(tMsg);
}
function change(frmSelect) {
	// makes form submit when combo box changes
	frmSelect.submit();
}
