function postRating(id, action, path, imgIndex, submitUrl) {
	var postrate_options = { 'type': 'POST', 'url': submitUrl, 'data': 'id='+ id +'&action='+ action +'&path='+ path +'&imgIndex='+imgIndex, 'dataType': 'html', 'callbackFn': 'post_rate_results' };
	processAjax(postrate_options);
}

function post_rate_results(json) {
	var response = json.split('|');
		if(response[0] == 'done'){
            if(response[1]){
				//Changes the thumbs to dull gray and disable the action
                if (response[4] == 'dislike') {
                   var src = 'http://'+response[3]+'images/'+response[6];
				   jQuery("#down-"+response[1]+"-img").attr('src',src); 
                } else if (response[4] == 'like'){
                   var src = 'http://'+response[3]+'images/'+response[6];
				   jQuery("#up-"+response[1]+"-img").attr('src',src) 
                }
                jQuery("#down-"+response[1]).click ='';
                jQuery("#up-"+response[1]).click ='';
                //Update the karma number display
                if(!response[2]){
                	alert("Response has no value");
                }
                var karmanumber = response[2];
                //The below line is commented out because there is no karma number atm.
                if (document.getElementById("karma-"+response[1]+"-"+response[4]) != null) {
                   document.getElementById("karma-"+response[1]+"-"+response[4]).innerHTML = "&nbsp;("+karmanumber+")";
                }
                // deal with the single value total
                if (document.getElementById("karma-"+response[1]+"-total") != null) {
                   document.getElementById("karma-"+response[1]+"-total").innerHTML = response[5];
                }
            } else {
                alert("WTF ?");
            }
        }
        else if(response[0] == 'error')
        {
            var error = 'Error: '+response[1];
            alert(error);
        } else {
        	alert("Reponse: "+response[0]);
            alert("Karma not changed, please try again later.");
        }
}
