 
 //the visible popup
 var popup=null;
 
 //the highlighted link
 var highlight=null;

 function getLeft(element){
 	var left=element.offsetLeft;
	var parent=element.offsetParent;
	while (parent) {
		left+=parent.offsetLeft;
	 	parent=parent.offsetParent; 
	}
	return left;
 }

 function getTop(element){
 	var top=element.offsetTop;
	var parent=element.offsetParent;
	while (parent) {
		top+=parent.offsetTop;
	 	parent=parent.offsetParent; 
	}
	return top;
 }

 //shows the popup with the specified id
 //the popup is placed directly over the element that fired the event
 function show_popup(popupid){
 	popup=eval('document.all.'+popupid);
 	var left=getLeft(window.event.srcElement);
 	// alert (left + " - " + popup.offsetWidth);
 	if (left + popup.offsetWidth > document.body.clientWidth) 
 	    left = left - popup.offsetWidth + window.event.srcElement.offsetWidth + 5;  // +5 looks better
  	popup.style.left = left;
  	popup.style.top = getTop(window.event.srcElement) + window.event.srcElement.offsetHeight;
  	popup.style.visibility='visible';
  	popup.style.filter='alpha(opacity=80, finishopacity=80, style=1)';
 }
 
 //hides the specified popup
 //checks if the mousepointer is outside the popup, does not always work!
 function hide_popup(popupid){
 	var p=eval('document.all.'+popupid);
 	var mx=window.event.x+document.body.scrollLeft;
 	var my=window.event.y+document.body.scrollTop;
 	
 	if((mx<=p.offsetLeft) || (mx>(p.offsetLeft+p.offsetWidth)) ||
 	   (my<=p.offsetTop) || (my>(p.offsetTop+p.offsetHeight))){
    	if(popup)
 			popup.style.visibility='hidden'; 	
 		p.style.visibility='hidden';
 		popup=p;
 	}
 	
 }
 
 //highlights the specified span
 function over(spanid){
 	s=eval('document.all.'+spanid);
 	if(highlight && s!=highlight)
 		highlight.style.backgroundColor="#F5F3F1";
 	s.style.backgroundColor="#B6BDD2";
 	highlight=s;
 }

 //de-highlights the specified span
 function out(spanid){
 	s=eval('document.all.'+spanid);
   s.style.backgroundColor="#F5F3F1";
 	highlight=null;
 }
 

	function beginpopup(popupid, title, location){
	
		document.write('<span onmouseover="show_popup(\''+popupid+'\');"><a href="'+location+'" class="top">'+title+'</a></span>');
	
		document.write('<span id="'+popupid+'" style="position:absolute; color:#F5F3F1; visibility:hidden; min-width=100px; max-width:400px; overflow:hidden;" onmouseout="hide_popup(\''+popupid+'\');">');
		document.write('<table border=0 cellpadding=0 cellspacing=0>');
		//document.write('<tr><td><a class="top" href="'+location+'" width="20%">'+title+'</a></td></tr>');
		document.write('<tr><td><table border=0 cellpadding=0 cellspacing=0>');
		document.write('<tr><td colspan=2 height=2 width=2><img src="http://_servlink.scone.de/res/p_ol.gif" height=2 width=2></td>');
		document.write('<td height=2><img src="http://_servlink.scone.de/res/p_o.gif" height=2 width="100%"></td>');
    	document.write('<td colspan=2 height=2 width=2><img src="http://_servlink.scone.de/res/p_or.gif" height=2 width=2></td>');
 
		document.write('<tr><td width=1 bgcolor=#D4D0C2><img src="" width=1 height=1></td>');
    	document.write('<td width=1 bgcolor=white><img src="" width=1 height=1></td>');
    	document.write('<td><table border=0 cellpadding=0 cellspacing=0>');
	}

	function choice(name, type, title, location){
		document.write('<tr><td bgcolor="#F5F3F1"><span id="'+name+'" style="width:100%" onclick="window.location.href=\''+location+'\';"');
		document.write(' onmouseover=\'document.all.'+name+'.style.backgroundColor="#B6BDD2";\'');
		document.write(' onmouseout=\'document.all.'+name+'.style.backgroundColor="#F5F3F1";\'>');
		document.write('<nobr><a class="pop" href="'+location+'" >&nbsp;'+type+': '+title+'</a>&nbsp;</nobr></span></td></tr>');
	}
	
	function endpopup(){
		document.write('</table></td><td width=1 bgcolor=#D2C8BE><img src="" width=1 height=1></td>');
		document.write('<td width=1 bgcolor=#957E67><img src="" width=1 height=1></td></tr>');
		document.write('<tr><td colspan=2 height=2 width=2><img src="http://_servlink.scone.de/res/p_ul.gif" height=2 width=2></td>');
    	document.write('<td height=2><img src="http://_servlink.scone.de/res/p_u.gif" height=2 width="100%"></td>');
    	document.write('<td colspan=2 height=2 width=2><img src="http://_servlink.scone.de/res/p_ur.gif" height=2 width=2></td></tr>');
    	document.write('</table></td></tr></table></span> ');
	}