<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:import href="section.xsl"/>
    <xsl:output method="html" indent="yes" omit-xml-declaration="yes"/>
    <xsl:template match="/">
        <xsl:apply-templates select="ShowPage" mode="block">
            <xsl:with-param name="hide">append</xsl:with-param>
            <xsl:with-param name="title">
                <xsl:if test="count(/ShowPage/xRootNode[.='on'])=0">title</xsl:if>
            </xsl:with-param>
        </xsl:apply-templates>
    </xsl:template>
    <xsl:template match="@super" mode="new">
        <xsl:choose>
            <xsl:when test="count(../ListOption/@new)">
                <xsl:value-of select="../ListOption/@new"/>
            </xsl:when>
            <xsl:when test="../xListNode='on'">
                <xsl:value-of select="$lsTemplateSelected"/>
            </xsl:when>
            <xsl:otherwise>Section.xsl</xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <xsl:template match="xAID|@id" mode="XOptions">
        <![CDATA[<X2Options>]]>CRM_<xsl:value-of select="."/><![CDATA[</X2Options>]]>
    </xsl:template>
    <xsl:variable name="tablewidth">
        <xsl:choose>
            <xsl:when test="Agent='1Android'">668</xsl:when>
            <xsl:otherwise>680</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:template name="search-href">
        <xsl:value-of select="/ShowPage/Script"/>
        <xsl:text>?f=search&amp;o=</xsl:text>
        <xsl:value-of select="$lsTemplateSelected"/>
        <xsl:text>&amp;eWhere=&amp;eWord=wordonly&amp;ex=</xsl:text>
        <xsl:value-of select="/ShowPage/@id"/>
        <!--
        <xsl:text>&amp;v=SearchBib.xsl</xsl:text>
        -->
    </xsl:template>
    <xsl:template match="ShowPage" mode="Untergeordnet">
        <style type="text/css">

            #detail td {border-bottom: 1px solid #cccccc;font-size: 12}
            table#detail {width: <xsl:value-of select="$tablewidth"/>px;}
            form td,textarea,input,select {font-size: 12; font-family: tahoma; }
            .submit {font-size: 11; font-family: tahoma;}
            #detail tr.header td {font-weight: bold}
            table#detail a {text-decoration: none}
            img {vertical-align: bottom}
            .i1 {width: 260px; font-size: 12px;}

            <xsl:choose>
                <xsl:when test="Agent[.='MSIE' and @version &lt; 9]" />
                <xsl:when test="Agent[.='MSIE']" >
                    select.i1 {width: 266px;}
                </xsl:when>
                <xsl:when test="Agent[.='Safari']">
                    .i1 {width: 258px;}
                    input.i1 {width: 242px;}
                    select.i1 {width: 252px;}
                    textarea.i1 {width:252px;}
                </xsl:when>
                <xsl:when test="Agent[.='Chrome']">
                    textarea.i1 {width: 258px;}
                    select.i1 {width: 264px;}
                </xsl:when>
                <xsl:when test="Agent[.='1Android']">
                    .i1 {width: 250px;}
                    textarea.i1 {width: 249px;}
                    select.i1 {width: 256px;}
                </xsl:when>
                <xsl:when test="Agent='Opera'">
                    select.i1 {width: 265px;}
                </xsl:when>
                <xsl:otherwise>
                    select.i1 {width: 100%;}
                </xsl:otherwise>
            </xsl:choose>
            @media screen and (min-resolution: 180dpi){
            .i1 {width: 240px;}
            select.i1 {width:244px;}
            }

        </style>
        <script language="JavaScript" type="text/javascript">
            function yellow(ctrl){
            ctrl.style.background = '#ccccff';
            }
        </script>
        <script>
            function ShowItems(ctrl){
                var k = ctrl.options[ctrl.selectedIndex].text;
                var t = document.getElementById("detail");
                var l = t.getElementsByTagName("tr");
                var i;
                for(i=0; i &lt; l.length; i++){
                    if(k=='<xsl:value-of select="$lsAllItems"/>')
                    l[i].style.display = '';
                    else {
                        var a = l[i].getElementsByTagName("a")[0];
                        if(a==null);
                        else if(a.innerHTML.toUpperCase().substring(0,2)==k)l[i].style.display = '';
                        else l[i].style.display = 'none';
                    }

                }
            }
        </script>
        <xsl:if test="(count(Modus)=0 or Modus!='all') and count(xRootNode)=0">
            <!-- ################## Editor ################### -->
            <form  method="post" action="{Script}?f={@id}&amp;m=update" target="lock">
                <xsl:apply-templates select="." mode="update" />
                <input type="hidden" name="bSave" value="bSave"/>
                <input type="hidden" name="mBody">
                    <xsl:attribute name="value">
                        <![CDATA[<Xtext/>]]><xsl:apply-templates select="xAID" mode="XOptions"/>
                    </xsl:attribute>
                </input>
                <xsl:if test="xListNode='on'">
                    <input type="hidden" name="xListNode" value="on"/>
                </xsl:if>
                <input type="hidden" name="sTemplate" value="{$lsTemplateSelected}"/>
            </form>
            <iframe name="lock" frameborder="0" width="0" height="0"></iframe>
            <br/>
        </xsl:if>
        <xsl:if test="sTitle != ''">
            <table border="0"  style="border: 1px solid #cccccc;" cellpadding="1">
                <!-- ########################## further functions ##################### -->
                <tbody>
                    <tr>
                        <!-- Kein Unterschied zwischen Gruppe und Kontakt
                            <td>
                                <form method="post" action="{Script}?f={@id}&amp;m=create" id="NewGroup">
                                    <input type="hidden" name="xBodyFields" value="xListNode,xAID"/>
                                    <input type="hidden" name="xAID" value="{xAID}"/>
                                    <input type="hidden" name="xListNode" value="on"/>
                                    <input type="hidden" name="mBody">
                                        <xsl:attribute name="value">
                                            <![CDATA[<Xtext/>]]><xsl:apply-templates select="xAID" mode="XOptions"/>
                                        </xsl:attribute>
                                    </input>
                                    <input type="submit" value="Neue Gruppe" class="submit"/>
                                </form>
                            </td>
                            -->
                        <td>
                            <form method="post" action="{Script}?f={@id}&amp;m=create" id="NewContact">
                                <input type="hidden" name="mBody">
                                    <xsl:attribute name="value">
                                        <![CDATA[<Xtext/>]]><xsl:apply-templates select="xAID" mode="XOptions"/>
                                    </xsl:attribute>
                                </input>
                                <xsl:apply-templates select="." mode="NewContact" />
                                <input type="submit" value="Neuer Kontakt" class="submit"/>
                            </form>
                        </td>
                        <td>
                            <form method="get" action="javascript:CreatePageTitle('Section.xsl',euf3(unescape('{/ShowPage/sTitle}')));" id="NewNote">
                                <input type="submit" value="Neue Notiz" class="submit"/>
                            </form>
                        </td>
                        <td>
                            <form method="post" action="{Script}?f={/ShowPage/@id}&amp;m=create" id="NewLink">
                                <input type="submit" value="Neuer Link" class="submit" />
                                <input type="hidden" name="sTitle" value="[new link]" />
                                <input type="hidden" name="sName" value="?f={/ShowPage/@id}" />
                                <input type="hidden" name="sTemplate" value="Xtern" />
                                <input type="hidden" name="keepopen" value="keepopen" />
                                <input type="hidden" name="sStatus" value="ActiveLink" />
                                <input type="hidden" name="sNextEdit" value="this" />
                            </form>
                        </td>
                        <xsl:if test="count(Subobj[sTemplate=$lsTemplateSelected])">
                            <xsl:choose>
                                <xsl:when test="Modus='all'">
                                    <td>
                                        <form method="get" action="{Script}">
                                            <input type="submit" value="Normaler Modus" class="submit"/>
                                            <input type="hidden" name="f" value="{@id}"/>
                                        </form>
                                    </td>
                                </xsl:when>
                                <xsl:otherwise>
                                    <td>
                                        <form method="get" action="{Script}">
                                            <input type="submit" value="Zeigen aller Eintragungen" class="submit"/>
                                            <input type="hidden" name="f" value="{@id}"/>
                                            <input type="hidden" name="m" value="all"/>
                                            <input type="hidden" name="v" value="{$lsTemplateSelected}"/>
                                        </form>
                                    </td>
                                </xsl:otherwise>
                            </xsl:choose>
                        </xsl:if>
                        <xsl:choose>
                            <xsl:when test="count(xRootNode)">
                                <td>
                                    <form method="get" action="{Script}" target="_blank" id="ListMan">
                                        <input type="submit" value="Unterstützende Liste ..." class="submit" />
                                        <input type="hidden" name="f" value="{xAID}"/>
                                    </form>
                                </td>
                            </xsl:when>
                            <xsl:when test="count(ActiveLinked[@class='ActiveLink' or @class='super']) > 1">
                                <td>
                                    <form method="get" action="{Script}" name="tosuper">
                                        <select style="width: 170px;" onchange="this.form.submit();" name="f">
                                            <option value="{@super}">
                                                Zum Übergeordneten ...
                                            </option>
                                            <xsl:for-each select="ActiveLinked[@class='ActiveLink' or @class='super']">
                                                <option value="{@id}">
                                                    <xsl:value-of select="."/>
                                                </option>
                                            </xsl:for-each>
                                        </select>
                                    </form>
                                </td>
                            </xsl:when>
                            <xsl:otherwise>
                                <td>
                                    <form method="get" action="{Script}" id="ToSuper">
                                        <input type="submit" value="Zum Übergeordneten" class="submit"/>
                                        <input type="hidden" name="f" value="{@super}"/>
                                    </form>
                                </td>
                            </xsl:otherwise>
                        </xsl:choose>
                    </tr>
                </tbody>
            </table>
            <br/>
            <xsl:if test="count(//Subobj[sTemplate!=$lsTemplateSelected]) or count(ActiveLinked[@class='Predecessor' or @class='FormerPosition'])">

                <table border="0" cellspacing="0" cellpadding="2" id="detail">
                    <tbody>
                        <xsl:if test="//Modus!='all' and (count(Subobj[sTemplate!=$lsTemplateSelected and Status[@class='Predecessor' or @class='FormerPosition']])>0
                        or count(ActiveLinked[@class='Predecessor' or @class='FormerPosition'])>0)">
                            <tr class="header">
                                <td>Verbindung</td>
                                <xsl:if test="//Modus='all'">
                                    <td>Kontakt</td>
                                </xsl:if>
                                <td>Inhalt</td>
                            </tr>
                            <xsl:apply-templates select="ActiveLinked[@class='FormerPosition' or @class='Predecessor']" mode="link"/>
                            <xsl:apply-templates mode="Notes" 
                                select="//Subobj[sTemplate!=$lsTemplateSelected and Status[@class='Predecessor' or @class='FormerPosition']]" />
                        </xsl:if>
                        <xsl:if test="count(//Subobj[sTemplate!=$lsTemplateSelected and 
                    Status[@class='Appointment' or @class='Deadline' or @class='Todo' or @class='Unpaid']])">
                            <tr class="header">
                                <td>Termin</td>
                                <xsl:if test="//Modus='all'">
                                    <td>Kontakt</td>
                                </xsl:if>
                                <td>Inhalt</td>
                            </tr>
                        </xsl:if>
                        <xsl:apply-templates mode="Notes" select="//Subobj[sTemplate!=$lsTemplateSelected and 
                    Status[@class='Appointment' or @class='Deadline' or @class='Todo' or @class='Unpaid']]">
                            <xsl:sort data-type="number" select="substring(Status/@time,7,2)"/>
                            <xsl:sort data-type="number" select="substring(Status/@time,4,2)"/>
                            <xsl:sort data-type="number" select="substring(Status/@time,1,2)"/>
                            <xsl:sort data-type="number" select="substring(Status/@time,10,2)"/>
                            <xsl:sort data-type="number" select="substring(Status/@time,13,2)"/>
                        </xsl:apply-templates>
                        <xsl:if test="count(//Subobj[sTemplate!=$lsTemplateSelected and count(Status/@time)=0])">
                            <tr class="header">
                                <td  style="width:150px;">Zeit</td>
                                <xsl:if test="//Modus='all'">
                                    <td>Kontakt</td>
                                </xsl:if>
                                <td>Notiz</td>
                            </tr>
                            <xsl:apply-templates select="//Subobj[sTemplate!=$lsTemplateSelected and count(Status/@time)=0]" mode="Notes">
                                <xsl:sort data-type="number" select="substring(@time,7,4)" order="descending"/>
                                <xsl:sort data-type="number" select="substring(@time,4,2)" order="descending"/>
                                <xsl:sort data-type="number" select="substring(@time,1,2)" order="descending"/>
                                <xsl:sort data-type="number" select="substring(@time,12,2)" order="descending"/>
                                <xsl:sort data-type="number" select="substring(@time,15,2)" order="descending"/>
                            </xsl:apply-templates>
                        </xsl:if>
                    </tbody>
                </table>
                <br/>
            </xsl:if>
            <xsl:if test="count(Subobj[sTemplate=$lsTemplateSelected])">
                <form action="{/ShowPage/Script}?f=move&amp;ex={/ShowPage/@id}" method="post" name="people">
                    <table border="0" cellspacing="0" cellpadding="2" id="detail">
                        <tbody>
                            <xsl:apply-templates select="." mode="detail" />
                        </tbody>
                    </table>
                </form>
                <br/>
            </xsl:if>
        </xsl:if>
    </xsl:template>
    <xsl:template match="ActiveLinked" mode="link">
        <tr>
            <td>
                <a href="{/ShowPage/Script}?f={@id}">
                    <xsl:choose>
                        <xsl:when test="@class='Predecessor'">
                            Nachfolger
                        </xsl:when>
                        <xsl:when test="@class='FormerPosition'">
                            Neue Position
                        </xsl:when>
                    </xsl:choose>
                </a>
            </td>
            <td>
                <xsl:value-of select="."/>
            </td>
        </tr>
    </xsl:template>
    <xsl:template match="Subobj" mode="Notes">
        <tr class="notes">
            <td nowrap="nowrap">
                <a href="{../Script}?f={@id}">
                    <xsl:choose>
                        <xsl:when test="Status/@class='Predecessor'">
                            <xsl:text>Vorgänger</xsl:text>
                        </xsl:when>
                        <xsl:when test="Status/@class='FormerPosition'">
                            <xsl:text>Ehemalige Position</xsl:text>
                        </xsl:when>
                        <xsl:when test="Status/@time!=''">
                            <xsl:value-of select="Status/@time"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="substring(@time,1,6)"/>
                            <xsl:value-of select="substring(@time,9,8)"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </a>
                <xsl:if test="Status[@class='Predecessor' or @class='FormerPosition']">
                    <a href="javascript:EditPage('{@id}');">
                        <img border="0" src="{/ShowPage/ImgDir}editable.gif"/>
                    </a>
                </xsl:if>
            </td>
            <xsl:if test="//Modus='all'">
                <td>
                    <a href="{../Script}?f={../@id}">
                        <xsl:value-of select="../sTitle"/>
                    </a>
                </td>
            </xsl:if>
            <td>
                <xsl:value-of select="sTitle"/>
            </td>
            <xsl:if test="count(xSonst|xTel)">
                <td>
                    <a href="{../Script}?f={@id}&amp;v=2Contact.xsl">
                        <xsl:value-of select="xSonst|xTel"/>
                    </a>
                </td>
            </xsl:if>
        </tr>
        <xsl:apply-templates select="Richtext" mode="note" />
    </xsl:template>
    <xsl:template match="Richtext" mode="note">
        <tr class="note_body">
            <tr>
                <td style="width: 150px;">
                </td>
                <td>
                    <xsl:apply-templates select="." />
                </td>
            </tr>
        </tr>
    </xsl:template>
    <!-- Having references to the field names -->
    <xsl:template match="xTel|xTel1|xTel2" mode="img">
        <xsl:if test=". != ''">
            <a target="_blank">
                <xsl:apply-templates select="." mode="href"/>
                <img src="{/ShowPage/ImgDir}connection.gif" alt="{$lsConnectionGif}" border="0"/>
            </a>
        </xsl:if>
    </xsl:template>
    <xsl:template match="xTel|xTel1|xTel2" mode="href">
        <xsl:variable name="t1" select="translate(.,'() -.','')"/>
        <xsl:variable name="t">
            <xsl:choose>
                <xsl:when test="starts-with($t1,'+')">
                    00<xsl:value-of select="substring($t1,2)"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$t1"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="mt" select="substring($t,3,2)"/>
        <xsl:variable name="tel">
            <xsl:choose>
                <xsl:when test="starts-with($t,'01')">
                    <xsl:choose>
                        <xsl:when test="$mt= '63' or $mt='77' or $mt='78' or $mt='57'">0178</xsl:when>
                        <xsl:when test="$mt= '59' or $mt='76' or $mt='79'">0179</xsl:when>
                        <xsl:when test="$mt= '51' or $mt='60' or $mt='70' or $mt='71' or $mt='75'">0171</xsl:when>
                        <xsl:when test="$mt= '52' or $mt='62' or $mt='72' or $mt='73' or $mt='74'">0172</xsl:when>
                    </xsl:choose>
                </xsl:when>
                <xsl:when test="starts-with($t,'008613') or starts-with($t,'13')">008613</xsl:when>
                <xsl:when test="starts-with($t,'0086')">0086</xsl:when>
                <xsl:when test="starts-with($t,'00886')">00886</xsl:when>
                <xsl:when test="starts-with($t,'001')">001</xsl:when>
                <xsl:when test="starts-with($t,'0049')">Fern</xsl:when>
                <xsl:when test="starts-with($t,'00')">
                    <xsl:value-of select="substring($t,1,4)"/>
                </xsl:when>
                <xsl:otherwise>Fern</xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:attribute name="href">
            http://telefontarife.focus.de/telefon/tarifrechner.asp?Destination=<xsl:value-of select="$tel"/>&amp;Date=-1&amp;Time=-1&amp;Duration=1&amp;Tariffs=1&amp;Tarifansage=2&amp;suchen=anzeigen
        </xsl:attribute>
    </xsl:template>
    <xsl:template match="xTel">
        <xsl:value-of select="."/>
        <xsl:text> </xsl:text>
        <a target="_blank">
            <xsl:apply-templates select="." mode="href"/>
            <img src="{/ShowPage/ImgDir}right.gif"  boder="0"/>
        </a>
    </xsl:template>
    <xsl:template match="xMail">
        <xsl:if test=". != ''">
            <a href="mailto:{.}">
                <img src="{/ShowPage/ImgDir}connection.gif" alt="{$lsConnectionGif}" border="0"/>
            </a>
        </xsl:if>
    </xsl:template>
    <!-- To be customized -->
    <xsl:template match="Subobj" mode="People">
        <tr class="people">
            <td>
                <input type="checkbox" name="para" value="{@id}" style="height: 14px;"/>
            </td>
            <td>
                <a href="{../Script}?f={@id}">
                    <xsl:value-of select="sTitle"/>
                    <xsl:if test="count(sTitle)=0 or sTitle=''">[Neuer Kontakt]</xsl:if>
                    <xsl:choose>
                        <xsl:when test="count(/ShowPage/xRootNode) and count(Subobj[sTemplate!=$lsTemplateSelected and Status/@time!=''])">
                            <img border="0" src="{/ShowPage/ImgDir}clock.gif" alt="{$lsClockGif}"/>
                        </xsl:when>
                        <xsl:when test="count(Subobj[sTemplate=$lsTemplateSelected])">
                            <img border="0" src="{/ShowPage/ImgDir}closed.gif" alt="{$lsClosedGif}"/>
                        </xsl:when>
                    </xsl:choose>
                </a>
            </td>
            <td>
                <xsl:value-of select="Body/xPosition|xPosition"/>
                <xsl:text>&#160;</xsl:text>
            </td>
            <td>
                <xsl:apply-templates select="Body/xTel|xTel"/>
                <xsl:text>&#160;</xsl:text>
            </td>
            <td>
                <xsl:choose>
                    <xsl:when test="Body/xListNode!='' or xListNode != '' or Body/xMail='' or xMail=''">
                        <a href="{Body/xURL|xURL}" target="_new12">
                            <xsl:value-of select="Body/xURL|xURL"/>
                        </a>
                    </xsl:when>
                    <xsl:otherwise>
                        <a href="mailto:{Body/xMail|xMail}">
                            <xsl:value-of select="Body/xMail|xMail"/>
                        </a>
                    </xsl:otherwise>
                </xsl:choose>
                <xsl:text>&#160;</xsl:text>
            </td>
        </tr>
    </xsl:template>
    <xsl:template match="ShowPage" mode="update">
        <input type="hidden" name="xBodyFields"
    value="xContact,xAddress,xInfo,xTel,xMail,xTel1,xTel2,xURL,xListNode,xPosition,xBranche,xAID,xAkdTitel"/>
        <input type="hidden" name="xAID" value="{xAID}"/>
        <table border="0"  style="border: 1px solid #cccccc; width: {$tablewidth}px;" cellpadding="2">
            <tbody>
                <tr>
                    <td style="width: 74px;">Kontakt</td>
                    <td style="text-align: left;">
                        <input type="text" name="sTitle" class="i1" value="{sTitle}" onchange="yellow(sTitle);"/>
                    </td>
                    <td nowrap="nowrap" style="width: 74px;">Akad. Titel</td>
                    <td style="text-align: left;">
                        <select name="xAkdTitel" class="i1" ondblclick="yellow(xAkdTitel);" >
                            <option>
                                <xsl:value-of select="xAkdTitel"/>
                            </option>
                            <xsl:if test="xAkdTitel!=''">
                                <option/>
                            </xsl:if>
                            <xsl:for-each select="Options/Section[@id='Akademischer Titel']/Option">
                                <xsl:sort select="sort"/>
                                <option>
                                    <xsl:value-of select="."/>
                                </option>
                            </xsl:for-each>
                        </select>
                    </td>
                    <td width="1"/>
                </tr>
                <tr>
                    <td>Adresse</td>
                    <td>
                        <textarea name="xAddress" class="i1"  rows="6"  onchange="yellow(xAddress);">
                            <xsl:value-of select="xAddress"/>
                        </textarea>
                    </td>
                    <td>Info</td>
                    <td>
                        <textarea name="xInfo" class="i1" rows="6"  onchange="yellow(xInfo);">
                            <xsl:value-of select="xInfo"/>
                            <xsl:value-of select="xSonst"/>
                        </textarea>
                    </td>
                </tr>
                <tr>
                    <td>
                        Tel. <xsl:apply-templates select="xTel" mode="img"/>
                    </td>
                    <td>
                        <input type="text" name="xTel" class="i1"  value="{xTel}"  onchange="yellow(xTel);">
                        </input>
                    </td>
                    <td nowrap="nowrap">
                        E-Mail <xsl:apply-templates select="xMail"/>
                    </td>
                    <td>
                        <input type="text" name="xMail" class="i1" value="{xMail}"  onchange="yellow(xMail);">
                        </input>
                    </td>
                </tr>
                <tr>
                    <td>
                        Tel. <xsl:apply-templates select="xTel1" mode="img"/>
                    </td>
                    <td>
                        <input type="text" name="xTel1" class="i1" value="{xTel1}"  onchange="yellow(xTel1);">
                        </input>
                    </td>
                    <td nowrap="nowrap">
                        Tel. <xsl:apply-templates select="xTel2" mode="img"/>
                    </td>
                    <td>
                        <input type="text" name="xTel2" class="i1" value="{xTel2}"  onchange="yellow(xTel2);">
                        </input>
                    </td>
                </tr>
                <tr>
                    <td>Branche</td>
                    <td>
                        <select name="xBranche" class="i1" onclick="yellow(xBranche);">
                            <option>
                                <xsl:value-of select="xBranche"/>
                            </option>
                            <xsl:if test="xBranche!=''">
                                <option/>
                            </xsl:if>
                            <xsl:for-each select="Options/Section[@id='Branche']/Option">
                                <xsl:sort select="."/>
                                <option>
                                    <xsl:value-of select="."/>
                                </option>
                            </xsl:for-each>
                        </select>
                    </td>
                    <td>Position</td>
                    <td>
                        <select name="xPosition" class="i1" onclick="yellow(xPosition);">
                            <option>
                                <xsl:value-of select="xPosition"/>
                            </option>
                            <xsl:if test="xPosition!=''">
                                <option/>
                            </xsl:if>
                            <xsl:for-each select="Options/Section[@id='Position']/Option">
                                <xsl:sort select="sort"/>
                                <option>
                                    <xsl:value-of select="."/>
                                </option>
                            </xsl:for-each>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">
                        URL <xsl:if test="xURL != ''">
                            <a href="{xURL}">
                                <img src="{/ShowPage/ImgDir}connection.gif" alt="{$lsConnectionGif}" border="0"/>
                            </a>
                        </xsl:if>
                    </td>
                    <td colspan="2">
                        <input type="text" name="xURL" style="width: 330px;" value="{xURL}"  onchange="yellow(xURL);">
                        </input>
                    </td>
                    <td style="text-align: right;">
                        <input type="submit" value="Speichern" class="i1" style="width:100%;"/>
                    </td>
                </tr>
            </tbody>
        </table>
    </xsl:template>
    <xsl:template match="ShowPage" mode="NewContact">
        <input type="hidden" name="xBodyFields" value="xAddress,xTel,xMail,xTel1,xTel2,xURL,xBranche,xAID"/>
        <input type="hidden" name="xAID" value="{xAID}"/>
        <input type="hidden" name="xAddress" value="{xAddress}"/>
        <input type="hidden" name="xTel" value="{xTel}"/>
        <input type="hidden" name="xMail" value="{xMail}"/>
        <input type="hidden" name="xTel1" value="{xTel1}"/>
        <input type="hidden" name="xTel2" value="{xTel2}"/>
        <input type="hidden" name="xURL" value="{xURL}"/>
        <input type="hidden" name="xBranche" value="{xBranche}"/>
    </xsl:template>
    <xsl:template match="ShowPage" mode="detail">
        <tr class="header">
            <td>
                <input type="image" src="{/ShowPage/ImgDir}move.gif" title="{$lsMove}" onclick="document.people.submit();"/>
            </td>
            <td>
                <xsl:text>Kontakt </xsl:text>
                <xsl:apply-templates select="." mode="makelist"/>
            </td>
            <td>Position</td>
            <td>Tel</td>
            <td>Mail/URL</td>
        </tr>
        <xsl:apply-templates select="Subobj[sTemplate=$lsTemplateSelected]" mode="People">
            <xsl:sort select="sTitle" order="ascending"/>
        </xsl:apply-templates>
    </xsl:template>
    <xsl:template match="ShowPage" mode="makelist">
        <xsl:if test="count(Subobj[sTemplate=$lsTemplateSelected]) > 13">
            <select id="goquick" style="width: 70px;" onchange="ShowItems(this);">
                <option>
                    <xsl:value-of select="$lsAllItems"/>
                </option>
                <xsl:for-each select="Subobj[sTemplate=$lsTemplateSelected]">
                    <xsl:sort select="sTitle"/>
                    <xsl:variable name="t" select="translate(substring(sTitle,1,2),'abcdefghijlmnopqrstuvwxyzäöü','ABCDEFGHIJLMNOPQRSTUVWXYZÄÖÜ')" />
                    <xsl:choose>
                        <xsl:when test="preceding-sibling::Subobj[translate(substring(sTitle,1,2),'abcdefghijlmnopqrstuvwxyzäöü','ABCDEFGHIJLMNOPQRSTUVWXYZÄÖÜ') = $t]" />
                        <xsl:otherwise>
                            <option>
                                <xsl:value-of select="translate(substring(sTitle,1,2),'abcdefghijlmnopqrstuvwxyzäöü','ABCDEFGHIJLMNOPQRSTUVWXYZÄÖÜ')"/>
                            </option>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:for-each>
                <!--
                <xsl:apply-templates select="Subobj[sTemplate=$lsTemplateSelected]" mode="listitem">
                    <xsl:sort select="sTitle"/>
                    <xsl:with-param name="pos" select="10"/>
                </xsl:apply-templates>
                -->
            </select>
        </xsl:if>
    </xsl:template>
    <xsl:template match="Subobj" mode="listitem">
        <xsl:param name="last" select="''" />
        <xsl:param name="pos" select="1" />
        <xsl:choose>
            <xsl:when test="$pos > count(../Subobj[sTemplate=$lsTemplateSelected])">
            </xsl:when>
            <xsl:when test="$last = substring(sTitle,1,2)">
                
            </xsl:when>
            <xsl:otherwise>
                
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <xsl:param name="lsAllItems">All</xsl:param>
    <xsl:param name="lsTemplateSelected">NextContact.xsl</xsl:param>
</xsl:stylesheet>
