/**
 * @ Stars Ratings Plugin @VERSION 4
 * @ Author: Luca Filosofi
 * @ aseptik@gmail.com
 * @ http://ask.altervista.org  
 * @ Release Date: 29.09.2009
 * @ Last Update: 26.03.2010
 * @ Depends: e107.org CMS v7+
 */
 
  $.noConflict();

  jQuery(function($) {

   $('.rater').click(function(e) {
     e.preventDefault();
      var query = 'action=ratings&query=' + $(this).attr('href');
        var id = $(this).parent().parent().parent().attr('id');
          $(this).parent().parent().parent().fadeOut(200);
          $.ajax({
            type: 'POST',
              url: ajax.url() + 'ajax.php',
              data: query,
              cache: false,
        complete: function(data) {
            $('#' + id).html(data.responseText).fadeIn(200);
        },
        error: function() {
            alert('Ajax Request ' + query + ' Error!');
        }
    });

    return false;
 });
});

var ajax = new function() {
    var js_path = document.getElementById('ratings_js').src;
    this.url = function() {
        var ajax_path = js_path.substring(0, js_path.lastIndexOf('/') - 2);
        return ajax_path;
    };
}
