var pics = new Array();
var objCount = 0;

function preloadButtons(btnName, btnDef, btnSel) {

    pics[objCount] = new Array(3);
    pics[objCount][0] = new Image();
    pics[objCount][0].src = btnDef;
    pics[objCount][1] = new Image();
    pics[objCount][1].src = btnSel;
    pics[objCount][2] = btnName;
    objCount++;
}

/**
* Does NOT change the button txt color.
*/
function setDefButton(btnName, el) {
    for (i = 0; i < objCount; i++) {
        if (pics[i][2] == btnName) {
            if (el != null){				
                el.style.backgroundImage='url(' + pics[i][0].src + ')';
			}
        }
    }
}

/**
* Does NOT change the button txt color.
*/
function setSelButton(btnName, el) {
    for (i = 0; i < objCount; i++) {
        if (pics[i][2] == btnName) {
            if (el != null){
                el.style.backgroundImage='url(' + pics[i][1].src + ')';
			}
        }
    }
}

function initButtons() {
    var btnName;
    var elId;
    var el;
    for (var i = 0; i < arguments.length; i++) {
        btnName = arguments[i][0];
        elId = arguments[i][1];
        el = document.getElementById(elId);
        setDefButton(btnName, el);
    }
}

function setDefButtonHeader (e) {
        e.className = 'button-header';
}

function setSelButtonHeader (e) {
        e.className = 'button-header-on ';
}