/* Copy of tooltips2.js modified to work with March 2008 navbar update using jQuery */

var toolTip = {
   x : 0,
   y : 0,
   timer : null,
   obj : null, 

   show : function(s,p){
      if(!this.isReady){  return false; }
      
      // note: if p is defined then the tip pointer will point down, default points up
      if(p != undefined) { this.obj.addClass("t2"); }
      else { this.obj.removeClass("t2"); }
      
      $(document).bind("mousemove.SBtooltip", function(e){
            if(p != undefined){ toolTip.obj.css({top: e.clientY-50, left: e.clientX}); }
            else { toolTip.obj.css({top: e.clientY+10, left: e.clientX-10 }); }
      });
      
      this.obj.html('<span class="ttip">'+s+'</span>');
      this.obj.show();
      this.obj.css({visibility:"visible", display:"inline"});
      
      this.timer = setTimeout("toolTip.hide()", 4000);
   },
   showFixed : function (s,attachObj){
      if(!this.isReady){  return false; }
      
      this.obj.addClass("t2");

      var pos = attachObj.offset(); 
      
      this.obj.css({top: pos.top - attachObj.height() - 15, left: pos.left}); 
      
      this.obj.html('<span class="ttip">'+s+'</span>');
      this.obj.show();
      
      this.timer = setTimeout("toolTip.hide()", 4000);
   },
   hide : function (){ 
      if(!this.isReady){  return false; }
      $(document).unbind("mousemove.SBtooltip");
      this.obj.hide();
      clearTimeout(this.timer);
   },
   isReady : function(){
      return (this.obj == null) ? (false) : (true);
   },
   setup : function(){
      $("body").prepend('<div id="ttip" style="position:absolute;"></div>');
      this.obj = $("div#ttip");
   }
};

/* If possible create toolTip DOM object */

if($("body")){
   toolTip.setup();
} else {
   $(document).ready(toolTip.setup);
}
