
// Config:
var ballonBack = "lightyellow";  
var ballonText = "#000000"; 
var ballonBreite = 130;     
var ballonBorder = 1;      
var ballonFont = "Arial";
var ballonDir = 0;         
var ballonVDir = 0;        
var ballonChangeVDir = 65; 
			      
var ballonSpace = 10;
var ballonShow = false;

var Ballon = null;     
var b_Breite;          
var b_Dir, b_VDir;

//setting the tooltip background color
function setBallon(id, breite, bgcolor) {
		
	document.onmousemove = cursorMove;
	
	if (breite && breite>20) b_Breite = breite;
	if (bgcolor) ballonBack = bgcolor;
	Ballon = crossGetObject(id);
	if (Ballon == null) {
		
		showBallon = noBallon; hideBallon = noBallon;
	}
	ballonShow = false;
}
function noBallon() {} 
document.write('<meta name="scripts" content="">');

//showing the tooltip
function showBallon(msg, dir, breite, bgcolor) {
	var b_Back;
	var relWidth, relHeight;

	if (Ballon == null) return;
	if (breite && breite>20) b_Breite = breite;
	else b_Breite=ballonBreite;
	if (bgcolor) b_Back=bgcolor;
	else b_Back=ballonBack;
	msg = '<table width=' + b_Breite + ' border=0 cellpadding=' + ballonBorder + ' cellspacing=0 bgcolor=\"' + ballonText + '\"><tr><td><table width=100% border=0 cellpadding=3 cellspacing=0 bgcolor=\"' + b_Back + '\"><tr><td><font face=\"'  + ballonFont + '\" color=\"' + ballonText + '\" size=-1>' + msg + '</font></td></tr></table></td></tr></table>';
	if (!dir) b_Dir = ballonDir;
	else b_Dir = dir;
	relWidth = crossInnerWindowWidth() + crossGetScroll("x");
	relHeight = crossInnerWindowHeight() + crossGetScroll("y");
	if (crossMouseX + b_Breite + ballonSpace > relWidth) 
		{b_Dir = 1;}
	else if (crossMouseX < b_Breite + ballonSpace) b_Dir = 0;
	b_VDir = ballonVDir;
	if (crossMouseY + ballonChangeVDir > relHeight) b_VDir = 1;
	else if (crossMouseY - ballonChangeVDir < 0) b_VDir = 0;
	crossWrite(Ballon, msg);
	ballonShow = true;
	crossShowObject(Ballon);
}
//hiding the tooltip
function hideBallon() {
	if (Ballon == null) return;
	crossHideObject(Ballon);
	ballonShow=false;
	crossMoveTo(Ballon, -200, 0);
}

//finding the position of the mouse
function cursorMove(e) {
	var posX, posY;
	
	crossMousePosition(e);

	if (ballonShow) {
		
		if (b_Dir==0) {
			posX = crossMouseX + ballonSpace; 
			if (b_VDir==0) {posY = crossMouseY + ballonSpace;}
			else {posY = crossMouseY - ballonChangeVDir;}
		}
		else {
			posX = crossMouseX-b_Breite-ballonSpace;
			if (b_VDir==0) {posY = crossMouseY + ballonSpace;}
			else {posY = crossMouseY - ballonChangeVDir;}
		}
		crossMoveTo(Ballon, posX, posY)
	}
}
