﻿

BLACKBAUD.netcommunity.PhotoPicker = function (serverVars)
{
    
    function onFrameSubmit()
    {
        document.getElementById(serverVars.FrameID).style.visibility = "hidden";
    }
    
    function onFrameLoad()
    {
    
        try
        {
            //Because the frame is loading in a new .aspx file, visually the load isn't as clean
            //as the rest of the PhotoPicker which relies on Update Panels.  To correct for this,
            //we are hiding the frame when it is submitted (or the first time it is downloaded), and then
            //unhiding it during the OnLoad event.  This is closer to the Update Panel navigation.
            document.getElementById(serverVars.FrameID).style.visibility = "visible";
            
            //Register our OnSubmit function to re-hide the frame.
            document.getElementById(serverVars.FrameID).contentWindow.OnSubmit = onFrameSubmit;
                
            //If the frame signals that the upload is complete, then we'll post back so we can switch to
            //the thumbnail view.
            if( document.getElementById(serverVars.FrameID).contentWindow.bUploadComplete === true)
            {
                document.getElementById(serverVars.BtnUploadCompleteID).click();
            }
            
        }
        catch(x)
        {
        }
    }
    
    this.onFrameLoad = onFrameLoad;
};
    
    
////////////////////////////////////////////
// End of script
if (typeof(Sys) !== 'undefined')
{
    Sys.Application.notifyScriptLoaded();
}
////////////////////////////////////////////
// Do not add any code below this
////////////////////////////////////////////
