//
// 2006 by bitart; Author: Alexander Graf
//
// Copyright by bitart - Furch & Graf GbR, Gartenstr. 5 56220 St. Sebastian,
// Germany. All rights reserved.
// Copyright in this software is owned by bitart, unless otherwise indicated.
//
// You are not allowed to distribute this software in any form or use it as
// part of another project without asking the owner for permission to use.
//

var tipobject = null;
var tipsize   = null;
var tiptimer  = null;
var tipnumber = null;

function initTipps(timer, num)
{
	tipobject = document.getElementById('tip');
	tipobject.onclick = newTipps;
	tipobject.title = 'Nächsten Tipp anzeigen';
	var stp = document.getElementById('stop');
	stp.onclick = stopTipps;
	stp.title = 'Keine Tipps mehr anzeigen';
	tipnumber = num;
	resizeTipps();
	window.onresize = resizeTipps;
	if (timer) tiptimer = window.setTimeout('newTipps(true)',timer*1000);
}

function resizeTipps()
{
	try{
		var bw = document.documentElement.offsetWidth || window.innerWidth || document.body.offsetWidth || 0;
		var th = tipobject.offsetHeight;
		if (bw>0 && th != tipsize){
			top.sizes[2][1] = '*,'+th;
			top.sizer(2,-1);
			tipsize = th;
		}
	}catch(e){};
}

function stopTipps()
{
	if (tiptimer) tiptimer = window.clearTimeout(tiptimer);
	top.sizer(2,0);
}

function newTipps(ran)
{
	if (tiptimer) tiptimer = window.clearTimeout(tiptimer);
	if (ran===true){
		window.location.reload();
	}else{
		window.location.replace('/app/tipps.php?num='+(tipnumber+1));
	}
}
