

function printAGOF()
{
	try {var sPrintagof=IVW.substring(IVW.indexOf("/CP/")+4,IVW.length-2);} catch(err) {}
	if ((sPrintagof==undefined) || (sPrintagof==""))
	{
		sPrintagof="- Keine AGOF-ID gefunden! -";
		alert(sPrintagof);
	} else
	{
		alert("AGOF-ID: "+sPrintagof);
		//window.document.title+=printagof;
	}
}

function trackGallery(pPictureNr, pGalleryName)
{
	// check for loaded s_code.js
	if(!window.s_gi) {
		return;
	}
	var s = s_gi(s_account);
	s.linkTrackVars='prop15,prop16';
	s.prop15 = 'Bild_' + pPictureNr;
	s.prop16 = pGalleryName;
	s.tl(this, 'o', 'Bildaufruf_' + pPictureNr);
}

function openPopup(url, width, height) {
	var win = window.open(url, 'Sat1', 'width='+width+',height='+height);
	win.focus();
}

function openPopUpWindow( side, width, height, top, left, scrollbars )
{
    if (side && side != null)
    {
        var win = document.open(side, "_blank", "width=" + width + ",height=" + height + ",top="+ top + ",left=" + left + ",toolbar=no,status=no,location=no,menubar=no,directories=no,resizable=yes,scrollbars=" + scrollbars + ",scrolling=");
		win.focus();
    }
    return;
}

function openGalleryPopup(uri) {
	if (!uri) return;

	var clack=window.open(uri, 's1gallery', 'width=880,height=646,resizable=1');
	if (clack) clack.focus();
	return false;
}

function toggleElementVisibility(el) {
	if (el) {
        if (el.style.display != 'block') {
            showElement(el);
        } else {
            hideElement(el);
        }
    }
}

function hideElement(el) {
    if (el) {
        el.style.display = 'none';
    }
}

function showElement(el) {
    if (el) {
        el.style.display = 'block';
        el.style.visibility = 'visible';
    }
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

// attrib_name may be
// id|class|readOnly
// or a style property name like 'display'
function setAttributeForElement(id, attrib_name, attrib_value)
{
	var element = document.getElementById(id);
	if (!element) return;
	
	if (attrib_name == 'class') {
		element.className = attrib_value;
	}
	else if (attrib_name == 'id') {
		element.id = attrib_value;
	}
	else if (attrib_name == 'readOnly') {
		element.readOnly = attrib_value;
	}
	else {
		element.style[attrib_name] = attrib_value;
	}
	return 1;
}


/** Magic Dropdowns **/

var magicdropdowns = new Array();
var magicdropdownButtonHandled = false;

function magicdropdownButtonClick(tag) {
	magicdropdownButtonHandled = true;
	// TODO: hide other dropdowns

	// show requested dropdown
	el = magicdropdowns[tag];
	toggleElementVisibility(el);
}

function magicdropdownOptionClick(tag, optionValue, optionText) {
	// change text
	var textEl = document.getElementById('magicdropdown-text-'+tag);
	if (textEl) {
        textEl.innerHTML = optionText;
        textEl.style.color = '#000000';
    }

	// change hidden form value to optionValue
    var valueEl = document.getElementById('magicdropdown-value-'+tag);
    if (valueEl) {
        valueEl.value = optionValue;
    }

	// hide dropdown
	hideElement(magicdropdowns[tag]);
}


function magicdropdownClickHandler(event) {
	if (!magicdropdownButtonHandled) {
		// TODO: hide all dropdowns
	}

	magicdropdownButtonHandled = false;
}

function magicdropdownInit() {
	document.onclick = magicdropdownClickHandler;
	magicdropdowns = new Array();
}

function magicdropdownRegister(tag) {
	magicdropdowns[tag] = document.getElementById('magicdropdown-dropdown-'+tag);
}



/* musicload */

function musicloadAlert() {
    //alert('Willkommen in der ProSieben-Filiale von musicload.\nLeider kann unser umfangreiches Download-Angebot nur\nin Deutschland genutzt werden. User aus Österreich und der Schweiz\ngreifen bitte auf andere nationale Anbieter zurück.');
    openPopUpWindow('/shop_more/partner/musicload/popup_musicload.php', 400, 300, 50, 50, 'yes');
}




var bikky = document.cookie;

function getCookie(name) { // use: getCookie("name");
    var index = bikky.indexOf(name + "=");
    if (index == -1) return null;
    index = bikky.indexOf("=", index) + 1;
    var endstr = bikky.indexOf(";", index);
    if (endstr == -1) endstr = bikky.length;
    return unescape(bikky.substring(index, endstr));
}

var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days

function setCookie(name, value) { // use: setCookie("name", value);
    if (value != null && value != "")
      document.cookie=name + "=" + escape(value) + "; expires=" + expiry.toGMTString()+"; path=/";
    bikky= document.cookie; // update bikky
}

function testCookie() {
    var yourName = getCookie ("yourName");
    if (yourName == null) yourName = prompt ("What is your name?", "");
    alert ("Hello, " + yourName + "\nWelcome to my Website");
    setCookie ("yourName", yourName);
}


function checkCommunityBoxLinks() {
    if (getCookie('s7_community_login')) {
        hideElement(document.getElementById('community_box_login_link'));
        showElement(document.getElementById('community_box_logout_link'));
    }
}

function doTeatri(directory)
{
	if (directory && window.teatri != '') {
		document.write('<img src="http://ps.sat1.de/cgi-bin/s1ps.cgi?pfad=' + directory
			+ window.teatri + '" width="1" height="1" align="right">');
	}
}

/* Combox*/

function eshowcom(name) {
	var container = document.getElementById(name);
	if (container) container.style.display = "block";
	var button = document.getElementById(name+"_button");
	if (button) button.className = "combox_active_"+ name +"_button";
}

function ehidecom(name) {
	var container = document.getElementById(name);
	if (container) container.style.display = "none";
	var button = document.getElementById(name+"_button");
	if (button) button.className = "combox_inactive_"+ name +"_button";
}

function rollovercom(a, b, c) {
	eshowcom(a);
	ehidecom(b);
	ehidecom(c);
}


function comActive(reiter){
	if(reiter == 1) {
		rollovercom('combox_reiterebene_foren1' , 'combox_reiterebene_foren2', 'combox_reiterebene_foren3')
	}
	if(reiter == 2) {
		rollovercom('combox_reiterebene_foren2' , 'combox_reiterebene_foren1', 'combox_reiterebene_foren3')
	}
	if(reiter == 3) {
		rollovercom('combox_reiterebene_foren3' , 'combox_reiterebene_foren2', 'combox_reiterebene_foren1')
	}
}

/* End Combox*/

/*Dynabox*/

function eshowdyna(name) {
	var container = document.getElementById(name);
	if (container) container.style.display = "block";
	var button = document.getElementById(name+"_button")
	if (button) button.className = "dynabox_active_"+ name +"_button";
}

function ehidedyna(name) {
	var container = document.getElementById(name);
	if (container) container.style.display = "none";
	var button = document.getElementById(name+"_button");
	if (button) button.className = "dynabox_inactive_"+ name +"_button";
}

function rolloverdyna(a, b, c) {
	eshowdyna(a);
	ehidedyna(b);
	ehidedyna(c);
}

function dynaActive(reiter){
	if(reiter == 1) {
	rolloverdyna('dynabox_reiterebene1' , 'dynabox_reiterebene2', 'dynabox_reiterebene3')
	}
	if(reiter == 2) {
	rolloverdyna('dynabox_reiterebene2' , 'dynabox_reiterebene1', 'dynabox_reiterebene3')
	}
	if(reiter == 3) {
	rolloverdyna('dynabox_reiterebene3' , 'dynabox_reiterebene2', 'dynabox_reiterebene1')
	}
}
/*Dynabox*/

/* Channel Navi Highlighting */

// Make sure that all compared paths end on a slash.
// It does not cause a problem here if a slash is appended to a filename.
function channelNaviHighlight(urls, ids, aufklapp)
{
	var pathname = window.location.pathname;

	if (! pathname.match('/\$')) pathname += '/';

	for (var i = 0; i < urls.length; i++) {
		var url = urls[i];
		if (! url.match('/\$')) url += '/';

		if (url && new RegExp('^' + url).test(pathname)) {
			var item = document.getElementById('c' + ids[i]);
			if (item) {
				var classname = item.className;
				if (classname && ! classname.match('-hl\$')) {
					item.className = classname + '-hl';
				}
			}
			
			var aufklapp = aufklapp[i];
			if (aufklapp != null) {
				var ul = document.getElementById('weiterenavi' + aufklapp);
				if (ul) ul.style.display = 'block';
			}
			break;
		}
	}
}

/* DHTML channel navi for layer on top of wide iframe */

function openMainNavi()
{
	toggleMainNavi('block');
}
function closeMainNavi()
{
	toggleMainNavi('none');
}

function toggleMainNavi(display)
{
	// TODO:
	// In class.ChannelNaviPrinter.php:
	// *add* id="hauptnavi" to div with class="hauptnavi"
	var element = document.getElementById('hauptnavi-dhtml');
	if (!element) return;
	
	var containers = element.getElementsByTagName('div');

	for (var i = 0; i < containers.length; i++) {
		var container = containers[i];

		var class_name = (container.className || '');
		if (class_name == 'hauptnavi') {
			container.style.display = display;
			break;
		}
	}
}

/*
	STANDARD CHANNEL AND FORMAT NAVI FOR sat1xl 
	
	REQUIREMENTS:
	(1) The channelnavi consists of two containers, one for main items, one for all sub-item containers.
	
	Main item ids are n1 ... nX
	sub-item *container* ids are s-n1 ... s-nX
	where 'n' is configurable via 'main_id_prefix'
	
	Both containers must be enclosed in another container with id set via 'container_id'
	
	var cnavi = new sat1xlChannelNavi({active_id: '1', main_id_prefix: 'n', container_id: 'navi-sat1xl-channelnavi'});

	(2) Mouse events
	- All level1 items need:
	onmouseover="cnavi.show(this, event)"
	
	- The two containers for main items and sub-items need:
	onmouseout="cnavi.reset(this, event)"
	
	(3) Highlight active link in channel subnavi and format navi
	cnavi.highlight('s-n7', 'li', 'active');
	cnavi.highlight('navi-sat1xl-level3', 'li', 'active');
*/

function sat1xlNavi(config) {
	this.__container_id   = (config['container_id'] || 'navi-sat1xl-channelnavi');
	this.__main_id_prefix = (config['main_id_prefix'] || 'n');
	this.__active_id      = this.__main_id_prefix + (config['active_id'] || 1);
	this.__current_id     = this.__active_id;
	
	this.show = function(element, e) {
			this.__do(element, e, 1);
		};

	this.reset = function(element, e) {
			this.__do(element, e, 0);
		};

	this.highlight = function(container_id, tagname, classname) {
			var container = document.getElementById(container_id);
			if (!container) return;

			var items = container.getElementsByTagName(tagname);
			if (!items) return;

			var dirname = this.__normalize_path(window.location.pathname);

			var found = '';
			var active_id;

			for (var i = 0; i < items.length; i++) {
				var item = items[i];
				var links = item.getElementsByTagName('a');
				if (!links) continue;

				var href = this.__normalize_path(links[0].href);

				if (dirname.indexOf(href) == 0 && href.length > found.length) {
					active_id = i;
					found = href;
				}
			}

			if (typeof active_id != 'undefined') items[active_id].className = classname;
		};

	/*
		Private methods
	*/
	this.__do = function(element, e, mode) {
			var requested_id;

			if (mode) {
				if (!element.id || element.id == this.__current_id) return;
				requested_id = element.id;
				element.className = 'active';
			}
			else {
				if (this.__contains(this.__container_id, (e.relatedTarget || e.toElement))) return;
				requested_id = this.__active_id;
			}

			if (this.__current_id != this.__active_id) {
				var current_element = document.getElementById(this.__current_id);
				if (current_element) current_element.className = '';
			}

			var subnavi1 = document.getElementById('s-' + requested_id);
			if (subnavi1) subnavi1.style.display = 'block';

			if (this.__current_id != requested_id) {
				var subnavi2 = document.getElementById('s-' + this.__current_id);
				if (subnavi2) subnavi2.style.display = 'none';
			}

			this.__current_id = requested_id;
		};

	this.__contains = function(arg1, arg2) {
			var element1 = typeof arg1 == 'string' ? document.getElementById(arg1) : arg1;
			var element2 = typeof arg2 == 'string' ? document.getElementById(arg2) : arg2;

			var retval = false;
			
			// Test if element1 contains element2
			if (element1.contains) {
				// IE
				retval = element1.contains(element2) ? true : false;
			}
			else {
				while (element2 && element2.parentNode) {
					element2 = element2.parentNode;
					if (element2 == element1) {
						retval = true;
						break;
					}
				}
			}

			return retval;
		};

	this.__normalize_path = function(path) {
			path = path.replace(/index([a-zA-Z0-9_]+)\.php$/, '');
			path = path.replace(new RegExp('^' + location.protocol + '//' + location.hostname), '');
			if (!path.match(/\/$/)) path += '/';
			return path;
		};
}

/*
	annaunddieliebe channel navi
*/

var isGrafikTextNavi = 0;

var disappeardelay=0  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="no" //hide menu when user clicks within menu?

var ie4=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function showhide(obj, e, visible, hidden, menuwidth){
	if (ie4||ns6)
	dropmenuobj.style.left=dropmenuobj.style.top="-400px"
	if (menuwidth!=""){
		dropmenuobj.widthobj=dropmenuobj.style
		dropmenuobj.widthobj.width=menuwidth
	}
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
	obj.visibility=visible
	else if (e.type=="click")
	obj.visibility=hidden
}

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge"){
		var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
		if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
			edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
	}
	else{
		var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
		var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
		if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
			edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
		if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
		edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
		}
	}
	return edgeoffset
}

function populatemenu(what){
	if (ie4||ns6)
	dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth, selected){	
	if (window.event) event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()
	clearhidemenu()
	swapLayer("mainnavi_" + selected, 7, 'class', '', 'class', 'highlighted')	
	dropmenuobj=document.getElementById? document.getElementById("subnavi") : subnavi
	populatemenu(menucontents)

	if (ie4||ns6){
		showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
		dropmenuobj.x=getposOffset(obj, "left")
		dropmenuobj.y=getposOffset(obj, "top")
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
	}
	
	var reg = /(\w.+)_\d/;
  	reg.exec(obj.id);
	
	for (var i = 0; i <= 7; i++) {
		var module1 = RegExp.$1 + '_' + i;
		
		setAttributeForElement(module1, 'class', '');
		if(obj.id == module1)
		{
			setAttributeForElement(obj.id, 'class', 'highlighted');
		}
	}

	setAttributeForElement('mainnavi_' + selected, 'class', 'highlighted');

	return clickreturnvalue()
}

function clickreturnvalue(){
	if (ie4||ns6) return false
	else return true
}

function contains_ns6(a, b) {
	while (b.parentNode)
	if ((b = b.parentNode) == a)
	return true;
	return false;
}

function dynamichide(obj, e, menucontents, menuwidth,selected){
	if (ie4&&!dropmenuobj.contains(e.toElement))
	delayhidemenu(obj, e, menucontents, menuwidth,selected)
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
	delayhidemenu(obj, e, menucontents, menuwidth,selected)
}

function hidemenu(obj, e, menucontents, menuwidth, selected){
	if (typeof dropmenuobj!="undefined"){
	if (ie4||ns6)
		dropdownmenu(obj, e, menucontents, menuwidth, selected)
	}
}

function delayhidemenu(obj, e, menucontents, menuwidth, selected){
	if (ie4||ns6)
	delayhide=setTimeout(function(){hidemenu(obj, e, menucontents, menuwidth, selected)},disappeardelay)
}

function clearhidemenu(){
	if (typeof delayhide!="undefined")
	clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

/*DHTML Übersicht*/
function swapAttributeForElement(id, id1, maxvalue)
{
	maxvalue = maxvalue + 1;
	for (var i=0; i<=maxvalue; i++)
	{
		var id2 = id1 + i;
		setAttributeForElement(id2, 'display', 'none');
	}
	

	setAttributeForElement(id, 'display', 'block');
		
}

function clearHoverTab(selected)
{
	for (var i = 0; i <= 7; i++) {
		
			setAttributeForElement('mainnavi_' + i, 'class', '');
		
	}
	setAttributeForElement(selected, 'class', 'highlighted');
}

/* ViB header teaser */
function flitTeaser(source_id, target_id) {
	var target_teaser = document.getElementById(target_id);

	if (target_teaser) {
		var source_teaser = document.getElementById(source_id);
		if (source_teaser) {
			target_teaser.innerHTML = source_teaser.innerHTML;
		}
	}
}

function eshowdhtml(name) {
if(document.getElementById(name).style.display != "block"){
	document.getElementById(name).style.display = "block";
	var stand = document.getElementById(name+"_button").className;
	document.getElementById(name+"_button").className = stand + "_hover";
}
}

function ehidedhtml(name) {
document.getElementById(name).style.display = "none";
var stand = document.getElementById(name+"_button").className;
stand = stand.split("_");
document.getElementById(name+"_button").className = stand[0];
}

function rolloverdhtml(a, b) {
eshowdhtml(a);
ehidedhtml(b);
}
/*DHTML Übersicht*/

function swapLayer(module, count, firstAttrib, firstValue, secondAtrrib, secondValue)
{
	var reg = /(\w.+)_\d/;
  	reg.exec(module);
		
	for (var i = 0; i <= count; i++) {
		var module1 = RegExp.$1 + '_' + i;

		setAttributeForElement(module1, firstAttrib, firstValue);
	}
	setAttributeForElement(module, secondAtrrib, secondValue);
	
}

/*A-Z Modul*/
function toggleiframe(elem, frame_src)
{
	var iframe = document.getElementById('iframe_az');

	if (!iframe) {
		return;
	}
	
	var item = document.getElementById(elem);
	if (item) {
		if (!is_loaded) {
			iframe.style.height = '0px';
			iframe.src = frame_src;
			is_loaded = 1;
			
		}
		else if (is_loaded == -1) {
			iframe.style.display = 'block';
			is_loaded = 1;
		}
		else if (is_loaded == 1) {
			iframe.style.display = 'none';
			is_loaded = -1;
		}
	}
}

function onloadiframe(iframe, container_id)
{
	var container = document.getElementById(container_id);
	var frame_id = parent.document.getElementById(iframe);
	if (container && frame_id) {
		var height = container.offsetHeight || 620;
		frame_id.style.height = height + 'px';
	}
}

function insertaznavigation(isGrafikTextNavi)
{
	var item = document.getElementById('azisin');

	if (!item) {
		var insert_point = document.getElementById('naviOuter');
		var insert_point1 = document.getElementsByName('slot1');
		if(insert_point || insert_point1)
		{
			var newiframediv = document.createElement("div");
			newiframediv.id = 'az_iframe_container';
			var newiframe = document.createElement("iframe");
			newiframe.style.height = "0px";
			newiframe.style.width = "100%";
			newiframe.id = "iframe_az";
			newiframe.name ="iframe_az";
			newiframe.className = "iframe";
			newiframe.allowTransparency = "true";
			newiframe.scrolling = "no";
			newiframe.frameBorder = "0";

			//Den Link als Kindelement in das "menu" Element hängen
			newiframediv.appendChild(newiframe);
			
			var isFormat = document.getElementById("naviOuter");
			if (isGrafikTextNavi == 1)
			{
				isFormat = 0;
			}
			var isTop = document.getElementById("naviTop");
			if(isFormat)
			{
				if(isTop)
				{
					document.getElementById("mitte").insertBefore(newiframediv, document.getElementById("naviTop"));
				}
				else
				{
					document.getElementById("mitte").insertBefore(newiframediv, document.getElementById("naviOuter"));
				}
					
			}
			else 
			{
				// FIXME: insert_point1 does not necessarily exist.
				if (insert_point1 && insert_point1[0])
					insert_point1[0].appendChild(newiframediv);
			}
		}
	}
}

function closeiframe(elem)
{
	var iframe = parent.document.getElementById('iframe_az');

	if (!iframe) {
		return;
	}
	
	var item = parent.document.getElementById(elem);
	
	if (item) {
		if (parent.is_loaded == -1) {
			iframe.style.display = 'block';
			parent.is_loaded = 1;
		}
		else if (parent.is_loaded == 1) {
			iframe.style.display = 'none';
			parent.is_loaded = -1;
		}
	}
}

/** Flash Newsletter Box**/

function setNewsletterBoxState(state)
{
	if (!state) state = 'closed';
	setAttributeForElement('newsletterbox-inner','class','newsletterbox-inner-' + state);
	return void(0);
}

/* Only IE >= 5.5 and Mozilla can do correct CSS clipping */
function canNewsletterBox() {
	if (window.isType
		&& (isType('popup1', 'tandem')
			|| isType('popup1', 'xxl')
			|| isType('popup1', 'wallpaper'))) return;
	
	var ua = window.navigator.userAgent;

	if (ua.indexOf('Opera') > -1) return;
	if (ua.indexOf('Netscape') > -1) return;

	var found = ua.match(/MSIE ([0-9.]+)/);
	if (found) {
		if (parseFloat(found[1]) < 5.5) return;
		return 1;
	}

	found = ua.match(/Mozilla\/([0-9.]+)/);
	if (found) {
		if (parseFloat(found[1]) < 5.0) return;
		return 1;
	}
	
	return;
}

/**
 * Handles the click on a teaser element.
 */
function teaserclick(trackChannel,trackLink, teaserpfad, teaserlayout,teaserpos, teaserid, linktyp, pHtmlObject, pTargetUrl, pTargetWindowName)
{
	if (storedEvents&&storedEvents!='') sendOMTRData();

	var hasRedirection = typeof(pTargetUrl) != 'undefined';

	// tracking logic:
	// track now if there is no redirection,
	// track on unload if there is a redirection.
	var teaserclickStruct = new Object();
	
	if (trackChannel) {
		// fill tracking structure
		teaserclickStruct.trackChannel = trackChannel;
		teaserclickStruct.trackLink = trackLink;
		teaserclickStruct.teaserpfad = teaserpfad;
		teaserclickStruct.teaserlayout = teaserlayout;
		teaserclickStruct.teaserpos = teaserpos;
		teaserclickStruct.teaserid = teaserid;
		teaserclickStruct.linktyp = linktyp;
		teaserclickStruct.pHtmlObject = pHtmlObject;
		// do the tracking
		if(!hasRedirection) {
			// track now
			teaserclickTracking(teaserclickStruct);
		}
		else {
			// set up unload handler for tracking
			addEvent(window, 'unload', function() {teaserclickTracking(teaserclickStruct);}, false);
		}
	}

	// follow target url if set
	if(typeof(pTargetUrl) != 'undefined') {
		var targetWindowName = (typeof(pTargetWindowName) != 'undefined') ? pTargetWindowName : '_self';
		window.open(pTargetUrl, targetWindowName);
	}
}

/**
 * Does the tracking using the global tracking structure.
 */
function teaserclickTracking(pTeaserclickStruct)
{
	var s=s_gi(s_account);
	s.linkTrackVars='events,products,eVar1';
	s.linkTrackEvents='event5';
	s.events='event5';
	s.products=';'+ pTeaserclickStruct.teaserpos +'|'+ pTeaserclickStruct.teaserid +'|'+ pTeaserclickStruct.teaserlayout +'|'+ pTeaserclickStruct.teaserpfad;
	if (pTeaserclickStruct.trackLink && pTeaserclickStruct.linktyp) s.products=s.products +'|'+ pTeaserclickStruct.linktyp;
	void(s.tl(typeof(pTeaserclickStruct.pHtmlObject) == 'undefined' ? document : pTeaserclickStruct.pHtmlObject,'o','Teaser Click - '+pTeaserclickStruct.teaserid) );
}

var productstring;
function teasercount(teaserpfad, teaserlayout,teaserpos, teaserid)
{
	if (trackChannel){
		if (productstring) {
			productstring=productstring + ',;'+ teaserpos +'|'+ teaserid +'|'+ teaserlayout +'|'+ teaserpfad;
		} else {
			productstring=';'+ teaserpos +'|'+ teaserid +'|'+ teaserlayout +'|'+ teaserpfad;
		}
	}
}

/**
 * Crossbrowser function to add an event handler
 */
function addEvent(obj, eventType, callback, useCaption)
{
  if (obj.addEventListener) {
    obj.addEventListener(eventType, callback, useCaption);
    return true;
  } else if (obj.attachEvent) {
    var retVal = obj.attachEvent("on"+eventType, callback);
    return retVal;
  } else {
    return false;
  }
}

/*
	Mediacenter fallback
*/

function mcShowFallback(obj_id, info_id) {
	var movie = document.getElementById(obj_id);
	if (!movie) return;
	var tagname = movie.tagName.toLowerCase();
	if (tagname != 'object' && tagname != 'embed') {
		var mc_info = document.getElementById(info_id);
		if (!mc_info) return;
		mc_info.style.visibility = 'visible';
	}
}


s_browserInfo = {  
	_widthCategories : [800, 810, 820, 830, 840, 850, 860, 870, 880, 890,
						900, 910, 920, 930, 940, 950, 960, 970, 980, 990,
						1000, 1010, 1020, 1030, 1040, 1050, 1060, 1070, 1080, 1090,
						1100, 1110, 1120, 1130, 1140, 1150, 1160, 1170, 1180, 1190,
						1200, 1210, 1220, 1230, 1240, 1250, 1260, 1270, 1280, 1290,
						1300, 1310, 1320, 1330, 1340, 1350, 1360, 1370, 1380, 1390,
						1400, 1410, 1420, 1430, 1440, 1450, 1460, 1470, 1480, 1490,
						1500, 1510, 1520, 1530, 1540, 1550, 1560, 1570, 1580, 1590,
						1600, 1610, 1620, 1630, 1640, 1650, 1660, 1670, 1680, 1690,
						1700, 1710, 1720, 1730, 1740, 1750, 1760, 1770, 1780, 1790,
						1800],
	_heightCategories : [400, 500, 600, 700, 800, 900, 1000, 1100, 1200],
	_maxPopupWidth : 801, // filter all popups by excluding pages with a smaller viewport than this value
	_assumePopup : -1,
	viewportWidth : "",
	viewportHeight : "",
	flashVersion : "",
	
	getFlashVersion : function() {
		//returns the installed flash version, determined by SWFObject (if available)
		try {
			var fv = deconcept.SWFObjectUtil.getPlayerVersion();
			fv = fv.major + "." + fv.minor + "." + fv.rev;
			this.flashVersion = fv;
			return fv;
		} catch (err) {
			return "";
		}
	},
	
	getViewportWidth : function() {
		// returns the viewport width
		this._calculateSize();
		return this._matchCategories(this.viewportWidth, this._widthCategories);
	},
	
	getViewportHeight : function() {
		//returns the viewport height
		this._calculateSize();
		return this._matchCategories(this.viewportHeight, this._heightCategories);
	},
	
	_calculateSize : function() {
		// calculate the viewport width and height	
		try {			
			this.viewportWidth = window.top.document.documentElement.clientWidth;
			this.viewportHeight = window.top.document.documentElement.clientHeight;
			return true;
		} catch (err) {
			return false;
		}
	},
	
	_matchCategories : function(size, catArray) {
		//matches a calculated size against a given array
		var i = 0;
		var r = "";
		//detect if this is the first call (using viewport width) of this function
		if (this._assumePopup == -1) {
			//check if the current viewport has a smaller width than the estimated maxPopupWidth. 
			//if this is the case assume a popup (requires width categorization before height categorization)
			if (size < this._maxPopupWidth) {
				this._assumePopup = 1;
			} else {
				this._assumePopup = 0;
			}
		}
		if (this._assumePopup < 1) {
			if (typeof size == typeof 2) {
				r = "<= "+catArray[i]; //define the default (smallest) value, example: "<= "+catArray[i]
				while ((size > catArray[i]) && (i < catArray.length)) {
					i++;
				}
				if (i == catArray.length) {
					r = "> "+catArray[i-1];
				} else {
					if (i > 0) {
						r = catArray[i-1] + " - " + (catArray[i]-1);
					}
				}
			} else {
				r = "";
			}
		}
		return r;
	}
}


//Games Formular

function _activate(value,feld) {
	var element = document.getElementById(feld);
	var element2 = document.getElementById(feld + "2");
	var element3 = document.getElementById(feld + "3");	
	if (value == "DE") {	
		element.style.display='block';
		element2.style.display='block';
		element3.style.display='block';
	}
	else {
		element.style.display='none';
		element2.style.display='none';
		element3.style.display='none';
	}
}
