var photo = 1;
var slide = 1;
var locPhoto = document.URL.indexOf('photo=');
var locSlide = document.URL.indexOf('slide=');
if (locPhoto < locSlide) {
	if (locPhoto != -1) {
		photo = document.URL.substring((locPhoto + 6), (locSlide - 1));
		}
	if (locSlide != -1) {
		slide = document.URL.substring((locSlide + 6), document.URL.length);
		}
	}
else if (locSlide < locPhoto) {
	if (locSlide != -1) {
		slide = document.URL.substring((locSlide + 6), (locPhoto - 1));
		}
	if (locPhoto != -1) {
		photo = document.URL.substring((locPhoto + 6), document.URL.length);
		}
    }
var prev = photo - 1;
var next = photo - 1 + 2;

document.title = 'NJ SpringProm 2005: Album ' + album + ': ' + photo;

function slideCount() {
	setTimeout ('slideGo();', 2000);
	}

function slideGo() {
	if (photo < numPhotos) {
		window.location = 'slide.htm?photo=' + next + '&slide=' + slide;
		}
	else {
		switch (album) {
			case 'A':
				window.location = '../albumB/slide.htm?photo=1&slide=' + slide;
				break;
			case 'B':
				window.location = '../albumC/slide.htm?photo=1&slide=' + slide;
				break;
			case 'C':
				window.location = '../album1/slide.htm?photo=1&slide=' + slide;
				break;
			default:
				var nextAlbum = album - 1 + 2;
				window.location = '../album' + nextAlbum + '/slide.htm?photo=1&slide=' + slide;
				}
		}
	}

function comingSoon(whatComing) {
	alert(whatComing + ' are coming soon!');
	}

function writeHeader() {
	document.write('<tr><td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td class="title">NJ SpringProm 2005: Album ' + album + '</td><td class="backhome"><a href="../../index.htm">NJ SpringProm Home Page</a></td></tr></table></td></tr>');
	}
	
function writePicker() {
	document.write('<tr><td width="110px"><nobr>');
	if (prev < 1) {
		document.write('&lt;&lt; First | &lt; Previous');
		}
	else {
		document.write('<a href="slide.htm?photo=1&slide=' + slide +'">&lt;&lt; First</a> | <a href="slide.htm?photo=' + prev + '&slide=' + slide +'">&lt; Previous</a>');
		}
	document.write('</nobr></td><td align="center">');
	for (i = 1; i <= numPhotos; i++) {
		if (i == photo) {
			document.write(i);
			}
		else {
			document.write('<a href="slide.htm?photo=' + i + '&slide=' + slide +'">' + i + '</a>');
			}
		if (i != numPhotos) {
			document.write(' | ');
			}
		}
	document.write('</nobr></td><td align="right" width="110px">');
	if (next > numPhotos) {
		document.write('Next &gt; | Last &gt;&gt;');
		}
	else {
		document.write('<a href="slide.htm?photo=' + next + '&slide=' + slide +'">Next &gt;</a> | <a href="slide.htm?photo=' + numPhotos + '&slide=' + slide +'">Last &gt;&gt;</a>');
		}
	document.write('</nobr></td></tr>');
	}

function writePhoto() {
	document.write('<td width="60%" height="410px" align="center"><img src="' + photo + '.jpg" hspace="4" vspace="4" border="0"');
	if ((slide == 1) && ((photo < numPhotos) || (album != numAlbums))) {
		document.write(' onload="javascript: slideCount();"');
		}
	document.write('><noscript><h1>You need a browser that supports JavaScript to view this page. We recommend <a href="http://www.getfirefox.com">Mozilla Firefox</a>.</h1></noscript></td>');
	}
