/*===globális változók===*/
var sliderPos = 0;
var slideShowInit;
var slidesNumber;
/*=======================*/
/**
  Szövegmezők alapértékeinek ki- bekapcsolgatása focus és blur eseményeknél
  @tfield - HTMLFormObject - a szövegmező melynek szövegét kapcsolgatni akarjuk (áltzalában 'this')
  @op - String - értéke 'show', ha be akrjuk kapcsolni (blur) az alapszöveget, 'hide' ha ki akarjuk kapcsolni (focus)
  @deftext - String - a mező alapérték (akár egy változó is lehet melyet JS-el töltünk fel)
*/
function handleTextField(tfield, op, deftext){
            switch(op){
		    case 'show' : if(tfield.value == '')
                                tfield.value=deftext;
		    break;
		    
                    case 'hide' : if(tfield.value == deftext)
				tfield.value='';
		    break;
	    }
        return true;
}

/**
 getElementsByClass
 thx: http://www.dustindiaz.com/getelementsbyclass
 
 @searchClass - String - CSS class ami szerint amellyel rendelkező elemeket gyűjtsön
 @node - HTML object - ha meg van adva csak azon az elemen belül keres, ha elhagyjuk az egész dokumentumban keres
 @tag - String - egy TAG-név, ha meg van adva csak az adott teget veszi figyelembe, elhagyva minden tagben keres
 @return - ObjectCollection - a searchClass class-al rendlekező és az egyéb megadott feltételeknek megfelelő elemek-et tartalmazó tömb
 */
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

/*
  Általános animációs osztály thx:http://www.dustindiaz.com/javascript-animate/
  működését lsd. slideUp() fv-ben
  * @constructor Animate
  * @param {HTMLElement} el the element we want to animate
  * @param {String} prop the CSS property we will be animating
  * @param {Object} opts a configuration object
  * object properties include
  * from {Int}
  * to {Int}
  * time {Int} time in milliseconds
  * callback {Function}
  */
function Animate(el, prop, opts) {
  this.el = el;
  this.prop = prop;
  this.from = opts.from;
  this.to = opts.to;
  this.time = opts.time;
  this.callback = opts.callback;
  this.animDiff = this.to - this.from;
}

/**
  * @private
  * @param {String} val the CSS value we will set on the property
  */
Animate.prototype._setStyle = function(val) {
  switch (this.prop) {
    case 'opacity':
      this.el.style[this.prop] = val;
      this.el.style.filter = 'alpha(opacity=' + val * 100 + ')';
      break;

    default:
      this.el.style[this.prop] = val + 'px';
      break;
  };
};

/**
  * @private
  * this is the tweening function
  */
Animate.prototype._animate = function() {
  var that = this;
  this.now = new Date();
  this.diff = this.now - this.startTime;

  if (this.diff > this.time) {
    this._setStyle(this.to);

    if (this.callback) {
      this.callback.call(this);
    }
    clearInterval(this.timer);
    return;
  }

  this.percentage = (Math.floor((this.diff / this.time) * 100) / 100);
  this.val = (this.animDiff * this.percentage) + this.from;
  this._setStyle(this.val);
};

/**
  * @public
  * begins the animation
  */
Animate.prototype.start = function() {
  var that = this;
  this.startTime = new Date();

  this.timer = setInterval(function() {
    that._animate.call(that);
  }, 4);
};

/**
  Animáltan fel- lenyitogat egy boxot
  @objId - String - annak a boxnak az ID-je amit ki-be akarunk nyitogatni
  függőség: slideUp();
*/
function animatedToggle(objId){
            obj = document.getElementById(objId);
            if(obj.style.display=='none'){
                slideDown(obj);
            }
            else{
                slideUp(obj);
            }
}

/**
  Animáltan becsuk egy boxot, az animateToggle() használja de meg lehet hívni önmagában is, ha csak becsukás kell.
  @obj - HTMLObject - amit be akarunk csukni
  függőség: Animate class
*/
function slideUp(obj){
            objHeight = obj.offsetHeight;
            new Animate(obj, 'height', {
                        from: objHeight,
                        to: 0,
                        time: 250,
                        callback: function(){
                            obj.style.display = 'none';
                            obj.style.height = '';
                        }
                      }).start();
}

/**
  Animáltan kinyit egy boxot, az animateToggle() használja de meg lehet hívni önmagában is, ha csak kinyitás kell.
  @obj - HTMLObject - amit ki akarunk nyitni
  függőség: Animate class
*/
function slideDown(obj){
            obj.style.visibility = 'hidden';
            obj.style.display = 'block';
            objHeight = obj.offsetHeight;
            new Animate(obj, 'height', {
                        from: 0,
                        to: objHeight,
                        time: 250,
                        callback: function(){
                            obj.style.visibility = 'visible';
                            obj.style.height = '';
                        }
                      }).start();
}

/**
  Select elem navigációs elemmé alakítása
  @el - object HTMLOptionElement - a kiválasztott opciólista elem
*/
function navigateTo(el){
            if(el.value){
                        document.location = el.value;            
            }
}

/**
  Emailek maszkolása spam robotok elől
  @mailDom - String - az email cím domain neve
  @mailName - String - a '@' előtti rész
  @mailTdl - String - a '@' utáni rész
  @el -String - link ID-je ahova a mail címet visszaírjuk 
*/
function writeMail(mailDom,mailName,mailTdl,el){
            var mailLink = document.getElementById(el);
            var emailFirstPart = mailName;
            var mailArr = ['mailto:','.'+mailTdl,mailDom,'@'];
            if(mailLink!==null && mailLink!==undefined){
                        mailLink.href = mailArr[0]+emailFirstPart+mailArr[3]+mailArr[2]+mailArr[1];
                        mailLink.innerHTML = emailFirstPart+mailArr[3]+mailArr[2]+mailArr[1];
            }
}

/**
  Animáltan megnöveli a kapcsolat oldalon található képet
*/
function growMap(){
            mapImg = document.getElementById('dtmMap');
            if(mapImg!==null && mapImg!==undefined){
                        if(mapImg.className!=='shadow'){
                                    mapImg.style.position = 'absolute';
                                    mapImg.style.top = '34px';                                    
                                    mapImg.style.right = '19px';                                    
                                    new Animate(mapImg,'width',{
                                                from : 196,
                                                to : 311,
                                                time : 250,
                                                callback : function(){
                                                            return true;
                                                            }
                                                }).start();
                                    
                                    new Animate(mapImg,'height',{
                                                from : 173,
                                                to : 285,
                                                time : 250,
                                                callback : function(){
                                                            mapImg.className = 'shadow';                                               
                                                            return true;
                                                            }
                                                }).start();
                        }
                        else{
                                    new Animate(mapImg,'width',{
                                                from : 311,
                                                to : 196,
                                                time : 250,
                                                callback : function(){
                                                            return true;
                                                            }
                                                }).start();
                                    
                                    new Animate(mapImg,'height',{
                                                from : 285,
                                                to : 173,
                                                time : 250,
                                                callback : function(){
                                                            mapImg.className = '';                                               
                                                            return true;
                                                            }
                                                }).start();
                                    mapImg.style.position = '';
                                    mapImg.style.top = '';                                    
                                    mapImg.style.right = ''; 
                        }
            }
            return false;
}
/**
  Ki- bekapcsolható smartlabel hozzáadása
  @textboxId - String - annak az input type text-nek vagy textarea-nak az ID-je amit smartlabellel akarunk ellátni
*/
function addSmartLabel(textboxId){
            textboxObj = document.getElementById(textboxId);

            if(textboxObj!==null || textboxObj!==undefined){
                        textboxObj.value=formDeftexts[textboxId];
            }
}

/**
  Kialakítja a főoldali banner-slideshowt
*/
function createSlideshow(){
            var slideShowNumber = getElementsByClass('slide',document.getElementById('slides'),'div').length;
            //alert(slideShowNumber);
            if(document.getElementById('slideshowFrame')!==null && document.getElementById('slides')!==null){
                   document.getElementById('slides').style.width = slideShowNumber*288+'px';     
            }
            
}

/**
  Főoldai hír-slideshow mozgatója
  @pos - Integer - ahányadik helyen van az elem 0-tól n-ig, n max=6
  @el - String - a címsorok listájában lévő A elem ID-je mely meghívja az fv-t
  @e - Object - ha kattintásra hívjuk meg egy A-n az értéke a default browser esemény objektum, ha máshogy hívjuk meg az fv-t, elhagyható
*/
function moveSlider(pos,el,clicked){
            var pagerItems = document.getElementById('slideShowPager').getElementsByTagName('a');
            function setPos(){
                        for(i=0;i<pagerItems.length;i++){
                                    pagerItems[i].className='';
                        }
                        el.className = 'activeSlide';
                        //alert(el.parentNode.className);
            }
            slideShow = document.getElementById('slides');
            //slideShow.style.marginLeft = -(pos*386)+'px'; 
            new Animate(slideShow, 'marginLeft', {
                        from: 0,
                        to: -(pos*288),
                        time: 250,
                        callback: setPos()
                      }).start();
            //document.getElementById('slideshowDebug').value = sliderPos;
            if(clicked){
                        el.className = 'activeSlide';
                        clearInterval(slideShowInit);
            }
}

/**
  meghívja a moveSlider-t és növeli a sliderPos globalt amíg el nem éri a slider végét
*/
function timedSlider(){
            sliderPos++;
            if(sliderPos==slidesNumber){
                        sliderPos = 0;
            }
            moveSlider(sliderPos,document.getElementById('pager'+sliderPos));
}

/**
 tab vezérlő függvény
 @tabChangerContId - String - a tab vezérlőket tartalmazó szülő elem ID-je
 @argMaxIndex - Integer - összesen ennyi tab van
 @argActualIndex - Integer - megjeleníteni kívánt tab sorszáma a tabsetben
*/
function showTab(tabChangerContId, argMaxIndex, argActualIndex){
	var linksObj = document.getElementById(tabChangerContId);
	var linkObj = false;
	var display =  'none';
	var blockObj;

	for (i=1;i<=argMaxIndex;i++){
		linkObj = document.getElementById('tabChange'+i);
		blockObj = document.getElementById('tab'+i);
		blockObj.style.display = 'none';
		/*megkeressük és kivonjuk az inact CLASS-t, hogy ne kelljen literálban visszaadni mindkét meglővé class-t*/
            to = linkObj.className.indexOf('activeTab');
            linkObj.className = linkObj.className.substring(0,to);
	}

	linkObj = document.getElementById('tabChange'+argActualIndex);
        linkObj.className+=" activeTab"

	blockObj = document.getElementById('tab'+argActualIndex);
	blockObj.style.display = 'block';

	linksObj.style.display = 'block';
        
        return false;
}

/**
  Kialakítja a tabstruktúrát, ráakaja az első/utolsó vezérlőelemekre a plussz CLASS-okat, display=none-ra rakja a dobozokat, kivéve az elsőt
  @tabContId - String - az egész tabsetet tartalmazó elem ID-je
  @tabCnagerContId - String - a tabokat tartalmazó elem ID-je 
*/
function createTabset(tabContId, tabChangerContId){
            tabs = getElementsByClass('tab',document.getElementById(tabChangerContId),'a');
            tabSlides = getElementsByClass('tabSlide',document.getElementById(tabContId),'div');
            tabEdges = getElementsByClass('tabEdge',document.getElementById(tabChangerContId),'span');
            if(document.getElementById(tabContId)!==null && document.getElementById(tabContId)!==undefined){
                        tabs[0].className += ' activeTab';
                        tabEdges[tabEdges.length-1].className += ' last';
                        tabSlides[0].style.display = 'block';
                        for(i=1;i<tabSlides.length;i++){
                                    tabSlides[i].style.display = 'none';
                        }
            }
}

//create onDomReady Event
window.onDomReady = DomReady;

//Setup the event
function DomReady(fn)
{
	//W3C
	if(document.addEventListener)
	{
		document.addEventListener("DOMContentLoaded", fn, false);
	}
	//IE
	else
	{
		document.onreadystatechange = function(){readyState(fn)}
	}
}

//IE execute function
function readyState(fn)
{
	//dom is ready for interaction
	if(document.readyState == "complete")
	{
		fn();
	}
}

window.onDomReady(onReady);

function onReady(){
            document.getElementById('rsmdtm').className+='js';
            createTabset('tabsetContainer', 'tabNavigation');
            createSlideshow();
            slidesNumber = getElementsByClass('slide').length;
            if(document.getElementById('slides')!==null && document.getElementById('slideshowFrame')!==null){
                 slideShowInit = setInterval('timedSlider()',4000);
            }
            
            var searchInput = document.getElementById('txbQuery');
            addSmartLabel('txbQuery');
            if(searchInput!==null || searchInput!==undefined){
              if(searchInput.addEventListener){
                  searchInput.addEventListener('focus',function(){handleTextField(this,'hide',formDeftexts.txbQuery)},false);
                  searchInput.addEventListener('blur',function(){handleTextField(this,'show',formDeftexts.txbQuery)},false);
              }
              else if(searchInput.attachEvent){
                  searchInput.attachEvent('onfocus',function(){handleTextField(searchInput,'hide',formDeftexts.txbQuery)});
                  searchInput.attachEvent('onblur',function(){handleTextField(searchInput,'show',formDeftexts.txbQuery)});
              }
              else{
                  searchInput.onfocus=function(){
                      handleTextField(this,'hide',formDeftexts.txbQuery);
                  }
                  searchInput.onblur=function(){
                      handleTextField(this,'show',formDeftexts.txbQuery);
                  }
              }
          }
//bannerek a főoldalon;
            rotateBanners('box1',1,2,0);
            rotateBanners('box2',1,2,0);
     
}

/**
	Az űrlap mezőinek kijelöléséhez szükséges függvények
function cssChange( hol, mire, inp )
{
	if( document.getElementById(inp+'_ch')==null )
		hol.className = mire;
}
function createDiv( mit, mire )
{
	var szulo = mit.offsetParent;
	if( document.getElementById(mit.name+'_child')==null )
		szulo.innerHTML += '<div class="hibe" id="'+mit.name+'_child" style="height: 0px;"><input type="hidden" id="'+mit.name+'_ch" class="null" /></div>';
	else
		document.getElementById(mit.name+'_child').innerHTML = '<input type="hidden" id="'+mit.name+'_ch" class="null" />';
	var os = szulo.offsetParent;
	if(os.nodeName=='TR')
		cssChange( os, mire, mit.name+'fix' );
	if(os.nodeName=='TABLE')
	{
		os = szulo.parentElement;
		cssChange( os, mire, mit.name+'fix' );
	}
}
function delDiv( mit, mire )
{
	if( document.getElementById(mit.name+'_child') )
		document.getElementById(mit.name+'_child').innerHTML = '';
	var szulo = mit.offsetParent;
	var os = szulo.offsetParent;
	if(os.nodeName=='TR')
		cssChange( os, mire, mit.name );
	if(os.nodeName=='TABLE'){
		os = szulo.parentElement;
		cssChange( os, mire, mit.name );
	}
}
*/

function restrictDefText(warningtext){
            query = document.getElementById('txbQuery').value;
            if(query===formDeftexts.txbQuery || query===''){
                        alert(warningtext);
                        return false;
            }
            else{
                        return true;
            }
}

/**
 *  Az események oldalon a regisztrációhoz kötött dokumentumelérés függvényei
 */  
var fieldsAreDisabled=false;
/**
	Beállítja a beviteli mez?k állapotát, hogy legyenek letiltva
	@argState	bool	A letiltás (true, false)
*/
function setFieldsToDisabled(argState)
{
	arrFields = document.f.elements;
    if (argState==false){
       document.getElementById('loaderAnim').style.display = 'none';
    }
	fieldsAreDisabled = argState;
	
	for (i=0;i<arrFields.length;i++){
		objField = arrFields[i];
		if (objField!==null) objField.disabled = argState;
	}
}
/**
 *	Elküldi a regisztráció formot
*/
function submitForm()
{
    document.getElementById('loaderAnim').style.display = 'block';
    document.f.submit();
	setFieldsToDisabled(true);
}
/**
	A megadott tartalommal frissíti a documentumokat
*/
function showDocuments()
{
	var arrBody = top.postiframe.document.getElementsByTagName('body');
	document.getElementById('documents_container').innerHTML = arrBody[0].innerHTML;
}
/**
    Hírlevél-regisztráció elküldése
*/
function sendNLRegistration()
{
    var objForm = document.getElementById('newsletter_registration');
    var result = saveForm(objForm.action, 'newsletter_registration', 'btnRegistration', 'loaderAnim');
    if (result){
        alert(result);
        document.getElementById('txbEmail').value = '';
        document.getElementById('txbName').value = '';
        document.getElementById('cbxType1').checked = false;
        document.getElementById('cbxType2').checked = false;
        document.getElementById('cbxType3').checked = false;
    }
    return false;
}

/**
    Ajánlatkérés elküldése
*/
function sendInquery()
{
    var objForm = document.getElementById('inqueryForm');
    saveForm(objForm.action, 'inqueryForm', 'btnSend', 'loaderAnim');
    return false;
}
/**
	Elmenti a form adatait Ajax POST-tal
	@argURL				string	POST cím
	@argFormContainer		string	A konténer neve, amiben a form elemei laknak
	@argButtonName		string	Megnyomott gomb neve. Nem kell, hogy létezzen, a lényeg, hogy ez bekerül a POST adatok közé is '1' értékkekl
	@argLoaderAnim		string	A várakozó animáció neve, amit be kell kapcsolni a POST alatt
*/
function saveForm(argURL,argFormContainer,argButtonName,argLoaderAnim)
{

	var arrInputs = document.getElementById(argFormContainer).getElementsByTagName('input');
	var arrSelects = document.getElementById(argFormContainer).getElementsByTagName('select');
	var arrTextAreas = document.getElementById(argFormContainer).getElementsByTagName('textarea');
	var loaderAnim = document.getElementById(argLoaderAnim);
	var button = document.getElementById(argButtonName);
	var returnResult = false;
	
	if (loaderAnim!=null) loaderAnim.style.display = 'block';
	if (button!=null) button.style.display = 'none';

	var parameters = argButtonName+'=1';
	for (i=0;i<arrInputs.length;i++){
		if (arrInputs[i].id != argButtonName ){
			type = arrInputs[i].type.toLowerCase();
			if ((type == 'checkbox') && (arrInputs[i].checked==true)) parameters+= '&'+arrInputs[i].id+'='+escape(arrInputs[i].value);
			else if ((type == 'checkbox') && (arrInputs[i].checked==false)) parameters+= '&'+arrInputs[i].id+'='; 	
			else if (type == 'text') parameters+= '&'+arrInputs[i].id+'='+escape(arrInputs[i].value);
			else if (type == 'textarea') parameters+= '&'+arrInputs[i].id+'='+escape(arrInputs[i].value);
			else if (type == 'password') parameters+= '&'+arrInputs[i].id+'='+escape(arrInputs[i].value);
			else if (type == 'hidden') parameters+= '&'+arrInputs[i].id+'='+escape(arrInputs[i].value);
		}
	}
	for (i=0;i<arrSelects.length;i++){
		if (arrSelects[i].selectedIndex!=undefined)
			parameters+= '&'+arrSelects[i].id+'='+escape(arrSelects[i].options[arrSelects[i].selectedIndex].value);
		arrSelects[i].disabled = true;
	}
        
	for (i=0;i<arrTextAreas.length;i++){
		parameters+= '&'+arrTextAreas[i].id+'='+escape(arrTextAreas[i].value);
		arrTextAreas[i].disabled = true;
	}

    if (parameters!='') parameters+='&';
    else parameters+='?';
    parameters+='ajaxRequest=1';
    client = new HttpClient();
    client.requestType = 'POST';
    client.callback = function(){};
    result = client.makeRequest(argURL, parameters, null);

	if (result){
		arrResult = result.split("\n");
		if (arrResult[0] == 'error') alert (arrResult[1]);
		else if (arrResult[0] == 'succeedWithMessage'){
            returnResult = arrResult[1];
		}
		else if (arrResult[0] == 'succeedWithId'){
			returnResult = arrResult[1];
		}
		else if (arrResult[0] == 'succeedWithURL'){
			window.location.href = arrResult[1];
            returnResult = true;
		}
		else if (arrResult[0] == 'succeed') returnResult = true;
		else alert(result);
	}

	for (i=0;i<arrInputs.length;i++) arrInputs[i].disabled = false;
	for (i=0;i<arrSelects.length;i++) arrSelects[i].disabled = false;
	for (i=0;i<arrTextAreas.length;i++) arrTextAreas[i].disabled = false;
	if (loaderAnim!=null) loaderAnim.style.display = 'none';
	if (button!=null) button.style.display = 'block';

	return returnResult;
}
/**
 *AJAX kérésekhez
 */
function HttpClient(){}
HttpClient.prototype = {
 requestType: 'GET',
 isAsync: false,
 xmlhttp: false,
 callback: false,
 /**
   Az ajax hivas elkuldesekor vegrehajtando tevekenyseg
   @divid          string         annak a layer-nek az azonositoja ahova a vegeredmeny kerul
 */
 onSend: function(divid){
   if( divid ){
     document.getElementById(divid).innerHTML = "<br /><span style='margin:0px 0px 0px 10px;background:#ffffff;'>Adatfeldolgozás...</span>";
   }
 },
 /**
   Az ajax hivas betoltodesekor vegrehajtando tevekenyseg
   @divid          string         annak a layer-nek az azonositoja ahova a vegeredmeny kerul
 */
 onLoad: function(divid){
   if( divid ){
     document.getElementById(divid).innerHTML = "<br /><span style='margin:0px 0px 0px 10px;background:#ffffff;'>Kész</span>";
   }
 },
 /**
   Hiba eseten vegrehajtando tevekenyseg
   @error          string         annak a layer-nek az azonositoja ahova a vegeredmeny kerul
 */
 onError: function(error){ alert(error);
 },
 /**
   Az ajax hivas inicializalasa
 */
 init: function(){
  try{
   this.xmlhttp=new XMLHttpRequest();
  }
  catch(e){
   var xmlhttp_ids = new Array('MSXML2.XMLHTTP.5.0',
             'MSXML2.XMLHTTP.4.0',
             'MSXML2.XMLHTTP.3.0',
             'MSXML2.XMLHTTP',
             'Microsoft.XMLHTTP');
   var success = false;
   for(var i = 0;i < xmlhttp_ids.length && !success; i++){
    try{
     this.xmlhttp = new ActiveXObject(xmlhttp_ids[i]);
     success = true;
    }
    catch (e){}
   }
   if(!success){
    this.onError('XMLHttpRequest is failed.');
   }
  }
 },
 /**
   Az ajax hivas kezdemenyezese
   @url            string         a fogado script url-je, ahol a feldolgozas tortenik
   @payload        string         ha a request tipusa post, akkor ez tartalmazza a post parametereket
   @divid          string         annak a layer-nek az azonositoja ahova a vegeredmeny kerul
   @return         string         ha nem aszinkron volt a hivas, akkor az eredmeny itt tarolodik
 */
 makeRequest: function(url,payload,divid){
  
  if(!this.xmlhttp){
   this.init();
  }
  this.xmlhttp.open(this.requestType,url,this.isAsync);
  if(this.requestType == 'POST'){
   this.xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded;charset=ISO-8859-2');
  }
  this.xmlhttp.onreadystatechange = function(){
   self._readyStateChangeCallback(divid);
  }
  var self=this;
  this.xmlhttp.send(payload);
  if( !this.isAsync ){
   return this.xmlhttp.responseText;
  }
 },
 /**
   Az ajax hivas visszateresenek lekezelese
   @divid          string         annak a layer-nek az azonositoja ahova a vegeredmeny kerul
 */
 _readyStateChangeCallback: function(divid){
  switch(this.xmlhttp.readyState){
   case 0:
   case 1:
   case 2:
    this.onSend(divid);
   break;
   case 4:
    this.onLoad(divid);
    if( this.xmlhttp.status == 200 ){
     this.callback(this.xmlhttp.responseText);
    }
    else {
     this.onError('HTTP error during the request: ['+this.xmlhttp.status+'] '+this.xmlhttp.statusText);
    }
   break;
  }
  return false;
 }
}
/**
 *  Elindítja a főoldal jobb hasábjában lévő banner rotálást
 *  @argBoxName      string      Box neve
 *  @argPrevIndex    int         Előző banner index
 *  @argNextIndex    int         Következő banner index
 *  @argAnimStep     int        Animáció lépés állapota 1-5
 */
function rotateBanners(argBoxName, argPrevIndex, argNextIndex, argAnimStep)
{
    var nextObj = document.getElementById(argBoxName+'_'+argNextIndex);
    var prevObj = document.getElementById(argBoxName+'_'+argPrevIndex);
    if ((prevObj==null) || (nextObj==null)) return false;

    if (argAnimStep==0){
        prevObj.style.filter  = "alpha(opacity=100)";
        prevObj.style.opacity = 1;
        prevObj.style.zIndex = 5;
        prevObj.style.display = 'block';
    }

    nextObj.style.zIndex = 10;
    nextObj.style.filter  = "alpha(opacity=" + (100*(0.2*argAnimStep)) + ")";
    nextObj.style.opacity = (0.2*argAnimStep);
    nextObj.style.display = 'block';

    if (argAnimStep<5) setTimeout(function(){rotateBanners(argBoxName, argPrevIndex, argNextIndex, argAnimStep+1);}, 40);
    else{
        prevObj.style.display = 'none';
        if (document.getElementById(argBoxName+'_'+(parseInt(argNextIndex)+1)) == null) nextIndex = 1;
        else nextIndex = parseInt(argNextIndex)+1;
        setTimeout("rotateBanners('"+argBoxName+"', '"+argNextIndex+"', '"+nextIndex+"', 0)", 5000);
    }
}

