function bodyOnLoad() {
    window.onresize = function() {
        bodyOnResize();
    }
    var cB = document.getElementById('contentBack');
    if (cB != undefined) { cB.style.overflowX = 'hidden'; }
    var cL = document.getElementById('contentLinksOverflow');
    if (cL != undefined) { cL.style.overflowX = 'hidden'; }

    if (UserStats.browser != 'Internet Explorer' || UserStats.version != 6) {
        /* If the user is not using IE6, and there is a flash movie on screen, and it has an applicable top fade, add a bottom fade */
        /* This is required because the large height of the logoScroller makes the bottom fade disappear.                          */
        var cL = document.getElementById('contentLinkFlash');
        var fT = document.getElementById('flash-TopFade');
        if (cL != undefined && fT != undefined) {
            cL.innerHTML = cL.innerHTML + '<div style="bottom:0px;left:0px;right:0px;height:24px;background:url(Images/Fades/bannerBottom.png);" id="flash-BottomFade"></div>';
        }
    }

    bodyOnResize();
}

dateOnLoad();
function dateOnLoad() { if (document.getElementById('date') == undefined) { window.setTimeout('dateOnLoad();', 10); } else { setupDate(); } }
function setupDate() {
    var dateElm = document.getElementById('date');
    var months = new Array('January','Febuary','March','April','May','June','July','August','September','October','November','December');
    var days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
    var dates = new Array('st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st');
    var currentDate = new Date();
    var year = currentDate.getYear();
    if (UserStats.browser == 'Firefox' || UserStats.browser == 'Safari' || UserStats.browser == 'Chrome') { year = year + 1900; }
    var month = months[currentDate.getMonth()];
    var day = days[currentDate.getDay()];
    var date = currentDate.getDate() + '<sup>' + dates[currentDate.getDate()-1] + '</sup>';
    dateOut = day + ', ' + date + ' ' + month + ' ' + year;
    dateElm.innerHTML = dateOut;
}

function navi(URL) { window.location = URL; }

bodyOnResize();
function bodyOnResize() {
    if (UserStats.browser=='Internet Explorer' && UserStats.version == 6) {
        contentBackOnLoad();
        contentLinksOnLoad();
        footerOnLoad();
    }

    if (UserStats.browser == 'Internet Explorer' && UserStats.version == 7) {
        var cB = document.getElementById('contentBack');
        if (cB != undefined) {
            if (cB.scrollHeight > cB.offsetHeight) {
                // The content scrollbar is visible.
                var cT = document.getElementById('contentText');
                cT.style.width = '400px';
            }
        }

        var cL = document.getElementById('contentLinksOverflow');
        if (cL != undefined) {
            if (cL.scrollHeight > cL.offsetHeight) {
                // The links scrollbar is visible. (IE7 only)
                var cP = document.getElementById('contentLinkPadding');
                if (cP != undefined) {
                    cP.style.width = '120px';
                }
            }
        }
    }

    var cL = document.getElementById('contentLinksOverflow');
    var cP = document.getElementById('contentLinkPadding');
    if (cL != undefined) {
        if (cL.scrollHeight > cL.offsetHeight) {
            // The links scrollbar is visible.
            if (cP != null) {
                cP.style.left = '5px';
            }
            // Move the content across slightly to prevent it running up against the scrollbar
        }
    }

    //if (document.open('application/x-shockwave-flash') != null) {alert('flash plugin found!'); }
}

function contentBackOnLoad() { var t = document.getElementById('contentBack'); if (t == undefined || t == null) { window.setTimeout('contentBackOnLoad();', 10); } else { setupContentBack(); } }
function setupContentBack() {
    var contentBack = document.getElementById('contentBack');
    var pageBody = document.getElementById('overallBody');
    contentBack.style.height = (pageBody.offsetHeight - (192 + 73)) + 'px';
}
function contentLinksOnLoad() { var t = document.getElementById('contentLinks'); if (t == undefined || t == null) { window.setTimeout('contentLinksOnLoad();', 10); } else { setupContentLinks(); } }
function setupContentLinks() {
    var contentLinks = document.getElementById('contentLinks');
    var pageBody = document.getElementById('overallBody');
    contentLinks.style.height = (pageBody.offsetHeight - (192 + 73)) + 'px';
}
function footerOnLoad() { var t = document.getElementById('footer'); if (t == undefined || t == null) { window.setTimeout('footerOnLoad();', 10); } else { setupFooter(); } }
function setupFooter() {
    var footer = document.getElementById('footer');
    var pageBody = document.getElementById('overallBody');
    footer.style.top = pageBody.offsetHeight - 73 + 'px';
}
