<!-- // Begin

var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);

// ----------------------------------------------------------------
// Toggles between two title messages that will be displayed in the 
// title bar of the browser.
// ----------------------------------------------------------------
function toggleTitles(title1, title2, interval) {
    if (top.document.title == title1) top.document.title = title2;
    else top.document.title = title1;
    setTimeout("toggleTitles('" + title1 + "', '" + title2 + "', " + interval + ")", interval);
}

// -------------------------------------------------
// Handle a click on an gallery image
// -------------------------------------------------
function handleGalleryImageClick( imgElemId, imgSrc, imgHeight, imgWidth 
                                , descElemId, description
                                , collElemId, collection 
                                ) {
    try {
        okay = true;
        okay = changeImage(imgElemId, "./images/blank.gif", imgHeight, imgWidth) && true; 
        okay = changeImage(imgElemId, imgSrc, imgHeight, imgWidth) && true; 
        okay = changeElementText(descElemId, description) && okay;
        okay = changeElementText(collElemId, collection) && okay;
    } catch (Exception) {
        okay = false;
    }
    if (!okay) alert ('Error handling your click ...');
    return okay;
}

// -------------------------------------------------
//  Change the source of an image using its Id
// -------------------------------------------------
function changeImage(elemId, imgSrc, imgHeight, imgWidth) {
    if (document.images) {
        document.images[elemId].src = imgSrc;
        document.images[elemId].height = imgHeight;
        document.images[elemId].width = imgWidth;
        return true;
    } else if (isDOM) {
        getElementById(elemId).src = imgSrc;
        getElementById(elemId).height = imgHeight;
        getElementById(elemId).width = imgWidth;
        return true;
    }
    return false;
}

// -------------------------------------------------
//  Change the innerHTML of an element
// -------------------------------------------------
function changeElementText(elemId, inner_HTML) {
    if (document.getElementById) {
        document.getElementById(elemId).innerHTML = inner_HTML;
        return true;
    } 
    return false;
}

// ---------------------------------------------------------------
// Preloads images.
// ----------------------------------------------------------------
function preload() {
    if (!document.images) return;

    var arrImages    = new Array();
    var arrArguments = preload.arguments;

    for (var i = 0; i < arguments.length; i++) {
        arrImages[i] = new Image();
        arrImages[i].src = arrArguments[i];
    }
}

// End -->
