/* ***** COPYRIGHT (c) 2009 gedankenstromgenerator.net - CONTACT: coolstuff@gedankenstromgenerator.net - ANY USE OF THIS SCRIPT, EVEN PARTIALLY, IS PROHIBITED! ***** */
var ytVideoPlayer;var ytVideoId;var ytVideos={count:0};var ytButtonPlayPauseID="plr_wtfrud";var ytListEntryID="plr_entry_";var ytPlayTimeID="yt_time";var ytDurationID="yt_duration";var ytJumpID="yt_jump";function secondsFormat(e){var c=parseInt(e,10);var a=Math.floor(c/3600);var b=Math.floor(c/60);var d=parseInt(c%60,10);c=(a===0?"":(a>9?""+a:"0"+a)+":");c=c+(b===0?"00":(b>9?""+b:"0"+b));c=c+(d===0?":00":(d>9?":"+d:":0"+d));return c}function ytScreenshot(b,a){if(b===null){return""}a=(a===undefined)?"small":a;if(a=="small"){return"http://img.youtube.com/vi/"+b+"/2.jpg"}else{return"http://img.youtube.com/vi/"+b+"/0.jpg"}}function getYtVideo(c){if(ytVideos===undefined){return false}var b=-1;for(var a=0;a<ytVideos.count;a++){if(ytVideos[a].id==c){b=a;break}}return(b<0?false:ytVideos[b])}function ytUpdate(){if(ytVideoPlayer===undefined||ytVideoPlayer===null||ytVideoPlayer.getCurrentTime===undefined){return}$("#"+ytPlayTimeID).html(secondsFormat(ytVideoPlayer.getCurrentTime()))}function ytCueVideo(a,c){if(ytVideoPlayer===undefined){return}if(a===undefined){return}if(c===undefined){c=0}ytVideoId=a;ytVideoPlayer.stopVideo();ytVideoPlayer.cueVideoById(ytVideoId,c);$("#"+ytDurationID).html("00:00");var b=getYtVideo(ytVideoId).originalUrl;$("#"+ytJumpID).unbind("click").click(function(){window.open(b,"_blank")})}function ytPlay(a){if(ytVideoPlayer===undefined){return}if(a!==undefined){ytCueVideo(a)}ytVideoPlayer.playVideo()}function ytPause(){if(ytVideoPlayer===undefined){return}ytVideoPlayer.pauseVideo()}function ytPlayPause(){if(ytVideoPlayer===undefined){return}var a=ytVideoPlayer.getPlayerState();if(a==-1){return}if(a==1||a==3){ytVideoPlayer.pauseVideo()}else{ytVideoPlayer.playVideo()}}function ytVolumeToggle(a){if(ytVideoPlayer===undefined){return}var b=ytVideoPlayer.getVolume();b=(b>50?0:b>0?100:50);ytVideoPlayer.setVolume(b);if(a!==undefined){if(b===0){$(a).html("Null")}else{if(b==50){$(a).html("Halbzeit")}else{if(b==100){$(a).html("Volle Kanne")}}}}}function ytVolumeUp(b){if(b===undefined){b=10}if(ytVideoPlayer===undefined){return}var a=ytVideoPlayer.getVolume();ytVideoPlayer.setVolume(a<=(100-b)?a+b:100)}function ytVolumeDown(b){if(b===undefined){b=10}if(ytVideoPlayer===undefined){return}var a=ytVideoPlayer.getVolume();ytVideoPlayer.setVolume(a>=b?a-b:0)}function ytNextVideo(){if(ytVideoPlayer===undefined||ytVideos.count<=1){return}var b=-1;for(var a=0;a<ytVideos.count;a++){if(ytVideos[a].id==ytVideoId){b=a;break}}b=(b>=(ytVideos.count-1)||b<0)?0:b+1;ytCueVideo(ytVideos[b].id)}function ytPrevVideo(){if(ytVideoPlayer===undefined||ytVideos.count<=1){return}var b=-1;for(var a=0;a<ytVideos.count;a++){if(ytVideos[a].id==ytVideoId){b=a;break}}b=(b<=0||b>ytVideos.count)?ytVideos.count-1:b-1;ytCueVideo(ytVideos[b].id)}function onytPlayerStateChange(a){if(a===0&&ytVideoPlayer!==undefined){ytVideoPlayer.seekTo(0)}if(a==1||a==3){$("#"+ytDurationID).html(secondsFormat(ytVideoPlayer.getDuration()));$("#"+ytButtonPlayPauseID).removeClass("plr_play").addClass("plr_stop")}else{$("#"+ytButtonPlayPauseID).removeClass("plr_stop").addClass("plr_play")}}function onPlayerError(a){}function onYouTubePlayerReady(a){ytVideoPlayer=$("#"+a).get(0);if(a===undefined||ytVideoPlayer===undefined||ytVideoPlayer.id!=a){return}ytVideoPlayer.addEventListener("onError","onPlayerError");ytVideoPlayer.addEventListener("onStateChange","onytPlayerStateChange");ytCueVideo(ytVideoId);window.setInterval(ytUpdate,500)}function ytShowLatestVideo(){ytCueVideo(ytVideos[0].id)}function showYtVideoList(){for(var a=0;a<ytVideos.count;a++){var c=ytVideos[a].id;var b=ytScreenshot(c);if(b.length===0){continue}$("#"+ytListEntryID+""+a).find(".plr_thumb").attr("src",b).attr("vid",c).click(function(){ytPlay(this.getAttribute("vid"))}).end().find(".plr_list_name").html(ytVideos[a].title).end().find(".plr_list_date").html(ytVideos[a].published.substring(0,10)).end().find(".plr_list_length").html(secondsFormat(ytVideos[a].duration)).end()}}function initYTVideo(b,c,a){$.getJSON("http://gdata.youtube.com/feeds/users/GiuseppeOttaviani/uploads?alt=json-in-script&format=5&max-results=50&orderby=published&callback=?",function(g){var f=/[\\?&]v=([^&#]+)/;var d=g.feed.entry||[];for(var e=0;e<d.length;e++){var j=d[e].media$group.media$player[0].url;var h=f.exec(j);if(h===null||h[1]===null){continue}ytVideos[ytVideos.count]={id:h[1],originalUrl:j,description:d[e].media$group.media$description.$t,title:d[e].title.$t,duration:d[e].media$group.yt$duration.seconds,published:d[e].published.$t};ytVideos.count=ytVideos.count+1}if(ytVideos.count>0){ytVideoId=ytVideos[0].id}swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=ytv1",b,c,a,"8",null,null,{allowScriptAccess:"always"},{id:"ytv1"},null);showYtVideoList()})}function initFlickrPics(){$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=40254896@N02&lang=de-de&format=json&jsoncallback=?",function(a){$.each(a.items,function(c,d){var b=""+d.media.m;b=b.replace(/_m.jpg$/g,"_t.jpg");$("#flickr_entry_"+c).find("img.flickr_entry_image").attr("src",b).wrap("<a target='_blank' href='"+d.link+"'></a>")})})}function showFlickr(){$("#plr_vid_frame").hide();$("#flickr_pic_frame").show()}function showYtVideos(){$("#flickr_pic_frame").hide();$("#plr_vid_frame").show()};