var current_pic = 0;
var pics = new Array();
var diashow = false;
var diadelay = 5;
var dia = null;
function gallery_createPic(picUrl, picName, picZoomUrl) {
	if (picZoomUrl === false) {
		picZoomUrl = '/gfx/gallery/blank.gif';
	}
	pics.push(new Array(picUrl, picName, picZoomUrl));
}
function gallery_next() {
	current_pic++;
	if (current_pic > pics.length-1) {
		current_pic = 0;
	}
	gallery_update();
	window.clearTimeout(dia);
	window.setTimeout('gallery_next()', diadelay*1000);
}
function gallery_back() {
	current_pic--;
	if (current_pic < 0) {
		current_pic = pics.length-1;
	}
	gallery_update();
}
function gallery_update() {
	parent.document.getElementById("pic1").src = pics[current_pic][0];
	if (parent.document.getElementById("gallery_pic1_desc") != null) {
		parent.document.getElementById("gallery_pic1_desc").innerHTML = pics[current_pic][1];
	}
	if (parent.document.getElementById("gallery_pic1_zoomlink") != null) {
		parent.document.getElementById("gallery_pic1_zoomlink").href = pics[current_pic][2];
	}
}
function gallery_diaStart(seconds) {
	diadelay = seconds;
	diashow = true;
	dia = window.setTimeout('gallery_next()', seconds*1000);
}
function gallery_diaStop() {
	diashow = false;
	window.clearTimeout(dia);
}
function gallery_diaChange(seconds) {
	if (diashow === true) {
		gallery_diaStop();
	} else {
		gallery_diaStart(seconds);
	}
}