function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6||this.ie7
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()

m_timer = new Object;

function AJAXNav(url, ElementId, callMessage, errorMessage) {
	window.document.getElementById(ElementId).innerHTML = callMessage;
	try {
		req = new XMLHttpRequest();
		} catch (e) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
				req = false;
				}
			}
		}
	req.onreadystatechange = function() {
		AJAXNav_response(ElementId, errorMessage);
		};
	req.open("GET", url, true);
	req.send(null);
	}

function AJAXNav_response(ElementId, errorMessage) {
	if (req.readyState == 4) {
		if (req.status == 200) {
			document.getElementById(ElementId).innerHTML = req.responseText;
			} else {
			document.getElementById(ElementId).innerHTML = errorMessage;
			}
		}
	}
	
wmtt = null;
wmttx = 20;
wmtty = 20;

function updateWMTT(e) {
	if (wmtt != null) {
		x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
		y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
		if (bw.ie7) {
			x = window.event.clientX + document.documentElement.scrollLeft;
			y = window.event.clientY + document.documentElement.scrollTop;
			}
		wmtt.style.left = (x + wmttx) + "px";
		wmtt.style.top 	= (y + wmtty) + "px";
	}
}

function showWMTT(id, x, y) {
	if (x == null) x = 20;
	if (y == null) y = 20;
	wmttx = x+0;
	wmtty = y+0;
	wmtt = document.getElementById(id);
	wmtt.style.display = "block"
}

function hideWMTT() {
	wmtt.style.display = "none";
}

document.onmousemove = updateWMTT;



function showContextmenu(id, e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	document.getElementById(id).style.position = "absolute";
	document.getElementById(id).style.display = "block";
	document.getElementById(id).style.left = (x - 8) + "px";
	document.getElementById(id).style.top = (y - 8) + "px";
	}

function hoverContextmenu(id) {
	window.clearTimeout(m_timer["Contextmenu"+id]);
	}
	
function leaveContextmenu(id) {
	m_timer["Contextmenu"+id] = window.setTimeout("hideContextmenu('"+id+"');",125);
	}
	
function hideContextmenu(id) {
	document.getElementById(id).style.display = "none";
	}

function getPosition(element) {
	var elem=element,tagname="",x=0,y=0;
	while ((typeof(elem)=="object")&&(typeof(elem.tagName)!="undefined")) {
		y+=elem.offsetTop;
		x+=elem.offsetLeft;
		tagname=elem.tagName.toUpperCase();
		if (tagname=="BODY") elem=0;
		if (typeof(elem)=="object")
			if (typeof(elem.offsetParent)=="object")
				elem=elem.offsetParent;
		}
	position=new Object();
	position.x=x;
	position.y=y;
	return position;
	}
