function ContentCarousel(E,K){var I,F;var G,C,L,B,J,H,D;if(this._isString(K)){F=document.getElementById(K)}else{F=K}if(this._isString(E)){I=document.getElementById(E)}else{if(E.nodeType!=1){if(this._isString(E.content)){I=document.getElementById(E.content)}else{I=E.content}if(E.controls!=null){if(this._isString(E.controls)){F=document.getElementById(E.controls)}else{F=E.controls}}C=E.loop;L=E.displayTime;B=E.fadeSteps;J=E.fadeTime;H=E.userPauseTime;G=E.autoStart;D=E.autoStartAfterDelay}else{I=E}}this._containerElement=I;this._containerElement.style.position="relative";this._blocks=new Array();for(var A=0;A<this._containerElement.childNodes.length;A++){if(!(this._containerElement.childNodes[A].nodeType==3&&!this._containerElement.childNodes[A].nodeValue.match(/\w+/))){this._blocks.push(new ContentCarouselBlock(this._containerElement.childNodes[A]))}}this.blockCount=this._blocks.length;if(F!=null){this._controls=new ContentCarouselControls(F,this)}this._currentBlock=this._blocks[0];this._currentBlock.display();this._containerElementSizer=document.createElement("div");this._containerElement.appendChild(this._containerElementSizer);this._sizeContainer();this._buildTransitions();if(C!=null){this.setLoop(C)}if(L!=null){this.setDisplayTime(L)}if(B!=null){this.setFadeSteps(B)}if(J!=null){this.setFadeTime(J)}if(H!=null){this.setUserPauseTime(H)}if(D!=null){this._delayedStart(D)}if(G!=null&&G===true&&D==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(A){var B=this._running;this._stop();this._transitionToIndex(A);if(B){this._delayedStart(this._userPauseTime)}};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)}};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 }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 }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()};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._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"){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.width="auto";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(C,A,B,D){this._fadeStepTime=A;this._fadeStepAmount=B;this._CurrentOpacity=1;this._startBlock=null;this._targetBlock=C;this.controlsBlock=D}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(){var A=this;this._CurrentOpacity-=this._fadeStepAmount;this._startBlock.setOpacity(this._CurrentOpacity);if(this._CurrentOpacity<=0){this._finalizeTransition()}else{this._fadeTimer=setTimeout(function(){A._fadeStep()},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;
