﻿// Window load event used just in case window height is dependant upon images


//$(document).ready(function () {


$(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",
                margin: "-25px 0px 0px 0px",
                top: footerTop,
                visibility: "visible"
            })
        } else {
            $footer.css({
                position: "static",
                visibility: "visible"
            })
        }

    }

    $(window)
               .scroll(positionFooter)
               .resize(positionFooter)

});
