/*
 * $Id: chair.js,v 1.2 2007/12/11 19:01:34 chaitat Exp $
 *
 * Shared functions.
 *
 * All functions has 'chair' as their prefix.
 */

/*
 * Check if the specified string is blank.  This string is from '<input type="text" ... />'
 *
 * Returns: true if blank, false otherwise.
 */
function chairIsTextInputBlank(s) {
  return s.match('^[ \t\r\n]*$');
}

function chairIsTextInputInteger(s) {
  return s.match('^[0-9]+$');
}

function chairIsTextInputDecimal(s) {
  return s.match('^[0-9]+(\\.[0-9]+)?$');
}

function chairIsTextInputEndWith(s, endString) {
  return s.match('^.*' + endString + '$');
}

// Check to see if the web browser is IE or Firefox.
function chairIsIE() {
  return navigator.appName == "Microsoft Internet Explorer";
}