/* Anchor Slider by Cedric Dugas
   Http://www.position-absolute.com */

jQuery.fn.anchorAnimate = function (settings) {
    settings = jQuery.extend({ speed: 1000 }, settings);

    return this.each(function () {
        var target = $(this).attr("href");

        var destination = $(target).offset().top - 35;

        this.scrollToTarget = function () {
            $("html:not(:animated), body:not(:animated)").animate({ scrollTop: destination }, settings.speed, function () {
                window.location.hash = target;

                $(document).scrollTop(destination);
            });
        }

        $(this).click(function (event) {
            event.preventDefault();

            this.scrollToTarget();

            return false;
        })
    })
}
