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

var http = createRequestObject();

function sndReq(action) {
    http.open('get', 'vote.php?action='+action);
    http.onreadystatechange = handleResponse;
    http.send(null);
}
function sndReqArg(action,arg) {
    http.open('get', 'vote.php?action='+action+'&arg='+arg);
    http.onreadystatechange = handleResponse;
    http.send(null);
}
function vote(entry_id, rating) {
 					//	for(i=1;i<=5;i++){ 
           // 	if (rating == i) {
            //		document.getElementById('vote_'+entry_id+'_'+i).style.background = "#FFBBBB";
            //	} else {
            //	  document.getElementById('vote_'+entry_id+'_'+i).style.background = "none";
            //	}
           // }
 		http.open('get', 'vote.php?id='+entry_id+'&rate='+rating);
   // http.onreadystatechange = handleResponse;
    http.send(null);
}
function handleResponse2() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            for(i=1;i<=5;i++){ 
            	if (update[0] == i) {
            		document.getElementById('vote_'+update[1]+'_'+i).style.background = update[2];
            	} else {
            	  document.getElementById('vote_'+update[1]+'_'+i).style.background = "";
            	}
            }
        }
    }
}

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
        }
    }
}     