﻿//************************************************************************************* 
// File     :   mf_footer_push.js
// Requires :   mf_domLibrary_0.1.js, prototype.js
// Author   :   Kyle Weems (ksw)
// Origin   :   mindfly.com
// Created  :   July 26, 2007
// Modified :   July 26, 2007
// Purpose  :   Ensures that content div is tall enough to make the footer appear at the bottom
//              of the broswer window if the page's content would otherwise be too short.
//*************************************************************************************
var ranOnce = false;

function adjustContentHeight()
{
    // Get the heights of the browswer window and site_info (for backup purposes).
    var windowHeight = getViewportSize()[1];
    // Only make changes to content height if site_info actually exists.
    if($('site_info'))
    {
        var siHeight = $('site_info').offsetHeight;
        // Expand content's height to fill the broswer window after accounting for the branding and site_info's heights.
        var minContentHeight = windowHeight - ($('branding').offsetHeight + $('site_info').offsetHeight);
        //if($('content').offsetHeight < minContentHeight)
        //{
        //    $('content').style.height = minContentHeight + 'px';
            // Restore site_info's height from backup (in case it distorted).
        //    $('site_info').style.height = siHeight + 'px';
        if(ranOnce == false)
        {
            $('content_main').style.height = ($('content').offsetHeight) + "px";         
            ranOnce = true;
        }
        //}
       
    }
} // end of adjustContentHeight()

addLoadEvent(adjustContentHeight);
addOnresizeEvent(adjustContentHeight);
