var xmlHttp

function atualiza_equipes(playday,equipe,equipe_selecionada) { 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="pesquisa_playday_equipes.php"
	url=url+"?playday="+playday
	url=url+"&equipe="+equipe
	
	if (equipe_selecionada!="") {
		url=url+"&equipe_selecionada="+equipe_selecionada;
	}
	
	//encodeURIComponent()
	url=url+"&sid="+Math.random()
	
	if (equipe=="1") {
		xmlHttp.onreadystatechange=atualiza_equipe1_stateChanged
	}else{
		xmlHttp.onreadystatechange=atualiza_equipe2_stateChanged
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function atualiza_equipe1_stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 	
		document.getElementById("equipe_1").innerHTML= unescape(xmlHttp.responseText.replace(/\+/g," "))
	} else if (xmlHttp.readyState==1 || xmlHttp.readyState==2 || xmlHttp.readyState==3) { 	
		document.getElementById("equipe_1").innerHTML= "<p class='processando'><img src='pics/indicator.gif' /> Processando/Loading..</p>";
	}
} 

function atualiza_equipe2_stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 	
		document.getElementById("equipe_2").innerHTML= unescape(xmlHttp.responseText.replace(/\+/g," "))
	} else if (xmlHttp.readyState==1 || xmlHttp.readyState==2 || xmlHttp.readyState==3) { 	
		document.getElementById("equipe_2").innerHTML= "<p class='processando'><img src='pics/indicator.gif' /> Processando/Loading..</p>";
	}
} 

function showPlayDay(playday) { 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="pesquisa_playday.php"
	url=url+"?playday="+playday
	//encodeURIComponent()
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=playday_stateChanged
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function playday_stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 	
		document.getElementById("showplayday").innerHTML= unescape(xmlHttp.responseText.replace(/\+/g," "))
	} else if (xmlHttp.readyState==1 || xmlHttp.readyState==2 || xmlHttp.readyState==3) { 	
		document.getElementById("showplayday").innerHTML= "<p class='processando'><img src='pics/indicator.gif' /> Processando/Loading..</p>";
	}
} 

function GetXmlHttpObject() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

