$(document).ready(function() {
    if (typeof(document.getElementById('gallery')) != "undefined") $("#gallery a").fancybox();
    if (typeof(document.getElementById('articleGallery')) != "undefined") $("#articleGallery a").fancybox();
    
    // main vertical scroll 
    $(document).ready(function() {		
            $("#main").scrollable({ 
             
                // basic settings 
                vertical: true, 
                size: 1, 
                clickable: false,
                loop: true,
             
                // up/down keys will always control this scrollable 
                keyboard: 'static', 
             
                // assign left/right keys to the actively viewed scrollable 
                onSeek: function(event, i) { 
                    horizontal.scrollable(i).focus(); 
                } 
             
            // main navigator (thumbnail images) 
            }).navigator('#main_navi').autoscroll({autoplay: true}); 
             
            // horizontal scrollables. each one is circular and has its own navigator instance 
            var horizontal = $(".scrollable").scrollable({size: 1}).circular().navigator(".navi"); 
             
            // when page loads setup keyboard focus on the first horzontal scrollable 
            horizontal.eq(0).scrollable().focus();
            
            $("#vertical").scrollable({vertical:true, size:3, loop:true});
    });
    
    $('#searchInput').focus(function(){
        if ($(this).val() == 'słowo kluczowe...') {
            $(this).attr('title', $(this).val());
            $(this).val('');
        }
    }).blur(function(){
        if ($(this).val() == '') {
            $(this).val($(this).attr('title'));
        }
    });
    
    $('.hoverable').live('mouseover', function() {
        $(this).addClass('hover');
    }).live('mouseout', function(){
        $(this).removeClass('hover');
    });
});
