how to put two function together
<p>I want to write a function to make user click the table header double click and change into descending or ascending order, and I have finished the sorting function, but don't know how to put together, now I just put one of them into the header as following:</p>

<pre><code>function sortBy(sKey)
{
   document.sortResultsForm.sSortBy.value=sKey;
   document.sortResultsForm.submit();
}

if($sSortBy=="District")
{
   usort($tempArr, 'sortDistrictNameascend');
}

 &lt;table border="0" width="100%" cellspacing="2" cellpadding="2"&gt;
   &lt;tr&gt; &lt;td class="headTable" width=15%&gt;
     &lt;a href="javascript:sortBy('District');"
       &gt;&lt;font color=white&gt;District&lt;/font&gt;&lt;/a&gt;
   &lt;/td&gt;
</code></pre>

<p>and I don't know how to put the other function into the header let user can double click to change sorting order, the order function as following:</p>

<pre><code>function sortDistrictNamedescend($a, $b)
{
    if ($a-&gt;DistrictName == $b-&gt;DistrictName)
    {
        return 0;
    }
    return ($a-&gt;DistrictName &lt; $b-&gt;DistrictName) ? 1 : -1;
}

usort($tempArr, 'sortDistrictNamedescend');
</code></pre>

<p>anybody can help me, thank you very much.</p>
