// --- Breadcrump Reader Variablen ---
var bC = [],															//BreadCrumps
	kE = ['Die Sendung','HOME','Archiv','Seitencontainer','Filme'];		//Keyword Blacklist
// --- /Breadcrump Reader Variablen ---

$(function()
{	$('ul').each(function()
	{	if ($('li',this).size()==0)
		{	$(this).remove();
		}
	});
	$('ul#navlist > li').each(function(i){
			if (typeof navlist_active != 'undefined' && navlist_active == i) {
				$(this).find('li').show();
			$(this).attr('id', 'active');
			} else {
			$(this).find('li').hide();
			$(this).removeAttr('id');
		}
	});
	$('ul#navlist > li > a').click(function(){
		if ($(this).parent().attr('id') == 'active') {
			$(this).parent().find('li').hide();
			$(this).parent().removeAttr('id');
		} else {
			$(this).parent().find('li').show();
			$(this).parent().attr('id', 'active');
		}
		return $(this).next('ul').length > 0 ? false : true;
	});
	$('ul#programmlisting > li').each(function(i){
			if (programmlisting_aktuell == i) {
				$(this).find('li').show();
			$(this).find('a.aktuell').addClass('aktuell');
			} else {
			$(this).find('li').hide();
			$(this).find('a.aktuell').removeClass('aktuell');
		}
		});
	$('ul#programmlisting > li > a').click(function(){
		if ($(this).is('.aktuell')) {
			$(this).parent().find('li').hide();
			$(this).removeClass('aktuell');
		} else {
			$(this).parent().find('li').show();
			$(this).addClass('aktuell');
		}
		return $(this).next('ul').length > 0 ? false : true;
	});
	$('.startnewsmiddle').hide();
	$('.startnewsright').hide();
	$('#startnewsmiddle_news').show();
	$('#startnewsright_news').show();
	$('#startnewslist > li > a').click(function(){
		$('#startnewslist > li > a').removeClass('startnewscurrent');
		$(this).addClass('startnewscurrent');
		$('#startmehrnews > a').attr('href', $(this).attr('href'));
		$('.startnewsmiddle').hide();
		$('.startnewsright').hide();
		$('#startnewsmiddle_' + $(this).attr('name')).show();
		$('#startnewsright_' + $(this).attr('name')).show();
		return false;
	});

	// Yahoo-Suche
	if (typeof(Ytop5) != "undefined" && Ytop5 != '' )
	{	$('#YT5').attr('src','http://www.rtl2.de/Y/'+Ytop5+'.html');
	}
	// /Yahoo-Suche

	// Breadcrump Reader
	$('#statusbar li').each(function()
	{	var bCtmp = $(this).text();
		if (bCtmp)
		{	bC.push($.trim(bCtmp).replace(/[^a-zA-Z0-9]+/g,'-'));
		}
	});

	bC.shift();			// Home loeschen
	if (bC.length>0)
	{	var tmp=bC;bC=[];
		for (var i=0; i<tmp.length; i++)
		{	if (!inArray(kE,tmp[i]))
			{	bC.push(tmp[i]);
			}
		}

		switch (bC.length)
		{	case 0:
				break;
			case 1:
				et_areas = escape(bC.pop());
				et_pagename = et_areas+'-Gabelseite';
				break;
			default:
				et_pagename = escape(bC.pop());
				et_areas = escape(bC.join('/'));
		}

		var xL	= et_areas.length;
		if (xL>60)
		{	et_areas=et_areas.substr((xL-60),60);
		}
	}
	// /Breadcrump Reader

	// Klicktracker
	/*$('a[href^="http://"],a[href$=".pdf"],a[href$=".zip"]').each(function()
	{	var eL	= $(this).attr('href'),
			eT	= $(this).attr('title'),
			iM	= $(this).find('img[alt]');

		if (iM.size() == 1 )
		{	iM = iM.attr('alt');
		}
		$(this).attr('href','http://www.etracker.de/lnkcnt.php?et=k3Kzyx&url='+escape(eL)+'&amp;lnkname='+escape(eT||iM||eL));
	});*/
});

function inArray(array,key)
{	for (var i=0; i<array.length; i++)
	{	if (array[i].toLowerCase() == key.toLowerCase())
		{	return true;
		}
	}
	return false;
}