﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <xsl:variable name="HostName" select="normalize-space(Brands/HostName)"></xsl:variable>
        <xsl:variable name="Mode" select="normalize-space(Brands/Mode)"></xsl:variable>

        <div id="divBrandContent">
            <xsl:if test ="$Mode = 'NewReport'">
                <table class="tableMaster" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                        <td align="right" style="font-weight:bold; text-align:right; padding:10px;" colspan="5">
                            <a href="CreateBrand.aspx?ID=0" class="anchorButton" style="color: white; text-decoration: none;">
                                Add Brand
                            </a>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5" style="padding: 10px;" nowrap="nowrap">
                            <Span class="label" style="vertical-align: middle;">Key</Span>
                            <input id="txtBKey" type="text" class="text" style="width: 150px; margin-left: 10px; margin-right: 20px;"
                                    onKeyUp='return brand_TopBarFilter(
                                                        event, "txtBKey", "txtBName", "txtInviteCode", 
                                                        "ddlBStatus", "divBrandContainer_Content");'></input>

                            <Span class="label" style="vertical-align: middle;">Name</Span>
                            <input id="txtBName" type="text" class="text" style="width: 150px; margin-left: 10px; margin-right: 20px;"
                                    onKeyUp='return brand_TopBarFilter(
                                                        event, "txtBKey", "txtBName", "txtInviteCode", 
                                                        "ddlBStatus", "divBrandContainer_Content");'></input>

                            <Span class="label" style="vertical-align: middle;">Invite Code</Span>
                            <input id="txtInviteCode" type="text" class="text" style="width: 150px; margin-left: 10px; margin-right: 20px;"
                                    onKeyUp='return brand_TopBarFilter(
                                                        event, "txtBKey", "txtBName", "txtInviteCode", 
                                                        "ddlBStatus", "divBrandContainer_Content");'></input>

                            <Span class="label" style="vertical-align: middle;">Status</Span>
                            <select id="ddlBStatus" class="smallDropdown" style="width: 150px; margin-left: 10px;"
                                    onChange='return brand_TopBarFilter(
                                    null, "txtBKey", "txtBName", "txtInviteCode", 
                                    "ddlBStatus", "divBrandContainer_Content");'>
                                <option value="Select Status" selected="selected">
                                    Select Status
                                </option>
                                <xsl:for-each select="Brands/BrandStatus/Status">
                                    <option value="{ID}">
                                        <xsl:value-of select="BrandStatusText"/>
                                    </option>
                                </xsl:for-each>
                            </select>
                        </td>
                    </tr>
                </table>
            </xsl:if>
            <div id="divBrandContainer_Content">
                <table class="tableMaster" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                        <td style="padding-left: 10px; padding-bottom: 10px;">
                            <span class="labelHeader" style="color: rgb(55, 96, 146);">Brand</span>
                        </td>
                        <td>
                            <span class="labelHeader" style="color: rgb(55, 96, 146);">Brand Content</span>
                        </td>
                        <td colspan="2">
                            <span class="labelHeader" style="color: rgb(55, 96, 146);">Details</span>
                        </td>
                        <td style="padding-left: 80px;">
                            <span class="labelHeader" style="color: rgb(55, 96, 146);">Admin</span>
                        </td>
                    </tr>
                    <xsl:for-each select="Brands/BrandAdminData/Brand[not(following::Brand/BrandID = BrandID)]">
                        <xsl:variable name="CurrentBrandID" select="BrandID"/>
                        <xsl:if test ="position() mod 2 = 0">
                            <tr id="tr_BrandID_{BrandID}" style="background-color: #DCDCDC;">
                                <td width="100" style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px; padding-top:5px;">
                                    <a class="link" href="http://{$HostName}/{BrandKey}" target="_blank">
                                        <img style="display:inline; margin-left: 0px; vertical-align: middle; display: none;"
                                              src="{BrandLogoSmallURL}" onload='setWidthAndHeightImage(this,"100");'></img>
                                    </a>
                                </td>
                                <td width="400" style="padding-right: 10px; padding-bottom: 10px;">
                                    <a class="link" href="http://{$HostName}/{BrandKey}" target="_blank">
                                        <div class="label" style="display: inline; color: rgb(55, 96, 146); font-weight: bold;">
                                            <xsl:value-of select="CompanyName"/>
                                        </div>
                                    </a>
                                    <div class="label" style="text-align: justify;">
                                        <xsl:value-of select="BrandDescription"/>
                                    </div>
                                </td>
                                <td width="200" style="padding-right: 10px; padding-bottom: 10px;" colspan="2">
                                    <div class="label">
                                        <span class="labelBold" style="color: rgb(55, 96, 146);">
                                            Key:
                                        </span>
                                        <div id="div_{BrandID}_BrandKey" style="display: inline;">
                                            <a class="link" id="anc_{BrandID}_BrandKey"
                                               style="font-weight: normal;"
                                               onClick="return brand_EditKey(
                                                            'anc_{BrandID}_BrandKey',
                                                            'div_{BrandID}_Edit')">
                                                <xsl:value-of select="BrandKey"/>
                                            </a>
                                        </div>
                                        <div id="div_{BrandID}_Message" class="labelSmall" style="color: red; display: none;">
                                            This BrandKey already exists.
                                        </div>
                                        <div id ="div_{BrandID}_Edit" style="display: none;">
                                            <input id="txt_{BrandID}_Update" value="{BrandKey}"
                                                   type="text" name="BrandKey" class="text"
                                                   onkeypress="return brand_ValidateBrandKey(event);"
                                                   onkeyup="return brand_ValidateBrandKey(event);"
                                                   style="width: 150px;">
                                            </input>
                                            <input type="button" name="BrandKey" value ="Save"
                                                   style="width: 50px; background-color: #4F81BD; color: white; margin-left: 5px; margin-right: 5px;"
                                                   onclick="brand_UpdateBrandKey( {normalize-space(BrandID)}, 'txt_{BrandID}_Update' );"></input>
                                            <input type="button" name="ExitBrandKey" value="X" style="background-color: #4F81BD; color: white;"
                                                    onclick="brand_ExitUpdateBrandKey(
                                                                'anc_{BrandID}_BrandKey',
                                                                'div_{BrandID}_Edit');"></input>
                                        </div>
                                    </div>
                                    <div class="label">
                                        <xsl:if test="PermissionID = 4">
                                            <xsl:value-of select="UserName"/>
                                        </xsl:if>
                                    </div>
                                    <div class="label">
                                        <xsl:value-of select="CompanyEmail"/>
                                    </div>
                                    <div>
                                        <xsl:variable name="BrandStatus" select="BrandStatus"></xsl:variable>
                                        <span class="labelHeader" style="color: rgb(55, 96, 146);">Status</span>

                                        <a class="label" href="#" id="anc_{normalize-space(BrandID)}"
                                           onClick="return brand_EditStatus('anc_{normalize-space(BrandID)}','ddl_{normalize-space(BrandID)}')" style="padding-left:5px; color:black;">
                                            <xsl:value-of select="BrandStatus"/>
                                        </a>
                                        <select class="label" style="display:none;" id="ddl_{normalize-space(BrandID)}"
                                                       onChange="return brand_UpdateStatus('{normalize-space(BrandID)}','anc_{normalize-space(BrandID)}','ddl_{normalize-space(BrandID)}')">
                                            <xsl:for-each select="../../BrandStatus/Status">
                                                <xsl:if test="BrandStatusText = $BrandStatus">
                                                    <option value="{ID}" selected="selected" >
                                                        <xsl:value-of select="BrandStatusText"/>
                                                    </option>
                                                </xsl:if>

                                                <xsl:if test="BrandStatusText != $BrandStatus">
                                                    <option value="{ID}" >
                                                        <xsl:value-of select="BrandStatusText"/>
                                                    </option>
                                                </xsl:if>
                                            </xsl:for-each>
                                        </select>

                                    </div>
                                    <div>
                                        <span class="labelHeader" style="color: rgb(55, 96, 146);">PublicYN</span>

                                        <a class="label" href="#" id="anc_BrandPublicYN_{normalize-space(BrandID)}"
                                           onClick="return brand_EditVisibility(
                                                                'anc_BrandPublicYN_{normalize-space(BrandID)}',
                                                                'ddl_BrandPublicYN_{normalize-space(BrandID)}')"
                                           style="padding-left:5px; color:black;">

                                            <xsl:choose>
                                                <xsl:when test="PublicYN = 1">
                                                    <xsl:text>Yes</xsl:text>
                                                </xsl:when>
                                                <xsl:otherwise>
                                                    <xsl:text>No</xsl:text>
                                                </xsl:otherwise>
                                            </xsl:choose>
                                        </a>
                                        <select class="label" style="display:none;" id="ddl_BrandPublicYN_{normalize-space(BrandID)}"
                                                onChange="return brand_UpdateVisibility(
                                                                    '{normalize-space(BrandID)}','PublicYN',
                                                                    'anc_BrandPublicYN_{normalize-space(BrandID)}',
                                                                    'ddl_BrandPublicYN_{normalize-space(BrandID)}')">
                                            <xsl:if test="PublicYN = 1">
                                                <option value="1" selected="selected">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:if>

                                            <xsl:if test="PublicYN = 0">
                                                <option value="1">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0" selected="selected">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:if>
                                        </select>
                                    </div>
                                    <div>
                                        <span class="labelHeader" style="color: rgb(55, 96, 146);">PublishYN</span>

                                        <a class="label" href="#" id="anc_BrandPublishYN_{normalize-space(BrandID)}"
                                           onClick="return brand_EditVisibility(
                                                                'anc_BrandPublishYN_{normalize-space(BrandID)}',
                                                                'ddl_BrandPublishYN_{normalize-space(BrandID)}')"
                                           style="padding-left:5px; color:black;">

                                            <xsl:choose>
                                                <xsl:when test="PublishYN = 1">
                                                    <xsl:text>Yes</xsl:text>
                                                </xsl:when>
                                                <xsl:otherwise>
                                                    <xsl:text>No</xsl:text>
                                                </xsl:otherwise>
                                            </xsl:choose>
                                        </a>
                                        <select class="label" style="display:none;" id="ddl_BrandPublishYN_{normalize-space(BrandID)}"
                                                onChange="return brand_UpdateVisibility(
                                                                    '{normalize-space(BrandID)}','PublishYN',
                                                                    'anc_BrandPublishYN_{normalize-space(BrandID)}',
                                                                    'ddl_BrandPublishYN_{normalize-space(BrandID)}')">
                                            <xsl:if test="PublicYN = 1">
                                                <option value="1" selected="selected">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:if>

                                            <xsl:if test="PublicYN = 0">
                                                <option value="1">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0" selected="selected">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:if>
                                        </select>
                                    </div>
                                    <div>
                                        <xsl:variable name="BrandPortalType" select="BrandPortalType"></xsl:variable>
                                        <span class="labelHeader" style="color: rgb(55, 96, 146);">Brand Type</span>
                                        <a class="label" href="#" id="anc_BrandType_{normalize-space(BrandID)}"
                                           onClick="return brand_EditStatus('anc_BrandType_{normalize-space(BrandID)}','ddl_BrandType_{normalize-space(BrandID)}')"
                                           style="padding-left:5px; color:black;">
                                            <xsl:value-of select="BrandPortalType"/>
                                        </a>
                                        <select class="label" style="display:none;" id="ddl_BrandType_{normalize-space(BrandID)}"
                                                       onChange="return brand_UpdateType('{normalize-space(BrandID)}','anc_BrandType_{normalize-space(BrandID)}','ddl_BrandType_{normalize-space(BrandID)}')">
                                            <xsl:for-each select="../../BrandTypes/Types">
                                                <xsl:if test="PortalType = $BrandPortalType">
                                                    <option value="{PortalTypeID}" selected="selected" >
                                                        <xsl:value-of select="PortalType"/>
                                                    </option>
                                                </xsl:if>
                                                <xsl:if test="PortalType != $BrandPortalType">
                                                    <option value="{PortalTypeID}" >
                                                        <xsl:value-of select="PortalType"/>
                                                    </option>
                                                </xsl:if>
                                            </xsl:for-each>
                                        </select>
                                    </div>
                                    <xsl:for-each select="../Brand[BrandID = $CurrentBrandID]">
                                        <div class="label">
                                            <span>
                                                [<xsl:value-of select="CouponCode"/>]
                                            </span>
                                            <span style="margin-left:3px;">
                                                <xsl:value-of select="Package"/>
                                            </span>
                                        </div>
                                    </xsl:for-each>
                                </td>
                                <td width="150" style="padding-bottom: 10px; padding-top: 10px;">
                                    <div align="right" style="padding-right:10px;">
                                        <xsl:choose>
                                            <xsl:when test="BrandPortalTypeID = 1">
                                                <a class="anchorButton" target="_blank"
                                          href="http://{$HostName}/CreateCoach.aspx?ID={BrandID}"
                                          style="color:white; text-decoration: none;">Edit Coach</a>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <a class="link" href="http://{$HostName}/CreateBrand.aspx?ID={BrandID}"
                                                      onmouseover="this.style.textDecoration='underline';"
                                                      onmouseout="this.style.textDecoration='none';">
                                                    Edit Brand
                                                </a>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </div>
                                    &#xa0;
                                    <div align="right" style="padding-right:10px;">
                                        <xsl:choose>
                                            <xsl:when test="BrandPortalTypeID = 1">
                                                <a class="anchorButton" href="http://{$HostName}/CoachServices.aspx?ID={BrandID}" target="_blank"
                                           style="color:white; text-decoration: none;">Edit Package</a>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <a class="anchorButton" href="http://{$HostName}/SelectBrandPackage.aspx?ID={BrandID}" target="_blank"
                                            style="color:white; text-decoration: none;">Edit Package</a>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </div>
                                    &#xa0;
                                    <div align="right" style="padding-right:10px;">
                                        <a class="anchorButton" target="_blank"
                                           href="http://{$HostName}/AddBrandDomain.aspx?ID={BrandID}"
                                           style="color:white; text-decoration: none;">Add Domain</a>
                                    </div>
                                    &#xa0;
                                    <div align="right" style="padding-right:10px;">
                                        <a class="anchorButton" style="color: white; text-decoration: none;"
                                           href="#" onClick='return deleteBrand(
                                                                "{BrandID}","tr_BrandID_{BrandID}");'>Delete</a>
                                    </div>
                                </td>
                            </tr>
                        </xsl:if>
                        <xsl:if test ="position() mod 2 != 0">
                            <tr id="tr_BrandID_{BrandID}">
                                <td width="100" style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px; padding-top:5px;">
                                    <a class="link" href="http://{$HostName}/{BrandKey}" target="_blank">
                                        <img style="display:inline; margin-left: 0px; vertical-align: middle; display: none;"
                                              src="{BrandLogoSmallURL}" onload='setWidthAndHeightImage(this,"100");'></img>
                                    </a>
                                </td>
                                <td width="400" style="padding-right: 10px; padding-bottom: 10px;">
                                    <a class="link" href="http://{$HostName}/{BrandKey}" target="_blank">
                                        <div class="label" style="display: inline; color: rgb(55, 96, 146); font-weight: bold;">
                                            <xsl:value-of select="CompanyName"/>
                                        </div>
                                    </a>
                                    <div class="label" style="text-align: justify;">
                                        <xsl:value-of select="BrandDescription"/>
                                    </div>
                                </td>
                                <td colspan="2" width="200" style="padding-right: 10px; padding-bottom: 10px;">
                                    <div class="label">
                                        <span class="labelBold" style="color: rgb(55, 96, 146);">
                                            Key:
                                        </span>
                                        <div id="div_{BrandID}_BrandKey" style="display: inline;">
                                            <a class="link" id="anc_{BrandID}_BrandKey"
                                               style="font-weight: normal;"
                                               onClick="return brand_EditKey(
                                                            'anc_{BrandID}_BrandKey',
                                                            'div_{BrandID}_Edit')">
                                                <xsl:value-of select="BrandKey"/>
                                            </a>
                                        </div>
                                        <div id="div_{BrandID}_Message" class="labelSmall" style="color: red; display: none;">
                                            This BrandKey already exists.
                                        </div>
                                        <div id ="div_{BrandID}_Edit" style="display: none;">
                                            <input id="txt_{BrandID}_Update" value="{BrandKey}"
                                                   type="text" name="BrandKey" class="text"
                                                   onkeypress="return brand_ValidateBrandKey(event);"
                                                   onkeyup="return brand_ValidateBrandKey(event);"
                                                   style="width: 150px;">
                                            </input>
                                            <input type="button" name="BrandKey" value ="Save"
                                                   style="width: 50px; background-color: #4F81BD; color: white; margin-left: 5px; margin-right: 5px;"
                                                   onclick="brand_UpdateBrandKey( {normalize-space(BrandID)}, 'txt_{BrandID}_Update' );"></input>
                                            <input type="button" name="ExitBrandKey" value="X" style="background-color: #4F81BD; color: white;"
                                                    onclick="brand_ExitUpdateBrandKey(
                                                                'anc_{BrandID}_BrandKey',
                                                                'div_{BrandID}_Edit');"></input>
                                        </div>
                                    </div>
                                    <div class="label">
                                        <xsl:value-of select="UserName"/>
                                    </div>
                                    <div class="label">
                                        <xsl:value-of select="CompanyEmail"/>
                                    </div>
                                    <div>
                                        <xsl:variable name="BrandStatus" select="BrandStatus"></xsl:variable>
                                        <span class="labelHeader" style="color: rgb(55, 96, 146);">Status</span>

                                        <a class="label" href="#" id="anc_{normalize-space(BrandID)}"
                                           onClick="return brand_EditStatus('anc_{normalize-space(BrandID)}','ddl_{normalize-space(BrandID)}')" style="padding-left:5px; color:black;">
                                            <xsl:value-of select="BrandStatus"/>
                                        </a>
                                        <select class="label" style="display:none;" id="ddl_{normalize-space(BrandID)}"
                                                       onChange="return brand_UpdateStatus('{normalize-space(BrandID)}','anc_{normalize-space(BrandID)}','ddl_{normalize-space(BrandID)}')">
                                            <xsl:for-each select="../../BrandStatus/Status">
                                                <xsl:if test="BrandStatusText = $BrandStatus">
                                                    <option value="{ID}" selected="selected" >
                                                        <xsl:value-of select="BrandStatusText"/>
                                                    </option>
                                                </xsl:if>

                                                <xsl:if test="BrandStatusText != $BrandStatus">
                                                    <option value="{ID}" >
                                                        <xsl:value-of select="BrandStatusText"/>
                                                    </option>
                                                </xsl:if>
                                            </xsl:for-each>
                                        </select>
                                    </div>
                                    <div>
                                        <span class="labelHeader" style="color: rgb(55, 96, 146);">PublicYN</span>

                                        <a class="label" href="#" id="anc_BrandPublicYN_{normalize-space(BrandID)}"
                                           onClick="return brand_EditVisibility(
                                                                'anc_BrandPublicYN_{normalize-space(BrandID)}',
                                                                'ddl_BrandPublicYN_{normalize-space(BrandID)}')"
                                           style="padding-left:5px; color:black;">
                                            <xsl:choose>
                                                <xsl:when test="PublicYN = 1">
                                                    <xsl:text>Yes</xsl:text>
                                                </xsl:when>
                                                <xsl:otherwise>
                                                    <xsl:text>No</xsl:text>
                                                </xsl:otherwise>
                                            </xsl:choose>
                                        </a>
                                        <select class="label" style="display:none;" id="ddl_BrandPublicYN_{normalize-space(BrandID)}"
                                                onChange="return brand_UpdateVisibility(
                                                                    '{normalize-space(BrandID)}','PublicYN',
                                                                    'anc_BrandPublicYN_{normalize-space(BrandID)}',
                                                                    'ddl_BrandPublicYN_{normalize-space(BrandID)}')">
                                            <xsl:if test="PublicYN = 1">
                                                <option value="1" selected="selected">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:if>

                                            <xsl:if test="PublicYN = 0">
                                                <option value="1">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0" selected="selected">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:if>
                                        </select>
                                    </div>
                                    <div>
                                        <span class="labelHeader" style="color: rgb(55, 96, 146);">PublishYN</span>

                                        <a class="label" href="#" id="anc_BrandPublishYN_{normalize-space(BrandID)}"
                                           onClick="return brand_EditVisibility(
                                                                'anc_BrandPublishYN_{normalize-space(BrandID)}',
                                                                'ddl_BrandPublishYN_{normalize-space(BrandID)}')"
                                           style="padding-left:5px; color:black;">

                                            <xsl:choose>
                                                <xsl:when test="PublishYN = 1">
                                                    <xsl:text>Yes</xsl:text>
                                                </xsl:when>
                                                <xsl:otherwise>
                                                    <xsl:text>No</xsl:text>
                                                </xsl:otherwise>
                                            </xsl:choose>
                                        </a>
                                        <select class="label" style="display:none;" id="ddl_BrandPublishYN_{normalize-space(BrandID)}"
                                                onChange="return brand_UpdateVisibility(
                                                                    '{normalize-space(BrandID)}','PublishYN',
                                                                    'anc_BrandPublishYN_{normalize-space(BrandID)}',
                                                                    'ddl_BrandPublishYN_{normalize-space(BrandID)}')">
                                            <xsl:if test="PublicYN = 1">
                                                <option value="1" selected="selected">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:if>

                                            <xsl:if test="PublicYN = 0">
                                                <option value="1">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0" selected="selected">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:if>
                                        </select>
                                    </div>
                                    <div>
                                        <xsl:variable name="BrandPortalType" select="BrandPortalType"></xsl:variable>
                                        <span class="labelHeader" style="color: rgb(55, 96, 146);">Brand Type</span>
                                        <a class="label" href="#" id="anc_BrandType_{normalize-space(BrandID)}"
                                           onClick="return brand_EditStatus('anc_BrandType_{normalize-space(BrandID)}','ddl_BrandType_{normalize-space(BrandID)}')"
                                           style="padding-left:5px; color:black;">
                                            <xsl:value-of select="BrandPortalType"/>
                                        </a>
                                        <select class="label" style="display:none;" id="ddl_BrandType_{normalize-space(BrandID)}"
                                                       onChange="return brand_UpdateType('{normalize-space(BrandID)}','anc_BrandType_{normalize-space(BrandID)}','ddl_BrandType_{normalize-space(BrandID)}')">
                                            <xsl:for-each select="../../BrandTypes/Types">
                                                <xsl:if test="PortalType = $BrandPortalType">
                                                    <option value="{PortalTypeID}" selected="selected" >
                                                        <xsl:value-of select="PortalType"/>
                                                    </option>
                                                </xsl:if>
                                                <xsl:if test="PortalType != $BrandPortalType">
                                                    <option value="{PortalTypeID}" >
                                                        <xsl:value-of select="PortalType"/>
                                                    </option>
                                                </xsl:if>
                                            </xsl:for-each>
                                        </select>
                                    </div>
                                    <xsl:for-each select="../Brand[BrandID = $CurrentBrandID]">
                                        <div class="label">
                                            <span>
                                                [<xsl:value-of select="CouponCode"/>]
                                            </span>
                                            <span style="margin-left:3px;">
                                                <xsl:value-of select="Package"/>
                                            </span>
                                        </div>
                                    </xsl:for-each>
                                </td>

                                <td width="150" style="padding-bottom: 10px; padding-top: 10px;">
                                    <div align="right" style="padding-right:10px;">
                                        <xsl:choose>
                                            <xsl:when test="BrandPortalTypeID = 3">
                                                <a class="link" href="http://{$HostName}/CreateBrand.aspx?ID={BrandID}"
                                                      onmouseover="this.style.textDecoration='underline';"
                                                      onmouseout="this.style.textDecoration='none';">
                                                    Edit Brand
                                                </a>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <a class="anchorButton" target="_blank"
                                            href="http://{$HostName}/CreateCoach.aspx?ID={BrandID}"
                                            style="color:white; text-decoration: none;">Edit Brand</a>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </div>
                                    &#xa0;
                                    <div align="right" style="padding-right:10px;">
                                        <xsl:choose>
                                            <xsl:when test="BrandPortalTypeID = 3">
                                                <a class="anchorButton" href="http://{$HostName}/SelectBrandPackage.aspx?ID={BrandID}" target="_blank"
                                           style="color:white; text-decoration: none;">Edit Package</a>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <a class="anchorButton" href="http://{$HostName}/CoachServices.aspx?ID={BrandID}" target="_blank"
                                            style="color:white; text-decoration: none;">Edit Package</a>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </div>
                                    &#xa0;
                                    <div align="right" style="padding-right:10px;">
                                        <a class="anchorButton" target="_blank"
                                           href="http://{$HostName}/AddBrandDomain.aspx?ID={BrandID}"
                                           style="color:white; text-decoration: none;">Add Domain</a>
                                    </div>
                                    &#xa0;
                                    <div align="right" style="padding-right:10px;">
                                        <a class="anchorButton" style="color: white; text-decoration: none;"
                                           href="#" onClick='return deleteBrand(
                                                                "{BrandID}","tr_BrandID_{BrandID}");'>Delete</a>
                                    </div>
                                </td>
                            </tr>
                        </xsl:if>
                    </xsl:for-each>
                </table>
            </div>
            <xsl:if test ="$Mode = 'NewReport'">
                <table class="tableMaster" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                        <td align="right" style="font-weight:bold; text-align:right; padding:10px;" colspan="5">
                            <a href="CreateBrand.aspx?ID=0" class="anchorButton" style="color: white; text-decoration: none;">
                                Add Brand
                            </a>
                        </td>
                    </tr>
                </table>
            </xsl:if>
        </div>
    </xsl:template>
</xsl:stylesheet>
