function show_help(event, help_id) {
    document.getElementById(help_id).style.left = event.clientX + 4;
    document.getElementById(help_id).style.top = event.clientY - 40;
    $("#"+help_id).show("clip");
}

$(document).ready(
	function() {if(document.createElement) tooltip.d();}
);
	
tooltip = {

  t: document.createElement("div"),
  c: null,
  g: false,
  
  tooltipHTML: null,
  reversedTooltipHTML: null,
  moveTimeout: null,
  
  m: function(e) {
    if(tooltip.g) {
      x = window.event ? event.clientX + document.body.scrollLeft : e.pageX;
      y = window.event ? event.clientY + document.documentElement.scrollTop  : e.pageY;
	  tooltip.a( x, y);
    }
  },

  d: function() {  
    tooltip.t.setAttribute("id","ttip");
    document.body.appendChild(tooltip.t);
    a = (document.all) ? document.all : document.getElementsByTagName("*");
    for(var i=0; i<a.length; i++) {
      if(a[i].getAttribute("title")) {
        a[i].setAttribute("text", a[i].getAttribute("title"));
        a[i].removeAttribute("title");
        if(a[i].getAttribute("alt") && a[i].complete) a[i].removeAttribute("alt");
        tooltip.l(a[i],"mouseover",tooltip.s);
        tooltip.l(a[i],"mouseout", tooltip.h);
		//tooltip.l(a[i],"mouseout", function() { tooltip.g = false; tooltip.moveTimeout = setTimeout(tooltip.h, 50) } );
      }
    }
	document.onmousemove = tooltip.m;
  },

  s: function(e) {
	tooltip.g = true;
	
    d = (window.event) ? window.event.srcElement : e.currentTarget;
    //tooltip.t.appendChild(document.createTextNode(d.getAttribute("text")));
 
	tooltip.tooltipHTML = '<table border="0" cellpadding="0" cellspacing="0" width="420"><tr><td width="33"><img width="33" src="/images/help_border/help-left-top.png"></td><td style="background: url(\'/images/help_border/help-top.png\');"></td><td width="7"><img width="7" src="/images/help_border/help-right-top.png"></td></tr><tr><td style="background: url(\'/images/help_border/help-left.png\');" valign="top"><img src="/images/help_border/help-arrow.png"></td><td style="background: #FDF3DA;" class="ttip_text" valign="top">'+d.getAttribute("text")+'</td><td style="background: url(\'/images/help_border/help-right.png\');"></td></tr><tr><td><img src="/images/help_border/help-bottom-left.png"></td><td style="background: url(\'/images/help_border/help-bottom.png\');"></td><td><img src="/images/help_border/help-right-bottom.png"></td></tr></table>';
    tooltip.tooltipYHTML = '<table border="0" cellpadding="0" cellspacing="0" width="420"><tr><td width="33"><img width="33" src="/images/help_border/help-left-top.png"></td><td style="background: url(\'/images/help_border/help-top.png\');"></td><td width="7"><img width="7" src="/images/help_border/help-right-top.png"></td></tr><tr><td style="background: url(\'/images/help_border/help-left.png\');" valign="bottom"><img src="/images/help_border/help-arrow.png" style="position:relative;top:-10px;"></td><td style="background: #FDF3DA;" class="ttip_text" valign="top">'+d.getAttribute("text")+'</td><td style="background: url(\'/images/help_border/help-right.png\');"></td></tr><tr><td><img src="/images/help_border/help-bottom-left.png"></td><td style="background: url(\'/images/help_border/help-bottom.png\');"></td><td><img src="/images/help_border/help-right-bottom.png"></td></tr></table>';	
	tooltip.reversedTooltipHTML = '<table border="0" cellpadding="0" cellspacing="0" width="420"><tr><td width="33"><img width="33" src="/images/help_border/help-left-top.png"></td><td style="background: url(\'/images/help_border/help-top.png\');"></td><td width="7"  align="left"><img width="7" src="/images/help_border/help-right-top.png"></td></tr><tr><td style="background: url(\'/images/help_border/help-left.png\');"></td><td style="background: #FDF3DA;" class="ttip_text" valign="top">'+d.getAttribute("text")+'</td><td style="background: url(\'/images/help_border/help-right.png\') repeat-y;" valign="top"><img src="/images/help_border/help-arrow_reversed.png"></td></tr><tr><td><img src="/images/help_border/help-bottom-left.png"></td><td style="background: url(\'/images/help_border/help-bottom.png\');"></td><td  align="left"><img src="/images/help_border/help-right-bottom.png"></td></tr></table>';
    tooltip.reversedTooltipYHTML = '<table border="0" cellpadding="0" cellspacing="0" width="420"><tr><td width="33"><img width="33" src="/images/help_border/help-left-top.png"></td><td style="background: url(\'/images/help_border/help-top.png\');"></td><td width="7"><img width="7" src="/images/help_border/help-right-top.png"></td></tr><tr><td style="background: url(\'/images/help_border/help-left.png\');"></td><td style="background: #FDF3DA;" class="ttip_text" valign="top">'+d.getAttribute("text")+'</td><td style="background: url(\'/images/help_border/help-right.png\') repeat-y;" valign="bottom"><img src="/images/help_border/help-arrow_reversed.png" style="position:relative;top:-10px;"></td></tr><tr><td><img src="/images/help_border/help-bottom-left.png"></td><td style="background: url(\'/images/help_border/help-bottom.png\');"></td><td><img src="/images/help_border/help-right-bottom.png"></td></tr></table>';
    
	tooltip.c = setTimeout("tooltip.t.style.visibility = 'visible';",0);  
  },

  h: function(e) {
    tooltip.t.style.visibility = "hidden";
    if (tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild);
    clearTimeout(tooltip.c);
    tooltip.g = false;
    tooltip.a(-99,-99);
  },

  l: function(o,e,a) {
    if(o.addEventListener) o.addEventListener(e,a,true);
    else if(o.attachEvent) o.attachEvent("on"+e,a);
    else return null; 
  },

  a: function(x,y) {
	var clientWidth = 
			(document.compatMode=='CSS1Compat' && !window.opera) ? 
			document.documentElement.clientWidth :
			document.body.clientWidth;
    var clientHeight =
    (document.compatMode=='CSS1Compat' && !window.opera) ? 
            document.documentElement.clientHeight :
            document.body.clientHeight;

    var ypos= window.event ? document.body.scrollTop  : self.pageYOffset; 

    var toolheight=5;		
	if (clientWidth-x <= 438)
		tooltip.t.innerHTML = tooltip.reversedTooltipHTML
	else
        tooltip.t.innerHTML = tooltip.tooltipHTML;
	

 
	tooltip.t.style.left = (clientWidth-x > 438) ? (x + 16 + "px") : (x - 434 + "px");
    tooltip.t.style.top  = y+ 8 + "px";
  
  }

}