
var piclist = new Array();

var i=0;

var latest="Ancient";

function drawpics(gallery) {
	drawOneSubGallery(gallery,"ALL");
}

function drawOneSubGallery(gallery, subgallery) {
	drawOneSubGallery(gallery,subgallery,0,0);
}
function drawOneSubGallery(gallery, subgallery, writeHeader, onlyOne) {
	var root="http://chapleau.us/Gallery/";
	i=0;
	var j=0;
	var lastarmy='';
	if (writeHeader)
		document.write('<h2>Latest Gallery</h2>');
	for (i=0;i<=piclist.length-1;i++) {
		if (piclist[i]==null) continue;
		if (piclist[i][4] == gallery) 
		{
			if ((piclist[i][3] != subgallery) && (subgallery!="ALL"))
			{
				continue;
			}
			if (j==0) {
				lastarmy=piclist[i][3];
				document.write('<CENTER><table border=0 width=100% cellspacing=0 cellpadding=0>');
				document.write('<tr><td><H2 class="GalleryHeader">'+piclist[i][3]+'<tr><td><table border=0 width=100%><tr><td><a href="'+root+piclist[i][0]+'" target="PIC"><center><img src="'+root+piclist[i][2]+'" width=75 BORDER=0><br>'+piclist[i][1]+'</a>');
				j++;
			} else if (piclist[i][3]==lastarmy) {
				if ((j++ % 5)==0) {
					document.write('<tr>');
				}
				document.write('<td><a href="'+root+piclist[i][0]+'" target="PIC"><center><img src="'+root+piclist[i][2]+'"  width=75 BORDER=0><br>'+piclist[i][1]+'</a>');
			} else {
				if (onlyOne)
					break;
				lastarmy=piclist[i][3];
				document.write('</table></tr>');
				document.write('<tr><td><H2 class="GalleryHeader">'+piclist[i][3]+'<tr><td><table border=0 width=100%><td><a href="'+root+piclist[i][0]+'" target="PIC"><center><img src="'+root+piclist[i][2]+'" width=75  BORDER=0><br>'+piclist[i][1]+'</a>');
				j=1;
			}
		}
	}
	if (j>0)
	{
		document.write('</table><tr bgcolor=#000066><td>&nbsp;</th></tr>');
		document.write('</table></CENTER>');
	}
}