
var obj,werb,ysize,scrollpx;
var running=0;
var delay=20000;
var vscrollo=10;
var vscrollc=40;
var adhoehe=0;

function klickwerb()
{ if (running != 1)
init();
}

function init()
{ running = 1;
if (document.all)
{ obj=document.all.logo;
werb=document.all.werb;
pos=getDim(document.all.ShutterAd);
}

else

{ obj=document.getElementById("logo");
werb=document.getElementById("werb");
pos=getDim(document.getElementById("ShutterAd"));
}
ysize=obj.offsetHeight;
var xp=pos.x;
scrollpx=Math.round(ysize/60);

if (screen.width<1024)
pos = getDim(document.getElementById("ShutterAd800600"));
werb.style.left=xp+obj.offsetWidth-werb.offsetWidth;
werb.style.top=pos.y;
obj.style.visibility="visible";
werb.style.visibility="visible";

//Animation starten
moveIn(ysize,pos.y)
}

function moveIn(cl,ypos)
{ if (cl<0)
{ obj.style.clip="rect(auto auto auto auto)";
obj.style.top=ypos+"px";
werb.style.top=(ypos+ysize)+"px";
setTimeout("moveOut(0,"+ypos+")", delay);
}

else

{ obj.style.clip="rect("+cl+"px auto auto auto)";
obj.style.top=ypos-cl+"px";
werb.style.top=(ypos-cl+ysize)+"px";
cl=cl-scrollpx;
setTimeout("moveIn("+cl+","+ypos+")", vscrollo)
}
}

function moveOut(cl,ypos)
{ if (cl>ysize)
{ obj.style.clip="rect("+ysize+"px auto auto auto)";
obj.style.visibility="hidden";
werb.style.top=ypos+"px";
running=0;
}

else

{ obj.style.clip="rect("+cl+"px auto auto auto)";
obj.style.top=ypos-cl+"px";
werb.style.top=(ypos-cl+ysize)+"px";
cl=cl+scrollpx;
setTimeout("moveOut("+cl+","+ypos+")", vscrollc)
}
}

function getDim(el)

{ var rd = {x:el.offsetLeft,y:el.offsetTop}, tEl=el.offsetParent
while (tEl)
{ rd.x += tEl.offsetLeft;
rd.y += tEl.offsetTop;
tEl = tEl.offsetParent;
}

rd.y += adhoehe;
return rd
}
