/* Start Header ------------------------------------------------------------

    Kodak Graphic Communications Canada Company
    Burnaby B.C. Canada
    V5G 4M1

    Copyright (C) 2009 Kodak Graphic Communications Canada Company
    
    Reproduction or disclosure of this file or its contents without the
    prior written consent of Kodak Graphic Communications Canada Company
    is prohibited.

 * End Header --------------------------------------------------------------
 */

// =========================================== XPAG_Base_ShowPageErrorPanel
// ===========================================
function XPAG_Base_ShowPageErrorPanel
(
    strErrorHtml,
    strBodyID,
    strErrorPanelID,
    strBodyPanelID,
    fltBodyPanelSpaceBefore,
    blnBrowserIsIE
)
{
    var objErrorPanel = document.getElementById( strErrorPanelID );
    
    // only shift the page down when the error panel IS NOT already displayed
    if ( objErrorPanel.style.display != "block" )
    {
        var fltErrorPanelHeight = parseFloat( objErrorPanel.style.height );
        
        // equivalent to objMaster.BodyPanel.PositionControl( objMaster.ErrorPanel, WCCR_ScrollingPanel.Location.Before );
        if ( blnBrowserIsIE )
        {
            var objBody = document.getElementById( strBodyID );
            var fltBodyPaddingTop = parseFloat( objBody.style.paddingTop );
            
            if ( isNaN( fltBodyPaddingTop ) )
            {
                // we seem to get NaN, even though the CssStyle contains top: 0px;
                fltBodyPaddingTop = 0;
            }
            
            objBody.style.paddingTop = ( fltBodyPaddingTop + fltErrorPanelHeight ) + "px";
        }
        else
        {
            var objBodyPanel = document.getElementById( strBodyPanelID );
            var fltBodyPanelTop = parseFloat( objBodyPanel.style.top );
            
            if ( isNaN( fltBodyPanelTop ) )
            {
                // we seem to get NaN, even though the CssStyle contains top: 0px;
                fltBodyPanelTop = 0;
            }
            
            objBodyPanel.style.top = ( fltBodyPanelTop + fltErrorPanelHeight ) + "px";
        }
        
        // make room for the HeaderPanel, NavigationPanel and TitlePanel
        objErrorPanel.style.top = fltBodyPanelSpaceBefore + "px";
        
        objErrorPanel.style.display = "block";
    }    
    
    objErrorPanel.innerHTML = strErrorHtml;
}

// =========================================== XPAG_Base_HidePageErrorPanel
// ===========================================
function XPAG_Base_HidePageErrorPanel
(
    strBodyID,
    strErrorPanelID,
    strBodyPanelID,
    blnBrowserIsIE
)
{
    // reverse changes made in XPAG_Base_ShowPageErrorPanel
    var objErrorPanel = document.getElementById( strErrorPanelID );
    
    // only shift the page back up when the error panel IS already displayed
    if ( objErrorPanel.style.display == "block" )
    {
        var fltErrorPanelHeight = parseFloat( objErrorPanel.style.height );
        
        // reverse of objMaster.BodyPanel.PositionControl( objMaster.ErrorPanel, WCCR_ScrollingPanel.Location.Before );
        if ( blnBrowserIsIE )
        {
            var objBody = document.getElementById( strBodyID );
            var fltBodyPaddingTop = parseFloat( objBody.style.paddingTop );
            
            if ( isNaN( fltBodyPaddingTop ) )
            {
                // we seem to get NaN, even though the CssStyle contains top: 0px;
                fltBodyPaddingTop = 0;
            }
            
            objBody.style.paddingTop = ( fltBodyPaddingTop - fltErrorPanelHeight ) + "px";
        }
        else
        {
            var objBodyPanel = document.getElementById( strBodyPanelID );
            var fltBodyPanelTop = parseFloat( objBodyPanel.style.top );
            
            if ( isNaN( fltBodyPanelTop ) )
            {
                // we seem to get NaN, even though the CssStyle contains top: 0px;
                fltBodyPanelTop = 0;
            }
            
            objBodyPanel.style.top = ( fltBodyPanelTop - fltErrorPanelHeight ) + "px";
        }
        
        objErrorPanel.style.display = "none";
    }    
    
    objErrorPanel.innerHTML = "";
}