var tmpFrame = null;

document.onmousemove = positionToolTip;

function positionToolTip(e) {
	if (tmpFrame != null) {
	
		// Fensterbreite und -höhe ermitteln
		var winWidth=0, winHeight=0;
		if (window.innerWidth) {
			winWidth=window.innerWidth;
			winHeight=window.innerHeight;
		} else {
			if (window.document.documentElement && window.document.documentElement.clientWidth) {
				winWidth=window.document.documentElement.clientWidth;
				winHeight=window.document.documentElement.clientHeight;
			} else {
				winWidth=window.document.body.offsetWidth;
				winHeight=window.document.body.offsetHeight;
			}
		}
	
		// Scrollposition ermitteln
		var scrollX=0, scrollY=0;
		if(typeof(window.pageYOffset) == 'number') {
			// Netscape
			scrollX=window.pageXOffset;
			scrollY=window.pageYOffset;
		} else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
			// DOM
			scrollX=document.body.scrollLeft;
			scrollY=document.body.scrollTop;
		} else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
			// IE
			scrollX=document.documentElement.scrollLeft;
			scrollY=document.documentElement.scrollTop;
		}
	
		// Maus-Position
		var mouseX=0, mouseY=0;
		if(document.all) {
			mouseX=window.event.x + document.body.scrollLeft;
			mouseY=window.event.y + document.body.scrollTop;
		} else {
			mouseX=e.pageX;
			mouseY=e.pageY;
		}
		
		// Objectbreite und -höhe ermitteln
		var objWidth=0, objHeight=0;
		if(document.all) {
			objWidth=tmpFrame.clientWidth;
			objHeight=tmpFrame.clientHeight;
		} else {
			objWidth=tmpFrame.offsetWidth;
			objHeight=tmpFrame.offsetHeight;
		}
	
		if((mouseX+objWidth)>(scrollX+winWidth-40)) objX=mouseX-objWidth-10; else objX=mouseX+10;
//		if((objX-10)<scrollX) objX=scrollX+10;
		if((mouseY+(objHeight/2))>(scrollY+winHeight-10)) objY=scrollY+winHeight-objHeight-10; else objY=mouseY-(objHeight/2);
		if((objY-10)<scrollY) objY=scrollY+10;
		
		tmpFrame.style.left = objX + "px";
		tmpFrame.style.top 	= objY + "px";
	}
}

function showTempFrame(id, img_path, img_title, img_caption) {
	tmpFrame = document.getElementById(id);
	tmpFrame.innerHTML="<table cellspacing='0' cellpadding='0'><tr><td width='100%' class='mediawin_head'>" + img_title + "</td></tr><tr><td width='100%' class='mediawin_image'><img src='" + img_path + "' class='img'></td></tr><tr><td width='100%' class='mediawin_bottom'>" + img_caption + "</td></tr></table>";
	tmpFrame.style.display = "block";
}


function hideTempFrame() {
	tmpFrame.style.display = "none";
}






function switchImage(name, src) {
  if(document.images) {
    if(src!="none") document.images[name].src=src;
  }
}


