<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <link rel="stylesheet" href="lib/leaflet/leaflet.css" />
        <link rel="stylesheet" href="lib/leaflet/geosearch/l.geosearch.css" />

        <style type="text/css">
            body {
                padding: 0;
                margin: 0;
            }
            html, body, #map {
                height: 100%;
            }
        </style>

        <script type="text/javascript">
        // Required for Firefox 3.6
        if (!Function.prototype.bind) {
          Function.prototype.bind = function (oThis) {
            if (typeof this !== "function") {
              // closest thing possible to the ECMAScript 5 internal IsCallable function
              throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
            }

            var aArgs = Array.prototype.slice.call(arguments, 1),
                fToBind = this,
                fNOP = function () {},
                fBound = function () {
                  return fToBind.apply(this instanceof fNOP && oThis
                                         ? this
                                         : oThis,
                                       aArgs.concat(Array.prototype.slice.call(arguments)));
                };

            fNOP.prototype = this.prototype;
            fBound.prototype = new fNOP();

            return fBound;
          };
        }
        </script>

        <script src="lib/jquery-1.9.0.js"></script>
        <script src="lib/leaflet/leaflet.js"></script>
        <script src="lib/leaflet/geosearch/l.control.geosearch.js"></script>
        <script src="lib/leaflet/geosearch/l.geosearch.provider.iiab.js"></script>

        <script type="text/javascript">
            $(function () {
                var map = L.map('map'); /*.setView([51.505, -0.09], 14);*/
                L.tileLayer('/iiab/maps/tile/{z}/{x}/{y}.png', {
                    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
                    maxZoom: 15
                }).addTo(map);

                var geoOptions = {
                    provider: new L.GeoSearch.Provider.iiab(),
                    searchLabel: "Search by City Name...",
                    notFoundMessage: "No matches found",
                    zoomLevel: 8,
                    maxMarkers: 10,
                    maxResultCount: 15,
                    enableAutocomplete: true,
                    enableButtons: true
                };
                new L.Control.GeoSearch(geoOptions).addTo(map);

                map.fitWorld().setZoom(3);  // default world view
                //map.locate({setView: true, maxZoom: 15});
            });
        </script>
    </head>
    <body>
        <div id="map"></div>

    </body>
</html>
