function rating_hilight_on(item_id, position, file_name) {
   for(var pos=1; pos <= position; pos++){
        size = 3 - Math.abs(pos - 3);
        img_name = '/images/'+file_name+size+'s.png?';
        img_id = 'star_'+item_id+'_'+pos;
        $(img_id).src = img_name;
   }
}

function rating_hilight_off(item_id, vote, file_name) {
   for(var pos=1; pos <= 5; pos++){
        size = 3 - Math.abs(pos - 3);
        suffix = (pos > vote) ? 'd' : '';
        img_name = '/images/'+file_name+size+suffix+'.png?';
        img_id = 'star_'+item_id+'_'+pos;
        $(img_id).src = img_name;
   }
}

function item_add_vote(item_id, vote, file_name){
    var url = "/products/ajax_add_vote/"+item_id;
    var params = "vote="+vote+"&file_name="+file_name;
    //alert("Thanks for rating! Your rating was " + vote +". You can change your mind and give another rating for this application!");
    new Ajax.Request (url, {
        method:'post',
        onFailure: function(request){alert("Error " + request.status);},
        parameters: params}
    );
}

