function charCount(theField) {
  return theField.length;
}

// add zero to end of currency values etc
function addZero( N ) {
  var S = new String( N );
  var i = S.indexOf('.');
  if (i != -1) {
    S = S.substr( 0, i+3 );
    if (S.length-i < 3){
      S = S + '0';
    }
  }
  else {
    S = S + '.00';
  }
  return S;
}

// get the top y-position of a scrolled page
function getYoffset(){
  var ScrollTop = document.body.scrollTop;
  if (ScrollTop == 0) {
      if (window.pageYOffset)
          ScrollTop = window.pageYOffset;
      else
          ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
  }
  return ScrollTop;
}