/**
 * jQuery.browser.mobile (http://detectmobilebrowser.com/)
 *
 * Copyright (c) 2010 Chad Smith (http://twitter.com/chadsmith)
 * Dual licensed under the MIT and GPL licenses.
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.opensource.org/licenses/gpl-license.php
 *
 * jQuery.browser.mobile will be true if the browser is a mobile device
 *
 **/
(function(a){jQuery.browser.mobile=/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);




// settings and global functions

var ntv = new Object();
ntv = {
	random:	Math.round( Math.random() * 999998 + 1 ),
	basepath: window.location.protocol+"//"+window.location.host,
	pageUrl: "http://www.n-tv.de",
	articleID: "",
	urlParams: new Object(),
	videotag: "video",
	showMobileMessage: false,
	mobileBrowser: function(){
		mobileBrowser = /android 3/g.test(navigator.userAgent.toLowerCase())?false:jQuery.browser.mobile;
		return mobileBrowser;
	},
	log: function( message ) {
		if( "console" in window && console.debug ) {
			console.debug( message );
		}
	},
	debug: function( message ) {
		if( "console" in window && console.debug && ntv.urlParams.debug ) {
			console.debug( message );
		}
	}
};

(function(){
	var qs = window.location.search;
	if( qs != "" ){
		qs = qs.substr( qs.indexOf("?")+1 );
		var keyValues = qs.split("&");
		for ( var i = 0; i < keyValues.length; i++ ){
			ntv.urlParams[ (keyValues[i].split("="))[0] ] = (keyValues[i].split("="))[1];
		}
	}
}());

ntv.debug(ntv);

function printview(url) {
  	var mw = window.open(url, "ntv_Meldung_Druckansicht", "width=835,height=600,scrollbars=yes,toolbar=no,status=no,menubar=no,location=no");
  	mw.focus();
	return false;
}

function mobileSwitch(){
	if(ntv.mobileBrowser()==true){
		ntv.showMobileMessage = true;
		var mobilCheck = confirm("Wollen Sie zur mobilen Version dieser Seite wechseln?");
		if (mobilCheck == true){
		  window.location.href = "http://mobil.n-tv.de";
		}
	}
}



// IVW-Load durch Videoplayer
function reloadIVW() {
	if( ntv_location != 'media' ){
		var ivw_image = new Image();
		ivw_image.src="http://ntv.ivwbox.de/cgi-bin/ivw/CP/"+ntv.videotag+";/"+ntv_sitename+"/"+ntv_section+"/video?r="+escape(document.referrer)+"&d="+(Math.random()*100000);

	}

}


function getCookie(name){
   var i=0;
   var suche = name+"=";
   while (i<document.cookie.length){
      if (document.cookie.substring(i, i+suche.length)==suche){
         var ende = document.cookie.indexOf(";", i+suche.length);
         ende = (ende>-1) ? ende : document.cookie.length;
         var cook = document.cookie.substring(i+suche.length, ende);
         return unescape(cook);
      }
      i++;
   }
   return null;
}

function ntv_parseDate (date){
	var dateStrings = date.split(".");
	return new Date(
		parseInt(dateStrings[2]),
		parseInt(dateStrings[1])-1,
		parseInt(dateStrings[0])
	);
}

function ntv_formatDate(date, format){

	var startDate = new Date(Math.abs(date));

	var weekday = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag")[startDate.getDay()];

	var year = startDate.getFullYear();

	var month = startDate.getMonth();
	var monthName = new Array("Januar", "Februar", "M&auml;rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember")[month];

	month = month+1;
	month = month<10?"0"+month:month;

	var day = startDate.getDate();
	day = day<10?"0"+day:day;

	var hours = startDate.getHours();
	hours = hours<10?"0"+hours:hours;

	var minutes = startDate.getMinutes();
	minutes = minutes<10?"0"+minutes:minutes;

	var formatDate = "";

	switch ( format ){
		case "EEEEEEEEEE, dd.MMMMMMMMM yyyy":
			formatDate = weekday + ', ' + day + '. ' + monthName + ' ' + year;
  			break;
		case "EE, dd.MMMMMMMMM":
			formatDate = weekday.substr(0,2) + ', ' + day + '. ' + monthName;
  			break;
		case "EE, dd.MMMMMMMMM - HH:mm":
			formatDate = weekday.substr(0,2) + ', ' + day + '. ' + monthName + ' - ' + hours + ':' + minutes;
  			break;
		case "HH:mm":
			formatDate = hours + ':' + minutes;
  			break;
		case "dd.MM. HH:mm":
			formatDate = day + '.' + month + '. ' + hours + ':' + minutes;
  			break;

		default:
			formatDate = day + '.' + month + '. ' + year + ' ' + hours + ':' + minutes;
  			break;
	}



	return formatDate;
}


// jquery functions

(function($) {

	/*
	 ### jQuery XML to JSON Plugin v1.0 - 2008-07-01 ###
	 * http://www.fyneworks.com/ - diego@fyneworks.com
	 * Dual licensed under the MIT and GPL licenses:
	 *   http://www.opensource.org/licenses/mit-license.php
	 *   http://www.gnu.org/licenses/gpl.html
	 ###
	 Website: http://www.fyneworks.com/jquery/xml-to-json/
	*/

	 $.extend({

		  // converts xml documents and xml text to json object
		  xml2json: function(xml, extended) {
		   if(!xml) return {}; // quick fail

		   //### PARSER LIBRARY
		   // Core function
		   function parseXML(node, simple){
		    if(!node) return null;
		    var txt = '', obj = null, att = null;
		    var nt = node.nodeType, nn = jsVar(node.localName || node.nodeName);
		    var nv = node.text || node.nodeValue || '';
		    /*DBG*/ //if(window.console) console.log(['x2j',nn,nt,nv.length+' bytes']);
		    if(node.childNodes){
		     if(node.childNodes.length>0){
		      /*DBG*/ //if(window.console) console.log(['x2j',nn,'CHILDREN',node.childNodes]);
		      $.each(node.childNodes, function(n,cn){
		       var cnt = cn.nodeType, cnn = jsVar(cn.localName || cn.nodeName);
		       var cnv = cn.text || cn.nodeValue || '';
		       /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>a',cnn,cnt,cnv]);
		       if(cnt == 8){
		        /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>b',cnn,'COMMENT (ignore)']);
		        return; // ignore comment node
		       }
		       else if(cnt == 3 || cnt == 4 || !cnn){
		        // ignore white-space in between tags
		        if(cnv.match(/^\s+$/)){
		         /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>c',cnn,'WHITE-SPACE (ignore)']);
		         return;
		        };
		        /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>d',cnn,'TEXT']);
		        txt += cnv.replace(/^\s+/,'').replace(/\s+$/,'');
										// make sure we ditch trailing spaces from markup
		       }
		       else{
		        /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>e',cnn,'OBJECT']);
		        obj = obj || {};
		        if(obj[cnn]){
		         /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>f',cnn,'ARRAY']);
		         if(obj[cnn].constructor != Array) obj[cnn] = myArr(obj[cnn]);
		         obj[cnn][ obj[cnn].length ] = parseXML(cn, true/* simple */);
		         obj[cnn].length = obj[cnn].length;
		        }
		        else{
		         /*DBG*/ //if(window.console) console.log(['x2j',nn,'node>g',cnn,'dig deeper...']);
		         obj[cnn] = parseXML(cn);
		        };
		       };
		      });
		     };//node.childNodes.length>0
		    };//node.childNodes
		    if(node.attributes){
		     if(node.attributes.length>0){
		      /*DBG*/ //if(window.console) console.log(['x2j',nn,'ATTRIBUTES',node.attributes])
		      att = {}; obj = obj || {};
		      $.each(node.attributes, function(a,at){
		       var atn = jsVar(at.name), atv = at.value;
		       att[atn] = atv;
		       if(obj[atn]){
		        /*DBG*/ //if(window.console) console.log(['x2j',nn,'attr>',atn,'ARRAY']);
		        if(!obj[atn].length) obj[atn] = myArr(obj[atn]);//[ obj[ atn ] ];
		        obj[atn][ obj[atn].length ] = atv;
		        obj[atn].length = obj[atn].length;
		       }
		       else{
		        /*DBG*/ //if(window.console) console.log(['x2j',nn,'attr>',atn,'TEXT']);
		        obj[atn] = atv;
		       };
		      });
		      //obj['attributes'] = att;
		     };//node.attributes.length>0
		    };//node.attributes
		    if(obj){

		    // obj = $.extend( (txt!='' ? new String(txt) : {}),/* {text:txt},*/ obj || {}/*, att || {}*/);
		     txt = (obj.text) ? (typeof(obj.text)=='object' ? obj.text : [obj.text || '']).concat([txt]) : txt;
		     if(txt) obj.text = txt;
		     txt = '';
		    };
		    var out = obj || txt;

		    //console.log([extended, simple, out]);
		    if(extended){
		     if(txt) out = {};//new String(out);
		     txt = out.text || txt || '';
		     if(txt) out.text = txt;
		     if(!simple) out = myArr(out);
		    };

		    return out;
		   };// parseXML
		   // Core Function End
		   // Utility functions
		   var jsVar = function(s){ return String(s || '').replace(/-/g,"_"); };

					// NEW isNum function: 01/09/2010
					// Thanks to Emile Grau, GigaTecnologies S.L., www.gigatransfer.com, www.mygigamail.com
					function isNum(s){
						// based on utility function isNum from xml2json plugin (http://www.fyneworks.com/ - diego@fyneworks.com)
						// few bugs corrected from original function :
						// - syntax error : regexp.test(string) instead of string.test(reg)
						// - regexp modified to accept  comma as decimal mark (latin syntax : 25,24 )
						// - regexp modified to reject if no number before decimal mark  : ".7" is not accepted
						// - string is "trimmed", allowing to accept space at the beginning and end of string
						var regexp=/^((-)?([0-9]+)(([\.\,]{0,1})([0-9]+))?$)/
						return (typeof s == "number") || regexp.test(String((s && typeof s == "string") ? jQuery.trim(s) : ''));
					};
					// OLD isNum function: (for reference only)
					//var isNum = function(s){ return (typeof s == "number") || String((s && typeof s == "string") ? s : '').test(/^((-)?([0-9]*)((\.{0,1})([0-9]+))?$)/); };

		   var myArr = function(o){
			if(o.constructor != Array) o = [ o ]; o.length=o.length;
		    // here is where you can attach additional functionality, such as searching and sorting...
		    return o;
		   };
		   // Utility functions End
		   //### PARSER LIBRARY END

		   // Convert plain text to xml
		   if(typeof xml=='string') xml = $.text2xml(xml);

		   // Quick fail if not xml (or if this is a node)
		   if(!xml.nodeType) return;
		   if(xml.nodeType == 3 || xml.nodeType == 4) return xml.nodeValue;

		   // Find xml root node
		   var root = (xml.nodeType == 9) ? xml.documentElement : xml;

		   // Convert xml to json
		   var out = parseXML(root, true /* simple */);

		   // Clean-up memory
		   xml = null; root = null;

		   // Send output
		   return out;
		  },

		  // Convert text to XML DOM
		  text2xml: function(str) {
		   // NOTE: I'd like to use jQuery for this, but jQuery makes all tags uppercase
		   //return $(xml)[0];
		   var out;
		   try{
		    var xml = ($.browser.msie)?new ActiveXObject("Microsoft.XMLDOM"):new DOMParser();
		    xml.async = false;
		   }catch(e){ throw new Error("XML Parser could not be instantiated") };
		   try{
		    if($.browser.msie) out = (xml.loadXML(str))?xml:false;
		    else out = xml.parseFromString(str, "text/xml");
		   }catch(e){ throw new Error("Error parsing XML string") };
		   return out;
		  }

		 }); // extend $

	$.fn.ntv_bookmark = function() {
		return this.each(function(){
			$(this).click(function(){
				if( navigator.userAgent.toLowerCase().indexOf('ie') != -1 ) {
					try {
						window.external.AddFavorite( window.location, document.title );
					} catch ( e ) {	ntv.log(e);}
				} else if( navigator.userAgent.toLowerCase().indexOf('moz') != -1 ) {
					try {
						window.sidebar.addPanel( document.title, window.location, '' );
					} catch ( e ) { ntv.log(e);	}
				}
				return false;
			});
		});
	};

	$.fn.ntv_bookmarking = function() {
		var html = "";
		html += "<p>";
		html += "Lesezeichen im Browser setzen<br />";
		html += "<button class=\"bookmark\" type=\"button\">Lesezeichen</button>";
		html += "</p>";

		var event = null;
		if( navigator.userAgent.toLowerCase().indexOf('ie') != -1 ) {
			event = function() {
				try {
					window.external.AddFavorite( window.location, document.title );
				} catch ( e ) {	ntv.log(e);}
			};
		} else if( navigator.userAgent.toLowerCase().indexOf('moz') != -1 ) {
			event = function() {
				try {
					window.sidebar.addPanel( document.title, window.location, '' );
				} catch ( e ) { ntv.log(e);	}
			};
		}

		return this.each( function() {
			if ( event != null ) {
				$( this ).html( html ).find( "button.bookmark" ).click( event );
			} else {
				$( this );
			}
		});
	};


	$.fn.ntv_bookmarking_home = function() {
		if( navigator.userAgent.toLowerCase().indexOf('ie') != -1 ) {
			$(this).prepend('<li><a href="http://www.n-tv.de" onclick=" document.body.style.behavior=\'url(#default#homepage)\'; document.body.setHomePage( \'http://www.n-tv.de/\' ); return false; " title="n-tv.de als Startseite einrichten"><img src="http://www.n-tv.de/ads/images/icon_startseite.gif" alt="n-tv.de als Startseite einrichten"/></a></li>');
		} else if( navigator.userAgent.toLowerCase().indexOf('moz') != -1 ) {
			$(this).prepend('<li><a href="http://www.n-tv.de" onclick="window.sidebar.addPanel( \'n-tv.de\', \'http://www.n-tv.de\', \'\' ); return false" title="n-tv.de als Lesezeichen hinzuf&uuml;gen"><img src="http://www.n-tv.de/ads/images/icon_startseite.gif" alt="n-tv.de als Lesezeichen hinzuf&uuml;gen"/></a></li>');
		}
	};

	// click to big pictures
	$.fn.ntv_click_to_big = function() {
		return this.each( function() {
			var image = new Image();

			image.onload = function() {

				var $container = $( "<div class='big_pic' />" ).append( image );
				var img = $container.find( "img" ).get( 0 );

				$container.css( "height", $( "body" ).height()+"px" );
				$( "body" ).prepend( $container );

				var posX = $( self ).scrollTop() + ( $( self ).height()/2 - img.height/2 );
				var posY = $( self ).width() / 2 - img.width / 2;

				$( img ).css( "top", posX+"px" );
				$( img ).css( "left", posY+"px" );

				$container.fadeIn( "slow" );
				$container.bind( "click", function() {
					$container.fadeOut( "slow", function() {
						try {
							$( $container ).remove();
						} catch (err) {}
					});
				});

				var ivwImage = new Image();
				ivwImage.src = "http://ntv.ivwbox.de/cgi-bin/ivw/CP/"+ivw_code+";/"+ntv_sitename+"/"+ntv_navipath+"?r="+escape(document.referrer)+"&d="+(Math.random()*100000);

			};

			image.src = this.href;




		});
	};


	$.ntv_show_sendForm = function(url) {


		var $layer = $( '<div class="defaultLayer" />' );
		var $formContainer = $('<div id="email_form_layer" class="clearfix"/>');
		var articleUrl = url?url:ntv.pageUrl;


		var posX = $( self ).scrollTop() + ( $( self ).height()/2 - 170 );
		var posY = $( self ).width() / 2 - 344;

		$layer.prepend($formContainer);

		$layer.css( "height", $( "body" ).height()+"px" );
		$formContainer.css( {"top": posX+"px", "left": posY+"px"} );


		$( "body" ).prepend( $layer );
		$layer.fadeIn( "slow" );



		$formContainer.load(articleUrl + '?service=ajax&action=remail_wide&cache=false', function(response, status){
			if(status=="error"){
				$formContainer.html('<div class="close" onclick="$(\'.defaultLayer\').fadeOut(\'slow\');"></div><span class="error">Das Formular konnte nicht geladen werden</span>');
				window.setTimeout('$(".defaultLayer").fadeOut("slow")', 2000);
			}
		});

	};

	// navigation for the fb ticker
	$.fn.ntv_fb_ticker_navigation = function() {
		$container = $( this );
		$( this ).find( "ul.navi li a" ).each( function( index, item ) {
			$( item ).click( function() {
				var activeLi = $container.find( "ul.navi li.active" ).get( 0 );
				var activateLi = $container.find( "ul.navi li" ).get( index );

				var activeTb = $container.children( "div.active" ).get( 0 );
				var activateTb = $container.children( "div" ).get( index );

				$( activeLi ).removeClass( "active" );
				$( activateLi ).addClass( "active" );

				$( activeTb ).removeClass( "active" );
				$( activateTb ).addClass( "active" );

				return false;
			});
		});
	};

	$.fn.ntv_format_articleH1 = function() {
		var headline = $(this).html().split(": ");
		$(this).html( "<span>" + headline[0] + "</span>" + headline[1]);
	}



	$.fn.ntv_hpnews_search = function() {
		return this.each( function() {
			var g_cleared = false;
			var g_interval = null;
			var inputField = $(this);

			if ($(this).attr("value").length >= 3) {
				window.clearInterval(g_interval);
				$('#hpnews_loading').show();
				g_interval = window.setInterval(function () {

					$("#hpnews_city").empty();

					$.get( "http://www.n-tv.de/ext.jsp?s=wetter&f=ntvsearchdeutschland/search_" + encodeURI($(inputField).val()) + ".xml",
					function( xml ){
						$( "item", xml ).each(
								function( i, item ){
									$("#hpnews_city").append("<option value=\"" + $( item ).attr( "wmo" ) + ";" + $( item ).attr( "city" ) + "\">" + $( item ).attr( "city" ) + "(" + $( item ).attr( "bl" ) + ")</option>");
								}
						);

						$('#hpnews_loading').hide();
					});

				/*
					//$.getJSON("http://www.n-tv.de/tools/wetter2007/dispatcher?tpl=content&decode=1&plz_ort_fragment="+encodeURI($(inputField).val())+"&jsoncallback=?", function (data) {
					$.getJSON("hpnews_json.html", function (data) {

						if (data) {
							$("#hpnews_city").empty();
							$.each(data.data, function (index, d) {
								$("#hpnews_city").append("<option value=\"" + d.key + "\">" + d.value + "</option>");
							});
						}
						$('#hpnews_loading').hide();
					});
				*/


					window.clearInterval(g_interval);
				}, 500);
			}
		});
	};

	$.fn.ntv_hpnews_generate = function() {
		return this.each( function() {


				$('#hpnews_code').hide();
				$("#hpnews_code textarea").empty();



				var html = "<iframe src=\"http://www.n-tv.de/myntv";
				html += "?";
				var elements = $("#hpnews_form input:checked");
				if (elements.length > 1) {
					$("#hpnews_error").hide();

					$.each(elements, function (index, item) {
						html += item.name + "=" + item.value;
						if (index < elements.length - 1) {
							html += "&";
						}
					});
					if ($("#hpnews_form input[@name=\"size\"]:checked").val() == "maxi") {
						if ($("#hpnews_form #hpnews_city").val()) {
							var params = $("#hpnews_form #hpnews_city").val().split(";");
							html += "&city=" + encodeURI(params[1]) + "&wmo=" + params[0];
						} else {
							html += "&city=Berlin&wmo=10384";
						}
					}
					html += "\" name=\"n-tv.de\" scrolling=\"no\" frameborder=\"0\" ";
					if ($("#hpnews_form input[@name=\"size\"]:checked").val() == "mini") {
						html += "width=\"200px\" height=\"250px\">";
					} else {
						if ($("#hpnews_form input[@name=\"size\"]:checked").val() == "midi") {
							html += "width=\"300px\" height=\"300px\">";
						} else {
							if ($("#hpnews_form input[@name=\"size\"]:checked").val() == "maxi") {
								html += "width=\"400px\" height=\"350px\">";
							}
						}
					}
					html += "</iframe>";

					$("#hpnews_form #hpnews_code textarea").val(html);
					$('#hpnews_code').toggle(500);

				} else {
					$("#hpnews_error").show();
				}
		});

	};


	$.fn.ntv_hpnews_generate_new = function() {
		return this.each( function() {
				$('#hpnews_code').hide();
				$("#hpnews_code textarea").empty();

				var css = {
						"ntv_link_container": {
							"css": "display: block; overflow: hidden; padding: 0;",
							"size": {
								"mini": "height: 250px; width: 200px;",
								"midi": "height: 300px; width: 300px;",
								"maxi": "height: 350px; width: 400px;"
							}
						},
						"ntv_link": {
							"css": "border: none; display: block; float: none; height: 45px; outline: none; overflow: hidden; text-indent: 0; width: 400px;"
						},
						"ntv_link_img": {
							"css": "border: none; display: block; float: none; height: 45px; outline: none; width: 400px;"
						}
				};

				// generate basic html
				var html = [];
				html.push("<div>");
				html.push("<div id=\"ntv_link_container\">");
					html.push("<a id=\"ntv_link\" href=\"http://www.n-tv.de\" title=\"Nachrichten, aktuelle Schlagzeilen und Videos - n-tv.de\">");
						html.push("<img id=\"ntv_link_img\" src=\"http://www.n-tv.de/stat/images/hp_news/ntv_link.png\" alt=\"n-tv.de\" />");
					html.push("</a>");
					html.push("<script type=\"text/javascript\" src=\"\"></script>");
				html.push("</div>");
				html.push("</div>");
				var $html = $(html.join(""));


				// base script source
				var jssrc = [];
				jssrc.push("http:/www.n-tv.de/resources/ver1-0/js/jquery.hp_news.js?");

				// define elements and size
				var elements = $("#hpnews_form input:checked");
				var elementsLength = elements.length;

				if (elementsLength > 1) {
					$("#hpnews_error").hide();

					$.each(elements, function (index, item) {
						jssrc.push(item.name + "=" + item.value);
						if (index < elementsLength - 1) {
							jssrc.push("&");
						}
					});

					// set size
					var size = $("#hpnews_form input[@name=\"size\"]:checked").val() || "mini";

					// add weather config if maxi-version
					if ($("#hpnews_form input[@name=\"size\"]:checked").val() == "maxi") {
						if ($("#hpnews_form #hpnews_city").val()) {
							var params = $("#hpnews_form #hpnews_city").val().split(";");
							jssrc.push("&city=" + encodeURI(params[1]) + "&wmo=" + params[0]);
						} else {
							jssrc.push("&city=Berlin&wmo=10384");
						}
					}

					// set js source
					$html
						.find("script")
						.attr("src", jssrc.join(""));

					// add inline styles
					$html
						.find("#ntv_link_container")
						.attr("style", css["ntv_link_container"].css + css["ntv_link_container"].size[size])
						.end()
						.find("#ntv_link")
						.attr("style", css["ntv_link"].css)
						.end()
						.find("#ntv_link_img")
						.attr("style", css["ntv_link_img"].css);

					// show html
					$("#hpnews_form #hpnews_code textarea").val($html.html());
					$('#hpnews_code').toggle(500);

				} else {
					$("#hpnews_error").show();
				}
		});

	};


	$.fn.ntv_hpnews_show = function() {
		return this.each( function() {
			if($(this).attr("id")=="hpnews_showmini"){
				$('#iframe_mini').toggle(500);
				$('#hpnews_mini').attr('checked','checked');
				//$('#hpnews_weather').hide();
			}
			if($(this).attr("id")=="hpnews_showmidi"){
				$('#iframe_midi').toggle(500);
				$('#hpnews_midi').attr('checked','checked');
				//$('#hpnews_weather').hide();
			}
			if($(this).attr("id")=="hpnews_showmaxi"){
				$('#iframe_maxi').toggle(500);
				$('#hpnews_maxi').attr('checked','checked');
				//$('#hpnews_weather').show();
			}
		});
	};


	// make text clickable
	$.fn.ntv_js_link = function() {
		return this.each( function() {
			var $link, href, target = null;

			if($(this).find("a").size() > 0) {
				$link = $(this).find("a");
				href = $link.attr("href");
				target = $link.attr("target") || "_self";
			}
			else if($(this).parent().find("a:first").size() > 0) {
				$link = $(this).parent().find("a:first");
				href = $link.attr("href");
				target = $link.attr("target") || "_self";
			}

			if($link != null){
				$(this)
					.css("cursor", "pointer")
					.click(function() {
						window.open( href, target );
					});
			}
		});
	};

	$.fn.ntv_js_link_new = function() {
		return this.each( function() {
			$("li",this).each(function(){
				var $link, href, target = null;

				if($(this).find("a").size() > 0) {
					$link = $(this).find("a");
					href = $link.attr("href");
					target = $link.attr("target") || "_self";
				}
				if($link != null){
					$(this)
						.css("cursor", "pointer")
						.click(function() {
							window.open( href, target );
						});
				}

			});


		});
	};


	$.fn.ntv_media_teaser = function( options ) {
		var settings = $.extend({
			interval: 5000,
			speed: 350,
			wrapper: ".wrapper_nav"
		}, options);

		return this.each( function() {
			var teaser = this;


			// fader functioniality
			var $items = $( this ).find( "ul.fade li" );



			var $wrapper = $( this ).find( settings.wrapper );

			var index = 0;
			var count = $items.size();
			var interval = null;

			$items.each( function( i ) {
				$( this ).find( ".wrapper_text .scroll" ).append( '<a class="forward">vor</a><span>'+ (i+1) + '/' + count + '</span><a class="backward">zur&uuml;ck</a>' );
				$( this ).find( "a.forward" ).click( function(){
					slide( $items[i], $items[i < count-1 ? i+1 : 0], true );
				});
				$( this ).find( "a.backward" ).click( function(){
					slide( $items[i], $items[i <= 0 ? count-1 : i-1], true );
				});
			});

			function slide( active, next, clear ) {
				$( active ).removeClass( "active" );
				$( next ).addClass( "active" );

				clear ? window.clearTimeout( interval ) : setFadeTimeout( settings.interval );
			}

			function setFadeTimeout( timeout ){
				var timout = timout || settings.interval;

				interval = window.setTimeout( function() {
					var active = $items[index];
					index < count-1 ? index++ : index = 0;
					var next = $items[index];
					slide( active, next, false );
				}, timeout );

				intervalStart = new Date().getTime();
			}

			if(count > 0) {
				setFadeTimeout( settings.interval );
			}

		});
	};


	$.fn.ntv_medrect = function( rePos ) {

		if( $("#medrect").height() >  30 && $("#medrect_ref").length>0 ){
			if ( !rePos ){
				$("#medrect_ref").before('<div class="medrect_header">Anzeige</div>');
			}
			$("#medrect").css({'top' : $("#medrect_ref").position().top,  'left' : $("#medrect_ref").position().left, 'display' : 'block'});
			$("#medrect_ref").css({'width' : $("#medrect").width(), 'height' : $("#medrect").height()});
			if ( !rePos ){
				$("#medrect_ref").after('<div class="medrect_footer"></div>');
			}
		}
		if( $("#medrect2").height() >  30 && $("#medrect2_ref").length>0 ){
			if ( !rePos ){
				$("#medrect2_ref").before('<div class="medrect_header">Anzeige</div>');
			}
			$("#medrect2").css({'top' : $("#medrect2_ref").position().top,  'left' : $("#medrect2_ref").position().left, 'display' : 'block'});
			$("#medrect2_ref").css({'width' : $("#medrect2").width(), 'height' : $("#medrect2").height()});
			if ( !rePos ){
				$("#medrect2_ref").after('<div class="medrect_footer"></div>');
			}
		}
		if( $("#medrectprem").height() >  30 && $("#medrectprem_ref").length>0 ){
				$(".mediathek_teaser hr").hide();
				$("#medrectprem").css({'top' : $("#medrectprem_ref").offset().top,  'left' : $("#medrectprem_ref").offset().left, 'display' : 'block'});
				$("#medrectprem_ref").css({'width' : $("#medrectprem").width(), 'height' : $("#medrectprem").height()});
		}
	}

	/*
	$.fn.ntv_medrectprem = function() {
		if( $(this).height() >  30 && $("#medrectprem_ref").length>0 ){
			$(".mediathek_teaser hr").hide();
			$(this).css({'top' : $("#medrectprem_ref").offset().top,  'left' : $("#medrectprem_ref").offset().left, 'display' : 'block'});
			$("#medrectprem_ref").css({'width' : $("#medrectprem").width(), 'height' : $("#medrectprem").height()});
		}
	}
	*/

	$.fn.ntv_xxlbanner = function() {
		if( $(this).height() >  30 && $("#xxl_banner_ref").length>0 ){
			$(this).css({'top' : $("#xxl_banner_ref").offset().top,  'left' : $("#xxl_banner_ref").offset().left, 'display' : 'block'});
			$("#xxl_banner_ref").css({'width' : $("#xxl_banner").width(), 'height' : $("#xxl_banner").height()});
			$("#medrect").ntv_medrect( true );
		}
	}




	$.fn.ntv_navigation = function( settings ) {
		// set icon for quicknavi
		$( "#quickNavigation" ).ntv_bookmarking_home();

		// qickfix: style for videotabs
		if( ntv_location != 'media' ){
			$("#primaryNavigation li:last-child").addClass( 'video' );
		}
		if( ntv_location == 'media' && ntv_navipath == 'Video' ){
			$("#secondaryNavigation li:first-child").addClass( 'active' );
		}

		// settings
		var s = $.extend({
			activeClass: "hover",
			last_link: null,
			pageWidth: 996,
			time: 250,
			timeout: null,
			speed: 'fast'
		}, settings);

		// events
		return this.each( function() {

			// layer events + positioning
			var $layer = $( this ).next();

			if( $layer.length !== 0 ) {
				// if the layer is to far to the right.
				if( $( this ).offset().left + $layer.width() > s.pageWidth ) {
					var overhang = ( $( this ).offset().left + $layer.width() ) - s.pageWidth;
					$layer.css( "left", $( this ).offset().left - overhang );
				}

				$layer.bind( "mouseover", function(e) {
					window.clearTimeout( s.timeout );
				});
				$layer.bind( "mouseout", function(e) {
					s.timeout = window.setTimeout( function() {
						navigator.userAgent.toLowerCase().indexOf('ie') != -1 ?
							$layer.hide() : $layer.fadeOut( s.speed );
					}, s.time );
				});

				// secondary links events
				$( this ).bind( "mouseover", function(e) {
					if( s.last_link != this ) {
						navigator.userAgent.toLowerCase().indexOf('ie') != -1 ?
							$( s.last_link ).next().hide() : $( s.last_link ).next().fadeOut( s.speed );
						s.last_link = this;
					} else {
						window.clearTimeout( s.timeout );
					}
					navigator.userAgent.toLowerCase().indexOf('ie') != -1 ?
						$layer.show() : $layer.fadeIn( s.speed );
				});
				// mouseout
				$( this ).bind( "mouseout", function(e) {
					s.timeout = window.setTimeout( function() {
						navigator.userAgent.toLowerCase().indexOf('ie') != -1 ?
							$layer.hide() : $layer.fadeOut( s.speed );
					}, s.time );
				});

				// layer links events
				var $links = $layer.find( "a" );
				// generate tree for coloring
				$links.each( function( index, anchor ) {
					$( anchor ).data( "tree", new Array() );
					(function( a ) {
						$( anchor ).data( "tree" ).push( a );
						var parent = $( a ).closest( "ul" ).prev( "a" );
						if( parent.length !== 0 ) {
							arguments.callee( parent );
						}
					})( anchor );
				});
				$links.hover(
					// mouseover
					function(e) {
						var tree =  $( e.target ).data( "tree" );
						$.each( tree, function() {
							$( this ).addClass( s.activeClass );
						});
					},
					// mouseout
					function(e) {
						var tree =  $( e.target ).data( "tree" );
						$.each( tree, function() {
							$( this ).removeClass( s.activeClass );
						});
					}
				);
			}
		});
	};


	$.fn.ntv_newslist_switch = function(){
		return this.each(function(){
			var $tabs = $(".nav li", this);
			var $tabLinks = $(".nav a:not(.rss)", this);
			var $lists = $(".list", this);

			$tabLinks.click(function(){
				var idx = $tabLinks.index(this);
				var activeClass = idx === 0 ? "newest_active" : "most_clicks_active";
				var inactiveClass = idx !== 0 ? "newest_active" : "most_clicks_active";

				$tabs
					.removeClass(inactiveClass)
					.eq(idx)
					.addClass(activeClass);
				$lists
					.removeClass("active")
					.eq(idx)
					.addClass("active");

				return false;
			});
		});
	};


	$.fn.ntv_player = function(settings) {
		var options = $.extend(
				{
					"w3c": true,
					"bgcolor": "#333333",
					"advertising": true,
					"modus": "vod",
					"theme": "video",
					"stationid": "http://www.n-tv.de/stat/videoplayer/ntv_stationid.f4v",
					"teaser_url": null
				}, settings
		);

		ntv.log(options.stationid);

		ntv.videotag = options.theme;

		if(ntv.urlParams.sProt){

			if(options.modus == "live" || options.modus == "eventfeed"){
				options.video = ntv.urlParams.sProt + "://fms.n-tv.de" + options.video;
			}else{
				options.video = ntv.urlParams.sProt + "://fms.n-tv.de/ntv" + options.video;
			}
		}else{
			if(options.modus == "live" || options.modus == "eventfeed"){
				options.video = "rtmp://fms.n-tv.de" + options.video;
			}else{
				options.video = "rtmp://fms.n-tv.de/ntv" + options.video;
			}
		}

		//var src = "http://www.n-tv.de/stat/videoplayer/ntv_player.swf?flv="+options.video+"&type="+options.modus;
		var src = "http://www.n-tv.de/stat/videoplayer/ntv_player.swf?flv="+options.video+"&type="+options.modus+(options.stationid?"&stationid="+options.stationid:"");

		if( ntv.urlParams["playertest"] ){
			src = "http://www.n-tv.de/stat/videoplayer/ntv_player_test.swf?flv="+options.video+"&type="+options.modus;
		}

		if(options.modus == "live"){
			src = src + "&stopafter=1800&geoipcheck=1";
		}
		if(options.modus == "eventfeed"){
			src = src + "&stopafter=1800";
		}
		if( options.image ){
			src = src + "&as=0&startimage=" + options.image;
		}else{
			src = src + "&as=1";
		}
		if(options.advertising == true && window.location.href.indexOf("ad=of")<0){
			src = src + "&admeta=http://www.n-tv.de/stat/videoplayer/admeta.xml";
			src = src + "&adcall=http://ad.de.doubleclick.net/adx/www.nntv.de/" + ivw_code + ";pack=;theme="+options.theme+";playerseite=ja;"+n_pbt+"playersize=" + options.width +  "x" + options.height + ";dcmt=text/xml;";
			src = src + "&tile=10";
			src = src + "&ord=ord=" + ip_random;
			src = src + "&adclasses=0";
			if(options.modus == "live" || options.modus == "eventfeed"){
				src = src + "&adconfig=1,0,0";
			}else{
				src = src + "&adconfig=1,1,1";
			}
		}
		src = src + "&bgcolor=" + options.bgcolor;
		if(options.teaser_url){
			src = src + "&teaser_url=" + escape(options.teaser_url);
		}
		src = src + "&angebot=ntv&ivw=/"+ntv_sitename+"/"+ntv_section;


		return this.each(function(){
			$(this).flashembed(
					{
						src: src,
						width: options.width,
						height: options.height,
						w3c: options.w3c,
						bgcolor: options.bgcolor
					});
		});
	};

	/*
	$.fn.ntv_poll = function( url ) {
		return this.each(function(){
			var container = this;

			$( this ).find( "form" ).submit(function() {
				var choice = $( this ).find( "input:checked" );
				$( container ).load( url, choice);
				return false;
			});
		});
	};
	*/

	$.fn.ntv_poll = function( url ) {
		return this.each(function(){
			var container = this;
			var form = $("form",this);

			$( ".radio",form ).change(function() {
				form.submit();
			});
		});
	};


	$.fn.ntv_search = function() {

		return this.each(
				function() {
					var activeID;
					var a = $(this).find( ".select a" ).each(
						function() {

							if( $(this).attr( "class" )=='active' ) {
								activeID = $(this);
							}

							$(this).click(
									function(){
										$(activeID).removeClass( 'active' );
										$(this).addClass( 'active' );
										activeID = $(this);

										//$( "#search_form #searchabout" ).attr( "value",$(this).attr( "id" ) );

										$( "#search_form" ).attr( { "action": "", "target": "_self" } );

										if ( $(this).attr("id")=="ntv" ){
											$( "#search_form input[name='at']" ).attr( "value","all" );
										}
										if ( $(this).attr("id")=="news" ){
											$( "#search_form input[name='at']" ).attr( "value","m" );
										}
										if ( $(this).attr("id")=="gallery" ){
											$( "#search_form input[name='at']" ).attr( "value","b" );
										}
										if ( $(this).attr("id")=="video" ){
											$( "#search_form input[name='at']" ).attr( "value","v" );
										}

										if ( $(this).attr("id")=="quote" ){
											//$( "#search_form" ).attr("action","http://kurse.teleboerse.de/DE/showpage.aspx");
											//$( "#search_form" ).attr("target","_blank");
											window.open("http://kursdaten.teleboerse.de/teleboerse/kurse_einzelkurs_suche.htn?seite=suche&suchbegriff="+$( "#search_form input[name='q']" ).attr( "value"), "tb");
											return false;

										}

										var issearchstring = false;
										var inp = $( "#search_form" ).find( "input" ).each(
												function() {
													if( $(this).attr( "type" ) == "text" && $(this).attr( "value" )){
														issearchstring = true;
													}
												}
										);
										if (issearchstring==true){
											$( "#search_form" ).submit();
										}
										return false;
									}
							);

						}
					);

					var isdetailsearch = false;
					var detailinp = $( "#search_form #detailsearch" ).find( "input" ).each(
							function() {
								if( $(this).attr( "type" ) == "text" && $(this).attr( "value" )){
									isdetailsearch = true;
								}
							}
					);
					if (isdetailsearch==true){
						$('#detailsearch').show();
						var a = $(this).find( "a.more_light" ).each(
								function() {
									$(this).html("Detailsuche schlie&szlig;en");
								}
						);
					}
				}
		);
	};



	$.fn.ntv_search_detail = function() {
		return this.each( function() {
			if ( $('#detailsearch').css("display") == "none" ){
				$('#detailsearch').show();
				$(this).html("Detailsuche schlie&szlig;en");
			} else {
				$('#detailsearch').hide();
				$(this).html("Detailsuche");
			}
		});
	};


	$.fn.ntv_search_head = function() {
		return this.each(function () {
			$( this ).submit(function(){
				var id = $( "input:checked", this ).attr( "id" );
				switch( id ) {
					case "shares":
						var url = "http://kursdaten.teleboerse.de/teleboerse/kurse_einzelkurs_suche.htn?seite=suche&suchbegriff=" + $( "input#search", this ).val();
						var teleb = window.open(url, "teleboerse");
						teleb.focus();
						return false;
						break;
					case "shop":
						var url = "http://shop.n-tv.de/Suche/?q=" + $( "input#search", this ).val();
						var shop = window.open(url, "shop");
						shop.focus();
						return false;
						break;
					case "google":
						var url = "http://www.n-tv.de/websuche?cx=partner-pub-2530298322057252:igr6xq-lhje&cof=FORID:11&ie=UTF-8&q=" + $( "input#search", this ).val();
						window.location.href=url;
						//var google = window.open(url, "google");
						//google.focus();
						return false;
						break;
					default:
						return true;
						break;
				}
			});
		});
	};


	$.fn.ntv_search_head_evalSuggest = function() {

		var showSuggest = function(data){
			var html = '';
			for (var row = 0; row < data.length; ++row){
				html += '<a href="http://www.n-tv.de/suche/?searchabout=ntv&a=search&q=' + data[row] + '" target="_blank">' + data[row] + '</a><br/>';
			}
			$("#searchAutoSuggest").html(html);
			$("#searchAutoSuggest").show();
		}

		var url;

		if($(this).val().length > 1){


			//url = "resources/dummy/suggest.json";
			url = "http://dev.dt-data.de/proxy/proxy?term=" + $(this).val();

			$.ajax({
			    url: url,
			    dataType: 'json',
			    success: function( data ){

						showSuggest(data);
			      },
			      error: function( e ){

			      }
			});
		}
	}


	$.fn.ntv_slideshow = function( images, settings ) {
		var s = $.extend({
			/* defaults */
			buttonNextClass: 'next',
			buttonPrevClass: 'previous',
			fadeTime: 200,
			imgContainerClass: 'imgContainer',
			loadingAnimClass: 'loading',
			onClick: function(){},
			textContainerClass: 'textContainer',
			preloadImages: true
		}, settings );

		if( s.preloadImages ) {
			(function(index) {
				var tempImg = new Image();
				var callee = arguments.callee;
				tempImg.src = images[index];
				tempImg.onload = function() {
					images[index + 1] && callee(index + 1);
				};
			})(0);
		}

		return this;
	};


	$.fn.ntv_text = function(opts) {
		var options = $.extend({
			"rep": 0
		}, opts);

		var rep = {
			0: "(dpa)",
			1: "dpa"
		};
		return this.each(function(){
			$(this).html(rep[options.rep]);
		});
	};



	$.fn.ntv_social_bookmarking = function() {
		return this.each( function() {
			var list = $( this ).find( "ul.jq_social_bookmarks_list" );
			var target = $( this ).find( "span.bm_service" );

			// Rollover
			$( list ).find( "a" ).each( function( index, li ) {
				$( li ).hover(
					function() {
						var text = $( this ).text();
						$( target ).text( text );
					},
					function() {
						$( target ).text( "" );
					}
				);
			});

			// neues Fenster bei click
			$( list ).find( "a" ).each( function() {
				$( this ).click( function() {
					window.open( $(this).attr( "href" ) );
					return false;
				});
			});

		});

	};

	$.fn.ntv_video_play = function() {
		return this.each( function() {

			if( this.nodeName == "A" ){
				$( this ).append( "<span class='play'></span>" ).css( "cursor", "pointer" );
				var top = Math.round(($(this).height() - 48)/2) + "px";
				var left = Math.round(($(this).width() - 81)/2) + "px";
				$("span.play", this).css({ "top":top, "left":left });
			}else{

				try {
					var a = $(this).find( "a" ).get( 0 );
					var href = a.href;
					$( a ).append( "<span class='play'></span>" ).css( "cursor", "pointer" );
				} catch ( e ) {}

			}
		});
	};

	$.fn.ntv_buttonVideo = function() {
		return this.each( function() {

			var image = $("img",this);
			var imageWidth = image.width();
			var imageHeight = image.height();

			var buttonSrc = relat_prefix + "img/butt_play_v_l.png";
			var buttonHoverSrc = relat_prefix + "img/butt_play_v_l_roll.png";
			var posLeft = Math.round((imageWidth - 88)/2) + "px";
			var posTop = Math.round((imageHeight - 50)/2) + "px";

			if (imageWidth<440){
				buttonSrc = relat_prefix + "img/butt_play_v_m.png";
				buttonHoverSrc = relat_prefix + "img/butt_play_v_m_roll.png";
				posLeft = Math.round((imageWidth - 58)/2) + "px";
				posTop = Math.round((imageHeight - 34)/2) + "px";
			}
			if (imageWidth<220){
				buttonSrc = relat_prefix + "img/butt_play_v_s.png";
				buttonHoverSrc = relat_prefix + "img/butt_play_v_s_roll.png";
				posLeft = Math.round((imageWidth - 30)/2) + "px";
				posTop = Math.round((imageHeight - 18)/2) + "px";
			}

			var $button = $('<img>');
			$button.attr("src",buttonSrc);
			$button.css({"position": "absolute","left": posLeft, "top": posTop});

			$(this).append($button);

			$(this).mouseover(function(){
				$button.attr("src",buttonHoverSrc);
			});
			$(this).mouseout(function(){
				$button.attr("src",buttonSrc);
			});
		});
	};

	$.fn.ntv_buttonGallery = function() {
		return this.each( function() {

			var image;

			if($(".images",this).length>0){
				image = $(".images",this);
			}else{
				image = $("img",this);
			}

			var imageWidth = image.width();
			var imageHeight = image.height();

			var buttonSrc = relat_prefix + "img/butt_play_bs_l.png";
			var buttonHoverSrc = relat_prefix + "img/butt_play_bs_l_roll.png";
			var posLeft = Math.round((imageWidth - 88)/2) + "px";
			var posTop = imageHeight - 70 + "px";

			if (imageWidth<440 || imageHeight<300){
				buttonSrc = relat_prefix + "img/butt_play_bs_m.png";
				buttonHoverSrc = relat_prefix + "img/butt_play_bs_m_roll.png";
				posLeft = Math.round((imageWidth - 58)/2) + "px";
				posTop = imageHeight - 50 + "px";
			}
			if (imageWidth<220){
				buttonSrc = relat_prefix + "img/butt_play_bs_s.png";
				buttonHoverSrc = relat_prefix + "img/butt_play_bs_s_roll.png";
				posLeft = Math.round((imageWidth - 30)/2) + "px";
				posTop = imageHeight - 25 + "px";
			}

			var $button = $('<img>');
			$button.attr("src",buttonSrc);
			$button.css({"position": "absolute","left": posLeft, "top": posTop});

			$(this).append($button);

			$(this).mouseover(function(){
				$button.attr("src",buttonHoverSrc);
			});
			$(this).mouseout(function(){
				$button.attr("src",buttonSrc);
			});
		});
	};


	$.fn.ntv_chron_video_play = function(){
		return this.each(function(){
			$(this).append("<span class=\"play\"></span>");
		});
	};


	// Mediathek

	$.fn.ntv_media_detail = function( options ) {
		var settings = $.extend({
			backgroundColor: "#383838",
			linkColor: "#FFFFFF"
		}, options);

		return this.each( function() {
			var $container = $( this );
			var $link = $( this ).find( "a" );
			var $detail = $( this ).find( ".detail" );
			var backgroundColor = $( this ).css( "backgroundColor" );
			var timeout = null;

			$link.hover(
					// over
					function() {

						timeout = window.setTimeout(function(){
							//$container.css( "backgroundColor", settings.backgroundColor );
							$detail.css( "backgroundColor", settings.backgroundColor );
							$detail.show();
						}, 200);
					},
					// out
					function() {
						window.clearTimeout( timeout );
						$detail.hide();
						//$container.css( "backgroundColor", backgroundColor );
						$detail.css( "backgroundColor", backgroundColor );
					}
			);
		});

	};

	/*
	$.fn.ntv_slideTeaser = function() {

		var slider = $(this);
		var ul = slider.find("ul");
		var duration = 500;
		var left = 0;
		var slideWidth = 680 + parseInt( slider.find( "ul li" ).css( "padding-right") );

		slider.find( ".slide" ).css( "height", slider.find( "ul li" ).height() );

		if ( slider.find( "ul li:last-child" ).offset().left > 690 ){
			slider.find( ".forward a" ).css( "display", "block" );
		}



		slider.find( ".forward a" ).click(
			function(){
				slider.find( ".forward a" ).css( "display", "none" );
				$( ul ).animate( { left: parseInt( $ ( ul ).css( "left") ) - slideWidth }, duration, function(){
					slider.find( ".backward a" ).css( "display", "block" );
					if ( slider.find( "ul li:last-child" ).offset().left >=  slider.offset().left + 680 ){
						slider.find( ".forward a" ).css( "display", "block" );
					}
				});
				return false;
			}
		);

		slider.find( ".backward a" ).click(
			function(){
				slider.find( ".backward a" ).css( "display", "none" );
				slider.find( "ul" ).animate( { left: parseInt( $ ( ul ).css( "left") ) + slideWidth }, duration, function(){
					slider.find( ".forward a" ).css( "display", "block" );
					if ( slider.find( "ul li:first-child" ).offset().left <  slider.offset().left ){
						slider.find( ".backward a" ).css( "display", "block" );
					}
				});
				return false;
			}
		);

		slider.find(".teaser_mod" ).ntv_modDetail();
	};

	*/

	$.fn.ntv_slideTeaser = function() {

		var slider = $(this);
		var duration = 500;
		var left = 0;
		var teaserCount = slider.find("ul").children("li").length - slider.find("ul li ul").children("li").length;
		var slideWidth = slider.find( "ul li" ).width() + parseInt( slider.find( "ul li" ).css( "padding-right") );
		var slideEnd = teaserCount * slideWidth - slider.width() - parseInt( slider.find( "ul li" ).css( "padding-right") );

		var height = 0;
		$( slider ).find( "li" ).each( function() {
			if ( $(this).height() > height ){
				height = $(this).height();
			}
		});
		slider.find( ".slide" ).css( "height", height );

		if ( teaserCount * slideWidth > 690 ){
			slider.find( ".forward a" ).css( "display", "block" );
		}

		slider.find( ".forward a" ).click(
			function(){
				slider.find( "ul" ).animate( { left: left - slideWidth }, duration );
				slider.find( ".backward a" ).css( "display", "block" );
				left = left - slideWidth;
				if (left <= -slideEnd ){
					slider.find( ".forward a" ).css( "display", "none" );
				}
				return false;
			}
		);

		slider.find( ".backward a" ).click(
			function(){
				slider.find( "ul" ).animate( { left: left + slideWidth }, duration );
				slider.find( ".forward a" ).css( "display", "block" );
				left = left + slideWidth;
				if (left >= 0 ){
					slider.find( ".backward a" ).css( "display", "none" );
				}
				return false;
			}
		);

		slider.find(".teaser_mod" ).ntv_modDetail();
	};


	$.fn.ntv_hideDoubleTeaser = function( options ) {


		var isInUrlList = function(url){
			for ( var i=0; i < options.filterUrlList.length; ++i ){
				if( url == options.filterUrlList[i] ){
					return true;
				}
			}
		}

		$( options.selector, this ).each( function(){
			if( isInUrlList($( "a",this ).attr("href")) ){
				$(this).hide();
			}
		});
	};


	$.fn.ntv_prevBox = function( options ) {

		if( options && options.filterUrlList ){
			var selector = ".teaser_220_450";
			if( $(".newest .ajax_container div", this).hasClass("teaser_slideshow_680") ){
				selector = ".teaser_slideshow_680";
			}
			$(".newest", this).ntv_hideDoubleTeaser( { "filterUrlList": options.filterUrlList, "selector": selector } );
		}

		var newest_link = $(this).find( "a.newest" );
		var most_viewed_link = $(this).find( "a.most_viewed" );
		var newest_box = $(this).find( "div.newest" );
		var most_viewed_box = $(this).find( "div.most_viewed" );

		$(newest_link).click(
			function(){
				$( most_viewed_link ).parent().removeClass( "active" );
				$( newest_link ).parent().addClass( "active" );

				$(newest_box).show();
				$(most_viewed_box).hide();
				return false;
			}
		);
		$(most_viewed_link).click(
			function(){
				$( newest_link ).parent().removeClass( "active" );
				$( most_viewed_link ).parent().addClass( "active" );

				$(most_viewed_box).show();
				$(newest_box).hide();
				return false;
			}
		);

		$(this).find( ".ajax_container" ).ntv_scrollAjax();
	};

	$.fn.ntv_scrollAjax = function() {

		var container = $(this);
		var html_cache = new Object();

		var init = function(){

			var backward = $(container).find( ".backward a" );
			var forward = $(container).find( ".forward a" );

			$(backward).css( "display", "none" );
			$(forward).css( "display", "none" );

			if($(backward).attr("href")){
				preload($(backward));
			}
			if($(forward).attr("href")){
				preload($(forward));
			}

		}

		var preload = function(button){
			var url = $(button).attr("href");

			if(!html_cache[url]){
				$.get( url, function(html) {
					html_cache[url] = html;
					setClick(button);
				});
			}
			else{
				setClick(button);
			}
		}

		var setClick = function(button){

			$(button).click(
				function(){
					$(container).html(html_cache[$(this).attr("href")]);
					init();
					return false;
				}
			);
			$(button).css( "display", "block" );
		}

		init();

	};


	$.fn.ntv_modDetail = function() {

		var ref_html;

		$( this ).find( "> li" ).each( function() {

			$( this ).find( ".teaser img" ).click( function() {

				ref_html = $( this ).closest("li").find(".detail").html();

				$('#mod_detail').toggle( 1000, function() {
					$("#mod_detail .wrapper").html( ref_html );
				});
				$("#mod_detail").toggle(1000);
			});
		});
	};



	$.fn.ntv_bilder_slideshow = function( options ) {
		var settings = $.extend({
			backward: ".switch a.backward",
			forward: ".switch a.forward",
			images: null,
			imageContainer: "#wrapper_img",
			loadImageSrc: relat_prefix + "bilderserie/img/loader.gif",
			speed: "slow",
			startIndex: 0,
			textContainer: "#wrapper_txt p"
		}, options);

		var $backward = $( settings.backward );
		var $forward = $( settings.forward );
		var $imageContainer = $( settings.imageContainer );
		var imageContainerHeight = $imageContainer.height();
		var $textContainer = $( settings.textContainer );
		var $creditContainer;

		var $loadingImg = $( "<img />" ).load( function () {
			$( this ).css( "marginTop", (imageContainerHeight - this.height)/2 );
			$imageContainer.append( this );
		}).attr({
			alt: "Bild wird geladen",
			src: settings.loadImageSrc
		});


		var imgCount = settings.images.length;
		var index = 0;
		index = settings.startIndex>0 && settings.startIndex<=imgCount ? settings.startIndex : index;

		var switchImage = function( i, preload, getIVW ) {

			var $nextImg = $( "<img />" ).load(

					function() {
						var marginTop = imageContainerHeight - this.height - 27;
						$( this ).
							css({
								//cursor: "pointer",
								display: "none",
								marginTop: marginTop
							})
							.addClass( "slide_img" );
						$loadingImg.hide();
						$imageContainer.find( "img.slide_img" ).replaceWith( this );
						$( this ).fadeIn( settings.speed, function(){
						});
						$textContainer.html( $("#wrapper_captions p:nth-child(" + (index+1) + ")").html() );
						$creditContainer.html( settings.images[i].credit != "" ? "(Foto: " + settings.images[i].credit + ")" : "" );
						$creditContainer.css("padding-right", 340 - this.width/2);

						if( getIVW ){
							var ivwImage = $( "<img />" );
							var src = "http://ntv.ivwbox.de/cgi-bin/ivw/CP/"+ivw_code+";/"+ntv_sitename+"/"+ntv_navipath+"?r="+escape(document.referrer)+"&d="+(Math.random()*100000);

							ivwImage.attr({
								src: src
							});
						}
					}
			).attr( {
				src: settings.images[i].src,
				alt: "",
				title: settings.images[i].credit != "" ? "(Foto: " + settings.images[i].credit + ")" : ""
				}
			);

			if( preload && i < imgCount-1 ) {
				var $preloadImage = $( "<img />" );
				$preloadImage.attr( "src", settings.images[i+1].src );
			}

		};

		// get the first image and show it
		$imageContainer.append('<span class="credit"></span>');
		$creditContainer = $imageContainer.find( "span.credit" );
		switchImage( index, true, false );

		// register click events
		return this.each( function() {
			var that = this;
			$(".counter", that).html((index + 1) + " / " + imgCount);

			$forward.click(function() {
				index == imgCount-1 ? index = 0 : index++;
				switchImage( index, true, true );
				$(".counter", that).html((index + 1) + " / " + imgCount);
				return false;
			});

			$backward.click(function() {
				index == 0 ? index = imgCount-1 : index--;
				switchImage( index, false, true );
				$(".counter", that).html((index + 1) + " / " + imgCount);
				return false;
			});
		});
	};

	$.fn.ntv_slideshowInline = function() {

		/* ##### Container ####### */


		var $container = $( "<div id='slideshow_inline' />" );
		$container.css( "height", $( "body" ).height()+"px" );
		$( "body" ).prepend( $container );
		var html = '';
		html += '<div class="slideshow">';
		html += '<div class="clearfix">';
		html += '<a href="" class="backward" title="zur&uuml;ck"><span>voriges Bild</span></a>';
		html += '<a href="" class="forward" title="vorw&auml;rts"><span>n&auml;chstes Bild</span></a>';
		html += '</div>';
		html += '<img class="slide_img"/>';
		html += '<span class="credit">&copy; OL</span>';
		html += '<span class="exit">X SCHLIESSEN</span>';
		html += '</div>';
		$container.append( html );

		$container.find(".slideshow").click( function(){
			return false;
		});

		$container.find(".exit").click( function(){
			$container.fadeOut( "slow", function() {
				try {
					$( $container ).remove();
				} catch (err) {}
			});
		});

		$container.fadeIn( "slow" );
		$container.click( function() {
			$container.fadeOut( "slow", function() {
				try {
					$( $container ).remove();
				} catch (err) {}
			});
		});


		/* ##### Slideshow ####### */

		var imageJSON = $(this).attr("href");
		var images;
		var imgCount;



		var $backward = $( "#slideshow_inline a.backward" );
		var $forward = $( "#slideshow_inline a.forward" );
		var $imageContainer = $( "#slideshow_inline .slideshow" );
		var loadImageSrc = relat_prefix + "bilderserie/img/loader.gif";
		var speed = "slow";
		var $loadingImg = $( "<img />" ).load( function () {
			$imageContainer.append( this );
		}).attr({
			alt: "Bild wird geladen",
			src: loadImageSrc
		});

		var index = 0;

		var ivw_code_slideshow = "pa_swe_i";

		$.getJSON( imageJSON, function(data) {
			if( data.length>0 ){
				images = data;

				if(ntv.urlParams.swId){
					for (var i = 0; i < images.length; ++i){
						if( (images[i].src).indexOf("/"+ntv.urlParams.swId+"/")>-1){
							index = i;
						}
					}
				}


				imgCount = images.length;
				// get the first image and show it
				switchImage( index, true, true );

				// register click events
				$forward.click(function() {
					index == imgCount-1 ? index = 0 : index++;
					switchImage( index, true, true );
					return false;
				});

				$backward.click(function() {
					index == 0 ? index = imgCount-1 : index--;
					switchImage( index, false, true );
					return false;
				});
	       }
		});

		var switchImage = function( i, preload, getIVW ) {

			var $nextImg = $( "<img />" ).load(

					function() {

						$( this ).css( "display", "none");
						$( this ).addClass( "slide_img" );
						$loadingImg.hide();

						$imageContainer.find( "img.slide_img" ).replaceWith( this );
						$imageContainer.css( {"width": $(this).width() + "px", "top": ($( self ).scrollTop()+50) + "px"});


						$( this ).fadeIn( speed, function(){
						});

						if( getIVW ){
							var ivwImage = $( "<img />" );
							var src = "http://ntv.ivwbox.de/cgi-bin/ivw/CP/"+ivw_code_slideshow+";/"+ntv_sitename+"/"+ntv_navipath+"?r="+escape(document.referrer)+"&d="+(Math.random()*100000);

							ivwImage.attr({
								src: src
							});
						}
					}
			).attr( {
				src: images[i].src,
				alt: images[i].credit != "" ? "(Foto: " + images[i].credit + ")" : "",
				title: images[i].credit != "" ? "(Foto: " + images[i].credit + ")" : ""
				}
			);

			if( preload && i < imgCount-1 ) {
				var $preloadImage = $( "<img />" );
				$preloadImage.attr( "src", images[i+1].src );
			}

		};

		return false;
	};

	$.fn.ntv_slideshowSimple = function(options) {

		return this.each(function(){
			var settings = $.extend({
				images: null
			}, options);
			var index = 0;
			var $image = $(this);
			var timeout = null;

			var imagePreload = [];

			if(settings.images.length>1){
				$image.load(function(){
					if( settings.images.length > index+1 && !imagePreload[index+1]){
						imagePreload[index+1] = new Image();
						imagePreload[index+1].src = settings.images[index+1];
					}
					$image.fadeIn(500);
					window.clearTimeout(timeout);
					timeout = window.setTimeout(switchImage, 5000);
				});
			}

			var switchImage = function(){
				if( settings.images.length > index+1){
					index += 1;
				}else{
					index = 0;
				}

				$image
					.fadeOut(500,
						function(){
							$image.attr("src", settings.images[index]);
					});
			};

			$image.attr("src", settings.images[0]);
			imagePreload[0] = new Image();
			imagePreload[0].src = settings.images[0];
		});
	}

	$.fn.ntv_writeMobileMessage = function() {
		if( ntv.showMobileMessage==true ){
			var $div = $("<div />");
			$div.css({ "background": "#A5000C", "color": "#FFFFFF", "font-size": "40px", "text-align": "center", "line-height": "80px", "margin-top": "3px" })
			$div.html('<a href="http://mobil.n-tv.de" style="color: #FFFFFF;">Hier geht es zur optimierten Mobil-Seite &raquo;</a>');
			$(this).append($div);
		}
	}

	$.fn.ntv_media_tab_teaser = function(options) {

		if( options && options.filterUrlList ){
			var selector = "li";
			$(this).ntv_hideDoubleTeaser( { "filterUrlList": options.filterUrlList, "selector": selector } );
		}

		return this.each(function(){
			var tabList = $(options.tabList, this);
			var content = $(options.content, this);

			$("a", tabList).click(function(){
				$("li", tabList).removeClass("active");
				$(this).closest("li").addClass("active");

				var index = $("a", tabList).index(this);
				$(content).removeClass("active");
				$(content).eq(index).addClass("active");

				return false;
			});


		});

	};

	$.fn.ntv_kompaktnews_teaser = function() {

		return this.each( function() {
			var teaser = this;

			var $items = $( this ).find( "div.tabItem" );
			var $navitems = $( this ).find( "ul li" );
			var $wrapper = $( this ).find( "#teaser_kompaktnews .mediathek_teaser_body" );

			var index = 0;
			var count = $items.size();
			var timer = null;
			var interval = 3000;


			function slide() {

				window.clearTimeout( timer );
				timer = window.setTimeout( function() {

					$items.each( function() {
						$( this ).removeClass( "active" );
					});
					$navitems.each( function() {
						$( this ).removeClass( "active" );
					});
					index < count-1 ? index++ : index = 0;
					$($items[index]).addClass( "active" );
					$($navitems[index]).addClass( "active" );

					slide();
				}, interval );
			}

			if(count > 0) {
				timer = window.setTimeout( slide, interval);
			}

		});
	};


	$.fn.ntv_football_schedule = function() {

		var container = $(this);
		var selectList = $( "select", this );
		var selectValue = $("option:selected", selectList).val();


		/*
		if( $("option:selected", selectList).val()=='all' ){
			$( container ).find( "table" ).each( function() {
				$(this).show();
				$( "caption", this ).show();
			});
		}
		*/

		$( container ).find( "table" ).each( function() {
			if( $(this).hasClass("round"+selectValue) || selectValue=='all' ){
				$(this).show();
				if( selectValue=='all' ){
					$( "caption", this ).show();
				}else{
					$( "caption", this ).hide();
				}
			}else{
				$(this).hide();
			}
		});


		$( "select", this ).bind("change",
	        function(){
				selectValue = $("option:selected", this).val();
				$( container ).find( "table" ).each( function() {
					if( $(this).hasClass("round"+selectValue) || selectValue=='all' ){
						$(this).show();
						if( selectValue=='all' ){
							$( "caption", this ).show();
						}else{
							$( "caption", this ).hide();
						}
					}else{
						$(this).hide();
					}
				});
			}
		);
	}

	$.fn.ntv_settingLiHeight = function() {

		var cols = 2;
		var row = [];
		var maxHeight = 0;

		$(this).find("li").each(function(index){

			row.push($(this));
			if($(this).height()>maxHeight)maxHeight = $(this).height();

			if(index%cols!=0){
				for (var i = 0; i < row.length; ++i){
					row[i].css("height", maxHeight + "px");
				}
				row = [];
				maxHeight = 0;
			}

		});

	}

	$.fn.ntv_renderHeadWeather = function() {

		var $container = $(this);

		//document.cookie = "w_city=49_13115; path=/";

		if(getCookie("w_city")){

			var plz=getCookie("w_city");

			var dataUrl = "http://www.n-tv.de/ext.jsp?s=weather&f=ntvpageheader/" + plz + ".xml&ts=" + nRandom;

			if(window.location.protocol != "http:"){
				dataUrl = "resources/dummy/weather/" + plz + ".xml?ts=" + nRandom;
			}

			var renderWeather = function(data){

				var html = [];

				//html.push('<div class="weather clearfix" onclick="location.href=\'http://www.n-tv.de/wetter/5-tage-wetter/?plz=' + data.content.city.plz + '&amp;ort=' + data.content.city.name + '\'">');
				html.push('<div class="weather clearfix" onclick="location.href=\'http://www.n-tv.de/wetter/5-tage-wetter/?plz=' + data.content.city.plz + '&amp;ort=' + data.content.city.name + '\'">');
					html.push('<img src="' + data.content.today.symbolurl.replace(/\/small/g,"") + '" alt="" />');
					html.push('<div class="left clearfix">');
						html.push('<div class="city">' + data.content.city.name + '</div>');
						html.push('<div class="actual"><img src="http://www.n-tv.de/stat/images/header_temp/' + data.content.today.temp + '.png?cc=1" alt="" /></div>');
						html.push('<div class="min_max">');
							html.push('<table cellspacing="0">');
								html.push('<tr>');
									html.push('<td>' + data.content.today.name + '</td>');
									html.push('<td>' + data.content.today.temp_min + '<span>&deg; /</span> ' + data.content.today.temp_max + '<span>&deg;</span></td>');
								html.push('</tr>');
								html.push('<tr>');
									html.push('<td>' + data.content.tomorrow.name + '</td>');
									html.push('<td>' + data.content.tomorrow.temp_min + '<span>&deg; /</span> ' + data.content.tomorrow.temp_max + '<span>&deg;</span></td>');
								html.push('</tr>');
							html.push('</table>');
						html.push('</div>');
					html.push('</div>');
				html.push('</div>');

				$container.html(html.join(""));

				$container.show();

				$( "#weather_head_ort" ).focus(
					function(){
						$( "#weather_head_ort" ).val("");
						$( "#weather_head_plz" ).val("-1");
						$( "#weather_head_ort" ).unbind( "focus" );
					}
				);

			}

			$.ajax({
			    url: dataUrl,
			    dataType: "xml",
			    success: function( data ){
					data = $.xml2json(data);
					renderWeather(data);
			      },
			      error: function( e ){
			      }
			});

		}else{
			$container.show();
		}
	}



	$.ntv_init = function() {
		if( $(".jq_soccer").length || $(".jq_soccer_detailSite").length ){

			var scriptUrl = relat_prefix + "js/jquery.ntv.soccer.js";
			if(window.location.protocol != "http:"){
				scriptUrl = "resources/ver1-0/js/jquery.ntv.soccer.js";
			}
			document.write('<sc' + 'ript type="text/javascript" src="' + scriptUrl + '"></sc' + 'ript>');
			//$.getScript(scriptUrl);
		}

		if( $(".jq_f1").length ){
			var scriptUrl = relat_prefix + "js/jquery.ntv.f1.js";
			if(window.location.protocol != "http:"){
				scriptUrl = "resources/ver1-0/js/jquery.ntv.f1.js";
			}
			document.write('<sc' + 'ript type="text/javascript" src="' + scriptUrl + '"></sc' + 'ript>');
			//$.getScript(scriptUrl);
		}
		if( $(".jq_dtm").length ){
			var scriptUrl = relat_prefix + "js/jquery.ntv.dtm.js";
			if(window.location.protocol != "http:"){
				scriptUrl = "resources/ver1-0/js/jquery.ntv.dtm.js";
			}
			document.write('<sc' + 'ript type="text/javascript" src="' + scriptUrl + '"></sc' + 'ript>');
		}
		if( $(".jq_f3").length ){
			var scriptUrl = relat_prefix + "js/jquery.ntv.f3.js";
			if(window.location.protocol != "http:"){
				scriptUrl = "resources/ver1-0/js/jquery.ntv.f3.js";
			}
			document.write('<sc' + 'ript type="text/javascript" src="' + scriptUrl + '"></sc' + 'ript>');
		}
		if( $(".jq_sid").length ){
			var scriptUrl = relat_prefix + "js/jquery.ntv.sid.js";
			if(window.location.protocol != "http:"){
				scriptUrl = "resources/ver1-0/js/jquery.ntv.sid.js";
			}
			document.write('<sc' + 'ript type="text/javascript" src="' + scriptUrl + '"></sc' + 'ript>');
		}

		$(".article_wide .center .teaser_list ul").ntv_settingLiHeight();
	}


	$( document ).ready( function() {

		//quickfix ie for links
		(function(){
			if ( $.browser.msie && parseInt($.browser.version)<8) {
				$( "a span.clearfix" ).each( function() {
					var span = $(this);
					var link = $(this).parent("a").attr("href");
					span.css("cursor","pointer");
					span.click(function(){
						window.location.href = link;
					});
				});
			}
		 })();


		// Hide toggle elements if user has javascript enabled.
		$( "#comment" ).hide();
		$( "#email_form" ).hide();
		$( "#bookmarking" ).hide();
		$( "#detailsearch" ).hide();
		$( ".jq_close" ).show();

		// suche head
		$( "#header_top form" ).ntv_search_head();

		// Make p clickable on index pages.
		$( ".jq_link" ).ntv_js_link();
		$( ".jq_link_new" ).ntv_js_link_new();

		// Add rollover, etc to the social bookmark links
		$( ".jq_socialbookmarks" ).ntv_social_bookmarking();

		// add bookmarking code for ie and mozilla
		$( ".jq_bookmarking" ).ntv_bookmarking();

		// video play button
		$( ".jq_videoteaser" ).ntv_video_play();
		$( ".jq_chron_videoteaser" ).ntv_chron_video_play();
		$( ".jq_buttonVideo" ).ntv_buttonVideo();
		$( ".jq_buttonGallery" ).ntv_buttonGallery();


		// fb_ticker_naviagtion
		$( "#jq_fb_ticker" ).ntv_fb_ticker_navigation();

		// Add rollover, etc to the fastsearch navi
		$( ".jq_search" ).ntv_search();

		// video_teaser
		$( ".mediathek_teaser" ).ntv_media_teaser();

		// umfragen
		$( ".article_wide .poll" ).ntv_poll();

		// Fussball-Ansetzungen
		$( ".jq_schedulAll" ).ntv_football_schedule();

		// weather
		$("#weather_head_ort").focus( function() {
			$("#weather_head_ort").val("");
			$("#weather_head_plz").val("-1");
			$("#weather_head_ort").unbind("focus");
		});

		//placement rectangle
		$("#medrect").ntv_medrect();
		//$("#medrectprem").ntv_medrectprem();
		$("#xxl_banner").ntv_xxlbanner();

		//Reset HP News
		$("#hpnews_search").val("z.B. Berlin o. 10119");


		//schoenes wocheende
		if( (window.location.href).indexOf("http://www.n-tv.de/?schoeneswochenende")>-1 ){
			$("<a href='http://www.n-tv.de/?service=ajax&action=sw_json'></a>").ntv_slideshowInline();
		}


		//Mediathek
		//$( ".program ul.prog li" ).ntv_media_detail( { "backgroundColor": "#535353" } );
		//$( ".sendungen ul li" ).ntv_media_detail( { "backgroundColor": "#535353" } );

	});
})(jQuery);




