var nImageTotal = 83;
var ImgName = new Array("bakerview1.jpg",
					"bakerview2.jpg",
					"bayview1.jpg",
					"beachviewst1.jpg",
					"beachviewst2.jpg",
					"beachviewst3.jpg",
					"beachviewst5.jpg",
					"breakwater.jpg",
					"broadbeach.jpg",
					"campbellpark1.jpg",
					"campbellpark2.jpg",
					"clearwater.jpg",
					"crescentbeach0.jpg",
					"crescentbeach2.jpg",
					"crescentbeach3.jpg",
					"crescentsunset.jpg",
					"driftwood1.jpg",
					"eastbeach1.jpg",
					"eastbeach2.jpg",
					"eastbeachcondos.jpg",
					"eastbeachpierview.jpg",
					"easthump.jpg",
					"got_one.jpg",
					"herontree1.jpg",
					"herontree2.jpg",
					"hightide.jpg",
					"hillsidecommunity.jpg",
					"hillsiderock.jpg",
					"kwomaishines2.jpg",
					"kwomaishines3.jpg",
					"kwomaisshines1.jpg",
					"kwomaisview.jpg",
					"littlecampbell1.jpg",
					"littlecampbell2.jpg",
					"littlecampbell3.jpg",
					"littlecampbell4.jpg",
					"littlecampbell5.jpg",
					"littlecampbell6.jpg",
					"littlecampbell7.jpg",
					"littlecampbell8.jpg",
					"littlecampbell9.jpg",
					"littlecampbell10.jpg",
					"naturesculpture.jpg",
					"nauticaview.jpg",
					"no_bites.jpg",
					"oceanbluff1.jpg",
					"oceanskies1.jpg",
					"oceanskies2.jpg",
					"peacearch1.jpg",
					"pier1.jpg",
					"pierdive.jpg",
					"pierfishn.jpg",
					"pierromance.jpg",
					"pierview1.jpg",
					"pierview2.jpg",
					"pierview3.jpg",
					"pleasantneighbourhoods2.jpg",
					"promenade1.jpg",
					"promenade2.jpg",
					"quainthomes1.jpg",
					"quainthomes2.jpg",
					"resortsemiahmoo.jpg",
					"restaurantrow.jpg",
					"rockart2.jpg",
					"rockpier1.jpg",
					"sailingclub.jpg",
					"sandybeach2.jpg",
					"sandybeach4.jpg",
					"sandybeach7.jpg",
					"sandypier.jpg",
					"station1.jpg",
					"steelroad.jpg",
					"sunsetboats1.jpg",
					"sunsetboats2.jpg",
					"sunsetboats3.jpg",
					"thehump.jpg",
					"towersofwhite.jpg",
					"traincome.jpg",
					"traingo.jpg",
					"waterypier2.jpg",
					"whiterockstation.jpg",
					"who_me.jpg",
					"wildshores.jpg")
//Note: height in ImageSize includes button's height
var ImgSize = new Array(1984,1488,
						1984,1488,
						1984,1488,
						960,1280,
						1280,960,
						1280,960,
						1280,960,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1488,1984,
						1984,1488,
						1488,1984,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1488,1984,
						1984,1488,
						1984,1488,
						1984,1488,
						1280,960,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1024,768,
						1024,768,
						1024,768,
						1024,768,
						1024,768,
						1488,1984,
						6154,1330,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1488,1984,
						1488,1984,
						1984,1488,
						1488,1984,
						1984,1488,
						1488,1984,
						1984,1488,
						1984,1488,
						1488,1984,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1488,1984,
						1488,1984,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1280,960,
						1984,1488,
						1488,1984,
						1488,1984,
						1488,1984,
						1488,1984,
						1984,1488,
						1984,1488,
						1984,1488,
						1984,1488,
						1280,960,
						1984,1488,
						1984,1488,
						1984,1488)
var ThumbnailWnd;
function WriteThumbnailBrowse(nCurPage)
{
	if(ThumbnailWnd)
	{
		var str;
		var i;
		var nPicWidth, nPicHeight, nWndWidth, nWndHeight, nCurPicWidth, nCurPicHeight;
		nWndWidth = parseInt(screen.width*8/10);
		nWndHeight = parseInt(screen.height*8/10);
		ThumbnailWnd.document.writeln("<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2//EN>");
		ThumbnailWnd.document.writeln("<HTML>");
		ThumbnailWnd.document.writeln("<HEAD>");
		ThumbnailWnd.document.writeln("<TITLE>Image Browser</TITLE>");
		ThumbnailWnd.document.writeln("<META HTTP-EQUIV=Content-Type CONTENT=text/html>");
		ThumbnailWnd.document.writeln("<META NAME=language CONTENT=English>");
		ThumbnailWnd.document.writeln("<META NAME=description CONTENT=Web Album Generated by PhotoBase v2.6>");
		ThumbnailWnd.document.writeln("<script language=\"JavaScript\">");
		ThumbnailWnd.document.writeln("function MM_swapImgRestore() {");
		ThumbnailWnd.document.writeln("  if (document.MM_swapImgData != null)");
		ThumbnailWnd.document.writeln("  for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)");
		ThumbnailWnd.document.writeln("    document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];");
		ThumbnailWnd.document.writeln("}");
		ThumbnailWnd.document.writeln("function MM_preloadImages() {");
		ThumbnailWnd.document.writeln("  if (document.images) {");
		ThumbnailWnd.document.writeln("    var imgFiles = MM_preloadImages.arguments;");
		ThumbnailWnd.document.writeln("    if (document.preloadArray==null) document.preloadArray = new Array();");
		ThumbnailWnd.document.writeln("    var i = document.preloadArray.length;");
		ThumbnailWnd.document.writeln("    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!=\"#\"){");
		ThumbnailWnd.document.writeln("    preloadArray[i] = new Image;");
		ThumbnailWnd.document.writeln("    preloadArray[i++].src = imgFiles[j];");
		ThumbnailWnd.document.writeln("  }}");
		ThumbnailWnd.document.writeln("}");
		ThumbnailWnd.document.writeln("function MM_swapImage() {");
		ThumbnailWnd.document.writeln("  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;");
		ThumbnailWnd.document.writeln("  for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {");
		ThumbnailWnd.document.writeln("    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];");
		ThumbnailWnd.document.writeln("    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||");
		ThumbnailWnd.document.writeln("        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))");
		ThumbnailWnd.document.writeln("      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);");
		ThumbnailWnd.document.writeln("    obj = eval(objStr);");
		ThumbnailWnd.document.writeln("    if (obj != null) {");
		ThumbnailWnd.document.writeln("      swapArray[j++] = obj;");
		ThumbnailWnd.document.writeln("      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];");
		ThumbnailWnd.document.writeln("      obj.src = MM_swapImage.arguments[i+2];");
		ThumbnailWnd.document.writeln("  } }");
		ThumbnailWnd.document.writeln("  document.MM_swapImgData = swapArray; //used for restore");
		ThumbnailWnd.document.writeln("}");
		str = "var nImageTotal="+nImageTotal+";";
		ThumbnailWnd.document.writeln(str);
		if(navigator.appName != "Netscape")
			str = "var nImageCur=" + nCurPage + ";";
		else
			str = "var nImageCur=-1;";
		ThumbnailWnd.document.writeln(str);
		if(navigator.appName != "Netscape")
		{
			ThumbnailWnd.document.writeln("var ImageUnableOpen=\"UnableOpen.jpg\";");
			if(nImageTotal==1)
			{
				str = "var ImgName = new Array(\""+ImgName[0]+"\")"
				ThumbnailWnd.document.writeln(str);
			}
			else
				for(i=0;i<nImageTotal;i++)
				{
					if(i==0)
						str = "var ImgName = new Array(\""+ImgName[i]+"\",";
					else if(i==nImageTotal-1)
						str = "				\""+ImgName[i]+"\")";
					else
						str = "				\""+ImgName[i]+"\",";
					ThumbnailWnd.document.writeln(str);
				}
		}
		if(nImageTotal==1)
		{
			nPicWidth = ImgSize[0];
			nPicHeight = ImgSize[1];
			if(nPicWidth+50>nWndWidth || nPicHeight+125>nWndHeight)
			{
				if(nPicWidth*(nWndHeight-125)>nPicHeight*(nWndWidth-50))
				{
					nPicHeight = parseInt(nPicHeight*(nWndWidth-50)/nPicWidth);
					nPicWidth = nWndWidth-50;
				}
				else
				{
					nPicWidth = parseInt(nPicWidth*(nWndHeight-125)/nPicHeight);
					nPicHeight = nWndHeight-125;
				}
			}
			str = "var ImgSize = new Array("+nPicWidth+","+nPicHeight+")";
			ThumbnailWnd.document.writeln(str);
			nCurPicWidth = nPicWidth;
			nCurPicHeight = nPicHeight;
		}
		else
			for(i=0;i<nImageTotal;i++)
			{
				nPicWidth = ImgSize[i*2];
				nPicHeight = ImgSize[i*2+1];
				if(nPicWidth+50>nWndWidth || nPicHeight+125>nWndHeight)
				{
					if(nPicWidth*(nWndHeight-125)>nPicHeight*(nWndWidth-50))
					{
						nPicHeight = parseInt(nPicHeight*(nWndWidth-50)/nPicWidth);
						nPicWidth = nWndWidth-50;
					}
					else
					{
						nPicWidth = parseInt(nPicWidth*(nWndHeight-125)/nPicHeight);
						nPicHeight = nWndHeight-125;
					}
				}
				if(i==0)
					str = "var ImgSize = new Array("+nPicWidth+","+nPicHeight+",";
				else if(i==nImageTotal-1)
					str = "						"+nPicWidth+","+nPicHeight+")";
				else
					str = "						"+nPicWidth+","+nPicHeight+",";
				ThumbnailWnd.document.writeln(str);
				if(i==nCurPage)
				{
					nCurPicWidth = nPicWidth;
					nCurPicHeight = nPicHeight;
				}
			}
		ThumbnailWnd.document.writeln("function gotoImage(nImageIndex)");
		ThumbnailWnd.document.writeln("{");
		ThumbnailWnd.document.writeln("	if(nImageIndex == nImageCur)");
		ThumbnailWnd.document.writeln("		return;");
		if(navigator.appName != "Netscape")
		{
			ThumbnailWnd.document.writeln("	document.images[\"OriginalImage\"].src=\"\";");
			ThumbnailWnd.document.writeln("	if(ImgSize[nImageIndex*2]==0)");
			ThumbnailWnd.document.writeln("		document.images[\"OriginalImage\"].src=ImageUnableOpen;");
			ThumbnailWnd.document.writeln("	else");
			ThumbnailWnd.document.writeln("		document.images[\"OriginalImage\"].src=ImgName[nImageIndex];");
			ThumbnailWnd.document.writeln("	document.images[\"OriginalImage\"].alt=ImgName[nImageIndex];");
			ThumbnailWnd.document.writeln("	document.images[\"OriginalImage\"].width=ImgSize[nImageIndex*2]==0? 250 : ImgSize[nImageIndex*2];");
			ThumbnailWnd.document.writeln("	document.images[\"OriginalImage\"].height=ImgSize[nImageIndex*2+1]==0? 250 : ImgSize[nImageIndex*2+1];");
			ThumbnailWnd.document.writeln("	document.title=ImgName[nImageIndex];");
			ThumbnailWnd.document.writeln("	nImageCur=nImageIndex;");
			ThumbnailWnd.document.writeln("	if(ImgSize[nImageCur*2]==0)");
			ThumbnailWnd.document.writeln("		resizeTo(300, 375);");
			ThumbnailWnd.document.writeln("	else");
			ThumbnailWnd.document.writeln("		resizeTo(ImgSize[nImageCur*2]+50<200? 200 : ImgSize[nImageCur*2]+50, ImgSize[nImageCur*2+1]+125<270 ? 270 : ImgSize[nImageCur*2+1]+125);");
		}
		else
		{
			ThumbnailWnd.document.writeln("	var sDivID;");
			ThumbnailWnd.document.writeln("	if(nImageCur>=0)");
			ThumbnailWnd.document.writeln("	{");
			ThumbnailWnd.document.writeln("		sDivID = \"d\" + nImageCur;");
			ThumbnailWnd.document.writeln("		document.layers[sDivID].visibility=\"hide\";");
			ThumbnailWnd.document.writeln("	}");
			ThumbnailWnd.document.writeln("	sDivID = \"d\" + nImageIndex;");
			ThumbnailWnd.document.writeln("	document.layers[sDivID].visibility=\"show\";");
			ThumbnailWnd.document.writeln("	nImageCur=nImageIndex;");
			ThumbnailWnd.document.writeln("	if(ImgSize[nImageCur*2]==0)");
			ThumbnailWnd.document.writeln("		resizeTo(270, 345);");
			ThumbnailWnd.document.writeln("	else");
			ThumbnailWnd.document.writeln("		resizeTo(ImgSize[nImageCur*2]+20<170? 170 : ImgSize[nImageCur*2]+20, ImgSize[nImageCur*2+1]+75<220? 220 : ImgSize[nImageCur*2+1]+75);");
		}
		ThumbnailWnd.document.writeln("}");
		ThumbnailWnd.document.writeln("function gotoFirst()");
		ThumbnailWnd.document.writeln("{");
		ThumbnailWnd.document.writeln("	gotoImage(0);");
		ThumbnailWnd.document.writeln("}");
		ThumbnailWnd.document.writeln("function gotoLast()");
		ThumbnailWnd.document.writeln("{");
		ThumbnailWnd.document.writeln("	gotoImage(nImageTotal-1);");
		ThumbnailWnd.document.writeln("}");
		ThumbnailWnd.document.writeln("function gotoPrevious()");
		ThumbnailWnd.document.writeln("{");
		ThumbnailWnd.document.writeln("	if(nImageCur>0)");
		ThumbnailWnd.document.writeln("		gotoImage(nImageCur-1);");
		ThumbnailWnd.document.writeln("}");
		ThumbnailWnd.document.writeln("function gotoNext()");
		ThumbnailWnd.document.writeln("{");
		ThumbnailWnd.document.writeln("	if(nImageCur<nImageTotal-1)");
		ThumbnailWnd.document.writeln("		gotoImage(nImageCur+1);");
		ThumbnailWnd.document.writeln("}");
		ThumbnailWnd.document.writeln("</script>");
		ThumbnailWnd.document.writeln("</HEAD>");
		ThumbnailWnd.document.write("<");		ThumbnailWnd.document.write("BODY bgcolor=#000000 TEXT=#FFFFFF ALINK=green LINK=#0000FF VLINK=#8080FF onLoad=\"MM_preloadImages('thumbtna2.gif','#1');MM_preloadImages('thumbtnb2.gif','#2');");		ThumbnailWnd.document.writeln("MM_preloadImages('thumbtnc2.gif','#3');MM_preloadImages('thumbtnd2.gif','#4')\">");
		ThumbnailWnd.document.writeln("<P>");
		ThumbnailWnd.document.writeln("<TABLE ALIGN=\"LEFT\" BORDER=0>");
		ThumbnailWnd.document.writeln("  <TR>");
		ThumbnailWnd.document.write("      <TD><A HREF=\"javascript:gotoFirst()\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('document.first','document.first','thumbtna2.gif','#1')\"> ");		ThumbnailWnd.document.writeln("<IMG SRC=\"thumbtna.gif\" BORDER=\"0\" name=\"first\" alt=\"First\"></A></TD>");
		ThumbnailWnd.document.write("      <TD><A HREF=\"javascript:gotoPrevious()\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('document.previous','document.previous','thumbtnb2.gif','#2')\"> ");		ThumbnailWnd.document.writeln("<IMG SRC=\"thumbtnb.gif\" BORDER=\"0\" name=\"previous\" alt=\"Previous\"></A></TD>");
		ThumbnailWnd.document.write("      <TD><A HREF=\"javascript:gotoNext()\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('document.next','document.next','thumbtnc2.gif','#3')\"> ");		ThumbnailWnd.document.writeln("<IMG SRC=\"thumbtnc.gif\" BORDER=\"0\" name=\"next\" alt=\"Next\"></A></TD>");
		ThumbnailWnd.document.write("      <TD><A HREF=\"javascript:gotoLast()\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('document.last','document.last','thumbtnd2.gif','#4')\"> ");		ThumbnailWnd.document.writeln("<IMG SRC=\"thumbtnd.gif\" BORDER=\"0\" name=\"last\" alt=\"Last\"></A></TD>");
		ThumbnailWnd.document.writeln("  </TR>");
		ThumbnailWnd.document.writeln("</TABLE>");
		ThumbnailWnd.document.writeln("<BR><BR><BR>");
		ThumbnailWnd.document.writeln("</P>");
		ThumbnailWnd.document.writeln("</BODY>");
		ThumbnailWnd.document.writeln("<P>");
		if(navigator.appName != "Netscape")
		{
			str = "<IMG SRC=\"" + ImgName[nCurPage] + "\" BORDER=\"0\" name=\"OriginalImage\" alt=\"" + ImgName[nCurPage] + "\"";
			if(nCurPicWidth == 0 || nCurPicHeight == 0)
				str = str + "width=250 height=250>";
			else
				str = str + "width=" + nCurPicWidth + "height=" + nCurPicHeight + ">";
			ThumbnailWnd.document.writeln(str);
		}
		else
		{
			for(i=0;i<nImageTotal;i++)
			{
				nPicWidth = ImgSize[i*2];
				nPicHeight = ImgSize[i*2+1];
				if(nPicWidth+50>nWndWidth || nPicHeight+125>nWndHeight)
				{
					if(nPicWidth*(nWndHeight-125)>nPicHeight*(nWndWidth-50))
					{
						nPicHeight = parseInt(nPicHeight*(nWndWidth-50)/nPicWidth);
						nPicWidth = nWndWidth-50;
					}
					else
					{
						nPicWidth = parseInt(nPicWidth*(nWndHeight-125)/nPicHeight);
						nPicHeight = nWndHeight-125;
					}
				}
				var sImageCur = ImgSize[i*2]==0? "UnableOpen.jpg" : ImgName[i];
				str = "<div style=\"visibility:hide;position:absolute;left:10;top:60;width:" + nPicWidth + ";height:" + nPicHeight;
				str = str + "\" id=\"d" + i + "\"><IMG SRC=\"" + sImageCur + "\" ALT=\"" + ImgName[i];
				str = str + "\" BORDER=\"0\" id=\"img" + i + "\" width=\"" + nPicWidth + "\" height=\""+ nPicHeight + "\"></div>";
				ThumbnailWnd.document.writeln(str);
			}
		}
		ThumbnailWnd.document.writeln("</P>");
		ThumbnailWnd.document.writeln("</HTML>");
	}
}
function ThumbnailBrowse(nImageIndex)
{
	if(ThumbnailWnd==null || ThumbnailWnd.closed)
	{
		var nPicWidth = ImgSize[nImageIndex*2]==0 ? 250 : ImgSize[nImageIndex*2];
		var nPicHeight = ImgSize[nImageIndex*2+1]==0 ? 250 : ImgSize[nImageIndex*2+1];
		var nWndWidth = parseInt(screen.width*8/10);
		var nWndHeight = parseInt(screen.height*8/10);
		if(nPicWidth+50>nWndWidth || nPicHeight+125>nWndHeight)
		{
			if(nPicWidth*(nWndHeight-125)>nPicHeight*(nWndWidth-50))
			{
				nPicHeight = parseInt(nPicHeight*(nWndWidth-50)/nPicWidth);
				nPicWidth = nWndWidth-50;
			}
			else
			{
				nPicWidth = parseInt(nPicWidth*(nWndHeight-125)/nPicHeight);
				nPicHeight = nWndHeight-125;
			}
		}
		nWndWidth = nPicWidth+50;
		nWndHeight = nPicHeight+125;
		var	sWndOpt = "width="+nWndWidth+",height="+nWndHeight+",top=0,left=0,resizable=yes,scrollbars=yes";
		ThumbnailWnd = window.open("", "ImageBrowser", sWndOpt);
		WriteThumbnailBrowse(nImageIndex);
	}
	ThumbnailWnd.gotoImage(nImageIndex);
	ThumbnailWnd.focus();
}
function CloseBrowser()
{
	if(ThumbnailWnd && !ThumbnailWnd.closed)
	{
		ThumbnailWnd.close();
		ThumbnailWnd=null;
	}
}