function element () {
  var w;
  var id;

  if (arguments.length == 2) {
    w = arguments[0];
    id = arguments[1];
  } else {
    w = window;
    id = arguments[0];
  }

  if (w.document.getElementById != null) {
    return w.document.getElementById(id);
  } else if (w.document.all != null) {
    return w.document.all[id];
  } else if (w.document.layers != null) {
    return w.document.layers[id];
  } else {
    return null;
  } 
}
