// Returns the browser-specific reference to a layer
function Layer(Name) {
   return (document.layers) ? document.layers[Name] : document.all[Name].style;
}

// Either hides or shows a layer, depending on the value in "Status"
function Show(Name, Status) {
   var Visible = (document.layers) ? 'show' : 'visible';
   var Hidden = (document.layers) ? 'hide' : 'hidden';
   Layer(Name).visibility = (Status) ? Visible : Hidden;
}

// Centers the layer (IE needs the Layer_Width)
function Center(Name, Layer_Width) {
   if (document.layers) {
      var Mid = Math.round(window.innerWidth/2);
      var Half = Math.round(Layer(Layer_Array[j]).clip.width/2);
   }
   else {
      var Mid = Math.round(document.body.clientWidth/2);
      var Half = Math.round(Layer_Width/2);
   }
   Layer(Name).left = Mid - Half;
}

// Dynamically writes content to a layer
function Layer_Write(Name, Content) {
   if (document.layers) {
      with (Layer(Name).document) {
         write(Content);
         close();
      }
   }
   else document.all[Name].innerHTML = Content;
}

// Moves the specified layer (Thing) with the mouse (X & Y are distances from the mouse pointer)
function Follow(Thing, X, Y) {
   if (typeof X == 'undefined') var X = 0;
   if (typeof Y == 'undefined') var Y = 0;
   Layer(Thing).left = event.clientX + X;
   Layer(Thing).top = event.clientY + Y;
}
