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

	<xsl:output method="html" indent="yes" encoding="utf-8" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/>

	<!-- http://xslt.webcode.ru/archive/12/  -->

	<xsl:variable name="skinPath"><xsl:value-of select="/SITEBUILDER-PAGE/PROPERTIES/SKIN-PATH" disable-output-escaping="yes"/></xsl:variable>
	<xsl:variable name="windowTitle"><xsl:value-of select="/SITEBUILDER-PAGE/PROPERTIES/CUSTOM-TITLE"/></xsl:variable>

	<xsl:template match="/">

		<html>
			<head>
				<link href="{$skinPath}/Plesk.Buttons.css?{$version}.{$build}" type="text/css" rel="stylesheet" />
				<link href="{$skinPath}/Plesk.css?{$version}.{$build}" type="text/css" rel="stylesheet" />
				<link href="{$skinPath}/Plesk.Fieldset.css?{$version}.{$build}" type="text/css" rel="stylesheet" />
				<link href="{$skinPath}/Plesk.IconButton.css?{$version}.{$build}" type="text/css" rel="stylesheet" />
				<link href="{$skinPath}/Plesk.InputControls.css?{$version}.{$build}" type="text/css" rel="stylesheet" />

				<link href="{$skinPath}/style.css?{$version}.{$build}" type="text/css" rel="stylesheet" />
				<link href="{$skinPath}/style_ext.css?{$version}.{$build}" type="text/css" rel="stylesheet" />
				<link href="/skins/style_ext.css?{$version}.{$build}" type="text/css" rel="stylesheet" />

				<link rel="shortcut icon" href="/favicon.ico" />
				<script src='/js/util.js?{$version}.{$build}' type='text/javascript'></script>
				<script src='/js/preloader.js?{$version}.{$build}' type='text/javascript'></script>
				
				<script src='/js/common.js?{$version}.{$build}' type='text/javascript'></script>
				<script src='/js/validator.js?{$version}.{$build}' type='text/javascript'></script>
				<style type="text/css">img{ behavior:url('/images/pngbehavior.htc'); }</style>

				<title><xsl:value-of select="$windowTitle"/></title>
			</head>
			
			<body>
				<xsl:choose>
					<xsl:when test="$preloader = 1">
						<xsl:attribute name="onbeforeunload">TogglePreloader(1);</xsl:attribute>
						<xsl:attribute name="onload">ProcessOnloadActions();TogglePreloader(0);</xsl:attribute>
					</xsl:when>
					<xsl:otherwise>
						<xsl:attribute name="onload">ProcessOnloadActions();</xsl:attribute>
					</xsl:otherwise>
				</xsl:choose>
				
				<xsl:apply-templates select="SITEBUILDER-PAGE/JS-LOCALE"/>
				<div id="fullScreenDiv" style="position:absolute; background: #ff0000; filter:alpha(opacity=0); -moz-opacity: 0;"></div>
				
				<xsl:if test="$preloader = 1">
					<xsl:call-template name="PRELOADER"/>
				</xsl:if>
				
				<script>
					sb_status = null;
				</script>
				<!--modal forms -->
				<xsl:apply-templates select="SITEBUILDER-PAGE/APPLY-CHANGES" mode="initAfterBody"/>
				<xsl:apply-templates select="/SITEBUILDER-PAGE/ACTION-STATUS/DETAILS" mode="initAfterBody"/>
				<!--<xsl:apply-templates select="SITEBUILDER-PAGE/VIEW-CONTENT/MODULE-EDITOR/*" mode="initAfterBody"/>-->
				<!--/modal forms -->
				<xsl:apply-templates select="SITEBUILDER-PAGE"/>
				<!--/form-->
		
			</body>
		</html>
	</xsl:template>

	<xsl:template match="*" mode="initAfterBody">
	</xsl:template>

	<xsl:template match="JS-LOCALE">
		<script src='/js/locale.js?{$version}.{$build}' type='text/javascript'></script>
		<script type="text/javascript" language="javascript">
			<xsl:for-each select="*">
				SbAppendLocaleKey('<xsl:value-of select="name()"/>', '<xsl:value-of select="."/>');
			</xsl:for-each>
		</script>
	</xsl:template>

	<xsl:template name="PRELOADER">
<!--	<iframe src="/blank.html" id="SB_loader_iframe" name="SB_loader_iframe" frameBorder='0' scrolling='no' style='z-index: 998; border-width: 0px; width: 420px; height: 80px; position: absolute; display: none;'></iframe>
		<table id="SB_loader_table" cellpadding="0" cellspacing="0" border="0" width="100%" style="height: 100%; z-index: 997; position: absolute; display: none;">
			<tr>
				<td id="SB_loader_td" style="background: #ffffff; filter: alpha(opacity=40); -moz-opacity: 0.40;">
					&#160;
				</td>
			</tr>
		</table>
		<div id="DIV_DESKTOP" class="background-image : url({$skinPath}/images/empty.gif);">&#160;</div>
		<div id="loader" style="z-index: 999; display: none;">
			<table border="0" cellpadding="0" cellspacing="0" width="100%" style="height: 100%">
				<tr>
					<td valign="middle" align="center">
						<table cellpadding="0" cellspacing="0" border="0" width="100%" style="height: 100%">
							<tr>
								<td valign="middle"  align="center" width="26">
									<img src="{$skinPath}/icons/loading.gif" border="0" hspace="0" vspace="0" height="32" width="32" alt=""/></td>
								<td valign="middle">
									<strong><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/LOADER-MESSAGE1" disable-output-escaping="yes"/></strong>
									<xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/LOADER-MESSAGE2" disable-output-escaping="yes"/>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</div>
-->
		<table id="SB_loader_table" cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" style="display:none;z-index:1098;position:absolute;">
			<tr>
				<td id="SB_loader_td" style="filter:alpha(opacity=40);background-color:#ffffff;-moz-opacity:0.40;"></td>
			</tr>
		</table>
		<div id="DIV_DESKTOP" style="width:1%;height:1%;text-align:center;position:absolute;left:0px;top:0px;z-index:1001;"></div>
		<!-- style="background-color:White;border-color:#4DA8F7;border-width:3px;border-style:Solid;height:56px;width:320px;display:block;position:absolute;left:0px;top:0px;z-index:1100;" -->
		<div id="loader" style="height:56px;width:320px;display:block;position:absolute;left:0px;top:0px;z-index:1100;">
			<table border="0" cellspacing="3" cellpadding="3" width="100%" height="100%"  class="SB_Preloader">
				<tr>
					<td align="center" valign="middle" width="15%"><img id="ImagePreloader" src="{$skinPath}/images/loading.gif" style="border-width:0px;" /></td>
					<td align="left" valign="middle">
						<!-- style="color:Black;font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:11px;" -->
						<span id="LabelPreloader">
							<strong><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/LOADER-MESSAGE2" disable-output-escaping="yes"/></strong><br/><strong><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/LOADER-MESSAGE1" disable-output-escaping="yes"/></strong>
						</span>
					</td>
				</tr>
			</table>
		</div>
		<iframe src="" id="SB_loader_iframe" name="SB_loader_iframe" frameborder="0" scrolling="no" style="border-width:0;display:none;z-index:1099;position:absolute;height:56px;width:320px;"></iframe>		
		<script type="text/javascript">TogglePreloader(1);</script>
	</xsl:template>

	<xsl:template name="HEADER-LOGO">
		<img align="middle" style="" alt="" border="0">
			<xsl:attribute name="src"><xsl:value-of select="/SITEBUILDER-PAGE/PROPERTIES/CUSTOM-LOGO"/></xsl:attribute>
			<xsl:if test="/SITEBUILDER-PAGE/PROPERTIES/CUSTOM-LINK!=''">
				<xsl:attribute name="onclick">window.open('<xsl:value-of select="/SITEBUILDER-PAGE/PROPERTIES/CUSTOM-LINK"/>', '_new'); return false;</xsl:attribute>
				<xsl:attribute name="style">cursor: pointer;</xsl:attribute>
			</xsl:if>
		</img>
	</xsl:template>
	
<!--	<xsl:template match="NAVIGATION">
		<xsl:comment>Nothing to do in NAVIGATION</xsl:comment>
	</xsl:template>
-->

<!--	<xsl:template match="VIEW-CONTENT">
		<xsl:comment>Nothing to do in VIEW-CONTENT</xsl:comment>
	</xsl:template>
-->

<!--	<xsl:template name="MAIN-PAGE-HEADER">
		<xsl:choose>
			<xsl:when test="PAGE-HEADER">
				<xsl:apply-templates select="PAGE-HEADER"/>
			</xsl:when>
			<xsl:otherwise>
				<tr>
					<td class="SB_AdminPanel_Header">
						<xsl:if test="NAVIGATION">
							<xsl:attribute name="colspan">2</xsl:attribute>
						</xsl:if>
						<table class="SB_AdminPanel_Header_Inner" border="0" width="100%">
							<tr>
								<td valign="middle" style="padding-left:20;">
									<img onclick="window.open('http://swsoft.com', '_new'); return false;" src="{$skinPath}/images/def_sb_logo.gif" align="middle" style="border-width:0px;cursor:pointer;" alt=""/>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
-->

	<xsl:template match="SELECT-LANGUAGE">
		<!-- must be redesigned using combo-box template -->
		<xsl:param name="name" select="@NAME"></xsl:param>
		<xsl:param name="onChange"></xsl:param>
		<table border="0" cellpadding="5" cellspacing="0" class="SB_Start_Panel">
			<tr>
				<td align="left" valign="middle" style="width: 30px;padding-left:14px">
					<img src="{$skinPath}/images/language.gif" style="border-width:0px;" />
				</td>
				<td align="left" valign="middle" style="white-space: nowrap; color:Black;font-family:Arial;font-size:11px;" ><xsl:value-of select="@TITLE"/></td>
				<td align="left" valign="middle" style="white-space: nowrap;" >
					<select style="color:Black;font-family:Arial;font-size:11px;">
						<xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute>
						<xsl:attribute name="onChange"><xsl:value-of select="$onChange"/></xsl:attribute>
						<xsl:if test="@DISABLED = 1"><xsl:attribute name="disabled">true</xsl:attribute></xsl:if>
						<xsl:for-each select="LANGUAGE">
							<option value="">
								<xsl:attribute name="value"><xsl:value-of select="@ID"/></xsl:attribute>
								<xsl:if test="@SELECTED = 1">
									<xsl:attribute name="selected"><xsl:value-of select="@SELECTED"/></xsl:attribute>
								</xsl:if>
								<xsl:value-of select="@TITLE"/>
							</option>
						</xsl:for-each>
					</select>
				</td>
			</tr>
		</table>
	</xsl:template>
	
	<xsl:template match="SELECT-SITE">
		<!-- must be redesigned using combo-box template -->
		<xsl:param name="name" select="@NAME"></xsl:param>
		<xsl:param name="id" select="@ID"></xsl:param>
		<xsl:param name="onChange"></xsl:param>
		<table border="0" cellpadding="5" cellspacing="0" class="SB_Start_Panel">
			<tr>
<!--			<td align="left" valign="middle" style="width: 30px;padding-left:14px">
					<img src="{$skinPath}/images/site.gif" style="border-width:0px;" />
				</td>-->
				<td align="left" valign="middle" style="white-space: nowrap; color:Black;font-family:Arial;font-size:11px;" ><xsl:value-of select="@TITLE"/></td>
				<td align="left" valign="middle" style="white-space: nowrap;" >
					<select style="color:Black;font-family:Arial;font-size:11px;">
						<xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute>
						<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
						<xsl:attribute name="onChange"><xsl:value-of select="$onChange"/></xsl:attribute>
						<xsl:if test="@DISABLED = 1"><xsl:attribute name="disabled">true</xsl:attribute></xsl:if>
						<xsl:for-each select="SITE">
							<option value="">
								<xsl:attribute name="value"><xsl:value-of select="@ID"/></xsl:attribute>
								<xsl:if test="@SELECTED = 1">
									<xsl:attribute name="selected"><xsl:value-of select="@SELECTED"/></xsl:attribute>
								</xsl:if>
								<xsl:value-of select="@TITLE"/>
							</option>
						</xsl:for-each>
					</select>
				</td>
			</tr>
		</table>
	</xsl:template>

	<xsl:template name="nl2br">
		<xsl:param name="string"/>
		<xsl:value-of select="normalize-space(substring-before($string,'&#10;'))"/>
		<xsl:choose>
			<xsl:when test="contains($string,'&#10;')">
				<br />
				<xsl:call-template name="nl2br">
					<xsl:with-param name="string" select="substring-after($string,'&#10;')"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$string"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
	<xsl:template match="APPLY-CHANGES" mode="initAfterBody">
		<xsl:call-template name="MODAL-FORM">
			<xsl:with-param name="formName">SbApplyChanges</xsl:with-param>
			<xsl:with-param name="formTitle" select="@TITLE"/>
			<xsl:with-param name="closeHint" select="@CLOSE-HINT"/>
			<xsl:with-param name="additionalFormStyle">width:300px; height:145px; display:none;</xsl:with-param>
			<xsl:with-param name="content" select="current()"/>
			<xsl:with-param name="onCloseAction">top.sbApplyChangesObject.hide();</xsl:with-param>
			<xsl:with-param name="showStatus">0</xsl:with-param>
		</xsl:call-template>
		<script type="text/javascript" language="javascript" src="/js/apply_changes.js?{$version}.{$build}"/>
		<script type="text/javascript" language="javascript">
			<xsl:comment>
				top.sbApplyChangesObject = new SB_ApplyChanges('SbApplyChanges');
			//</xsl:comment>
		</script>
	</xsl:template>
	
	<xsl:template match="APPLY-CHANGES" mode="content">
		<table width="80%" cellspacing="0" cellpadding="0" border="0" align="center">
			<tr>
				<td align="left" colspan="3" style="vertical-align: middle; padding-bottom:10px; padding-left:10px;">
					<img src="{$skinPath}/images/applychanges.gif" style="display: inline; vertical-align: middle; border-width:0px;"/>
					<span style="white-space:nowrap; padding-left:30px; vertical-align: middle; color:black; font-family:Tahoma,Arial,Helvetica,sans-serif; font-size:11px;"><xsl:value-of select="@QUESTION"/></span>
				</td>
			</tr>
			<tr>
				<td align="center" width="33%" style="padding-right:15px;">
					<xsl:call-template name="BUTTON">
						<xsl:with-param name="action">return top.sbApplyChangesObject.yes();</xsl:with-param>
						<xsl:with-param name="title" select="@YES"/>
					</xsl:call-template>
				</td>
				<td align="center" width="34%">
					<xsl:call-template name="BUTTON">
						<xsl:with-param name="action">return top.sbApplyChangesObject.no();</xsl:with-param>
						<xsl:with-param name="title" select="@NO"/>
					</xsl:call-template>
				</td>
				<td align="center" width="33%" style="padding-left:15px;">
					<xsl:call-template name="BUTTON">
						<xsl:with-param name="action">top.sbApplyChangesObject.cancel();</xsl:with-param>
						<xsl:with-param name="title" select="@CANCEL"/>
					</xsl:call-template>
				</td>
			</tr>
		</table>
<!-- abelyaev@: for Modal forms debugging
<div id="SbLogs" style="width:100%; height:100%; overflow:auto; vertical-align:top; border:solid 1px #000000">Logs:</div>
<script type="text/javascript" language="javascript">
	<xsl:comment>
		SbInitLogging();
	//</xsl:comment>
</script>
-->
	</xsl:template>
	
</xsl:stylesheet>
