/*
____________________________________

Filename:  StaticLayer.js 
Path:      
Owner:     Justin C. Ionescu
Copyright (c) 1999 InterWorld Corporation
____________________________________

/////   U S A G E

- change your  <BODY . . . onLoad = "javascript:fMakeStaticLayer( "name of layer" )"> tag to reflect the onLoad event

/////    required  I N C L U D E S  for HTML

<SCRIPT LANGUAGE="JavaScript" SRC="(path)/BrowserType.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="(path)/StaticLayer.js"></SCRIPT>

*/


//----create static layer object and trigger refresh methods
function fMakeStaticLayer (asStaticLayer)
  {
  slFloater = new fStaticLayerObj(asStaticLayer);
  fUpdate();
  }

//----create static layer object
function fStaticLayerObj (id) {
  if (document.layers) 
    {
    this.css = document.layers[id];
//alert(id);
    this.x = this.css.left;
    this.y = this.css.top;
    }
  else if (document.all) 
    {
    this.css = document.all[id].style;
    this.x = this.css.pixelLeft;
    this.y = this.css.pixelTop;
    }
  this.fMoveTo = fMoveTo;
  this.fUpdateIE   = fUpdateIE;
  this.fUpdateNS  = fUpdateNS;
}

//----move object to a specified position
function fMoveTo (xpos,ypos) {
  this.x = xpos;
  this.css.left = this.x;
  this.y = ypos;
  this.css.top = this.y;
}

//----based on browser type, assign a refresh method
function fUpdate ()
  {
  if (document.all) onscroll = slFloater.fUpdateIE;
  if (document.layers) setInterval(slFloater.fUpdateNS,10);
  }  

//----regenerate for document.all
function fUpdateIE ()
  {
  var w2=document.body.scrollLeft;
  var h2=document.body.scrollTop;
  slFloater.fMoveTo(w2,h2);
  }

//----regenerate for document.layers
function fUpdateNS ()
  {
  var w2 = pageXOffset;
  var h2 = pageYOffset;
  slFloater.fMoveTo(w2,h2);
  }
