jQuery(document).ready(function() {			
  // zajaxovani formularu (staci pridat class="ajax" a formular se odesle pres ajax)
  jQuery(function() {
    jQuery("form.ajax").livequery("submit", function() {
      jQuery(this).ajaxSubmit();
      return false;
    });
    jQuery(".ajax .paginator a").livequery("click", function() {
      jQuery.get(this.href);
      return false;
    });
    jQuery("a.ajax").livequery("click", function() {
      jQuery.get(this.href);
      return false;
    });
    jQuery(".ajax select.ajax").livequery("change", function() {
      jQuery(this.form).ajaxSubmit();
      return false;
    });
    // pro Nette formulare (Nette\Form)
    jQuery("form.ajaxAppForm :submit").livequery(function () {
          this.oldonclick = this.onclick;
          this.onclick = null;
          jQuery(this).click(function() {
                  if (jQuery.isFunction(this.oldonclick) && !this.oldonclick())
                          return false;
                  jQuery(this).ajaxSubmit();
                  return false;
          });
    }, function () {});
  });

  // ajax spinner
  jQuery(function() {
    jQuery('<div id="ajax-spinner"><span></span></div>').hide()
        .ajaxStart(function() {
          jQuery(this).show();
        }).ajaxStop(function() {
          jQuery(this).hide();
        }).appendTo("body");
  });

  jQuery('#ajax-spinner').css('opacity', '0.80');
/*
  jQuery(".flash").livequery(function() {
    var el = $(this);
    setTimeout(function() {
      el.animate( {
        "opacity" : 0
      }, 2000);
      el.slideUp();
    }, 15000);
  });
*/
  jQuery(".flash").livequery("click", function() {
    jQuery(this).hide();
  });

  jQuery(".fancybox").fancybox({});
});
