// JavaScript Document

$(function(){
    

    $("#navigation ul li a").mouseup(function(){
        $(this).parent().removeClass("click-li");
    }).mousedown(function(){
        $(this).parent().addClass("click-li");
    });

    $("input.form-submit").hover(
        function(){ $(this).addClass("form-submit-hover"); },
        function(){ $(this).removeClass("form-submit-hover"); }
    );

    $(".left-menu ul li a").hover(
        function(){ $(this).parent().addClass("li-hover"); },
        function(){ $(this).parent().removeClass("li-hover"); }
    );
    $(".left-menu h4 a").hover(
        function(){ $(this).parent().addClass("h-hover"); },
        function(){ $(this).parent().removeClass("h-hover"); }
    );

    setTimeout(function(){
      $(".block-product .product .product_desc").equalize({step:3});
      $(".block-product .product").equalize({step:3});
      $(".fixedwidth li").equalize({step:4});
    }, 300);

    $("input.datepicker").parent().addClass("datepicker-wraper");

    $(".datepicker").datepicker({dateFormat: 'dd/mm/yy'});
    
/*
    $(".tabs-menu-block .blocks .blocks-inner .items-ui ul li .pic img").each(function(){
        var eventI = $(this).height();
        var eventB = (122 - eventI) / 2;
        $(this).css("top", eventB + "px");
    });
*/    

    $("#imageSearch").autocomplete(baseUrl + "/search/autocomplete?req=ajax", {//request adress
        width: 320,
        max: 10,
        highlight: false,
        scroll: true,
        scrollHeight: 130,
        formatItem: function(data, i, n, value) {//content autocomplete
            var itemW =    '<div><a style="color:{/literal}{$menuBackgroundColor}{literal};" href="'+value.url+'"><div style="float:left; width:60px;"><img src="' +
            value.image_file +
            '" style="width:60px;height:60px;" /></div>\n\ <div style="float:right;width:230px;height:60px;"><b style="color:{/literal}{$menuSecondaryColor}{literal};">' +
            value.name +
            '</b><br >' +
            value.description +
            '...';
            itemW += '</div></a></div>';
            return itemW;
        },
        formatResult: function(data, value) {
            return value.name;//content selected autocomplete
        }
    });

    $('.select_states').bind('mouseenter', function(){
        $('.dropdown-menu.state').addClass("show");
    });
    $('.dropdown').bind('mouseleave', function(){
        $('.dropdown-menu.state').removeClass("show");
    });

});
