//**************************************************************************
// floatLayer(id,sx,sy,hsfe,vsfe)
// 
// Example Usage:
// 1) Body: <script language="JavaScript" src="/scripts/floatLayer.js"></script>
// 2) Body: <div id="x"; style="position:relative">...</div>
// 3) Body: <script language="JavaScript">floatLayer("floatLayer",0,10,1).flt();</script>
//
// Note(s):
// 1) Possible: <div id="x"; style="position:absolute">...</div>
// 2) sx/sy should be set with relation to div position (i.e. absolute or relative)
// 3) sy < 0 designed to work with div position absolute to allow floating at bottom of screen
// 4) Horrizontal Scroll Floating Enabled: hsfe = 1
// 5) Verticle Scroll Floating Enabled: vsfe = 1
//**************************************************************************
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
var px = document.layers ? "" : "px";
function floatLayer(id,sx,sy,hsfe,vsfe)
{
 var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
 window[id + "_obj"] = el;
 if(d.layers)el.style=el;
  el.cx = el.sx = sx;el.cy = el.sy = sy;

  // px -> pixels
  el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

  el.flt=function()
  {
   var pX, pY;

   pX = ns ? pageXOffset : 
   document.documentElement && document.documentElement.scrollLeft ? 
   document.documentElement.scrollLeft : document.body.scrollLeft;

   pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 
   document.documentElement.scrollTop : document.body.scrollTop;

   if(this.sy<0)
   pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 
   document.documentElement.clientHeight : document.body.clientHeight;

   if (hsfe == 1) {this.cx += (pX + this.sx - this.cx)/8;}
   if (vsfe == 1) {this.cy += (pY + this.sy - this.cy)/8;}
   this.sP(this.cx, this.cy);
   setTimeout(this.id + "_obj.flt()", 40);
  }
 return el;
}
