/**
 * String prototype
 */
String.prototype.format = function(){
	var temp = this;
	for(i = 0; i < arguments.length; i++)	{
	    temp = temp.replace('{' + (i) + '}', arguments[i]);
	}
	return temp;
}

var searchValue='Suchbegriff, WKN';

var ugcConfig = {
	'actionPath' : '/ugc/'
};

var ugcLogger = function() {
	var _logger = window.console;
	return {
		log : function (message){
			if(_logger){
				_logger.log(message);
			}
		}
	}
}();

window.addEvent('domready',function(){

	// allgemeines hover für ie6
	if(checkBrowserName('MSIE 6')) {
		$$('.iehover').addEvent('mouseenter', function (e) {
			this.addClass('hover');
		}).addEvent('mouseleave', function (e) {
			this.removeClass('hover');
		});
	}


	$$('.openOnClick').addEvent('click', function (e) {
		this.addClass('layerActive');
		new Event(e).stop();
	}).addEvent('mouseleave', function (e) {
		this.removeClass('layerActive');
	});

	// Safari nur mit sans-serif (ohne Arial, weil Bold Arial im Safari leider zuuu Bold ist)
	if(checkBrowserName('Safari'))
	{
		$$('body').setStyle('font-family','sans-serif');
		$$('table').setStyle('font-family','sans-serif');
		$$('textarea').setStyle('font-family','sans-serif');
	}


	// Suchfunktionen definieren
    if ($('search_oben'))
    {
        $('search_oben').addEvent('keyup',function(e)
        {
            var event=new Event(e);
            if (event.code==13)
            {
                $('f_search_oben').submit();
                return false;
            }
        });
    }
    if ($('search_unten'))
    {
        $('search_unten').addEvent('keyup',function(e)
        {
            var event=new Event(e);
            if (event.code==13)
            {
                $('f_search_unten').submit();
                return false;
            }
        });
    }
    if ($('search_form') && $('search') && $('ss0'))
    {
		var suchbegriff=GetParam('s');
		var suchenach=GetParam('suchenach');
		if(suchbegriff!='')
		{
    		if(suchenach=='g')
            {
    			$('search_form').setProperty('action','http://www.N24.de/service/suche.php');
    			$('search_button').setProperty('name','sa');
    			$('search').addClass('google');
            }
			$('search').value=decodeURI(suchbegriff.replace(/\+/g,' '));
		}

		$('ss0').addEvent('click',function()
		{
			$('search_form').setProperty('action','http://www.N24.de/service/suche.php');
			$('search_button').setProperty('name','sa');
			$('search').addClass('google').focus();
		});
		$('ss1').addEvent('click',function()
		{
			$('search_form').setProperty('action','http://www.N24.de/service/suche.php');
			$('search_button').removeProperty('name');
			//$('search_button').removeProperty('value');
			$('search').removeClass('google').focus();
		});

        $('search_form').addEvent('submit',function(e)
        {
			var event=new Event(e);
			if ($('search').value=='' || $('search').value==searchValue)
            {
                event.stop();
                alert('Bitte geben Sie einen Suchbegriff ein.');
                $('search').focus();
            }
        });

    	$('search').addEvent('focus',function(e)
    	{
    		if ($('search').value==searchValue)
    		{
    			$('search').value='';
    		}
    		$('search').select();
    	});
    	$('search').addEvent('blur',function(e)
    	{
    		if ($('search').value=='' && $('ss1').checked)
    		{
    			$('search').value=searchValue;
    		}
    	});
    }
    else if ($('search'))
    {
    	$('search').addEvent('focus',function(e)
    	{
    		if ($('search').value=='Suchbegriff, WKN')
    		{
    			$('search').value='';
    		}
    		$('search').select();
    	});
    	$('search').addEvent('blur',function(e)
    	{
    		if ($('search').value=='')
    		{
    			$('search').value='Suchbegriff, WKN';
    		}
    	});
    }


	// EPG Funktionen definieren
	if (typeof TagesBereich=='object')
	{
		SetEPGView();
		$$('#tb_wahler a').addEvent('click',function(e)
		{
			var event=new Event(e);
			if (this.hasClass('selected'))
			{
				event.stop();
				this.removeClass('selected');
				TagesBereich[this.getProperty('id').replace(/b/,'')]=0;
			}
			else
			{
				this.addClass('selected');
				TagesBereich[this.getProperty('id').replace(/b/,'')]=1;
			}
			SetEPGView();
		});

		$$('#epg tbody tr td.click').addEvent('click',function()
		{
			var parent_click=this.getParent();
			if(parent_click.hasClass('selected')) /* Schliessen */
			{
				parent_click.removeClass('selected');
			}
			else /* Aufklappen */
			{
				parent_click.addClass('selected');
			}
			trackIVW();
			SetEquidistance();
		});
	}

    // Videoplayer Standardhoehe ohne JS (auto) auf 1px setzen
    $$('.videoplayer').each(function(item,index)
    {
        if (item.getStyle('height')=='auto')
        {
            item.setStyle('height','1px');
        }
    });
    if($('videoplayer'))
    {
        if ($('videoplayer').getStyle('height')=='auto')
        {
            $('videoplayer').setStyle('height','1px');
        }
    }

	if($('profil'))
    {
        if($$('.showmore') && $$('.more'))
        {
            $$('.more').setStyle('display','none');
            $$('.showmore').setStyle('display','block');
            $$('.showmore').addEvent('click',function(e)
            {
                var event=new Event(e);
                event.stop();
                $$('.more').each(function(item,index)
                {
                    window.setTimeout('ShowMoreComments('+index+');',(index*150));
                });
                var myFx=new Fx.Style($$('.showmore')[0],'opacity').set(1);
                $$('.showmore')[0].effect('opacity',
                {
                	duration:($$('.more').length*100),onComplete:function()
	                {
	                	$$('.showmore').setStyle('display','none');
	                	SetEquidistance();
	                },transition:Fx.Transitions.Quad.easeOut
	            }).start(1,0);
            });
        }

		if($('edit_profile'))
        {
            $('edit_profile').addEvent('click',function(e)
            {
                var event=new Event(e);
                event.stop();

				if ($('acknowledge')) {
					$('acknowledge').setStyle('display', 'none');
					$('acknowledge_field').setStyle('display', 'none');
				}

                if($('pedit').getStyle('display')=='none')
                {
                    var myFx=new Fx.Style('pedit','opacity').set(0);
                    var myFx=new Fx.Style('h2_pedit','opacity').set(0);
                    $('pedit').setStyle('display','block');
                    $('h2_pedit').setStyle('display','block');
                    $('spacer_content').setStyle('height','1px');
                    $('pedit').effect('opacity',
                    {
                    	duration:1000,onComplete:function()
                    	{
                    		SetEquidistance();
                    	},transition:Fx.Transitions.Quad.easeIn
                    }).start(0,1);
                    $('h2_pedit').effect('opacity',
                    {
                    	duration:1000,onComplete:function()
                    	{
                    		SetEquidistance();
							document.location.hash = "h2_pedit";

                    	},transition:Fx.Transitions.Quad.easeIn
                    }).start(0,1);
                }
                else
                {
                    var myFx=new Fx.Style('pedit','opacity').set(1);
                    var myFx=new Fx.Style('h2_pedit','opacity').set(1);
                    $('spacer_content').setStyle('height','1px');
                    $('pedit').effect('opacity',
                    {
                    	duration:1000,onComplete:function()
                    	{
                    		$('pedit').setStyle('display','none');
                    		SetEquidistance();
                    	},transition:Fx.Transitions.Quad.easeIn
                    }).start(1,0);
                    $('h2_pedit').effect('opacity',
                    {
                    	duration:1000,onComplete:function()
                    	{
                    		$('h2_pedit').setStyle('display','none');
                    		SetEquidistance();
                    	},transition:Fx.Transitions.Quad.easeIn
                    }).start(1,0);
                }
            });

			if ($('delete_user_question')) {
	            $('delete_user_question').addEvent('click',function(e)
	            {
	                var event=new Event(e);
	                event.stop();
	                if($('delete_user').getStyle('display')=='none')
	                {
	                    var myFx=new Fx.Style('delete_user','opacity').set(0);
	                    $('delete_user').setStyle('display','block');
	                    $('delete_user').effect('opacity',
	                    {
	                    	duration:500,transition:Fx.Transitions.Quad.easeIn
	                    }).start(0,1);
	                }
	                else
	                {
	                    $('delete_user').effect('opacity',
	                    {
	                    	duration:500,onComplete:function()
	                    	{
	                    		$('delete_user').setStyle('display','none');
	                    	},transition:Fx.Transitions.Quad.easeIn
	                    }).start(1,0);
	                }
	            });
	            $$('.user_delete_exit').addEvent('click',function()
	            {
					$('delete_user').effect('opacity',
					{
						duration:500,onComplete:function()
						{
							$('delete_user').setStyle('display','none');
						},transition:Fx.Transitions.Quad.easeIn
					}).start(1,0);
	            });
	            $$('.user_delete_ok').addEvent('click',function()
	            {
	                $('delete_user').effect('opacity',
	                {
	                	duration:500,onComplete:function()
	                	{
	                		$('delete_user').setStyle('display','none');
	                	},transition:Fx.Transitions.Quad.easeIn
	                }).start(1,0);
	            });
	        }
		}
    }
});

var chooser=new Object();
var AktuelleNews=0;
var AnzahlNews=1;
var NewsTimeOutID=0;

window.addEvent('load',function()
{

	// Stichwortmodul Funktionen definieren
		$$('.glossarcontent').addEvent('click',function(e)
		{
			var event=new Event(e);
			if(this.hasClass('glossaropen')) /* aufgeklappte Schliessen */
			{
				if(!event.control) /* alle oder nur diesen? */
				{
					$$('.glossaropen').addClass('glossarcontent').removeClass('glossaropen');
				}
				this.addClass('glossarcontent').removeClass('glossaropen');
			}
			else /* Aufklappen */
			{
				if(!event.control) /* zusaetzlich aufklappen? */
				{
					$$('.glossaropen').addClass('glossarcontent').removeClass('glossaropen');
				}
				this.addClass('glossaropen').removeClass('glossarcontent');
			}
			trackIVW();
			SetEquidistance();
		});

	// jedes 1. von 2 half_content Elementen als neuen Absatz definieren
	if($$('#content .half_content'))
	{
		var i=1;
		$$('#content .half_content').each(function(item,index)
		{
			if(item.getParent().getProperty('id')=='content')
			{
				if((i%2)==1)
				{
					item.setStyle('clear','left');
                    try
                    {
                    	/* eventhandler gingen im ie verloren beim neusetzen des html */
						item.parentNode.insertBefore(new Element('div', {'class': 'clear'}), item);

                    }
                    catch(e){}
				}
				i++;
			}
		});
	}

	// Blaetterelemente anzeigen (Serien, Nachrichten, etc.)
	$$('span.waehler').setStyle('display','inline');
	$$('.headline .rechts').setStyle('display','inline');

	// Nachrichten-, Serienelemente ausblenden (ausser 1.)
	var HidableClasses = new Array('nachrichten','teaser','teaser_v2','tsr_double_horizontal','tsr_double_horizontal_v2','kommentare','tsr_double');
	HidableClasses.each(function(hc_item,hc_index)
	{
		$$('.'+hc_item).getChildren().each(function(item,index)
		{
			HideElements(item);
		});
	});

	// Bildvergroesserung/-kleinerung
    $$('.news_img').addEvent('click',function(e)
    {
	    var mylocation = location.host;
	    var myivwurl = "http://n24.ivwbox.de/cgi-bin/ivw/CP/";
	    if(mylocation.toLowerCase() == "www.n24.at")
	    {
	         var myivwurl = "http://n24.ivwbox.de/cgi-bin/ivw/CP/";
	    }
	    if(mylocation.toLowerCase() == "www.n24.ch")
	    {
	        var myivwurl = "http://n24.wemfbox.ch/cgi-bin/ivw/CP/";
	    }

  		param1 = Exo_Ivw.getAgof();
	  	param2 = Exo_Ivw.getRessort();
	    param3 = document.title;
	    var mystring = "";
	    mystring = param1+";/"+param2+"/"+param3;

        if(this.hasClass('news_img'))
        {
          this.removeClass('news_img').addClass('news_img_big');
	      mystring = mystring+"/absatzbild";
        }
        else
        {
          this.removeClass('news_img_big').addClass('news_img');
    	}
        SetEquidistance();
	    var IVW = myivwurl+""+mystring;
		var zeit="&zeit="+new Date().getTime();
	    var IVWSTRING = ""+IVW+"?r="+escape(document.referrer)+zeit;
	    document.trackingcallimage.src=IVWSTRING;
    });

	// Breaking News Rotation inkl. Unterbrechung bei Mouseover
    if(typeof BreakingNews=='object' && $('breaking_news'))
    {
		AnzahlNews=BreakingNews.length;
    	NewsTimeOutID=window.setTimeout('ChangeBreakingNews();',NewsDauer);
    	$('breaking_news').addEvent('mouseenter',function()
    	{
    		window.clearTimeout(NewsTimeOutID);
    	});
    	$('breaking_news').addEvent('mouseleave',function()
    	{
    		window.clearTimeout(NewsTimeOutID);
	    	NewsTimeOutID=window.setTimeout('ChangeBreakingNews();',NewsDauer);
    	});
    }

	if ($('s2f_form')) {
		$('s2f_form').addEvent('submit', function(e) {
			new Event(e).stop();

			var s2f_fehler = false;

			if ($('s2f_user').getProperty("value") == "") {
				$('s2f_user').addClass("fehler");
				s2f_fehler = true;
			} else {
				$('s2f_user').removeClass("fehler");
			}

			if ($('s2f_mail').getProperty("value") == "") {
				$('s2f_mail').addClass("fehler");
				s2f_fehler = true;
			} else {
				$('s2f_mail').removeClass("fehler");
			}

			if (s2f_fehler) {
				return false;
			}

			var log = $('s2f_loading').setHTML('ajax-loading');

			this.send({
				update: log,
				onComplete: function() {

					hideForm('send2friend_form', 'send2friend');

				}
			});
		});
	}

	if ($('registerForm')) {
		$('registerForm').addEvent('submit', function(e) {
			new Event(e).stop();
			var register_fehler = false;
			var first_error = "";
			if ($('register_salutation').getProperty("value") == "-1") {
				$('register_salutation').setProperty("class","half fehler");
				$('label_register_salutation').setProperty("class","fehler");
				$('error_salutation').setProperty("class","fehler");
				register_fehler = true;

				if (first_error == "") {
					first_error = "maindata";
				}

			} else {
				$('register_salutation').setProperty("class","half kein_fehler");
				$('label_register_salutation').setProperty("class","kein_fehler");
				$('error_salutation').setProperty("class","kein_fehler");
			}

			if ($('register_firstname').getProperty("value") == "") {
				$('register_firstname').setProperty("class","fehler");
				$('label_register_firstname').setProperty("class","fehler");
				$('error_names').setProperty("class","fehler");
				register_fehler = true;

				if (first_error == "") {
					first_error = "maindata";
				}

			} else {
				$('register_firstname').setProperty("class","kein_fehler");
				$('label_register_firstname').setProperty("class","kein_fehler");
				$('error_names').setProperty("class","kein_fehler");
			}

			if ($('register_lastname').getProperty("value") == "") {
				$('register_lastname').setProperty("class","fehler");
				$('label_register_lastname').setProperty("class","fehler");
				$('error_names').setProperty("class","fehler");
				register_fehler = true;

				if (first_error == "") {
					first_error = "maindata";
				}
			} else {
				$('register_lastname').setProperty("class","kein_fehler");
				$('label_register_lastname').setProperty("class","kein_fehler");
				$('error_names').setProperty("class","kein_fehler");
			}

			$('error_username_invalid').setProperty("class","kein_fehler");
			$('error_username_forgiven').setProperty("class","kein_fehler");

			$('error_email_forgiven').setProperty("class","kein_fehler");

			if ($('register_email').getProperty("value") == "") {
				$('register_email').setProperty("class","fehler");
				$('label_register_email').setProperty("class","fehler");
				$('error_email').setProperty("class","fehler");
				register_fehler = true;

				if (first_error == "") {
					first_error = "maindata";
				}
			} else {
				$('register_email').setProperty("class","kein_fehler");
				$('label_register_email').setProperty("class","kein_fehler");
				$('error_email').setProperty("class","kein_fehler");
			}

			if ($('register_username').getProperty("value") == "") {
				$('register_username').setProperty("class","fehler");
				$('label_register_username').setProperty("class","fehler");
				$('error_username').setProperty("class","fehler");
				register_fehler = true;

				if (first_error == "") {
					first_error = "maindata";
				}
			} else {
				$('register_username').setProperty("class","kein_fehler");
				$('label_register_username').setProperty("class","kein_fehler");
				$('error_username').setProperty("class","kein_fehler");
			}

			if ($('register_password').getProperty("value") == "") {
				$('register_password').setProperty("class","fehler");
				$('label_register_password').setProperty("class","fehler");
				register_fehler = true;

				if (first_error == "") {
					first_error = "maindata";
				}
			} else {
				$('register_password').setProperty("class","kein_fehler");
				$('label_register_password').setProperty("class","kein_fehler");
			}

			if ($('register_repassword').getProperty("value") == "") {
				$('register_repassword').setProperty("class","fehler");
				$('label_register_repassword').setProperty("class","fehler");
				register_fehler = true;

				if (first_error == "") {
					first_error = "maindata";
				}
			} else {
				$('register_repassword').setProperty("class","kein_fehler");
				$('label_register_repassword').setProperty("class","kein_fehler");
			}

			if ($('register_repassword').getProperty("value") != $('register_password').getProperty("value") ) {
				$('register_password').setProperty("class","fehler");
				$('label_register_password').setProperty("class","fehler");
				$('register_repassword').setProperty("class","fehler");
				$('label_register_repassword').setProperty("class","fehler");
				register_fehler = true;

				if (first_error == "") {
					first_error = "maindata";
				}
			}

			if ($('register_repassword').getProperty("value") == "" || $('register_password').getProperty("value") == "") {
				$('error_password_invalid').setProperty("class","fehler");

				if (first_error == "") {
					first_error = "maindata";
				}
			} else {
				$('error_password_invalid').setProperty("class","kein_fehler");
				if ($('register_repassword').getProperty("value") != $('register_password').getProperty("value") ) {
					$('error_pws').setProperty("class","fehler");
				} else {
					$('error_pws').setProperty("class","kein_fehler");
				}
			}

			if ($('register_mobile').getProperty("value") != '' ) {

				if ($('register_mobile').getProperty("value").match(/[0-9+ )(-]+/) != $('register_mobile').getProperty("value")) {
					$('register_mobile').setProperty("class","d2 fehler");
					$('error_register_mobile').setProperty("class","fehler");
					register_fehler = true;

					if (first_error == "") {
						first_error = "privatedata";
					}
				} else {
					$('register_mobile').setProperty("class","d2");
					$('error_register_mobile').setProperty("class","kein_fehler");
				}
			} else {
				$('register_mobile').setProperty("class","d2");
				$('error_register_mobile').setProperty("class","kein_fehler");
			}

			if ($('register_captcha').getProperty("value") == "" ) {
				$('register_captcha').setProperty("class","d2 fehler");
				$('label_register_captcha').setProperty("class","fehler");
				$('error_label_captcha').setProperty("class", "fehler");
				register_fehler = true;
				if (first_error == "") {
					first_error = "privatedata";
				}
			} else {
				$('register_captcha').setProperty("class","d2 kein_fehler");
				$('label_register_captcha').setProperty("class","kein_fehler");
				$('error_label_captcha').setProperty("class", "kein_fehler");
			}

			if (register_fehler) {
				if (first_error != "")
					document.location.hash = first_error;

				return false;
			}

			$('registerForm').submit();
		});
	}


	if($('send2friend')) {
		$$('a.sendEmail').addEvent('click',function(e) {
			var e = new Event(e).stop();
			var sendLink = this;
			var send2friend_form = $('send2friend_form');

					var top = sendLink.getPosition().y - $('main').getPosition().y;
					if (!sendLink.hasClass('formBelow')) {
						 top -= 310; // margin-top von #main und hoehe des form
					}
					send2friend_form.setStyle('top', top + 'px');

			return false;
		}).each(function (link) {
			bindFormLinks('send2friend_form', link);
		});


	}

	if ($('profileForm')) {
		$('profileForm').addEvent('submit', function(e) {

			e = new Event(e).stop();

			var first_error = "";

			if ($('submit_type').getProperty('value') == 'deleteImage' || $('submit_type').getProperty('value') == 'submitImage') {
				$('profileForm').submit();
				return false;
			}

			var profile_error = false;

			if ($('firstname').getProperty('value') == '') {
				setErrorFirstname();
				profile_error  = true;

				if (first_error == "")
					first_error = "label_firstname";

			} else {
				setOkFirstname();
			}

			if ($('lastname').getProperty('value') == '') {
				setErrorLastname();
				profile_error  = true;

				if (first_error == "")
					first_error = "label_lastname";

			} else {
				setOkLastname();
			}

			if (profile_error) {
				$('error_names').setProperty('class', 'fehler');
				profile_error  = true;
			} else {
				$('error_names').setProperty('class', 'kein_fehler');
			}
//
			if (($('profile_password').getProperty('value') != '' ||
				$('profile_repassword').getProperty('value') != '') &&
				($('profile_password').getProperty('value') != $('profile_repassword').getProperty('value'))) {

				if (first_error == "")
					first_error = "label_password";

				setErrorPassword();
				$('error_pws').setProperty('class', 'fehler');
				$('error_pw_tooweak').setProperty('class', 'kein_fehler');
				$('error_password_notvalid').setProperty('class', 'kein_fehler');
				profile_error  = true;

			} else {

				if (($('profile_password').getProperty('value') != '' ||
					$('profile_repassword').getProperty('value') != '') && $('profile_password').getProperty('value').length < 4) {

					if (first_error == "")
						first_error = "label_password";

					setErrorPassword();
					$('error_pws').setProperty('class', 'kein_fehler');
					$('error_pw_tooweak').setProperty('class', 'fehler');
					$('error_password_notvalid').setProperty('class', 'kein_fehler');
					profile_error = true;
				} else {
					$('error_pws').setProperty('class', 'kein_fehler');
					$('error_pw_tooweak').setProperty('class', 'kein_fehler');
					$('error_password_notvalid').setProperty('class', 'kein_fehler');
					setOkPassword();
				}

			}

			if ($('mobile').getProperty("value") != '' ) {

				if ($('mobile').getProperty("value").match(/[0-9+ )(-]+/) != $('mobile').getProperty("value")) {
					$('mobile').setProperty("class","d2 fehler");
					$('error_profile_mobile').setProperty("class","fehler");
					profile_error = true;

					if (first_error == "") {
						first_error = "privatedata";
					}
				} else {
					$('mobile').setProperty("class","d2");
					$('error_profile_mobile').setProperty("class","kein_fehler");
				}
			} else {
				$('mobile').setProperty("class","d2");
				$('error_profile_mobile').setProperty("class","kein_fehler");
			}

			$('birthday_label').setProperty('class', '');
			$('error_birthday').setProperty('class', 'kein_fehler');
			$('birthday').setProperty('class', '');
			$('birthmonth').setProperty('class', '');
			$('birthyear').setProperty('class', '');

			if (!profile_error ) {
				$('profileForm').submit();
			} else {
				if (first_error != "")
					document.location.hash = first_error;
			}
		});
	}

   	SetEquidistance();
   	window.setTimeout('SetEquidistance();',300); // der IE ist manchmal recht langsam und braucht eine 2.Chance ;-)

    $$('body').setStyle('padding','0px');
    $$('body').setStyle('margin','0px');

	// Werbeeinblendungen pruefen
   	window.setTimeout('AdControlling();',1000);
});

function AdControlling()
{
	var moveSite=true;
    var moveRectangles=true;
    var movePromoboxes=true;
    var noadmove=false;

	var regex = /<(?:!(?:--[\s\S]*?--\s*)?(>)\s*|(?:script|style|SCRIPT|STYLE)[\s\S]*?<\/(?:script|style|SCRIPT|STYLE)>)/g;

	if(window.location.host != "developmentn24.ariva.de" && window.location.host != "boerse.n24.de" )
	{
		if ($('SOI_TAG_T_rectangle1'))
		{
			if ($('RT1') && (!$('soi_span_rectangle1') || $('soi_span_rectangle1').innerHTML.replace(regex,'')=='' || soi_adtrace.indexOf('rectangle1%20-%20fallback') != -1))
			{
				$('RT1').getParent().setStyle('display','none');
			}
		}
 	}

    // Fullbanner Platzhalter ausblenden, damit man auch auf die Werbung draufklicken kann
    if ($('FB2'))
    {
        $('FB2').setStyle('display','none');
    }
    // Skyscraper Platzhalter ausblenden, damit man auch auf die Werbung draufklicken kann
    if ($('SC1'))
    {
        $('SC1').setStyle('display','none');
    }

	// Alle aufeinander folgenden (1,2,3, etc.) Rectangle ADs korrekt positionieren
	var rt_var = 1;
	while (moveRectangles==true && $('div_rectangle'+rt_var) && $('RT'+rt_var))
	{
        $('RT'+rt_var).setHTML('').setProperty('class','').setProperty('style','');
        $('div_rectangle'+rt_var).setProperty('class','').setProperty('style','').injectInside('RT'+rt_var);
		rt_var++;
	}


	// Alle aufeinander folgenden (1,2,3, etc.) PromoBoxs korrekt positionieren
	var pb_var = 1;
	while (movePromoboxes==true && $('div_promo'+pb_var) && $('PB'+pb_var))
	{
        if($('soi_span_promo'+pb_var) && $('soi_span_promo'+pb_var).innerHTML.replace(regex,'')!='' && soi_adtrace.indexOf('promo' + pb_var + '%20-%20fallback') == -1)
        {
            $('PB'+pb_var).setHTML('').setProperty('class','').setProperty('style','');
            $('div_promo'+pb_var).setProperty('class','').setProperty('style','').injectInside('PB'+pb_var);
        }
        else
        {
            $('PB'+pb_var).setStyle('display','none');
            $('div_promo'+pb_var).setStyle('display','none');
        }
		pb_var++;
	}



	if (moveSite==true && $('div_fullbanner2'))
	{
		if (!$('soi_span_fullbanner2') || $('soi_span_fullbanner2').innerHTML.replace(regex,'')=='')
		{
			if ($('hstick_anzeige')) $('hstick_anzeige').setStyle('display','none');
			if ($('FB2')) $('FB2').setStyle('display','none');
			if ($('header')) $('header').setStyle('top','15px');
			if ($('player'))
			{
				// Home
				if ($('breadcrumb'))
				{
					$('player').setStyle('top','189px');
					if ($('main')) $('main').setStyle('top','601px');
				}
				else
				{
					if(noadmove && noadmove == 1)
					{
						$('player').setStyle('top','0px');
						if ($('main')) $('main').setStyle('top','0px');
					}
					else
					{
						$('player').setStyle('top','156px');
						if ($('main')) $('main').setStyle('top','518px');
					}
				}
			}
			else
			{
				if ($('teletext_body'))
				{
					// IFrame Rahmen
					if ($('breadcrumb'))
					{
						$('teletext_body').setStyle('top','199px');
					}
					else
					{
						$('teletext_body').setStyle('top','156px');
					}
				}
				else
				{
					// Subhome
					if ($('breadcrumb'))
					{
						if ($('main')) $('main').setStyle('top','194px');
					}
					else
					{
						if ($('main')) $('main').setStyle('top','161px');
					}
				}
			}
			if ($('animlogo'))
            {
                try
                {
                    $('animlogo').setStyle('top','0px');
                }
                catch(e)
                {
                    document.getElementById('animlogo').style.top='0px';
                }
            }
		}
	}

	SetEquidistance();
}

function ShowMoreComments(index)
{
	var myFx=new Fx.Style($$('.more')[index],'opacity').set(0);
	$$('.more')[index].setStyle('display','block');
	$$('.more')[index].effect('opacity',
	{
		duration:500,onComplete:function()
		{
			SetEquidistance();
		},transition:Fx.Transitions.Quad.easeIn
	}).start(0,1);
}

function ShowFullKommentar(element)
{
    // Ganzen Beitrag anzeigen
    element.getParent().getChildren().each(function(item,index)
    {
        if(item.tagName=='I')
        {
            item.getChildren().each(function(item2,index2){
                if(item2.hasClass('ugc_continue'))
                {
                    item2.addClass('ugc_disabled').removeClass('ugc_continue');
                }
                else if(item2.hasClass('ugc_disabled'))
                {
                    item2.addClass('ugc_continue').removeClass('ugc_disabled');
                }

                if(item2.hasClass('ugc_player_a'))
                {
                    if(item2.getStyle('display')=='block')item2.setStyle('display','none');
                    else item2.setStyle('display','block');
                }
            });
        }
        if(item.tagName=='A' && item.getProperty('href')==null)
        {
            if(item.getText()=='Kurzfassung anzeigen')
            {
                item.setText('Ganzen Beitrag anzeigen');
            }
            else
            {
                item.setText('Kurzfassung anzeigen');
            }
        }
    });
    SetEquidistance();
}

function HideFullKommentar(element)
{
    ShowFullKommentar($(element).getParent().getParent());
}

function ChangeBreakingNews()
{
	AktuelleNews++;
	if((AktuelleNews+1)>AnzahlNews)AktuelleNews=0;
	var fx=new Fx.Styles($('breaking_news'),
	{
		duration:NewsEffektDauer,onComplete:function()
		{
			$$('#breaking_news span').setHTML(BreakingNews[AktuelleNews]['text']);
			$('breaking_news').setProperty('href',BreakingNews[AktuelleNews]['link']);
			var fx_back=new Fx.Styles($('breaking_news'),
			{
				duration:NewsEffektDauer
			});
			fx_back.start(
			{
				color:'#FFFFFF'
			});
		}
	});
	fx.start(
	{
		color:'#D70302'
	});
   	NewsTimeOutID=window.setTimeout('ChangeBreakingNews();',NewsDauer);
}

function SetEquidistance()
{
	/* Aequidistanz von Content- und Marginalspalte herstellen */
	if($('spacer_marginal') && $('spacer_content'))
	{
		$('spacer_content').setStyle('height','1px');
		$('spacer_marginal').setStyle('height','1px');
		var y1=$('spacer_content').getPosition().y;
		var y2=$('spacer_marginal').getPosition().y;
		if(y1>=y2)
		{
			var new_h=y1-y2+1;
			$('spacer_marginal').setStyle('height',new_h+'px');
		}
		else
		{
			var new_h=y2-y1+1;
			$('spacer_content').setStyle('height',new_h+'px');
		}
	}
}

function Next(parent_id,id)
{
	if(typeof chooser[id]!='object')InitParentChooser(parent_id);
	chooser[id]['sichtbar']++;
	var anzahl=chooser[id]['objects'].length;
	if(chooser[id]['sichtbar']>(anzahl-1))chooser[id]['sichtbar']=0;
	chooser[id]['objects'].each(function(item,index)
	{
        if(index==chooser[id]['sichtbar'])item.setStyle('display','block');
		else item.setStyle('display','none');
	});

	chooser[id]['wahl'].setHTML(formatLeadingZero(chooser[id]['sichtbar']+1)+' von '+formatLeadingZero(chooser[id]['anzahl']));
	if(chooser[id]['wahl_2']) chooser[id]['wahl_2'].setHTML(formatLeadingZero(chooser[id]['sichtbar']+1)+' von '+formatLeadingZero(chooser[id]['anzahl']));
	SetEquidistance();
}

function Last(parent_id,id)
{
	if(typeof chooser[id]!='object')InitParentChooser(parent_id);
	chooser[id]['sichtbar']--;
	var anzahl=chooser[id]['objects'].length;
	if(chooser[id]['sichtbar']<0)chooser[id]['sichtbar']=anzahl-1;
	chooser[id]['objects'].each(function(item,index)
	{
		if(index==chooser[id]['sichtbar'])item.setStyle('display','block');
		else item.setStyle('display','none');
	});
	chooser[id]['wahl'].setHTML(formatLeadingZero(chooser[id]['sichtbar']+1)+' von '+formatLeadingZero(chooser[id]['anzahl']));
	if(chooser[id]['wahl_2'])chooser[id]['wahl_2'].setHTML(formatLeadingZero(chooser[id]['sichtbar']+1)+' von '+formatLeadingZero(chooser[id]['anzahl']));
	SetEquidistance();
}

function InitParentChooser(parent_id)
{
	if($(parent_id))
	{
		var id='';
		var anzahl=0;
		var parent_obj=$$($(parent_id)).getChildren()[0];
		var obj_arr=new Array();
	    parent_obj.each(function(item,index)
	    {
	    	if(item.id!='')
	    	{
	    		id=item.id.split('_')[0];
	    		anzahl++;
	    		obj_arr.push(item);
	   		}
		});
		chooser[id]=new Object();
		chooser[id]['sichtbar']=0;
		chooser[id]['anzahl']=anzahl;
		chooser[id]['objects']=obj_arr;
		chooser[id]['wahl']=$(parent_id+'_wahl');
		if($(parent_id+'_wahl_2'))chooser[id]['wahl_2']=$(parent_id+'_wahl_2');
    }
}

function formatLeadingZero(param) {
    var pNum=Number(param);
    var fVal=pNum;
    if((pNum)<10){
        fVal='0'+pNum;
    }
    return fVal;
}

function GetScreenSize()
{
	var ScreenSize = new Object();
	ScreenSize['window']=new Object;
	ScreenSize['screen']=new Object;
	ScreenSize['window']['x']=window.getWidth();
	ScreenSize['window']['y']=window.getHeight();
	ScreenSize['screen']['x']=screen.width;
	ScreenSize['screen']['y']=screen.height;
	return ScreenSize;
}

function SetEPGView()
{
	/* Sichtbarkeit der einzelnen Tagesabschnitte gemaess Userauswahl setzen */
	for (x=0;x<TagesBereich.length;x++)
	{
		if (TagesBereich[x]==0)
		{
			$$('#epg .b'+x).setStyle('display','none');
		}
		else
		{
			if (!this['ie']) $$('#epg .b'+x).setStyle('display','table-row');
			else $$('#epg .b'+x).setStyle('display','block');
		}
	}
	SetEquidistance();
}

function HideElements(item)
{
	var str='';
	item.each(function(item2,index2)
	{
		str=item2.getProperty('id');
		if (str!=null)
		{
			if (str.split('_')[1]>0)
			{
				$(str).setStyle('display','none');
			}
		}
	});
	SetEquidistance();
	return null;
}

/* User Agent (Browserkennung) auf einen bestimmten Wert pruefen */
function checkBrowserName(name)
{
	if (navigator.userAgent.indexOf(name)>-1)
	{
		return true;
	}
	return false;
}

function replaceitems(mystring)
{
	return mystring.replace(/\"/g, '').
			    	replace(/\'/g, '').
			    	replace(/ /g, '_').
	                replace(/ö/g, 'oe').
	                replace(/ä/g, 'ae').
	                replace(/ü/g, 'ue').
	                replace(/Ö/g, 'Oe').
	                replace(/Ä/g, 'Ae').
	                replace(/Ü/g, 'Ue').
	                replace(/ß/g, 'ss').
	                replace(/\%20/g, '_').
			    	replace(/\?/g, '');
}

function GetParam(name)
{
    name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS="[\\?&]"+name+"=([^&#]*)";
    var regex=new RegExp( regexS );
    var results=regex.exec( window.location.href );
    if( results==null )
        return "";
    else
        return results[1];
}

function google_afs_request_done(google_ads, ad_container_id)
{
	var google_num_ads=google_ads.length;
	if (google_num_ads<=0)
	{
		return;
	}
	var googleAds="";   // wide ad unit html text
	for(i=0;i<google_num_ads;i++)
	{
		if (google_ads[i].type=="text/wide")
		{
                  googleAds+='<a class="ad_title" target="_blank" onmouseover="javascript:window.status=\''+
                  google_ads[i].url+'\';return true;" onmouseout="javascript:window.status=\'\';return true;" '+
                  'href="'+google_ads[i].url+'">'+
                  '<span class="ad_line1">'+google_ads[i].line1+'<\/span><\/a>'+
                  '<span class="ad_text">'+google_ads[i].line2+'<\/span>'+
                  '<span class="ad_url"'+(((i+1)==google_num_ads)? ' style="border:none;"':'')+'><a target="_blank" onmouseover="javascript:window.status=\''+
                  google_ads[i].url+'\';return true;" onmouseout="javascript:window.status=\'\';return true;" '+
                  'href="'+google_ads[i].url+'">'+
                  ''+google_ads[i].visible_url+'<\/a><\/span>';
		}
	}
	if (googleAds!="")
	{
		googleAds='<div class="google_ad_content"><h2 class="blau"><a target="_blank" style="color:#FFFFFF;" href="http://services.google.com/feedback/online_hws_feedback">Google-Anzeigen<\/a><img class="clear" src="http://www.N24.de/media/imageimport/images/layout/clear.gif" height="22" alt=""/><\/h2>' + googleAds + '</div>';
	}
	if (googleAds!="") document.getElementById(ad_container_id).innerHTML=googleAds;
}

function google_ad_request_done(google_ads, ad_container_id)
{
	/*
	* This function is required and is used to display
	* the ads that are returned from the JavaScript
	* request. You should modify the document.write
	* commands so that the HTML they write out fits
	* with your desired ad layout.
	*/
	var s = '';
	var i;

	/*
	* Verify that there are actually ads to display.
	*/
	if (google_ads.length == 0)
	{
		return;
	}

	/*
	* If an image or flash ad is returned, display that ad.
	* Otherwise, build a string containing all of the ads and
	* then use a document.write() command to print that string.
	*/
	if (google_ads[0].type == "flash")
	{
		s += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
		' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' +
		google_ad.image_width + '" HEIGHT="' +
		google_ad.image_height + '"> <PARAM NAME="movie" VALUE="' +
		google_ad.image_url + '">' +
		'<PARAM NAME="quality" VALUE="high">' +
		'<PARAM NAME="AllowScriptAccess" VALUE="never">' +
		'<EMBED src="' +
		google_ad.image_url + '" WIDTH="' +
		google_ad.image_width + '" HEIGHT="' +
		google_ad.image_height +
		'" TYPE="application/x-shockwave-flash"' +
		' AllowScriptAccess="never" ' +
		' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
	}
	else if (google_ads[0].type == "image")
	{
		s += '<a href="' +
		google_ads[0].url + '" target="_blank" title="go to ' +
		google_ads[0].visible_url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
		google_ads[0].visible_url + '\';return true"><img border="0" src="' +
		google_ads[0].image_url + '"width="' +
		google_ads[0].image_width + '"height="' +
		google_ads[0].image_height + '"></a>';
	}
	else if (google_ads[0].type == "html")
	{
		s += google_ads[0].snippet;
	}
	else
	{
		if (google_ads.length == 1)
		{
			/*
			* Partners should adjust text sizes
			* so ads occupy the majority of ad space.
			*/
			s += '<a class="ad_title" target="_blank" href="' +
			google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
			google_ads[0].visible_url + '\';return true"><span class="ad_line1">' +
			google_ads[0].line1 + '</span></a><span class="ad_text">' +
			google_ads[0].line2 + '&nbsp;' +
			google_ads[0].line3 + '</span><span class="ad_url" style="border:none;"><a target="_blank" href="' +
			google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
			google_ads[0].visible_url + '\';return true">' +
			google_ads[0].visible_url + '</a></span>';
		}
		else if (google_ads.length > 1)
		{
			/*
			 * For text ads, append each ad to the string.
			 */
			for(i = 0; i < google_ads.length; ++i)
			{
				s += '<a class="ad_title" target="_blank" href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true"><span class="ad_line1">' +
				google_ads[i].line1 + '</span></a><span class="ad_text">' +
				google_ads[i].line2 + '&nbsp;' +
				google_ads[i].line3 + '</span><span class="ad_url"'+(((i+1)==google_ads.length)? ' style="border:none;"':'')+'><a target="_blank" href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' +
				google_ads[i].visible_url + '</a></span>';
			}
		}
	}
	if (s!='')
	{
		s='<div class="google_ad_content"><h2 class="blau"><a target="_blank" style="color:#FFFFFF;" href="http://services.google.com/feedback/online_hws_feedback">Google-Anzeigen<\/a><img class="clear" src="http://www.N24.de/media/imageimport/images/layout/clear.gif" height="22" alt=""/><\/h2>' + s + '</div>';
		document.getElementById(ad_container_id).innerHTML=s;
	}
	return;
}



var GoogleAdHelper = {
	
	AD_NEWS_RECTANGLE: 'news_rectangle',
	AD_SUBHOME_RECTANGLE: 'subhome_rectangle',
	AD_LATEST_GALLERIES: 'gallery_ad',
	CHANNEL_VIDEO: 'Videos',
	CHANNEL_GALLERY: 'Bilderserien',
	
	defaultChannels: ['N24_alleKategorien', '12345678'],
	urlShowAds: 'http://pagead2.googlesyndication.com/pagead/show_ads.js',
	classifications: {},
	renderedAds: [],
	
	// save callbacks currently implemented elsewhere in main_js
	google_ad_request_done: google_ad_request_done,
	google_afs_request_done: google_afs_request_done,
	
	// basic parameters
	baseConfig: {
		google_ad_client: 'pub-8413118759824828', // your client_id (pub-#)
		google_ad_output: 'js',
		google_max_num_ads: '3',
		google_ad_type: 'text,image,flash,html',
		google_image_size: '300x250',
		google_feedback: 'on',
		
		google_afs_query: GetParam('s'),
		google_afs_ad: 'w3n0', 
		google_afs_client: 'pub-8413118759824828', 
		google_afs_hl: 'de', 
		google_afs_ie: 'utf8', 
		google_afs_oe: 'utf8', 
		google_afs_adpage: parseInt(GetParam('p'))
	},
	
	/**
	 * Returns textual representation of a list of ad channels that fit the specified ad.
	 * @param String type
	 * @param String channel
	 * @return String 
	 */
	getChannels: function (type, channel) {
		channel = channel || '';
		var channels = Exo_Ivw.googleChannels || [];
		channels = channels.copy().remove('');
		
		var suffix = '';
		
		// add channels specific to placement !!!!! contains fall-throughs
		switch (type) {
			case this.AD_SUBHOME_RECTANGLE:
			case this.AD_NEWS_RECTANGLE:
				suffix = '_unten_mitte'; 
				break;
			case this.AD_LATEST_GALLERIES:
				suffix = '_links_oben';
				break;
			default: 
				break;
		}
		
		if (suffix) {
			if (channels.length) {
				channels.unshift(channels[0] + suffix);
				if (channel) {
					channels.unshift(channel + suffix);
				}
			}
			channels.push(this.defaultChannels[0] + suffix);
		}
		
		return channels.extend(this.defaultChannels).join('+');
	},
	
	/**
	 * Returns the id to use for the given ad.
	 * @param String type
	 * @return String
	 */
	getIdForAd: function (type) {
		// !!!!! contains fall-throughs
		switch (type) {
			case this.AD_SUBHOME_RECTANGLE:
			case this.AD_NEWS_RECTANGLE:
				return 'google_ads';
			case this.AD_LATEST_GALLERIES:
				return 'gallery_ad';
			default: 
				return 'google_ads';
		}
	},
	
	/**
	 * Returns a hash of all parameters needed for the specified ad. 
	 * @param String type
	 * @param String id
	 * @param String channel
	 * @return Object
	 */
	getConfiguration: function (type, id, channel) {
		var adHelper = this; // preserve scope for inenr func
		
		// get basic config
		var config = $extend({
			google_afs_request_done: function (ads) {
				return adHelper.google_afs_request_done(ads, id);
			},
			google_ad_request_done: function (ads) {
				return adHelper.google_ad_request_done(ads, id);
			},
			google_ad_channel: this.getChannels(type, channel)
		}, this.baseConfig);
		
		// augment config according to type !!!!! contains fall-throughs
		switch (type) {
			case this.AD_NEWS_RECTANGLE:
			case this.AD_SUBHOME_RECTANGLE:
				break;
			case this.AD_LATEST_GALLERIES:
				config.google_max_num_ads = 1;
				config.google_ad_type = 'text';
				break;
			default: 
				break;
		}
		
		return config;
	},
	
	/**
	 * Returns html for given ad.
	 * @param String type
	 * @param String id
	 * @return HTML
	 */
	getAd: function (type, id) {
		var html = '<div class="google_ad_container" id="' + id + '"></div> ' +
						'<script type="text/javascript" src="' + this.urlShowAds + '"></script>';
		return html;
	},
	
	/**
	 * Renders an ad: Retrieves and sets global necessary config, gets global id, logs, renders script-tag.
	 * @param String type
	 * @param String channel An additional channel to be used specificaally with this ad
	 * @return void
	 */
	renderAd: function (type, channel) {
		var id = this.getIdForAd(type);
		var config = this.getConfiguration(type, id, channel);
		this.renderedAds.push([type, config, id]);
		this.setGlobal(config);
		document.write(this.getAd(type, id));
	},
	
	/**
	 * Maps all properties of the given hash to properties of the current window.
	 * @param Object obj
	 * @return void
	 */
	setGlobal: function (obj) {
		$extend(window, obj);
	},
	
	/**
	 * Currently sets the default configuration for google ads --
	 * This behaviour is needed only for backwards compatibility with older news item html.
	 */
	init: function () {
		var adHelper = this; // preserve scope for inenr func
		var defaultConfig = $extend({
			google_afs_request_done: function (ads) {
				return adHelper.google_afs_request_done(ads, 'google_ads');
			},
			google_ad_request_done: function (ads) {
				return adHelper.google_ad_request_done(ads, 'google_ads');
			},
			google_ad_channel: this.defaultChannels.join('+')
		}, this.baseConfig);
		this.setGlobal(defaultConfig);
	}
	
};
GoogleAdHelper.init();


function myObjectBubbleSort(arrayName,orderBy,direction)
{
	var length=arrayName.length;
	if(direction=='desc')
	{
	    for (var i=0; i<(length-1); i++)
	    {
	        for (var j=i+1; j<length; j++)
	        {
	            if (arrayName[j][orderBy]>arrayName[i][orderBy])
	            {
	                var dummy = arrayName[i];
	                arrayName[i] = arrayName[j];
	                arrayName[j] = dummy;
	            }
	        }
	    }
	}
	else
	{
	    for (var i=0; i<(length-1); i++)
	    {
	        for (var j=i+1; j<length; j++)
	        {
	            if (arrayName[j][orderBy]<arrayName[i][orderBy])
	            {
	                var dummy = arrayName[i];
	                arrayName[i] = arrayName[j];
	                arrayName[j] = dummy;
	            }
	        }
	    }
	}
}

function thisMovie(movieName)
{
   if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
   }
   else {
        return document[movieName];
   }
}

// flashcommunication
function callExternalInterface( navi )
{
	thisMovie("homeplayer").selectNavigation( navi );
}

function getURLParam(strParamName)
{
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 )
  {
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
    {
      if (
	  aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 )
	  {
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
}

if(typeof(window.MR_FlashMovie)!="function"){
function MR_FlashMovie(src, width, height, Params, FlashVars, Styles)
{
	// Object Parameter und Embed Properties zusammenstellen
	var ParamString = '';
	var EmbedString = '';
	for(p in Params)
	{
		ParamString += '<param name="'+p+'" value="'+Params[p]+'"/>';
		if(p!='id')
		{
			EmbedString += ' '+p+'="'+Params[p]+'"';
		}
	}
	ParamString = ParamString.replace(/\//g,'\/');
	EmbedString = EmbedString.replace(/\//g,'\/');

	// FlashVars zusammenstellen
	var FlashVarsString = '';
	for(f in FlashVars)
	{
		FlashVarsString += '&'+f+'='+FlashVars[f];
	}
	FlashVarsString = FlashVarsString.substring(1).replace(/\//g,'\/');

	if(Styles!='')
	{
		Styles = ' style="'+Styles+'"';
	}

	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+Params['id']+'"'+Styles+'>');
	document.write('<param name="movie" value="'+src+'"\/>');
	document.write('<param name="FlashVars" value="'+FlashVarsString+'"\/>');
	document.write(ParamString);
	document.write('<embed src="'+src+'" swLiveConnect="true" FlashVars="'+FlashVarsString+'"'+EmbedString+' width="'+width+'" height="'+height+'" name="'+Params['id']+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"\/>');
	document.write('<\/object>');
}
}

if(typeof(window.MR_FlashMovie_NEW)!="function"){
function MR_FlashMovie_NEW(src, width, height, Params, FlashVars, Styles, FlashContainerId)
{
    // Object Parameter und Embed Properties zusammenstellen
    var ParamString = '';
    var EmbedString = '';
    for(p in Params)
    {
        ParamString += '<param name="'+p+'" value="'+Params[p]+'"/>';
        if(p!='id')
        {
            EmbedString += ' '+p+'="'+Params[p]+'"';
        }
    }
    ParamString = ParamString.replace(/\//g,'\/');
    EmbedString = EmbedString.replace(/\//g,'\/');

    // FlashVars zusammenstellen
    var FlashVarsString = '';
    for(f in FlashVars)
    {
        FlashVarsString += '&'+f+'='+FlashVars[f];
    }
    FlashVarsString = FlashVarsString.substring(1).replace(/\//g,'\/');

    // eventuelle Styles zusammenstellen
    if(Styles!='')
    {
        Styles = ' style="'+Styles+'"';
    }

    // Objekt schreiben
    $(FlashContainerId).empty();
    $(FlashContainerId).setHTML('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+Params['id']+'"'+Styles+'><param name="movie" value="'+src+'"\/><param name="FlashVars" value="'+FlashVarsString+'"\/>'+ParamString+'<embed src="'+src+'" swLiveConnect="true" FlashVars="'+FlashVarsString+'"'+EmbedString+' width="'+width+'" height="'+height+'" name="'+Params['id']+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"\/><\/object>');
}
}

function disableSOIFlag(){
	SOI_WERBUNG=false;
	SOI_FB2 = false;    /* Fullbanner/Superbanner top */
	SOI_RT1 = false;    /* Medium Rectangle 300x250*/
	SOI_RT2 = false;    /* Rectangle 180x150 */
	SOI_RT3 = false;   /* Rectangle 180x150 */
	SOI_PB1 = false;    /* Promobox top 300x250 */
	SOI_PB2 = false;   /* Promobox middle 300x250 */
	SOI_PB3 = false;    /* Promobox bottom 300x250 */
	SOI_SC1 = false;    /* Skyscraper */
	SOI_PU1 = false;    /* PopUp erlaubt oder nicht erlaubt*/
	SOI_PU1 = false;
	SOI_VA1 = false;   /* Videoads */
	SOI_VA2 = false;   /* Videoads */
	SOI_TS4 = false;    /* Promobox bottom */
}
var Exo_N24_HomePlayer = {

    isPlayerLoaded: false,

    playVideo: function (navi, playerOnly)
    {
        if (!this.loadPlayer(navi, playerOnly))
        {
            callExternalInterface(navi);
        }
    },

    loadPlayer: function (navi, playerOnly)
    {
        if (!this.isPLayerLoaded)
        {

            var params = {
                'id':'homeplayer', // Pflichtangabe
                'allowFullScreen':'true',
                'enableAds':'true',
                'wmode':'transparent'
            };

            var height = 357, width = 811;

            var flashVars = {
				'xmlFile': 'http://www.N24.de/1/index.xml',
                //'startChannel': GetParam('startChannel'), // a call to magic super global
                'startChannel': navi,
                't':'1',
                'maxtime' : getURLParam('umts')=='vodafone' ? '600' : '0)'                //'navigation': navi //@TODO: Implement in flash - to start up in a navi
            };

            var umts = getURLParam('umts');
            if (umts) {
				flashVars.umts = umts;
			}

			/* FB-Livestream */
			if (playerOnly) {
				flashVars.playerOnly = 'true';
				params.playerOnly = 'true';
				width = 476;
			}
			/* /FB-Livestream */

			MR_FlashMovie_NEW('http://www.N24.de/media/flash/homeplayernt.swf?1=2&v2', width, height, params, flashVars, null, 'player');

            this.isPLayerLoaded = true;
            return true;
        }
        return false;
    }

};


function home_tracking_call(ivw_param)
{
    switch (ivw_param){
      case "home_neue":
    	 //<![CDATA[
    		 var IVW = myivwurl+"1201homeneue;/"+Exo_Ivw.getRessort()+"/"+escape(document.title);
    		 var zeit="&zeit="+new Date().getTime();
    	     var IVWSTRING = ""+IVW+"/neustevideos?r="+escape(document.referrer)+zeit;
    	     document.trackingcallimage.src=IVWSTRING;
    	 //]]>
      break;
      case "home_live":
    	 //<![CDATA[
    		 var IVW = myivwurl+"1201liveVIDE;/"+Exo_Ivw.getRessort()+"/"+escape(document.title);
    		 var zeit="&zeit="+new Date().getTime();
    	     var IVWSTRING = ""+IVW+"/livestream?r="+escape(document.referrer)+zeit;
    	     document.trackingcallimage.src=IVWSTRING;
    	 //]]>
      break;
      case "home_live2":
    	 //<![CDATA[
    		 var IVW = myivwurl+"1201liveVIDE;/"+Exo_Ivw.getRessort()+"/"+escape(document.title);
    		 var zeit="&zeit="+new Date().getTime();
    	     var IVWSTRING = ""+IVW+"/livestream_event?r="+escape(document.referrer)+zeit;
    	     document.trackingcallimage.src=IVWSTRING;
    	 //]]>
      break;
      case "home_report":
    	 //<![CDATA[
     	    var IVW = myivwurl+"1201kompVIDE;/"+Exo_Ivw.getRessort()+"/"+escape(document.title);
    		var zeit="&zeit="+new Date().getTime();
    	    var IVWSTRING = ""+IVW+"/livestream_kompakt?r="+escape(document.referrer)+zeit;
    	    document.trackingcallimage.src=IVWSTRING;
    	 //]]>
      break;
    }
}

/* Get all GET-parameters from current url as string
* Used in newsitem pages to inject params
* into the subhome flash player
* - return empty string if there are no GET-parameters
*/
function getExternalParameters(){
	if (window.location.search != ""){
		return window.location.search.slice(1); // remove starting '?'
	}
	return "";
}

/*
NVZS-102, NVZS-116
Used from NewsitemVideoPlayer for Facebook VideoSharing
*/
if (!$chk(N24))
{
  var N24 = {};

  N24.StaticResources = {};
  N24.StaticResources.Methods = {};
  N24.StaticResources.Constants = {};
  N24.StaticResources.Constants.ShareUrl = "http://mediencenter.n24.de/share/{CLIP_ID}";

  N24.StaticResources.Constants.ShareUrlPattern = "{CLIP_ID}";

  N24.StaticResources.Methods.ShareClip = function(shareId, title)
  {
      var url = N24.StaticResources.Methods.BuildShareUrl(shareId);
      window.open('http://www.facebook.com/sharer.php?u='+url+'&amp;t='+encodeURIComponent(title.replace(/"/g, '')),'sharer','toolbar=0,status=0,width=626,height=436');
  };

  N24.StaticResources.Methods.BuildShareUrl = function(shareId)
  {
      return encodeURIComponent(N24.StaticResources.Constants.ShareUrl.replace(N24.StaticResources.Constants.ShareUrlPattern, shareId));
  };
}

/* DFP-AdServer 18.06.2009 & 29.06.2009 */

function n24_VideoAdRequest(video_ad_id, data) {
     if (typeof(data) != 'object') data = {};
     var ad_request = '';

     if (typeof(window.soi_VideoAdRequest) == 'function') {
         // TODO: Set prefetch and/or industries if needed
          var config_data = {};
          if (0 && 'TODO-1') config_data.prefetch = true;
          if (0 && 'TODO-2') {
                config_data.industries =
                     {
                     //   midroll1d: {industry: 'xyz', indtarget: 1},
                     //   midroll1e: {industry: 'abc', indtarget: 0}
};

}
          ad_request = window.soi_VideoAdRequest(
video_ad_id, config_data);
     }

     else {
          // TODO LATER: The 'else' block should disappear
	// eventually after the new globalV6 is available.
	// TODO: Iff done so before, built your own add2tag.
var tag = window.add2tag;
          if (!tag) return '';

          ad_request = 'http://adserver.71i.de/html.ng/place='
                + escape(video_ad_id) + '&' + tag;

if (typeof(data.industries) == 'object') {
                for (var key in data.industries) {
                     if (key.match(/^midroll/
&& video_ad_id.match(/^midroll/))
&& key >= video_ad_id) continue;
                     var value = data.industries[key].industry;
                     if (value == null || !value.length) continue;
                     var operator = data.industries[key].indtarget ? '=' : '!=';
                     ad_request += '&ads.segment' + operator + value;
                }
          }
     }

      return ad_request;
}

function call_n24_VideoAdRequest(){
	var ad_request = n24_VideoAdRequest('preroll1');
	return ad_request;
}

function n24_syncVars()
{
	if (parent == window) return;
	var sync_vars = ['add2tag', 'Ad', 'soi_adtrace', 'soi_dimension', 'SoiSetMid',
			'forceSkyscraperInside',
'forceSkyscraperOutside', 'preferSkyscraperOutside',
			'DFPSite', 'DFPZone', 'DFPTile', 'DFPOrd', 'DFPOid',
			'SOI_SITE', 'SOI_SUBSITE', 'SOI_SUB2SITE', 'SOI_SUB3SITE', 'SOI_SUB4SITE', 'SOI_SUB5SITE', 'SOI_SUB6SITE',
			'SOI_BREADCRUMBS', 'SOI_CONTENT',
			'SOI_WERBUNG', 'SOI_FB1', 'SOI_FB2', 'SOI_RT1', 'SOI_RT2', 'SOI_RT3', 'SOI_SC1', 'SOI_PU1',
			'SOI_VP', 'SOI_VA1', 'SOI_VA2', 'SOI_VA3', 'SOI_VA4', 'SOI_VA5', 'SOI_LPY', 'SOI_NPY',
			'SOI_SOWEFO', 'SOI_PU', 'SOI_WP', 'SOI_PW', 'SOI_PB', 'SOI_PC', 'SOI_PL', 'SOI_PR',
			'SOI_UPC'
		];
	for (var i = 0; i < sync_vars.length; i++) {
		parent[sync_vars[i]] = window[sync_vars[i]];
	}
}

/* /DFP-AdServer  */

// return the iframe in the dom directly above the current window
function getContainingIframe() {
	return parent.$(self.frameElement) || null;
}
// sets the height of the parent iframe to the height of this document
function resizeContainingIframe(element) {
	element = $(element);
	if (getContainingIframe()) {
		var size = $(element || document.body).getSize().size;
		getContainingIframe().setStyle('height', size.y + 'px');
		getContainingIframe().setStyle('width', size.x + 'px');
		if (parent.SetEquidistance) {
			parent.SetEquidistance();
		}
	}
}

/**
 * closure
 * shows the loginlayer
 * @param config object {topPosition: , require: , showSuccess:, newsItemId:, callback:}
 */
var initLoginForm = function () {

	var initialized = false;
	var config = {
		callback: null,
		topPosition: null,
		require: '',
		showSuccess: false,
		newsItemId: 0
	};

	return function(configHash){
		var c = $extend({}, config, configHash);
		c = $extend(c, configHash);

		//set cookie indicating initial call of login
		document.cookie = "initCall=1; path=/; max-age="+60*5;

		//position layer
		if (c.topPosition) {
			$('login_container').setStyle('top', c.topPosition + 'px');
		}
		//show if initialized
		if (initialized && !c.callback && !c.require && !c.showSuccess) {
			$('login_iframe').contentWindow.showLoginForm();
		} else {
			//create unique initloginFunction with callbackhandler
			var uid = 'initlogin' + new Date().getTime();
			var onSuccessJsFn = '?onSuccessJsFn='+uid;
			var paramRequire = '&require=' + (c.require || '');
			var paramShowSuccess = '&showSuccess=' + (c.showSuccess ? '1' : '0');
			var paramNewsId = '&newsitem_id='+ c.newsItemId;
			initialized = true;

			window[uid] = function (userId) {
				if (c.callback) {
					c.callback(userId);
				}
				commonLoginCallback();
			}
			//contains inner script which shows login
			$('login_container').innerHTML = '<iframe name="login_iframe" id="login_iframe" scrolling="no" frameborder="no" src="' + ugcConfig.actionPath + 'profile/login.php' + onSuccessJsFn + paramRequire + paramShowSuccess + paramNewsId +'" width="400" height="300"></iframe>';
		}
	};
}();

/**
 * called everytime on loginwizard - login success
 * @return null
 */
function commonLoginCallback(){
	updateLoggedInState();

	$('login_container').style.display = 'none';
	updateCommentListBySessionVars();
}

function updateLoggedInState(){
	if(document.cookie && document.cookie.indexOf("loggedIn") != -1 && document.cookie.indexOf("PHPSESSID") != -1) {
		$('loggedIn').setStyle("display", "inline");
		$('loggedOut').setStyle("display", "none");
		var matches = document.cookie.match(/username=([^;]+)/);
		var name = matches[1].replace(/\+/, ' ');
		$('profile').innerHTML = decodeURIComponent(name);
	} else {
		$('loggedOut').setStyle("display", "inline");
		$('loggedIn').setStyle("display", "none");
	}
}

/**
 * updates #commentscontainer content with currentcomments defined by SessionState
 * @return
 */
function updateCommentListBySessionVars() {
	var url = ugcConfig.actionPath + "comment/list_comments.php";

	new Ajax(url, {
		method: 'get',
		update: $('commentsContainer'),
		evalScripts: true
	}).request();
}


/**
 * rates for an item
 * @param hash params {newsitem_id: ,comment_id: ,rate_type:,media_id:  }
 * @param function onComplete callback
 */
function sendRatingRequest(params, fn) {
	var ratingUrl = ugcConfig.actionPath + 'rating/rate.php';
	var data = $extend({
		newsitem_id: Exo_Ivw.getNiID(),
		comment_id: '',
		rate_type: '' ,
		media_id: ''
	}, params);
	new Ajax(ratingUrl, {
		data: data,
		method: 'post',
		onComplete: function (data) {
			data = Json.evaluate(data);
			if (data.success) {
				fn.call(this, data);
			} else {

			}
		}
	}).request();
}

/**
 * gets RatingType for element that has ratingUp or ratingDown class
 * @param string id of rating link element
 * @return RatingType used by php action/rate/rating
 */
function getRatingType(link) {
	link = $(link);
	if (link.hasClass('ratingUp')) {
		return 'UP';
	} else if (link.hasClass('ratingDown')) {
		return 'DOWN';
	}
	return '';
}

/**
 * rates a newsitem by link
 * @exception class ratingAllowed, ratingNotAllowed used for indication rateing state
 * @param id of ratinglink element
 * @return null
 */
function rateNewsItem(link) {
	if ($(link.parentNode.parentNode).hasClass('ratingNotAllowed')) {
		return false;
	}
	sendRatingRequest({
		content_type:'newsItem',
		rate_type: getRatingType(link)
	}, function (data) {
		updateRatingLinks($$('div.news div.layer div.clearfix').removeClass('ratingAllowed').addClass('ratingNotAllowed'), data);
	});
}

/**
 * rates a comment by link
 * @expects class ratingAllowed, ratingNotAllowed used for indication of rating state
 * @param id of rating-link element
 * @return null
 */
function rateComment(link, commentId, userId) {
	commentId = commentId || '';
	userId = userId || '';
	if ($(link.parentNode.parentNode).hasClass('ratingNotAllowed')) {
		return false;
	}
	sendRatingRequest({
		content_type:'comment',
		rate_type: getRatingType(link),
		comment_id: commentId,
		user_id: userId
	}, function (data) {
		updateRatingLinks($$(link.parentNode.parentNode).removeClass('ratingAllowed').addClass('ratingNotAllowed'), data);
	});
}

/**
 * inserts new rating details into existing rating fields
 * @param string id of element where to update data
 * @param object data with ratingInfo
 */
function updateRatingLinks(where, data) {
	where.each(function (item, num) {
		item.getElements('.ratingUp').setHTML(data.result.rated_up);
		item.getElements('.ratingDown').setHTML(data.result.rated_down);
		item.getElements('.ratingCombined').setHTML(data.result.counter);
		item.getElements('.ratingComment').setHTML('Stimme gez&auml;hlt').addClass('itemWasRated');
	});
}

/**
 * initializes ugc-functionality of news-items.
 * @return void
 */
function initNewsItemUgc() {
	var strHref = window.location.href;
	var strQueryString = strHref.substr(strHref.indexOf("?")+1);
	if (strHref.indexOf("?") == -1) {
		strQueryString = "";
	}

	// include comment-form
	var url = ugcConfig.actionPath + "comment/comments.php?newsitem_id=" + Exo_Ivw.getNiID() + strQueryString;
	var x = new Ajax(url, {
		method: 'get',
		update: $('ugc_comments'),
		evalScripts:true
	});
	x.request();

	// news item rating lazy-loads on hover
	var ratingUrl = ugcConfig.actionPath + 'rating/show.php';
	var contentType = 'newsItem';
	var ratingLayers = $$('div.news li.ratingLayer');
	ratingLayers.addEvent('mouseenter', function (e) {
		ratingLayers.removeEvent('mouseenter', arguments.callee);
		new Ajax(ratingUrl, {
			data: {
				newsitem_id: Exo_Ivw.getNiID(),
				content_type: contentType
			},
			method: 'post',
			onComplete: function (data) {
				var layers = $$('div.news li.ratingLayer div.layer');
				layers.forEach(function (item, index) {
					item.setHTML(data);
					item.getElements('a').addEvent('click', function (e) {
						rateNewsItem(this);
					});
				});
			}
		}).request();
	});

	var tweetLinks = $$('a.tweetLink');
	tweetLinks.addEvent('click', function (e) {
		var top = this.getPosition().y - 100;
		initLoginForm({
			callback: function (userId) {
				showTweetThisForm(top);
			},
			topPosition: top,
			require: 'twitter',
			showSuccess: false
		});
	});
}




/**
 * Initializes tweet this functionality
 *
 */
var showTweetThisForm = function () {

	var url = ugcConfig.actionPath + 'comment/share_twitter.php';
	return function (top) {
		// ajax -> einsetzen formular
		new Ajax(url, {
			evalScripts: true,
			data: {
				init: 1,
				text: '',
				news_dachzeile: $('hidden_comment_dachzeile').innerHTML.trim(),
				news_headline: $('hidden_comment_headline').innerHTML.trim(),
				newsitem_id: Exo_Ivw.getNiID()
			},
			method: 'post',
			update: $('tweetthis_container'),
			onComplete: function (e) {
				if (top) {
					$('tweetthis_form').setStyle('top', top + 'px');
				}
				$ES('.close', 'tweetthis_form').addEvent('click', function (e) {
					hideForm('tweetthis_form');
				});
				showForm('tweetthis_form');
			}
		}).request();
	};
}();







/**
 * Hides the element with an id of "id" using a fading transition.
 * If an element with the id "linkId" exists, its font-weight is set to normal.
 *
 * @param {Object} id
 * @param {Object} linkId
 */
function hideForm(id, linkId) {
	$(id).effect('opacity', {
		duration: 500,
		onComplete: function() {
			$(id).setStyle('display', 'none');
			if ($(linkId)) {
				//$(linkId).setStyle('font-weight', '400');
			}
		},
		transition: Fx.Transitions.Quad.easeIn
	}).start(1,0);
}



/**
 * Renders the element with the id "id" visible using a fading transition.
 * If an element with the id "linkId" exists, its font-weight is set to bold.
 *
 * @param {Object} id
 * @param {Object} linkId
 */
function showForm(id, linkId) {
	var myFx=new Fx.Style(id, 'opacity').set(0);
	$(id).setStyle('display','block');
	$(id).effect('opacity', {
		duration: 500,
		onComplete: function() {
			if ($(linkId)) {
				//$(linkId).setStyle('font-weight','800');
			}
		},
		transition: Fx.Transitions.Quad.easeIn
	}).start(0,1);
}



/**
 * Toggles the visibility of an element using either showForm or hideForm.
 *
 * @param {Object} id
 * @param {Object} linkId
 * @return if the element will be visible
 */
function toggleForm(id, linkId) {
	if ($(id).getStyle('display') == 'none') {
		showForm(id, linkId);
		return true;
	} else {
		hideForm(id, linkId);
		return false;
	}
}


/**
 * Binds click handlers to element with an id of linkId to show/hide the element with "id".
 *
 * @param {Object} id
 * @param {Object} linkId
 */
function bindFormLinks(id, linkId) {
	$(linkId).addEvent('click', function (e) {
		toggleForm(id, linkId);
	});
	$ES('.close', id).addEvent('click', function (e) {
		hideForm(id, linkId);
	});
}

/**
 * NVZS-241: Newsitem Print Link oeffnet Print-Popup
 */
var addPopUp;

function printNewsItem(){
	//url für das special oder leeren String zuweisen, wenn kein Special aktiv ist.
	var special_url = ''; //'/ratgeberservice/verbraucher/promotion_verbraucher/kodak_promotion.html';

	var padding = navigator.appName == "Microsoft Internet Explorer" ? 10 : 0;
	var screenw = screen.availWidth;
	var screenh = screen.availHeight;
	var posx = (screenw - 1024 - 15 - padding) / 2;
	var posy = (screenh - 768-30-padding) / 2;

	if(special_url != null && special_url != ''){
		addPopUp = window.open(special_url, "_blank", "width=1024,height=768,resizable=yes,directories=no,titlebar=no,scrollbars=no,status=no,menubar=no,toolbar=no,top="+posy+",left="+posx);
		window.print();
		addPopUp.focus();

	}else{
		window.print();
	}
	return false;
}







/**
 * Implements tool methods for rendering iframe content in layers.
 */
var LayerHelper = {
	
	layers: {},
	
	/**
	 * Fades in a given el.
	 * @param HTMLElement layer
	 * @return void
	 */
	showLayer: function (layer) {
		if (!layer.layerRendered) {
			layer.layerRendered = true;
			this.renderLayer(layer);
		}
		if (layer.getStyle('display') != 'none') {
			return layer;
		}
		layer.setStyles({
			opacity: '0',
			display: 'block'
		}).effect('opacity').start(0, 1);
		return layer;
	},
	
	/**
	 * Hides a given el.
	 * @param HTMLElement layer
	 * @return HTMLElement the layer
	 */
	hideLayer: function (layer) {
		layer.setStyles({
			opacity: '1',
			display: 'block'
		}).effect('opacity', {
			onComplete: function () {
				layer.setStyles({
					display: 'none'
				});
			}
		}).start(1, 0);
		return layer;
	},
	
	/**
	 * Show a google map in an iframe layer.
	 * @param String url of google map page
	 * @return void
	 */
	showMap: function (url) {
		var layer = this.getLayer({
			url: url,
			key: url,
			width: 515,
			height: 445,
			left: 295,
			top: 295
		});
		this.showLayer(layer);
	},
	
	/**
	 * Returns HTML for a layer specified by data
	 * @param Object data A hash of configuration data: width, height, top, left, url, key (to distinguish it when caching), id if applicable
	 * @return String HTML source of the layer
	 */
	getLayer: function (data) {
		if (this.layers[data.key]) {
			return this.layers[data.key];
		}
		var helper = this;
		var cls = data['class'] || '', id = data.id || 'layer_' + new Date().getTime();
		var layer =  new Element('div', {
			'styles': {
				top: data.top,
				left: data.left
			},
		    'events': {
		        'click': function(e) {
					e = new Event(e);
					if ($(e.target).hasClass('layer_close')) {
						helper.hideLayer(layer);
						e.stop();
					}
		        }
		    },
		    'class': 'layer_wrapper ' + cls,
		    id: id
		});
		layer.setHTML('' + 
				'<div class="layer_inner">' + 
				'<div class="shadow">' + 
					'<div class="rt"></div>' + 
					'<div class="right"></div>' + 
					'<div class="rb"></div>' + 
					'<div class="bottom"></div>' + 
					'<div class="lb"></div>' + 
				'</div>' + 
				'<div class="layer_content">' + 
					'<div class="buttons"><a class="layer_close" href="#">schlie&szlig;en</a></div>' + 
					'<iframe data-src="' + data.url +  '" style="width: ' + data.width + 'px; height: ' + data.height + 'px" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" id="iframe_' + id + '" name="iframe_' + id + '"></iframe>' + 
				'</div>' + 
				'</div>' + 
		'');
		this.layers[data.key] = layer;
		return layer;
	},
	
	/**
	 * Appends a layer to the DOM.
	 * @param HTMLElement layer
	 * @return HTMLElement
	 */
	renderLayer: function (layer) {
		$(document.body).adopt(layer);
		$('iframe_' + layer.id).src = $('iframe_' + layer.id).getAttribute('data-src');
	}
};
