<!--
function MM_findObj(n, d) { //v4.01
	var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_setTextOfTextfield(objName,x,newText) { //v3.0
	var obj = MM_findObj(objName); if (obj) obj.value = newText;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// JavaScript Document
var reInteger = /^\d+$/
var digits = "0123456789";
// U.S. phone numbers have 10 digits.
// They are formatted as 123 456 7890 or (123) 456-7890.
var digitsInUSPhoneNumber = 10;
// whitespace characters as defined by this sample code
var whitespace = " \t\n\r";
function isEmpty(s) { return ((s == null) || (s.length == 0)) }
function validateEmail(objField, strMessage) {
	// Validates e-mail address form inputs.
	if (objField.value == "") {	// no value entered in field.
		// DISPLAY validation failure message.
		alert(strMessage);
		// REDIRECT shopper's cursor to the offending field.
		objField.focus();
		return false;
	}
	if (objField.value.indexOf ('@', 0) == -1 || objField.value.indexOf ('.', 0) == -1) {	// address does not contain the "@" and "." characters.
		// DISPLAY validation failure message.
		alert(strMessage);
		// REDIRECT shopper's cursor to the offending field.
		objField.select();
		objField.focus();
		return false;
	}
	else {	// the address is acceptable.
		return true;
	}
}
function validateTextField (objField, minLen, maxLen, strMessage) {
	// Validate a Text Field
	if(objField.value == "") {
		alert(strMessage);
		objField.focus();
		return false;
	}
	if(objField.value.length<minLen || objField.value.length>maxLen) {
		alert(strMessage);
		objField.focus();
		return false;
	}
	return true;
}
function TrimSTR(strValue) {
	// REMOVE leading spaces.
	while (true) {
		if (strValue.indexOf(" ") == 0) {	// a leading space has been found so...
			strValue = strValue.substring(1, strValue.length)	// slice it off.
		} else {	// the first character in the string is no longer a space so...
			break	// exit the loop.
		}
	}
	// REMOVE trailing spaces.
	if (strValue.length>0) {	// the string is not null.
		while (true) {
			if (strValue.lastIndexOf(" ") == strValue.length - 1) {	// a trailing space has been found so...
				strValue = strValue.substring(0, strValue.length - 1)	// slice it off.
			} else {	// the last character in the string is no longer a space so...
				break	// exit the loop.
			}
		}
	}
	// ASSIGN return value
	return strValue
}
function isNumeric(objField) {
	// INITIALIZE procedure-scope variables.
	var blnNumeric = true
	// SCAN string for non-numeric characters.
	for (var i = 0; i<objField.value.length; i++) {
		var strDigit = objField.value.charAt(i)
		if (strDigit<"0" || strDigit>"9") {	//non-numeric character has been found.
			blnNumeric = false
			break
		}
	}
	// ASSIGN return value.
	return blnNumeric
}
function stripCharsInBag (s, bag)
{ var i;
	var returnString = "";
	for (i = 0; i<s.length; i++)
	{
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}
	return returnString;
}
function stripCharsNotInBag (s, bag)
{ var i;
	var returnString = "";
	// Search through string's characters one by one.
	// If character is in bag, append to returnString.
	for (i = 0; i<s.length; i++)
	{
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (bag.indexOf(c) != -1) returnString += c;
	}
	return returnString;
}
function isInteger (s)	{
	if (isEmpty(s)) return false;
	return reInteger.test(s)
}
function stripWhitespace (s) {
	return stripCharsInBag (s, whitespace)
}
function validatePhoneNumber(field){
	sx = stripCharsNotInBag(field.value,digits); // Strip all non-digit chars;
	if (sx.length<digitsInUSPhoneNumber) {
		alert('There are not enough digits in your phone number, please correct');
		field.focus();
		return false;
	}
	return true;
}
function validateZip(field) {
	sx = stripWhitespace(field.value); // Strip all non-digit chars
	if(sx.length<5) { // Postals need to be at least 5
		alert('Please enter a valid zip code');
		field.focus();
		return false;
	}
	return true;
}
function validateForm(objForm) {
	with(objForm) {
		// Validate Form Input
		if(!validateTextField(name,4,30,'Please provide us with your name')) return false;
		if(!validateEmail(email,'Please provide us with your email address')) return false;
		if(!validatePhoneNumber(phone)) return false;
	}
}
function MM_findObj(n, d) { //v4.01
	var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
	var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
		if (val) { nm=val.name; if ((val=val.value)!="") {
				if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
				} else if (test!='R') { num = parseFloat(val);
					if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
						min=test.substring(8,p); max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
		} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
	} if (errors) alert('The following error(s) occurred:\n'+errors);
	document.MM_returnValue = (errors == '');
}
-->
