function post_rating(postId, rating) {
		var divHtml;
		
		/* Validate data */
		var IsFound = /^-?\d+$/.test(postId);
		if ((IsFound == false) || ((rating != '1') && (rating != '-1'))) {
			 alert('invalid data');
			 return false;
		}
		
		selectedItem="post_rating_" + String(postId);
		
		/* Display user's action */
		if (rating==1) {
			 divHtml = 'Rating: <img src="images/button_plus.gif" width="12" height="12" alt="Negative" />';
		} else {
			 divHtml = 'Rating: <img src="images/button_minus.gif" width="12" height="12" alt="Negative" />';
		}
		document.getElementById(selectedItem).innerHTML = divHtml;
    
		/* Use AJAX to update post rating */
    xmlHttp=GetXmlHttpObject();
    
    if (xmlHttp==null) {
     		alert("Your browser does not support AJAX.");
    		return;
    }
		
		var url="ajax/thread_post_rating.php";
		url=url+"?post_id="+postId+"&rating="+rating;
    
		xmlHttp.onreadystatechange=stateChanged;
		
   	xmlHttp.open("GET",url,true);
   	xmlHttp.send(null);			 
}
