window.adscaleVideoDefaults={assetHost:"http://js.adscale.de",videoSlotConfig:"http://vh.adscale.de/vch",videoAdvertUrl:"http://vh.adscale.de/vah",contentProviderUrls:{clipkit:"",castaclip:""},logging:{level:"error"},autoplayCountdown:3,contentInformationUrl:"http://vd.adscale.de/c"};for(var attrname in window.adscaleVideo){window.adscaleVideoDefaults[attrname]=window.adscaleVideo[attrname]}window.adscaleVideo=window.adscaleVideoDefaults;if(!adscaleVideoNS){var adscaleVideoNS={autoplayComplete:false,initVideo:function(){if(!adscaleVideoNS.videoIdProvider){adscaleVideoNS.videoIdProvider=((function(){var a=adscaleVideoNS.DEFAULT_PLAYER_ID;return{getId:function(){var b=a;a=a+1;return b}}}))()}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 window.adscale_video_events.autoplay_id==="undefined"){window.adscale_video_events.autoplay_id=false}if(typeof window.adscale_video_events.player_width==="undefined"||typeof window.adscale_video_events.player_height==="undefined"||window.adscale_video_events.player_width===""||window.adscale_video_events.player_height===""){window.adscale_video_events.player_width=false;window.adscale_video_events.player_height=false}if(typeof adscale_slot_id!=="undefined"){var d=window.adscaleVideo.videoSlotConfig;var c=d.indexOf("?")!=-1?"&":"?";document.write("<script type='text/javascript' src='"+d+c+"sid="+adscale_slot_id+"'><\/script>")}},__callbacks:[],__apis:{},__onChunkScriptId:"onChunkScript",DEFAULT_PLAYER_ID:1,playById:function(f,e){if(typeof e=="undefined"){e=adscaleVideoNS.DEFAULT_PLAYER_ID}var d=adscaleVideoNS.__apis[e];if(typeof d!="undefined"){d.playById(f)}},playByPos:function(f,e){if(typeof e=="undefined"){e=adscaleVideoNS.DEFAULT_PLAYER_ID}var d=adscaleVideoNS.__apis[e];if(typeof d!="undefined"){d.playByPos(f)}},requestMoreItems:function(e,f){if(typeof e=="undefined"){e=adscaleVideoNS.DEFAULT_PLAYER_ID}var d=adscaleVideoNS.__apis[e];if(typeof d!="undefined"){d.requestMoreItems(f)}},onContentDetails:function(e){var f=adscaleVideoNS.__callbacks;for(var d=0;d<f.length;d+=1){f[d](e)}},renderVideoPlayer:function(V){var ay=document,P=window.adscaleVideo,R=window;var an=adscaleVideoNS.videoIdProvider.getId();if(V.renderId!=="0000000000"){V.playerId=V.playerId+"_"+an}var ag;var at=window.adscale_video_events;var Q=window.adscale_slot_id;var ad=((function(){var c=new Array();var a=true;var d=null;var e=false;var b=((function(){var f=new Array();var g=-1;return{add:function(h){f.length=g+1;f.push(h);g++},hasPrevious:function(){return g>0},hasNext:function(){return g<f.length-1},next:function(){g++;return f[g]},previous:function(){g--;return f[g]},getCurrentIndex:function(){return f[g]},hasHistory:function(){return f.length>0}}}))();return{atLast:function(){return !a},add:function(f,g){if(c.length==0){g[g.length-1].isFirst=true;g[0].autoPlay=false;b.add(0)}else{g[g.length-1].isFirst=false}c.push([f,g]);if(g[g.length-1].isLast){a=false}if(d!=null){d(g);b.add(c.length-1);d=null}},findByPos:function(g,f){if(c.length==0){return[]}if(!f){e=true}b.add(g);return c[g][1]},findById:function(f,g){if(!g){e=true}if(c.length==0){return[]}for(var h=0;h<c.length;h++){if(c[h][0]===f){if(!g){e=true}b.add(h);return c[h][1]}}return[]},findPosById:function(f){for(var g=0;g<c.length;g++){if(c[g][0]===f){return g}}return -1},findIdByPos:function(f){return c[f][0]},getIds:function(){var f=[];for(var g=0;g<c.length;g++){f.push(c[g][0])}return f},findNext:function(f){e=true;if(!b.hasNext()&&b.getCurrentIndex()==c.length-1&&a){adscaleVideoNS.requestMoreItems(an,true);d=f}else{if(!b.hasNext()&&b.getCurrentIndex()<c.length-1){var g=b.getCurrentIndex()+1;f(c[g][1]);b.add(g)}else{if(b.hasNext()){f(c[b.next()][1])}else{e=false}}}},findPrevious:function(f){e=true;if(b.hasPrevious()){f(c[b.previous()][1])}else{e=false}},findFirst:function(){if(c.length!=0){e=true;if(!b.hasHistory()){b.add(0)}return c[b.getCurrentIndex()][1]}},getLastContentId:function(){return c[c.length-1][0]},getFirstContentId:function(){if(c.length>0){return c[0][0]}else{return -1}},setFirstContentForPlayback:function(f){var g=this.findPosById(f);if(g!=-1){b.add(g)}},isUnlocked:function(){return !e},unlock:function(){setTimeout(function(){e=false},500)}}}))();var X=((function(){var a={};function b(c){var d=a[c];var e={};e.id=d.id;e.title=d.title;e.description=d.description;e.duration=d.duration;e.published=d.published;e.thumbnail=d.thumbnail;e.category=d.category;e.format=d.format.title;e.pos=d.pos;return e}return{add:function(c){a[c.id]=c;c.pos=ad.findPosById(c.id)},get:function(c){return b(c)},getPlaylist:function(){var g={clips:[],categories:{},formats:{},playerId:an};var e=ad.getIds();for(var f=0;f<e.length;f++){var i=e[f];var h=a[i];var d=h.category;var c=h.format.title;g.clips.push(b(i));if(!g.categories[d]){g.categories[d]={clipIds:[]}
}g.categories[d].clipIds.push(h.id);if(!g.formats[c]){g.formats[c]=h.format;g.formats[c].clipIds=[]}g.formats[c].clipIds.push(h.id)}return g}}}))();function ae(){var a=U();ai(a);aA(a,V,aD,aB);al()}function af(a,b){b=typeof b=="undefined"?0:b;if(!$f(b).isLoaded()){$f(b).load(function(){$f(b).setPlaylist(a)})}else{window.currentIndex="ere";$f(b).setPlaylist(a)}}adscaleVideoNS.__apis[an]={playById:function(a){if(typeof flowplayer==="undefined"){var b=aw();Y(b)}else{if(ad.isUnlocked()){if(ag.isLoaded()){af(ad.findById(a,false),ag.getIndex())}else{S(a);ag.load()}}}},playByPos:function(b){if(typeof flowplayer==="undefined"){var a=ah(b);Y(a)}else{if(ad.isUnlocked()){if(ag.isLoaded()){af(ad.findByPos(b,false),ag.getIndex())}else{S(ad.findIdByPos(b));ag.load()}}}},requestMoreItems:function(a){if(typeof __chunkRequestLock!=="undefined"&&__chunkRequestLock){return}if(typeof a==="undefined"){a=false}if(!ad.atLast()){__chunkRequestLock=true;var b=ay.createElement("script");b.id=adscaleVideoNS.__onChunkScriptId;b.src=P.videoSlotConfig+"?sid="+Q+"&vcid="+ad.getLastContentId()+"&rid="+V.renderId;b.callback=function(c){W(c,ad);aq(c,a);b.parentNode.removeChild(b)};ay.getElementsByTagName("head")[0].appendChild(b)}else{if(!a){at.onPlaylist(X.getPlaylist())}}}};function av(){return an}function W(a,f){var b=ar(a);var g=0;var c=new Array();var h=null;while(g<b.length){var d=b[g];var e=d.id.split("|")[0];if(h!=null&&e!=h){f.add(h,c);h=e;c=new Array();c.push(d)}else{if(h==null){h=e;c.push(d)}else{if(h==e){c.push(d)}}}g++}if(c.length>0){f.add(h,c)}}function ao(){var b;var a=adscaleVideoNS;b={removeItem:function(c,d){for(var e=0;e<c.length;e++){if(c[e]===d){c.splice(e,1);break}}return c},addCallback:function(c){a.__callbacks.push(c)},removeCallback:function(c){a.__callbacks=b.removeItem(a.__callbacks,c)},createVideoDetailsScriptTagId:function(c){return"videoDetails_"+c.replace("=","")+"_"+av()},requestContent:function(c,d){function f(g){var h=ay.createElement("script");h.src=P.contentInformationUrl+"/"+encodeURIComponent(g);h.callback=function(k,i,j){X.add(i);k=b.removeItem(k,i.id);if(k.length==0){if(!d){at.onPlaylist(X.getPlaylist())}b.removeCallback(j)}};h.id=b.createVideoDetailsScriptTagId(g);ay.getElementsByTagName("head")[0].appendChild(h)}if(typeof c==="string"){f(c)}else{for(var e=0;e<c.length;e++){f(c[e])}}},deleteScript:function(c){var d=ay.getElementById(b.createVideoDetailsScriptTagId(c.id));d.parentNode.removeChild(d)}};return b}function au(a){a=a.split("|")[0];at.nowPlaying(Q,X.get(a),av())}function aq(a,b){if(typeof at.onPlaylist==="function"){function c(j){var g=[];for(var h=1;h<j.length;h+=2){var i=j[h].id;g.push(i)}return g}var d=ao();var f=c(a);var e=function(g){var h=ay.getElementById(d.createVideoDetailsScriptTagId(g.id));if(h!==null){h.callback(f,g,e);d.deleteScript(g)}};d.addCallback(e);d.requestContent(f,b)}}function ac(d,b){var a={onLoad:function(){var f=this;var g=f.getIndex();if(d.player.autoplay){if(!adscaleVideoNS.autoplayComplete){f.hide()}else{var e=setInterval(function(){f.resume();if(f.getState()===3){clearInterval(e)}},100)}}$f(g).onPrevious=function(){if(ad.isUnlocked()){ad.findPrevious(function(h){af(h,g)})}};$f(g).onNext=function(){if(ad.isUnlocked()){ad.findNext(function(h){af(h,g)})}};af(ad.findFirst(),g)},onPlaylistReplace:function(){setTimeout(function(){ad.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(f){var g=this;if(typeof at.nowPlaying==="function"){au(f.id)}if(f.clipType=="ad"){var e={update:function(){},duration:function(){return Math.floor(f.duration-g.getTime())}};f.timerElement=ax(g.getConfig().playerId,e)}},onFinish:function(e){if(e.timerElement){e.timerElement.parentNode.removeChild(e.timerElement)}}},playlist:[]};a.log=b.logging;a.plugins={adscaleControl:{url:b.assetHost+"/adscale-control.swf",contentUrls:b.contentProviderUrls,singleFrame:{host:b.assetHost,filename:"blank-single-frame.flv"}},rtmp:{url:b.assetHost+"/flowplayer.rtmp-3.2.3.swf"}};if(!(typeof Q==="undefined")){a.plugins.adscaleVast={url:b.assetHost+"/adscale-vast.swf",sid:Q,vastServer:b.videoAdvertUrl,rid:d.renderId,singleFrame:{host:b.assetHost,filename:"blank-single-frame.flv"},autoplayCountdown:d.player.autoplay}}if(d.player.showControls){a.plugins.controls={url:b.assetHost+"/flowplayer.controls-3.2.5.swf",timeBorderRadius:0,volumeBorder:"0px",left:0,zIndex:99,playlist:true};var c=d.player.width;if(c<380){a.plugins.controls.timeFontSize=12-(380-c)/40;a.plugins.controls.height=Math.round(26-(380-c)/13)}}else{a.plugins.controls=null}ak(a,b,d);return a}function ak(b,a,c){var d=null;if(!(typeof Q==="undefined")){d=Q}b.plugins.adscalePlaylist={url:a.assetHost+"/adscale-playlist.swf",rid:c.renderId,vastServer:a.videoAdvertUrl,vchUrl:window.adscaleVideo.videoSlotConfig,sid:d,autoplay:c.player.autoplay,singleFrame:{host:a.assetHost,filename:"blank-single-frame.flv"}}}function ar(b){var c=[];
var f=b.length;for(var a=0;a<f;a++){var d=b[a];var e={url:d.url,clipType:d.clipType,id:d.id,isLast:d.isLast,cat:d.cat,fid:d.fid,startEvent:d.startEvent?d.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=d.duration;e.authenticationMethod=d.authenticationMethod;c.push(e)}return c}function aA(a,f,c,b){var d=new Image();d.src=f.player.splash.url;if(d.src===""||typeof d.src=="undefined"){return}var e=Math.min(parseInt(Math.round(b*f.player.splash.ratio)),c);d.height=b;d.style.height=b+"px";d.width=e;d.style.width=e+"px";d.style.margin="auto";aE=Z(c,b);a.appendChild(d);a.appendChild(aE)}function Z(k,c){var l=P.assetHost+"/play_large.png";var e=parseInt(Math.min(k*0.26,83));var b=e;var d=(c/2)-(e/2);var j=(k/2)-(b/2);var f=new Image();f.src=l;var a=[["cursor","pointer"],["position","absolute"],["top",d+"px"],["left",j+"px"],["width",e+"px"],["height",b+"px"]];var g=a.length;for(var i=0;i<g;i+=1){var h=a[i][0];f.style[h]=a[i][1]}return f}function U(){return ay.getElementById(ab+"_player")}function ai(a){a.style.width=aD+"px";a.style.height=aB+"px";a.style.textAlign="center";a.style.position="relative";a.style.backgroundColor="black"}function T(c,a){var b=(aB/2)-30;var e="<div id='"+ab+"_countdownDiv' style='background:transparent url("+P.assetHost+"/roundy.png) no-repeat center; height:80px; position:absolute; top:"+b+"px;left: 0; width:"+aD+"px; text-align:center;'></div>";var d="<p style='margin: 0 auto; padding: 0; font: 13px/80px Helvetica, Arial, sans-serif;'>"+a+"</p>";if(c.textElement==null){c.textElement=ay.createElement("div");c.textElement.style.position="absolute";c.textElement.style.top="0px";c.textElement.style.left="0px";c.textElement.style.width=aD+"px";c.textElement.style.height=aB+80+"px";ay.getElementById(ab).appendChild(c.textElement);c.textElement.innerHTML=e;aA(c.textElement,V,aD,aB);c.textElement.removeChild(aE)}ay.getElementById(ab+"_countdownDiv").innerHTML=d}function ax(a,c){var g=document.getElementById(a+"_player");var h=document.createElement("div");h.style.fontFamily="Helvetica, Arial, sans-serif";h.style.display="block";h.style.backgroundColor="white";h.style.padding="2px";h.style.fontSize="10px";h.style.position="absolute";h.style.left="0px";h.style.lineHeight="15px";h.style.top="-19px";g.appendChild(h);var b={textElement:h};var f=function(){};var d=function(k,i){var j=i==1?"Sekunde":"Sekunden";k.textElement.innerHTML="Werbung - noch "+i+" "+j};var e=adscaleVideoNS.textUpdatingCountdown(b,d,f,c);e.startTicker();return h}function az(a){var c=ay.getElementById(ab+"_player");if(!c){ay.write("<div id='"+ab+"' style='position: relative'><div id='"+ab+"_player'><span></span></div></div>");c=ay.getElementById(ab+"_player");if(c===null){var b=setInterval(function(){var d=ay.getElementById(ab+"_player");if(d!==null){clearInterval(b);a()}},100)}else{a()}}else{a()}}function al(){var a;var c=function(){if(typeof flowplayer==="function"){clearInterval(a);ag=flowplayer(ab+"_player",{src:P.assetHost+"/flowplayer.unlimited-3.2.7.swf",version:[10,53],onFail:function(){ay.getElementById(ab+"_player").innerHTML="<span style='color:white; margin:2px;'>Sie ben??tigen die neueste Flash-Version zu MP4 Filme ansehen.</span> "},expressInstall:false,wmode:"opaque"},aj)}};if(typeof flowplayer==="undefined"){if(!ay.getElementById("adscale_fp_js")){var b=ay.createElement("script");var d=ay.getElementsByTagName("head").item(0);d.appendChild(b);b.setAttribute("id","adscale_fp_js");b.setAttribute("type","text/javascript");b.setAttribute("src",P.assetHost+"/flowplayer-3.2.6.min.js")}a=setInterval(c,50)}else{c()}}function aw(a){return{contentId:a,startImmediately:true,showAutoplayCountdown:false,render:true}}function ah(a){var b=ad.findIdByPos(a);return{contentId:b,startImmediately:true,showAutoplayCountdown:false,render:true}}function am(){var c={};function e(){return at.autoplay_id!==false}function b(){return at.autoplay_id}function a(){return ad.getFirstContentId()}function f(){return V.player.autoplay}function d(){return at.render_player}if(!d()){c.contentId=false;c.startImmediately=false;c.showAutoplayCountdown=false;c.render=false}else{if(e()){c.contentId=b();c.startImmediately=true;c.showAutoplayCountdown=false;c.render=true}else{if(f()){c.contentId=a();c.startImmediately=true;c.showAutoplayCountdown=true;c.render=true}else{c.contentId=a();c.startImmediately=false;c.showAutoplayCountdown=false;c.render=true}}}return c}function S(a){if(a!=-1){ad.setFirstContentForPlayback(a)}}function Y(a){if(a.render){S(a.contentId);ae();if(a.startImmediately){ap(a.showAutoplayCountdown)}}}function aa(){var b={textElement:null};var c=function(){ag.show();var g=setInterval(function(){if(ag.getState()==4){ag.getPlugin("controls").show();
ag.resume();adscaleVideoNS.autoplayComplete=true;clearInterval(g)}},100);var f=b.textElement.parentNode;if(f!=null){f.removeChild(b.textElement)}};var d=function(h,f){var g=f==1?"Sekunde":"Sekunden";T(b,"Video startet in "+f+" "+g+"...")};var a={remainingTime:P.autoplayCountdown,update:function(){if(this.remainingTime>0){this.remainingTime-=1}},duration:function(){return this.remainingTime}};var e=adscaleVideoNS.textUpdatingCountdown(b,d,c,a);e.startTicker()}function ap(b){var c=false;function a(f,e,g){if(f.addEventListener){f.addEventListener(e,g,false)}else{if(f.attachEvent){f.attachEvent("on"+e,g)}}}function d(){function g(h){return(!h&&typeof ay.readyState==="undefined")}function f(h){return(!h&&typeof ay.readyState!=="undefined"&&(ay.readyState==="complete"||ay.readyState==="initialized"||ay.readyState==="loaded"))}if(g(c)||f(c)){c=true;var e=setInterval(function(){if(typeof ag!=="undefined"){ag.load();if(b){aa()}clearInterval(e)}},500)}}if(ay.readyState==="complete"){d()}else{a(R,"load",d);a(ay,"DOMContentLoaded",d);a(ay,"readystatechange",d)}}adscaleVideoNS.onChunk=function(a){var b=ay.getElementById(adscaleVideoNS.__onChunkScriptId);b.callback(a);__chunkRequestLock=false};W(V.playlist,ad);if(at.autoplay_id!==false){V.player.autoplay=false}var aj=ac(V,P);var ab=V.playerId;var aD=V.player.width;var aB=V.player.height;if(at.player_width!==false&&at.player_height!==false){aD=at.player_width;aB=at.player_height}var aE;var aC=function(){aq(V.playlist,false);renderConfiguration=am();Y(renderConfiguration)};az(aC)},callEventUrl:function(d){var c=new Image();c.src=d},textUpdatingCountdown:function(k,n,i,l){var m=l;var h;var j=function(){if(m.duration()>0){n(k,m.duration());m.update()}else{i();clearInterval(h)}};return{autoplayDelayInSeconds:m.duration(),startTicker:function(){j();var a=1000;h=setInterval(j,a)}}}}}adscaleVideoNS.initVideo();

