function ContentSlider(A,I,G,E,D){this.id=A;this.timer=A+"timer";this.delay=(typeof (G)=="number")?G:3000;this.effect=(typeof (I)=="string")?I:"none";this.sliders=[];this.pointer=0;this.pause=0;var C=document.getElementById(A);var B=C.getElementsByTagName("div");for(var F=0;F<B.length;F++){if(B[F].className=="bs_opacitylayer"){C.opacitylayer=B[F]}else{if(B[F].className=="bs_contentdiv"){this.sliders.push(B[F])}}}if(this.sliders.length==0){return }this.targetobject=C.opacitylayer||null;this.width=parseInt(C.style.width);this.height=parseInt(C.style.height);if((typeof (D)!="undefined")&&(D==1)){this.showall();ContentSlider.resizeImg(A,this.width,this.height);this.hideall()}var H=this;C.onmouseover=function(){H.pause=1};C.onmouseout=function(){H.pause=0};if((typeof (E)=="undefined")||(E==1)){this.sliders.sort(function(){return 0.5-Math.random()})}if(this.effect.charAt(0)=="s"){this.accel=1.05;this.pos=1;for(var F=0;F<this.sliders.length;F++){this.sliders[F].style.position="relative"}}switch(I){case"scroll_left":case"scroll_top":this.scrollL();break;case"scroll_right":case"scroll_bottom":this.scrollR();break;case"fade":default:this.fade()}}ContentSlider.prototype.next=function(){this.pointer=(this.pointer<this.sliders.length-1)?++this.pointer:0};ContentSlider.prototype.hideall=function(){for(var A=0;A<this.sliders.length;A++){this.sliders[A].style.display="none"}};ContentSlider.prototype.showall=function(){for(var A=0;A<this.sliders.length;A++){this.sliders[A].style.display="block"}};ContentSlider.prototype.fade=function(){var A=this;if(this.pause){window[this.timer]=setTimeout(function(){A.slide()},1000)}else{this.sliders[this.pointer].style.display="none";if(this.effect!="none"){if(window[this.id+"fadetimer"]){clearTimeout(window[this.id+"fadetimer"])}this.setopacity(0.1)}this.next();this.sliders[this.pointer].style.display="block";if(this.effect!="none"){this.fadein()}window[this.timer]=setTimeout(function(){A.fade()},this.delay)}};ContentSlider.prototype.fadein=function(){if(this.targetobject&&this.targetobject.currentopacity<1){this.setopacity(this.targetobject.currentopacity+0.1);var A=this;window[this.id+"fadetimer"]=setTimeout(function(){A.fadein()},100)}};ContentSlider.prototype.setopacity=function(A){if(this.targetobject&&this.targetobject.filters&&this.targetobject.filters[0]){if(typeof this.targetobject.filters[0].opacity=="number"){this.targetobject.filters[0].opacity=A*100}else{this.targetobject.style.filter="alpha(opacity="+A*100+")"}}else{if(this.targetobject&&typeof this.targetobject.style.MozOpacity!="undefined"){this.targetobject.style.MozOpacity=A}else{if(this.targetobject&&typeof this.targetobject.style.opacity!="undefined"){this.targetobject.style.opacity=A}}}this.targetobject.currentopacity=A};ContentSlider.prototype.scrollL=function(){var A=this;if(this.pause){window[this.timer]=setTimeout(function(){A.scrollL()},1000)}else{if((this.effect=="scroll_left"&&this.pos>-this.width)||(this.effect=="scroll_top"&&this.pos>-this.height)){if(this.pos==0){this.pos=-1;window[this.timer]=setTimeout(function(){A.scrollL()},this.delay);return }else{if(this.pos<0){this.pos=Math.floor(this.pos*this.accel)-1}else{this.pos=Math.floor(this.pos/this.accel)}}}else{this.sliders[this.pointer].style.display="none";this.pos=-this.pos;this.next()}this.sliders[this.pointer].style.display="block";if(this.effect=="scroll_left"){this.sliders[this.pointer].style.left=this.pos+"px"}else{this.sliders[this.pointer].style.top=this.pos+"px"}window[this.timer]=setTimeout(function(){A.scrollL()},80)}};ContentSlider.prototype.scrollR=function(){var A=this;if(this.pause){window[this.timer]=setTimeout(function(){A.scrollR()},1000)}else{if((this.effect=="scroll_right"&&this.pos<this.width)||(this.effect=="scroll_bottom"&&this.pos<this.height)){if(this.pos==0){this.pos=1;window[this.timer]=setTimeout(function(){A.scrollR()},this.delay);return }else{if(this.pos<0){this.pos=Math.ceil(this.pos/this.accel)}else{this.pos=Math.ceil(this.pos*this.accel)}}}else{this.sliders[this.pointer].style.display="none";this.pos=-this.pos;this.next()}this.sliders[this.pointer].style.display="block";if(this.effect=="scroll_right"){this.sliders[this.pointer].style.left=this.pos+"px"}else{this.sliders[this.pointer].style.top=this.pos+"px"}window[this.timer]=setTimeout(function(){A.scrollR()},80)}};ContentSlider.resizeImg=function(G,B,D){var A=document.getElementById(G).getElementsByTagName("img");if(A.length>0){var F,E;for(var C=0;C<A.length;C++){E=ContentSlider.getDimension(A[C]);if(E.width>B||E.height>D){F=Math.min((B-E.padH)/E.width,(D-E.padV)/E.height);A[C].style.width=parseInt(E.width*F)+"px";A[C].style.height=parseInt(E.height*F)+"px"}}}};ContentSlider.getDimension=function(E){var B=E.style.display;E.style.display="block";var A=E.width;var C=E.height;var F=E.offsetWidth-A;var D=E.offsetHeight-C;E.style.display=B;return{width:A,height:C,padH:F,padV:D}};