function createFlash( msg, type )
{
    if ( type == null ) type = "";
    type = type.toLowerCase();
    switch ( type )
    {
        case "success":
        case "warning":
        case "error":
        case "notice":
        case "message":
            break;
        default:
            type = "default";
            break;
    }
    
    var flash = new Array();
    flash['message'] = msg;
    flash['type'] = type;
    
    return flash;
}

function clearFlashes( container, type )
{
    var selector = container;
    if ( type )
    {
        selector += ".zend_flash_" + type;
    }
    $(selector).empty();
}

function printFlashes( container, flashes )
{
    if ( flashes && flashes.length )
    {
        for ( key in flashes )
        {
            // Add the flash message at the end of the list and hide it immediately..
            $(container).append('<li class="zend_flash_' + flashes[key]['type'] + '">' + flashes[key]['message'] + '</li>');
            $(container).children().hide();
        }
        
        // Animate all hidden messages with the slideDown effect..
        $(container).find(":hidden").slideDown('normal');
    }
}
