function createRequestObject()
{
    var http;
    if (window.XMLHttpRequest)
    { // Mozilla, Safari, IE7 ...
        http = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    { // Internet Explorer 6
        http = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return http;
}

function rate_image(rate,affirmations_id) {
req = createRequestObject();
req.open("GET", 'rating.php?rating='+rate+'&affirmations_id='+affirmations_id+'', false);
req.send(null);
rating = (rate * 25);
document.getElementById('star-rating_'+affirmations_id).innerHTML = '<li class="current-rating" id="current-rating" style="width:'+rating+'px;"></li>'; 

}