/* This file is part of Sava CMS. */

/*    Sava CMS is free software: you can redistribute it and/or modify */
/*    it under the terms of the GNU General Public License as published by */
/*    the Free Software Foundation, Version 2 of the License. */

/*    Sava CMS is distributed in the hope that it will be useful, */
/*    but WITHOUT ANY WARRANTY; without even the implied warranty of */
/*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the */
/*    GNU General Public License for more details. */

/*    You should have received a copy of the GNU General Public License */
/*    along with Sava CMS.  If not, see <http://www.gnu.org/licenses/>. */

siteid = 'global';
function saveRate(id){
	var thisform = Form.serialize(document.getElementById(id));
	var myAjax = new Ajax.Request(
	 context + "/" + siteid + "/includes/display_objects/rater/ajax/saveRate.cfm", 
	{
		method: 'post', 
		postBody: thisform, 
		onComplete: showRatingResponse
	});
	
}

function showRatingResponse(resp){
	var r= eval( '(' + resp.responseText + ')' );
	$("numvotes").innerHTML=r.data.THECOUNT + String(" vote").pluralize(r.data.THECOUNT);;
	$("ratestars").src=starImg(r.data.THEAVG);
	$("ratestars").alt=r.data.THEAVG + " stars";
	
	return false;
}