<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:template name="uiTableSorting">
        <xsl:param name="caption" />
        <xsl:param name="sortBy" />
        <xsl:param name="name" />
        <xsl:param name="sortReverse" />
        <xsl:param name="onClick" />

        <div class="Table-sort-caption">
            <xsl:attribute name="class">
                <xsl:text>Table-sort-caption</xsl:text>
                <xsl:if test="$sortBy = $name">
                    <xsl:text> Table-sort-caption-active</xsl:text>
                </xsl:if>
            </xsl:attribute>
            <xsl:attribute name="onclick">
                <xsl:value-of select="$onClick" />
            </xsl:attribute>

            <span class="Table-sort-caption-text">
                <xsl:value-of select="$caption" />
            </span>
            <xsl:choose>
                <xsl:when test="$sortBy = $name">
                    <span class="Table-sort-caption-icon">
                        <xsl:attribute name="class">
                            <xsl:text>Table-sort-caption-icon</xsl:text>
                            <xsl:choose>
                                <xsl:when test="$sortReverse = 1">
                                    <xsl:text> Table-sort-caption-icon-down</xsl:text>
                                </xsl:when>
                                <xsl:otherwise>
                                    <xsl:text> Table-sort-caption-icon-up</xsl:text>
                                </xsl:otherwise>
                            </xsl:choose>
                        </xsl:attribute>
                        <xsl:call-template name="icon">
                            <xsl:with-param name="type" select="'filter-arrow'" />
                            <xsl:with-param name="role" select="'default'" />
                        </xsl:call-template>
                    </span>
                </xsl:when>
                <xsl:otherwise>
                    <span class="Table-sort-caption-icon">
                        <xsl:call-template name="icon">
                            <xsl:with-param name="type" select="'select-arrows'" />
                            <xsl:with-param name="role" select="'default'" />
                        </xsl:call-template>
                    </span>
                </xsl:otherwise>
            </xsl:choose>
        </div>
    </xsl:template>

    <xsl:template name="uiEvenOddTrClass">
        <xsl:param name="className" select="''"/>
        <xsl:param name="position" />

        <xsl:variable name="evenOddClassName">
            <xsl:choose>
                <xsl:when test="$position mod 2 = 0">
                    <xsl:text>even</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>odd</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:attribute name="class">
            <xsl:text>Table-row Table-row-data Table-row-</xsl:text><xsl:value-of select="$evenOddClassName" />
            <xsl:if test="$className">
                <xsl:text> </xsl:text><xsl:value-of select="$className" />
            </xsl:if>
        </xsl:attribute>
    </xsl:template>
</xsl:stylesheet>
