/********************************************************************
* layers.js                                                         *
* Modified from cbdhtml.js by Brian Sidharta 6-1-99                 *
* - Removed many functions to reduce file size                      *
*                                                                   *
* Copyright 1998, 1999 by Mike Hall.                                *
* Web:   http://members.aol.com/MHall75819                          *
* Email: MHall75819@aol.com                                         *
*                                                                   *
* Last updated January 24, 1999.                                    *
*                                                                   *
* These functions allow dynamic HTML effects to be added to any     *
* web page and will work on both Netscape Communicator 4.0+ and MS  *
* Internet Explorer 4.0+ browsers.                                  *
*                                                                   *
********************************************************************/

var layerList = new Array();

function createLayer(name, left, top, width, height, visible, content) {

  var z = layerList.length;
  var layer;

  layerList[z] = name;

  if (document.layers) {
    document.writeln('<layer name="' + name + '" left=' + left + ' top=' + top + ' width=' + width + ' height=' + height +  ' visibility=' + (visible ? '"show"' : '"hide"') + ' z-index=' + z + '>');
    document.writeln(content);
    document.writeln('</layer>');
    layer = getLayer(name);
    layer.width = width;
    layer.height = height;
  }

  if (document.all) {
    document.writeln('<div id="' + name + '" style="position:absolute; overflow:none; left:' + left + 'px; top:' + top + 'px; width:' + width + 'px; height:' + height + 'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') + ' z-index:' + z + '">');
    document.writeln(content);
    document.writeln('</div>');
  }

  clipLayer(name, 0, 0, width, height);
}

function hideLayer(name) {

  var layer = getLayer(name);

  if (document.layers)
    layer.visibility = "hide";
  if (document.all)
    layer.visibility = "hidden";
}

function showLayer(name) {

  var layer = getLayer(name);

  if (document.layers)
    layer.visibility = "show";
  if (document.all)
    layer.visibility = "visible";
}

function clipLayer(name, clipleft, cliptop, clipright, clipbottom) {

  var layer = getLayer(name);

  if (document.layers) {
    layer.clip.left   = clipleft;
    layer.clip.top    = cliptop;
    layer.clip.right  = clipright;
    layer.clip.bottom = clipbottom;
  }
  if (document.all)
    layer.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';
}


function setBgColor(name, color) {

  var layer = getLayer(name);

  if (document.layers)
    layer.bgColor = color;
  else if (document.all)
    layer.backgroundColor = color;
}

function replaceContent(name, content) {

  if (document.layers) {
    var layer = getLayer(name);
    layer.document.open();
    layer.document.writeln(content);
    layer.document.close();
  }
  else if (document.all) {
    document.all.item( name ).innerHTML = content;
    //eval("document.all." + name + ".innerHTML = '" + content + "';");
  }
}


function getLayer(name) {

  // Returns a handle to the named layer.

  if (document.layers)
    return(document.layers[name]);
  else if (document.all) {
    layer = eval('document.all.' + name + '.style');
    return(layer);
  }
  else
    return(null);
}


