<!--

 addEvent(window,'load',initCommutation);

var commutable=new Array();
function initCommutation() {
  if(document.getElementById('contCommutable')) {
    var div=document.getElementById('contCommutable').getElementsByTagName('div');
    var id=0;
    for (var i=0;i<div.length;i++) {
      if (div[i].className.indexOf('box')>=0) {
        if (!div[i].getAttribute('id')) {
          div[i].setAttribute('id','comm'+id);
          id++;
        }
        commutable.push(div[i].getAttribute('id'));

        if (commutable.length>1) hideBox(commutable[commutable.length-1]);
      }
    }
  }
  //alert(commutable.toString());
}
function moveToPosition(go,abs,div) {
  oldPos=getPos(div);
  newPos=abs?go:oldPos+go;
  //printfire(oldPos+'|'+newPos);
  //alert(commutable.toString());
  //alert(oldPos+'|'+newPos);
  if (newPos>=0 && newPos<commutable.length && newPos!=oldPos) {
    var childs=new Array();
    for (var i=newPos>oldPos?oldPos:newPos;i<commutable.length;i++) {
      //alert('elem ('+commutable[i]+'): '+(document.getElementById(commutable[i])?'van':'nincs'));
      try {
        child=document.getElementById('contCommutable').removeChild(document.getElementById(commutable[i]));
      }
      catch (hiba) {
        //alert('removechild ('+commutable[i]+'): '+hiba.name+ ':'+hiba.message);
      }
      try {
        childs.push(child);
      }
      catch(hiba) {
        //alert('push ('+commutable[i]+'): '+hiba.name+ ':'+hiba.message);
      }
    }
    var order=0;
    for (var i=0;i<childs.length;i++) {
      //printfire(commutable.toString());
      if (oldPos>newPos && !i) makeCommChild(childs[oldPos-newPos]);
      if (oldPos>newPos && i!=oldPos-newPos) makeCommChild(childs[i]);
      if (oldPos<newPos && i) makeCommChild(childs[i]);
      if (oldPos<newPos && i==newPos-oldPos) makeCommChild(childs[0]);
    }
  }
  showBox(div);
}
function showBox(id) {
  if (document.getElementById(id).style.display!='block') {
    document.getElementById(id).style.display='block';
  }
}
function hideBox(id) {
  if (document.getElementById(id).style.display!='none') {
    document.getElementById(id).style.display='none';
  }
}
function getPos(id) {
  for (var i=0;i<commutable.length;i++) {
    if (commutable[i]==id) {
      return i;
    }
  }
}
function makeCommChild(child) {
  document.getElementById('contCommutable').appendChild(child);
  setLastId(child.getAttribute('id'));
}
function setLastId(id) {
  commutable[getElementsByClassName(document.getElementById('contCommutable'),'div','box').length-1]=id;
}
function getElementsByClassName(oElm,strTagName,strClassName) {
  /*
    Written by Jonathan Snook, http://www.snook.ca/jonathan
    Add-ons by Robert Nyman, http://www.robertnyman.com
  */
  var arrElements=(strTagName=='*' && document.all)?document.all:oElm.getElementsByTagName(strTagName);
  var arrReturnElements=new Array();
  strClassName=strClassName.replace(/\-/g,'\\-');
  var oRegExp=new RegExp('(^|\\s)'+strClassName+'(\\s|$)');
  var oElement;
  for(var i=0;i<arrElements.length;i++) {
    oElement=arrElements[i];      
    if(oRegExp.test(oElement.className)) {
      arrReturnElements.push(oElement);
    }   
  }
  return arrReturnElements;
}
// firefox debug
function printfire() {
  if (document.createEvent) {
    printfire.args=arguments;
    var ev=document.createEvent('Events');
    ev.initEvent('printfire', false, true);
    dispatchEvent(ev);
  }
}
-->