// Floater class
function Floater(sID)
  {
  // Properties
  this.ID = sID;
  this.SlideTime = 1200;  
  this.TargetY = 0;
  this.MaxDiff = (IE ? document.body.clientHeight : window.innerHeight);

  if(IE)
    this.Style = document.all[sID].style;
  else if(NS6)
    this.Style = document.getElementById(sID).style;
  else if(NS)
    this.Style = document.layers[sID];

  // Methods  
  this.Position = function(iLeft, iTop)
    {
    this.Style[LEFT] = iLeft;
    this.Style[TOP] = iTop;
    this.Left = iLeft;
    this.Top = iTop
    }

  this.Align = function(iLeft)
    {
    this.Style[LEFT] = iLeft;    
    this.Left = iLeft;
    }    
    
  this.Toggle = function()
    {
    this.Position(this.Left, this.Top);
    var Visibility = this.Style.visibility.toUpperCase();
    if(Visibility == "HIDDEN" || Visibility == "HIDE" || Visibility == "")
      this.Style.visibility = "visible";
    else
      this.Style.visibility = "hidden";  
    }
  
  this.OnTimer = function()
    {
    this.CurrentY = parseInt(this.Style[TOP]);
    this.ScrollTop = Page.Top();
    var TargetY = this.ScrollTop + this.Top;

    if(this.CurrentY != TargetY) 
      {
      if(TargetY != this.TargetY) 
        {
        this.TargetY = TargetY;
        this.FloatInitialize();
        }                
      this.Float();
      }
    }

  this.FloatInitialize = function()
    {    
    var now = new Date();
    this.A = this.TargetY - this.CurrentY;
  	this.B = Math.PI / (2 * this.SlideTime);
  	this.C = now.getTime();
     
    if(Math.abs(this.A) > this.MaxDiff) 
      {
  		this.D = (this.A > 0 ? this.TargetY - this.MaxDiff : this.TargetY + this.MaxDiff);
  		this.A = (this.A > 0 ? this.MaxDiff : -this.MaxDiff);
      } 
    else 
      {
  		this.D = this.CurrentY;
      }
    }  

  this.Float = function()
    {
    var now = new Date();
    var newY = this.A * Math.sin(this.B * (now.getTime() - this.C)) + this.D;
  	newY = Math.round(newY);
  
  	if((this.A > 0 && newY > this.CurrentY ) ||
  		(this.A < 0 && newY < this.CurrentY )) 
      {
      this.Style[LEFT] = this.Left;
      this.Style[TOP] = newY;
      }   
    }    
  }


function WriteFloaterHeader(sID, sTitle, iWidth)
  {
  document.write("<DIV ID='" + sID + "' CLASS='Floater'>");
  document.write("<TABLE WIDTH=" + iWidth + " CELLSPACING=0 CELLPADDING=0 BORDER=0>");
  document.write("<TR><TD WIDTH='100%' CLASS='FloaterBorder'>");
  document.write("<TABLE WIDTH='100%' CELLSPACING=1 CELLPADDING=3 BORDER=0>");
  document.write("<TR><TH WIDTH='100%' CLASS='Floater'>" + sTitle + "</TH></TR>");
  document.write("<TR><TD WIDTH='100%' CLASS='Floater'>");
  }
  
function WriteFloaterFooter()
  {
  document.write("</TD></TR>");
  document.write("</TABLE>");
  document.write("</TD></TR>");
  document.write("</TABLE>");
  document.write("</DIV>  ");
  }  
  
function WriteFloaterItem(sURL, sDescription)
  {
  document.write("<A HREF='" + sURL + "'>" + sDescription + "</A><BR>");
  }

    

