$(document).ready(function(){
    $('.txt ul li.list').each(function(i, e) {
        $(e).contents().wrap('<span class="text"></span>')
    });
    
    $('#gallery a').lightBox({fixedNavigation:true});
    $('.icaption_left a').lightBox({fixedNavigation:true});
    $('.icaption_right a').lightBox({fixedNavigation:true});
     
    slide("#sliding-navigation", 35, 20, 150, .8);
    
    $('#black_trigger').click(function() {
      $('#h2_black').show('slow', function() {
        // Animation complete.
      });

    });
    
    $('#black_close').click(function() {
      $('#h2_black').hide('slow', function() {
        // Animation complete.
      });

    });   
    
    $('#yellow_trigger').click(function() {
      $('#h2_yellow').show('slow', function() {
        // Animation complete.
      });

    });
    
    $('#yellow_close').click(function() {
      $('#h2_yellow').hide('slow', function() {
        // Animation complete.
      });

    });   

})


function slide(navigation_id, pad_out, pad_in, time, multiplier)
{
    // creates the target paths
    var list_elements = navigation_id + " li.sliding-element";
    var link_elements = list_elements + " a";
    
    
    // initiates the timer used for the sliding animation
    var timer = 0;
    
    // creates the slide animation for all list elements 
    /*$(list_elements).each(function(i)
    {

        // updates timer
        timer = (timer*multiplier + time);
        $(this).animate({ marginLeft: "0" }, timer*2);
        $(this).animate({ marginLeft: "15px" }, timer);
        $(this).animate({ marginLeft: "0" }, timer);
    });*/

    // creates the hover-slide effect for all link elements         
    $(link_elements).each(function(i)
    {
        $(this).hover(
        function()
        {
            $(this).children('span').animate({ paddingLeft: pad_out, backgroundPosition:"(21px 10px)" }, 250);            
        },        
        function()
        {
            $(this).children('span').animate({ paddingLeft: pad_in, backgroundPosition:"(150px 10px)" }, 250);
        });
    });
}


