if(!popupbox){
	var popupbox=new Object();
	popupbox.layer=null;
	popupbox.HTMLtagsTab=new Array("IMG","A");
	popupbox.x=popupbox.y=popupbox.offset=0;

	popupbox.windowonload=window.onload;
	window.onload=function(){
		popupbox.layer=document.getElementById("popupbox");
		document.body.appendChild(popupbox.layer);
		SetPopupbox();
		if(popupbox.windowonload)popupbox.windowonload();
	}

	document.writeln('<div id="popupbox" class="popupbox"'
		+' style="position:absolute;left:0px;top:0px;z-index:999999;visibility:hidden;max-width:400px;min-height:20px;"'
		+'></div>');
	// onload="SetPopupbox(this)";
}

function SetPopupbox(){
	for(var j=0;j<popupbox.HTMLtagsTab.length;j++){// Set MouseOverListeners:
		var tags=document.getElementsByTagName(popupbox.HTMLtagsTab[j].toUpperCase());
		if(tags!=null)for(var i=0;i<tags.length;i++){
			var tag=tags[i];
			var popupboxText=tag.getAttribute("popupbox");
			if(popupboxText!=null&&popupboxText.length>0&&tag.popupbox_text==null){
				tag.popupbox_text=popupboxText;
				if(tag.popupbox_preloaded==null){
					popupboxSetzen(tag.popupbox_text,true);
					tag.popupbox_preloaded=true;
				}
				tag.style.cursor="pointer";
				tag.newOnmouseover=popupboxAnzeigen;
				if(tag.onmouseover==null)
					tag.onmouseover=function(){
						this.newOnmouseover(this);
					}
				else{
					tag.oldOnmouseover=tag.onmouseover;
					tag.onmouseover=function(){
						this.newOnmouseover(this);
						this.oldOnmouseover();
					}
				}
				if(tag.onmouseout==null)
					tag.onmouseout=popupboxVerstecken;
				else{
					tag.oldOnmouseout=tag.onmouseout;
					tag.newOnmouseout=popupboxVerstecken;
					tag.onmouseout=function(){
						this.newOnmouseout();
						this.oldOnmouseout();
	}	}	}	}	}
}


function GetPopupboxPosition(e,p){// ermittelt absolute Koordinaten von e relativ zu p
	var tagname,x=0,y=0;
	while(e&&e!=p&&(typeof(e)=="object")&&(typeof(e.tagName)!="undefined")){
		tagname=e.tagName.toLowerCase();// tag in Klein
		x+=e.offsetLeft;
		y+=e.offsetTop;
		if(typeof(e)=="object")
			if(typeof(e.offsetParent)=="object")
				e=e.offsetParent;
		if(tagname=="body"||tagname=="html")break;//fertig wenn body
	}
	pos=new Object();
	pos.x=x;
	pos.y=y;
	return pos;
}

function popupboxLoeschen(){
	while(popupbox.layer.hasChildNodes())
		popupbox.layer.removeChild(popupbox.layer.lastChild);
}

function popupboxVerstecken(){
	popupbox.layer.style.visibility="hidden";
	popupboxLoeschen();
}

function popupboxAnzeigen(e){
	popupboxLoeschen();
	//e.appendChild(popupbox.layer);
	popupboxSetzen(this.popupbox_text,false);
	popupbox.layer.style.visibility="visible";
	popupbox.tagpos=GetPopupboxPosition(e,popupbox.layer);
	popupboxPositionieren(e.offsetWidth,0);
//offsetWidth offsetHeight
}

function popupboxPositionieren(x,y){
	if(popupbox.layer==null||popupbox.layer.style.visibility=="hidden")
		return;
	if(!popupbox.tagpos)return;
	x+=popupbox.tagpos.x+popupbox.offset;//+13
	y+=popupbox.tagpos.y-5;//-20
	popupbox.layer.style.left=x+"px";
	popupbox.layer.style.top=y+"px";
}

function popupboxSetzen(text,nurPreload){
	var str="";
	var nichtnurBild=false;
	var c,ab,tag,e;

	if(text.substr(0,4).toLowerCase()=="<img"){
		popupbox.layer.style.backgroundColor="transparent";
		popupbox.layer.style.border="none";
		popupbox.layer.style.padding="0 0 0 0";
		popupbox.offset=5;
	}else{
		popupbox.layer.style.backgroundColor="#ffffc0";
		popupbox.layer.style.border="solid gray 1px";
		popupbox.layer.style.padding="0px 4px 2px 5px";
		popupbox.offset=16;
		text='<img src="http://localhost/Include/tab/infoauf.gif" style="padding:0;margin-left:-11px;position:absolute;left:0px;top:5px;z-index:9999;">'
			+text;
	}
	popupbox.layer.innerHTML=text;
}

