  $(document).ready(function () {
    
    // boxy s class = selectable meni tridu pri najeti mysi (.selectedBox v our-style.css)
    // pri kliknuti se zmeni URL na hodnotu atributu "href" prvniho odkazu v boxu
    $('.selectable').mouseover(function (){
      $(this).toggleClass('selectedBox').css('cursor', 'pointer');                                        
    })
    .mouseout(function() {
      $(this).toggleClass('selectedBox');
    })
    .click(function(event) {
      
      event.preventDefault();
      var redir = null;
      if (event.target.tagName == 'IMG') {
        if (event.target.parentNode.tagName == 'A') redir = event.target.parentNode.href;
      }
      
      if (redir == null) {
        $(this).find('a:first').each(function () {
          window.location = $(this).attr('href');
        });
      } else {
        window.location = redir;
      }
    });
  });
