
//var nbsp = 160;    // non-breaking space char
//var node_text = 3; // DOM text node-type
var emptyString = /^\s*$/
//var glb_vfld;      // retain vfld for timer thread
var proceed = 2;  


// -----------------------------------------
//            commonCheck2
// Common code for checkbox validation routines to
// check for older / less-equipped browsers
// Returns true (validation passed) or
//         proceed (don't know yet)
// -----------------------------------------

function commonCheck2   (vfld)   // element to be validated
{
  if (!document.getElementById) {
    return true;  // not available on this browser - leave validation to the server
  }
  return proceed;
};


// -----------------------------------------
//            validateRadiobutton
// Validate that a radiobutton has been checked.
// Returns true if valid (and also if could not be executed because 
// of old browser)
// -----------------------------------------

function validateRadiobutton(vfld)   // radiobutton to be validated
{

  var stat = commonCheck2(vfld);
  if (stat != proceed) return stat;

  for (i=0;i<vfld.length;i++) {
    if (vfld[i].checked==true) {
      return true;
    }
  }
  return false;
};


// -----------------------------------------
//            validatePresent
// Validate if something has been entered
// Returns true if so 
// -----------------------------------------

function validatePresent(vfld)   // element to be validated
{
  var stat = commonCheck2 (vfld);
  if (stat != proceed) return stat;

  if (emptyString.test(vfld.value)) {
      return false;
  }
  return true;  

};

