Ajax = new AbrirAjax();

function ExecAjaxShowMatches(strdados){
	//var strdados = document.getElementById("tournaments").value;
	Ajax.open("post","show_incs.php",true);
	Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	Ajax.onreadystatechange = function(){
			if(Ajax.readyState == 4 ){
				document.getElementById('ShowMatchesTable').innerHTML = Ajax.responseText;
			}
			if(Ajax.readyState == 1 ){
				html = "<center><img src='images/loading.gif' alt='Carregando...' /></center>";
				document.getElementById("ShowMatchesTable").innerHTML = html;
			}
		}
	Ajax.send("value=" + strdados + "&type=ShowMatches");
}

function ExecAjaxShowResults(strdados){
	//var strdados = document.getElementById("tournaments").value;
	Ajax.open("post","show_incs.php",true);
	Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	Ajax.onreadystatechange = function(){
			if(Ajax.readyState == 4 ){
				document.getElementById('ShowResultsTable').innerHTML = Ajax.responseText;
			}
			if(Ajax.readyState == 1 ){
				html = "<center><img src='images/loading.gif' alt='Carregando...' /></center>";
				document.getElementById("ShowResultsTable").innerHTML = html;
			}
		}
	Ajax.send("value=" + strdados + "&type=ShowResults");
}

function ExecAjaxShowClubs(strdados){
	//var strdados = document.getElementById("tournaments").value;
	Ajax.open("post","show_incs.php",true);
	Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	Ajax.onreadystatechange = function(){
			if(Ajax.readyState == 4 ){
				document.getElementById('ShowClubsTable').innerHTML = Ajax.responseText;
			}
			if(Ajax.readyState == 1 ){
				html = "<center><img src='images/loading.gif' alt='Carregando...' /></center>";
				document.getElementById("ShowClubsTable").innerHTML = html;
			}
		}
	Ajax.send("value=" + strdados + "&type=ShowClubs");
}

function ShowOtherRoundMatch(rounds,tournament){
	Ajax.open("post","show_incs.php",true);
	Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	Ajax.onreadystatechange = function(){
			if(Ajax.readyState == 4 ){
				document.getElementById('ShowMatchesTable').innerHTML = Ajax.responseText;
			}
			if(Ajax.readyState == 1 ){
				html = "<center><img src='images/loading.gif' alt='Carregando...' /></center>";
				document.getElementById("ShowMatchesTable").innerHTML = html;
			}
		}
	Ajax.send("rounds=" + rounds + "&tournament=" + tournament + "&type=ShowNextRoundMatch");
}

function ShowOtherRoundMatch(rounds,tournament){
	Ajax.open("post","show_incs.php",true);
	Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	Ajax.onreadystatechange = function(){
			if(Ajax.readyState == 4 ){
				document.getElementById('ShowMatchesTable').innerHTML = Ajax.responseText;
			}
			if(Ajax.readyState == 1 ){
				html = "<center><img src='images/loading.gif' alt='Carregando...' /></center>";
				document.getElementById("ShowMatchesTable").innerHTML = html;
			}
		}
	Ajax.send("rounds=" + rounds + "&tournament=" + tournament + "&type=ShowNextRoundMatch");
}

function Valida(email,id){
	
	Ajax.open("post","valida.php",true);
	Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	
	if(id==1){
		Ajax.onreadystatechange = function(){
			if(Ajax.readyState == 4 ){
				document.getElementById('ResponseEmail').innerHTML = Ajax.responseText;
			}
			if(Ajax.readyState == 1 ){
				html = "<center><img src='images/loading.gif' alt='Carregando...' /></center>";
				document.getElementById("ResponseEmail").innerHTML = html;
			}
		}
		Ajax.send("email=" + email + "&id=" + id);
	}
	
	if(id==2){
			Ajax.onreadystatechange = function(){
			if(Ajax.readyState == 4 ){
				document.getElementById('Pendencias').innerHTML = Ajax.responseText;
			}
			if(Ajax.readyState == 1 ){
				html = "<center><img src='images/loading.gif' alt='Carregando...' /></center>";
				document.getElementById('Pendencias').innerHTML = html;
			}
		}
		var txtNome = document.getElementById('txtNome').value;
		var txtSobrenome = document.getElementById('txtSobrenome').value;
		var txtCpf = document.getElementById('txtCpf').value;
		var txtDataNascimento = document.getElementById('txtDataNascimento').value;
		var RdSexoF = document.getElementById('F').checked;
		var RdSexoM = document.getElementById('M').checked;
		var SelTime = document.getElementById('SelTime').value;
		var txtOutroTime = document.getElementById('txtOutroTime').value;
		var txtEmail = document.getElementById('txtEmail').value;
		var txtPassSenha = document.getElementById('txtPassSenha').value;
		var txtPassCSenha = document.getElementById('txtPassCSenha').value;
		var txtCep = document.getElementById('txtCep').value;
		var txtEndereco = document.getElementById('txtEndereco').value;
		var txtNumero = document.getElementById('txtNumero').value;
		var txtBairro = document.getElementById('txtBairro').value;
		var txtCidade = document.getElementById('txtCidade').value;
		var txtEstado = document.getElementById('txtEstado').value;
		var txtPais = document.getElementById('txtPais').value;
		var indication = document.getElementById('indication').value;
		var chkTermo = document.getElementById('chkTermo').checked;
		
		Ajax.send(
			"id=" + id +
			"&stxtNome=" + txtNome +
			"&stxtSobrenome=" + txtSobrenome +
			"&stxtCpf=" + txtCpf +
			"&stxtDataNascimento=" + txtDataNascimento +
			"&sRdSexoF=" + RdSexoF +
			"&sRdSexoM=" + RdSexoM +
			"&sSelTime=" + SelTime +
			"&stxtOutroTime=" + txtOutroTime +
			"&stxtEmail=" + txtEmail +
			"&stxtPassSenha=" + txtPassSenha +
			"&stxtPassCSenha=" + txtPassCSenha +
			"&stxtCep=" + txtCep +
			"&stxtEndereco=" + txtEndereco +
			"&stxtNumero=" + txtNumero +
			"&stxtBairro=" + txtBairro +
			"&stxtCidade=" + txtCidade +
			"&stxtEstado=" + txtEstado +
			"&stxtPais=" + txtPais +
			"&schkTermo=" + chkTermo +
			"&sindication=" + indication
		);
	}
	
}
function RespEnquete(){
	Ajax.open("post","resp_enquete.php",true);
	Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	Ajax.onreadystatechange = function(){
			if(Ajax.readyState == 4 ){
				document.getElementById('Denquete').innerHTML = Ajax.responseText;
			}
			if(Ajax.readyState == 1 ){
				html = "<center><img src='images/loading.gif' alt='Carregando...' /></center>";
				document.getElementById("Denquete").innerHTML = html;
			}
		}
	var chkResposta = document.getElementById('resposta').value;
	
	Ajax.send("&schkResposta=" + chkResposta);
}