var Hirek = Class.create({
  initialize: function() {
	this.darab = 3;
	this.act = 1;
	this.stopped = 0;
  },
  
	start:function(){
		new PeriodicalExecuter(Hirek.valt, 3);
	},
	
	leptet:function(){
		Hirek.stopped = 1;
		for(var i=1;i<=Hirek.darab;i++){
			try{
				$('headerhir'+i).setStyle({opacity: 0.0});
			}catch(e){;}
		}
		id = ++Hirek.act;
		try{
			$('headerhir'+id).setStyle({opacity: 1.0});
		}catch(e){;}
		
		Hirek.stopped = 0;
	},
	
	valt:function(){
		var elso = Hirek.act;
		if(Hirek.act == Hirek.darab){
			var masodik = 1;
		}else{
			var masodik = elso+1;
		}
		Hirek.act = masodik;
		//alert(elso+'-'+masodik);
		//elrejtes
		$('headerhir'+elso).show();
		new Effect.Opacity('headerhir'+elso, { duration: 1.0, from: 1.0, to: 0.0, afterFinish:function(){
			$('headerhir'+elso).hide();
		}  });
		
			
		//megjelenites
		$('headerhir'+masodik).show();
		new Effect.Opacity('headerhir'+masodik, { duration: 1.0, from: 0.0, to: 1.0, afterFinish:function(){
			//$('headerhir'+masodik).hide();
		}  });
	}
});

var Hirek = new Hirek();
