(function(){var b=null;var d=null;var c=true;a.prototype.getStack=function(){var g=new Array();var e=this.container.getElementsByTagName(this.item_type);for(var f in e){if(e[f]&&e[f].className&&e[f].className.indexOf(this.rotator_class)>=0){if(c&&e[f].style.position!="relative"){e[f].style.position="relative";}g.push(e[f]);}}if(c&&g&&g[0]){c=false;var h=g[0].parentNode;if(h.style.overflow!="hidden"){h.style.overflow="hidden";}}return g;};a.prototype.rotateStack=function(e){if(e&&e.length>1){var g=e[0].parentNode;var f=e.length-1;if(!document.all){if(this.direction==this.UP){this.setOpacity(e[0],0);}else{if(this.direction==this.DOWN){this.setOpacity(e[f],0);}}}if(this.direction==this.UP){g.removeChild(e[0]);g.appendChild(e[0]);}else{g.removeChild(e[f]);g.insertBefore(e[f],e[0]);}if(!document.all){if(this.direction==this.UP){b.fadeIn(e[0]);}else{if(this.direction==this.DOWN){b.fadeIn(e[f]);}}}}};a.prototype.setOpacity=function(e,f){if(e){if(f<0){f=0;}else{if(f>100){f=100;}}if(document.all){e.style.zoom=1;if(f==100){e.style.filter="";}else{e.style.filter="alpha(opacity="+f+")";}}else{e.style.opacity=f/100;e.style.MozOpacity=f/100;e.opacity=f;}e.current_opacity=f;}};a.prototype.getPos=function(f){var g=0;var e=0;if(f&&f.offsetParent){do{g+=f.offsetLeft;e+=f.offsetTop;}while(f=f.offsetParent);}return{x:g,y:e};};function a(f){b=this;this.UP=0;this.DOWN=1;this.height=200;this.container=(f&&f.container?f&&f.container:document);this.item_type=(f&&f.item_type?f.item_type:"li");this.rotator_class=(f&&f.rotator_class?f.rotator_class:"rotate");this.direction=(f?f.direction:this.UP);this.move_delay=(f&&f.move_delay_ms?f.move_delay_ms:120);this.rotate_delay=(f&&f.rotate_delay_ms?f.rotate_delay_ms:this.move_delay);this.fadein_delay=(f&&f.fadein_delay_ms?f.fadein_delay_ms:50);this.top_margin=0-(f&&f.top_margin?f.top_margin:0);this.moveUp=function(g){for(var h in g){if(g[h]){var l=(g[h].style.top?parseInt(g[h].style.top):0);g[h].style.top=(l-1)+"px";}}var k=b.getPos(g[1].parentNode);var j=b.getPos(g[1]);if((j.y-k.y)>0){d=setTimeout(e,b.move_delay);}else{b.rotateStack(g);for(var h in g){if(g[h]){g[h].style.top=b.top_margin+"px";}}d=setTimeout(e,b.rotate_delay);}};this.getHeight=function(g){if(g){if(g.style.pixelHeight){return g.style.pixelHeight;}else{return g.offsetHeight;}}};this.moveDown=function(g){for(var j in g){if(g[j]){var m=(g[j].style.top?parseInt(g[j].style.top):0);g[j].style.top=(m+1)+"px";}}var h=g.length-1;var l=b.getPos(g[0].parentNode);var k=b.getPos(g[0]);if(k.y<(l.y+b.getHeight(g[h]))){d=setTimeout(e,b.move_delay);}else{b.rotateStack(g);for(var j in g){if(g[j]){g[j].style.top=b.top_margin+"px";}}d=setTimeout(e,b.rotate_delay);}};this.start=function(g){this.stop();if(!g){e();}else{d=setTimeout(e,g);}};this.stop=function(){if(d){clearTimeout(d);}d=null;};function e(){if(d){clearTimeout(d);}d=null;var g=b.getStack();if(g.length>1){if(b.direction==b.UP){b.moveUp(g);}else{if(b.direction==b.DOWN){b.moveDown(g);}}}}this.fadeIn=function(g){if(g){if(!g.current_opacity){g.current_opacity=0;}if(g.current_opacity<100){g.current_opacity+=10;b.setOpacity(g,g.current_opacity);setTimeout(function(){b.fadeIn(g);},this.fadein_delay);}}};}window.Rotator=a;})();
