

    function popGaleria(id) {
        $.ajax( {
                    type: "POST",
                    url: "./incs/funcoes_jQuery.php",
                    data: "acao=montaGaleria&id=" + id,
                    beforeSend: function() {
                                    // enquanto a função esta sendo processada...
                                    //$('#moldura-foto').html('<img id="image-big" src="./img/carregando.gif">');
                                    //alert('aqui');
                },
          success: function(txt) {
          // troca o conteúdo
                                    //$("#image-big").fadeOut("slow");
                                    $('#left').html(txt);
                                    $('#galeria').show();
                                    $('#bt-fechar-galeria').show();
                                  },

          error: function(txt) {
          // em caso de erro pode dar um alert('erro');
                                    alert('Erro: '+txt);
                               }
                }
              );
    }


    function mostraFoto(id) {
        $.ajax( {
                    type: "POST",
                    url: "./incs/funcoes_jQuery.php",
                    data: "acao=exibeFoto&id=" + id,
                    beforeSend: function() {
                                    // enquanto a função esta sendo processada...
                                    $('#moldura-foto').html('<img id="image-big" src="./img/carregando.gif">');
                },
          success: function(txt) {
          // troca o conteúdo
                                    //$("#image-big").fadeOut("slow");
                                    $('#moldura-foto').html(txt);
                                    $('id_da_foto').value = id;
                                  },

          error: function(txt) {
          // em caso de erro pode dar um alert('erro');
                                    alert('Erro: '+txt);
                               }
                }
              );
    }
    
    function mostraThumbs(id,pagina) {
        $.ajax( {
          //faz a chamada
                    type: "POST",
                    url: "./incs/funcoes_jQuery.php",
                    data: "acao=exibeThumbs&id=" + id+"&pagina="+pagina,
                    beforeSend: function() {
                                    // enquanto a função esta sendo processada...
                                    $('#right').html('<img id="image-big" src="../img/carregando.gif">');
                },
          success: function(txt) {
          // troca o conteúdo
                                    $('#right').html(txt);
                                    $("#image-big").fadeOut("slow");
                                  },

          error: function(txt) {
          // em caso de erro pode dar um alert('erro');
                                    alert('Erro: '+txt);
                               }
                }
              );
    }

    function enviaFormFoto(form) {
        if (validaForm(form)) {
            var id = document.getElementById('id_da_foto').value;
            var nome = document.getElementById('nome').value;
            var email = document.getElementById('email').value;
            var nomeAmigo = document.getElementById('nomeAmigo').value;
            var emailAmigo = document.getElementById('emailAmigo').value;
            $.ajax( {
                        type: "POST",
                        url: "./incs/email_fotos.php",
                        data: "acao=exibeFoto&id="+id+"&nome="+nome+"&email="+email+"&nomeAmigo="+nomeAmigo+"&emailAmigo="+emailAmigo,
                        beforeSend: function() {
                                        fechaEnviarFoto();
                                        //$('#resultado-envio-email').html(txt);
                                        // enquanto a função esta sendo processada...
                    },
              success: function(txt) {
              // troca o conteúdo
                                        //$('#resultado-envio-email').html(txt);
                                        //$("#image-big").fadeOut("slow");
                                        alert('Foto enviada com sucesso.');
                                      },

              error: function(txt) {
              // em caso de erro pode dar um alert('erro');
                                        alert('Erro: '+txt);
                                   }
                    }
                  );
        }
        return false;
    }
    
    function cadastraNews() {
        $.ajax( {
                    type: "POST",
                    url: "./incs/funcoes_jQuery.php",
                    data: "acao=cadastraNews&email=" + document.getElementById('emailNews').value,
                    beforeSend: function() {
                                    // enquanto a função esta sendo processada...
                                    //$('#image-big').html('<img id="image-big" src="../img/carregando.gif">');
                },
          success: function(txt) {
          // troca o conteúdo
                                    //$('#left').html(txt);
                                    alert('Obrigado por se cadastrar.'+txt);
                                  },

          error: function(txt) {
          // em caso de erro pode dar um alert('erro');
                                    alert('Erro: '+txt);
                               }
                }
              );
    }
    
