﻿/*Função que limita o numero máximo de caracteres para textbox multiline*/
function CheckCount(text, length) {
    var maxlength = new Number(length);
    if (text.value.length > maxlength) {
        text.value = text.value.substring(0, maxlength);
        alert("Atenção! Neste campo são permitidos no máximo " + maxlength + " caracteres!");
    }
}

function Mascara(o, f) {
    v_obj = o
    v_fun = f
    setTimeout("execmascara()", 1)
}

function execmascara() {
    v_obj.value = v_fun(v_obj.value)
}

function Integer(v) {
    return v.replace(/\D/g, "")
}


function Telefone(v) {
    v = v.replace(/\D/g, "");
    v = v.replace(/(\d{4})(\d)/, "$1-$2");
    return v;
}

/*Função que padroniza CEP*/
function Cep(v) {
    v = v.replace(/\D/g, "")
    v = v.replace(/D/g, "")
    v = v.replace(/^(\d{5})(\d)/, "$1-$2")
    return v
}

function searchBox(obj) {
    obj.value = "";
}

$(document).ready(function () {
    $('.busca-central').keypress(function (e) {
        if (e.which == 13) {
            $(this).blur();
            $('.submit').focus();
            __doPostBack('ctl00$LinkButton1', '');
        }
    });
});
