function ebCTemplateFloatingAd(objName){this.temp=ebCTemplateBase;this.temp();delete this.temp;var strResName="ebFloatingAd_";var strDivName="ebEyeContainer_";this.objName=objName;this.introRes=null;this.fIntroImgLoaded=false;this.fAdOn=false;this.introPosition=null;this.introPosParams=null;this.objToPosition=null;this.addResources=addResources;this.resourcesReady=resourcesReady;this.show=show;this.close=close;this.autoClose=autoClose;this.fullPlay=fullPlay;this.getResOrigSize=getResOrigSize;this.showIntro=showIntro;this.playIntroFlash=playIntroFlash;this.hideIntro=hideIntro;this.noMovement=noMovement;this.moveOnly=moveOnly;this.movePause=movePause;this.movePause2=movePause2;this.movePauseMove=movePauseMove;this.movePauseMove2=movePauseMove2;this.movePauseMove3=movePauseMove3;this.doOnResize=doOnResize;this.doOnScroll=doOnScroll;this.imgLoaded=imgLoaded;this.doOnUnload=close;this.ebshowHandler=ebReplayHandler;this.ebreplayHandler=ebReplayHandler;this.ebautoreplayHandler=ebAutoReplayHandler;this.ebkeepadopenHandler=ebkeepadopenHandler;function addResources(){gEbDbg.always("Template: Load Floating Ad resources");switch(this.ad.nContentType){case 1:addFlashRes(this);break;case 2:addImageRes(this);break;}}function resourcesReady(){try{gEbDbg.debug("Template: FloatingAd -> resourcesReady");var strName=this.myName(strResName);if(this.introRes==null){this.introRes=this.adTI.doc.getElementById(strName);if(this.introRes==null){gEbDbg.debug("resourcesReady() : Can't find resource "+strName);return (0);}}var fFullyLoaded=false;switch(this.ad.nContentType){case 1:fFullyLoaded=this.flashResReady(this.introRes,this.ad.nWeight,this.ad.streaming);break;case 2:fFullyLoaded=this.fIntroImgLoaded;break;}if(!fFullyLoaded){gEbDbg.debug("resourcesReady() : Resource " + strName + " is not fully loaded");return (0);}return (1);}catch(e){gEbDbg.error("resourcesReady: "+e.description);}}function show(){gEbDbg.always("Template: Show Floating ad");this.fAdOn=true;if(this.introPosition==null)this.introPosition=new ebCPosition(this.objName+".introPosition",this.adTI);if(this.introPosParams==null){var posParams=new ebCPosParams();posParams.nType=this.ad.fAbsPos;posParams.nWidthScale=this.ad.nWidthScale;posParams.nScaleRef=this.ad.fResizable;posParams.nResWidth=this.ad.nWidth;posParams.nResHeight=this.ad.nHeight;posParams.fCenteredPage=this.ad.fCentered;posParams.nPageWidth=this.ad.nPageWidth;posParams.nRightAlignement=this.adData.nRightAlignment;posParams.fLimitVerSize=this.ad.fLimitVerSize;if(this.ad.nPosType==2){posParams.strRefObj=this.ad.strRefName;posParams.nRefCorner=this.ad.nRefCorner;posParams.refObj=this.relativeObjRef;}this.introPosParams=posParams;}this.showIntro();}function showIntro(){this.adData.customEventHandler.onBeforeIntroShow(this.objName);gEbDbg.attention("Template: Play (start the movement if needed for) floating ad");switch(this.ad.nMoveType){case 1:gEbDbg.info("Play floating ad with no Movement");this.noMovement();if(!this.ad.fScrollWithPage)this.initPosition=this.buildAdElemAttr(this.introPosition);break;case 2:gEbDbg.info("Play floating ad with move only");this.moveOnly();break;case 3:gEbDbg.info("Play floating ad with move stop");this.movePause();break;case 4:gEbDbg.info("Play floating ad with move pause move");this.movePauseMove();break;}if(this.ad.nContentType==1){var strFunc=this.objName+".playIntroFlash()";window.setTimeout(strFunc,50);}if(!this.fHideElements){this.hidePageElements(this.adTI.win,this.initPosition);this.fHideElements=true;}this.adData.customEventHandler.onAfterIntroShow(this.objName);}function playIntroFlash(){var nFlashVer=gEbClientInfo.pluginInfo.flFlashVer;this.introRes.LoadMovie(0,this.ad.strFlashMov);if(nFlashVer>=6)this.setRandFlashVar(this.introRes);this.introRes.Play();}function close(){this.adData.customEventHandler.onBeforeAdClose(this.objName);gEbDbg.delimiter("==========================Close the Eyeblaster===========================",1);this.hideIntro();if(this.fHideElements){this.showPageElements(this.adTI.win,this.initPosition);this.fHideElements=false;}this.collectTimers(true);gEbDbg.delimiter("=========================The Eyeblaster was closed========================",1);this.adData.customEventHandler.onAfterAdClose(this.objName);}function hideIntro(){try{this.introPosition.clear();gEbDbg.always("Closing ad id " + this.adData.nAdID + " (index: " + this.adData.nIndex + ")");var introRes=this.introRes;if(introRes==null)return;this.adData.customEventHandler.onBeforeIntroHide(this.objName);this.closeResWMP(introRes);introRes.style.width="0px";introRes.style.height="0px";this.fAdOn=false;if(this.ad.nContentType==1){introRes.StopPlay();introRes.LoadMovie(0,"about:blank");}if(typeof(gEbSyncAdsRes)!="undefined"){var adIdentifier=this.objName;gEbSyncAdsRes.clear(introRes,adIdentifier,this.adData.nCampaignID);}this.adData.customEventHandler.onAfterIntroHide(this.objName);}catch(e){gEbDbg.error("Exception in hideIntro: "+e.description);}}function imgLoaded(){if(this.fIntroImgLoaded)return;gEbDbg.info("Resource for FloatingAd (" + this.adData.nAdID + ") was loaded");this.fIntroImgLoaded=true;}function noMovement(){var posParams=this.introPosParams;posParams.nStartX=this.nIntroRefLeft+this.ad.nX0;posParams.nStartY=this.nIntroRefTop+this.ad.nY0;posParams.nEndX=this.nIntroRefLeft+this.ad.nX0;posParams.nEndY=this.nIntroRefTop+this.ad.nY0;posParams.nTime=this.ad.nStopInterval*1000;var strCB=this.objName+".fullPlay()";this.introPosition.set(posParams,null,this.objToPosition,strCB);}function moveOnly(){var posParams=this.introPosParams;posParams.nStartX=this.nIntroRefLeft+this.ad.nX0;posParams.nStartY=this.nIntroRefTop+this.ad.nY0;posParams.nEndX=this.nIntroRefLeft+this.ad.nX1;posParams.nEndY=this.nIntroRefTop+this.ad.nY1;posParams.nTime=this.ad.nDisplayTime1*1000;var strCB=this.objName+".fullPlay()";this.introPosition.set(posParams,null,this.objToPosition,strCB);}function movePause(){var posParams=this.introPosParams;posParams.nStartX=this.nIntroRefLeft+this.ad.nX0;posParams.nStartY=this.nIntroRefTop+this.ad.nY0;posParams.nEndX=this.nIntroRefLeft+this.ad.nX1;posParams.nEndY=this.nIntroRefTop+this.ad.nY1;posParams.nTime=this.ad.nDisplayTime1*1000;var strCB=this.objName+".movePause2()";this.introPosition.set(posParams,null,this.objToPosition,strCB);}function movePause2(){var posParams=this.introPosParams;posParams.nStartX=this.nIntroRefLeft+this.ad.nX1;posParams.nStartY=this.nIntroRefTop+this.ad.nY1;posParams.nEndX=this.nIntroRefLeft+this.ad.nX1;posParams.nEndY=this.nIntroRefTop+this.ad.nY1;posParams.nTime=this.ad.nStopInterval*1000;var strCB=this.objName+".fullPlay()";this.introPosition.set(posParams,null,this.objToPosition,strCB);}function movePauseMove(){var posParams=this.introPosParams;posParams.nStartX=this.nIntroRefLeft+this.ad.nX0;posParams.nStartY=this.nIntroRefTop+this.ad.nY0;posParams.nEndX=this.nIntroRefLeft+this.ad.nX1;posParams.nEndY=this.nIntroRefTop+this.ad.nY1;posParams.nTime=this.ad.nDisplayTime1*1000;var strCB=this.objName+".movePauseMove2()";this.introPosition.set(posParams,null,this.objToPosition,strCB);}function movePauseMove2(){var posParams=this.introPosParams;posParams.nStartX=this.nIntroRefLeft+this.ad.nX1;posParams.nStartY=this.nIntroRefTop+this.ad.nY1;posParams.nEndX=this.nIntroRefLeft+this.ad.nX1;posParams.nEndY=this.nIntroRefTop+this.ad.nY1;posParams.nTime=this.ad.nStopInterval*1000;var strCB=this.objName+".movePauseMove3()";this.introPosition.set(posParams,null,this.objToPosition,strCB);}function movePauseMove3(){var posParams=this.introPosParams;posParams.nStartX=this.nIntroRefLeft+this.ad.nX1;posParams.nStartY=this.nIntroRefTop+this.ad.nY1;posParams.nEndX=this.nIntroRefLeft+this.ad.nX2;posParams.nEndY=this.nIntroRefTop+this.ad.nY2;posParams.nTime=this.ad.nDisplayTime2*1000;var strCB=this.objName+".fullPlay()";this.introPosition.set(posParams,null,this.objToPosition,strCB);}function fullPlay(){gEbDbg.always("Full Play of ad " + this.adData.nAdID + " (index: " + this.adData.nIndex + ")");this.ebsysteminteractionHandler("ebFullPlay");this.close();}function getResOrigSize(resObj){if(resObj==this.introRes){var arrSize=new Array();arrSize[0]=this.ad.nWidth;arrSize[1]=this.ad.nHeight;return arrSize;}else return null;}function doOnResize(){if(!this.fAdOn)return;this.resetIntroRefObjPos();this.introPosition.reset();}function doOnScroll(){if(!this.fAdOn)return;if(this.ad.fScrollWithPage){gEbDbg.info("Ignore Scrolling: the intro should be repositioned");this.resetIntroRefObjPos();this.introPosition.reset();}}function ebReplayHandler(){try{replay(this);this.ebsysteminteractionHandler("ebReplay");}catch(e){gEbDbg.error("Exception in ebReplayHandler: "+e.description);}}function ebAutoReplayHandler(){try{replay(this);}catch(e){gEbDbg.error("Exception in ebAutoReplayHandler: "+e.description);}}function ebkeepadopenHandler(){try{gEbDbg.attention("ebKeepAdOpen - keep the ad on the page");if(this.introPosition==null)return;this.introPosition.clear();}catch(e){gEbDbg.error("ebkeepadopenHandler: "+e.description);}}function autoClose(){gEbDbg.delimiter("==========================Auto-close the Eyeblaster===========================",1);this.fullPlay();gEbDbg.delimiter("=========================The Eyeblaster was closed========================",1);}function replay(objRef){objRef.hideIntro();objRef.fAdOn=true;objRef.showIntro();}function addFlashRes(myObj){gEbDbg.debug("adding FloatingAd - flash resources");var nFlashVer=gEbClientInfo.pluginInfo.flFlashVer;var strName=myObj.myName(strResName);myObj.ad.strFlashMov=myObj.buildResUrl(myObj.ad.strFlashMov,strName);if(nFlashVer<6)myObj.ad.strFlashMov+=myObj.strRandFlashVar;var TIobj=new ebCTIObj(strName);TIobj.src=myObj.ad.strFlashMov;TIobj.play=false;TIobj.style.position="absolute";TIobj.style.width="0px";TIobj.style.height="0px";TIobj.wmode="transparent";TIobj.wmode="transparent";if(myObj.adData.strWmode!=""){var wmode=myObj.adData.strWmode.toLowerCase();if((wmode=="transparent")||(wmode == "window")||(wmode == "opaque"))TIobj.wmode=wmode;}TIobj.version=myObj.ad.flFlashVer;if(nFlashVer>=6)TIobj.flashVars=myObj.strRandFlashVar;var method=gEbBC.isSafari()?"write" : "append";var fsCommandhandler=myObj.scriptWin+"." + myObj.objName + '.handleFSCommand(command,args,"'+strName +'");';myObj.adTI.addFsCommandHandler(method,TIobj.name,fsCommandhandler);if(myObj.ad.nPosType==2){myObj.nIntroRefTop=ebGetRealTop(myObj.relativeObjRef);myObj.nIntroRefLeft=ebGetRealLeft(myObj.relativeObjRef);}myObj.introRes=myObj.adTI.addFlash("append",TIobj);myObj.objToPosition=myObj.introRes;}function addImageRes(myObj){gEbDbg.debug("adding FloatingAd - image resources");var strName=myObj.myName(strResName);var TIobj=new ebCTIObj(strName);TIobj.src=myObj.ad.strImageSrc;TIobj.style.position="absolute";TIobj.style.width="0px";TIobj.style.height="0px";var method="append";var onloadHandler=myObj.scriptWin+"." + myObj.objName + ".imgLoaded('" + strName + "')";TIobj.onload=onloadHandler;if(myObj.ad.fLink){var onclickHandler=myObj.scriptWin+"." + myObj.objName + ".ebinteractionHandler('_eyeblaster')";TIobj.onclick=onclickHandler;}if(myObj.ad.nPosType==2){myObj.nIntroRefTop=ebGetRealTop(myObj.relativeObjRef);myObj.nIntroRefLeft=ebGetRealLeft(myObj.relativeObjRef);}myObj.introRes=myObj.adTI.addImage(method,TIobj);myObj.objToPosition=myObj.introRes;}}ebScriptLoaded("FloatingAd");