var scroller;

var CollectionScroller = new Class({

	/* initialize needed methods
	 ======================================================================= */
	initialize: function(){
		if(!$('scroller')) return false;
		
		this.wrap = $('scroller');

		this.start();
	},

	/* attach events and add the initially fired methods
	 ======================================================================= */
	start: function(){	
		scroller = new Scroller('scroller');
		scroller.show();
		scroller.populate();
		scroller.direction = 'left';
		scroller.play();
		scroller.wrapper.addEvents({
			mouseover: function(){
				scroller.stop();
			},
			mouseout: function(){
				scroller.resume();
			}
		});
		
		this.addBehavior();
	},
	
	addBehavior: function(){
		var self = this;
		
		this.wrap.addEvents({
			'mouseover:relay(a)': function(){
				self.switchView(this.getProperty('rel'),'show');
				self.switchView('startMsg','hidden');
			},
			'mouseout:relay(a)': function(){
				self.switchView(this.getProperty('rel'),'hidden');
				self.switchView('startMsg','show');
			}
		});
	},
	
	switchView: function(el, mode){
		$(el).setProperty('class', mode);
	}
});
