function doTillDis(n, oid) {
    var i = 0;
    for (i = 1; i <= n; i++) {
        var o = document.getElementById('star_' + oid + '_' + i);
        if (o != null) {
            o.src = '/gfx/star_green.png';
        }
    }
    
    for (i; i <= 5; i++) {
        var o = document.getElementById('star_' + oid + '_' + i);
        if (o != null) {
            o.src = '/gfx/star_blue.png';
        }
    }

}

function undoDis(oid) {
    for (var i = 0; i <= 5; i++) {
        var o = document.getElementById('star_' + oid + '_' + i);
        if (o != null) {
            o.src = '/gfx/star_blue.png';
        }
    }
}

function starsheriff(event, o, action, msg) {
    var x = event.offsetX;
    if (!ivy.browser.isIE) {
        x = event.pageX;
        var element = o;
        while (element) {
            x -= element.offsetLeft;
            element = element.offsetParent;
        }
    }

    var rate = 1 + Math.floor(x / o.clientWidth * 5);
    switch (action) {
        case 'out':
            o.style.backgroundPosition = o.getAttribute('origvalue') + 'px top';
            toolTip();
            break;
        case 'over':
            o.style.backgroundPosition = Math.floor(rate * 67 / 5) + 'px top';
            switch (Math.floor(x / Math.floor(67 / 5))) {
                case 0:
                    toolTip('1 pont' + msg, 130);
                    break;
                case 1:
                    toolTip('2 pont' + msg, 130);
                    break;
                case 2:
                    toolTip('3 pont' + msg, 130);
                    break;
                case 3:
                    toolTip('4 pont' + msg, 130);
                    break;
                case 4:
                    toolTip('5 pont' + msg, 130);
                    break;
            }
            break;
        case 'click':
	    var vvalue = Math.floor(x / Math.floor(67 / 5)) + 1;
	    location.href="/votecerky.php?rid=" + o.getAttribute('rid') + "&value=" + vvalue;
            break;
    }
}
