/* 

 ADRIANO CARVALHO

*/
var nav;
var campos, msg, overlay; //USADAS NA PÁGINA DE CONTATO

$(function(){
    
    $.each(nav, function(item, value){
            if ( value != "" ) {
                    $("." + item + " ." +value).addClass("atual");
            }
    });

    /*RESIZE RODAPE*/
    $(".rodape-endereco").height($('.rodape-menu').height());

    overlay = $('.overlay').overlay({
            top: 'center',
            mask: {
                color: "#FFFFFF",
                loadSpeed: 500
            },
            onBeforeLoad: function(){
                if ( this.getTrigger().attr('id') == "overlay" ){
                    var wrap = this.getOverlay();
                    wrap.find('h2').text( $('.link-overlay').attr('title') );
                    wrap.find('iframe').attr('src', $('.link-overlay').attr('href'));
                }
            }
        });
        
   $('.link-overlay').click(function(e){
        e.preventDefault();
        overlay.filter('#overlay').overlay().load();
    });

   $.tools.validator.localize("br", {
        '*'                     :"Preencha o valor correto!",
        ':email'  		: 'Preencha um e-mail v&aacute;lido',
        ':number' 		: 'Preencher somente n&uacute;meros',
        '[required]' 	: 'Campo de Preenchimento Obrigat&oacute;rio'
    });
    
    // adds an effect called "wall" to the validator
    $.tools.validator.addEffect("wall", function(errors, event) {
            var campos = new Array();
            // get the message wall
            var wall = this.getForm().prev(this.getConf().container).fadeIn();

            // remove all existing messages
            wall.find("p").remove();

            // add new ones
            $.each(errors, function(index, error) {
                    campos.push(error.input.attr("title"));
                    error.input.addClass('invalid');
            });
            wall.append(
                "<p>"+errors[0].messages+":<br><strong>" +campos.join(", ")+ "</strong></p>"
            );

    // the effect does nothing when all inputs are valid
    }, function(inputs) {
        
    });
    $('#fAreaRestrita,#fAulaExp').validator({
        lang: 'br',
        container: ".error",
        effect: "wall"
    });
    
});

