/*-------------------------------------------------------------------*/
/* Original code: Image Gallery 4.0 Powered by Plebius               */
/*                http://www.plebius.org/javascripts                 */
/* Compatibility: Netscape 4+, MSIE 4+                               */
/*                                                                   */
/* Revision History:                                                 */
/*                                                                   */
/*  8/24/99  massively modified the code for our use: add a ton of   */
/*           variables; change to use just one set of pictures; use  */
/*           arrays for the pictures and captions; add border around */
/*           the displayed picture; and many more changes            */
/*  8/26/99  eliminate the initiate() function; separate the         */
/*           functions from the HTML file so they can be used        */
/*           generically                                             */
/*  9/10/99  modify the Generate function to take out the Prev and   */
/*           Next buttons. For navigation, we'll add codes in the    */
/*           HTML file for Prev, Next, and direct link to each       */
/*           picture by calling the appropriate functions            */
/*  9/16/99  add function checkmin() to check for a minimum browser  */
/*           level of v4.0 and stop if not v4 or greater             */
/*  8/14/00  change the caption attribute from centered to           */
/*           blockquoted                                             */
/*  9/24/00  fix the MSIE output so that it too shows the caption    */
/*           as left-justified and not centered                      */
/* 11/17/01  check out with the mozilla browser (v0.9.4), but it     */
/*           doesn't support the document.layers[] method, so        */
/*           although the images are displayed fine, the captions    */
/*           are not                                                 */
/*-------------------------------------------------------------------*/

function nextImage(name) {
    i = eval(document.forms[name].indx.value);
    if (++i == totalnum) {
        i = 0;
    }
    switchImage(name,i);
}

function prevImage(name) {
    i = eval(document.forms[name].indx.value);
    if (--i < 0 ) {
        i = totalnum - 1;
    }
    switchImage(name,i);
}

function switchImage(name,i) {
    if (document.images) {
        document.images[name].src = myPath + myPhoto[i];
        document.forms[name].indx.value = i;
        switchCaption(myCaption[i],name);
    }
}

function switchCaption(desc,name) {
    if (checkmin()) return;
    var HTMLout = '<blockquote>' + FontSpec + desc + '</font></blockquote>';
    if (navigator.appName == "Netscape") {
        document.layers[name].document.write(HTMLout);
        document.layers[name].document.close();
    } 
    if (navigator.appVersion.indexOf("MSIE") != -1) {
        var FormName = name + 'IE';
        document.forms[FormName].innerHTML = HTMLout;
    }
}

function Generate(name) {
    if (checkmin()) return;
    var First_Image = myPath + myPhoto[0];
    if (navigator.appName == "Netscape") {
        output = '<center><table border=0 cellspacing=0 cellpadding=1><tr><td bgcolor="#333333"><table border=0 cellspacing=0 cellpadding=0><tr><td><img src="' + First_Image + '" width=' + ImgWidth + ' height=' + ImgHeight + ' name=' + name + '></td></tr></table></td></tr></table><br><layer id=' + name + ' align=center></layer><br><br><br><br><form name=' + name + '><input type=hidden name=indx value=0></form></center>';
        document.write(output);
    }
    if (navigator.appVersion.indexOf("MSIE") != -1) {
        output = '<table border=0 cellspacing=0 cellpadding=1><tr><td bgcolor="#333333"><table border=0 cellspacing=0 cellpadding=0><tr><td><img src="' + First_Image + '" width=' + ImgWidth + ' height=' + ImgHeight + ' name=' + name + '></td></tr></table></td></tr></table><form name=' + name + 'IE></form><form name=' + name + '><input type=hidden name=indx value=0></form>';
        document.write(output);
    }
}

function checkmin() {
    var versionB = navigator.appVersion;
    if (parseFloat(versionB) < 4) {
        output = '<p><center>In order to view this photo gallery, you need a JavaScript-capable browser that is v4.0 or later. This script has been tested on Netscape Navigator/Communicator v4.0+ and Microsoft Internet Explorer v4.0+. Mozilla browser does not support the document.layers[] method, so the caption will not be displayed.</center>';
        document.write(output);
        return 1;
    }
}

