function OpenGalerie(param)
{
	var w = window.open("/galerie.php?"+param, "Galerie", "width=650,height=680,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");
	w.focus();
}

function OpenTicker(url, SpielID, sid)
{
	var w = window.open(url+"?SpielID="+SpielID+"&"+sid, "Ticker"+SpielID, "width=500,height=650,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");
	w.focus();
}

function OpenTicker2(url, SpielID, sid)
{
	var w = window.open(url+"?SpielID="+SpielID+"&"+sid, "Ticker"+SpielID, "width=920,height=640,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");
	w.focus();
}

function OpenChat()
{
	var w = window.open("/fanzone/chat/popup.php", "FCEFanChat", "width=800,height=650,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");
	w.focus();
}

function OpenPopUp(url, name, w, h)
{
	var w = window.open(url, name, "width="+w+",height="+h+",menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");
	w.focus();
}

function OpenPKTV()
{
	var w = window.open("/pk_tv/home.php", "PK_TV", "width=500,height=570,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");
	w.focus();
}

function OpenShop()
{
	window.open("/shop2/catalog/default.php", "shop");
	/*
	var p = window.open("/popup/shop_weihnacht.html", "_blank", "width=400, height=400, resizable=yes,status=no,menubar=no,location=no,scrollbars=no,toolbar=no");
	p.focus();
	*/
}

/*
*
* Geburtstagsticker
*
*/
var GTicker = null;
var GTickerDiv = null;
var GTickerDivDummy = null;
var GTickerFred = null;

function initGTicker()
{
	GTicker = document.getElementById('GTicker');
	if (!GTicker)	return;
	
	var divs = GTicker.getElementsByTagName('div');
	if (divs.length < 2)	return;
	GTickerDiv = divs[0];
	GTickerDivDummy = divs[1];
	
	// der IE-Arsch kennt die Breite noch nicht - alle anderen schon ...
	if (GTicker.offsetWidth==0 || GTickerDiv.offsetWidth==0)	{
		setTimeout("initGTicker()", 50);
		return;
	}
	
	// in manchen Browsern sind abgeschnittene DIVs genauso gross wie das ElternDIV - dumme Sache
	if (GTickerDiv.offsetWidth >= GTicker.offsetWidth)	{
		GTickerDiv.style.left = GTicker.offsetWidth+"px";
		GTickerDivDummy.style.left = GTicker.offsetWidth+GTickerDiv.offsetWidth+"px";
		rollGTicker();
	}
	else	{
		GTickerDiv.style.display = "none";
		GTickerDiv = null;
	}
}

function rollGTicker()
{
	if (!GTickerDiv)	return;
	var off = parseInt(GTickerDiv.style.left)-1;
	if (off <= 0-GTickerDiv.offsetWidth)	{
		off = 0;
	}
	GTickerDiv.style.left = off+"px";
	GTickerDivDummy.style.left = off+GTickerDiv.offsetWidth+"px";
	GTickerFred = setTimeout("rollGTicker()", 30);
}

function stopGTicker()
{
	if (!GTickerFred)	return;
	clearTimeout(GTickerFred);
}

/*
*
* NewsFlash
*
*/
var NewsFlash = null;
var NewsFlashDiv = null;
var NewsFlashDivDummy = null;
var NewsFlashFred = null;

function initNewsFlash()
{
	NewsFlash = document.getElementById('NewsFlash');
	if (!NewsFlash)	return;
	
	var divs = NewsFlash.getElementsByTagName('div');
	if (divs.length < 2)	return;
	NewsFlashDiv = divs[0];
	NewsFlashDivDummy = divs[1];
	
	// der IE-Arsch kennt die Breite noch nicht - alle anderen schon ...
	if (NewsFlash.offsetWidth==0 || NewsFlash.offsetWidth==0)	{
		setTimeout("initNewsFlash()", 50);
		return;
	}
	
	// in manchen Browsern sind abgeschnittene DIVs genauso gross wie das ElternDIV - dumme Sache
	if (NewsFlashDiv.offsetWidth >= NewsFlash.offsetWidth)	{
		NewsFlashDiv.style.left = (parseInt(NewsFlash.offsetWidth)>>1)+"px";
		NewsFlashDivDummy.style.left = (parseInt(NewsFlash.offsetWidth)>>1+NewsFlashDiv.offsetWidth)+"px";
		rollNewsFlash();
	}
	else	{
		NewsFlashDiv.style.display = "none";
		NewsFlashDiv = null;
	}
}

function moveNewsFlash()
{
	if (!NewsFlashDiv)	return;
	var off = parseInt(NewsFlashDiv.style.left)-2;
	if (off <= 0-NewsFlashDiv.offsetWidth)	{
		off = 0;
	}
	NewsFlashDiv.style.left = off+"px";
	NewsFlashDivDummy.style.left = off+NewsFlashDiv.offsetWidth+"px";
	NewsFlashFred = setTimeout("moveNewsFlash()", 30);
}

function rollNewsFlash()
{
	if (NewsFlashFred)	return;
	moveNewsFlash();
}

function stopNewsFlash()
{
	if (!NewsFlashFred)	return;
	clearTimeout(NewsFlashFred);
	NewsFlashFred = null;
}

/*
*
* SpielStatistik
*
*/
function SelSpielBericht()
{
	var krBericht = document.getElementById('krBericht');
	var kkBericht = document.getElementById('kkBericht');
	var krStatistik = document.getElementById('krStatistik');
	var kkStatistik = document.getElementById('kkStatistik');
	
	krBericht.className = 'SpielReiterAktiv';
	kkBericht.className = 'SpielKarteiAktiv';
	krStatistik.className = 'SpielReiterInaktiv';
	kkStatistik.className = 'SpielKarteiInaktiv';
}
function SelSpielStatistik()
{
	var krBericht = document.getElementById('krBericht');
	var kkBericht = document.getElementById('kkBericht');
	var krStatistik = document.getElementById('krStatistik');
	var kkStatistik = document.getElementById('kkStatistik');
	
	krBericht.className = 'SpielReiterInaktiv';
	kkBericht.className = 'SpielKarteiInaktiv';
	krStatistik.className = 'SpielReiterAktiv';
	kkStatistik.className = 'SpielKarteiAktiv';
}
