// JavaScript Document
function getRating(id){
	if(id == null) return false;
	var req = Spry.Utils.loadURL("GET", "includes/widgets/ratings/get_ratings.php?node="+id, false);
	return req.xhRequest.responseText;
}
function sendRating(){
	// alert(this.getValue());
	var value = this.getValue();
	var state = 'readonly';
	var ele = this.element;
	var req = Spry.Utils.loadURL("GET", "includes/widgets/ratings/set_rating.php?rating="+value+"&node="+ratingId, false);
	var response = Spry.Utils.urlComponentToObject(req.xhRequest.responseText);
	if(response.resp == 'true'){
		this.setValue(getRating(ratingId));
		state = 'readonly';
		Spry.$$('span#'+ele.id+'>span.customerr').setProperty('innerHTML',successMsg);
	}else if(response.resp == 'false'){
		Spry.$$('span#'+ele.id+'>span.customerr').setProperty('innerHTML',errorMsgs[response.error]);
		state = response.error < 1? 'initial' : 'readonly';
	}
	this.setState(state);
}
var ratingObj = {};
ratingObj.onPreRate = function(obj,req){
}
ratingObj.onPostRate = function(obj,req){
}
var saveURL = 'includes/widgets/ratings/set_ratings.php'; // url to save ratings
var params = Spry.Utils.getLocationParamsAsObject();
var ratingId = ((typeof ratedId == 'undefined') ||( ratedId == null)? params.id : ratedId); // the id that is going to be used
