<?xml version="1.0"?>
<!-- edited with XML Spy v2.5 NT  - http://www.xmlspy.com -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xslc="http://xslcomponents.org/TR/WD-xslc">
	<xsl:import href="../xslc.xsl"/>
	<xsl:template match="/">
		<xsl:apply-templates select="document"/>
	</xsl:template>
	<xsl:template match="document">
		<xsl:call-template name="xslc:Page">
			<xsl:with-param name="Title" select="/document/Locales/LoginTitle"/>
			<xsl:with-param name="Head">
				<script language="javascript" src="{$XMLC_Portal}md5.js"/>
				<script language="javascript">
					<![CDATA[
function checkTopLevel() {
  if ((null == top) || (top == self))
   return;
//  top.location.href = location.href;
} // checkTopLevel

function ProcessPwd() {
  if (D = document.MainForm) {

// importantissime pour FireFox
// rajouter pour éviter pb de login sous FireFox...

    if (D.XMLC_BaseHREF.value == '') {
      D.XMLC_BaseHREF.value = XMLC_BaseHRef;
    }

    if (D.ProcessPwdDone.value != '1') {
      D.Password.value = calcMD5(D.Password_.value);
      D.Password_.value = '';
      D.ProcessPwdDone.value = '1';
    } else
     D.Password.value = D.Password_.value; // Password transmitted in clear (e.g. LDAP)
  }
  else {
    alert('Password encryption failed.\nPlease upgrade your browser.');
  }
}
]]>
				</script>
			</xsl:with-param>
			<xsl:with-param name="BodyAttributes">
				<Attributes onload="checkCookie('divCookieAlert'); checkTopLevel();"/>
			</xsl:with-param>
			<xsl:with-param name="ActivePageName">FormLogin</xsl:with-param>
			<xsl:with-param name="Tabs">
				<Item Name="FormLogin" Caption="{/document/Locales/Login}" Hint="{/document/Locales/Login}" ImagePath="{$XMLC_PictosPath}button_login.gif"/>
			</xsl:with-param>
			<xsl:with-param name="DisplayTabControl">0</xsl:with-param>
			<xsl:with-param name="DisplayTabs">0</xsl:with-param>
			<xsl:with-param name="Body">
				<xsl:variable name="vHRef">
					<xsl:if test="/document/XMLC_Params/XMLC_BaseHREF != ''">
						<xsl:value-of select="/document/XMLC_Params/XMLC_BaseHREF"/>
					</xsl:if>
					<xsl:if test="/document/XMLC_Params/XMLC_BaseHREF = ''">
						<xsl:if test="(/document/XMLC_Params/XMLC_Host) and (/document/XMLC_Params/XMLC_Host != '') and (/document/XMLC_Params/XMLC_ScriptName) and (/document/XMLC_Params/XMLC_ScriptName != '')">
							<xsl:choose>
								<xsl:when test="/document/XMLC_Params/XMLC_HTTPS = '1'">https</xsl:when>
								<xsl:otherwise>http</xsl:otherwise>
							</xsl:choose>://<xsl:value-of select="/document/XMLC_Params/XMLC_Host"/>
							<xsl:value-of select="/document/XMLC_Params/XMLC_ScriptName"/>
							<xsl:if test="$XMLC_UseXMLC_Action != '1'">/</xsl:if>
						</xsl:if>
					</xsl:if>
				</xsl:variable>
				<xsl:if test="/document/XMLC_Params/XMLC_Exception != ''">
					<div style="margin-top: 10px;">
						<xsl:call-template name="xslc:ApplicationMessages"/>
					</div>
				</xsl:if>
				<div id="divCookieAlert" style="display: none;">
					<xsl:call-template name="xslc:Exception">
						<xsl:with-param name="Message" select="/document/Locales/BrowserDoNotSupportCookies"/>
					</xsl:call-template>
				</div>
				<form method="POST" name="MainForm" onsubmit="ProcessPwd();">
					<xsl:attribute name="action">
						<xsl:value-of select="/document/XMLC_Params/XMLC_ScriptName"/>
						<xsl:if test="/document/XMLC_Params/XMLC_UseXMLC_Action != '1'">/XMLC_Login</xsl:if>
					</xsl:attribute>
					<xsl:if test="/document/XMLC_Params/XMLC_UseXMLC_Action = '1'">
						<input type="hidden" name="XMLC_Action" value="XMLC_Login"/>
					</xsl:if>
					<input type="hidden" name="XMLC_BaseHREF">
						<xsl:attribute name="value">
							<xsl:value-of select="$vHRef"/>
						</xsl:attribute>
					</input>
					<input type="hidden" name="XMLC_UserName" value="{/document/PARAMS/XMLC_UserName}"/>
					<input type="hidden" name="ProcessPwdDone">
						<xsl:attribute name="value">
							<xsl:choose>
								<xsl:when test="/document/PARAMS/XMLC_SecurityDirectory = 'LDAP'">1</xsl:when>
								<xsl:when test="/document/PARAMS/XMLC_SecurityDirectory = 'WinNT'">1</xsl:when>
								<xsl:otherwise>0</xsl:otherwise>
							</xsl:choose>
						</xsl:attribute>
					</input>
					<table border="0" cellpadding="2" cellspacing="0" width="100%" style="margin-top: 10px;">
						<xsl:if test="/document/PARAMS/ShowLanguage = 1"/>
						<tr>
							<td nowrap="">
								<b>
									<xsl:value-of select="/document/Locales/Language"/>
								</b>
							</td>
							<td width="100%">
								<xsl:apply-templates select="/document/Languages"/>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<hr size="1"/>
							</td>
						</tr>
						<tr>
							<td nowrap="">
								<b>
									<xsl:value-of select="/document/Locales/EMail"/>
								</b>
							</td>
							<td>
								<input type="text" name="UserName" style="width: 100%" class="clFlatTextInput" value="{/document/PARAMS/XMLC_UserName}"/>
							</td>
						</tr>
						<tr>
							<td nowrap="">
								<b>
									<xsl:value-of select="/document/Locales/Password"/>
								</b>
							</td>
							<td>
								<input type="hidden" name="Password"/>
								<input type="password" name="Password_" style="width: 100%" class="clFlatTextInput"/>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<ul type="square" style="margin-top: 4px; margin-bottom: 4px; margin-left: 16px">
									<li>
										<xsl:value-of select="/document/Locales/LiIfYouDont"/>
									</li>
									<li>
										<xsl:value-of select="/document/Locales/LiToLogIn"/>
									</li>
								</ul>
							</td>
						</tr>
					</table>
					<input type="image" src="{$XMLC_SkinPath}spacer.gif" height="0" width="0"/>
					<table>
						<tr>
							<td>
								<xsl:call-template name="xslc:Button">
									<xsl:with-param name="Caption">
										<span>
											<b>
												<xsl:value-of select="/document/Locales/Login"/>
											</b>
										</span>
									</xsl:with-param>
									<xsl:with-param name="OnClick">SubmitForm('MainForm'); return false;</xsl:with-param>
								</xsl:call-template>
							</td>
							<td>
								<xsl:call-template name="xslc:Button">
									<xsl:with-param name="Caption">
										<span>
											<b>
												<xsl:value-of select="/document/Locales/ChangePassword"/>
											</b>
										</span>
									</xsl:with-param>
									<xsl:with-param name="OnClick">SubmitForm('MainForm', 'ACTION', 'XMLC_CheckChangePWD'); return false;</xsl:with-param>
								</xsl:call-template>
							</td>
						</tr>
					</table>
				</form>
				<xsl:call-template name="xslc:PoweredBy"/>
			</xsl:with-param>
			<xsl:with-param name="Width">400px</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Languages">
		<select style="width: 100px" name="XMLC_Language">
			<xsl:attribute name="onchange">MainForm.action='XMLC_FormLogin'; MainForm.submit(); return false;</xsl:attribute>
			<xsl:apply-templates/>
		</select>
	</xsl:template>
	<xsl:template match="Language">
		<option value="{Code}">
			<xsl:if test="Code = /document/PARAMS/XMLC_Language">
				<xsl:attribute name="selected">yes</xsl:attribute>
			</xsl:if>
			<xsl:value-of select="Title"/>
		</option>
	</xsl:template>
</xsl:stylesheet>
