﻿(function($) {
    $.fn.extend({

        presentation: function(opts) {

            return this.each(function() {

                // reset the top margin of the services container on mouse out
                $('#services').mouseleave(function() {
                $('#presentation-content').animate({ "marginTop": 0 + "px" }, { queue: false, duration: 500 });
                });

                // calculate and set the top margin of the content container
                $('#services a').hover(function() {
                    var i = $("#services a").index(this);
                    $('#presentation-content').animate({ "marginTop": -((i + 1) * 166) + "px" }, { queue: false, duration: 500 }); // multiply by height+top/bottom padding/margin/border
                });

            });
        }
    });
})(jQuery);