

// Reference: <!-- http://www.somecoders.com/2006/05/make-an-ajax-poll/ -->
function rkd_vote(filename, querystring,  callback){
    var xmlhttp=false; //Clear our fetching variable
    try {
	xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); 
    } catch (e) {
	try {
	    xmlhttp = new
		ActiveXObject('Microsoft.XMLHTTP'); 
	} catch (E) {
	    xmlhttp = false; }
    }
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	xmlhttp = new XMLHttpRequest(); }
    var file = filename+'?'+querystring;
    xmlhttp.open('GET', file, true);
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { 
	    var content = xmlhttp.responseText; 
	    callback(content);
        }
    }
    xmlhttp.send(null); //Nullify the XMLHttpRequest
}


function rkd_toggledisplay(item){
    var clickerlink=document.getElementById(item);
    if (clickerlink.style.display == "none")
	{
	    clickerlink.style.display = "";
	}
    else
	{
	    clickerlink.style.display = "none";
	}
    return ;
}

function rkd_vote2(id, vote){
    voteAreaName = new Array("votearea", id) ;
    voteAreaName = voteAreaName.join("_") ;
    queryString = new Array(id, vote) ;
    queryString = queryString.join("=") ;

    callback = function(serverReturn) {
	data = serverReturn.split('\n')[0];
	document.getElementById(voteAreaName).innerHTML = data;
    }
    document.getElementById(voteAreaName).innerHTML = "Please stand by...";
    // this makes a callback to change the area to the results of voting:
    rkd_vote("scripts/getvote.py.cgi", queryString, callback); 
    return false;
}


