// JavaScript Document


getViewportWidth = function() {
	var width = 0;
	if( document.documentElement && document.documentElement.clientWidth ) {
		width = document.documentElement.clientWidth;
	}
	else if( document.body && document.body.clientWidth ) {
		width = document.body.clientWidth;
	}
	else if( window.innerWidth ) {
		width = window.innerWidth - 18;
	}
	return width;
};

getViewportHeight = function() {
	var height = 0;
	if( document.documentElement && document.documentElement.clientHeight ) {
		height = document.documentElement.clientHeight;
		//height = document.body.offsetHeight;
	}
	else if( document.body && document.body.clientHeight ) {
		height = document.body.clientHeight;
	}
	else if( document.innerHeight ) {
		height = document.innerHeight - 18;
	}
	return height;
};


document.onmousemove = mouse;
	
	var x=y=oldx=oldy=0;

	function mouse(e){
		x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
		y = (document.all) ? window.event.y + document.body.scrollTop : e.pageY;
//y=window.event.y;
	}
	

showIt = function(strID,breite,hoehe) {
		//Mausposition
		x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
		y = (document.all) ? window.event.y + document.body.scrollTop : e.pageY;


	if( document.getElementById ) {
		var setX = x;
		var setY = y;

		var div = document.getElementById( strID );
		var divWidth = div.offsetWidth ? div.offsetWidth : div.style.width ? parseInt( div.style.width ) : 0;
		var divHeight = div.offsetHeight ? div.offsetHeight :  div.style.height ? parseInt( div.style.height ) : 0;
		

		// Test if setX + the width of the div is greater than the viewport width.
		// If it is bigger, an adjustment is made.
		if( setX + breite > document.documentElement.offsetWidth ) {
			setX = document.documentElement.scrollLeft - breite;
		}
		
		// Test if setY + the height of the div is greater than the viewport height.
		// If it is bigger, an adjustment is made.
		if( (setY + hoehe) > document.documentElement.offsetHeight ) {
			setY=document.documentElement.offsetHeight - hoehe;
			
		}
		
		setY= document.documentElement.scrollTop +50;
		
		div.style.left = setX;// + "px";
		div.style.top = setY ;//+ "px";

		
		div.style.visibility = "visible";
	}
//	div.moveto(setX+10,setY-30);
};

hideIt = function(strID) {
	if( document.getElementById ) {
		var div = document.getElementById(strID);
		div.style.visibility = "hidden";
		div.style.left = 0 + "px";
		div.style.top = 0 + "px";
	}
};






