wcube_rating = function() {
  JQ('#comment_form div.dccv-rating-selector select').hide();
  JQ('#comment_form div.dccv-rating-selector div.description').append('<div class="notation"></div>');
  JQ('#comment_form div.dccv-rating-selector div.description div.star a').addClass('mod');
  
  var index = 6 - JQ('#comment_form div.dccv-rating-selector select').get(0).selectedIndex;
  
  wcube_refresh = function() {
    JQ('#comment_form div.dccv-rating-selector div.description div.star').removeClass('on');
  
    for (var tmp = 1; tmp <= index; tmp++) {
      JQ('#comment_form div.dccv-rating-selector div.description div.star' + tmp).addClass('on');
    }
    
    JQ('#comment_form div.dccv-rating-selector div.description div.notation').html(
       JQ('#comment_form div.dccv-rating-selector select option')[6 - index].text
    );
    JQ('#comment_form div.dccv-rating-selector select option')[6 - index].selected = true;
  }
  
  JQ('#comment_form div.dccv-rating-selector div.description div.star').hover(
    function() {
      var classes = JQ(this).attr('class').split(' ');
      
      for (var tmp = 0; tmp < classes.length; tmp++) {
        if (classes[tmp].length == 5 && classes[tmp].substr(0, 4) == 'star') {
          index = parseInt(classes[tmp].substr(4));
        }
      }
      
      wcube_refresh();
    },
    function() {}
  );
  
  wcube_refresh();
}

if (isJsEnabled()) {
  JQ(document).ready(wcube_rating);
}
