<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html"
    indent="yes"
    omit-xml-declaration="yes"
    encoding="utf-8"
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
  <xsl:template match="/d">
    <html>
      <head>
        <title>
          <xsl:choose>
            <xsl:when test="count(fiche)=0">No file found</xsl:when>
            <xsl:when test="count(fiche)=1 and count(fiche/pts)=1">Runner <xsl:value-of select="fiche/@doss"/> - 
									<xsl:value-of select="fiche/identite/@prenom"/><xsl:text> </xsl:text><xsl:value-of select="fiche/identite/@nom"/>
									- <xsl:value-of select="courses/c[@id=/d/fiche/@c]/@nc"/>
			</xsl:when>
            <xsl:otherwise>Search : <xsl:value-of select="@rech"/></xsl:otherwise>
          </xsl:choose>
          - LiveTrail®
        </title>
        <xsl:if test="string(fiche/state/@code) = 'f'">
			<meta property="og:title"><xsl:attribute name="content"><xsl:value-of select="fiche/@doss"/> - 
									<xsl:value-of select="fiche/identite/@prenom"/><xsl:text> </xsl:text><xsl:value-of select="fiche/identite/@nom"/>
									- <xsl:value-of select="courses/c[@id=/d/fiche/@c]/@nc"/> - LiveTrail®</xsl:attribute>
			</meta>
			<meta property="og:description">
				<xsl:attribute name="content">
											<xsl:value-of select="fiche/identite/@prenom"/><xsl:text> </xsl:text><xsl:value-of select="fiche/identite/@nom"/>
											- Finisher ! - <xsl:value-of select="courses/c[@id=/d/fiche/@c]/@nc"/>
				</xsl:attribute>
			</meta>
		</xsl:if>
        <xsl:if test="count(fiche)=1 and number(fiche/@nocarto)!=1">
			<script type="text/javascript" src="data/gmData_{fiche/@c}.js?v="></script>
			<script type="text/javascript" src="data/kmData_{fiche/@c}.js?v="></script>
			<link rel="stylesheet" href="js/leaflet1.3.css" />
			<script src="js/leaflet1.3.js"></script>
										<script src="js/leaflet-layers/IGN.js"></script>
						<script src="js/leaflet-layers/OSM.js"></script>
			<script src="js/leaflet-layers/TileLayer.collection.js"></script>
        </xsl:if>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="pragma" content="no-cache"/>
  <meta http-equiv="cache-control" content="no-cache, must-revalidate"/>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
  <link rel="stylesheet" type="text/css" media="screen" href="js/theme-ui/ui.all.css"/>
  <link rel="stylesheet" type="text/css" media="screen" href="st.css?v=20240403"/>
  <link rel="stylesheet" type="text/css" media="screen" href="style.css?y=2024"/>
  <link rel="icon" type="image/png" href="im/favicon.png" />
  <!--[if IE]>
  <link rel="shortcut icon" type="image/x-icon" href="im/favicon.ico" />
  <![endif]-->
  	<script type="text/javascript">
		var isIframeMode=false;
	</script>
		<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/mob_swipe.js"></script>
	<script type="text/javascript" src="js/raphael.js"></script>
	<script type="text/javascript" src="js/aplweb.scrollbars.js"></script>
	<script type="text/javascript" src="js/jquery-ui.js"></script>
	<script type="text/javascript" src="js/util.js?v20231003"></script>
	<script type="text/javascript" src="js/jquery.countdown.js"></script>
	<script type="text/javascript" src="js/httpReq.js"></script>
	  <script type="text/javascript" src="js/gm.js"></script>
    
<!-- Google tag (gtag.js) -->
<script async="1" src="https://www.googletagmanager.com/gtag/js?id=G-TK9N9GRYWX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-TK9N9GRYWX');
</script>

<!-- Google tag (gtag.js) -->
<script async="1" type="text/javascript" src="https://www.googletagmanager.com/gtag/js?id=G-9B5975ZT9G"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-9B5975ZT9G');
</script>
<script type="text/javascript">
  
	/* Hotjar */
	(function(h,o,t,j,a,r){
		h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
		h._hjSettings={hjid:2201953,hjsv:6};
		a=o.getElementsByTagName('head')[0];
		r=o.createElement('script');r.async=1;
		r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
		a.appendChild(r);
	})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');

</script>
</head>
<body>
	<script type="text/javascript">
	!function(f,b,e,v,n,t,s)
	{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
	n.callMethod.apply(n,arguments):n.queue.push(arguments)};
	if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
	n.queue=[];t=b.createElement(e);t.async=!0;
	t.src=v;s=b.getElementsByTagName(e)[0];
	s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js');
	fbq('init', '176863753641136');
		fbq('track', 'PageView');
</script>
<noscript>
	<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=176863753641136&amp;ev=PageView&amp;noscript=1" />
	</noscript>
        <script type="text/javascript" src="js/morris.min.js"></script>
		<script type="text/javascript" src="js/lt.chart.js"></script>
        <script type="text/javascript" src="js/fc.js?v=20231003"></script>
        <script type="text/javascript" src="js/blowfish.js"></script>
        <script type="text/javascript">
          var carte=null;
          			var is_carto_SwissTopo=false;
		  		  			var key={
				ign:"2xyxfx0ztk5667ii7kc82eh3"
			};
		            var lastidpt='<xsl:value-of select="/d/fiche/pass/e[position()=last()]/@idpt"/>';
          <xsl:if test="count(fiche)=1 and number(fiche/@nocarto)!=1">
	          var kmpts=kmxy_<xsl:value-of select="/d/fiche/@c"/>;
          </xsl:if>
          var lastLoc=null;
          <xsl:if test="count(/d/fiche/loc)>=1">
			lastLoc={crypt:'<xsl:value-of select="/d/fiche/loc/@crypt"/>',lon:'<xsl:value-of select="/d/fiche/loc/@lon"/>',lat:'<xsl:value-of select="/d/fiche/loc/@lat"/>',vit:'<xsl:value-of select="/d/fiche/loc/@vit"/>',acc:'<xsl:value-of select="/d/fiche/loc/@acc"/>',bat:'<xsl:value-of select="/d/fiche/loc/@bat"/>',o:'<xsl:value-of select="/d/fiche/loc/@o"/>',minago:'<xsl:value-of select="/d/fiche/loc/@minago"/>',dt:'<xsl:call-template name="fmt-dtjt"><xsl:with-param name="j" select="/d/fiche/loc/@j" /><xsl:with-param name="t" select="/d/fiche/loc/@h" /></xsl:call-template>'};
          </xsl:if>
          var textminago='xx min ago';
          var bib='<xsl:value-of select="fiche/@doss"/>';
          var pts=[
            <xsl:variable name="pts" select="fiche/pts/pt" />
		<xsl:variable name="__lastpt" select="fiche/pts/pt[position()=last()]/@idpt" />
            <xsl:for-each select="$pts">
              <xsl:variable name="_idpt" select="@idpt"/>
              <xsl:variable name="pospt" select="position()"/>
              <xsl:variable name="_pass" select="/d/fiche/pass/e[@idpt = $_idpt]"/>
              <xsl:variable name="_heurepass" >
                <xsl:if test="string($_pass/@ha) != ''">
                  <xsl:call-template name="fmt-dtjt">
                    <xsl:with-param name="j" select="$_pass/@ja" />
                    <xsl:with-param name="t" select="$_pass/@ha" />
                  </xsl:call-template>
                </xsl:if>
		<xsl:if test="@idpt!=$__lastpt">
                <xsl:if test="string($_pass/@ha) != '' and string($_pass/@hd) != ''">&lt;br/&gt;</xsl:if>
                <xsl:if test="string($_pass/@hd) != ''">
                  <xsl:call-template name="fmt-dtjt">
                    <xsl:with-param name="j" select="$_pass/@jd" />
                    <xsl:with-param name="t" select="$_pass/@hd" />
                  </xsl:call-template>
                </xsl:if>
		</xsl:if>
              </xsl:variable>	  
              <xsl:if test="$pospt&gt;1">,</xsl:if>
              {idpt:'<xsl:value-of select="@idpt"/>',kmt:'<xsl:call-template name="fmt-f"><xsl:with-param name="v" select="10 * ((@km div 10) div 1.609344)" /><xsl:with-param name="format" select="'0.0'"/></xsl:call-template> miles',kmp:'<xsl:call-template name="fmt-f"><xsl:with-param name="v" select="10 * (((@km - $pts[$pospt - 1]/@km) div 10) div 1.609344)" /><xsl:with-param name="format" select="'0.0'"/></xsl:call-template> miles',dt:'<xsl:call-template name="fmt-i"><xsl:with-param name="v" select="@d * 3.28084"/></xsl:call-template> ft',dp:'<xsl:call-template name="fmt-i"><xsl:with-param name="v" select="(@d - $pts[$pospt - 1]/@d) * 3.28084"/></xsl:call-template> ft',p:"<xsl:value-of select="$pts[$pospt - 1]/@n"/>",a:'<xsl:call-template name="fmt-i"><xsl:with-param name="v" select="@a * 3.28084"/></xsl:call-template> ft',n:"<xsl:value-of select="$pts[$pospt]/@n"/>",lon:'<xsl:value-of select="$pts[$pospt]/@lon"/>',lat:'<xsl:value-of select="$pts[$pospt]/@lat"/>',meet:'<xsl:value-of select="$pts[$pospt]/@meet"/>',hp:'<xsl:if test="/d/fiche/state/@code != 'nl' and /d/fiche/state/@code != 'np'"><xsl:value-of select="$_heurepass"/></xsl:if>',tc:'<xsl:value-of select="$_pass/@tps"/>',clt:'<xsl:value-of select="$_pass/@clt"/>',vit:'<xsl:call-template name="calc-kmh"><xsl:with-param name="idpt" select="$_idpt" /><xsl:with-param name="pts" select="/d/fiche/pts/pt" /><xsl:with-param name="pass" select="/d/fiche/pass/e" /><xsl:with-param name="pace" select="'0'" /></xsl:call-template>mph'}
            </xsl:for-each>
          ];
          $(function() {
            $('.tpass a').click(function(event) {
              var i=$('.tpass a').index(event.target);
              var p=pts[i];
              var t=$(event.target).position().top;
              $('#tab .postit').animate({top:(t-10)}).show().html('&lt;img src="im/ptdr.png" id="ptdr" /&gt;'+
                '&lt;div&gt;&lt;b&gt;Distance from&lt;/b&gt;&lt;br/&gt;- The start : '+p['kmt']+'&lt;br/&gt;'+(p['p']==''||i==1?'':'- '+p['p']+' : '+p['kmp']+'&lt;/div&gt;')+'&lt;br/&gt;'+
                '&lt;div&gt;&lt;b&gt;Elevation gain from&lt;/b&gt;&lt;br/&gt;- The start : '+p['dt']+'&lt;br/&gt;'+(p['p']==''||i==1?'':'- '+p['p']+' : '+p['dp'])+'&lt;/div&gt;');
              event.preventDefault();
              event.stopPropagation();
            });
            $('.tpass a[data=0]').click();
            $('.tpass a').each(function() {
              if($(this).attr('data')=='<xsl:value-of select="/d/fiche/pass/e[last()]/@idpt"/>') {
                $(this).click();
              }
            });
            				if(isFav(<xsl:value-of select="fiche/@doss"/>)) {
				  $(".fav").show(); $(".nofav").hide();
				}
								<xsl:for-each select="fiche">
					if(isComp(<xsl:value-of select="@doss"/>)) { $(".comp[data-dos=<xsl:value-of select="@doss"/>]").show(); $(".nocomp[data-dos=<xsl:value-of select="@doss"/>]").hide(); }
				</xsl:for-each>
				          });
          
          		          </script>
                  <div id="main" >
	<div id="bandeau" ></div>
		<div id="lg" >
	<label>Language	&#160;</label>
	<span class="sel" title="English">EN</span>		|	<a href="javascript:setCookie('langue_affich','_fr');unsetCookie('homeTip');unsetCookie('runnerTip');location.reload(true);" title="Français">FR</a>		|	<a href="javascript:setCookie('langue_affich','_es');unsetCookie('homeTip');unsetCookie('runnerTip');location.reload(true);" title="Español">ES</a>				</div>
	<div id="main2"  >
		<table id="tmenu">
	  <thead>
		<tr>
		  		  <td width="200">
			<form class="rech" name="recherch" method="POST" style="margin:0;white-space:nowrap;" action="coureur.php" onsubmit="return getValue(document.recherch.rech)!='';">
			  <input type="text" name="rech" value="{@rech}" onfocus="this.select();"/>
			  <input type="submit" value="" class="btnfd"/>
			</form>
		  </td>
		  <td><span><a href="./">Welcome</a></span></td>
		  <td style="cursor:pointer" onclick="dispMenu();"><div>Info</div></td>
		  <td style="cursor:pointer" onclick="dispMenu();"><div>Runners</div></td>
		  <td style="cursor:pointer" onclick="dispMenu();"><div>Following</div></td>
		  		  			  <td style="text-align:right;width:180px;">
								<span><a href="javascript:winlog()">Admin Login</a></span>
							  </td>
			  		</tr>
	  </thead>
	  <tbody>
		<tr id="tbmenu" style="display:none" >
		  <td><div id="menulogo">&#160;</div></td>
		  <td>
			&#160;		  </td>
		  <td>
			<ul>
			  <li><a href="stats.php">Stats</a></li>			  <li><a href="parcours.php">Routes</a></li>			</ul>
		  </td>
		  <td>
			<ul>
			  <li class="sel"><a href="coureur.php">Runner's file</a></li>
			  <li><a href="favoris.php">My favourite runners</a></li>
			  <li><a href="lstfavoris.php">Favorites list</a></li>			  <li><a href="compare.php">Participants' Comparison</a></li>			  			  <li><a href="gps.php">GPS or predictive Following</a></li>			  					<li><a href="lstCoureurs.php">List of runners</a></li>
				  					<li><a href="lstPartants.php">List of starters</a></li>
								</ul>
		  </td>
		  <td>
			<ul>
			  <li><a href="teteCourse.php">Race leaders</a></li>			  <li><a href="prochains.php">Expected arrivals</a></li>			  <li><a href="passages.php">Participants' Progress</a></li>			  <li><a href="classement.php">Results</a></li>			  			  			  <li><a href="classementPoint.php">Timing point Leaderboards</a></li>			  			  			  <li><a href="tabAbd.php">Withdrawals</a></li>			  			  			  <li>&#160;</li>
			</ul>
		  </td>
		  <td>&#160;</td>		</tr>
	  </tbody>
	</table>
			<div id="poplogin" title="Admin Login" style="display:none" >
		  <form id="FormLog" name="FormLog" method="post" onsubmit="return false;" >
			<div>Dear Organiser, please identify yourself to access LiveTrail's tools.<br/>Dear spectators, the live following is free and you do not need to register to follow the race.<br/></div>
			<div><span>Login : </span><input type="text" name="login" value="" maxlength="256" size="20"/></div>
			<div><span>Password : </span><input type="password" name="pass" maxlength="256" size="15"/></div>
			<label><input name="keepConn" value="1" type="checkbox" checked="checked"/>Stay connected</label>
			<div id="btnUser"><input type="submit" value="Valider" onclick="setUser();"/></div>
		  </form>
		</div>
			<div id="layhelprech" class="helper" style="display:none" >
	  <div class="br">
		<strong>SEARCH BY :</strong><br/>&#160; - The <strong>race-bib</strong> of runner<br/>&#160; - The  <strong>family name</strong> of a runner, of a team<br/>&#160; - The <strong>name</strong> of a runner<br/>	  </div>
	</div>
	          <xsl:choose>
            <xsl:when test="count(fiche)=0">
              <div id="ictete"/>
              <div id="tete">
                <div class="np" style="margin-top:10px;text-transform:uppercase">Search a runner</div>
              </div>
              <div id="fintete"/>
              <xsl:choose>
				<xsl:when test="count(error)&gt;0">
					<div class="noresult">An error occurred on the creation of the runner's file</div>
				</xsl:when>
                <xsl:when test="@rech!=''">
                  <div class="noresult">
                  No participant found. : "<xsl:value-of select="@rech"/>"
                  </div>
                </xsl:when>
                <xsl:otherwise>
                  <div class="noresult">To search for a participant, use the search button on the top left of this page.</div>
                </xsl:otherwise>
              </xsl:choose>
                          </xsl:when>
            <xsl:when test="count(fiche)=1 and count(fiche/pts)=1">
				<xsl:variable name="lastpass" select="/d/fiche/pass/e[position()=last()]" />
				 				<xsl:if test="count(fiche/state)=0">
					<script type="text/javascript">location.href="?rech=<xsl:value-of select="fiche/@doss"/>"</script>
				</xsl:if>
              <div id="ictete"/>
                            <div id="tete">
                <div class="np">
											<span class="pnom"><xsl:value-of select="fiche/identite/@prenom"/></span><xsl:text> </xsl:text><span class="nom"><xsl:value-of select="fiche/identite/@nom"/></span>
											&#160; 
				  				  <a href="javascript:setFav({fiche/@doss},true)" class="nofav" data-dos="{fiche/@doss}" title="Add this participant to my Favourites list"></a><a href="javascript:setFav({fiche/@doss},false)" class="fav" data-dos="{fiche/@doss}" title="Remove this participant from my Favourites list." style="display:none"></a>
				  					  <a href="javascript:setComp({fiche/@doss},true)" data-dos="{fiche/@doss}" class="nocomp" title="Add this participant to my comparison list"></a><a href="javascript:setComp({fiche/@doss},false)" data-dos="{fiche/@doss}" class="comp" title="Remove this participant from my comparison list" style="display:none"></a>
				  				  <xsl:if test="fiche/state/@code='nl'">
					<a href="tableauFantome.php?bib={fiche/@doss}" target="ghost" class="ghost" title="See my LiveRun ghost timetable"></a>
				  </xsl:if>
				  	
                </div>
                <div class="cat">
                  <div class="onglets">
					                    <div class="onglet"><span class="l"/><span class="r"/><div class="fl"/><a href="#detfc"><b id="txtfc1">Runner's info</b><xsl:if test="count(fiche/palm/e)!=0"><b id="txtfc2" style="display:none">Results</b></xsl:if></a></div>
                                        <xsl:choose>
						<xsl:when test="string(fiche/identite/@photo)!=''"><img src="{fiche/identite/@photo}" style="width:46px;height:46px;margin:2px;"/></xsl:when>
						<xsl:when test="string(fiche/identite/@ph)!=''"><img src="https://res.cloudinary.com/utmb-world/image/upload/q_auto/f_auto/c_fill,g_auto/c_scale,w_200/v1/worldseries/Members/{fiche/identite/@ph}" style="width:46px;height:46px;margin:2px;"/></xsl:when>
					</xsl:choose>
                  </div>
                  Bib 
                  <xsl:choose>
                  	<xsl:when test="string(fiche/@nd)=''">
	                  <xsl:value-of select="fiche/@doss"/>
	                </xsl:when>
	                <xsl:otherwise>not affected</xsl:otherwise>
                  </xsl:choose>
                  &#160; <xsl:value-of select="courses/c[@id=/d/fiche/@c]/@nc"/> - <xsl:value-of select="fiche/identite/@cat"/>
                                  </div>
              </div>
              <div id="fintete"/>
              <div id="detfc">
                <div class="col2">
                  <table>
                    <tr>
                      <th colspan="2"><span class="pnom"><xsl:value-of select="fiche/identite/@prenom"/></span><xsl:text> </xsl:text><span class="nom"><xsl:value-of select="fiche/identite/@nom"/></span></th>
                    </tr>
                    <xsl:if test="string(fiche/identite/@relai) != ''">
                      <tr>
                        <td>Team members :</td>
                        <td>
                          <xsl:for-each select="fiche/relai/c">
                            <xsl:variable name="fccoeq">
							  								<span class="pnom"><xsl:value-of select="@prenom"/></span><xsl:text> </xsl:text><span class="nom"><xsl:value-of select="@nom"/></span>
								                            </xsl:variable>
                            <xsl:choose>
                              <xsl:when test="string(@running)='1'"><b><xsl:value-of select="$fccoeq"/></b></xsl:when>
                              <xsl:otherwise><xsl:value-of select="$fccoeq"/></xsl:otherwise>
                            </xsl:choose>
                            <br/>
                          </xsl:for-each>&#160;
                        </td>
                      </tr>
                    </xsl:if>
                    <tr>
                      <td>Gender :</td>
                      <td>
						<xsl:choose>
							<xsl:when test="fiche/identite/@sx='F'">Women</xsl:when>
							<xsl:when test="fiche/identite/@sx='H'">Men</xsl:when>
						</xsl:choose>
                      </td>
                    </tr>
                    <tr>
                      <td>Category :</td>
                      <td><xsl:value-of select="fiche/identite/@cat"/> <xsl:if test="string(fiche/identite/@descat)!=''"> (<xsl:value-of select="fiche/identite/@descat"/>)</xsl:if></td>
                    </tr>
                                                                                  <tr>
                        <td>Nationality :</td>
                        <td>
															<xsl:if test="string(fiche/identite/@a3)!=''">
									<span style="font-size:0.5em;text-align:center;font-weight:normal">
										<img src="im/flags/{translate(fiche/identite/@a2, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')}.png" height="40"/>
									</span><br/>
								</xsl:if>
															<xsl:choose>
								<xsl:when test="string(fiche/identite/@cio)!='' and string(fiche/identite/@nat)!=''"><xsl:value-of select="fiche/identite/@cio"/> (<xsl:value-of select="fiche/identite/@nat"/>)</xsl:when>
								<xsl:when test="string(fiche/identite/@cio)!=''"><xsl:value-of select="fiche/identite/@cio"/></xsl:when>
								<xsl:when test="string(fiche/identite/@nat)!=''"><xsl:value-of select="fiche/identite/@nat"/></xsl:when>
							</xsl:choose>
						</td>
                      </tr>
                                        					  <xsl:if test="string(fiche/identite/@ville)!=''">
						<tr>
							<td>City :</td>
							<td>
								<xsl:if test="string(fiche/identite/@cp)!=''">
									<xsl:value-of select="string(fiche/identite/@cp)"/><xsl:text> </xsl:text>
								</xsl:if>
								<xsl:value-of select="string(fiche/identite/@ville)"/>
							</td>
						</tr>
					  </xsl:if>
					  <xsl:if test="string(fiche/identite/@pays)!=''">
						<tr>
							<td>Country :</td>
							<td>
								<xsl:value-of select="string(fiche/identite/@pays)"/>
							</td>
						</tr>
					  </xsl:if>
                                        		    <xsl:if test="string(fiche/antecedents) != ''">
                      <tr>
                        <td>Sport events already done :<br/><span class="pt"> (Indicative and not exhaustive)</span></td>
                        <td><xsl:value-of select="string(fiche/antecedents)"/></td>
                      </tr>
		    </xsl:if>
                    										<xsl:if test="string(fiche/divers1) != ''">
					<tr>
						<td>State :</td>
						<td>
							<xsl:choose>
								<xsl:when test="starts-with(fiche/divers1, 'http')">
									<a href="{string(fiche/divers1)}" target="_blank"><xsl:value-of select="string(fiche/divers1)"/></a>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="string(fiche/divers1)"/>
								</xsl:otherwise>
							</xsl:choose>
													</td>
					</tr>
				</xsl:if>
					                                                              </table>
                    </div>
                    <div class="col2">
						<xsl:choose>
							<xsl:when test="string(fiche/identite/@photo)!=''">
								<xsl:attribute name="style">min-height:280px;</xsl:attribute>
								<img src="{fiche/identite/@photo}" id="photoident"/>
							</xsl:when>
							<xsl:when test="string(fiche/identite/@ph)!=''">
								<xsl:attribute name="style">min-height:280px;</xsl:attribute>
								<img id="photoident" src="https://res.cloudinary.com/utmb-world/image/upload/q_auto/f_auto/c_fill,g_auto/c_scale,w_200/v1/worldseries/Members/{fiche/identite/@ph}"/>
							</xsl:when>
						</xsl:choose>
                      <table>
                                                              <xsl:if test="count(fiche/palm/e)!=0">
                      <tr><th colspan="2">Results <xsl:if test="string(fiche/palm/@cote)!=''"><span class="utmbindex" style="float:right;"><xsl:value-of select="fiche/palm/@cote"/></span></xsl:if></th></tr>
                      <tr><td colspan="2">
                        <div id="palm" class="sb" >
                          <ul>
                            <xsl:for-each select="fiche/palm/e">
                              <li><span class="crefpos"><xsl:value-of select="@pos" />°</span><xsl:if test="string(@cltsx)!=''"><xsl:text> </xsl:text><span class="crefpos">(<xsl:value-of select="@cltsx" />° woman)</span></xsl:if><xsl:text> </xsl:text><span class="creftps">(<xsl:value-of select="@tps" />)</span> on <span class="crefcrs" style="text-transform:capitalize"><xsl:value-of select="@race" /><xsl:text> </xsl:text><xsl:value-of select="@year" /><xsl:if test="number(@dist)&gt;0"><xsl:text> </xsl:text>(<xsl:value-of select="@dist" />km)</xsl:if></span></li>
                            </xsl:for-each>
                          </ul>
                        </div>
                      </td></tr>
                      </xsl:if>                
                      <xsl:for-each select="fiche/relai/c">
						  <xsl:if test="count(palm/e)!=0">
							  <tr><th colspan="2">
								Results 											<xsl:value-of select="@prenom"/><xsl:text> </xsl:text><xsl:value-of select="@nom"/>
																					<xsl:if test="string(@cot)!=''"><span class="utmbindex" style="float:right;"><xsl:value-of select="@cot"/></span></xsl:if>
							  </th></tr>
							  <tr><td colspan="2">
								<div id="palm" class="sb" >
								  <ul>
									<xsl:for-each select="palm/e">
									  <li><span class="crefpos"><xsl:value-of select="@pos" />°</span><xsl:if test="string(@cltsx)!=''"><xsl:text> </xsl:text><span class="crefpos">(<xsl:value-of select="@cltsx" />° woman)</span></xsl:if><xsl:text> </xsl:text><span class="creftps">(<xsl:value-of select="@tps" />)</span> on <span class="crefcrs" style="text-transform:capitalize"><xsl:value-of select="@race" /><xsl:text> </xsl:text><xsl:value-of select="@year" /><xsl:if test="number(@dist)&gt;0"><xsl:text> </xsl:text>(<xsl:value-of select="@dist" />km)</xsl:if></span></li>
									</xsl:for-each>
								  </ul>
								</div>
							  </td></tr>
							</xsl:if>
					  </xsl:for-each>  
                                        </table>
                  		                  </div>
                <div class="degbas"></div>
              </div>
                            <div id="fc">
			<div id="addon">
								<a href="#" class="info" onclick="$('#tete .onglet').first().click();return false;">
					<xsl:attribute name="title">Runner's info<xsl:if test="count(fiche/palm/e)!=0"> / Results</xsl:if></xsl:attribute>
					Infos					<xsl:if test="count(fiche/palm/e)!=0">Palmares</xsl:if>
				</a>
				
				<xsl:if test="fiche/state/@code='nl'">
					<a href="tableauFantome.php?bib={fiche/@doss}" target="ghost" class="iconGhost" title="See my LiveRun ghost timetable">Ghost Runner</a>
				</xsl:if>
				
				
				<xsl:if test="string(fiche/@dipl)!=''">
						<a>
							<xsl:attribute name="href">
								<xsl:choose>
									<xsl:when test="string(fiche/@dipl) = '1'">coureurDiplome.php?dossard=<xsl:value-of select="fiche/@doss"/></xsl:when>
									<xsl:otherwise><xsl:value-of select="string(fiche/@dipl)"/>&amp;language=EN</xsl:otherwise>
								</xsl:choose>
							</xsl:attribute>
							<xsl:if test="string(fiche/@dipl) != '1'"><xsl:attribute name="target">_blank</xsl:attribute></xsl:if>
							<div id="dipl"></div>
							Certif.						</a>
				</xsl:if>
									<xsl:if test="fiche/state/@code = 'f'">
						<script type="text/javascript">
							
						(function (d, s, id) {
							var js, fjs = d.getElementsByTagName(s)[0];
							if (d.getElementById(id)) { return; }
							js = d.createElement(s); js.id = id;
							js.src = "//connect.facebook.net/en_US/sdk.js";
							fjs.parentNode.insertBefore(js, fjs);
						}(document, 'script', 'facebook-jssdk'));

						window.fbAsyncInit = function () {
							var appId = '230991323691676';
							FB.init({
								appId: appId,
								xfbml: true,
								version: 'v2.9'
							});
						};
						function repl(txt) {
							txt=txt.replace(/#eventName#/g,"Georgia Death Race");
							txt=txt.replace(/#courseName#/g,"<xsl:value-of select="/d/courses/c[@id=/d/fiche/@c]/@n"/>");
							txt=txt.replace(/#courseShortName#/g,"<xsl:value-of select="/d/courses/c[@id=/d/fiche/@c]/@nc"/>");
							txt=txt.replace(/#nom#/g,"<xsl:value-of select="fiche/identite/@nom"/>");
							txt=txt.replace(/#prenom#/g,"<xsl:value-of select="fiche/identite/@prenom"/>");
							txt=txt.replace(/#clt#/g,"<xsl:value-of select="fiche/state/@clt"/>");
							txt=txt.replace(/#cltcat#/g,"<xsl:value-of select="fiche/state/@cltcat"/>");
							txt=txt.replace(/#tps#/g,"<xsl:value-of select="fiche/pass/e[position()=last()]/@tps"/>");
							txt=txt.replace(/#cat#/g,"<xsl:value-of select="fiche/identite/@cat"/>");
							return txt;
						}
						function pub_fb(){
							var ll=window.location.href;
							if (ll.indexOf("?") &gt; 0)
								ll=ll.substr(0,ll.indexOf("?"));
							ll+="?rech=<xsl:value-of select="fiche/@doss"/>";
							var texte=repl("#prenom# #nom# finished the race ! Rank #clt# (#cat# : rank #cltcat#), after #tps# of efforts !");
							var titre=repl("#eventName# - #courseName# : #prenom# #nom# is Finisher !");
							
							
							
							var FBDesc      = texte;
							var FBTitle     = titre;
							var FBLink      = ll;
							var FBPic       = 'http://livetrail.net/live/georgiadeathrace/images/fbimage.png';

							// Open FB share popup
							FB.ui({
								method: 'share_open_graph',
								action_type: 'og.shares',
								action_properties: JSON.stringify({
									object: {
										'og:url': FBLink,
										'og:title': FBTitle,
										'og:description': FBDesc,
										'og:image': FBPic
									}
								})
							})
							
							//window.open("https://www.facebook.com/dialog/share?app_id=230991323691676&amp;description="+encodeURIComponent(texte)+"&amp;redirect_uri=http://www.livetrail.net/autoclose.php&amp;name="+encodeURIComponent(titre)+"&amp;title="+encodeURIComponent(titre)+"&amp;display=popup&amp;message="+encodeURIComponent(texte)+"&amp;link="+encodeURIComponent(ll)+"&amp;picture="+encodeURIComponent("http://livetrail.net/live/georgiadeathrace/images/fbimage.png"),"Share","toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,width=640,height=340");
						}
						function pub_tw() {
							var ll=window.location.href;
							if (ll.indexOf("?") &gt; 0) ll=ll.substr(0,ll.indexOf("?")-1);
							ll+="?rech=<xsl:value-of select="fiche/@doss"/>";
							var texte=repl("#eventName# : #prenom# #nom# finished the race #courseShortName# ! Rank #clt# (#cat# : rank #cltcat#) ; #tps# of efforts !");
							window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(texte+"\n")+"&amp;url="+encodeURIComponent(ll),"Share","toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,width=640,height=340");
						}
												</script>
						<div id="fb" onclick="pub_fb();" title="Share info on Facebook."></div>
						<div id="twitter" onclick="pub_tw();" title="Share info on Twitter."></div>
											</xsl:if>
													<a>
					<xsl:attribute name="href">reclam.php</xsl:attribute>
					<xsl:attribute name="title">Rédiger une réclamation</xsl:attribute>
					<xsl:attribute name="id">reclamation</xsl:attribute>
					Contact
				</a>
			</div>
                <table class="resume">
                  <tr>
                    <td>
                      <div style="font-weight:bold">
                        <label>Status</label><br/>
                        <xsl:choose>
                          <xsl:when test="fiche/state/@code = 'f'"><b>Finisher</b></xsl:when>
                          <xsl:when test="fiche/state/@code = 'f2'"><b>Ranked</b></xsl:when>
                          <xsl:when test="fiche/state/@code = 'fe'">End&#160;of&#160;stage</xsl:when>
                          <xsl:when test="fiche/state/@code = 's'">Stopped by the organisers</xsl:when>
                          <xsl:when test="fiche/state/@code = 'hd'">Exceed cut-off time</xsl:when>
                          <xsl:when test="fiche/state/@code = 'a'">Withdrawn</xsl:when>
                          <xsl:when test="fiche/state/@code = 'd'">Disqualified by the organisers</xsl:when>
                          <xsl:when test="fiche/state/@code = 'u'">Unranked</xsl:when>
                          <xsl:when test="fiche/state/@code = 'np'">"DNS"</xsl:when>
                          <xsl:when test="fiche/state/@code = 'nl'">Race&#160;not&#160;started</xsl:when>
                          <xsl:otherwise>In&#160;race...</xsl:otherwise>
                        </xsl:choose>
                                              </div>
                    </td>
                    <xsl:if test="count(fiche/infopub)&gt;0 or count(fiche/pena/e)&gt;0">
                      <td><div>
                        <xsl:if test="string(fiche/infopub/@pena)!=''">
                          <xsl:choose>
                            <xsl:when test="number(fiche/infopub/@pena) &gt; 0"><label>Penalty</label><br/></xsl:when>
                            <xsl:otherwise><label>Bonus</label><br/></xsl:otherwise>
                          </xsl:choose>
						  <xsl:choose>
                            <xsl:when test="fiche/infopub/@pena &gt; 0"><xsl:value-of select="format-number(number(fiche/infopub/@pena) div 60, '#.##')"/></xsl:when>
                            <xsl:otherwise><xsl:value-of select="format-number(0 - number(fiche/infopub/@pena) div 60, '#.##')"/></xsl:otherwise>
                          </xsl:choose> minutes<br/>
                        </xsl:if>
                        <xsl:if test="count(fiche/pena/e)&gt;0">
						  <ul class="subpena">
                          <xsl:for-each select="fiche/pena/e">
						  	<xsl:variable name="penaidpt" select="@idpt"/>
							<li><xsl:value-of select="/d/fiche/pts/pt[number(@idpt) = $penaidpt]/@nc"/>
								:
								<xsl:choose>
									<xsl:when test="@p &gt; 0">+<xsl:call-template name="hour2time"><xsl:with-param name="h" select="@p div 3600"/></xsl:call-template></xsl:when>
									<xsl:otherwise>-<xsl:call-template name="hour2time"><xsl:with-param name="h" select="0 - @p div 3600"/></xsl:call-template></xsl:otherwise>
								</xsl:choose>
							</li>
						  </xsl:for-each>
						  </ul>
                        </xsl:if>
                        <xsl:copy-of select="fiche/infopub/child::node()"/>
                      </div></td>
                    </xsl:if>
                    <xsl:if test="fiche/state/@code != 'np' and fiche/state/@code != 'nl'">
						 <xsl:if test="fiche/state/@code != 'u' and fiche/state/@code != 'd'">
						  <xsl:choose>
							<xsl:when test="string(fiche/state/@clt)!=''">
								  <td><div>
									<label>Rank</label><br/>
									<xsl:value-of select="fiche/state/@clt"/>
																	  </div></td>
							  <xsl:if test="string(fiche/state/@cltsx)!=''">
								  <td><div>
									<label>Rank <xsl:value-of select="fiche/identite/@sx"/></label><br/>
									<xsl:value-of select="fiche/state/@cltsx"/>
																	  </div></td>
							  </xsl:if>
							  <xsl:if test="string(fiche/identite/@cat)!=''">
								  <td><div>
									<label>Rank <xsl:value-of select="fiche/identite/@cat"/></label><br/>
									<xsl:value-of select="fiche/state/@cltcat"/>
																	  </div></td>
							  </xsl:if>
							</xsl:when>
							<xsl:when test="string(/d/fiche/pass/e[last()]/@clt)!=''">
								<td><div>
									<label>Rank</label><br/>
									<xsl:value-of select="/d/fiche/pass/e[last()]/@clt"/>
								</div></td>
							</xsl:when>
						  </xsl:choose>
						 </xsl:if>
                      <td><div>
                        <label>Last timing point</label><br/>
                        <xsl:call-template name="fmt-dtjt">
                          <xsl:with-param name="j" select="$lastpass/@ja" />
                          <xsl:with-param name="t" select="$lastpass/@ha" />
                        </xsl:call-template>
                        &#160;
                        <xsl:value-of select="fiche/pts/pt[number(@idpt) = number($lastpass/@idpt)]/@n"/>
                      </div></td>
                      <td><div>
                        <label>Race time</label><br/>            
							<xsl:choose>
								<xsl:when test="(fiche/state/@code = 'c' ) and (number(fiche/@finishc) = 0 or fiche/@finishc='')" >
									<xsl:if test="string($lastpass/@tpsr)!=''">Official&#160;:&#160;</xsl:if>
									<span class="timer" style="background-color:transparent" ><span id="tim1"></span></span>
									<xsl:if test="string($lastpass/@tpsr)!=''"><br/>Real&#160;:&#160;<span class="timer" style="background-color:transparent"><span id="tim2"></span></span></xsl:if>
									<script type="text/javascript">
										$(function() {
											<xsl:choose>
												<xsl:when test="count(fiche/resumeEtp/e)">
													var dt=dtsql2js("<xsl:value-of select="fiche/resumeEtp/e[string(@dthd)][last()]/@dthd"/>");
													var timePreviousStages = 0 <xsl:for-each select="fiche/resumeEtp/e">+<xsl:value-of select="@tn"/></xsl:for-each>;
													dt = new Date(dt.getTime() - timePreviousStages * 3600000);
												</xsl:when>
												<xsl:otherwise>
													var dt=dtsql2js("<xsl:value-of select="concat(fiche/pass/e[number(@idpt)=0]/@date,' ')"/> <xsl:value-of select="fiche/pass/e[number(@idpt)=0]/@hd"/>");
												</xsl:otherwise>
											</xsl:choose>
											
											$("#tim1").countdown({since:dt,format:'HMS', layout:'{hn}{sep}{mnn}{sep}{snn}', timezone:<xsl:value-of select="fiche/pass/e[number(@idpt)=0]/@tz"/>});
											<xsl:if test="string($lastpass/@tpsr)!=''">
											var dt2=dtsql2js("<xsl:value-of select="concat(fiche/pass/e[number(@idpt)=0]/@date,' ')"/> <xsl:value-of select="fiche/pass/e[number(@idpt)=0]/@hdr"/>");
											$("#tim2").countdown({since:dt2,format:'HMS', layout:'{hn}{sep}{mnn}{sep}{snn}', timezone:<xsl:value-of select="fiche/pass/e[number(@idpt)=0]/@tz"/>});
											</xsl:if>
										});
									</script>
							
								</xsl:when>
								<xsl:otherwise>
									<xsl:if test="string($lastpass/@tpsr)!=''">Official&#160;:&#160;</xsl:if>
									<xsl:choose>
										<xsl:when test="(fiche/state/@code = 'f') or count(fiche/pena/e) = 0">
											<xsl:value-of select="$lastpass/@tps"/>
										</xsl:when>
										<xsl:otherwise>
											<xsl:call-template name="hour2time"><xsl:with-param name="h" select="$lastpass/@tn + (sum(/d/fiche/pena/e/@p) div 3600)"/></xsl:call-template>
										</xsl:otherwise>
									</xsl:choose>
									
									<xsl:if test="string($lastpass/@tpsr)!=''"><br/>Real&#160;:&#160;<xsl:value-of select="$lastpass/@tpsr"/></xsl:if>
								</xsl:otherwise>
							</xsl:choose>       
                      </div></td>
                      <xsl:if test="(fiche/state/@code = 'c' or fiche/state/@code = 'u') and count(fiche/prev/e[number(@idpt) &gt; number($lastpass/@idpt)])&gt;0">
                        <td><div>
                          <label>Next timing point</label><br/>
                          <xsl:variable name="nextp" select="fiche/prev/e[number(@idpt) &gt; number($lastpass/@idpt)][1]" />
                          <xsl:choose>
                            <xsl:when test="count($nextp) = 0">
                              <span title="This participant has not left the last timing point. Information will be available when leaving">Not available</span>
                            </xsl:when>
                            <xsl:otherwise>
                              <span title="Time estimated based on the previous section.">
																	<xsl:for-each select="fiche/prev/e">
										<xsl:variable name="nidpt" select="@idpt" />
										<xsl:call-template name="fmt-dtjt">
										  <xsl:with-param name="j" select="@j" />
										  <xsl:with-param name="t" select="@h" />
										</xsl:call-template>
										&#160;
										<xsl:value-of select="/d/fiche/pts/pt[@idpt = $nidpt]/@n"/>
										<br/>
									</xsl:for-each>
								                              </span>
                            </xsl:otherwise>
                          </xsl:choose>
                        </div></td>
                                              </xsl:if>
                      						  <xsl:if test="fiche/state/@code = 'f'">
							  <td><div>
								<label>Speed</label><br/>
								<span>
								<xsl:variable name="kmall"><xsl:call-template name="getoverallkm"><xsl:with-param name="pts" select="fiche/pts" /><xsl:with-param name="idx" select="1" />
								</xsl:call-template></xsl:variable>
								  <xsl:call-template name="calc-vit">
									<xsl:with-param name="dist"  select="$kmall" />
									<xsl:with-param name="tps" select="number($lastpass/@tn)" />
									<xsl:with-param name="pace" select="'0'" />
								  </xsl:call-template> mph								  <xsl:if test="string($lastpass/@tpsr)!=''">
									<br/>
									<xsl:call-template name="calc-vit">
										<xsl:with-param name="dist"  select="$kmall" />
										<xsl:with-param name="tps" select="number($lastpass/@tnr)" />
										<xsl:with-param name="pace" select="'0'" />
									</xsl:call-template> mph								  </xsl:if>  
								</span>
							  </div></td>
						  </xsl:if>
						                      </xsl:if>
                                      </tr>
                  <xsl:if test="count(fiche/resumeEtp/e) &gt; 0">
                  <xsl:if test="count(fiche/resumeEtp/e) &gt; 6">
                  	<tr id="detStageBtn"><td colspan="6" style="text-align:center">
                  		<a href="#" onclick="$('#detailStages').slideDown(); $('#detStageBtn').hide(); return false;">Display stages details</a>
                  	</td></tr>
                  </xsl:if>
                  <tfoot id="detailStages">
                  <xsl:if test="count(fiche/resumeEtp/e) &gt; 6">
                  	<xsl:attribute name="style">display: none;</xsl:attribute>
                  </xsl:if>
                  <xsl:for-each select="fiche/resumeEtp/e">
                  <tr>
					<td>
                      <div style="font-weight:bold;font-size:1em;border-top-width:1px;font-style:italic">
						  <xsl:value-of select="@name"/>
                      </div>
                    </td>
                    <xsl:if test="count(/d/fiche/infopub)&gt;0"><td>&#160;</td></xsl:if>
                    
                    <xsl:if test="/d/fiche/state/@code != 'np' and /d/fiche/state/@code != 'nl'">
                      <xsl:choose>
						<xsl:when test="string(/d/fiche/state/@clt)!='' and /d/fiche/state/@code !='u'">
							<td><div style="font-size:1em;border-top-width:1px;font-style:italic">
								<xsl:value-of select="@clt"/>
							</div></td>
							<xsl:if test="string(/d/fiche/state/@cltsex)!=''">
								<td><div style="font-size:1em;border-top-width:1px;font-style:italic">
									<xsl:value-of select="@cltsex"/>
								</div></td>
							</xsl:if>
							<xsl:if test="string(/d/fiche/identite/@cat)!=''">
								<td><div style="font-size:1em;border-top-width:1px;font-style:italic">
									<xsl:value-of select="@cltcat"/>
								</div></td>
							</xsl:if>
						</xsl:when>
						<xsl:when test="string(/d/fiche/pass/e[last()]/@clt)!='' and /d/fiche/state/@code !='u'">
							<td><div style="font-size:1em;border-top-width:1px;font-style:italic">
								<xsl:value-of select="@clt"/>
							</div></td>
						</xsl:when>
                      </xsl:choose>
                      <xsl:if test="string(/d/fiche/state/@cltsex)!=''">
							<td> </td>
					  </xsl:if>
                      <td> </td>
                      <td><div style="font-size:1em;border-top-width:1px;font-style:italic">
                        <xsl:value-of select="@tps"/>
                      </div></td>
                      						  	  <td><div style="font-size:1em;border-top-width:1px;font-style:italic">
								  <xsl:if test="string(@tps)!=''">
									<xsl:call-template name="calc-vit">
										<xsl:with-param name="dist" select="10 * ((@dist div 10) div 1.609344)" />
										<xsl:with-param name="tps" select="number(@tn)" />
										<xsl:with-param name="pace">
											<xsl:choose>
												<xsl:when test="@unit='minp100'">2</xsl:when>
												<xsl:when test="@unit='minpkm'">1</xsl:when>
												<xsl:otherwise>0</xsl:otherwise>
											</xsl:choose>
										</xsl:with-param>
									  </xsl:call-template>
									  <xsl:choose>
										<xsl:when test="@unit='minp100'"><xsl:text> / 100m</xsl:text></xsl:when>
										<xsl:when test="@unit='minpkm'"> / mile</xsl:when>
										<xsl:otherwise> mph</xsl:otherwise>
									  </xsl:choose>
									  
								  </xsl:if>
							  </div></td>
						                      </xsl:if>
                  </tr>
                </xsl:for-each>
                </tfoot>
                </xsl:if>
                  
                </table>
                
                <div id="mediaCont">
                				  <div id="sepZone"></div>
				  			  </div>
			  <div class="vues">
					<xsl:if test="string(fiche/@nocarto)!='1'">
						<div class="sel">
							<a class="prof bgcol" href="javascript:chgvue('prof')" title="See race profile"/><a class="color" href="javascript:chgvue('prof')">PROFIL</a>
						</div>
					</xsl:if>
					<div>
						<xsl:if test="string(fiche/@nocarto)='1'"><xsl:attribute name="class">sel</xsl:attribute></xsl:if>
						<a class="tab bgcol" href="javascript:chgvue('tab')" title="Table of the passing timing points"/><a class="color" href="javascript:chgvue('tab')">TABLE</a>
					</div>
					<xsl:if test="string(fiche/@nocarto)!='1'">
						<xsl:if test="string(fiche/ybtrack)!=''">
							<style>
								#fc .vues a.carto {
								  background:url(im/ybtrack.png) center center no-repeat #cccccc;
								  background-color:transparent !important;
								}
								#fc .vues a.carto:hover, #fc .vues .sel a.carto {
									background-color:white;
									background-position:center center;
								}
							</style>
						</xsl:if>
						<xsl:if test="string(fiche/dotvision)!=''">
							<style>
								#fc .vues a.carto {
								  background-position:-164px -48px;
								  background-color:transparent !important;
								}
								#fc .vues a.carto:hover, #fc .vues .sel a.carto {
									background-color:white;
									background-position:-164px -48px;
								}
							</style>
						</xsl:if>
						<div><a class="carto bgcol" href="javascript:chgvue('carto')" title="See maps of the race"/><a class="color" href="javascript:chgvue('carto')">MAP</a></div>
					</xsl:if>
														</div>
                <div id="contvues"><div>
		  <xsl:if test="string(fiche/@nocarto)!='1'">
                  <div id="prof" class="vue">
					<div style="position:relative" >
						<div id="beforeProf"></div>
						<div id="infosProfilFlech"></div>
						<div id="infosProfil">
						  <table data="details_pass" class="sumup up rmargin">
							<tr>
							  <th>Time of the day</th>
							  <td data="hp"></td>
							  </tr>
							  <tr>
							  <th>Race time</th>
							  <td data="tc"></td>
							  </tr>
							  <xsl:if test="string(fiche/state/@clt)!=''">				  <tr>
							  <th>Points ranking</th>
							  <td data="clt"></td>
							  </tr>
				  </xsl:if>				  							  <tr>
							  <th>Speed</th>
							  <td data="vit"></td>
							  </tr>
				  						  </table>
						  <table class="sumup up">
							<tr>
							<th>Altitude</th>
							<td data="a" ></td>
							</tr>
							<tr>
							<th>Dist. from start</th>
							<td data="kmt" ></td>
							</tr>
						  <tr>
							<th><input type="hidden" data="n-1km" value="Dist. from" /><label data="n-1km"></label></th>
							<td data="kmp" ></td>
						  </tr>
							<tr>
							<th>Elevation gain from start</th>
							<td data="dt" ></td>
							</tr>
							<tr>
							  <th><input type="hidden" data="n-1d" value="Elevation gain from" /><label data="n-1d"></label></th>
							  <td data="dp" ></td>
							</tr>
						  </table>
						  <div class="title" ></div>
						</div>
						<div id="profil">
						  <img src="images/profil_{/d/fiche/@c}.png?v="/>
						  <xsl:for-each select="fiche/pts/pt">
							<xsl:variable name="profidpt" select="@idpt"/>
							<xsl:variable name="profpassc" select="/d/fiche/pass/e[@idpt=$profidpt]"/>
							  <div data="{$profidpt}" style="top:{number(@py)}%;left:{number(@px)}%;transform:translate(-7px,-7px);">
								<xsl:attribute name="class">
								  <xsl:choose>
									<xsl:when test="@meet = 1">pts meet </xsl:when>
									<xsl:otherwise>pts </xsl:otherwise>
								   </xsl:choose>
								   <xsl:if test="/d/fiche/state/@code != 'nl' and /d/fiche/state/@code != 'np' and count($profpassc) &gt; 0"> passedPt </xsl:if>
								   <xsl:variable name="proflastpass" select="/d/fiche/pass/e[position()=last()]" />
								   <xsl:if test="(/d/fiche/state/@code != 'np' and /d/fiche/state/@code != 'nl' and $profidpt =$proflastpass/@idpt ) and not((/d/fiche/state/@code = 'c' or /d/fiche/state/@code = 'u' ) and count(/d/fiche/prev/e[number(@idpt) &gt; number($lastpass/@idpt)])&gt;0)"> lastPt</xsl:if>
								</xsl:attribute>
							  </div>
						  </xsl:for-each>
						  <xsl:choose>
							  <xsl:when test="(fiche/state/@code = 'c' or fiche/state/@code = 'u' ) and count(fiche/prev/e[number(@idpt) &gt; number($lastpass/@idpt)])&gt;0">
								  <xsl:variable name="nextpdist" select="fiche/prev/e[number(@idpt) &gt; number($lastpass/@idpt)][1]" />
								  <div class='lastPoint' data="{$nextpdist/@km}" ></div>
							  </xsl:when>
							 
						  </xsl:choose>
						</div>
                    </div>
                    
						<xsl:variable name="crs" select="/d/fiche/@c"/>
							
						<script type="text/javascript">
							
							var lstcrs=["<xsl:value-of select="$crs"/>"];
							var mypts={};
							var coureurs={};
							var data={};
							var lines={};
							var tmp,tmp2;
							//var lastidpt=0;
							isGraphFC=true;
												
							lines["<xsl:value-of select="$crs"/>"]=Array();
							lines["<xsl:value-of select="$crs"/>"].push(0);
							mypts["<xsl:value-of select="$crs"/>"]=Array();
							mypts["<xsl:value-of select="$crs"/>"]["0"]="<xsl:value-of select="/d/fiche/pts/pt[1]/@nc"/>";
							data["<xsl:value-of select="$crs"/>"]=Array();
							data["<xsl:value-of select="$crs"/>"].push({ x:0 });
							<xsl:for-each select="/d/fiche/pts/pt">
								<xsl:variable name="pospt" select="position()"/>
								<xsl:variable name="idpt" select="@idpt"/>
								<xsl:if test="$pospt &gt; 1">
									<xsl:variable name="ptprec" select="/d/fiche/pts/pt[($pospt - 1)]"/>
									<xsl:variable name="curpt" select="/d/fiche/pts/pt[($pospt)]"/>
									lines["<xsl:value-of select="$crs"/>"].push(<xsl:value-of select="10 * ((@km div 10) div 1.609344)"/>);
									mypts["<xsl:value-of select="$crs"/>"][""+(<xsl:value-of select="10 * (($ptprec/@km div 10) div 1.609344)"/>+(<xsl:value-of select="10 * ((@km div 10) div 1.609344)"/>-<xsl:value-of select="10 * (($ptprec/@km div 10) div 1.609344)"/>)/2)]="<xsl:value-of select="$ptprec/@nc"/> - <xsl:value-of select="@nc"/>";
									mypts["<xsl:value-of select="$crs"/>"]["<xsl:value-of select="10 * ((@km div 10) div 1.609344)"/>"]="<xsl:value-of select="@nc"/>";
									tmp={x:(<xsl:value-of select="10 * (($ptprec/@km div 10) div 1.609344)"/>+(<xsl:value-of select="10 * ((@km div 10) div 1.609344)"/>-<xsl:value-of select="10 * (($ptprec/@km div 10) div 1.609344)"/>)/2)};
									tmp2={x:<xsl:value-of select="10 * (($curpt/@km div 10) div 1.609344)"/>};
									
									<xsl:if test="count(/d/fiche/pass/e[@idpt=$idpt]) &gt; 0">
																				<xsl:if test="(10 * (($curpt/@km div 10) div 1.609344) - 10 * (($ptprec/@km div 10) div 1.609344)) &gt; 0">
											<xsl:variable name="pospt2">
											  <xsl:for-each select="/d/fiche/pass/e">
												<xsl:if test="@idpt = $idpt"><xsl:value-of select="position()"/></xsl:if>
											  </xsl:for-each>
											</xsl:variable>
											<xsl:if test="number(/d/fiche/pass/e[position()=$pospt2]/@tnp) != 0">
												tmp.s0=<xsl:call-template name="calc-kmh">
																				<xsl:with-param name="idpt" select="$idpt" />
																				<xsl:with-param name="pts" select="/d/fiche/pts/pt" />
																				<xsl:with-param name="pass" select="/d/fiche/pass/e" />
																				<xsl:with-param name="js" select="'1'" />
																			</xsl:call-template>;
											</xsl:if>
										</xsl:if>
																				tmp2.r0=<xsl:value-of select="/d/fiche/pass/e[@idpt=$idpt]/@clt"/>;
									</xsl:if>
									
									data["<xsl:value-of select="$crs"/>"].push(tmp);
									data["<xsl:value-of select="$crs"/>"].push(tmp2);
								</xsl:if>
							</xsl:for-each>
							coureurs["<xsl:value-of select="$crs"/>"]=Array();
							coureurs["<xsl:value-of select="$crs"/>"].push("<xsl:value-of select="/d/fiche/identite/@prenom"/><xsl:text> </xsl:text><xsl:value-of select="/d/fiche/identite/@nom"/>");
							
							var libs={r:[],s:[],a:[]};
							libs["r"][0]=" ";
							libs["r"][1]=" : ";
							libs["r"][2]="°";
							libs["s"][0]=" ";
							libs["s"][1]=" : ";
							libs["s"][2]="mph";
							libs["a"][0]=" ";
							libs["a"][1]=" : ";
							libs["a"][2]="min/mile";
							
							var labfmt={r:[],s:[],a:[]};
							labfmt["r"][0]=" ";
							labfmt["r"][1]="°";
							labfmt["s"][0]=" ";
							labfmt["s"][1]="mph";
							labfmt["a"][0]=" ";
							labfmt["a"][1]="min";
							
							$(function() {
								initAllGraph("s");
							});
						</script>
						<style>
							div.choiceChart {
								text-align:left;
								padding-left:50px;
							}
							div.choiceChart input:empty {
								opacity:0.001;
								position:absolute;
							}
							div.choiceChart label {
								display:relative;
								display:inline-block;
								padding-right:20px;
								border:none;
								font-size:1.2em;
								line-height: 1.2em;
								cursor:pointer;
								font-weight:normal;
								color:black;
								-webkit-user-select: none;
								-moz-user-select: none;
								-ms-user-select: none;
								user-select: none;
							}
							div.choiceChart input:checked + label {
								font-weight:bold;
								text-decoration:underline;
							}
							div.choiceChart input:not(:checked):hover + label {
								text-decoration:underline;
								color:black;
							}
							#tmpGPS { visibility:hidden; }
						</style>
						<div id="chart{$crs}" style="height:120px; width:850px;"></div>
						<div class="choiceChart">
							<input id="tcs" type="radio" name="typChart" value="s" checked="checked" onclick="initAllGraph(this.value);"/><label for="tcs">Speed</label>
							<input id="tca" type="radio" name="typChart" value="a" onclick="initAllGraph(this.value);"/><label for="tca">Pace</label>
							<input id="tcr" type="radio" name="typChart" value="r" onclick="initAllGraph(this.value);"/><label for="tcr">Rank</label>
						</div>
						                  </div>
		  </xsl:if>
                  <div id="tab" class="vue">
                    <div class="postit" style="top:40px;display:none;"></div>
                    <table class="tpass">
                      <tr class="up">
                        <th>Timing point</th>
                        							<th>Speed</th>
						                        <xsl:if test="string(fiche/pass/e[1]/@clt)!=''"><th>Rank</th></xsl:if>                                                <th>Time of the day</th>
                        <th>
							Race time							<xsl:if test="string(fiche/pass/e[1]/@tpsr)!=''">
								<br/>Official / Real                            </xsl:if>
                        </th>
                        <th>
								difference /<br/>1st							</th>                      </tr>
                      <xsl:for-each select="fiche/pts/pt">
                        <tr>
						  <xsl:attribute name="class">
							<xsl:if test="position() mod 2">odd </xsl:if>
							<xsl:if test="string(@sep)='1' and position()!=last()">sep</xsl:if>
                          </xsl:attribute>
                          <xsl:variable name="idpt" select="@idpt"/>
                          <xsl:variable name="passc" select="/d/fiche/pass/e[@idpt=$idpt]"/>
                                                    <td><span class="rig">
							  								<xsl:call-template name="fmt-i"><xsl:with-param name="v" select="@a * 3.28084"/></xsl:call-template> ft							  							  </span><a href="#" data="{$idpt}"><xsl:value-of select="@n"/></a></td>
                          
                          							  <td><span class="rig">
								<xsl:if test="/d/fiche/state/@code != 'nl' and /d/fiche/state/@code != 'np'">																<xsl:call-template name="calc-kmh">
									<xsl:with-param name="idpt" select="$idpt" />
									<xsl:with-param name="pts" select="/d/fiche/pts/pt" />
									<xsl:with-param name="pass" select="/d/fiche/pass/e" />
									<xsl:with-param name="pace">
										<xsl:choose>
											<xsl:when test="/d/fiche/pts/pt[number(@idpt) = $idpt]/@unit='minp100'">2</xsl:when>
											<xsl:when test="/d/fiche/pts/pt[number(@idpt) = $idpt]/@unit='minpkm'">1</xsl:when>
											<xsl:otherwise>0</xsl:otherwise>
										</xsl:choose>
									</xsl:with-param>								
								</xsl:call-template>
								<xsl:choose>
									<xsl:when test="/d/fiche/pts/pt[number(@idpt) = $idpt]/@unit='minp100'"><xsl:text> / 100m</xsl:text></xsl:when>
									<xsl:when test="/d/fiche/pts/pt[number(@idpt) = $idpt]/@unit='minpkm'"> / mile</xsl:when>
									<xsl:otherwise> mph</xsl:otherwise>
								  </xsl:choose>
								
								</xsl:if>							  </span></td>
						  						  <xsl:if test="string(/d/fiche/pass/e[1]/@clt)!=''">                          <td><span class="rig">
                          <xsl:choose>
                            <xsl:when test="/d/fiche/state/@code != 'nl' and /d/fiche/state/@code != 'np' and count($passc) &gt; 0">
                              <xsl:value-of select="$passc/@clt"/>
                            </xsl:when>
                            <xsl:otherwise>-</xsl:otherwise>
                          </xsl:choose>
                          </span></td>
			</xsl:if>                                                    <td>
                            <xsl:choose>
                              <xsl:when test="/d/fiche/state/@code != 'nl' and /d/fiche/state/@code != 'np' and count($passc) &gt; 0">
                                <xsl:if test="string($passc/@ha) != ''">
                                  <xsl:call-template name="fmt-dtjt">
                                    <xsl:with-param name="j" select="$passc/@ja" />
                                    <xsl:with-param name="t" select="$passc/@ha" />
                                  </xsl:call-template>
                                </xsl:if>
                                <xsl:if test="position()!=last() and string($passc/@ha) != '' and string($passc/@hd) != ''"> / </xsl:if>
                                <xsl:if test="position()!=last() and string($passc/@hd) != ''">
                                  <xsl:call-template name="fmt-dtjt">
                                    <xsl:with-param name="j" select="$passc/@jd" />
                                    <xsl:with-param name="t" select="$passc/@hd" />
                                  </xsl:call-template>
                                </xsl:if>
                                                              </xsl:when>
                                                            <xsl:otherwise>-</xsl:otherwise>
                            </xsl:choose>
                          </td>
                          <td><span class="rig">
                            <xsl:choose>
                              <xsl:when test="/d/fiche/state/@code != 'nl' and /d/fiche/state/@code != 'np' and count($passc) &gt; 0">
								<xsl:choose>
									<xsl:when test="count(/d/fiche/pena/e)&gt;0">
										<xsl:if test="count(/d/fiche/pena/e[@idpt = $idpt])&gt;0">
											<xsl:choose>
												<xsl:when test="/d/fiche/pena/e[@idpt = $idpt]/@p &lt; 0">
																										<span title="Bonus" style="color:#00bc0f;margin-right:20px;">-<xsl:call-template name="hour2time"><xsl:with-param name="h" select="0 - /d/fiche/pena/e[@idpt = $idpt]/@p div 3600"/></xsl:call-template></span>
												</xsl:when>
												<xsl:otherwise>
																										<span title="Penalty" style="color:#e11111;margin-right:20px;">+<xsl:call-template name="hour2time"><xsl:with-param name="h" select="/d/fiche/pena/e[@idpt = $idpt]/@p div 3600"/></xsl:call-template></span>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:if>
										<xsl:choose>
							  				<xsl:when test="$idpt != /d/fiche/pts/pt[last()]/@idpt">
												<xsl:call-template name="hour2time"><xsl:with-param name="h" select="$passc/@tn + (sum(/d/fiche/pena/e[@idpt &lt;= $idpt]/@p) div 3600)"/></xsl:call-template>
											</xsl:when>
											<xsl:otherwise>
												<xsl:value-of select="$passc/@tps"/>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="$passc/@tps"/>
									</xsl:otherwise>
								</xsl:choose>
								<xsl:if test="string($passc/@tpsr)!=''">
								// <xsl:value-of select="$passc/@tpsr"/>
								</xsl:if>
                              </xsl:when>
                              <xsl:otherwise>-</xsl:otherwise>
                            </xsl:choose>
                          </span></td>
							<td><span class="rig">
									<xsl:if test="string($passc/@tn) != '' and string(/d/best/e[@idpt=$idpt]/@tn) != ''">
										<xsl:choose>
											<xsl:when test="number(/d/best/e[@idpt=$idpt]/@tn) - number($passc/@tn) &gt; 0">
												-<xsl:call-template name="hour2time"><xsl:with-param name="h" select="(number(/d/best/e[@idpt=$idpt]/@tn) - number($passc/@tn))"/></xsl:call-template>
											</xsl:when>
											<xsl:otherwise>
												<xsl:call-template name="hour2time"><xsl:with-param name="h" select="(number($passc/@tn) - number(/d/best/e[@idpt=$idpt]/@tn))"/></xsl:call-template>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:if>
								</span></td>                        </tr>
                      </xsl:for-each>
                    </table>
                  </div>
		  <xsl:if test="string(fiche/@nocarto)!='1'">
                  <div id="carto" class="vue">
					  <xsl:choose>
						<xsl:when test="string(fiche/dotvision)!=''">
							<div id="div" class="divWindow">
								<iframe id="ifr" style="width:100%;height:100%" data-src="{fiche/dotvision}" src="about:blank"></iframe>
								<div id="fullscr"><a href="javascript:fullToggle();" title="full"><img src="im/fullScreen.png" border="0"/></a></div>
							</div>
						</xsl:when>
						<xsl:when test="string(fiche/ybtrack)!=''">
							<div id="div" class="divWindow">
								<iframe id="ifr" style="width:100%;height:100%" data-src="{fiche/ybtrack}" src="about:blank"></iframe>
								<div id="fullscr"><a href="javascript:fullToggle();" title="full"><img src="im/fullScreen.png" border="0"/></a></div>
							</div>
						</xsl:when>
						<xsl:when test="string(fiche/othergps)!=''">
							<div id="div" class="divWindow">
								<iframe id="ifr" style="width:100%;height:100%" data-src="{fiche/othergps}" src="about:blank"></iframe>
								<div id="fullscr"><a href="javascript:fullToggle();" title="full"><img src="im/fullScreen.png" border="0"/></a></div>
							</div>
						</xsl:when>
						<xsl:when test="string(fiche/nexxtep)!=''">
							<div id="div" class="divWindow">
								<iframe id="ifr" style="width:100%;height:100%" data-src="{fiche/nexxtep}" src="about:blank"></iframe>
								<div id="fullscr"><a href="javascript:fullToggle();" title="full"><img src="im/fullScreen.png" border="0"/></a></div>
							</div>
						</xsl:when>
						<xsl:otherwise>
							<script type="text/javascript">
								$(function(){
									$("#posTyp span").click(function(){
										var tt=$(this).data("typ");
										displayLoc(tt);
									});
								});
								function initMap() {
									initMap_<xsl:value-of select="/d/fiche/@c"/>();
									setTimeout('initOneMap(p_<xsl:value-of select="/d/fiche/@c"/>,b_<xsl:value-of select="/d/fiche/@c"/>);carte.on("click",function(event){$("#posTyp").hide();$("#posCode").hide();}); if(lastLoc &amp;&amp; lastLoc.minago&lt;30) {displayLoc("pg");}',1000); //test(event);
								}
								function choosePosTyp(e){
									$("#posTyp").show();
									e.stopPropagation();
								}
								function displayLoc(mode){
									<xsl:if test="count(/d/fiche/loc)&lt;=0">return false;</xsl:if>
									
									$("#posTyp span").removeClass("sel").removeClass("bgcol").addClass("color");
									var ms=$("#posTyp span[data-typ='"+mode+"']");
									ms.removeClass("color").addClass("sel").addClass("bgcol");
									$("#posTypBtn").val(ms.html());
										
									if (mode=="dpo") { //affiche dpo
										showDPO();
										hideGP();
										hideHisto();
										$("#posCode").hide();
									} else {
										hideDPO();
										if (mode=="pg"){
											showGP();
											hideHisto();
										}else {
											if (!histosloc){ //on a pas encore recup les data
												//crypte ?
												if (lastLoc.crypt=="1"){
													var code=getCookie('gpscode'+bib);
													if (code==null){
														$("#posCode").show();
														return;
													}
												}
												$.post("_gpshisto.php", "mode=getHistoLoc&amp;doss=<xsl:value-of select="fiche/@doss" />", function(resp) {
												  eval(resp);
												  showHisto(loc);
												  showGP();
											  });
										  } else {
											  showHisto(histosloc);
											  showGP();
										  }
										}
									}
								}
							</script>
							
							<div id="mapBox" style="position:relative">			
								<div id="map" class="_{/d/fiche/@c}">
									<xsl:if test="count(/d/fiche/loc)>=1">
										 <div class="leaflet-top leaflet-left " style="margin-left:50px">
											<input class="leaflet-control leaflet-bar mapBtn" type="button" id="posTypBtn" value="Last official position" onclick="choosePosTyp(event)" />
										</div>
	
									</xsl:if>
								</div>
									<div id="posTyp" style="display:none" class="leaflet-bar mapDialog" >
										<span data-typ="dpo" class="sel bgcol">Last official position</span>
										<hr/>
										<span data-typ="pg" class="color" >GPS position</span>
										<hr/>
										<span data-typ="hpg" class="color" >GPS positions history</span>
									</div>
									<div id="posCode" style="display:none" class="leaflet-bar mapDialog">
										<span class="help bgcol">?</span>
										<h3 class="color" >Private GPS Tracking</h3>
										<label>Access code</label>
										<input id="gpscodeInput" />
										<input type="button" onclick='enregGPSCode();' value="Validate" class="bgcol valid" />
									</div>
							</div>
							<div id="profil2" class="profil">
							  <img src="images/profil_{/d/fiche/@c}.png"/>
							  <xsl:for-each select="fiche/pts/pt">
								<xsl:variable name="profidpt" select="@idpt"/>
								<xsl:variable name="profpassc" select="/d/fiche/pass/e[@idpt=$profidpt]"/>
								  <div data="{$profidpt}" style="top:{number(@py)}%;left:{number(@px)}%;transform:translate(-7px,-7px);">
									<xsl:attribute name="class">
									  <xsl:choose>
										<xsl:when test="@meet = 1">pts meet </xsl:when>
										<xsl:otherwise>pts </xsl:otherwise>
									   </xsl:choose>
									   <xsl:if test="/d/fiche/state/@code != 'nl' and /d/fiche/state/@code != 'np' and count($profpassc) &gt; 0"> passedPt </xsl:if>
									   <xsl:variable name="proflastpass" select="/d/fiche/pass/e[position()=last()]" />
									   <xsl:if test="(/d/fiche/state/@code != 'np' and /d/fiche/state/@code != 'nl' and $profidpt =$proflastpass/@idpt ) and not((/d/fiche/state/@code = 'c' or /d/fiche/state/@code = 'u' ) and count(/d/fiche/prev/e[number(@idpt) &gt; number($lastpass/@idpt)])&gt;0)"> lastPt</xsl:if>
									</xsl:attribute>
								  </div>
							  </xsl:for-each>
							  <xsl:choose>
							  <xsl:when test="(fiche/state/@code = 'c' or fiche/state/@code = 'u' ) and count(fiche/prev/e[number(@idpt) &gt; number($lastpass/@idpt)])&gt;0">
								  <xsl:variable name="nextpdist" select="fiche/prev/e[number(@idpt) &gt; number($lastpass/@idpt)][1]" />
								  <div class='lastPoint' data="{$nextpdist/@km}" ></div>
							  </xsl:when>
							 
						  </xsl:choose>
							</div>
						</xsl:otherwise>
					  </xsl:choose>
					                    </div>
		  </xsl:if>
		                  </div>
                </div>
              </div>
              
            </xsl:when>
            <xsl:otherwise>
                            <div id="ictete"/>
              <div id="tete">
                <div class="np" style="margin-top:10px;text-transform:uppercase">Search a runner</div>
              </div>
              <div id="fintete"/>
              <div id="content">
				  <h3>Select this participant from the following list. (<xsl:value-of select="count(fiche)"/>)</h3>
				  <div id="scrollZone">
					<table>
					  <thead>
						<tr>
						  <th>Race</th>
						  <th>Bib</th>
						  <th>Family name</th>
						  <th>First name</th>
						  						  <th>Status</th>
						  <th>Category</th>
						  <th>Club/Team</th>
						   						   							<th>Nationality</th>
						   						</tr>
					  </thead>
					  <tbody>
						<xsl:for-each select="fiche">
						  <tr>
							<xsl:if test="position() = 1"><xsl:attribute name="class">first</xsl:attribute></xsl:if>
							<xsl:if test="(position() mod 2) != 1"><xsl:attribute name="class">even</xsl:attribute></xsl:if>
							<xsl:variable name="idc" select="@c"/>
							<td>
								<a href="javascript:setFav({@doss},true)" data-dos="{@doss}" class="nofav" title="Add this participant to my Favourites list"></a><a href="javascript:setFav({@doss},false)" data-dos="{@doss}" class="fav" title="Remove this participant from my Favourites list." style="display:none"></a>
																	<a href="javascript:setComp({@doss},true)" data-dos="{@doss}" class="nocomp" title="Add this participant to my comparison list"></a><a href="javascript:setComp({@doss},false)" data-dos="{@doss}" class="comp" title="Remove this participant from my comparison list" style="display:none"></a>
																<xsl:value-of select="/d/courses/c[@id=$idc]/@nc"/>
							</td>
							<td><a href="coureur.php?rech={@doss}">
								<xsl:choose>
									<xsl:when test="string(@nd)=''"><xsl:value-of select="@doss"/></xsl:when>
									<xsl:otherwise>not affected</xsl:otherwise>
								</xsl:choose>
							</a></td>
							<xsl:choose>
							  <xsl:when test="count(relai)&gt;0">
								<td><xsl:value-of select="relai/@n"/></td>
								<td>
								  <xsl:for-each select="relai/c">
									<xsl:if test="string(@doss)!=''"><xsl:value-of select="@doss"/> - </xsl:if>
																			<span class="pnom"><xsl:value-of select="@prenom"/></span><xsl:text> </xsl:text>
										<span class="nom"><xsl:value-of select="@nom"/></span><br/>
																			
								  </xsl:for-each>
								</td>
							  </xsl:when>
							  <xsl:otherwise>
								<td><xsl:value-of select="identite/@nom"/></td>
								<td><xsl:value-of select="identite/@prenom"/></td>
								
															  </xsl:otherwise>
							</xsl:choose>
							<td>
								<xsl:choose>
									<xsl:when test="state/@code = 'f'"><b>Finisher</b></xsl:when>
									<xsl:when test="state/@code = 'f2'"><b>Ranked</b></xsl:when>
									<xsl:when test="state/@code = 'fe'">End&#160;of&#160;stage</xsl:when>
									<xsl:when test="state/@code = 's'">Stopped by the organisers</xsl:when>
									<xsl:when test="state/@code = 'hd'">Exceed cut-off time</xsl:when>
									<xsl:when test="state/@code = 'a'">Withdrawn</xsl:when>
									<xsl:when test="state/@code = 'd'">Disqualified by the organisers</xsl:when>
									<xsl:when test="state/@code = 'u'">Unranked</xsl:when>
									<xsl:when test="state/@code = 'np'">"DNS"</xsl:when>
									<xsl:when test="state/@code = 'nl'">Race&#160;not&#160;started</xsl:when>
									<xsl:otherwise>In&#160;race...</xsl:otherwise>
								</xsl:choose>
							</td>
							<td><xsl:value-of select="identite/@cat"/></td>
							<td><xsl:value-of select="identite/@club"/></td>
													   							<td><xsl:value-of select="identite/@cio"/></td>
						   						  </tr>
						</xsl:for-each>
					  </tbody>
					</table>
				  </div>
              </div>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:if test="count(/d/error)&gt;0 and string(/d/@rech)=''">
<div id="content"><h3>There's an error :
<xsl:copy-of select="/d/error/child::node()"/>
</h3></div>
</xsl:if>
				  <div id="parten">
			<span class="l"></span>
			<div>PARTNERS</div>
			<img src="im/LT-parten_horiz.png"/>
			<span class="r"></span>
		  </div>
				<div id="botmain">
						<div style="float:right;">
				Powered by <a href="https://livetrail.net" target="_blank"><img style="position:relative; top:3px;" src="im/miniLogo.png"/></a>&#160;
			</div>
			<a href="reclam.php">Contact</a>		</div>
	</div>
</div>
      </body>
    </html>
  </xsl:template>
  
  <xsl:template name="calc-kmh">
    <xsl:param name="idpt"/>
    <xsl:param name="pts"/>
    <xsl:param name="pass"/>
    <xsl:param name="js"/>
    <xsl:param name="pace"/>
    <xsl:choose>
      <xsl:when test="count($pass[@idpt = $idpt]) = 0 or number($idpt) = 0">-</xsl:when>
      <xsl:otherwise>
        <xsl:variable name="pospt">
          <xsl:for-each select="$pass">
            <xsl:if test="@idpt = $idpt"><xsl:value-of select="position()"/></xsl:if>
          </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="idptprec" select="$pass[position()=($pospt - 1)]/@idpt" />
        <xsl:variable name="kmprec" select="10 * ((number($pts[@idpt = $idptprec]/@km) div 10) div 1.609344)" />
        <xsl:variable name="km" select="10 * ((number($pts[@idpt = $idpt]/@km) div 10) div 1.609344)" />
        <xsl:variable name="tps" select="number($pass[position()=$pospt]/@tnp)" />

        <xsl:choose>
			<xsl:when test="($km - $kmprec)=0">-</xsl:when>
			<xsl:otherwise>
				 <xsl:choose>
					<xsl:when test="string($js)=1">
						<xsl:value-of select="format-number(($km - $kmprec) div $tps, '0.00')"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:choose>
							<xsl:when test="string($pace)='1'">
								<xsl:call-template name="minutes2pace">
									<xsl:with-param name="minutes" select="60 div (($km - $kmprec) div $tps)"/>
								</xsl:call-template>
							</xsl:when>
							<xsl:when test="string($pace)='2'">
								<xsl:call-template name="minutes2pace">
									<xsl:with-param name="minutes" select="60 div ((10 * ($km - $kmprec)) div $tps)"/>
								</xsl:call-template>
							</xsl:when>
							<xsl:otherwise>
								<xsl:call-template name="fmt-f">
									<xsl:with-param name="v" select="($km - $kmprec) div $tps"/>
									<xsl:with-param name="format" select="'0.00'"/>
								</xsl:call-template>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>	
			</xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="getoverallkm">
	<xsl:param name="pts"/>
	<xsl:param name="idx"/>
	<xsl:if test="count($pts/pt) &lt;= number($idx)"><xsl:value-of select="10 * (($pts/pt[last()]/@km div 10) div 1.609344)"/></xsl:if>
	<xsl:variable name="idxsmax"><xsl:for-each select="$pts/pt">
		<xsl:variable name="pos" select="position()"/>
		<xsl:choose>
			<xsl:when test="$pos &lt;= number($idx)"></xsl:when>
			<xsl:when test="$pos &gt; number($idx)"><xsl:if test="$pts/pt[$pos]/@km &lt; $pts/pt[$pos - 1]/@km"><xsl:value-of select="$pos - 1"/>,</xsl:if></xsl:when>
		</xsl:choose>
	</xsl:for-each></xsl:variable>
	<xsl:choose>
		<xsl:when test="string($idxsmax) != ''">
			<xsl:variable name="idxmax" select="number(substring-before($idxsmax, ','))"/>
			<xsl:variable name="val1" select="10 * (($pts/pt[$idxmax]/@km div 10) div 1.609344)"/>
			<xsl:variable name="val2"><xsl:call-template name="getoverallkm"><xsl:with-param name="pts" select="$pts"/><xsl:with-param name="idx" select="$idxmax + 1"/></xsl:call-template></xsl:variable>
			<xsl:value-of select="number($val1) + number($val2)"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="10 * (($pts/pt[last()]/@km div 10) div 1.609344)"/>
		</xsl:otherwise>
	</xsl:choose>
  </xsl:template>
  
  <!-- Renvoie le nom d'une categ potentiellement générique -->
<xsl:template name="getCategName">
	<xsl:param name="id"/>
	<xsl:param name="n"/>
	<xsl:choose>
		<xsl:when test="string($id)='scratch'">Overall</xsl:when>
		<xsl:when test="string($id)='scratchH'">Men Overall</xsl:when>
		<xsl:when test="string($id)='scratchF'">Women Overall</xsl:when>
		<xsl:when test="string($id)='scratchMx'">Mixed team</xsl:when>
		<xsl:when test="string($id)='all'">All categories</xsl:when>
		<xsl:when test="string($id)='onlyH'">Men </xsl:when>
		<xsl:when test="string($id)='onlyF'">Women </xsl:when>
		<xsl:when test="string($id)='Mx'">Mixed team</xsl:when>
		<xsl:when test="string($id)='H'">Men's team</xsl:when>
		<xsl:when test="string($id)='F'">Women's team</xsl:when>
		
		<xsl:when test="string($n)!=''"><xsl:value-of select="$n"/></xsl:when>
		<xsl:otherwise><xsl:value-of select="$id"/></xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- Format de time avec jour/heure Jr. hh:mm -->
<xsl:template name="fmt-dtjt">
    <xsl:param name="j"/>
    <xsl:param name="t"/>
    <xsl:choose>
      <xsl:when test="$j=1">Mon</xsl:when>
      <xsl:when test="$j=2">Tue</xsl:when>
      <xsl:when test="$j=3">Wed</xsl:when>
      <xsl:when test="$j=4">Thu</xsl:when>
      <xsl:when test="$j=5">Fri</xsl:when>
      <xsl:when test="$j=6">Sat</xsl:when>
      <xsl:when test="$j=7">Sun</xsl:when>
    </xsl:choose>. <xsl:value-of select="concat(substring-before($t,':'),':',substring-before(substring-after($t,':'),':'))" />
  </xsl:template>
  
  <!-- Format de date jj/mm/aaaa -->
  <xsl:template name="fmt-d">
    <xsl:param name="d"/>
    <xsl:value-of select="substring-after(substring-after($d,'-'),'-')" />/<xsl:value-of select="substring-before(substring-after($d,'-'),'-')" />/<xsl:value-of select="substring-before($d,'-')" />
  </xsl:template>
  <!-- Format de datetime jj/mm/aaaa hh:mm:ss -->
  <xsl:template name="fmt-dt">
    <xsl:param name="dt"/>
    <xsl:value-of select="substring-after(substring-after(substring-before($dt,' '),'-'),'-')" />/<xsl:value-of select="substring-before(substring-after($dt,'-'),'-')" />/<xsl:value-of select="substring-before($dt,'-')" /><xsl:text> </xsl:text>
    <xsl:value-of select="substring-after($dt,' ')" />
  </xsl:template>
  
  <!-- Format de nombre -->
  <xsl:template name="fmt-f">
    <xsl:param name="v"/>
    <xsl:param name="format"/>
    <xsl:variable name="fmt"><xsl:choose><xsl:when test="string($format)=''">#,##0</xsl:when><xsl:otherwise><xsl:value-of select="$format"/></xsl:otherwise></xsl:choose></xsl:variable>
    <xsl:choose>
		<xsl:when test="string($v) = 'Infinity'">-</xsl:when>
					<xsl:otherwise><xsl:value-of select="format-number($v, $fmt)" /></xsl:otherwise>
		    </xsl:choose>
  </xsl:template>

  <xsl:template name="fmt-i">
	<xsl:param name="v"/>
			<xsl:value-of select="format-number($v, '#,##0')" />
	  </xsl:template>

<!-- convertit un temps en secondes en hh:mm -->
  <xsl:template name="sec2time">
    <xsl:param name="sec"/>
    <xsl:if test="$sec&lt;0">-</xsl:if><xsl:value-of select="format-number(floor(($sec*($sec&gt;=0)-$sec*($sec&lt;0)) div 3600), '0')" />:<xsl:value-of select="format-number(floor((($sec*($sec&gt;=0)-$sec*($sec&lt;0)) mod 3600) div 60), '00')" />
  </xsl:template>
  
  <xsl:template name="sec2timefull">
    <xsl:param name="sec"/>
    <xsl:if test="$sec&lt;0">-</xsl:if><xsl:value-of select="format-number(floor(($sec*($sec&gt;=0)-$sec*($sec&lt;0)) div 3600), '0')" />:<xsl:value-of select="format-number(floor((($sec*($sec&gt;=0)-$sec*($sec&lt;0)) mod 3600) div 60), '00')" />:<xsl:value-of select="format-number($sec mod 60, '00')" />
  </xsl:template>

<!-- convertit un temps numérique en heures en hh:mm:ss -->
<xsl:template name="hour2time">
    <xsl:param name="h"/>
	<xsl:choose>
    <xsl:when test="$h&lt;0">-</xsl:when>
	<xsl:otherwise>
		<xsl:value-of select="format-number(floor($h), '00')" />:<xsl:value-of select="format-number(floor( ($h - floor($h))*60 ), '00')" />:<xsl:value-of select="format-number(round( ($h*60 - floor($h*60))*60 ), '00')" />
	</xsl:otherwise>
	</xsl:choose>
  </xsl:template>
  
<!-- convertit un temps en minutes en mm:ss -->  
  <xsl:template name="minutes2pace">
    <xsl:param name="minutes"/>
    <xsl:if test="$minutes&lt;0">-</xsl:if><xsl:value-of select="format-number(floor($minutes), '00')" />:<xsl:value-of select="format-number(round(($minutes - floor($minutes)) * 60), '00')" />
  </xsl:template>

  
  <xsl:template name="calc-vit">
    <xsl:param name="dist"/>
    <xsl:param name="tps"/>
    <xsl:param name="pace"/>
	<xsl:choose>
		<xsl:when test="string($pace)='1'">
			<xsl:call-template name="minutes2pace">
				<xsl:with-param name="minutes" select="60 div (($dist) div $tps)"/>
			</xsl:call-template>
		</xsl:when>
		<xsl:when test="string($pace)='2'">
			<xsl:call-template name="minutes2pace">
				<xsl:with-param name="minutes" select="60 div ((10 * $dist) div $tps)"/>
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<xsl:call-template name="fmt-f">
				<xsl:with-param name="v" select="($dist) div $tps"/>
				<xsl:with-param name="format" select="'0.00'"/>
			</xsl:call-template>
		</xsl:otherwise>
	</xsl:choose>
  </xsl:template>
  
  
</xsl:stylesheet>
