
function init_menu() {
  var table = document.getElementById('menu');
  var tds  =  table.getElementsByTagName('td');
  for(var i = 0; i < tds.length; i++) {
    tds[i].onmouseover = function() {
      this.style.background = 'url("image/top52.gif") no-repeat';
    }
    tds[i].onmouseout  = function() {
      this.style.background = 'url("image/top5.gif") no-repeat';
    }
    tds[i].style.cursor = 'pointer';
    tds[i].onclick  = function() {
      var as  =  this.getElementsByTagName('a');
      document.location.href = as[0].href;
    }
  }
}

function init_prog() {
  var table = document.getElementById('prog');
  var tds  =  table.getElementsByTagName('td');
  for(var i = 0; i < tds.length; i++) {
    tds[i].onmouseover = i % 2 ? function() {
      this.style.background = 'url("image/top62.gif") repeat-x';
      var e = this.parentNode.getElementsByTagName('td');
      e[0].style.background = 'url("image/top72.gif") no-repeat';
    } : function() {
      this.style.background = 'url("image/top72.gif") no-repeat';
      var e = this.parentNode.getElementsByTagName('td');
      e[1].style.background = 'url("image/top62.gif") repeat-x';
    }
    tds[i].onmouseout  = i % 2 ? function() {
      this.style.background = 'url("image/top6.gif") repeat-x';
      var e = this.parentNode.getElementsByTagName('td');
      e[0].style.background = 'url("image/top7.gif") no-repeat';
    } : function() {
      this.style.background = 'url("image/top7.gif") no-repeat';
      var e = this.parentNode.getElementsByTagName('td');
      e[1].style.background = 'url("image/top6.gif") repeat-x';
    }
    tds[i].style.cursor = 'pointer';
    tds[i].onclick = i % 2 ? function() {
      var e = this.parentNode.getElementsByTagName('td');
      var as =  e[0].getElementsByTagName('a');
      document.location.href = as[0].href;
    } : function() {
      var as =  this.getElementsByTagName('a');
      document.location.href = as[0].href;
    }
  }
}

function init_kategory() {
  var table = document.getElementById('thekategory');
  var tds  =  table.getElementsByTagName('td');
  for(var i = 0; i < tds.length; i++) if(tds[i].className == 'kaqq') {
    tds[i].onmouseover = function() {
      this.style.background = 'url("image/top82.gif") no-repeat';
    }
    tds[i].onmouseout  = function() {
      this.style.background = 'url("image/top8.gif") no-repeat';
    }
    tds[i].style.cursor = 'pointer';
    tds[i].onclick  = function() {
      var as  =  this.getElementsByTagName('a');
      document.location.href = as[0].href;
    }
  }
}

function pollAction()
{
  var el = $('poll');
  var it = el.getElementsByTagName('input');
  var id = '';
  for(var i = 0; i < it.length; i++) if(it[i].checked) id = it[i].id;
  if(id) {
    new Ajax.Updater(
      'poll',
      'main/poll.php',
      { method: 'get',
        parameters: 'vote_id=' + id
      }
    );
  }
}

function init_poll() {
  var table = document.getElementById('poll');
  var tds  =  table.getElementsByTagName('input');
  for(var i = 0; i < tds.length; i++) tds[i].onclick  = pollAction;
}

window.onload = myclock;
function myclock()
{
  var div = document.getElementById('clocks');
  var span = div.getElementsByTagName('span');
  var dateObj = new Date();
  span[0].innerHTML = dateObj.getHours() < 10 ? '0' + dateObj.getHours() : dateObj.getHours();
  span[1].innerHTML = dateObj.getMinutes() < 10 ? '0' + dateObj.getMinutes() : dateObj.getMinutes();
  span[2].innerHTML = dateObj.getSeconds() < 10 ? '0' + dateObj.getSeconds() : dateObj.getSeconds();
  setTimeout("myclock()", 1000);
}

