function btnSubmit() {
  if (checkForm()) { document.form1.submit(); }
}
function setFocus(frmName, tagName) {
  document.forms[frmName].elements[tagName].focus();
}
function hasSpace (strIn) {
  var re = / /;
  return re.test(strIn);
}
function hasQuote (strIn) {
  var re = /\"/;
  return re.test(strIn);
}
function hasUpper (strIn) {
  var re = /[A-Z]/;
  return re.test(strIn);
}
function hasLower (strIn) {
  var re = /[a-z]/;
  return re.test(strIn);
}
function hasNumeric (strIn) {
  var re = /[0-9]/;
  return re.test(strIn);
}
function isNumeric (strIn) {
  var re = /\D/g;
  return !re.test(strIn);
}
function emptyString (strIn) {
  var re = / |[\f\n\r]/g;
  var tmpStr = strIn.replace(re, '');
  if (tmpStr.length == 0)
    return true;
  else
    return false;
}
function isDate (strIn) {
  // first make sure date is formatted as mm/dd/yyyy
  var re = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
  var retval = re.exec(strIn);

  // if format is okay, use date object to parse date
  if (retval) {
    // check year greater than 1752 (minimum that SQL Server can handle)
    if (Number(RegExp.$3) <= 1752) {
      return false;
    }
  
    // check month values
    if (Number(RegExp.$1) == 1 || Number(RegExp.$1) == 3 || Number(RegExp.$1) == 5 || Number(RegExp.$1) == 7 || Number(RegExp.$1) == 8 || Number(RegExp.$1) == 10 || Number(RegExp.$1) == 12) {
      // day value must be between 1 and 31
      if (Number(RegExp.$2) >= 1 && Number(RegExp.$2) <= 31)
        return true;
    }
    else if (Number(RegExp.$1) == 4 || Number(RegExp.$1) == 6 || Number(RegExp.$1) == 9 || Number(RegExp.$1) == 11) {
      // day value must be between 1 and 30
      if (Number(RegExp.$2) >= 1 && Number(RegExp.$2) <= 30)
        return true;
    }
    else if (Number(RegExp.$1 == 2)) {
      // if year is divisible by 4, then it is a leap-year
      if (Number(RegExp.$3) % 4 == 0) {
        if (Number(RegExp.$2) >= 1 && Number(RegExp.$2) <= 29)
          return true;
      }
      else {
        if (Number(RegExp.$2) >= 1 && Number(RegExp.$2) <= 28)
          return true;
      }
    }
  }
  // at least one test failed, return false
  return false;
}
function getLen (strIn) {
  return strIn.length;
}
function isUPIN(strIn) {
  var reUPIN = /^[A-Za-z][0-9]{5}$/;
  var reNPI = /^[0-9]{10}$/;
  var chk = reUPIN.test(strIn);
  if (chk == true)
    return true;
  else {
	  return reNPI.test(strIn);
  }
}
function isMoney (strIn) {
  var re = /^\d*$|^\d*\.\d{2}$/;
  return re.test(strIn);
}
function formatMoney (strIn) {
  strIn = new String(roundDecimal(strIn));
  if (Number(strIn) < 0) { strIn = String(Number(strIn) * -1) }
  
  var idx = strIn.indexOf('.');
  if (idx > 0) {
    var dollars = strIn.substr(0, idx);
    var cents = strIn.substr(idx + 1, 2);
    cents = cents + '00';
    cents = cents.substr(0,2);
  }
  else {
    var dollars = strIn;
    var cents = '00';
  }
  if (dollars == 'null') {
    dollars = "0";
  }

  return dollars + '.' + cents;
}
function roundDecimal (numIn) {
  // multiply by 100
  var numIn = numIn * 100;
  
  // round
  numIn = Math.round(numIn);
  
  // divide by 100
  numIn = numIn / 100;
  
  return numIn;
}
function lrTrim(strIn) {
  var re = /^ *| *$/g;
  return strIn.replace(re, '');
}
function stripComma (strIn) {
  var re = /,/g;
  var tmpStr = strIn.replace(re, '');
  return tmpStr;
}
function stripHTML (strIn) {
  var re = /<body[^>]*>((.|\n)*)<\/body>/i;
  re.exec(stripNoPrint(strIn));
  var tmpStr = String(RegExp.$1);
  re = /^<P>&nbsp;<\/P>$/i;
  return tmpStr.replace(re, '');
}
function trimNoPrint (strIn) {
  var tmpStr = String(strIn);
  var re = / {2,}|[\f\n\r]/g;
  return tmpStr.replace(re, ' ');
}
function stripNoPrint (strIn) {
  var re = /[\f\n\r]/g;
  return strIn.replace(re, '');
}
function isSSN (strIn) {
  var re = /^\d{3}-?\d{2}-?\d{4}$/;
  return re.test(strIn);
}
function stripSSN (strIn) {
  // remove all non-word characters
  var strTest = String(strIn);
  var re = /\W/g;
  return strTest.replace(re, '');
}

