//    To use this script, simply define the first or both variables below...

 var image = "path/to/image"     // The path to & name of the image.
 var link  = "";                 //Link URL, if you want to link the image.

/*
 ------------------------------------------------------------------------------
 
     Torgo.org jFloater v2.0
     Created by:  Bobby Thompson (bobby@torgo.org)
     
     This JavaScript  file  will suspend  a logo image in  the lower  right hand
     corner of a  browser window.  Optionally,  the suspended  image can be used
     as a link.
     When the browser window is resized,  the image will automatically move back
     down to the lower  right corner.  When  it does, it  will move in a "fluid"
     manner.
     
     This script was  envisioned and created  solely by me.  I spent a very long
     time  thinking &  rethinking how to  structure  this.  I actually made this
     version for  use on my work's  intranet.  It took me a couple of years, but
     I am now replacing my former JavaFloater script with this.
     
     This script (as far as I know) is ONLY compatible with Apple's Safari,  and
     Microsoft Internet Explorer.  I  have attempted to implement this script to
     be compatible with Netscape and Mozilla, however after spending a long time
     trying to figure  out how to implement  this for those  browsers, I finally
     decided  it was  easier to implement  this for use in  the top browsers for
     both Mac & Windows.
     Browsers  in browsers  other than  Safari & MSIE,  the  image *should* stay
     invisible.
     
     If you decide to  use this script,  I ask that you leave  these comments in
     place.  You can always post  a link to my page  to give me credit,  however
     as  long  as you  leave these  comments in  the .js file,  nothing else  is
     necessary.
     
     --------------------------------------------------------
     Copyright(c) 2002-2004, Bobby Thompson (bobby@torgo.org)
     http://www.torgo.org/
     --------------------------------------------------------
     143 ÄÄ
     
 ------------------------------------------------------------------------------
*/

if( image == "path/to/image" || image == "path/to/image.gif" ) {
	image = "logo_top.gif";
	link  = "#page_top";
}


document.write('<DIV ID="float_pane" STYLE="position:absolute;visibility:hidden">\n');
if( link != "" )
  document.write('<A HREF="' + link + '">');
document.write('<IMG SRC="' + image + '" BORDER="0">');
if( link != "" )
  document.write('</A>');
document.write('\n</DIV>');

  var start = 0;
  var oTop;
  var oLeft;
  var cHeight = 0;
  var cWidth = 0;
  function floatRefresh() {
      getValues();
      oLeft = float_pane.style.pixelLeft - (cWidth + document.body.scrollLeft - (  float_pane.offsetWidth + 3 ));
      oTop = float_pane.style.pixelTop - (cHeight + document.body.scrollTop - (  float_pane.offsetHeight + 3 ));
      if( oTop < 0)
        float_pane.style.pixelTop += 1 + (Math.round(Math.abs(float_pane.style.pixelTop - (cHeight + document.body.scrollTop - (  float_pane.offsetHeight ))) / 10));
      if(  oTop > 0 )
        float_pane.style.pixelTop -= 1 + (Math.round(Math.abs(float_pane.style.pixelTop - (cHeight + document.body.scrollTop - (  float_pane.offsetHeight))) / 10));
      if( oLeft < 0)
        float_pane.style.pixelLeft += 1 + (Math.round(Math.abs(float_pane.style.pixelLeft - (cWidth + document.body.scrollLeft - (  float_pane.offsetWidth ))) / 10));
      if(  oLeft > 0 )
        float_pane.style.pixelLeft -= 1 + (Math.round(Math.abs(float_pane.style.pixelLeft - (cWidth + document.body.scrollLeft - (  float_pane.offsetWidth ))) / 10));
  }
  function getValues() {
   		if( navigator.userAgent.indexOf("Safari") != -1 ) {
   			cHeight = document.clientHeight;
   			cWidth = document.clientWidth;
   			start = 1;
   		} else if( navigator.userAgent.indexOf("MSIE") != -1 ) {
   			cHeight = document.body.clientHeight;
   			cWidth = document.body.clientWidth;
   			start = 1;
   		}
   }
   
   getValues();
   if( cHeight && cWidth ) {
     float_pane.style.pixelLeft = (cWidth + document.body.scrollLeft - (  float_pane.offsetWidth + 3 ));
     float_pane.style.pixelTop  = (cHeight + document.body.scrollTop - (  float_pane.offsetHeight + 3 ));
     float_pane.style.visibility = "visible";
     setInterval("floatRefresh()",1);
   }
       
