addshow = function(img) {
	img.onmouseover = function() {
		document.getElementById('pic').src = img.src;
		document.getElementById('pic').alt = img.alt;
		document.getElementById('pic').title = img.title;
		document.getElementById('piccap').innerHTML = img.title;
	}
}
addshowpics = function() {
	var x = document.getElementById('pics').getElementsByTagName('DIV');
	for (var i=0; i<x.length; ++i) {
		if (x[i].className != 'picrow') {
			continue;
		}
		x[i].className = 'picrowjs';
		var pageNum = 1;
		if (window.location.search.match(/page=(\d+)/)) {
			pageNum = parseInt(RegExp.$1);
		}
		lastPage = document.getElementById('photopages').getElementsByTagName('LI').length;

		var prev = document.createElement('A');
		prev.innerHTML = '&lsaquo;';
		prev.title = 'Go to the previous page.';
		prev.className = 'prev';
		prev.href = '?page='+(pageNum>1?pageNum-1:lastPage);
		var next = document.createElement('A');
		next.innerHTML = '&rsaquo;';
		next.title = 'Go to the next page.';
		next.className = 'next';
		next.href = '?page='+(pageNum<lastPage?pageNum+1:1);
		
		x[i].insertBefore(prev,x[i].firstChild);
		x[i].appendChild(next);
		
		var y = x[i].getElementsByTagName('IMG');
		for (var j=0; j<y.length; ++j) {
			addshow(y[j]);
			if (i==0 && j==0) {
				//y[j].onmouseover();
				//var img = document.createElement('IMG');
				//img.id = 'pic';
				///img = document.getElementById('pic');
		document.getElementById('pic').src = y[j].src;
		document.getElementById('pic').alt = y[j].alt;
		document.getElementById('pic').title = y[j].title;
		document.getElementById('piccap').innerHTML = y[j].title;
				//document.getElementById('picdiv').appendChild(img);
			}
		}
	}
}

var oldonload = window.onload;
if (typeof window.onload != 'function') {
	window.onload = addshowpics;
} else {
	window.onload = function() {
		if (oldonload) {
			oldonload();
		}
		addshowpics();
	}
}