function fn_location(path)
{
    window.location = path;
}
$(document).ready(function(){
     $("#rodape-interno").hide();
     $(window).load(function() {
           $('input:text:first:visible').focus();
           altura = $("#texto").height();
           altura = (altura<255) ? 260 : altura;
           
           $("#conteudo-interno").css({"height":altura+"px"});
           $("#principal").css({"height":altura+400+"px"});
           $("#rodape-interno").show();
        });
     $("#nm_enviar").click(function(e){
         var qtd=0;
         $("#retorno").html("");
         exps = new Array();
         exps['nm_email'] = /^[A-Za-z][A-Za-z0-9._-]*@[A-Za-z0-9_-]+\.[A-Za-z0-9_.]+[A-za-z]$/;
         exps['nm_telefone'] = /^[(]{1}\d{2}[)]{1}\d{4}[-]{1}\d{4}$/;

         $("#fContato input[type|=text]").each(function(){
             $(this).removeAttr("style");
             nome_campo = $(this).attr("id");
             if($.trim($(this).val())=='')
             {
                 $(this).css({"border":"1px solid #CC0000"});
                 qtd++;
             }
             if(nome_campo=="nm_email")
             {
                if(!$(this).val().match(exps[nome_campo]))
                    {
                         $(this).css({"border":"1px solid #CC0000"});
                         qtd++;
                    }
             }
         });
         $("#nm_mensagem").removeAttr("style");
         if($.trim($("#nm_mensagem").val())=='')
          {
             $("#nm_mensagem").css({"border":"1px solid #CC0000"});
             qtd++;
          }

         $('input:text:first:visible').focus();

         if(qtd>0)
            $("#retorno").html("<p class='atencao'>Preencha os campos em destaque!</p>");
         else
         {
             var campos_vl=$("#fContato").serialize();
             $.post("fale.php",campos_vl,function(result){$("#retorno").html("<p class='atencao'>"+result+"</p>");fn_tam();});
         }
        function fn_tam()
        {
            altura = $("#texto").height();
            $("#conteudo-interno").css({"height":altura+"px"});
            $("#principal").css({"height":altura+400+"px"});
        }
        fn_tam();
     });
});
