<%
  import se.datadosen.util.*;
  // If meta.properties exists in the image directory and contains
  // an alternative title, use it instead of the directory name
  File propsFile = new File(imageDirectory, "meta.properties");
  if (propsFile.exists()) {
    Properties props = IO.readPropertyFile(propsFile);
    String newTitle = props.get("title");
    if (newTitle != null) title = newTitle;
  }
  
  String spacerImage(height) {
  	String sOut = "";
  	int lHeight = 0;
  	
  	lHeight = (int)((94 - height) / 2);
  	if (lHeight > 0) {
  		sOut += "<img style=\"visibility:hidden;\" src=\"" + resPath + "/1x1.gif\" width=\"94\" height=\"" + lHeight + "\" border=\"0\">";
  	}
  	
  	return sOut;
  }
  
  String imageCount() {
  	String sOut = "";
  	int lLength = files.length;
  	
  	if (lLength > 0) {
  		if (indexNum == void) {
  			sOut += "($text.image 1 $text.through " + indexImageCount + " $text.of " + lLength + ")";
  		} else {
  			sOut += "($text.image " + ((indexNum - 1) * (cols * rows) + 1) + " $text.through " + ((indexNum - 1) * (cols * rows) + indexImageCount) + " $text.of " + lLength + ")";
  		}
  	}
  	
  	return sOut;
  }
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!-- saved from url=(0013)about:internet -->
	<meta http-equiv="content-type" content="text/html" charset=$textEncoding" />
	<title><%=title%></title>
	<link href="$stylePath" rel="stylesheet">
<script language="javascript" src="$resPath/x.js"></script>
<script language="javascript">
function saveCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000))
		var expires = "; expires="+date.toGMTString()
	}
	else expires = ""
	document.cookie = name+"="+value+expires+"; path=/"
}
function setSlideShowCookie() {
	saveCookie('slideShow', 'true');
}
function init() {
	saveCookie('slideShow', '', -1);
	resizeHandler();
}
function resizeHandler() {
	xHeight('divActivity', parseInt(xClientHeight(),10) + parseInt(xScrollTop(),10));
}
window.onresize = resizeHandler
window.onscroll = resizeHandler
</script>
</head>
<body onload="init();" ID="index">
<script language="javascript">
if (navigator.userAgent.indexOf('Opera')!=-1)
	document.write('<style>\ndiv.Photo {\ndisplay: inline-block;\nfloat: none;\n}\n</style>');
</script>
<div id="divMainHeader"><%=title%> <% out.print(imageCount())%></div>
<div id="divMain">
<%
	String sFirstSlide = "";
%>
<ja:rowiterator>
	<ja:coliterator>
<ja:if exists="iconPath">
</ja:if>
<ja:else>
<%
	if (sFirstSlide.equals("")) {
		sFirstSlide = closeupPath;
	}
%>
</ja:else>
<div class="Photo" align="center"><div class="imgBorder" align="center"><a href="$closeupPath"><%=spacerImage(thumbHeight)%><img src="$thumbPath" width="$thumbWidth" height="$thumbHeight" border="0"/><%=spacerImage(thumbHeight)%></a></div><a href="$closeupPath" class="Photo">$fileName</a></div>
	</ja:coliterator>
</ja:rowiterator>
</div>
<div id="divActivity">
<div id="divImageActivity">
<table border="0" cellspacing="0" cellpadding="0" width="185">
<tr>
	<td colspan="3" width="185" class="ImagePaneHeader">$text.imageActivities</td>
</tr>
<ja:if exists="parentIndexPage">
<tr>
	<td width="1" class="ImagePaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
	<td width="183" class="ImagePaneRow"><a href="$parentIndexPage" class="ImagePaneRow"><img src="$resPath/FolderUp.gif" border="0" align="absmiddle" style="margin-right: 5px;"/>$text.upOneLevel</a></td>
	<td width="1" class="ImagePaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
</tr>
</ja:if>
<%
if (!sFirstSlide.equals("")) {
out.print("<tr>" +
"	<td width=\"1\" class=\"ImagePaneFrame\"><img src=\"$resPath/1x1.gif\" width=\"1\" height=\"1\"/></td>" +
"	<td width=\"183\" class=\"ImagePaneRow\"><a onclick=\"setSlideShowCookie();\" href=\"" + sFirstSlide + "\" class=\"ImagePaneRow\"><img src=\"$resPath/Slideshow.gif\" border=\"0\" align=\"absmiddle\" style=\"margin-right: 5px;\"/>$text.showSlideshow</a></td>" +
"	<td width=\"1\" class=\"ImagePaneFrame\"><img src=\"$resPath/1x1.gif\" width=\"1\" height=\"1\"/></td>" +
"</tr>");
}
%>
<ja:if exists="totalIndexes">
<ja:if exists="nextIndexPage">
<tr>
	<td width="1" class="ImagePaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
	<td width="183" class="ImagePaneRow"><a href="$nextIndexPage" class="ImagePaneRow"><img src="$resPath/Forward.gif" border="0" align="absmiddle" style="margin-right: 5px;"/>$text.nextPage</a></td>
	<td width="1" class="ImagePaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
</tr>
</ja:if>
<ja:if exists="previousIndexPage">
<tr>
	<td width="1" class="ImagePaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
	<td width="183" class="ImagePaneRow"><a href="$previousIndexPage" class="ImagePaneRow"><img src="$resPath/Back.gif" border="0" align="absmiddle" style="margin-right: 5px;"/>$text.previousPage</a></td>
	<td width="1" class="ImagePaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
</tr>
</ja:if>
</ja:if>
<tr>
	<td width="185" colspan="3" class="ImagePaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
</tr>
</table>
</div>
<div id="divInfoActivity">
<table border="0" cellspacing="0" cellpadding="0" width="185">
<tr>
	<td colspan="3" width="185" class="InfoPaneHeader">$text.information</td>
</tr>
<tr>
	<td width="1" class="InfoPaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
	<td width="183" class="InfoPaneRow"></td>
	<td width="1" class="InfoPaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
</tr>
<tr>
	<td width="185" colspan="3" class="InfoPaneFrame"><img src="$resPath/1x1.gif" width="1" height="1"/></td>
</tr>
</table>
</div>
<div id="divJAlbum">
Powered by <a href="$generatorUrl" target="_blank"><img src="$resPath/JAlbum.gif" border="0" alt="JAlbum" align="absmiddle"/></a>&nbsp;JAlbum
</div>
</div>
</body>
</html>
