$(document).ready(function(){
  $(".w3-jshow").show();
  $(".w3-jhide").hide();
  $(".w3-jshowclass").click(function() {
    id = "."+$(this).attr("rel");
    $(id).show();
  });
  $(".w3-jhideclass").click(function() {
    id = "."+$(this).attr("rel");
    $(id).hide();
  });
  $(".w3-close").live("click",function() {
    $(this).parent().hide();
  });
  $("li:has(ul)").hover(
    function() {
      $(this).children("ul").stop(1,1);
      $(this).children("ul").show();
    },
    function() {
      $(this).children("ul").stop(1,1);
      $(this).children("ul").hide();
  });
  $(".kom-name, .kom-message").focus(
    function() {
      $(this).val('')
    });
  $(".kom-addw").submit(function() {
    name = $(this).children('.kom-name').val();
    text = $(this).children('.kom-message').val();
    if(name == '' || text == '' || name == 'meno' || text == 'komentár') {
      alert('Prosím vyplňte všetky polia');
      return false;
    }
  });
  $('.showcomments').click(function() {
    id = $(this).attr('id');
    id = '.comment-'+id;
    $(id).fadeIn();
    $(this).hide();
  });
  $('#menu li[class!=active]').hover(
    function() {
      id = $(this).attr('id');
      imageactive = '/images/menu-active-'+id+'.png';
      image = '/images/menu-'+id+'.png';
      id = '#img-'+id;
      $(id).attr('src',imageactive);
      $(this).addClass('active');
    },function() {
      $(id).attr('src',image);
      $(this).removeClass('active');
    });
});