


function cur_val_cad() {
	cpf				=	document.form.cpf.value;
	nome			=	document.form.nome.value;
	email			=	document.form.email.value;
	senha			=	document.form.senha.value;
	nascimento		=	document.form.nascimento.value;
	endereco		=	document.form.endereco.value;
	bairro			=	document.form.bairro.value;
	cidade			=	document.form.cidade.value;
	pais			=	document.form.pais.value;
	nacionalidade	=	document.form.nacionalidade.value;


	if(!testaCPF(cpf)){
		alert('O campo CPF deve ser válido.');
		cur_muda_td('db');
		return false;
	}
	
	if(nome.length<3 || nome.length>100 ){
		alert('O campo NOME deve ser preenchido.');
		cur_muda_td('db');
		return false;
	}	
	
	if(!testaEmail(email)){
		alert('O campo E-MAIL deve ser válido.');
		cur_muda_td('db');
		return false;
	}
	
	if(senha.length<5 || senha.length>15 ){
		alert('O campo SENHA deve ser preenchido.');
		cur_muda_td('db');
		return false;
	}

	if(!testaData(nascimento)){
		alert('O campo NASCIMENTO deve ser válido.');
		cur_muda_td('dp');
		return false;
	}
	
	if(endereco.length<5 || endereco.length>200 ){
		alert('O campo ENDEREÇO deve ser preenchido.');
		cur_muda_td('dp');
		return false;
	}
	
	if(bairro.length<5 || bairro.length>50 ){
		alert('O campo BAIRRO deve ser preenchido.');
		cur_muda_td('dp');
		return false;
	}	
	
	if(cidade.length<5 || cidade.length>50 ){
		alert('O campo CIDADE deve ser preenchido.');
		cur_muda_td('dp');
		return false;
	}	
	
	if(pais.length<5 || pais.length>50 ){
		alert('O campo PAÍS deve ser preenchido.');
		cur_muda_td('dp');
		return false;
	}	
	
	if(nacionalidade.length<5 || nacionalidade.length>50 ){
		alert('O campo NACIONALIDADE deve ser preenchido.');
		cur_muda_td('dp');
		return false;
	}	
}


function cur_muda_td(qual) {
    todas	=	new Array("db", "dp", "fe", "id", "ex", "ep", "ic");

	td		=	"td_"+qual;
	fs		=	"fs_"+qual;

	document.getElementById(td).className		=	"cur-link-escolhido";
	document.getElementById(fs).style.display	=	"block";

	for(i=0;i<todas.length;i++){
			td_laco	=	"td_"+todas[i];
			fs_laco	=	"fs_"+todas[i];
		if(td != td_laco){
			document.getElementById(td_laco).className		=	"cur-link-sem-foco";
			document.getElementById(fs_laco).style.display	=	"none";
		}
	}

}


function cv_senha_perdida()
{
	email	=	window.prompt('Para recuperar sua senha digite seu E-mail:','');

	if(email != null)
	{
		xmlhttp	=	mount_XMLHttp();
		url	=	"../ajax/cv.senhaperdida.asp?email="+email;
		xmlhttp.open("GET", url,true);
	
		xmlhttp.onreadystatechange=function() {
		
			if(xmlhttp.readyState==4){
				alert(xmlhttp.responseText);
			}
		}
	
	xmlhttp.send(null);
	}
}



function ar_senha_perdida()
{
	email	=	document.form_senha_perdida.email_perdido.value;

	if(email != null)
	{
		xmlhttp	=	mount_XMLHttp();
		url	=	"../ajax/ar.senhaperdida.asp?email="+email;
		xmlhttp.open("GET", url,true);
	
		xmlhttp.onreadystatechange=function() {
		
			if(xmlhttp.readyState==4){
				alert(xmlhttp.responseText);
				document.getElementById('esqueci_pos').style.display	= 'none';
			}
		}
	
	xmlhttp.send(null);
	}
}

function ar_senha_perdida_toggle(act) {
    if(act=="show"){
		document.getElementById('esqueci_pos').style.display	= 'block';
	}else{
		document.getElementById('esqueci_pos').style.display	= 'none';
	}
}


function pop_up_center(local, w, h, scrol)
{
largura = screen.width;
altura 	= screen.height;
XX 		= (largura-w)/2;
YY		= (altura-h)/2;
janela = window.open(local,'POP_UP','width='+w+',height='+h+',left='+XX+',top='+YY+',scrollbars='+scrol+',status=no,resizable=yes, toolbar=no,directories=no,menubar=no');
janela.focus();
}


function show_onde_comprar(selObj)
{
valor	=	selObj.options[selObj.selectedIndex].value;

	onde_comprar(valor);
}


function show_onde_comprar_flash(valor)
{
	onde_comprar(valor);
}



function seta_cadastro()
{

nome	=	document.form_cad_news.news_nome.value;
email	=	document.form_cad_news.news_email.value;

xmlhttp	=	mount_XMLHttp();
url	=	"../ajax/ajax.cadastro.news.asp?a=1&nome="+nome+'&email='+email;
xmlhttp.open("GET", url,true);

xmlhttp.onreadystatechange=function() {

	if(xmlhttp.readyState==4){
		retorno	=	xmlhttp.responseText;
		document.getElementById('cadastro').style.display		= 'none';
		document.getElementById('cadastro_msg').style.display	= 'block';
		document.getElementById('cadastro_msg').innerHTML		= retorno;
			self.setTimeout('show_cad()', 4000) ;
	}
}
xmlhttp.send(null);
}


function show_cad()
{
	window.clearTimeout();
	document.getElementById('cadastro').style.display		= 'block';
	document.getElementById('cadastro_msg').style.display	= 'none';
	document.form_cad_news.reset();
}


function mount_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 _go(selObj)
{
valor = selObj.options[selObj.selectedIndex].value;
	if(valor != "#"){
		self.location = valor;
	}
}

function addToFavorites(pageName){
	if(window.external){
		window.external.AddFavorite(window.location,pageName);
	}else{
		alert('Desculpe, seu browser não suporta esta função. Efetue o procedimento manualmente.');
	}
}


	function exibe_resp(obj)
	{
		if (document.getElementById)
		{
			var style2 = document.getElementById(obj).style;
			style2.display = style2.display? "":"block";
		}
		else if (document.all)
		{
			var style2 = document.all[obj].style;
			style2.display = style2.display? "":"block";
		}
		else if (document.layers)
		{
			var style2 = document.layers[obj].style;
			style2.display = style2.display? "":"block";
		}
	}
