function SC_InPage(){if(SC_InPage.singleton==null){SC_InPage.singleton=new SC_InPageClass();}return SC_InPage.singleton;};function SC_InPageClass(){this.debugLayer=document.getElementById('SC_DEBUGLAYER');this.browser='UNKNOWN';this.version=0.0;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/inpage/';this.miniPlayerUrl=this.cdnBase+'inpage.swf';this.backgroundColor='000000';this.audioVolume=100;this.curSiteZone=null;this.videoAdUrl=null;this.videoAdXML=null;this.player=null;this.layer=null;this.adWidth=640;this.adHeight=480;this.autoStart=true;this.onStartCallback=null;this.onEndCallback=null;this.headerText='Weiter geht es nach einem kurzen Werbespot';this.headerTextColor='FFFFFF';this.closeText='';this.closeDelay=null;this.borderWidth=12;this.controlHeight=30;this.colorSet=0;this.timeText='Sekunden';this.messages=[];this.elementId=null;this.onCappedAdCall=null;this.onCappedCallback=null;this.onStartTrackerUrl=null;this.onEndFired=false;this.onCappedFired=false;this.fallbackAdUrl=null;this.fallbackAdWidth=0;this.fallbackAdHeight=0;this.hasStarted=false;this.SC_CompanionArray=new Array();this.objectId="SC_InPagePlayer";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.setElementId=function(_elementId){this.elementId=_elementId;return this;};this.setDimension=function(_width,_height){this.debug('- setDimension('+_width+', '+_height+')');this.adWidth=_width;this.adHeight=_height;return this;};this.getDimension=function(){this.debug('- getDimension()');var oDimension=new Object();oDimension.width=this.adWidth;oDimension.height=this.adHeight;return oDimension;};this.setColorSet=function(_colorSet){this.debug('- setColorSet('+_colorSet+')');this.colorSet=_colorSet;return this;};this.setBorderColor=function(_borderColor){this.debug(' - setBorderColor('+_borderColor+')');this.borderColor=_borderColor;return this;};this.setNaviColor=function(_naviColor){this.debug(' - setNaviColor('+_naviColor+')');this.naviColor=_naviColor;return this;};this.setBarColor=function(_barColor){this.debug(' - setBarColor('+_barColor+')');this.barColor=_barColor;return this;};this.setFontStyle=function(_fontStyle){this.debug(' - setFontStyle('+_fontStyle+')');this.fontStyle=_fontStyle;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.setAutoStart=function(_autoStart){this.debug('- setAutoStart('+_autoStart+')');this.autoStart=_autoStart;return this;};this.setOnStartTrackerUrl=function(_trackerUrl){this.debug('- setOnStartTrackerUrl('+_trackerUrl+')');this.onStartTrackerUrl=_trackerUrl;return this;};this.setMiniPlayerUrl=function(_miniPlayerUrl){this.debug('- setMiniPlayerUrl('+_miniPlayerUrl+')');if(_miniPlayerUrl!=null)this.miniPlayerUrl=_miniPlayerUrl;return this;};this.setFallbackAd=function(_width,_height,_adUrl){this.debug('- setFallbackAd('+_width+', '+_height+', '+_adUrl+')');if(_adUrl!=null){document.write("<ifr"+"ame id='SC_InpageFallback_"+this.rnd+"' name='SC_InpageFallback_"+this.rnd+"' src='about:blank' framespacing='0' frameborder='no' scrolling='no' width='0' height='0'><\/ifr"+"ame>");this.fallbackAdWidth=_width;this.fallbackAdHeight=_height;this.fallbackAdUrl=_adUrl;}return this;};this.loadFallbackAd=function(){this.debug('- loadFallbackAd()');if(this.fallbackAdUrl!=null){var oFallbackAd=document.getElementById("SC_InpageFallback_"+this.rnd);if(oFallbackAd.src=="about:blank"){oFallbackAd.height=this.fallbackAdHeight;oFallbackAd.width=this.fallbackAdWidth;oFallbackAd.src=this.fallbackAdUrl;}return "";}return this;};this.setDimension=function(_width,_height){this.debug('- setDimension('+_width+', '+_height+')');this.adWidth=_width;this.adHeight=_height;return this;};this.isAutoStart=function(){return this.autoStart;};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.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.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.setOnCappedAdCall=function(_onCappedAdCall){this.debug('- setOnCappedAdCall('+_onCappedAdCall+')');this.onCappedAdCall=_onCappedAdCall;return this;};this.setOnCappedCallback=function(_onCappedCallback){this.debug('- setOnCappedCallback('+typeof(_onCappedCallback)+')');this.onCappedCallback=_onCappedCallback;return this;};this.init=function(){this.debug('- init('+this.autoStart+')');var flashVer=this.getFlashVersion();if(flashVer>=9&&this.detectBrowser()){this.write();}else{this.fireErrorTracker(this.curSiteZone,1);this.endAd();}};this.run=function(_videoAdUrl){try{if(_videoAdUrl!=null){this.videoAdUrl=_videoAdUrl;}this.debug('- run('+this.videoAdUrl+')');this.player=document.getElementById(this.objectId);this.layer=document.getElementById('SC_InPageLayer');if(this.player!=null&&this.layer!=null){if(this.videoAdUrl!=null){this.player.loadVideoAdFromUrl(this.videoAdUrl,this.audioVolume,this.adWidth,this.adHeight);}else{this.player.loadVideoAdFromXML(this.videoAdXML,this.audioVolume,this.adWidth,this.adHeight);}}else{this.fireErrorTracker(this.curSiteZone,4);}}catch(e){this.fireErrorTracker(this.curSiteZone,2);}};this.startingAd=function(_width,_height,_seconds){this.debug('- startingAd('+this.adWidth+','+this.adHeight+','+_seconds+')');this.adWidth=_width;this.adHeight=_height;this.hasStarted=true;this.layer.style.width=this.adWidth+"px";this.layer.style.height=this.adHeight+"px";this.player.style.width=this.adWidth+"px";this.player.style.height=this.adHeight+"px";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,5);this.debug('Couldn\'t fire on Start Imptracker - '+e);}}if(this.onStartCallback!=null){try{this.onStartCallback(_seconds);if(typeof(SC_trackEvent)!="undefined"){SC_trackEvent("clip_start")}}catch(e){this.fireErrorTracker(this.curSiteZone,6);this.debug('Couldn\'t call on start callback function - '+e);}}};this.endAd=function(_success){if(this.onEndFired==false){this.onEndFired=true;this.debug('- endAd('+_success+')');if(this.layer!=null){this.layer.style.display='none';}if(this.onEndCallback!=null){try{this.onEndCallback(_success);if(typeof(SC_trackEvent)!="undefined"){SC_trackEvent("clip_stop")}}catch(e){this.fireErrorTracker(this.curSiteZone,7);this.debug('Couldn\'t call on end callback function');}}if(this.hasStarted==false){this.loadFallbackAd();SC_onCapped();}}};this.stopAd=function(){this.debug('- stopAd()');this.player.stopVideoAd();};this.write=function(){var html='<div id="SC_InPageLayer" style="overflow:hidden;background-color:#'+this.backgroundColor+';width:1px;height:1px; padding:0px;">'+this.getPlayer()+'</div>';if(this.elementId!=null){var element=document.getElementById(this.elementId);if(element!=null){element.innerHTML=html;}}else{document.write(html);}};this.getOpacityCSS=function(_value){if(this.browser=='IE'){return 'filter: alpha(opacity='+(_value*100)+')';}return 'opacity:'+_value;};this.getPlayer=function(){var player='';var closeDelay=9999;if(this.closeDelay!=null){closeDelay=this.closeDelay;}if(this.browser=='IE'){player='<object id="'+this.objectId+'" classid="clsid:'+this.flashClassId+'" codebase="'+this.protocol+'//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="'+this.adWidth+'" height="'+this.adHeight+'" type="application/x-shockwave-flash">';player+=this.getParam('movie',this.miniPlayerUrl);}else if(this.browser!='FIREFOX' && this.browser != 'Firefox'){player='<object id="'+this.objectId+'" width="'+this.adWidth+'" height="'+this.adHeight+'" type="application/x-shockwave-flash">';player+=this.getParam('movie',this.miniPlayerUrl);}else{player='<object id="'+this.objectId+'" width="'+this.adWidth+'" height="'+this.adHeight+'" type="application/x-shockwave-flash" data="'+this.miniPlayerUrl+'">';}player+=this.getParam('menu','false');player+=this.getParam('scale','noscale');player+=this.getParam('wmode','transparent');player+=this.getParam('bgcolor','#'+this.backgroundColor);player+=this.getParam('allowScriptAccess','always');player+=this.getParam('FlashVars','adWidth='+this.adWidth+'&adHeight='+this.adHeight+'&format='+'inpage'+'&audioVolume='+this.audioVolume+'&frameThickness='+this.borderWidth+'&closeText='+this.closeText+'&frameTextColor='+this.headerTextColor+'&frameText='+this.headerText+'&colorSet='+this.colorSet+'&timeText='+this.timeText+'&closeButtonDelay='+this.closeDelay+'&onCappedAdCall='+this.onCappedAdCall+'&borderColor='+this.borderColor+'&naviColor='+this.naviColor+'&barColor='+this.barColor+'&fontStyle='+this.fontStyle);player+='</object>';return player;};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(/Firefox\/.(\d.\d)/i) != null) {this.browser = 'Firefox';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;} else if (agent.match(/Chrome.(\d)/i) != null) {this.browser = 'FIREFOX';return true;}return false;};this.getParam=function(_name,_value){return '<param name="'+_name+'" value="'+_value+'"></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){this.messages[this.messages.length]=_message;};this.writeDebug=function(){if(this.debugLayer!=null){this.debugLayer.innerHTML=this.messages.join("<br>");}};this.debug('SC_InPage()');window.setTimeout(function(){SC_InPage().writeDebug();},15000);};function SC_initDone(){SC_InPage().debug('\nSC_initDone()');if(SC_InPage().isAutoStart()){SC_InPage().run();}};function SC_startingVideoAd(_width,_height,_seconds){SC_InPage().debug('\nSC_startingVideoAd()');SC_InPage().startingAd(_width,_height,_seconds);};function SC_endVideoAd(_success){SC_InPage().debug('\nSC_endVideoAd()');SC_InPage().endAd(_success);};function SC_onCapped(_adCall){if(SC_InPage().onCappedFired==false){SC_InPage().onCappedFired=true;SC_InPage().debug('\nSC_onCapped()');if(SC_InPage().onCappedCallback!=null){try{SC_InPage().onCappedCallback(_adCall);}catch(e){this.fireErrorTracker(this.curSiteZone,9);this.debug('Couldn\'t call on capped callback function - '+e);}}SC_InPage().loadFallbackAd();}};function SC_stopVideoAd(){SC_InPage().debug('\nSC_stopVideoAd()');SC_InPage().stopAd();};function truncateIframe(sId){if(document.getElementById(sId)!=null){document.getElementById(sId).innerHTML="";}};function showFrameContents(sId,nWidth,nHeight){SC_InPage().showFrameContents(sId,nWidth,nHeight);};if(typeof(ewSync)=='undefined'){document.write('<scr'+'ipt type="text/javascript">function ewSync(xmlData, node, nodepath){SC_InPage().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>');}
