<?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="VIEW-CONTENT">
		<script type="text/javascript" src="/js/Wizard/panel_toogle.js?{$version}.{$build}"></script>
		<table border="0" cellpadding="0" cellspacing="0" style="height: 100%;width:100%" align="center">
			<tr>
				<td style="vertical-align: top; " align="center">
					<table cellpadding="0" cellspacing="0" border="0" style="height: 100%;width:100%">
						<tr>
							<xsl:call-template name="SITE-MAP-PANEL"/>
							<xsl:apply-templates select="EDITOR-AREA"/>
						</tr>
					</table>
				</td>
			</tr>
		</table>

	</xsl:template>

	<xsl:template name="SITE-MAP-PANEL">
		<td valign="top">
			<table style="height:100%;" cellpadding="0" cellspacing="0">
				<tr>
					<td>
						<div id="LeftPanelDiv">
							<xsl:attribute name="style">height: 100%; display: <xsl:choose>
								<xsl:when test="SITE-MAP/@IS-OPENED='yes'">block</xsl:when>
								<xsl:otherwise>none</xsl:otherwise>
							</xsl:choose>;</xsl:attribute>
							<xsl:call-template name="SITE-MAP" />
						</div>
					</td>
                    <td style="height: 100%;" class="sb-edit-panel-hidebackground" id="LeftPanelDiv_Bar">
                        <div id="ButtonHideTree" onclick="toggleLeftPanel('{$skinPath}/images/right.gif', '{$skinPath}/images/left.gif');" align="center" style="width: 21px; height: 100%; border: 0px solid #7D7D7D; float: left; cursor: hand; cursor: pointer;">
                            <img id="LeftPanelDiv_bullet" class="sb-edit-panel-arrow" style="border-width:0px;"><xsl:attribute name="src"><xsl:value-of select="$skinPath"/>/images/<xsl:choose>
											<xsl:when test="SITE-MAP/@IS-OPENED='yes'">left</xsl:when>
											<xsl:otherwise>right</xsl:otherwise>
										</xsl:choose>.gif</xsl:attribute></img><br />
                            <img id="LeftPanelDiv_Text" style="border-width:0px;" src="/localizedimage.php?text="/>
							<script type="text/javascript" language="javascript">
								<xsl:choose>
									<xsl:when test="SITE-MAP/@IS-OPENED='yes'">$('LeftPanelDiv_Text').src += encodeURIComponent(SbGetLocaleByKey('HIDE-SITE-MAP'));</xsl:when>
									<xsl:otherwise>$('LeftPanelDiv_Text').src += encodeURIComponent(SbGetLocaleByKey('SHOW-SITE-MAP'));</xsl:otherwise>
								</xsl:choose>
							</script>
                        </div>
                    </td>
				</tr>
			</table>
			<input type="hidden" id="LeftPanelDiv_hidden">
				<xsl:attribute name="value">
					<xsl:choose>
						<xsl:when test="SITE-MAP/@IS-OPENED='yes'">false</xsl:when>
						<xsl:otherwise>true</xsl:otherwise>
					</xsl:choose>
				</xsl:attribute>
			</input>
		</td>
	</xsl:template>

	<xsl:template name="SITE-MAP">
		<table style="height:100%"  class="sb-edit-panel"  width="200"  border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td valign="top">
					<table border="0" cellpadding="8" cellspacing="8" width="100%" height="450">
					    <tr valign="top">
					        <td>
					            <b class="sb-text">
					            	<xsl:value-of select="SITE-MAP/@TITLE"/>
					            </b>
					        </td>
					    </tr>
						<xsl:call-template name="SITE-MAP-TREE" />
						<xsl:call-template name="SITE-MAP-FORM" />
					</table>
				</td>
			</tr>
		</table>
	</xsl:template>

	<xsl:template name="SITE-MAP-TREE">
		<script src="/js/Wizard/Edit.js?{$version}.{$build}" language="javascript"></script>
		<script type="text/javascript" language="javascript">
			<xsl:comment>
			var currentPageId = '<xsl:value-of select="@PAGE"/>';
			var action = '<xsl:value-of select="@ACTION"/>';
			//</xsl:comment>
		</script>
		<tr class="sb-edit-panel-block" style="height: 100%;">
			<td class="sb-edit-panel-block-border" id="siteMapTd" valign="top" width="183">
				<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" style="table-layout: fixed;">
					<tr><td valign="top">
						<xsl:apply-templates select="SITE-MAP/PAGES-TREE" >
							<xsl:with-param name="onSelect">onNodeSelect</xsl:with-param>
							<xsl:with-param name="style">white-space: nowrap; overflow-x: hidden; overflow-y: auto; width:100%; height:100%;</xsl:with-param>
						</xsl:apply-templates>
					</td></tr>
				</table>
			</td>
		</tr>
		<script type="text/javascript" language="javascript">
			var knownPagesFileNames = new Array('index');

			<xsl:apply-templates select="SITE-MAP/PAGES-TREE/PAGES-TREE-PAGE" mode="SBPageRegistration"/>
		</script>
	</xsl:template>

	<xsl:template match="PAGES-TREE-PAGE" mode="SBPageRegistration">
		<xsl:choose>
			<xsl:when test="@SELECTED or @SELECTED = 'true'"/>
			<xsl:otherwise>knownPagesFileNames.push('<xsl:value-of select="@FILE-NAME"/>');</xsl:otherwise>
		</xsl:choose>

		registerPageEditView('<xsl:value-of select="@ID"/>', '<xsl:value-of select="@EDIT-INSTANCE-VIEW"/>');
		<xsl:apply-templates select="PAGES-TREE-PAGE" mode="SBPageRegistration"/>
	</xsl:template>

	<xsl:template name="SITE-MAP-FORM">
	    <tr valign="top" id="PageSettingsTR" height="160px" class="sb-edit-panel-block">
	        <td class="sb-edit-panel-block-border" width="170px">
	        	<script>
	        		sbNavigationObject.registerOnSubmitFunction(validateForm);
	        	</script>


	            <table border="0" cellpadding="0" cellspacing="0" width="100%">
	                <tr>
	                    <td style="padding-bottom: 5px;">
	                        <span class="sb-text"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/PAGE-TITLE"/></span><span style="color:Red; width: 10px;">*</span>
	                        <br />
	                        <input id="pageTitle" name="pageTitle" type="text" maxlength="255" class="sb-text" style="border-color:#999EA1;border-width:1px;border-style:Solid;width:90%;" onchange="self.sbApplyChangesObject.registerChange();">
	                        	<xsl:attribute name="value"><xsl:value-of select="SITE-MAP/PAGE-INFO/@TITLE"/></xsl:attribute>
	                        </input>

	                    </td>
	                </tr>
	                <tr>
	                    <td style="padding-bottom: 5px;">
	                        <span class="sb-text"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/PAGE-FILE-NAME"/></span><span style="color:Red; width: 10px;">*</span>
	                        <br />
	                        <input id="pageFileName" name="pageFileName" type="text" maxlength="255" class="sb-text" style="border-color:#999EA1;border-width:1px;border-style:Solid;width:90%;" onchange="self.sbApplyChangesObject.registerChange();">
	                        	<xsl:attribute name="value"><xsl:value-of select="SITE-MAP/PAGE-INFO/@FILE-NAME"/></xsl:attribute>
	                        </input>

	                    </td>
	                </tr>
	                <tr>
	                    <td style="padding-bottom: 5px;">
	                        <span class="sb-text"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/PAGE-KEYWORDS"/></span><br />
	                        <textarea id="pageKeywords" name="pageKeywords" rows="2" cols="20" class="sb-text" style="border-color:#999EA1;border-width:1px;border-style:Solid;width:100%;" onchange="self.sbApplyChangesObject.registerChange();">
	                        	<xsl:value-of select="SITE-MAP/PAGE-INFO/@KEYWORDS"/>
	                        </textarea>
	                    </td>
	                </tr>
	                <tr>
	                    <td style="padding-bottom: 5px;">
	                        <span class="sb-text"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/PAGE-DESCRIPTION"/></span><br />
	                        <textarea id="pageDescription" name="pageDescription" rows="2" cols="20" class="sb-text" style="border-color:#999EA1;border-width:1px;border-style:Solid;width:100%;" onchange="self.sbApplyChangesObject.registerChange();">
	                        	<xsl:value-of select="SITE-MAP/PAGE-INFO/@DESCRIPTION"/>
	                        </textarea>
	                    </td>
	                </tr>
	                <tr>
	                    <td>
							<div style="width: 0; height: 5px;"><span></span></div>
							<table cellpadding="0" cellspacing="0" border="0">
								<tr>
									<td>
				                        <input type="checkbox" name="pageShowInNavigation" onchange="self.sbApplyChangesObject.registerChange();" style="margin: 0; width: 13px; height: 13px;">
				                        	<xsl:if test="SITE-MAP/PAGE-INFO/@SHOW-IN-NAVIGATION = 1">
				                        		<xsl:attribute name="checked">checked</xsl:attribute>
				                        	</xsl:if>
				                        </input>
									</td>
									<td>
										<span class="sb-text" style="padding-left: 5px;"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/PAGE-SHOW-IN-NAVIGATION"/></span>
									</td>
								</tr>
							</table>
	                    </td>
	                </tr>
	                <tr>
	                    <td>
	                    	<br/><span style="color:Red; padding-right: 5px;">*</span><span class="sb-text"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/PAGE-REQUIRE-FIELDS"/></span><br />
	                    </td>
	                </tr>
	            </table>
	            <input type="hidden" name="currentPageId" id="page" >
	            	<xsl:attribute name="value"><xsl:value-of select="SITE-MAP/PAGE-INFO/@ID"/></xsl:attribute>
	            </input>
	        </td>
	    </tr>
	</xsl:template>

</xsl:stylesheet>
