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

<xsl:template match="SITE-FAMILIES-FORM">
	<style>
			.sb-formtableheader-th { background-color: #ffffff; }
			.sb-page { padding-top: 0; }
	</style>
	<script type="text/javascript" src="/js/Admin/SiteFamilies.js?{$version}.{$build}"/>
	
	<form name="siteFamilyForm" id="siteFamilyForm" enctype="multipart/form-data"  method="post" onsubmit="return submitForm();">
		<input type="hidden" id="action" name="action" value="/Admin/SiteFamilies/Save"/>
				
		<xsl:apply-templates select="TAB-PANEL"/>

		<!-- input image needed for work default submit via Enter -->
		<input type="image" style="border-width: 0px; height: 0px; width: 0px;"/>
	</form>

	<table border="0" cellpadding="0" cellspacing="0" width="100%">
		<tr>
			<td align="left" style="padding-left: 5px"><xsl:call-template name="REQUIRED-FIELDS"/></td>
			<td>
				<xsl:call-template name="OK-CANCEL-BUTTONS">
					<xsl:with-param name="okAction">submitForm();</xsl:with-param>
					<xsl:with-param name="cancelAction">document.location.href="<xsl:value-of select="$baseUrl"/>/Admin/SiteFamilies/List";</xsl:with-param>
				</xsl:call-template>
			</td>
		</tr>
	</table>
</xsl:template>

<xsl:template match="TAB-PANEL-CARD[@ID='presentation']/CONTENT">
	<table border="0" width="100%" cellpadding="2" cellspacing="0">
		<tr class="sb-formview-row">
			<td>
				<xsl:apply-templates select="CONTROL[@NAME='code']" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="onChange">sbApplyChangesObject.registerChange();</xsl:with-param>
					<xsl:with-param name="require">on</xsl:with-param>
				</xsl:apply-templates>
			</td>
		</tr>
		
		<tr class="sb-formview-alternaterow">
			<td>
				<xsl:apply-templates select="CONTROL[@NAME='title']" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="onChange">sbApplyChangesObject.registerChange();</xsl:with-param>
					<xsl:with-param name="require">on</xsl:with-param>
				</xsl:apply-templates>
			</td>
		</tr>
		
		<tr class="sb-formview-row">
			<td>
				<xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/FIELD-DESCRIPTION"/><br/>
				<xsl:apply-templates select="WYSIWYG[@NAME='description']"/>
			</td>
		</tr>
		
		<tr class="sb-formview-alternaterow">
			<td>
				<table width="100%" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td width="50%">
							<xsl:value-of select="LOGO-PREVIEW/@VALUE"/>
						</td>
						<td width="50%">
							<table cellpadding="0" cellspacing="0" border="0">
								<tr>
									<td valign="middle" align="center" style="width: 160px; height: 100px;" class="logotype-layer">
										<img style="border-width: 0px;">
											<xsl:attribute name="src">
												<xsl:choose>
													<xsl:when test="LOGO-PREVIEW/@IMAGE">
														<xsl:value-of select="LOGO-PREVIEW/@IMAGE"/>
													</xsl:when>
													<xsl:otherwise>
														<xsl:value-of select="$skinPath"/>/images/<xsl:value-of select="LOGO-PREVIEW/@DEFAULT-IMAGE"/>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:attribute>
										</img>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		
		<tr class="sb-formview-row">
			<td>
				<xsl:call-template name="UPLOAD-LOGO"/>
			</td>
		</tr>		
	</table>
</xsl:template>

<xsl:template match="TAB-PANEL-CARD[@ID='generic']/CONTENT">
	<table border="0" width="100%" cellpadding="2" cellspacing="0">
		<tr class="sb-formview-alternaterow">
			<td>
				<xsl:apply-templates select="CONTROL[@NAME='templateCategoryId' and @TYPE='COMBO-BOX']" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="onChange">sbApplyChangesObject.registerChange();</xsl:with-param>
				</xsl:apply-templates>
			</td>
		</tr>
		<tr class="sb-formview-row">
			<td>
				<xsl:apply-templates select="CONTROL[@NAME='pagesetId' and @TYPE='COMBO-BOX']" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="onChange">sbApplyChangesObject.registerChange();</xsl:with-param>
				</xsl:apply-templates>
			</td>
		</tr>
	</table>
</xsl:template>

<xsl:template name="UPLOAD-LOGO">
	<input type="hidden" name="MAX_FILE_SIZE">
		<xsl:attribute name="value"><xsl:value-of select="UPLOAD-LOGO/@MAX-FILE-SIZE"/></xsl:attribute>
	</input>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr class="sb-formview-row">
			<td width="50%">
				<xsl:value-of select="UPLOAD-LOGO/@VALUE"/>
			</td>
			<td width="50%">
				<table cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td>
							<input type="file" style="border: 1px solid rgb(153, 158, 161); width: 185px;" id="idUploadLogo">
								<xsl:attribute name="name">
									<xsl:value-of select="UPLOAD-LOGO/@NAME"/>
								</xsl:attribute>
							</input>
						</td>
						
						<td><img src="/images/blank.gif" width="16" height="1"/></td>
						
						<td>
							<xsl:apply-templates select="UPLOAD-LOGO/CONTROL[@NAME='uploadButton']">
								<xsl:with-param name="action">javascript:submitForUpload();</xsl:with-param>
								<xsl:with-param name="style">width: 100px;</xsl:with-param>
							</xsl:apply-templates>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</xsl:template>

</xsl:stylesheet>