function initCoverflow(){$("#coverflow").empty();cfCache=new Array();cfFirstLoad=true;if(livestream){if(cfLiveCA){$("#coverflow").append("<div style='margin: 0 15px 4px; text-align: center; font-weight: bold;'>Weitere Beiträge dieser Sendereihe:</div>")}else{$("#coverflow").append("<div style='margin: 0 15px 4px; text-align: center; font-weight: bold;'>Aktuelle Beiträge</div>")}}$("#coverflow").append("<div id='cfTop'><a class='link'><img src='images/layout2008/cf_top_inactive.png' class='png' style='width: 150px; height: 20px;' /></a></div>");for(var a=0;a<cfSize;a++){$("#coverflow").append("<div id='cf-"+a+"' class='item'></div>")}$("#coverflow").append("<div id='cfBottom'><a class='link'><img src='images/layout2008/cf_bottom_active.png' class='png' style='width: 150px; height: 20px;' /></a></div>");if(livestream){if(cfLiveCA){loadCoverflow(0,0);setActiveItemLive(0)}else{loadCoverflow(0);setActiveItemLive()}}else{loadCoverflow(Math.floor(currentItem/cfSize)*cfSize,currentItem);setActiveItem(currentItem)}}function loadCoverflow(a){if(coverflow.length-cfSize<a){a=coverflow.length-cfSize}if(a<0){a=0}var c=(loadCoverflow.arguments.length>=2)?loadCoverflow.arguments[1]:null;for(var b=0;b<cfSize;b++){loadItem(b,a+b,((a+b==c||(a+b==currentItem&&c==null))&&(!livestream||cfLiveCA)))}cfPosition=a;showButtons()}function loadItem(b,a){var d=(loadItem.arguments.length>=3)?loadItem.arguments[2]:false;$("#cf-"+b).removeClass("active");if(typeof cfCache[a]!="undefined"){$("#cf-"+b).html(cfCache[a]);$("#cf-"+b+" a").bind("click",{pos:a},(livestream?setActiveItemLive:setActiveItem));if(d){$("#cf-"+b).addClass("active")}return true}if(coverflow.length<=a||coverflow.length==0){$("#cf-"+b).empty();return false}var e=coverflow[a];var c="<div id='item-"+a+"' class='small'>";c+="<a class='h100 link' style='height: 100px;'><img src='image.php?fotoID="+e.picture+"&amp;width=150' style='width: 150px;' alt='Vorschaubild: "+e.titleFull+"' /></a>";c+="<div style='margin: 3px 0;'><em>"+e.moduleName+"</em></div>";c+="<div style='margin: 3px 0; max-height: 26px; overflow: hidden;'><strong><a class='link' title='"+e.titleFull+"'>"+e.title+"</a></strong></div>";c+="<div class='small'>"+e.date+" | "+e.duration+" min</div>";cfCache[a]=c;$("#cf-"+b).html(c);$("#cf-"+b+" a").bind("click",{pos:a},(livestream?setActiveItemLive:setActiveItem));if(d){$("#cf-"+b).addClass("active")}}function setActiveItemFlash(a){if(player&&currentPlayerItem!=a){setItem(a,(currentPlayerState=="IDLE"))}else{if(currentPlayerItem!=a){setTimeout("setActiveItemFlash("+a+")",500)}}}function setActiveItem(a){if(typeof a=="object"){a=a.data.pos}if(a<0){return}setActiveItemFlash(a);if(currentItem==a&&!cfFirstLoad){return}cfFirstLoad=false;if(a<cfPosition||a>=cfPosition+cfSize){loadCoverflow(a,a)}else{$("#coverflow > div").removeClass("active");$("#item-"+a).parent().addClass("active")}if(window.location.hash!="#error"){window.location.replace("#"+coverflow[a].node+"/"+coverflow[a].item)}currentItem=a;$(".iptv .message:first").animate({opacity:1},30000).fadeOut("slow",function(){$(this).remove()});loadItemRating(a);loadItemContent(a);loadItemLeserbrief(a);sendStatistic(coverflow[a].node,coverflow[a].module,coverflow[a].item)}function setActiveItemLive(a){if(typeof a=="object"){a=a.data.pos}if(!cfFirstLoad){window.location.href="index.php?node="+coverflow[a].node+"&content_item="+coverflow[a].item;return true}cfFirstLoad=false;if(typeof a=="undefined"){setRating(0,0,0);itemEndTime=0;loadItemLiveContent();return true}if(a<cfPosition||a>=cfPosition+cfSize){loadCoverflow(a,a)}else{$("#coverflow > div").removeClass("active");$("#item-"+a).parent().addClass("active")}currentItem=a;$(".iptv .message:first").animate({opacity:1},30000).fadeOut("slow",function(){$(this).remove()});loadItemRating(a);loadItemContent(a);loadItemLeserbrief(a);sendStatistic(coverflow[a].node,coverflow[a].module,coverflow[a].item)}function loadItemRating(a){var b=coverflow[a].module;var d=coverflow[a].item;var c=coverflow[a].rating;if(typeof b!="undefined"&&typeof d!="undefined"&&typeof c!="undefined"){setRating(b,d,c)}}function loadItemContent(a){var c=coverflow[a];itemEndTime=Math.round(new Date().getTime()/1000+c.duration2*0.8);if(typeof c.content=="string"){$("#flashContent").html(c.content);tb_init("#flashContent a.thickbox, #flashContent area.thickbox, #flashContent input.thickbox");return true}var b="";b+="<div class='no-print small' style='text-align: right; margin-top: 6px;'><a class='link' onclick='window.print();'>Drucken</a> | <a href='index.php?node=4059&amp;backNode="+currentNode+"-"+c.module+"-"+c.item+"&amp;noReset=true&amp;type=content&amp;TB_iframe=true' title='Sendung weiterempfehlen' class='thickbox'>Senden</a></div><hr />";b+="<p><em>"+c.moduleName+"</em></p><h1>"+c.titleFull+"</h1>";if(!livestream){b+="<p class='small'>"+c.date2+" | "+c.duration+" min</p>"}b+="<div class='article'></div>";cfAjaxCount++;$("#flashContent").html(b);$("#flashContent .article").load("ajax.php",{mode:"tvContent",module:c.module,item:c.item},function(){if(cfAjaxCount==1){coverflow[currentItem].content=$("#flashContent").html()}tb_init("#flashContent a.thickbox, #flashContent area.thickbox, #flashContent input.thickbox");cfAjaxCount--})}function loadItemLeserbrief(a){var b=coverflow[a];if(typeof b=="undefined"){return false}$("#flashLeserbrief").empty();$("#flashLeserbrief").load("ajax.php",{mode:"leserbrief",module:b.module,item:b.item})}function showButtons(){if(cfPosition==0){$("#cfTop").empty().html("<img src='images/layout2008/cf_top_inactive.png' class='png' style='width: 150px; height: 20px;' />")}else{$("#cfTop").empty().html("<a class='link'><img src='images/layout2008/cf_top_active.png' class='png' style='width: 150px; height: 20px;' /></a>");$("#cfTop a").click(prev)}if(cfPosition>=(coverflow.length-cfSize)){$("#cfBottom").empty().html("<img src='images/layout2008/cf_bottom_inactive.png' class='png' style='width: 150px; height: 20px;' />")}else{$("#cfBottom").empty().html("<a class='link'><img src='images/layout2008/cf_bottom_active.png' class='png' style='width: 150px; height: 20px;' /></a>");$("#cfBottom a").click(next)}}function next(){loadCoverflow(cfPosition+cfStep)}function prev(){loadCoverflow(cfPosition-cfStep)}function sendStatistic(c,a,b){try{if(a!=""&&b!=""){$.get(ajaxDomain+"ajax.php",{mode:"tvStatistik",module:a,item:b,type:"start"})}if(c!=""&&b!=""){pageTracker._trackPageview("/iptv/"+c+"/"+b)}}catch(d){}}function sendEndStatistic(){window.setTimeout("sendEndStatistic()",15000);if(itemEndTime!=0&&itemEndTime<(new Date().getTime()/1000)){var a=coverflow[currentItem];if(a.tv1=="ja"){$.get(ajaxDomain+"ajax.php",{mode:"tvStatistik",module:a.module,item:a.item,type:"end"})}itemEndTime=0}}var cfFirstLoad=true;var cfStep=1;var cfPosition;var cfSize=4;var cfAjaxCount=0;var livestream=false;var cfLiveCA=false;var itemEndTime=0;window.setTimeout("sendEndStatistic()",15000);var ajaxDomain="";var cfCache=new Array();$(window).unload(function(){cfCache=null});
