function openShopBigImage(){
	var shopMediaWin = window.open(bigLink, 'shopWin','width=660,height=700,locationbar=no,resizable=yes,scrollbars=yes');
	shopMediaWin.focus();
}

function openMatchreport( url ) {
	var width = 700;
	var height = 500;
	fenster = window.open(url,'fcbMatchreport','width=' +  width + ',height=' + height + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,left=0,top=0,screenX=0,screenY=0');
	fenster.moveTo(0,0);
	fenster.focus();
}

function tickerChange(){
	var oldNewsticker = currentNewsticker;
	if(currentNewsticker < arrTicker.length - 1){
		currentNewsticker = oldNewsticker + 1;
	}else{
		currentNewsticker = 0;
	}
	document.getElementById('newsticker'+arrTicker[oldNewsticker]['id']).style.display = 'none';
	document.getElementById('newsticker'+arrTicker[currentNewsticker]['id']).style.display = 'block';
	setTimeout('tickerChange();',6000);
}

function showNextMatchEditorial(){
	document.getElementById('team1_table').style.display = 'none';
	document.getElementById('team2_table').style.display = 'none';
	document.getElementById('nextMatchEditorial').style.display = 'block';
}

function getCookieValue(n){
	a = document.cookie;
	res = '';
	while(a != ''){
		while(a.substr(0,1) == ' '){
			a = a.substr(1,a.length);
		}
		cookiename = a.substring(0,a.indexOf('='));
		if(a.indexOf(';') != -1){
			cookiewert = a.substring(a.indexOf('=')+1,a.indexOf(';'));
		}else{
			cookiewert = a.substr(a.indexOf('=')+1,a.length);
		}
		if(n == cookiename){
			res = cookiewert;
		}
		i = a.indexOf(';')+1;
		if(i == 0){
			i = a.length
		}
		a = a.substring(i,a.length);
	}
	return(res)
}

function changeBodyClass(bodyId, bodyClass){
	var timeout = new Date();
	var timeoutExpire = timeout.getTime() + (30 * 24 * 60 * 60 * 1000);
	timeout.setTime(timeoutExpire);
	document.cookie = "fcbBodyClass=" + bodyClass + "; path=/; expires=" + timeout.toGMTString();
	document.getElementById(bodyId).className = bodyClass;
	document.getElementById('bgBodyFrm').className = 'bgBody' + bodyClass;
}

function changeButton(img,imgName){
	document.getElementById(imgName).src = img;
}

function displayTopNews(boxID){
	document.getElementById('topNews' + currentTopNewsBoxID).style.display = 'none';
	document.getElementById('topNews' + boxID).style.display = 'block';
	currentTopNewsBoxID = boxID;
}

function reloadWebsite(selectName){
	var str_link = document.getElementById(selectName).value;
	location.href = str_link;
}

function clearField(fieldName){
	document.getElementById(fieldName).value = '';
}

function bannerChange(id){
	//var url = 'component=bannerchange&action=showBanner&id='+id+'&tpl=skel_banner.tpl';
	//url = encode(url);
	var url = 'banner.php?id=' + id;
	location.replace(url);
}
function smallBannerChange(id,typeID){
	var url = 'banner-type.php?typeID='+typeID+'&id=' + id;
	location.replace(url);
}
function bannerChangeType(id,typeID){
	//var url = 'component=bannerchange&action=showBanner&id='+id+'&tpl=skel_banner.tpl';
	//url = encode(url);
	var url = 'bannerType.php?id=' + id + '&typeID=' + typeID;
	location.replace(url);
}
// change Banner
function changeBanner(){
	//alert ("gr�sse"+bannerId.length);
	//alert ("position"+currentBannerPosition);
	//alert ("delay"+bannerDelay[currentBannerPosition]);
	if( ( bannerId.length - 1 ) > currentBannerPosition ){
		currentBannerPosition++;
	}else{
		currentBannerPosition = 0;		
	}
	document.getElementById('bannerPic').src = bannerSrc[currentBannerPosition];
	//alert('Sekunden:'+bannerDelay[currentBannerPosition]);
	setTimeout('changeBanner();',bannerDelay[currentBannerPosition]*1000);
}
// open Banner Url
function goToUrl(){
	var url = 'core.php' + encode('component=bannerchange&action=clickBanner&bannerchangeID='+bannerId[currentBannerPosition]+'&tpl=skel_banner_click.tpl');
	fenster = window.open(url,'bannerPopup');
	fenster.moveTo(0,0);
	fenster.focus();
}

function validatePlayerratingForm(){
	var int_playerratingID = 0;
	error = new Array();
	for(var i = 0; i < PlayerratingArray.length; i++){
		var tmperror = false;
		int_playerratingID = PlayerratingArray[i];
		if(document.getElementById('input_'+int_playerratingID).value == 0){
			tmperror = true;
		}
		error[i] = tmperror;
	}
	var counter = 0;
	for(var i = 0; i < PlayerratingArray.length; i++){
		if(error[i] == false){
			counter++;
		}
	}
	if(counter == PlayerratingArray.length){
		return true;
	}else{
		alert("Bitte bewerten Sie alle Spieler!");
		return false;
	}
}

function hideAdvertisement(){
	if (document.getElementById){
		document.getElementById("advertisement").style.display = "none";
	}else if (document.all){
		document.all["advertisement"].style.display = "none";
	}else if (document.layers){
		document.layers["advertisement"].style.display = "none";
	}
}

function openJahreskarte( url ) {
	var width = 1024;
	var height = 660;
	fenster = window.open(url,'fcbJahreskarte','width=' +  width + ',height=' + height + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,left=0,top=0,screenX=0,screenY=0');
	fenster.moveTo(0,0);
	fenster.focus();
}

function setJahreskarteCookie(){
	var timeout = new Date();
	var timeoutExpire = timeout.getTime() + (5 * 24 * 60 * 60 * 1000);
	timeout.setTime(timeoutExpire);
	document.cookie = "fcbJahreskarte=1" + "; path=/; expires=" + timeout.toGMTString();
}