/* -*- ecmascript -*- */

dj_theme = 'shadow';
dj_image_suffix = '.png';

function dj_set_theme(theme) {
    dj_theme = theme;
}

function dj_highlight(id) {
    image_name = '/graphics/links/' + dj_theme + '/' + id + '--current' + dj_image_suffix;
    window.status = image_name;
    document[id].src = image_name;
}

function dj_revert(id) {
    image_type = document[id].className;
    image_name = '/graphics/links/' + dj_theme + '/' + id + '--' + image_type + dj_image_suffix;
    window.status = image_name;
    document[id].src = image_name;
}

function dj_preload(id) {
    var highlight_image = new Image();
    image_name = '/graphics/links/' + dj_theme + '/' + id + '--current' + dj_image_suffix;
    highlight_image.src = image_name;
}

/* gallery index - room-example-highlight images */

function dj_room_highlight(id) {
    image_name = document[id].src
    idx = image_name.indexOf('room-example');
    new_image_name = image_name.substring(0, idx) + 'room-example-highlight.jpg';
    document[id].src = new_image_name;
}

function dj_room_revert(id) {
    image_name = document[id].src
    idx = image_name.indexOf('room-example');
    new_image_name = image_name.substring(0, idx) + 'room-example.jpg';
    document[id].src = new_image_name;
}

function dj_room_preload(id) {
    var highlight_image = new Image();
    image_name = document[id].src;
    idx = image_name.indexOf('room-example');
    new_image_name = image_name.substring(0, idx) + 'room-example-highlight.jpg';
    highlight_image.src = new_image_name;
}
