/* $Id: autopopup.js,v 1.3 2009/07/20 20:13:48 zkonyves Exp $ */
include('http://helpmeister.bizware.com/js/showtooltip.js');
var links = document.getElementsByTagName('A');

if (!document.getElementById('TipBox')) {
document.write('<span id="TipBox" style="display: none; position: absolute; font-size: 11px; font-family: tahoma; border: #000 solid 1px; padding: 2px; color: #000; background-color: #FFFFE0; width: 150px; text-align: left;"></span>');
}

for (var i=0; i<links.length; i++) { 
  if(links[i].target == "helpmeister") {
	  if(links[i].attachEvent) { 
		var l_href = links[i].href;
		var l_width = links[i].offsetWidth;
		var l_height = links[i].offsetHeight;
		  //links[i].attachEvent("onmouseover",function(){popup_ie(l_href, l_width, l_height)});
		  //links[i].attachEvent("onmouseout",function(){HideTip()});
		  links[i].onmouseover = function(){popup_ff(this)};
		  links[i].onmouseout = function(){HideTip()};
		  links[i].title = "";
	  } else {  
		  links[i].addEventListener("mouseover",function(){popup_ff(this)},false);
		  links[i].addEventListener("mouseout",function(){HideTip()},false);
		  links[i].title = "";
	  }
  }
} 

var callX = 0;
var callY = 0;
var callWidth = 0;
var callHeight = 0;

function popup_ie(link_href, owidth, oheight)
{ 
	callX = mouseX;
	callY = mouseY;
	callWidth = owidth;
	callHeight = oheight;
  var this_link = event.srcElement;
  var this_href = link_href;
  if (this_href) {
  var index_of = this_href.indexOf("?");
  var hmid = this_href.substr(index_of+1); 
  ShowToolTip(this_link,hmid);
  }
}

function popup_ff(evt)
{ 
	callX = mouseX;
	callY = mouseY;
	callWidth = evt.offsetWidth;
	callHeight = evt.offsetHeight;
  var this_link = evt;
  var this_href = this_link.href;
  var index_of = this_href.indexOf("?");
  var hmid = this_href.substr(index_of+1);
  ShowToolTip(this_link,hmid);
}

function include(filename)
{
	var head = document.getElementsByTagName('head')[0];
	
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';
	
	head.appendChild(script)
}







// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false;

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE);

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var mouseX = 0;
var mouseY = 0;

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    mouseX = event.clientX + document.body.scrollLeft;
    mouseY = event.clientY + document.body.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    mouseX = e.pageX;
    mouseY = e.pageY;
  }  
  // catch possible negative values in NS4
  if (mouseX < 0){mouseX = 0}
  if (mouseY < 0){mouseY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  //document.Show.MouseX.value = mouseX;
  //document.Show.MouseY.value = mouseY;
  return true;
}


