$(document).ready(function() {
    $("button.black").hover(
      function () {
        $(this).toggleClass("hover");
      },
      function () {
        $(this).toggleClass("hover");
      }
    )

    $("#in_search_2").focus(function () {
        $("#tooltip-1").show();
    });
    $("#in_search_2").blur(function () {
        $("#tooltip-1").hide();
    });

    $("#color-checkboxes label").focus(function () {
        $("#tooltip-2").show();
    });
    $("#color-checkboxes input").focus(function () {
        $("#tooltip-2").show();
    });
    $("#color-checkboxes label").blur(function () {
        $("#tooltip-2").hide();
    });
    $("#color-checkboxes input").blur(function () {
        $("#tooltip-2").hide();
    });
    $("div.show-advanced a").click(function () {
        $("div.show-advanced").hide();
        $("div.advanced").show();
        return false;
    });

    $("#advanced_submit").click(function () {
        $("#simple_form").val("0");
    });

    // dynamické zobrazování náhledů obrázků u menu kategorií
    $(".treeview li a.cat_title").hover(
      function (f_in) {
        var id_cat = $(this).parents("li").attr("id")

        // bez této deklarace skript respektive fce .hover() funguje špatně
        var x = f_in.pageX + 50
        var y = f_in.pageY

        // css styly
        var cssObj = {
          'left' :  x + "px",
          'top' : y + "px"
        }

        $("#img_" + id_cat).css(cssObj).fadeIn(200)
      },
      function (f_out) {
        var id_cat = $(this).parents("li").attr("id")
        $("#img_" + id_cat).fadeOut(200)
      }
    );

});

