// Swap image code.
// Settings are located in HTML file.
// Do not edit!


	var firstimg = 1 //img_list.length;
	var lastimg = img_list.length //1;

	var current = lastimg + 1;
	var preimg = new Array();
	var current_alt = 0;

	for(var x=0;x<(img_list.length);x++){
		preimg[x] = new Image();
		preimg[x].src="../../includes/site_images/archives/" + (img_list[x]) + ".jpg";
	}

	function swapimg(opt){
		if (current == firstimg && opt == 2) {
			current = lastimg;
		} else if (current == lastimg && opt == 1) {
			current = firstimg;
		} else if (current == firstimg && opt == 1) {
			current++;
			if (skipimg.indexOf("|" + current + "|") != -1) {
				swapimg(1);
				return;
			}
		}
		else {
			if (opt == 2) {
				current--;
				if (skipimg.indexOf("|" + current + "|") != -1) {
					swapimg(2);
					return;
				}
			} else {
				current++;
				if (skipimg.indexOf("|" + current + "|") != -1) {
					swapimg(1);
					return;
				}
			}
		}
		applyeffect();
		document.gallery.src = preimg[lastimg - current].src;
		displaydesc(current);
		playeffect();
	}

	function displaydesc(which){
		current_alt = lastimg - ((lastimg-firstimg) - (lastimg - current));

		if (document.all) {
			gallery.alt = alt_array[current_alt - 1] + " - Photo No. " + current_alt + " of " + img_list.length;
			descriptions.innerHTML=alt_array[current_alt - 1] + "<br><i>Photo No. " + current_alt + " of " + img_list.length + "</i>";
		}else if (document.getElementById)
			document.getElementById("descriptions").innerHTML=alt_array[current_alt - 1] + "<br><i>Photo No. " + current_alt + " of " + img_list.length + "</i>";
		else if(document.layers){
			document.layers["divID"].document.open()
			document.layers["divID"].document.write(alt_array[current_alt - 1] + "<br><i>Photo No. " + current_alt + " of " + img_list.length + "</i>")
			document.layers["divID"].document.close()
			}
	}

function applyeffect(){
	if (document.all){
		gallery.filters.revealTrans.Transition=6; //Math.floor(Math.random()*23)
		gallery.filters.revealTrans.stop()
		gallery.filters.revealTrans.apply()
	}
}

function playeffect(){
	if (document.all)
		gallery.filters.revealTrans.play()
}
