$(document).ready(function(){
    
    //lazyload
    $(".productImg img").lazyload({ 
        placeholder : "/img/others/loading.gif",
        effect : "fadeIn"
    });

    //image hover
    $('.hover').imghover({
        suffix: '_1'
    });
    
    $('.productBox.tiles:nth-child(4n+2)').addClass('last');
        
    //pokaz profil
    function closeProfile(){ 
        $('#showProfile .menuButton').removeClass('active');
        $('#profileContainer').hide();
        $('#windowOverlay__').hide();
        
        $('#showProfile .menuButton .arr').remove(); 
    }
    function showProfile(){
        $('.overlay').css('z-index', '200');
        $('#showProfile .menuButton').addClass('active');
        $('#profileContainer').show();
        $('#windowOverlay__').show();
        
        $('#showProfile .menuButton').append('<div class="arr"></div>');   
    }

    $('#showProfile').mouseover(function() {
        showProfile()
    }).mouseleave(function() {
        closeProfile()
    });
   
    //click item slideshow
    $('#slidesContainer .item').click( 
        function() {
            location.replace($(this).find('a').attr('href'));
            return false
        }
        );

    //animation slideshow box
    $('#selectMainCategories li').hover(  
        function(){  
            $('.slider',this).stop().animate({
                top: "-240px"
            },380,"linear");  
              
        },  
        function(){  
            $('.slider',this).stop().animate({
                top: "0px"
            },250,"linear");  
        }  
        );  
    
    //search animation
    $('#search input[type="text"]').click(function(){
        //$('#search').css('z-index','500');
        $(this).animate({
            width: "180px"
        },300,"linear");  
    });
    
    //search
    $('#search input[type="text"]').blur(function(){
        $(this).animate({
            width: "93px"
        },500,"linear");
    });
        
});
