var http = createRequestObject();
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
} else {
ro = new XMLHttpRequest();
}
return ro;
}

function react() {
if(http.readyState == 4) {
var response = http.responseText;
returned = response.split('|');
if(response.indexOf('|' != -1)) {
var id=returned[1];
var antstem=returned[2];
var status=returned[0];

if(status == '1') {
document.getElementById('stempunten'+id).innerHTML = '<a href="#" class="bottun">gestemd</a>';
document.getElementById('antstem'+id).innerHTML = '<b>'+antstem+'</b><br />stemmen';
} else if(status == '2') {
document.getElementById('stempunten'+id).innerHTML = '<a href="#" class="bottun">gestemd</a>';
} else if(status == '0') {
document.getElementById('stempunten'+id).innerHTML = '<a href="http://www.misdaad-nieuws.nl/inloggen.html" class="bottun">Inloggen</a>';
}
}
}
}

function stem(id) {
document.getElementById('stempunten'+id).innerHTML = '<a href="" class="bottun"><img src="http://www.misdaad-nieuws.nl/indicator.gif" /></a>';
http.open('get', 'http://www.misdaad-nieuws.nl/stemmen.php?id='+id);
http.onreadystatechange = react;
http.send(null);
}
