var focikkslide=new Class({
	Implements:[Options,Events,Chain],
	options:{
		mire : 1,
		kint : true,
		maxsz : 4,
		aktsl : 1,
		mittuntetunkel : 'hirecskekc',
		control1 : 'hirecskekvissza',
		control2 : 'hirecskekelore'
	},
	initialize: function(options){
			this.setOptions(options);
			$('cikkekfentcc').addEvent('mouseenter',function()
									{
									$clear(this.timer);
									this.kint=false;
									}.bind(this));
			$('cikkekfentcc').addEvent('mouseleave',function()
									{
									this.kint=true;
									$clear(this.timer);
									}.bind(this));			
			this.mire = this.options.mire;
			this.kint = this.options.kint;
			this.maxsz = this.options.maxsz;
			this.aktsl = this.options.aktsl;

			this.hirecskekslide2 = new Fx.Tween('cikkekfentkepekc', {link:'ignore',onComplete: function() { this.callChain();}.bind(this),duration:1000});
	},
	autovalt2:function(){
				if (this.kint==true)
				{
				if (this.mire==this.maxsz) {this.mire=1;}
				else
					{
					this.mire++;
					}
				this.callChain();
				this.clearChain();
				this.mehet2();
				}
	},
	valterre2:function(szam){
				this.mire=szam;
				this.callChain();
				this.clearChain();
				this.mehet2();
	},
	valtelore2:function(){
				if (this.mire==this.maxsz) {this.mire=1;}
				else
					{
					this.mire++;
					}
				this.callChain();
				this.clearChain();
				this.mehet2();
	},
	valtvissza2:function(){
				if (this.mire==1) {this.mire=this.maxsz;}
				else
					{
					this.mire--;
					}
				this.callChain();
				this.clearChain();
				this.mehet2();
	},
	mehet2:function(){
			this.chain(
				function(){this.hirecskekslide2.start('opacity','0')},
				function(){
						$('rs'+this.aktsl).removeClass('aktiv');
						$('rs'+this.aktsl).getChildren().each(function(a) {a.set('style','background-color:transparent');})
						$('rs'+this.mire).addClass('aktiv');
						$('rs'+this.mire).getChildren().each(function(a) {a.set('style','background-color:white');})
						
						this.callChain();
						},
				function(){this.cserel2()},
				function(){this.hirecskekslide2.start('opacity','1')}
				);
			this.callChain();
	},
	cserel2:function(){
			$$('div#cikkekfentkepekc div#rimg'+this.aktsl).each(function(a){a.set('styles', {
				    'display': 'none'
				    });
				},this);

			$$('div#cikkekfentkepekc div#rimg'+this.mire).each(function(a){a.set('styles', {
				    'display': 'block'
				    });
				},this);
			this.aktsl=this.mire;
			this.callChain();
	}
	
});

var kiosztfocikkslide = function(){
	var maxsz = $('maxcimlap').value;
	focikkslider= new focikkslide({'maxsz':maxsz});
	$$('.hirc').each(function(a){a.addEvent('mouseenter',function(a){
								var szam=this.getProperty('rel');
								$clear(focikkslider.timer);
								focikkslider.clearChain();
								focikkslider.valterre2(szam);})});
	$$('div.cikkekfentszoveg').each(function(a){
					size=a.getSize();
					});
	maxy=eval(size.y+10);
	if (maxy>355)
		{
		$$('.focikkek').each(function(a){a.set('styles',{'height':maxy})});
		}
	}

window.addEvent('domready',function(){kiosztfocikkslide();});

