// ====================================
function isDigit (c){   
	return ((c >= "0") && (c <= "9"))
}
// ====================================
function isInteger (s) {   
	var i;
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (!isDigit(c)) return false;
    }
    return true;
}
// ====================================
function stripCharsInBag (s, bag)
{   var i;
    var returnString = "";
    for (i = 0; i < s.length; i++) {   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
// ====================================
function checkPhone (theField){  
	var normalizedPhone = stripCharsInBag(theField.value, "()- ");
    return (isInteger(normalizedPhone) && normalizedPhone.length == 10);
}
// ====================================
function checkZipCode (theField) {   
 var normalizedZIP = stripCharsInBag(theField.value, "-");
 return (isInteger(normalizedZIP) && ((normalizedZIP.length == 5) || (normalizedZIP.length == 9)));
}
// ====================================
function checkEmail(theField) {
	return (theField.value.indexOf("@") + "" != "-1" &&
  		theField.value.indexOf(".") + "" != "-1" &&
  		theField.value != "") 
	}
// ====================================	
function printfriendly() {
childWindow = window.open("printfriendly.htm", "printFriendly", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=570,height=600,left=50,top=50");
if (childWindow.opener == null) childWindow.opener = self;
}	
// ====================================	
function isEmpty(s) {   
	if ((s == null) || (s.length == 0)) {
		return true;
	} else {
		while (s.substring(0,1) == ' ') {
			s = s.substring(1, s.length);
		}
		if ((s == null) || (s.length == 0)) {
			return true;
		}
		return false;
	}
}
