function $(id) {
  return document.getElementById(id);
}

function o$(id) {
  return opener.document.getElementById(id);
}

function dw(str) {
  document.write(str);
}

function a(str) {
  alert(str);
}

function openCenteredWindow(url, name, width, height) {
  var myWindow;
  var left = parseInt((screen.availWidth/2) - (width/2));
  var top = parseInt((screen.availHeight/2) - (height/2));
  var windowFeatures = "width=" + width + 
                       ",height=" + height + 
                       ",resizable=1,location=0,status=0,menubar=0," + 
                       ",left=" + left + 
                       ",top=" + top + 
                       ",screenX=" + left + 
                       ",screenY=" + top;
  myWindow = window.open(url, name, windowFeatures);
  myWindow.resizeTo(width, height);
  myWindow.focus();
}

function numberOnly(evt) {
  /*
  48..57  = 0..9
  96..105 = (numpad) 0..(numpad) 9
  190     = . (comma)
  110     = (numpad) . (comma)
  8       = backspace
  9       = tab
  46      = delete
  37..40  = arrow left, up, right, down
  */
  evt = (evt) ? evt : ((window.event) ? event : null);
  if (evt) {
    var elem = (evt.target) ? evt.target : 
      ((evt.srcElement) ? evt.srcElement : null);
    if (elem) {
      var charCode = (evt.charCode) ? evt.charCode : 
        ((evt.which) ? evt.which : evt.keyCode);
      if ((charCode >= 48 && charCode <= 57) || 
          (charCode >= 96 && charCode <= 105) || 
          (charCode >= 37 && charCode <= 40) || 
          charCode == 190 || charCode == 110 || charCode == 8 || charCode == 9 || charCode == 46
         ) {
        return true;
      } else {
        return false;
      }
    }
  }
}