window.adscaleVideoDefaults={assetHost:"http://dev.adscale.de/adscale-javascript/",videoSlotConfig:"http://dev.adscale.de/adscale-client-http",videoAdvertUrl:"http://dev.adscale.de/adscale-client-http/",contentProviderUrls:{clipkit:""},logging:{level:"error"},autoplayCountdown:3,contentInformationUrl:"http://dev.adscale.de/adscale-javascript/vd"};for(var attrname in window.adscaleVideo){window.adscaleVideoDefaults[attrname]=window.adscaleVideo[attrname]}window.adscaleVideo=window.adscaleVideoDefaults;if(!adscaleVideoNS){var adscaleVideoNS={initVideo:function(){if(typeof adscale_video_events!=="object"){window.adscale_video_events={}}if(typeof window.adscale_video_events.render_player==="undefined"){window.adscale_video_events.render_player=true}if(typeof adscale_slot_id!=="undefined"){var a=window.adscaleVideo.videoSlotConfig;var b=a.indexOf("?")!=-1?"&":"?";document.write("<script type='text/javascript' src='"+a+b+"sid="+adscale_slot_id+"'><\/script>")}},__callbacks:[],__playlist:[],onContentDetails:function(a){var c=adscaleVideoNS.__callbacks;for(var b=0;b<c.length;b+=1){c[b](a)}},renderVideoPlayer:function(A){var w=A;var C=document,B=window.adscaleVideo;var t=((function(){var F=new Array();var H=true;var E=null;var D=false;var G=((function(){var J=new Array();var I=-1;return{add:function(K){J.length=I+1;J.push(K);I++},hasPrevious:function(){return I>0},hasNext:function(){return I<J.length-1},next:function(){I++;return J[I]},previous:function(){I--;return J[I]},getCurrentIndex:function(){return J[I]},hasHistory:function(){return J.length>0}}}))();return{atLast:function(){return !H},add:function(J,I){if(F.length==0){I[I.length-1].isFirst=true;I[0].autoPlay=false;G.add(0)}else{I[I.length-1].isFirst=false}F.push([J,I]);if(I[I.length-1].isLast){H=false}if(E!=null){E(I);G.add(F.length-1);E=null}},findByPos:function(I,J){if(F.length==0){return[]}if(!J){D=true}G.add(I);return F[I][1]},findById:function(K,J){if(!J){D=true}if(F.length==0){return[]}for(var I=0;I<F.length;I++){if(F[I][0]===K){if(!J){D=true}G.add(I);return F[I][1]}}return[]},findPosById:function(J){for(var I=0;I<F.length;I++){if(F[I][0]===J){return I}}return -1},getIds:function(){var J=[];for(var I=0;I<F.length;I++){J.push(F[I][0])}return J},findNext:function(J){D=true;if(!G.hasNext()&&G.getCurrentIndex()==F.length-1&&H){adscaleVideoNS.requestMoreItems(0);E=J}else{if(!G.hasNext()&&G.getCurrentIndex()<F.length-1){var I=G.getCurrentIndex()+1;J(F[I][1]);G.add(I)}else{if(G.hasNext()){J(F[G.next()][1])}else{D=false}}}},findPrevious:function(I){D=true;if(G.hasPrevious()){I(F[G.previous()][1])}else{D=false}},findFirst:function(){D=true;if(!G.hasHistory()){G.add(0)}return F[G.getCurrentIndex()][1]},getLastContentId:function(){return F[F.length-1][0]},isUnlocked:function(){return !D},unlock:function(){setTimeout(function(){D=false},500)}}}))();var e=((function(){var E={};function D(H){var G=E[H];var F={};F.id=G.id;F.title=G.title;F.description=G.description;F.duration=G.duration;F.published=G.published;F.thumbnail=G.thumbnail;F.category=G.category;F.format=G.format.title;F.pos=G.pos;return F}return{add:function(F){E[F.id]=F;F.pos=t.findPosById(F.id)},get:function(F){return D(F)},getPlaylist:function(){var G={clips:[],categories:{},formats:{}};var I=t.getIds();for(var H=0;H<I.length;H++){var L=I[H];var F=E[L];var J=F.category;var K=F.format.title;G.clips.push(D(L));if(!G.categories[J]){G.categories[J]={clipIds:[]}}G.categories[J].clipIds.push(F.id);if(!G.formats[K]){G.formats[K]=F.format;G.formats[K].clipIds=[]}G.formats[K].clipIds.push(F.id)}return G}}}))();function d(){var D=v();i(D);if(!A.player.autoplay){n(D,w,u,q)}k()}function z(E,D){D=typeof D=="undefined"?0:D;if(!$f(D).isLoaded()){$f(D).load(function(){$f(D).setPlaylist(E)})}else{$f(D).setPlaylist(E)}}adscaleVideoNS.requestMoreItems=function(E){if(typeof __chunkRequestLock!=="undefined"&&__chunkRequestLock){return}if(!y().atLast()){__chunkRequestLock=true;__calledByFlowPlayerWithPlayerId=E;var D=C.createElement("script");D.src=B.videoSlotConfig+"?sid="+adscale_slot_id+"&vcid="+y().getLastContentId()+"&rid="+A.renderId;C.getElementsByTagName("head")[0].appendChild(D)}else{if(typeof playId==="undefined"){adscale_video_events.onPlaylist(e.getPlaylist())}}};adscaleVideoNS.playById=function(D){if(typeof flowplayer==="undefined"){d()}if(typeof $f!=="function"||typeof $f(0)==="undefined"){setTimeout(function(){adscaleVideoNS.playById(D)},50)}else{if(t.isUnlocked()){if($f().isLoaded()){z(t.findById(D,false))}else{t.findById(D,true);$f().load()}}}};adscaleVideoNS.playByPos=function(D){if(typeof flowplayer==="undefined"){d()}if(typeof $f!=="function"||typeof $f(0)==="undefined"){setTimeout(function(){adscaleVideoNS.playByPos(D)},50)}else{if(t.isUnlocked()){if($f().isLoaded()){z(t.findByPos(D,false))}else{t.findByPos(D,true);$f().load()}}}};function y(){playerId=0;if(typeof __calledByFlowPlayerWithPlayerId!="undefined"){playerId=__calledByFlowPlayerWithPlayerId}var D=adscaleVideoNS.__playlist[playerId];return D?D:t}function h(D,E){return adscaleVideoNS.__playlist[D]=E
}function p(K,F){var J=x(K);var E=0;var I=new Array();var D=null;while(E<J.length){var H=J[E];var G=H.id.split("|")[0];if(D!=null&&G!=D){F.add(D,I);D=G;I=new Array();I.push(H)}else{if(D==null){D=G;I.push(H)}else{if(D==G){I.push(H)}}}E++}if(I.length>0){F.add(D,I)}}adscaleVideoNS.onChunk=function(D){p(D,y());calledByPlayer=typeof __calledByFlowPlayerWithPlayerId!="undefined";f(D,calledByPlayer);__calledByFlowPlayerWithPlayerId=undefined;__chunkRequestLock=false};p(A.playlist,t);var b=o(A,B);var c=A.playerId;var u=A.player.width;var q=A.player.height;var m;f(A.playlist,false);v();if(adscale_video_events.render_player){d()}function l(){var D;var E=adscaleVideoNS;D={removeItem:function(H,G){for(var F=0;F<H.length;F++){if(H[F]===G){H.splice(F,1);break}}return H},addCallback:function(F){E.__callbacks.push(F)},removeCallback:function(F){E.__callbacks=D.removeItem(E.__callbacks,F)},createVideoDetailsScriptTagId:function(F){return"videoDetails_"+F.replace("=","")},requestContent:function(H){function F(J){var I=C.createElement("script");I.src=B.contentInformationUrl+"/"+encodeURIComponent(J);I.id=D.createVideoDetailsScriptTagId(J);C.getElementsByTagName("head")[0].appendChild(I)}if(typeof H==="string"){F(H)}else{for(var G=0;G<H.length;G++){F(H[G])}}},storeContent:function(G){e.add(G);var F=C.getElementById(D.createVideoDetailsScriptTagId(G.id));F.parentNode.removeChild(F)}};return D}function j(D){D=D.split("|")[0];adscale_video_events.nowPlaying(adscale_slot_id,e.get(D))}function f(I,H){if(typeof adscale_video_events.onPlaylist==="function"){function G(L){var K=[];for(var J=1;J<L.length;J+=2){var M=L[J].id;K.push(M)}return K}var F=l();var D=G(I);var E=function(J){var K=J.id;F.storeContent(J);D=F.removeItem(D,K);if(D.length==0){if(!H){adscale_video_events.onPlaylist(e.getPlaylist())}F.removeCallback(E)}};F.addCallback(E);F.requestContent(D)}}function o(D,F){var G={onLoad:function(){var I=this;var H=I.getIndex();if(D.player.autoplay){I.hide();setTimeout(function(){I.setVolume(5)},50)}else{setTimeout(function(){I.setVolume(50)},50)}h(H,t);$f(H).onPrevious=function(){if(t.isUnlocked()){t.findPrevious(function(J){z(J,H)})}};$f(H).onNext=function(){if(t.isUnlocked()){t.findNext(function(J){z(J,H)})}};z(t.findFirst(),H)},onPlaylistReplace:function(){var H=this;setTimeout(function(){t.unlock()},50)},canvas:{background:"#000000",backgroundGradient:"none"},play:{replayLabel:D.player.playAgain,width:D.player.width/3,height:D.player.height/3},clip:{scaling:"fit",onStart:function(I){var H=this;if(typeof adscale_video_events.nowPlaying==="function"){j(I.id)}if(I.clipType=="ad"){var J={update:function(){},duration:function(){return Math.floor(I.duration-H.getTime())}};I.timerElement=a(H.getConfig().playerId,J)}},onFinish:function(H){if(H.timerElement){H.timerElement.parentNode.removeChild(H.timerElement)}}},playlist:[]};G.log=F.logging;G.plugins={adscaleControl:{url:F.assetHost+"/adscale-control.swf",contentUrls:F.contentProviderUrls,singleFrame:{host:F.assetHost,filename:"blank-single-frame.flv"}},rtmp:{url:F.assetHost+"/flowplayer.rtmp-3.2.3.swf"}};if(!(typeof adscale_slot_id==="undefined")){G.plugins.adscaleVast={url:F.assetHost+"/adscale-vast.swf",sid:adscale_slot_id,vastServer:F.videoAdvertUrl,rid:D.renderId,singleFrame:{host:F.assetHost,filename:"blank-single-frame.flv"},autoplayCountdown:D.player.autoplay}}if(D.player.showControls){G.plugins.controls={url:F.assetHost+"/flowplayer.controls-3.2.5.swf",timeBorderRadius:0,volumeBorder:"0px",left:0,zIndex:99,playlist:true};if(D.player.autoplay){G.plugins.controls.display="none"}var E=D.player.width;if(E<380){G.plugins.controls.timeFontSize=12-(380-E)/40;G.plugins.controls.height=Math.round(26-(380-E)/13)}}else{G.plugins.controls=null}g(G,F,D);return G}function g(F,G,E){var D=null;if(!(typeof adscale_slot_id==="undefined")){D=adscale_slot_id}F.plugins.adscalePlaylist={url:G.assetHost+"/adscale-playlist.swf",rid:E.renderId,vastServer:G.videoAdvertUrl,vchUrl:window.adscaleVideo.videoSlotConfig,sid:D,singleFrame:{host:G.assetHost,filename:"blank-single-frame.flv"}}}function x(H){var G=[];var D=H.length;for(var I=0;I<D;I++){var F=H[I];var E={url:F.url,clipType:F.clipType,id:F.id,isLast:F.isLast,cat:F.cat,fid:F.fid,startEvent:F.startEvent?F.startEvent:[]};if(E.url.indexOf("rtmp:")==0){if(E.url.indexOf("mp4:")>-1){E.netConnectionUrl=E.url.substring(0,E.url.indexOf("mp4:"));E.url=E.url.substring(E.url.indexOf("mp4:"),E.url.length)}else{E.netConnectionUrl=E.url.substring(0,E.url.lastIndexOf("/")+1);E.url="mp4:"+E.url.substring(E.url.lastIndexOf("/")+1,E.url.length)}E.provider="rtmp"}else{E.provider="http"}E.duration=F.duration;E.authenticationMethod=F.authenticationMethod;G.push(E)}return G}function n(I,D,G,H){var F=new Image();F.src=D.player.splash.url;if(F.src===""||typeof F.src=="undefined"){return}var E=Math.min(parseInt(Math.round(H*D.player.splash.ratio)),G);F.height=H;F.style.height=H+"px";F.width=E;F.style.width=E+"px";F.style.margin="auto";m=s(G,H);I.appendChild(F);I.appendChild(m)
}function s(E,M){var D=B.assetHost+"/play_large.png";var K=parseInt(Math.min(E*0.26,83));var N=K;var L=(M/2)-(K/2);var F=(E/2)-(N/2);var J=new Image();J.src=D;var O=[["cursor","pointer"],["position","absolute"],["top",L+"px"],["left",F+"px"],["width",K+"px"],["height",N+"px"]];var I=O.length;for(var G=0;G<I;G+=1){var H=O[G][0];J.style[H]=O[G][1]}return J}function v(){var D=C.getElementById(c+"_player");if(!D){C.write("<div id='"+c+"' style='position: relative'><div id='"+c+"_player'><span></span></div></div>");D=C.getElementById(c+"_player")}return D}function i(D){D.style.width=u+"px";D.style.height=q+"px";D.style.textAlign="center";D.style.position="relative";D.style.backgroundColor="black"}function r(F,H){var G=(q/2)-30;var D="<div id='"+c+"_countdownDiv' style='background:transparent url("+B.assetHost+"/roundy.png) no-repeat center; height:80px; position:absolute; top:"+G+"px;left: 0; width:"+u+"px; text-align:center;'></div>";var E="<p style='margin: 0 auto; padding: 0; font: 13px/80px Helvetica, Arial, sans-serif;'>"+H+"</p>";if(F.textElement==null){F.textElement=C.createElement("div");F.textElement.style.position="absolute";F.textElement.style.top="0px";F.textElement.style.left="0px";F.textElement.style.width=u+"px";F.textElement.style.height=q+80+"px";C.getElementById(c).appendChild(F.textElement);F.textElement.innerHTML=D;n(F.textElement,w,u,q);F.textElement.removeChild(m)}C.getElementById(c+"_countdownDiv").innerHTML=E}function a(K,I){var E=document.getElementById(K+"_player");var D=document.createElement("div");D.style.fontFamily="Helvetica, Arial, sans-serif";D.style.display="block";D.style.backgroundColor="white";D.style.padding="2px";D.style.fontSize="10px";D.style.position="absolute";D.style.left="0px";D.style.lineHeight="15px";D.style.top="-19px";E.appendChild(D);var J={textElement:D};var F=function(){};var H=function(L,N){var M=N==1?"Sekunde":"Sekunden";L.textElement.innerHTML="Werbung - noch "+N+" "+M};var G=adscaleVideoNS.textUpdatingCountdown(J,H,F,I);G.startTicker();return D}function k(){var H={textElement:null};var G;var E=function(){if(typeof flowplayer==="function"){clearInterval(G);var K=flowplayer(c+"_player",{src:B.assetHost+"/flowplayer.unlimited-3.2.7.swf",version:[10,53],onFail:function(){C.getElementById(c+"_player").innerHTML="<span style='color:white; margin:2px;'>Sie benötigen die neueste Flash-Version zu MP4 Filme ansehen.</span> "},expressInstall:false,wmode:"opaque"},b);if(A.player.autoplay){K.load();var L=function(){var P=0;K.show();var N=setInterval(function(){if(K.getState()==2||K.getState()==4||P>50){K.getPlugin("controls").show();K.pause();K.resume();clearInterval(N)}else{P=P+1}},100);var O=H.textElement.parentNode;if(O!=null){O.removeChild(H.textElement)}};var J=function(N,P){var O=P==1?"Sekunde":"Sekunden";r(H,"Video startet in "+P+" "+O+"...")};var M={remainingTime:B.autoplayCountdown,update:function(){if(this.remainingTime>0){this.remainingTime-=1}},duration:function(){return this.remainingTime}};var I=adscaleVideoNS.textUpdatingCountdown(H,J,L,M);I.startTicker()}}};if(typeof flowplayer==="undefined"){if(!C.getElementById("adscale_fp_js")){var F=C.createElement("script");var D=C.getElementsByTagName("head").item(0);D.appendChild(F);F.setAttribute("id","adscale_fp_js");F.setAttribute("type","text/javascript");F.setAttribute("src",B.assetHost+"/flowplayer-3.2.6.min.js")}G=setInterval(E,50)}else{E()}}},callEventUrl:function(a){var b=new Image();b.src=a},textUpdatingCountdown:function(f,c,a,e){var d=e;var b;var g=function(){if(d.duration()>0){c(f,d.duration());d.update()}else{a();clearInterval(b)}};return{autoplayDelayInSeconds:d.duration(),startTicker:function(){g();var h=1000;b=setInterval(g,h)}}}}}adscaleVideoNS.initVideo();

