<xsl:template match="home">
	<div class="page__wrap page__wrap__{$ccf/@id}" data-js="page-{$ccf/@id}" data-circle-class="Circle_canvas">
		<!-- sksmooth attributes -->
		<xsl:attribute name="data-sksmooth">page-content</xsl:attribute>
		<xsl:attribute name="data-model"><xsl:value-of select="$ccf/@model"/></xsl:attribute>
		<xsl:attribute name="data-uid"><xsl:value-of select="$ccf/@uid"/></xsl:attribute>
		<!-- /sksmooth attributes -->
		
		<div class="mw">
			<div class="mw__inner">
				<div class="home__grid">
					<div class="home__grid__col home__grid__col--a">
						<xsl:apply-templates select="$cr//cat[@id='pagea']" mode="home-grid-item"/>
						<div class="home__grid__item home__grid__item--d">
							<div class="home__grid__item__inner__for__anim">
								<cube type="wrapp" src="blocdtitre"/>
								<cube type="wrapp" src="blocdtxt"/>
							</div>
							<div class="home__grid__item__dummy__for__anim"></div>
						</div>
						<xsl:apply-templates select="$cr//cat[@id='pagec']" mode="home-grid-item"/>
					</div>
					<div class="home__grid__col home__grid__col--b">
						<div class="home__grid__item home__grid__item--a">
							<div class="home__grid__item__inner__for__anim">
								<cube type="wrapp" src="blocatitre"/>
								<div class="home__blocatxt__wrap">
									<div class="home__blocatxt__inner">
										<div class="home__blocatxt">
											<xsl:apply-templates select="$cr//cat[@model = 'pagemodel']" mode="home-first-bloc-links"/>
										</div>
									</div>
								</div>
							</div>
							<div class="home__grid__item__dummy__for__anim"></div>
						</div>
						<xsl:apply-templates select="$cr//cat[@id='pagea']" mode="home-grid-item"/>
						<div class="home__grid__item home__grid__item--c">
							<div class="home__grid__item__inner__for__anim">
								<div class="home__blocctxt__wrap">
									<div class="home__blocctxt__svg home__blocctxt__svg--a">
										<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 291.86 19.01">
											<polyline points="0.1,18.8 18.33,0.21 36.56,18.8 54.79,0.21 73.02,18.8 91.25,0.21 109.47,18.8 127.7,0.21 
												145.93,18.8 164.16,0.21 182.39,18.8 200.62,0.21 218.84,18.8 237.07,0.21 255.3,18.8 273.53,0.21 291.76,18.8 	"/>
										</svg>
									</div>
									<cube type="wrapp" src="blocctxt"/>
									<div class="home__blocctxt__svg home__blocctxt__svg--b">
										<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 291.86 19.01">
											<polyline points="0.1,18.8 18.33,0.21 36.56,18.8 54.79,0.21 73.02,18.8 91.25,0.21 109.47,18.8 127.7,0.21 
												145.93,18.8 164.16,0.21 182.39,18.8 200.62,0.21 218.84,18.8 237.07,0.21 255.3,18.8 273.53,0.21 291.76,18.8 	"/>
										</svg>
									</div>
								</div>
							</div>
							<div class="home__grid__item__dummy__for__anim"></div>
						</div>
						
						<xsl:apply-templates select="$cr//cat[@id='pageb']" mode="home-grid-item"/>
						<div class="home__grid__item home__grid__item--d">
							<div class="home__grid__item__inner__for__anim">
								<cube type="wrapp" src="blocdtitre"/>
								<cube type="wrapp" src="blocdtxt"/>
							</div>
							<div class="home__grid__item__dummy__for__anim"></div>
						</div>
						<xsl:apply-templates select="$cr//cat[@id='pagec']" mode="home-grid-item"/>
						<xsl:apply-templates select="$cr//cat[@id='paged']" mode="home-grid-item"/>
					</div>
				</div>
				<div class="home_parts">
					<xsl:apply-templates select="$ccf/list/item[not(@display='hidden')]" mode="part-item"/>
				</div>
			</div>
		</div>
	</div> <!-- page__wrap -->
</xsl:template>

<xsl:template match="cat" mode="home-first-bloc-links">
	<a href="{concat($siteroot, ./@mainwu)}" class="home__first__bloc__link">
		<xsl:apply-templates select="./text/item/meatitrea/node()"/>
	</a>
</xsl:template>

<xsl:template match="cat" mode="home-grid-item">
	<xsl:variable name="name" select="name(.)"/>
	<a href="{concat($siteroot, ./@mainwu)}" class="home__grid__item home__grid__item--page home__grid__item--page--{./@id}" title="{./@name}">
		<div class="home__grid__item__inner__for__anim">
			<div class="home__grid__item__bg"></div>
			<img class="home__grid__item__img" src="{concat($pc, ./text/item/meaphotos/i[1])}" data-asset="page" data-size="1"/>
			<img class="home__grid__item__img__abs" src="{concat($pc, ./text/item/meaphotos/i[1])}" data-asset="page" data-size="1"/>
			<div class="home__grid__item__txts">
				<cube type="wrapp" src="./text/item/meatitre" inner="1"/>
				<cube type="wrapp" src="./text/item/meatxt"/>
				<div class="home__grid__item__cta__wrap">
					<span class="home__grid__item__cta">
						<xsl:value-of select="$cr//cat[@id='home']/text/item/readmore"/>
					</span>
				</div>
			</div>
		</div>
		<div class="home__grid__item__dummy__for__anim"></div>
	</a>
</xsl:template>

<xsl:template match="item" mode="part-item">
	<xsl:variable name="elname">
		<xsl:choose>
			<xsl:when test="./lienremoved/si">a</xsl:when>
			<xsl:otherwise>div</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:element name="{$elname}">
		<xsl:if test="./lienremoved/si">
			<xsl:variable name="qq" select="./lien/si"/>
			<xsl:variable name="ccl" select="$cr//item[@uid=$qq]"/>
			<xsl:attribute name="href"><xsl:value-of select="concat($siteroot, $ccl/../../@mainwu, '#', $ccl/@id)"/></xsl:attribute>
		</xsl:if>
		<xsl:attribute name="class">home__part__item</xsl:attribute>
		<div class="home__part__item__visu" style="background-image:url({concat($pc, ./photos/i[1])})"></div>
	</xsl:element>
</xsl:template>

