changeButtonState = function(in_strId, in_strState, in_blnPreload) {

    var objImageElement = $(in_strId);

    if (objImageElement.tagName == 'A') {
        objImageElement = objImageElement.firstChild;
    }

    var objNewImage = new Image(1, 1);
    objNewImage.src = objImageElement.src.replace(/\_[a-z]*\.png/g, in_strState + '.png');

    if (!in_blnPreload) {
        objImageElement.src = objNewImage.src;
    }

}

initButtons = function() {

    var objChilds = document.getElementsByClassName('Button');
    for (var i = 0; i < objChilds.length; i++) {

        objChilds[i].id = 'button_' + i;
        Event.observe(objChilds[i], 'mousedown', new Function('e', 'changeButtonState($(\'' + objChilds[i].id + '\'), "_c");'));
        Event.observe(objChilds[i], 'mouseup', new Function('e', 'changeButtonState($(\'' + objChilds[i].id + '\'), "_n");'));
        Event.observe(objChilds[i], 'mouseover', new Function('e', 'changeButtonState($(\'' + objChilds[i].id + '\'), "_f");'));
        Event.observe(objChilds[i], 'mouseout', new Function('e', 'changeButtonState($(\'' + objChilds[i].id + '\'), "_n");'));
        Event.observe(objChilds[i], 'focus', new Function('e', 'Event.element(e).blur();'));
        changeButtonState(objChilds[i].id, '_f', true);
        changeButtonState(objChilds[i].id, '_c', true);

    }

}