var xmlHttp;
function mostrarSecao(q,f) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Seu navegador não suporta o nosso site, por favor tente utilizar Internet Explorer +6  ou Google Chrome.");
		return;
	}
	window.document.getElementById("preloading").style.display = "block";			
	if(f==null) {
		window.document.getElementById("topo").focus();
	}
	var url="includes/aj_vamovamo.php";
	url=url+"?secao="+q;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function detalharEvento(q) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Seu navegador não suporta o nosso site, por favor tente utilizar Internet Explorer +6  ou Google Chrome.");
		return;
	}
	window.document.getElementById("preloading").style.display = "block";			
	window.document.getElementById("topo").focus();
	var url="includes/aj_vamovamo.php";
	url=url+"?secao=agenda&info="+q;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function agendaPesquisar(q) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Seu navegador não suporta o nosso site, por favor tente utilizar Internet Explorer +6  ou Google Chrome.");
		return;
	}
	window.document.getElementById("preloading").style.display = "block";			
	window.document.getElementById("topo").focus();
	var url="includes/aj_vamovamo.php";
	url=url+"?secao=agenda&"+q;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function eflyersPesquisar(q) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Seu navegador não suporta o nosso site, por favor tente utilizar Internet Explorer +6 ou Google Chrome.");
		return;
	}
	window.document.getElementById("preloading").style.display = "block";			
	window.document.getElementById("preloading").focus();
	var url="includes/aj_vamovamo.php";
	url=url+"?secao=e-flyers&"+q;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function coberturasPesquisar(q) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Seu navegador não suporta o nosso site, por favor tente utilizar Internet Explorer +6  ou Google Chrome.");
		return;
	}
	window.document.getElementById("preloading").style.display = "block";			
	window.document.getElementById("preloading").focus();
	var url="includes/aj_vamovamo.php";
	url=url+"?secao=coberturas&"+q;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function validaCampoNick(q) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Seu navegador não suporta o nosso site, por favor tente utilizar Internet Explorer +6  ou Google Chrome.");
		return;
	}
	var url="includes/secoes/cadastro/valida_campos.php?";
	url=url+q;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=validaCadastroNick;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function validaCadastroNick() {
	if (xmlHttp.readyState==4) {
		if (xmlHttp.responseText >= "1") {
			document.getElementById("cadastro_erro_nick").style.display = "block";
			document.getElementById("cadastro_erro_nick").innerHTML="Esse nick já existe, por favor escolha outro.";
//			document.getElementById("validacao_nick").value = "0";										
			window.document.getElementById("cadastro_usuario_nick").focus();							
			window.document.getElementById("cadastro_usuario_nick").select();										
		} else { 
			document.getElementById("cadastro_erro_nick").style.display = "none";
//			document.getElementById("validacao_nick").disabled = "1";										
		}
	}
}

function stateChanged() {
	if (xmlHttp.readyState==4) {
		document.getElementById("conteudo_principal").innerHTML=xmlHttp.responseText;
		window.document.getElementById("preloading").style.display = "none";				
	}
}
function GetXmlHttpObject() {
	var xmlHttp=null;
		try {
		// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		} catch (e) {
		// Internet Explorer
			try {
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
	return xmlHttp;
}


function validaCampoEmail(q) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Seu navegador não suporta o nosso site, por favor tente utilizar Internet Explorer +6  ou Google Chrome.");
		return;
	}
	var url="includes/secoes/cadastro/valida_campos.php?";
	url=url+q;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=validaCadastroEmail;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function validaCadastroEmail() {
	if (xmlHttp.readyState==4) {
		if (xmlHttp.responseText >= "1") {
			document.getElementById("cadastro_erro_email").style.display = "block";
			document.getElementById("cadastro_erro_email").innerHTML="Outro usuário já está utilizando este e-mail, caso seja de sua propriedade tente utilizar a opção \"recuperar senha\" ou utilize outro endereço de e-mail.";
			window.document.getElementById("cadastro_usuario_email").focus();				
			window.document.getElementById("cadastro_usuario_email").select();							
		} else { 
			document.getElementById("cadastro_erro_email").style.display = "none";
		}
	}
}

function dialogoPromocao(q) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Seu navegador não suporta o nosso site, por favor tente utilizar Internet Explorer +6  ou Google Chrome.");
		return;
	}
	var url="includes/secoes/promocoes/box_promocoes.php?";
	url=url+q;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=inscrevePromocao;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}

function inscrevePromocao() {
	if (xmlHttp.readyState==4) {
		document.getElementById("caixa_dialogo").innerHTML = xmlHttp.responseText;
		document.getElementById("caixa_dialogo").style.display = "block";
		window.document.getElementById("topo").focus();
	}
}




function dialogoNewsletter(q) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Seu navegador não suporta o nosso site, por favor tente utilizar Internet Explorer +6  ou Google Chrome.");
		return;
	}
	var url="includes/secoes/principal/newsletter.php?";
	url=url+q;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=inscreveNewsletter;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}

function inscreveNewsletter() {
	if (xmlHttp.readyState==4) {
		document.getElementById("caixa_dialogo").innerHTML = xmlHttp.responseText;
		document.getElementById("caixa_dialogo").style.display = "block";

		window.document.getElementById("topo").focus();
		//		window.scrollBy(0,0);
	}
}

