var Caroussel = new Class({
	initialize: function() {		  
		this.firstRun = true;
		this.interval = 6000;
		this.active = 0;		
		this.items = $$(".header");		
		this.items2 = $$(".tip");
		this.items.setStyles({
			"display":"block",
			"opacity":0
		});
		this.items2.setStyles({
			"display":"block",
			"opacity":0
		});
		if(this.items.length>0){
			this.items[0].setStyle("opacity",1);
			if(this.items2.length>0)
				this.items2[0].setStyle("opacity",1);
			this.activeItem = this.items[0];
			this.activeItem2 = this.items2[0];
		}
		if(this.items.length>1){
			this.items.each(function(item,index){
				var text = index+1;
				new Element("span").set("text",text).inject($("nav"));
				/* new Element("span").set("text",text).inject($("nav2")); */
			});
			$$("#nav span")[0].addClass("selected");
			/* $$("#nav2 span")[0].addClass("selected"); */
			this.activeNav = $$("#nav span")[0];
			/* this.activeNav2 = $$("#nav2 span")[0]; */
			this.shedule.delay(this.interval,this);
		}
	},		
	
	shedule: function(){
		this.show();	
	},	
	
	show: function(){
		var num = this.active;
		this.activeItem.fade(0);
		this.activeItem2.fade(0);
		this.items[num+1].fade(1);
		this.items2[num+1].fade(1);
		this.activeNav.removeClass("selected");
		/* this.activeNav2.removeClass("selected"); */
		$$("#nav span")[num+1].addClass("selected");
		/* $$("#nav2 span")[num+1].addClass("selected"); */
		this.activeItem = this.items[num+1];
		this.activeItem2 = this.items2[num+1];
		this.activeNav = $$("#nav span")[num+1];
		/* this.activeNav2 = $$("#nav2 span")[num+1]; */
		this.active = this.active + 1;
		if(this.active == this.items.length-1) this.active = -1;		
		this.shedule.delay(this.interval,this);
	}	
});
