/* -------------------------------------------------------------- 

   

   JavaScript build on jQuery for detektor.fm

  

-------------------------------------------------------------- */
$('html').addClass('js');

Function.prototype.delay = function(s){ setTimeout(this, s*1000); };
function css(id, style){ $(id)[0].style.cssText += ';'+style; };

var
	ua = navigator.userAgent,
	webkit = ua.indexOf('AppleWebKit/') > -1,
	moz = ua.indexOf('Gecko') > -1 && !webkit,
    transprop = webkit ? 'webkitTransform' : (moz ? 'MozTransform' : 'transform'),
    transstr = webkit ? '-webkit-transform' : (moz ? '-moz-transform' : 'transform');


function anim(id, transform, opacity, dur){
        css(id,'-webkit-transition:-webkit-transform'+
          ',opacity '+(dur||0.5)+'s,'+(dur||0.5)+'s;'+transstr+':'+
          transform+';opacity:'+(1||opacity)); 
      }

var mobile = false;
if ($('html').hasClass('mobile')) mobile = true;




//remove Filter-Property
(function($) {
	//
	// plugin fixClearType
	//
	$.fn.fixClearType = function(){
	 return this.each(function(){
	 if(typeof this.style.filter  && this.style.removeAttribute)
	 this.style.removeAttribute("filter");
	 })
	};
//
// end of closure
//
})($);

var ie   = false;
var ie6 = false;
var ie7 = false;
var ie8 = false;
var ie9 = false;


if ($.browser.msie){
	ie = true;
	if (parseInt($.browser.version) == 6) {
  	 ie6 = true;
	}
	if (parseInt($.browser.version) == 7) {
  	 ie7 = true;
	}
	if (parseInt($.browser.version) == 8) {
  	 ie8 = true;
	}
	if (parseInt($.browser.version) == 9) {
  	 ie9 = true;
	}
};

// setting some common Vars

var fade_in_speed	 = 600;
var fade_out_speed	 = 500;

$.easing.easeOutCubic = function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; };
$.easing.easeOutQuart = function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; };
$.easing.easeOutElastic = function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c;	if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; };

$.easing.def = "easeOutQuart";

// init Contact-Forms with Validation und AJAX
function initForm(which) {
	if(document.getElementById(which+'_form')) {
	 var $form = $('#'+which+'_form');
	 $('fieldset.verify', $form).addClass('hideme').find('input').val('2');
	 var badwordlist = new Array("nice site", "good work", "xxx ", "url=http", "drugs ", "aciphex", "nude ");
	 $.validator.addMethod("badWord", function(value) { 
	 return !new RegExp('/' + badwordlist.join('|') + '/').test(value.toLowerCase());
	 }, "Verdacht auf Spam-Versuch. Bitte passen Sie Ihre Nachricht an.");

	 $.validator.addClassRules("badwords", {
	   badWord: true
	 });
 
 
	 $($form).prepend('<div id="messagebox_'+which+'" style="display: none"></div>').find('div.captcha img').after('<img src="http://detektor.fm/assets/img/reload.png" alt="♻" title="Neues Spamcheckbild laden" style="font-size: 2em; line-height: 22px; cursor: pointer; border: none;" class="reload" width="16" height="22" />');



	 $.validator.addMethod("hii", function(value) {
	 //if (value != 2) return false; else return true;
	 return value == 2;
	 }, "Bitte geben Sie die korrekte Antwort ein.");
 
	 $.validator.addClassRules("hii", {
	   hii: true
	 });
 
	 if (which == "tellafriend" || which == "contact" || which == "presse" || which == "detektor") {
	 var v = $form.validate({
	 errorClass: 'error',
	 submitHandler: function(form) {
	 $(form).ajaxSubmit({
	 beforeSubmit:  hideButton,
	 success: updateForm
	 });
	 }
	 });
	 }else {
	 var v = $form.validate({
	 errorClass: 'error'
	 });
	 }
 

 
 
	 var $keywords = $("input[name='keywords']", $form);
 
	 if ($keywords.length){
	 $keywords.rules("add", {
	 minlength: 3,
	 messages: {
	 minlength: $.validator.format("Bitte mindestens {0} Buchstaben eingeben.")
	 }
	 });
	 };
 
	 function hideButton() {
	 $('div.submit', $form).addClass('loading').find('button').trigger('blur');
	 }
 
	 function updateForm(response) {
	 var message = $('#message', response);
	 var heading = $('h1', response);
	 if (heading.text().match(/Fehler/)){
  $('#messagebox_'+which).addClass('error').removeClass('success');
	 $.scrollTo($form, 400);
	 } else {
  $('#messagebox_'+which).addClass('success').removeClass('error');
	 v.resetForm();
	 $.scrollTo($form, 400);
 
	 }
  $('#messagebox_'+which).empty().append('<h4>'+heading.html()+'</h4>'+message.html()).slideDown("fast");
	 //alert($('#'+which+'_message', response).html());
	 //$form.before($('#message', response));
	 if ($('#messagebox_'+which).hasClass('success')) {v.resetForm();}
	 $('div.submit', $form).removeClass('loading');
	 }
	 
	 function updateCaptcha(which) {
	 	$.get(window.location.href, function(data){
		   var data = $('#'+which+'_form',data);
		   var hidden = $('div.hiddenFields',data).html();
		   var captcha = $('div.captcha img',data).attr('src');
		   $('div.captcha img:first',$form).css("opacity", 0.01).attr('src', captcha).fadeTo(400, 1);
		   $('div.hiddenFields',$form).empty().append(hidden);
		});
	 }
	 
	 $('div.captcha img.reload',$form).bind('click',function(){updateCaptcha(which);});
	};
};


// init gallery and overlays
function initOverlay() {
 
	$('body').append('<div class="simple_overlay" id="gallery"><div class="info"></div><a class="prev">zurück</a><a class="next">vor</a><img class="progress" src="http://detektor.fm/assets/img/loading.gif" alt="Laden …"/></div><div class="simple_overlay" id="iframe"><iframe id="overlay_iframe" name="overlay_iframe" src=""></iframe></div>');
 
	var $trigger = $("div.embed_gallery ul a, ul.gallery a");

	// select the thumbnails and make them trigger our overlay 
	if ($trigger.size()) {
	 $trigger.overlay({ 
 
	 // each trigger uses the same overlay with the id "gallery" 
	 target: '#gallery', 

	 speed: 0,
 
	 // optional exposing effect 
	 expose: { 
	         color: '#f1f1f1', 
	         onBeforeLoad: function(event) {this.fit();}  
	     } 
 
	 // let the gallery plugin do its magic! 
	 }).gallery({ 
 
	 // the plugin accepts its own set of configuration options 
	 speed: 0 
	 });
	};
 
	$('a.overlay').overlay({
	 speed: 0,
	 expose: { 
	 color: '#f1f1f1', 
	 onBeforeLoad: function(event) {this.fit();}  
	     }
	});
 
	$('a.overlay_iframe').overlay({
	 speed: 0,
	 target: '#iframe',
	 expose: { 
	 color: '#f1f1f1', 
	 onBeforeLoad: function(event) {this.fit();}  
	 },
	 onBeforeLoad: function() { 
	 // grab wrapper element inside content 
	    	var wrap = this.getContent().find("#overlay_iframe");

	 // load the page specified in the trigger 
	        wrap.attr("src", this.getTrigger().attr("href"));
	 }  
	});
}

// init gallery and overlays
function initAccordion() {
	$("dl#infobox").tabs("dl#infobox dd", { 
	 tabs: 'dt', effect: 'slide'
	});
}

// init select_menu
function initSelectMenu() {
	var $select = $("#segment_select");
	var root = $select.attr("data-root");
	$select.bind("change",function(){
	 var value = $(this).val().toLowerCase();
	 if (value){
	 value = value+"/";
	 }
	 var mobind ="";
	 if (mobile) mobind = "?mobile=i";
	 window.location.href = root+value+mobind;
	});
}


// init Autocompleter
function initAutocomplete(){$("input#top_suche").autocomplete("http://detektor.fm/suche/autocomplete/",{
	  selectFirst: false,
      cacheLength: 10,
      minChars: 3,
      formatItem: function (row) {
      	return row[0]
      },
      formatResult: function (row){
      	return row[1]
      }
    }).result(function(event, item) {
      //redirect to the URL in the string
      window.location.href = item[1];
      return false;
    });
}

// init Kalender-Pager
function initCalendarPager(){
	$("#kalender a.nav").live("click", function(){
		var target = $(this).attr('rel');
	 	 //console.log(target);
		$('#kalender').addClass('loading').load(target, function(){
			$(this).removeClass('loading')
	    	.find('table').fadeTo(200, '1');
		}).find('table').fadeTo(200, '0.1');
		return false;
	});
}


function showMap(where) {
 
	var $where = $(where);
 
	if ($where.length){
	function removeHTMLTags(input){
	 	 var strInputCode = input;
	 	 /* 
	  	 This line is optional, it replaces escaped brackets with real ones, 
	  	 i.e. < is replaced with < and > is replaced with >
	 	 */
	 	 	strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
	 	  	return (p1 == "lt")? "<" : ">";
	 	 });
	 	 var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
	 	 return strTagStrippedText;
	}
 
	var address = $('.adresse').html();
	var address_text = address.replace(/<br\/>/g,', ');
	address_text = address_text.replace(/<br>/g,', ');
	address_text = address_text.replace(/<BR\/>/g,', ');
	address_text = address_text.replace(/<BR>/g,', ');
	address_text = removeHTMLTags(address_text);
	var google_link_text = address_text.replace(/ /g,'+');
 
 
	var google_link = "http://www.google.de/maps?f=q&source=s_q&hl=de&geocode=&q="+google_link_text;
 

 
	$where.css("height","280px").jmap('init', 
	 {
	 mapCenter:[51.3240519, 12.3365342],
	 mapShowjMapsIcon: false,
	 mapEnableScaleControl: true,
	 mapEnableSmoothZoom: true,
	 mapEnableType: true,
	 mapEnableGoogleBar: false,
	 language: 'de',
	 mapZoom: 14
	 })
	 .jmap('SearchAddress', {
            'query': address_text,
            'returnType': 'getLocations'
        }, function(result, options) {

            $.each(result.Placemark, function(i, point){
            	//alert(google_link_text+' | '+point.Point.coordinates[1]+' | '+point.Point.coordinates[0]);
            
                $where.jmap('AddMarker',{
                   pointLatLng:[point.Point.coordinates[1], point.Point.coordinates[0]],
	    centerMap: true,
                   pointHTML: address+'<br /><a href="'+google_link+'">Gr&ouml;&szlig;ere Ansicht bei Google</a>'
                 });
            });
        
        });
	}
}


/* attempt to find a text selection */
function getSelected() {
	if(window.getSelection) { return window.getSelection(); }
	else if(document.getSelection) { return document.getSelection(); }
	else {
	 var selection = document.selection && document.selection.createRange();
	 if(selection.text) { return selection.text; }
	 return false;
	}
	return false;
}


/* search Selected Text */
function searchSelected() {

	var url = 'http://detektor.fm/suche/?s={term}', selectionImage;
	$('#paper').mouseup(function(e) {
	 var selection = getSelected();
	 //console.log(selection);
	 if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) {
	 //ajax here {http://davidwalsh.name/text-selection-ajax}
	 if(!selectionImage) {
	 selectionImage = $('<a>').attr({
	 href: url, 
	 title: 'Klicken Sie hier, um nach »'+selection+'«‚ zu suchen',
	 target: '_self',
	 id: 'selection-image'
	 }).hide();
	 $(document.body).append(selectionImage);
	 }
  selectionImage.attr('href',url.replace('{term}',encodeURI(selection))).css({
	 top: e.pageY - 30,	//offsets
	 left: e.pageX - 13 //offsets
	 }).attr('title', 'Klicken Sie hier, um nach »'+selection+'«‚ zu suchen').fadeIn();
	 }
	});
	$(document.body).mousedown(function() {
	 if(selectionImage) {selectionImage.fadeOut();}
	});
 
};


loadinfo = true;
loadinforoot = true;
currentSong = "";

// Update Now-Playing
function updateNP() {

	if(loadinforoot){$.getJSON("http://detektor.fm/word.json?"+ (new Date().getTime()), function(data){
			if (data.h*1 >= 15 && data.h*1 <= 18 && data.m*1 >= 0 && data.m*1 <= 59) {//nix} else {			
				if (currentSong.date != data.date) {
					currentSong = data;
					var artist = "";
					if(data.artist) {
						artist = data.artist + " – ";
					}
					$('#current_title').fadeTo(400,0, function(){
						$(this).empty().text(artist + data.title).fadeTo(400, 1);
					});
				}
					
			}
			
		});
	}
};

//pulsate
function highlightStreamButton(){
	var $span = $('#start_stream span'),
	speed = 1100;

	
	function button_in() {
	    $span.css('display', 'block').fadeTo(speed, 1, function() {button_out();});
	};
	function button_out() {
	    $span.fadeTo(speed, 0, function() {button_in();});
	};
	
	button_in();
}


//Replace empty Cover
function replaceCover() {
	var replace = '<img src="http://detektor.fm/assets/img/kein_cover_130.png" alt="Leider kein Cover verfügbar" width="60" />';
	$("td.cover img[src='']").replaceWith(replace);
}


//Cinema-Selector

function initCinema(){
	if ($('#kinoprogramm').length) {
		var csurl = "http://cinestar.de/cinestar-export/iframe.php?cssfile=http%3A%2F%2Fdetektor.fm%2Finlcude%2Fmin%2Findex.php%3Ff%3Dassets%2Fcss%2Fiframe.css&kinonr=";
	
		function changeCinema(nr){$('#cinestar').attr('src',csurl+nr);}
		
		$("#kinoprogramm #iframeselect").bind("change", function(){changeCinema($(this).val());});
	}
}


//PayPal-Select

function ppSelect(){
	$('#ppAmountSelect').bind('change',function(){
		$this = $(this);
		if($this.val() == 'other'){
			$this.replaceWith('<input type="text" title="Tragen Sie hier bitte Ihren gewünschten Spenden-Betrag ein." style="width: 35px; margin: 0 0 0 5px;" name="amount" id="ppAmountText" value="" class="text">');
			$('#ppAmountText').focus();
		}
	}).change();
}



function initializePinnedSite(){
    try {
        if (window.external.msIsSiteMode()) {
            // Continue initialization.
        }
        else {
            var $bannerwichtig = $("#wichtig");

			if ($bannerwichtig.length && self == top){
			
				$("div#wichtig").track({
					category : 'IE-Pinsite',
					action   : 'mousedown',
					label    : 'Pinsitebanner',
					skip_internal: false
			     });
		     
				$("#paper").animate({'margin-top': '+=30px'}, 1000, "easeOutQuart");
			    	
				$bannerwichtig
			    	.animate({
			    	 'top': '0'
			    	}, 1000, "easeOutQuart")
			    	.animate({
			    	 'top': '0'
			    	}, 15000, "linear", function(){
			    		$("#paper").animate({'margin-top': '-=30px'}, 800, "easeOutQuart");
			    	 	$(this).animate({
			    	 		'top': '-60'
			    	 	}, 800,"easeOutQuart",function(){$(this).remove();});
			    	});
			    }
        }
    }
    catch (e) {
        // Fail silently. Pinned Site API not supported.
    }
}






// **** run the scripts ****


$(document).ready(function () {
	$('body').removeClass('nojs');
	
	$("dl#infobox").tabs("dl#infobox dd", { 
	 tabs: 'dt', effect: 'slide'
	});
	
	$("#ps_tabs").tabs("#ps_content > li");

	
	ppSelect();
		
	var fbchatsrc = $('#chat iframe').attr('src');
	var $chattrigger = $('#chattrigger');
	var $chat = $('#chat');
	var $zzz = $('#zzz');
	var $info_content = $('#info_content');
	if($chat.length){
		$chattrigger.bind('click', function(event){
			event.preventDefault();
			$chat.animate({
				height: 'toggle'
			}, 500, 'easeOutQuart',function(){
				if($(this).is(':visible')){
					loadinfo = false;
					$chattrigger.toggleClass('visible');
				}else{
					loadinfo = true;
					$chattrigger.toggleClass('visible');
				}
			});
			if($chattrigger.hasClass('visible')){
				$('iframe', $chat)[0].src = fbchatsrc+'&dfmcacheprevent='+ (new Date().getTime());
			}
			return false;
		});
	}
	
	//Leave out this piece of crap …
	if(!ie || ie9){
		// Don't update if window is not in focus
		$(window).bind({
	  		blur: function() {
				loadinforoot = false;
				loadinfo = false;
				if($info_content.length && !$('body').hasClass('tiny')){
					$info_content.animate({
						opacity: .3
					}, 1000, 'easeOutQuart');
					$zzz.show().animate({
						top: '300px',
						opacity: 1
					}, 750, 'easeOutQuart');
				}
			},
			focus: function() {
				loadinforoot = true;
				updateNP();
				//if(($chat.length && !$chat.is(':visible')) || $('body').hasClass('tiny')){
					loadinfo = true;
				//}
				if($info_content.length){
					$info_content.animate({
						opacity: 1
					}, 1000, 'easeOutQuart');
					$zzz.animate({
						top: '280px',
						opacity: 0
					}, 750, 'easeOutQuart', function(){$(this).hide();});
					
					$.fn.audioPlayer.publicCheckInfo();
				}
			}
		});
	}
	
	if ($('#current_title').length) {
		if (update_title) {
			updateNP();
			window.setInterval(updateNP, 20000);
		}

			highlightStreamButton();
	}
	
	var $rondellholder = $('div.rondellholder');
	if ($rondellholder.length) {
		$rondellholder.each(function(i){
			var $this = $(this);
			var interval;
			
			function startAutoPlay() {
				return setInterval(function() {
					$('ul.rondell', $this).roundabout_animateToPreviousChild();
				}, 5000);
			}

			
			
			$('ul.rondell', $this).roundabout({
         		//shape: 'tearDrop',
         		minScale: 0.001,
         		minOpacity: 0,
         		duration: 1000,
         		easing: 'easeOutQuart'
       		}).hover(
					function() {
						// oh no, it's the cops!
						clearInterval(interval);
					},
					function() {
						// false alarm: PARTY!
						interval = startAutoPlay();
					}
				);
				
				// let's get this party started
				interval = startAutoPlay();
				
				
				
			/*$this.attr('id','rondell'+i).append('<div class="rondellnav" id="nav'+i+'"></div>');
			$('ul.rondell', $this).cycle({ 
		    	fx:     'scrollHorz', 
		    	pager:  '#nav'+i,
		    	speed:  600, 
		    	timeout: 5000,
		    	easing: 'easeOutQuart', 
		    	pause: true,
		    	// callback fn that creates a thumbnail to use as pager anchor 
			    pagerAnchorBuilder: function(idx, slide) { 
			        return '<a href="#">&bull;</a>'; 
			    } 
			}); */
		});
		
	}
 
	// DEV
	//$("form[action='http://detektor.fm/']").attr('action', 'http://detektor.fm/index.php');
	//$("a[href='http://detektor.fm/']").attr('href', 'http://detektor.fm/index.php');
	// DEV init.js
	
	var url = location.pathname;
 
  	if(url.indexOf('/vorschau/') == -1) {
  	 
		  	 		$.trackPage('UA-11563891-1')
  	 		     
	     $("a#start_stream").track({
			category : 'Seitenaufruf',
			action   : 'click',
			label    : 'Player',
			skip_internal: false
	     });
	     
	     $("a.download").track({
			category : 'Downloads',
			action   : 'Download',
			label    : function(element) { return element.attr('href').replace('http://detektor.fm/download/?file=', '').replace('/images/uploads/', '')},
			skip_internal: false
	     });
	     
	     $("a.drucken").track({
			category : 'Artikel drucken',
			action   : 'click',
			label    : function(element) { return element.attr('data-title'); },
			skip_internal: false
	     });
	     
	     $("a.versenden").track({
			category : 'Artikel versenden',
			action   : 'click',
			label    : function(element) { return element.attr('data-title'); },
			skip_internal: false
	     });
	     
	     $("#social ul li a").track({
			category : function(element) { return "Social: "+ element.parent('li').attr('class'); },
			action   : 'click',
			label    : function(element) { return element.attr('data-title'); },
			skip_internal: false
	     });

	     $("a[data-trackcat]").track({
			category : function(element) { return element.attr('data-trackcat'); },
			action   : 'click',
			label    : function(element) { return element.attr('data-tracktitle'); },
			skip_internal: false
	     });

	     $("a.crowdradio").track({
			category : 'CrowdRadio-App',
			action   : 'click',
			label    : function(element) { return element.attr('title'); },
			skip_internal: false
	     });
	
	 	
	 	/*
	 	$("#main img").lazyload({ 
		    placeholder : "http://detektor.fm/assets/img/ft.png",
		    effect : "show",
		    threshold : 500
		});
		*/

	};
	
 
	$("div.autosearch form").submit();
 
	$('#main_nav a').blend({speed:300, active:true});

	initOverlay();
	initAccordion();
	initAutocomplete();
	showMap('#top_map');
	searchSelected();
	initForm('comment');
	initForm('search');
	initForm('quicksearch');
	initForm('kontakt');
	initForm('contact');
	initForm('presse');
	initForm('detektor');
	initForm('tellafriend');
	
	replaceCover();
 
	$('ul.rangliste li').quickpaginate( { perpage: 1 } ); 
 
	$('a.toggle').bind('click', function (event) {
      var $this = $(this);
      var target = $this.attr('href').split('#')[1];
      //$('#'+target).toggle();
      var $target = $('#'+target);
      
      if ($target.is(":hidden")) {$target.slideDown('200');} else {$target.slideUp('200');}
      return false;
    });
    
    $('dl.infobox_text dt').bind('click', function () {
      var $this = $(this);
      
      var $target = $this.next('dd');
      
      if ($target.is(":hidden")) {$target.slideDown('400');} else {$target.slideUp('200');}
      return false;
    });
    
    //Kommentare einblenden, wenn Hash mit "kommentar" vorhanden ist
    if (location.hash && location.hash.split('#')[1].substr(0, 9) == "kommentar"){
    	$('#kommentare').show();
    	$.scrollTo( location.hash , 800 );
    } 
 
	//$('.rating form').rating();
 
	var options = { 
        success:function() { 
	     $("button", '#rating form').after("<span class=\"button_small i_like_it\" style=\"display: none;\" id=\"updated_button\">Dieser Artikel gefällt Dir</span>").fadeOut(300, function () {$("#updated_button").fadeIn(300);$(this).remove();});
	     }
    };
    
	$('#rating form').submit(function() {  
        $(this).ajaxSubmit(options); 
        return false; 
    }); 

 	
	if (!$.font.test("'AmericanTypewriter', 'American Typewriter'") && startCufon) {
	    	Cufon.replace('h1:not(".nocuf")',{
	 hover: true,
	 textShadow: '#fff 1px 1px'
	 });
	 Cufon.replace('h2:not(".nocuf"), h3:not(".nocuf"), div.dateholder div.month, div.dateholder div.day',{
	 hover: true
	 });
	}
	


	if (ie) {
	 $("button, input.text, input.file, textarea, ul li, dl dt, dl dd").hover(
	   function () {$(this).addClass("hover");},
	   function () {$(this).removeClass("hover");}
	 ).bind('focus blur', function(event) {
	 (event.type == 'blur' ? $(this).removeClass("focus") : $(this).addClass("focus"))
      }).trigger('blur');
	}
 
 
	$('a.historybutt').bind('click', function(){
	 history.back();
	 return false;
	});
 
	initSelectMenu();
	initCinema();
 
	//decode e-mail-addresses
	$(".email").not('input').defuscate();
 
	$('a:urlExternal').attr('target','_blank');
	
	
	if (mobile){
		$.urlInternalRegExp( /^(?:https?:)?\/\/(?:(?:www|foo)\.)?detektor.fm\// );
		$("a, form").urlInternal().querystring({mobile:'i'});
		
		/*
		$("a[href*='/playlisten/']").each(function(){
			var $this = $(this),
				o_url = $this.attr('href'),
				n_url = o_url.replace('/playlisten/', '/playlisten_list/');
			$this.attr('href', n_url);			
		});
		*/
		
		$('<div id="now_mob" style="position: absolute; right: 10px; top: 30px; overflow: hidden; max-width: 330px; padding-left: 120px; "><h3 style="position: absolute; left: 0;">Gerade läuft:</h3></div>').insertAfter("#logo").append($("p#current_title").detach().css({marginLeft: "10px", marginTop: "-1px", fontSize: "1.3em"}));
	}
 
	
	
	

 
	$('.pullquote').each(function() {
	 $(this.parentNode).before('<blockquote class="pullquote"><p>' + $(this).html() + '<\/p><\/blockquote>');
	});
 
	initCalendarPager();
	
	$("a.popup").open({windowName: "detektorPlayer"});
	
	initializePinnedSite();
	
});



$(window).bind('load', function(){
	
	
	
	$("#flattr_start").animate({
		    height: 'toggle'
  		}, 800, "easeOutQuart");
	
});

fb_init = true;


