function PioEffects(){ this.animateLargeBackground = function animateLargeBackground(bannerWidth, bannerHeight, canvasWidth, canvasHeight, canvasObject, optionalDir, optionalStartX, optionalStartY){ var sVarName = "animateLargeBackground" + (iAnimateLargeBackgroundIndex++); var oAnimator; if(optionalDir==null){ oAnimator = new PioEffectsAnimateLargeBackgroundClass(sVarName, bannerWidth, bannerHeight, canvasWidth, canvasHeight, canvasObject, 1, null, null); }else{ oAnimator = new PioEffectsAnimateLargeBackgroundClass(sVarName, bannerWidth, bannerHeight, canvasWidth, canvasHeight, canvasObject, optionalDir, optionalStartX, optionalStartY); } window[sVarName] = oAnimator; oAnimator.animate(); } var iAnimateLargeBackgroundIndex = 0; this.getContentsFader = function(doNotCreate) { return this.getContetsFader(doNotCreate); } this.getContetsFader = function(doNotCreate){ var sVarName = "PioEffectsContentsFaider_oInstance"; var o = window[sVarName]; if(o == null){ if(doNotCreate) return null; o = new PioEffectsContentsFaider(sVarName); window[sVarName] = o; } return o; } } var PioEffects = new PioEffects(); var PioEffectsContentsFaider_Config = {bgColor:"black", zIndex:1001, minOpacity:30, maxOpacity:50, fadeStepOpacity:5, timeoutInterval:4 }; function PioEffectsContentsFaider(selfVarName){ var oConfig = PioEffectsContentsFaider_Config; var bMakeAnimation = (oConfig.fadeStepOpacity > 0 && oConfig.fadeStepOpacity < oConfig.maxOpacity); var oCtl = document.createElement("DIV"); oCtl.style.position = "absolute"; oCtl.style.top = "0px"; oCtl.style.left = "0px"; oCtl.style.backgroundColor = oConfig.bgColor; oCtl.style.zIndex = oConfig.zIndex; oCtl.style.display = "none"; var oAriaHidden = document.createAttribute("aria-hidden");oAriaHidden.value = "true";oCtl.attributes.setNamedItem(oAriaHidden); document.body.appendChild(oCtl); var iCurrent = -1; this.open = function(){ makeResize(); if(!bMakeAnimation){ iCurrent = -1; setOpacity(oConfig.maxOpacity); oCtl.style.display = ""; }else{ iCurrent = oConfig.minOpacity; setOpacity(iCurrent); oCtl.style.display = ""; setTimeout(nextStep, oConfig.timeoutInterval); } } this.close = function(){ iCurrent = -1; oCtl.style.display = "none"; } this.getZIndex = function(){ return PioWeb.getStyleValue(oCtl,"zIndex"); } function setOpacity(value){ var iOpacity = (value == 100)?99.999:value; oCtl.style.filter = "alpha(opacity:"+iOpacity+")"; oCtl.style.KHTMLOpacity = iOpacity/100; oCtl.style.MozOpacity = iOpacity/100; oCtl.style.opacity = iOpacity/100; } function nextStep(){ if(iCurrent > -1){ var iCurrentNew = iCurrent + oConfig.fadeStepOpacity; if(iCurrent >= oConfig.maxOpacity){ iCurrent = -1; setOpacity(oConfig.maxOpacity); }else{ iCurrent = iCurrentNew; setOpacity(iCurrent); setTimeout(nextStep, oConfig.timeoutInterval); } } } function makeResize(){ var iX; var iY; //if(PioWeb.BrName == "IE"){ iX = document.body.clientWidth; if(document.body.scrollWidth > iX) iX = document.body.scrollWidth; iY = document.body.clientHeight; if(document.body.scrollHeight > iY) iY = document.body.scrollHeight; //}else{ // iX = document.documentElement.clientWidth; // iY = document.documentElement.clientHeight; //} oCtl.style.width = iX + "px"; oCtl.style.height = iY + "px"; } function resizeHandler(){ if(oCtl.style.display != "none"){ //oCtl.style.width = "100px"; //oCtl.style.height = "100px"; makeResize(); } } PioWeb.attachEvent(window, "resize", resizeHandler); //PioWeb.attachEvent(window, "load", resizeHandler); PioWeb.registerBestOnPageExecutionHandler(resizeHandler, true); } function PioEffectsAnimateLargeBackgroundClass(selfVarName, bannerWidth, bannerHeight, canvasWidth, canvasHeight, canvasObject, dir, startX, startY){ var oCanvas; var iDir = dir; var iX; var iY; var iX1; var iY1; var iX2; var iY2; var iStepX = 2; var iStepY = 2; var bAnimateX = (bannerWidth > canvasWidth + 50); //bAnimateX = false; var bAnimateY = (bannerHeight > canvasHeight + 50); bAnimateY = false; var bAnimate = (bAnimateX || bAnimateY); var iAngle = 0; if(bAnimate){ if(bAnimateX && bAnimateY){ iAngle = PioWeb.randomInt(1, 6); switch(iAngle){ case 1 : iAngle = 30;break; case 2 : iAngle = 45;break; case 3 : iAngle = 60;break; case 4 : iAngle = 120;break; case 5 : iAngle = 135;break; case 6 : iAngle = 150;break; } }else if(bAnimateX){ iAngle = 0; if(iDir > 0){ iX1 = 0; iX2 = bannerWidth - canvasWidth; //iStepX = iStepX; }else{ iX2 = 0; iX1 = bannerWidth - canvasWidth; iStepX = iStepX * -1; } iY1 = (startY == null)? Math.floor((bannerHeight - canvasHeight)/2) : startY; if(iY1 > bannerHeight - canvasHeight) iY1 = 0; iY2 = iY1; iStepY = 0; }else if(bAnimateY){ iAngle = 90; if(iDir > 0){ iY1 = 0; iY2 = bannerHeight - canvasHeight; //iStepY = iStepY; }else{ iY2 = 0; iY1 = bannerHeight - canvasHeight; iStepY = iStepY * -1; } iX1 = (startX == null)? Math.floor((bannerWidth - canvasWidth)/2) : startX; if(iX1 > bannerWidth - canvasWidth) iX1 = 0; iX2 = iX1; iStepX = 0; } }else{ if(bannerWidth > canvasWidth){ iX1 = Math.floor((bannerWidth - canvasWidth)/2); }else{ iX1 = 0; } if(bannerHeight > canvasHeight){ iY1 = Math.floor((bannerHeight - canvasHeight)/2); }else{ iY1 = 0; } iX2 = iX1; iY2 = iY2; } iX = iX1; iY = iY1; oCanvas = (typeof(canvasObject) == "string") ? PioWeb.getElementById(canvasObject) : canvasObject; this.animate = function(){ if(oCanvas == null) return; oCanvas.style.backgroundPosition = "-" + iX + "px -" + iY + "px"; if(!bAnimate) return; iX = iX + iStepX; iY = iY + iStepY; if(iDir > 0) { if(iX > iX2 || iY > iY2) { PioEffects.animateLargeBackground(bannerWidth, bannerHeight, canvasWidth, canvasHeight, canvasObject, -1, iX, iY); window[selfVarName] = null; return; } }else{ if(iX < iX2 || iY < iY2) { PioEffects.animateLargeBackground(bannerWidth, bannerHeight, canvasWidth, canvasHeight, canvasObject, 1, iX, iY); eval(selfVarName +" = null;"); return; } } window.setTimeout(selfVarName+".animate();",25); } }