function SC_Interstitial(){if(SC_Interstitial.singleton==null){SC_Interstitial.singleton=new SC_InterstitialClass();}return SC_Interstitial.singleton;};function SC_InterstitialClass(){this.debugLayer=document.getElementById('SC_DEBUGLAYER');this.browser='UNKNOWN';this.version=0.0;this.opacity=0.8;this.mediaPlayerClassId='6BF52A52-394A-11D3-B153-00C04F79FAA6';this.flashClassId='D27CDB6E-AE6D-11CF-96B8-444553540000';this.protocol=window.location.protocol;this.cdnBase=this.protocol+'//cdn.smartclip.net/interstitial/';this.miniPlayerUrl=this.cdnBase+'interstitial.swf';this.backgroundColor='000000';this.audioVolume=100;this.videoAdUrl=null;this.curSiteZone=null;this.videoAdXML=null;this.layer=null;this.layerframe=null;this.playerLayer=null;this.adisavailable=false;this.player=null;this.adWidth=640;this.adHeight=360;this.zIndex=10000;this.flashHiding=true;this.polite=true;this.offSetLeft=0;this.onStartCallback=null;this.onEndCallback=null;this.headerText='Weiter geht es nach einem kurzen Werbespot';this.headerTextColor='FFFFFF';this.closeText='Schliessen';this.closeDelay=0;this.borderWidth=12;this.controlHeight=30;this.colorSet=0;this.onStartTrackerUrl=null;this.timeText='Sekunden';this.SC_CompanionArray=new Array();this.objectId="SC_InterstitialPlayer";this.rnd=Math.floor(Math.random()*100000000);this.ewSync=function(xmlData,node,nodepath){if(typeof(node)=='undefined'){var bFirstCall='true';var node='';var nodepath='';}for(var i in xmlData){if(typeof(xmlData[i])=='object'){if(node!=''&&nodepath!=""){nodepath+="."+node;}else if(node!=''){nodepath+=node;}this.ewSync(xmlData[i],i,nodepath)}else{var nIndex=nodepath.split(".")[0];if(typeof(nIndex)!='undefined'){if(typeof(this.SC_CompanionArray[nIndex])=='undefined'){this.SC_CompanionArray[nIndex]=new Object();}this.SC_CompanionArray[nIndex][nodepath+"."+node+"."+i]=xmlData[i];}}}if(typeof(bFirstCall)!='undefined'){this.displayCompanion();}};this.checkDomElement=function(sId){if(document.getElementById(sId)!=null){return true;}else{return false;}};this.displayCompanion=function(){for(var i=0;i<this.SC_CompanionArray.length;i++){var nHeight=0;var nWidth=0;var sType="";var sSrc="";var sClickUrl="";for(var j in this.SC_CompanionArray[i]){if(j.indexOf("height")>0){nHeight=this.SC_CompanionArray[i][j];}else if(j.indexOf("width")>0){nWidth=this.SC_CompanionArray[i][j];}else if(j.indexOf("IFrameResource")>0||this.SC_CompanionArray[i][j].toLowerCase()=="iframe"){nType="iframe";}else if(j.indexOf("StaticResource")>0||this.SC_CompanionArray[i][j].toLowerCase()=="static"){nType="static";}else if(j.indexOf("HTMLResource")>0||this.SC_CompanionArray[i][j].toLowerCase()=="html"){nType="html";}else if(j.indexOf("ScriptResource")>0||this.SC_CompanionArray[i][j].toLowerCase()=="script"){nType="script";}else if(j.indexOf("CompanionClickThrough")>0){sClickUrl=this.SC_CompanionArray[i][j];}if(j.indexOf("Resource.text")>0||j.indexOf("URL.text")>0||j.indexOf("Code.text")>0){sSrc=this.SC_CompanionArray[i][j];}}if(this.checkDomElement("sc_companion_"+nWidth+"x"+nHeight+"_"+nType)){if(nType=="iframe")this.displayIFrame("sc_companion_"+nWidth+"x"+nHeight+"_"+nType,nHeight,nWidth,sSrc);if(nType=="static")this.displayStaticResource("sc_companion_"+nWidth+"x"+nHeight+"_"+nType,nHeight,nWidth,sSrc,sClickUrl);if(nType=="script")this.displayScriptResource("sc_companion_"+nWidth+"x"+nHeight+"_"+nType,sSrc);if(nType=="html")this.displayHTMLResource("sc_companion_"+nWidth+"x"+nHeight+"_"+nType,sSrc);}else{try{if(typeof(SC_CompAdIds)!='undefined'){var aCompIds=SC_CompAdIds.split(",");for(var nIdCounter=0;nIdCounter<aCompIds.length;nIdCounter++){var aCompId=aCompIds[nIdCounter].split("::");if(this.checkDomElement(aCompId[0])&&aCompId[1]==nWidth+"x"+nHeight&&nType=="iframe"){this.displayIFrame(aCompId[0],nHeight,nWidth,sSrc);}}}}catch(ex){;}}}};this.displayHTMLResource=function(sId,sSrc){document.getElementById(sId).innerHTML=sSrc;};this.displayScriptResource=function(sId,sSrc){if(sSrc.indexOf("alenty.com")>0){SC_AlConfUrl=sSrc;}else{oElement=document.getElementById(sId);oScript=document.createElement("script");oScript.type="text/javascript";oScript.src=sSrc;oElement.appendChild(oScript);}};this.displayStaticResource=function(sId,nHeight,nWidth,sSrc,sClickUrl){oElement=document.getElementById(sId);oAnker=document.createElement("a");oAnker.target="_blank";oAnker.href=sClickUrl;oImage=document.createElement("img");oImage.width=nWidth;oImage.height=nHeight;oImage.src=sSrc;oImage.style.cssText="border:none";oAnker.appendChild(oImage);oElement.appendChild(oAnker);};this.showFrameContents=function(sId,nWidth,nHeight){document.getElementById(sId+"_smcframe").height=nHeight;document.getElementById(sId+"_smcframe").width=nWidth;document.getElementById(sId).height=nHeight;document.getElementById(sId).width=nWidth;return true;};this.displayIFrame=function(sId,nHeight,nWidth,sSrc){oElement=document.getElementById(sId);if(document.getElementById(sId+"_smcframe")==null){sFrame="<ifr"+"ame frameborder=0 scrolling='no' onload='showFrameContents(\""+sId+"\","+nWidth+","+nHeight+")' id='"+sId+"_smcframe"+"' style=\"border:none;margin:0px;\" height=\"1\" width=\"1\" src='"+sSrc+"'><\/ifr"+"ame>";oElement.innerHTML=sFrame;}};this.getTrackableObjectId=function(){return this.objectId;};this.setDimension=function(_width,_height){this.debug('- setDimension('+_width+', '+_height+')');this.adWidth=_width;this.adHeight=_height;return this;};this.setColorSet=function(_colorSet){this.debug('- setColorSet('+_colorSet+')');this.colorSet=_colorSet;return this;};this.setPosLeft=function(_offSetLeft){this.debug("- setPosLeft("+_offSetLeft+")");this.offSetLeft=_offSetLeft;return this;};this.setBorderWidth=function(_width){this.debug('- setBorderWidth('+_width+')');this.borderWidth=_width;return this;};this.setTimeText=function(_text){this.debug('- setTimeText('+_text+')');this.timeText=_text;return this;};this.setHeaderText=function(_text){this.debug('- setHeaderText('+_text+')');this.headerText=_text;return this;};this.setHeaderTextColor=function(_color){this.debug('- setHeaderTextColor('+_color+')');this.headerTextColor=_color;return this;};this.setCloseText=function(_text){this.debug('- setCloseText('+_text+')');this.closeText=_text;return this;};this.setCloseDelay=function(_delay){this.debug('- setCloseDelay('+_delay+')');this.closeDelay=_delay;return this;};this.setOnStartCallback=function(_onStartCallback){this.debug('- setOnStartCallback('+typeof(_onStartCallback)+')');this.onStartCallback=_onStartCallback;return this;};this.setOnEndCallback=function(_onEndCallback){this.debug('- setOnEndCallback('+typeof(_onEndCallback)+')');this.onEndCallback=_onEndCallback;return this;};this.setPolite=function(_polite){this.debug('- setPolite('+_polite+')');this.polite=_polite;return this;};this.setZIndex=function(_zIndex){this.debug('- setZIndex('+_zIndex+')');this.zIndex=new String(_zIndex);if(this.zIndex==null|| !this.zIndex.match(/^[1-9][0-9]*$/)){this.zIndex=10000;this.debug('- Redefining z-index '+_zIndex+' with '+this.zIndex+'.');}return this;};this.setBackgroundColor=function(_color){this.debug('- setBackgroundColor('+_color+')');this.backgroundColor=_color;if(this.backgroundColor==null||typeof(this.backgroundColor.match)=='undefined'|| !this.backgroundColor.match(/^[A-Fa-f0-9]{6}$/)){this.backgroundColor='000000';this.debug('- Redefining invalid color '+_color+' with '+this.backgroundColor+'.');}return this;};this.setAudioVolume=function(_volume){this.debug('- setAudioVolume('+_volume+')');this.audioVolume=_volume;if(isNaN(this.audioVolume)){this.audioVolume=100;this.debug('- redefining invalid volume '+_volume+' with '+this.audioVolume);}return this;};this.setOpacity=function(_opacity){this.debug('- setOpacity('+_opacity+')');this.opacity=_opacity;if(isNaN(this.opacity)||this.opacity<0.0||this.opacity>1.0){this.opacity=0.8;this.debug('- Redefining invalid opacity '+_opacity+' with '+this.opacity);}return this;};this.setVideoAdUrl=function(_url){this.debug('- setVideoAdUrl('+_url+')');var sRef=this.getReferer();var aDfpTagElems=_url.split("/");this.videoAdUrl=_url;this.videoAdUrl=this.videoAdUrl.replace("ord=","dt1="+encodeURIComponent(encodeURIComponent(encodeURIComponent(encodeURIComponent(sRef))))+";ord=");try{var sSitename = aDfpTagElems[4];this.curSiteZone = sSitename + "/" + aDfpTagElems[5].split(";")[0];}catch(ex){;}return this;};this.setVideoAdXML=function(_xml){this.debug('- setVideoAdXML('+_xml+')');this.videoAdXML=_xml;return this;};this.setMiniPlayerUrl=function(_miniPlayerUrl){this.debug('- setMiniPlayerUrl('+_miniPlayerUrl+')');if(_miniPlayerUrl!=null)this.miniPlayerUrl=_miniPlayerUrl;return this;};this.setOnStartTrackerUrl=function(_trackerUrl){this.debug('- setOnStartTrackerUrl('+_trackerUrl+')');this.onStartTrackerUrl=_trackerUrl;return this;};this.getDimension=function(){this.debug('- getDimension()');var oDimension=new Object();oDimension.width=this.adWidth;oDimension.height=this.adHeight;return oDimension;};this.disableFlashHiding=function(){this.flashHiding=false;return this;};this.init=function(){this.debug('- init(polite = '+this.polite+')');var onLoad=false;var onResize=this.addEvent(window,"resize",SC_onResize);var onScroll=this.addEvent(window,"scroll",SC_onResize);var flashVer=this.getFlashVersion();if(!onResize|| !onScroll||flashVer<9|| !this.detectBrowser()){this.removeEvent(window,"resize",SC_onResize);this.removeEvent(window,"scroll",SC_onResize);this.fireErrorTracker(this.curSiteZone,11);this.endAd();}else if(this.polite){onLoad=this.addEvent(window,"load",SC_onLoad);if(!onLoad){this.removeEvent(window,"load",SC_onLoad);this.removeEvent(window,"resize",SC_onResize);this.removeEvent(window,"scroll",SC_onResize);this.fireErrorTracker(this.curSiteZone,12);this.endAd();}}else{this.initLayers();}};this.loadAd=function(){this.debug('- loadAd('+this.videoAdUrl+', '+this.adWidth+', '+this.adHeight+')');if(this.videoAdUrl!=null){this.player.loadVideoAdFromUrl(this.videoAdUrl,this.audioVolume);}else{this.player.loadVideoAdFromXML(this.videoAdXML,this.audioVolume);}};this.startingAd=function(_width,_height){this.debug('- startingAd(P['+this.adWidth+','+this.adHeight+'], V['+_width+','+_height+'])');this.adisavailable=true;this.onResize();if(this.flashHiding){this.hideObjectsAndEmbeds();}this.layer.style.visibility='visible';this.makeTransparent(this.playerLayer,1.0);if(this.onStartTrackerUrl!=null){try{oImage=document.createElement("img");oImage.width=0;oImage.height=0;oImage.src=this.onStartTrackerUrl;oImage.style.cssText="border:none";this.layer.appendChild(oImage);}catch(e){this.fireErrorTracker(this.curSiteZone,13);this.debug('Couldn\'t fire on Start Imptracker - '+e);}}if(this.onStartCallback!=null){try{this.onStartCallback();if(typeof(SC_trackEvent)!="undefined"){SC_trackEvent("clip_start")}}catch(e){this.fireErrorTracker(this.curSiteZone,14);this.debug('Couldnt call on start callback function - '+e);}}};this.hideObjectsAndEmbeds=function(){if(typeof(document.getElementsByTagName)!='undefined'&&document.getElementsByTagName!=null){var tags=['object','embed'];for(var j=0;j<tags.length;j++){var objects=document.getElementsByTagName(tags[j]);for(var i=0;i<objects.length;i++){if(objects[i].getAttribute('id')!=this.objectId){objects[i].setAttribute('sc_ov',objects[i].style.visibility==null?'visible':objects[i].style.visibility);objects[i].style.visibility='hidden';}}}}};this.endAd=function(){this.debug('- endAd()');if(this.layer!=null){this.layer.style.visibility='hidden';}if(this.playerLayer!=null){this.playerLayer.style.visibility='hidden';}if(this.flashHiding){this.showObjectsAndEmbeds();}if(this.onEndCallback!=null){try{this.onEndCallback();if(typeof(SC_trackEvent)!="undefined"){SC_trackEvent("clip_stop")}}catch(e){this.fireErrorTracker(this.curSiteZone,15);this.debug('Couldn\'t call on end callback function');}}};this.showObjectsAndEmbeds=function(){if(typeof(document.getElementsByTagName)!='undefined'&&document.getElementsByTagName!=null){var tags=['object','embed'];for(var j=0;j<tags.length;j++){var objects=document.getElementsByTagName(tags[j]);for(var i=0;i<objects.length;i++){var ov=objects[i].getAttribute('sc_ov');if(ov!=null){objects[i].style.visibility=ov;}}}}};this.stopAd=function(){this.debug('- stopAd()');this.player.stopVideoAd();};this.onResize=function(){this.debug('- onResize()');if((this.layer!=null&&this.playerLayer!=null)&&this.adisavailable==true){var scroll=this.getScrolling();var viewport=this.getViewport();var popWidth=viewport[0];if(popWidth<scroll[2]){popWidth=scroll[2];}var popHeight=viewport[1];if(popHeight<scroll[3]){popHeight=scroll[3];}this.layer.style.height=popHeight+"px";this.layer.style.width=popWidth+"px";this.playerLayer.style.width=this.adWidth+2*this.borderWidth+"px";this.playerLayer.style.height=this.adHeight+2*this.borderWidth+this.controlHeight+"px";if(this.offSetLeft!=0){this.playerLayer.style.left=this.offSetLeft+"px";}else{this.playerLayer.style.left=Math.round(scroll[0]+(viewport[0]-this.adWidth-2*this.borderWidth)/2)+"px";}this.playerLayer.style.top=Math.round(scroll[1]+(viewport[1]-this.adHeight-2*this.borderWidth-this.controlHeight)/2)+"px";}};this.addEvent=function(_obj,_event,_func){if(_obj.addEventListener){_obj.addEventListener(_event,_func,false);return true;}else if(_obj.attachEvent){return _obj.attachEvent("on"+_event,_func);}return false;};this.removeEvent=function(_obj,_event,_func){if(typeof(_obj.removeEventListener)!='undefined'){_obj.removeEventListener(_event,_func,false);return true;}else if(typeof(_obj.detachEvent)!='undefined'){return _obj.detachEvent("on"+_event,_func);}return false;};this.getViewport=function(){if(window.innerHeight!=window.undefined){return[window.innerWidth-15,window.innerHeight-15];}else if(document.compatMode=='CSS1Compat'){return[document.documentElement.clientWidth-15,document.documentElement.clientHeight-15];}else if(document.body){return[document.body.clientWidth-15,document.body.clientHeight-15];}return false;};this.makeTransparent=function(_obj,_value){if(this.browser=='IE'){_obj.style.filter='alpha(opacity='+(_value*100)+')';}else{_obj.style.opacity=_value;}};this.getScrolling=function(){if(document.compatMode=='CSS1Compat'){return[document.documentElement.scrollLeft,document.documentElement.scrollTop,document.documentElement.scrollWidth,document.documentElement.scrollHeight];}else{return[document.body.scrollLeft,document.body.scrollTop,document.body.scrollWidth,document.body.scrollHeight];}};this.initLayers=function(){this.debug('- initLayers()');if(this.browser=='IE'){this.player=document.createElement('<object id="'+this.objectId+'" classid="clsid:'+this.flashClassId+'" codebase="'+this.protocol+'//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="100%" height="'+(this.adHeight+this.borderWidth+this.controlHeight)+'" type="application/x-shockwave-flash">');}else{this.player=document.createElement('object');this.player.setAttribute('id',this.objectId);this.player.setAttribute('width','100%');this.player.setAttribute('height',this.adHeight+this.borderWidth+this.controlHeight);this.player.setAttribute('type','application/x-shockwave-flash');this.player.setAttribute('data',this.miniPlayerUrl);}this.player.appendChild(this.createParam('movie',this.miniPlayerUrl));this.player.appendChild(this.createParam('menu','false'));this.player.appendChild(this.createParam('scale','noscale'));this.player.appendChild(this.createParam('wmode','window'));this.player.appendChild(this.createParam('bgcolor','#'+this.backgroundColor));this.player.appendChild(this.createParam('allowScriptAccess','always'));this.player.appendChild(this.createParam('FlashVars','adWidth='+this.adWidth+'&adHeight='+this.adHeight+'&format='+'interstitial'+'&audioVolume='+this.audioVolume+'&frameThickness='+this.borderWidth+'&closeText='+this.closeText+'&closeButtonDelay='+this.closeDelay+'&frameTextColor='+this.headerTextColor+'&frameText='+this.headerText+'&colorSet='+this.colorSet+'&timeText='+this.timeText));if(this.browser=='IE'){if(this.IsIE8Browser()){this.layer=document.createElement('<div style="position:absolute; z-index:'+this.zIndex+'; top:0px; left:0px; width:100%; height:100%; filter:alpha(opacity='+(this.opacity*100)+'); background-color:transparent; visibility:hidden;">');}else{this.layer=document.createElement('<div style="position:absolute; z-index:'+this.zIndex+'; top:0px; left:0px; width:100%; height:100%; filter:alpha(opacity='+(this.opacity*100)+'); background-color:#'+this.backgroundColor+'; visibility:hidden;">');}this.playerLayer=document.createElement('<div style="filter:alpha(opacity=1); position:absolute; z-index:'+(this.zIndex+1)+'; left:-1000px; top:0px; width:'+this.adWidth+'px; height:'+this.adHeight+'px; padding:0px 0px;">');}else{this.layer=document.createElement('div');this.layer.setAttribute('style','position:absolute; z-index:'+this.zIndex+'; top:0px; left:0px; width:100%; height:100%; opacity:'+this.opacity+'; background-color:#'+this.backgroundColor+'; visibility:hidden;');this.playerLayer=document.createElement('div');this.playerLayer.setAttribute('style','opacity:0.01; position:absolute; z-index:'+(this.zIndex+1)+'; left:-1000px; top:0px; width:'+this.adWidth+'px; height:'+this.adHeight+'px; padding:0px 0px;">');}this.layerframe=document.createElement("iframe");this.layerframe.setAttribute("marginwidth","0");this.layerframe.setAttribute("marginheight","0");this.layerframe.setAttribute("hspace","0");this.layerframe.setAttribute("vspace","0");this.layerframe.setAttribute("frameborder","0");this.layerframe.setAttribute("scrolling","no");this.layerframe.setAttribute("src","about:blank");this.layerframe.style.cssText="z-index:-1;position:absolute;width:100%;height:100%;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);";this.playerLayer.appendChild(this.layerframe);this.playerLayer.appendChild(this.player);document.body.insertBefore(this.playerLayer,document.body.firstChild);document.body.insertBefore(this.layer,document.body.firstChild);return true;};this.detectBrowser=function(){var agent=navigator.userAgent;if(agent.match(/Firefox.(\d.\d)/i)!=null){this.browser='FIREFOX';return true;}else if(agent.match(/MSIE.(\d.\d)/i)!=null){this.browser='IE';return true;}else if(agent.match(/Opera.(\d.\d)/i)!=null){this.browser='OPERA';return true;}else if(agent.match(/Safari.(\d)/i)!=null){this.browser='SAFARI';return true;}return false;};this.IsIE8Browser=function(){var rv= -1;var ua=navigator.userAgent;var re=new RegExp("Trident\/([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null){rv=parseFloat(RegExp.$1);}return(rv==4);};this.createParam=function(_name,_value){var param=null;if(this.browser=='IE'){param=document.createElement('<param name="'+_name+'" value="'+_value+'">');}else{param=document.createElement('param');param.setAttribute('name',_name);param.setAttribute('value',_value);}return param;};this.getFlashVersion=function(){var isIE=(navigator.appVersion.indexOf("MSIE")!= -1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!= -1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!= -1)?true:false;var descr=null;var versions=null;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){descr=navigator.plugins["Shockwave Flash"+(navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"")].description.split(" ");versions=descr[2].split(".");return versions[0];}}else if(isIE&&isWin&& !isOpera){try{versions=(new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")).GetVariable("$version").split(",");return versions[0].substr(4);}catch(exception){}}return 7;};this.fireErrorTracker=function(sZone,nCode){var rnd=Math.floor(Math.random()*1000000);var oImage=document.createElement("img");oImage.width=0;oImage.height=0;oImage.src=this.protocol+"//ad-emea.doubleclick.net/ad/error.eu.smartclip/"+sZone+";u=scerr="+nCode+";sz=1x1;ord="+rnd+"?";oImage.style.cssText="border:none";document.body.appendChild(oImage);};this.getReferer=function(){try{var ref=top.location.href;}catch(e){var ref=document.referrer;}return ref;};this.debug=function(_message){if(this.debugLayer!=null){if(this.debugLayer.innerHTML==''){this.debugLayer.innerHTML=_message;}else{this.debugLayer.innerHTML=this.debugLayer.innerHTML+'<br>'+_message.replace('\n','<br>');}}};this.debug('SC_Interstitial()');};function SC_onLoad(){SC_Interstitial().debug('\nSC_onLoad()');SC_Interstitial().initLayers();};function SC_initDone(){SC_Interstitial().debug('\nSC_initDone()');SC_Interstitial().loadAd();};function SC_startingVideoAd(_width,_height){SC_Interstitial().debug('\nSC_startingVideoAd()');SC_Interstitial().startingAd(_width,_height);};function SC_onResize(){SC_Interstitial().debug('\nSC_onResize()');SC_Interstitial().onResize();};function SC_endVideoAd(){SC_Interstitial().debug('\nSC_endVideoAd()');SC_Interstitial().endAd();};function SC_stopVideoAd(){SC_Interstitial().debug('\nSC_stopVideoAd()');SC_Interstitial().stopAd();};function showFrameContents(sId,nWidth,nHeight){SC_Interstitial().showFrameContents(sId,nWidth,nHeight);};if(typeof(ewSync)=='undefined'){document.write('<scr'+'ipt type="text/javascript">function ewSync(xmlData, node, nodepath){SC_Interstitial().ewSync(xmlData, node, nodepath);}<\/scr'+'ipt>');document.write('<di'+'v id="sc_companion_2x2_script"><\/di'+'v>');document.write('<di'+'v id="sc_companion_2x3_script"><\/di'+'v>');document.write('<di'+'v id="sc_companion_2x4_script"><\/di'+'v>');}
