var first_img = 01, current_img = 01;
var height = null, last_img = null;
var img_numbers = new Array ();

var current_page = window.location.href;
current_page = current_page.substr (current_page.lastIndexOf('/')+1);
if (current_page == '' || current_page == 'index.html')
	current_page = '2008';
else
	current_page = current_page.substr (0,current_page.indexOf('.'));
	
switch (current_page) {		// specifies # of imgs for each page and height of horizontally-oriented images when resized to width of 500px
	case '2008': last_img = 21; height = 333; break;
	case '2007': last_img = 20; height = 375; break;
	default: last_img = 21; height = 333; break;	// "default" is year 2006
}

var img_numbers = new Array();		// pads image names
for (var i = 1; i <= last_img; i++)
{
	if (i < 10)
		img_numbers[i] = '0' + i;
	else
		img_numbers[i] = i;
}

function show_img (img_num) {
	current_img = img_num;
	if (current_page == '2006')		// for the 2006 page, the imgs aren't high-qual enough to click and get a larger img
		document.getElementById('img_holder').innerHTML='<img src="..\/images\/gallery\/' + current_page + '\/' + img_numbers[img_num] + '.jpg" height="' + height + '" alt="" border="0">'; 
	else
		document.getElementById('img_holder').innerHTML='<a href="..\/images\/gallery\/' + current_page + '\/' + img_numbers[img_num] + '_lrg.jpg" target="_blank"><img src="..\/images\/gallery\/' + current_page + '\/' + img_numbers[img_num] + '.jpg" height="' + height + '" alt="" border="0"><\/a>'; 
}

function next_img () {
	if (current_img == last_img)
		show_img (first_img);
	else
		show_img (current_img+1);
}

function prev_img () {
	if (current_img == first_img)
		show_img (last_img);
	else
		show_img (current_img-1);
}

