//this function loads the contents of a weblink into id=plusbox and a link into id=msgline (link is not executed if coded: onclick='return ap(this);')
//url of link is modified by adding kopf=0 and js variable js2url

function ap(obj,opttext){
var title="";
var url="";
if(typeof obj=="string") url=obj;
else {
 title=obj.title;
 if(obj.innerHTML.length>5)title = obj.innerHTML+title;//termine haben nur den rest im titel
 url=obj.href;
}
if(typeof opttext=="string") title=opttext;
if(title=="" && typeof aptitle=="string") title=aptitle;

var plusbox =document.getElementById('plusbox');
if (url.indexOf('?')>0)url+='&kopf=0'; else url+='?kopf=0';
if(typeof js2url == "string")url+='&'+js2url;
//alert('js2url='+js2url+typeof js2url);
plusbox.innerHTML="<a name=plpusbox></a>"
+"<div width=90% style='background-image:url(/img/wallpapermedium.jpg);'  >"
+"<a href='javascript:removeplusbox();' title='ausblenden' style='text-decoration:none;'> &darr; &darr; &darr; </a> "
+title
+"</div>"

+"<iframe class=plusboxiframe src='"+url+"'></iframe>";

//+"<div style='background-color:green;'><a href='javascript:removeplusbox(this);' style='background-color:red;float:right;'>X</a></div>"
//plusbox.focus();

var msgline=document.getElementById('msgline');

if(title.length>30)title=title.substr(0,29)+'..';
msgline.innerHTML="<a class=navopt href='#plusbox'>"+title+"</a> &nbsp; <span style='width:100%;text-align:right;'><a class=navopt target=branchenbuch href='"+url+"'>In neuem Fenter öffnen</a></span>";

//now move this div upwards
plusbox.style.position="absolute";

plusbox.style.zIndex=999;
plusbox.style.className="plusboxup";
//if({$isIE})plusbox.style.border='1px'; else plusbox.style.border='1px solid grey';
//alert("duppy apt called");return false;

plusbox.style.opacity="40";
plusbox.style.width="90%";
plusbox.style.top="600px";

plusbox_timer=setInterval('moveit("plusbox",600,100);', 50);

return false;
}//////////

function removeplusbox(obj){
var plusbox =document.getElementById('plusbox');
plusbox.innerHTML="";
plusbox.style.top="600px";
plusbox.style.position="";
var msgline=document.getElementById('msgline');
msgline.innerHTML="";
plusbox_outcount=0;
}

function plusboxdown(j){
var plusbox =document.getElementById('plusbox');
plusbox.style.top="600px";
plusboxY=600;
}

var plusbox_outcount=0;
var plusbox_timer=0;
var plusboxY=600;

function moveit(objname,starty,endy){
plusbox_outcount+=1;
if(plusbox_outcount>9999) {msgin("plusbox_outcount:"+plusbox_outcount);clearInterval(plusbox_timer); return; }
if(plusbox_timer!==0) {clearInterval(plusbox_timer);plusbox_timer=0;}

var obj=document.getElementById(objname);

obj.style.position="absolute";
obj.style.top=starty+"px";
plusboxY=starty;

var rest=starty-endy;
step=parseInt(rest/5);

var nextpos=starty-step;
if(rest<=5 || step <=3) nextpos=endy;

//msgin(starty+"s="+step+" n="+nextpos);
if (step==0 || nextpos==endy) {clearInterval(plusbox_timer); return; }
var nextcall="moveit('"+objname+"',"+nextpos+","+endy+");";

if(plusbox_timer==0) {} else clearInterval(plusbox_timer);
plusbox_timer=setInterval(nextcall, 50);

}///////////

function msgin(t) {  //if({$test}){}else return;
var ml=document.getElementById('msglinetop');
ml.innerHTML+='*'+t;
}

