<?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="POST-FORM">
	</xsl:template>	
	
	<xsl:template match="POST-FORM" mode="initAfterBody">
		<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: 470px;</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">
		<script type="text/javascript" src="/modules/Blogger/js/Post.js?{$version}.{$build}"/>
		<table border="0" style="width:100%;" class="sb-page">
			<tr>
				<td class="sb-formview-row">
					<xsl:apply-templates select="CONTROL[@NAME='title']" mode="TITLE-TOP">
						<xsl:with-param name="require">on</xsl:with-param>
						<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
						<xsl:with-param name="onChange">top.sbApplyChangesObject.registerChange();</xsl:with-param>
					</xsl:apply-templates>
				</td>				
			</tr>
			<tr>
				<td>
					<span><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/COMMENT"/></span><br/>
					<xsl:apply-templates select="WYSIWYG"/>
				</td>
			</tr>
		</table>			
	</xsl:template>	
	
	<xsl:template match="CATEGORIES-CARD">
		<script language="javascript">	
			function setCheckboxStatus(status) {
				var form = document.forms['SB_WizardForm'];
				for (var n = 0; n &lt; form.elements.length; n++) {
					if (form.elements[n].type == 'checkbox' &amp;&amp; form.elements[n].name=='objectIds[]') {
						if (!form.elements[n].disabled) {
							form.elements[n].checked = status;
						}
					}
				}
			}
		</script>
		<input type="hidden" name="product_category_pageNum"   value=""/>
		<input type="hidden" name="product_category_pageSize"  value=""/>
		
		<div style="overflow:auto; width:100%;height:250px;">
			<xsl:apply-templates select="PAGED-LIST" />
		</div>
	</xsl:template>	
	
	<xsl:template match="CATEGORIES-CARD/PAGED-LIST/LIST/HEADER">
		<tr class="sb-gridview-header" align="left" style="height:24px;white-space:nowrap;">
			<th style="width:1%;text-align:center">
				<input type="checkbox" name="globalCheck" onclick="setCheckboxStatus(this.checked);"/>
			</th>
			<th style="padding-left: 4px; padding-right: 4px;"><xsl:value-of select="NAME"/></th>
		</tr> 
	</xsl:template>
	
	<xsl:template match="CATEGORIES-CARD/PAGED-LIST/LIST/ITEM">
		<xsl:variable name="class">
			<xsl:call-template name="LIST-ROW-CLASS">
				<xsl:with-param name="position"><xsl:value-of select="position()"/></xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		
		<tr class="{$class}" style="height:24px;">
			<td style="width:1%;text-align:center;">
				<input type="checkbox" name="objectIds[]">
					<xsl:attribute name="value"><xsl:value-of select="ID"/></xsl:attribute>
					<xsl:if test="../../../SELECTED-CATEGORIES/CATEGORY/@ID=ID">
						<xsl:attribute name="checked">true</xsl:attribute>
					</xsl:if>
				</input>
			</td>
			
			<xsl:call-template name="LIST-ROW-ITEM">
				<xsl:with-param name="title"><xsl:value-of select="NAME"/></xsl:with-param>
			</xsl:call-template>
		</tr>
	</xsl:template>		
	
	<xsl:template match="WYSIWYG[@MODE='bloggerPost']">
		<xsl:variable name="Wysiwyg">
			<xsl:text>Wysiwyg_</xsl:text>
			<xsl:value-of select="generate-id()"/>
		</xsl:variable>
		<xsl:variable name="WysiwygIniter">
			<xsl:text>Init_</xsl:text>
			<xsl:value-of select="$Wysiwyg"/>
		</xsl:variable>
		<script type="text/javascript" src="/js/Modules/Wysiwyg/fckeditor.js?{$version}.{$build}"></script>
		<script language="JavaScript" type="text/javascript">
		 	function <xsl:value-of select="$WysiwygIniter"/>() {
		 		if (!<xsl:value-of select="$Wysiwyg"/>) {
			 		<xsl:value-of select="$Wysiwyg"/>=new FCKeditor('<xsl:value-of select="$Wysiwyg"/>');
			 		<xsl:value-of select="$Wysiwyg"/>.BasePath = '/js/Modules/Wysiwyg/';
					<xsl:value-of select="$Wysiwyg"/>.Config["CustomConfigurationsPath"] = "/js/Modules/Wysiwyg/config/BloggerPostForm.js?<xsl:value-of select="$version"/>.<xsl:value-of select="$build"/>";
					<xsl:value-of select="$Wysiwyg"/>.ToolbarSet="BloggerPostForm";
					<xsl:value-of select="$Wysiwyg"/>.Config["DefaultLanguage"]="<xsl:value-of select="@LANGUAGE"/>";
					<xsl:value-of select="$Wysiwyg"/>.Config["Version"]="<xsl:value-of select="$version"/>.<xsl:value-of select="$build"/>";
					<xsl:value-of select="$Wysiwyg"/>.ReplaceTextarea();
				}
			}
			<xsl:value-of select="$Wysiwyg"/>=null;
			<xsl:call-template name="CUSTOM-SCRIPT">
				<xsl:with-param name="Initer"><xsl:value-of select="$WysiwygIniter"/></xsl:with-param>
			</xsl:call-template>
		</script>
		<textarea id="{$Wysiwyg}" name="{@NAME}" style="border-width: 0px;"><xsl:value-of select="CONTENT"/></textarea>
	</xsl:template>		
	
</xsl:stylesheet>	