var logowidth
var logoheight
var logoimage
var loadinterval;
var moveinterval;
var loadtime;
var flyer_obj;
var flyer_img;

var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1;


function showFlyer(imagesrc)
{
	loadtime=0;
	logoimage=new Image();
	logoimage.src=imagesrc;
	loadinterval = setInterval("checkLoad()",100);
}

function checkLoad()
{
	if( !logoimage.complete) {
		loadtime++;
		if (loadtime > 10)
		{
			logowidth=150;
			logoheight=50;
		
			positionit();
			writeFlyer('<p>Das Bild wird geladen...</p>(Klicken zum Schlie&szlig;en)');
			showIt();
		}
		return;
	}
	clearInterval(loadinterval);

	logowidth=logoimage.width+20;
	logoheight=logoimage.height+40;

	positionit();
	
	writeFlyer('<p><img src="'+logoimage.src+'" width="'+logoimage.width+'" height="'+logoimage.height+'" alt="klicken zum schließen"></p>Aufs Bild klicken zum Schlie&szlig;en');
	
	showIt();

}

function writeFlyer(code)
{
	if (ie||document.getElementById)
	flyer_img.innerHTML=code;
	else if (document.layers){
	flyer_img.document.write(code);
	flyer_img.document.close();
	}
}

function showIt()
{
	if (document.layers)
	flyer_obj.visibility="visible";
	else
	flyer_obj.style.visibility="visible";
	moveinterval=setInterval("positionit()",50);
}

function hideFlyer()
{
	if (document.layers)
	flyer_obj.visibility="hidden";
	else
	flyer_obj.style.visibility="hidden";
	clearInterval(moveinterval);
	logoimage=null;
}

function drawPopup()
{
	//document.write('<div style="position: absolute; top: 0px; right: 0px; visibility:hidden" id="flyerPopup" onClick="hideFlyer();"><table border="0" cellspacing="0" cellpadding="0" bgcolor="#0C181F"><tr valign="top"><td width="10" height="10" background="/images/mdl_lt.gif"></td><td height="10" background="/images/mdl_borderfill.gif" class="t003"></td><td width="10" height="10" align="right" background="/images/mdl_rt.gif"></td></tr><tr><td width="10" background="/images/mdl_borderfill.gif" class="t004"></td><td valign="top" align="center"><div id="flyerImg"></div></td><td width="10" align="right" background="/images/mdl_borderfill.gif" class="t005"></td></tr><tr><td width="10" height="10" background="/images/mdl_lb.gif"></td><td height="10" background="/images/mdl_borderfill.gif" class="t006"></td><td width="10" height="10" align="right" background="/images/mdl_rb.gif"></td></tr></table></div>');
	document.write('<div style="position: absolute; visibility:hidden; z-index: 1000;" id="flyerPopup" onClick="hideFlyer();"><table border="0" cellspacing="0" cellpadding="0"><tr valign="top"><td width="10" height="10" background="/images/mdl_lt_bg.gif"></td><td height="10" background="/images/mdl_borderfill.gif" class="t003" bgcolor="#0C181F"></td><td width="10" height="10" align="right" background="/images/mdl_rt_bg.gif"></td></tr><tr><td width="10" background="/images/mdl_borderfill.gif" class="t004" bgcolor="#0C181F"><img src="/images/spacer.gif" width="10"></td><td valign="top" align="center" bgcolor="#0C181F"><div id="flyerImg"></div></td><td width="10" align="right" background="/images/mdl_borderfill.gif" class="t005" bgcolor="#0C181F"><img src="/images/spacer.gif" width="10"></td></tr><tr><td width="10" height="10" background="/images/mdl_lb_bg.gif"></td><td height="10" background="/images/mdl_borderfill.gif" class="t006" bgcolor="#0C181F"></td><td width="10" height="10" align="right" background="/images/mdl_rb_bg.gif" ></td></tr></table></div>');
	document.close();
	flyer_obj=ie? document.all.flyerPopup : document.getElementById? document.getElementById("flyerPopup") : document.flyerPopup;
	flyer_img=ie? document.all.flyerImg : document.getElementById? document.getElementById("flyerImg") : document.flyerImg;
}



function positionit(){
var dsocleft=ie? document.body.scrollLeft : pageXOffset;
var dsoctop=ie? document.body.scrollTop : pageYOffset;
var window_width=ie? document.body.clientWidth : window.innerWidth-20;
var window_height=ie? document.body.clientHeight : window.innerHeight;

if (ie||document.getElementById){
flyer_obj.style.left=parseInt(dsocleft)+parseInt(window_width)/2-logowidth/2;
flyer_obj.style.top=parseInt(dsoctop)+parseInt(window_height)/2-logoheight/2;
}
else if (document.layers){
flyer_obj.left=dsocleft+window_width/2-logowidth/2;
flyer_obj.top=dsoctop+window_height/2-logoheight/2;
}
}