// This will add the voting handlers to a specific video function Add_Rating_Handlers(video, adv, ratings) { (5).times(function(n) { n++; $('star_'+video+'_'+(n)).observe('mouseover', function() { Rating_Change(video, n); }); $('star_'+video+'_'+(n)).observe('mouseout', function() { Rating_Reset(video, adv, ratings); }); $('star_'+video+'_'+(n)).observe('click', function() { Rating_Vote(video, n); }); }) } // This will remove our rating handlers function Remove_Rating_Handlers(video) { (4).times(function(n) { n++ $('star_'+video+'_'+(n)).stopObserving('mouseout'); $('star_'+video+'_'+(n)).stopObserving('mouseover'); $('star_'+video+'_'+(n)).stopObserving('click'); }) }