var http_request = false;

function castVote(id, positive, forum_master) { makeRequest('/video.aspx','?id=' + id + '&action=vote&vote=' + positive + '&i=' + forum_master,id,positive); return false; }
function makeRequest(url, parameters, id, positive) { http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = function () { completeVoting(id,positive) }; http_request.open('GET', url + parameters, true); http_request.send(null); }

function completeVoting(id,positive) { 

if (http_request.readyState == 4) {
document.getElementById('voteSpan' + id).innerHTML = '<img src=\"/j/6c/images/blog/external-link-voted.png\" />';

if (positive == 1) {
document.getElementById('positiveVotes').innerHTML = parseInt(document.getElementById('positiveVotes').innerHTML) + 1;
}
document.getElementById('totalVotes').innerHTML = parseInt(document.getElementById('totalVotes').innerHTML) + 1;

}
}
