
ajax = new sack();
rating = 0;

function changeback(id, starsid, newClass) {
  identity = document.getElementById(starsid);
  identity.className = "rate" + newClass;
}

function change(id, starsid, newClass) {
  identity = document.getElementById(starsid);
  identity.className = "rate" + newClass;
}

function ajax_ready() {
  var res = ajax.response;
  
  var i = res.search("@");
  
  if (i == -1)
    alert(ajax.response);
  else {

    rating = res.substring(i+1);
    alert(res.substring(0,i));    
  
  }
  
  
  
  //rating = 5;
}

function rate(id,rating) {

  var url = "rating_save.php?id="+id+"&rate="+rating;

  
  ajax.requestFile = url;
  ajax.onCompletion = ajax_ready;
  ajax.runAJAX();

  //alert(id+' '+rating);


}

