﻿<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template name="replace-string">
	<xsl:param name="str"/>
	<xsl:param name="old"/>
	<xsl:param name="new"/>

	<xsl:choose>
		<xsl:when test="contains($str, $old)">
			<xsl:value-of select="substring-before($str, $old)"/>
			<xsl:value-of select="$new"/>
			<xsl:call-template name="replace-string">
				<xsl:with-param name="str" select="substring-after($str, $old)"/>
				<xsl:with-param name="old" select="$old"/>
				<xsl:with-param name="new" select="$new"/>
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="$str"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template name="character-tabs">
  <xsl:param name="thePage" />
  <xsl:param name="charUrl" />
  <xsl:param name="guildUrl" />
  <xsl:param name="charLevel" />
  <xsl:param name="isPropass" select = "'false'" />
  <xsl:param name="pathPropass" select = "''" />

	<xsl:variable name="loginStatusParams">
		<xsl:choose>
			<!-- Double-URI encode to work around unconfirmed MSXML bug with parameter encoding in document() URIs -->
			<xsl:when test="system-property('xsl:vendor') = 'Microsoft'">
				<xsl:call-template name="replace-string">
					<xsl:with-param name="str" select="$charUrl"/>
					<xsl:with-param name="old" select="'%'"/>
					<xsl:with-param name="new" select="'%25'"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$charUrl"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

	<xsl:variable name="profile" select="document(concat('/login-status.xml?',$loginStatusParams))/page/loginStatus" />
<div id="divCharTabs">
<div class="tabs">
<div class="hide">
	<div>
	  <xsl:attribute name="class">
	    <xsl:choose>
		  <xsl:when test="$thePage='character-sheet'">select1</xsl:when>
		  <xsl:otherwise>select0</xsl:otherwise>
		</xsl:choose>
	  </xsl:attribute>
		<ul>
			<li class="tab-left"></li>
			<li class="tab-content">
			<a href="/character-sheet.xml?{$charUrl}" class="active"><xsl:value-of select="$loc/strs/unsorted/str[@id='armory.tabs.characterSheet']"/></a>
			</li>
			<li class="tab-right"></li>
		</ul>
	</div>

	<div>
	  <xsl:attribute name = "class">
	    <xsl:choose>
		  <xsl:when test="$thePage = 'character-talents'">select1</xsl:when>
		  <xsl:otherwise>select0</xsl:otherwise>
		</xsl:choose>
	  </xsl:attribute>
		<ul>
			<li class="tab-left"></li>
			<li class="tab-content">
			<a href = "/character-talents.xml?{$charUrl}" class="active"><xsl:value-of select="$loc/strs/unsorted/str[@id='armory.tabs.talents']"/></a>
			</li>
			<li class="tab-right"></li>
		</ul>
	</div>

  <xsl:if test="(character/arenaTeams or arenaTeams) and $isPropass != 'true'">
	<div>
	  <xsl:attribute name = "class">
	    <xsl:choose>
		  <xsl:when test="$thePage = 'character-arenateams'">select1</xsl:when>
		  <xsl:otherwise>select0</xsl:otherwise>
		</xsl:choose>
	  </xsl:attribute>
		<ul>
			<li class="tab-left"></li>
			<li class="tab-content">
			<a href = "/character-arenateams.xml?{$charUrl}" class="active"><xsl:value-of select="$loc/strs/unsorted/str[@id='armory.tabs.arenateams']"/></a>
			</li>
			<li class="tab-right"></li>
		</ul>
	</div>
  </xsl:if>

  <xsl:if test="$isPropass = 'true' and string-length($pathPropass) &gt; 0">
	<div class = "select2" onMouseOut="hideTip();" onMouseOver="showTip('{$loc/strs/unsorted/str[@id='armory.tabs.character.arenateams.mouseover']}');">
		<ul>
			<li class="tab-left"></li>
			<li class="tab-content">
			<a href = "team-info.xml?{$pathPropass/@url}" class="active"><xsl:value-of select="$loc/strs/unsorted/str[@id='armory.tabs.arenateams']"/></a>
			</li>
			<li class="tab-right"></li>
		</ul>
	</div>
  </xsl:if>

<xsl:choose>
  <xsl:when test="$charLevel &gt;= 10">

  <xsl:if test="$isPropass != 'true'">
	<div>
	  <xsl:attribute name = "class">
	    <xsl:choose>
		  <xsl:when test="$thePage = 'character-reputation'">select1</xsl:when>
		  <xsl:otherwise>select0</xsl:otherwise>
		</xsl:choose>
	  </xsl:attribute>
		<ul>
			<li class="tab-left"></li>
			<li class="tab-content">
			<a href = "/character-reputation.xml?{$charUrl}" class="active"><xsl:value-of select="$loc/strs/unsorted/str[@id='armory.tabs.reputation']"/></a>
			</li>
			<li class="tab-right"></li>
		</ul>
	</div>

	<div style="display:none">
	  <xsl:attribute name = "class">
	    <xsl:choose>
		  <xsl:when test="$thePage = 'character-calendar'">select1</xsl:when>
		  <xsl:otherwise>select0</xsl:otherwise>
		</xsl:choose>
	  </xsl:attribute>
		<xsl:attribute name="style">
			<xsl:choose>
				<xsl:when test="$profile/@character=1">
				display:block
				</xsl:when>
				<xsl:when test="string-length($profile/@username)=0">
				display:block
				</xsl:when>
				<xsl:otherwise>
				display:none
				</xsl:otherwise>
			</xsl:choose>
		</xsl:attribute>
		<ul>
			<li class="tab-left"></li>
			<li class="tab-content">
			<a href = "/vault/character-calendar.xml?{$charUrl}" class="active">
			<div style="display: block; float: left; vertical-align: baseline; margin-top: -3px;  width: 21px; height: 21px; background: url('../images/tab-key-2.gif') no-repeat top left; margin-right: 4px;"></div>
			<xsl:value-of select="$loc/strs/unsorted/str[@id='armory.tabs.calendar']"/></a>
			</li>
			<li class="tab-right"></li>
		</ul>
	</div>
	</xsl:if>

  </xsl:when>
</xsl:choose>


  <xsl:if test="$guildUrl != '' and $isPropass != 'true'">
	<div class = "select2" onMouseOut="hideTip();" onMouseOver="showTip('{$loc/strs/unsorted/str[@id='armory.tabs.character.guild.mouseover']}');">
		<ul>
			<li class="tab-left"></li>
			<li class="tab-content">
			<a href = "/guild-info.xml?{$guildUrl}" class="active"><xsl:value-of select="$loc/strs/unsorted/str[@id='armory.tabs.guild']"/></a>
			</li>
			<li class="tab-right"></li>
		</ul>
	</div>
  </xsl:if>


</div>
</div>
</div>

</xsl:template>


<xsl:template name="charSheetMiniSearchPanel">
	<xsl:param name="searchNode" />

	<xsl:choose>
		<xsl:when test="$searchNode">
			<xsl:call-template name="lastSearchTemplate">
				<xsl:with-param name="searchNode" select="$searchNode" />
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<!-- <p>HIDING PANEL</p> -->
			<xsl:choose>
				<xsl:when test="miniSearch">
					<xsl:variable name="guildRoster" select="document(concat('/guild-info.xml?r=',character/@realm,'&amp;n=',character/@guildName,'&amp;p=',miniSearch/@page,'&amp;select=',character/@name))/page/guildInfo"/>

					<!-- <p>CALLING GUILD ROSTER TEMPLATE</p> -->
					<xsl:choose>
						<xsl:when test="$guildRoster/guild">
							<!-- set the expanded search panel style -->
							<link rel="stylesheet" type="text/css" media="screen, projection" href="css/mini-search-expand.css" />

							<xsl:call-template name="miniGuildRosterTemplate">
								<xsl:with-param name="path" select="$guildRoster" />
							</xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<!-- set the collapsed search panel style -->
							<link rel="stylesheet" type="text/css" media="screen, projection" href="css/mini-search-collapse.css" />
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<xsl:variable name="guildRoster" select="document(concat('/guild-info.xml?r=',character/@realm,'&amp;n=',character/@guildName,'&amp;p=1','&amp;select=',character/@name))/page/guildInfo"/>

					<!-- <p>CALLING GUILD ROSTER TEMPLATE</p> -->
					<xsl:choose>
						<xsl:when test="$guildRoster/guild">
							<!-- set the expanded search panel style -->
							<link rel="stylesheet" type="text/css" media="screen, projection" href="css/mini-search-expand.css" />

							<xsl:call-template name="miniGuildRosterTemplate">
								<xsl:with-param name="path" select="$guildRoster" />
							</xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<!-- set the collapsed search panel style -->
							<link rel="stylesheet" type="text/css" media="screen, projection" href="css/mini-search-collapse.css" />
						</xsl:otherwise>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template name = "propassRight">
  <xsl:param name = "pathPropass" />

							<link rel="stylesheet" type="text/css" media="screen, projection" href="css/mini-search-expand.css" />



	<div class="results-side">
		<div class="results-list">
			 <div class="result-banner">
		<h3 class="results-header"><em><xsl:value-of select="$loc/strs/propass/str[@id='teaminfo']"/></em></h3>
			</div>
	<div class="ps">
		<div class="ps-bot">
			<div class="ps-top">
	<div class="data">

<center><strong class = "propassName"><xsl:value-of select = "$pathPropass/@name" /></strong></center>

<xsl:variable name = "rankingPropass" select = "$pathPropass/@ranking" />

<xsl:variable name = "standingPropass">
	<xsl:choose>
	<xsl:when test = "$rankingPropass != 0 and $rankingPropass &lt;= 1000 ">
	<xsl:value-of select = "$rankingPropass" /><xsl:call-template name="positionSuffix"><xsl:with-param name="pos" select="$rankingPropass"/></xsl:call-template>
	</xsl:when>
	</xsl:choose>
</xsl:variable>

<ul class="badges-pvp">
	<li style="width: 170px;">
	<div class="arenacontainer" style = "width: 100%;"><br /><span style="font-size: 12px; font-weight: bold; line-height: 140%;"><xsl:value-of select="$loc/strs/propass/str[@id='arena']"/><br /><xsl:value-of select="$loc/strs/propass/str[@id='tournament']"/><br /><xsl:value-of select="$loc/strs/propass/str[@id='rating']"/><xsl:value-of select = "$pathPropass/@rating" /></span><div class="icon" id = "iconPropassteam" onClick = "javascript: window.location.href = 'team-info.xml?{$pathPropass/@url}'" style = "cursor: pointer;"><img src = "/images/pixel.gif" id = "badgeBorderPropassteam" class="p" border = "0"/>

	<div class="rank-num" id="arenarank5">
		<xsl:call-template name="flash">
		<xsl:with-param name="id" select="'arenarank5'"/>
		<xsl:with-param name="src" select="'/images/rank.swf'"/>
		<xsl:with-param name="wmode" select="'transparent'"/>
		<xsl:with-param name="width" select="'100'"/>
		<xsl:with-param name="height" select="'40'"/>
		<xsl:with-param name="quality" select="'best'"/>
		<xsl:with-param name="flashvars" select="concat('rankNum=', $standingPropass)"/>
		</xsl:call-template>
	</div>



	</div>
	</div>
	</li>
</ul>


<script type="text/javascript">
getArenaIconBorder(<xsl:value-of select = "$pathPropass/@rating" />, 'badgeBorderPropassteam')
</script>



<center><xsl:value-of select="$loc/strs/propass/str[@id='winloseone']"/><xsl:value-of select = "$pathPropass/@seasonGamesWon" /><xsl:value-of select="$loc/strs/propass/str[@id='winlosetwo']"/><xsl:value-of select = "$pathPropass/@seasonGamesPlayed - $pathPropass/@seasonGamesWon" /><xsl:value-of select="$loc/strs/propass/str[@id='winlosethree']"/>
<br />
<xsl:value-of select="$loc/strs/propass/str[@id='winpercentageone']"/><xsl:value-of select = "round($pathPropass/@seasonGamesWon div $pathPropass/@seasonGamesPlayed * 100)" /><xsl:value-of select="$loc/strs/propass/str[@id='winpercentagetwo']"/>
</center>
<p />

    <table class="data-table">
	<xsl:for-each select="$pathPropass/members/character">
    <tr>
		<xsl:attribute name="class"><xsl:choose><xsl:when test="position() mod 2 = 0">data1</xsl:when><xsl:otherwise>data0</xsl:otherwise></xsl:choose></xsl:attribute>
      <td><div><p></p></div></td>
      <td>
        <a><strong>
        </strong></a>
      </td>
      <td><q>
      	<xsl:choose>
            <xsl:when test="@charUrl">
                <a><strong>
                <xsl:call-template name="nameAbbreviator">
                    <xsl:with-param name="name" select="@name" />
                    <xsl:with-param name="link">character-sheet.xml?<xsl:value-of select="@charUrl" /></xsl:with-param>
                </xsl:call-template>
                </strong></a>
	      	</xsl:when>
	      	<xsl:otherwise>
                <a><strong>
                <xsl:call-template name="nameAbbreviator">
                    <xsl:with-param name="name" select="@name" />
                </xsl:call-template>
                </strong></a>
	      	</xsl:otherwise>
      	</xsl:choose>
		</q>
      </td>
      <td align="center">
        <xsl:variable name="raceIdStringGender" select="concat('armory.races.race.', @raceId,'.', @genderId)" />
        <xsl:variable name="classIdStringGender" select="concat('armory.classes.class.', @classId,'.', @genderId)" />
        <!--<img onmouseover="showTip('{$loc/strs/races/str[@id=$raceIdStringGender]}',100)" onmouseout="hideTip()" class="ci" src="/images/icons/race/{@raceId}-{@genderId}.gif" />
        <img src="/shared/wow-com/images/layout/pixel.gif" width = "2" />-->
        <img onmouseover="showTip('{$loc/strs/classes/str[@id=$classIdStringGender]}',100)" onmouseout="hideTip()" class="ci" src="/images/icons/class/{@classId}.gif" />
      </td>
      <td align="center"><q style="font-size: 11px; font-weight: bold; top: 1px;"><xsl:value-of select = "@contribution" /></q></td>
      <td align="right"><div><b></b></div></td>
    </tr>
	</xsl:for-each>
    </table>


	</div>
			</div>
		</div>
	</div><!--/end ps/-->

		</div><!--/end results-list/-->
	</div><!--/end results-side/-->

</xsl:template>

</xsl:stylesheet>

