	function popup(url){
		fenster=window.open(url, "Popup", "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,directories=no,width=500,height=280");
		fenster.focus();
	}

	function termine(){
		fenster=window.open("/_popup/termine.php", "Popup", "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,directories=no,width=500,height=280");
		fenster.focus();
	}
	
	function gaestebuch(){
		fenster=window.open("/_popup/interact_bg.php", "GB", "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,directories=no,width=350,height=500");
		fenster.focus();
	}

	function wc(link){
		fenster=window.open(link, "webstreamhigh", "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,directories=no,width=550,height=425");
		fenster.focus();
	}

	function wdrpopup(link){
		fenster=window.open(link, "fenster", "location=no,menubar=no,width=540,height=610,status=no,scrollbars=no,resizable=yes");
		fenster.focus();
	}
	
	function filmpopup(url){
		fenster=window.open(url, "Popup", "location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,directories=no,width=500,height=280");
		fenster.focus();
	}
	
	function LoadVideoBar() {

    var videoBarL;
    var videoBarR;
    
    var options = {
        string_allDone : "Nu reicht's!",
        largeResultSet : !true,
        vertical : true,
        autoExecuteList : {
          cycleTime : GSvideoBar.CYCLE_TIME_MEDIUM,
          cycleMode : GSvideoBar.CYCLE_MODE_LINEAR,
          executeList : ["ytchannel:onk3lfisch"]
        }
      }

    videoBarL = new GSvideoBar(document.getElementById("videoBar-DN"),
                              GSvideoBar.PLAYER_ROOT_FLOATING,
                              options);
    $('#videoBar-DN').append('<div class="youtMore"><p><a href="http://www.youtube.com/user/onk3lfisch">mehr</a></p></div>');
    var options = {
        largeResultSet : !true,
        vertical : true,
        master: videoBarL,
        autoExecuteList : {
          cycleTime : GSvideoBar.CYCLE_TIME_MEDIUM,
          cycleMode : GSvideoBar.CYCLE_MODE_LINEAR,
          executeList : ["ytchannel:Sackbinder"]
        }
      }

    videoBarR = new GSvideoBar(document.getElementById("videoBar-SB"),
                              GSvideoBar.PLAYER_ROOT_FLOATING,
                              options);
    $('#videoBar-SB').append('<div class="youtMore"><p><a href="http://www.youtube.com/user/SACKBINDER">mehr</a></p></div>');
    }
	



$(document).ready(function(){

	$.getJSON('http://twitter.com/status/user_timeline/onkelfisch.json?count=6&callback=?', function(data){
		$.each(data, function(index, item){
			$('#twitter').append('<div class="tweet"><p>' + item.text.linkify() + ' <strong>' + relative_time(item.created_at) + '</strong></p></div>');
		});
		$('#twitter').append('<div class="tweet rechts"><p><a href="http://twitter.com/onkelfisch">fiSCH bei twitter</a></p></div>');
	});
	
	
	function relative_time(time_value) {
	  var values = time_value.split(" ");
	  time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
	  var parsed_date = Date.parse(time_value);
	  var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
	  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
	  delta = delta + (relative_to.getTimezoneOffset() * 60);
	  
	  var r = '';
	  if (delta < 60) {
		r = 'gerade eben';
	  } else if(delta < 120) {
		r = 'vor einigen Minuten';
	  } else if(delta < (45*60)) {
		r = 'vor ' + (parseInt(delta / 60)).toString() + ' Minuten';
	  } else if(delta < (90*60)) {
		r = 'vor einer Stunde';
	  } else if(delta < (24*60*60)) {
		r = 'vor ' + (parseInt(delta / 3600)).toString() + ' Stunden';
	  } else if(delta < (48*60*60)) {
		r = 'vor einem Tag';
	  } else {
		r = 'vor ' + (parseInt(delta / 86400)).toString() + ' Tagen';
	  }
	  
	  return r;
	}
	
	String.prototype.linkify = function() {
		return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) {
			return m.link(m);
		});
	};

});

