function campoValidar(campo,tipo,msg){
    msg = msg == undefined?"":msg;
    if( $("#div_"+campo.attr('id')) ){
        $("#div_"+campo.attr('id')).remove();
    }
    campo.removeClass('campo_erro');
    campo.removeClass('campo_sucesso');
    
    var msg_alerta = "";
    if(tipo=="erro"){
        msg_alerta = "<div id='div_"+campo.attr('id')+"' class='form-msg-erro'>"+msg+"</div>";
        campo.addClass('campo_erro');
    }else if(tipo=="ok"){
        msg_alerta = "<div id='div_"+campo.attr('id')+"' class='form-msg-sucesso'>"+msg+"</div>";
        campo.addClass('campo_sucesso');
    }
    campo.after(msg_alerta);
}

function setCampoAguarde(id,tipo){
    var campo = $("#"+id);
    if(tipo=="setar"){
        campo.addClass("campo_aguarde");
    }else{
        campo.removeClass("campo_aguarde");
    }
}

uiAlert= function (tipo,msg,botoes){
    $.blockUI({
        message : msg + "<br /><br />"+botoes
    });
}

dialogAlert = function(tipo, titulo, msg, ok, cancel) {
    var img_tp = "";
    var css = "";
    tipo = tipo.toLowerCase();



    if(tipo=="erro") {
        img_tp = "<tr><td width='70'><img src='../site/images/erro_resposta.png'/></td></tr>";
        css = "style='color:#C00;' ";
    }else if(tipo=="sucesso"){
        img_tp = "<tr><td width='70'><img src='../site/images/sucesso.png'/></td></tr>";
        css = "style='color:#3e9300;' ";
    }else if(tipo=="alerta"){
        img_tp = "<tr><td width='70'><img src='../site/images/6_meses.png'/></td></tr>";
        css = "style='color:#C00;' ";
        img_tp = "<tr><td width='70'><img src='../site/images/6_meses.png'/></td></tr>";
    }else{
        img_tp = "<td width='70'><img src='icones/64x64_alert.png'/></td>";
    }

    $('#hdd-dialog-alert').remove();
        $("<div id='hdd-dialog-alert'><table width='100%'>"+img_tp+"<tr><td "+css+">"+msg+"</td></tr></table></div>").appendTo("body").dialog({
            title: titulo,
            modal: true,
            width: 400,
            resizable: false,
            overlay: {
                opacity: 0.7,
                background: "#000"
            },
            buttons: {
                "Ok": ok,
                "Cancelar": cancel
            }
        });
}
