//Manter Arquivos Gerais
  $(document).on('ready', function() {
    var initialPreview = [];
    var initialPreviewConfig = [];
    var idGal=$('#idGal').val();
    var acao = 'manterFiles';
    var tipoAcao = 'listarFiles';
    $.ajax({
      url:"manter.php",                    
      type:"post",                            
      data: "id="+idGal+"&acao="+acao+"&tipoAcao="+tipoAcao,
      dataType: "JSON",
      success: function (result){ 
        $.each(result, function(key, value) {  
          //alert(result[key].media_file);
          initialPreview.push("/system/_files/galerias/"+result[key].fot_file); 
          //initialPreview.push("/modelo/profcarlos/admin/system/_files/galerias/"+result[key].fot_file); 
          initialPreviewConfig.push({ 
                                      caption: result[key].fot_file, 
                                      size: 762980, 
                                      url: '/system/adm/manter.php', 
                                      //url: '/modelo/profcarlos/admin/system/adm/manter.php', 
                                      key: result[key].fot_id, 
                                      extra:  {
                                                id: result[key].fot_id, 
                                                acao: 'manterFiles', 
                                                tipoAcao: 'delete'
                                              } 
                                    }
                                    ); 
        });//each
        $("#upFilesOng").fileinput({
          overwriteInitial: false,

          initialPreview,
          initialPreviewConfig,
          initialPreviewAsData: true, 
          initialPreviewFileType: 'image', 

          uploadUrl: '/system/adm/manter.php',
          //uploadUrl: '/modelo/profcarlos/admin/system/adm/manter.php',
          uploadExtraData: {acao:'manterFiles', tipoAcao: 'adicionar', id: idGal},
          language: "pt-BR",
          'showUpload':true, 
          allowedFileExtensions: ["jpg", "gif", "png"],
          maxFilePreviewSize: 10240
        }).on('fileuploaded', function(event, data, id, index) {

        });
        
      }//success
    });//Ajax

    ////////////////////////////////////
  });//function
