-}
-
-#---------- initial checks, startup, main entry form ----------
-
-dbw_connect($a{Ocean});
-
-</%perl>
-<%args>
-$debug => 0
-$routestring => ''
-</%args>
-
-<hr>
-
-%########### query `route' ##########
-% if ($a{Query} eq 'route') {
-
-<h1>Specify route</h1>
-<form action="<% $quri->() |h %>" method="get">
-
-%#---------- textbox, user enters route as string ----------
-% if (!$a{Dropdowns}) {
-
-Enter route (islands, or archipelagoes, separated by |s or commas;
- abbreviations are OK):<br/>
-
-<&| script &>
-tr_uri= "routetextstring?format=json&type=text/xml"
- + "&ocean=<% uri_escape($a{Ocean}) %>";
-
-tr_timeout=false;
-tr_request=false;
-tr_done='';
-tr_needed='';
-function tr_Later(){
- window.clearTimeout(tr_timeout);
- tr_timeout = window.setTimeout(tr_Needed, 500);
-}
-function tr_Needed(){
- window.clearTimeout(tr_timeout);
- tr_element= document.getElementById('routestring');
- tr_needed= tr_element.value;
- tr_Request();
-}
-function tr_Request(){
- if (tr_request || tr_needed==tr_done) return;
- tr_done= tr_needed;
- tr_request= new XMLHttpRequest();
- uri= tr_uri+'&string='+encodeURIComponent(tr_needed);
- tr_request.open('GET', uri);
- tr_request.onreadystatechange= tr_Ready;
- tr_request.send(null);
-}
-function tr_Ready() {
- if (tr_request.readyState != 4) return;
- if (tr_request.status == 200) {
- response= tr_request.responseText;
- eval('results='+response);
- toedit= document.getElementById('routeresults');
- toedit.innerHTML= results.show;
- }
- tr_request= false;
- tr_Request();
-}
-window.onload= tr_Needed;
-</&script>
-
-<input type="text" id="routestring" name="routestring" size=80
- value="<% $routestring |h %>"
- onchange="tr_Needed();"
- onkeyup="tr_Later();"><br>
-<div id="routeresults"> </div><br/>
-
-% } else { #---------- dropdowns, user selects from menus ----------