var IE4 = (document.all && !document.getElementById) ? true : false;
var IE5 = (document.all && document.getElementById) ? true : false;
var IE = (document.all) ? true : false;

var NS4 = (document.layers) ? true : false;
var NS6 = (document.getElementById && !document.all) ? true : false;
var NS = (NS4 || NS6) ? true : false;

var first = true;
var infolayer = null;

function init_infolayer() {
	first = false;
	if ( IE5 || NS6 ) {
		infolayer = document.createElement("DIV");
		document.body.appendChild(infolayer);
		infolayer.id = "infoLayer";
		infolayer.style.cssText = "position:absolute;visibility:hidden;top:200;left:200;";
	} else if ( NS4 ) {
		infolayer = new Layer(250);
	}
}


function showInfo( e, text ) {
	if ( first ) init_infolayer();
	if ( text == "" ) return;
	if ( !infolayer ) return;
	text = "<div CLASS='info'  style='z-index:50'><table cellspacing=0 cellpadding=2 border=1 bgcolor=#FFFFFF bordercolor=#0066CC width=300 style= filter:Alpha(opacity=95, style=position: relative; z-index: 20)><tr><td class=text_11>" + text + "</td></tr></table></DIV>"
	setLayerText(infolayer.id, text);

	showLayer(infolayer.id);
}


function showInfo1( e, text ) {
	if ( first ) init_infolayer();
	if ( text == "" ) return;
	if ( !infolayer ) return;
	text = "<div CLASS='info'  style='z-index:50' style='position: relative; left: 300' ><table cellspacing=0 cellpadding=2 border=1 bgcolor=#FFFFFF bordercolor=#0066CC width=300 style= filter:Alpha(opacity=95, style=position: relative; z-index: 20)><tr><td class=text_admin_m>" + text + "</td></tr></table></DIV>"
	setLayerText(infolayer.id, text);

	showLayer(infolayer.id);
}


function showInfo3( e, text ) {
	if ( first ) init_infolayer();
	if ( text == "" ) return;
	if ( !infolayer ) return;
	text = "<table cellspacing=0 cellpadding=2 border=1 bgcolor=#F4C972 bordercolor=#0066CC width=300 style= filter:Alpha(opacity=95, style=position: relative; z-index: 6000)><tr><td class=minitext_black>" + text + "</td></tr></table>"
	setLayerText(infolayer.id, text);
	moveInfo(e);
	showLayer(infolayer.id);
}
function showInfo2( e, text ) {
	if ( first ) init_infolayer();
	if ( text == "" ) return;
	if ( !infolayer ) return;
	text = "<table cellspacing=0 cellpadding=2 border=1 bgcolor=#FF9933 bordercolor=black width=100><tr><td class=anvisn><img src='http://WWW.hallof.nu/~vof/images/trans.gif' width=100 height=1><br>" + text + "</td></tr></table>"
	setLayerText(infolayer.id, text);
	moveInfo(e);
	showLayer(infolayer.id);
}

function moveInfo(e) {
	if ( !infolayer ) return;

	var width = getLayerContentWidth(infolayer.id);
	var height = getLayerContentHeight(infolayer.id);
	
	if ( IE || NS6 ) {
		x = e.clientX + document.body.scrollLeft - width - -40;
		if ( e.y < (height+10) )
			y = e.clientY + document.body.scrollTop - -55;
		else
			y = e.clientY + document.body.scrollTop - height - 0;
	} else {
		x = e.x - width - 10;
		y = e.y - height;
	}
	
	moveLayerTo( infolayer.id, x, y );
}

function hideInfo() {
	if ( !infolayer ) return;
	hideLayer(infolayer.id);
}

function setLayerText(id, text) {
	obj = findObj(id);
	if ( !obj ) return;
	if (NS4) { 
		obj.document.open();
		obj.document.write(text);
		obj.document.close();
	}
	else obj.innerHTML = text;
}

function showLayer(id) {
	obj = findObj(id);
	if ( !obj ) return;
	if (obj.style) obj.style.visibility = "visible";
	else obj.visibility = "show";
}

function hideLayer(id) {
	obj = findObj(id);
	if ( !obj ) return;
	if (obj.style) obj.style.visibility = "hidden";
	else obj.visibility = "hide";
}

function moveLayerTo(id, x, y) {
	obj = findObj( id );
	if ( !obj ) return;
	if ( obj.style ) obj = obj.style;
	obj.top = y;
	obj.left = x;
}

function getLayerContentWidth(id) {
	obj = findObj( id );
	if ( !obj ) return 0;

	if ( NS4 ) return obj.document.width;
	else if (NS6) return ( (this.contentWidth) ? this.contentWidth : obj.offsetWidth );
	else if (IE) return parseInt(obj.scrollWidth);
	else return 0;
}

function getLayerContentHeight(id) {
	obj = findObj( id );
	if ( !obj ) return 0;

	if ( NS4 ) return obj.document.height;
	else if (NS6) return ( (this.contentHeight) ? this.contentHeight : obj.offsetHeight );
	else if (IE) return parseInt(obj.scrollHeight);
	else return 0;
}

function findObj( id ) {
	obj = null;
	if ( document.getElementById ) obj = document.getElementById( id );
	else if ( document.all ) obj = document.all[ id ];
	else if ( document.layers )	obj = document.layers[ id ];

	return obj;
}
