    
    function submitForm(idFrm) {
        var frm = $("#" + idFrm);

        $(frm).submit();
    }

    function addProduto(prod1_cod){
	frm = $("#frmAddProduto" + prod1_cod);

        qtd = $("#prod1_qtd", frm).val();
        qtd = parseInt(qtd);

	if ((isNaN(qtd)) || (qtd < 1)) {
		alert("Preencha a quantidade desejada.");
		$("#prod1_qtd", frm).focus();
	} else {
		frm.submit();
	}
    }


    function cofirmaExclusaoFavorito(idFrm) {
        if (confirm('Deseja realmente excluir este produto da lista de favoritos?')){
            submitForm(idFrm);
        }
    }

    function logoff(idFrm) {
        if (confirm('Tem certeza que deseja sair?')){
            submitForm(idFrm);
        }
    }

    function atendimento(root_path) {
        window.open(root_path+"/msn/index/", "Autocar", "status=no, width=500, height=500");
    }

    function validaDataPT_BR(data)
    {
        if (data != '')
        {
            erro = 0;
            hoje = new Date();
            anoAtual = hoje.getFullYear();
            barras = data.split('/');
            if (barras.length == 3)
            {
                dia = barras[0];
                mes = barras[1];
                ano = barras[2];
                resultado = (!isNaN(dia) && (dia > 0) && (dia < 32)) && (!isNaN(mes) && (mes > 0) && (mes < 13)) && (!isNaN(ano) && (ano.length == 4) && (ano <= anoAtual && ano >= 1900));
                if (!resultado)
                {

                    return false;
                }
            }
            else
            {

                return false;
            }
            return true;
        }

        return false;
}


