<ja:include once page="bsh/index.bsh">Code NOT Included</ja:include>

<%
	Common commonModel = (Common) indexModel;
	indexModel.updateVars();
%>

<ja:include page="includes/html-header.inc" />
<html>
<head>
	<title><%= indexModel.getCurrentIndexFullTitle() %></title>

	<!-- Include Header Common Parts -->
	<ja:include page="includes/common-header.inc" />

	<ja:if test="<%= indexModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_META_TAGS_ON_INDEX, imageDirectory, true ) %>">
		<!-- Include Meta-Tags -->
		<ja:include page="includes/metatags-header.inc" />
	</ja:if>

	<ja:if test="<%= indexModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_BLENDING_EFFECT_ON_INDEXES, imageDirectory, true ) %>">
		<!-- Blending/Fading effect -->
		<meta http-equiv="page-enter" content="blendTrans(Duration=0.5)">
		<meta http-equiv="page-exit" content="blendTrans(Duration=0.5)">
	</ja:if>

	<!-- Page Setup -->
	<script language="javascript" type="text/javascript">
		<ja:include page="includes/setup-index.js">JavaScript Code NOT Included</ja:include>
	</script>

	<ja:if test="<%= indexModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_KEYBOARD_SUPPORT, imageDirectory, true ) %>">
		<!-- Keyboard & Navigation Support -->
		<script language="javascript" type="text/javascript" src="$resPath/js/keyboard.js"></script>
		<script language="javascript" type="text/javascript" src="$resPath/js/nav-index.js"></script>
	</ja:if>

	<ja:if test="<%= indexModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_VIEWER_REMARKS_FEATURE_ON_FOLDERS, imageDirectory, true ) %>">
		<!-- Remarks Support -->
		<script language="javascript" type="text/javascript" src="$resPath/js/remarks.js"></script>
	</ja:if>
</head>

<body id="body">
	<ja:if test="<%= indexModel.shouldIncludeViewerRemarksOnIndex() %>">
		<!-- PHP Remarks Support -->
		<?php
			include "$resPath/php/remarks.php";
			$userRemarks = new UserRemarks(NULL, "$indexPage", "$resPath");
		?>
		<!-- PHP Remarks Support -->
	</ja:if>

	<%
		String folderBackgroundPath = indexModel.getFolderBackgroundPath();
	%>

	<ja:include page="includes/help.inc" />

	<!-- table for entire slide page -->
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td width="100%" height="100%">
				<!-- table for top path bar -->
				<ja:include page="includes/index-topbar.inc" />
			</td>
		</tr>
		<tr>
			<td>
				<!-- table of navigation icons and slide image -->
				<ja:if test="<%= folderBackgroundPath!=null %>">
					<table width="100%" border="0" cellspacing="0" cellpadding="0" background="${folderBackgroundPath}">
						<tr>
							<td height="10"><img src="$resPath/empty.gif" alt=""/></td>
						</tr>
				</ja:if>
				<ja:else>
					<table class="index-pagebody" width="100%" border="0" cellspacing="0" cellpadding="0">
				</ja:else>
					<ja:if test="<%= indexModel.hasTopNavigationBar() %>">
						<tr valign="top">
							<td width="100%">
								<ja:include page="includes/index-top-navigation.inc" />
							</td>
						</tr>
					</ja:if>

					<% String header = indexModel.getHeaderContent(); %>
					<ja:if test="<%= !GeneralUtils.isEmptyString(header) %>">
						<tr>
							<td align="center" valign="top">
								<p class="bppheader">${header}</p>
							</td>
						</tr>
					</ja:if>

					<tr>
						<td class="topruler"/>
					</tr>

					<tr>
						<td align="center">
							<!-- Start of the thumbnail images -->
							<!-- Iterate through images and produce an index table -->
							<%
								String cellSize = ((int)100/cols) + "%";
							%>
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<ja:rowiterator>
								<% List columnProperties = new ArrayList();	%>
								<tr>
								<ja:coliterator>
									<% File currentFile = files[imageNum - 1]; %>
									<ja:if test="<%= currentFile.isDirectory() %>">
										<td width="${cellSize}" valign="middle" align="center">
											<% columnProperties.add( indexModel.writeFolderThumbnail(currentFile, out) ); %>
										</td>
									</ja:if>
									<ja:else>
										<td width="${cellSize}" valign="bottom" align="center">
											<% columnProperties.add( indexModel.writeSlideThumbnail(currentFile, out) ); %>
										</td>
									</ja:else>
								</ja:coliterator>
								</tr>
								<% Iterator it = columnProperties.iterator(); %>
								<tr>
								<ja:coliterator>
									<% String[] props = (String[]) it.next(); %>

									<td align="center" valign="top" width="${cellSize}">
										<table width="100%" border="0">
											<tr>
												<td width="10">&nbsp;</td>
												<td align="center" valign="top">
													<a href="<%= props[0] %>" class="note">
														<ja:if test="<%= props[3].equalsIgnoreCase("TYPE_FOLDER") %>">
															<strong><%= props[1] %></strong>
														</ja:if>
														<ja:else>
															<%= props[1] %>
														</ja:else>
													</a>

													<ja:if test="<%= props[2]!=null %>">
														<!-- Voice annotation -->
														<%= indexModel.getActionBlock(props[2], null, "$text.download-sound", indexModel.getIconSetPath(imageDirectory) + "/sound_small.gif", "align=\"middle\""); %>
													</ja:if>
												</td>
												<td width="10">&nbsp;</td>
											</tr>
										</table>
									</td>
								</ja:coliterator>
								</tr>
								<tr>
									<td height="30"/>
								</tr>
							</ja:rowiterator>
							</table>
						</td>
					</tr>

					<tr>
						<td class="bottomruler"/>
					</tr>

					<ja:if test="<%= totalIndexes==void || indexNum==1 %>">
						<% String voiceAnnotationConsole = indexModel.getFolderVoiceAnnotationConsole(); %>
						<ja:if test="<%= voiceAnnotationConsole!=null %>">
							<!-- Add and play voice annotations (only on first index page!) -->
							<tr>
								<td width="100%" align="center">
	 								${voiceAnnotationConsole}
								</td>
							</tr>
						</ja:if>
					</ja:if>

					<ja:if test="<%= indexModel.hasBottomNavigationBar() %>">
						<tr valign="top">
							<td width="100%">
								<ja:include page="includes/index-bottom-navigation.inc" />
							</td>
						</tr>
					</ja:if>

					<ja:if test="<%= indexModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_VIEWER_REMARKS_FEATURE_ON_FOLDERS, imageDirectory, true ) %>">
						<tr valign="top">
							<td width="100%">
								<ja:include page="includes/index-remarks.inc" />
							</td>
						</tr>
					</ja:if>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<!-- Page footer -->
				<ja:include page="includes/footer.inc" />
			</td>
		</tr>
	</table>

	<script language="javascript" type="text/javascript">pageSetup();</script>
</body>
</html>