function createRequestObject() {
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

var http = createRequestObject();

function Like(action,comment_id) {
    http.open('get', 'thumb_rater.htm?rating='+action+'&comment_id='+comment_id, true);
    http.onreadystatechange = function(){ handleResponse(comment_id)};
    http.send(null);
}

function handleResponse(comment_id) {
if(http.readyState == 4){
    var response = http.responseText;
    var elements = new Array();
    elements = response.split("|");
    document.getElementById('amount_'+comment_id).innerHTML = elements[0];
    document.getElementById('total_'+comment_id).innerHTML = elements[1];
}
}

function DisLike(action,comment_id) {
    http.open('get', 'thumb_rater.htm?ratingd='+action+'&comment_id='+comment_id, true);
    http.onreadystatechange = function(){ handleResponse2(comment_id)};
    http.send(null);
}

function handleResponse2(comment_id) {
if(http.readyState == 4){
    var response = http.responseText;
    var elements = new Array();
    elements = response.split("|");
    document.getElementById('disagree_'+comment_id).innerHTML = elements[0];
    document.getElementById('total_'+comment_id).innerHTML = elements[1];
}
}

