	/*var req;

	function loadXMLDoc(url,valor){ 

		req = null; 

		if (window.XMLHttpRequest) { 

			req = new XMLHttpRequest(); 

			req.onreadystatechange = processReqChange; 

			req.open("GET", url+'?'+valor, true); 

			req.send(null);

		} else if (window.ActiveXObject) { 

			req = new ActiveXObject("Microsoft.XMLHTTP"); 

			if (req) { 

				req.onreadystatechange = processReqChange; 

				req.open("GET", url+'?'+valor, true); 

				req.send();

			}

		}

	}



	function processReqChange() {

		if(req.readyState == 4){

			if (req.status == 200) {

				document.getElementById('direita').innerHTML = req.responseText;

			} else { 

				alert("Houve um problema ao obter os dados:\n" + req.statusText);

			}

		}

	}



	function validaLogin(url, valor){	

		if(valor == 'nenhum'){

			document.getElementById('direita').innerHTML = '';

		}else{

			loadXMLDoc("socios_cadastrar.php",valor);

		}

	} */

	

	var req;

	function loadXMLDocEmail(url,valor){ 

		req = null; 

		if (window.XMLHttpRequest) { 

			req = new XMLHttpRequest(); 

			req.onreadystatechange = processReqChangeEmail; 

			req.open("GET", url+'?'+valor, true); 

			req.send(null);

		} else if (window.ActiveXObject) { 

			req = new ActiveXObject("Microsoft.XMLHTTP"); 

			if (req) { 

				req.onreadystatechange = processReqChangeEmail; 

				req.open("GET", url+'?'+valor, true); 

				req.send();

			}

		}

	}



	function processReqChangeEmail() {

		if(req.readyState == 4){

			if (req.status == 200) {

				document.getElementById('LAYER_ESQUECEU_SENHA').innerHTML = req.responseText;

			} else { 

				alert("Houve um problema ao obter os dados:\n" + req.statusText);

			}

		}

	}



	function perfilXML(url, valor){	

		if(valor == 'nenhum'){

			document.getElementById('LAYER_ESQUECEU_SENHA').innerHTML = '';

		}else{

			loadXMLDocEmail(url,valor);

		}

	}



	function loadingLogin() {

		document.getElementById('LAYER_VALIDA_LOGIN').innerHTML = '';

		document.getElementById('CarregandoLogin').innerHTML = "<img src='./img/lendo.gif'> lendo informações...";

	}// JavaScript Document

	

	function confereFormLogin(login, senha) {

		if (login == '' || senha == '') {

			alert('Favor informar login e senha.');

		} else {

			document.formLogin.submit();

		}

	}

	function show_layer_ext(id, action1, action2) {

		// Opera

		if(navigator.userAgent.indexOf("Opera") != -1 && document.getElementById)

			type="OP";

		// Internet Explorer e.g. IE4+

		if(document.all)

			type="IE";

		// Netscape version 4 :

		if(document.layers)

			type="NN";

		// Mozila e.g. Netscape 6 upwards

		if(!document.all && document.getElementById)

			type="MO";

		// Show/hide the layer

		if(type == "IE") {

			eval("document.all." + id + ".style.visibility='" + action1 + "'");

			eval("document.all." + id + ".style.display='" + action2 + "'");

		}

		if(type == "NN")

		{

			eval("document." + id + ".visibility='" + action1 + "'");

			eval("document." + id + ".display='" + action2 + "'");

		}

		if(type == "MO" || type == "OP")

		{

			eval("document.getElementById('" + id + "').style.visibility='" + action1 + "'");

			eval("document.getElementById('" + id + "').style.display='" + action2 + "'");

		}

	}

	

	function novoCadastro() {

		texto = '<div id=\"fundocadastrogeral\"><div id=\"conteudocadastro\"><div class="style2" id="entrar" style= "left:196px; top:196px; height:14px; color:#FFCC00; width:90px;background-color:">dd/mm/aaaa</div><form action=\"socios_cadastrar.php\" name=\"formSocio\" method=\"post\" ><div class=\"style2\" id=\"entrar\" style= \"left:344px; top:649px; height:14px; width:61px;background-color:\"><a href=\"javascript: perfil(\'novo\')\" name=\"efeitolistaa\" class=\"style7 style1\"  id=\"efeitolistaa\" style= \"left:127px; top:61px; height:19px;width:66px;background:;\">ENVIAR</a></div><div id=\"Layer28\" style= \"left:41px; top:57px; height:18px; width:340px;\"><input name=\"nome\" type=text class=\"style2\" id=\"nome\" style=\"border-width:0; border-color:#FFE535; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:330px;background-color:#151515\" maxlength=\"80\"></div><div id=\"Layer28\" style= \"left:41px; top:125px; height:16px; width:330px;\"><input name=\"email\" type=\"text\" class=\"style2\" id=\"email\" style=\"border-width:0; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:330px;background-color:#151515\" value=\"\" maxlength=\"80\" /></div><div id=\"Layer28\" style= \"left:41px; top:197px; height:16px; width:150px;\"><input name=\"nascimento\" type=\"text\" class=\"style2\" id=\"nascimento\" style=\"border-width:0; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:150px;background-color:#151515\" value=\"\" maxlength=\"10\" /></div><div id=\"Layer28\" style= \"left:41px; top:260px; height:16px; width:150px;\"><input name=\"localismo\" type=\"text\" class=\"style2\" id=\"localismo\" style=\"border-width:0; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:150px;background-color:#151515\" value=\"\" maxlength=\"40\" /></div><div id=\"Layer28\" style= \"left:41px; top:318px; height:16px; width:150px;\"><input name=\"login\" type=\"text\" class=\"style2\" id=\"login\" style=\"border-width:0; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:150px;background-color:#151515\" value=\"\" maxlength=\"15\" /></div><div id=\"Layer28\" style= \"left:41px; top:380px; height:16px; width:150px;\"><input name=\"senha\" type=\"password\" class=\"style2\" id=\"senha\" style=\"border-width:0; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:150px;background-color:#151515\" value=\"\" maxlength=\"10\" /></div><div id=\"Layer28\" style= \"left:41px; top:442px; height:16px; width:150px;\"><input name=\"senha2\" type=\"password\" class=\"style2\" id=\"senha2\" style=\"border-width:0; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:150px;background-color:#151515\" value=\"\" maxlength=\"10\" /></div><div id=\"Layer28\" style= \"left:11px; top:510px; height:23px; width:24px;\"><input name=\"preferencia[]\" type=\"checkbox\" value=\"surf\" class=\"check\" id=\"preferencia[]\"/></div><div id=\"Layer28\" style= \"left:129px; top:510px; height:23px; width:24px;\"><input name=\"preferencia[]\" type=\"checkbox\" class=\"check\" id=\"preferencia[]\" value=\"bodyboard\"/></div><div id=\"Layer28\" style= \"left:282px; top:570px; height:23px; width:24px;\"><input name=\"interesse[]\" type=\"checkbox\" value=\"video\" class=\"check\" id=\"interesse[]\"/></div><div id=\"Layer28\" style= \"left:129px; top:570px; height:23px; width:24px;\"><input name=\"interesse[]\" type=\"checkbox\" value=\"acessorio\" class=\"check\" id=\"interesse[]\"/></div><div id=\"Layer28\" style= \"left:11px; top:570px; height:23px; width:24px;\"><input name=\"interesse[]\" type=\"checkbox\" value=\"roupa\" class=\"check\" id=\"interesse[]\"/></div><div id=\"Layer28\" style= \"left:11px; top:623px; height:11px; width:24px;\"><input name=\"informacao\" type=\"checkbox\" value=\"1\" class=\"check\" id=\"informacao\"/><input type=\"hidden\" name=\"action\" value=\"novo\" /></div></form></div></div>';



		document.getElementById('direita').innerHTML = texto;

	}



	function editarPerfil() {

		//validaLogin("socios_cadastrar.php", "action=formAtualizarCadastro");
		Atualiza("action=formAtualizarCadastro","direita","socios_cadastrar.php");

	}	

	

	function checaEmail(email) {



		if (email.value == "") {

			//alert("Informe seu e-mail.");

			email.focus();

			email.select();

			return false;

		} else {

			prim = email.value.indexOf("@")

			if(prim < 2) {

				///alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf("@",prim + 1) != -1) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf(".") < 1) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf(" ") != -1) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf("zipmeil.com") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf("hotmeil.com") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf(".@") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf("@.") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf(".com.br.") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf("/") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf("[") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf("]") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf("(") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf(")") > 0) {

				///alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

			if(email.value.indexOf("..") > 0) {

				//alert("O e-mail informado parece não estar correto.");

				email.focus();

				email.select();

				return false;

			}

		}

			return true;

	}

	

	function validaData(str) { 



		dia = (str.value.substring(0,2)); 

	    mes = (str.value.substring(3,5)); 

		ano = (str.value.substring(6,10)); 

	

		cons = true; 

		

		// verifica se foram digitados números

		if (isNaN(dia) || isNaN(mes) || isNaN(ano)){

			alert("Preencha a data somente com números."); 

			str.value = "";

			str.focus(); 

			return false;

		}

			

	    // verifica o dia valido para cada mes 

	    if ((dia < 01)||(dia < 01 || dia > 30) && 

			(mes == 04 || mes == 06 || 

			 mes == 09 || mes == 11 ) || 

			 dia > 31) { 

	    	cons = false; 

		} 

	

		// verifica se o mes e valido 

		if (mes < 01 || mes > 12 ) { 

			cons = false; 

		} 

	

		// verifica se e ano bissexto 

		if (mes == 2 && ( dia < 01 || dia > 29 || 

		   ( dia > 28 && 

		   (parseInt(ano / 4) != ano / 4)))) { 

			cons = false; 

		} 

	    

		if (cons == false) { 

			//alert("A data inserida não é válida: " + str.value); 

			str.value = "";

			str.focus(); 

			return false;

		} 

	}



	function validaCadastroSocio(acao) {

	/*	PRIMEIRO VALIDAR SE OS CAMPOS ESTÃO EM BRANCO	*/

		mensagem = '';

		

		if (document.formSocio.nome.value == '') {

			mensagem += "Nome:\n";

		}

		

		if (document.formSocio.email.value == '') {

			mensagem += "Email:\n";

		} else {

			if(checaEmail(document.formSocio.email) == false) {

				mensagem += "Email inválido: \n";

			}

		}

		

		if (document.formSocio.nascimento.value == '') {

			mensagem += "Nascimento:\n"

		} else {

			if (validaData(document.formSocio.nascimento) == false) {

				mensagem += "Nascimento inválido:\n"

			}

		}

		

		if (document.formSocio.login.value == '') {

			mensagem += "Login:\n"

		}

		

		if (acao == 'novo' || document.formSocio.senha.value != '') {

			if (document.formSocio.senha.value == '') {

				mensagem += "Senha:\n"

			}

			

			if (document.formSocio.senha2.value == '') {

				mensagem += "Repetição da senha:\n"

			}

		}

		

		if (mensagem != '') {

			mensagem = "Os seguintes campos são de preenchimento obrigatório.\nFavor informá-los.\n\n"+mensagem;

			alert(mensagem);

			return false;

		} else {

		/*	SE NÃO EXISTE NENHUM CAMPO EM BRANCO */

		/*	VERIFICAR SE AS SENHAS SÃO IGUAIS	*/

			if (document.formSocio.senha.value != document.formSocio.senha2.value) {

				alert('As senhas não se conferem, favor corrigí-las.');

				return false;

			}

		}

		return true;

	}

	

	function perfil(acao) {

		if (validaCadastroSocio(acao)) {

		

			nome = document.formSocio.nome.value;

			email = document.formSocio.email.value;

			nascimento = document.formSocio.nascimento.value;

			localismo = document.formSocio.localismo.value;

			login = document.formSocio.login.value;

			senha = document.formSocio.senha.value;

			//preferencia = document.formSocio.elements['preferencia[]'].value;

			//interesse = document.formSocio.elements['interesse[]'].value;

			//informacao = document.formSocio.informacao.value;

			get = '';

			

			if (acao == 'atualizar') {

				idSocioQ = document.formSocio.idSocioQ.value;

				get+= '&login2='+document.formSocio.login2.value; 

			} else {

				idSocioQ = '';

			}

			

			

			for (i = 0; i < document.formSocio.elements['preferencia[]'].length; i++) {

				if (document.formSocio.elements['preferencia[]'][i].checked) {

					get += '&preferencia[]='+document.formSocio.elements['preferencia[]'][i].value;

				}

			}

			

			for (i = 0; i < document.formSocio.elements['interesse[]'].length; i++) {

				if (document.formSocio.elements['interesse[]'][i].checked) {

					get += '&interesse[]='+document.formSocio.elements['interesse[]'][i].value;

				}

			}

			

			if (document.formSocio.informacao.checked == true) {

				get += '&informacao='+document.formSocio.informacao.value;

			}

			

			//document.getElementById('direita').innerHTML = '';

			loadingSocio();

			valor = 'action='+acao+'&idSocioQ='+idSocioQ+'&nome='+nome+'&email='+email+'&nascimento='+nascimento+'&localismo='+localismo+'&login='+login+'&senha='+senha+''+get;

			//validaLogin("socios_cadastrar.php",valor);
			Atualiza(valor,"direita","socios_cadastrar.php");

		}

		

	}

	

	function loginEsqueceu() {

		texto = '<form name="formLogin" action="socios_cadastrar.php?action=logar" method="post"><div id="fundoesqueceu"><div class="style2" id="cadastre" style= "left:51px; top:41px;  height:16px;  width:117px;"><a href="javascript: novoCadastro()" ><div id="Layer27"><img src="img/botao.gif" width="100" height="12" border="0"></div></a></div><div id="Layer28" style= "left:37px; top:114px; height:18px;  width:340px;"><input name="loginEmail" type="text" class="style2" style="border-width:0; border-color:#FFE535; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:330px;background-color:#151515" value="" maxlength="80"></div><div id="Layer28" style= "left:34px; top:182px; height:18px;  width:340px;"></div><div class="style2" id="entrar" style= "left:11px; top:248px; height:14px; width:77px;background-color:"><a href="javascript: voltarTelaLogin()" name="efeitolistaa" class="style7 style1"  id="efeitolistaa" style= "left:127px; top:61px; height:19px;width:66px;background:;">VOLTAR</a></div><div class="style2" id="entrar" style= "left:327px; top:248px; height:14px; width:77px;background-color:"><a href="javascript: enviarEsqueceu(document.formLogin.loginEmail.value);" name="efeitolistaa" class="style7 style1"  id="efeitolistaa" style= "left:127px; top:61px; height:19px;width:66px;background:;">ENVIAR</a></div><div class="style2" id="entrar" style= "left:30px; top:248px; height:14px; width:112px;background-color:"></div></div><div class="style2" id="LAYER_ESQUECEU_SENHA" style= "left:5px; top:216px; height:14px; width:383px; text-align:center;background-color:; color:#FFCC00; z-index:10"></div></form>';

		document.getElementById('LAYER_VALIDA_LOGIN').innerHTML = texto;

	}

	

	function enviarEsqueceu(email) {

		if (email == '') {

			alert('Favor informar o email.');

		} else {

			document.getElementById('LAYER_ESQUECEU_SENHA').innerHTML = 'Aguarde...';

			valor = 'action=esqueceuEmail&email='+email;

			perfilXML("socios_cadastrar.php", valor);

		}

	}

	

	function loadingSocio() {

		texto = '<div id="fundosociosgeral"  style="z-index:2"><div id="fundo22"><div class="style2" id="entrar" style= "left:156px; top:161px; height:116px; width:103px;background-color:"><img src="img/carregando.gif" width="98" height="94"><br>CARREGANDO....</div></div></div>';

		document.getElementById('direita').innerHTML = texto;

	}

	

	function favoritosSocioQ() {

		loadingSocio();

		//validaLogin("socios_cadastrar.php", "action=favoritos");
		Atualiza("action=favoritos","direita","socios_cadastrar.php");
		

	}

	

	function voltarTelaLogin() {

		texto = '<form name="formLogin" action="socios_cadastrar.php?action=logar" method="post"><div id="Layer25socio"><div class="style2" id="cadastre" style= "left:51px; top:41px;  height:16px;  width:117px;"><a href="javascript: novoCadastro()" ><div id="Layer27"><img src="img/botao.gif" width="100" height="12" border="0"></div></a></div><div id="Layer28" style= "left:37px; top:114px; height:18px;  width:340px;"><input name="loginNome" type="text" class="style2" style="border-width:0; border-color:#FFE535; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:330px;background-color:#151515" value="" maxlength="15" ></div><div id="Layer28" style= "left:34px; top:182px; height:18px;  width:340px;"><input name="loginSenha" type="password" class="style2" style="border-width:0; border-color:#FFE535; font-family:HelveticaNeue;src: url(fonts/HelveticaNeue.dfont);font-weight: bold;  color:#FFE535; left:5px; top:20px; height:16px;  width:330px;background-color:#151515" value="" maxlength="10"></div><div class="style2" id="entrar" style= "left:327px; top:248px; height:14px; width:77px;background-color:"><a href="javascript: confereFormLogin(document.formLogin.loginNome.value, document.formLogin.loginSenha.value);" name="efeitolistaa" class="style7 style1"  id="efeitolistaa" style= "left:127px; top:61px; height:19px;width:66px;background:;">ENTRAR</a></div><div class="style2" id="entrar" style= "left:30px; top:248px; height:14px; width:112px;background-color:"><a href="javascript: loginEsqueceu();" name="efeitolistaa" class="style7 style1"  id="efeitolistaa" style= "left:127px; top:61px; height:19px;width:66px;background:;">ESQUECEU?</a></div></div></form>';

		document.getElementById('LAYER_VALIDA_LOGIN').innerHTML = texto;

	}
