<form id="search_form" action="<tag:action />" method="post">
 <input class="hidden" name="criteria_form" id="criteria_form" value="" />
 <input class="hidden" name="folders_form" id="folders_form" value="" />

 <h1 class="header">
  <strong>
<if:edit_query_vfolder>
   <gettext>Edit Virtual Folder</gettext>
<else:edit_query_vfolder>
<if:edit_query_filter>
   <gettext>Edit Filter</gettext>
<else:edit_query_filter>
   <gettext>Search</gettext>
</else:edit_query_filter></if:edit_query_filter>
</else:edit_query_vfolder></if:edit_query_vfolder>
  </strong>
 </h1>

 <div id="recent_searches_div" class="smallheader leftAlign" style="display:none">
  <gettext>Recent Searches</gettext>
 </div>

 <div class="item" style="display:none">
  <label for="recent_searches" class="hidden"><gettext>Recent Searches:</gettext></label>
  <select id="recent_searches">
   <option value=""><gettext>Recent Searches:</gettext></option>
  </select>
 </div>

 <div class="smallheader leftAlign">
  <gettext>Search Criteria</gettext>
 </div>

 <div class="item">
  <div id="no_search_criteria"><gettext>No Search Criteria</gettext></div>
  <div id="search_criteria" style="display:none"></div>

  <div class="searchAdd">
   <select id="search_criteria_add">
    <option value=""><gettext>Add search criteria:</gettext></option>
    <option value="" disabled="disabled">- - - - - - - - -</option>
    <option value="or" style="display:none"><gettext>Add OR clause</gettext></option>
    <option value="" disabled="disabled" style="display:none">- - - - - - - - -</option>
<loop:clist>
    <option value="<tag:clist.val />"><tag:clist.label /></option>
</loop:clist>
    <option value="" disabled="disabled">- - - - - - - - -</option>
<loop:filterlist>
    <option value="<tag:filterlist.val />"><tag:filterlist.label /></option>
</loop:filterlist>
    <option value="" disabled="disabled">- - - - - - - - -</option>
<loop:flist>
    <option value="<tag:flist.val />"><tag:flist.label /></option>
</loop:flist>
   </select>
  </div>
 </div>

<if:edit_query_filter><else:edit_query_filter>
 <div class="smallheader leftAlign">
  <gettext>Search Folders</gettext>
 </div>

 <div class="item">
  <div id="no_search_folders"><gettext>No Search Folders</gettext></div>
  <div id="search_folders" style="display:none"></div>

  <div class="searchAdd">
   <select id="search_folders_add">
    <tag:tree />
   </select>
  </div>
 </div>
</else:edit_query_filter></if:edit_query_filter>

 <div class="smallheader leftAlign">
  <gettext>Saved Searches</gettext>
 </div>

 <div>
<if:edit_query_vfolder>
  <input type="hidden" id="search_type" name="search_type" value="vfolder" />
  <input type="hidden" name="edit_query_vfolder" value="<tag:edit_query_vfolder />" />
<else:edit_query_vfolder>
<if:edit_query_filter>
  <input type="hidden" id="search_type" name="search_type" value="filter" />
  <input type="hidden" name="edit_query_filter" value="<tag:edit_query_filter />" />
<else:edit_query_filter>
  <div class="item">
   <label for="search_type"><gettext>Type:</gettext></label>
   <select id="search_type" name="search_type">
    <option value="" selected="selected">- - - - - -</option>
    <option value="filter"><gettext>Filter</gettext></option>
    <option value="vfolder"><gettext>Virtual Folder</gettext></option>
   </select>
  </div>
</else:edit_query_filter></if:edit_query_filter>
</else:edit_query_vfolder></if:edit_query_vfolder>
  <div class="item">
   <label for="search_label"><gettext>Label:</gettext></label> <input type="text" name="search_label" id="search_label"<if:search_label> value="<tag:search_label />"</if:search_label> />
  </div>
 </div>

 <div class="searchuiButtons">
<if:edit_query>
  <input type="button" id="search_submit" class="button" value="<gettext>Save</gettext>" />
  <input type="button" id="search_edit_query_cancel" class="button" value="<gettext>Cancel</gettext>" />
<else:edit_query>
  <input type="button" id="search_submit" class="button" value="<gettext>Submit</gettext>" />
  <input type="button" id="search_reset" class="button" value="<gettext>Reset</gettext>" />
</else:edit_query></if:edit_query>
<if:return_mailbox_val>
  <input type="button" id="search_dimp_return" class="button" value="<tag:return_mailbox_val />" />
</if:return_mailbox_val>
 </div>
</form>

<select id="within_criteria" style="display:none">
 <option value="d"><gettext>Days</gettext></option>
 <option value="m"><gettext>Months</gettext></option>
 <option value="y"><gettext>Years</gettext></option>
</select>
