$(document).ready(function(){ 
  
  $("#taby").tabs();
  
  /* leve menu - aktivni kategorie */
  
  $('ul.hoverMenu li a.active').parent().children('ul').show().parent('li').addClass('active-submenu');
  $('ul.submenu a.active').parent().parent().show().parent('li').addClass('active-submenu');
  //$('ul.dropdownmenu li.active').children('ul').show();
  $('ul.dropdownmenu ul.dropdownmenu li.active').parent('ul').show().parent().addClass('active-dropdownmenu');
  
  
  /* -------------- leve menu */
  
  
   $(document).pngFix();
    $('a.lightbox, a.picture').lightBox({
     fixedNavigation:true,
     imageLoading: '/repository/js/lightbox/images/lightbox-ico-loading2.gif',
     imageBtnClose: '/repository/js/lightbox/images/lightbox-btn-close.gif',
     imageBtnPrev: '/repository/js/lightbox/images/lightbox-btn-prev.gif',
     imageBtnNext: '/repository/js/lightbox/images/lightbox-btn-next.gif'
    });
   
   var boxLink = $(".box-new-model p a").attr("href");
   if(boxLink != undefined){
      
   }
       
  $('div.box-new-model img').click(function () {
    var url = $(this).parent("p").children("a").attr("href");
    if (url) {
      window.location = url;
    }
  });
    
  $('div.box-new-model').click(function () {
    var url = $(this).children("p").children("a").attr("href");
    if (url) {
      window.location = url;
    }
  });
  
  var detailImgAlt = $("#slideshow img").attr('alt');
  if(detailImgAlt == undefined){
    $("#foto").css("display", "none");
    $("#popis").css("margin-left", "30px");
  }
  
  $('.novinka_detail img').each(function() {
      var fl = $(this).css('float');
      if (fl == 'left')
      {
          $(this).css('margin-left', 0);
      } else if (fl == 'right')
      {
          $(this).css('margin-right', 0);
      }
  });
  
  /* ZMIZENI TEXTU PO KLIKU NA INPUT NEWSLETTER */

    $('input[placeholder]').click(function() {
        $this = $(this);

        if ($this.val() == $this.attr('placeholder'))
        {
            $this.val('');
        }
    });

    $('input[placeholder]').blur(function() {
        $this = $(this);

        if ($this.val() == '')
        {
            $this.val($this.attr('placeholder'));
        }
    });
    
    $("#non-external").removeClass('external').removeClass('popup');

    if ($('#popis').length){

      $('#popis li').each(function() {
          var li = $(this);
          if (li.text().length == 0){
            if (li.parent().children().length == 1){
              li.parent().hide();
            }
            else {
              li.hide();
            }
          }
      });

    }
  
}); 
