var rovidhirslide = new Class(
{
   Implements : [Options, Events, Chain], options :
   {
      mire : 1, kint : true, maxsz : 3, aktsl : 1, mittuntetunkel : "hirecskekc", control1 : "hirecskekvissza", control2 : "hirecskekelore"
   }
   , initialize : function(options)
   {
      this.setOptions(options);
      $("hirecskekc").addEvent("mouseenter", function()
      {
         $clear(this.timer);
         this.kint = false
      }
      .bind(this));
      $("hirecskekc").addEvent("mouseleave", function()
      {
         this.kint = true;
         $clear(this.timer);
         this.timer = this.autovalt.delay(12000, this)
      }
      .bind(this));
      $("hirecskekvissza").addEvent("click", function()
      {
         $clear(this.timer);
         this.clearChain();
         this.valtvissza()
      }
      .bind(this));
      $("hirecskekelore").addEvent("click", function()
      {
         $clear(this.timer);
         this.clearChain();
         this.valtelore()
      }
      .bind(this));
      this.mire = this.options.mire;
      this.kint = this.options.kint;
      this.maxsz = this.options.maxsz;
      this.aktsl = this.options.aktsl;
      this.hirecskekslide = new Fx.Slide("hirecskecontainer",
      {
         link : "ignore", onComplete : function()
         {
            this.callChain()
         }
         .bind(this), delay : 1000, mode : "horizontal", open : false
      }
      );
      this.timer = this.autovalt.delay(12000, this)
   }
   , autovalt : function()
   {
      if(this.kint == true)
      {
         if(this.mire == this.maxsz)
         {
            this.mire = 1
         }
         else
         {
            this.mire ++
         }
         this.callChain();
         this.clearChain();
         this.mehet()
      }
   }
   , valtelore : function()
   {
      if(this.mire == this.maxsz)
      {
         this.mire = 1
      }
      else
      {
         this.mire ++
      }
      this.callChain();
      this.clearChain();
      this.mehet()
   }
   , valtvissza : function()
   {
      if(this.mire == 1)
      {
         this.mire = this.maxsz
      }
      else
      {
         this.mire --
      }
      this.callChain();
      this.clearChain();
      this.mehet()
   }
   , mehet : function()
   {
      this.chain(function()
      {
         this.hirecskekslide.slideOut()
      }
      , function()
      {
         this.cserel()
      }
      , function()
      {
         this.hirecskekslide.slideIn()
      }
      , function()
      {
         this.timer = this.autovalt.delay(12000, this)
      }
      );
      this.callChain()
   }
   , cserel : function()
   {
      $$("div.rh" + this.aktsl).each(function(a)
      {
         a.set("styles",
         {
            display : "none"
         }
         )
      }
      , this);
      $$("div.rh" + this.mire).each(function(a)
      {
         a.set("styles",
         {
            display : "block"
         }
         )
      }
      , this);
      this.aktsl = this.mire;
      this.callChain()
   }
}
);
var kioszthirecskeslide = function()
{
   var maxsz = $("maxhirecskeslide").value;
   maxy = 0;
   for(i = 1; i < 1 + maxsz; i ++ )
   {
      sumy = 0;
      $$("div.rh" + i).each(function(a)
      {
         var size = a.getSize();
         sumy += size.y
      }
      );
      if(sumy > maxy)
      {
         maxy = sumy
      }
   }
   maxy += 20;
   $("hirecskecontainer").set("styles",
   {
      height : maxy
   }
   );
   for(i = 2; i < 1 + maxsz; i ++ )
   {
      $$("div.rh" + i).each(function(a)
      {
         a.set("styles",
         {
            display : "none"
         }
         )
      }
      )
   }
   var ujrovidhir = new rovidhirslide(
   {
      maxsz : maxsz
   }
   )
}
;
window.addEvent("domready", function()
{
   kioszthirecskeslide()
}
);
