function showNewsGroup(count,row) {
  var node = document.getElementById(newsGroupItems[count]['ID']);
  for(var i=0; i<node.getElementsByTagName('div').length; ++i) {
    if(row*3 <= i && i <= row*3+2) {
      showElement( node.getElementsByTagName('div')[i] );
    } else {
      hideElement( node.getElementsByTagName('div')[i] );
    }
  }
  for(var i=0; i<node.getElementsByTagName('div').length/3; ++i) {
    if (document.getElementById(newsGroupItems[count]['ID']+'_pager') != null) {
        if (document.getElementById(newsGroupItems[count]['ID']+'_pager').getElementsByTagName('input')[i] != null) {
    if(i == row) {
      document.getElementById(newsGroupItems[count]['ID']+'_pager').getElementsByTagName('input')[i].src = 'fileadmin/templates/activeCar.gif';
      newsGroupItems[count]['row'] = row;
    } else {
      document.getElementById(newsGroupItems[count]['ID']+'_pager').getElementsByTagName('input')[i].src = 'fileadmin/templates/inactiveCar.gif';
    }
    }
  }
  }
}
function showNewsGroupLeft(count) {
  if(newsGroupItems[count]['row']-1 >= 0) {
    showNewsGroup(count,newsGroupItems[count]['row']-1);
  }
}
function showNewsGroupRight(count) {
  var node = document.getElementById(newsGroupItems[count]['ID']);
  if(newsGroupItems[count]['row']+1 < node.getElementsByTagName('div').length/3) {
    showNewsGroup(count,newsGroupItems[count]['row']+1);
  }
}
function createNewsGroupMenu(count) {
  if( newsGroupItems[count] && document.getElementById(newsGroupItems[count]['ID']).getElementsByTagName('div').length > 3) {
    var inputNode;
    var attribute;

    for(var i=0; i<document.getElementById(newsGroupItems[count]['ID']).getElementsByTagName('div').length/3; ++i) {
      inputNode = document.createElement('input');
      inputNode.className = 'padding';
      inputNode.src = 'fileadmin/templates/inactiveCar.gif';
      inputNode.alt = 'Blättern';
      attribute = document.createAttribute('type');
      attribute.nodeValue = 'image';
      inputNode.setAttributeNode(attribute);
      attribute = document.createAttribute('onclick');
      attribute.nodeValue = 'showNewsGroup('+count+','+i+')';
      inputNode.setAttributeNode(attribute);
      document.getElementById(newsGroupItems[count]['ID']+'_pager').appendChild(inputNode);
    }

    inputNode = document.createElement('input');
    inputNode.src = 'fileadmin/templates/backward.gif';
    inputNode.alt = 'Zurück blättern';
    attribute = document.createAttribute('type');
    attribute.nodeValue = 'image';
    inputNode.setAttributeNode(attribute);
    attribute = document.createAttribute('onclick');
    attribute.nodeValue = 'showNewsGroupLeft('+count+')';
    inputNode.setAttributeNode(attribute);
    document.getElementById(newsGroupItems[count]['ID']+'_pager').appendChild(inputNode);

    inputNode = document.createElement('input');
    inputNode.src = 'fileadmin/templates/forward.gif';
    inputNode.alt = 'Vorwärts blättern';
    attribute = document.createAttribute('type');
    attribute.nodeValue = 'image';
    inputNode.setAttributeNode(attribute);
    attribute = document.createAttribute('onclick');
    attribute.nodeValue = 'showNewsGroupRight('+count+')';
    inputNode.setAttributeNode(attribute);
    document.getElementById(newsGroupItems[count]['ID']+'_pager').appendChild(inputNode);
  }
}
