function onLoadHandler() {
    if (location.href.indexOf('#add_comment') != -1) {
        showCommentForm();
        location.href = location.href;
    }
}

function showCommentForm(parent) {
    var div = $('add_comment');

    if (div && (typeof(div) != 'undefined')) {
        div.style.display = 'block';
        if (parent && (typeof(parent) != 'undefined')) {
            var inp = $('comm_parent');

            if (inp && (typeof(inp) != 'undefined')) {
                inp.value = parent;
            }
        }
    }
}

function paintStars(a, turnOn, mark, isSmall) {
    var list = a.parentNode.childNodes;
    var timeout = 30;
    var size = 'big';
    var j = 0;

    if (isSmall && (typeof(isSmall) != 'undefined')) {
        size = 'small';
    }

    if (turnOn) {
        if (list && (typeof(list) != 'undefined')) {
            for (var i = 0; i < list.length; i++) {
                if (list[i] && (list[i].tagName == 'A')) {
                    j++;
                    if (j <= mark) {
                        list[i].className = 'star_red_' + size;
                    } else {
                        list[i].className = 'star_grey_' + size;
                    }
                }
            }
        }
    } else {
        var tmp0 = new Date();
        var tmp1 = new Date();
        while (((tmp1.getMilliseconds() - tmp0.getMilliseconds()) < 100) && (tmp0.getSeconds() == tmp1.getSeconds())) {
            tmp1 = new Date();
        }
        markGrey(list, size);
    }
}

function markGrey(list, size) {
    if (list && (typeof(list) != 'undefined')) {
        for (var i = 0; i < list.length; i++) {
            if (list[i] && (list[i].tagName == 'A')) {
                list[i].className = 'star_grey_' + size;
            }
        }
    }
}

/* ========================================================================== */

window.onload = onLoadHandler;

/* ========================================================================== */

var tmpImg = new Array();

tmpImg[0] = new Image();
tmpImg[0].src = '/defa/i/star_big.gif';

tmpImg[1] = new Image();
tmpImg[1].src = '/defa/i/star_small.gif';
