Added preliminary autocompletion support
diff --git a/templates/collections.html.ep b/templates/collections.html.ep
index 3dee20f..3f73e96 100644
--- a/templates/collections.html.ep
+++ b/templates/collections.html.ep
@@ -1,14 +1,14 @@
 <h2>Virtual Collections</h2>
 <ul>
 % foreach my $vc (@{resource_info('collection')}) {
-<li class="active" title="<%= $vc->{description} // '' %>"><h3><%= $vc->{name} %></h3>
+  <li class="active" title="<%= $vc->{description} // '' %>"><h3><%= $vc->{name} %></h3>
 % my $stats = $vc->{stats};
-  <dl class="info">
-    <dt>Documents</dt><dd><%= commify $stats->{documents} %></dd>
-    <dt>Paragraphs</dt><dd><%= commify $stats->{paragraphs} %></dd>
-    <dt>Sentences</dt><dd><%= commify $stats->{sentences} %></dd>
-    <dt>Tokens</dt><dd><%= commify $stats->{tokens} %></dd>
-  </dl>
-</li>
+    <dl class="info">
+      <dt>Documents</dt>  <dd><%= commify $stats->{documents} %></dd>
+      <dt>Paragraphs</dt> <dd><%= commify $stats->{paragraphs} %></dd>
+      <dt>Sentences</dt>  <dd><%= commify $stats->{sentences} %></dd>
+      <dt>Tokens</dt>     <dd><%= commify $stats->{tokens} %></dd>
+    </dl>
+  </li>
 % };
 </ul>
diff --git a/templates/intro.html.ep b/templates/intro.html.ep
new file mode 100644
index 0000000..bcf4117
--- /dev/null
+++ b/templates/intro.html.ep
@@ -0,0 +1,5 @@
+<div id="intro">
+  <p>This is the alternative KorAP Frontend.</p>
+  <p>The primary goal is to serve as a testbed for the query serialization and for different flavours of user interfaces.</p>
+  <p>Search capabilities are limited to the demo user.</p>
+</div>
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index 2af32a2..a14b0e0 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -3,11 +3,13 @@
   <head>
     <title><%= title %></title>
 %= stylesheet '/style.css'
+%= stylesheet '/hint.css'
 %= stylesheet '/table.css'
 %= stylesheet '/kwic-4.0.css'
 %= stylesheet '/fontawesome/font-awesome.min.css'
 %= javascript '/jquery-2.0.0.min.js'
 %= javascript '/translateTable.js'
+%= javascript '/hint.js'
 <meta charset="utf-8" />
   </head>
   <body>
@@ -26,7 +28,59 @@
 %= form_for url_for() => begin
 %= select_field ql => [[Poliqarp => 'poliqarp'], ['Cosmas II' => 'cosmas2']], id => 'ql-field'
 <br />
-%= search_field 'q', id => 'q-field'
+%= search_field 'q', id => 'q-field', autofocus => 'autofocus'
+%= javascript begin
+new Hint({
+  "ref" : "q-field",
+  "hintSize" : 10,
+  "hints" : {
+    "corenlp" : {
+      "ne_dewac_175m_600" : ["ne_dewac_175m_600=", "Named Entity"],
+      "ne_hgc_175m_600" : ["ne_hgc_175m_600=", "Named Entity"]
+    },
+    "corenlp/ne_dewac_175m_600" : ["I-LOC","I-MISC","I-ORG","I-PER"],
+    "corenlp/ne_hgc_175m_600" : ["I-LOC","I-MISC","I-ORG","I-PER"],
+    "cnx" : {
+      "c" : ["c=", "Constituency"],
+      "l" : ["l=", "Lemma"],
+      "m" : ["m=", "Morpho Syntax"],
+      "p" : ["p=", "Part of Speech"],
+      "syn" : ["syn=", "Syntax"]
+    },
+    "cnx/m" : ["Abbr","CMP","IMP","IND","INF","ORD","PAST","PCP","PERF","PL","PRES","PROG","Prop","SUB","SUP"],
+    "cnx/p" : ["A","ADV","CC","CS","DET","INTERJ","N","NUM","PREP","PRON","V"],
+    "cnx/syn" : ["@ADVL","@AUX","@CC","@MAIN","@NH","@POSTMOD","@PREMARK","@PREMOD"],
+    "opennlp" : {
+      "p" : ["p=", "Part of Speech"]
+    },
+    "opennlp/p" : ["$(","$,","$.","ADJA","ADJD","ADV","APPR","APPRART","ART","CARD","FM","KOKOM","KON","KOUI","KOUS","NE","NN","PDAT","PDS","PIAT","PIS","PPER","PPOSAT","PRELS","PRF","PROAV","PTKNEG","PTKVZ","PTKZU","PWAT","PWAV","PWS","TRUNC","VAFIN","VAINF","VAPP","VMFIN","VVFIN","VVIMP","VVINF","VVIZU","VVPP","XY"],
+    "xip" : {
+      "c" : ["c=", "Constituency"],
+      "d" : ["d=", "Dependency"],
+      "l" : ["l=", "Lemma"],
+      "p" : ["p=", "Part of Speech"]
+    },
+    "xip/c" : ["ADJ","ADV","AP","CONJ","DET","INFC","INS","ITJ","MC","NEGAT","NOUN","NP","NPA","NUM","POSTP","PP","PREP","PRON","PTCL","PUNCT","SC","SYMBOL","TOP","TRUNC","VERB"],
+    "xip/d" : ["ADJMOD","AUXIL","CONNECT","COORD","DATE","DETERM","EXPL","LOC","MODAL","NEGAT","NMOD","NMOD2","NUMMOD","OBJ","ORG","PERSON","PLINK","PRED","REFLEX","SUBJ","THEMA","TIME","TRUNC","VMAIN","VMOD","VPREF"],
+    "xip/p" : ["ADJ","ADV","CONJ","DET","ITJ","NEGAT","NOUN","NUM","POSTP","PREP","PRON","PTCL","PUNCT","SYMBOL","TRUNC","VERB"],
+    "tt" : {
+      "l" : ["l=", "Lemma"],
+      "p" : ["p=", "Part of Speech"]
+    },
+    "tt/p" : ["$.","ADJA","ADJD","ADV","APPO","APPR","APPRART","APZR","ART","CARD","FM","ITJ","KOKOM","KON","KOUI","KOUS","NE","NN","PDAT","PDS","PIAT","PIS","PPER","PPOSAT","PRELS","PRF","PROAV","PTKA","PTKNEG","PTKVZ","PTKZU","PWAT","PWAV","PWS","TRUNC","VAFIN","VAINF","VAPP","VMFIN","VMINF","VVFIN","VVIMP","VVINF","VVIZU","VVPP","XY"],
+    "mate" : {
+      "d" : ["d=", "Dependency"],
+      "l" : ["l=", "Lemma"],
+      "m" : ["m=", "Morpho Syntax"],
+      "p" : ["p=", "Part of Speech"]
+    },
+    "mate/d" : ["--","AG","AMS","APP","CC","CD","CJ","CM","CP","CVC","DA","DM","EP","JU","MNR","MO","NG","NK","NMC","OA","OC","OG","OP","PAR","PD","PG","PH","PM","PNC","RC","RE","RS","SB","SBP","SVP","UC"],
+    "mate/m" : ["<no-type>","case:*","case:acc","case:dat","case:gen","case:nom","degree:comp","degree:pos","degree:sup","gender:*","gender:fem","gender:masc","gender:neut","mood:imp","mood:ind","mood:subj","number:*","number:pl","number:sg","person:1","person:2","person:3","tense:past","tense:pres"],
+    "mate/p" : ["$(","$,","$.","<root-POS>","ADJA","ADJD","ADV","APPO","APPR","APPRART","ART","CARD","FM","ITJ","KOKOM","KON","KOUI","KOUS","NE","NN","PDAT","PDS","PIAT","PIS","PPER","PPOSAT","PPOSS","PRELAT","PRELS","PRF","PROAV","PTKA","PTKNEG","PTKVZ","PTKZU","PWAT","PWAV","PWS","TRUNC","VAFIN","VAINF","VAPP","VMFIN","VVFIN","VVIMP","VVINF","VVIZU","VVPP","XY"]
+  }}
+);
+
+% end
 <button type="submit" name="action" value="ok"><i class="fa fa-search"></i></button>
 <button type="submit" name="action" value="inspect"><i class="fa fa-code"></i></button>
 % end
diff --git a/templates/query.html.ep b/templates/query.html.ep
index 6ef646f..3485296 100644
--- a/templates/query.html.ep
+++ b/templates/query.html.ep
@@ -1,8 +1,11 @@
 % use JSON::XS;
 
 % if (stash('search.query')) {
-<code class="query serial<% if (param('action') eq 'inspect') { %> active<% } %>"><span>JSON-LD Query for <%= param 'q' %> (<%= param 'ql' %>)</span><pre>
-%  my $json = JSON::XS->new->allow_blessed->pretty;
-%= $json->encode(stash('search.query'))
-</pre></span></code>
-% }
+%   state $json = JSON::XS->new->allow_blessed->pretty;
+<code class="query serial<% if (param('action') eq 'inspect') { %> active<% } %>">
+  <span>JSON-LD Serialization for <%= param 'q' %> (<%= param 'ql' %>)</span>
+  <pre>
+<%= $json->encode(stash('search.query')) =%>
+  </pre>
+</code>
+% };
diff --git a/templates/search.html.ep b/templates/search.html.ep
index a409a40..c393c72 100644
--- a/templates/search.html.ep
+++ b/templates/search.html.ep
@@ -3,49 +3,37 @@
 
 % unless (param 'snippet') {
 <div style="clear: both">
-  <p class="found">
-    <span class="pagination">
 % my $url = url_with->query(['p' => '{page}']);
 % my $pages = (stash('search.totalResults') / (stash('search.itemsPerPage') || 1));
 % $pages = $pages < 0 ? 0 : $pages;
-    </span>
-
-    <div id="pagination">
-%= pagination(stash('search.startPage'), $pages, $url)
-    </div>
-
-Found <span id="total-results"><%= commify(stash('search.totalResults')) %> matches</span>
-% if (stash 'search.bm.hit') {
- in <%= stash 'search.bm.hit' %> (<%= stash 'search.bm.result' %>)
-% }
+  <div id="pagination"><%= pagination(stash('search.startPage'), $pages, $url) =%></div>
+  <p class="found">Found
+    <span id="total-results"><%= commify(stash('search.totalResults')) %> matches</span>
+    <% if (stash 'search.bm.hit') { %> in <%= stash 'search.bm.hit' %> (<%= stash 'search.bm.result' %>)<% } %>
   </p>
 </div>
 
 %= include 'query'
 % };
 
+
+
 <ol class="left-aligned">
 %=  search_hits begin
-
+%# ID, title, corpusID, author, pubDate, textClass
   <li data-corpus-id="<%= $_->{corpusID} %>"
       data-doc-id="<%= korap_doc_id($_) %>"
       data-match-id="<%= korap_match_id($_) %>">
-%# ID, title, corpusID, author, pubDate, textClass
     <div>
-      <div class="snippet">
-        <%== $_->{snippet} %>
-      </div>
-
-%#    as <%= $_->{ID} %>
-%#  textClass docID
-%# foreach (grep { m!/morpho$! } split(/\s+/, $_->{foundries})) {
-%#  <%= $_ %>
-%# };
-
+      <div class="snippet"><%== $_->{snippet} %></div>
       <div class="tokenInfo"></div>
     </div>
-    <p><strong><%= $_->{title} %></strong><%= $_->{author} ? ' by ' . $_->{author}  : '' %>; published on <%= date_format $_->{pubDate} %> as <%= $_->{docID} %> (<%= $_->{corpusID} %>)</p>
-
+    <p>
+      <strong><%= $_->{title} %></strong>
+      <%= $_->{author} ? ' by ' . $_->{author}  : '' %>;
+      published on <%= date_format $_->{pubDate} %>
+      as <%= $_->{docID} %> (<%= $_->{corpusID} %>)
+    </p>
     <ul class="action right">
       <li onmouseup="closeSnippet(this)" title="close"><i class="fa fa-toggle-up"></i></li>
       <li onclick="showTable(this)" title="Annotations"><i class="fa fa-info-circle"></i></li>
@@ -54,16 +42,13 @@
       <li title="Remember"><i class="fa fa-star-o"></i></li>
 -->
     </ul>
-
-
   </li>
 %   end
 </ol>
+
 % end
-% } else {
-<div id="intro">
-  <p>This is the alternative KorAP Frontend.</p>
-  <p>The primary goal is to serve as a testbed for the query serialization and for different flavours of user interfaces.</p>
-  <p>Search capabilities are limited to the demo user.</p>
-</div>
+
+% }
+% else {
+%= include 'intro'
 % };