// Overlay Photo Gallery Java Script
// (w) 2006 Mark Beazley
// Davis Audio Visual, LLC

function togglegallery(back,gallery,photoref,photocaption,current) {
    if (!document.getElementById) return null;
    var currentpic = current;
    if (document.getElementById(back) == null) return;
    if (document.getElementById(back).style.visibility == "visible") {
        document.getElementById(back).style.visibility = "hidden";
        document.getElementById(gallery).style.visibility = "hidden";
        document.getElementById(photoref).src = piclist[currentpic];
        document.getElementById(photocaption).innerHTML = piccaption[currentpic];
    } else {
        document.getElementById(back).style.visibility = "visible";
        document.getElementById(gallery).style.visibility = "visible";
        document.getElementById(photoref).src = piclist[currentpic];
        document.getElementById(photocaption).innerHTML = piccaption[currentpic];
        }
    return currentpic;
    }
            
function nextimage (photoref,photocaption) {
    if (!document.getElementById) return null;
    currentpic ++;
    if (currentpic > maxphotos) currentpic = 1;
    document.getElementById(photoref).src = piclist[currentpic];
    document.getElementById(photocaption).innerHTML = piccaption[currentpic];
    }
                
function previmage (photoref,photocaption) {
    if (!document.getElementById) return null;
    currentpic --;
    if (currentpic < 1) currentpic = maxphotos;
    document.getElementById(photoref).src = piclist[currentpic];
    document.getElementById(photocaption).innerHTML = piccaption[currentpic];
    }