

var curid = "";
function showmenu(id) {
	if(curid == "") { curid = id; }
	if(curid != id) {
		clearTimeout(this.outtime);
		document.getElementById(curid).style.display = "none";
	}
	curid = id;
	document.getElementById(id).style.display = "block";
	clearTimeout(this.outtime);
}
function hidemenu(id) {
	time = 250;
	this.outtime = setTimeout("document.getElementById('" + id + "').style.display = 'none'", time);
}

xMouse = 0;
yMouse = 0;

document.onmousemove = getMouse;

function bubbleUser(user) {

	theBubble = document.getElementById('divbubbleuser');

	if(user) {

		theBubble.innerHTML = "<div style='margin: 3px;'><img src='bubble.php?user=" + user + "'></div>";
		theBubble.style.position = "absolute";
		theBubble.style.left = xMouse-10 + "px";
		theBubble.style.top = yMouse-55 + "px";
		theBubble.style.width = "100px";
		theBubble.style.height = "50px";
		theBubble.style.background = "url(../images/bubble.gif) repeat-x top left";
		theBubble.style.display = "block";

	}
	else {

		theBubble.style.display = "none";
		theBubble.style.width = "0px";
		theBubble.style.height= "0px";
		theBubble.style.background = "";
		theBubble.innerHTML = "";

	}

}

function bubbleInfo(topic, info) {

	theBubble = document.getElementById('divbubbleinfo');

	if(topic && info) {

		theBubble.innerHTML = "<table width='200' cellpadding='0' cellspacing='0' style='border: 1px solid #000000;'><tr><td bgcolor='#40beff' height='16'><b>" + topic + "</b></td></tr><tr><td bgcolor='#ffffff'><div style='margin: 3px;'><font size='1'>" + info + "</font></div></td></tr></table>";
		theBubble.style.position = "absolute";
		theBubble.style.left = xMouse-1 + "px";
		theBubble.style.top = yMouse-1 + "px";
		theBubble.style.width = "200px";
		theBubble.style.display = "block";

	}
	else {

		theBubble.style.display = "none";
		theBubble.style.width = "0px";
		theBubble.style.height= "0px";
		theBubble.style.background = "";
		theBubble.innerHTML = "";

	}

}

function moveBubble(type) {

	if(type == "Info") {

		theBubbleInfo = document.getElementById('divbubbleinfo');

		if(theBubbleInfo.style.display == "block") {

			theBubbleInfo.style.position = "absolute";
			theBubbleInfo.style.left = xMouse+10 + "px";
			theBubbleInfo.style.top = yMouse+10 + "px";

		}

	}

	if(type == "User") {

		theBubbleUser = document.getElementById('divbubbleuser');

		if(theBubbleUser.style.display == "block") {

			theBubbleUser.style.position = "absolute";
			theBubbleUser.style.left = xMouse-10 + "px";
			theBubbleUser.style.top = yMouse-55 + "px";

		}

	}

}

function getMouse(e) {

	e = e || window.event;

	if(e.pageX || e.pageY) {

		xMouse = e.pageX;
		yMouse = e.pageY;

	}
	else {

		de = document.documentElement;
		b = document.body;

		xMouse = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
		yMouse = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);

	}

}

function check_login() {

	var errm = '';

	if(document.login.username.value.length==0)
		errm = errm + '- Du måste ange ditt användarnamn!\n';

	if(document.login.password.value.length==0)
		errm = errm + '- Du måste ange ditt lösenord!\n';

	if(errm.length!=0){
		alert('Fel:\n\n' + errm + ' ');
		return false;
	}

}