function toggleVisibility(id) {
	var visibility = document.getElementById(id).style.visibility;
	if (visibility == "hidden") {
		document.getElementById(id).style.visibility = "inherit";
		document.getElementById(id).style.position = "inherit";
		document.getElementById(id).parentNode.parentNode.setAttribute('class','opened');
	} else {
		document.getElementById(id).style.visibility = "hidden";
		document.getElementById(id).style.position = "absolute";
		document.getElementById(id).parentNode.parentNode.setAttribute('class','collapsed');
	}
}

function getQueryVariable(variable) { 
	var query = window.location.search.substring(1); 
	var vars = query.split("&"); 
	for (var i=0;i<vars.length;i++) { 
		var pair = vars[i].split("="); 
		if (pair[0] == variable) { 
			return pair[1]; 
		} 
	} 
	return null
} 

function show(id, e) {
	document.getElementById(id).style.visibility = "visible";
	document.getElementById(id).style.position = "absolute";
	var xy = getMouseXY(e);
	document.getElementById(id).style.left = xy[0] + "px";
	document.getElementById(id).style.top = xy[1] + "px";
	
}

function hide(id) {
	document.getElementById(id).style.visibility = "hidden";
	document.getElementById(id).style.position = "absolute";
}

function getMouseXY(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)         {
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)        {
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	return new Array(posx, posy);
}
