﻿var IE = document.all?true:false;
document.onmousemove = getMouseXY;
var thisX;
var thisY;
var zindex = 200;

function getMouseXY(e) {

	window.lastX=thisX;
	window.lastY=thisY;

	if (IE) {
		window.thisX = event.clientX + document.body.scrollLeft;
		window.thisY = event.clientY + document.body.scrollTop;
	} else {
		window.thisX = e.pageX;
		window.thisY = e.pageY;
	}

	if ( window.thisX < 0){ window.thisX = 0;}
	if ( window.thisY < 0){ window.thisY = 0;}

}

function offsetWidth_perso(obj) {
	return obj.offsetWidth;
}

function offsetHeight_perso(obj) {
	return obj.offsetHeight;
}

function showTip(iden){
	zindex++;
	obj = document.getElementById(iden);

	if ( obj ) {

		var thiswidth = obj.style.width;
		if ( thiswidth === '' )	{
			thiswidth = offsetWidth_perso(obj);
		}
		var thisheight = obj.style.height;
		if ( thisheight === '' ) {
			thisheight = offsetHeight_perso(obj);
		}
	
		var window_width = '';
		var window_height = '';
	
		if ( window.innerWidth )
		{
			window_width = window.innerWidth;
			window_height = window.innerHeight;
		}
		else if (document.body && document.body.offsetWidth)
		{
			window_width = document.body.offsetWidth;
			window_height = document.body.offsetHeight;
		}
		else
		{
			window_width = documentBodyOffsetWidth();
			window_height = documentBodyOffsetHeight();
		}
	
		XX = ( ( thisX + thiswidth ) > window_width - 25) ? thisX - thiswidth - 5 : thisX + 5;
		YY = ( ( thisY + thisheight ) > window_height - 25) ? thisY - thisheight - 5 : thisY + 15;
	
		obj.style.left = XX+"px";
		obj.style.top = YY+"px";
		obj.style.zIndex = zindex;
		obj.style.visibility = "visible";

	}

}

function hideTip(iden){
	var obj = document.getElementById(iden);
	if ( obj ) {
		obj.style.visibility = "hidden";
	}
}

function infobull(id_info,text_info,titre_info,link_info) {
	zindex++;

        var w_target = document.getElementById('p_body');
        var elem = document.createElement('div');
        var txt = document.createTextNode('');
        elem.appendChild(txt);

        elem.id = id_info;
	w_target.appendChild(elem);

	var itext = '  <table border="0" cellpadding="0" cellspacing="0">'
	+ '    <tr><td nowrap="nowrap"><p class="infobullcontent">' + text_info + '</p></td></tr>'
	+ '  </table>';

        obj = document.getElementById(id_info);
        obj.innerHTML = itext;
	obj.style.visibility = "hidden";
	obj.className = "infobull";
	obj.style.zIndex = zindex;

	return true;
}

function showabout() {

	document.getElementById('about').style.visibility = 'visible';
	document.getElementById('button_about').onmouseover = '';

}

function init() {

	infobull('infoabout', labout,'','');
	infobull('join_infernal', ljinfernal,'','');
	infobull('join_skeleton', ljskeleton,'','');

}

function showmenu(ident) {

	clearTimeout(window['menutimeout'+ident]);
	obj = document.getElementById(ident);
	obj.style.visibility = 'visible';
	obj.style.display = '';

}

function hidemenu(ident) {

	window['menutimeout'+ident] = setTimeout("hidemenu_timout('"+ident+"')", 10 );

}

function hidemenu_timout(ident) {
	obj = document.getElementById(ident);
	obj.style.visibility = 'hidden';
	obj.style.display = 'none';
}

