
/* ******************************************************************
	   TOOLTIPS 1.03 (c)2001-2002 Peter Kerl
	             www.peterkerl.de
****************************************************************** */


// integriert: Crossbrowser-Funktionen von "cross.js"

// Config:
var balloonBack = "#00ff77";  // Hintergrundfarbe
var balloonText = "#000000";  // Text und Randfarbe
var balloonBreite = 200;        // Balloon-Breite (Vorgabewert)
var balloonBorder = 1;      // Randstaerke
var balloonFont = "verdana";
var balloonDir = 0;         // Ausrichtung; 0=rechts 1=links
var balloonVDir = 1;        // Ausrichtung; 0=unten 1=oberhalb
var balloonChangeVDir = 5;    // Schwellwert fuer Wechsel der 
			      // V-Ausrichtung am unteren Rand
var balloonSpace = 10;        // Abstand vom Cursor
var balloonShow = false; // Anzeige aktiv/inaktiv

var Balloon = null;        // das DIV-Objekt
var b_Breite;             // aktueller Speicher fuer Balloonbreite
var b_Dir, b_VDir;

// Balloon-Objekt (div) festlegen
function setBalloon(id, breite, bgcolor) {
		
	document.onmousemove = cursorMove;
	
	if (breite && breite>20) b_Breite = breite;
	if (bgcolor) balloonBack = bgcolor;
	Balloon = crossGetObject(id);
	if (Balloon == null) {
//		alert("keine Unterstuetzung fuer Balloon-Infos");
		showBalloon = noBalloon; hideBalloon = noBalloon;
	}
	balloonShow = false;
}
function noBalloon() {} // functionsaufrufe abfangen
document.write('<meta name="scripts" content="TOOLTIPS 1.03 (c)2001-2002 Peter Kerl [www.peterkerl.de]">');

function test()
{
	alert("test");
	window.status = "ich bin drin...";
}
// Balloon kreieren und anzeigen
function showBalloon(msg, dir, breite, bgcolor) {
	var b_Back;
	var relWidth, relHeight;

	if (Balloon == null) return;
	if (msg=='') return;
	if (breite && breite>20) b_Breite = breite;
	else b_Breite=balloonBreite;
	if (bgcolor) b_Back=bgcolor;
	else b_Back=balloonBack;
	msg = '<table width=' + b_Breite + ' border=0 cellpadding=' + balloonBorder + ' cellspacing=0 bgcolor=\"' + balloonText + '\"><tr><td><table width=100% border=0 cellpadding=3 cellspacing=0 bgcolor=\"' + b_Back + '\"><tr><td><font size="1" face=\"'  + balloonFont + '\" color=\"' + balloonText + '\" size=-1>' + msg + '</font></td></tr></table></td></tr></table>';
	if (!dir) b_Dir = balloonDir;
	else b_Dir = dir;
	relWidth = crossInnerWindowWidth() + crossGetScroll("x");
	relHeight = crossInnerWindowHeight() + crossGetScroll("y");
	if (crossMouseX + b_Breite + balloonSpace > relWidth) 
		{b_Dir = 1;}
	else if (crossMouseX < b_Breite + balloonSpace) b_Dir = 0;
	b_VDir = balloonVDir;
	if (crossMouseY + balloonChangeVDir > relHeight) b_VDir = 1;
	else if (crossMouseY - balloonChangeVDir < 0) b_VDir = 0;
	crossWrite(Balloon, msg);
	balloonShow = true;
	crossShowObject(Balloon);
}

function hideBalloon() {
	if (Balloon == null) return;
	crossHideObject(Balloon);
	balloonShow=false;
	crossMoveTo(Balloon, -200, 0);
}

// der Maus folgen
function cursorMove(e) {
	var posX, posY;
	
	crossMousePosition(e);

	if (balloonShow) {
		
		if (b_Dir==0) {
			posX = crossMouseX + balloonSpace; 
			if (b_VDir==0) {posY = crossMouseY + balloonSpace;}
			else {posY = crossMouseY - balloonChangeVDir;}
		}
		else {
			posX = crossMouseX-b_Breite-balloonSpace;
			if (b_VDir==0) {posY = crossMouseY + balloonSpace;}
			else {posY = crossMouseY - balloonChangeVDir;}
		}
		crossMoveTo(Balloon, posX, posY)
	}
}
