/* 
@brief Generic function to pop-up a yui panel

@param yuiId        String of the id for the content of the YUI panel
@param contentDict  Dictionary to contain content to display, keys should be 'header', 'body' or 'footer'.
@param configDict   Optional dictionary to contain YUI configuration options. Consult YUI documentation for keys/values.
*/
function show_yui_panel(yuiId, contentDict, configDict)
{
    if(!yuiId || !contentDict)
    {
        //Can't display a panel if we don't have an id for the content element or any content to display
        return false;
    }
    else if(!configDict)
    {
        //Configuration is optional, if the parameter hasn't been passed then use YUI defaults.
        configDict = {};
    }

    //Check contentDict actually has elements 
    var hasContent = false;
    for(key in contentDict)
    {
        if((key == 'header' || key == 'body' || key == 'footer') && contentDict[key])
        {
            hasContent = true;
            break;
        }
    }

    if(!hasContent)
    {
        return false;
    }
    
    var yuiPanel = new YAHOO.widget.Panel(yuiId, configDict);
    if(contentDict['header'])
    {
        yuiPanel.setHeader(contentDict['header']);
    }
    if(contentDict['body'])
    {
        yuiPanel.setBody(contentDict['body']);
    }
    if(contentDict['footer'])
    {
        yuiPanel.setFooter(contentDict['footer']);
    }
    yuiPanel.render(document.body);
    yuiPanel.show();
    return true;
}
