var swapImageOff = new Array();
var swapImageOn = new Array();
var swapCurrent = '';

function preloadImages() {
    if (document.images) {
        for (var i = 0; i < swapOnImages.length; i++) {
            swapCurrentName = swapImageNames[i];
            swapImageOff[swapCurrentName] = new Image();
            swapImageOn[swapCurrentName] = new Image();
            swapImageOff[swapCurrentName].src = swapImagePath + swapOffImages[i];
            swapImageOn[swapCurrentName].src = swapImagePath + swapOnImages[i];
        }
    }
}

function swapOn(img, layer) {
    if (document.images && swapImageOn[img]) {
        if (layer != null && document.layers) {
            if (typeof(layer) == 'object')
                layer.document.images[img].src = swapImageOn[img].src;
            else if (typeof(layer) == 'string')
                eval('document.layers["' + layer + '"].document.images[img].src = swapImageOn[img].src');
        }
        else if (document.images[img])
            document.images[img].src = swapImageOn[img].src;
    }
}

function swapOff(img, layer) {
    if (document.images && swapImageOff[img]) {
        if (layer != null && document.layers) {
            if (typeof(layer) == 'object')
                layer.document.images[img].src = swapImageOff[img].src;
            else if (typeof(layer) == 'string')
                eval('document.layers["' + layer + '"].document.images[img].src = swapImageOff[img].src');
        }
        else if (document.images[img])
            document.images[img].src = swapImageOff[img].src;
    }
}

