// START EGNA INSTÄLLNINGAR

var textColor = "#000000";
var textFont = "arial";
var textSize = "11";

var backgroundColor = "#F9F7F5";
var borderColor = "#333333";


var marginWidth = 5;
var borderWidth = 2;  // 0 för att dölja
var popupWidth = 200;
var offsetX = 5;
var offsetY = 30;

var doneLoading = false;
var statusText = "";


// SLUT EGNA INSTÄLLNINGAR


var overDiv, overDivBG, mouseX, mouseY, statusText;
var isActive = 0;

function viewText(text) {


if(doneLoading) {

	document.onmousemove = moveText;
	isActive = 1;
	overDiv.innerHTML = createTable(text);
	overDiv.style.visibility ="visible";




}
return true;
}

function hideText() {

	// document.onmousemove = null;
	if(doneLoading) {
	isActive = 0;
	overDiv.style.visibility = "hidden";

	overDiv.style.left = - popupWidth;
	window.status = "";
	}
}

function initText() {

	overDiv = document.getElementById("overDiv");

	overDiv.style.left = - popupWidth;
	doneLoading = true;

}

function moveText(e) {

	if (!e) var e = window.event;


	var mouseX = e.clientX + document.body.scrollLeft;
	var mouseY = e.clientY + document.body.scrollTop;
	var boxX, boxY;


	if(isActive && doneLoading && !isLoading) {


	boxX = Math.max(0,mouseX + offsetX - popupWidth/2);
	boxX = Math.min(boxX,document.body.clientWidth-popupWidth);


	boxY = Math.max(0,mouseY + offsetY);

	if((boxY + overDiv.offsetHeight) > (document.body.clientHeight + document.body.scrollTop))
	{
		boxY = mouseY - overDiv.offsetHeight - 20;
	}

	overDiv.style.top = boxY + "px";
	overDiv.style.left = boxX + "px";


	}
	return true;
}

function createTable(text) {

	textSpan = "<span style=\"font: "+textSize+"px "+textFont+"; color: "+textColor+";\">"+text+"</span>";

	return "<TABLE STYLE=\"border: "+borderWidth+"px solid "+borderColor+";	\" WIDTH="+popupWidth+" CELLPADDING="+marginWidth+" CELLSPACING=0 BGCOLOR=\""+backgroundColor+"\"><TR><TD>"+textSpan+"</TD></TR></TABLE>"

}
