function changeRateText(text) {
    var happy = document.getElementById("happy");
    happy.innerHTML = text;
}

function initPage() {
    var rates = document.getElementsByTagName("ul");
    
    var index = 0;
    for (i = 0; i < rates.length; i++) {
        
        if (rates[i].className.indexOf("star-rating") != -1) {
            rates[i]._lis = rates[i].getElementsByTagName("li");

            rates[i].onmouseover = function() {
            for (k = 0; k < this._lis.length; k++) {
                index = k;
                    if (this._lis[k].className.indexOf("active") != -1) {
                        this._active = this._lis[k];
                        this._lis[k].className = this._lis[k].className.replace("active", "");

                        
                        
                    }

                }
            }
            rates[i].onmouseout = function() {
                if (this._active && this._active.className.indexOf("active") == -1) {
                    this._active.className += " active";
                    
                    
                }
            }
        }
    }
}

if (window.addEventListener)
    window.addEventListener("load", initPage, false);
else if (window.attachEvent)
    window.attachEvent("onload", initPage);

