$(function() {
    $("#login input").tooltip({
    	position: "center left",
    	offset: [-2, 1],
    	effect: "fade",
    	opacity: 0.8
    });
});
function detectaModais(){
    $(function() {
    	var modal = $("a[rel]").overlay({
           effect: 'default',
           mask: {
    		color: '#35547D',
    		loadSpeed: 200,
    		opacity: 0.5
    	   },
           onBeforeLoad: function(){
            var wrap = this.getOverlay().find(".contentWrap");
            if(this.getTrigger().attr("rev") != ""){
                coords = this.getTrigger().attr("rev").split("x");
                wrap.parent().css("width", coords[0]+"px");
                wrap.parent().css("height", coords[1]+"px");
                wrap.css("width", coords[0]+"px");
                wrap.css("height", coords[1]+"px");
            }
            if (this.getTrigger().attr("rel") == "#ajax_box"){
                wrap.load(this.getTrigger().attr("href"));
            }
           },
           onClose: function(){
            if (this.getTrigger().attr("rel") == "#ajax_box"){
                this.getOverlay().find(".contentWrap").html("<img src=\"/imagens/layout/box/ajax-loader.gif\"/>");
            }
            if (this.getTrigger().attr("rel") == "#suporte_box"){
                window.location='/produtos/novosac.php';
            }
            if (this.getTrigger().attr("rel") == "#help_login"){
                $("#usr_login").focus();
            }
            if (this.getTrigger().attr("rel") == "#control_painel"){
                fecharPainel();
            }
           }
        });
    });
}
detectaModais();

$(document).ready(function(){
    jQuery("#login-panel").hide();
    jQuery("#cart-panel").hide();
    jQuery("#link_car").click(function () {
        jQuery("#login-panel").slideUp("normal");
        jQuery("#cart-panel").slideToggle("slow");
    });
    jQuery("#link_log").click(function () {
        jQuery("#cart-panel").slideUp("normal");
        jQuery("#login-panel").slideToggle("slow");
    });
    makemasks();
});
function makemasks(){
    $(function($){
        $("input.cnpj").mascara("99.999.999/9999-99",{placeholder:"_"});
        $("input.telefone").mascara("(99) 9999-9999",{placeholder:"_"});
    });
}
