document.observe("dom:loaded", function(){
	bannerObj = new bannerClass();
	function recSlide(){
		 bannerObj.slide();
	}
	recSlide(); 
	new PeriodicalExecuter(recSlide, 5);
});

var bannerClass = {};
bannerClass = Class.create();
bannerClass.prototype = {
	initialize: function(){
		this.options = Object.extend({
			banner: "banner",
			item: "item",
			bannerHeadline: "bannerHeadline",
			none: true
        }, arguments[2] || { });

		this.mark = 0;
	},

	slide: function(){
		if($(this.options.banner) && $(this.options.banner).select("."+this.options.item)[0]){
			this.hideItems();

			this.mark++;
			if(!$(this.options.banner).select("."+this.options.item+"-"+this.mark)[0]){
				this.mark = 1;
			}

			if($(this.options.banner).select("."+this.options.item+"-"+this.mark)[0]){
				$(this.options.banner).select("."+this.options.item+"-"+this.mark)[0].select(".text")[0].setStyle({
					width: "0%"
				});

				new Effect.Appear($(this.options.banner).select("."+this.options.item+"-"+this.mark)[0], {
					form: 0.0,
					to: 1.0,
					duration: 1.0,
					queue: "start"
				});

				new Effect.Morph($(this.options.banner).select("."+this.options.item+"-"+this.mark)[0].select(".text")[0], {
					style: "width: 100%",
					queue: "end"
				});
			}
		}else{
			if($(this.options.bannerHeadline))
				$(this.options.bannerHeadline).hide();
			if($(this.options.banner))
				$(this.options.banner).hide();
		}
	},

	hideItems: function(){
		$(this.options.banner).select("."+this.options.item).each( Element.hide );
	},

	none: function(){
	}
}