<!--

var popupDivName = "popup";
var popupDivWidth = 450;
var offsetFromMouse = [5,15];

if (document.getElementById || document.all){
	document.write('<div id="trueBody" style="position: absolute; visibility: hidden; left: 0px; top: 0px; width: ' + getDocWidth() + 'px; height: ' + getDocHeight() + 'px; z-index: 101"></div>');
	document.write('<div id="' + popupDivName + '" style="position: absolute; visibility: hidden; left: 0px; top: 0px; width: ' + popupDivWidth + 'px; height: 0px; z-index: 102;"></div>');
}

function getDocWidth(){
	return (document.all ? getTrueBody().scrollLeft+getTrueBody().clientWidth-16 : pageXOffset+window.innerWidth-16);
}

function getDocHeight(){
	return (document.all ? Math.min(getTrueBody().scrollHeight, getTrueBody().clientHeight) : Math.min(window.innerHeight));
}

function getTrueBody(){
	return ((!window.opera && document.compatMode && document.compatMode!="BackCompat") || window.opera) ? document.documentElement : document.body;
}

function getDivObj(obj){
	if (document.getElementById){return document.getElementById(obj);}
	else if (document.all){return document.all[obj];}
}

function showDiv(imagename,title,description){
	document.onmousemove = attachDivToMouse;
	popupDivContent = '<div id="popupContent" align="center">';
	if(imagename != ''){popupDivContent += '<img src="' + imagename + '" border="0" />';}
	else{popupDivContent += '		<table><tr><td id="content_header">' + title + '</td></tr><tr><td id="content_text" style="padding-bottom: 10px;">' + description + '</td></tr></table>';}
	popupDivContent += '</div>';
	getDivObj(popupDivName).innerHTML = popupDivContent;
	getDivObj(popupDivName).style.visibility = 'visible';
}

function hideDiv(){
	getDivObj(popupDivName).style.visibility = 'hidden';
	document.onmousemove = '';
	getDivObj(popupDivName).style.left = '-' + (popupDivWidth+20) + 'px';
}

function attachDivToMouse(e){
	var popupDivHeight = document.all ? document.getElementById("popupContent").scrollHeight+16 : document.getElementById("popupContent").scrollHeight+20;
	var xCoord = offsetFromMouse[0];
	var yCoord = offsetFromMouse[1];
	var docWidth = getDocWidth();
	var docHeight = getDocHeight();
	if (typeof e != "undefined"){
		if (docWidth - e.pageX < (popupDivWidth-16)){xCoord = e.pageX - xCoord - popupDivWidth;}
		else {xCoord += e.pageX;}
		if (docHeight - e.pageY < popupDivHeight){yCoord += e.pageY - Math.max(0,(popupDivHeight + e.pageY - docHeight - getTrueBody().scrollTop));}
		else {yCoord += e.pageY;}
	}
	else if (typeof window.event != "undefined"){
		if (docWidth - event.clientX < (popupDivWidth-16)){xCoord = event.clientX + getTrueBody().scrollLeft - xCoord - popupDivWidth;}
		else {xCoord += getTrueBody().scrollLeft+event.clientX}
		if (docHeight - event.clientY < popupDivHeight){yCoord += event.clientY + getTrueBody().scrollTop - Math.max(0,(popupDivHeight + event.clientY - docHeight));}
		else {yCoord += getTrueBody().scrollTop + event.clientY;}
	}
	if (yCoord < 0){yCoord = yCoord * -1;}
	getDivObj(popupDivName).style.left = xCoord+"px";
	getDivObj(popupDivName).style.top = yCoord+"px";
}

window.onload = function(){
	var imgs = document.getElementsBySelector('table.klinikbilder td.thumb img');
	for(var i = 0; i < imgs.length; i++){
		imgs[i].newsrc = imgs[i].src.replace("_thumb.jpg", ".jpg");
		imgs[i].onmouseover = function(){
			showDiv(this.newsrc,'','');
		}
		imgs[i].onmouseout = function(){
			hideDiv();
		}
	}
}
//-->
