var xmlHttpPoll
var x;

function check_vote()
{

chosen = ""
len = document.vote_form.vote.length

for (i = 0; i <len; i++) {
if (document.vote_form.vote[i].checked) {
chosen = document.vote_form.vote[i].value
}
}

if (chosen == "") {
alert("maak een keuze")
}
else {
getVote(chosen)
}

}

function getVote(int)
{

//document.writeln('hello world!');

xmlHttpPoll=GetXmlHttpObjectPoll()
if (xmlHttpPoll==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="_pages/_home/_code/_poll/poll.php"
url=url+"?vote="+int
url=url+"&sid="+Math.random()
xmlHttpPoll.onreadystatechange=statePollChanged 
xmlHttpPoll.open("GET",url,true)
xmlHttpPoll.send(null)
} 

function statePollChanged() 
{ 
 if (xmlHttpPoll.readyState==4 || xmlHttpPoll.readyState=="complete")
 { 
 document.getElementById("poll").
 innerHTML=xmlHttpPoll.responseText;
 } 
} 

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