<?xml version='1.0' ?>
<!--Picture Gallery Pro Skin #1 - Fedor Skvortsov, COMobjects.NET. July, 2001-->
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
	<xsl:include href="config.xslt" />
	<xsl:output method='html' encoding='windows-1252' />
	<!--Document representation-->
	<xsl:template match='/'>
		<html>
		<body bgcolor="#000000" background="Images/background.gif" text="#ffffff" link="#ffff00" vlink="#ffff00" alink="#000000" bgproperties="fixed" topmargin="0" marginheight="0">
		<xsl:apply-templates select='Folder/Path'></xsl:apply-templates>
		<xsl:choose>
			<xsl:when test='Folder/File[@src!=""]'>
				<xsl:apply-templates select='Folder/File' />
				<xsl:apply-templates select='Folder/Pages' />
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select='Folder/SubFolders' />
				<xsl:apply-templates select='Folder/Files' />
				<xsl:apply-templates select='Folder/Pages' />
			</xsl:otherwise>
		</xsl:choose>
		</body>
		</html>
	</xsl:template>
	<!--End of the document representation
		Path and navigation buttons representation-->
	<xsl:template match='Folder/Path'>
		<table>
			<xsl:attribute name='width'>
				<xsl:value-of select='$GalleryWidth' />
			</xsl:attribute>
			<tr>
				<td>
					<xsl:attribute name='width'>
						<xsl:value-of select='$GalleryWidth' />
					</xsl:attribute>
					<table cellpadding='0' cellspacing='0'>
						<xsl:attribute name='width'>
							<xsl:value-of select='$GalleryWidth' />
						</xsl:attribute>
						<tr>
							<form method='get'>
								<td valign='middle' align="right">
									<xsl:attribute name='width'>
										<xsl:value-of select='$GalleryWidth - 280' />
									</xsl:attribute>								
									<xsl:attribute name='action'>
										<xsl:value-of select='$MainASP' />
									</xsl:attribute>
									<input type='text' name='query' size='14' />&#32;&#32;
								</td>
								<td width='10'></td>
								<td>
									<xsl:attribute name='width'>
										<xsl:value-of select='90' />
									</xsl:attribute>
									<input type='image' border='0' src='Images/Search.gif' />
								</td>
							</form>
							<td width='90'>
								<xsl:choose>
									<xsl:when test='Folder[last()-1]/@href != ""'>
										<a>
											<xsl:attribute name='href'>
												<xsl:value-of select='$MainASP' />
												<xsl:value-of select='Folder[last()-1]/@href' />
											</xsl:attribute>
											<img border='0' src='Images/Parent.gif' />
										</a>
									</xsl:when>
									<xsl:otherwise>
										<img border='0' src='Images/ParentGrey.gif' />
									</xsl:otherwise>
								</xsl:choose>
							</td>
							<td width='90'>
								<xsl:choose>
									<xsl:when test='Folder[1]/@href != ""'>
										<a>
											<xsl:attribute name='href'>
												<xsl:value-of select='$MainASP' />
											</xsl:attribute>
											<img border='0' src='Images/Top.gif' />
										</a>
									</xsl:when>
									<xsl:otherwise>
										<img border='0' src='Images/TopGrey.gif' />
									</xsl:otherwise>
								</xsl:choose>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<xsl:attribute name='width'>
						<xsl:value-of select='$GalleryWidth' />
					</xsl:attribute>
					<p class="path">
						<img border='0' src='Images/FolderOpen.gif' />&#32;
						<xsl:for-each select='Folder'>
							<xsl:if test='position()!=1'> \	</xsl:if>
							<xsl:choose>
								<xsl:when test='@href!=""'>
									<a>
										<xsl:attribute name='href'>
											<xsl:value-of select='$MainASP' />
											<xsl:value-of select='@href' />
										</xsl:attribute>
										<xsl:value-of select='@name' />
									</a>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select='@name' />
								</xsl:otherwise>
							</xsl:choose>
						</xsl:for-each>
					</p>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--End of the path and navigation buttons representation
		Subfolders representation-->
	<xsl:template match='Folder/SubFolders'>
		<table>
			<xsl:attribute name='width'>
				<xsl:value-of select='$GalleryWidth' />
			</xsl:attribute>
			<xsl:for-each select='Folder'>
				<xsl:if test='position() mod 2=1'>
					<tr>
						<xsl:apply-templates select='current()' />
						<xsl:apply-templates select='following-sibling::Folder[1]' />
					</tr>
				</xsl:if>
			</xsl:for-each>
		</table>
	</xsl:template>
	<xsl:template match='Folder/SubFolders/Folder'>
		<td valign='top'>
			<xsl:attribute name='width'>
				<xsl:value-of select='floor($GalleryWidth div 2)' />
			</xsl:attribute>
			<div class='folder'>
				<img border='0' src='Images/Folder.gif' />&#32; 
				<a>
					<xsl:attribute name='href'>
						<xsl:value-of select='$MainASP' />
						<xsl:value-of select='@href' />
					</xsl:attribute>
					<xsl:value-of select='@name' />&#32;
				</a>
				<xsl:if test='@filecount &gt; 0 or @foldercount &gt; 0'>
					(<xsl:if test='@foldercount &gt; 0'>
						<xsl:value-of select='@foldercount' /> subfolder<xsl:if test='@foldercount &gt; 1'>s</xsl:if>
						<xsl:if test='@filecount &gt; 0'>
							, 
						</xsl:if> 
					</xsl:if>
					<xsl:if test='@filecount &gt; 0'>
						<xsl:value-of select='@filecount' /> image<xsl:if test='@filecount &gt; 1'>s</xsl:if> 		
					</xsl:if>)
				</xsl:if>
			</div>
			<div class='folderdesc'>
				<xsl:if test='@category!=""'>
					<b>CATEGORY: <xsl:value-of select='@category' /></b>
					<br />
				</xsl:if>
				<xsl:value-of select='@description' />
			</div>
		</td>
	</xsl:template>
	<!--End of the subfolders representation
		Pictures drawing-->
	<xsl:template match='Folder/Files'>
		<table>
			<xsl:attribute name='width'>
				<xsl:value-of select='$GalleryWidth' />
			</xsl:attribute>
			<xsl:for-each select='File'>
				<xsl:if test='position() mod 4=1'>
					<tr>
						<xsl:apply-templates select='current()' />
						<xsl:choose>
							<xsl:when test='following-sibling::File[1]/@href!=""'>
								<xsl:apply-templates select='following-sibling::File[1]' />
							</xsl:when>
							<xsl:otherwise>
								<td></td>
							</xsl:otherwise>
						</xsl:choose>
						<xsl:choose>
							<xsl:when test='following-sibling::File[2]/@href!=""'>
								<xsl:apply-templates select='following-sibling::File[2]' />
							</xsl:when>
							<xsl:otherwise>
								<td></td>
							</xsl:otherwise>
						</xsl:choose>
						<xsl:choose>
							<xsl:when test='following-sibling::File[3]/@href!=""'>
								<xsl:apply-templates select='following-sibling::File[3]' />
							</xsl:when>
							<xsl:otherwise>
								<td></td>
							</xsl:otherwise>
						</xsl:choose>
					</tr>
				</xsl:if>
			</xsl:for-each>
		</table>
	</xsl:template>
	<xsl:template match='Folder/Files/File'>
		<td valign='top'>
			<xsl:attribute name='width'>
				<xsl:value-of select='floor($GalleryWidth div 4)' />
			</xsl:attribute>
			<table width='100%'>
				<tr>
					<td width='100%' align='center' valign='bottom'>
						<xsl:attribute name='height'>
							<xsl:value-of select='$ThumbnailSize + 5' />
						</xsl:attribute>
						<a>
							<xsl:attribute name='href'>
								<xsl:value-of select='$MainASP' />
								<xsl:value-of select='@href' />
							</xsl:attribute>
							<img border='0'>
								<xsl:attribute name='src'><xsl:value-of select='$ThumbnailASP' /><xsl:value-of select='@icon' />&amp;size=<xsl:value-of select='$ThumbnailSize' /></xsl:attribute>
							</img>
						</a>
					</td>
				</tr>
				<tr>
					<td width='100%' align='center' valign='top' class='infobox'>
						<xsl:attribute name='height'>
							<xsl:value-of select='$InfoHeight' />
						</xsl:attribute>
						<p>
							<xsl:if test='@description!=""'>
								<span class='description'>
									<xsl:value-of select='@description' />
								</span>
								<br />
							</xsl:if>
							<span class='info'>
								<xsl:value-of select='@name' />
							</span>
							<br />
							<span class='info'>
								<xsl:value-of select='@size' />
							</span>
							<br />
							<span class='info'>
								<xsl:value-of select='@date' />
							</span>
							<br />
						</p>
					</td>
				</tr>
			</table>
		</td>
	</xsl:template>
	<!--End of the pictures drawing
		Generating of the pages of the pictures (when their number exceeds PageSize variable of the Picture Gallery)-->
	<xsl:template match='Folder/Pages'>
		<table>
			<xsl:attribute name='width'>
				<xsl:value-of select='$GalleryWidth' />
			</xsl:attribute>
			<tr>
				<td>
					<xsl:attribute name='width'>
						<xsl:value-of select='$GalleryWidth' />
					</xsl:attribute>
					<p align='center' class='navbar'>
						<xsl:variable name='currentpage' select='@currentpage'></xsl:variable>
						<xsl:variable name='groupsize'>20</xsl:variable>
						<xsl:choose>
							<xsl:when test='@prevhref!=""'>
								<a>
									<xsl:attribute name='href'>
										<xsl:value-of select='$MainASP' />
										<xsl:value-of select='@prevhref' />
									</xsl:attribute>
									&lt;&#32;Prev&#32;				
								</a>
							</xsl:when>
							<xsl:otherwise>
								&lt;&#32;Prev&#32;
							</xsl:otherwise>
						</xsl:choose>						
						<xsl:for-each select='Page'>						
							<xsl:choose>
								<xsl:when test='@index &gt; ($currentpage - $currentpage mod $groupsize) and @index &lt; ($currentpage - $currentpage mod $groupsize) + $groupsize + 1'>
						
									<xsl:choose>
										<xsl:when test='@index=$currentpage'>
											<xsl:apply-templates select='current()' />
										</xsl:when>
										<xsl:otherwise>
											<a>
												<xsl:attribute name='href'>
													<xsl:value-of select='$MainASP' />
													<xsl:value-of select='@href' />
												</xsl:attribute>
												<xsl:apply-templates select='current()' />
											</a>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:when>
								<xsl:otherwise>
									<xsl:if test='@index mod $groupsize = 1'>
										&#32;
										<a>
											<xsl:attribute name='href'>
												<xsl:value-of select='$MainASP' />
												<xsl:value-of select='@href' />
											</xsl:attribute>
											|		
											<xsl:choose>
												<xsl:when test='@from!=""'>								
													<xsl:value-of select='@from' />
												</xsl:when>
												<xsl:otherwise>
													<xsl:value-of select='@index' />
												</xsl:otherwise>
											</xsl:choose>
											...
											|
										</a>
										&#32;					
									</xsl:if>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:for-each>						
						<xsl:choose>
							<xsl:when test='@nexthref!=""'>
								<a>
									<xsl:attribute name='href'>
										<xsl:value-of select='$MainASP' />
										<xsl:value-of select='@nexthref' />
									</xsl:attribute>
									&#32;Next&#32;&gt;
								</a>
							</xsl:when>
							<xsl:otherwise>
								&#32;Next&#32;&gt;
							</xsl:otherwise>
						</xsl:choose>
					</p>
				</td>
			</tr>
		</table>
	</xsl:template>
	<xsl:template match='Folder/Pages/Page'>
		|		
		<xsl:choose>
			<xsl:when test='@from!=""'>								
				<xsl:value-of select='@from' />-<xsl:value-of select='@to' />
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select='@index' />
			</xsl:otherwise>
		</xsl:choose>
		|
	</xsl:template>
	<!--End of the generating of the pages of the pictures 
		Full-sized picture drawing-->
	<xsl:template match='Folder/File'>
		<table>
			<xsl:attribute name='width'>
				<xsl:value-of select='$GalleryWidth' />
			</xsl:attribute>
			<tr>
				<td align='center'>
					<xsl:attribute name='width'>
						<xsl:value-of select='$GalleryWidth' />
					</xsl:attribute>
					<xsl:if test='@description != ""'>
						<span class='description'>
							<xsl:value-of select='@description' />
						</span>
						<br />
						<br />
					</xsl:if>
					<span class='info'>( <xsl:value-of select='@name' />, 
					<xsl:value-of select='@size' />, 
					<xsl:value-of select='@date' /> )</span>
					<br />
					<br />
					<xsl:choose>
						<xsl:when test='@type = "picture" or @type = "image"'>
							<img>
								<xsl:if test='$DisplayAsIs = "False"'>
									<xsl:attribute name='width'>
										<xsl:value-of select='$GalleryWidth' />
									</xsl:attribute>
								</xsl:if>
								<xsl:attribute name='src'>
									<xsl:value-of select='@src' />
								</xsl:attribute>
							</img>
						</xsl:when>
						<xsl:otherwise>
							<span class='links'>
								<table width='250' align='center'>
									<td width='50'>
										<img border='0'>
											<xsl:attribute name='src'><xsl:value-of select='$ThumbnailASP' /><xsl:value-of select='@icon' />&amp;size=<xsl:value-of select='$ThumbnailSize' /></xsl:attribute>
										</img>
									</td>
									<td width='200'>
										<p class='path'>
											<a>
												<xsl:attribute name='href'>
													<xsl:value-of select='@src' />
												</xsl:attribute>								
												Download (<xsl:value-of select='@size' />)
											</a>
										</p>
									</td>
								</table>
							</span>
						</xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--End of the full-sized picture drawing-->
</xsl:stylesheet>

