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


<!-- VARIABLES -->

<!-- <xsl:variable name="siteroot" select="//site/head/@siteroot" />
<xsl:variable name="siterootlg" select="//site/head/@siterootlg" />
<xsl:variable name="ca" select="//site/head/@ca" />
<xsl:variable name="si" select="concat($siteroot,'si/')" />
<xsl:variable name="sa" select="concat($siteroot,'sa/')" />
<xsl:variable name="pc" select="concat($siteroot,'pc/')" />
<xsl:variable name="ci" select="'ci/'" />
<xsl:variable name="cvi" select="concat($siteroot,'cvi/')" />
<xsl:variable name="cvii" select="concat($siteroot,'cvii/')" />
<xsl:variable name="ch" select="concat($siteroot,'ch/')" />
<xsl:variable name="lang" select="//site/head/@lang" />
<xsl:variable name="langcode" select="//site/head/@langcode" />
<xsl:variable name="cc" select="//*[@currentcat='1']" />
<xsl:variable name="ccf" select="//*[@finalcat='1']" />
<xsl:variable name="cif" select="//*[@finalitem='1']" />
<xsl:variable name="cr" select="/site/cats" /> -->

<xsl:variable name="siteroot" select="/site/head/@siteroot" />
<xsl:variable name="siterootlg" select="/site/head/@siterootlg" />
<xsl:variable name="staticroot1" select="/site/head/@staticroot1" />
<xsl:variable name="staticroot2" select="/site/head/@staticroot2" />
<xsl:variable name="ca" select="/site/head/@ca" />
<xsl:variable name="si" select="concat($siteroot,'si/')" />
<!-- <xsl:variable name="sa" select="concat($siteroot,'sa/')" /> -->
<xsl:variable name="sa" select="concat($staticroot1,'sa/')" />
<!-- <xsl:variable name="ssa1" select="concat($staticroot1,'sa/')" /> -->
<!-- <xsl:variable name="ssa2" select="concat($staticroot2,'sa/')" /> -->
<!-- <xsl:variable name="pc" select="concat($siteroot,'pc/')" /> -->
<xsl:variable name="pc" select="concat($staticroot1,'pc/')" />
<!-- <xsl:variable name="ci" select="'ci/'" /> -->
<xsl:variable name="ci" select="concat($siteroot,'ci/')" />
<xsl:variable name="cvi" select="concat($siteroot,'cvi/')" />
<xsl:variable name="cvii" select="concat($siteroot,'cvii/')" />
<xsl:variable name="ch" select="concat($siteroot,'ch/')" />
<xsl:variable name="lang" select="/site/head/@lang" />
<xsl:variable name="langcode" select="/site/head/@langcode" />
<xsl:variable name="langweburl" select="/site/head/@langweburl" />
<xsl:variable name="cc" select="//cat[@currentcat='1']" />
<xsl:variable name="ccf" select="(//cat[@finalcat='1'])[1]" />
<xsl:variable name="cif" select="$ccf//item[@finalitem='1']" />
<xsl:variable name="cr" select="/site/cats" />
<xsl:variable name="ismobile" select="/site/head/@ismobile" />
<xsl:variable name="istablet" select="/site/head/@istablet" />
<xsl:variable name="isphone" select="/site/head/@isphone" />
<xsl:variable name="isbot" select="/site/head/@isbot" />
<xsl:variable name="usecriticalcss" select="/site/head/@usecriticalcss" />
<xsl:variable name="cube_version" select="/site/head/@cube_version" />
<xsl:variable name="req_url" select="/site/head/@req_url" />


<!-- DEFAUTS BEHAVIORS -->

<xsl:template match="@*">
	<xsl:copy/>
</xsl:template>


<xsl:template match="*">
	<xsl:element name="{name()}">
		<xsl:apply-templates select="* | text() | @*" />
	</xsl:element>
</xsl:template>

<!-- CHANGE FCK IMGS URL TO HAVE A CORRECT SIZE -->

<xsl:template match="img[@ckimg='1']">
	<xsl:element name="{name()}">
		<xsl:apply-templates select="@*" />
		<xsl:attribute name="src"><xsl:value-of select="concat($ci,'ram_',@w,'_',@h,'/',@srco)" /></xsl:attribute>
		<xsl:attribute name="srco"></xsl:attribute>
	</xsl:element>
</xsl:template>

<!-- CHANGE FCK LINKS URL TO HAVE A CORRECT URL -->

<xsl:template match="a[@local='1']">
	<xsl:element name="{name()}">
		<xsl:apply-templates select="@*" />
		<xsl:attribute name="href"><xsl:value-of select="concat($siteroot, ./@href)"/></xsl:attribute>
		<xsl:apply-templates select="* | text()" />
	</xsl:element>
</xsl:template>

<!-- CHANGE FCK LINKS URL WITH AN EMAIL TO # AND ADD CLASS CMTA (used by javascript) -->

<xsl:template match="a[@cml='1']">
	<xsl:element name="{name()}">
		<xsl:apply-templates select="@*" />
		<xsl:attribute name="href">#</xsl:attribute>
		<xsl:choose>
			<xsl:when test="string-length(@class) &gt; 0">
				<xsl:attribute name="class"><xsl:value-of select="concat(@class,' cmta')" /></xsl:attribute>
			</xsl:when>
			<xsl:otherwise>
				<xsl:attribute name="class">cmta</xsl:attribute>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:element>
</xsl:template>

<!-- CHANGE FCK VIDPRO ELEMENTS TO A SPAN (used by javascript) -->

<xsl:template match="vidpro[@ckvid='1']">
	<xsl:apply-templates select="php:function('xslVidpro', current(), false)/node()"/>
	<!-- <span class="vpdivd" vid="{@vid}" vpr="{@vpr}" vw="{@width}" vh="{@height}" /> -->
</xsl:template>

<xsl:template match="vidpro"><!-- old way -->
	<span class="vpdivd" vid="{@vid}" vpr="{@vpr}" vw="{@width}" vh="{@height}" />
</xsl:template>

<!-- CUBE MENU -->

<xsl:template match="cat" mode="cubemenu">
	<li class="{@uid}">
		<xsl:if test="@catselected = '1'">
			<xsl:attribute name="class"><xsl:value-of select="concat(@uid, ' current')" /></xsl:attribute>
		</xsl:if>
		<a class="{@uid}" href="{@mainwu}">
			<xsl:if test="@catselected = '1'">
				<xsl:attribute name="class"><xsl:value-of select="concat(@uid, ' current')" /></xsl:attribute>
			</xsl:if>
			<span class="name">
				<xsl:value-of select="@name" />
			</span>
		</a>
		<xsl:if test="./cat[not(@display = 'hidden')] and current()/@subcatmenu='1'">
			<ul class="{@uid}">
				<xsl:if test="@catselected = '1'">
					<xsl:attribute name="class"><xsl:value-of select="concat(@uid, ' current')" /></xsl:attribute>
				</xsl:if>
				<xsl:apply-templates select="./cat[not(@display = 'hidden')]" mode="cubemenu" />
			</ul>
		</xsl:if>
	</li>
</xsl:template>

<!-- CUSTOM WRAP ELEMENTS SEE Lib-xsl.php -->

<xsl:template match="*" mode="imgwrap">
	<xsl:param name="class" />
	<xsl:param name="datajs" />
	<xsl:variable name="name" select="name(.)"/>
	<xsl:variable name="catel" select="./../../.."/>
	<xsl:variable name="model" select="$catel/@model"/>
	<xsl:variable name="modelcat" select="//model[@id = $model]"/>
	<xsl:variable name="inputel" select="//model[@id = $model]//input[@code = $name]"/>
	<xsl:variable name="content" select="$inputel/@content"/>
	<xsl:variable name="contentlinknb" select="$inputel/@contentlinknb"/>
	<div class="{concat($inputel/@class, ' ', $class, ' ', $inputel/@type, '__wrap ', $inputel/@type, '__wrap__', $name)}">
		<xsl:if test="string-length($datajs) &gt; 0">
			<xsl:attribute name="data-js"><xsl:value-of select="$datajs"/></xsl:attribute>
		</xsl:if>
		<xsl:if test="$content = 'withmorelink'">
			<xsl:attribute name="data-withmorelink">1</xsl:attribute>
			<a href="{concat($pc, ./i[1])}" target="_blank">
				<xsl:if test="string-length($contentlinknb) &gt; 0">
					<xsl:attribute name="href"><xsl:value-of select="concat($pc, ./i[2])"/></xsl:attribute>
				</xsl:if>
				<div class="item-more item-more--withmorelink"></div>
			</a>
		</xsl:if>
		<div class="inner">
		<xsl:choose>
			<xsl:when test="$inputel/@type = 'images'">
				<img class="{$inputel/@type} {$inputel/@classimg} {$inputel/@type}__{$name}" src="{concat($pc, ./i[1])}"/>
			</xsl:when>
			<xsl:when test="$inputel/@type = 'bloc'">
				<xsl:apply-templates select="./node()"/>
			</xsl:when>
			<xsl:when test="$inputel/@type = 'line'">
				<xsl:value-of select="."/>
			</xsl:when>
			<xsl:otherwise></xsl:otherwise>
		</xsl:choose>
		</div>
	</div>
</xsl:template>

<xsl:template match="*" mode="imgwrappo">
	<!-- param atts contains all attributes converted as string... -->
	<xsl:param name="atts" />
	<!-- ...convert attributes back to a dummy elements with all attributes assigned to him -->
	<xsl:variable name="eatts" select="php:function('xslFormatObjAtts',$atts)"/>
	<!-- <xsl:variable name="name" select="name(.)"/> -->
	<xsl:variable name="name">
		<xsl:choose>
			<xsl:when test="name(.) = 'i'">
				<xsl:value-of select="name(./..)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="name(.)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

	<xsl:variable name="catel" select="./ancestor::cat[1]"/>
	<xsl:variable name="model" select="$catel/@model"/>
	<xsl:variable name="modelname" select="substring-before($model, 'model')"/>
	<xsl:variable name="modelcat" select="//model[@id = $model]"/>
	<xsl:variable name="inputel" select="//model[@id = $model]//*[@code = $name]"/>
	<xsl:variable name="content" select="$inputel/@content"/>
	<xsl:variable name="contentlinknb" select="$inputel/@contentlinknb"/>
	<xsl:variable name="imgq">
		<xsl:choose>
			<xsl:when test="$inputel/@type != 'images'">
				<xsl:value-of select="''"/>
			</xsl:when>
			<xsl:when test="name(.) = 'i'">
				<xsl:copy-of select="."/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:copy-of select="./i[1]"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="imgel" select="$imgq"/>
	<xsl:value-of select="$imgel"/>
</xsl:template>


<xsl:template match="*" mode="imgwrappretinia">
	<!-- param atts contains all attributes converted as string... -->
	<xsl:param name="atts" />
	<xsl:param name="dataatts" />
	<!-- ...convert attributes back to a dummy elements with all attributes assigned to him -->
	<xsl:variable name="eatts" select="php:function('xslFormatObjAtts',$atts)"/>
	<xsl:variable name="edataatts" select="php:function('xslFormatObjAtts',$dataatts)"/>
	<!-- <xsl:variable name="name" select="name(.)"/> -->
	<xsl:variable name="name">
		<xsl:choose>
			<xsl:when test="name(.) = 'i'">
				<xsl:value-of select="name(./..)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="name(.)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:value-of select="concat($pc, $imgel)"/>
</xsl:template>

<xsl:template match="*" mode="imgwrapp">
	<!-- param atts contains all attributes converted as string... -->
	<xsl:param name="atts" />
	<xsl:param name="dataatts" />
	<xsl:param name="finalatts" />
	<!-- ...convert attributes back to a dummy elements with all attributes assigned to him -->
	<xsl:variable name="eatts" select="php:function('xslFormatObjAtts',$atts)"/>
	<xsl:variable name="edataatts" select="php:function('xslFormatObjAtts',$dataatts)"/>
	<xsl:variable name="efinalatts" select="php:function('xslFormatObjAtts',$finalatts)"/>
	<!-- <xsl:variable name="name" select="name(.)"/> -->
	<xsl:variable name="name">
		<xsl:choose>
			<xsl:when test="name(.) = 'i'">
				<xsl:value-of select="name(./..)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="name(.)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<!-- <xsl:variable name="catel" select="./../../.."/> -->
	<xsl:variable name="catel" select="./ancestor::cat[1]"/>
	<xsl:variable name="model" select="$catel/@model"/>
	<xsl:variable name="modelname" select="substring-before($model, 'model')"/>
	<xsl:variable name="modelcat" select="//model[@id = $model]"/>
	<xsl:variable name="inputel" select="//model[@id = $model]//*[@code = $name]"/>
	<xsl:variable name="content" select="$inputel/@content"/>
	<xsl:variable name="contentlinknb" select="$inputel/@contentlinknb"/>


	<xsl:if test="($inputel/@type = 'images' and count(./i) &gt; 0) or ($inputel/@type != 'images' and string-length(.) &gt; 0)">
		

	<xsl:variable name="imgel">
		<xsl:choose>
			<xsl:when test="$inputel/@type != 'images'">
				<xsl:value-of select="''"/>
			</xsl:when>
			<xsl:when test="name(.) = 'i'">
				<xsl:copy-of select="."/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:copy-of select="./i[1]"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="imgsrc">
		<xsl:choose>
			<xsl:when test="$inputel/@type != 'images'">
				<xsl:value-of select="''"/>
			</xsl:when>
			<xsl:when test="$isphone = '1' and string-length($eatts/@cip)">
				<xsl:value-of select="concat($ci, $eatts/@cip, '/', $imgel)"/>
			</xsl:when>
			<xsl:when test="$istablet = '1' and string-length($eatts/@cit)">
				<xsl:value-of select="concat($ci, $eatts/@cit, '/', $imgel)"/>
			</xsl:when>
			<xsl:when test="$ismobile = '1' and string-length($eatts/@cim)">
				<xsl:value-of select="concat($ci, $eatts/@cim, '/', $imgel)"/>
			</xsl:when>
			<xsl:when test="string-length($eatts/@ci)">
				<xsl:value-of select="concat($ci, $eatts/@ci, '/', $imgel)"/>
			</xsl:when>
			<xsl:when test="$isphone = '1' and string-length($inputel/@cip)">
				<xsl:value-of select="concat($ci, $inputel/@cip, '/', $imgel)"/>
			</xsl:when>
			<xsl:when test="$istablet = '1' and string-length($inputel/@cit)">
				<xsl:value-of select="concat($ci, $inputel/@cit, '/', $imgel)"/>
			</xsl:when>
			<xsl:when test="$ismobile = '1' and string-length($inputel/@cim)">
				<xsl:value-of select="concat($ci, $inputel/@cim, '/', $imgel)"/>
			</xsl:when>
			<xsl:when test="string-length($inputel/@ci)">
				<xsl:value-of select="concat($ci, $inputel/@ci, '/', $imgel)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($pc, $imgel)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="mainelname">
		<xsl:choose>
			<xsl:when test="string-length($eatts/@n) &gt; 0"><xsl:value-of select="$eatts/@n"/></xsl:when>
			<xsl:otherwise>div</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:element name="{$mainelname}">
		<xsl:attribute name="class">
			<xsl:value-of select="concat('el__', $inputel/@type, ' ', $inputel/@class, ' ', $eatts/@class, ' ', $modelname, '__', $name)"/>
		</xsl:attribute>
		<xsl:if test="$inputel/@type = 'images' and $eatts/@bg = '1'">
			<xsl:attribute name="style">background-image:url(<xsl:value-of select="$imgsrc"/>);</xsl:attribute>
			<xsl:if test="$eatts/@base64 = '1'">
				<xsl:attribute name="style">background-image:url(<xsl:apply-templates select="php:function('xslBase64EncodeImg', $imgsrc)/node()"/>);</xsl:attribute>
			</xsl:if>
			<xsl:attribute name="data-asset">page</xsl:attribute>
		</xsl:if>
		<xsl:if test="$eatts/@itemprop and not($eatts/@inner = '1') and $inputel/@type != 'images'">
			<xsl:attribute name="itemprop"><xsl:value-of select="$eatts/@itemprop"/></xsl:attribute>
		</xsl:if>
		<xsl:if test="$inputel/@type != 'images'">
			<xsl:apply-templates select="$efinalatts/@*" />
		</xsl:if>
		<!-- <xsl:if test="not($eatts/@inner = '1')"> -->
			<xsl:apply-templates select="$edataatts/@*" />
		<!-- </xsl:if> -->
		<xsl:if test="$content = 'withmorelink'">
			<xsl:attribute name="data-withmorelink">1</xsl:attribute>
			<a href="{concat($pc, ./i[1])}" target="_blank">
				<xsl:if test="string-length($contentlinknb) &gt; 0">
					<xsl:attribute name="href"><xsl:value-of select="concat($pc, ./i[2])"/></xsl:attribute>
				</xsl:if>
				<div class="item-more item-more--withmorelink"></div>
			</a>
		</xsl:if>
		<!-- if no inner element needed... -->
		<!-- ...set inner element name to "dummyel" so it can be easily removed on the final php step -->
		<xsl:variable name="elname">
			<xsl:choose>
				<xsl:when test="$inputel/@format = 'url'">a</xsl:when>
				<xsl:when test="string-length($inputel/@href) &gt; 0">a</xsl:when>
				<xsl:when test="$eatts/@inner = '1'">div</xsl:when>
				<xsl:otherwise>dummyel</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:element name="{$elname}">
			<xsl:attribute name="class">
				<xsl:choose>
					<xsl:when test="$inputel/@format = 'url'"><xsl:value-of select="concat($modelname, '__', $name, '__a')"/></xsl:when>
					<xsl:otherwise>inner</xsl:otherwise>
				</xsl:choose>
				<xsl:if test="string-length($eatts/@innerclass) &gt; 0">
					 <xsl:value-of select="concat(' ', $eatts/@innerclass)"/>
				</xsl:if>
			</xsl:attribute>
			<xsl:if test="$inputel/@format = 'url'">
				<xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
			</xsl:if>
			<xsl:if test="$eatts/@itemprop and $eatts/@inner = '1'">
				<xsl:attribute name="itemprop"><xsl:value-of select="$eatts/@itemprop"/></xsl:attribute>
			</xsl:if>
			<xsl:if test="string-length($inputel/@href) &gt; 0">
				<xsl:choose>
					<xsl:when test="$inputel/@href = 'mailto'">
						<xsl:attribute name="href">mailto:<xsl:value-of select="."/></xsl:attribute>
					</xsl:when>
					<xsl:otherwise>
						<!-- is a xpath query -->
						<!-- <xsl:variable name="hrefinputq" select="concat('$inputel', $inputel/@href)"/> -->
						<xsl:variable name="hrefinput" select="$inputel/../*[@code = $inputel/@href]"/>
						<xsl:choose>
							<xsl:when test="$hrefinput/@type = 'select'">
								<xsl:variable name="hrefeluid" select="./../*[name()=$inputel/@href]/@v"/>
								<xsl:variable name="hrefel" select="$cr//*[@uid = $hrefeluid]"/>
								<xsl:attribute name="href"><xsl:value-of select="concat($siteroot, $hrefel/@mainwu)"/></xsl:attribute>
							</xsl:when>
							<xsl:otherwise>
								<xsl:variable name="hrefel" select="./../*[name()=$inputel/@href]"/>
								<xsl:attribute name="href"><xsl:value-of select="$hrefel"/></xsl:attribute>
								<xsl:attribute name="target">_blank</xsl:attribute>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
			<xsl:choose>
				<xsl:when test="$inputel/@type = 'images' and not($eatts/@bg = '1')">
					<xsl:variable name="altquery" select="concat($name, 'alt')"/>
					<xsl:choose>
						<xsl:when test="$eatts/@retinia = '1'">
							<xsl:variable name="fw" select="floor(./i[1]/@w div 2)"/>
							<xsl:variable name="fh" select="floor(./i[1]/@h div 2)"/>
							<img class="{$inputel/@type} {$inputel/@classimg} {$inputel/@type}__{$name}" src="{concat($pc, $imgel)}" data-asset="page" width="{$fw}" height="{$fh}" srcset="{concat($ci, 'rm_', $fw, '_', $fh, '/', $imgel, ' 1x, ', $pc, $imgel, ' 2x')}">
								<xsl:if test="$inputel/@type = 'images'">
									<xsl:apply-templates select="$efinalatts/@*" />
								</xsl:if>
							</img>
						</xsl:when>
						<xsl:otherwise>
							<img class="{$inputel/@type} {$inputel/@classimg} {$inputel/@type}__{$name}" src="{$imgsrc}" data-asset="page" alt="{./../*[name()=$altquery]}">
								<!-- <xsl:attribute name="src"><xsl:value-of select="$eatts/@retinia"/></xsl:attribute> -->
								<xsl:if test="$eatts/@base64 = '1'">
									<xsl:attribute name="src"><xsl:apply-templates select="php:function('xslBase64EncodeImg', $imgsrc)/node()"/></xsl:attribute>
								</xsl:if>
							</img>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:when test="$inputel/@format = 'url' and string-length($inputel/@ctalabel) &gt; 0">
					<xsl:variable name="linkelname">
						<xsl:choose>
							<xsl:when test="$eatts/@inner = '1'">span</xsl:when>
							<xsl:otherwise>dummyel</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
					<xsl:element name="{$linkelname}">
						<xsl:value-of select="./../*[name()=$inputel/@ctalabel]"/>
					</xsl:element>
				</xsl:when>
				<xsl:when test="$inputel/@type = 'bloc'">
					<xsl:apply-templates select="./node()"/>
				</xsl:when>
				<xsl:when test="$inputel/@type = 'fck'">
					<xsl:apply-templates select="./node()"/>
				</xsl:when>
				<xsl:when test="$inputel/@type = 'line'">
					<xsl:choose>
						<xsl:when test="string-length($inputel/@href) &gt; 0">
							<span><xsl:value-of select="."/></span>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="."/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise></xsl:otherwise>
			</xsl:choose>
		</xsl:element>
	</xsl:element>


	</xsl:if>


</xsl:template>

<!-- CUBE GMAP -->

<xsl:template name="cubegmapold">
	<xsl:param name="node" />
	<xsl:param name="width" />
	<xsl:param name="height" />
	<xsl:param name="noprocessonload" />
	<div class="cubegmapdiv inv" w="{$width}" h="{$height}" maplat="{$node/@lat}" maplng="{$node/@lng}" mapzoom="{$node/@zoom}">
		<xsl:if test="$noprocessonload = '1'">
			<xsl:attribute name="data-noprocessonload">1</xsl:attribute>
		</xsl:if>
		<xsl:apply-templates select="$node/m" mode="cubemapmarker" />
	</div>
</xsl:template>

<xsl:template match="m" mode="cubemapmarker">
	<div class="cubemapmarker" maplat="{./@lat}" maplng="{./@lng}" hover="{./@hover}" title="{./@title}"><xsl:apply-templates select="./node()"/></div>
</xsl:template>


<!-- MAIN ENTRY POINT : default : webpage -->

<xsl:template match="/">
    <xsl:apply-templates select="./site/cube[@webpage='1']" mode="webpage" />
    <xsl:apply-templates select="./site/cube[@rsspage='1']" mode="rsspage" />
    <xsl:apply-templates select="./site/cube[@mobilepage='1']" mode="mobilepage" />
    <xsl:apply-templates select="./site/cube[@ajaxpage='1']" mode="ajaxpage" />
</xsl:template>

<!-- AJAX PAGE -->

<xsl:template match="cube" mode="ajaxpage">
    <xsl:apply-templates select="/site/content" mode="ajaxpagecontent"/>
</xsl:template>

<!-- WEBPAGE -->
<xsl:template match="cube" mode="webpage">
	<xsl:if test="$cube_version &gt; 0">
		<xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text>
	</xsl:if>
	<!-- <xsl:comment>htmlwraptoppart</xsl:comment> -->
    <!-- <html lang="{$langcode}" itemscope="itemscope" itemtype="http://schema.org/" id="html{$ccf/@uid}" class="fakescroll"> -->
    <html lang="{$langcode}" id="html{$ccf/@uid}" itemscope="itemscope" itemtype="http://schema.org/">
		<xsl:apply-templates select="/site/head" mode="webpagehead" />
		<body class="jsoff body{$ccf/@id} lang{$langcode} body__{$ccf/@model}">
			<xsl:comment>htmlwraptoppart</xsl:comment>
			<xsl:if test="$cube_version &gt; 0">
				<xsl:apply-templates select="/site/content" mode="webpageprecontent" />
			</xsl:if>
			<xsl:apply-templates select="/site/content" mode="webpagecontent" />
			<xsl:comment>htmlwrapbottompart</xsl:comment>
			<xsl:apply-templates select="/site/head/javascript[not(@head='1')]" mode="genjs"/>
			<xsl:apply-templates select="$cr/cat[@id='general']/cat[@id='googleanalytics']/text/item[gaon='1']" mode="genga" />
        </body>
    </html>
    <!-- <xsl:comment>htmlwrapbottompart</xsl:comment> -->
</xsl:template>


<xsl:template match="content" mode="webpageprecontent">
	<div id="iewarning">
		<div class="ie-warning__content">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</div>
	</div>
	<script type="text/javascript">
		document.body.className=document.body.className.replace('jsoff', 'json');
		<xsl:if test="/site/head/@has_cymasmooth = '1'">
			document.body.parentNode.className+=' has-cymamooth';
		</xsl:if>
		document.body.parentNode.className+=' main-menu-openo';
	</script>
</xsl:template>


<!-- WEBPAGE HEADER PART -->

<xsl:template match="head" mode="webpagehead">
	<head>
		<!-- DEFINE CHARSET (should be useless if set in http header response) -->
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<!-- <meta name="viewportold" content="width=device-width;initial-scale=1.0;" /> -->
		<!-- MOBILE DEVICE ADJUSTMENT -->
		<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no,width=device-width" />
		<!-- USEFULL TO REDUCE URLS -->
		<base href="{$siteroot}" />
		<!-- FAVICON -->
		<!-- <link rel="shortcut icon" href="{concat($si, ./@icon)}" /> -->
		<xsl:apply-templates select="/site/head" mode="genfavicon"/>
		<xsl:apply-templates select="/site/head/seo" mode="genseo"/>
		<xsl:apply-templates select="$cr//cat[@rss='1']" mode="genrss"/>
		<xsl:choose>
			<xsl:when test="$usecriticalcss = '1'">
				<xsl:apply-templates select="/site/head/css" mode="gencsswithcritical"/>
				<script type="text/javascript">
					<![CDATA[(function(c){var a={};a.support=function(){try{var b=c.document.createElement("link").relList.supports("preload")}catch(e){b=!1}return function(){return b}}();a.bindMediaToggle=function(b){function a(){b.media=c}var c=b.media||"all";b.addEventListener?b.addEventListener("load",a):b.attachEvent&&b.attachEvent("onload",a);setTimeout(function(){b.rel="stylesheet";b.media="only x"});setTimeout(a,3E3)};a.poly=function(){if(!a.support())for(var b=c.document.getElementsByTagName("link"),e=0;e<b.length;e++){var d=
b[e];"preload"!==d.rel||"style"!==d.getAttribute("as")||d.getAttribute("data-loadcss")||(d.setAttribute("data-loadcss",!0),a.bindMediaToggle(d))}};if(!a.support()){a.poly();var f=c.setInterval(a.poly,500);c.addEventListener?c.addEventListener("load",function(){a.poly();c.clearInterval(f)}):c.attachEvent&&c.attachEvent("onload",function(){a.poly();c.clearInterval(f)})}})("undefined"!==typeof global?global:this);]]>
				</script>
				<noscript>
					<xsl:apply-templates select="/site/head/css" mode="gencss"/>
				</noscript>
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select="/site/head/css" mode="gencss"/>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:call-template name="gen_CssVar" />
		<xsl:apply-templates select="/site/head/javascript[@head='1']" mode="genjs"/>
		<script type="text/javascript">
			var SITE_ROOT='<xsl:value-of select="$siteroot" />',SITE_ROOT_LG='<xsl:value-of select="$siterootlg" />',CA='<xsl:value-of select="$ca" />',SITE_LANG='<xsl:value-of select="$lang" />',HAS_CYMASMOOTH=<xsl:value-of select="/site/head/@has_cymasmooth" />;
			<xsl:apply-templates select="/site/head/javascriptvar" mode="genjsvar"/>
		</script>
		<xsl:if test="string-length($cr/cat[@id='general']/cat[@id='googleanalytics']/text/item/gaverif) &gt; 0">
			<meta name="google-site-verification" content="{$cr/cat[@id='general']/cat[@id='googleanalytics']/text/item/gaverif}" />
		</xsl:if>
	</head>
</xsl:template>

<!-- 
<xsl:template name="gen_Header">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<xsl:if test="//site/head/@applefix = '1'">
		<meta content='width=device-width; initial-scale=1.0;' name='viewport' />
	</xsl:if>	
	<base href="{$siteroot}" />
	<link rel="shortcut icon" href="{concat($si, //site/head/@icon)}" />
	<xsl:call-template name="gen_Seo" />
	<xsl:call-template name="gen_Rss" />
	<xsl:call-template name="gen_Css" />
	<xsl:call-template name="gen_CssVar" />
	<script type="text/javascript">var SITE_ROOT = '<xsl:value-of select="$siteroot" />';var CA = '<xsl:value-of select="$ca" />';var SITE_LANG = '<xsl:value-of select="$lang" />';<xsl:call-template name="gen_JsVar" /></script>
</xsl:template>
 -->

<xsl:template match="head" mode="genfavicon">
	<link rel="apple-touch-icon" sizes="180x180" href="{$si}favicon/apple-touch-icon.png"/>
	<link rel="icon" type="image/png" href="{$si}favicon/favicon-32x32.png" sizes="32x32"/>
	<link rel="icon" type="image/png" href="{$si}favicon/favicon-16x16.png" sizes="16x16"/>
	<link rel="manifest" href="{$si}favicon/manifest.json"/>
	<link rel="mask-icon" href="{$si}favicon/safari-pinned-tab.svg" color="#5bbad5"/>
	<xsl:if test="$cube_version &lt; 1">
		<link rel="shortcut icon" href="{$si}favicon/favicon.ico"/>
		<meta name="msapplication-config" content="{$si}favicon/browserconfig.xml"/>
	</xsl:if>
	<meta name="theme-color" content="#ffffff"/>
</xsl:template>

<xsl:template match="head" mode="genfaviconvv">
	<xsl:apply-templates select="." mode="genfavicon"/>
</xsl:template>


<xsl:template match="head" mode="genfaviconold">
	<link rel="apple-touch-icon" sizes="57x57" href="{$sa}imgs/favicon/apple-touch-icon-57x57.png"/>
	<link rel="apple-touch-icon" sizes="60x60" href="{$sa}imgs/favicon/apple-touch-icon-60x60.png"/>
	<link rel="apple-touch-icon" sizes="72x72" href="{$sa}imgs/favicon/apple-touch-icon-72x72.png"/>
	<link rel="apple-touch-icon" sizes="76x76" href="{$sa}imgs/favicon/apple-touch-icon-76x76.png"/>
	<link rel="apple-touch-icon" sizes="114x114" href="{$sa}imgs/favicon/apple-touch-icon-114x114.png"/>
	<link rel="apple-touch-icon" sizes="120x120" href="{$sa}imgs/favicon/apple-touch-icon-120x120.png"/>
	<link rel="apple-touch-icon" sizes="144x144" href="{$sa}imgs/favicon/apple-touch-icon-144x144.png"/>
	<link rel="apple-touch-icon" sizes="152x152" href="{$sa}imgs/favicon/apple-touch-icon-152x152.png"/>
	<link rel="apple-touch-icon" sizes="180x180" href="{$sa}imgs/favicon/apple-touch-icon-180x180.png"/>
	<link rel="icon" type="image/png" href="{$sa}imgs/favicon/favicon-32x32.png" sizes="32x32"/>
	<link rel="icon" type="image/png" href="{$sa}imgs/favicon/android-chrome-192x192.png" sizes="192x192"/>
	<link rel="icon" type="image/png" href="{$sa}imgs/favicon/favicon-96x96.png" sizes="96x96"/>
	<link rel="icon" type="image/png" href="{$sa}imgs/favicon/favicon-16x16.png" sizes="16x16"/>
	<!-- <link rel="manifest" href="{$sa}imgs/favicon/manifest.json"/> -->
	<link rel="shortcut icon" href="{$sa}imgs/favicon/favicon.ico"/>
	<meta name="msapplication-TileColor" content="#00aba9"/>
	<meta name="msapplication-TileImage" content="{$sa}imgs/favicon/mstile-144x144.png"/>
	<meta name="msapplication-config" content="{$sa}imgs/favicon/browserconfig.xml"/>
	<meta name="theme-color" content="#ffffff"/>
</xsl:template>

<xsl:template match="seo" mode="genseo">
	<xsl:variable name="seo" select="." />
	<!-- BASIC SEO CODE -->
	<title><xsl:value-of select="$seo/title"/></title>
	<meta name="keywords" content="{$seo/kw}" />
	<meta name="description" content="{$seo/desc}" />
	<link rel="canonical" href="{$seo/url}" />
	<!-- BASIC SEO CODE END -->
	<!-- LANGS ALTERNATE LINKS CODE -->
	<!-- https://support.google.com/webmasters/answer/189077?hl=fr -->
	<xsl:if test="not(/site/head/@one_lang_in_front = '1')">
		<xsl:apply-templates select="/site/head/langsseo" mode="seo-langs-alternate"/>
	</xsl:if>
	<!-- LANGS ALTERNATE LINKS END -->
	<!-- OG SEO CODE -->
	<xsl:apply-templates select="." mode="genseo-og"/>
	<!-- TWITTER SEO CODE -->
	<xsl:apply-templates select="." mode="genseo-tw"/>
	<!-- SHEMA SEO CODE -->
	<xsl:apply-templates select="." mode="genseo-shema"/>
</xsl:template>

<!-- OG SEO CODE -->
<xsl:template match="seo" mode="genseo-og">
	<meta property="og:url" content="{./url}" />
	<meta property="og:site_name" content="{./sitename}" />
	<meta property="og:title" content="{./title}" />
	<meta property="og:type" content="website" />
	<xsl:if test="./thumb/node()">
		<meta property="og:image" content="{./thumb}" />
	</xsl:if>
	<meta property="og:description" content="{./desc}" />
</xsl:template>

<!-- TWITTER SEO CODE -->
<xsl:template match="seo" mode="genseo-tw">
	<meta name="twitter:card" content="summary" />
	<meta name="twitter:title" content="{./title}" />
	<meta name="twitter:description" content="{./desc}" />
	<xsl:if test="./thumb/node()">
		<meta name='twitter:image' content="{./thumb}" />
	</xsl:if>
	<meta name="twitter:url" content="{./url}" />
</xsl:template>

<!-- SHEMA SEO CODE -->
<xsl:template match="seo" mode="genseo-shema">
	<meta name="name" content="{./title}" itemprop="name" />
	<meta name="description" content="{./desc}" itemprop="description" />
	<xsl:if test="./thumb/node()">
		<meta name="thumbnail" content="{./thumb}" itemprop="thumbnailUrl" />
	</xsl:if>
</xsl:template>

<xsl:template match="langsseo" mode="seo-langs-alternate">
	<link rel="alternate" hreflang="x-default" href="{$siteroot}" />
	<xsl:apply-templates select="./langseourl" mode="seo-langs-alternate-item"/>
</xsl:template>

<xsl:template match="langseourl" mode="seo-langs-alternate-item">
	<link rel="alternate" hreflang="{./@langid}" href="{concat($siteroot, '/', ./@url)}" />
</xsl:template>


<xsl:template match="cat" mode="genrss">
	<link rel="alternate" type="application/rss+xml" title="RSS - {./@name}" href="{concat($siterootlg,'rss/',./@wu)}" />
</xsl:template>


<xsl:template match="css" mode="gencss">
	<xsl:choose>
		<xsl:when test="contains(.,'//')">
			<link rel="stylesheet" href="{.}" />
		</xsl:when>
		<xsl:when test="@asset = '1'">
			<link rel="stylesheet" type="text/css" href="{concat($ca,.)}" media="screen" />
		</xsl:when>
		<xsl:when test="@print = '1'">
			<link rel="stylesheet" type="text/css" href="{concat($sa,.)}" media="print" />
		</xsl:when>
		<xsl:otherwise>
			<link rel="stylesheet" type="text/css" href="{concat($sa,.)}" media="screen" />
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template match="css" mode="gencsswithcritical">
	<xsl:choose>
		<xsl:when test="contains(.,'//')">
			<link rel="preload" href="{.}" media="screen" as="style" onload="this.onload=null;this.rel='stylesheet'"/>
		</xsl:when>
		<xsl:when test="@asset = '1'">
			<link rel="preload" type="text/css" href="{concat($ca,.)}" media="screen"  as="style" onload="this.onload=null;this.rel='stylesheet'"/>
		</xsl:when>
		<xsl:when test="@print = '1'">
			<link rel="preload" type="text/css" href="{concat($sa,.)}" media="print"  as="style" onload="this.onload=null;this.rel='stylesheet'"/>
		</xsl:when>
		<xsl:otherwise>
			<link rel="preload" type="text/css" href="{concat($sa,.)}" media="screen"  as="style" onload="this.onload=null;this.rel='stylesheet'"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template match="javascript" mode="genjs">
	<xsl:choose>
		<xsl:when test="contains(.,'http://') or contains(.,'https://')">
			<script src="{.}" type="text/javascript"><xsl:comment/></script>
		</xsl:when>
		<xsl:when test="@asset = '1'">
			<script src="{concat($ca,.)}" type="text/javascript"><xsl:comment/></script>
		</xsl:when>
		<xsl:when test="@cache = '1'">
			<script src="{concat($ch,.)}" type="text/javascript"><xsl:comment/></script>
		</xsl:when>
		<xsl:otherwise>
			<script src="{concat($sa,.)}" type="text/javascript" async="async"><xsl:comment/></script>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>


<xsl:template match="javascriptvar" mode="genjsvar">
	var <xsl:value-of select="@name" /> = '<xsl:value-of select="@value" />';
</xsl:template>


<xsl:template name="gen_CssVar">
	<xsl:if test="./@fill = '1'">
		<style type="text/css">
			<xsl:apply-templates select="./node()" />
		</style>
	</xsl:if>
</xsl:template>

<xsl:template match="item" mode="genga">
	<xsl:if test="string-length(./gacode) &gt; 3">
		<xsl:choose>
			<xsl:when test="./useuniv = '1'">
				<script type="text/javascript">
					(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
					(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
					m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
					})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
					ga('create', '<xsl:value-of select="./gacode" />', 'auto');
					ga('send', 'pageview');
					<xsl:if test="//site/content/gacmde">
						<xsl:apply-templates select="//site/content/gacmde/node()" />
					</xsl:if>
				</script>
			</xsl:when>
			<xsl:otherwise>
				<script type="text/javascript">
					var _gaq = _gaq || [];
					_gaq.push(['_setAccount', '<xsl:value-of select="./gacode" />']);
					if ( typeof SkSmooth == 'undefined' &amp;&amp; typeof cymasmooth == 'undefined' ) {
						_gaq.push(['_trackPageview']);
					}
					<xsl:if test="//site/content/gacmdenotuniv">
						<xsl:apply-templates select="//site/content/gacmdenotuniv/node()" />
					</xsl:if>
					(function() {
						var ga = document.createElement('script'); ga.type = 'text/javascript';
						ga.async = true;
						ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
						var s = document.getElementsByTagName('script')[0];
						s.parentNode.insertBefore(ga, s);
						//document.body.appendChild(ga);
						//console.log('i');
					})();
				</script>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:if>
</xsl:template>

<xsl:template name="gen_GAcode">
	<xsl:if test="string-length(//site/content/gacode) &gt; 3">
		<script type="text/javascript">
			var _gaq = _gaq || [];
			_gaq.push(['_setAccount', '<xsl:value-of select="//site/content/gacode" />']);
			_gaq.push(['_trackPageview']);
			<xsl:if test="//site/content/gacmde">
				<xsl:apply-templates select="//site/content/gacmde/node()" />
			</xsl:if>
			(function() {
				var ga = document.createElement('script'); ga.type = 'text/javascript';
				ga.async = true;
				ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
				var s = document.getElementsByTagName('script')[0];
				s.parentNode.insertBefore(ga, s);
				//console.log('i');
			})();
		</script>
	</xsl:if>
</xsl:template>

<!-- WEBPAGE HEADER PART -->


<!-- WEBPAGE FORM PART -->

<xsl:template match="custominputline | custominputmail">
	<div class="{concat('formline ',@error)}">
	  <div class="labelform">
		<label for="{@name}">
		  <xsl:value-of select="@label" />
		</label>
	  </div>
	  <div class="inputform"><input class="inputline" type="text" id="{@name}" name="{@name}" value="{@value}" />  <span class="err"><xsl:value-of select="@err" /></span><span class="errb"><xsl:value-of select="@errb" /></span></div>
	</div>
</xsl:template>

<xsl:template match="custominputmultiline">
	<div class="{concat('formline ',@error)}">
	  <div class="labelform">
		<label for="{@name}">
		  <xsl:value-of select="@label" />
		</label>
	  </div>
	  <div class="inputform"><textarea class="inputmultiline" id="{@name}" name="{@name}"><xsl:value-of select="@value" /></textarea><br/> <span class="err"><xsl:value-of select="@err" /></span><span class="errb"><xsl:value-of select="@errb" /></span></div>
	</div>
</xsl:template>

<!-- CUBE INPUT NODE NAME : cymainput -->
<!-- apply main template indicate in php SkForm object -->
<xsl:template match="cymainput">
	<xsl:apply-templates select="./*" mode="cubeinput"/>
</xsl:template>

<xsl:template match="formcheckerinput" mode="cubeinput">
	<input data-js-form-dyn="cfinput" name="{./@nameid}" value="{.}" type="hidden" />
</xsl:template>

<xsl:template match="honeypotinput" mode="cubeinput">
	<input data-js-form-dyn="hpinput" name="{./@nameid}" value="" class="youremail" />
</xsl:template>

<xsl:template match="lineinputeinside" mode="cubeinput">
	<div id="formline{@name}">
		<xsl:attribute name="class">
			<xsl:value-of select="'formline '"/>
			<xsl:if test="@error = '1'">formlineerror</xsl:if>
			<xsl:value-of select="concat(' fit',./@type)"/>
			<xsl:value-of select="concat(' ',./@data-wrap-class)"/>
		</xsl:attribute>
		<xsl:if test="@haslabel = '1' or @type = 'file' or @type = 'files' or @type = 'imgfile' or @type = 'unikcheckbox' or @type = 'jqfufile'">
			<div class="labelform {./@data-label-wrap-class}">
				<label for="{@name}">
					<xsl:if test="@type = 'unikcheckbox'">
						<xsl:apply-templates select="." mode="cubeinputunikcheckbox" />
						<xsl:value-of select="' '" />
					</xsl:if>
					<xsl:choose>
						<xsl:when test="string-length(@labellink) &gt; 0">
							<xsl:variable name="labellink" select="@labellink"/>
							<a href="{$cr//cat[@id=$labellink]/@mainwu}" target="_blank">
								<xsl:value-of select="@label" />
							</a>
						</xsl:when>
						<xsl:when test="string-length(@data-labellinkb) &gt; 0">
							<xsl:variable name="labellinkb" select="@data-labellinkb"/>
							<xsl:value-of select="substring-before(@label, '%LIEN%')"/> 
							<a href="{$cr//cat[@id=$labellinkb]/@mainwu}" target="_blank">
								<xsl:value-of select="$cr//cat[@id=$labellinkb]/@name" />
							</a>
							<xsl:value-of select="substring-after(@label, '%LIEN%')"/> 
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="@label" />
						</xsl:otherwise>
					</xsl:choose>
					<xsl:if test="@req = '1'">
						<xsl:value-of select="' *'" />
					</xsl:if>
					<!--
					<xsl:if test="@type != 'unikcheckbox'">
						<xsl:value-of select="' :'" />
					</xsl:if>
					-->
				</label>
			</div>
			<xsl:comment>ib</xsl:comment>
		</xsl:if>
		<div class="inputform  {./@data-input-wrap-class}">
			<xsl:if test="@type = 'line'">
				<xsl:apply-templates select="." mode="cubeinputline" />
			</xsl:if>
			<xsl:if test="@type = 'text'">
				<xsl:apply-templates select="." mode="cubeinputtext" />
			</xsl:if>
			<xsl:if test="@type = 'select'">
				<xsl:apply-templates select="." mode="cubeinputselect" />
			</xsl:if>
			<xsl:if test="@type = 'multicheckbox'">
				<xsl:apply-templates select="." mode="cubeinputmulticheckbox" />
			</xsl:if>
			<xsl:if test="@type = 'checkbox'">
				<xsl:apply-templates select="." mode="cubeinputcheckbox" />
			</xsl:if>
			<xsl:if test="@type = 'radio'">
				<xsl:apply-templates select="." mode="cubeinputradio" />
			</xsl:if>	
			<xsl:if test="@type = 'jqfufile'">
				<xsl:apply-templates select="." mode="cubeinputjqfufile" />
			</xsl:if>	
			<xsl:if test="@type = 'file'">
				<xsl:apply-templates select="." mode="cubeinputfile" />
			</xsl:if>
			<xsl:if test="@type = 'files'">
				<xsl:apply-templates select="." mode="cubeinputfiles" />
			</xsl:if>
			<xsl:if test="@type = 'imgfile'">
				<xsl:apply-templates select="." mode="cubeinputimgfile" />
			</xsl:if>
			<xsl:if test="@type = 'date'">
				<xsl:apply-templates select="." mode="cubeinputdate" />
			</xsl:if>
			<xsl:if test="@type = 'datenaissance'">
				<xsl:apply-templates select="." mode="cubeninputdateaissance" />
			</xsl:if>
			<xsl:if test="string-length(@err) &gt; 0">
				<span class="err"><xsl:value-of select="@err"/></span>
			</xsl:if>
			<xsl:if test="string-length(@errb) &gt; 0">
				<span class="err"><xsl:value-of select="@errb"/></span>
			</xsl:if>
		</div>
		<xsl:if test="string-length(@labelb) &gt; 0">
			<div class="labelbform"><xsl:value-of select="@labelb" /></div>
		</xsl:if>
		<xsl:if test="./labelc">
			<div class="labelcform"><xsl:apply-templates select="./labelc/node()"/></div>
		</xsl:if>
	</div>
</xsl:template>


<xsl:template match="*" mode="lineinputatts">
	<xsl:attribute name="class">
		<xsl:value-of select="concat('input',@type)" /> 
		<xsl:value-of select="' '" />
		<xsl:if test="string-length(@obl) &gt; 0">
			<xsl:if test="contains(@obl, ',')">
				 validate[<xsl:value-of select="@obl" />] 
			</xsl:if>
			<xsl:if test="@obl = '1'">
				 validate['required'] 
			</xsl:if>
			<xsl:if test="@obl = 'pwd'">
				 validate['required','length[4,-1]','alphanum'] 
			</xsl:if>
			<xsl:if test="@obl = 'mail'">
				 validate['required','email'] 
			</xsl:if>
			<xsl:if test="@obl = 'number'">
				 validate['required','number'] 
			</xsl:if>
		</xsl:if>
		<xsl:if test="string-length(@confirm) &gt; 0">
			 validate['confirm[<xsl:value-of select="@confirm" />]'] 
		</xsl:if>
		<xsl:value-of select="' '" />
		<xsl:if test="@error = '1'"> formlineinputerror </xsl:if>
		<xsl:if test="name() = 'lineinputeinside'"> labelinside </xsl:if>
		<xsl:if test="@type = 'date'"> datepicker </xsl:if>
		<xsl:value-of select="' '" />
		<xsl:value-of select="@data-class" />
	</xsl:attribute>
	<xsl:if test="@obl = 'pwd' or @crypted = '1'">
		<xsl:attribute name="type">password</xsl:attribute>
	</xsl:if>
	<!-- <xsl:attribute name="multiple">multiple</xsl:attribute> -->
	<xsl:if test="@haslabelinside = '1' or @labin='1'">
		<xsl:choose>
			<xsl:when test="@type = 'select'">
				<xsl:if test="./../@defaultvalue != 'first'">
					<xsl:attribute name="data-placeholder"><xsl:value-of select="@label" /></xsl:attribute>
				</xsl:if>
			</xsl:when>
			<xsl:when test="@type = 'file' or @type = 'files' or @type = 'imgfile' or @type = 'jqfufile'">
				
			</xsl:when>
			<xsl:otherwise>
				<xsl:attribute name="data-form-default"><xsl:value-of select="@label" /></xsl:attribute>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:if>
	<xsl:if test="string-length(@ph) &gt; 0">
		<xsl:attribute name="placeholder"><xsl:value-of select="./@ph"/></xsl:attribute>
	</xsl:if>
	<xsl:for-each select="./@*">
		<xsl:if test="substring(name(), 1, 5) = 'data-'">
			<xsl:copy-of select="current()"/>
		</xsl:if>
	</xsl:for-each>
	<xsl:if test="string-length(@data-rows) &gt; 0">
		<xsl:attribute name="rows"><xsl:value-of select="@data-rows"/></xsl:attribute>
	</xsl:if>
</xsl:template>

<xsl:template match="*" mode="cubeinputline">
	<input type="text" data-js-form-dyn="{@name}" id="{@name}" name="{@nameid}" value="{@value}">
		<xsl:apply-templates select="." mode="lineinputatts" />
	</input>
</xsl:template>

<xsl:template match="*" mode="cubeinputtext">
	<textarea id="{@name}" name="{@nameid}">
		<xsl:apply-templates select="." mode="lineinputatts" />
		<xsl:value-of select="value" />
	</textarea>
</xsl:template>

<xsl:template match="*" mode="cubeninputdateaissance">
	<div class="input-datenaissance">
	<div class="input-datenaissance__inner">
		<select class="inputlineselect" id="{@name}day" name="{@nameid}day">
			<xsl:apply-templates select="." mode="lineinputatts" />
			<xsl:if test="./@defaultvalue != 'first'">
				<xsl:element name="option">
					<xsl:attribute name="value">-1</xsl:attribute>
					<xsl:if test="@selected"><xsl:attribute name="selected" /></xsl:if>
					<xsl:value-of select="./selectday/@defval" />
				</xsl:element>
			</xsl:if>
			<xsl:if test="./@defaultvalue = 'first'">
				<xsl:attribute name="data-defaultvalue">first</xsl:attribute>
			</xsl:if>
			<!-- <xsl:apply-templates select="./option" mode="cubeinputselectoption" /> -->
			<xsl:apply-templates select="./selectday/optioncat" mode="cubeinputselectoption" />
		</select>
	</div>
	</div>
	<xsl:comment>ib</xsl:comment>
	<div class="input-datenaissance">
	<div class="input-datenaissance__inner">
		<select class="inputlineselect" id="{@name}month" name="{@nameid}month">
			<xsl:apply-templates select="." mode="lineinputatts" />
			<xsl:if test="./@defaultvalue != 'first'">
				<xsl:element name="option">
					<xsl:attribute name="value">-1</xsl:attribute>
					<xsl:if test="@selected"><xsl:attribute name="selected" /></xsl:if>
					<xsl:value-of select="./selectmonth/@defval" />
				</xsl:element>
			</xsl:if>
			<xsl:if test="./@defaultvalue = 'first'">
				<xsl:attribute name="data-defaultvalue">first</xsl:attribute>
			</xsl:if>
			<!-- <xsl:apply-templates select="./option" mode="cubeinputselectoption" /> -->
			<xsl:apply-templates select="./selectmonth/optioncat" mode="cubeinputselectoption" />
		</select>
	</div>
	</div>
	<xsl:comment>ib</xsl:comment>
	<div class="input-datenaissance">
	<div class="input-datenaissance__inner">
		<select class="inputlineselect" id="{@name}year" name="{@nameid}year">
			<xsl:apply-templates select="." mode="lineinputatts" />
			<xsl:if test="./@defaultvalue != 'first'">
				<xsl:element name="option">
					<xsl:attribute name="value">-1</xsl:attribute>
					<xsl:if test="@selected"><xsl:attribute name="selected" /></xsl:if>
					<xsl:value-of select="./selectyear/@defval" />
				</xsl:element>
			</xsl:if>
			<xsl:if test="./@defaultvalue = 'first'">
				<xsl:attribute name="data-defaultvalue">first</xsl:attribute>
			</xsl:if>
			<!-- <xsl:apply-templates select="./option" mode="cubeinputselectoption" /> -->
			<xsl:apply-templates select="./selectyear/optioncat" mode="cubeinputselectoption" />
		</select>
	</div>
	</div>
</xsl:template>

<xsl:template match="*" mode="cubeinputselect">
	<select class="inputlineselect" id="{@name}" name="{@nameid}">
		<xsl:apply-templates select="." mode="lineinputatts" />
		<xsl:if test="./@defaultvalue != 'first'">
			<xsl:element name="option">
				<xsl:attribute name="value">-1</xsl:attribute>
				<xsl:if test="@selected"><xsl:attribute name="selected" /></xsl:if>
				<xsl:value-of select="@label" />
			</xsl:element>
		</xsl:if>
		<xsl:if test="./@defaultvalue = 'first'">
			<xsl:attribute name="data-defaultvalue">first</xsl:attribute>
		</xsl:if>
		<xsl:apply-templates select="./option" mode="cubeinputselectoption" />
		<xsl:apply-templates select="./optioncat" mode="cubeinputselectoption" />
	</select>
</xsl:template>

<xsl:template match="option" mode="cubeinputselectoption">
	<xsl:element name="option">
	  <xsl:attribute name="value">
		<xsl:value-of select="@name" />
	  </xsl:attribute>
	  <xsl:if test="@selected">
		<xsl:attribute name="selected" />
	  </xsl:if>
	  <xsl:value-of select="@name" />
	</xsl:element>
</xsl:template>

<xsl:template match="optioncat" mode="cubeinputselectoption">
	<xsl:element name="option">
	  <xsl:attribute name="value">
		<xsl:value-of select="@id" />
	  </xsl:attribute>
	  <xsl:if test="@selected">
		<xsl:attribute name="selected" />
	  </xsl:if>
	  <xsl:value-of select="@label" />
	</xsl:element>
</xsl:template>


<xsl:template match="*" mode="cubeinputmulticheckbox">
	<div class="multicheckbox--wrap">
		<div class="multicheckbox--values">
			<xsl:apply-templates select="./optioncat" mode="cubeinputmulticheckboxoption" />
		</div>
	</div>
</xsl:template>

<xsl:template match="optioncat" mode="cubeinputmulticheckboxoption">
	<div class="multicheckbox--value-line">
		<input class="inputlinecb" type="checkbox" name="{./../@nameid}[]" value="{@label}">
			<xsl:if test="@selected">
				<xsl:attribute name="checked" />
			</xsl:if>
		</input><xsl:value-of select="concat(' ',@label, ' ')" />
	</div>
</xsl:template>

<xsl:template match="*" mode="cubeinputcheckbox">
	<xsl:apply-templates select="./option" mode="cubeinputcheckboxoption" />
</xsl:template>

<xsl:template match="option" mode="cubeinputcheckboxoption">
	<input class="inputlinecb" type="checkbox" name="{@nameid}[]" value="{@name}">
		<xsl:if test="@selected">
			<xsl:attribute name="checked" />
		</xsl:if>
	</input><xsl:value-of select="concat(' ',@name, ' ')" />
</xsl:template>

<xsl:template match="*" mode="cubeinputradio">
	<xsl:apply-templates select="./option" mode="cubeinputradiooption" />
	<xsl:apply-templates select="./optioncat" mode="cubeinputradiooption" />
</xsl:template>

<xsl:template match="option" mode="cubeinputradiooption">
	<input class="inputlinecb" type="radio" name="{./../@nameid}" value="{@name}">
		<xsl:if test="string-length(./../@obl) &gt; 0 and position() = 1">
			<xsl:attribute name="class">inputlinecb validate['required']</xsl:attribute>
		</xsl:if>
		<xsl:if test="@selected">
			<xsl:attribute name="checked" />
		</xsl:if>
	</input><span><xsl:value-of select="concat(' ',@name, ' ')" /></span>
</xsl:template>

<xsl:template match="optioncat" mode="cubeinputradiooption">
	<input class="inputlinecb" type="radio" name="{./../@nameid}" value="{@id}">
		<xsl:if test="string-length(./../@data-error-on-parent) &gt; 0">
			<xsl:attribute name="data-error-on-parent"><xsl:value-of select="./../@data-error-on-parent"/></xsl:attribute>
		</xsl:if>
		<xsl:if test="string-length(./../@obl) &gt; 0 and position() = 1">
			<xsl:attribute name="class">inputlinecb validate['required']</xsl:attribute>
		</xsl:if>
		<xsl:if test="@selected">
			<xsl:attribute name="checked" />
		</xsl:if>
	</input><span><xsl:value-of select="concat(' ',@label, ' ')" /></span>
</xsl:template>

<xsl:template match="*" mode="cubeinputjqfufile">
	<input type="text" id="{@name}" name="{@nameid}" value="{@value}">
		<xsl:apply-templates select="." mode="lineinputatts" />
	</input>
</xsl:template>

<xsl:template match="*" mode="cubeinputfile">
	<input type="file" id="{@name}" name="{@nameid}" data-real-value="{@value}" value="{@value}">
		<xsl:apply-templates select="." mode="lineinputatts" />
	</input>
</xsl:template>

<xsl:template match="*" mode="cubeinputfiles">
	<input type="file" id="{@name}" name="{@nameid}[]" multiple="multiple" value="{@value}">
		<xsl:apply-templates select="." mode="lineinputatts" />
	</input>
</xsl:template>

<xsl:template match="*" mode="cubeinputimgfile">
	<div class="input-imgfile__preview js-input-imgfile__preview" data-img-preview-for="{@name}" data-img-src="{@value}"></div>
	<input type="file" id="{@name}" name="{@nameid}" value="">
		<xsl:apply-templates select="." mode="lineinputatts" />
	</input>
</xsl:template>

<xsl:template match="*" mode="cubeinputdate">
	<input type="text" id="{@name}" name="{@nameid}" value="{@value}">
		<xsl:apply-templates select="." mode="lineinputatts" />
	</input>
</xsl:template>

<xsl:template match="*" mode="cubeinputunikcheckbox">
	<input type="checkbox" id="{@name}" name="{@nameid}[]" value="1">
		<xsl:apply-templates select="." mode="lineinputatts" />
		<xsl:if test="@value = '1'">
			<xsl:attribute name="checked" />
		</xsl:if>
	</input>
</xsl:template>















<xsl:template match="lineinputl | lineinputrtodel">
	<div class="{concat('formline ',@error)}">
		<xsl:if test="@error = '1'">
			<xsl:attribute name="class">formline formlineerror</xsl:attribute>
		</xsl:if>
	  <div class="labelform">
		<label for="{@name}">
		  <xsl:value-of select="@label" />
		</label>
	  </div>
	  <div class="inputform">
		<input class="inputline" type="text" id="{@name}" name="{@name}form" value="{@value}">
		<xsl:if test="@type = 'pwd'">
			<xsl:attribute name="type">password</xsl:attribute>
			<xsl:attribute name="value"></xsl:attribute>
		</xsl:if>
		</input>
		<span class="err">
		  <xsl:value-of select="@err" />
		</span>
		<span class="errb">
		  <xsl:value-of select="@errb" />
		</span>
	  </div>
	</div>
</xsl:template>

<xsl:template match="lineinputinsidetodel">
	<div class="{concat('formline ','formline',@name)}">
	  <div class="inputform inputtype{@type}">
		<div class="label">
			<xsl:value-of select="@label" /><xsl:if test="@obl = '1'"><span>&#160;*</span></xsl:if>
		</div>
		<div class="blocinput">
			<xsl:choose>
				<xsl:when test="@type = 'text'">
					<textarea class="inputtext error{@error}" name="{@name}form"><xsl:value-of select="value" /></textarea>
				</xsl:when>
				<xsl:otherwise>
					<input class="inputline error{@error}" type="text" name="{@name}form" value="{@value}" />
				</xsl:otherwise>
			</xsl:choose>
		</div>
	  </div>
	</div>
</xsl:template>

<xsl:template match="lineinputinsideBtodel">
	<div class="{concat('formline ','formline',@name)}">
	  <div class="inputform inputtype{@type}">
		<div class="blocinput">
			<xsl:choose>
				<xsl:when test="@type = 'text'">
					<textarea class="inputtext error{@error} inputlabelinsine" label="{@label}" name="{@name}form"><xsl:value-of select="value" /></textarea>
				</xsl:when>
				<xsl:otherwise>
					<input class="inputline error{@error} inputlabelinsine" label="{@label}" type="text" name="{@name}form" value="{@value}" />
				</xsl:otherwise>
			</xsl:choose>
		</div>
	  </div>
	</div>
</xsl:template>

<xsl:template match="inpopttodel">
	<xsl:element name="option">
	  <xsl:attribute name="value">
		<xsl:value-of select="@value" />
	  </xsl:attribute>
	  <xsl:if test="@selected">
		<xsl:attribute name="selected" />
	  </xsl:if>
	  <xsl:value-of select="@name" />
	</xsl:element>
</xsl:template>
<!-- Inputline template -->
<xsl:template match="lineinputctodel">
	<div class="formline">
	  <div class="labelform">
		<label for="{@name}">
		  <xsl:value-of select="@label" />
		</label>
	  </div>
	  <div class="inputform">
		<xsl:choose>
		  <xsl:when test="@type = 'select'">
			<select class="inputlineselect" name="{@name}">
			  <xsl:apply-templates select="inpopt" />
			</select>
			<span class="needed">
			  <xsl:value-of select="@needed" />
			</span>
		  </xsl:when>
		  <xsl:otherwise>
			<input class="inputline" type="{@type}" name="{@name}" value="{@value}" onfocus="this.style.backgroundColor = '#eee';" onblur="this.style.backgroundColor = '#fff';" />
			<span class="needed">
			  <xsl:value-of select="@needed" />
			</span>
		  </xsl:otherwise>
		</xsl:choose>
	  </div>
	</div>
</xsl:template>




<xsl:template match="lineinputetodel">
	<div class="formline fit{@type}" id="formline{@name}">
		<xsl:if test="@error = '1'">
			<xsl:attribute name="class">formline formlineerror</xsl:attribute>
		</xsl:if>
	  <div class="labelform">
		<label for="{@name}">
			<xsl:if test="@type = 'unikcheckbox'">
				<xsl:apply-templates select="." mode="unikcheckbox" />
				<xsl:value-of select="' '" />
			</xsl:if>
			<xsl:value-of select="@labellink"/>
			<xsl:choose>
				<xsl:when test="string-length(@labellink) &gt; 0">
					<xsl:variable name="labellink" select="@labellink"/>
					<a href="{$cr//cat[@id=$labellink]/@mainwu}" target="_blank">
						<xsl:value-of select="@label" />
					</a>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="@label" />
				</xsl:otherwise>
			</xsl:choose>
			<xsl:if test="@req = '1'">
				<xsl:value-of select="' *'" />
			</xsl:if>
			<!--
			<xsl:if test="@type != 'unikcheckbox'">
				<xsl:value-of select="' :'" />
			</xsl:if>
			-->
		</label>
	  </div>
	  <div class="inputform">
		<xsl:if test="@type = 'line'">
			<xsl:apply-templates select="." mode="line" />
		</xsl:if>
		<xsl:if test="@type = 'text'">
			<xsl:apply-templates select="." mode="text" />
		</xsl:if>
		<xsl:if test="@type = 'select'">
			<xsl:apply-templates select="." mode="select" />
		</xsl:if>
		<xsl:if test="@type = 'checkbox'">
			<xsl:apply-templates select="." mode="checkbox" />
		</xsl:if>
		<xsl:if test="@type = 'radio'">
			<xsl:apply-templates select="." mode="radio" />
		</xsl:if>	
		<xsl:if test="@type = 'date'">
			<xsl:apply-templates select="." mode="date" />
		</xsl:if>	
		<xsl:if test="@type = 'file'">
			<xsl:apply-templates select="." mode="file" />
		</xsl:if>	
		<xsl:if test="@type = 'jqfufile'">
			<xsl:apply-templates select="." mode="jqfufile" />
		</xsl:if>
	  </div>
	  <xsl:if test="string-length(@labelb) &gt; 0">
		  <div class="labelbform"><xsl:value-of select="@labelb" /></div>
	  </xsl:if>
	  
	  
	</div>
</xsl:template>

<xsl:template match="lineinputbtodel">
	<div class="formline">
	  <label for="{@name}">
		<xsl:value-of select="@label" />
	  </label>
	  <input class="inputline" type="text" name="{@name}" id="{@name}" value="{@value}" onfocus="this.style.backgroundColor = '#eee';" onblur="this.style.backgroundColor = '#fff';" />
	</div>
</xsl:template>
<!-- Form Error -->
<xsl:template match="formerror">
	<p>
	  <xsl:value-of select="." />
	</p>
</xsl:template>

<!-- WEBPAGE FORM PART -->

<xsl:template match="cat" mode="nlinscform">
	<xsl:variable name="cct" select="." />
	<div id="nlformdiv">
		<div id="nlformtitle"><xsl:value-of select="$cct/nl/item/titreform" /></div>
		<div id="nlformdivcontent">
			<div id="nlformsuccess"><xsl:value-of select="$cct/nl/item/success" /></div>
			<form id="nlform" action="" method="post" class="formcheck">
				<input type="txt" name="nlmail" id="nlmail" value="" class="labelinside validate['required','email']" lang="{$cct/nl/item/labelmail}" />
				<input type="submit" name="nlsend" id="nlsubmit" value="{$cct/nl/item/labelsend}" />
			</form>
		</div>
	</div>
</xsl:template>

<xsl:template match="cat" mode="nlinscformnew">
	<xsl:variable name="cct" select="." />
	<div id="nlformdiv">
		<div id="nlformtitle"><xsl:value-of select="$cct/text/item/titreform" /></div>
		<div id="nlformdivcontent">
			<div id="nlformsuccess"><xsl:value-of select="$cct/text/item/success" /></div>
			<form id="nlform" action="" method="post" data-js="formcheck-nl">
				<div id="nlmailwrap">
					<input type="txt" name="nlmail" id="nlmail" value="" class="labelinside validate['required','email']" placeholder="{$cct/text/item/email}" />
				</div>
				<input type="hidden" name="nllang" id="nllang" value="{$langcode}" />
				<div id="nlsubmitwrap">
					<input type="submit" name="nlsend" id="nlsubmit" value="{$cct/text/item/submit}" />
				</div>
			</form>
		</div>
	</div>
</xsl:template>

<xsl:template name="breadcrumb">
	<xsl:apply-templates select="$cr//cat[@id='home']" mode="breadcrumbitem"/>
</xsl:template>




<xsl:template match="cat" mode="breadcrumbitem">
	<xsl:if test="@id != 'home'">
		<span class="sep">&#160;&#160;<xsl:value-of select="concat(' ', '&#62;', ' ')"/>&#160;&#160;</span>
	</xsl:if>
	
	<xsl:choose>
		<xsl:when test="./@nopage = '1'">
			<span><xsl:value-of select="./@name"/></span>
		</xsl:when>
		<xsl:otherwise>
			<a href="{./@mainwu}">
				<xsl:value-of select="./@name"/>	
			</a>
		</xsl:otherwise>
	</xsl:choose>
	
	<xsl:choose>
		<xsl:when test="@id = 'home'">
			<xsl:apply-templates select="$cr//cat[@id='site']/cat[@catselected='1' and not(@id='home')]" mode="breadcrumbitem"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:apply-templates select="./cat[@catselected='1']" mode="breadcrumbitem"/>
		</xsl:otherwise>
	</xsl:choose>
	
</xsl:template>


</xsl:stylesheet>
