<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:strip-space elements="*"/>
	<xsl:output method="html" indent="yes" encoding="utf-8"/>
	
	<xsl:template match="CATEGORY-FORM">
	</xsl:template>
	
	<xsl:template match="CATEGORY-FORM" mode="initAfterBody">
		<!--<script type="text/javascript" src="/modules/ImageGallery/js/categories.js?{$version}.{$build}"></script>-->
		<xsl:call-template name="MODAL-FORM">
			<xsl:with-param name="formName">modalForm</xsl:with-param>
			<xsl:with-param name="formTitle" select="/SITEBUILDER-PAGE/LOCALE/FORM-TITLE"/>
			<!--<xsl:with-param name="helpHint" select="/SITEBUILDER-PAGE/LOCALE/HELP-HINT"/>-->
			<!--<xsl:with-param name="closeHint" select="@CLOSE-HINT"/>-->
			<xsl:with-param name="additionalFormStyle">width: 650px; height: 420px;</xsl:with-param>
			<xsl:with-param name="content" select="current()"/>
			<xsl:with-param name="onCloseAction">sbNavigationObject.go();</xsl:with-param>
		</xsl:call-template>
	</xsl:template>	
		
	<xsl:template match="MAIN-CARD">
		<table cellpadding="0" cellspacing="0" border="0" class="control-title-input">
			<tr>
				<td class="title-block">
					<xsl:call-template name="LABEL" mode="label">
						<xsl:with-param name="id">name</xsl:with-param>
						<xsl:with-param name="require">true</xsl:with-param>
						<xsl:with-param name="title" select="CURRENT-CATEGORY-IMAGE/@TITLE"/>
						<xsl:with-param name="value" select="CURRENT-CATEGORY-IMAGE/@VALUE"/>
					</xsl:call-template>
				</td>
				<td class="input-block">
					<xsl:call-template name="INPUT" mode="control">
						<xsl:with-param name="id">name</xsl:with-param>
						<xsl:with-param name="maxlength">50</xsl:with-param>
						<xsl:with-param name="name">name</xsl:with-param>
						<xsl:with-param name="require">true</xsl:with-param>
						<xsl:with-param name="value" select="CURRENT-CATEGORY-IMAGE/@VALUE"/>
					</xsl:call-template>
				</td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td class="title-block">
					<xsl:call-template name="LABEL" mode="label">
						<xsl:with-param name="title" select="/SITEBUILDER-PAGE/LOCALE/CURRENT-IMAGE-TITLE"/>
					</xsl:call-template>
				</td>
				<td class="input-block">
					<xsl:choose>
						<xsl:when test="CURRENT-CATEGORY-IMAGE/@IMAGE-FILE-PATH!=''">
							<img border="0">
								<xsl:attribute name="src"><xsl:value-of select="CURRENT-CATEGORY-IMAGE/@IMAGE-URL"/></xsl:attribute>
							</img>
						</xsl:when>
						<xsl:otherwise>
							<xsl:call-template name="NO-IMAGE" />
						</xsl:otherwise>
					</xsl:choose>
					<input type="hidden" name="image">
						<xsl:attribute name="value"><xsl:value-of select="CURRENT-CATEGORY-IMAGE/@IMAGE-FILE-PATH"/></xsl:attribute>
					</input>
				</td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td class="title-block">
					<xsl:call-template name="LABEL" mode="label">
						<xsl:with-param name="title" select="/SITEBUILDER-PAGE/LOCALE/NEW-IMAGE"/>
					</xsl:call-template>
				</td>
				<td class="input-block">
					<xsl:call-template name="INPUT" mode="control">
						<xsl:with-param name="name">image</xsl:with-param>
						<xsl:with-param name="size">25</xsl:with-param>
						<xsl:with-param name="type">file</xsl:with-param>						
					</xsl:call-template>
				</td>
				<td style="padding-left:5px;">
					<xsl:call-template name="BUTTON-CONTROL">
						<xsl:with-param name="title"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/UPLOAD"/></xsl:with-param>
						<xsl:with-param name="action">setWizardFormAction("<xsl:value-of select="/SITEBUILDER-PAGE/VIEW-CONTENT/@ACTION"/>/Modules/ImageGallery/Category/Image/Upload");wizardFormSubmit();</xsl:with-param>
					</xsl:call-template>
				</td>
				<td style="padding-left:5px;">
					<xsl:if test="CURRENT-CATEGORY-IMAGE/@IMAGE-FILE-PATH!=''">
						<xsl:call-template name="BUTTON-CONTROL">
							<xsl:with-param name="title"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/DELETE"/></xsl:with-param>
							<xsl:with-param name="action">setWizardFormAction("<xsl:value-of select="/SITEBUILDER-PAGE/VIEW-CONTENT/@ACTION"/>/Modules/ImageGallery/Category/Image/Delete");wizardFormSubmit();</xsl:with-param>
							<xsl:with-param name="icon">delete.png</xsl:with-param>
						</xsl:call-template>
					</xsl:if>
				</td>
			</tr>
		</table>
	</xsl:template>	
	
	<xsl:template match="DESCRIPTION-CARD">
		<table width="100%" border="0">
			<tr>
				<td>
					<xsl:apply-templates select="WYSIWYG" />
				</td>
			</tr>
		</table>
	</xsl:template>	
	
	<xsl:template name="NO-IMAGE">
		<table style="width: 102px; height: 70px; background-color: #A4A4A4;">
			<tr>
				<td valign="middle" align="center">
					<span style="vertical-align: middle; color: #FFFFFF;"><b><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/NO-IMAGE"/></b></span>
				</td>
			</tr>
		</table>
	</xsl:template>	
	
	<xsl:template match="POSITION">
		<option >
			<xsl:attribute name="value"><xsl:value-of select="@VALUE"/></xsl:attribute>
			<xsl:if test="@SELECTED=1">
				<xsl:attribute name="selected">true</xsl:attribute>
			</xsl:if>
			<xsl:value-of select="@VALUE"/>
		</option>
	</xsl:template>	
	
</xsl:stylesheet>