$(document).ready(function() {
    //initialAnimation("#nav-content", 250, .6);
    slide("#nav-content", 9, 1);
});

function initialAnimation(navigation_id, time, multiplier) {
    var list_elements = navigation_id + " ul li";

    var timer = 0;

    // creates the slide animation for all list elements 
    $(list_elements).each(function(i) {
        // margin left = - ([width of element] + [total vertical padding of element])
        $(this).css("margin-top", "-2000px");

        timer = (timer * multiplier + time);
        $(this).stop().animate({ marginTop: "0" }, timer);
        $(this).stop().animate({ marginTop: "20px" }, timer);
        $(this).stop().animate({ marginTop: "0" }, timer);
    });
}

function slide(navigation_id, pad_out, pad_in) {
    var link_elements = navigation_id + " li";

    // creates the hover-slide effect for all link elements 
    $(link_elements).each(function(i) {
        $(this).hover(
    		function() {
    		    $(this).stop().animate({ marginLeft: pad_out }, 350);
    		},
    		function() {
    		    $(this).stop().animate({ marginLeft: pad_in }, 150);
    		});
    });

    var link_subelementsActive = navigation_id + " li.active";

    $(link_subelementsActive).each(function(i) {
        $(this).css("margin-left", "0px");

        $(this).hover(
		function() {
		    $(this).stop().animate({ marginLeft: 0 }, 350);
		},
		function() {
		    $(this).stop().animate({ marginLeft: 0 }, 150);
		});
    });
}
