var BannerRotation	= new Class({
	
	initialize: function(container) {
		this.height	= 0;
		this.interval = 5000;
		this.current = 0;
		
		this.container	= $(container);
		this.banners	= this.container.getElements('p');
		this.banners.each(this.setup, this);
		this.setupContainer();
		
		if(this.banners.length > 1) {
			this.transition.periodical(this.interval, this);
		}
	},
	
	setup: function(p, i) {
		if(i > 0) {
			p.setStyles({
				'display': '',
				'opacity': 0
			});
		}
		
		p.setStyles({
			'position': 'absolute',
			'top': 0,
			'left': 0,
			'width': '100%'
		});
		
		if(p.getSize().y > this.height) {
			this.height = p.getSize().y;
		}
	},
	
	setupContainer: function() {
		this.container.setStyles({
			'position': 'relative',
			'height': this.height
		});
	},
	
	transition: function() {
		var next	= (this.current+1 >= this.banners.length)
			? 0
			: this.current+1;
		
		this.banners[this.current].fade(1, 0);
		this.banners[next].fade(0, 1);
		this.current = next;
	}
	
});
