<!--
	function ajaxInit(){
		var xmlhttp;
		try{ xmlhttp = new XMLHttpRequest(); }
		catch(ee) {
			try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch(e) {
				try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch(E){ xmlhttp = false ;	}
			}
		}
		return xmlhttp;
	}

	function carregar(formulario, pagina, local) {
		ajax = ajaxInit();
		document.getElementById(local).innerHTML += "Carregando ...";
		if(ajax){
			ajax.open('POST', pagina+'.php', true);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			ajax.onreadystatechange = function(){
				if(ajax.readyState == 1) { idOpcao.innerHTML = "Carregando..."; }
				if(ajax.readyState == 4) {
					if(ajax.status == 200) {
						document.getElementById(local).innerHTML = ajax.responseText;
					}
				}
			}
			var params = capturaDados(formulario);
			ajax.send(params);
			document.getElementById(local).innerHTML = '';
		}
	}

	function capturaDados(formulario){
		var arrayFormulario = document.getElementsByTagName('form');
		var campos = '';
		var navegador = navigator.appName;
		if(navegador == 'Netscape'){
			inicioArray = arrayFormulario[formulario].length;
			i=1;
			for(chaves in arrayFormulario[formulario]){ 
				if(i <= inicioArray ){
					if(campos!=''){ campos = campos + '&' }
					campos = campos + chaves + '=' + arrayFormulario[formulario][chaves].value;
				}i++;
			}
		} else {
			nCampos = arrayFormulario[formulario].length;
			totalArray=1;
			for(chaves in arrayFormulario[formulario]){ totalArray++; }
			inicioArray = totalArray-nCampos;
			i=1;
			for(chaves in arrayFormulario[formulario]){ 
				if(i >= inicioArray ){
					if(campos!=''){ campos = campos + '&' }
					campos = campos + chaves + '=' + arrayFormulario[formulario][chaves].value;
				}i++;
			}
		}
		return campos;
	}

	function numeros(e,src){
		if(window.event) { _TXT = e.keyCode; } 
			else if(e.which) { _TXT = e.which; }
			if(_TXT > 47 && _TXT < 58) { 
				return true;
			} else {
				if (_TXT != 8) { return false; } 
				else { return true; }
		}
	}

	function validacaoTeste(){
		var d = document.formTeste;
		var i, j=0;
		var frase = ' é de preenchimento obrigatório!';
		if(d.nome_razao.value == ''){ alert('O campo "Nome/Razão Social"' + frase); d.nome_razao.focus(); return false; }
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value))) { alert("Dados inválidos no campo Email. Favor verificar!"); d.email.focus(); return false; }
		if(d.endereco.value == ''){ alert('O campo "Endereço"' + frase); d.endereco.focus(); return false; }
		if(d.bairro.value == ''){ alert('O campo "Bairro"' + frase); d.bairro.focus(); return false; }
		if(d.cidade.value == ''){ alert('O campo "Cidade"' + frase); d.cidade.focus(); return false; }
		if(d.estado.value == ''){ alert('O campo "Estado"' + frase); d.estado.focus(); return false; }
		if(d.cep.value == ''){ alert('O campo "CEP"' + frase); d.cep.focus(); return false; }
		switch(d.tipo_documento.value){
			case 'cpf': if(!ValidaCPF(d.cpf.value)){ alert("Digite um CPF válido!"); d.cpf.focus(); return false; } break;
			case 'cnpj': if(d.cnpj.value == ''){ alert("Digite o CNPJ "); d.cnpj.focus(); return false; } break;
			default: alert('O campo "Doc."' + frase); d.tipo_documento.focus(); return false;
		}
		if(d.telefone.value == ''){ alert('O campo "Telefone"' + frase); d.telefone.focus(); return false; }
		if(d.rg.value == ''){ alert('O campo "RG"' + frase); d.rg.focus(); return false; }
		if(d.marca_modelo.value == ''){ alert('O campo "Marca/Modelo"' + frase); d.marca_modelo.focus(); return false; }
		if(d.tamanho.value == ''){ alert('O campo "Tamanho"' + frase); d.tamanho.focus(); return false; }
		if(d.numero_serie.value == ''){ alert('O campo "Número de Série"' + frase); d.numero_serie.focus(); return false; }
		if(d.valor_midia.value == ''){ alert('O campo "Mídia"' + frase); d.valor_midia.focus(); return false; }
		if(d.valor_so.value == ''){ alert('O campo "SO"' + frase); d.valor_so.focus(); return false; }

		if(d.principais_pastas.value == ''){ alert('O campo "Principais Pastas, Sub-Pastas e Arquivos"' + frase); d.principais_pastas.focus(); return false; }
		if(d.principais_arquivos.value == ''){ alert('O campo "Principais tipos de arquivos"' + frase); d.principais_arquivos.focus(); return false; }
		if(d.descricao_ocorrido.value == ''){ alert('O campo "Descreva o ocorrido"' + frase); d.descricao_ocorrido.focus(); return false; }
		if(d.valor_tentativa.value == 'sim'){
			if(d.descreva_recuperacao.value == ''){ alert('O campo "Descreva"' + frase); d.descreva_recuperacao.focus(); return false; }
		}
		return true;
	}


	function ValidaCPF(numcpf){
		if(numcpf != "" ){
			numcpf = numcpf.substr(0, 3) + numcpf.substr(4, 3) + numcpf.substr(8, 3) + numcpf.substr(12, 2);
			if (numcpf == "00000000000" || 
				numcpf == "11111111111" || 
				numcpf == "22222222222" || 
				numcpf == "33333333333" || 
				numcpf == "44444444444" || 
				numcpf == "55555555555" || 
				numcpf == "66666666666" || 
				numcpf == "77777777777" || 
				numcpf == "88888888888" || 
				numcpf == "99999999999") {
				return false;
			} else {
				x = 0;
				soma = 0;
				dig1 = 0;
				dig2 = 0;
				texto = "";
				numcpf1="";
				len = numcpf.length;
				x = len -1;
				for (var i=0; i <= len - 3; i++) {
					y = numcpf.substring(i,i+1);
					soma = soma + ( y * x);
					x = x - 1;
					texto = texto + y;
				}
				dig1 = 11 - (soma % 11);
				if (dig1 == 10) dig1=0 ;
				if (dig1 == 11) dig1=0 ;
				numcpf1 = numcpf.substring(0,len - 2) + dig1 ;
				x = 11; soma=0;
				for (var i=0; i <= len - 2; i++) {
					soma = soma + (numcpf1.substring(i,i+1) * x);
					x = x - 1;
				}
				dig2= 11 - (soma % 11);
				if (dig2 == 10) dig2=0;
				if (dig2 == 11) dig2=0;
				if ((dig1 + "" + dig2) == numcpf.substring(len,len-2)) {
					return true;
				}
				return false;
			}
		} else { return false; }
	}

	/*function validaCNPJ(CNPJ){
		if (CNPJ.length < 18) { return false; }
		if ((CNPJ.charAt(3) != ".") || (CNPJ.charAt(7) != ".") || (CNPJ.charAt(11) != "/") || (CNPJ.charAt(16) != "-")){ return false; } 
        if(document.layers && parseInt(navigator.appVersion) == 4){
			x = CNPJ.substring(0,3);
			x += CNPJ. substring (3,7);
			x += CNPJ. substring (7,11);
			x += CNPJ. substring (11,16);
			x += CNPJ. substring (16,18);
			CNPJ = x;
		} else {
			CNPJ = CNPJ. replace (".","");
			CNPJ = CNPJ. replace (".","");
			CNPJ = CNPJ. replace ("-","");
			CNPJ = CNPJ. replace ("/","");
		}
		var nonNumbers = /\D/;
		if (nonNumbers.test(CNPJ)) { return false; }
       	tot  = 0; peso = 2; 
		for (i = 0;  i <= 12;  i++){ 
			tot += peso * parseInt(CNPJ.charAt(12 - i)); 
			peso++; 
			if(peso == 10){ peso = 2; } 
		} 
		if ((tot * 10 % 11 % 10) != parseInt(CNPJ.charAt(13))) { return false; } else { return true; }
	}*/

	function MM_format(e,src,mask) {
		if(window.event) { _TXT = e.keyCode; } 
		else if(e.which) { _TXT = e.which; }
		if(_TXT > 47 && _TXT < 58) { 
			var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i)
			if (texto.substring(0,1) != saida) {
				src.value += texto.substring(0,1);
			} 
			return true;
			} else {
				if (_TXT != 8) { return false; } 
				else { return true; }
		}
	}

	function setaDocumento(tipo){
		if(tipo != ""){
			document.getElementById('cpf').style.display = 'none';
			document.getElementById('cnpj').style.display = 'none';
			document.getElementById(tipo).style.display = 'block';
			document.getElementById(tipo).value = '';
		} else {
			document.getElementById('cpf').style.display = 'none';
			document.getElementById('cnpj').style.display = 'none';
		}
	}
	
	
	function validacaoContato(){
		var e = document.formContato;
		var frase = ' é de preenchimento obrigatório!';
		
		if(e.nome.value == ''){ alert('O campo Nome"' + frase); e.nome.focus(); return false; }
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e.email_contato.value))) { alert("Dados inválidos no campo Email. Favor verificar!"); e.email_contato.focus(); return false; }
		if(e.assunto.value == ''){ alert('O campo Assunto"' + frase); e.assunto.focus(); return false; }
		if(e.mensagem.value == ''){ alert('O campo Mensagem"' + frase); e.mensagem.focus(); return false; }
		return true;
	}
	
-->