if (top.frames.length > 0)
{
	top.location.href = self.location;
}

window.onresize = resizeDetailbox;

function resizeDetailbox()
{
	if (!window.opera)
	{
		var varDetailbox = null;
		var ie4 = (document.all) ? true : false;
		var ns4 = (document.layers) ? true : false;
		var ns6 = (document.getElementById && !document.all) ? true : false;
		var xoffset = (ie4) ? 400 : 420; /* 20 for ns and ff, sets scrollbar outside !!! */
		var yoffset = (ie4) ? 0 : 20; /* 20 for ns and ff, sets scrollbar outside !!! */
		
		if (ie4)
		{
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}
		else
		{
			x = window.innerWidth;
			y = window.innerHeight;
		}
		if (ns4)
		{
			varDetailbox = document.detailbox;
		}
		else
		{
			varDetailbox = document.getElementById("detailbox").style;
		}
		if (varDetailbox != null)
		{
			if (x > xoffset)
			{
				varDetailbox.width = (x - xoffset) + "px";
			}
			if (y > yoffset)
			{
				varDetailbox.height = (y - yoffset) + "px";
			}
		}
	}
}

// global variable for current sponsor
var timeout = 6000;
var maxsponsor = 6;
var sponsor = 0;
var img;

function MM_findObj(n, d)
{ //v4.0
	var p,i,x;
	if (!d) d = document;
	if ((p = n.indexOf("?")) > 0 && parent.frames.length)
	{
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
	if (!(x = d[n]) && d.all) x = d.all[n];
	for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
	for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
	if (!x && document.getElementById) x = document.getElementById(n);
	return x;
}

function changeSponsor()
{
	sponsor = Math.round(maxsponsor * Math.random());
	if (sponsor == maxsponsor) sponsor = 0;
	img = MM_findObj("sponsorimage");
	img.src = "images/logos/sponsor_logo_" + sponsor + ".gif";
	window.setTimeout('changeSponsor();', timeout);
}

function openWindow(url)
{
        popupWindow = window.open(url);
        if (window.focus) popupWindow.focus(); 
}       

function gotoSponsor()
{
   if (sponsor==0) openWindow("http://www.best-trip.at/");
   if (sponsor==1) openWindow("http://www.rastenfeld.at/");
   if (sponsor==2) openWindow("http://www.waldviertel.or.at/waldviertel/");
   if (sponsor==3) openWindow("http://www.noev.at/");
   if (sponsor==4) openWindow("http://www.raika.at/");
   if (sponsor==5) openWindow("http://www.standby.info.at/");
}


