(function (){
document.addEventListener('DOMContentLoaded', function (){
document.querySelectorAll('.star-group').forEach(function (group){
var stars=group.querySelectorAll('.star');
var input=group.querySelector('input[type="hidden"]');
stars.forEach(function (star){
star.addEventListener('click', function (){
var val=parseInt(star.getAttribute('data-value'), 10);
input.value=val;
stars.forEach(function (s){
s.classList.toggle('active', parseInt(s.getAttribute('data-value'), 10) <=val);
});
});
star.addEventListener('mouseenter', function (){
var val=parseInt(star.getAttribute('data-value'), 10);
stars.forEach(function (s){
s.classList.toggle('hover', parseInt(s.getAttribute('data-value'), 10) <=val);
});
});
star.addEventListener('mouseleave', function (){
stars.forEach(function (s){
s.classList.remove('hover');
});
});
});
});
});
})();