/**
 * @package    Church Resources
 * @subpackage View
 * @author     Stephen Callaghan
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 * @updated    07/10/2011
 */
$(window).load(function() {
    $('#arrowdown').click(function(a) {
        // Get Current CSS Top Value 
        var current_top = parseInt($('#menu').css('top'));
     
        // Calculate the heights
        var sidebar_height = parseInt($('#sidebar').height());

        //Calculate the top value
        var top_value = 0 - (sidebar_height - current_top);

        if(top_value > (0 - $('#menu').height()))
        {
          //Animate the #menu by chaging the top value
          $('#menu').animate({top: top_value}, { queue:false, duration:500});
        }
    });

    $('#arrowup').click(function(e) {
        // Get Current CSS Top Value 
        var current_top = parseInt($('#menu').css('top'));
     
        // Calculate the heights
        var sidebar_height = parseInt($('#sidebar').height());

        //Calculate the top value
        
        var top_value = sidebar_height + current_top;

        if(top_value <= 0)
        {
          //Animate the #menu by chaging the top value
          $('#menu').animate({top: top_value}, { queue:false, duration:500});
        }
        else
        {
          $('#menu').animate({top: 0}, {queue:false, duration: 300})
        }
    });
});

