// quick ref, for laziness
d=document;

/***
 * Gets the layer object, as defined by <DIV> in IE4+, Mozilla Gecko, and standard browsers,
 * or <LAYER> in Netscape4 only.
 *
 * Usage: getEl(id), where id is the ID of the layer (a string).
 *
 * Script originally from: http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=14
 */

function getEl(id, oDoc) {
  if (d.layers) { // Netscape 4 ONLY.
    if (!oDoc) {oDoc = document;}
      if (oDoc.layers[id]) {return oDoc.layers[id];} 
      else {
        //repeatedly run through all child layers
        for (var x=0, y; !y && x < oDoc.layers.length; x++) {
          //on success, return that layer, else return nothing
          y = getEl(id,oDoc.layers[x].document); 
        }
        return y; 
      } 
  }
  if (d.getElementById) { // W3C Standard: IE5+, Mozilla Gecko (Netscape 6+), Opera 5+ (4 buggy), Konquerer 2+ (Safari)
    return d.getElementById(id);
  }
  if (d.all) { // IE4+, Opera 7
    return d.all[id];
  }
  return false;
}

function moveEl(el,x,y) {
  noPx=0;
//  var noPx = document.childNodes ? 'px' : 0; // px for Gecko with strict doctype
  if (el.style) el=el.style;
  el.left = x + noPx;
  el.top = y + noPx;
}

function getX(el) {
  if (el.style) el=el.style;
  return parseInt(el.left);
}

function getY(el) {
  if (el.style) el=el.style;
  return parseInt(el.top);
}

function show(el) {
  if (el.style) el.style.visibility = 'visible';
  else if (el.visibility) el.visibility = 'show';
}
function hide(el) {
  if (el.style) el.style.visibility = 'hidden';
  else if (el.visibility) el.visibility = 'hide';
}

function show2(id) {show(getEl(id));}
function hide2(id) {hide(getEl(id));}
