/*************************************************************************
  This code is from Dynamic Web Coding at dyn-web.com
  Copyright 2003-5 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

// adjust horizontal and vertical offsets here
// (distance from mouseover event which activates tooltip)
Tooltip.offX = 4;  
Tooltip.offY = 4;
Tooltip.followMouse = false;  // must be turned off for hover-tip

// Tooltips for Video Carousel
var msgVideo1 = '<h1><a href="#" class="watchvid">Paris Gives Lap Dance&nbsp;&raquo;</a></h1> The heiress gets frisky with man in a wheelchair at a wild New Year&rsquo;s Eve party in Las Vegas.<br /><br /><span>posted by</span> <a href="#">jeff</a>  <span>|  11:54 AM 11/28/07<br />Tags:</span> <a href="http://www.searchles.com/search/tag/Music News">Music News</a>, <a href="http://www.searchles.com/search/tag/rockstar">rockstar</a>';

// Tooltips for Post Titles - videos have class=watchvid
var msgPost1 = '<a href="#" class="closevid" title="close"><img src="images/ico_close.gif" alt="close" /></a><h1><a href="#">Great Collection of Hava Nagila&nbsp;&raquo;</a></h1><div class="desc">A description for this link goes here. Blah blah.</div><div class="url"><a href="http://www.thisisaurl.com/url/">http://www.thisisaurl.com/url</a></div><div class="tags">Tags: <span class="tag_lenses tag level0" ><a href="http://www.searchles.com/search/tag/lenses/all">lenses</a> </span>&#183; <span class="tag_topics tag level0" ><a href="http://www.searchles.com/search/tag/topics/all">topics</a> </span>&#183; <span class="tag_squidoo tag level0" ><a href="http://www.searchles.com/search/tag/squidoo/all">squidoo</a> </span>&#183; <span class="tag_experts tag level0" ><a href="http://www.searchles.com/search/tag/experts/all">experts</a> </span></div><div class="actions"><a href="http://www.searchles.com/links/add_link/livescience.com%2Fenvironment%2F071204-geothermal-energy.html" class="add_tags">save</a> | <a href="http://www.searchles.com/links/show/livescience.com%2Fenvironment%2F071204-geothermal-energy.html?add_comment=true" class="add_comment">Comment</a> | <a href="http://www.searchles.com/links/show/livescience.com%2Fenvironment%2F071204-geothermal-energy.html" class="urlinfo">Info</a> | <a href="http://www.searchles.com/links/share/livescience.com%2Fenvironment%2F071204-geothermal-energy.html" class="send_message">Share</a> | <a href="http://www.searchles.com/links/report_spam/livescience.com%2Fenvironment%2F071204-geothermal-energy.html" class="spam">Spam</a></div>';

function doTooltip(e, msg) {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.clearTimer();
  var tip = document.getElementById? document.getElementById(Tooltip.tipID): null;
  if ( tip && tip.onmouseout == null ) {
      tip.onmouseout = Tooltip.tipOutCheck;
      tip.onmouseover = Tooltip.clearTimer;
  }
  Tooltip.show(e, msg);
}

function hideTip() {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.timerId = setTimeout("Tooltip.hide()", 600);
}

Tooltip.tipOutCheck = function(e) {
  e = dw_event.DOMit(e);
  // is element moused into contained by tooltip?
  var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
  if ( this != toEl && !contained(toEl, this) ) Tooltip.hide();
}

// returns true of oNode is contained by oCont (container)
function contained(oNode, oCont) {
  if (!oNode) return; // in case alt-tab away while hovering (prevent error)
  while ( oNode = oNode.parentNode ) if ( oNode == oCont ) return true;
  return false;
}

Tooltip.timerId = 0;
Tooltip.clearTimer = function() {
  if (Tooltip.timerId) { clearTimeout(Tooltip.timerId); Tooltip.timerId = 0; }
}

Tooltip.unHookHover = function () {
    var tip = document.getElementById? document.getElementById(Tooltip.tipID): null;
    if (tip) {
        tip.onmouseover = null; 
        tip.onmouseout = null;
        tip = null;
    }
}

dw_event.add(window, "unload", Tooltip.unHookHover, true);
