/*-------------------------------------------------------------------*/
/* 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            */
/*-------------------------------------------------------------------*/

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) {
    var HTMLout = '<center>' + FontSpec + desc + '</font></center>';
    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) {
    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+.</center>';
        document.write(output);
        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 align=center id="' + name + '"></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 = '<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><form name="' + name + 'IE"></form><form name="' + name + '"><input type="hidden" name="indx" value="0"></form></center>';
        document.write(output);
    }
}

