function wOpen(url,name,eig){var neuWin=window.open(url,name,eig);}

/* PixelCounter */
document.write('<div style="position:absolute;visibility:hidden" id="pixelholder0">nix</div>');

function doIframePixelCall() {
	if (window.arPixelIdx >= window.arPixel.length) {
		window.callingPixel = false;
		return;
	}
	var url = window.arPixel[window.arPixelIdx];
	var x = '<div id="pixelholder'+(window.arPixelIdx + 1)+'">nix</div>';
	x += '<iframe src="'+url+'" width="1" height="1" onload="window.arPixelIdx++;doIframePixelCall();"></iframe>';
	document.getElementById('pixelholder' + window.arPixelIdx).innerHTML=x;
}

function callIframePixel(url) {
	if (! window.arPixelIdx) window.arPixelIdx = 0;
	if (! window.arPixel) window.arPixel = new Array();
	window.arPixel[window.arPixel.length] = url;
	window.sPixel = window.arPixel.join('\n');
	if (! window.callingPixel) {
		window.callingPixel = true;
		doIframePixelCall();
	}
}

function getSp1Pixel(ext) {
	var url = ivwUrl;
	var pe = '';
	if ('undefined' != typeof(partner)) pe += partner;
	if (ext) {
		sp1SwitchView(ext == 'start'? 'overview' : 'content');
		if (pe != '') pe += '/';
		pe += ext;
	}
	if (pe != '') url += '&path=' + pe;
	return url;
}

function callPixel(url) {
	if (!window.callPixelArray) window.callPixelArray = new Array();
	var x = new Image();
	x.src = url;
	window.callPixelArray[window.callPixelArray.length] = x;
}

// falls sich während der Laufzeit des Tickers Änderungen in den Konfiguration oder der HTML-Seite selbst ergeben, wird so eine Aktualisierung erzwungen
//function sp1AutoRefresh() {window.location.reload();}window.setTimeout('sp1AutoRefresh();', 40 * 60 * 1000);


// Funktionen zur Erkennung des Flash-Plugins und zur Darstellung
window.sp1flashinstalled=0;window.sp1flashversion=0;window.sp1vbflashinstalled=0;window.sp1vbflashversion=0;
document.write('<scr'+'ipt language="VBScr'+'ipt" src="/ticker/flasherkennung_sub_vb.js"></sc'+'ript>');

function sp1GetFlashTag (version, url, width, height, flashvars) {
	var doShowFlash = sp1IsFlashInstalled();
	if (!doShowFlash) return sp1CreateFlashError(url, flashvars, width, height, 0);
	doShowFlash = version <= sp1GetFlashVersion();
	if (!doShowFlash) return sp1CreateFlashError(url, flashvars, width, height, 1);
	return sp1GetOnlyFlash(url,width,height,flashvars);
}

function sp1SwitchErrorToFlashTag() {
	document.getElementById('flasherror').style.visibility='hidden';
	document.getElementById('flasherror').style.position='absolute';
//	document.getElementById('flashct').style.position='relative';
	document.getElementById('flashct').style.visibility='visible';
}

function sp1CreateFlashError(url, flashvars, width, height, type) {
	var s = '<div id="flasherror"><table cellpadding=0 cellspacing="0" border="0"><tr>';
	s += '<td align="center" valign="middle" width="'+width+'" height="'+height+'" bgcolor="#FFFFFF">';
	s += 'Zur Darstellung des Tickers ist ein aktuelles <a href="http://www.macromedia.com/go/getflashplayer" target="_blank">Flash-Plugin</a> erforderlich.';
	s += '<br><a href="javascript://" onclick="sp1SwitchErrorToFlashTag();return false;">zum Ticker</a>';
	s += '</td></tr></table></div>';
	s += '<div id="flashct" style="visibility:hidden; position:absolute">';
	s += sp1GetOnlyFlash(url, width, height, flashvars);
	s += '<div>';
	return s;
}

function sp1GetOnlyFlash(url, width, height, flashvars) {
	var s = '';
	s+='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	s+='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
	s+='WIDTH="'+width+'" HEIGHT="' + height + '">';
	s+='	<PARAM NAME="movie" VALUE="'+url+'">';
	s+='	<PARAM NAME="loop" VALUE="false">';
	s+='	<PARAM NAME="menu" VALUE="false">';
	s+='	<PARAM NAME="quality" VALUE="high">';
	s+='	<PARAM NAME="scale" VALUE="exactfit">';
	s+='	<PARAM NAME="wmode" VALUE="transparent">';
	s+='	<PARAM NAME="FlashVars" VALUE="'+ flashvars +'">';
	s+='	<EMBED src="'+url+'" FlashVars="' + flashvars + '" loop="false" menu="false" quality="high" ';
	s+='scale="exactfit" wmode="transparent" width="' + width + '" height="'+height+'" ';
	s+='type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></EMBED>';
	s+='</OBJECT>';
	return s;
}

function sp1CheckFlash() {
	if(window.sp1flashinstalled) return;
	window.sp1flashinstalled=0; window.sp1flashversion=0;
	//kein MS Browser;
	if (navigator.plugins && navigator.plugins.length) {
		x = navigator.plugins["Shockwave Flash"];
		if (x) {
			window.sp1flashinstalled = 2;
			if (x.description) {
				y = x.description;
				window.sp1flashversion = y.charAt(y.indexOf('.')-1);
			}
		}
		else	window.sp1flashinstalled = 1;
		if (navigator.plugins["Shockwave Flash 2.0"]) {
			window.sp1flashinstalled = 2;
			window.sp1flashversion = 2;
		}
	}
	else if (navigator.mimeTypes && navigator.mimeTypes.length) {
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		if (x && x.enabledPlugin) window.sp1flashinstalled = 2;	
		else window.sp1flashinstalled = 1;
	}
	//MS Browser;
	else {
		for (i=25;i>0;i--) {
			vs = VBGetSwfVer(i);
			if (vs != 0) {
				window.sp1flashinstalled = 2;
				window.sp1flashversion = Number(vs.split(' ')[1].split(',')[0]);
				return;
			}
		}
	}
}
function sp1IsFlashInstalled() {sp1CheckFlash(); window.flashInfo="flash installed: " + window.sp1flashinstalled + " with version " + window.sp1flashversion; return window.sp1flashinstalled>0; }
function sp1GetFlashVersion() { sp1CheckFlash(); return window.sp1flashversion; }


function sp1SwitchView(p) {
	if (p) {
		handleTickerContentPresenting(p);
		handleTickerOverviewPresenting(p);
	}
}

// Presentings der Webseiten
function handleTickerContentPresenting(p) {
	if (!window.tickerContentPresentingRefName) return;
	// speichere dieReferenz
	if (!window.tickerContentPresentingRef) window.tickerContentPresentingRef = document.getElementById(window.tickerContentPresentingRefName);
	if (window.tickerContentPresentingRef == null) return;
	// Wenn nicht die Übersicht
	if ('overview' != p) {
		// wenn das Presenting noch nicht aktiviert worden ist
		if (!window.presSwitchC) {
			// aktiviere
			window.tickerContentPresentingRef.style.visibility='visible';
			// speichere die aktivierung
			window.presSwitchC = true;
		}
	}
	// wenn es die übersicht ist
	else {
		// presenting aus
		window.tickerContentPresentingRef.style.visibility='hidden';
		// speichere die deaktivierung
		window.presSwitchC = false;
	}
}

function handleTickerOverviewPresenting(p) {
	if (!window.tickerOverviewPresentingRefName) return;
	// speichere dieReferenz
	if (!window.tickerOverviewPresentingRef) window.tickerOverviewPresentingRef = document.getElementById(window.tickerOverviewPresentingRefName);
	if (window.tickerOverviewPresentingRef == null) return;
	// Wenn es die Übersicht ist
	if ('overview' == p) {
		// wenn das Presenting noch nicht aktiviert worden ist
		if (!window.presSwitchO) {
			// aktiviere
			window.tickerOverviewPresentingRef.style.visibility='visible';
			// speichere die aktivierung
			window.presSwitchO = true;
		}
	}
	// wenn es nicht die übersicht ist
	else {
		// presenting aus
		window.tickerOverviewPresentingRef.style.visibility='hidden';
		// speichere die deaktivierung
		window.presSwitchO = false;
	}
}

function sp1hideAd () {
	clearTimeout(window.adTimer);
	if (!window.tickerIntersitialRefName) return;
	var ref = document.getElementById(window.tickerIntersitialRefName);
	ref.innerHTML = '';
	ref.style.visibility='hidden';
}

var AD_EVENT_GAME_END = 1;
var AD_EVENT_GAME_START = 2;
var AD_EVENT_HALF_BREAK = 3;
var AD_EVENT_SECOND_HALF_START = 4;
