var Xmouse, Ymouse;
var hidden = true;
var ttTimeout = 4;
var showDelay = 0.5;
var ttids = 0;
var ttidh = 0;
var ttWidth = 220;
var winWidth = 790;
				
function showTooltip() {
	if (document.getElementById) {
		document.getElementById("s24tooltip").style.visibility="visible";
	} else if (document.all) {
		document.all["s24tooltip"].style.visibility = "visible";
	} else if (document.layers){
		document.layers["s24tooltip"].visibility = "show";
	}
}


function tooltip(message) {
	if(message){
		hidden = false;
		txt = "<table id=tt1 border=4 bordercolorlight=005A7D bordercolor=000040 cellpadding=2 cellspacing=0><tr><td bgcolor='#000022' class='f2c'>" + message + "</td></tr></table>";
 	 	
		if (document.getElementById && !document.all) {
			document.getElementById("s24tooltip").innerHTML = txt;
			ttWidth = document.getElementById("s24tooltip").style.width;
			ttWidth = ttWidth.substring(0,ttWidth.length-2);
			winWidth = document.width;
		} else if (document.layers){
			with (document["s24tooltip"].document){
				open();
				write(txt);
				close();
				ttWidth = document["s24tooltip"].document.width;
				winWidth = document.width;
				//status = winWidth;

			}
		} else {
			document.all["s24tooltip"].innerHTML = txt;
			ttWidth = document.all["tt1"].clientWidth;
			winWidth = document.body.clientWidth;
		}
		//alert(winWidth);
		//alert(ttWidth);
		

/*		if (document.getElementById) {
			document.getElementById("s24tooltip").style.visibility="visible";
		} else if (document.all) {
			document.all["s24tooltip"].style.visibility = "visible";
		} else if (document.layers){
			document.layers["s24tooltip"].visibility = "show";
		}
*/		
		ttids = setTimeout("showTooltip();", showDelay*1000);
		
		//if (suchflag) suchFokus(0);
		showStatus(message);
		if (ttidh) clearTimeout(ttidh);
		if (ttTimeout!=0) ttidh = setTimeout("tooltip();", ttTimeout*1000);
		
	} else {
		hidden = true;
		if (document.getElementById) {
			document.getElementById("s24tooltip").style.visibility="hidden";
		} else if (document.all) {
			document.all["s24tooltip"].style.visibility = "hidden";
		} else if (document.layers){
			document.layers["s24tooltip"].visibility = "hide";
		}
		
		//if (suchflag) suchFokus(1);
		showStatus('');
		clearTimeout(ttids);
		clearTimeout(ttidh);
	}
	//alert('tooltip');
}
// Init handler

function initTThandler() {
	if (document.layers){
		window.captureEvents(Event.MOUSEMOVE);
		window.onMouseMove = MoveHandler;
		//alert('x');
	}
	if (document.all){
		document.onmousemove = MoveHandler;
	}
	if (document.getElementById) {
		document.onmousemove = MoveHandler;
	}
}

function MoveHandler(evnt) {
	if(document.getElementById && !document.all) {
		Xmouse = evnt.pageX + pageXOffset;
		Ymouse = evnt.pageY ;  //+ pageYOffset
	} else if(document.layers){
		Xmouse = evnt.pageX + pageXOffset;
		Ymouse = evnt.pageY ;  //+ pageYOffset
	} else if(document.all) {
		Xmouse = window.event.x + document.body.scrollLeft;
		Ymouse = window.event.y + document.body.scrollTop;
	}
	var itsme = (Xmouse*1)+(ttWidth*1);
	XM = Xmouse+15;
	YM = Ymouse-10;
	if (itsme>=((winWidth*1)-180)) { XM = Xmouse-ttWidth-20; }
	moveLayer("s24tooltip",XM,YM);
}
function moveLayer(Id,x,y){
	if (hidden){
		x = 0; y = -200;
	}
	if (document.getElementById) {
		document.getElementById(Id).style.left=x;
		document.getElementById(Id).style.top=y;
	} else if (document.all){
		document.all[Id].style.left = x;
		document.all[Id].style.top = y;
	} else if (document.layers){
		//eval('document.layers["'+Id+'"].left = x;');
		//eval('document.layers["'+Id+'"].top = y;');
		document.layers["s24tooltip"].left = x;
		document.layers["s24tooltip"].top = y;

	}
}

