<!--
function O_Mesmo_1() {
	if (document.Cadastro.NomeDoCliente.checked == true) {
		document.Cadastro.ContatoComercial.disabled = true;
		document.Cadastro.ContatoComercial.value = document.Cadastro.NomeCliente.value;
	}
	else {
		document.Cadastro.ContatoComercial.disabled = false;
	}
}

function O_Mesmo_2() {
	if (document.Cadastro.ContatoDoFinanceiro.checked == true) {
		document.Cadastro.ContatoFinanceiro.disabled = true;
		document.Cadastro.EmailFinanceiro.disabled = true;
		document.Cadastro.ContatoFinanceiro.value = document.Cadastro.ContatoComercial.value;
		document.Cadastro.EmailFinanceiro.value = document.Cadastro.EmailComercial.value;
	}
	else {
		document.Cadastro.ContatoFinanceiro.disabled = false;
		document.Cadastro.EmailFinanceiro.disabled = false;
	}
}


// ----------------------------------------------------------------------------------------------------
// Habilita campos para cadastrar mais de um domínio na abertura da conta
function planos() {
	if (document.Cadastro.Quantidade.value < 3) {
		document.Cadastro.Dominio_3.value = "";
		document.Cadastro.Dominio_3.disabled = true;
		document.Cadastro.Plano_3.value = "";
		document.Cadastro.Plano_3.disabled = true;
	}
	if (document.Cadastro.Quantidade.value < 2) {
		document.Cadastro.Dominio_2.value = "";
		document.Cadastro.Dominio_2.disabled = true;
		document.Cadastro.Plano_2.value = "";
		document.Cadastro.Plano_2.disabled = true;
	}
	if (document.Cadastro.Quantidade.value >= 2) {
		document.Cadastro.Dominio_2.disabled = false;
		document.Cadastro.Plano_2.disabled = false;
	}
	if (document.Cadastro.Quantidade.value >= 3) {
		document.Cadastro.Dominio_3.disabled = false;
		document.Cadastro.Plano_3.disabled = false;
	}
}

// ----------------------------------------------------------------------------------------------------
// FORMATA CEP ---------------------------------------------
function FormataCep(Campo){
var tam = Campo.value.length;
if (((event.keyCode) >= 48 ) && ((event.keyCode) <= 57 )){
      event.keyCode;
      if ((tam == 5 )){
           Campo.value = Campo.value + "-";
           }
      }
else
{
   event.keyCode = 0;
   }
}

// ---------------------------------------- FORMATA COMPOS --------------------------------------------
// ----------------------------------------------------------------------------------------------------
// FORMATA DATA ---------------------------------------------
function FormataData( data )
{ var tam = data.value.length;
if (((event.keyCode) >= 44 ) && ((event.keyCode) <= 57 ))
{ event.keyCode;
if ( ( tam == 2 ) || ( tam == 5 ) )
{ data.value = data.value + "/"; }
}
else
{ event.keyCode = 0; }
}

// ----------------------------------------------------------------------------------------------------
// FORMATA CPF ----------------------------------------------
function FormataCpf(Campo){
var tam = Campo.value.length;
if (((event.keyCode) >= 48 ) && ((event.keyCode) <= 57 )){
      event.keyCode;
      if ((tam == 3 ) || (tam == 7)){
         Campo.value = Campo.value + ".";
      }
      if ((tam == 11 )){
         Campo.value = Campo.value + "-";
      }
   }
else
{ event.keyCode = 0; }
}

// ----------------------------------------------------------------------------------------------------
// FORMATA CNPJ --------------------------------------------------
function SomenteNumeros(input){
if ((event.keyCode<48)||(event.keyCode>57))
     event.returnValue = false;
     }
function FormataValor(campo,tammax,teclapres) {
var tecla = teclapres.keyCode;
var vr = campo.value;
vr = vr.replace( "-", "" );
vr = vr.replace( "/", "" );
vr = vr.replace( ".", "" );
vr = vr.replace( ".", "" );
tam = vr.length;

if (tam < tammax && tecla != 13){ tam = vr.length + 1 ; }
if (tecla == 13 ){ tam = tam - 1 ; }
if ( tecla == 13 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ){
if ( tam <= 2 ){ 
campo.value = vr ; }
tam = tam - 1;
if ( (tam > 2) && (tam <= 5) ){
campo.value = vr.substr( 0, tam - 2 ) + '-' + vr.substr( tam - 2, tam ) ; }
if ( (tam >= 6) && (tam <= 8) ){
campo.value = vr.substr( 0, tam - 6 ) + '/' + vr.substr( tam - 6, 4 ) + '-' + vr.substr( tam - 2, tam ) ; }
if ( (tam >= 9) && (tam <= 11) ){
campo.value = vr.substr( 0, tam - 9 ) + '.' + vr.substr( tam - 9, 3 ) + '/' + vr.substr( tam - 6, 4 ) + '-' + vr.substr( tam - 2, tam ) ; }
if ( (tam >= 12) && (tam <= 14) ){
campo.value = vr.substr( 0, tam - 12 ) + '.' + vr.substr( tam - 12, 3 ) + '.' + vr.substr( tam - 9, 3 ) + '/' + vr.substr( tam - 6, 4 ) + '-' + vr.substr( tam - 2, tam ) ; }
} }

// ----------------------------------------------------------------------------------------------------
// FORMATA TELEFONE ---------------------------------------------
function MascaraTelefone(Campo, Mascara){
var Tecla = window.event.keyCode;
var ValorCampo = Campo.value;
var Seps = ".-,:;/";
var EstaMascara = Mascara.substring(ValorCampo.length,ValorCampo.length+1);
var ProxMascara = Mascara.substring(ValorCampo.length+1,ValorCampo.length+2);
var Ret=false;
// BackSpace ou TAB
if (Tecla==8 || Tecla==9 || window.event.ctrlKey==true) { return true; }
// Números
if (Tecla>47 && Tecla<58 && (EstaMascara=="#" || EstaMascara=="?")==true) { Ret=true; }
// Letras
if (Tecla>96 && Tecla<123 && (EstaMascara=="@" || EstaMascara=="?")==true) { Ret=true; }
if (Tecla>64 && Tecla<91 && (EstaMascara=="@" || EstaMascara=="?")==true) { Ret=true; }
if (Ret==true){
Campo.value=Campo.value+String.fromCharCode(Tecla);
if (Seps.indexOf(ProxMascara)>-1){
Campo.value=Campo.value+ProxMascara;
   }
}
return false;
}

// ----------------------------------------------------------------------------------------------------
// FORMATA MOEDA --------------------------------------------------------
function SomenteNumeros(input) { 
if ((event.keyCode<48)||(event.keyCode>57))
     event.returnValue = false; 
	 }
function Limpar(valor, validos) {
var result = "";
var aux;
for (var i=0; i < valor.length; i++) {
aux = validos.indexOf(valor.substring(i, i+1));
if (aux>=0) { result += aux; } } return result; 
}
function Formata(campo,tammax,teclapres) {
var tecla = teclapres.keyCode;
vr = Limpar(campo.value,"0123456789");
tam = vr.length;
if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }
if (tecla == 8 )
{ tam = tam - 1 ; }
if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 )
{ dec=2
if ( tam <= dec )
{ campo.value = vr ; }
if ( (tam > dec) && (tam <= 5) ){
campo.value = vr.substr( 0, tam - 2 ) + "," + vr.substr( tam - dec, tam ) ; }
if ( (tam >= 6) && (tam <= 8) ){
campo.value = vr.substr( 0, tam - 5 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; }
if ( (tam >= 9) && (tam <= 11) ){
campo.value = vr.substr( 0, tam - 8 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; }
if ( (tam >= 12) && (tam <= 14) ){
campo.value = vr.substr( 0, tam - 11 ) + "." + vr.substr( tam - 11, 3 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; }
if ( (tam >= 15) && (tam <= 17) ){
campo.value = vr.substr( 0, tam - 14 ) + "." + vr.substr( tam - 14, 3 ) + "." + vr.substr( tam - 11, 3 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - 2, tam ) ; } } }


// ---------------------------------------- VALIDA CAMPOS ---------------------------------------------
// ----------------------------------------------------------------------------------------------------
// Valida Formulário da Newsletter ------------------------
function FormularioNews(a){
		 if(a.Nome.value == "seu nome" || a.Nome.value == ""){
		    alert("O campo ''Nome'' não foi preenchido!");
		    a.Nome.focus();
		 return false;
		 }
		 
		 if(a.Email.value == "seu e-mail" || a.Email.value == "informe um e-mail válido" || a.Email.value == "informe outro e-mail" || a.Email.value == ""){
		    alert("O campo ''E-mail'' não foi preenchido!");
		    a.Email.focus();
		 return false;
		 }
		 
	return true;
}
// ----------------------------------------------------------------------------------------------------

// ----------------------------------------------------------------------------------------------------
// Valida Formulário da abertura de conta ------------------------!=
function FormularioConta(b){
         b = document.Cadastro
         if(b.Obs_1.value == ""){
            alert("Alguma opção obrigatória em ''Registro e Transferência de Domínios'' não foi marcada!");
		 return false;
         }
		 
		 if(b.Dominio_1.value == ""){
            alert("O campo ''Domínio 1'' deve ser preenchido!");
            b.Dominio_1.focus();
		 return false;
         }
		 
		 if(b.Plano_1.value == ""){
            alert("O campo ''Plano 1'' não foi selecionado!");
            b.Plano_1.focus();
		 return false;
         }
		 
		 if(b.Quantidade.value != "1" && b.Dominio_2.value == ""){
            alert("O campo ''Dominio 2'' deve ser preenchido!");
            b.Dominio_2.focus();
		 return false;
         }
		 
		 if(b.Quantidade.value != "1" && b.Plano_2.value == ""){
            alert("O campo ''Plano 2'' não foi selecionado!");
            b.Plano_2.focus();
		 return false;
         }
		 
		 if(b.Quantidade.value != "1" && b.Quantidade.value != "2" && b.Dominio_3.value == ""){
            alert("O campo ''Dominio 3'' deve ser preenchido!");
            b.Dominio_3.focus();
		 return false;
         }
		 
		 if(b.Quantidade.value != "1" && b.Quantidade.value != "2" && b.Plano_3.value == ""){
            alert("O campo ''Plano 3'' não foi selecionado!");
            b.Plano_3.focus();
		 return false;
         }
		 
		 if(b.Senha.value == ""){
            alert("O campo ''Senha'' deve ser preenchido!");
            b.Senha.focus();
		 return false;
         }
		 
		 if(b.Senha_02.value == ""){
            alert("O campo ''Redigite a Senha'' deve ser preenchido!");
            b.Senha_02.focus();
		 return false;
         }
		 
		 if(b.NomeCliente.value == ""){
            alert("O campo ''Nome'' deve ser preenchido!");
            b.NomeCliente.focus();
		 return false;
         }
		 
		 if(b.EmailCliente.value == ""){
            alert("O campo ''E-mail'' deve ser preenchido!");
            b.EmailCliente.focus();
		 return false;
         }
		 
		 if(b.CpfCnpj.value == ""){
            alert("O campo ''CNPJ/CPF'' deve ser preenchido!");
            b.CpfCnpj.focus();
		 return false;
         }
		 
		 if(b.ContatoComercial.value == ""){
            alert("O campo ''Nome do contato comercial'' deve ser preenchido!");
            b.ContatoComercial.focus();
		 return false;
         }
		 
		 if(b.EmailComercial.value == ""){
            alert("O campo ''E-mail do contato comercial'' deve ser preenchido!");
            b.EmailComercial.focus();
		 return false;
         }
		 
		 if(b.ContatoFinanceiro.value == ""){
            alert("O campo ''Nome do contato financeiro'' deve ser preenchido!");
            b.ContatoFinanceiro.focus();
		 return false;
         }
		 
		 if(b.EmailFinanceiro.value == ""){
            alert("O campo ''E-mail do contato financeiro'' deve ser preenchido!");
            b.EmailFinanceiro.focus();
		 return false;
         }
		 
		 if(b.Tel_1.value == ""){
            alert("O campo ''Telefone'' deve ser preenchido!");
            b.Tel_1.focus();
		 return false;
         }
		 
		 if(b.Rua.value == ""){
            alert("O campo ''Endereço'' deve ser preenchido!");
            b.Rua.focus();
		 return false;
         }
		 
		 if(b.Numero.value == ""){
            alert("O campo ''Número'' deve ser preenchido!");
            b.Numero.focus();
		 return false;
         }
		 
		 if(b.Bairro.value == ""){
            alert("O campo ''Bairro'' deve ser preenchido!");
            b.Bairro.focus();
		 return false;
         }
		 
		 if(b.Cep.value == ""){
            alert("O campo ''CEP'' deve ser preenchido!");
            b.Cep.focus();
		 return false;
         }
		 
		 if(b.Cidade.value == ""){
            alert("O campo ''Cidade'' deve ser preenchido!");
            b.Cidade.focus();
		 return false;
         }
		 
		 if(b.Estado.value == ""){
            alert("O campo ''Estado'' não foi selecionado!");
            b.Estado.focus();
		 return false;
         }
		 
		 if(b.FormaPagamento.value == ""){
            alert("O campo ''Forma de Pagamento'' não foi selecionado!");
            b.FormaPagamento.focus();
		 return false;
         }
		 
		 if(b.Vencimentos.value == ""){
            alert("O campo ''Vencimentos'' não foi selecionado!");
            b.Vencimentos.focus();
		 return false;
         }
		 
		 if(b.DiaVencimento.value == ""){
            alert("O campo ''Dia do Vencimento'' não foi selecionado!");
            b.DiaVencimento.focus();
		 return false;
         }
		 
		 if(b.Aceite.value == ""){
            alert("O campo ''Assinatura'' deve ser preenchido!");
            b.Aceite.focus();
		 return false;
         }
	return true;
}

// Valida Formulario Cadastro Noticias ---------------------
function FormularioCadastroNoticias(c){
         c = document.CadastroNoticias
		 if(c.IdCategoria.value == ""){
		 alert("O campo ''Categoria'' deve ser preenchido!");
		 c.IdCategoria.focus();
		 return false;
		 }
		 
		 if(c.Titulo.value == ""){
		 alert("O campo ''Título'' deve ser preenchido!");
		 c.Titulo.focus();
		 return false;
		 }
		 
		 if(c.Resumo.value == ""){
		 alert("O campo ''Resumo'' deve ser preenchido!");
		 c.Resumo.focus();
		 return false;
		 }
		 
    return true; 
}


// ----------------------------------------------------------------------------------------------------
//-->