var photoNum = 1;

function overlayInnerHTML (target, source) {
var element;
if (document.getElementById) {
t = document.getElementById(target);
s = document.getElementById(source);
}
else if (document.all) {
t = document.all[target];
s = document.all[source];
}
t.innerHTML = s.innerHTML;
}

function overlayInnerText (target, text) {
var element;
if (document.getElementById) {
t = document.getElementById(target);
}
else if (document.all) {
t = document.all[target];
}
t.innerHTML = text;
}

function nextPhoto () {
photoNum++;
if ( photoNum > photoMax ) {
photoNum = 1;
}
overlayInnerHTML ('photos','photo'+photoNum);
overlayInnerText ('count','Photo '+photoNum+' of '+photoMax);
}

function prevPhoto () {
photoNum--;
if ( photoNum < 1 ) {
photoNum = photoMax;
}
overlayInnerHTML ('photos','photo'+photoNum);
overlayInnerText ('count','Photo '+photoNum+' of '+photoMax);
}

