$(document).ready(function() {
    resize();
    setFooter();
    adjustNewsletterForm();
})

$(window).resize(function() {
    resize();
    setFooter();
});

function setFooter() {
    var windowHeight = $(window).height();
    var containerHeight = $('#container').height();
    var footerHeight = $('#footer').height();
    var totalHeight = windowHeight - (containerHeight + footerHeight);
    if (totalHeight >= 0) {
        $('#footer').css('top', totalHeight-28);
    }
    else {
        $('#footer').css('top', 0);
    }

}

function adjustNewsletterForm() {
    $('.formRow label, .formButtonRow label').each(function() {
        if ($.trim($(this).html()) == '<br>') {
            $(this).remove();
        }
    })
}

function resize() {
    var windowwidth = $(window).width();
    if (windowwidth < 950) {
        $('#bottom').width(950);
    } else {
        $('#bottom').width('auto'); 
    }
//    if (windowwidth >= 1121) {
//        $('#canvas').width(1121);
//        $('#nav').css('padding', '0 95px 0 96px').width('auto');
//    } else {
//        $('#canvas').width(950);
//        $('#nav').css('padding', '0 10px 0 10px').width(930);
//    }
}