function ContentCarousel(F,L){var J,G;var H,D,M,C,K,I,E;if(this._isString(L)){G=document.getElementById(L)}else{G=L}if(this._isString(F)){J=document.getElementById(F)}else{if(F.nodeType!=1){if(this._isString(F.content)){J=document.getElementById(F.content)}else{J=F.content}if(F.controls!=null){if(this._isString(F.controls)){G=document.getElementById(F.controls)}else{G=F.controls}}D=F.loop;M=F.displayTime;C=F.fadeSteps;K=F.fadeTime;I=F.userPauseTime;H=F.autoStart;E=F.autoStartAfterDelay}else{J=F}}this._containerElement=J;this._containerElement.style.position="relative";this._blocks=new Array();for(var B=0;B<this._containerElement.childNodes.length;B++){var A=this._containerElement.childNodes[B];if(A.nodeType==8){continue}if(A.nodeType==3&&!A.nodeValue.match(/\w+/)){continue}this._blocks.push(new ContentCarouselBlock(this._containerElement.childNodes[B]))}this.blockCount=this._blocks.length;if(G!=null){this._controls=new ContentCarouselControls(G,this)}this._currentBlock=this._blocks[0];this._currentBlock.display();this._containerElementSizer=document.createElement("div");this._containerElement.appendChild(this._containerElementSizer);this._sizeContainer();this._buildTransitions();if(D!=null){this.setLoop(D)}if(M!=null){this.setDisplayTime(M)}if(C!=null){this.setFadeSteps(C)}if(K!=null){this.setFadeTime(K)}if(I!=null){this.setUserPauseTime(I)}if(E!=null){this._delayedStart(E)}if(H!=null&&H===true&&E==null){this._start()}}ContentCarousel.prototype._displayTimer=null;ContentCarousel.prototype._displayTime=1000;ContentCarousel.prototype._fadeTime=250;ContentCarousel.prototype._fadeSteps=10;ContentCarousel.prototype._userPauseTime=5000;ContentCarousel.prototype._loop=true;ContentCarousel.prototype._blocks=null;ContentCarousel.prototype._transitionsHead=null;ContentCarousel.prototype._currentTransition=null;ContentCarousel.prototype._currentBlock=null;ContentCarousel.prototype._controls=null;ContentCarousel.prototype._running=false;ContentCarousel.prototype._containerElement=null;ContentCarousel.prototype._containerElementSizer=null;ContentCarousel.prototype.blockCount=0;ContentCarousel.prototype.start=function(){this._stop();this._start()};ContentCarousel.prototype.delayedStart=function(A){this._stop();this._delayedStart(A)};ContentCarousel.prototype.resume=function(){this._stop();this._delayedStart(0)};ContentCarousel.prototype.stop=function(){this._stop()};ContentCarousel.prototype.next=function(){var A=this._running;this._stop();this._next();if(A){this._delayedStart(this._userPauseTime)}};ContentCarousel.prototype.previous=function(){var A=this._running;this._stop();this._previous();if(A){this._delayedStart(this._userPauseTime)}};ContentCarousel.prototype.jump=function(B){var C=this._running;this._stop();var A=this._transitionToIndex(B);if(C){this._delayedStart(this._userPauseTime)}return A};ContentCarousel.prototype._start=function(){this._delayedStart(this._displayTime)};ContentCarousel.prototype._delayedStart=function(A){var B=this;this._running=true;this._displayTimer=setTimeout(function(){B._autoNext()},A)};ContentCarousel.prototype._stop=function(){clearTimeout(this._displayTimer);this._running=false};ContentCarousel.prototype._autoNext=function(){var A=this;if(this._next()){this._displayTimer=setTimeout(function(){A._autoNext()},this._displayTime+this._fadeTime)}};ContentCarousel.prototype._next=function(){if(this._currentTransition==null){this._currentTransition=this._transitionsHead}else{if(this._currentTransition.data.inProgress){return true}}if(this._currentTransition.data.controlsBlock!=null){this._currentTransition.data.controlsBlock.normal();this._currentTransition.data.controlsBlock.enableHover()}this._currentTransition=this._currentTransition._next;if(this._currentTransition==null){return false}this._currentTransition.data.fade(this._currentBlock);this._currentBlock=this._currentTransition.data._targetBlock;this._sizeContainer();return true};ContentCarousel.prototype._previous=function(){if(this._currentTransition==null){this._currentTransition=this._transitionsHead}else{if(this._currentTransition.data.inProgress){return true}}if(this._currentTransition.data.controlsBlock!=null){this._currentTransition.data.controlsBlock.normal();this._currentTransition.data.controlsBlock.enableHover()}this._currentTransition=this._currentTransition._previous;if(this._currentTransition==null){return false}this._currentTransition.data.fade(this._currentBlock);this._currentBlock=this._currentTransition.data._targetBlock;this._sizeContainer();return true};ContentCarousel.prototype._transitionToIndex=function(A){if(this._currentTransition!=null&&this._currentTransition.data.inProgress){return false}var C=this._transitionsHead;for(var B=0;B<A&&C!=null;B++){C=C._next}if(C==null||C.data._targetBlock==this._currentBlock){return true}if(this._controls!=null){if(this._currentTransition!=null&&this._currentTransition.data.controlsBlock!=null){this._currentTransition.data.controlsBlock.normal();this._currentTransition.data.controlsBlock.enableHover()}else{this._controls.revertAll()}}this._currentTransition=C;this._currentTransition.data.fade(this._currentBlock);this._currentBlock=this._currentTransition.data._targetBlock;this._sizeContainer();return true};ContentCarousel.prototype.setLoop=function(A){this._loop=A;this._buildTransitions()};ContentCarousel.prototype.getLoop=function(){return this._loop};ContentCarousel.prototype.setDisplayTime=function(A){this._displayTime=A};ContentCarousel.prototype.getDisplayTime=function(){return this._displayTime};ContentCarousel.prototype.setFadeSteps=function(A){this._fadeSteps=A;this._buildTransitions()};ContentCarousel.prototype.getFadeSteps=function(){return this._fadeSteps};ContentCarousel.prototype.setFadeTime=function(A){this._fadeTime=A;this._buildTransitions()};ContentCarousel.prototype.getFadeTime=function(){return this._fadeTime};ContentCarousel.prototype.setUserPauseTime=function(A){this._userPauseTime=A};ContentCarousel.prototype.getUserPauseTime=function(){return this._userPauseTime};ContentCarousel.prototype._buildTransitions=function(){this._transitionsHead=null;var B=null;var C=null;for(var A=0;A<this._blocks.length;A++){var D=null;if(this._controls!=null){D=this._controls.blocks[A]}C=new ContentCarouselList(new ContentCarouselTransition(this._blocks[A],this._fadeTime,this._fadeTime/this._fadeSteps,1/this._fadeSteps,D));if(B!=null){B._next=C;C._previous=B}if(this._transitionsHead==null){this._transitionsHead=C}B=C}if(this._loop&&B!=null){B._next=this._transitionsHead;this._transitionsHead._previous=B}};ContentCarousel.prototype._sizeContainer=function(){this._containerElementSizer.style.width=this._currentBlock.element.clientWidth+"px";this._containerElementSizer.style.height=this._currentBlock.element.clientHeight+"px"};ContentCarousel.prototype._isString=function(B){if(typeof B=="string"){return true}if(typeof B=="object"){if(B.constructor==null){return false}var A=B.constructor.toString().match(/function string\(/i);return(A!=null)}return false};function ContentCarouselControls(C,F){var B,E,A=0;this.blocks=new Array();if(C instanceof Array){for(var G=0;G<C.length;G++){if(C[G]==null){continue}this.blocks.push(new ImageControlsFunction(C[G].normal,C[G].active,G))}}else{if(C.nodeType==1){C.style.position="relative";for(var D=0;D<C.childNodes.length;D++){if(C.childNodes[D].nodeType==1){B=C.childNodes[D];do{D++}while(C.childNodes[D].nodeType!=1);E=C.childNodes[D];this.blocks.push(new ImageControlsBlock(B,E,F,A));A++}}}else{for(var G=0;G<F.blockCount;G++){this.blocks.push(new ImageControlsFunction(C.normal,C.active,G))}}}this.blocks[0].active();this.blocks[0].disableHover();this.revertAll=function(){for(var H=0;H<this.blocks.length;H++){this.blocks[H].normal();this.blocks[H].enableHover()}}}ContentCarouselControls.prototype.blocks=null;function ImageControlsBlock(C,B,E,A){this._elementNormal=C;this._elementActive=B;this._faderObject=E;this._imageIndex=A;var D=this;this._elementActive.onclick=function(){D._click()};this.enableHover();this.normal()}ImageControlsBlock.prototype._elementNormal=null;ImageControlsBlock.prototype._elementActive=null;ImageControlsBlock.prototype._faderObject=null;ImageControlsBlock.prototype._imageIndex=0;ImageControlsBlock.prototype.active=function(){this._elementNormal.style.display="none";this._elementActive.style.display="inline"};ImageControlsBlock.prototype.normal=function(){this._elementActive.style.display="none";this._elementNormal.style.display="inline"};ImageControlsBlock.prototype._click=function(){this._faderObject.jump(this._imageIndex)};ImageControlsBlock.prototype.disableHover=function(){this._elementNormal.onmouseover=null;this._elementActive.onmouseout=null};ImageControlsBlock.prototype.enableHover=function(){var A=this;this._elementNormal.onmouseover=function(){A.active()};this._elementActive.onmouseout=function(){A.normal()}};function ImageControlsFunction(C,B,A){this._functionNormal=C;this._functionActive=B;this._index=A}ImageControlsFunction.prototype._functionNormal=null;ImageControlsFunction.prototype._functionActive=null;ImageControlsFunction.prototype._index=null;ImageControlsFunction.prototype.active=function(){if(this._functionActive){this._functionActive(this._index)}};ImageControlsFunction.prototype.normal=function(){if(this._functionNormal){this._functionNormal(this._index)}};ImageControlsFunction.prototype.disableHover=function(){};ImageControlsFunction.prototype.enableHover=function(){};function ContentCarouselBlock(A){this.element=A;this.element.style.position="absolute";this.element.style.top="0px";this.element.style.left="0px";this.element.style.width="100%";this.element.style.height="100%";this.element.style.height="auto";this.element.style.display="none";this.element.style.opacity="1.0";this.element.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity = 100)";this.element.style.zIndex="0";if(this.element.filters!=null){this._useFilters=true}}ContentCarouselBlock.prototype.element=null;ContentCarouselBlock.prototype._useFilters=false;ContentCarouselBlock.prototype.setOpacity=function(A){if(this._useFilters){this.element.filters.item("DXImageTransform.Microsoft.Alpha").opacity=A*100}else{this.element.style.opacity=A}};ContentCarouselBlock.prototype.display=function(){this.element.style.display="block"};ContentCarouselBlock.prototype.hide=function(){this.element.style.display="none"};function ContentCarouselTransition(D,A,B,C,E){this._fadeTime=A;this._fadeStepTime=B;this._fadeStepAmount=C;this._CurrentOpacity=1;this._startBlock=null;this._targetBlock=D;this.controlsBlock=E}ContentCarouselTransition.prototype._fadeTime=0;ContentCarouselTransition.prototype._fadeStepTime=0;ContentCarouselTransition.prototype._fadeStepAmount=0;ContentCarouselTransition.prototype._CurrentOpacity=1;ContentCarouselTransition.prototype._targetBlock=null;ContentCarouselTransition.prototype._startBlock=null;ContentCarouselTransition.prototype._fadeTimer=null;ContentCarouselTransition.prototype.inProgress=null;ContentCarouselTransition.prototype.controlsBlock=null;ContentCarouselTransition.ZIndex=65536;ContentCarouselTransition.prototype.fade=function(A){this.inProgress=true;this._startBlock=A;this._startBlock.element.style.zIndex="1";this._startBlock.setOpacity(1);this._startBlock.display();this._targetBlock.display();this._targetBlock.element.style.zIndex="0";if(this.controlsBlock!=null){this.controlsBlock.active();this.controlsBlock.disableHover()}this._fadeStep()};ContentCarouselTransition.prototype._fadeStep=function(A){var B=this;if(A==undefined){A=0}this._CurrentOpacity-=this._fadeStepAmount;this._startBlock.setOpacity(this._CurrentOpacity);if(A>=this._fadeTime){this._finalizeTransition()}else{this._fadeTimer=setTimeout(function(){B._fadeStep(A+B._fadeStepTime)},this._fadeStepTime)}};ContentCarouselTransition.prototype._finalizeTransition=function(){this._CurrentOpacity=1;this._startBlock.element.style.zIndex="0";this._startBlock.setOpacity(1);this._startBlock.hide();this.inProgress=false};function ContentCarouselList(A){this.data=A}ContentCarouselList.prototype.data=null;ContentCarouselList.prototype.next=null;ContentCarouselList.prototype.previous=null;
