function _censuraReviewVote(loadingImg, baseUrl, reviewid, vote)
{
	document.getElementById('review_helpful_vote_' + reviewid).innerHTML = "<img class='ajax_loading_graphic' src='" + loadingImg + "' alt='Loading...' />";
	new Ajax.Request(baseUrl,  {
			method: 'post', 
			postBody: 'id=' + reviewid + '&vote=' + vote,
			onSuccess: function(response) {
				var xml = response.responseXML;
				var feedback = xml.getElementsByTagName('feedback').length > 0 ? xml.getElementsByTagName('feedback')[0].childNodes[0].data : "";
				var new_score = xml.getElementsByTagName('new_score').length > 0 ? xml.getElementsByTagName('new_score')[0].childNodes[0].data : "";
				document.getElementById('review_helpful_voted_' + reviewid).innerHTML = "<div class='ajax_feedback'>" + feedback + "</div>";
				document.getElementById('review_helpful_voted_' + reviewid).style.display = 'block';
				document.getElementById('review_helpful_vote_' + reviewid).style.display = 'none';
				if(new_score) {
					document.getElementById('review_helpful_score_' + reviewid).innerHTML = new_score;
					document.getElementById('review_helpful_score_' + reviewid).style.display = 'block';
				}
			}
	});
}
function writeStarRatingInput(type, name, value, max, labels, values)
{
  if(type == 'option') {
    var onclickString = "starRatingSetValue(\""+name+"\", "+String(max)+", "+values['null']+", \"null\", \""+labels["null"]+"\");";
    var onMouseOverString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", \"null\", \""+labels['null']+"\");";
    var onMouseOutString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", starRatingCurrentValues[\""+name+"\"][\"number\"], starRatingCurrentValues[\""+name+"\"][\"label\"]);";
  } else if(type == 'number') {
    var onclickString = "starRatingSetValue(\""+name+"\", "+String(max)+", 0, \"null\");";
    var onMouseOverString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", \"null\");";
    var onMouseOutString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", starRatingCurrentValues[\""+name+"\"][\"number\"]);";
  } else {
    var onclickString = "starRatingSetValue(\""+name+"\", "+String(max)+", 0, \"null\");";
    var onMouseOverString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", \"null\");";
    var onMouseOutString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", starRatingCurrentValues[\""+name+"\"][\"number\"]);";
  }
  document.write("<img src='"+image_dir+"/ratings/null-inactive-large.png' alt='-' onclick='"+onclickString+"' onmouseover='"+onMouseOverString+"' onmouseout='"+onMouseOutString+"' id='starRatingInput_"+name+"_star_null' />");
  for(i = 1; i <= max; i++) {
    if(type == 'option') {
      inputValue = values[i];
      inputLabel = labels[i];
      var onclickString = "starRatingSetValue(\""+name+"\", "+String(max)+", "+inputValue+", "+String(i)+", \""+inputLabel+"\");";
      var onMouseOverString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", "+String(i)+", \""+inputLabel+"\");";
      var onMouseOutString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", starRatingCurrentValues[\""+name+"\"][\"number\"], starRatingCurrentValues[\""+name+"\"][\"label\"]);";
    } else if(type == 'number') {
      var onclickString = "starRatingSetValue(\""+name+"\", "+String(max)+", "+String(i)+", "+String(i)+");";
      var onMouseOverString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", "+String(i)+");";
      var onMouseOutString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", starRatingCurrentValues[\""+name+"\"][\"number\"]);";
    } else {
      var onclickString = "starRatingSetValue(\""+name+"\", "+String(max)+", "+String((Math.round(i*1000/max)/1000))+", "+String(i)+");";
      var onMouseOverString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", "+String(i)+");";
      var onMouseOutString = "starRatingUpdateDisplay(\""+name+"\", "+String(max)+", starRatingCurrentValues[\""+name+"\"][\"number\"]);";
    }
    document.write("<img src='"+image_dir+"/ratings/empty-large.png' alt='*' onclick='"+onclickString+"' onmouseover='"+onMouseOverString+"' onmouseout='"+onMouseOutString+"' id='starRatingInput_"+name+"_star_"+String(i)+"' />");
  }
  document.write("<span id='starRatingInput_"+name+"_label' class='starRatingInputLabel'></span>");
  document.write("<input type='hidden' name='"+name+"' value='' id='starRatingInput_"+name+"_hidden' />");
  if(value == "" || value == null) {
    starNumber = null;
    label = null;
  } else {
    if(type == 'option') {
      starNumber = null;
      for (var i in values) { 
        if(value == values[i]) {
          starNumber = i;
        }
      }
      label = labels[starNumber ? starNumber : 'null'];
    } else if(type == 'number') {
      starNumber = value;
      label = null;
    } else {
      starNumber = value*max;
      label = null;
    }
  }
  starRatingSetValue(name, max, value, starNumber, label);
}
function starRatingUpdateDisplay(name, numberStars, starNumber, label)
{
  if(starNumber == 'null')  {
    starNumber = 0;
    document.getElementById("starRatingInput_"+name+"_star_null").src = image_dir + "/ratings/null-large.png";
  } else {
    if(!starNumber) starNumber = 0;
    document.getElementById("starRatingInput_"+name+"_star_null").src = image_dir + "/ratings/null-inactive-large.png";
  }
  for(i = 1; i <= numberStars; i++) {
    document.getElementById("starRatingInput_"+name+"_star_"+String(i)).src = image_dir + (i <= starNumber ? "/ratings/full-large.png" : "/ratings/empty-large.png");
  }
  if(!label) label = "";
  document.getElementById("starRatingInput_"+name+"_label").innerHTML = label;
}
var starRatingCurrentValues = new Array();
function starRatingSetValue(name, numberStars, inputValue, starNumber, label)
{
  starRatingCurrentValues[name] = new Array();
  starRatingCurrentValues[name]['number'] = starNumber;
  starRatingCurrentValues[name]['label'] = label;
  hiddenInput = document.getElementById("starRatingInput_"+name+"_hidden");
  hiddenInput.value = inputValue;
  starRatingUpdateDisplay(name, numberStars, starNumber, label);
}