// JavaScript Document
jscadastro={
	txtLogin : '',
	txtSenha : '',
	
	login : function(){
		document.getElementById('txtLoginGeral').style.backgroundColor="#ffffff";
		document.getElementById('txtSenhaGeral').style.backgroundColor="#ffffff";
			
		this.txtLogin = document.getElementById('txtLoginGeral').value;
		this.txtSenha = document.getElementById('txtSenhaGeral').value;

		if (this.validaLogin() == ''){
			var retorno = classCadastro.login(this.txtLogin, this.txtSenha).value;

			if (retorno != 'Erro'){
				window.location.href = window.location.href;
			}else{
				document.getElementById('txtLoginGeral').style.backgroundColor="#ecb2b1";
				document.getElementById('txtSenhaGeral').style.backgroundColor="#ecb2b1";
			}
		}
	},
	
	login2 : function(){
		document.getElementById('txtLoginGeral2').style.backgroundColor="#ffffff";
		document.getElementById('txtSenhaGeral2').style.backgroundColor="#ffffff";
			
		this.txtLogin = document.getElementById('txtLoginGeral2').value;
		this.txtSenha = document.getElementById('txtSenhaGeral2').value;

		if (this.validaLogin2() == ''){
			var retorno = classCadastro.login(this.txtLogin, this.txtSenha).value;

			if (retorno != 'Erro'){
				//window.location.href = '../CHOPP_EXPRESS/produtos.aspx';
				//alert(FuncoesGerais.BuscaParametro('p'));
				window.location.href = '..' + FuncoesGerais.BuscaParametro('p');
			}else{
				document.getElementById('txtLoginGeral2').style.backgroundColor="#ecb2b1";
				document.getElementById('txtSenhaGeral2').style.backgroundColor="#ecb2b1";
			}
		}
	},
	
	validaLogin : function(){
		var msg = '';
		
		if (FuncoesGerais.ValidaEmail(this.txtLogin) == 0){
			document.getElementById('txtLoginGeral').style.backgroundColor="#ecb2b1";
			msg = 'erro';
		}
		if (this.txtSenha == ''){
			document.getElementById('txtSenhaGeral').style.backgroundColor="#ecb2b1";
			msg = 'erro';
		}
		
		return msg;
	},
	
	validaLogin2 : function(){
		var msg = '';
		
		if (FuncoesGerais.ValidaEmail(this.txtLogin) == 0){
			document.getElementById('txtLoginGeral2').style.backgroundColor="#ecb2b1";
			msg = 'erro';
		}
		if (this.txtSenha == ''){
			document.getElementById('txtSenhaGeral2').style.backgroundColor="#ecb2b1";
			msg = 'erro';
		}
		
		return msg;
	},
	
	abreLogin : function(){
		document.getElementById('divSenhaSucesso').style.display = 'none';
		document.getElementById('divEsqueciSenha').style.display = 'none';
		document.getElementById('divLogin').style.display = '';
	},
	
	abreLogin2 : function(){
		document.getElementById('fieldSenhaSucesso').style.display = 'none';
		document.getElementById('fieldEsqueciSenha').style.display = 'none';
		document.getElementById('fieldLogin').style.display = '';
	},
	
	abreEsqueciSenha : function(){
		document.getElementById('divLogin').style.display = 'none';
		document.getElementById('divEsqueciSenha').style.display = '';
	},
	
	abreEsqueciSenha2 : function(){
		document.getElementById('fieldLogin').style.display = 'none';
		document.getElementById('fieldEsqueciSenha').style.display = '';
	},
	
	esqueciSenha : function(){
		document.getElementById('txtEsqueciSenhaGeral').style.backgroundColor="";
		
		var email = document.getElementById('txtEsqueciSenhaGeral').value;
		
		if (email != ''){
			retorno = classCadastro.enviaSenha(email).value;
		
			if (retorno == 'OK'){
				document.getElementById('divEsqueciSenha').style.display = 'none';
				document.getElementById('divSenhaSucesso').style.display = '';
				document.getElementById('txtEsqueciSenhaGeral').value = '';
			}else{
				document.getElementById('txtEsqueciSenhaGeral').style.backgroundColor="#ecb2b1";
			}
		}else{
			document.getElementById('txtEsqueciSenhaGeral').style.backgroundColor="#ecb2b1";
		}
	},
	
	esqueciSenha2 : function(){
		document.getElementById('txtEsqueciSenhaGeral2').style.backgroundColor="";
		
		var email = document.getElementById('txtEsqueciSenhaGeral2').value;
		
		if (email != ''){
			retorno = classCadastro.enviaSenha(email).value;
		
			if (retorno == 'OK'){
				document.getElementById('fieldEsqueciSenha').style.display = 'none';
				document.getElementById('fieldSenhaSucesso').style.display = '';
				document.getElementById('txtEsqueciSenhaGeral2').value = '';
			}else{
				document.getElementById('txtEsqueciSenhaGeral2').style.backgroundColor="#ecb2b1";
			}
		}else{
			document.getElementById('txtEsqueciSenhaGeral2').style.backgroundColor="#ecb2b1";
		}
	},
	
	idCadastro : 0,
	nome : '',
	sexo : '',
	nascimento : '',
	cpf : '',
	cep : '',
	estado : '',
	cidade : '',
	endereco : '',
	numero : '',
	complemento : '',
	bairro : '',
	telResidencial : '',
	telCelular : '',	
	operadora : '',	
	estadoCivil : '',
	filhos : '',	
	email : '',
	profissao : '',
	time : '',
	senha : '',
	infoMarca : '',
	infoCelular : '',
	
	enviar : function(){
		this.limpaValidacao();
		msg = this.valida();
		if (msg == ''){
			this.idCadastro = document.getElementById('Menu1_hidCadastro').value;
			
			if (this.idCadastro == 0){
				var retorno = classCadastro.insere(this.nome, this.sexo, this.nascimento, this.cpf, this.cep, this.cidade, this.endereco, this.numero, this.complemento, this.bairro, this.telResidencial, this.telCelular, this.operadora, this.estadoCivil, this.filhos, this.email, this.profissao, this.time, '', '', '', '', this.senha, this.infoMarca, this.infoCelular).value;
			}else{
				var retorno = classCadastro.atualiza(this.idCadastro, this.nome, this.sexo, this.nascimento, this.cpf, this.cep, this.cidade, this.endereco, this.numero, this.complemento, this.bairro, this.telResidencial, this.telCelular, this.operadora, this.estadoCivil, this.filhos, this.email, this.profissao, this.time, '', '', '', '', this.senha, this.infoMarca, this.infoCelular, '', 0).value;
			}

			if (retorno != 'erro'){
				document.frmCadastro.reset();
				document.getElementById('frmCadastro').style.display = 'none';
				document.getElementById('btnSalvar').style.display = 'none';
				document.getElementById('divTitulo').style.display = 'none';
				document.getElementById('divFormulario').style.height = '350px';
				document.getElementById('divSucesso').style.display = '';
				document.getElementById('erroCpf').style.display = 'none';
				document.getElementById('erroEmail').style.display = 'none';
			}else{
				document.getElementById('txtCpf').style.backgroundColor="#ecb2b1";
				document.getElementById('txtEmail').style.backgroundColor="#ecb2b1";
				document.getElementById('erroCpf').style.display = '';
				document.getElementById('erroEmail').style.display = '';
			}
		}
	},
	
	AlteraInfoCel : function(elemento,status){
		document.getElementById(elemento).style.display = status;
		if(status == 'none'){
		    document.getElementById('txtTel2DDD').value = '';
		    document.getElementById('txtTel2').value = '';
		    document.getElementById('cmbOperadora').value = '';
		}
	},
	
	valida : function(){
		this.nome = document.getElementById('txtNome').value;
		if (document.getElementById('radioSexoM').checked){
			this.sexo = 'M';
		}else if (document.getElementById('radioSexoF').checked){
			this.sexo = 'F';
		}
		this.nascimento = document.getElementById('txtAnoNascimento').value + '-' + document.getElementById('txtMesNascimento').value + '-' + document.getElementById('txtDiaNascimento').value;
		this.cpf = document.getElementById('txtCpf').value;
		this.cep = document.getElementById('txtCep1').value + '-' + document.getElementById('txtCep2').value;
		this.estado = document.getElementById('cmbEstado').value;
		this.cidade = document.getElementById('cmbCidade').value;
		this.endereco = document.getElementById('txtEndereco').value;
		this.numero = document.getElementById('txtNumero').value;
		this.complemento = document.getElementById('txtComplemento').value;
		this.bairro = document.getElementById('txtBairro').value;
		this.telResidencial = document.getElementById('txtTel1DDD').value + '-' + document.getElementById('txtTel1').value;
		this.telCelular = document.getElementById('txtTel2DDD').value + '-' + document.getElementById('txtTel2').value;
		this.operadora = document.getElementById('cmbOperadora').value;
		this.estadoCivil = document.getElementById('cmbEstadoCivil').value;
		this.filhos = document.getElementById('cmbFilhos').value;
		this.email = document.getElementById('txtEmail').value;
		this.profissao = document.getElementById('txtProfissao').value;
		this.time = document.getElementById('txtTime').value;
		this.senha = document.getElementById('txtSenha').value;
		confirmaSenha = document.getElementById('txtConfirmaSenha').value;
		if (document.getElementById('radioInfoMarcaS').checked){
			this.infoMarca = '1';
		}else if (document.getElementById('radioInfoMarcaN').checked){
			this.infoMarca = '0';
		}
		if (document.getElementById('radioInfoCelularS').checked){
			this.infoCelular = '1';
		}else if (document.getElementById('radioInfoCelularN').checked){
			this.infoCelular = '0';
		}
				
		msg = '';
		if (this.nome == ''){
			document.getElementById('txtNome').style.backgroundColor="#ecb2b1";
			msg = 'Nome';
		}
		if (this.sexo == ''){
			document.getElementById('spanSexo').style.backgroundColor="#ecb2b1";
			msg = 'Sexo';
		}
		if (FuncoesGerais.ValidaDataSeparada(document.getElementById('txtDiaNascimento').value, document.getElementById('txtMesNascimento').value, document.getElementById('txtAnoNascimento').value) == 0){
			document.getElementById('txtDiaNascimento').style.backgroundColor="#ecb2b1";
			document.getElementById('txtMesNascimento').style.backgroundColor="#ecb2b1";
			document.getElementById('txtAnoNascimento').style.backgroundColor="#ecb2b1";
			msg = 'Nascimento';
		}
		if (classCadastro.calculaData(this.nascimento).value < 18){
			document.getElementById('txtDiaNascimento').style.backgroundColor="#ecb2b1";
			document.getElementById('txtMesNascimento').style.backgroundColor="#ecb2b1";
			document.getElementById('txtAnoNascimento').style.backgroundColor="#ecb2b1";
			msg = 'Nascimento';
		}
		if (FuncoesGerais.checaCPF(this.cpf) == false){
			document.getElementById('txtCpf').style.backgroundColor="#ecb2b1";
			msg = 'CPF';
		}
		if (this.cep == '-'){
			document.getElementById('txtCep1').style.backgroundColor="#ecb2b1";
			document.getElementById('txtCep2').style.backgroundColor="#ecb2b1";
			msg = 'CEP';
		}
		if (this.estado == ''){
			document.getElementById('cmbEstado').style.backgroundColor="#ecb2b1";
			document.getElementById('optionEstado').style.backgroundColor="#ecb2b1";
			msg = 'Estado';
		}
		if (this.cidade == ''){
			document.getElementById('cmbCidade').style.backgroundColor="#ecb2b1"
			document.getElementById('optionCidade').style.backgroundColor="#ecb2b1"
			msg = 'Cidade';
		}
		if (this.endereco == ''){
			document.getElementById('txtEndereco').style.backgroundColor="#ecb2b1";
			msg = 'Endereco';
		}
		if (this.numero == ''){
			document.getElementById('txtNumero').style.backgroundColor="#ecb2b1";
			msg = 'Numero';
		}
		if (this.bairro == ''){
			document.getElementById('txtBairro').style.backgroundColor="#ecb2b1";
			msg = 'Bairro';
		}
		if (this.telResidencial == '-' || this.telResidencial == 'DDD-'){
			document.getElementById('txtTel1DDD').style.backgroundColor="#ecb2b1";
			document.getElementById('txtTel1').style.backgroundColor="#ecb2b1";
			msg = 'Telefone 1';
		}
		if (FuncoesGerais.ValidaEmail(this.email) == 0){
			document.getElementById('txtEmail').style.backgroundColor="#ecb2b1";
			msg = 'E-mail';
		}
		if (this.senha == ''){
			document.getElementById('txtSenha').style.backgroundColor="#ecb2b1";
			msg = 'Senha';
		}
		if (this.senha != confirmaSenha || confirmaSenha == ''){
			document.getElementById('txtConfirmaSenha').style.backgroundColor="#ecb2b1";
			msg = 'Senha';
		}
		if (this.infoMarca == ''){
			document.getElementById('txtInfoMarcaS').style.backgroundColor="#ecb2b1";
			document.getElementById('txtInfoMarcaN').style.backgroundColor="#ecb2b1";
			msg = 'Marca';
		}
		if (this.infoCelular == ''){
			document.getElementById('txtInfoCelularS').style.backgroundColor="#ecb2b1";
			document.getElementById('txtInfoCelularN').style.backgroundColor="#ecb2b1";
			msg = 'Celular';
		}

		return msg;
	},
	
	limpaValidacao : function(){
		document.getElementById('txtNome').style.backgroundColor="#e0e0e0";
		document.getElementById('spanSexo').style.backgroundColor="";
		document.getElementById('txtDiaNascimento').style.backgroundColor="#e0e0e0";
		document.getElementById('txtMesNascimento').style.backgroundColor="#e0e0e0";
		document.getElementById('txtAnoNascimento').style.backgroundColor="#e0e0e0";
		document.getElementById('txtCep1').style.backgroundColor="#e0e0e0";
		document.getElementById('txtCep2').style.backgroundColor="#e0e0e0";
		document.getElementById('cmbEstado').style.backgroundColor="#e0e0e0";
		document.getElementById('optionEstado').style.backgroundColor="#e0e0e0";
		document.getElementById('cmbCidade').style.backgroundColor="#e0e0e0";
		document.getElementById('optionCidade').style.backgroundColor="#e0e0e0";
		document.getElementById('txtEndereco').style.backgroundColor="#e0e0e0";
		document.getElementById('txtNumero').style.backgroundColor="#e0e0e0";
		document.getElementById('txtComplemento').style.backgroundColor="#e0e0e0";
		document.getElementById('txtBairro').style.backgroundColor="#e0e0e0";
		document.getElementById('txtTel1DDD').style.backgroundColor="#e0e0e0";
		document.getElementById('txtTel1').style.backgroundColor="#e0e0e0";
		document.getElementById('txtTel2DDD').style.backgroundColor="#e0e0e0";
		document.getElementById('txtTel2').style.backgroundColor="#e0e0e0";
		document.getElementById('txtEmail').style.backgroundColor="#e0e0e0";
		document.getElementById('txtSenha').style.backgroundColor="#e0e0e0";
		document.getElementById('txtConfirmaSenha').style.backgroundColor="#e0e0e0";
		document.getElementById('txtInfoMarcaS').style.backgroundColor="";
		document.getElementById('txtInfoMarcaN').style.backgroundColor="";
		document.getElementById('txtInfoCelularS').style.backgroundColor="";
		document.getElementById('txtInfoCelularN').style.backgroundColor="";
	},
	
	carregaPeloCEP : function(){
	    vCEP = document.getElementById('txtCep1').value + '-' + document.getElementById('txtCep2').value;
	    objDT = classCadastro.retornaEndereco(vCEP);
	    if(objDT.error == null){
			var dt = objDT.value;
			if(dt!=null && typeof(dt) == "object"){
				document.getElementById('txtEndereco').value = dt.Rows[0].tp_logradouro + ' ' + dt.Rows[0].logradouro;
				document.getElementById('txtBairro').value = dt.Rows[0].bairro;
				document.getElementById('cmbEstado').value= dt.Rows[0].uf;
				this.carregaCidade(dt.Rows[0].uf);
				var opt = document.getElementById('cmbCidade').options;
				
				for(var i=0; i<opt.length; i++){
					if (document.getElementById('cmbCidade').options[i].text == dt.Rows[0].cidade){
						document.getElementById('cmbCidade').value = document.getElementById('cmbCidade').options[i].value;
					}
				}
			}
		}
	},
	
	carregaCidade : function(estado){
		document.getElementById('cmbCidade').disabled = ''
		
		response = classCidades.seleciona(0, estado, '', 1);

		if(response.error == null){
			var retorno = response.value;
			var dt = retorno;

			if(dt!=null && typeof(dt) == "object"){
				//define a quantidade de itens do dropdown(1 a mais da quantidade de itens do dataset)
				document.getElementById('cmbCidade').length =dt.Rows.length+1;
				
				//adiciona um item no dropdown
				document.getElementById('cmbCidade').options[0].id= 'optionCidade';
				document.getElementById('cmbCidade').options[0].text= 'Selecione';
				document.getElementById('cmbCidade').options[0].value= '';
				
				//adiciona os itens do dataset no dropdown
				for(var i=0; i<dt.Rows.length; i++){
					var row = dt.Rows[i];
					document.getElementById('cmbCidade').options[i+1].text= row.cidade;
					document.getElementById('cmbCidade').options[i+1].value= row.idCidade;
				}
			} 
		}else{
			document.getElementById('cmbCidade').length = 1;
		}
	},
	
	idEndereco : 0,
	tipoEndereco : '',
	
	abreExcluiEndereco : function(idEndereco){
		this.idEndereco = idEndereco
		lightbox.abrir('divExcluirEndereco');
	},
	
	excluiEndereco : function(){
	    lightbox.fechar();
	    this.idCadastro = document.getElementById('Menu1_hidCadastro').value;
		classCadastro.deletaEndereco(this.idEndereco);
		//window.location.href = window.location.href;
		document.getElementById('divEnderecos').innerHTML = CHOPP_EXPRESS_endereco.carregaEnderecos(this.idCadastro).value;
	},
	
	abreEndereco : function(idEndereco, tipoEndereco){
		this.idCadastro = document.getElementById('Menu1_hidCadastro').value;
		this.idEndereco = idEndereco;
		this.tipoEndereco = tipoEndereco;

		if (tipoEndereco != ''){
			if (idEndereco == 0){
				retorno = classCadastro.seleciona(this.idCadastro, '', '', '', 1).value;
				document.getElementById('radioEnderecoCadastrado').checked = true;
			}else{
				retorno = classCadastro.selecionaEndereco(idEndereco, 0, '', 1).value;
				document.getElementById('radioEndereco'+idEndereco).checked = true;
			}
			var dt = retorno;

			if(dt!=null && typeof(dt) == "object"){
				var row = dt.Rows[0];

				if (row.nome != undefined){
					document.getElementById('txtNome').value = row.nome;
				}else if (row.descricao != undefined){
					document.getElementById('txtNome').value = row.descricao;
				}else{
					document.getElementById('txtNome').value = '';
				}
				arrayCep = row.cep.split('-');
				document.getElementById('txtCep1').value = arrayCep[0];
				try{
					document.getElementById('txtCep2').value = arrayCep[1];
				}catch(erro){}
				document.getElementById('cmbEstado').value = row.estado;
				this.carregaCidade(row.estado);
				document.getElementById('cmbCidade').value = row.idCidade;
				document.getElementById('txtEndereco').value = row.endereco;
				document.getElementById('txtNumero').value = row.numero;
				document.getElementById('txtComplemento').value = row.complemento;
				document.getElementById('txtBairro').value = row.bairro;
				if (row.referencia != undefined){
					document.getElementById('txtReferencia').value = row.referencia;	
				}else{
					document.getElementById('txtReferencia').value = '';
				}
			}
		}else{
			document.getElementById('txtNome').value = '';
			document.getElementById('txtCep1').value = '';
			document.getElementById('cmbEstado').value = '';
			document.getElementById('cmbCidade').length = 1;
			document.getElementById('txtEndereco').value = '';
			document.getElementById('txtNumero').value = '';
			document.getElementById('txtComplemento').value = '';
			document.getElementById('txtBairro').value = '';
			document.getElementById('txtReferencia').value = '';
		}
		
		document.getElementById('divEndereco').style.display = '';
	},
	
	salvarEndereco : function(){
		this.limpaEndereco();
		msg = this.validaEndereco();
		if (msg == ''){
			this.idCadastro = document.getElementById('Menu1_hidCadastro').value;
			if (this.tipoEndereco == ''){
				if (this.idEndereco == 0){
					retorno = classCadastro.insereEndereco(this.idCadastro, this.nome, '', this.cidade, this.endereco, this.numero, this.complemento, '', '', this.bairro, this.cep, this.referencia).value;
					document.getElementById('divEnderecos').innerHTML = CHOPP_EXPRESS_endereco.carregaEnderecos(this.idCadastro).value;
					document.getElementById('radioEndereco' + retorno).checked = true;
				}else{
					retorno = classCadastro.atualizaEndereco(this.idEndereco, this.nome, '', this.cidade, this.endereco, this.numero, this.complemento, '', '', this.bairro, this.cep, this.referencia, 0).value;
				}
			}else{
				if (this.idEndereco == 0){
					retorno = classCadastro.atualiza(this.idCadastro, '', '', '1900-01-01', '', this.cep, this.cidade, this.endereco, this.numero, this.complemento, this.bairro, '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, this.referencia, 2).value;
				}else{
					retorno = classCadastro.atualizaEndereco(this.idEndereco, this.nome, '', this.cidade, this.endereco, this.numero, this.complemento, '', '', this.bairro, this.cep, this.referencia, 0).value;
				}
			}
			//jsprodutos.encomendarFinal();
			document.getElementById('divEndereco').style.display = 'none';
		}
	},
	
	validaEndereco : function(){
		this.nome = document.getElementById('txtNome').value;
		this.cep = document.getElementById('txtCep1').value + '-' + document.getElementById('txtCep2').value;
		this.estado = document.getElementById('cmbEstado').value;
		this.cidade = document.getElementById('cmbCidade').value;
		this.endereco = document.getElementById('txtEndereco').value;
		this.numero = document.getElementById('txtNumero').value;
		this.complemento = document.getElementById('txtComplemento').value;
		this.bairro = document.getElementById('txtBairro').value;
		this.referencia = document.getElementById('txtReferencia').value;
				
		msg = '';
		if (this.nome == ''){
			document.getElementById('txtNome').style.backgroundColor="#ecb2b1";
			msg = 'Nome';
		}
		if (this.cep == '-'){
			document.getElementById('txtCep1').style.backgroundColor="#ecb2b1";
			document.getElementById('txtCep2').style.backgroundColor="#ecb2b1";
			msg = 'CEP';
		}
		if (this.estado == ''){
			document.getElementById('cmbEstado').style.backgroundColor="#ecb2b1";
			document.getElementById('optionEstado').style.backgroundColor="#ecb2b1";
			msg = 'Estado';
		}
		if (this.cidade == ''){
			document.getElementById('cmbCidade').style.backgroundColor="#ecb2b1"
			document.getElementById('optionCidade').style.backgroundColor="#ecb2b1"
			msg = 'Cidade';
		}
		if (this.endereco == ''){
			document.getElementById('txtEndereco').style.backgroundColor="#ecb2b1";
			msg = 'Endereco';
		}
		if (this.numero == ''){
			document.getElementById('txtNumero').style.backgroundColor="#ecb2b1";
			msg = 'Numero';
		}
		if (this.bairro == ''){
			document.getElementById('txtBairro').style.backgroundColor="#ecb2b1";
			msg = 'Bairro';
		}
		if (this.referencia == ''){
			document.getElementById('txtReferencia').style.backgroundColor="#ecb2b1";
			msg = 'Senha';
		}

		return msg;
	},
	
	limpaEndereco : function(){
		document.getElementById('txtNome').style.backgroundColor="#e0e0e0";
		document.getElementById('txtCep1').style.backgroundColor="#e0e0e0";
		document.getElementById('txtCep2').style.backgroundColor="#e0e0e0";
		document.getElementById('cmbEstado').style.backgroundColor="#e0e0e0";
		document.getElementById('optionEstado').style.backgroundColor="#e0e0e0";
		document.getElementById('cmbCidade').style.backgroundColor="#e0e0e0";
		document.getElementById('optionCidade').style.backgroundColor="#e0e0e0";
		document.getElementById('txtEndereco').style.backgroundColor="#e0e0e0";
		document.getElementById('txtNumero').style.backgroundColor="#e0e0e0";
		document.getElementById('txtComplemento').style.backgroundColor="#e0e0e0";
		document.getElementById('txtBairro').style.backgroundColor="#e0e0e0";
		document.getElementById('txtReferencia').style.backgroundColor="#e0e0e0";
	},
	
	comoChegar : function(valor){
		document.getElementById('frmFacilitometro'+valor).submit();
	},
	
	rota : function(valor){
		document.getElementById('frmRotaFacilitometro'+valor).submit();
	},
	
	tipoFavoritos : function(valor){
		this.idCadastro = document.getElementById('Menu1_hidCadastro').value;
		document.getElementById('ulListaFavoritos').innerHTML = '';
		document.getElementById('ulListaFavoritos').innerHTML = CADASTRO_favoritos.carregaBares(this.idCadastro, valor).value;
		document.getElementById('ulTrajetos').innerHTML = '';
		document.getElementById('ulTrajetos').innerHTML = CADASTRO_favoritos.carregaRotas(this.idCadastro, valor).value;
		init_dw_Scroll();
		init_dw_Scroll2();
	},
	
	logoff : function(){
		classCadastro.logOff();
		window.location.href = window.location.href;
	},
	
	estadoLoja:'',
	
	carregaCidadeLoja : function(estado){
	    this.estadoLoja = estado;
		document.getElementById('cmbCidadeLoja').length=0;
		if(estado!=''){
			var dt = CHOPP_EXPRESS_endereco.carregaLoja(this.estadoLoja, '',7).value;
			if(dt!=null && typeof(dt) == "object"){
				//define a quantidade de itens do dropdown(1 a mais da quantidade de itens do dataset)
				document.getElementById('cmbCidadeLoja').length = dt.Rows.length + 1;
				//adiciona um item no dropdown
				document.getElementById('cmbCidadeLoja').options[0].text= 'Selecione';
				document.getElementById('cmbCidadeLoja').options[0].value= '';
				//adiciona os itens do dataset no dropdown
				for(var i=0; i<dt.Rows.length; i++){
					var row = dt.Rows[i];
					document.getElementById('cmbCidadeLoja').options[i+1].text= row.cidade;
					document.getElementById('cmbCidadeLoja').options[i+1].value= row.cidade;
				}
				
				this.carregaLoja('');
				//document.getElementById('cmbCidadeLoja').disabled = false;
			}
		}
	},
	
	carregaLoja : function(cidade){
		document.getElementById('cmbLoja').length=0;
		if(this.estadoLoja!=''){
			var dt = CHOPP_EXPRESS_endereco.carregaLoja(this.estadoLoja, cidade,6).value;
			if(dt!=null && typeof(dt) == "object"){
				//define a quantidade de itens do dropdown(1 a mais da quantidade de itens do dataset)
				document.getElementById('cmbLoja').length = dt.Rows.length + 1;
				//adiciona um item no dropdown
				document.getElementById('cmbLoja').options[0].text= 'Selecione';
				document.getElementById('cmbLoja').options[0].value= '';
				//adiciona os itens do dataset no dropdown
				for(var i=0; i<dt.Rows.length; i++){
					var row = dt.Rows[i];
					document.getElementById('cmbLoja').options[i+1].text= row.nome;
					document.getElementById('cmbLoja').options[i+1].value= row.idLoja;
				}
				
				//document.getElementById('cmbLoja').disabled = false;
			}
		}
	}
}