<?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:variable name="formId">SB_WizardFormBlockModule</xsl:variable>

	<xsl:template match="SITEBUILDER-PAGE">
		<html>
			<head></head>
			<body topmargin="0" leftmargin="0">
				<xsl:apply-templates select="ACTION-STATUS"/>
				<xsl:apply-templates select="VIEW-CONTENT"/>
			</body>
		</html>
	</xsl:template>

	<xsl:template match="VIEW-CONTENT">
		<form name="{$formId}" method="post" enctype="multipart/form-data" action="{@ACTION}">
			<xsl:call-template name="BLOCK-MODULE-EDITOR"/>
			<input type="hidden" name="moduleInstance" value="{@MODULE-INSTANCE}"/>
			<xsl:apply-templates/>
		</form>
	</xsl:template>
	
	<xsl:template match="ACTION-STATUS[@STATUS='2' and MESSAGE]">
		<table border="0" class="sb-text" style="padding-top: 5px; padding-bottom: 5px; width: 100%; padding-left: 10px;">
			<tr>
				<td valign="top" style="padding-right: 10px;">
					<img id="StatusIcon" style="border-width:0px;" src="{$skinPath}/images/error.gif"/>
				</td>
				<td width="100%">
					<xsl:value-of select="MESSAGE" mode="modalForm"/>
				</td>
			</tr>
		</table>	
	</xsl:template>

	<xsl:template name="BLOCK-MODULE-EDITOR">
		<script type="text/javascript" src="/js/Wizard/BlockModuleEditor.js?{$version}.{$build}"></script>
		<script type="text/javascript" language="javascript">
			<xsl:comment>
				self.sbEditorObject = new SbBlockModuleEditor('<xsl:value-of select="@MODULE-INSTANCE"/>', '<xsl:value-of select="$formId"/>');
			//</xsl:comment>
		</script>
	</xsl:template>

	<xsl:template name="BLOCK-MODULE-BUTTONS">
		<xsl:param name="isRequiredFieldsExists"/>
		<xsl:call-template name="OK-CANCEL-BUTTONS">
			<xsl:with-param name="okAction">self.sbEditorObject.submit();</xsl:with-param>
			<xsl:with-param name="cancelAction">self.sbEditorObject.discard();</xsl:with-param>
			<xsl:with-param name="isRequiredFieldsExists" select="$isRequiredFieldsExists"/>
		</xsl:call-template>
	</xsl:template>

</xsl:stylesheet>