var Rotator=new Class({Implements:Options,options:{rotators:".rotator",counter:0,init:false,timer:{delay:9000,scolling:9500,fading:2000,fps:200},opacity:{min:0,max:1},backgroundPosition:-130},
initialize:function(options){this.setOptions(options);this.container=$("intro-banner");

this.rotators=$$(this.options.rotators);
this.captionFlag=false;
this.captions=".sbDesc";
this.hideRotators();
this.initFirst();
this.initRotators.periodical(this.options.timer.delay,this)},
isFx2Mac:function(){
if(Browser.Platform.mac&&Browser.Engine.gecko&&(Browser.Engine.version==18))
{return true}
else{return false}},

hideRotators:function(){
this.rotators.set("styles",{opacity:this.options.opacity.min,zIndex:500})},

initRotators:function(){
this.container.set("styles",{background:"none"});
this.rotators.each(function(rotator){
rotator.set("morph",{duration:this.options.timer.fading});
rotator.morph({opacity:this.options.opacity.min})},this);
if(this.options.counter.toInt()==this.rotators.length.toInt()){
this.options.counter=0}
this.showCurrent();
this.options.counter++},

applyCaption:function(el){
var desc=el.getElements(this.captions);
desc.set("morph",{transition:"linear"});
desc.morph({opacity:(this.captionFlag?0:1),
left:(this.captionFlag?[20,40]:[0,20])});
this.captionFlag=(this.captionFlag?false:true)},

scrollBanner:function(el){
el.set("morph",{fps:this.options.timer.fps,duration:this.options.timer.scolling,transition:"linear"});
//el.morph({backgroundPosition:[0,this.options.backgroundPosition]});
this.applyCaption.bind(this,el).delay(this.options.timer.fading);
this.applyCaption.bind(this,el).delay(this.options.timer.delay-1000)},

showCurrent:function(){
var current=this.rotators[this.options.counter];
current.getElements(this.captions).morph({opacity:0});
current.set("styles",{zIndex:600});
current.set("morph",{duration:this.options.timer.fading});
current.morph({opacity:this.options.opacity.max});
var cChild=current.getElement("a");

this.scrollBanner(cChild)},initFirst:function(){
var last=this.rotators.getLast();last.set("styles",{zIndex:600});$$(this.captions).set("styles",{opacity:0});var lChild=last.getElement("a");
this.scrollBanner(lChild)}});
