var xmlHttp

function setVote(question)
{
	var thevote = 0;
	for (var i=0; i < document.trainingform.vote.length; i++)
	{
		if (document.trainingform.vote[i].checked)
		{
			thevote = document.trainingform.vote[i].value;
		}
	}
	if (thevote != 0)
	{
		getVote(question,thevote);
	}
}


function getVote(question, int)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="polling_vote.php"
	url=url+"?question="+question
	url=url+"&vote="+int
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("polling").
		innerHTML=xmlHttp.responseText;
	} 
} 

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}
