+}
+
+@# Always have a search form
+ <div class=search>
+ <form class=search
+ action="@url"
+ method=POST
+ enctype="multipart/form-data" accept-charset=utf-8>
+ <p class=search>Enter search terms:
+ <input class=query name=query type=text value="@argq{query}"
+ size=50>
+ @submit{@label{search.search}}
+ <input name=action type=hidden value=choose>
+ </p>
+ </form>
+@actbutton{@label{search.clear}}{}{choose}
+ </div>
+
+ @if{@ne{@arg{query}}{}}
+ {@# There's a search query
+ <table class=search>
+ <tr class=headings>
+ <th class=artist>@label{heading.artist}</th>
+ <th class=album>@label{heading.album}</th>
+ <th class=title>@label{heading.title}</th>
+ <th class=length>@label{heading.length}</th>
+@right{prefs}{
+ <th class=button> </th>}
+ </tr>
+ @search{@arg{query}}{
+ <tr class=@parity>
+ <td class=artist>@martist{search}{@track}</td>
+ <td class=album>@malbum{search}{@track}</td>
+ <td class=title>@mtitleplay{search}{@track}</td>
+ <td class=length>@length{@track}</td>
+ @right{prefs}{
+ <td class=imgbutton>
+ <a class=imgbutton
+ href="@url?action=prefs&track=@urlquote{@track}">
+ <img class=button src="@image{edit}"
+ title="@label{choose.prefsverbose}"
+ alt="@label{choose.prefs}">
+ </a>
+ </td>
+ </tr>}
+ }
+ </table>}
+ {@# No search query
+
+@# We have the following possible cases:
+@# choose.which dir re result
+@# choose "" - Ask for top level
+@# choose "" present Ask for top level with re applied
+@# choose present - Ask for dir
+@# choose present re Ask for dir with re applied
+@# choosealpha "" - Nothing
+@# choosealpha "" present Ask for top level with re applied
+@# choosealpha present - Ask for dir
+@# choosealpha present re Ask for dir with re applied
+@#
+@# So in fact the only oddity is choosealpha + no dir + no re.
+@#
+@# NB we don't really bother distinguishing between re being empty or absent,
+@# and the server deliberately cooperates in this.
+
+ @if{@ne{@arg{dir}}{}}{
+ <p class=directoryname>@#
+@breadcrumbs{@arg{dir}}
+ {/<a href="@url?action=choose&dir=@urlquote{@dir}">@#
+@basename{@dir}</a>}:</p>}