﻿// Footer

// Window load event used just in case window height is dependant upon images
/*
$(window).bind("load", function () {

    var footerHeight = 0,
           footerTop = 0,
           $footer = $("#footer");

    positionFooter();

    function positionFooter() {

        footerHeight = $footer.height();
        footerTop = ($(window).scrollTop() + $(window).height() - footerHeight) + "px";

        if (($(document.body).height() + footerHeight) < $(window).height()) {
            $footer.css({
                position: "absolute"
            }).animate({
                top: footerTop
            })
        } else {
            $footer.css({
                position: "static"
            })
        }

    }

    $(window)
               .scroll(positionFooter)
               .resize(positionFooter)

});
*/

$(document).ready(function () {
    positionFooter();

    $(window)
    .scroll(positionFooter)
    .resize(positionFooter);

    function positionFooter() {
        var docHeight = $(document.body).height() - $("#sticky-footer-push").height();
        if (docHeight < $(window).height()) {
            var diff = $(window).height() - docHeight;
            if (!$("#sticky-footer-push").length > 0) {
                $("#footer").before('<div id="sticky-footer-push"></div>');
            }
            $("#sticky-footer-push").height(diff);
        }
    }
});




