var aGalleryMenuId = 'gallery-list';
var aGalleryTarget = 'gallery-image';
var aGalleryDirectory = 'gallery';
var aGalleryThumbDirectory = aGalleryDirectory + '/' + 'thumbs';

var aGalleryImages = new Array();

function load_image(element) {
	var target = getElement(aGalleryTarget);
	var source = element.getAttribute("href");
	target.setAttribute("src", source);
	return false;
}

function get_image_name(image) {
	var result = image;
	re = new RegExp("[^/]+$");
	var m = re.exec(image);

	if (m != null) {
		result = image.substr(m.index);
	}
	return result;
}

function init_gallery() {
	var menu = getElement(aGalleryMenuId);
	if (menu.getElementsByTagName) {
		var aList = menu.getElementsByTagName('a');
		for (var i = 0; i < aList.length; i++) {
			aList[i].onclick = function() {
				return load_image(this);
			}
			aList[i].onkeypress = aList[i].onclick;
			var temp = new Image();
			temp.src = aList[i].getAttribute("href");
		}
	}
};


addEvent(window, 'load', init_gallery);