function doRating(eID,rating,type,listener){
// CONFIRM
var conf = confirm("You are about to give this entry a rating of "+rating+".\n\nAre you sure?");
if (conf){
function number_format( number, decimals, dec_point, thousands_sep ) {
    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
    var d = dec_point == undefined ? "." : dec_point;
    var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
    var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;  
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
$.post("./submit_rating.php", {eID:eID,rating:rating,type:type},
function(data){
	//alert(data);
//success|Thank you! You rated this tenant $rating out of $max_rating for $friendly_rating_type.|$tID|$rating_type|$total|$ratings|$max_rating|$rating_object_width	
var response = data.split("|");
var response_entry_id = response[2];
var response_votes = response[3];
var response_total = response[4];
var response_max_rating = response[5];
var response_rating_object_width = response[6];
var response_rating_type = response[7];
//
var current_rating = number_format(response_total/response_votes,2,'.','');
// RESIZE VOTES DONE DIV
var rating_width = number_format(response_total/response_votes,2,'.','')*response_rating_object_width;
//
if (response[0] == "error"){
	alert(response[1]);
	
} else {
// resize yellow stars
$('#vote_stars_div_'+eID+'_'+type).width(rating_width);
// REMOVE EACH INDIVIDUAL STAR *BUTTON*
var vote_div = '';
//alert(eID);
for (d=1; d <= response_max_rating; d++){
// these are the actual clickable (blue) stars
$('#vote_div_'+eID+'_'+type+'_'+d).hide();
}
// PLURAL TENSE?
if (response_votes > 1){
	var vote_tense = 'votes';
} else {
	var vote_tense = 'vote';
}
var newvotes = parseInt(response_votes);
$('#vote_text_div_'+eID+'_'+type).html('('+newvotes+' '+vote_tense+')');
// ADD TEXT ETC.
//$('#vote_text_div_'+response_entry_id+'_'+response_rating_type).html('Current Rating: <span class="rating_digits">'+current_rating+'/'+response_max_rating+'</span> ('+response_votes+' '+vote_tense+')');
// UPDATE MAIN RATING DIV WITH NEW ALT AND TITLE
//$("body").find('#ratingblock_'+response_entry_id+'_'+response_rating_type).attr('title','Currently '+current_rating+'/'+response_max_rating);
}// END ELSE SUCCESS
//
} // END JQUERY POST DATA FUNCTION
); // END POST
} // END CONFIRM
} // END DORATING FUNCTION