]> ToastFreeware Gitweb - philipp/winterrodeln/mediawiki_extensions/wrmap.git/commitdiff
Now using OpenLayer version 2.14.dev.bf1bdb1.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 9 Dec 2016 21:00:28 +0000 (21:00 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 9 Dec 2016 21:00:28 +0000 (21:00 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/mediawiki_extensions/wrmap/trunk@2578 7aebc617-e5e2-0310-91dc-80fb5f6d2477

openlayers/OpenLayers.js
openlayers/OpenLayers.min.js

index 3ab927311766054abc660c675401221f40cd2301..8d47f6dc06ce5d8132c7cb738d7c72d8e672fc13 100644 (file)
@@ -2,14 +2,14 @@
 
   OpenLayers.js -- OpenLayers Map Viewer Library
 
 
   OpenLayers.js -- OpenLayers Map Viewer Library
 
-  Copyright (c) 2006-2013 by OpenLayers Contributors
+  Copyright (c) 2006-2015 by OpenLayers Contributors
   Published under the 2-clause BSD license.
   Published under the 2-clause BSD license.
-  See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors.
+  See https://raw.githubusercontent.com/openlayers/ol2/master/license.txt for the full text of the license, and https://raw.githubusercontent.com/openlayers/ol2/master/authors.txt for full list of contributors.
 
   Includes compressed code under the following licenses:
 
   (For uncompressed versions of the code used, please see the
 
   Includes compressed code under the following licenses:
 
   (For uncompressed versions of the code used, please see the
-  OpenLayers Github repository: <https://github.com/openlayers/openlayers>)
+  OpenLayers Github repository: <https://github.com/openlayers/ol2>)
 
 */
 
 
 */
 
  * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is
  * Copyright (c) 2006, Yahoo! Inc.
  * All rights reserved.
  * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is
  * Copyright (c) 2006, Yahoo! Inc.
  * All rights reserved.
- * 
+ *
  * Redistribution and use of this software in source and binary forms, with or
  * without modification, are permitted provided that the following conditions
  * are met:
  * Redistribution and use of this software in source and binary forms, with or
  * without modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright notice,
  *   this list of conditions and the following disclaimer.
  * * Redistributions of source code must retain the above copyright notice,
  *   this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright notice,
  *   this list of conditions and the following disclaimer in the documentation
  *   and/or other materials provided with the distribution.
  * * Redistributions in binary form must reproduce the above copyright notice,
  *   this list of conditions and the following disclaimer in the documentation
  *   and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of Yahoo! Inc. nor the names of its contributors may be
  *   used to endorse or promote products derived from this software without
  *   specific prior written permission of Yahoo! Inc.
  * * Neither the name of Yahoo! Inc. nor the names of its contributors may be
  *   used to endorse or promote products derived from this software without
  *   specific prior written permission of Yahoo! Inc.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /* ======================================================================
     OpenLayers/SingleFile.js
    ====================================================================== */
 
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /* ======================================================================
     OpenLayers/SingleFile.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -68,7 +68,7 @@ var OpenLayers = {
     /**
      * Constant: VERSION_NUMBER
      */
     /**
      * Constant: VERSION_NUMBER
      */
-    VERSION_NUMBER: "Release 2.13.1",
+    VERSION_NUMBER: "Release 2.14 dev",
 
     /**
      * Constant: singleFile
 
     /**
      * Constant: singleFile
@@ -137,11 +137,136 @@ var OpenLayers = {
      */
     ImgPath : ''
 };
      */
     ImgPath : ''
 };
+/* ======================================================================
+    OpenLayers/BaseTypes/Class.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/SingleFile.js
+ */
+
+/**
+ * Constructor: OpenLayers.Class
+ * Base class used to construct all other classes. Includes support for 
+ *     multiple inheritance. 
+ *     
+ * This constructor is new in OpenLayers 2.5.  At OpenLayers 3.0, the old 
+ *     syntax for creating classes and dealing with inheritance 
+ *     will be removed.
+ * 
+ * To create a new OpenLayers-style class, use the following syntax:
+ * (code)
+ *     var MyClass = OpenLayers.Class(prototype);
+ * (end)
+ *
+ * To create a new OpenLayers-style class with multiple inheritance, use the
+ *     following syntax:
+ * (code)
+ *     var MyClass = OpenLayers.Class(Class1, Class2, prototype);
+ * (end)
+ * 
+ * Note that instanceof reflection will only reveal Class1 as superclass.
+ *
+ */
+OpenLayers.Class = function() {
+    var len = arguments.length;
+    var P = arguments[0];
+    var F = arguments[len-1];
+
+    var C = typeof F.initialize == "function" ?
+        F.initialize :
+        function(){ P.prototype.initialize.apply(this, arguments); };
+
+    if (len > 1) {
+        var newArgs = [C, P].concat(
+                Array.prototype.slice.call(arguments).slice(1, len-1), F);
+        OpenLayers.inherit.apply(null, newArgs);
+    } else {
+        C.prototype = F;
+    }
+    return C;
+};
+
+/**
+ * Function: OpenLayers.inherit
+ *
+ * Parameters:
+ * C - {Object} the class that inherits
+ * P - {Object} the superclass to inherit from
+ *
+ * In addition to the mandatory C and P parameters, an arbitrary number of
+ * objects can be passed, which will extend C.
+ */
+OpenLayers.inherit = function(C, P) {
+   var F = function() {};
+   F.prototype = P.prototype;
+   C.prototype = new F;
+   var i, l, o;
+   for(i=2, l=arguments.length; i<l; i++) {
+       o = arguments[i];
+       if(typeof o === "function") {
+           o = o.prototype;
+       }
+       OpenLayers.Util.extend(C.prototype, o);
+   }
+};
+
+/**
+ * APIFunction: extend
+ * Copy all properties of a source object to a destination object.  Modifies
+ *     the passed in destination object.  Any properties on the source object
+ *     that are set to undefined will not be (re)set on the destination object.
+ *
+ * Parameters:
+ * destination - {Object} The object that will be modified
+ * source - {Object} The object with properties to be set on the destination
+ *
+ * Returns:
+ * {Object} The destination object.
+ */
+OpenLayers.Util = OpenLayers.Util || {};
+OpenLayers.Util.extend = function(destination, source) {
+    destination = destination || {};
+    if (source) {
+        for (var property in source) {
+            var value = source[property];
+            if (value !== undefined) {
+                destination[property] = value;
+            }
+        }
+
+        /**
+         * IE doesn't include the toString property when iterating over an object's
+         * properties with the for(property in object) syntax.  Explicitly check if
+         * the source has its own toString property.
+         */
+
+        /*
+         * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
+         * prototype object" when calling hawOwnProperty if the source object
+         * is an instance of window.Event.
+         */
+
+        var sourceIsEvt = typeof window.Event == "function"
+                          && source instanceof window.Event;
+
+        if (!sourceIsEvt
+           && source.hasOwnProperty && source.hasOwnProperty("toString")) {
+            destination.toString = source.toString;
+        }
+    }
+    return destination;
+};
 /* ======================================================================
     OpenLayers/BaseTypes.js
    ====================================================================== */
 
 /* ======================================================================
     OpenLayers/BaseTypes.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -480,12 +605,12 @@ OpenLayers.Function = {
      */
     bind: function(func, object) {
         // create a reference to all arguments past the second one
      */
     bind: function(func, object) {
         // create a reference to all arguments past the second one
-        var args = Array.prototype.slice.apply(arguments, [2]);
+        var args = Array.prototype.slice.call(arguments, 2);
         return function() {
             // Push on any additional arguments from the actual function call.
             // These will come after those sent to the bind call.
             var newArgs = args.concat(
         return function() {
             // Push on any additional arguments from the actual function call.
             // These will come after those sent to the bind call.
             var newArgs = args.concat(
-                Array.prototype.slice.apply(arguments, [0])
+                Array.prototype.slice.call(arguments, 0)
             );
             return func.apply(object, newArgs);
         };
             );
             return func.apply(object, newArgs);
         };
@@ -604,136 +729,11 @@ OpenLayers.Array = {
     }
     
 };
     }
     
 };
-/* ======================================================================
-    OpenLayers/BaseTypes/Class.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/SingleFile.js
- */
-
-/**
- * Constructor: OpenLayers.Class
- * Base class used to construct all other classes. Includes support for 
- *     multiple inheritance. 
- *     
- * This constructor is new in OpenLayers 2.5.  At OpenLayers 3.0, the old 
- *     syntax for creating classes and dealing with inheritance 
- *     will be removed.
- * 
- * To create a new OpenLayers-style class, use the following syntax:
- * (code)
- *     var MyClass = OpenLayers.Class(prototype);
- * (end)
- *
- * To create a new OpenLayers-style class with multiple inheritance, use the
- *     following syntax:
- * (code)
- *     var MyClass = OpenLayers.Class(Class1, Class2, prototype);
- * (end)
- * 
- * Note that instanceof reflection will only reveal Class1 as superclass.
- *
- */
-OpenLayers.Class = function() {
-    var len = arguments.length;
-    var P = arguments[0];
-    var F = arguments[len-1];
-
-    var C = typeof F.initialize == "function" ?
-        F.initialize :
-        function(){ P.prototype.initialize.apply(this, arguments); };
-
-    if (len > 1) {
-        var newArgs = [C, P].concat(
-                Array.prototype.slice.call(arguments).slice(1, len-1), F);
-        OpenLayers.inherit.apply(null, newArgs);
-    } else {
-        C.prototype = F;
-    }
-    return C;
-};
-
-/**
- * Function: OpenLayers.inherit
- *
- * Parameters:
- * C - {Object} the class that inherits
- * P - {Object} the superclass to inherit from
- *
- * In addition to the mandatory C and P parameters, an arbitrary number of
- * objects can be passed, which will extend C.
- */
-OpenLayers.inherit = function(C, P) {
-   var F = function() {};
-   F.prototype = P.prototype;
-   C.prototype = new F;
-   var i, l, o;
-   for(i=2, l=arguments.length; i<l; i++) {
-       o = arguments[i];
-       if(typeof o === "function") {
-           o = o.prototype;
-       }
-       OpenLayers.Util.extend(C.prototype, o);
-   }
-};
-
-/**
- * APIFunction: extend
- * Copy all properties of a source object to a destination object.  Modifies
- *     the passed in destination object.  Any properties on the source object
- *     that are set to undefined will not be (re)set on the destination object.
- *
- * Parameters:
- * destination - {Object} The object that will be modified
- * source - {Object} The object with properties to be set on the destination
- *
- * Returns:
- * {Object} The destination object.
- */
-OpenLayers.Util = OpenLayers.Util || {};
-OpenLayers.Util.extend = function(destination, source) {
-    destination = destination || {};
-    if (source) {
-        for (var property in source) {
-            var value = source[property];
-            if (value !== undefined) {
-                destination[property] = value;
-            }
-        }
-
-        /**
-         * IE doesn't include the toString property when iterating over an object's
-         * properties with the for(property in object) syntax.  Explicitly check if
-         * the source has its own toString property.
-         */
-
-        /*
-         * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
-         * prototype object" when calling hawOwnProperty if the source object
-         * is an instance of window.Event.
-         */
-
-        var sourceIsEvt = typeof window.Event == "function"
-                          && source instanceof window.Event;
-
-        if (!sourceIsEvt
-           && source.hasOwnProperty && source.hasOwnProperty("toString")) {
-            destination.toString = source.toString;
-        }
-    }
-    return destination;
-};
 /* ======================================================================
     OpenLayers/BaseTypes/Bounds.js
    ====================================================================== */
 
 /* ======================================================================
     OpenLayers/BaseTypes/Bounds.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -899,7 +899,7 @@ OpenLayers.Bounds = OpenLayers.Class({
      * Returns a boundingbox-string representation of the bounds object.
      * 
      * Parameters:
      * Returns a boundingbox-string representation of the bounds object.
      * 
      * Parameters:
-     * decimal - {Integer} How many significant digits in the bbox coords?
+     * decimal - {Integer} How many decimal places in the bbox coords?
      *                     Default is 6
      * reverseAxisOrder - {Boolean} Should we reverse the axis order?
      * 
      *                     Default is 6
      * reverseAxisOrder - {Boolean} Should we reverse the axis order?
      * 
@@ -1574,7 +1574,7 @@ OpenLayers.Bounds.oppositeQuadrant = function(quadrant) {
     OpenLayers/BaseTypes/Element.js
    ====================================================================== */
 
     OpenLayers/BaseTypes/Element.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -1767,7 +1767,7 @@ OpenLayers.Element = {
     OpenLayers/BaseTypes/LonLat.js
    ====================================================================== */
 
     OpenLayers/BaseTypes/LonLat.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -1986,7 +1986,7 @@ OpenLayers.LonLat.fromArray = function(arr) {
     OpenLayers/BaseTypes/Pixel.js
    ====================================================================== */
 
     OpenLayers/BaseTypes/Pixel.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -2133,7 +2133,7 @@ OpenLayers.Pixel = OpenLayers.Class({
     OpenLayers/BaseTypes/Size.js
    ====================================================================== */
 
     OpenLayers/BaseTypes/Size.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -2226,7 +2226,7 @@ OpenLayers.Size = OpenLayers.Class({
     OpenLayers/Console.js
    ====================================================================== */
 
     OpenLayers/Console.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -2244,7 +2244,7 @@ OpenLayers.Size = OpenLayers.Class({
  * cross-browser debugging Firebug style.
  *
  * Note:
  * cross-browser debugging Firebug style.
  *
  * Note:
- * Note that behavior will differ with the Firebug extention and Firebug Lite.
+ * Note that behavior will differ with the Firebug extension and Firebug Lite.
  * Most notably, the Firebug Lite console does not currently allow for
  * hyperlinks to code or for clicking on object to explore their properties.
  * 
  * Most notably, the Firebug Lite console does not currently allow for
  * hyperlinks to code or for clicking on object to explore their properties.
  * 
@@ -2480,7 +2480,7 @@ OpenLayers.Console = {
     OpenLayers/Lang.js
    ====================================================================== */
 
     OpenLayers/Lang.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -2618,7 +2618,7 @@ OpenLayers.i18n = OpenLayers.Lang.translate;
     OpenLayers/Util.js
    ====================================================================== */
 
     OpenLayers/Util.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -4391,11 +4391,37 @@ OpenLayers.Util.getFormattedLonLat = function(coordinate, axis, dmsOption) {
     return str;
 };
 
     return str;
 };
 
+/**
+ * Function: getConstructor
+ * Take an OpenLayers style CLASS_NAME and return a constructor.
+ *
+ * Parameters:
+ * className - {String} The dot delimited class name (e.g. 'OpenLayers.Foo').
+ * 
+ * Returns:
+ * {Function} The constructor.
+ */
+OpenLayers.Util.getConstructor = function(className) {
+    var Constructor;
+    var parts = className.split('.');
+    if (parts[0] === "OpenLayers") {
+        Constructor = OpenLayers;
+    } else {
+        // someone extended our base class and used their own namespace
+        // this will not work when the library is evaluated in a closure
+        // but it is the best we can do (until we ourselves provide a global)
+        Constructor = window[parts[0]];
+    }
+    for (var i = 1, ii = parts.length; i < ii; ++i) {
+        Constructor = Constructor[parts[i]];
+    }
+    return Constructor;
+};
 /* ======================================================================
     OpenLayers/Events.js
    ====================================================================== */
 
 /* ======================================================================
     OpenLayers/Events.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -4521,6 +4547,23 @@ OpenLayers.Event = {
         return event.touches && event.touches.length > 1;
     },
 
         return event.touches && event.touches.length > 1;
     },
 
+    /**
+     * Method: isTouchEvent
+     * Determine whether the event was triggered by a touch
+     * 
+     * Parameters:
+     * evt - {Event}
+     * 
+     * Returns:
+     * {Boolean}
+     */
+    isTouchEvent: function(evt) {
+        return ("" + evt.type).indexOf("touch") === 0 || (
+                "pointerType" in evt && (
+                     evt.pointerType === evt.MSPOINTER_TYPE_TOUCH /*IE10 pointer*/ ||
+                     evt.pointerType === "touch" /*W3C pointer*/));
+    },
+
     /**
      * Method: isLeftClick
      * Determine whether event was caused by a left click. 
     /**
      * Method: isLeftClick
      * Determine whether event was caused by a left click. 
@@ -4804,6 +4847,24 @@ OpenLayers.Events = OpenLayers.Class({
         "touchstart", "touchmove", "touchend",
         "keydown"
     ],
         "touchstart", "touchmove", "touchend",
         "keydown"
     ],
+    
+    /**
+     * Constant: standard pointer model
+     * {string}
+     */
+    TOUCH_MODEL_POINTER: "pointer",
+
+    /**
+     * Constant: prefixed pointer model (IE10)
+     * {string}
+     */
+    TOUCH_MODEL_MSPOINTER: "MSPointer",
+
+    /**
+     * Constant: legacy touch model
+     * {string}
+     */
+    TOUCH_MODEL_TOUCH: "touch",
 
     /** 
      * Property: listeners 
 
     /** 
      * Property: listeners 
@@ -4963,7 +5024,7 @@ OpenLayers.Events = OpenLayers.Class({
         this.listeners  = {};
         this.extensions = {};
         this.extensionCount = {};
         this.listeners  = {};
         this.extensions = {};
         this.extensionCount = {};
-        this._msTouches = [];
+        this._pointerTouches = [];
         
         // if a dom element is specified, add a listeners list 
         // for browser events on the element and register them
         
         // if a dom element is specified, add a listeners list 
         // for browser events on the element and register them
@@ -5030,15 +5091,17 @@ OpenLayers.Events = OpenLayers.Class({
             );
         }
         this.element = element;
             );
         }
         this.element = element;
-        var msTouch = !!window.navigator.msMaxTouchPoints;
+        var touchModel = this.getTouchModel();
         var type;
         for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
             type = this.BROWSER_EVENTS[i];
             // register the event cross-browser
             OpenLayers.Event.observe(element, type, this.eventHandler
             );
         var type;
         for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
             type = this.BROWSER_EVENTS[i];
             // register the event cross-browser
             OpenLayers.Event.observe(element, type, this.eventHandler
             );
-            if (msTouch && type.indexOf('touch') === 0) {
-                this.addMsTouchListener(element, type, this.eventHandler);
+            if ((touchModel === this.TOUCH_MODEL_POINTER ||
+                    touchModel === this.TOUCH_MODEL_MSPOINTER) &&
+                    type.indexOf('touch') === 0) {
+                this.addPointerTouchListener(element, type, this.eventHandler);
             }
         }
         // disable dragstart in IE so that mousedown/move/up works normally
             }
         }
         // disable dragstart in IE so that mousedown/move/up works normally
@@ -5418,18 +5481,38 @@ OpenLayers.Events = OpenLayers.Class({
     },
 
     /**
     },
 
     /**
-     * Method: addMsTouchListener
+     * Method: getTouchModel
+     * Get the touch model currently in use.
+     * 
+     * This is cached on OpenLayers.Events as _TOUCH_MODEL 
+     * 
+     * Returns:
+     * {string} The current touch model (TOUCH_MODEL_xxx), null if none
+     */
+    getTouchModel: function() {
+        if (!("_TOUCH_MODEL" in OpenLayers.Events)) {
+            OpenLayers.Events._TOUCH_MODEL =
+                    (window.PointerEvent && "pointer") ||
+                    (window.MSPointerEvent && "MSPointer") ||
+                    (("ontouchdown" in document) && "touch") ||
+                    null;
+        }
+        return OpenLayers.Events._TOUCH_MODEL;
+    },
+
+    /**
+     * Method: addPointerTouchListener
      *
      * Parameters:
      * element - {DOMElement} The DOM element to register the listener on
      * type - {String} The event type
      * handler - {Function} the handler
      */
      *
      * Parameters:
      * element - {DOMElement} The DOM element to register the listener on
      * type - {String} The event type
      * handler - {Function} the handler
      */
-    addMsTouchListener: function (element, type, handler) {
+    addPointerTouchListener: function (element, type, handler) {
         var eventHandler = this.eventHandler;
         var eventHandler = this.eventHandler;
-        var touches = this._msTouches;
+        var touches = this._pointerTouches;
 
 
-        function msHandler(evt) {
+        function pointerHandler(evt) {
             handler(OpenLayers.Util.applyDefaults({
                 stopPropagation: function() {
                     for (var i=touches.length-1; i>=0; --i) {
             handler(OpenLayers.Util.applyDefaults({
                 stopPropagation: function() {
                     for (var i=touches.length-1; i>=0; --i) {
@@ -5447,29 +5530,34 @@ OpenLayers.Events = OpenLayers.Class({
 
         switch (type) {
             case 'touchstart':
 
         switch (type) {
             case 'touchstart':
-                return this.addMsTouchListenerStart(element, type, msHandler);
+                return this.addPointerTouchListenerStart(element, type, pointerHandler);
             case 'touchend':
             case 'touchend':
-                return this.addMsTouchListenerEnd(element, type, msHandler);
+                return this.addPointerTouchListenerEnd(element, type, pointerHandler);
             case 'touchmove':
             case 'touchmove':
-                return this.addMsTouchListenerMove(element, type, msHandler);
+                return this.addPointerTouchListenerMove(element, type, pointerHandler);
             default:
                 throw 'Unknown touch event type';
         }
     },
 
     /**
             default:
                 throw 'Unknown touch event type';
         }
     },
 
     /**
-     * Method: addMsTouchListenerStart
+     * Method: addPointerTouchListenerStart
      *
      * Parameters:
      * element - {DOMElement} The DOM element to register the listener on
      * type - {String} The event type
      * handler - {Function} the handler
      */
      *
      * Parameters:
      * element - {DOMElement} The DOM element to register the listener on
      * type - {String} The event type
      * handler - {Function} the handler
      */
-    addMsTouchListenerStart: function(element, type, handler) {
-        var touches = this._msTouches;
+    addPointerTouchListenerStart: function(element, type, handler) {
+        var touches = this._pointerTouches;
 
         var cb = function(e) {
 
 
         var cb = function(e) {
 
+            // pointer could be mouse or pen
+            if (!OpenLayers.Event.isTouchEvent(e)) {
+                return;
+            }
+
             var alreadyInArray = false;
             for (var i=0, ii=touches.length; i<ii; ++i) {
                 if (touches[i].pointerId == e.pointerId) {
             var alreadyInArray = false;
             for (var i=0, ii=touches.length; i<ii; ++i) {
                 if (touches[i].pointerId == e.pointerId) {
@@ -5485,35 +5573,52 @@ OpenLayers.Events = OpenLayers.Class({
             handler(e);
         };
 
             handler(e);
         };
 
-        OpenLayers.Event.observe(element, 'MSPointerDown', cb);
+        OpenLayers.Event.observe(element,
+                this.getTouchModel() === this.TOUCH_MODEL_MSPOINTER ?
+                        'MSPointerDown' : 'pointerdown',
+                cb);
+        
+        // the pointerId only needs to be removed from the _pointerTouches array
+        // when the pointer has left its element
+        var internalCb = function (e) {
 
 
-        // Need to also listen for end events to keep the _msTouches list
-        // accurate
-        var internalCb = function(e) {
-            for (var i=0, ii=touches.length; i<ii; ++i) {
+            // pointer could be mouse or pen
+            if (!OpenLayers.Event.isTouchEvent(e)) {
+               return;
+            }
+
+            var up = false;
+            for (var i = 0, ii = touches.length; i < ii; ++i) {
                 if (touches[i].pointerId == e.pointerId) {
                 if (touches[i].pointerId == e.pointerId) {
-                    touches.splice(i, 1);
+                    if (this.clientWidth != 0 && this.clientHeight != 0) {
+                        if ((Math.ceil(e.clientX) >= this.clientWidth || Math.ceil(e.clientY) >= this.clientHeight)) {
+                            touches.splice(i, 1);
+                        }
+                    }
                     break;
                 }
             }
         };
                     break;
                 }
             }
         };
-        OpenLayers.Event.observe(element, 'MSPointerUp', internalCb);
+        OpenLayers.Event.observe(element,
+                this.getTouchModel() === this.TOUCH_MODEL_MSPOINTER ?
+                        'MSPointerOut' : 'pointerout',
+                internalCb);
     },
 
     /**
     },
 
     /**
-     * Method: addMsTouchListenerMove
+     * Method: addPointerTouchListenerMove
      *
      * Parameters:
      * element - {DOMElement} The DOM element to register the listener on
      * type - {String} The event type
      * handler - {Function} the handler
      */
      *
      * Parameters:
      * element - {DOMElement} The DOM element to register the listener on
      * type - {String} The event type
      * handler - {Function} the handler
      */
-    addMsTouchListenerMove: function (element, type, handler) {
-        var touches = this._msTouches;
+    addPointerTouchListenerMove: function (element, type, handler) {
+        var touches = this._pointerTouches;
         var cb = function(e) {
 
         var cb = function(e) {
 
-            //Don't fire touch moves when mouse isn't down
-            if (e.pointerType == e.MSPOINTER_TYPE_MOUSE && e.buttons == 0) {
+            // pointer could be mouse or pen
+            if (!OpenLayers.Event.isTouchEvent(e)) {
                 return;
             }
 
                 return;
             }
 
@@ -5533,22 +5638,30 @@ OpenLayers.Events = OpenLayers.Class({
             handler(e);
         };
 
             handler(e);
         };
 
-        OpenLayers.Event.observe(element, 'MSPointerMove', cb);
+        OpenLayers.Event.observe(element,
+                this.getTouchModel() === this.TOUCH_MODEL_MSPOINTER ?
+                        'MSPointerMove' : 'pointermove',
+                cb);
     },
 
     /**
     },
 
     /**
-     * Method: addMsTouchListenerEnd
+     * Method: addPointerTouchListenerEnd
      *
      * Parameters:
      * element - {DOMElement} The DOM element to register the listener on
      * type - {String} The event type
      * handler - {Function} the handler
      */
      *
      * Parameters:
      * element - {DOMElement} The DOM element to register the listener on
      * type - {String} The event type
      * handler - {Function} the handler
      */
-    addMsTouchListenerEnd: function (element, type, handler) {
-        var touches = this._msTouches;
+    addPointerTouchListenerEnd: function (element, type, handler) {
+        var touches = this._pointerTouches;
 
         var cb = function(e) {
 
 
         var cb = function(e) {
 
+            // pointer could be mouse or pen
+            if (!OpenLayers.Event.isTouchEvent(e)) {
+               return;
+            }
+
             for (var i=0, ii=touches.length; i<ii; ++i) {
                 if (touches[i].pointerId == e.pointerId) {
                     touches.splice(i, 1);
             for (var i=0, ii=touches.length; i<ii; ++i) {
                 if (touches[i].pointerId == e.pointerId) {
                     touches.splice(i, 1);
@@ -5560,372 +5673,657 @@ OpenLayers.Events = OpenLayers.Class({
             handler(e);
         };
 
             handler(e);
         };
 
-        OpenLayers.Event.observe(element, 'MSPointerUp', cb);
+        OpenLayers.Event.observe(element,
+                this.getTouchModel() === this.TOUCH_MODEL_MSPOINTER ?
+                        'MSPointerUp' : 'pointerup',
+                cb);
     },
 
     CLASS_NAME: "OpenLayers.Events"
 });
 /* ======================================================================
     },
 
     CLASS_NAME: "OpenLayers.Events"
 });
 /* ======================================================================
-    OpenLayers/Events/buttonclick.js
+    OpenLayers/Icon.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Events.js
+ * @requires OpenLayers/BaseTypes/Class.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Events.buttonclick
- * Extension event type for handling buttons on top of a dom element. This
- *     event type fires "buttonclick" on its <target> when a button was
- *     clicked. Buttons are detected by the "olButton" class.
- *
- * This event type makes sure that button clicks do not interfere with other
- *     events that are registered on the same <element>.
+ * Class: OpenLayers.Icon
+ * 
+ * The icon represents a graphical icon on the screen.  Typically used in
+ * conjunction with a <OpenLayers.Marker> to represent markers on a screen.
  *
  *
- * Event types provided by this extension:
- * - *buttonclick* Triggered when a button is clicked. Listeners receive an
- *     object with a *buttonElement* property referencing the dom element of
- *     the clicked button, and an *buttonXY* property with the click position
- *     relative to the button.
+ * An icon has a url, size and position.  It also contains an offset which 
+ * allows the center point to be represented correctly.  This can be
+ * provided either as a fixed offset or a function provided to calculate
+ * the desired offset. 
+ * 
  */
  */
-OpenLayers.Events.buttonclick = OpenLayers.Class({
-    
-    /**
-     * Property: target
-     * {<OpenLayers.Events>} The events instance that the buttonclick event will
-     * be triggered on.
-     */
-    target: null,
+OpenLayers.Icon = OpenLayers.Class({
     
     
-    /**
-     * Property: events
-     * {Array} Events to observe and conditionally stop from propagating when
-     *     an element with the olButton class (or its olAlphaImg child) is
-     *     clicked.
+    /** 
+     * Property: url 
+     * {String}  image url
      */
      */
-    events: [
-        'mousedown', 'mouseup', 'click', 'dblclick',
-        'touchstart', 'touchmove', 'touchend', 'keydown'
-    ],
+    url: null,
     
     
-    /**
-     * Property: startRegEx
-     * {RegExp} Regular expression to test Event.type for events that start
-     *     a buttonclick sequence.
+    /** 
+     * Property: size 
+     * {<OpenLayers.Size>|Object} An OpenLayers.Size or
+     * an object with a 'w' and 'h' properties.
      */
      */
-    startRegEx: /^mousedown|touchstart$/,
+    size: null,
 
 
-    /**
-     * Property: cancelRegEx
-     * {RegExp} Regular expression to test Event.type for events that cancel
-     *     a buttonclick sequence.
+    /** 
+     * Property: offset 
+     * {<OpenLayers.Pixel>|Object} distance in pixels to offset the
+     * image when being rendered. An OpenLayers.Pixel or an object
+     * with a 'x' and 'y' properties.
      */
      */
-    cancelRegEx: /^touchmove$/,
-
-    /**
-     * Property: completeRegEx
-     * {RegExp} Regular expression to test Event.type for events that complete
-     *     a buttonclick sequence.
+    offset: null,    
+    
+    /** 
+     * Property: calculateOffset 
+     * {Function} Function to calculate the offset (based on the size)
      */
      */
-    completeRegEx: /^mouseup|touchend$/,
+    calculateOffset: null,    
     
     
-    /**
-     * Property: startEvt
-     * {Event} The event that started the click sequence
+    /** 
+     * Property: imageDiv 
+     * {DOMElement} 
+     */
+    imageDiv: null,
+
+    /** 
+     * Property: px 
+     * {<OpenLayers.Pixel>|Object} An OpenLayers.Pixel or an object
+     * with a 'x' and 'y' properties.
      */
      */
+    px: null,
     
     
-    /**
-     * Constructor: OpenLayers.Events.buttonclick
-     * Construct a buttonclick event type. Applications are not supposed to
-     *     create instances of this class - they are created on demand by
-     *     <OpenLayers.Events> instances.
+    /** 
+     * Constructor: OpenLayers.Icon
+     * Creates an icon, which is an image tag in a div.  
      *
      *
-     * Parameters:
-     * target - {<OpenLayers.Events>} The events instance that the buttonclick
-     *     event will be triggered on.
+     * url - {String} 
+     * size - {<OpenLayers.Size>|Object} An OpenLayers.Size or an
+     *                                   object with a 'w' and 'h'
+     *                                   properties.
+     * offset - {<OpenLayers.Pixel>|Object} An OpenLayers.Pixel or an
+     *                                      object with a 'x' and 'y'
+     *                                      properties.
+     * calculateOffset - {Function} 
      */
      */
-    initialize: function(target) {
-        this.target = target;
-        for (var i=this.events.length-1; i>=0; --i) {
-            this.target.register(this.events[i], this, this.buttonClick, {
-                extension: true
-            });
-        }
+    initialize: function(url, size, offset, calculateOffset) {
+        this.url = url;
+        this.size = size || {w: 20, h: 20};
+        this.offset = offset || {x: -(this.size.w/2), y: -(this.size.h/2)};
+        this.calculateOffset = calculateOffset;
+
+        var id = OpenLayers.Util.createUniqueID("OL_Icon_");
+        this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id);
     },
     
     },
     
-    /**
+    /** 
      * Method: destroy
      * Method: destroy
+     * Nullify references and remove event listeners to prevent circular 
+     * references and memory leaks
      */
     destroy: function() {
      */
     destroy: function() {
-        for (var i=this.events.length-1; i>=0; --i) {
-            this.target.unregister(this.events[i], this, this.buttonClick);
-        }
-        delete this.target;
+        // erase any drawn elements
+        this.erase();
+
+        OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild); 
+        this.imageDiv.innerHTML = "";
+        this.imageDiv = null;
     },
 
     },
 
-    /**
-     * Method: getPressedButton
-     * Get the pressed button, if any. Returns undefined if no button
-     * was pressed.
-     *
-     * Arguments:
-     * element - {DOMElement} The event target.
-     *
+    /** 
+     * Method: clone
+     * 
      * Returns:
      * Returns:
-     * {DOMElement} The button element, or undefined.
+     * {<OpenLayers.Icon>} A fresh copy of the icon.
      */
      */
-    getPressedButton: function(element) {
-        var depth = 3, // limit the search depth
-            button;
-        do {
-            if(OpenLayers.Element.hasClass(element, "olButton")) {
-                // hit!
-                button = element;
-                break;
-            }
-            element = element.parentNode;
-        } while(--depth > 0 && element);
-        return button;
+    clone: function() {
+        return new OpenLayers.Icon(this.url, 
+                                   this.size, 
+                                   this.offset, 
+                                   this.calculateOffset);
     },
     
     /**
     },
     
     /**
-     * Method: ignore
-     * Check for event target elements that should be ignored by OpenLayers.
-     *
+     * Method: setSize
+     * 
      * Parameters:
      * Parameters:
-     * element - {DOMElement} The event target.
+     * size - {<OpenLayers.Size>|Object} An OpenLayers.Size or
+     * an object with a 'w' and 'h' properties.
      */
      */
-    ignore: function(element) {
-        var depth = 3,
-            ignore = false;
-        do {
-            if (element.nodeName.toLowerCase() === 'a') {
-                ignore = true;
-                break;
-            }
-            element = element.parentNode;
-        } while (--depth > 0 && element);
-        return ignore;
+    setSize: function(size) {
+        if (size != null) {
+            this.size = size;
+        }
+        this.draw();
     },
     },
-
+    
     /**
     /**
-     * Method: buttonClick
-     * Check if a button was clicked, and fire the buttonclick event
-     *
+     * Method: setUrl
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event}
+     * url - {String} 
      */
      */
-    buttonClick: function(evt) {
-        var propagate = true,
-            element = OpenLayers.Event.element(evt);
-        if (element && (OpenLayers.Event.isLeftClick(evt) || !~evt.type.indexOf("mouse"))) {
-            // was a button pressed?
-            var button = this.getPressedButton(element);
-            if (button) {
-                if (evt.type === "keydown") {
-                    switch (evt.keyCode) {
-                    case OpenLayers.Event.KEY_RETURN:
-                    case OpenLayers.Event.KEY_SPACE:
-                        this.target.triggerEvent("buttonclick", {
-                            buttonElement: button
-                        });
-                        OpenLayers.Event.stop(evt);
-                        propagate = false;
-                        break;
-                    }
-                } else if (this.startEvt) {
-                    if (this.completeRegEx.test(evt.type)) {
-                        var pos = OpenLayers.Util.pagePosition(button);
-                        var viewportElement = OpenLayers.Util.getViewportElement();
-                        var scrollTop = window.pageYOffset || viewportElement.scrollTop;
-                        var scrollLeft = window.pageXOffset || viewportElement.scrollLeft;
-                        pos[0] = pos[0] - scrollLeft;
-                        pos[1] = pos[1] - scrollTop;
-                        
-                        this.target.triggerEvent("buttonclick", {
-                            buttonElement: button,
-                            buttonXY: {
-                                x: this.startEvt.clientX - pos[0],
-                                y: this.startEvt.clientY - pos[1]
-                            }
-                        });
-                    }
-                    if (this.cancelRegEx.test(evt.type)) {
-                        delete this.startEvt;
-                    }
-                    OpenLayers.Event.stop(evt);
-                    propagate = false;
-                }
-                if (this.startRegEx.test(evt.type)) {
-                    this.startEvt = evt;
-                    OpenLayers.Event.stop(evt);
-                    propagate = false;
-                }
-            } else {
-                propagate = !this.ignore(OpenLayers.Event.element(evt));
-                delete this.startEvt;
-            }
+    setUrl: function(url) {
+        if (url != null) {
+            this.url = url;
         }
         }
-        return propagate;
-    }
-    
-});
-/* ======================================================================
-    OpenLayers/Util/vendorPrefix.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/SingleFile.js
- */
-
-OpenLayers.Util = OpenLayers.Util || {};
-/**
- * Namespace: OpenLayers.Util.vendorPrefix
- * A collection of utility functions to detect vendor prefixed features
- */
-OpenLayers.Util.vendorPrefix = (function() {
-    "use strict";
-    
-    var VENDOR_PREFIXES = ["", "O", "ms", "Moz", "Webkit"],
-        divStyle = document.createElement("div").style,
-        cssCache = {},
-        jsCache = {};
+        this.draw();
+    },
 
 
-    
-    /**
-     * Function: domToCss
-     * Converts a upper camel case DOM style property name to a CSS property
-     *      i.e. transformOrigin -> transform-origin
-     *      or   WebkitTransformOrigin -> -webkit-transform-origin
-     *
+    /** 
+     * Method: draw
+     * Move the div to the given pixel.
+     * 
      * Parameters:
      * Parameters:
-     * prefixedDom - {String} The property to convert
-     *
+     * px - {<OpenLayers.Pixel>|Object} An OpenLayers.Pixel or an
+     *                                  object with a 'x' and 'y' properties.
+     * 
      * Returns:
      * Returns:
-     * {String} The CSS property
+     * {DOMElement} A new DOM Image of this icon set at the location passed-in
      */
      */
-    function domToCss(prefixedDom) {
-        if (!prefixedDom) { return null; }
-        return prefixedDom.
-            replace(/([A-Z])/g, function(c) { return "-" + c.toLowerCase(); }).
-            replace(/^ms-/, "-ms-");
-    }
+    draw: function(px) {
+        OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, 
+                                            null, 
+                                            null, 
+                                            this.size, 
+                                            this.url, 
+                                            "absolute");
+        this.moveTo(px);
+        return this.imageDiv;
+    }, 
 
 
-    /**
-     * APIMethod: css
-     * Detect which property is used for a CSS property
+    /** 
+     * Method: erase
+     * Erase the underlying image element.
+     */
+    erase: function() {
+        if (this.imageDiv != null && this.imageDiv.parentNode != null) {
+            OpenLayers.Element.remove(this.imageDiv);
+        }
+    }, 
+    
+    /** 
+     * Method: setOpacity
+     * Change the icon's opacity
      *
      * Parameters:
      *
      * Parameters:
-     * property - {String} The standard (unprefixed) CSS property name
-     *
-     * Returns:
-     * {String} The standard CSS property, prefixed property or null if not
-     *          supported
+     * opacity - {float} 
      */
      */
-    function css(property) {
-        if (cssCache[property] === undefined) {
-            var domProperty = property.
-                replace(/(-[\s\S])/g, function(c) { return c.charAt(1).toUpperCase(); });
-            var prefixedDom = style(domProperty);
-            cssCache[property] = domToCss(prefixedDom);
-        }
-        return cssCache[property];
-    }
+    setOpacity: function(opacity) {
+        OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null, 
+                                            null, null, null, null, opacity);
 
 
+    },
+    
     /**
     /**
-     * APIMethod: js
-     * Detect which property is used for a JS property/method
+     * Method: moveTo
+     * move icon to passed in px.
      *
      * Parameters:
      *
      * Parameters:
-     * obj - {Object} The object to test on
-     * property - {String} The standard (unprefixed) JS property name
-     *
-     * Returns:
-     * {String} The standard JS property, prefixed property or null if not
-     *          supported
+     * px - {<OpenLayers.Pixel>|Object} the pixel position to move to.
+     * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
      */
      */
-    function js(obj, property) {
-        if (jsCache[property] === undefined) {
-            var tmpProp,
-                i = 0,
-                l = VENDOR_PREFIXES.length,
-                prefix,
-                isStyleObj = (typeof obj.cssText !== "undefined");
-
-            jsCache[property] = null;
-            for(; i<l; i++) {
-                prefix = VENDOR_PREFIXES[i];
-                if(prefix) {
-                    if (!isStyleObj) {
-                        // js prefix should be lower-case, while style
-                        // properties have upper case on first character
-                        prefix = prefix.toLowerCase();
-                    }
-                    tmpProp = prefix + property.charAt(0).toUpperCase() + property.slice(1);
-                } else {
-                    tmpProp = property;
-                }
+    moveTo: function (px) {
+        //if no px passed in, use stored location
+        if (px != null) {
+            this.px = px;
+        }
 
 
-                if(obj[tmpProp] !== undefined) {
-                    jsCache[property] = tmpProp;
-                    break;
+        if (this.imageDiv != null) {
+            if (this.px == null) {
+                this.display(false);
+            } else {
+                if (this.calculateOffset) {
+                    this.offset = this.calculateOffset(this.size);  
                 }
                 }
+                OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, {
+                    x: this.px.x + this.offset.x,
+                    y: this.px.y + this.offset.y
+                });
             }
         }
             }
         }
-        return jsCache[property];
-    }
+    },
     
     
-    /**
-     * APIMethod: style
-     * Detect which property is used for a DOM style property
+    /** 
+     * Method: display
+     * Hide or show the icon
      *
      * Parameters:
      *
      * Parameters:
-     * property - {String} The standard (unprefixed) style property name
-     *
-     * Returns:
-     * {String} The standard style property, prefixed property or null if not
-     *          supported
+     * display - {Boolean} 
      */
      */
-    function style(property) {
-        return js(divStyle, property);
-    }
+    display: function(display) {
+        this.imageDiv.style.display = (display) ? "" : "none"; 
+    },
     
     
-    return {
-        css:      css,
-        js:       js,
-        style:    style,
-        
-        // used for testing
-        cssCache:       cssCache,
-        jsCache:        jsCache
-    };
-}());
+
+    /**
+     * APIMethod: isDrawn
+     * 
+     * Returns:
+     * {Boolean} Whether or not the icon is drawn.
+     */
+    isDrawn: function() {
+        // nodeType 11 for ie, whose nodes *always* have a parentNode
+        // (of type document fragment)
+        var isDrawn = (this.imageDiv && this.imageDiv.parentNode && 
+                       (this.imageDiv.parentNode.nodeType != 11));    
+
+        return isDrawn;   
+    },
+
+    CLASS_NAME: "OpenLayers.Icon"
+});
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Animation.js
+    OpenLayers/Marker.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-/**
- * @requires OpenLayers/SingleFile.js
- * @requires OpenLayers/Util/vendorPrefix.js
- */
 
 /**
 
 /**
- * Namespace: OpenLayers.Animation
+ * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Events.js
+ * @requires OpenLayers/Icon.js
+ */
+
+/**
+ * Class: OpenLayers.Marker
+ * Instances of OpenLayers.Marker are a combination of a 
+ * <OpenLayers.LonLat> and an <OpenLayers.Icon>.  
+ *
+ * Markers are generally added to a special layer called
+ * <OpenLayers.Layer.Markers>.
+ *
+ * Example:
+ * (code)
+ * var markers = new OpenLayers.Layer.Markers( "Markers" );
+ * map.addLayer(markers);
+ *
+ * var size = new OpenLayers.Size(21,25);
+ * var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
+ * var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png', size, offset);
+ * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
+ * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone()));
+ *
+ * (end)
+ *
+ * Note that if you pass an icon into the Marker constructor, it will take
+ * that icon and use it. This means that you should not share icons between
+ * markers -- you use them once, but you should clone() for any additional
+ * markers using that same icon.
+ */
+OpenLayers.Marker = OpenLayers.Class({
+    
+    /** 
+     * Property: icon 
+     * {<OpenLayers.Icon>} The icon used by this marker.
+     */
+    icon: null,
+
+    /** 
+     * Property: lonlat 
+     * {<OpenLayers.LonLat>} location of object
+     */
+    lonlat: null,
+    
+    /** 
+     * Property: events 
+     * {<OpenLayers.Events>} the event handler.
+     */
+    events: null,
+    
+    /** 
+     * Property: map 
+     * {<OpenLayers.Map>} the map this marker is attached to
+     */
+    map: null,
+    
+    /** 
+     * Constructor: OpenLayers.Marker
+     *
+     * Parameters:
+     * lonlat - {<OpenLayers.LonLat>} the position of this marker
+     * icon - {<OpenLayers.Icon>}  the icon for this marker
+     */
+    initialize: function(lonlat, icon) {
+        this.lonlat = lonlat;
+        
+        var newIcon = (icon) ? icon : OpenLayers.Marker.defaultIcon();
+        if (this.icon == null) {
+            this.icon = newIcon;
+        } else {
+            this.icon.url = newIcon.url;
+            this.icon.size = newIcon.size;
+            this.icon.offset = newIcon.offset;
+            this.icon.calculateOffset = newIcon.calculateOffset;
+        }
+        this.events = new OpenLayers.Events(this, this.icon.imageDiv);
+    },
+    
+    /**
+     * APIMethod: destroy
+     * Destroy the marker. You must first remove the marker from any 
+     * layer which it has been added to, or you will get buggy behavior.
+     * (This can not be done within the marker since the marker does not
+     * know which layer it is attached to.)
+     */
+    destroy: function() {
+        // erase any drawn features
+        this.erase();
+
+        this.map = null;
+
+        this.events.destroy();
+        this.events = null;
+
+        if (this.icon != null) {
+            this.icon.destroy();
+            this.icon = null;
+        }
+    },
+    
+    /** 
+    * Method: draw
+    * Calls draw on the icon, and returns that output.
+    * 
+    * Parameters:
+    * px - {<OpenLayers.Pixel>}
+    * 
+    * Returns:
+    * {DOMElement} A new DOM Image with this marker's icon set at the 
+    * location passed-in
+    */
+    draw: function(px) {
+        return this.icon.draw(px);
+    }, 
+
+    /** 
+    * Method: erase
+    * Erases any drawn elements for this marker.
+    */
+    erase: function() {
+        if (this.icon != null) {
+            this.icon.erase();
+        }
+    }, 
+
+    /**
+    * Method: moveTo
+    * Move the marker to the new location.
+    *
+    * Parameters:
+    * px - {<OpenLayers.Pixel>|Object} the pixel position to move to.
+    * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
+    */
+    moveTo: function (px) {
+        if ((px != null) && (this.icon != null)) {
+            this.icon.moveTo(px);
+        }           
+        this.lonlat = this.map.getLonLatFromLayerPx(px);
+    },
+
+    /**
+     * APIMethod: isDrawn
+     * 
+     * Returns:
+     * {Boolean} Whether or not the marker is drawn.
+     */
+    isDrawn: function() {
+        var isDrawn = (this.icon && this.icon.isDrawn());
+        return isDrawn;   
+    },
+
+    /**
+     * Method: onScreen
+     *
+     * Returns:
+     * {Boolean} Whether or not the marker is currently visible on screen.
+     */
+    onScreen:function() {
+        
+        var onScreen = false;
+        if (this.map) {
+            var screenBounds = this.map.getExtent();
+            onScreen = screenBounds.containsLonLat(this.lonlat);
+        }    
+        return onScreen;
+    },
+    
+    /**
+     * Method: inflate
+     * Englarges the markers icon by the specified ratio.
+     *
+     * Parameters:
+     * inflate - {float} the ratio to enlarge the marker by (passing 2
+     *                   will double the size).
+     */
+    inflate: function(inflate) {
+        if (this.icon) {
+            this.icon.setSize({
+                w: this.icon.size.w * inflate,
+                h: this.icon.size.h * inflate
+            });
+        }        
+    },
+    
+    /** 
+     * Method: setOpacity
+     * Change the opacity of the marker by changin the opacity of 
+     *   its icon
+     * 
+     * Parameters:
+     * opacity - {float}  Specified as fraction (0.4, etc)
+     */
+    setOpacity: function(opacity) {
+        this.icon.setOpacity(opacity);
+    },
+
+    /**
+     * Method: setUrl
+     * Change URL of the Icon Image.
+     * 
+     * url - {String} 
+     */
+    setUrl: function(url) {
+        this.icon.setUrl(url);
+    },    
+
+    /** 
+     * Method: display
+     * Hide or show the icon
+     * 
+     * display - {Boolean} 
+     */
+    display: function(display) {
+        this.icon.display(display);
+    },
+
+    CLASS_NAME: "OpenLayers.Marker"
+});
+
+
+/**
+ * Function: defaultIcon
+ * Creates a default <OpenLayers.Icon>.
+ * 
+ * Returns:
+ * {<OpenLayers.Icon>} A default OpenLayers.Icon to use for a marker
+ */
+OpenLayers.Marker.defaultIcon = function() {
+    return new OpenLayers.Icon(OpenLayers.Util.getImageLocation("marker.png"),
+                               {w: 21, h: 25}, {x: -10.5, y: -25});
+};
+    
+
+/* ======================================================================
+    OpenLayers/Util/vendorPrefix.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/SingleFile.js
+ */
+
+OpenLayers.Util = OpenLayers.Util || {};
+/**
+ * Namespace: OpenLayers.Util.vendorPrefix
+ * A collection of utility functions to detect vendor prefixed features
+ */
+OpenLayers.Util.vendorPrefix = (function() {
+    "use strict";
+    
+    var VENDOR_PREFIXES = ["", "O", "ms", "Moz", "Webkit"],
+        divStyle = document.createElement("div").style,
+        cssCache = {},
+        jsCache = {};
+
+    
+    /**
+     * Function: domToCss
+     * Converts a upper camel case DOM style property name to a CSS property
+     *      i.e. transformOrigin -> transform-origin
+     *      or   WebkitTransformOrigin -> -webkit-transform-origin
+     *
+     * Parameters:
+     * prefixedDom - {String} The property to convert
+     *
+     * Returns:
+     * {String} The CSS property
+     */
+    function domToCss(prefixedDom) {
+        if (!prefixedDom) { return null; }
+        return prefixedDom.
+            replace(/([A-Z])/g, function(c) { return "-" + c.toLowerCase(); }).
+            replace(/^ms-/, "-ms-");
+    }
+
+    /**
+     * APIMethod: css
+     * Detect which property is used for a CSS property
+     *
+     * Parameters:
+     * property - {String} The standard (unprefixed) CSS property name
+     *
+     * Returns:
+     * {String} The standard CSS property, prefixed property or null if not
+     *          supported
+     */
+    function css(property) {
+        if (cssCache[property] === undefined) {
+            var domProperty = property.
+                replace(/(-[\s\S])/g, function(c) { return c.charAt(1).toUpperCase(); });
+            var prefixedDom = style(domProperty);
+            cssCache[property] = domToCss(prefixedDom);
+        }
+        return cssCache[property];
+    }
+
+    /**
+     * APIMethod: js
+     * Detect which property is used for a JS property/method
+     *
+     * Parameters:
+     * obj - {Object} The object to test on
+     * property - {String} The standard (unprefixed) JS property name
+     *
+     * Returns:
+     * {String} The standard JS property, prefixed property or null if not
+     *          supported
+     */
+    function js(obj, property) {
+        if (jsCache[property] === undefined) {
+            var tmpProp,
+                i = 0,
+                l = VENDOR_PREFIXES.length,
+                prefix,
+                isStyleObj = (typeof obj.cssText !== "undefined");
+
+            jsCache[property] = null;
+            for(; i<l; i++) {
+                prefix = VENDOR_PREFIXES[i];
+                if(prefix) {
+                    if (!isStyleObj) {
+                        // js prefix should be lower-case, while style
+                        // properties have upper case on first character
+                        prefix = prefix.toLowerCase();
+                    }
+                    tmpProp = prefix + property.charAt(0).toUpperCase() + property.slice(1);
+                } else {
+                    tmpProp = property;
+                }
+
+                if(obj[tmpProp] !== undefined) {
+                    jsCache[property] = tmpProp;
+                    break;
+                }
+            }
+        }
+        return jsCache[property];
+    }
+    
+    /**
+     * APIMethod: style
+     * Detect which property is used for a DOM style property
+     *
+     * Parameters:
+     * property - {String} The standard (unprefixed) style property name
+     *
+     * Returns:
+     * {String} The standard style property, prefixed property or null if not
+     *          supported
+     */
+    function style(property) {
+        return js(divStyle, property);
+    }
+    
+    return {
+        css:      css,
+        js:       js,
+        style:    style,
+        
+        // used for testing
+        cssCache:       cssCache,
+        jsCache:        jsCache
+    };
+}());
+/* ======================================================================
+    OpenLayers/Animation.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/SingleFile.js
+ * @requires OpenLayers/Util/vendorPrefix.js
+ */
+
+/**
+ * Namespace: OpenLayers.Animation
  * A collection of utility functions for executing methods that repaint a 
  *     portion of the browser window.  These methods take advantage of the
  *     browser's scheduled repaints where requestAnimationFrame is available.
  * A collection of utility functions for executing methods that repaint a 
  *     portion of the browser window.  These methods take advantage of the
  *     browser's scheduled repaints where requestAnimationFrame is available.
@@ -6020,7 +6418,7 @@ OpenLayers.Animation = (function(window) {
     OpenLayers/Tween.js
    ====================================================================== */
 
     OpenLayers/Tween.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -6385,7 +6783,7 @@ OpenLayers.Easing.Quad = {
     OpenLayers/Projection.js
    ====================================================================== */
 
     OpenLayers/Projection.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -6491,7 +6889,7 @@ OpenLayers.Projection = OpenLayers.Class({
     /**
      * Method: equals
      * Test equality of two projection instances.  Determines equality based
     /**
      * Method: equals
      * Test equality of two projection instances.  Determines equality based
-     *     soley on the projection code.
+     *     solely on the projection code.
      *
      * Returns:
      * {Boolean} The two projections are equivalent.
      *
      * Returns:
      * {Boolean} The two projections are equivalent.
@@ -6553,23 +6951,27 @@ OpenLayers.Projection.transforms = {};
  * APIProperty: defaults
  * {Object} Defaults for the SRS codes known to OpenLayers (currently
  * EPSG:4326, CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:900913, EPSG:3857,
  * APIProperty: defaults
  * {Object} Defaults for the SRS codes known to OpenLayers (currently
  * EPSG:4326, CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:900913, EPSG:3857,
- * EPSG:102113 and EPSG:102100). Keys are the SRS code, values are units,
- * maxExtent (the validity extent for the SRS) and yx (true if this SRS is
- * known to have a reverse axis order).
+ * EPSG:102113, EPSG:102100 and OSGEO:41001). Keys are the SRS code, values are
+ * units, maxExtent (the validity extent for the SRS in projected coordinates),
+ * worldExtent (the world's extent in EPSG:4326) and yx (true if this SRS
+ * is known to have a reverse axis order).
  */
 OpenLayers.Projection.defaults = {
     "EPSG:4326": {
         units: "degrees",
         maxExtent: [-180, -90, 180, 90],
  */
 OpenLayers.Projection.defaults = {
     "EPSG:4326": {
         units: "degrees",
         maxExtent: [-180, -90, 180, 90],
+        worldExtent: [-180, -90, 180, 90],
         yx: true
     },
     "CRS:84": {
         units: "degrees",
         yx: true
     },
     "CRS:84": {
         units: "degrees",
-        maxExtent: [-180, -90, 180, 90]
+        maxExtent: [-180, -90, 180, 90],
+        worldExtent: [-180, -90, 180, 90]
     },
     "EPSG:900913": {
         units: "m",
     },
     "EPSG:900913": {
         units: "m",
-        maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34]
+        maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34],
+        worldExtent: [-180, -89, 180, 89]
     }
 };
 
     }
 };
 
@@ -6653,9 +7055,9 @@ OpenLayers.Projection.nullTransform = function(point) {
 
 /**
  * Note: Transforms for web mercator <-> geographic
 
 /**
  * Note: Transforms for web mercator <-> geographic
- * OpenLayers recognizes EPSG:3857, EPSG:900913, EPSG:102113 and EPSG:102100.
- * OpenLayers originally started referring to EPSG:900913 as web mercator.
- * The EPSG has declared EPSG:3857 to be web mercator.
+ * OpenLayers recognizes EPSG:3857, EPSG:900913, EPSG:102113, EPSG:102100 and 
+ * OSGEO:41001. OpenLayers originally started referring to EPSG:900913 as web
+ * mercator. The EPSG has declared EPSG:3857 to be web mercator.
  * ArcGIS 10 recognizes the EPSG:3857, EPSG:102113, and EPSG:102100 as
  * equivalent.  See http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/20/ArcGIS-Online-moving-to-Google-_2F00_-Bing-tiling-scheme_3A00_-What-does-this-mean-for-you_3F00_.aspx#12084.
  * For geographic, OpenLayers recognizes EPSG:4326, CRS:84 and
  * ArcGIS 10 recognizes the EPSG:3857, EPSG:102113, and EPSG:102100 as
  * equivalent.  See http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/20/ArcGIS-Online-moving-to-Google-_2F00_-Bing-tiling-scheme_3A00_-What-does-this-mean-for-you_3F00_.aspx#12084.
  * For geographic, OpenLayers recognizes EPSG:4326, CRS:84 and
@@ -6696,7 +7098,7 @@ OpenLayers.Projection.nullTransform = function(point) {
     }
     
     // list of equivalent codes for web mercator
     }
     
     // list of equivalent codes for web mercator
-    var mercator = ["EPSG:900913", "EPSG:3857", "EPSG:102113", "EPSG:102100"],
+    var mercator = ["EPSG:900913", "EPSG:3857", "EPSG:102113", "EPSG:102100", "OSGEO:41001"],
         geographic = ["CRS:84", "urn:ogc:def:crs:EPSG:6.6:4326", "EPSG:4326"],
         i;
     for (i=mercator.length-1; i>=0; --i) {
         geographic = ["CRS:84", "urn:ogc:def:crs:EPSG:6.6:4326", "EPSG:4326"],
         i;
     for (i=mercator.length-1; i>=0; --i) {
@@ -6711,7 +7113,7 @@ OpenLayers.Projection.nullTransform = function(point) {
     OpenLayers/Map.js
    ====================================================================== */
 
     OpenLayers/Map.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -6795,6 +7197,9 @@ OpenLayers.Map = OpenLayers.Class({
      *     zoom has changed.
      * move - triggered after each drag, pan, or zoom
      * moveend - triggered after a drag, pan, or zoom completes
      *     zoom has changed.
      * move - triggered after each drag, pan, or zoom
      * moveend - triggered after a drag, pan, or zoom completes
+     * zoomstart - triggered when a zoom starts. Listeners receive an object
+     *     with *center* and *zoom* properties, for the target center and zoom
+     *     level.
      * zoomend - triggered after a zoom completes
      * mouseover - triggered after mouseover the map
      * mouseout - triggered after mouseout the map
      * zoomend - triggered after a zoom completes
      * mouseover - triggered after mouseover the map
      * mouseout - triggered after mouseout the map
@@ -7221,10 +7626,6 @@ OpenLayers.Map = OpenLayers.Class({
      *     Note that if an ArgParser/Permalink control is present,
      *     and the querystring contains a zoom level, zoom will be set
      *     by that, and this option will be ignored.
      *     Note that if an ArgParser/Permalink control is present,
      *     and the querystring contains a zoom level, zoom will be set
      *     by that, and this option will be ignored.
-     * extent - {<OpenLayers.Bounds>|Array} The initial extent of the map.
-     *     If provided as an array, the array should consist of
-     *     four values (left, bottom, right, top).
-     *     Only specify if <center> and <zoom> are not provided.
      * 
      * Examples:
      * (code)
      * 
      * Examples:
      * (code)
@@ -7259,7 +7660,8 @@ OpenLayers.Map = OpenLayers.Class({
     initialize: function (div, options) {
         
         // If only one argument is provided, check if it is an object.
     initialize: function (div, options) {
         
         // If only one argument is provided, check if it is an object.
-        if(arguments.length === 1 && typeof div === "object") {
+        var isDOMElement = OpenLayers.Util.isElement(div);
+        if(arguments.length === 1 && typeof div === "object" && !isDOMElement) {
             options = div;
             div = options && options.div;
         }
             options = div;
             div = options && options.div;
         }
@@ -7972,7 +8374,7 @@ OpenLayers.Map = OpenLayers.Class({
      *     the layer is moved down.  Again, note that this cannot (or at least
      *     should not) be effectively used to raise base layers above overlays.
      *
      *     the layer is moved down.  Again, note that this cannot (or at least
      *     should not) be effectively used to raise base layers above overlays.
      *
-     * Paremeters:
+     * Parameters:
      * layer - {<OpenLayers.Layer>} 
      * delta - {int} 
      */
      * layer - {<OpenLayers.Layer>} 
      * delta - {int} 
      */
@@ -7998,6 +8400,7 @@ OpenLayers.Map = OpenLayers.Class({
 
                 // preserve center and scale when changing base layers
                 var center = this.getCachedCenter();
 
                 // preserve center and scale when changing base layers
                 var center = this.getCachedCenter();
+                var oldResolution = this.getResolution();
                 var newResolution = OpenLayers.Util.getResolutionFromScale(
                     this.getScale(), newBaseLayer.units
                 );
                 var newResolution = OpenLayers.Util.getResolutionFromScale(
                     this.getScale(), newBaseLayer.units
                 );
@@ -8026,7 +8429,7 @@ OpenLayers.Map = OpenLayers.Class({
                         newResolution || this.resolution, true
                     );
                     // zoom and force zoom change
                         newResolution || this.resolution, true
                     );
                     // zoom and force zoom change
-                    this.setCenter(center, newZoom, false, true);
+                    this.setCenter(center, newZoom, false, oldResolution != newResolution);
                 }
 
                 this.events.triggerEvent("changebaselayer", {
                 }
 
                 this.events.triggerEvent("changebaselayer", {
@@ -8428,7 +8831,7 @@ OpenLayers.Map = OpenLayers.Class({
    
    /** 
      * APIMethod: panTo
    
    /** 
      * APIMethod: panTo
-     * Allows user to pan to a new lonlat
+     * Allows user to pan to a new lonlat.
      * If the new lonlat is in the current extent the map will slide smoothly
      * 
      * Parameters:
      * If the new lonlat is in the current extent the map will slide smoothly
      * 
      * Parameters:
@@ -8689,7 +9092,7 @@ OpenLayers.Map = OpenLayers.Class({
 
             if (centerChanged) {
                 if (!zoomChanged && this.center) { 
 
             if (centerChanged) {
                 if (!zoomChanged && this.center) { 
-                    // if zoom hasnt changed, just slide layerContainer
+                    // if zoom hasn't changed, just slide layerContainer
                     //  (must be done before setting this.center to new value)
                     this.centerLayerContainer(lonlat);
                 }
                     //  (must be done before setting this.center to new value)
                     this.centerLayerContainer(lonlat);
                 }
@@ -9110,44 +9513,46 @@ OpenLayers.Map = OpenLayers.Class({
             if (map.baseLayer.wrapDateLine) {
                 zoom = map.adjustZoom(zoom);
             }
             if (map.baseLayer.wrapDateLine) {
                 zoom = map.adjustZoom(zoom);
             }
+            var center = xy ?
+                map.getZoomTargetCenter(xy, map.getResolutionForZoom(zoom)) :
+                map.getCenter();
+            if (center) {
+                map.events.triggerEvent('zoomstart', {
+                    center: center,
+                    zoom: zoom
+                });
+            }
             if (map.zoomTween) {
             if (map.zoomTween) {
+                map.zoomTween.stop();
                 var currentRes = map.getResolution(),
                     targetRes = map.getResolutionForZoom(zoom),
                     start = {scale: 1},
                     end = {scale: currentRes / targetRes};
                 var currentRes = map.getResolution(),
                     targetRes = map.getResolutionForZoom(zoom),
                     start = {scale: 1},
                     end = {scale: currentRes / targetRes};
-                if (map.zoomTween.playing && map.zoomTween.duration < 3 * map.zoomDuration) {
-                    // update the end scale, and reuse the running zoomTween
-                    map.zoomTween.finish = {
-                        scale: map.zoomTween.finish.scale * end.scale
-                    };
-                } else {
-                    if (!xy) {
-                        var size = map.getSize();
-                        xy = {x: size.w / 2, y: size.h / 2};
-                    }
-                    map.zoomTween.start(start, end, map.zoomDuration, {
-                        minFrameRate: 50, // don't spend much time zooming
-                        callbacks: {
-                            eachStep: function(data) {
-                                var containerOrigin = map.layerContainerOriginPx,
-                                    scale = data.scale,
-                                    dx = ((scale - 1) * (containerOrigin.x - xy.x)) | 0,
-                                    dy = ((scale - 1) * (containerOrigin.y - xy.y)) | 0;
-                                map.applyTransform(containerOrigin.x + dx, containerOrigin.y + dy, scale);
-                            },
-                            done: function(data) {
-                                map.applyTransform();
-                                var resolution = map.getResolution() / data.scale,
-                                    zoom = map.getZoomForResolution(resolution, true)
-                                map.moveTo(map.getZoomTargetCenter(xy, resolution), zoom, true);
-                            }
+                if (!xy) {
+                    var size = map.getSize();
+                    xy = {x: size.w / 2, y: size.h / 2};
+                }
+                map.zoomTween.start(start, end, map.zoomDuration, {
+                    minFrameRate: 50, // don't spend much time zooming
+                    callbacks: {
+                        eachStep: function(data) {
+                            var containerOrigin = map.layerContainerOriginPx,
+                                scale = data.scale,
+                                dx = ((scale - 1) * (containerOrigin.x - xy.x)) | 0,
+                                dy = ((scale - 1) * (containerOrigin.y - xy.y)) | 0;
+                            map.applyTransform(containerOrigin.x + dx, containerOrigin.y + dy, scale);
+                        },
+                        done: function(data) {
+                            map.applyTransform();
+                            var resolution = map.getResolution() / data.scale,
+                                newZoom = map.getZoomForResolution(resolution, true),
+                                newCenter = data.scale === 1 ? center :
+                                        map.getZoomTargetCenter(xy, resolution);
+                            map.moveTo(newCenter, newZoom);
                         }
                         }
-                    });
-                }
+                    }
+                });
             } else {
             } else {
-                var center = xy ?
-                    map.getZoomTargetCenter(xy, map.getResolutionForZoom(zoom)) :
-                    null;
                 map.setCenter(center, zoom);
             }
         }
                 map.setCenter(center, zoom);
             }
         }
@@ -9158,6 +9563,9 @@ OpenLayers.Map = OpenLayers.Class({
      * 
      */
     zoomIn: function() {
      * 
      */
     zoomIn: function() {
+        if (this.zoomTween) {
+            this.zoomTween.stop();
+        }
         this.zoomTo(this.getZoom() + 1);
     },
     
         this.zoomTo(this.getZoom() + 1);
     },
     
@@ -9166,6 +9574,9 @@ OpenLayers.Map = OpenLayers.Class({
      * 
      */
     zoomOut: function() {
      * 
      */
     zoomOut: function() {
+        if (this.zoomTween) {
+            this.zoomTween.stop();
+        }
         this.zoomTo(this.getZoom() - 1);
     },
 
         this.zoomTo(this.getZoom() - 1);
     },
 
@@ -9579,10 +9990,10 @@ OpenLayers.Map.TILE_WIDTH = 256;
  */
 OpenLayers.Map.TILE_HEIGHT = 256;
 /* ======================================================================
  */
 OpenLayers.Map.TILE_HEIGHT = 256;
 /* ======================================================================
-    OpenLayers/Layer.js
+    OpenLayers/Feature.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -9590,3111 +10001,2494 @@ OpenLayers.Map.TILE_HEIGHT = 256;
 
 /**
  * @requires OpenLayers/BaseTypes/Class.js
 
 /**
  * @requires OpenLayers/BaseTypes/Class.js
- * @requires OpenLayers/Map.js
- * @requires OpenLayers/Projection.js
+ * @requires OpenLayers/Util.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Layer
+ * Class: OpenLayers.Feature
+ * Features are combinations of geography and attributes. The OpenLayers.Feature
+ *     class specifically combines a marker and a lonlat.
  */
  */
-OpenLayers.Layer = OpenLayers.Class({
-
-    /**
-     * APIProperty: id
-     * {String}
-     */
-    id: null,
+OpenLayers.Feature = OpenLayers.Class({
 
     /** 
 
     /** 
-     * APIProperty: name
-     * {String}
+     * Property: layer 
+     * {<OpenLayers.Layer>} 
      */
      */
-    name: null,
+    layer: null,
 
     /** 
 
     /** 
-     * APIProperty: div
-     * {DOMElement}
+     * Property: id 
+     * {String} 
      */
      */
-    div: null,
-
-    /**
-     * APIProperty: opacity
-     * {Float} The layer's opacity. Float number between 0.0 and 1.0. Default
-     * is 1.
+    id: null,
+    
+    /** 
+     * Property: lonlat 
+     * {<OpenLayers.LonLat>} 
      */
      */
-    opacity: 1,
+    lonlat: null,
 
 
-    /**
-     * APIProperty: alwaysInRange
-     * {Boolean} If a layer's display should not be scale-based, this should 
-     *     be set to true. This will cause the layer, as an overlay, to always 
-     *     be 'active', by always returning true from the calculateInRange() 
-     *     function. 
-     * 
-     *     If not explicitly specified for a layer, its value will be 
-     *     determined on startup in initResolutions() based on whether or not 
-     *     any scale-specific properties have been set as options on the 
-     *     layer. If no scale-specific options have been set on the layer, we 
-     *     assume that it should always be in range.
-     * 
-     *     See #987 for more info.
+    /** 
+     * Property: data 
+     * {Object} 
      */
      */
-    alwaysInRange: null,   
+    data: null,
 
 
-    /**
-     * Constant: RESOLUTION_PROPERTIES
-     * {Array} The properties that are used for calculating resolutions
-     *     information.
+    /** 
+     * Property: marker 
+     * {<OpenLayers.Marker>} 
      */
      */
-    RESOLUTION_PROPERTIES: [
-        'scales', 'resolutions',
-        'maxScale', 'minScale',
-        'maxResolution', 'minResolution',
-        'numZoomLevels', 'maxZoomLevel'
-    ],
+    marker: null,
 
     /**
 
     /**
-     * APIProperty: events
-     * {<OpenLayers.Events>}
-     *
-     * Register a listener for a particular event with the following syntax:
-     * (code)
-     * layer.events.register(type, obj, listener);
-     * (end)
-     *
-     * Listeners will be called with a reference to an event object.  The
-     *     properties of this event depends on exactly what happened.
-     *
-     * All event objects have at least the following properties:
-     * object - {Object} A reference to layer.events.object.
-     * element - {DOMElement} A reference to layer.events.element.
-     *
-     * Supported map event types:
-     * loadstart - Triggered when layer loading starts.  When using a Vector 
-     *     layer with a Fixed or BBOX strategy, the event object includes 
-     *     a *filter* property holding the OpenLayers.Filter used when 
-     *     calling read on the protocol.
-     * loadend - Triggered when layer loading ends.  When using a Vector layer
-     *     with a Fixed or BBOX strategy, the event object includes a 
-     *     *response* property holding an OpenLayers.Protocol.Response object.
-     * visibilitychanged - Triggered when the layer's visibility property is
-     *     changed, e.g. by turning the layer on or off in the layer switcher.
-     *     Note that the actual visibility of the layer can also change if it
-     *     gets out of range (see <calculateInRange>). If you also want to catch
-     *     these cases, register for the map's 'changelayer' event instead.
-     * move - Triggered when layer moves (triggered with every mousemove
-     *     during a drag).
-     * moveend - Triggered when layer is done moving, object passed as
-     *     argument has a zoomChanged boolean property which tells that the
-     *     zoom has changed.
-     * added - Triggered after the layer is added to a map.  Listeners will
-     *     receive an object with a *map* property referencing the map and a
-     *     *layer* property referencing the layer.
-     * removed - Triggered after the layer is removed from the map.  Listeners
-     *     will receive an object with a *map* property referencing the map and
-     *     a *layer* property referencing the layer.
+     * APIProperty: popupClass
+     * {<OpenLayers.Class>} The class which will be used to instantiate
+     *     a new Popup. Default is <OpenLayers.Popup.Anchored>.
      */
      */
-    events: null,
+    popupClass: null,
 
 
-    /**
-     * APIProperty: map
-     * {<OpenLayers.Map>} This variable is set when the layer is added to 
-     *     the map, via the accessor function setMap().
-     */
-    map: null,
-    
-    /**
-     * APIProperty: isBaseLayer
-     * {Boolean} Whether or not the layer is a base layer. This should be set 
-     *     individually by all subclasses. Default is false
-     */
-    isBaseLayer: false,
-    /**
-     * Property: alpha
-     * {Boolean} The layer's images have an alpha channel.  Default is false.
+    /** 
+     * Property: popup 
+     * {<OpenLayers.Popup>} 
      */
      */
-    alpha: false,
+    popup: null,
 
     /** 
 
     /** 
-     * APIProperty: displayInLayerSwitcher
-     * {Boolean} Display the layer's name in the layer switcher.  Default is
-     *     true.
+     * Constructor: OpenLayers.Feature
+     * Constructor for features.
+     *
+     * Parameters:
+     * layer - {<OpenLayers.Layer>} 
+     * lonlat - {<OpenLayers.LonLat>} 
+     * data - {Object} 
+     * 
+     * Returns:
+     * {<OpenLayers.Feature>}
      */
      */
-    displayInLayerSwitcher: true,
+    initialize: function(layer, lonlat, data) {
+        this.layer = layer;
+        this.lonlat = lonlat;
+        this.data = (data != null) ? data : {};
+        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); 
+    },
 
 
-    /**
-     * APIProperty: visibility
-     * {Boolean} The layer should be displayed in the map.  Default is true.
+    /** 
+     * Method: destroy
+     * nullify references to prevent circular references and memory leaks
      */
      */
-    visibility: true,
+    destroy: function() {
 
 
-    /**
-     * APIProperty: attribution
-     * {String} Attribution string, displayed when an 
-     *     <OpenLayers.Control.Attribution> has been added to the map.
-     */
-    attribution: null, 
+        //remove the popup from the map
+        if ((this.layer != null) && (this.layer.map != null)) {
+            if (this.popup != null) {
+                this.layer.map.removePopup(this.popup);
+            }
+        }
+        // remove the marker from the layer
+        if (this.layer != null && this.marker != null) {
+            this.layer.removeMarker(this.marker);
+        }
 
 
-    /** 
-     * Property: inRange
-     * {Boolean} The current map resolution is within the layer's min/max 
-     *     range. This is set in <OpenLayers.Map.setCenter> whenever the zoom 
-     *     changes.
-     */
-    inRange: false,
+        this.layer = null;
+        this.id = null;
+        this.lonlat = null;
+        this.data = null;
+        if (this.marker != null) {
+            this.destroyMarker(this.marker);
+            this.marker = null;
+        }
+        if (this.popup != null) {
+            this.destroyPopup(this.popup);
+            this.popup = null;
+        }
+    },
     
     /**
     
     /**
-     * Propery: imageSize
-     * {<OpenLayers.Size>} For layers with a gutter, the image is larger than 
-     *     the tile by twice the gutter in each dimension.
+     * Method: onScreen
+     * 
+     * Returns:
+     * {Boolean} Whether or not the feature is currently visible on screen
+     *           (based on its 'lonlat' property)
      */
      */
-    imageSize: null,
+    onScreen:function() {
+        
+        var onScreen = false;
+        if ((this.layer != null) && (this.layer.map != null)) {
+            var screenBounds = this.layer.map.getExtent();
+            onScreen = screenBounds.containsLonLat(this.lonlat);
+        }    
+        return onScreen;
+    },
     
     
-  // OPTIONS
-
-    /** 
-     * Property: options
-     * {Object} An optional object whose properties will be set on the layer.
-     *     Any of the layer properties can be set as a property of the options
-     *     object and sent to the constructor when the layer is created.
-     */
-    options: null,
 
     /**
 
     /**
-     * APIProperty: eventListeners
-     * {Object} If set as an option at construction, the eventListeners
-     *     object will be registered with <OpenLayers.Events.on>.  Object
-     *     structure must be a listeners object as shown in the example for
-     *     the events.on method.
+     * Method: createMarker
+     * Based on the data associated with the Feature, create and return a marker object.
+     *
+     * Returns: 
+     * {<OpenLayers.Marker>} A Marker Object created from the 'lonlat' and 'icon' properties
+     *          set in this.data. If no 'lonlat' is set, returns null. If no
+     *          'icon' is set, OpenLayers.Marker() will load the default image.
+     *          
+     *          Note - this.marker is set to return value
+     * 
      */
      */
-    eventListeners: null,
+    createMarker: function() {
+
+        if (this.lonlat != null) {
+            this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);
+        }
+        return this.marker;
+    },
 
     /**
 
     /**
-     * APIProperty: gutter
-     * {Integer} Determines the width (in pixels) of the gutter around image
-     *     tiles to ignore.  By setting this property to a non-zero value,
-     *     images will be requested that are wider and taller than the tile
-     *     size by a value of 2 x gutter.  This allows artifacts of rendering
-     *     at tile edges to be ignored.  Set a gutter value that is equal to
-     *     half the size of the widest symbol that needs to be displayed.
-     *     Defaults to zero.  Non-tiled layers always have zero gutter.
-     */ 
-    gutter: 0, 
+     * Method: destroyMarker
+     * Destroys marker.
+     * If user overrides the createMarker() function, s/he should be able
+     *   to also specify an alternative function for destroying it
+     */
+    destroyMarker: function() {
+        this.marker.destroy();  
+    },
 
     /**
 
     /**
-     * APIProperty: projection
-     * {<OpenLayers.Projection>} or {<String>} Specifies the projection of the layer.
-     *     Can be set in the layer options. If not specified in the layer options,
-     *     it is set to the default projection specified in the map,
-     *     when the layer is added to the map.
-     *     Projection along with default maxExtent and resolutions
-     *     are set automatically with commercial baselayers in EPSG:3857,
-     *     such as Google, Bing and OpenStreetMap, and do not need to be specified.
-     *     Otherwise, if specifying projection, also set maxExtent,
-     *     maxResolution or resolutions as appropriate.
-     *     When using vector layers with strategies, layer projection should be set
-     *     to the projection of the source data if that is different from the map default.
+     * Method: createPopup
+     * Creates a popup object created from the 'lonlat', 'popupSize',
+     *     and 'popupContentHTML' properties set in this.data. It uses
+     *     this.marker.icon as default anchor. 
+     *  
+     *  If no 'lonlat' is set, returns null. 
+     *  If no this.marker has been created, no anchor is sent.
+     *
+     *  Note - the returned popup object is 'owned' by the feature, so you
+     *      cannot use the popup's destroy method to discard the popup.
+     *      Instead, you must use the feature's destroyPopup
      * 
      * 
-     *     Can be either a string or an <OpenLayers.Projection> object;
-     *     if a string is passed, will be converted to an object when
-     *     the layer is added to the map.
+     *  Note - this.popup is set to return value
+     * 
+     * Parameters: 
+     * closeBox - {Boolean} create popup with closebox or not
+     * 
+     * Returns:
+     * {<OpenLayers.Popup>} Returns the created popup, which is also set
+     *     as 'popup' property of this feature. Will be of whatever type
+     *     specified by this feature's 'popupClass' property, but must be
+     *     of type <OpenLayers.Popup>.
      * 
      */
      * 
      */
-    projection: null,    
-    
-    /**
-     * APIProperty: units
-     * {String} The layer map units.  Defaults to null.  Possible values
-     *     are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'.
-     *     Normally taken from the projection.
-     *     Only required if both map and layers do not define a projection,
-     *     or if they define a projection which does not define units.
-     */
-    units: null,
+    createPopup: function(closeBox) {
 
 
-    /**
-     * APIProperty: scales
-     * {Array}  An array of map scales in descending order.  The values in the
-     *     array correspond to the map scale denominator.  Note that these
-     *     values only make sense if the display (monitor) resolution of the
-     *     client is correctly guessed by whomever is configuring the
-     *     application.  In addition, the units property must also be set.
-     *     Use <resolutions> instead wherever possible.
-     */
-    scales: null,
+        if (this.lonlat != null) {
+            if (!this.popup) {
+                var anchor = (this.marker) ? this.marker.icon : null;
+                var popupClass = this.popupClass ? 
+                    this.popupClass : OpenLayers.Popup.Anchored;
+                this.popup = new popupClass(this.id + "_popup", 
+                                            this.lonlat,
+                                            this.data.popupSize,
+                                            this.data.popupContentHTML,
+                                            anchor, 
+                                            closeBox); 
+            }    
+            if (this.data.overflow != null) {
+                this.popup.contentDiv.style.overflow = this.data.overflow;
+            }    
+            
+            this.popup.feature = this;
+        }        
+        return this.popup;
+    },
 
 
-    /**
-     * APIProperty: resolutions
-     * {Array} A list of map resolutions (map units per pixel) in descending
-     *     order.  If this is not set in the layer constructor, it will be set
-     *     based on other resolution related properties (maxExtent,
-     *     maxResolution, maxScale, etc.).
-     */
-    resolutions: null,
     
     /**
     
     /**
-     * APIProperty: maxExtent
-     * {<OpenLayers.Bounds>|Array} If provided as an array, the array
-     *     should consist of four values (left, bottom, right, top).
-     *     The maximum extent for the layer.  Defaults to null.
-     * 
-     *     The center of these bounds will not stray outside
-     *     of the viewport extent during panning.  In addition, if
-     *     <displayOutsideMaxExtent> is set to false, data will not be
-     *     requested that falls completely outside of these bounds.
+     * Method: destroyPopup
+     * Destroys the popup created via createPopup.
+     *
+     * As with the marker, if user overrides the createPopup() function, s/he 
+     *   should also be able to override the destruction
      */
      */
-    maxExtent: null,
-    
-    /**
-     * APIProperty: minExtent
-     * {<OpenLayers.Bounds>|Array} If provided as an array, the array
-     *     should consist of four values (left, bottom, right, top).
-     *     The minimum extent for the layer.  Defaults to null.
+    destroyPopup: function() {
+        if (this.popup) {
+            this.popup.feature = null;
+            this.popup.destroy();
+            this.popup = null;
+        }    
+    },
+
+    CLASS_NAME: "OpenLayers.Feature"
+});
+/* ======================================================================
+    OpenLayers/Feature/Vector.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+// TRASH THIS
+OpenLayers.State = {
+    /** states */
+    UNKNOWN: 'Unknown',
+    INSERT: 'Insert',
+    UPDATE: 'Update',
+    DELETE: 'Delete'
+};
+
+/**
+ * @requires OpenLayers/Feature.js
+ * @requires OpenLayers/Util.js
+ */
+
+/**
+ * Class: OpenLayers.Feature.Vector
+ * Vector features use the OpenLayers.Geometry classes as geometry description.
+ * They have an 'attributes' property, which is the data object, and a 'style'
+ * property, the default values of which are defined in the 
+ * <OpenLayers.Feature.Vector.style> objects.
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Feature>
+ */
+OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
+
+    /** 
+     * Property: fid 
+     * {String} 
      */
      */
-    minExtent: null,
+    fid: null,
     
     
-    /**
-     * APIProperty: maxResolution
-     * {Float} Default max is 360 deg / 256 px, which corresponds to
-     *     zoom level 0 on gmaps.  Specify a different value in the layer 
-     *     options if you are not using the default <OpenLayers.Map.tileSize>
-     *     and displaying the whole world.
+    /** 
+     * APIProperty: geometry 
+     * {<OpenLayers.Geometry>} 
      */
      */
-    maxResolution: null,
+    geometry: null,
 
 
-    /**
-     * APIProperty: minResolution
-     * {Float}
+    /** 
+     * APIProperty: attributes 
+     * {Object} This object holds arbitrary, serializable properties that
+     *     describe the feature.
      */
      */
-    minResolution: null,
+    attributes: null,
 
     /**
 
     /**
-     * APIProperty: numZoomLevels
-     * {Integer}
+     * Property: bounds
+     * {<OpenLayers.Bounds>} The box bounding that feature's geometry, that
+     *     property can be set by an <OpenLayers.Format> object when
+     *     deserializing the feature, so in most cases it represents an
+     *     information set by the server. 
      */
      */
-    numZoomLevels: null,
-    
-    /**
-     * APIProperty: minScale
-     * {Float}
+    bounds: null,
+
+    /** 
+     * Property: state 
+     * {String} 
      */
      */
-    minScale: null,
+    state: null,
     
     
-    /**
-     * APIProperty: maxScale
-     * {Float}
+    /** 
+     * APIProperty: style 
+     * {Object} 
      */
      */
-    maxScale: null,
+    style: null,
 
     /**
 
     /**
-     * APIProperty: displayOutsideMaxExtent
-     * {Boolean} Request map tiles that are completely outside of the max 
-     *     extent for this layer. Defaults to false.
+     * APIProperty: url
+     * {String} If this property is set it will be taken into account by
+     *     {<OpenLayers.HTTP>} when updating or deleting the feature.
      */
      */
-    displayOutsideMaxExtent: false,
-
+    url: null,
+    
     /**
     /**
-     * APIProperty: wrapDateLine
-     * {Boolean} Wraps the world at the international dateline, so the map can
-     * be panned infinitely in longitudinal direction. Only use this on the
-     * base layer, and only if the layer's maxExtent equals the world bounds.
-     * #487 for more info.   
+     * Property: renderIntent
+     * {String} rendering intent currently being used
      */
      */
-    wrapDateLine: false,
+    renderIntent: "default",
     
     /**
     
     /**
-     * Property: metadata
-     * {Object} This object can be used to store additional information on a
-     *     layer object.
-     */
-    metadata: null,
-    
-    /**
-     * Constructor: OpenLayers.Layer
+     * APIProperty: modified
+     * {Object} An object with the originals of the geometry and attributes of
+     * the feature, if they were changed. Currently this property is only read
+     * by <OpenLayers.Format.WFST.v1>, and written by
+     * <OpenLayers.Control.ModifyFeature>, which sets the geometry property.
+     * Applications can set the originals of modified attributes in the
+     * attributes property. Note that applications have to check if this
+     * object and the attributes property is already created before using it.
+     * After a change made with ModifyFeature, this object could look like
      *
      *
-     * Parameters:
-     * name - {String} The layer name
-     * options - {Object} Hashtable of extra options to tag onto the layer
+     * (code)
+     * {
+     *     geometry: >Object
+     * }
+     * (end)
+     *
+     * When an application has made changes to feature attributes, it could
+     * have set the attributes to something like this:
+     *
+     * (code)
+     * {
+     *     attributes: {
+     *         myAttribute: "original"
+     *     }
+     * }
+     * (end)
+     *
+     * Note that <OpenLayers.Format.WFST.v1> only checks for truthy values in
+     * *modified.geometry* and the attribute names in *modified.attributes*,
+     * but it is recommended to set the original values (and not just true) as
+     * attribute value, so applications could use this information to undo
+     * changes.
      */
      */
-    initialize: function(name, options) {
-
-        this.metadata = {};
-        
-        options = OpenLayers.Util.extend({}, options);
-        // make sure we respect alwaysInRange if set on the prototype
-        if (this.alwaysInRange != null) {
-            options.alwaysInRange = this.alwaysInRange;
-        }
-        this.addOptions(options);
-
-        this.name = name;
-        
-        if (this.id == null) {
-
-            this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
-
-            this.div = OpenLayers.Util.createDiv(this.id);
-            this.div.style.width = "100%";
-            this.div.style.height = "100%";
-            this.div.dir = "ltr";
-
-            this.events = new OpenLayers.Events(this, this.div);
-            if(this.eventListeners instanceof Object) {
-                this.events.on(this.eventListeners);
-            }
+    modified: null,
 
 
-        }
-    },
-    
-    /**
-     * Method: destroy
-     * Destroy is a destructor: this is to alleviate cyclic references which
-     *     the Javascript garbage cleaner can not take care of on its own.
-     *
+    /** 
+     * Constructor: OpenLayers.Feature.Vector
+     * Create a vector feature. 
+     * 
      * Parameters:
      * Parameters:
-     * setNewBaseLayer - {Boolean} Set a new base layer when this layer has
-     *     been destroyed.  Default is true.
+     * geometry - {<OpenLayers.Geometry>} The geometry that this feature
+     *     represents.
+     * attributes - {Object} An optional object that will be mapped to the
+     *     <attributes> property. 
+     * style - {Object} An optional style object.
      */
      */
-    destroy: function(setNewBaseLayer) {
-        if (setNewBaseLayer == null) {
-            setNewBaseLayer = true;
-        }
-        if (this.map != null) {
-            this.map.removeLayer(this, setNewBaseLayer);
-        }
-        this.projection = null;
-        this.map = null;
-        this.name = null;
-        this.div = null;
-        this.options = null;
-
-        if (this.events) {
-            if(this.eventListeners) {
-                this.events.un(this.eventListeners);
-            }
-            this.events.destroy();
+    initialize: function(geometry, attributes, style) {
+        OpenLayers.Feature.prototype.initialize.apply(this,
+                                                      [null, null, attributes]);
+        this.lonlat = null;
+        this.geometry = geometry ? geometry : null;
+        this.state = null;
+        this.attributes = {};
+        if (attributes) {
+            this.attributes = OpenLayers.Util.extend(this.attributes,
+                                                     attributes);
         }
         }
-        this.eventListeners = null;
-        this.events = null;
+        this.style = style ? style : null; 
     },
     
     },
     
-   /**
-    * Method: clone
-    *
-    * Parameters:
-    * obj - {<OpenLayers.Layer>} The layer to be cloned
-    *
-    * Returns:
-    * {<OpenLayers.Layer>} An exact clone of this <OpenLayers.Layer>
-    */
-    clone: function (obj) {
-        
-        if (obj == null) {
-            obj = new OpenLayers.Layer(this.name, this.getOptions());
+    /** 
+     * Method: destroy
+     * nullify references to prevent circular references and memory leaks
+     */
+    destroy: function() {
+        if (this.layer) {
+            this.layer.removeFeatures(this);
+            this.layer = null;
         }
         }
-        
-        // catch any randomly tagged-on properties
-        OpenLayers.Util.applyDefaults(obj, this);
-        
-        // a cloned layer should never have its map property set
-        //  because it has not been added to a map yet. 
-        obj.map = null;
-        
-        return obj;
+            
+        this.geometry = null;
+        this.modified = null;
+        OpenLayers.Feature.prototype.destroy.apply(this, arguments);
     },
     
     /**
     },
     
     /**
-     * Method: getOptions
-     * Extracts an object from the layer with the properties that were set as
-     *     options, but updates them with the values currently set on the
-     *     instance.
-     * 
+     * Method: clone
+     * Create a clone of this vector feature.  Does not set any non-standard
+     *     properties.
+     *
      * Returns:
      * Returns:
-     * {Object} the <options> of the layer, representing the current state.
+     * {<OpenLayers.Feature.Vector>} An exact clone of this vector feature.
      */
      */
-    getOptions: function() {
-        var options = {};
-        for(var o in this.options) {
-            options[o] = this[o];
-        }
-        return options;
+    clone: function () {
+        return new OpenLayers.Feature.Vector(
+            this.geometry ? this.geometry.clone() : null,
+            this.attributes,
+            this.style);
     },
     },
-    
-    /** 
-     * APIMethod: setName
-     * Sets the new layer name for this layer.  Can trigger a changelayer event
-     *     on the map.
+
+    /**
+     * Method: onScreen
+     * Determine whether the feature is within the map viewport.  This method
+     *     tests for an intersection between the geometry and the viewport
+     *     bounds.  If a more efficient but less precise geometry bounds
+     *     intersection is desired, call the method with the boundsOnly
+     *     parameter true.
      *
      * Parameters:
      *
      * Parameters:
-     * newName - {String} The new name.
+     * boundsOnly - {Boolean} Only test whether a feature's bounds intersects
+     *     the viewport bounds.  Default is false.  If false, the feature's
+     *     geometry must intersect the viewport for onScreen to return true.
+     * 
+     * Returns:
+     * {Boolean} The feature is currently visible on screen (optionally
+     *     based on its bounds if boundsOnly is true).
      */
      */
-    setName: function(newName) {
-        if (newName != this.name) {
-            this.name = newName;
-            if (this.map != null) {
-                this.map.events.triggerEvent("changelayer", {
-                    layer: this,
-                    property: "name"
-                });
-            }
-        }
-    },    
-    
-   /**
-    * APIMethod: addOptions
-    * 
-    * Parameters:
-    * newOptions - {Object}
-    * reinitialize - {Boolean} If set to true, and if resolution options of the
-    *     current baseLayer were changed, the map will be recentered to make
-    *     sure that it is displayed with a valid resolution, and a
-    *     changebaselayer event will be triggered.
-    */
-    addOptions: function (newOptions, reinitialize) {
-
-        if (this.options == null) {
-            this.options = {};
-        }
-        
-        if (newOptions) {
-            // make sure this.projection references a projection object
-            if(typeof newOptions.projection == "string") {
-                newOptions.projection = new OpenLayers.Projection(newOptions.projection);
-            }
-            if (newOptions.projection) {
-                // get maxResolution, units and maxExtent from projection defaults if
-                // they are not defined already
-                OpenLayers.Util.applyDefaults(newOptions,
-                    OpenLayers.Projection.defaults[newOptions.projection.getCode()]);
-            }
-            // allow array for extents
-            if (newOptions.maxExtent && !(newOptions.maxExtent instanceof OpenLayers.Bounds)) {
-                newOptions.maxExtent = new OpenLayers.Bounds(newOptions.maxExtent);
-            }
-            if (newOptions.minExtent && !(newOptions.minExtent instanceof OpenLayers.Bounds)) {
-                newOptions.minExtent = new OpenLayers.Bounds(newOptions.minExtent);
-            }
-        }
-
-        // update our copy for clone
-        OpenLayers.Util.extend(this.options, newOptions);
-
-        // add new options to this
-        OpenLayers.Util.extend(this, newOptions);
-        
-        // get the units from the projection, if we have a projection
-        // and it it has units
-        if(this.projection && this.projection.getUnits()) {
-            this.units = this.projection.getUnits();
-        }
-
-        // re-initialize resolutions if necessary, i.e. if any of the
-        // properties of the "properties" array defined below is set
-        // in the new options
-        if(this.map) {
-            // store current resolution so we can try to restore it later
-            var resolution = this.map.getResolution();
-            var properties = this.RESOLUTION_PROPERTIES.concat(
-                ["projection", "units", "minExtent", "maxExtent"]
-            );
-            for(var o in newOptions) {
-                if(newOptions.hasOwnProperty(o) &&
-                   OpenLayers.Util.indexOf(properties, o) >= 0) {
-
-                    this.initResolutions();
-                    if (reinitialize && this.map.baseLayer === this) {
-                        // update map position, and restore previous resolution
-                        this.map.setCenter(this.map.getCenter(),
-                            this.map.getZoomForResolution(resolution),
-                            false, true
-                        );
-                        // trigger a changebaselayer event to make sure that
-                        // all controls (especially
-                        // OpenLayers.Control.PanZoomBar) get notified of the
-                        // new options
-                        this.map.events.triggerEvent("changebaselayer", {
-                            layer: this
-                        });
-                    }
-                    break;
-                }
+    onScreen:function(boundsOnly) {
+        var onScreen = false;
+        if(this.layer && this.layer.map) {
+            var screenBounds = this.layer.map.getExtent();
+            if(boundsOnly) {
+                var featureBounds = this.geometry.getBounds();
+                onScreen = screenBounds.intersectsBounds(featureBounds);
+            } else {
+                var screenPoly = screenBounds.toGeometry();
+                onScreen = screenPoly.intersects(this.geometry);
             }
             }
-        }
+        }    
+        return onScreen;
     },
 
     /**
     },
 
     /**
-     * APIMethod: onMapResize
-     * This function can be implemented by subclasses
+     * Method: getVisibility
+     * Determine whether the feature is displayed or not. It may not displayed
+     *     because:
+     *     - its style display property is set to 'none',
+     *     - it doesn't belong to any layer,
+     *     - the styleMap creates a symbolizer with display property set to 'none'
+     *          for it,
+     *     - the layer which it belongs to is not visible.
+     * 
+     * Returns:
+     * {Boolean} The feature is currently displayed.
      */
      */
-    onMapResize: function() {
-        //this function can be implemented by subclasses  
+    getVisibility: function() {
+        return !(this.style && this.style.display == 'none' ||
+                 !this.layer ||
+                 this.layer && this.layer.styleMap &&
+                 this.layer.styleMap.createSymbolizer(this, this.renderIntent).display == 'none' ||
+                 this.layer && !this.layer.getVisibility());
     },
     },
-
+    
     /**
     /**
-     * APIMethod: redraw
-     * Redraws the layer.  Returns true if the layer was redrawn, false if not.
-     *
+     * Method: createMarker
+     * HACK - we need to decide if all vector features should be able to
+     *     create markers
+     * 
      * Returns:
      * Returns:
-     * {Boolean} The layer was redrawn.
+     * {<OpenLayers.Marker>} For now just returns null
      */
      */
-    redraw: function() {
-        var redrawn = false;
-        if (this.map) {
-
-            // min/max Range may have changed
-            this.inRange = this.calculateInRange();
-
-            // map's center might not yet be set
-            var extent = this.getExtent();
-
-            if (extent && this.inRange && this.visibility) {
-                var zoomChanged = true;
-                this.moveTo(extent, zoomChanged, false);
-                this.events.triggerEvent("moveend",
-                    {"zoomChanged": zoomChanged});
-                redrawn = true;
-            }
-        }
-        return redrawn;
+    createMarker: function() {
+        return null;
     },
 
     /**
     },
 
     /**
-     * Method: moveTo
+     * Method: destroyMarker
+     * HACK - we need to decide if all vector features should be able to
+     *     delete markers
      * 
      * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * zoomChanged - {Boolean} Tells when zoom has changed, as layers have to
-     *     do some init work in that case.
-     * dragging - {Boolean}
+     * If user overrides the createMarker() function, s/he should be able
+     *   to also specify an alternative function for destroying it
      */
      */
-    moveTo:function(bounds, zoomChanged, dragging) {
-        var display = this.visibility;
-        if (!this.isBaseLayer) {
-            display = display && this.inRange;
-        }
-        this.display(display);
+    destroyMarker: function() {
+        // pass
     },
 
     /**
     },
 
     /**
-     * Method: moveByPx
-     * Move the layer based on pixel vector. To be implemented by subclasses.
-     *
-     * Parameters:
-     * dx - {Number} The x coord of the displacement vector.
-     * dy - {Number} The y coord of the displacement vector.
+     * Method: createPopup
+     * HACK - we need to decide if all vector features should be able to
+     *     create popups
+     * 
+     * Returns:
+     * {<OpenLayers.Popup>} For now just returns null
      */
      */
-    moveByPx: function(dx, dy) {
+    createPopup: function() {
+        return null;
     },
 
     /**
     },
 
     /**
-     * Method: setMap
-     * Set the map property for the layer. This is done through an accessor
-     *     so that subclasses can override this and take special action once 
-     *     they have their map variable set. 
+     * Method: atPoint
+     * Determins whether the feature intersects with the specified location.
      * 
      * 
-     *     Here we take care to bring over any of the necessary default 
-     *     properties from the map. 
+     * Parameters: 
+     * lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
+     *     object with a 'lon' and 'lat' properties.
+     * toleranceLon - {float} Optional tolerance in Geometric Coords
+     * toleranceLat - {float} Optional tolerance in Geographic Coords
      * 
      * 
-     * Parameters:
-     * map - {<OpenLayers.Map>}
+     * Returns:
+     * {Boolean} Whether or not the feature is at the specified location
      */
      */
-    setMap: function(map) {
-        if (this.map == null) {
-        
-            this.map = map;
-            
-            // grab some essential layer data from the map if it hasn't already
-            //  been set
-            this.maxExtent = this.maxExtent || this.map.maxExtent;
-            this.minExtent = this.minExtent || this.map.minExtent;
-
-            this.projection = this.projection || this.map.projection;
-            if (typeof this.projection == "string") {
-                this.projection = new OpenLayers.Projection(this.projection);
-            }
-
-            // Check the projection to see if we can get units -- if not, refer
-            // to properties.
-            this.units = this.projection.getUnits() ||
-                         this.units || this.map.units;
-            
-            this.initResolutions();
-            
-            if (!this.isBaseLayer) {
-                this.inRange = this.calculateInRange();
-                var show = ((this.visibility) && (this.inRange));
-                this.div.style.display = show ? "" : "none";
-            }
-            
-            // deal with gutters
-            this.setTileSize();
+    atPoint: function(lonlat, toleranceLon, toleranceLat) {
+        var atPoint = false;
+        if(this.geometry) {
+            atPoint = this.geometry.atPoint(lonlat, toleranceLon, 
+                                                    toleranceLat);
         }
         }
+        return atPoint;
     },
     },
-    
+
     /**
     /**
-     * Method: afterAdd
-     * Called at the end of the map.addLayer sequence.  At this point, the map
-     *     will have a base layer.  To be overridden by subclasses.
+     * Method: destroyPopup
+     * HACK - we need to decide if all vector features should be able to
+     * delete popups
      */
      */
-    afterAdd: function() {
+    destroyPopup: function() {
+        // pass
     },
     },
-    
+
     /**
     /**
-     * APIMethod: removeMap
-     * Just as setMap() allows each layer the possibility to take a 
-     *     personalized action on being added to the map, removeMap() allows
-     *     each layer to take a personalized action on being removed from it. 
-     *     For now, this will be mostly unused, except for the EventPane layer,
-     *     which needs this hook so that it can remove the special invisible
-     *     pane. 
-     * 
+     * Method: move
+     * Moves the feature and redraws it at its new location
+     *
      * Parameters:
      * Parameters:
-     * map - {<OpenLayers.Map>}
+     * location - {<OpenLayers.LonLat> or <OpenLayers.Pixel>} the
+     *         location to which to move the feature.
      */
      */
-    removeMap: function(map) {
-        //to be overridden by subclasses
+    move: function(location) {
+
+        if(!this.layer || !this.geometry.move){
+            //do nothing if no layer or immoveable geometry
+            return undefined;
+        }
+
+        var pixel;
+        if (location.CLASS_NAME == "OpenLayers.LonLat") {
+            pixel = this.layer.getViewPortPxFromLonLat(location);
+        } else {
+            pixel = location;
+        }
+        
+        var lastPixel = this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());
+        var res = this.layer.map.getResolution();
+        this.geometry.move(res * (pixel.x - lastPixel.x),
+                           res * (lastPixel.y - pixel.y));
+        this.layer.drawFeature(this);
+        return lastPixel;
     },
     
     /**
     },
     
     /**
-     * APIMethod: getImageSize
+     * Method: toState
+     * Sets the new state
      *
      * Parameters:
      *
      * Parameters:
-     * bounds - {<OpenLayers.Bounds>} optional tile bounds, can be used
-     *     by subclasses that have to deal with different tile sizes at the
-     *     layer extent edges (e.g. Zoomify)
-     * 
-     * Returns:
-     * {<OpenLayers.Size>} The size that the image should be, taking into 
-     *     account gutters.
-     */ 
-    getImageSize: function(bounds) { 
-        return (this.imageSize || this.tileSize); 
-    },    
-  
-    /**
-     * APIMethod: setTileSize
-     * Set the tile size based on the map size.  This also sets layer.imageSize
-     *     or use by Tile.Image.
-     * 
-     * Parameters:
-     * size - {<OpenLayers.Size>}
+     * state - {String} 
      */
      */
-    setTileSize: function(size) {
-        var tileSize = (size) ? size :
-                                ((this.tileSize) ? this.tileSize :
-                                                   this.map.getTileSize());
-        this.tileSize = tileSize;
-        if(this.gutter) {
-          // layers with gutters need non-null tile sizes
-          //if(tileSize == null) {
-          //    OpenLayers.console.error("Error in layer.setMap() for " +
-          //                              this.name + ": layers with " +
-          //                              "gutters need non-null tile sizes");
-          //}
-            this.imageSize = new OpenLayers.Size(tileSize.w + (2*this.gutter), 
-                                                 tileSize.h + (2*this.gutter)); 
+    toState: function(state) {
+        if (state == OpenLayers.State.UPDATE) {
+            switch (this.state) {
+                case OpenLayers.State.UNKNOWN:
+                case OpenLayers.State.DELETE:
+                    this.state = state;
+                    break;
+                case OpenLayers.State.UPDATE:
+                case OpenLayers.State.INSERT:
+                    break;
+            }
+        } else if (state == OpenLayers.State.INSERT) {
+            switch (this.state) {
+                case OpenLayers.State.UNKNOWN:
+                    break;
+                default:
+                    this.state = state;
+                    break;
+            }
+        } else if (state == OpenLayers.State.DELETE) {
+            switch (this.state) {
+                case OpenLayers.State.INSERT:
+                    // the feature should be destroyed
+                    break;
+                case OpenLayers.State.DELETE:
+                    break;
+                case OpenLayers.State.UNKNOWN:
+                case OpenLayers.State.UPDATE:
+                    this.state = state;
+                    break;
+            }
+        } else if (state == OpenLayers.State.UNKNOWN) {
+            this.state = state;
         }
     },
         }
     },
+    
+    CLASS_NAME: "OpenLayers.Feature.Vector"
+});
 
 
-    /**
-     * APIMethod: getVisibility
-     * 
-     * Returns:
-     * {Boolean} The layer should be displayed (if in range).
-     */
-    getVisibility: function() {
-        return this.visibility;
+
+/**
+ * Constant: OpenLayers.Feature.Vector.style
+ * OpenLayers features can have a number of style attributes. The 'default' 
+ *     style will typically be used if no other style is specified. These
+ *     styles correspond for the most part, to the styling properties defined
+ *     by the SVG standard. 
+ *     Information on fill properties: http://www.w3.org/TR/SVG/painting.html#FillProperties
+ *     Information on stroke properties: http://www.w3.org/TR/SVG/painting.html#StrokeProperties
+ *
+ * Symbolizer properties:
+ * fill - {Boolean} Set to false if no fill is desired.
+ * fillColor - {String} Hex fill color.  Default is "#ee9900".
+ * fillOpacity - {Number} Fill opacity (0-1).  Default is 0.4 
+ * stroke - {Boolean} Set to false if no stroke is desired.
+ * strokeColor - {String} Hex stroke color.  Default is "#ee9900".
+ * strokeOpacity - {Number} Stroke opacity (0-1).  Default is 1.
+ * strokeWidth - {Number} Pixel stroke width.  Default is 1.
+ * strokeLinecap - {String} Stroke cap type.  Default is "round".  [butt | round | square]
+ * strokeDashstyle - {String} Stroke dash style.  Default is "solid". [dot | dash | dashdot | longdash | longdashdot | solid]
+ * graphic - {Boolean} Set to false if no graphic is desired.
+ * pointRadius - {Number} Pixel point radius.  Default is 6.
+ * pointerEvents - {String}  Default is "visiblePainted".
+ * cursor - {String} Default is "".
+ * externalGraphic - {String} Url to an external graphic that will be used for rendering points.
+ * graphicWidth - {Number} Pixel width for sizing an external graphic.
+ * graphicHeight - {Number} Pixel height for sizing an external graphic.
+ * graphicOpacity - {Number} Opacity (0-1) for an external graphic.
+ * graphicXOffset - {Number} Pixel offset along the positive x axis for displacing an external graphic.
+ * graphicYOffset - {Number} Pixel offset along the positive y axis for displacing an external graphic.
+ * rotation - {Number} For point symbolizers, this is the rotation of a graphic in the clockwise direction about its center point (or any point off center as specified by graphicXOffset and graphicYOffset).
+ * graphicZIndex - {Number} The integer z-index value to use in rendering.
+ * graphicName - {String} Named graphic to use when rendering points.  Supported values include "circle" (default),
+ *     "square", "star", "x", "cross", "triangle".
+ * graphicTitle - {String} Tooltip when hovering over a feature. *deprecated*, use title instead
+ * title - {String} Tooltip when hovering over a feature. Not supported by the canvas renderer.
+ * backgroundGraphic - {String} Url to a graphic to be used as the background under an externalGraphic.
+ * backgroundGraphicZIndex - {Number} The integer z-index value to use in rendering the background graphic.
+ * backgroundXOffset - {Number} The x offset (in pixels) for the background graphic.
+ * backgroundYOffset - {Number} The y offset (in pixels) for the background graphic.
+ * backgroundHeight - {Number} The height of the background graphic.  If not provided, the graphicHeight will be used.
+ * backgroundWidth - {Number} The width of the background width.  If not provided, the graphicWidth will be used.
+ * label - {String} The text for an optional label. For browsers that use the canvas renderer, this requires either
+ *     fillText or mozDrawText to be available.
+ * labelAlign - {String} Label alignment. This specifies the insertion point relative to the text. It is a string
+ *     composed of two characters. The first character is for the horizontal alignment, the second for the vertical
+ *     alignment. Valid values for horizontal alignment: "l"=left, "c"=center, "r"=right. Valid values for vertical
+ *     alignment: "t"=top, "m"=middle, "b"=bottom. Example values: "lt", "cm", "rb". Default is "cm".
+ * labelXOffset - {Number} Pixel offset along the positive x axis for displacing the label. Not supported by the canvas renderer.
+ * labelYOffset - {Number} Pixel offset along the positive y axis for displacing the label. Not supported by the canvas renderer.
+ * labelSelect - {Boolean} If set to true, labels will be selectable using SelectFeature or similar controls.
+ *     Default is false.
+ * labelOutlineColor - {String} The color of the label outline. Default is 'white'. Only supported by the canvas & SVG renderers.
+ * labelOutlineWidth - {Number} The width of the label outline. Default is 3, set to 0 or null to disable. Only supported by the  SVG renderers.
+ * labelOutlineOpacity - {Number} The opacity (0-1) of the label outline. Default is fontOpacity. Only supported by the canvas & SVG renderers.
+ * fontColor - {String} The font color for the label, to be provided like CSS.
+ * fontOpacity - {Number} Opacity (0-1) for the label
+ * fontFamily - {String} The font family for the label, to be provided like in CSS.
+ * fontSize - {String} The font size for the label, to be provided like in CSS.
+ * fontStyle - {String} The font style for the label, to be provided like in CSS.
+ * fontWeight - {String} The font weight for the label, to be provided like in CSS.
+ * display - {String} Symbolizers will have no effect if display is set to "none".  All other values have no effect.
+ */ 
+OpenLayers.Feature.Vector.style = {
+    'default': {
+        fillColor: "#ee9900",
+        fillOpacity: 0.4, 
+        hoverFillColor: "white",
+        hoverFillOpacity: 0.8,
+        strokeColor: "#ee9900",
+        strokeOpacity: 1,
+        strokeWidth: 1,
+        strokeLinecap: "round",
+        strokeDashstyle: "solid",
+        hoverStrokeColor: "red",
+        hoverStrokeOpacity: 1,
+        hoverStrokeWidth: 0.2,
+        pointRadius: 6,
+        hoverPointRadius: 1,
+        hoverPointUnit: "%",
+        pointerEvents: "visiblePainted",
+        cursor: "inherit",
+        fontColor: "#000000",
+        labelAlign: "cm",
+        labelOutlineColor: "white",
+        labelOutlineWidth: 3
     },
     },
+    'select': {
+        fillColor: "blue",
+        fillOpacity: 0.4, 
+        hoverFillColor: "white",
+        hoverFillOpacity: 0.8,
+        strokeColor: "blue",
+        strokeOpacity: 1,
+        strokeWidth: 2,
+        strokeLinecap: "round",
+        strokeDashstyle: "solid",
+        hoverStrokeColor: "red",
+        hoverStrokeOpacity: 1,
+        hoverStrokeWidth: 0.2,
+        pointRadius: 6,
+        hoverPointRadius: 1,
+        hoverPointUnit: "%",
+        pointerEvents: "visiblePainted",
+        cursor: "pointer",
+        fontColor: "#000000",
+        labelAlign: "cm",
+        labelOutlineColor: "white",
+        labelOutlineWidth: 3
+
+    },
+    'temporary': {
+        fillColor: "#66cccc",
+        fillOpacity: 0.2, 
+        hoverFillColor: "white",
+        hoverFillOpacity: 0.8,
+        strokeColor: "#66cccc",
+        strokeOpacity: 1,
+        strokeLinecap: "round",
+        strokeWidth: 2,
+        strokeDashstyle: "solid",
+        hoverStrokeColor: "red",
+        hoverStrokeOpacity: 1,
+        hoverStrokeWidth: 0.2,
+        pointRadius: 6,
+        hoverPointRadius: 1,
+        hoverPointUnit: "%",
+        pointerEvents: "visiblePainted",
+        cursor: "inherit",
+        fontColor: "#000000",
+        labelAlign: "cm",
+        labelOutlineColor: "white",
+        labelOutlineWidth: 3
 
 
-    /** 
-     * APIMethod: setVisibility
-     * Set the visibility flag for the layer and hide/show & redraw 
-     *     accordingly. Fire event unless otherwise specified
-     * 
-     * Note that visibility is no longer simply whether or not the layer's
-     *     style.display is set to "block". Now we store a 'visibility' state 
-     *     property on the layer class, this allows us to remember whether or 
-     *     not we *desire* for a layer to be visible. In the case where the 
-     *     map's resolution is out of the layer's range, this desire may be 
-     *     subverted.
-     * 
-     * Parameters:
-     * visibility - {Boolean} Whether or not to display the layer (if in range)
-     */
-    setVisibility: function(visibility) {
-        if (visibility != this.visibility) {
-            this.visibility = visibility;
-            this.display(visibility);
-            this.redraw();
-            if (this.map != null) {
-                this.map.events.triggerEvent("changelayer", {
-                    layer: this,
-                    property: "visibility"
-                });
-            }
-            this.events.triggerEvent("visibilitychanged");
-        }
     },
     },
+    'delete': {
+        display: "none"
+    }
+};    
+/* ======================================================================
+    OpenLayers/Style.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+
+/**
+ * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Util.js
+ * @requires OpenLayers/Feature/Vector.js
+ */
+
+/**
+ * Class: OpenLayers.Style
+ * This class represents a UserStyle obtained
+ *     from a SLD, containing styling rules.
+ */
+OpenLayers.Style = OpenLayers.Class({
+
+    /**
+     * Property: id
+     * {String} A unique id for this session.
+     */
+    id: null,
+    
+    /**
+     * APIProperty: name
+     * {String}
+     */
+    name: null,
+    
+    /**
+     * Property: title
+     * {String} Title of this style (set if included in SLD)
+     */
+    title: null,
+    
+    /**
+     * Property: description
+     * {String} Description of this style (set if abstract is included in SLD)
+     */
+    description: null,
 
 
+    /**
+     * APIProperty: layerName
+     * {<String>} name of the layer that this style belongs to, usually
+     * according to the NamedLayer attribute of an SLD document.
+     */
+    layerName: null,
+    
+    /**
+     * APIProperty: isDefault
+     * {Boolean}
+     */
+    isDefault: false,
+     
     /** 
     /** 
-     * APIMethod: display
-     * Hide or show the Layer. This is designed to be used internally, and 
-     *     is not generally the way to enable or disable the layer. For that,
-     *     use the setVisibility function instead..
-     * 
-     * Parameters:
-     * display - {Boolean}
+     * Property: rules 
+     * {Array(<OpenLayers.Rule>)}
      */
      */
-    display: function(display) {
-        if (display != (this.div.style.display != "none")) {
-            this.div.style.display = (display && this.calculateInRange()) ? "block" : "none";
-        }
-    },
+    rules: null,
+    
+    /**
+     * APIProperty: context
+     * {Object} An optional object with properties that symbolizers' property
+     * values should be evaluated against. If no context is specified,
+     * feature.attributes will be used
+     */
+    context: null,
 
     /**
 
     /**
-     * APIMethod: calculateInRange
+     * Property: defaultStyle
+     * {Object} hash of style properties to use as default for merging
+     * rule-based style symbolizers onto. If no rules are defined,
+     * createSymbolizer will return this style. If <defaultsPerSymbolizer> is set to
+     * true, the defaultStyle will only be taken into account if there are
+     * rules defined.
+     */
+    defaultStyle: null,
+    
+    /**
+     * Property: defaultsPerSymbolizer
+     * {Boolean} If set to true, the <defaultStyle> will extend the symbolizer
+     * of every rule. Properties of the <defaultStyle> will also be used to set
+     * missing symbolizer properties if the symbolizer has stroke, fill or
+     * graphic set to true. Default is false.
+     */
+    defaultsPerSymbolizer: false,
+    
+    /**
+     * Property: propertyStyles
+     * {Hash of Boolean} cache of style properties that need to be parsed for
+     * propertyNames. Property names are keys, values won't be used.
+     */
+    propertyStyles: null,
+    
+
+    /** 
+     * Constructor: OpenLayers.Style
+     * Creates a UserStyle.
+     *
+     * Parameters:
+     * style        - {Object} Optional hash of style properties that will be
+     *                used as default style for this style object. This style
+     *                applies if no rules are specified. Symbolizers defined in
+     *                rules will extend this default style.
+     * options - {Object} An optional object with properties to set on the
+     *     style.
+     *
+     * Valid options:
+     * rules - {Array(<OpenLayers.Rule>)} List of rules to be added to the
+     *     style.
      * 
      * Returns:
      * 
      * Returns:
-     * {Boolean} The layer is displayable at the current map's current
-     *     resolution. Note that if 'alwaysInRange' is true for the layer, 
-     *     this function will always return true.
+     * {<OpenLayers.Style>}
      */
      */
-    calculateInRange: function() {
-        var inRange = false;
+    initialize: function(style, options) {
 
 
-        if (this.alwaysInRange) {
-            inRange = true;
-        } else {
-            if (this.map) {
-                var resolution = this.map.getResolution();
-                inRange = ( (resolution >= this.minResolution) &&
-                            (resolution <= this.maxResolution) );
-            }
+        OpenLayers.Util.extend(this, options);
+        this.rules = [];
+        if(options && options.rules) {
+            this.addRules(options.rules);
         }
         }
-        return inRange;
+
+        // use the default style from OpenLayers.Feature.Vector if no style
+        // was given in the constructor
+        this.setDefaultStyle(style ||
+                             OpenLayers.Feature.Vector.style["default"]);
+
+        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
     },
 
     /** 
     },
 
     /** 
-     * APIMethod: setIsBaseLayer
-     * 
-     * Parameters:
-     * isBaseLayer - {Boolean}
+     * APIMethod: destroy
+     * nullify references to prevent circular references and memory leaks
      */
      */
-    setIsBaseLayer: function(isBaseLayer) {
-        if (isBaseLayer != this.isBaseLayer) {
-            this.isBaseLayer = isBaseLayer;
-            if (this.map != null) {
-                this.map.events.triggerEvent("changebaselayer", {
-                    layer: this
-                });
-            }
+    destroy: function() {
+        for (var i=0, len=this.rules.length; i<len; i++) {
+            this.rules[i].destroy();
+            this.rules[i] = null;
         }
         }
+        this.rules = null;
+        this.defaultStyle = null;
     },
     },
-
-  /********************************************************/
-  /*                                                      */
-  /*                 Baselayer Functions                  */
-  /*                                                      */
-  /********************************************************/
-  
-    /** 
-     * Method: initResolutions
-     * This method's responsibility is to set up the 'resolutions' array 
-     *     for the layer -- this array is what the layer will use to interface
-     *     between the zoom levels of the map and the resolution display 
-     *     of the layer.
+    
+    /**
+     * Method: createSymbolizer
+     * creates a style by applying all feature-dependent rules to the base
+     * style.
      * 
      * 
-     * The user has several options that determine how the array is set up.
-     *  
-     * For a detailed explanation, see the following wiki from the 
-     *     openlayers.org homepage:
-     *     http://trac.openlayers.org/wiki/SettingZoomLevels
+     * Parameters:
+     * feature - {<OpenLayers.Feature>} feature to evaluate rules for
+     * 
+     * Returns:
+     * {Object} symbolizer hash
      */
      */
-    initResolutions: function() {
-
-        // ok we want resolutions, here's our strategy:
-        //
-        // 1. if resolutions are defined in the layer config, use them
-        // 2. else, if scales are defined in the layer config then derive
-        //    resolutions from these scales
-        // 3. else, attempt to calculate resolutions from maxResolution,
-        //    minResolution, numZoomLevels, maxZoomLevel set in the
-        //    layer config
-        // 4. if we still don't have resolutions, and if resolutions
-        //    are defined in the same, use them
-        // 5. else, if scales are defined in the map then derive
-        //    resolutions from these scales
-        // 6. else, attempt to calculate resolutions from maxResolution,
-        //    minResolution, numZoomLevels, maxZoomLevel set in the
-        //    map
-        // 7. hope for the best!
-
-        var i, len, p;
-        var props = {}, alwaysInRange = true;
+    createSymbolizer: function(feature) {
+        var style = this.defaultsPerSymbolizer ? {} : this.createLiterals(
+            OpenLayers.Util.extend({}, this.defaultStyle), feature);
+        
+        var rules = this.rules;
 
 
-        // get resolution data from layer config
-        // (we also set alwaysInRange in the layer as appropriate)
-        for(i=0, len=this.RESOLUTION_PROPERTIES.length; i<len; i++) {
-            p = this.RESOLUTION_PROPERTIES[i];
-            props[p] = this.options[p];
-            if(alwaysInRange && this.options[p]) {
-                alwaysInRange = false;
+        var rule, context;
+        var elseRules = [];
+        var appliedRules = false;
+        for(var i=0, len=rules.length; i<len; i++) {
+            rule = rules[i];
+            // does the rule apply?
+            var applies = rule.evaluate(feature);
+            
+            if(applies) {
+                if(rule instanceof OpenLayers.Rule && rule.elseFilter) {
+                    elseRules.push(rule);
+                } else {
+                    appliedRules = true;
+                    this.applySymbolizer(rule, style, feature);
+                }
             }
         }
             }
         }
-        if(this.options.alwaysInRange == null) {
-            this.alwaysInRange = alwaysInRange;
-        }
-
-        // if we don't have resolutions then attempt to derive them from scales
-        if(props.resolutions == null) {
-            props.resolutions = this.resolutionsFromScales(props.scales);
-        }
-
-        // if we still don't have resolutions then attempt to calculate them
-        if(props.resolutions == null) {
-            props.resolutions = this.calculateResolutions(props);
-        }
-
-        // if we couldn't calculate resolutions then we look at we have
-        // in the map
-        if(props.resolutions == null) {
-            for(i=0, len=this.RESOLUTION_PROPERTIES.length; i<len; i++) {
-                p = this.RESOLUTION_PROPERTIES[i];
-                props[p] = this.options[p] != null ?
-                    this.options[p] : this.map[p];
-            }
-            if(props.resolutions == null) {
-                props.resolutions = this.resolutionsFromScales(props.scales);
-            }
-            if(props.resolutions == null) {
-                props.resolutions = this.calculateResolutions(props);
+        
+        // if no other rules apply, apply the rules with else filters
+        if(appliedRules == false && elseRules.length > 0) {
+            appliedRules = true;
+            for(var i=0, len=elseRules.length; i<len; i++) {
+                this.applySymbolizer(elseRules[i], style, feature);
             }
         }
 
             }
         }
 
-        // ok, we new need to set properties in the instance
-
-        // get maxResolution from the config if it's defined there
-        var maxResolution;
-        if(this.options.maxResolution &&
-           this.options.maxResolution !== "auto") {
-            maxResolution = this.options.maxResolution;
+        // don't display if there were rules but none applied
+        if(rules.length > 0 && appliedRules == false) {
+            style.display = "none";
         }
         }
-        if(this.options.minScale) {
-            maxResolution = OpenLayers.Util.getResolutionFromScale(
-                this.options.minScale, this.units);
+        
+        if (style.label != null && typeof style.label !== "string") {
+            style.label = String(style.label);
         }
         }
-
-        // get minResolution from the config if it's defined there
-        var minResolution;
-        if(this.options.minResolution &&
-           this.options.minResolution !== "auto") {
-            minResolution = this.options.minResolution;
-        }
-        if(this.options.maxScale) {
-            minResolution = OpenLayers.Util.getResolutionFromScale(
-                this.options.maxScale, this.units);
-        }
-
-        if(props.resolutions) {
-
-            //sort resolutions array descendingly
-            props.resolutions.sort(function(a, b) {
-                return (b - a);
-            });
-
-            // if we still don't have a maxResolution get it from the
-            // resolutions array
-            if(!maxResolution) {
-                maxResolution = props.resolutions[0];
-            }
-
-            // if we still don't have a minResolution get it from the
-            // resolutions array
-            if(!minResolution) {
-                var lastIdx = props.resolutions.length - 1;
-                minResolution = props.resolutions[lastIdx];
-            }
-        }
-
-        this.resolutions = props.resolutions;
-        if(this.resolutions) {
-            len = this.resolutions.length;
-            this.scales = new Array(len);
-            for(i=0; i<len; i++) {
-                this.scales[i] = OpenLayers.Util.getScaleFromResolution(
-                    this.resolutions[i], this.units);
-            }
-            this.numZoomLevels = len;
-        }
-        this.minResolution = minResolution;
-        if(minResolution) {
-            this.maxScale = OpenLayers.Util.getScaleFromResolution(
-                minResolution, this.units);
-        }
-        this.maxResolution = maxResolution;
-        if(maxResolution) {
-            this.minScale = OpenLayers.Util.getScaleFromResolution(
-                maxResolution, this.units);
-        }
-    },
-
-    /**
-     * Method: resolutionsFromScales
-     * Derive resolutions from scales.
-     *
-     * Parameters:
-     * scales - {Array(Number)} Scales
-     *
-     * Returns
-     * {Array(Number)} Resolutions
-     */
-    resolutionsFromScales: function(scales) {
-        if(scales == null) {
-            return;
-        }
-        var resolutions, i, len;
-        len = scales.length;
-        resolutions = new Array(len);
-        for(i=0; i<len; i++) {
-            resolutions[i] = OpenLayers.Util.getResolutionFromScale(
-                scales[i], this.units);
-        }
-        return resolutions;
+        
+        return style;
     },
     },
-
+    
     /**
     /**
-     * Method: calculateResolutions
-     * Calculate resolutions based on the provided properties.
+     * Method: applySymbolizer
      *
      * Parameters:
      *
      * Parameters:
-     * props - {Object} Properties
+     * rule - {<OpenLayers.Rule>}
+     * style - {Object}
+     * feature - {<OpenLayer.Feature.Vector>}
      *
      * Returns:
      *
      * Returns:
-     * {Array({Number})} Array of resolutions.
+     * {Object} A style with new symbolizer applied.
      */
      */
-    calculateResolutions: function(props) {
-
-        var viewSize, wRes, hRes;
-
-        // determine maxResolution
-        var maxResolution = props.maxResolution;
-        if(props.minScale != null) {
-            maxResolution =
-                OpenLayers.Util.getResolutionFromScale(props.minScale,
-                                                       this.units);
-        } else if(maxResolution == "auto" && this.maxExtent != null) {
-            viewSize = this.map.getSize();
-            wRes = this.maxExtent.getWidth() / viewSize.w;
-            hRes = this.maxExtent.getHeight() / viewSize.h;
-            maxResolution = Math.max(wRes, hRes);
-        }
-
-        // determine minResolution
-        var minResolution = props.minResolution;
-        if(props.maxScale != null) {
-            minResolution =
-                OpenLayers.Util.getResolutionFromScale(props.maxScale,
-                                                       this.units);
-        } else if(props.minResolution == "auto" && this.minExtent != null) {
-            viewSize = this.map.getSize();
-            wRes = this.minExtent.getWidth() / viewSize.w;
-            hRes = this.minExtent.getHeight()/ viewSize.h;
-            minResolution = Math.max(wRes, hRes);
-        }
-
-        if(typeof maxResolution !== "number" &&
-           typeof minResolution !== "number" &&
-           this.maxExtent != null) {
-            // maxResolution for default grid sets assumes that at zoom
-            // level zero, the whole world fits on one tile.
-            var tileSize = this.map.getTileSize();
-            maxResolution = Math.max(
-                this.maxExtent.getWidth() / tileSize.w,
-                this.maxExtent.getHeight() / tileSize.h
-            );
-        }
-
-        // determine numZoomLevels
-        var maxZoomLevel = props.maxZoomLevel;
-        var numZoomLevels = props.numZoomLevels;
-        if(typeof minResolution === "number" &&
-           typeof maxResolution === "number" && numZoomLevels === undefined) {
-            var ratio = maxResolution / minResolution;
-            numZoomLevels = Math.floor(Math.log(ratio) / Math.log(2)) + 1;
-        } else if(numZoomLevels === undefined && maxZoomLevel != null) {
-            numZoomLevels = maxZoomLevel + 1;
-        }
-
-        // are we able to calculate resolutions?
-        if(typeof numZoomLevels !== "number" || numZoomLevels <= 0 ||
-           (typeof maxResolution !== "number" &&
-                typeof minResolution !== "number")) {
-            return;
-        }
-
-        // now we have numZoomLevels and at least one of maxResolution
-        // or minResolution, we can populate the resolutions array
-
-        var resolutions = new Array(numZoomLevels);
-        var base = 2;
-        if(typeof minResolution == "number" &&
-           typeof maxResolution == "number") {
-            // if maxResolution and minResolution are set, we calculate
-            // the base for exponential scaling that starts at
-            // maxResolution and ends at minResolution in numZoomLevels
-            // steps.
-            base = Math.pow(
-                    (maxResolution / minResolution),
-                (1 / (numZoomLevels - 1))
-            );
-        }
+    applySymbolizer: function(rule, style, feature) {
+        var symbolizerPrefix = feature.geometry ?
+                this.getSymbolizerPrefix(feature.geometry) :
+                OpenLayers.Style.SYMBOLIZER_PREFIXES[0];
 
 
-        var i;
-        if(typeof maxResolution === "number") {
-            for(i=0; i<numZoomLevels; i++) {
-                resolutions[i] = maxResolution / Math.pow(base, i);
+        var symbolizer = rule.symbolizer[symbolizerPrefix] || rule.symbolizer;
+        
+        if(this.defaultsPerSymbolizer === true) {
+            var defaults = this.defaultStyle;
+            OpenLayers.Util.applyDefaults(symbolizer, {
+                pointRadius: defaults.pointRadius
+            });
+            if(symbolizer.stroke === true || symbolizer.graphic === true) {
+                OpenLayers.Util.applyDefaults(symbolizer, {
+                    strokeWidth: defaults.strokeWidth,
+                    strokeColor: defaults.strokeColor,
+                    strokeOpacity: defaults.strokeOpacity,
+                    strokeDashstyle: defaults.strokeDashstyle,
+                    strokeLinecap: defaults.strokeLinecap
+                });
             }
             }
-        } else {
-            for(i=0; i<numZoomLevels; i++) {
-                resolutions[numZoomLevels - 1 - i] =
-                    minResolution * Math.pow(base, i);
+            if(symbolizer.fill === true || symbolizer.graphic === true) {
+                OpenLayers.Util.applyDefaults(symbolizer, {
+                    fillColor: defaults.fillColor,
+                    fillOpacity: defaults.fillOpacity
+                });
+            }
+            if(symbolizer.graphic === true) {
+                OpenLayers.Util.applyDefaults(symbolizer, {
+                    pointRadius: this.defaultStyle.pointRadius,
+                    externalGraphic: this.defaultStyle.externalGraphic,
+                    graphicName: this.defaultStyle.graphicName,
+                    graphicOpacity: this.defaultStyle.graphicOpacity,
+                    graphicWidth: this.defaultStyle.graphicWidth,
+                    graphicHeight: this.defaultStyle.graphicHeight,
+                    graphicXOffset: this.defaultStyle.graphicXOffset,
+                    graphicYOffset: this.defaultStyle.graphicYOffset
+                });
             }
         }
 
             }
         }
 
-        return resolutions;
+        // merge the style with the current style
+        return this.createLiterals(
+                OpenLayers.Util.extend(style, symbolizer), feature);
     },
     },
-
+    
     /**
     /**
-     * APIMethod: getResolution
+     * Method: createLiterals
+     * creates literals for all style properties that have an entry in
+     * <this.propertyStyles>.
      * 
      * 
-     * Returns:
-     * {Float} The currently selected resolution of the map, taken from the
-     *     resolutions array, indexed by current zoom level.
-     */
-    getResolution: function() {
-        var zoom = this.map.getZoom();
-        return this.getResolutionForZoom(zoom);
-    },
-
-    /** 
-     * APIMethod: getExtent
+     * Parameters:
+     * style   - {Object} style to create literals for. Will be modified
+     *           inline.
+     * feature - {Object}
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Bounds>} A Bounds object which represents the lon/lat 
-     *     bounds of the current viewPort.
+     * {Object} the modified style
      */
      */
-    getExtent: function() {
-        // just use stock map calculateBounds function -- passing no arguments
-        //  means it will user map's current center & resolution
-        //
-        return this.map.calculateBounds();
+    createLiterals: function(style, feature) {
+        var context = OpenLayers.Util.extend({}, feature.attributes || feature.data);
+        OpenLayers.Util.extend(context, this.context);
+        
+        for (var i in this.propertyStyles) {
+            style[i] = OpenLayers.Style.createLiteral(style[i], context, feature, i);
+        }
+        return style;
     },
     },
-
+    
     /**
     /**
-     * APIMethod: getZoomForExtent
+     * Method: findPropertyStyles
+     * Looks into all rules for this style and the defaultStyle to collect
+     * all the style hash property names containing ${...} strings that have
+     * to be replaced using the createLiteral method before returning them.
      * 
      * 
-     * Parameters:
-     * extent - {<OpenLayers.Bounds>}
-     * closest - {Boolean} Find the zoom level that most closely fits the 
-     *     specified bounds. Note that this may result in a zoom that does 
-     *     not exactly contain the entire extent.
-     *     Default is false.
-     *
      * Returns:
      * Returns:
-     * {Integer} The index of the zoomLevel (entry in the resolutions array) 
-     *     for the passed-in extent. We do this by calculating the ideal 
-     *     resolution for the given extent (based on the map size) and then 
-     *     calling getZoomForResolution(), passing along the 'closest'
-     *     parameter.
+     * {Object} hash of property names that need createLiteral parsing. The
+     * name of the property is the key, and the value is true;
      */
      */
-    getZoomForExtent: function(extent, closest) {
-        var viewSize = this.map.getSize();
-        var idealResolution = Math.max( extent.getWidth()  / viewSize.w,
-                                        extent.getHeight() / viewSize.h );
+    findPropertyStyles: function() {
+        var propertyStyles = {};
 
 
-        return this.getZoomForResolution(idealResolution, closest);
+        // check the default style
+        var style = this.defaultStyle;
+        this.addPropertyStyles(propertyStyles, style);
+
+        // walk through all rules to check for properties in their symbolizer
+        var rules = this.rules;
+        var symbolizer, value;
+        for (var i=0, len=rules.length; i<len; i++) {
+            symbolizer = rules[i].symbolizer;
+            for (var key in symbolizer) {
+                value = symbolizer[key];
+                if (typeof value == "object") {
+                    // symbolizer key is "Point", "Line" or "Polygon"
+                    this.addPropertyStyles(propertyStyles, value);
+                } else {
+                    // symbolizer is a hash of style properties
+                    this.addPropertyStyles(propertyStyles, symbolizer);
+                    break;
+                }
+            }
+        }
+        return propertyStyles;
     },
     
     },
     
-    /** 
-     * Method: getDataExtent
-     * Calculates the max extent which includes all of the data for the layer.
-     *     This function is to be implemented by subclasses.
-     * 
-     * Returns:
-     * {<OpenLayers.Bounds>}
-     */
-    getDataExtent: function () {
-        //to be implemented by subclasses
-    },
-
     /**
     /**
-     * APIMethod: getResolutionForZoom
+     * Method: addPropertyStyles
      * 
      * Parameters:
      * 
      * Parameters:
-     * zoom - {Float}
+     * propertyStyles - {Object} hash to add new property styles to. Will be
+     *                  modified inline
+     * symbolizer     - {Object} search this symbolizer for property styles
      * 
      * Returns:
      * 
      * Returns:
-     * {Float} A suitable resolution for the specified zoom.
+     * {Object} propertyStyles hash
      */
      */
-    getResolutionForZoom: function(zoom) {
-        zoom = Math.max(0, Math.min(zoom, this.resolutions.length - 1));
-        var resolution;
-        if(this.map.fractionalZoom) {
-            var low = Math.floor(zoom);
-            var high = Math.ceil(zoom);
-            resolution = this.resolutions[low] -
-                ((zoom-low) * (this.resolutions[low]-this.resolutions[high]));
-        } else {
-            resolution = this.resolutions[Math.round(zoom)];
+    addPropertyStyles: function(propertyStyles, symbolizer) {
+        var property;
+        for (var key in symbolizer) {
+            property = symbolizer[key];
+            if (typeof property == "string" &&
+                    property.match(/\$\{\w+\}/)) {
+                propertyStyles[key] = true;
+            }
         }
         }
-        return resolution;
+        return propertyStyles;
     },
     },
-
+    
     /**
     /**
-     * APIMethod: getZoomForResolution
+     * APIMethod: addRules
+     * Adds rules to this style.
      * 
      * Parameters:
      * 
      * Parameters:
-     * resolution - {Float}
-     * closest - {Boolean} Find the zoom level that corresponds to the absolute 
-     *     closest resolution, which may result in a zoom whose corresponding
-     *     resolution is actually smaller than we would have desired (if this
-     *     is being called from a getZoomForExtent() call, then this means that
-     *     the returned zoom index might not actually contain the entire 
-     *     extent specified... but it'll be close).
-     *     Default is false.
-     * 
-     * Returns:
-     * {Integer} The index of the zoomLevel (entry in the resolutions array) 
-     *     that corresponds to the best fit resolution given the passed in 
-     *     value and the 'closest' specification.
+     * rules - {Array(<OpenLayers.Rule>)}
      */
      */
-    getZoomForResolution: function(resolution, closest) {
-        var zoom, i, len;
-        if(this.map.fractionalZoom) {
-            var lowZoom = 0;
-            var highZoom = this.resolutions.length - 1;
-            var highRes = this.resolutions[lowZoom];
-            var lowRes = this.resolutions[highZoom];
-            var res;
-            for(i=0, len=this.resolutions.length; i<len; ++i) {
-                res = this.resolutions[i];
-                if(res >= resolution) {
-                    highRes = res;
-                    lowZoom = i;
-                }
-                if(res <= resolution) {
-                    lowRes = res;
-                    highZoom = i;
-                    break;
-                }
-            }
-            var dRes = highRes - lowRes;
-            if(dRes > 0) {
-                zoom = lowZoom + ((highRes - resolution) / dRes);
-            } else {
-                zoom = lowZoom;
-            }
-        } else {
-            var diff;
-            var minDiff = Number.POSITIVE_INFINITY;
-            for(i=0, len=this.resolutions.length; i<len; i++) {            
-                if (closest) {
-                    diff = Math.abs(this.resolutions[i] - resolution);
-                    if (diff > minDiff) {
-                        break;
-                    }
-                    minDiff = diff;
-                } else {
-                    if (this.resolutions[i] < resolution) {
-                        break;
-                    }
-                }
-            }
-            zoom = Math.max(0, i-1);
-        }
-        return zoom;
+    addRules: function(rules) {
+        Array.prototype.push.apply(this.rules, rules);
+        this.propertyStyles = this.findPropertyStyles();
     },
     
     /**
     },
     
     /**
-     * APIMethod: getLonLatFromViewPortPx
+     * APIMethod: setDefaultStyle
+     * Sets the default style for this style object.
      * 
      * Parameters:
      * 
      * Parameters:
-     * viewPortPx - {<OpenLayers.Pixel>|Object} An OpenLayers.Pixel or
-     *                                          an object with a 'x'
-     *                                          and 'y' properties.
-     *
-     * Returns:
-     * {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in 
-     *     view port <OpenLayers.Pixel>, translated into lon/lat by the layer.
+     * style - {Object} Hash of style properties
      */
      */
-    getLonLatFromViewPortPx: function (viewPortPx) {
-        var lonlat = null;
-        var map = this.map;
-        if (viewPortPx != null && map.minPx) {
-            var res = map.getResolution();
-            var maxExtent = map.getMaxExtent({restricted: true});
-            var lon = (viewPortPx.x - map.minPx.x) * res + maxExtent.left;
-            var lat = (map.minPx.y - viewPortPx.y) * res + maxExtent.top;
-            lonlat = new OpenLayers.LonLat(lon, lat);
-
-            if (this.wrapDateLine) {
-                lonlat = lonlat.wrapDateLine(this.maxExtent);
-            }
-        }
-        return lonlat;
+    setDefaultStyle: function(style) {
+        this.defaultStyle = style; 
+        this.propertyStyles = this.findPropertyStyles();
     },
     },
-
+        
     /**
     /**
-     * APIMethod: getViewPortPxFromLonLat
-     * Returns a pixel location given a map location.  This method will return
-     *     fractional pixel values.
+     * Method: getSymbolizerPrefix
+     * Returns the correct symbolizer prefix according to the
+     * geometry type of the passed geometry
      * 
      * Parameters:
      * 
      * Parameters:
-     * lonlat - {<OpenLayers.LonLat>|Object} An OpenLayers.LonLat or
-     *                                       an object with a 'lon'
-     *                                       and 'lat' properties.
-     *
-     * Returns: 
-     * {<OpenLayers.Pixel>} An <OpenLayers.Pixel> which is the passed-in 
-     *     lonlat translated into view port pixels.
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {String} key of the according symbolizer
      */
      */
-    getViewPortPxFromLonLat: function (lonlat, resolution) {
-        var px = null; 
-        if (lonlat != null) {
-            resolution = resolution || this.map.getResolution();
-            var extent = this.map.calculateBounds(null, resolution);
-            px = new OpenLayers.Pixel(
-                (1/resolution * (lonlat.lon - extent.left)),
-                (1/resolution * (extent.top - lonlat.lat))
-            );    
+    getSymbolizerPrefix: function(geometry) {
+        var prefixes = OpenLayers.Style.SYMBOLIZER_PREFIXES;
+        for (var i=0, len=prefixes.length; i<len; i++) {
+            if (geometry.CLASS_NAME.indexOf(prefixes[i]) != -1) {
+                return prefixes[i];
+            }
         }
         }
-        return px;
     },
     
     /**
     },
     
     /**
-     * APIMethod: setOpacity
-     * Sets the opacity for the entire layer (all images)
+     * APIMethod: clone
+     * Clones this style.
      * 
      * 
-     * Parameters:
-     * opacity - {Float}
+     * Returns:
+     * {<OpenLayers.Style>} Clone of this style.
      */
      */
-    setOpacity: function(opacity) {
-        if (opacity != this.opacity) {
-            this.opacity = opacity;
-            var childNodes = this.div.childNodes;
-            for(var i = 0, len = childNodes.length; i < len; ++i) {
-                var element = childNodes[i].firstChild || childNodes[i];
-                var lastChild = childNodes[i].lastChild;
-                //TODO de-uglify this
-                if (lastChild && lastChild.nodeName.toLowerCase() === "iframe") {
-                    element = lastChild.parentNode;
-                }
-                OpenLayers.Util.modifyDOMElement(element, null, null, null, 
-                                                 null, null, null, opacity);
-            }
-            if (this.map != null) {
-                this.map.events.triggerEvent("changelayer", {
-                    layer: this,
-                    property: "opacity"
-                });
+    clone: function() {
+        var options = OpenLayers.Util.extend({}, this);
+        // clone rules
+        if(this.rules) {
+            options.rules = [];
+            for(var i=0, len=this.rules.length; i<len; ++i) {
+                options.rules.push(this.rules[i].clone());
             }
         }
             }
         }
+        // clone context
+        options.context = this.context && OpenLayers.Util.extend({}, this.context);
+        //clone default style
+        var defaultStyle = OpenLayers.Util.extend({}, this.defaultStyle);
+        return new OpenLayers.Style(defaultStyle, options);
     },
     },
+    
+    CLASS_NAME: "OpenLayers.Style"
+});
 
 
-    /**
-     * Method: getZIndex
-     * 
-     * Returns: 
-     * {Integer} the z-index of this layer
-     */    
-    getZIndex: function () {
-        return this.div.style.zIndex;
-    },
-
-    /**
-     * Method: setZIndex
-     * 
-     * Parameters: 
-     * zIndex - {Integer}
-     */    
-    setZIndex: function (zIndex) {
-        this.div.style.zIndex = zIndex;
-    },
-
-    /**
-     * Method: adjustBounds
-     * This function will take a bounds, and if wrapDateLine option is set
-     *     on the layer, it will return a bounds which is wrapped around the 
-     *     world. We do not wrap for bounds which *cross* the 
-     *     maxExtent.left/right, only bounds which are entirely to the left 
-     *     or entirely to the right.
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     */
-    adjustBounds: function (bounds) {
-
-        if (this.gutter) {
-            // Adjust the extent of a bounds in map units by the 
-            // layer's gutter in pixels.
-            var mapGutter = this.gutter * this.map.getResolution();
-            bounds = new OpenLayers.Bounds(bounds.left - mapGutter,
-                                           bounds.bottom - mapGutter,
-                                           bounds.right + mapGutter,
-                                           bounds.top + mapGutter);
-        }
-
-        if (this.wrapDateLine) {
-            // wrap around the date line, within the limits of rounding error
-            var wrappingOptions = { 
-                'rightTolerance':this.getResolution(),
-                'leftTolerance':this.getResolution()
-            };    
-            bounds = bounds.wrapDateLine(this.maxExtent, wrappingOptions);
-                              
-        }
-        return bounds;
-    },
 
 
-    CLASS_NAME: "OpenLayers.Layer"
-});
+/**
+ * Function: createLiteral
+ * converts a style value holding a combination of PropertyName and Literal
+ * into a Literal, taking the property values from the passed features.
+ * 
+ * Parameters:
+ * value - {String} value to parse. If this string contains a construct like
+ *         "foo ${bar}", then "foo " will be taken as literal, and "${bar}"
+ *         will be replaced by the value of the "bar" attribute of the passed
+ *         feature.
+ * context - {Object} context to take attribute values from
+ * feature - {<OpenLayers.Feature.Vector>} optional feature to pass to
+ *           <OpenLayers.String.format> for evaluating functions in the
+ *           context.
+ * property - {String} optional, name of the property for which the literal is
+ *            being created for evaluating functions in the context.
+ * 
+ * Returns:
+ * {String} the parsed value. In the example of the value parameter above, the
+ * result would be "foo valueOfBar", assuming that the passed feature has an
+ * attribute named "bar" with the value "valueOfBar".
+ */
+OpenLayers.Style.createLiteral = function(value, context, feature, property) {
+    if (typeof value == "string" && value.indexOf("${") != -1) {
+        value = OpenLayers.String.format(value, context, [feature, property]);
+        value = (isNaN(value) || !value) ? value : parseFloat(value);
+    }
+    return value;
+};
+    
+/**
+ * Constant: OpenLayers.Style.SYMBOLIZER_PREFIXES
+ * {Array} prefixes of the sld symbolizers. These are the
+ * same as the main geometry types
+ */
+OpenLayers.Style.SYMBOLIZER_PREFIXES = ['Point', 'Line', 'Polygon', 'Text',
+    'Raster'];
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Layer/SphericalMercator.js
+    OpenLayers/Rule.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
+
 /**
 /**
- * @requires OpenLayers/Layer.js
- * @requires OpenLayers/Projection.js
+ * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Util.js
+ * @requires OpenLayers/Style.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Layer.SphericalMercator
- * A mixin for layers that wraps up the pieces neccesary to have a coordinate
- *     conversion for working with commercial APIs which use a spherical
- *     mercator projection.  Using this layer as a base layer, additional
- *     layers can be used as overlays if they are in the same projection.
- *
- * A layer is given properties of this object by setting the sphericalMercator
- *     property to true.
- *
- * More projection information:
- *  - http://spatialreference.org/ref/user/google-projection/
- *
- * Proj4 Text:
- *     +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0
- *     +k=1.0 +units=m +nadgrids=@null +no_defs
- *
- * WKT:
- *     900913=PROJCS["WGS84 / Simple Mercator", GEOGCS["WGS 84",
- *     DATUM["WGS_1984", SPHEROID["WGS_1984", 6378137.0, 298.257223563]], 
- *     PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], 
- *     AXIS["Longitude", EAST], AXIS["Latitude", NORTH]],
- *     PROJECTION["Mercator_1SP_Google"], 
- *     PARAMETER["latitude_of_origin", 0.0], PARAMETER["central_meridian", 0.0], 
- *     PARAMETER["scale_factor", 1.0], PARAMETER["false_easting", 0.0], 
- *     PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["x", EAST],
- *     AXIS["y", NORTH], AUTHORITY["EPSG","900913"]]
+ * Class: OpenLayers.Rule
+ * This class represents an SLD Rule, as being used for rule-based SLD styling.
  */
  */
-OpenLayers.Layer.SphericalMercator = {
-
+OpenLayers.Rule = OpenLayers.Class({
+    
     /**
     /**
-     * Method: getExtent
-     * Get the map's extent.
-     *
-     * Returns:
-     * {<OpenLayers.Bounds>} The map extent.
+     * Property: id
+     * {String} A unique id for this session.
      */
      */
-    getExtent: function() {
-        var extent = null;
-        if (this.sphericalMercator) {
-            extent = this.map.calculateBounds();
-        } else {
-            extent = OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this);
-        }
-        return extent;
-    },
-
+    id: null,
+    
     /**
     /**
-     * Method: getLonLatFromViewPortPx
-     * Get a map location from a pixel location
-     * 
-     * Parameters:
-     * viewPortPx - {<OpenLayers.Pixel>}
-     *
-     * Returns:
-     *  {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in view
-     *  port OpenLayers.Pixel, translated into lon/lat by map lib
-     *  If the map lib is not loaded or not centered, returns null
+     * APIProperty: name
+     * {String} name of this rule
      */
      */
-    getLonLatFromViewPortPx: function (viewPortPx) {
-        return OpenLayers.Layer.prototype.getLonLatFromViewPortPx.apply(this, arguments);
-    },
+    name: null,
     
     /**
     
     /**
-     * Method: getViewPortPxFromLonLat
-     * Get a pixel location from a map location
-     *
-     * Parameters:
-     * lonlat - {<OpenLayers.LonLat>}
-     *
-     * Returns:
-     * {<OpenLayers.Pixel>} An OpenLayers.Pixel which is the passed-in
-     * OpenLayers.LonLat, translated into view port pixels by map lib
-     * If map lib is not loaded or not centered, returns null
-     */
-    getViewPortPxFromLonLat: function (lonlat) {
-        return OpenLayers.Layer.prototype.getViewPortPxFromLonLat.apply(this, arguments);
-    },
-
-    /** 
-     * Method: initMercatorParameters 
-     * Set up the mercator parameters on the layer: resolutions,
-     *     projection, units.
+     * Property: title
+     * {String} Title of this rule (set if included in SLD)
      */
      */
-    initMercatorParameters: function() {
-        // set up properties for Mercator - assume EPSG:900913
-        this.RESOLUTIONS = [];
-        var maxResolution = 156543.03390625;
-        for(var zoom=0; zoom<=this.MAX_ZOOM_LEVEL; ++zoom) {
-            this.RESOLUTIONS[zoom] = maxResolution / Math.pow(2, zoom);
-        }
-        this.units = "m";
-        this.projection = this.projection || "EPSG:900913";
-    },
-
+    title: null,
+    
     /**
     /**
-     * APIMethod: forwardMercator
-     * Given a lon,lat in EPSG:4326, return a point in Spherical Mercator.
-     *
-     * Parameters:
-     * lon - {float} 
-     * lat - {float}
-     * 
-     * Returns:
-     * {<OpenLayers.LonLat>} The coordinates transformed to Mercator.
+     * Property: description
+     * {String} Description of this rule (set if abstract is included in SLD)
      */
      */
-    forwardMercator: (function() {
-        var gg = new OpenLayers.Projection("EPSG:4326");
-        var sm = new OpenLayers.Projection("EPSG:900913");
-        return function(lon, lat) {
-            var point = OpenLayers.Projection.transform({x: lon, y: lat}, gg, sm);
-            return new OpenLayers.LonLat(point.x, point.y);
-        };
-    })(),
+    description: null,
 
     /**
 
     /**
-     * APIMethod: inverseMercator
-     * Given a x,y in Spherical Mercator, return a point in EPSG:4326.
-     *
-     * Parameters:
-     * x - {float} A map x in Spherical Mercator.
-     * y - {float} A map y in Spherical Mercator.
-     * 
-     * Returns:
-     * {<OpenLayers.LonLat>} The coordinates transformed to EPSG:4326.
+     * Property: context
+     * {Object} An optional object with properties that the rule should be
+     * evaluated against. If no context is specified, feature.attributes will
+     * be used.
      */
      */
-    inverseMercator: (function() {
-        var gg = new OpenLayers.Projection("EPSG:4326");
-        var sm = new OpenLayers.Projection("EPSG:900913");
-        return function(x, y) {
-            var point = OpenLayers.Projection.transform({x: x, y: y}, sm, gg);
-            return new OpenLayers.LonLat(point.x, point.y);
-        };
-    })()
-
-};
-/* ======================================================================
-    OpenLayers/Layer/EventPane.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-
-/**
- * @requires OpenLayers/Layer.js
- * @requires OpenLayers/Util.js
- */
-
-/**
- * Class: OpenLayers.Layer.EventPane
- * Base class for 3rd party layers, providing a DOM element which isolates
- * the 3rd-party layer from mouse events.
- * Only used by Google layers.
- *
- * Automatically instantiated by the Google constructor, and not usually instantiated directly.
- *
- * Create a new event pane layer with the
- * <OpenLayers.Layer.EventPane> constructor.
- * 
- * Inherits from:
- *  - <OpenLayers.Layer>
- */
-OpenLayers.Layer.EventPane = OpenLayers.Class(OpenLayers.Layer, {
+    context: null,
     
     /**
     
     /**
-     * APIProperty: smoothDragPan
-     * {Boolean} smoothDragPan determines whether non-public/internal API
-     *     methods are used for better performance while dragging EventPane 
-     *     layers. When not in sphericalMercator mode, the smoother dragging 
-     *     doesn't actually move north/south directly with the number of 
-     *     pixels moved, resulting in a slight offset when you drag your mouse 
-     *     north south with this option on. If this visual disparity bothers 
-     *     you, you should turn this option off, or use spherical mercator. 
-     *     Default is on.
+     * Property: filter
+     * {<OpenLayers.Filter>} Optional filter for the rule.
      */
      */
-    smoothDragPan: true,
+    filter: null,
 
     /**
 
     /**
-     * Property: isBaseLayer
-     * {Boolean} EventPaned layers are always base layers, by necessity.
-     */ 
-    isBaseLayer: true,
-
+     * Property: elseFilter
+     * {Boolean} Determines whether this rule is only to be applied only if
+     * no other rules match (ElseFilter according to the SLD specification). 
+     * Default is false.  For instances of OpenLayers.Rule, if elseFilter is
+     * false, the rule will always apply.  For subclasses, the else property is 
+     * ignored.
+     */
+    elseFilter: false,
+    
     /**
     /**
-     * APIProperty: isFixed
-     * {Boolean} EventPaned layers are fixed by default.
-     */ 
-    isFixed: true,
-
+     * Property: symbolizer
+     * {Object} Symbolizer or hash of symbolizers for this rule. If hash of
+     * symbolizers, keys are one or more of ["Point", "Line", "Polygon"]. The
+     * latter if useful if it is required to style e.g. vertices of a line
+     * with a point symbolizer. Note, however, that this is not implemented
+     * yet in OpenLayers, but it is the way how symbolizers are defined in
+     * SLD.
+     */
+    symbolizer: null,
+    
     /**
     /**
-     * Property: pane
-     * {DOMElement} A reference to the element that controls the events.
+     * Property: symbolizers
+     * {Array} Collection of symbolizers associated with this rule.  If 
+     *     provided at construction, the symbolizers array has precedence
+     *     over the deprecated symbolizer property.  Note that multiple 
+     *     symbolizers are not currently supported by the vector renderers.
+     *     Rules with multiple symbolizers are currently only useful for
+     *     maintaining elements in an SLD document.
      */
      */
-    pane: null,
-
-
+    symbolizers: null,
+    
     /**
     /**
-     * Property: mapObject
-     * {Object} This is the object which will be used to load the 3rd party library
-     * in the case of the google layer, this will be of type GMap, 
-     * in the case of the ve layer, this will be of type VEMap
-     */ 
-    mapObject: null,
-
+     * APIProperty: minScaleDenominator
+     * {Number} or {String} minimum scale at which to draw the feature.
+     * In the case of a String, this can be a combination of text and
+     * propertyNames in the form "literal ${propertyName}"
+     */
+    minScaleDenominator: null,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Layer.EventPane
-     * Create a new event pane layer
+     * APIProperty: maxScaleDenominator
+     * {Number} or {String} maximum scale at which to draw the feature.
+     * In the case of a String, this can be a combination of text and
+     * propertyNames in the form "literal ${propertyName}"
+     */
+    maxScaleDenominator: null,
+    
+    /** 
+     * Constructor: OpenLayers.Rule
+     * Creates a Rule.
      *
      * Parameters:
      *
      * Parameters:
-     * name - {String}
-     * options - {Object} Hashtable of extra options to tag onto the layer
+     * options - {Object} An optional object with properties to set on the
+     *           rule
+     * 
+     * Returns:
+     * {<OpenLayers.Rule>}
      */
      */
-    initialize: function(name, options) {
-        OpenLayers.Layer.prototype.initialize.apply(this, arguments);
-        if (this.pane == null) {
-            this.pane = OpenLayers.Util.createDiv(this.div.id + "_EventPane");
+    initialize: function(options) {
+        this.symbolizer = {};
+        OpenLayers.Util.extend(this, options);
+        if (this.symbolizers) {
+            delete this.symbolizer;
         }
         }
+        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
     },
     },
-    
-    /**
+
+    /** 
      * APIMethod: destroy
      * APIMethod: destroy
-     * Deconstruct this layer.
+     * nullify references to prevent circular references and memory leaks
      */
     destroy: function() {
      */
     destroy: function() {
-        this.mapObject = null;
-        this.pane = null;
-        OpenLayers.Layer.prototype.destroy.apply(this, arguments); 
+        for (var i in this.symbolizer) {
+            this.symbolizer[i] = null;
+        }
+        this.symbolizer = null;
+        delete this.symbolizers;
     },
     },
-
     
     /**
     
     /**
-     * Method: setMap
-     * Set the map property for the layer. This is done through an accessor
-     * so that subclasses can override this and take special action once 
-     * they have their map variable set. 
-     *
+     * APIMethod: evaluate
+     * evaluates this rule for a specific feature
+     * 
      * Parameters:
      * Parameters:
-     * map - {<OpenLayers.Map>}
+     * feature - {<OpenLayers.Feature>} feature to apply the rule to.
+     * 
+     * Returns:
+     * {Boolean} true if the rule applies, false if it does not.
+     * This rule is the default rule and always returns true.
      */
      */
-    setMap: function(map) {
-        OpenLayers.Layer.prototype.setMap.apply(this, arguments);
+    evaluate: function(feature) {
+        var context = this.getContext(feature);
+        var applies = true;
+
+        if (this.minScaleDenominator || this.maxScaleDenominator) {
+            var scale = feature.layer.map.getScale();
+        }
         
         
-        this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1;
-        this.pane.style.display = this.div.style.display;
-        this.pane.style.width="100%";
-        this.pane.style.height="100%";
-        if (OpenLayers.BROWSER_NAME == "msie") {
-            this.pane.style.background = 
-                "url(" + OpenLayers.Util.getImageLocation("blank.gif") + ")";
+        // check if within minScale/maxScale bounds
+        if (this.minScaleDenominator) {
+            applies = scale >= OpenLayers.Style.createLiteral(
+                    this.minScaleDenominator, context);
         }
         }
-
-        if (this.isFixed) {
-            this.map.viewPortDiv.appendChild(this.pane);
-        } else {
-            this.map.layerContainerDiv.appendChild(this.pane);
+        if (applies && this.maxScaleDenominator) {
+            applies = scale < OpenLayers.Style.createLiteral(
+                    this.maxScaleDenominator, context);
         }
         }
-
-        // once our layer has been added to the map, we can load it
-        this.loadMapObject();
-    
-        // if map didn't load, display warning
-        if (this.mapObject == null) {
-            this.loadWarningMessage();
+        
+        // check if optional filter applies
+        if(applies && this.filter) {
+            // feature id filters get the feature, others get the context
+            if(this.filter.CLASS_NAME == "OpenLayers.Filter.FeatureId") {
+                applies = this.filter.evaluate(feature);
+            } else {
+                applies = this.filter.evaluate(context);
+            }
         }
         }
-    },
 
 
+        return applies;
+    },
+    
     /**
     /**
-     * APIMethod: removeMap
-     * On being removed from the map, we'll like to remove the invisible 'pane'
-     *     div that we added to it on creation. 
+     * Method: getContext
+     * Gets the context for evaluating this rule
      * 
      * Parameters:
      * 
      * Parameters:
-     * map - {<OpenLayers.Map>}
+     * feature - {<OpenLayers.Feature>} feature to take the context from if
+     *           none is specified.
      */
      */
-    removeMap: function(map) {
-        if (this.pane && this.pane.parentNode) {
-            this.pane.parentNode.removeChild(this.pane);
+    getContext: function(feature) {
+        var context = this.context;
+        if (!context) {
+            context = feature.attributes || feature.data;
         }
         }
-        OpenLayers.Layer.prototype.removeMap.apply(this, arguments);
+        if (typeof this.context == "function") {
+            context = this.context(feature);
+        }
+        return context;
     },
     },
-  
+    
     /**
     /**
-     * Method: loadWarningMessage
-     * If we can't load the map lib, then display an error message to the 
-     *     user and tell them where to go for help.
-     * 
-     *     This function sets up the layout for the warning message. Each 3rd
-     *     party layer must implement its own getWarningHTML() function to 
-     *     provide the actual warning message.
-     */
-    loadWarningMessage:function() {
-
-        this.div.style.backgroundColor = "darkblue";
-
-        var viewSize = this.map.getSize();
-        
-        var msgW = Math.min(viewSize.w, 300);
-        var msgH = Math.min(viewSize.h, 200);
-        var size = new OpenLayers.Size(msgW, msgH);
-
-        var centerPx = new OpenLayers.Pixel(viewSize.w/2, viewSize.h/2);
-
-        var topLeft = centerPx.add(-size.w/2, -size.h/2);            
-
-        var div = OpenLayers.Util.createDiv(this.name + "_warning", 
-                                            topLeft, 
-                                            size,
-                                            null,
-                                            null,
-                                            null,
-                                            "auto");
-
-        div.style.padding = "7px";
-        div.style.backgroundColor = "yellow";
-
-        div.innerHTML = this.getWarningHTML();
-        this.div.appendChild(div);
-    },
-  
-    /** 
-     * Method: getWarningHTML
-     * To be implemented by subclasses.
+     * APIMethod: clone
+     * Clones this rule.
      * 
      * Returns:
      * 
      * Returns:
-     * {String} String with information on why layer is broken, how to get
-     *          it working.
-     */
-    getWarningHTML:function() {
-        //should be implemented by subclasses
-        return "";
-    },
-  
-    /**
-     * Method: display
-     * Set the display on the pane
-     *
-     * Parameters:
-     * display - {Boolean}
-     */
-    display: function(display) {
-        OpenLayers.Layer.prototype.display.apply(this, arguments);
-        this.pane.style.display = this.div.style.display;
-    },
-  
-    /**
-     * Method: setZIndex
-     * Set the z-index order for the pane.
-     * 
-     * Parameters:
-     * zIndex - {int}
-     */
-    setZIndex: function (zIndex) {
-        OpenLayers.Layer.prototype.setZIndex.apply(this, arguments);
-        this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1;
-    },
-    
-    /**
-     * Method: moveByPx
-     * Move the layer based on pixel vector. To be implemented by subclasses.
-     *
-     * Parameters:
-     * dx - {Number} The x coord of the displacement vector.
-     * dy - {Number} The y coord of the displacement vector.
+     * {<OpenLayers.Rule>} Clone of this rule.
      */
      */
-    moveByPx: function(dx, dy) {
-        OpenLayers.Layer.prototype.moveByPx.apply(this, arguments);
-        
-        if (this.dragPanMapObject) {
-            this.dragPanMapObject(dx, -dy);
+    clone: function() {
+        var options = OpenLayers.Util.extend({}, this);
+        if (this.symbolizers) {
+            // clone symbolizers
+            var len = this.symbolizers.length;
+            options.symbolizers = new Array(len);
+            for (var i=0; i<len; ++i) {
+                options.symbolizers[i] = this.symbolizers[i].clone();
+            }
         } else {
         } else {
-            this.moveTo(this.map.getCachedCenter());
-        }
-    },
-
-    /**
-     * Method: moveTo
-     * Handle calls to move the layer.
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * zoomChanged - {Boolean}
-     * dragging - {Boolean}
-     */
-    moveTo:function(bounds, zoomChanged, dragging) {
-        OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
-
-        if (this.mapObject != null) {
-
-            var newCenter = this.map.getCenter();
-            var newZoom = this.map.getZoom();
-
-            if (newCenter != null) {
-
-                var moOldCenter = this.getMapObjectCenter();
-                var oldCenter = this.getOLLonLatFromMapObjectLonLat(moOldCenter);
-
-                var moOldZoom = this.getMapObjectZoom();
-                var oldZoom= this.getOLZoomFromMapObjectZoom(moOldZoom);
-
-                if (!(newCenter.equals(oldCenter)) || newZoom != oldZoom) {
-
-                    if (!zoomChanged && oldCenter && this.dragPanMapObject && 
-                        this.smoothDragPan) {
-                        var oldPx = this.map.getViewPortPxFromLonLat(oldCenter);
-                        var newPx = this.map.getViewPortPxFromLonLat(newCenter);
-                        this.dragPanMapObject(newPx.x-oldPx.x, oldPx.y-newPx.y);
-                    } else {
-                        var center = this.getMapObjectLonLatFromOLLonLat(newCenter);
-                        var zoom = this.getMapObjectZoomFromOLZoom(newZoom);
-                        this.setMapObjectCenter(center, zoom, dragging);
-                    }
+            // clone symbolizer
+            options.symbolizer = {};
+            var value, type;
+            for(var key in this.symbolizer) {
+                value = this.symbolizer[key];
+                type = typeof value;
+                if(type === "object") {
+                    options.symbolizer[key] = OpenLayers.Util.extend({}, value);
+                } else if(type === "string") {
+                    options.symbolizer[key] = value;
                 }
             }
         }
                 }
             }
         }
+        // clone filter
+        options.filter = this.filter && this.filter.clone();
+        // clone context
+        options.context = this.context && OpenLayers.Util.extend({}, this.context);
+        return new OpenLayers.Rule(options);
     },
     },
+        
+    CLASS_NAME: "OpenLayers.Rule"
+});
+/* ======================================================================
+    OpenLayers/StyleMap.js
+   ====================================================================== */
 
 
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
 
 
-  /********************************************************/
-  /*                                                      */
-  /*                 Baselayer Functions                  */
-  /*                                                      */
-  /********************************************************/
-
+/**
+ * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Style.js
+ * @requires OpenLayers/Feature/Vector.js
+ */
+/**
+ * Class: OpenLayers.StyleMap
+ */
+OpenLayers.StyleMap = OpenLayers.Class({
+    
     /**
     /**
-     * Method: getLonLatFromViewPortPx
-     * Get a map location from a pixel location
-     * 
-     * Parameters:
-     * viewPortPx - {<OpenLayers.Pixel>}
-     *
-     * Returns:
-     *  {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in view
-     *  port OpenLayers.Pixel, translated into lon/lat by map lib
-     *  If the map lib is not loaded or not centered, returns null
+     * Property: styles
+     * {Object} Hash of {<OpenLayers.Style>}, keyed by names of well known
+     * rendering intents (e.g. "default", "temporary", "select", "delete").
      */
      */
-    getLonLatFromViewPortPx: function (viewPortPx) {
-        var lonlat = null;
-        if ( (this.mapObject != null) && 
-             (this.getMapObjectCenter() != null) ) {
-            var moPixel = this.getMapObjectPixelFromOLPixel(viewPortPx);
-            var moLonLat = this.getMapObjectLonLatFromMapObjectPixel(moPixel);
-            lonlat = this.getOLLonLatFromMapObjectLonLat(moLonLat);
-        }
-        return lonlat;
-    },
-
+    styles: null,
+    
     /**
     /**
-     * Method: getViewPortPxFromLonLat
-     * Get a pixel location from a map location
-     *
-     * Parameters:
-     * lonlat - {<OpenLayers.LonLat>}
-     *
-     * Returns:
-     * {<OpenLayers.Pixel>} An OpenLayers.Pixel which is the passed-in
-     * OpenLayers.LonLat, translated into view port pixels by map lib
-     * If map lib is not loaded or not centered, returns null
+     * Property: extendDefault
+     * {Boolean} if true, every render intent will extend the symbolizers
+     * specified for the "default" intent at rendering time. Otherwise, every
+     * rendering intent will be treated as a completely independent style.
      */
      */
-    getViewPortPxFromLonLat: function (lonlat) {
-        var viewPortPx = null;
-        if ( (this.mapObject != null) && 
-             (this.getMapObjectCenter() != null) ) {
-
-            var moLonLat = this.getMapObjectLonLatFromOLLonLat(lonlat);
-            var moPixel = this.getMapObjectPixelFromMapObjectLonLat(moLonLat);
-        
-            viewPortPx = this.getOLPixelFromMapObjectPixel(moPixel);
-        }
-        return viewPortPx;
-    },
-
-  /********************************************************/
-  /*                                                      */
-  /*               Translation Functions                  */
-  /*                                                      */
-  /*   The following functions translate Map Object and   */
-  /*            OL formats for Pixel, LonLat              */
-  /*                                                      */
-  /********************************************************/
-
-  //
-  // TRANSLATION: MapObject LatLng <-> OpenLayers.LonLat
-  //
-
+    extendDefault: true,
+    
     /**
     /**
-     * Method: getOLLonLatFromMapObjectLonLat
-     * Get an OL style map location from a 3rd party style map location
-     *
-     * Parameters
-     * moLonLat - {Object}
+     * Constructor: OpenLayers.StyleMap
      * 
      * 
-     * Returns:
-     * {<OpenLayers.LonLat>} An OpenLayers.LonLat, translated from the passed in 
-     *          MapObject LonLat
-     *          Returns null if null value is passed in
+     * Parameters:
+     * style   - {Object} Optional. Either a style hash, or a style object, or
+     *           a hash of style objects (style hashes) keyed by rendering
+     *           intent. If just one style hash or style object is passed,
+     *           this will be used for all known render intents (default,
+     *           select, temporary)
+     * options - {Object} optional hash of additional options for this
+     *           instance
      */
      */
-    getOLLonLatFromMapObjectLonLat: function(moLonLat) {
-        var olLonLat = null;
-        if (moLonLat != null) {
-            var lon = this.getLongitudeFromMapObjectLonLat(moLonLat);
-            var lat = this.getLatitudeFromMapObjectLonLat(moLonLat);
-            olLonLat = new OpenLayers.LonLat(lon, lat);
+    initialize: function (style, options) {
+        this.styles = {
+            "default": new OpenLayers.Style(
+                OpenLayers.Feature.Vector.style["default"]),
+            "select": new OpenLayers.Style(
+                OpenLayers.Feature.Vector.style["select"]),
+            "temporary": new OpenLayers.Style(
+                OpenLayers.Feature.Vector.style["temporary"]),
+            "delete": new OpenLayers.Style(
+                OpenLayers.Feature.Vector.style["delete"])
+        };
+        
+        // take whatever the user passed as style parameter and convert it
+        // into parts of stylemap.
+        if(style instanceof OpenLayers.Style) {
+            // user passed a style object
+            this.styles["default"] = style;
+            this.styles["select"] = style;
+            this.styles["temporary"] = style;
+            this.styles["delete"] = style;
+        } else if(typeof style == "object") {
+            for(var key in style) {
+                if(style[key] instanceof OpenLayers.Style) {
+                    // user passed a hash of style objects
+                    this.styles[key] = style[key];
+                } else if(typeof style[key] == "object") {
+                    // user passsed a hash of style hashes
+                    this.styles[key] = new OpenLayers.Style(style[key]);
+                } else {
+                    // user passed a style hash (i.e. symbolizer)
+                    this.styles["default"] = new OpenLayers.Style(style);
+                    this.styles["select"] = new OpenLayers.Style(style);
+                    this.styles["temporary"] = new OpenLayers.Style(style);
+                    this.styles["delete"] = new OpenLayers.Style(style);
+                    break;
+                }
+            }
         }
         }
-        return olLonLat;
+        OpenLayers.Util.extend(this, options);
     },
 
     /**
     },
 
     /**
-     * Method: getMapObjectLonLatFromOLLonLat
-     * Get a 3rd party map location from an OL map location.
-     *
-     * Parameters:
-     * olLonLat - {<OpenLayers.LonLat>}
-     * 
-     * Returns:
-     * {Object} A MapObject LonLat, translated from the passed in 
-     *          OpenLayers.LonLat
-     *          Returns null if null value is passed in
+     * Method: destroy
      */
      */
-    getMapObjectLonLatFromOLLonLat: function(olLonLat) {
-        var moLatLng = null;
-        if (olLonLat != null) {
-            moLatLng = this.getMapObjectLonLatFromLonLat(olLonLat.lon,
-                                                         olLonLat.lat);
+    destroy: function() {
+        for(var key in this.styles) {
+            this.styles[key].destroy();
         }
         }
-        return moLatLng;
+        this.styles = null;
     },
     },
-
-
-  //
-  // TRANSLATION: MapObject Pixel <-> OpenLayers.Pixel
-  //
-
+    
     /**
     /**
-     * Method: getOLPixelFromMapObjectPixel
-     * Get an OL pixel location from a 3rd party pixel location.
-     *
+     * Method: createSymbolizer
+     * Creates the symbolizer for a feature for a render intent.
+     * 
      * Parameters:
      * Parameters:
-     * moPixel - {Object}
+     * feature - {<OpenLayers.Feature>} The feature to evaluate the rules
+     *           of the intended style against.
+     * intent  - {String} The intent determines the symbolizer that will be
+     *           used to draw the feature. Well known intents are "default"
+     *           (for just drawing the features), "select" (for selected
+     *           features) and "temporary" (for drawing features).
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Pixel>} An OpenLayers.Pixel, translated from the passed in 
-     *          MapObject Pixel
-     *          Returns null if null value is passed in
+     * {Object} symbolizer hash
      */
      */
-    getOLPixelFromMapObjectPixel: function(moPixel) {
-        var olPixel = null;
-        if (moPixel != null) {
-            var x = this.getXFromMapObjectPixel(moPixel);
-            var y = this.getYFromMapObjectPixel(moPixel);
-            olPixel = new OpenLayers.Pixel(x, y);
+    createSymbolizer: function(feature, intent) {
+        if(!feature) {
+            feature = new OpenLayers.Feature.Vector();
         }
         }
-        return olPixel;
+        if(!this.styles[intent]) {
+            intent = "default";
+        }
+        feature.renderIntent = intent;
+        var defaultSymbolizer = {};
+        if(this.extendDefault && intent != "default") {
+            defaultSymbolizer = this.styles["default"].createSymbolizer(feature);
+        }
+        return OpenLayers.Util.extend(defaultSymbolizer,
+            this.styles[intent].createSymbolizer(feature));
     },
     },
-
+    
     /**
     /**
-     * Method: getMapObjectPixelFromOLPixel
-     * Get a 3rd party pixel location from an OL pixel location
-     *
-     * Parameters:
-     * olPixel - {<OpenLayers.Pixel>}
+     * Method: addUniqueValueRules
+     * Convenience method to create comparison rules for unique values of a
+     * property. The rules will be added to the style object for a specified
+     * rendering intent. This method is a shortcut for creating something like
+     * the "unique value legends" familiar from well known desktop GIS systems
      * 
      * 
-     * Returns:
-     * {Object} A MapObject Pixel, translated from the passed in 
-     *          OpenLayers.Pixel
-     *          Returns null if null value is passed in
+     * Parameters:
+     * renderIntent - {String} rendering intent to add the rules to
+     * property     - {String} values of feature attributes to create the
+     *                rules for
+     * symbolizers  - {Object} Hash of symbolizers, keyed by the desired
+     *                property values 
+     * context      - {Object} An optional object with properties that
+     *                symbolizers' property values should be evaluated
+     *                against. If no context is specified, feature.attributes
+     *                will be used
      */
      */
-    getMapObjectPixelFromOLPixel: function(olPixel) {
-        var moPixel = null;
-        if (olPixel != null) {
-            moPixel = this.getMapObjectPixelFromXY(olPixel.x, olPixel.y);
+    addUniqueValueRules: function(renderIntent, property, symbolizers, context) {
+        var rules = [];
+        for (var value in symbolizers) {
+            rules.push(new OpenLayers.Rule({
+                symbolizer: symbolizers[value],
+                context: context,
+                filter: new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.EQUAL_TO,
+                    property: property,
+                    value: value
+                })
+            }));
         }
         }
-        return moPixel;
+        this.styles[renderIntent].addRules(rules);
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Layer.EventPane"
+    CLASS_NAME: "OpenLayers.StyleMap"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Layer/FixedZoomLevels.js
+    OpenLayers/Request.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Layer.js
+ * @requires OpenLayers/Events.js
+ * @requires OpenLayers/Request/XMLHttpRequest.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Layer.FixedZoomLevels
- *   Some Layers will already have established zoom levels (like google 
- *    or ve). Instead of trying to determine them and populate a resolutions[]
- *    Array with those values, we will hijack the resolution functionality
- *    here.
- * 
- *   When you subclass FixedZoomLevels: 
- * 
- *   The initResolutions() call gets nullified, meaning no resolutions[] array 
- *    is set up. Which would be a big problem getResolution() in Layer, since 
- *    it merely takes map.zoom and indexes into resolutions[]... but....
- * 
- *   The getResolution() call is also overridden. Instead of using the 
- *    resolutions[] array, we simply calculate the current resolution based
- *    on the current extent and the current map size. But how will we be able
- *    to calculate the current extent without knowing the resolution...?
- *  
- *   The getExtent() function is also overridden. Instead of calculating extent
- *    based on the center point and the current resolution, we instead 
- *    calculate the extent by getting the lonlats at the top-left and 
- *    bottom-right by using the getLonLatFromViewPortPx() translation function,
- *    taken from the pixel locations (0,0) and the size of the map. But how 
- *    will we be able to do lonlat-px translation without resolution....?
- * 
- *   The getZoomForResolution() method is overridden. Instead of indexing into
- *    the resolutions[] array, we call OpenLayers.Layer.getExent(), passing in
- *    the desired resolution. With this extent, we then call getZoomForExtent() 
- * 
- * 
- *   Whenever you implement a layer using OpenLayers.Layer.FixedZoomLevels, 
- *    it is your responsibility to provide the following three functions:
- * 
- *   - getLonLatFromViewPortPx
- *   - getViewPortPxFromLonLat
- *   - getZoomForExtent
- * 
- *  ...those three functions should generally be provided by any reasonable 
- *  API that you might be working from.
- *
+ * TODO: deprecate me
+ * Use OpenLayers.Request.proxy instead.
  */
  */
-OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class({
-      
-  /********************************************************/
-  /*                                                      */
-  /*                 Baselayer Functions                  */
-  /*                                                      */
-  /*    The following functions must all be implemented   */
-  /*                  by all base layers                  */
-  /*                                                      */
-  /********************************************************/
+OpenLayers.ProxyHost = "";
+
+/**
+ * Namespace: OpenLayers.Request
+ * The OpenLayers.Request namespace contains convenience methods for working
+ *     with XMLHttpRequests.  These methods work with a cross-browser
+ *     W3C compliant <OpenLayers.Request.XMLHttpRequest> class.
+ */
+if (!OpenLayers.Request) {
+    /**
+     * This allows for OpenLayers/Request/XMLHttpRequest.js to be included
+     * before or after this script.
+     */
+    OpenLayers.Request = {};
+}
+OpenLayers.Util.extend(OpenLayers.Request, {
     
     /**
     
     /**
-     * Constructor: OpenLayers.Layer.FixedZoomLevels
-     * Create a new fixed zoom levels layer.
+     * Constant: DEFAULT_CONFIG
+     * {Object} Default configuration for all requests.
      */
      */
-    initialize: function() {
-        //this class is only just to add the following functions... 
-        // nothing to actually do here... but it is probably a good
-        // idea to have layers that use these functions call this 
-        // inititalize() anyways, in case at some point we decide we 
-        // do want to put some functionality or state in here. 
+    DEFAULT_CONFIG: {
+        method: "GET",
+        url: window.location.href,
+        async: true,
+        user: undefined,
+        password: undefined,
+        params: null,
+        proxy: OpenLayers.ProxyHost,
+        headers: {},
+        data: null,
+        callback: function() {},
+        success: null,
+        failure: null,
+        scope: null
     },
     
     /**
     },
     
     /**
-     * Method: initResolutions
-     * Populate the resolutions array
+     * Constant: URL_SPLIT_REGEX
      */
      */
-    initResolutions: function() {
-
-        var props = ['minZoomLevel', 'maxZoomLevel', 'numZoomLevels'];
-          
-        for(var i=0, len=props.length; i<len; i++) {
-            var property = props[i];
-            this[property] = (this.options[property] != null)  
-                                     ? this.options[property] 
-                                     : this.map[property];
-        }
-
-        if ( (this.minZoomLevel == null) ||
-             (this.minZoomLevel < this.MIN_ZOOM_LEVEL) ){
-            this.minZoomLevel = this.MIN_ZOOM_LEVEL;
-        }        
-
-        //
-        // At this point, we know what the minimum desired zoom level is, and
-        //  we must calculate the total number of zoom levels. 
-        //  
-        //  Because we allow for the setting of either the 'numZoomLevels'
-        //   or the 'maxZoomLevel' properties... on either the layer or the  
-        //   map, we have to define some rules to see which we take into
-        //   account first in this calculation. 
-        //
-        // The following is the precedence list for these properties:
-        // 
-        // (1) numZoomLevels set on layer
-        // (2) maxZoomLevel set on layer
-        // (3) numZoomLevels set on map
-        // (4) maxZoomLevel set on map*
-        // (5) none of the above*
-        //
-        // *Note that options (4) and (5) are only possible if the user 
-        //  _explicitly_ sets the 'numZoomLevels' property on the map to 
-        //  null, since it is set by default to 16. 
-        //
+    URL_SPLIT_REGEX: /([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,
+    
+    /**
+     * APIProperty: events
+     * {<OpenLayers.Events>} An events object that handles all 
+     *     events on the {<OpenLayers.Request>} object.
+     *
+     * All event listeners will receive an event object with three properties:
+     * request - {<OpenLayers.Request.XMLHttpRequest>} The request object.
+     * config - {Object} The config object sent to the specific request method.
+     * requestUrl - {String} The request url.
+     * 
+     * Supported event types:
+     * complete - Triggered when we have a response from the request, if a
+     *     listener returns false, no further response processing will take
+     *     place.
+     * success - Triggered when the HTTP response has a success code (200-299).
+     * failure - Triggered when the HTTP response does not have a success code.
+     */
+    events: new OpenLayers.Events(this),
+    
+    /**
+     * Method: makeSameOrigin
+     * Using the specified proxy, returns a same origin url of the provided url.
+     *
+     * Parameters:
+     * url - {String} An arbitrary url
+     * proxy {String|Function} The proxy to use to make the provided url a
+     *     same origin url.
+     *
+     * Returns
+     * {String} the same origin url. If no proxy is provided, the returned url
+     *     will be the same as the provided url.
+     */
+    makeSameOrigin: function(url, proxy) {
+        var sameOrigin = url.indexOf("http") !== 0;
+        var urlParts = !sameOrigin && url.match(this.URL_SPLIT_REGEX);
+        if (urlParts) {
+            var location = window.location;
+            sameOrigin =
+                urlParts[1] == location.protocol &&
+                urlParts[3] == location.hostname;
+            var uPort = urlParts[4], lPort = location.port;
+            if (uPort != 80 && uPort != "" || lPort != "80" && lPort != "") {
+                sameOrigin = sameOrigin && uPort == lPort;
+            }
+        }
+        if (!sameOrigin) {
+            if (proxy) {
+                if (typeof proxy == "function") {
+                    url = proxy(url);
+                } else {
+                    url = proxy + encodeURIComponent(url);
+                }
+            }
+        }
+        return url;
+    },
 
 
-        //
-        // Note to future: In 3.0, I think we should remove the default 
-        // value of 16 for map.numZoomLevels. Rather, I think that value 
-        // should be set as a default on the Layer.WMS class. If someone
-        // creates a 3rd party layer and does not specify any 'minZoomLevel', 
-        // 'maxZoomLevel', or 'numZoomLevels', and has not explicitly 
-        // specified any of those on the map object either.. then I think
-        // it is fair to say that s/he wants all the zoom levels available.
-        // 
-        // By making map.numZoomLevels *null* by default, that will be the 
-        // case. As it is, I don't feel comfortable changing that right now
-        // as it would be a glaring API change and actually would probably
-        // break many peoples' codes. 
-        //
+    /**
+     * APIMethod: issue
+     * Create a new XMLHttpRequest object, open it, set any headers, bind
+     *     a callback to done state, and send any data.  It is recommended that
+     *     you use one <GET>, <POST>, <PUT>, <DELETE>, <OPTIONS>, or <HEAD>.
+     *     This method is only documented to provide detail on the configuration
+     *     options available to all request methods.
+     *
+     * Parameters:
+     * config - {Object} Object containing properties for configuring the
+     *     request.  Allowed configuration properties are described below.
+     *     This object is modified and should not be reused.
+     *
+     * Allowed config properties:
+     * method - {String} One of GET, POST, PUT, DELETE, HEAD, or
+     *     OPTIONS.  Default is GET.
+     * url - {String} URL for the request.
+     * async - {Boolean} Open an asynchronous request.  Default is true.
+     * user - {String} User for relevant authentication scheme.  Set
+     *     to null to clear current user.
+     * password - {String} Password for relevant authentication scheme.
+     *     Set to null to clear current password.
+     * proxy - {String} Optional proxy.  Defaults to
+     *     <OpenLayers.ProxyHost>.
+     * params - {Object} Any key:value pairs to be appended to the
+     *     url as a query string.  Assumes url doesn't already include a query
+     *     string or hash.  Typically, this is only appropriate for <GET>
+     *     requests where the query string will be appended to the url.
+     *     Parameter values that are arrays will be
+     *     concatenated with a comma (note that this goes against form-encoding)
+     *     as is done with <OpenLayers.Util.getParameterString>.
+     * headers - {Object} Object with header:value pairs to be set on
+     *     the request.
+     * data - {String | Document} Optional data to send with the request.
+     *     Typically, this is only used with <POST> and <PUT> requests.
+     *     Make sure to provide the appropriate "Content-Type" header for your
+     *     data.  For <POST> and <PUT> requests, the content type defaults to
+     *     "application-xml".  If your data is a different content type, or
+     *     if you are using a different HTTP method, set the "Content-Type"
+     *     header to match your data type.
+     * callback - {Function} Function to call when request is done.
+     *     To determine if the request failed, check request.status (200
+     *     indicates success).
+     * success - {Function} Optional function to call if request status is in
+     *     the 200s.  This will be called in addition to callback above and
+     *     would typically only be used as an alternative.
+     * failure - {Function} Optional function to call if request status is not
+     *     in the 200s.  This will be called in addition to callback above and
+     *     would typically only be used as an alternative.
+     * scope - {Object} If callback is a public method on some object,
+     *     set the scope to that object.
+     *
+     * Returns:
+     * {XMLHttpRequest} Request object.  To abort the request before a response
+     *     is received, call abort() on the request object.
+     */
+    issue: function(config) {        
+        // apply default config - proxy host may have changed
+        var defaultConfig = OpenLayers.Util.extend(
+            this.DEFAULT_CONFIG,
+            {proxy: OpenLayers.ProxyHost}
+        );
+        config = config || {};
+        config.headers = config.headers || {};
+        config = OpenLayers.Util.applyDefaults(config, defaultConfig);
+        config.headers = OpenLayers.Util.applyDefaults(config.headers, defaultConfig.headers);
+        // Always set the "X-Requested-With" header to signal that this request
+        // was issued through the XHR-object. Since header keys are case 
+        // insensitive and we want to allow overriding of the "X-Requested-With"
+        // header through the user we cannot use applyDefaults, but have to 
+        // check manually whether we were called with a "X-Requested-With"
+        // header.
+        var customRequestedWithHeader = false,
+            headerKey;
+        for(headerKey in config.headers) {
+            if (config.headers.hasOwnProperty( headerKey )) {
+                if (headerKey.toLowerCase() === 'x-requested-with') {
+                    customRequestedWithHeader = true;
+                }
+            }
+        }
+        if (customRequestedWithHeader === false) {
+            // we did not have a custom "X-Requested-With" header
+            config.headers['X-Requested-With'] = 'XMLHttpRequest';
+        }
 
 
-        //the number of zoom levels we'd like to have.
-        var desiredZoomLevels;
+        // create request, open, and set headers
+        var request = new OpenLayers.Request.XMLHttpRequest();
+        var url = OpenLayers.Util.urlAppend(config.url, 
+            OpenLayers.Util.getParameterString(config.params || {}));
+        url = OpenLayers.Request.makeSameOrigin(url, config.proxy);
+        request.open(
+            config.method, url, config.async, config.user, config.password
+        );
+        for(var header in config.headers) {
+            request.setRequestHeader(header, config.headers[header]);
+        }
 
 
-        //this is the maximum number of zoom levels the layer will allow, 
-        // given the specified starting minimum zoom level.
-        var limitZoomLevels = this.MAX_ZOOM_LEVEL - this.minZoomLevel + 1;
+        var events = this.events;
 
 
-        if ( ((this.options.numZoomLevels == null) && 
-              (this.options.maxZoomLevel != null)) // (2)
-              ||
-             ((this.numZoomLevels == null) &&
-              (this.maxZoomLevel != null)) // (4)
-           ) {
-            //calculate based on specified maxZoomLevel (on layer or map)
-            desiredZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
+        // we want to execute runCallbacks with "this" as the
+        // execution scope
+        var self = this;
+        
+        request.onreadystatechange = function() {
+            if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
+                var proceed = events.triggerEvent(
+                    "complete",
+                    {request: request, config: config, requestUrl: url}
+                );
+                if(proceed !== false) {
+                    self.runCallbacks(
+                        {request: request, config: config, requestUrl: url}
+                    );
+                }
+            }
+        };
+        
+        // send request (optionally with data) and return
+        // call in a timeout for asynchronous requests so the return is
+        // available before readyState == 4 for cached docs
+        if(config.async === false) {
+            request.send(config.data);
         } else {
         } else {
-            //calculate based on specified numZoomLevels (on layer or map)
-            // this covers cases (1) and (3)
-            desiredZoomLevels = this.numZoomLevels;
+            window.setTimeout(function(){
+                if (request.readyState !== 0) { // W3C: 0-UNSENT
+                    request.send(config.data);
+                }
+            }, 0);
+        }
+        return request;
+    },
+    
+    /**
+     * Method: runCallbacks
+     * Calls the complete, success and failure callbacks. Application
+     *    can listen to the "complete" event, have the listener 
+     *    display a confirm window and always return false, and
+     *    execute OpenLayers.Request.runCallbacks if the user
+     *    hits "yes" in the confirm window.
+     *
+     * Parameters:
+     * options - {Object} Hash containing request, config and requestUrl keys
+     */
+    runCallbacks: function(options) {
+        var request = options.request;
+        var config = options.config;
+        
+        // bind callbacks to readyState 4 (done)
+        var complete = (config.scope) ?
+            OpenLayers.Function.bind(config.callback, config.scope) :
+            config.callback;
+        
+        // optional success callback
+        var success;
+        if(config.success) {
+            success = (config.scope) ?
+                OpenLayers.Function.bind(config.success, config.scope) :
+                config.success;
         }
 
         }
 
-        if (desiredZoomLevels != null) {
-            //Now that we know what we would *like* the number of zoom levels
-            // to be, based on layer or map options, we have to make sure that
-            // it does not conflict with the actual limit, as specified by 
-            // the constants on the layer itself (and calculated into the
-            // 'limitZoomLevels' variable). 
-            this.numZoomLevels = Math.min(desiredZoomLevels, limitZoomLevels);
-        } else {
-            // case (5) -- neither 'numZoomLevels' not 'maxZoomLevel' was 
-            // set on either the layer or the map. So we just use the 
-            // maximum limit as calculated by the layer's constants.
-            this.numZoomLevels = limitZoomLevels;
+        // optional failure callback
+        var failure;
+        if(config.failure) {
+            failure = (config.scope) ?
+                OpenLayers.Function.bind(config.failure, config.scope) :
+                config.failure;
         }
 
         }
 
-        //now that the 'numZoomLevels' is appropriately, safely set, 
-        // we go back and re-calculate the 'maxZoomLevel'.
-        this.maxZoomLevel = this.minZoomLevel + this.numZoomLevels - 1;
+        if (OpenLayers.Util.createUrlObject(config.url).protocol == "file:" &&
+                                                        request.responseText) {
+            request.status = 200;
+        }
+        complete(request);
 
 
-        if (this.RESOLUTIONS != null) {
-            var resolutionsIndex = 0;
-            this.resolutions = [];
-            for(var i= this.minZoomLevel; i <= this.maxZoomLevel; i++) {
-                this.resolutions[resolutionsIndex++] = this.RESOLUTIONS[i];            
+        if (!request.status || (request.status >= 200 && request.status < 300)) {
+            this.events.triggerEvent("success", options);
+            if(success) {
+                success(request);
             }
             }
-            this.maxResolution = this.resolutions[0];
-            this.minResolution = this.resolutions[this.resolutions.length - 1];
-        }       
+        }
+        if(request.status && (request.status < 200 || request.status >= 300)) {                    
+            this.events.triggerEvent("failure", options);
+            if(failure) {
+                failure(request);
+            }
+        }
     },
     
     /**
     },
     
     /**
-     * APIMethod: getResolution
-     * Get the current map resolution
+     * APIMethod: GET
+     * Send an HTTP GET request.  Additional configuration properties are
+     *     documented in the <issue> method, with the method property set
+     *     to GET.
+     *
+     * Parameters:
+     * config - {Object} Object with properties for configuring the request.
+     *     See the <issue> method for documentation of allowed properties.
+     *     This object is modified and should not be reused.
      * 
      * Returns:
      * 
      * Returns:
-     * {Float} Map units per Pixel
+     * {XMLHttpRequest} Request object.
      */
      */
-    getResolution: function() {
-
-        if (this.resolutions != null) {
-            return OpenLayers.Layer.prototype.getResolution.apply(this, arguments);
-        } else {
-            var resolution = null;
-            
-            var viewSize = this.map.getSize();
-            var extent = this.getExtent();
-            
-            if ((viewSize != null) && (extent != null)) {
-                resolution = Math.max( extent.getWidth()  / viewSize.w,
-                                       extent.getHeight() / viewSize.h );
-            }
-            return resolution;
-        }
-     },
-
+    GET: function(config) {
+        config = OpenLayers.Util.extend(config, {method: "GET"});
+        return OpenLayers.Request.issue(config);
+    },
+    
     /**
     /**
-     * APIMethod: getExtent
-     * Calculates using px-> lonlat translation functions on tl and br 
-     *     corners of viewport
+     * APIMethod: POST
+     * Send a POST request.  Additional configuration properties are
+     *     documented in the <issue> method, with the method property set
+     *     to POST and "Content-Type" header set to "application/xml".
+     *
+     * Parameters:
+     * config - {Object} Object with properties for configuring the request.
+     *     See the <issue> method for documentation of allowed properties.  The
+     *     default "Content-Type" header will be set to "application-xml" if
+     *     none is provided.  This object is modified and should not be reused.
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Bounds>} A Bounds object which represents the lon/lat 
-     *                       bounds of the current viewPort.
+     * {XMLHttpRequest} Request object.
      */
      */
-    getExtent: function () {
-        var size = this.map.getSize();
-        var tl = this.getLonLatFromViewPortPx({
-            x: 0, y: 0
-        });
-        var br = this.getLonLatFromViewPortPx({
-            x: size.w, y: size.h
-        });
-        
-        if ((tl != null) && (br != null)) {
-            return new OpenLayers.Bounds(tl.lon, br.lat, br.lon, tl.lat);
-        } else {
-            return null;
+    POST: function(config) {
+        config = OpenLayers.Util.extend(config, {method: "POST"});
+        // set content type to application/xml if it isn't already set
+        config.headers = config.headers ? config.headers : {};
+        if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
+            config.headers["Content-Type"] = "application/xml";
         }
         }
+        return OpenLayers.Request.issue(config);
     },
     },
-
+    
     /**
     /**
-     * Method: getZoomForResolution
-     * Get the zoom level for a given resolution
+     * APIMethod: PUT
+     * Send an HTTP PUT request.  Additional configuration properties are
+     *     documented in the <issue> method, with the method property set
+     *     to PUT and "Content-Type" header set to "application/xml".
      *
      * Parameters:
      *
      * Parameters:
-     * resolution - {Float}
-     *
+     * config - {Object} Object with properties for configuring the request.
+     *     See the <issue> method for documentation of allowed properties.  The
+     *     default "Content-Type" header will be set to "application-xml" if
+     *     none is provided.  This object is modified and should not be reused.
+     * 
      * Returns:
      * Returns:
-     * {Integer} A suitable zoom level for the specified resolution.
-     *           If no baselayer is set, returns null.
+     * {XMLHttpRequest} Request object.
      */
      */
-    getZoomForResolution: function(resolution) {
-      
-        if (this.resolutions != null) {
-            return OpenLayers.Layer.prototype.getZoomForResolution.apply(this, arguments);
-        } else {
-            var extent = OpenLayers.Layer.prototype.getExtent.apply(this, []);
-            return this.getZoomForExtent(extent);
+    PUT: function(config) {
+        config = OpenLayers.Util.extend(config, {method: "PUT"});
+        // set content type to application/xml if it isn't already set
+        config.headers = config.headers ? config.headers : {};
+        if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
+            config.headers["Content-Type"] = "application/xml";
         }
         }
+        return OpenLayers.Request.issue(config);
     },
     },
-
-
-
-    
-    /********************************************************/
-    /*                                                      */
-    /*             Translation Functions                    */
-    /*                                                      */
-    /*    The following functions translate GMaps and OL    */ 
-    /*     formats for Pixel, LonLat, Bounds, and Zoom      */
-    /*                                                      */
-    /********************************************************/
-    
     
     
-    //
-    // TRANSLATION: MapObject Zoom <-> OpenLayers Zoom
-    //
+    /**
+     * APIMethod: DELETE
+     * Send an HTTP DELETE request.  Additional configuration properties are
+     *     documented in the <issue> method, with the method property set
+     *     to DELETE.
+     *
+     * Parameters:
+     * config - {Object} Object with properties for configuring the request.
+     *     See the <issue> method for documentation of allowed properties.
+     *     This object is modified and should not be reused.
+     * 
+     * Returns:
+     * {XMLHttpRequest} Request object.
+     */
+    DELETE: function(config) {
+        config = OpenLayers.Util.extend(config, {method: "DELETE"});
+        return OpenLayers.Request.issue(config);
+    },
   
     /**
   
     /**
-     * Method: getOLZoomFromMapObjectZoom
-     * Get the OL zoom index from the map object zoom level
+     * APIMethod: HEAD
+     * Send an HTTP HEAD request.  Additional configuration properties are
+     *     documented in the <issue> method, with the method property set
+     *     to HEAD.
      *
      * Parameters:
      *
      * Parameters:
-     * moZoom - {Integer}
+     * config - {Object} Object with properties for configuring the request.
+     *     See the <issue> method for documentation of allowed properties.
+     *     This object is modified and should not be reused.
      * 
      * Returns:
      * 
      * Returns:
-     * {Integer} An OpenLayers Zoom level, translated from the passed in zoom
-     *           Returns null if null value is passed in
+     * {XMLHttpRequest} Request object.
      */
      */
-    getOLZoomFromMapObjectZoom: function(moZoom) {
-        var zoom = null;
-        if (moZoom != null) {
-            zoom = moZoom - this.minZoomLevel;
-            if (this.map.baseLayer !== this) {
-                zoom = this.map.baseLayer.getZoomForResolution(
-                    this.getResolutionForZoom(zoom)
-                );
-            }
-        }
-        return zoom;
+    HEAD: function(config) {
+        config = OpenLayers.Util.extend(config, {method: "HEAD"});
+        return OpenLayers.Request.issue(config);
     },
     
     /**
     },
     
     /**
-     * Method: getMapObjectZoomFromOLZoom
-     * Get the map object zoom level from the OL zoom level
+     * APIMethod: OPTIONS
+     * Send an HTTP OPTIONS request.  Additional configuration properties are
+     *     documented in the <issue> method, with the method property set
+     *     to OPTIONS.
      *
      * Parameters:
      *
      * Parameters:
-     * olZoom - {Integer}
+     * config - {Object} Object with properties for configuring the request.
+     *     See the <issue> method for documentation of allowed properties.
+     *     This object is modified and should not be reused.
      * 
      * Returns:
      * 
      * Returns:
-     * {Integer} A MapObject level, translated from the passed in olZoom
-     *           Returns null if null value is passed in
+     * {XMLHttpRequest} Request object.
      */
      */
-    getMapObjectZoomFromOLZoom: function(olZoom) {
-        var zoom = null; 
-        if (olZoom != null) {
-            zoom = olZoom + this.minZoomLevel;
-            if (this.map.baseLayer !== this) {
-                zoom = this.getZoomForResolution(
-                    this.map.baseLayer.getResolutionForZoom(zoom)
-                );
-            }
-        }
-        return zoom;
-    },
+    OPTIONS: function(config) {
+        config = OpenLayers.Util.extend(config, {method: "OPTIONS"});
+        return OpenLayers.Request.issue(config);
+    }
 
 
-    CLASS_NAME: "OpenLayers.Layer.FixedZoomLevels"
 });
 });
-
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Layer/Google.js
+    OpenLayers/Request/XMLHttpRequest.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
+// XMLHttpRequest.js Copyright (C) 2010 Sergey Ilinsky (http://www.ilinsky.com)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 
 /**
 
 /**
- * @requires OpenLayers/Layer/SphericalMercator.js
- * @requires OpenLayers/Layer/EventPane.js
- * @requires OpenLayers/Layer/FixedZoomLevels.js
- * @requires OpenLayers/Lang.js
+ * @requires OpenLayers/Request.js
  */
 
  */
 
-/**
- * Class: OpenLayers.Layer.Google
- * 
- * Provides a wrapper for Google's Maps API
- * Normally the Terms of Use for this API do not allow wrapping, but Google
- * have provided written consent to OpenLayers for this - see email in 
- * http://osgeo-org.1560.n6.nabble.com/Google-Maps-API-Terms-of-Use-changes-tp4910013p4911981.html
- * 
- * Inherits from:
- *  - <OpenLayers.Layer.SphericalMercator>
- *  - <OpenLayers.Layer.EventPane>
- *  - <OpenLayers.Layer.FixedZoomLevels>
- */
-OpenLayers.Layer.Google = OpenLayers.Class(
-    OpenLayers.Layer.EventPane, 
-    OpenLayers.Layer.FixedZoomLevels, {
-    
-    /** 
-     * Constant: MIN_ZOOM_LEVEL
-     * {Integer} 0 
-     */
-    MIN_ZOOM_LEVEL: 0,
-    
-    /** 
-     * Constant: MAX_ZOOM_LEVEL
-     * {Integer} 21
-     */
-    MAX_ZOOM_LEVEL: 21,
+(function () {
 
 
-    /** 
-     * Constant: RESOLUTIONS
-     * {Array(Float)} Hardcode these resolutions so that they are more closely
-     *                tied with the standard wms projection
-     */
-    RESOLUTIONS: [
-        1.40625, 
-        0.703125, 
-        0.3515625, 
-        0.17578125, 
-        0.087890625, 
-        0.0439453125,
-        0.02197265625, 
-        0.010986328125, 
-        0.0054931640625, 
-        0.00274658203125,
-        0.001373291015625, 
-        0.0006866455078125, 
-        0.00034332275390625,
-        0.000171661376953125, 
-        0.0000858306884765625, 
-        0.00004291534423828125,
-        0.00002145767211914062, 
-        0.00001072883605957031,
-        0.00000536441802978515, 
-        0.00000268220901489257,
-        0.0000013411045074462891,
-        0.00000067055225372314453
-    ],
+    // Save reference to earlier defined object implementation (if any)
+    var oXMLHttpRequest    = window.XMLHttpRequest;
 
 
-    /**
-     * APIProperty: type
-     * {GMapType}
-     */
-    type: null,
+    // Define on browser type
+    var bGecko    = !!window.controllers,
+        bIE        = window.document.all && !window.opera,
+        bIE7    = bIE && window.navigator.userAgent.match(/MSIE 7.0/);
 
 
-    /**
-     * APIProperty: wrapDateLine
-     * {Boolean} Allow user to pan forever east/west.  Default is true.  
-     *     Setting this to false only restricts panning if 
-     *     <sphericalMercator> is true. 
-     */
-    wrapDateLine: true,
+    // Enables "XMLHttpRequest()" call next to "new XMLHttpReques()"
+    function fXMLHttpRequest() {
+        this._object    = oXMLHttpRequest && !bIE7 ? new oXMLHttpRequest : new window.ActiveXObject("Microsoft.XMLHTTP");
+        this._listeners    = [];
+    };
 
 
-    /**
-     * APIProperty: sphericalMercator
-     * {Boolean} Should the map act as a mercator-projected map? This will
-     *     cause all interactions with the map to be in the actual map 
-     *     projection, which allows support for vector drawing, overlaying 
-     *     other maps, etc. 
-     */
-    sphericalMercator: false, 
-    
-    /**
-     * Property: version
-     * {Number} The version of the Google Maps API
-     */
-    version: null,
+    // Constructor
+    function cXMLHttpRequest() {
+        return new fXMLHttpRequest;
+    };
+    cXMLHttpRequest.prototype    = fXMLHttpRequest.prototype;
 
 
-    /** 
-     * Constructor: OpenLayers.Layer.Google
-     * 
-     * Parameters:
-     * name - {String} A name for the layer.
-     * options - {Object} An optional object whose properties will be set
-     *     on the layer.
-     */
-    initialize: function(name, options) {
-        options = options || {};
-        if(!options.version) {
-            options.version = typeof GMap2 === "function" ? "2" : "3";
-        }
-        var mixin = OpenLayers.Layer.Google["v" +
-            options.version.replace(/\./g, "_")];
-        if (mixin) {
-            OpenLayers.Util.applyDefaults(options, mixin);
-        } else {
-            throw "Unsupported Google Maps API version: " + options.version;
-        }
+    // BUGFIX: Firefox with Firebug installed would break pages if not executed
+    if (bGecko && oXMLHttpRequest.wrapped)
+        cXMLHttpRequest.wrapped    = oXMLHttpRequest.wrapped;
 
 
-        OpenLayers.Util.applyDefaults(options, mixin.DEFAULTS);
-        if (options.maxExtent) {
-            options.maxExtent = options.maxExtent.clone();
-        }
+    // Constants
+    cXMLHttpRequest.UNSENT                = 0;
+    cXMLHttpRequest.OPENED                = 1;
+    cXMLHttpRequest.HEADERS_RECEIVED    = 2;
+    cXMLHttpRequest.LOADING                = 3;
+    cXMLHttpRequest.DONE                = 4;
 
 
-        OpenLayers.Layer.EventPane.prototype.initialize.apply(this,
-            [name, options]);
-        OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this, 
-            [name, options]);
+    // Public Properties
+    cXMLHttpRequest.prototype.readyState    = cXMLHttpRequest.UNSENT;
+    cXMLHttpRequest.prototype.responseText    = '';
+    cXMLHttpRequest.prototype.responseXML    = null;
+    cXMLHttpRequest.prototype.status        = 0;
+    cXMLHttpRequest.prototype.statusText    = '';
 
 
-        if (this.sphericalMercator) {
-            OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
-            this.initMercatorParameters();
-        }    
-    },
+    // Priority proposal
+    cXMLHttpRequest.prototype.priority        = "NORMAL";
 
 
-    /**
-     * Method: clone
-     * Create a clone of this layer
-     *
-     * Returns:
-     * {<OpenLayers.Layer.Google>} An exact clone of this layer
-     */
-    clone: function() {
-        /**
-         * This method isn't intended to be called by a subclass and it
-         * doesn't call the same method on the superclass.  We don't call
-         * the super's clone because we don't want properties that are set
-         * on this layer after initialize (i.e. this.mapObject etc.).
-         */
-        return new OpenLayers.Layer.Google(
-            this.name, this.getOptions()
-        );
-    },
+    // Instance-level Events Handlers
+    cXMLHttpRequest.prototype.onreadystatechange    = null;
 
 
-    /**
-     * APIMethod: setVisibility
-     * Set the visibility flag for the layer and hide/show & redraw 
-     *     accordingly. Fire event unless otherwise specified
-     * 
-     * Note that visibility is no longer simply whether or not the layer's
-     *     style.display is set to "block". Now we store a 'visibility' state 
-     *     property on the layer class, this allows us to remember whether or 
-     *     not we *desire* for a layer to be visible. In the case where the 
-     *     map's resolution is out of the layer's range, this desire may be 
-     *     subverted.
-     * 
-     * Parameters:
-     * visible - {Boolean} Display the layer (if in range)
-     */
-    setVisibility: function(visible) {
-        // sharing a map container, opacity has to be set per layer
-        var opacity = this.opacity == null ? 1 : this.opacity;
-        OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this, arguments);
-        this.setOpacity(opacity);
-    },
-    
-    /** 
-     * APIMethod: display
-     * Hide or show the Layer
-     * 
-     * Parameters:
-     * visible - {Boolean}
-     */
-    display: function(visible) {
-        if (!this._dragging) {
-            this.setGMapVisibility(visible);
-        }
-        OpenLayers.Layer.EventPane.prototype.display.apply(this, arguments);
-    },
-    
-    /**
-     * Method: moveTo
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * zoomChanged - {Boolean} Tells when zoom has changed, as layers have to
-     *     do some init work in that case.
-     * dragging - {Boolean}
-     */
-    moveTo: function(bounds, zoomChanged, dragging) {
-        this._dragging = dragging;
-        OpenLayers.Layer.EventPane.prototype.moveTo.apply(this, arguments);
-        delete this._dragging;
-    },
-    
-    /**
-     * APIMethod: setOpacity
-     * Sets the opacity for the entire layer (all images)
-     * 
-     * Parameters:
-     * opacity - {Float}
-     */
-    setOpacity: function(opacity) {
-        if (opacity !== this.opacity) {
-            if (this.map != null) {
-                this.map.events.triggerEvent("changelayer", {
-                    layer: this,
-                    property: "opacity"
-                });
-            }
-            this.opacity = opacity;
-        }
-        // Though this layer's opacity may not change, we're sharing a container
-        // and need to update the opacity for the entire container.
-        if (this.getVisibility()) {
-            var container = this.getMapContainer();
-            OpenLayers.Util.modifyDOMElement(
-                container, null, null, null, null, null, null, opacity
-            );
-        }
-    },
+    // Class-level Events Handlers
+    cXMLHttpRequest.onreadystatechange    = null;
+    cXMLHttpRequest.onopen                = null;
+    cXMLHttpRequest.onsend                = null;
+    cXMLHttpRequest.onabort                = null;
 
 
-    /**
-     * APIMethod: destroy
-     * Clean up this layer.
-     */
-    destroy: function() {
-        /**
-         * We have to override this method because the event pane destroy
-         * deletes the mapObject reference before removing this layer from
-         * the map.
-         */
-        if (this.map) {
-            this.setGMapVisibility(false);
-            var cache = OpenLayers.Layer.Google.cache[this.map.id];
-            if (cache && cache.count <= 1) {
-                this.removeGMapElements();
-            }            
-        }
-        OpenLayers.Layer.EventPane.prototype.destroy.apply(this, arguments);
-    },
-    
-    /**
-     * Method: removeGMapElements
-     * Remove all elements added to the dom.  This should only be called if
-     * this is the last of the Google layers for the given map.
-     */
-    removeGMapElements: function() {
-        var cache = OpenLayers.Layer.Google.cache[this.map.id];
-        if (cache) {
-            // remove shared elements from dom
-            var container = this.mapObject && this.getMapContainer();                
-            if (container && container.parentNode) {
-                container.parentNode.removeChild(container);
-            }
-            var termsOfUse = cache.termsOfUse;
-            if (termsOfUse && termsOfUse.parentNode) {
-                termsOfUse.parentNode.removeChild(termsOfUse);
-            }
-            var poweredBy = cache.poweredBy;
-            if (poweredBy && poweredBy.parentNode) {
-                poweredBy.parentNode.removeChild(poweredBy);
-            }
-            if (this.mapObject && window.google && google.maps &&
-                    google.maps.event && google.maps.event.clearListeners) {
-                google.maps.event.clearListeners(this.mapObject, 'tilesloaded');
-            }
-        }
-    },
+    // Public Methods
+    cXMLHttpRequest.prototype.open    = function(sMethod, sUrl, bAsync, sUser, sPassword) {
+        // Delete headers, required when object is reused
+        delete this._headers;
 
 
-    /**
-     * APIMethod: removeMap
-     * On being removed from the map, also remove termsOfUse and poweredBy divs
-     * 
-     * Parameters:
-     * map - {<OpenLayers.Map>}
-     */
-    removeMap: function(map) {
-        // hide layer before removing
-        if (this.visibility && this.mapObject) {
-            this.setGMapVisibility(false);
-        }
-        // check to see if last Google layer in this map
-        var cache = OpenLayers.Layer.Google.cache[map.id];
-        if (cache) {
-            if (cache.count <= 1) {
-                this.removeGMapElements();
-                delete OpenLayers.Layer.Google.cache[map.id];
-            } else {
-                // decrement the layer count
-                --cache.count;
-            }
-        }
-        // remove references to gmap elements
-        delete this.termsOfUse;
-        delete this.poweredBy;
-        delete this.mapObject;
-        delete this.dragObject;
-        OpenLayers.Layer.EventPane.prototype.removeMap.apply(this, arguments);
-    },
-    
-  //
-  // TRANSLATION: MapObject Bounds <-> OpenLayers.Bounds
-  //
+        // When bAsync parameter value is omitted, use true as default
+        if (arguments.length < 3)
+            bAsync    = true;
 
 
-    /**
-     * APIMethod: getOLBoundsFromMapObjectBounds
-     * 
-     * Parameters:
-     * moBounds - {Object}
-     * 
-     * Returns:
-     * {<OpenLayers.Bounds>} An <OpenLayers.Bounds>, translated from the 
-     *                       passed-in MapObject Bounds.
-     *                       Returns null if null value is passed in.
-     */
-    getOLBoundsFromMapObjectBounds: function(moBounds) {
-        var olBounds = null;
-        if (moBounds != null) {
-            var sw = moBounds.getSouthWest();
-            var ne = moBounds.getNorthEast();
-            if (this.sphericalMercator) {
-                sw = this.forwardMercator(sw.lng(), sw.lat());
-                ne = this.forwardMercator(ne.lng(), ne.lat());
-            } else {
-                sw = new OpenLayers.LonLat(sw.lng(), sw.lat()); 
-                ne = new OpenLayers.LonLat(ne.lng(), ne.lat()); 
-            }    
-            olBounds = new OpenLayers.Bounds(sw.lon, 
-                                             sw.lat, 
-                                             ne.lon, 
-                                             ne.lat );
-        }
-        return olBounds;
-    },
+        // Save async parameter for fixing Gecko bug with missing readystatechange in synchronous requests
+        this._async        = bAsync;
 
 
-    /** 
-     * APIMethod: getWarningHTML
-     * 
-     * Returns: 
-     * {String} String with information on why layer is broken, how to get
-     *          it working.
-     */
-    getWarningHTML:function() {
-        return OpenLayers.i18n("googleWarning");
-    },
+        // Set the onreadystatechange handler
+        var oRequest    = this,
+            nState        = this.readyState,
+            fOnUnload;
 
 
+        // BUGFIX: IE - memory leak on page unload (inter-page leak)
+        if (bIE && bAsync) {
+            fOnUnload = function() {
+                if (nState != cXMLHttpRequest.DONE) {
+                    fCleanTransport(oRequest);
+                    // Safe to abort here since onreadystatechange handler removed
+                    oRequest.abort();
+                }
+            };
+            window.attachEvent("onunload", fOnUnload);
+        }
 
 
-    /************************************
-     *                                  *
-     *   MapObject Interface Controls   *
-     *                                  *
-     ************************************/
+        // Add method sniffer
+        if (cXMLHttpRequest.onopen)
+            cXMLHttpRequest.onopen.apply(this, arguments);
 
 
+        if (arguments.length > 4)
+            this._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
+        else
+        if (arguments.length > 3)
+            this._object.open(sMethod, sUrl, bAsync, sUser);
+        else
+            this._object.open(sMethod, sUrl, bAsync);
 
 
-  // Get&Set Center, Zoom
+        this.readyState    = cXMLHttpRequest.OPENED;
+        fReadyStateChange(this);
 
 
-    /**
-     * APIMethod: getMapObjectCenter
-     * 
-     * Returns: 
-     * {Object} The mapObject's current center in Map Object format
-     */
-    getMapObjectCenter: function() {
-        return this.mapObject.getCenter();
-    },
+        this._object.onreadystatechange    = function() {
+            if (bGecko && !bAsync)
+                return;
 
 
-    /** 
-     * APIMethod: getMapObjectZoom
-     * 
-     * Returns:
-     * {Integer} The mapObject's current zoom, in Map Object format
-     */
-    getMapObjectZoom: function() {
-        return this.mapObject.getZoom();
-    },
+            // Synchronize state
+            oRequest.readyState        = oRequest._object.readyState;
 
 
-  
-    /************************************
-     *                                  *
-     *       MapObject Primitives       *
-     *                                  *
-     ************************************/
+            //
+            fSynchronizeValues(oRequest);
 
 
+            // BUGFIX: Firefox fires unnecessary DONE when aborting
+            if (oRequest._aborted) {
+                // Reset readyState to UNSENT
+                oRequest.readyState    = cXMLHttpRequest.UNSENT;
 
 
-  // LonLat
-    
-    /**
-     * APIMethod: getLongitudeFromMapObjectLonLat
-     * 
-     * Parameters:
-     * moLonLat - {Object} MapObject LonLat format
-     * 
-     * Returns:
-     * {Float} Longitude of the given MapObject LonLat
-     */
-    getLongitudeFromMapObjectLonLat: function(moLonLat) {
-        return this.sphericalMercator ? 
-          this.forwardMercator(moLonLat.lng(), moLonLat.lat()).lon :
-          moLonLat.lng();  
-    },
+                // Return now
+                return;
+            }
 
 
-    /**
-     * APIMethod: getLatitudeFromMapObjectLonLat
-     * 
-     * Parameters:
-     * moLonLat - {Object} MapObject LonLat format
-     * 
-     * Returns:
-     * {Float} Latitude of the given MapObject LonLat
-     */
-    getLatitudeFromMapObjectLonLat: function(moLonLat) {
-        var lat = this.sphericalMercator ? 
-          this.forwardMercator(moLonLat.lng(), moLonLat.lat()).lat :
-          moLonLat.lat(); 
-        return lat;  
-    },
-    
-  // Pixel
-    
-    /**
-     * APIMethod: getXFromMapObjectPixel
-     * 
-     * Parameters:
-     * moPixel - {Object} MapObject Pixel format
-     * 
-     * Returns:
-     * {Integer} X value of the MapObject Pixel
-     */
-    getXFromMapObjectPixel: function(moPixel) {
-        return moPixel.x;
-    },
+            if (oRequest.readyState == cXMLHttpRequest.DONE) {
+                // Free up queue
+                delete oRequest._data;
+/*                if (bAsync)
+                    fQueue_remove(oRequest);*/
+                //
+                fCleanTransport(oRequest);
+// Uncomment this block if you need a fix for IE cache
+/*
+                // BUGFIX: IE - cache issue
+                if (!oRequest._object.getResponseHeader("Date")) {
+                    // Save object to cache
+                    oRequest._cached    = oRequest._object;
 
 
-    /**
-     * APIMethod: getYFromMapObjectPixel
-     * 
-     * Parameters:
-     * moPixel - {Object} MapObject Pixel format
-     * 
-     * Returns:
-     * {Integer} Y value of the MapObject Pixel
-     */
-    getYFromMapObjectPixel: function(moPixel) {
-        return moPixel.y;
-    },
-    
-    CLASS_NAME: "OpenLayers.Layer.Google"
-});
+                    // Instantiate a new transport object
+                    cXMLHttpRequest.call(oRequest);
 
 
-/**
- * Property: OpenLayers.Layer.Google.cache
- * {Object} Cache for elements that should only be created once per map.
- */
-OpenLayers.Layer.Google.cache = {};
+                    // Re-send request
+                    if (sUser) {
+                         if (sPassword)
+                            oRequest._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
+                        else
+                            oRequest._object.open(sMethod, sUrl, bAsync, sUser);
+                    }
+                    else
+                        oRequest._object.open(sMethod, sUrl, bAsync);
+                    oRequest._object.setRequestHeader("If-Modified-Since", oRequest._cached.getResponseHeader("Last-Modified") || new window.Date(0));
+                    // Copy headers set
+                    if (oRequest._headers)
+                        for (var sHeader in oRequest._headers)
+                            if (typeof oRequest._headers[sHeader] == "string")    // Some frameworks prototype objects with functions
+                                oRequest._object.setRequestHeader(sHeader, oRequest._headers[sHeader]);
 
 
+                    oRequest._object.onreadystatechange    = function() {
+                        // Synchronize state
+                        oRequest.readyState        = oRequest._object.readyState;
 
 
-/**
- * Constant: OpenLayers.Layer.Google.v2
- * 
- * Mixin providing functionality specific to the Google Maps API v2.
- * 
- * This API has been deprecated by Google.
- * Developers are encouraged to migrate to v3 of the API; support for this
- * is provided by <OpenLayers.Layer.Google.v3>
- */
-OpenLayers.Layer.Google.v2 = {
-    
-    /**
-     * Property: termsOfUse
-     * {DOMElement} Div for Google's copyright and terms of use link
-     */
-    termsOfUse: null, 
+                        if (oRequest._aborted) {
+                            //
+                            oRequest.readyState    = cXMLHttpRequest.UNSENT;
 
 
-    /**
-     * Property: poweredBy
-     * {DOMElement} Div for Google's powered by logo and link
-     */
-    poweredBy: null, 
+                            // Return
+                            return;
+                        }
 
 
-    /**
-     * Property: dragObject
-     * {GDraggableObject} Since 2.93, Google has exposed the ability to get
-     *     the maps GDraggableObject. We can now use this for smooth panning
-     */
-    dragObject: null, 
-    
-    /** 
-     * Method: loadMapObject
-     * Load the GMap and register appropriate event listeners. If we can't 
-     *     load GMap2, then display a warning message.
-     */
-    loadMapObject:function() {
-        if (!this.type) {
-            this.type = G_NORMAL_MAP;
-        }
-        var mapObject, termsOfUse, poweredBy;
-        var cache = OpenLayers.Layer.Google.cache[this.map.id];
-        if (cache) {
-            // there are already Google layers added to this map
-            mapObject = cache.mapObject;
-            termsOfUse = cache.termsOfUse;
-            poweredBy = cache.poweredBy;
-            // increment the layer count
-            ++cache.count;
-        } else {
-            // this is the first Google layer for this map
+                        if (oRequest.readyState == cXMLHttpRequest.DONE) {
+                            // Clean Object
+                            fCleanTransport(oRequest);
 
 
-            var container = this.map.viewPortDiv;
-            var div = document.createElement("div");
-            div.id = this.map.id + "_GMap2Container";
-            div.style.position = "absolute";
-            div.style.width = "100%";
-            div.style.height = "100%";
-            container.appendChild(div);
+                            // get cached request
+                            if (oRequest.status == 304)
+                                oRequest._object    = oRequest._cached;
 
 
-            // create GMap and shuffle elements
-            try {
-                mapObject = new GMap2(div);
-                
-                // move the ToS and branding stuff up to the container div
-                termsOfUse = div.lastChild;
-                container.appendChild(termsOfUse);
-                termsOfUse.style.zIndex = "1100";
-                termsOfUse.style.right = "";
-                termsOfUse.style.bottom = "";
-                termsOfUse.className = "olLayerGoogleCopyright";
-
-                poweredBy = div.lastChild;
-                container.appendChild(poweredBy);
-                poweredBy.style.zIndex = "1100";
-                poweredBy.style.right = "";
-                poweredBy.style.bottom = "";
-                poweredBy.className = "olLayerGooglePoweredBy gmnoprint";
-                
-            } catch (e) {
-                throw(e);
-            }
-            // cache elements for use by any other google layers added to
-            // this same map
-            OpenLayers.Layer.Google.cache[this.map.id] = {
-                mapObject: mapObject,
-                termsOfUse: termsOfUse,
-                poweredBy: poweredBy,
-                count: 1
-            };
-        }
+                            //
+                            delete oRequest._cached;
 
 
-        this.mapObject = mapObject;
-        this.termsOfUse = termsOfUse;
-        this.poweredBy = poweredBy;
-        
-        // ensure this layer type is one of the mapObject types
-        if (OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),
-                                    this.type) === -1) {
-            this.mapObject.addMapType(this.type);
-        }
+                            //
+                            fSynchronizeValues(oRequest);
 
 
-        //since v 2.93 getDragObject is now available.
-        if(typeof mapObject.getDragObject == "function") {
-            this.dragObject = mapObject.getDragObject();
-        } else {
-            this.dragPanMapObject = null;
-        }
-        
-        if(this.isBaseLayer === false) {
-            this.setGMapVisibility(this.div.style.display !== "none");
-        }
+                            //
+                            fReadyStateChange(oRequest);
 
 
-    },
+                            // BUGFIX: IE - memory leak in interrupted
+                            if (bIE && bAsync)
+                                window.detachEvent("onunload", fOnUnload);
+                        }
+                    };
+                    oRequest._object.send(null);
 
 
-    /**
-     * APIMethod: onMapResize
-     */
-    onMapResize: function() {
-        // workaround for resizing of invisible or not yet fully loaded layers
-        // where GMap2.checkResize() does not work. We need to load the GMap
-        // for the old div size, then checkResize(), and then call
-        // layer.moveTo() to trigger GMap.setCenter() (which will finish
-        // the GMap initialization).
-        if(this.visibility && this.mapObject.isLoaded()) {
-            this.mapObject.checkResize();
-        } else {
-            if(!this._resized) {
-                var layer = this;
-                var handle = GEvent.addListener(this.mapObject, "load", function() {
-                    GEvent.removeListener(handle);
-                    delete layer._resized;
-                    layer.mapObject.checkResize();
-                    layer.moveTo(layer.map.getCenter(), layer.map.getZoom());
-                });
+                    // Return now - wait until re-sent request is finished
+                    return;
+                };
+*/
+                // BUGFIX: IE - memory leak in interrupted
+                if (bIE && bAsync)
+                    window.detachEvent("onunload", fOnUnload);
             }
             }
-            this._resized = true;
+
+            // BUGFIX: Some browsers (Internet Explorer, Gecko) fire OPEN readystate twice
+            if (nState != oRequest.readyState)
+                fReadyStateChange(oRequest);
+
+            nState    = oRequest.readyState;
         }
         }
-    },
+    };
+    function fXMLHttpRequest_send(oRequest) {
+        oRequest._object.send(oRequest._data);
 
 
-    /**
-     * Method: setGMapVisibility
-     * Display the GMap container and associated elements.
-     * 
-     * Parameters:
-     * visible - {Boolean} Display the GMap elements.
-     */
-    setGMapVisibility: function(visible) {
-        var cache = OpenLayers.Layer.Google.cache[this.map.id];
-        if (cache) {
-            var container = this.mapObject.getContainer();
-            if (visible === true) {
-                this.mapObject.setMapType(this.type);
-                container.style.display = "";
-                this.termsOfUse.style.left = "";
-                this.termsOfUse.style.display = "";
-                this.poweredBy.style.display = "";            
-                cache.displayed = this.id;
-            } else {
-                if (cache.displayed === this.id) {
-                    delete cache.displayed;
-                }
-                if (!cache.displayed) {
-                    container.style.display = "none";
-                    this.termsOfUse.style.display = "none";
-                    // move ToU far to the left in addition to setting display
-                    // to "none", because at the end of the GMap2 load
-                    // sequence, display: none will be unset and ToU would be
-                    // visible after loading a map with a google layer that is
-                    // initially hidden. 
-                    this.termsOfUse.style.left = "-9999px";
-                    this.poweredBy.style.display = "none";
-                }
+        // BUGFIX: Gecko - missing readystatechange calls in synchronous requests
+        if (bGecko && !oRequest._async) {
+            oRequest.readyState    = cXMLHttpRequest.OPENED;
+
+            // Synchronize state
+            fSynchronizeValues(oRequest);
+
+            // Simulate missing states
+            while (oRequest.readyState < cXMLHttpRequest.DONE) {
+                oRequest.readyState++;
+                fReadyStateChange(oRequest);
+                // Check if we are aborted
+                if (oRequest._aborted)
+                    return;
             }
         }
             }
         }
-    },
-    
-    /**
-     * Method: getMapContainer
-     * 
-     * Returns:
-     * {DOMElement} the GMap container's div
-     */
-    getMapContainer: function() {
-        return this.mapObject.getContainer();
-    },
+    };
+    cXMLHttpRequest.prototype.send    = function(vData) {
+        // Add method sniffer
+        if (cXMLHttpRequest.onsend)
+            cXMLHttpRequest.onsend.apply(this, arguments);
 
 
-  //
-  // TRANSLATION: MapObject Bounds <-> OpenLayers.Bounds
-  //
+        if (!arguments.length)
+            vData    = null;
 
 
-    /**
-     * APIMethod: getMapObjectBoundsFromOLBounds
-     * 
-     * Parameters:
-     * olBounds - {<OpenLayers.Bounds>}
-     * 
-     * Returns:
-     * {Object} A MapObject Bounds, translated from olBounds
-     *          Returns null if null value is passed in
-     */
-    getMapObjectBoundsFromOLBounds: function(olBounds) {
-        var moBounds = null;
-        if (olBounds != null) {
-            var sw = this.sphericalMercator ? 
-              this.inverseMercator(olBounds.bottom, olBounds.left) : 
-              new OpenLayers.LonLat(olBounds.bottom, olBounds.left);
-            var ne = this.sphericalMercator ? 
-              this.inverseMercator(olBounds.top, olBounds.right) : 
-              new OpenLayers.LonLat(olBounds.top, olBounds.right);
-            moBounds = new GLatLngBounds(new GLatLng(sw.lat, sw.lon),
-                                         new GLatLng(ne.lat, ne.lon));
+        // BUGFIX: Safari - fails sending documents created/modified dynamically, so an explicit serialization required
+        // BUGFIX: IE - rewrites any custom mime-type to "text/xml" in case an XMLNode is sent
+        // BUGFIX: Gecko - fails sending Element (this is up to the implementation either to standard)
+        if (vData && vData.nodeType) {
+            vData    = window.XMLSerializer ? new window.XMLSerializer().serializeToString(vData) : vData.xml;
+            if (!this._headers["Content-Type"])
+                this._object.setRequestHeader("Content-Type", "application/xml");
         }
         }
-        return moBounds;
-    },
 
 
+        this._data    = vData;
+/*
+        // Add to queue
+        if (this._async)
+            fQueue_add(this);
+        else*/
+            fXMLHttpRequest_send(this);
+    };
+    cXMLHttpRequest.prototype.abort    = function() {
+        // Add method sniffer
+        if (cXMLHttpRequest.onabort)
+            cXMLHttpRequest.onabort.apply(this, arguments);
 
 
-    /************************************
-     *                                  *
-     *   MapObject Interface Controls   *
-     *                                  *
-     ************************************/
+        // BUGFIX: Gecko - unnecessary DONE when aborting
+        if (this.readyState > cXMLHttpRequest.UNSENT)
+            this._aborted    = true;
 
 
+        this._object.abort();
 
 
-  // Get&Set Center, Zoom
+        // BUGFIX: IE - memory leak
+        fCleanTransport(this);
 
 
-    /** 
-     * APIMethod: setMapObjectCenter
-     * Set the mapObject to the specified center and zoom
-     * 
-     * Parameters:
-     * center - {Object} MapObject LonLat format
-     * zoom - {int} MapObject zoom format
-     */
-    setMapObjectCenter: function(center, zoom) {
-        this.mapObject.setCenter(center, zoom); 
-    },
-   
-    /**
-     * APIMethod: dragPanMapObject
-     * 
-     * Parameters:
-     * dX - {Integer}
-     * dY - {Integer}
-     */
-    dragPanMapObject: function(dX, dY) {
-        this.dragObject.moveBy(new GSize(-dX, dY));
-    },
+        this.readyState    = cXMLHttpRequest.UNSENT;
 
 
+        delete this._data;
+/*        if (this._async)
+            fQueue_remove(this);*/
+    };
+    cXMLHttpRequest.prototype.getAllResponseHeaders    = function() {
+        return this._object.getAllResponseHeaders();
+    };
+    cXMLHttpRequest.prototype.getResponseHeader    = function(sName) {
+        return this._object.getResponseHeader(sName);
+    };
+    cXMLHttpRequest.prototype.setRequestHeader    = function(sName, sValue) {
+        // BUGFIX: IE - cache issue
+        if (!this._headers)
+            this._headers    = {};
+        this._headers[sName]    = sValue;
 
 
-  // LonLat - Pixel Translation
-  
-    /**
-     * APIMethod: getMapObjectLonLatFromMapObjectPixel
-     * 
-     * Parameters:
-     * moPixel - {Object} MapObject Pixel format
-     * 
-     * Returns:
-     * {Object} MapObject LonLat translated from MapObject Pixel
-     */
-    getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
-        return this.mapObject.fromContainerPixelToLatLng(moPixel);
-    },
+        return this._object.setRequestHeader(sName, sValue);
+    };
 
 
-    /**
-     * APIMethod: getMapObjectPixelFromMapObjectLonLat
-     * 
-     * Parameters:
-     * moLonLat - {Object} MapObject LonLat format
-     * 
-     * Returns:
-     * {Object} MapObject Pixel transtlated from MapObject LonLat
-     */
-    getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
-        return this.mapObject.fromLatLngToContainerPixel(moLonLat);
-    },
+    // EventTarget interface implementation
+    cXMLHttpRequest.prototype.addEventListener    = function(sName, fHandler, bUseCapture) {
+        for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)
+            if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)
+                return;
+        // Add listener
+        this._listeners.push([sName, fHandler, bUseCapture]);
+    };
 
 
-  
-  // Bounds
-  
-    /** 
-     * APIMethod: getMapObjectZoomFromMapObjectBounds
-     * 
-     * Parameters:
-     * moBounds - {Object} MapObject Bounds format
-     * 
-     * Returns:
-     * {Object} MapObject Zoom for specified MapObject Bounds
-     */
-    getMapObjectZoomFromMapObjectBounds: function(moBounds) {
-        return this.mapObject.getBoundsZoomLevel(moBounds);
-    },
+    cXMLHttpRequest.prototype.removeEventListener    = function(sName, fHandler, bUseCapture) {
+        for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)
+            if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)
+                break;
+        // Remove listener
+        if (oListener)
+            this._listeners.splice(nIndex, 1);
+    };
 
 
-    /************************************
-     *                                  *
-     *       MapObject Primitives       *
-     *                                  *
-     ************************************/
+    cXMLHttpRequest.prototype.dispatchEvent    = function(oEvent) {
+        var oEventPseudo    = {
+            'type':            oEvent.type,
+            'target':        this,
+            'currentTarget':this,
+            'eventPhase':    2,
+            'bubbles':        oEvent.bubbles,
+            'cancelable':    oEvent.cancelable,
+            'timeStamp':    oEvent.timeStamp,
+            'stopPropagation':    function() {},    // There is no flow
+            'preventDefault':    function() {},    // There is no default action
+            'initEvent':        function() {}    // Original event object should be initialized
+        };
 
 
+        // Execute onreadystatechange
+        if (oEventPseudo.type == "readystatechange" && this.onreadystatechange)
+            (this.onreadystatechange.handleEvent || this.onreadystatechange).apply(this, [oEventPseudo]);
 
 
-  // LonLat
-    
-    /**
-     * APIMethod: getMapObjectLonLatFromLonLat
-     * 
-     * Parameters:
-     * lon - {Float}
-     * lat - {Float}
-     * 
-     * Returns:
-     * {Object} MapObject LonLat built from lon and lat params
-     */
-    getMapObjectLonLatFromLonLat: function(lon, lat) {
-        var gLatLng;
-        if(this.sphericalMercator) {
-            var lonlat = this.inverseMercator(lon, lat);
-            gLatLng = new GLatLng(lonlat.lat, lonlat.lon);
-        } else {
-            gLatLng = new GLatLng(lat, lon);
+        // Execute listeners
+        for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)
+            if (oListener[0] == oEventPseudo.type && !oListener[2])
+                (oListener[1].handleEvent || oListener[1]).apply(this, [oEventPseudo]);
+    };
+
+    //
+    cXMLHttpRequest.prototype.toString    = function() {
+        return '[' + "object" + ' ' + "XMLHttpRequest" + ']';
+    };
+
+    cXMLHttpRequest.toString    = function() {
+        return '[' + "XMLHttpRequest" + ']';
+    };
+
+    // Helper function
+    function fReadyStateChange(oRequest) {
+        // Sniffing code
+        if (cXMLHttpRequest.onreadystatechange)
+            cXMLHttpRequest.onreadystatechange.apply(oRequest);
+
+        // Fake event
+        oRequest.dispatchEvent({
+            'type':            "readystatechange",
+            'bubbles':        false,
+            'cancelable':    false,
+            'timeStamp':    new Date + 0
+        });
+    };
+
+    function fGetDocument(oRequest) {
+        var oDocument    = oRequest.responseXML,
+            sResponse    = oRequest.responseText;
+        // Try parsing responseText
+        if (bIE && sResponse && oDocument && !oDocument.documentElement && oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)) {
+            oDocument    = new window.ActiveXObject("Microsoft.XMLDOM");
+            oDocument.async                = false;
+            oDocument.validateOnParse    = false;
+            oDocument.loadXML(sResponse);
         }
         }
-        return gLatLng;
-    },
+        // Check if there is no error in document
+        if (oDocument)
+            if ((bIE && oDocument.parseError != 0) || !oDocument.documentElement || (oDocument.documentElement && oDocument.documentElement.tagName == "parsererror"))
+                return null;
+        return oDocument;
+    };
 
 
-  // Pixel
-    
+    function fSynchronizeValues(oRequest) {
+        try {    oRequest.responseText    = oRequest._object.responseText;    } catch (e) {}
+        try {    oRequest.responseXML    = fGetDocument(oRequest._object);    } catch (e) {}
+        try {    oRequest.status            = oRequest._object.status;            } catch (e) {}
+        try {    oRequest.statusText        = oRequest._object.statusText;        } catch (e) {}
+    };
+
+    function fCleanTransport(oRequest) {
+        // BUGFIX: IE - memory leak (on-page leak)
+        oRequest._object.onreadystatechange    = new window.Function;
+    };
+/*
+    // Queue manager
+    var oQueuePending    = {"CRITICAL":[],"HIGH":[],"NORMAL":[],"LOW":[],"LOWEST":[]},
+        aQueueRunning    = [];
+    function fQueue_add(oRequest) {
+        oQueuePending[oRequest.priority in oQueuePending ? oRequest.priority : "NORMAL"].push(oRequest);
+        //
+        setTimeout(fQueue_process);
+    };
+
+    function fQueue_remove(oRequest) {
+        for (var nIndex = 0, bFound    = false; nIndex < aQueueRunning.length; nIndex++)
+            if (bFound)
+                aQueueRunning[nIndex - 1]    = aQueueRunning[nIndex];
+            else
+            if (aQueueRunning[nIndex] == oRequest)
+                bFound    = true;
+        if (bFound)
+            aQueueRunning.length--;
+        //
+        setTimeout(fQueue_process);
+    };
+
+    function fQueue_process() {
+        if (aQueueRunning.length < 6) {
+            for (var sPriority in oQueuePending) {
+                if (oQueuePending[sPriority].length) {
+                    var oRequest    = oQueuePending[sPriority][0];
+                    oQueuePending[sPriority]    = oQueuePending[sPriority].slice(1);
+                    //
+                    aQueueRunning.push(oRequest);
+                    // Send request
+                    fXMLHttpRequest_send(oRequest);
+                    break;
+                }
+            }
+        }
+    };
+*/
+    // Internet Explorer 5.0 (missing apply)
+    if (!window.Function.prototype.apply) {
+        window.Function.prototype.apply    = function(oRequest, oArguments) {
+            if (!oArguments)
+                oArguments    = [];
+            oRequest.__func    = this;
+            oRequest.__func(oArguments[0], oArguments[1], oArguments[2], oArguments[3], oArguments[4]);
+            delete oRequest.__func;
+        };
+    };
+
+    // Register new object with window
     /**
     /**
-     * APIMethod: getMapObjectPixelFromXY
-     * 
-     * Parameters:
-     * x - {Integer}
-     * y - {Integer}
-     * 
-     * Returns:
-     * {Object} MapObject Pixel from x and y parameters
+     * Class: OpenLayers.Request.XMLHttpRequest
+     * Standard-compliant (W3C) cross-browser implementation of the
+     *     XMLHttpRequest object.  From
+     *     http://code.google.com/p/xmlhttprequest/.
      */
      */
-    getMapObjectPixelFromXY: function(x, y) {
-        return new GPoint(x, y);
+    if (!OpenLayers.Request) {
+        /**
+         * This allows for OpenLayers/Request.js to be included
+         * before or after this script.
+         */
+        OpenLayers.Request = {};
     }
     }
-    
-};
+    OpenLayers.Request.XMLHttpRequest = cXMLHttpRequest;
+})();
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Control.js
+    OpenLayers/Protocol.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -12704,424 +12498,263 @@ OpenLayers.Layer.Google.v2 = {
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Control
- * Controls affect the display or behavior of the map. They allow everything
- * from panning and zooming to displaying a scale indicator. Controls by 
- * default are added to the map they are contained within however it is
- * possible to add a control to an external div by passing the div in the
- * options parameter.
- * 
- * Example:
- * The following example shows how to add many of the common controls
- * to a map.
- * 
- * > var map = new OpenLayers.Map('map', { controls: [] });
- * >
- * > map.addControl(new OpenLayers.Control.PanZoomBar());
- * > map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
- * > map.addControl(new OpenLayers.Control.Permalink());
- * > map.addControl(new OpenLayers.Control.Permalink('permalink'));
- * > map.addControl(new OpenLayers.Control.MousePosition());
- * > map.addControl(new OpenLayers.Control.OverviewMap());
- * > map.addControl(new OpenLayers.Control.KeyboardDefaults());
- *
- * The next code fragment is a quick example of how to intercept 
- * shift-mouse click to display the extent of the bounding box
- * dragged out by the user.  Usually controls are not created
- * in exactly this manner.  See the source for a more complete 
- * example:
- *
- * > var control = new OpenLayers.Control();
- * > OpenLayers.Util.extend(control, {
- * >     draw: function () {
- * >         // this Handler.Box will intercept the shift-mousedown
- * >         // before Control.MouseDefault gets to see it
- * >         this.box = new OpenLayers.Handler.Box( control, 
- * >             {"done": this.notice},
- * >             {keyMask: OpenLayers.Handler.MOD_SHIFT});
- * >         this.box.activate();
- * >     },
- * >
- * >     notice: function (bounds) {
- * >         OpenLayers.Console.userError(bounds);
- * >     }
- * > }); 
- * > map.addControl(control);
- * 
+ * Class: OpenLayers.Protocol
+ * Abstract vector layer protocol class.  Not to be instantiated directly.  Use
+ *     one of the protocol subclasses instead.
  */
  */
-OpenLayers.Control = OpenLayers.Class({
-
-    /** 
-     * Property: id 
-     * {String} 
-     */
-    id: null,
+OpenLayers.Protocol = OpenLayers.Class({
     
     
-    /** 
-     * Property: map 
-     * {<OpenLayers.Map>} this gets set in the addControl() function in
-     * OpenLayers.Map 
+    /**
+     * Property: format
+     * {<OpenLayers.Format>} The format used by this protocol.
      */
      */
-    map: null,
-
-    /** 
-     * APIProperty: div 
-     * {DOMElement} The element that contains the control, if not present the 
-     *     control is placed inside the map.
-     */
-    div: null,
-
-    /** 
-     * APIProperty: type 
-     * {Number} Controls can have a 'type'. The type determines the type of
-     * interactions which are possible with them when they are placed in an
-     * <OpenLayers.Control.Panel>. 
-     */
-    type: null, 
-
-    /** 
-     * Property: allowSelection
-     * {Boolean} By default, controls do not allow selection, because
-     * it may interfere with map dragging. If this is true, OpenLayers
-     * will not prevent selection of the control.
-     * Default is false.
-     */
-    allowSelection: false,  
-
-    /** 
-     * Property: displayClass 
-     * {string}  This property is used for CSS related to the drawing of the
-     * Control. 
-     */
-    displayClass: "",
+    format: null,
     
     /**
     
     /**
-    * APIProperty: title  
-    * {string}  This property is used for showing a tooltip over the  
-    * Control.  
-    */ 
-    title: "",
-
-    /**
-     * APIProperty: autoActivate
-     * {Boolean} Activate the control when it is added to a map.  Default is
-     *     false.
-     */
-    autoActivate: false,
-
-    /** 
-     * APIProperty: active 
-     * {Boolean} The control is active (read-only).  Use <activate> and 
-     *     <deactivate> to change control state.
+     * Property: options
+     * {Object} Any options sent to the constructor.
      */
      */
-    active: null,
+    options: null,
 
     /**
 
     /**
-     * Property: handlerOptions
-     * {Object} Used to set non-default properties on the control's handler
-     */
-    handlerOptions: null,
-
-    /** 
-     * Property: handler 
-     * {<OpenLayers.Handler>} null
+     * Property: autoDestroy
+     * {Boolean} The creator of the protocol can set autoDestroy to false
+     *      to fully control when the protocol is destroyed. Defaults to
+     *      true.
      */
      */
-    handler: null,
-
+    autoDestroy: true,
+   
     /**
     /**
-     * APIProperty: eventListeners
-     * {Object} If set as an option at construction, the eventListeners
-     *     object will be registered with <OpenLayers.Events.on>.  Object
-     *     structure must be a listeners object as shown in the example for
-     *     the events.on method.
+     * Property: defaultFilter
+     * {<OpenLayers.Filter>} Optional default filter to read requests
      */
      */
-    eventListeners: null,
-
-    /** 
-     * APIProperty: events
-     * {<OpenLayers.Events>} Events instance for listeners and triggering
-     *     control specific events.
-     *
-     * Register a listener for a particular event with the following syntax:
-     * (code)
-     * control.events.register(type, obj, listener);
-     * (end)
-     *
-     * Listeners will be called with a reference to an event object.  The
-     *     properties of this event depends on exactly what happened.
-     *
-     * All event objects have at least the following properties:
-     * object - {Object} A reference to control.events.object (a reference
-     *      to the control).
-     * element - {DOMElement} A reference to control.events.element (which
-     *      will be null unless documented otherwise).
+    defaultFilter: null,
+    
+    /**
+     * Constructor: OpenLayers.Protocol
+     * Abstract class for vector protocols.  Create instances of a subclass.
      *
      *
-     * Supported map event types:
-     * activate - Triggered when activated.
-     * deactivate - Triggered when deactivated.
+     * Parameters:
+     * options - {Object} Optional object whose properties will be set on the
+     *     instance.
      */
      */
-    events: null,
+    initialize: function(options) {
+        options = options || {};
+        OpenLayers.Util.extend(this, options);
+        this.options = options;
+    },
 
     /**
 
     /**
-     * Constructor: OpenLayers.Control
-     * Create an OpenLayers Control.  The options passed as a parameter
-     * directly extend the control.  For example passing the following:
-     * 
-     * > var control = new OpenLayers.Control({div: myDiv});
+     * Method: mergeWithDefaultFilter
+     * Merge filter passed to the read method with the default one
      *
      *
-     * Overrides the default div attribute value of null.
-     * 
      * Parameters:
      * Parameters:
-     * options - {Object} 
+     * filter - {<OpenLayers.Filter>}
      */
      */
-    initialize: function (options) {
-        // We do this before the extend so that instances can override
-        // className in options.
-        this.displayClass = 
-            this.CLASS_NAME.replace("OpenLayers.", "ol").replace(/\./g, "");
-        
-        OpenLayers.Util.extend(this, options);
-        
-        this.events = new OpenLayers.Events(this);
-        if(this.eventListeners instanceof Object) {
-            this.events.on(this.eventListeners);
-        }
-        if (this.id == null) {
-            this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
+    mergeWithDefaultFilter: function(filter) {
+        var merged;
+        if (filter && this.defaultFilter) {
+            merged = new OpenLayers.Filter.Logical({
+                type: OpenLayers.Filter.Logical.AND,
+                filters: [this.defaultFilter, filter]
+            });
+        } else {
+            merged = filter || this.defaultFilter || undefined;
         }
         }
+        return merged;
     },
 
     /**
     },
 
     /**
-     * Method: destroy
-     * The destroy method is used to perform any clean up before the control
-     * is dereferenced.  Typically this is where event listeners are removed
-     * to prevent memory leaks.
+     * APIMethod: destroy
+     * Clean up the protocol.
      */
      */
-    destroy: function () {
-        if(this.events) {
-            if(this.eventListeners) {
-                this.events.un(this.eventListeners);
-            }
-            this.events.destroy();
-            this.events = null;
-        }
-        this.eventListeners = null;
-
-        // eliminate circular references
-        if (this.handler) {
-            this.handler.destroy();
-            this.handler = null;
-        }
-        if(this.handlers) {
-            for(var key in this.handlers) {
-                if(this.handlers.hasOwnProperty(key) &&
-                   typeof this.handlers[key].destroy == "function") {
-                    this.handlers[key].destroy();
-                }
-            }
-            this.handlers = null;
-        }
-        if (this.map) {
-            this.map.removeControl(this);
-            this.map = null;
-        }
-        this.div = null;
+    destroy: function() {
+        this.options = null;
+        this.format = null;
     },
     },
-
-    /** 
-     * Method: setMap
-     * Set the map property for the control. This is done through an accessor
-     * so that subclasses can override this and take special action once 
-     * they have their map variable set. 
+    
+    /**
+     * APIMethod: read
+     * Construct a request for reading new features.
      *
      * Parameters:
      *
      * Parameters:
-     * map - {<OpenLayers.Map>} 
+     * options - {Object} Optional object for configuring the request.
+     *
+     * Returns:
+     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
+     * object, the same object will be passed to the callback function passed
+     * if one exists in the options object.
      */
      */
-    setMap: function(map) {
-        this.map = map;
-        if (this.handler) {
-            this.handler.setMap(map);
-        }
+    read: function(options) {
+        options = options || {};
+        options.filter = this.mergeWithDefaultFilter(options.filter);
     },
     },
-  
+    
+    
     /**
     /**
-     * Method: draw
-     * The draw method is called when the control is ready to be displayed
-     * on the page.  If a div has not been created one is created.  Controls
-     * with a visual component will almost always want to override this method 
-     * to customize the look of control. 
+     * APIMethod: create
+     * Construct a request for writing newly created features.
      *
      * Parameters:
      *
      * Parameters:
-     * px - {<OpenLayers.Pixel>} The top-left pixel position of the control
-     *      or null.
+     * features - {Array({<OpenLayers.Feature.Vector>})} or
+     *            {<OpenLayers.Feature.Vector>}
+     * options - {Object} Optional object for configuring the request.
      *
      * Returns:
      *
      * Returns:
-     * {DOMElement} A reference to the DIV DOMElement containing the control
+     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
+     * object, the same object will be passed to the callback function passed
+     * if one exists in the options object.
      */
      */
-    draw: function (px) {
-        if (this.div == null) {
-            this.div = OpenLayers.Util.createDiv(this.id);
-            this.div.className = this.displayClass;
-            if (!this.allowSelection) {
-                this.div.className += " olControlNoSelect";
-                this.div.setAttribute("unselectable", "on", 0);
-                this.div.onselectstart = OpenLayers.Function.False; 
-            }    
-            if (this.title != "") {
-                this.div.title = this.title;
-            }
-        }
-        if (px != null) {
-            this.position = px.clone();
-        }
-        this.moveTo(this.position);
-        return this.div;
+    create: function() {
     },
     },
-
+    
     /**
     /**
-     * Method: moveTo
-     * Sets the left and top style attributes to the passed in pixel 
-     * coordinates.
+     * APIMethod: update
+     * Construct a request updating modified features.
      *
      * Parameters:
      *
      * Parameters:
-     * px - {<OpenLayers.Pixel>}
+     * features - {Array({<OpenLayers.Feature.Vector>})} or
+     *            {<OpenLayers.Feature.Vector>}
+     * options - {Object} Optional object for configuring the request.
+     *
+     * Returns:
+     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
+     * object, the same object will be passed to the callback function passed
+     * if one exists in the options object.
      */
      */
-    moveTo: function (px) {
-        if ((px != null) && (this.div != null)) {
-            this.div.style.left = px.x + "px";
-            this.div.style.top = px.y + "px";
-        }
+    update: function() {
     },
     },
-
+    
     /**
     /**
-     * APIMethod: activate
-     * Explicitly activates a control and it's associated
-     * handler if one has been set.  Controls can be
-     * deactivated by calling the deactivate() method.
-     * 
+     * APIMethod: delete
+     * Construct a request deleting a removed feature.
+     *
+     * Parameters:
+     * feature - {<OpenLayers.Feature.Vector>}
+     * options - {Object} Optional object for configuring the request.
+     *
      * Returns:
      * Returns:
-     * {Boolean}  True if the control was successfully activated or
-     *            false if the control was already active.
+     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
+     * object, the same object will be passed to the callback function passed
+     * if one exists in the options object.
      */
      */
-    activate: function () {
-        if (this.active) {
-            return false;
-        }
-        if (this.handler) {
-            this.handler.activate();
-        }
-        this.active = true;
-        if(this.map) {
-            OpenLayers.Element.addClass(
-                this.map.viewPortDiv,
-                this.displayClass.replace(/ /g, "") + "Active"
-            );
-        }
-        this.events.triggerEvent("activate");
-        return true;
+    "delete": function() {
     },
     },
-    
+
     /**
     /**
-     * APIMethod: deactivate
-     * Deactivates a control and it's associated handler if any.  The exact
-     * effect of this depends on the control itself.
-     * 
+     * APIMethod: commit
+     * Go over the features and for each take action
+     * based on the feature state. Possible actions are create,
+     * update and delete.
+     *
+     * Parameters:
+     * features - {Array({<OpenLayers.Feature.Vector>})}
+     * options - {Object} Object whose possible keys are "create", "update",
+     *      "delete", "callback" and "scope", the values referenced by the
+     *      first three are objects as passed to the "create", "update", and
+     *      "delete" methods, the value referenced by the "callback" key is
+     *      a function which is called when the commit operation is complete
+     *      using the scope referenced by the "scope" key.
+     *
      * Returns:
      * Returns:
-     * {Boolean} True if the control was effectively deactivated or false
-     *           if the control was already inactive.
+     * {Array({<OpenLayers.Protocol.Response>})} An array of
+     * <OpenLayers.Protocol.Response> objects.
      */
      */
-    deactivate: function () {
-        if (this.active) {
-            if (this.handler) {
-                this.handler.deactivate();
-            }
-            this.active = false;
-            if(this.map) {
-                OpenLayers.Element.removeClass(
-                    this.map.viewPortDiv,
-                    this.displayClass.replace(/ /g, "") + "Active"
-                );
-            }
-            this.events.triggerEvent("deactivate");
-            return true;
-        }
-        return false;
+    commit: function() {
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Control"
+    /**
+     * Method: abort
+     * Abort an ongoing request.
+     *
+     * Parameters:
+     * response - {<OpenLayers.Protocol.Response>}
+     */
+    abort: function(response) {
+    },
+   
+    /**
+     * Method: createCallback
+     * Returns a function that applies the given public method with resp and
+     *     options arguments.
+     *
+     * Parameters:
+     * method - {Function} The method to be applied by the callback.
+     * response - {<OpenLayers.Protocol.Response>} The protocol response object.
+     * options - {Object} Options sent to the protocol method
+     */
+    createCallback: function(method, response, options) {
+        return OpenLayers.Function.bind(function() {
+            method.apply(this, [response, options]);
+        }, this);
+    },
+   
+    CLASS_NAME: "OpenLayers.Protocol" 
 });
 
 /**
 });
 
 /**
- * Constant: OpenLayers.Control.TYPE_BUTTON
- */
-OpenLayers.Control.TYPE_BUTTON = 1;
-
-/**
- * Constant: OpenLayers.Control.TYPE_TOGGLE
- */
-OpenLayers.Control.TYPE_TOGGLE = 2;
-
-/**
- * Constant: OpenLayers.Control.TYPE_TOOL
+ * Class: OpenLayers.Protocol.Response
+ * Protocols return Response objects to their users.
  */
  */
-OpenLayers.Control.TYPE_TOOL   = 3;
-/* ======================================================================
-    OpenLayers/Strategy.js
-   ====================================================================== */
+OpenLayers.Protocol.Response = OpenLayers.Class({
+    /**
+     * Property: code
+     * {Number} - OpenLayers.Protocol.Response.SUCCESS or
+     *            OpenLayers.Protocol.Response.FAILURE
+     */
+    code: null,
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
+    /**
+     * Property: requestType
+     * {String} The type of request this response corresponds to. Either
+     *      "create", "read", "update" or "delete".
+     */
+    requestType: null,
 
 
-/**
- * @requires OpenLayers/BaseTypes/Class.js
- */
+    /**
+     * Property: last
+     * {Boolean} - true if this is the last response expected in a commit,
+     * false otherwise, defaults to true.
+     */
+    last: true,
 
 
-/**
- * Class: OpenLayers.Strategy
- * Abstract vector layer strategy class.  Not to be instantiated directly.  Use
- *     one of the strategy subclasses instead.
- */
-OpenLayers.Strategy = OpenLayers.Class({
-    
     /**
     /**
-     * Property: layer
-     * {<OpenLayers.Layer.Vector>} The layer this strategy belongs to.
+     * Property: features
+     * {Array({<OpenLayers.Feature.Vector>})} or {<OpenLayers.Feature.Vector>}
+     * The features returned in the response by the server. Depending on the 
+     * protocol's read payload, either features or data will be populated.
      */
      */
-    layer: null,
-    
+    features: null,
+
     /**
     /**
-     * Property: options
-     * {Object} Any options sent to the constructor.
+     * Property: data
+     * {Object}
+     * The data returned in the response by the server. Depending on the 
+     * protocol's read payload, either features or data will be populated.
      */
      */
-    options: null,
+    data: null,
 
 
-    /** 
-     * Property: active 
-     * {Boolean} The control is active.
+    /**
+     * Property: reqFeatures
+     * {Array({<OpenLayers.Feature.Vector>})} or {<OpenLayers.Feature.Vector>}
+     * The features provided by the user and placed in the request by the
+     *      protocol.
      */
      */
-    active: null,
+    reqFeatures: null,
 
     /**
 
     /**
-     * Property: autoActivate
-     * {Boolean} The creator of the strategy can set autoActivate to false
-     *      to fully control when the protocol is activated and deactivated.
-     *      Defaults to true.
+     * Property: priv
      */
      */
-    autoActivate: true,
+    priv: null,
 
     /**
 
     /**
-     * Property: autoDestroy
-     * {Boolean} The creator of the strategy can set autoDestroy to false
-     *      to fully control when the strategy is destroyed. Defaults to
-     *      true.
+     * Property: error
+     * {Object} The error object in case a service exception was encountered.
      */
      */
-    autoDestroy: true,
+    error: null,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Strategy
-     * Abstract class for vector strategies.  Create instances of a subclass.
+     * Constructor: OpenLayers.Protocol.Response
      *
      * Parameters:
      * options - {Object} Optional object whose properties will be set on the
      *
      * Parameters:
      * options - {Object} Optional object whose properties will be set on the
@@ -13129,1521 +12762,1672 @@ OpenLayers.Strategy = OpenLayers.Class({
      */
     initialize: function(options) {
         OpenLayers.Util.extend(this, options);
      */
     initialize: function(options) {
         OpenLayers.Util.extend(this, options);
-        this.options = options;
-        // set the active property here, so that user cannot override it
-        this.active = false;
-    },
-    
-    /**
-     * APIMethod: destroy
-     * Clean up the strategy.
-     */
-    destroy: function() {
-        this.deactivate();
-        this.layer = null;
-        this.options = null;
     },
 
     /**
     },
 
     /**
-     * Method: setLayer
-     * Called to set the <layer> property.
-     *
-     * Parameters:
-     * layer - {<OpenLayers.Layer.Vector>}
-     */
-    setLayer: function(layer) {
-        this.layer = layer;
-    },
-    
-    /**
-     * Method: activate
-     * Activate the strategy.  Register any listeners, do appropriate setup.
+     * Method: success
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} True if the strategy was successfully activated or false if
-     *      the strategy was already active.
+     * {Boolean} - true on success, false otherwise
      */
      */
-    activate: function() {
-        if (!this.active) {
-            this.active = true;
-            return true;
-        }
-        return false;
+    success: function() {
+        return this.code > 0;
     },
     },
-    
-    /**
-     * Method: deactivate
-     * Deactivate the strategy.  Unregister any listeners, do appropriate
-     *     tear-down.
-     *
-     * Returns:
-     * {Boolean} True if the strategy was successfully deactivated or false if
-     *      the strategy was already inactive.
-     */
-    deactivate: function() {
-        if (this.active) {
-            this.active = false;
-            return true;
-        }
-        return false;
-    },
-   
-    CLASS_NAME: "OpenLayers.Strategy" 
+
+    CLASS_NAME: "OpenLayers.Protocol.Response"
 });
 });
+
+OpenLayers.Protocol.Response.SUCCESS = 1;
+OpenLayers.Protocol.Response.FAILURE = 0;
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Feature.js
+    OpenLayers/Protocol/WFS.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
+/**
+ * @requires OpenLayers/Protocol.js
+ */
 
 /**
 
 /**
- * @requires OpenLayers/BaseTypes/Class.js
- * @requires OpenLayers/Util.js
+ * Class: OpenLayers.Protocol.WFS
+ * Used to create a versioned WFS protocol.  Default version is 1.0.0.
+ *
+ * Returns:
+ * {<OpenLayers.Protocol>} A WFS protocol of the given version.
+ *
+ * Example:
+ * (code)
+ *     var protocol = new OpenLayers.Protocol.WFS({
+ *         version: "1.1.0",
+ *         url:  "http://demo.opengeo.org/geoserver/wfs",
+ *         featureType: "tasmania_roads",
+ *         featureNS: "http://www.openplans.org/topp",
+ *         geometryName: "the_geom"
+ *     });
+ * (end)
+ *
+ * See the protocols for specific WFS versions for more detail.
  */
  */
+OpenLayers.Protocol.WFS = function(options) {
+    options = OpenLayers.Util.applyDefaults(
+        options, OpenLayers.Protocol.WFS.DEFAULTS
+    );
+    var cls = OpenLayers.Protocol.WFS["v"+options.version.replace(/\./g, "_")];
+    if(!cls) {
+        throw "Unsupported WFS version: " + options.version;
+    }
+    return new cls(options);
+};
 
 /**
 
 /**
- * Class: OpenLayers.Feature
- * Features are combinations of geography and attributes. The OpenLayers.Feature
- *     class specifically combines a marker and a lonlat.
+ * Function: fromWMSLayer
+ * Convenience function to create a WFS protocol from a WMS layer.  This makes
+ *     the assumption that a WFS requests can be issued at the same URL as
+ *     WMS requests and that a WFS featureType exists with the same name as the
+ *     WMS layer.
+ *     
+ * This function is designed to auto-configure <url>, <featureType>,
+ *     <featurePrefix> and <srsName> for WFS <version> 1.1.0. Note that
+ *     srsName matching with the WMS layer will not work with WFS 1.0.0.
+ * 
+ * Parameters:
+ * layer - {<OpenLayers.Layer.WMS>} WMS layer that has a matching WFS
+ *     FeatureType at the same server url with the same typename.
+ * options - {Object} Default properties to be set on the protocol.
+ *
+ * Returns:
+ * {<OpenLayers.Protocol.WFS>}
  */
  */
-OpenLayers.Feature = OpenLayers.Class({
+OpenLayers.Protocol.WFS.fromWMSLayer = function(layer, options) {
+    var typeName, featurePrefix;
+    var param = layer.params["LAYERS"];
+    var parts = (OpenLayers.Util.isArray(param) ? param[0] : param).split(":");
+    if(parts.length > 1) {
+        featurePrefix = parts[0];
+    }
+    typeName = parts.pop();
+    var protocolOptions = {
+        url: layer.url,
+        featureType: typeName,
+        featurePrefix: featurePrefix,
+        srsName: layer.projection && layer.projection.getCode() ||
+                 layer.map && layer.map.getProjectionObject().getCode(),
+        version: "1.1.0"
+    };
+    return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(
+        options, protocolOptions
+    ));
+};
 
 
-    /** 
-     * Property: layer 
-     * {<OpenLayers.Layer>} 
-     */
-    layer: null,
+/**
+ * Constant: OpenLayers.Protocol.WFS.DEFAULTS
+ */
+OpenLayers.Protocol.WFS.DEFAULTS = {
+    "version": "1.0.0"
+};
+/* ======================================================================
+    OpenLayers/Protocol/WFS/v1.js
+   ====================================================================== */
 
 
-    /** 
-     * Property: id 
-     * {String} 
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Protocol/WFS.js
+ */
+
+/**
+ * Class: OpenLayers.Protocol.WFS.v1
+ * Abstract class for for v1.0.0 and v1.1.0 protocol.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Protocol>
+ */
+OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
+    
+    /**
+     * Property: version
+     * {String} WFS version number.
      */
      */
-    id: null,
+    version: null,
     
     
-    /** 
-     * Property: lonlat 
-     * {<OpenLayers.LonLat>} 
+    /**
+     * Property: srsName
+     * {String} Name of spatial reference system.  Default is "EPSG:4326".
      */
      */
-    lonlat: null,
-
-    /** 
-     * Property: data 
-     * {Object} 
+    srsName: "EPSG:4326",
+    
+    /**
+     * Property: featureType
+     * {String} Local feature typeName.
      */
      */
-    data: null,
-
-    /** 
-     * Property: marker 
-     * {<OpenLayers.Marker>} 
+    featureType: null,
+    
+    /**
+     * Property: featureNS
+     * {String} Feature namespace.
      */
      */
-    marker: null,
+    featureNS: null,
+    
+    /**
+     * Property: geometryName
+     * {String} Name of the geometry attribute for features.  Default is
+     *     "the_geom" for WFS <version> 1.0, and null for higher versions.
+     */
+    geometryName: "the_geom",
 
     /**
 
     /**
-     * APIProperty: popupClass
-     * {<OpenLayers.Class>} The class which will be used to instantiate
-     *     a new Popup. Default is <OpenLayers.Popup.Anchored>.
+     * Property: maxFeatures
+     * {Integer} Optional maximum number of features to retrieve.
      */
      */
-    popupClass: null,
+    
+    /**
+     * Property: schema
+     * {String} Optional schema location that will be included in the
+     *     schemaLocation attribute value.  Note that the feature type schema
+     *     is required for a strict XML validator (on transactions with an
+     *     insert for example), but is *not* required by the WFS specification
+     *     (since the server is supposed to know about feature type schemas).
+     */
+    schema: null,
 
 
-    /** 
-     * Property: popup 
-     * {<OpenLayers.Popup>} 
+    /**
+     * Property: featurePrefix
+     * {String} Namespace alias for feature type.  Default is "feature".
      */
      */
-    popup: null,
+    featurePrefix: "feature",
+    
+    /**
+     * Property: formatOptions
+     * {Object} Optional options for the format.  If a format is not provided,
+     *     this property can be used to extend the default format options.
+     */
+    formatOptions: null,
 
     /** 
 
     /** 
-     * Constructor: OpenLayers.Feature
-     * Constructor for features.
+     * Property: readFormat 
+     * {<OpenLayers.Format>} For WFS requests it is possible to get a  
+     *     different output format than GML. In that case, we cannot parse  
+     *     the response with the default format (WFST) and we need a different 
+     *     format for reading. 
+     */ 
+    readFormat: null,
+    
+    /**
+     * Property: readOptions
+     * {Object} Optional object to pass to format's read.
+     */
+    readOptions: null,
+    
+    /**
+     * Constructor: OpenLayers.Protocol.WFS
+     * A class for giving layers WFS protocol.
      *
      * Parameters:
      *
      * Parameters:
-     * layer - {<OpenLayers.Layer>} 
-     * lonlat - {<OpenLayers.LonLat>} 
-     * data - {Object} 
-     * 
-     * Returns:
-     * {<OpenLayers.Feature>}
-     */
-    initialize: function(layer, lonlat, data) {
-        this.layer = layer;
-        this.lonlat = lonlat;
-        this.data = (data != null) ? data : {};
-        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); 
-    },
-
-    /** 
-     * Method: destroy
-     * nullify references to prevent circular references and memory leaks
+     * options - {Object} Optional object whose properties will be set on the
+     *     instance.
+     *
+     * Valid options properties:
+     * url - {String} URL to send requests to (required).
+     * featureType - {String} Local (without prefix) feature typeName (required).
+     * featureNS - {String} Feature namespace (required, but can be autodetected
+     *     during the first query if GML is used as readFormat and
+     *     featurePrefix is provided and matches the prefix used by the server
+     *     for this featureType).
+     * featurePrefix - {String} Feature namespace alias (optional - only used
+     *     for writing if featureNS is provided).  Default is 'feature'.
+     * geometryName - {String} Name of geometry attribute.  The default is
+     *     'the_geom' for WFS <version> 1.0, and null for higher versions. If
+     *     null, it will be set to the name of the first geometry found in the
+     *     first read operation.
+     * multi - {Boolean} If set to true, geometries will be casted to Multi
+     *     geometries before they are written in a transaction. No casting will
+     *     be done when reading features.
      */
      */
-    destroy: function() {
-
-        //remove the popup from the map
-        if ((this.layer != null) && (this.layer.map != null)) {
-            if (this.popup != null) {
-                this.layer.map.removePopup(this.popup);
-            }
-        }
-        // remove the marker from the layer
-        if (this.layer != null && this.marker != null) {
-            this.layer.removeMarker(this.marker);
-        }
-
-        this.layer = null;
-        this.id = null;
-        this.lonlat = null;
-        this.data = null;
-        if (this.marker != null) {
-            this.destroyMarker(this.marker);
-            this.marker = null;
+    initialize: function(options) {
+        OpenLayers.Protocol.prototype.initialize.apply(this, [options]);
+        if(!options.format) {
+            this.format = OpenLayers.Format.WFST(OpenLayers.Util.extend({
+                version: this.version,
+                featureType: this.featureType,
+                featureNS: this.featureNS,
+                featurePrefix: this.featurePrefix,
+                geometryName: this.geometryName,
+                srsName: this.srsName,
+                schema: this.schema
+            }, this.formatOptions));
         }
         }
-        if (this.popup != null) {
-            this.destroyPopup(this.popup);
-            this.popup = null;
+        if (!options.geometryName && parseFloat(this.format.version) > 1.0) {
+            this.setGeometryName(null);
         }
     },
     
     /**
         }
     },
     
     /**
-     * Method: onScreen
-     * 
-     * Returns:
-     * {Boolean} Whether or not the feature is currently visible on screen
-     *           (based on its 'lonlat' property)
+     * APIMethod: destroy
+     * Clean up the protocol.
      */
      */
-    onScreen:function() {
-        
-        var onScreen = false;
-        if ((this.layer != null) && (this.layer.map != null)) {
-            var screenBounds = this.layer.map.getExtent();
-            onScreen = screenBounds.containsLonLat(this.lonlat);
-        }    
-        return onScreen;
+    destroy: function() {
+        if(this.options && !this.options.format) {
+            this.format.destroy();
+        }
+        this.format = null;
+        OpenLayers.Protocol.prototype.destroy.apply(this);
     },
     },
-    
 
     /**
 
     /**
-     * Method: createMarker
-     * Based on the data associated with the Feature, create and return a marker object.
+     * APIMethod: read
+     * Construct a request for reading new features.  Since WFS splits the
+     *     basic CRUD operations into GetFeature requests (for read) and
+     *     Transactions (for all others), this method does not make use of the
+     *     format's read method (that is only about reading transaction
+     *     responses).
      *
      *
-     * Returns: 
-     * {<OpenLayers.Marker>} A Marker Object created from the 'lonlat' and 'icon' properties
-     *          set in this.data. If no 'lonlat' is set, returns null. If no
-     *          'icon' is set, OpenLayers.Marker() will load the default image.
-     *          
-     *          Note - this.marker is set to return value
-     * 
+     * Parameters:
+     * options - {Object} Options for the read operation, in addition to the
+     *     options set on the instance (options set here will take precedence).
+     *
+     * To use a configured protocol to get e.g. a WFS hit count, applications
+     * could do the following:
+     *
+     * (code)
+     * protocol.read({
+     *     readOptions: {output: "object"},
+     *     resultType: "hits",
+     *     maxFeatures: null,
+     *     callback: function(resp) {
+     *         // process resp.numberOfFeatures here
+     *     }
+     * });
+     * (end)
+     *
+     * To use a configured protocol to use WFS paging (if supported by the
+     * server), applications could do the following:
+     *
+     * (code)
+     * protocol.read({
+     *     startIndex: 0,
+     *     count: 50
+     * });
+     * (end)
+     *
+     * To limit the attributes returned by the GetFeature request, applications
+     * can use the propertyNames option to specify the properties to include in
+     * the response:
+     *
+     * (code)
+     * protocol.read({
+     *     propertyNames: ["DURATION", "INTENSITY"]
+     * });
+     * (end)
      */
      */
-    createMarker: function() {
+    read: function(options) {
+        OpenLayers.Protocol.prototype.read.apply(this, arguments);
+        options = OpenLayers.Util.extend({}, options);
+        OpenLayers.Util.applyDefaults(options, this.options || {});
+        var response = new OpenLayers.Protocol.Response({requestType: "read"});
+        
+        var data = OpenLayers.Format.XML.prototype.write.apply(
+            this.format, [this.format.writeNode("wfs:GetFeature", options)]
+        );
 
 
-        if (this.lonlat != null) {
-            this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);
-        }
-        return this.marker;
+        response.priv = OpenLayers.Request.POST({
+            url: options.url,
+            callback: this.createCallback(this.handleRead, response, options),
+            params: options.params,
+            headers: options.headers,
+            data: data
+        });
+
+        return response;
     },
 
     /**
     },
 
     /**
-     * Method: destroyMarker
-     * Destroys marker.
-     * If user overrides the createMarker() function, s/he should be able
-     *   to also specify an alternative function for destroying it
+     * APIMethod: setFeatureType
+     * Change the feature type on the fly.
+     *
+     * Parameters:
+     * featureType - {String} Local (without prefix) feature typeName.
      */
      */
-    destroyMarker: function() {
-        this.marker.destroy();  
+    setFeatureType: function(featureType) {
+        this.featureType = featureType;
+        this.format.featureType = featureType;
     },
     },
-
     /**
     /**
-     * Method: createPopup
-     * Creates a popup object created from the 'lonlat', 'popupSize',
-     *     and 'popupContentHTML' properties set in this.data. It uses
-     *     this.marker.icon as default anchor. 
-     *  
-     *  If no 'lonlat' is set, returns null. 
-     *  If no this.marker has been created, no anchor is sent.
+     * APIMethod: setGeometryName
+     * Sets the geometryName option after instantiation.
      *
      *
-     *  Note - the returned popup object is 'owned' by the feature, so you
-     *      cannot use the popup's destroy method to discard the popup.
-     *      Instead, you must use the feature's destroyPopup
-     * 
-     *  Note - this.popup is set to return value
-     * 
-     * Parameters: 
-     * closeBox - {Boolean} create popup with closebox or not
-     * 
-     * Returns:
-     * {<OpenLayers.Popup>} Returns the created popup, which is also set
-     *     as 'popup' property of this feature. Will be of whatever type
-     *     specified by this feature's 'popupClass' property, but must be
-     *     of type <OpenLayers.Popup>.
-     * 
+     * Parameters:
+     * geometryName - {String} Name of geometry attribute.
      */
      */
-    createPopup: function(closeBox) {
-
-        if (this.lonlat != null) {
-            if (!this.popup) {
-                var anchor = (this.marker) ? this.marker.icon : null;
-                var popupClass = this.popupClass ? 
-                    this.popupClass : OpenLayers.Popup.Anchored;
-                this.popup = new popupClass(this.id + "_popup", 
-                                            this.lonlat,
-                                            this.data.popupSize,
-                                            this.data.popupContentHTML,
-                                            anchor, 
-                                            closeBox); 
-            }    
-            if (this.data.overflow != null) {
-                this.popup.contentDiv.style.overflow = this.data.overflow;
-            }    
-            
-            this.popup.feature = this;
-        }        
-        return this.popup;
+    setGeometryName: function(geometryName) {
+        this.geometryName = geometryName;
+        this.format.geometryName = geometryName;
     },
     },
-
     
     /**
     
     /**
-     * Method: destroyPopup
-     * Destroys the popup created via createPopup.
+     * Method: handleRead
+     * Deal with response from the read request.
      *
      *
-     * As with the marker, if user overrides the createPopup() function, s/he 
-     *   should also be able to override the destruction
+     * Parameters:
+     * response - {<OpenLayers.Protocol.Response>} The response object to pass
+     *     to the user callback.
+     * options - {Object} The user options passed to the read call.
      */
      */
-    destroyPopup: function() {
-        if (this.popup) {
-            this.popup.feature = null;
-            this.popup.destroy();
-            this.popup = null;
-        }    
-    },
-
-    CLASS_NAME: "OpenLayers.Feature"
-});
-/* ======================================================================
-    OpenLayers/Feature/Vector.js
-   ====================================================================== */
+    handleRead: function(response, options) {
+        options = OpenLayers.Util.extend({}, options);
+        OpenLayers.Util.applyDefaults(options, this.options);
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-// TRASH THIS
-OpenLayers.State = {
-    /** states */
-    UNKNOWN: 'Unknown',
-    INSERT: 'Insert',
-    UPDATE: 'Update',
-    DELETE: 'Delete'
-};
-
-/**
- * @requires OpenLayers/Feature.js
- * @requires OpenLayers/Util.js
- */
-
-/**
- * Class: OpenLayers.Feature.Vector
- * Vector features use the OpenLayers.Geometry classes as geometry description.
- * They have an 'attributes' property, which is the data object, and a 'style'
- * property, the default values of which are defined in the 
- * <OpenLayers.Feature.Vector.style> objects.
- * 
- * Inherits from:
- *  - <OpenLayers.Feature>
- */
-OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
-
-    /** 
-     * Property: fid 
-     * {String} 
-     */
-    fid: null,
-    
-    /** 
-     * APIProperty: geometry 
-     * {<OpenLayers.Geometry>} 
-     */
-    geometry: null,
-
-    /** 
-     * APIProperty: attributes 
-     * {Object} This object holds arbitrary, serializable properties that
-     *     describe the feature.
-     */
-    attributes: null,
+        if(options.callback) {
+            var request = response.priv;
+            if(request.status >= 200 && request.status < 300) {
+                // success
+                var result = this.parseResponse(request, options.readOptions);
+                if (result && result.success !== false) { 
+                    if (options.readOptions && options.readOptions.output == "object") {
+                        OpenLayers.Util.extend(response, result);
+                    } else {
+                        response.features = result;
+                    }
+                    response.code = OpenLayers.Protocol.Response.SUCCESS;
+                } else {
+                    // failure (service exception)
+                    response.code = OpenLayers.Protocol.Response.FAILURE;
+                    response.error = result;
+                }
+            } else {
+                // failure
+                response.code = OpenLayers.Protocol.Response.FAILURE;
+            }
+            options.callback.call(options.scope, response);
+        }
+    },
 
     /**
 
     /**
-     * Property: bounds
-     * {<OpenLayers.Bounds>} The box bounding that feature's geometry, that
-     *     property can be set by an <OpenLayers.Format> object when
-     *     deserializing the feature, so in most cases it represents an
-     *     information set by the server. 
-     */
-    bounds: null,
-
-    /** 
-     * Property: state 
-     * {String} 
-     */
-    state: null,
-    
-    /** 
-     * APIProperty: style 
-     * {Object} 
+     * Method: parseResponse
+     * Read HTTP response body and return features
+     *
+     * Parameters:
+     * request - {XMLHttpRequest} The request object
+     * options - {Object} Optional object to pass to format's read
+     *
+     * Returns:
+     * {Object} or {Array({<OpenLayers.Feature.Vector>})} or
+     *     {<OpenLayers.Feature.Vector>} 
+     * An object with a features property, an array of features or a single 
+     * feature.
      */
      */
-    style: null,
+    parseResponse: function(request, options) {
+        var doc = request.responseXML;
+        if(!doc || !doc.documentElement) {
+            doc = request.responseText;
+        }
+        if(!doc || doc.length <= 0) {
+            return null;
+        }
+        var result = (this.readFormat !== null) ? this.readFormat.read(doc) : 
+            this.format.read(doc, options);
+        if (!this.featureNS) {
+            var format = this.readFormat || this.format;
+            this.featureNS = format.featureNS;
+            // no need to auto-configure again on subsequent reads
+            format.autoConfig = false;
+            if (!this.geometryName) {
+                this.setGeometryName(format.geometryName);
+            }
+        }
+        return result;
+    },
 
     /**
 
     /**
-     * APIProperty: url
-     * {String} If this property is set it will be taken into account by
-     *     {<OpenLayers.HTTP>} when upadting or deleting the feature.
-     */
-    url: null,
-    
-    /**
-     * Property: renderIntent
-     * {String} rendering intent currently being used
-     */
-    renderIntent: "default",
-    
-    /**
-     * APIProperty: modified
-     * {Object} An object with the originals of the geometry and attributes of
-     * the feature, if they were changed. Currently this property is only read
-     * by <OpenLayers.Format.WFST.v1>, and written by
-     * <OpenLayers.Control.ModifyFeature>, which sets the geometry property.
-     * Applications can set the originals of modified attributes in the
-     * attributes property. Note that applications have to check if this
-     * object and the attributes property is already created before using it.
-     * After a change made with ModifyFeature, this object could look like
-     *
-     * (code)
-     * {
-     *     geometry: >Object
-     * }
-     * (end)
+     * Method: commit
+     * Given a list of feature, assemble a batch request for update, create,
+     *     and delete transactions.  A commit call on the prototype amounts
+     *     to writing a WFS transaction - so the write method on the format
+     *     is used.
      *
      *
-     * When an application has made changes to feature attributes, it could
-     * have set the attributes to something like this:
+     * Parameters:
+     * features - {Array(<OpenLayers.Feature.Vector>)}
+     * options - {Object}
      *
      *
-     * (code)
-     * {
-     *     attributes: {
-     *         myAttribute: "original"
-     *     }
-     * }
-     * (end)
+     * Valid options properties:
+     * nativeElements - {Array({Object})} Array of objects with information for writing
+     * out <Native> elements, these objects have vendorId, safeToIgnore and
+     * value properties. The <Native> element is intended to allow access to 
+     * vendor specific capabilities of any particular web feature server or 
+     * datastore.
      *
      *
-     * Note that <OpenLayers.Format.WFST.v1> only checks for truthy values in
-     * *modified.geometry* and the attribute names in *modified.attributes*,
-     * but it is recommended to set the original values (and not just true) as
-     * attribute value, so applications could use this information to undo
-     * changes.
+     * Returns:
+     * {<OpenLayers.Protocol.Response>} A response object with a features
+     *     property containing any insertIds and a priv property referencing
+     *     the XMLHttpRequest object.
      */
      */
-    modified: null,
+    commit: function(features, options) {
 
 
-    /** 
-     * Constructor: OpenLayers.Feature.Vector
-     * Create a vector feature. 
-     * 
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>} The geometry that this feature
-     *     represents.
-     * attributes - {Object} An optional object that will be mapped to the
-     *     <attributes> property. 
-     * style - {Object} An optional style object.
-     */
-    initialize: function(geometry, attributes, style) {
-        OpenLayers.Feature.prototype.initialize.apply(this,
-                                                      [null, null, attributes]);
-        this.lonlat = null;
-        this.geometry = geometry ? geometry : null;
-        this.state = null;
-        this.attributes = {};
-        if (attributes) {
-            this.attributes = OpenLayers.Util.extend(this.attributes,
-                                                     attributes);
-        }
-        this.style = style ? style : null; 
+        options = OpenLayers.Util.extend({}, options);
+        OpenLayers.Util.applyDefaults(options, this.options);
+        
+        var response = new OpenLayers.Protocol.Response({
+            requestType: "commit",
+            reqFeatures: features
+        });
+        response.priv = OpenLayers.Request.POST({
+            url: options.url,
+            headers: options.headers,
+            data: this.format.write(features, options),
+            callback: this.createCallback(this.handleCommit, response, options)
+        });
+        
+        return response;
     },
     
     },
     
-    /** 
-     * Method: destroy
-     * nullify references to prevent circular references and memory leaks
+    /**
+     * Method: handleCommit
+     * Called when the commit request returns.
+     * 
+     * Parameters:
+     * response - {<OpenLayers.Protocol.Response>} The response object to pass
+     *     to the user callback.
+     * options - {Object} The user options passed to the commit call.
      */
      */
-    destroy: function() {
-        if (this.layer) {
-            this.layer.removeFeatures(this);
-            this.layer = null;
-        }
+    handleCommit: function(response, options) {
+        if(options.callback) {
+            var request = response.priv;
+
+            // ensure that we have an xml doc
+            var data = request.responseXML;
+            if(!data || !data.documentElement) {
+                data = request.responseText;
+            }
             
             
-        this.geometry = null;
-        this.modified = null;
-        OpenLayers.Feature.prototype.destroy.apply(this, arguments);
+            var obj = this.format.read(data) || {};
+            
+            response.insertIds = obj.insertIds || [];
+            if (obj.success) {
+                response.code = OpenLayers.Protocol.Response.SUCCESS;
+            } else {
+                response.code = OpenLayers.Protocol.Response.FAILURE;
+                response.error = obj;
+            }
+            options.callback.call(options.scope, response);
+        }
     },
     
     /**
     },
     
     /**
-     * Method: clone
-     * Create a clone of this vector feature.  Does not set any non-standard
-     *     properties.
-     *
-     * Returns:
-     * {<OpenLayers.Feature.Vector>} An exact clone of this vector feature.
+     * Method: filterDelete
+     * Send a request that deletes all features by their filter.
+     * 
+     * Parameters:
+     * filter - {<OpenLayers.Filter>} filter
      */
      */
-    clone: function () {
-        return new OpenLayers.Feature.Vector(
-            this.geometry ? this.geometry.clone() : null,
-            this.attributes,
-            this.style);
+    filterDelete: function(filter, options) {
+        options = OpenLayers.Util.extend({}, options);
+        OpenLayers.Util.applyDefaults(options, this.options);    
+        
+        var response = new OpenLayers.Protocol.Response({
+            requestType: "commit"
+        });    
+        
+        var root = this.format.createElementNSPlus("wfs:Transaction", {
+            attributes: {
+                service: "WFS",
+                version: this.version
+            }
+        });
+        
+        var deleteNode = this.format.createElementNSPlus("wfs:Delete", {
+            attributes: {
+                typeName: (options.featureNS ? this.featurePrefix + ":" : "") +
+                    options.featureType
+            }
+        });       
+        
+        if(options.featureNS) {
+            deleteNode.setAttribute("xmlns:" + this.featurePrefix, options.featureNS);
+        }
+        var filterNode = this.format.writeNode("ogc:Filter", filter);
+        
+        deleteNode.appendChild(filterNode);
+        
+        root.appendChild(deleteNode);
+        
+        var data = OpenLayers.Format.XML.prototype.write.apply(
+            this.format, [root]
+        );
+        
+        return OpenLayers.Request.POST({
+            url: this.url,
+            callback : options.callback || function(){},
+            data: data
+        });   
+        
     },
 
     /**
     },
 
     /**
-     * Method: onScreen
-     * Determine whether the feature is within the map viewport.  This method
-     *     tests for an intersection between the geometry and the viewport
-     *     bounds.  If a more effecient but less precise geometry bounds
-     *     intersection is desired, call the method with the boundsOnly
-     *     parameter true.
+     * Method: abort
+     * Abort an ongoing request, the response object passed to
+     * this method must come from this protocol (as a result
+     * of a read, or commit operation).
      *
      * Parameters:
      *
      * Parameters:
-     * boundsOnly - {Boolean} Only test whether a feature's bounds intersects
-     *     the viewport bounds.  Default is false.  If false, the feature's
-     *     geometry must intersect the viewport for onScreen to return true.
-     * 
-     * Returns:
-     * {Boolean} The feature is currently visible on screen (optionally
-     *     based on its bounds if boundsOnly is true).
+     * response - {<OpenLayers.Protocol.Response>}
      */
      */
-    onScreen:function(boundsOnly) {
-        var onScreen = false;
-        if(this.layer && this.layer.map) {
-            var screenBounds = this.layer.map.getExtent();
-            if(boundsOnly) {
-                var featureBounds = this.geometry.getBounds();
-                onScreen = screenBounds.intersectsBounds(featureBounds);
-            } else {
-                var screenPoly = screenBounds.toGeometry();
-                onScreen = screenPoly.intersects(this.geometry);
-            }
-        }    
-        return onScreen;
+    abort: function(response) {
+        if (response) {
+            response.priv.abort();
+        }
     },
     },
+  
+    CLASS_NAME: "OpenLayers.Protocol.WFS.v1" 
+});
+/* ======================================================================
+    OpenLayers/Format.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Util.js
+ */
 
 
+/**
+ * Class: OpenLayers.Format
+ * Base class for format reading/writing a variety of formats.  Subclasses
+ *     of OpenLayers.Format are expected to have read and write methods.
+ */
+OpenLayers.Format = OpenLayers.Class({
+    
     /**
     /**
-     * Method: getVisibility
-     * Determine whether the feature is displayed or not. It may not displayed
-     *     because:
-     *     - its style display property is set to 'none',
-     *     - it doesn't belong to any layer,
-     *     - the styleMap creates a symbolizer with display property set to 'none'
-     *          for it,
-     *     - the layer which it belongs to is not visible.
-     * 
-     * Returns:
-     * {Boolean} The feature is currently displayed.
+     * Property: options
+     * {Object} A reference to options passed to the constructor.
      */
      */
-    getVisibility: function() {
-        return !(this.style && this.style.display == 'none' ||
-                 !this.layer ||
-                 this.layer && this.layer.styleMap &&
-                 this.layer.styleMap.createSymbolizer(this, this.renderIntent).display == 'none' ||
-                 this.layer && !this.layer.getVisibility());
-    },
+    options: null,
     
     /**
     
     /**
-     * Method: createMarker
-     * HACK - we need to decide if all vector features should be able to
-     *     create markers
-     * 
-     * Returns:
-     * {<OpenLayers.Marker>} For now just returns null
+     * APIProperty: externalProjection
+     * {<OpenLayers.Projection>} When passed a externalProjection and
+     *     internalProjection, the format will reproject the geometries it
+     *     reads or writes. The externalProjection is the projection used by
+     *     the content which is passed into read or which comes out of write.
+     *     In order to reproject, a projection transformation function for the
+     *     specified projections must be available. This support may be 
+     *     provided via proj4js or via a custom transformation function. See
+     *     {<OpenLayers.Projection.addTransform>} for more information on
+     *     custom transformations.
      */
      */
-    createMarker: function() {
-        return null;
-    },
+    externalProjection: null,
 
     /**
 
     /**
-     * Method: destroyMarker
-     * HACK - we need to decide if all vector features should be able to
-     *     delete markers
-     * 
-     * If user overrides the createMarker() function, s/he should be able
-     *   to also specify an alternative function for destroying it
+     * APIProperty: internalProjection
+     * {<OpenLayers.Projection>} When passed a externalProjection and
+     *     internalProjection, the format will reproject the geometries it
+     *     reads or writes. The internalProjection is the projection used by
+     *     the geometries which are returned by read or which are passed into
+     *     write.  In order to reproject, a projection transformation function
+     *     for the specified projections must be available. This support may be
+     *     provided via proj4js or via a custom transformation function. See
+     *     {<OpenLayers.Projection.addTransform>} for more information on
+     *     custom transformations.
      */
      */
-    destroyMarker: function() {
-        // pass
-    },
+    internalProjection: null,
 
     /**
 
     /**
-     * Method: createPopup
-     * HACK - we need to decide if all vector features should be able to
-     *     create popups
-     * 
-     * Returns:
-     * {<OpenLayers.Popup>} For now just returns null
+     * APIProperty: data
+     * {Object} When <keepData> is true, this is the parsed string sent to
+     *     <read>.
      */
      */
-    createPopup: function() {
-        return null;
-    },
+    data: null,
 
     /**
 
     /**
-     * Method: atPoint
-     * Determins whether the feature intersects with the specified location.
-     * 
-     * Parameters: 
-     * lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
-     *     object with a 'lon' and 'lat' properties.
-     * toleranceLon - {float} Optional tolerance in Geometric Coords
-     * toleranceLat - {float} Optional tolerance in Geographic Coords
-     * 
+     * APIProperty: keepData
+     * {Object} Maintain a reference (<data>) to the most recently read data.
+     *     Default is false.
+     */
+    keepData: false,
+
+    /**
+     * Constructor: OpenLayers.Format
+     * Instances of this class are not useful.  See one of the subclasses.
+     *
+     * Parameters:
+     * options - {Object} An optional object with properties to set on the
+     *           format
+     *
+     * Valid options:
+     * keepData - {Boolean} If true, upon <read>, the data property will be
+     *     set to the parsed object (e.g. the json or xml object).
+     *
      * Returns:
      * Returns:
-     * {Boolean} Whether or not the feature is at the specified location
+     * An instance of OpenLayers.Format
      */
      */
-    atPoint: function(lonlat, toleranceLon, toleranceLat) {
-        var atPoint = false;
-        if(this.geometry) {
-            atPoint = this.geometry.atPoint(lonlat, toleranceLon, 
-                                                    toleranceLat);
-        }
-        return atPoint;
+    initialize: function(options) {
+        OpenLayers.Util.extend(this, options);
+        this.options = options;
     },
     },
-
+    
     /**
     /**
-     * Method: destroyPopup
-     * HACK - we need to decide if all vector features should be able to
-     * delete popups
+     * APIMethod: destroy
+     * Clean up.
      */
      */
-    destroyPopup: function() {
-        // pass
+    destroy: function() {
     },
 
     /**
     },
 
     /**
-     * Method: move
-     * Moves the feature and redraws it at its new location
-     *
+     * Method: read
+     * Read data from a string, and return an object whose type depends on the
+     * subclass. 
+     * 
      * Parameters:
      * Parameters:
-     * location - {<OpenLayers.LonLat> or <OpenLayers.Pixel>} the
-     *         location to which to move the feature.
+     * data - {string} Data to read/parse.
+     *
+     * Returns:
+     * Depends on the subclass
      */
      */
-    move: function(location) {
-
-        if(!this.layer || !this.geometry.move){
-            //do nothing if no layer or immoveable geometry
-            return undefined;
-        }
-
-        var pixel;
-        if (location.CLASS_NAME == "OpenLayers.LonLat") {
-            pixel = this.layer.getViewPortPxFromLonLat(location);
-        } else {
-            pixel = location;
-        }
-        
-        var lastPixel = this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());
-        var res = this.layer.map.getResolution();
-        this.geometry.move(res * (pixel.x - lastPixel.x),
-                           res * (lastPixel.y - pixel.y));
-        this.layer.drawFeature(this);
-        return lastPixel;
+    read: function(data) {
+        throw new Error('Read not implemented.');
     },
     
     /**
     },
     
     /**
-     * Method: toState
-     * Sets the new state
+     * Method: write
+     * Accept an object, and return a string. 
      *
      * Parameters:
      *
      * Parameters:
-     * state - {String} 
+     * object - {Object} Object to be serialized
+     *
+     * Returns:
+     * {String} A string representation of the object.
      */
      */
-    toState: function(state) {
-        if (state == OpenLayers.State.UPDATE) {
-            switch (this.state) {
-                case OpenLayers.State.UNKNOWN:
-                case OpenLayers.State.DELETE:
-                    this.state = state;
-                    break;
-                case OpenLayers.State.UPDATE:
-                case OpenLayers.State.INSERT:
-                    break;
-            }
-        } else if (state == OpenLayers.State.INSERT) {
-            switch (this.state) {
-                case OpenLayers.State.UNKNOWN:
-                    break;
-                default:
-                    this.state = state;
-                    break;
-            }
-        } else if (state == OpenLayers.State.DELETE) {
-            switch (this.state) {
-                case OpenLayers.State.INSERT:
-                    // the feature should be destroyed
-                    break;
-                case OpenLayers.State.DELETE:
-                    break;
-                case OpenLayers.State.UNKNOWN:
-                case OpenLayers.State.UPDATE:
-                    this.state = state;
-                    break;
-            }
-        } else if (state == OpenLayers.State.UNKNOWN) {
-            this.state = state;
-        }
-    },
-    
-    CLASS_NAME: "OpenLayers.Feature.Vector"
-});
-
-
-/**
- * Constant: OpenLayers.Feature.Vector.style
- * OpenLayers features can have a number of style attributes. The 'default' 
- *     style will typically be used if no other style is specified. These
- *     styles correspond for the most part, to the styling properties defined
- *     by the SVG standard. 
- *     Information on fill properties: http://www.w3.org/TR/SVG/painting.html#FillProperties
- *     Information on stroke properties: http://www.w3.org/TR/SVG/painting.html#StrokeProperties
- *
- * Symbolizer properties:
- * fill - {Boolean} Set to false if no fill is desired.
- * fillColor - {String} Hex fill color.  Default is "#ee9900".
- * fillOpacity - {Number} Fill opacity (0-1).  Default is 0.4 
- * stroke - {Boolean} Set to false if no stroke is desired.
- * strokeColor - {String} Hex stroke color.  Default is "#ee9900".
- * strokeOpacity - {Number} Stroke opacity (0-1).  Default is 1.
- * strokeWidth - {Number} Pixel stroke width.  Default is 1.
- * strokeLinecap - {String} Stroke cap type.  Default is "round".  [butt | round | square]
- * strokeDashstyle - {String} Stroke dash style.  Default is "solid". [dot | dash | dashdot | longdash | longdashdot | solid]
- * graphic - {Boolean} Set to false if no graphic is desired.
- * pointRadius - {Number} Pixel point radius.  Default is 6.
- * pointerEvents - {String}  Default is "visiblePainted".
- * cursor - {String} Default is "".
- * externalGraphic - {String} Url to an external graphic that will be used for rendering points.
- * graphicWidth - {Number} Pixel width for sizing an external graphic.
- * graphicHeight - {Number} Pixel height for sizing an external graphic.
- * graphicOpacity - {Number} Opacity (0-1) for an external graphic.
- * graphicXOffset - {Number} Pixel offset along the positive x axis for displacing an external graphic.
- * graphicYOffset - {Number} Pixel offset along the positive y axis for displacing an external graphic.
- * rotation - {Number} For point symbolizers, this is the rotation of a graphic in the clockwise direction about its center point (or any point off center as specified by graphicXOffset and graphicYOffset).
- * graphicZIndex - {Number} The integer z-index value to use in rendering.
- * graphicName - {String} Named graphic to use when rendering points.  Supported values include "circle" (default),
- *     "square", "star", "x", "cross", "triangle".
- * graphicTitle - {String} Tooltip when hovering over a feature. *deprecated*, use title instead
- * title - {String} Tooltip when hovering over a feature. Not supported by the canvas renderer.
- * backgroundGraphic - {String} Url to a graphic to be used as the background under an externalGraphic.
- * backgroundGraphicZIndex - {Number} The integer z-index value to use in rendering the background graphic.
- * backgroundXOffset - {Number} The x offset (in pixels) for the background graphic.
- * backgroundYOffset - {Number} The y offset (in pixels) for the background graphic.
- * backgroundHeight - {Number} The height of the background graphic.  If not provided, the graphicHeight will be used.
- * backgroundWidth - {Number} The width of the background width.  If not provided, the graphicWidth will be used.
- * label - {String} The text for an optional label. For browsers that use the canvas renderer, this requires either
- *     fillText or mozDrawText to be available.
- * labelAlign - {String} Label alignment. This specifies the insertion point relative to the text. It is a string
- *     composed of two characters. The first character is for the horizontal alignment, the second for the vertical
- *     alignment. Valid values for horizontal alignment: "l"=left, "c"=center, "r"=right. Valid values for vertical
- *     alignment: "t"=top, "m"=middle, "b"=bottom. Example values: "lt", "cm", "rb". Default is "cm".
- * labelXOffset - {Number} Pixel offset along the positive x axis for displacing the label. Not supported by the canvas renderer.
- * labelYOffset - {Number} Pixel offset along the positive y axis for displacing the label. Not supported by the canvas renderer.
- * labelSelect - {Boolean} If set to true, labels will be selectable using SelectFeature or similar controls.
- *     Default is false.
- * labelOutlineColor - {String} The color of the label outline. Default is 'white'. Only supported by the canvas & SVG renderers.
- * labelOutlineWidth - {Number} The width of the label outline. Default is 3, set to 0 or null to disable. Only supported by the  SVG renderers.
- * labelOutlineOpacity - {Number} The opacity (0-1) of the label outline. Default is fontOpacity. Only supported by the canvas & SVG renderers.
- * fontColor - {String} The font color for the label, to be provided like CSS.
- * fontOpacity - {Number} Opacity (0-1) for the label
- * fontFamily - {String} The font family for the label, to be provided like in CSS.
- * fontSize - {String} The font size for the label, to be provided like in CSS.
- * fontStyle - {String} The font style for the label, to be provided like in CSS.
- * fontWeight - {String} The font weight for the label, to be provided like in CSS.
- * display - {String} Symbolizers will have no effect if display is set to "none".  All other values have no effect.
- */ 
-OpenLayers.Feature.Vector.style = {
-    'default': {
-        fillColor: "#ee9900",
-        fillOpacity: 0.4, 
-        hoverFillColor: "white",
-        hoverFillOpacity: 0.8,
-        strokeColor: "#ee9900",
-        strokeOpacity: 1,
-        strokeWidth: 1,
-        strokeLinecap: "round",
-        strokeDashstyle: "solid",
-        hoverStrokeColor: "red",
-        hoverStrokeOpacity: 1,
-        hoverStrokeWidth: 0.2,
-        pointRadius: 6,
-        hoverPointRadius: 1,
-        hoverPointUnit: "%",
-        pointerEvents: "visiblePainted",
-        cursor: "inherit",
-        fontColor: "#000000",
-        labelAlign: "cm",
-        labelOutlineColor: "white",
-        labelOutlineWidth: 3
-    },
-    'select': {
-        fillColor: "blue",
-        fillOpacity: 0.4, 
-        hoverFillColor: "white",
-        hoverFillOpacity: 0.8,
-        strokeColor: "blue",
-        strokeOpacity: 1,
-        strokeWidth: 2,
-        strokeLinecap: "round",
-        strokeDashstyle: "solid",
-        hoverStrokeColor: "red",
-        hoverStrokeOpacity: 1,
-        hoverStrokeWidth: 0.2,
-        pointRadius: 6,
-        hoverPointRadius: 1,
-        hoverPointUnit: "%",
-        pointerEvents: "visiblePainted",
-        cursor: "pointer",
-        fontColor: "#000000",
-        labelAlign: "cm",
-        labelOutlineColor: "white",
-        labelOutlineWidth: 3
-
+    write: function(object) {
+        throw new Error('Write not implemented.');
     },
     },
-    'temporary': {
-        fillColor: "#66cccc",
-        fillOpacity: 0.2, 
-        hoverFillColor: "white",
-        hoverFillOpacity: 0.8,
-        strokeColor: "#66cccc",
-        strokeOpacity: 1,
-        strokeLinecap: "round",
-        strokeWidth: 2,
-        strokeDashstyle: "solid",
-        hoverStrokeColor: "red",
-        hoverStrokeOpacity: 1,
-        hoverStrokeWidth: 0.2,
-        pointRadius: 6,
-        hoverPointRadius: 1,
-        hoverPointUnit: "%",
-        pointerEvents: "visiblePainted",
-        cursor: "inherit",
-        fontColor: "#000000",
-        labelAlign: "cm",
-        labelOutlineColor: "white",
-        labelOutlineWidth: 3
 
 
-    },
-    'delete': {
-        display: "none"
-    }
-};    
+    CLASS_NAME: "OpenLayers.Format"
+});     
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Style.js
+    OpenLayers/Format/XML.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-
 /**
 /**
- * @requires OpenLayers/BaseTypes/Class.js
- * @requires OpenLayers/Util.js
- * @requires OpenLayers/Feature/Vector.js
+ * @requires OpenLayers/Format.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Style
- * This class represents a UserStyle obtained
- *     from a SLD, containing styling rules.
+ * Class: OpenLayers.Format.XML
+ * Read and write XML.  For cross-browser XML generation, use methods on an
+ *     instance of the XML format class instead of on <code>document<end>.
+ *     The DOM creation and traversing methods exposed here all mimic the
+ *     W3C XML DOM methods.  Create a new parser with the
+ *     <OpenLayers.Format.XML> constructor.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Format>
  */
  */
-OpenLayers.Style = OpenLayers.Class({
-
-    /**
-     * Property: id
-     * {String} A unique id for this session.
-     */
-    id: null,
+OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
     
     /**
     
     /**
-     * APIProperty: name
-     * {String}
+     * Property: namespaces
+     * {Object} Mapping of namespace aliases to namespace URIs.  Properties
+     *     of this object should not be set individually.  Read-only.  All
+     *     XML subclasses should have their own namespaces object.  Use
+     *     <setNamespace> to add or set a namespace alias after construction.
      */
      */
-    name: null,
+    namespaces: null,
     
     /**
     
     /**
-     * Property: title
-     * {String} Title of this style (set if included in SLD)
+     * Property: namespaceAlias
+     * {Object} Mapping of namespace URI to namespace alias.  This object
+     *     is read-only.  Use <setNamespace> to add or set a namespace alias.
      */
      */
-    title: null,
+    namespaceAlias: null,
     
     /**
     
     /**
-     * Property: description
-     * {String} Description of this style (set if abstract is included in SLD)
+     * Property: defaultPrefix
+     * {String} The default namespace alias for creating element nodes.
      */
      */
-    description: null,
-
+    defaultPrefix: null,
+    
     /**
     /**
-     * APIProperty: layerName
-     * {<String>} name of the layer that this style belongs to, usually
-     * according to the NamedLayer attribute of an SLD document.
+     * Property: readers
+     * Contains public functions, grouped by namespace prefix, that will
+     *     be applied when a namespaced node is found matching the function
+     *     name.  The function will be applied in the scope of this parser
+     *     with two arguments: the node being read and a context object passed
+     *     from the parent.
      */
      */
-    layerName: null,
+    readers: {},
     
     /**
     
     /**
-     * APIProperty: isDefault
-     * {Boolean}
-     */
-    isDefault: false,
-     
-    /** 
-     * Property: rules 
-     * {Array(<OpenLayers.Rule>)}
+     * Property: writers
+     * As a compliment to the <readers> property, this structure contains public
+     *     writing functions grouped by namespace alias and named like the
+     *     node names they produce.
      */
      */
-    rules: null,
-    
+    writers: {},
+
     /**
     /**
-     * APIProperty: context
-     * {Object} An optional object with properties that symbolizers' property
-     * values should be evaluated against. If no context is specified,
-     * feature.attributes will be used
+     * Property: xmldom
+     * {XMLDom} If this browser uses ActiveX, this will be set to a XMLDOM
+     *     object.  It is not intended to be a browser sniffing property.
+     *     Instead, the xmldom property is used instead of <code>document<end>
+     *     where namespaced node creation methods are not supported. In all
+     *     other browsers, this remains null.
      */
      */
-    context: null,
+    xmldom: null,
 
     /**
 
     /**
-     * Property: defaultStyle
-     * {Object} hash of style properties to use as default for merging
-     * rule-based style symbolizers onto. If no rules are defined,
-     * createSymbolizer will return this style. If <defaultsPerSymbolizer> is set to
-     * true, the defaultStyle will only be taken into account if there are
-     * rules defined.
+     * Constructor: OpenLayers.Format.XML
+     * Construct an XML parser.  The parser is used to read and write XML.
+     *     Reading XML from a string returns a DOM element.  Writing XML from
+     *     a DOM element returns a string.
+     *
+     * Parameters:
+     * options - {Object} Optional object whose properties will be set on
+     *     the object.
      */
      */
-    defaultStyle: null,
+    initialize: function(options) {
+        if (OpenLayers.Format.XML.supportActiveX) {
+            this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
+        }
+        OpenLayers.Format.prototype.initialize.apply(this, [options]);
+        // clone the namespace object and set all namespace aliases
+        this.namespaces = OpenLayers.Util.extend({}, this.namespaces);
+        this.namespaceAlias = {};
+        for(var alias in this.namespaces) {
+            this.namespaceAlias[this.namespaces[alias]] = alias;
+        }
+    },
     
     /**
     
     /**
-     * Property: defaultsPerSymbolizer
-     * {Boolean} If set to true, the <defaultStyle> will extend the symbolizer
-     * of every rule. Properties of the <defaultStyle> will also be used to set
-     * missing symbolizer properties if the symbolizer has stroke, fill or
-     * graphic set to true. Default is false.
+     * APIMethod: destroy
+     * Clean up.
      */
      */
-    defaultsPerSymbolizer: false,
+    destroy: function() {
+        this.xmldom = null;
+        OpenLayers.Format.prototype.destroy.apply(this, arguments);
+    },
     
     /**
     
     /**
-     * Property: propertyStyles
-     * {Hash of Boolean} cache of style properties that need to be parsed for
-     * propertyNames. Property names are keys, values won't be used.
+     * Method: setNamespace
+     * Set a namespace alias and URI for the format.
+     *
+     * Parameters:
+     * alias - {String} The namespace alias (prefix).
+     * uri - {String} The namespace URI.
      */
      */
-    propertyStyles: null,
-    
+    setNamespace: function(alias, uri) {
+        this.namespaces[alias] = uri;
+        this.namespaceAlias[uri] = alias;
+    },
 
 
-    /** 
-     * Constructor: OpenLayers.Style
-     * Creates a UserStyle.
+    /**
+     * APIMethod: read
+     * Deserialize a XML string and return a DOM node.
      *
      * Parameters:
      *
      * Parameters:
-     * style        - {Object} Optional hash of style properties that will be
-     *                used as default style for this style object. This style
-     *                applies if no rules are specified. Symbolizers defined in
-     *                rules will extend this default style.
-     * options - {Object} An optional object with properties to set on the
-     *     style.
-     *
-     * Valid options:
-     * rules - {Array(<OpenLayers.Rule>)} List of rules to be added to the
-     *     style.
-     * 
+     * text - {String} A XML string
+     
      * Returns:
      * Returns:
-     * {<OpenLayers.Style>}
+     * {DOMElement} A DOM node
      */
      */
-    initialize: function(style, options) {
-
-        OpenLayers.Util.extend(this, options);
-        this.rules = [];
-        if(options && options.rules) {
-            this.addRules(options.rules);
+    read: function(text) {
+        var index = text.indexOf('<');
+        if(index > 0) {
+            text = text.substring(index);
         }
         }
+        var node = OpenLayers.Util.Try(
+            OpenLayers.Function.bind((
+                function() {
+                    var xmldom;
+                    /**
+                     * Since we want to be able to call this method on the prototype
+                     * itself, this.xmldom may not exist even if in IE.
+                     */
+                    if (OpenLayers.Format.XML.supportActiveX && !this.xmldom) {
+                        xmldom = new ActiveXObject("Microsoft.XMLDOM");
+                    } else {
+                        xmldom = this.xmldom;
+                        
+                    }
+                    xmldom.loadXML(text);
+                    return xmldom;
+                }
+            ), this),
+            function() {
+                return new DOMParser().parseFromString(text, 'text/xml');
+            },
+            function() {
+                var req = new XMLHttpRequest();
+                req.open("GET", "data:" + "text/xml" +
+                         ";charset=utf-8," + encodeURIComponent(text), false);
+                if(req.overrideMimeType) {
+                    req.overrideMimeType("text/xml");
+                }
+                req.send(null);
+                return req.responseXML;
+            }
+        );
 
 
-        // use the default style from OpenLayers.Feature.Vector if no style
-        // was given in the constructor
-        this.setDefaultStyle(style ||
-                             OpenLayers.Feature.Vector.style["default"]);
+        if(this.keepData) {
+            this.data = node;
+        }
 
 
-        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
+        return node;
     },
 
     },
 
-    /** 
-     * APIMethod: destroy
-     * nullify references to prevent circular references and memory leaks
-     */
-    destroy: function() {
-        for (var i=0, len=this.rules.length; i<len; i++) {
-            this.rules[i].destroy();
-            this.rules[i] = null;
-        }
-        this.rules = null;
-        this.defaultStyle = null;
-    },
-    
     /**
     /**
-     * Method: createSymbolizer
-     * creates a style by applying all feature-dependent rules to the base
-     * style.
+     * APIMethod: write
+     * Serialize a DOM node into a XML string.
      * 
      * Parameters:
      * 
      * Parameters:
-     * feature - {<OpenLayers.Feature>} feature to evaluate rules for
-     * 
+     * node - {DOMElement} A DOM node.
+     *
      * Returns:
      * Returns:
-     * {Object} symbolizer hash
+     * {String} The XML string representation of the input node.
      */
      */
-    createSymbolizer: function(feature) {
-        var style = this.defaultsPerSymbolizer ? {} : this.createLiterals(
-            OpenLayers.Util.extend({}, this.defaultStyle), feature);
-        
-        var rules = this.rules;
-
-        var rule, context;
-        var elseRules = [];
-        var appliedRules = false;
-        for(var i=0, len=rules.length; i<len; i++) {
-            rule = rules[i];
-            // does the rule apply?
-            var applies = rule.evaluate(feature);
-            
-            if(applies) {
-                if(rule instanceof OpenLayers.Rule && rule.elseFilter) {
-                    elseRules.push(rule);
-                } else {
-                    appliedRules = true;
-                    this.applySymbolizer(rule, style, feature);
+    write: function(node) {
+        var data;
+        if(this.xmldom) {
+            data = node.xml;
+        } else {
+            var serializer = new XMLSerializer();
+            if (node.nodeType == 1) {
+                // Add nodes to a document before serializing. Everything else
+                // is serialized as is. This may need more work. See #1218 .
+                var doc = document.implementation.createDocument("", "", null);
+                if (doc.importNode) {
+                    node = doc.importNode(node, true);
                 }
                 }
+                doc.appendChild(node);
+                data = serializer.serializeToString(doc);
+            } else {
+                data = serializer.serializeToString(node);
             }
         }
             }
         }
-        
-        // if no other rules apply, apply the rules with else filters
-        if(appliedRules == false && elseRules.length > 0) {
-            appliedRules = true;
-            for(var i=0, len=elseRules.length; i<len; i++) {
-                this.applySymbolizer(elseRules[i], style, feature);
-            }
-        }
-
-        // don't display if there were rules but none applied
-        if(rules.length > 0 && appliedRules == false) {
-            style.display = "none";
-        }
-        
-        if (style.label != null && typeof style.label !== "string") {
-            style.label = String(style.label);
-        }
-        
-        return style;
+        return data;
     },
     },
-    
+
     /**
     /**
-     * Method: applySymbolizer
+     * APIMethod: createElementNS
+     * Create a new element with namespace.  This node can be appended to
+     *     another node with the standard node.appendChild method.  For
+     *     cross-browser support, this method must be used instead of
+     *     document.createElementNS.
      *
      * Parameters:
      *
      * Parameters:
-     * rule - {<OpenLayers.Rule>}
-     * style - {Object}
-     * feature - {<OpenLayer.Feature.Vector>}
-     *
+     * uri - {String} Namespace URI for the element.
+     * name - {String} The qualified name of the element (prefix:localname).
+     * 
      * Returns:
      * Returns:
-     * {Object} A style with new symbolizer applied.
+     * {Element} A DOM element with namespace.
      */
      */
-    applySymbolizer: function(rule, style, feature) {
-        var symbolizerPrefix = feature.geometry ?
-                this.getSymbolizerPrefix(feature.geometry) :
-                OpenLayers.Style.SYMBOLIZER_PREFIXES[0];
+    createElementNS: function(uri, name) {
+        var element;
+        if(this.xmldom) {
+            if(typeof uri == "string") {
+                element = this.xmldom.createNode(1, name, uri);
+            } else {
+                element = this.xmldom.createNode(1, name, "");
+            }
+        } else {
+            element = document.createElementNS(uri, name);
+        }
+        return element;
+    },
 
 
-        var symbolizer = rule.symbolizer[symbolizerPrefix] || rule.symbolizer;
-        
-        if(this.defaultsPerSymbolizer === true) {
-            var defaults = this.defaultStyle;
-            OpenLayers.Util.applyDefaults(symbolizer, {
-                pointRadius: defaults.pointRadius
-            });
-            if(symbolizer.stroke === true || symbolizer.graphic === true) {
-                OpenLayers.Util.applyDefaults(symbolizer, {
-                    strokeWidth: defaults.strokeWidth,
-                    strokeColor: defaults.strokeColor,
-                    strokeOpacity: defaults.strokeOpacity,
-                    strokeDashstyle: defaults.strokeDashstyle,
-                    strokeLinecap: defaults.strokeLinecap
-                });
-            }
-            if(symbolizer.fill === true || symbolizer.graphic === true) {
-                OpenLayers.Util.applyDefaults(symbolizer, {
-                    fillColor: defaults.fillColor,
-                    fillOpacity: defaults.fillOpacity
-                });
-            }
-            if(symbolizer.graphic === true) {
-                OpenLayers.Util.applyDefaults(symbolizer, {
-                    pointRadius: this.defaultStyle.pointRadius,
-                    externalGraphic: this.defaultStyle.externalGraphic,
-                    graphicName: this.defaultStyle.graphicName,
-                    graphicOpacity: this.defaultStyle.graphicOpacity,
-                    graphicWidth: this.defaultStyle.graphicWidth,
-                    graphicHeight: this.defaultStyle.graphicHeight,
-                    graphicXOffset: this.defaultStyle.graphicXOffset,
-                    graphicYOffset: this.defaultStyle.graphicYOffset
-                });
-            }
+    /**
+     * APIMethod: createDocumentFragment
+     * Create a document fragment node that can be appended to another node
+     *     created by createElementNS.  This will call 
+     *     document.createDocumentFragment outside of IE.  In IE, the ActiveX
+     *     object's createDocumentFragment method is used.
+     *
+     * Returns:
+     * {Element} A document fragment.
+     */
+    createDocumentFragment: function() {
+        var element;
+        if (this.xmldom) {
+            element = this.xmldom.createDocumentFragment();
+        } else {
+            element = document.createDocumentFragment();
         }
         }
-
-        // merge the style with the current style
-        return this.createLiterals(
-                OpenLayers.Util.extend(style, symbolizer), feature);
+        return element;
     },
     },
-    
+
     /**
     /**
-     * Method: createLiterals
-     * creates literals for all style properties that have an entry in
-     * <this.propertyStyles>.
+     * APIMethod: createTextNode
+     * Create a text node.  This node can be appended to another node with
+     *     the standard node.appendChild method.  For cross-browser support,
+     *     this method must be used instead of document.createTextNode.
      * 
      * Parameters:
      * 
      * Parameters:
-     * style   - {Object} style to create literals for. Will be modified
-     *           inline.
-     * feature - {Object}
+     * text - {String} The text of the node.
      * 
      * 
-     * Returns:
-     * {Object} the modified style
+     * Returns: 
+     * {DOMElement} A DOM text node.
      */
      */
-    createLiterals: function(style, feature) {
-        var context = OpenLayers.Util.extend({}, feature.attributes || feature.data);
-        OpenLayers.Util.extend(context, this.context);
-        
-        for (var i in this.propertyStyles) {
-            style[i] = OpenLayers.Style.createLiteral(style[i], context, feature, i);
+    createTextNode: function(text) {
+        var node;
+        if (typeof text !== "string") {
+            text = String(text);
         }
         }
-        return style;
+        if(this.xmldom) {
+            node = this.xmldom.createTextNode(text);
+        } else {
+            node = document.createTextNode(text);
+        }
+        return node;
     },
     },
-    
+
     /**
     /**
-     * Method: findPropertyStyles
-     * Looks into all rules for this style and the defaultStyle to collect
-     * all the style hash property names containing ${...} strings that have
-     * to be replaced using the createLiteral method before returning them.
+     * APIMethod: getElementsByTagNameNS
+     * Get a list of elements on a node given the namespace URI and local name.
+     *     To return all nodes in a given namespace, use '*' for the name
+     *     argument.  To return all nodes of a given (local) name, regardless
+     *     of namespace, use '*' for the uri argument.
+     * 
+     * Parameters:
+     * node - {Element} Node on which to search for other nodes.
+     * uri - {String} Namespace URI.
+     * name - {String} Local name of the tag (without the prefix).
      * 
      * Returns:
      * 
      * Returns:
-     * {Object} hash of property names that need createLiteral parsing. The
-     * name of the property is the key, and the value is true;
+     * {NodeList} A node list or array of elements.
      */
      */
-    findPropertyStyles: function() {
-        var propertyStyles = {};
-
-        // check the default style
-        var style = this.defaultStyle;
-        this.addPropertyStyles(propertyStyles, style);
-
-        // walk through all rules to check for properties in their symbolizer
-        var rules = this.rules;
-        var symbolizer, value;
-        for (var i=0, len=rules.length; i<len; i++) {
-            symbolizer = rules[i].symbolizer;
-            for (var key in symbolizer) {
-                value = symbolizer[key];
-                if (typeof value == "object") {
-                    // symbolizer key is "Point", "Line" or "Polygon"
-                    this.addPropertyStyles(propertyStyles, value);
-                } else {
-                    // symbolizer is a hash of style properties
-                    this.addPropertyStyles(propertyStyles, symbolizer);
-                    break;
+    getElementsByTagNameNS: function(node, uri, name) {
+        var elements = [];
+        if(node.getElementsByTagNameNS) {
+            elements = node.getElementsByTagNameNS(uri, name);
+        } else {
+            // brute force method
+            var allNodes = node.getElementsByTagName("*");
+            var potentialNode, fullName;
+            for(var i=0, len=allNodes.length; i<len; ++i) {
+                potentialNode = allNodes[i];
+                fullName = (potentialNode.prefix) ?
+                           (potentialNode.prefix + ":" + name) : name;
+                if((name == "*") || (fullName == potentialNode.nodeName)) {
+                    if((uri == "*") || (uri == potentialNode.namespaceURI)) {
+                        elements.push(potentialNode);
+                    }
                 }
             }
         }
                 }
             }
         }
-        return propertyStyles;
+        return elements;
     },
     },
-    
+
     /**
     /**
-     * Method: addPropertyStyles
+     * APIMethod: getAttributeNodeNS
+     * Get an attribute node given the namespace URI and local name.
      * 
      * Parameters:
      * 
      * Parameters:
-     * propertyStyles - {Object} hash to add new property styles to. Will be
-     *                  modified inline
-     * symbolizer     - {Object} search this symbolizer for property styles
+     * node - {Element} Node on which to search for attribute nodes.
+     * uri - {String} Namespace URI.
+     * name - {String} Local name of the attribute (without the prefix).
      * 
      * Returns:
      * 
      * Returns:
-     * {Object} propertyStyles hash
+     * {DOMElement} An attribute node or null if none found.
      */
      */
-    addPropertyStyles: function(propertyStyles, symbolizer) {
-        var property;
-        for (var key in symbolizer) {
-            property = symbolizer[key];
-            if (typeof property == "string" &&
-                    property.match(/\$\{\w+\}/)) {
-                propertyStyles[key] = true;
+    getAttributeNodeNS: function(node, uri, name) {
+        var attributeNode = null;
+        if(node.getAttributeNodeNS) {
+            attributeNode = node.getAttributeNodeNS(uri, name);
+        } else {
+            var attributes = node.attributes;
+            var potentialNode, fullName;
+            for(var i=0, len=attributes.length; i<len; ++i) {
+                potentialNode = attributes[i];
+                if(potentialNode.namespaceURI == uri) {
+                    fullName = (potentialNode.prefix) ?
+                               (potentialNode.prefix + ":" + name) : name;
+                    if(fullName == potentialNode.nodeName) {
+                        attributeNode = potentialNode;
+                        break;
+                    }
+                }
             }
         }
             }
         }
-        return propertyStyles;
+        return attributeNode;
     },
     },
-    
+
     /**
     /**
-     * APIMethod: addRules
-     * Adds rules to this style.
+     * APIMethod: getAttributeNS
+     * Get an attribute value given the namespace URI and local name.
      * 
      * Parameters:
      * 
      * Parameters:
-     * rules - {Array(<OpenLayers.Rule>)}
-     */
-    addRules: function(rules) {
-        Array.prototype.push.apply(this.rules, rules);
-        this.propertyStyles = this.findPropertyStyles();
-    },
-    
-    /**
-     * APIMethod: setDefaultStyle
-     * Sets the default style for this style object.
+     * node - {Element} Node on which to search for an attribute.
+     * uri - {String} Namespace URI.
+     * name - {String} Local name of the attribute (without the prefix).
      * 
      * 
-     * Parameters:
-     * style - {Object} Hash of style properties
+     * Returns:
+     * {String} An attribute value or and empty string if none found.
      */
      */
-    setDefaultStyle: function(style) {
-        this.defaultStyle = style; 
-        this.propertyStyles = this.findPropertyStyles();
+    getAttributeNS: function(node, uri, name) {
+        var attributeValue = "";
+        if(node.getAttributeNS) {
+            attributeValue = node.getAttributeNS(uri, name) || "";
+        } else {
+            var attributeNode = this.getAttributeNodeNS(node, uri, name);
+            if(attributeNode) {
+                attributeValue = attributeNode.nodeValue;
+            }
+        }
+        return attributeValue;
     },
     },
-        
+    
     /**
     /**
-     * Method: getSymbolizerPrefix
-     * Returns the correct symbolizer prefix according to the
-     * geometry type of the passed geometry
-     * 
+     * APIMethod: getChildValue
+     * Get the textual value of the node if it exists, or return an
+     *     optional default string.  Returns an empty string if no first child
+     *     exists and no default value is supplied.
+     *
      * Parameters:
      * Parameters:
-     * geometry - {<OpenLayers.Geometry>}
-     * 
+     * node - {DOMElement} The element used to look for a first child value.
+     * def - {String} Optional string to return in the event that no
+     *     first child value exists.
+     *
      * Returns:
      * Returns:
-     * {String} key of the according symbolizer
+     * {String} The value of the first child of the given node.
      */
      */
-    getSymbolizerPrefix: function(geometry) {
-        var prefixes = OpenLayers.Style.SYMBOLIZER_PREFIXES;
-        for (var i=0, len=prefixes.length; i<len; i++) {
-            if (geometry.CLASS_NAME.indexOf(prefixes[i]) != -1) {
-                return prefixes[i];
+    getChildValue: function(node, def) {
+        var value = def || "";
+        if(node) {
+            for(var child=node.firstChild; child; child=child.nextSibling) {
+                switch(child.nodeType) {
+                    case 3: // text node
+                    case 4: // cdata section
+                        value += child.nodeValue;
+                }
             }
         }
             }
         }
+        return value;
     },
     },
-    
+
     /**
     /**
-     * APIMethod: clone
-     * Clones this style.
-     * 
+     * APIMethod: isSimpleContent
+     * Test if the given node has only simple content (i.e. no child element
+     *     nodes).
+     *
+     * Parameters:
+     * node - {DOMElement} An element node.
+     *
      * Returns:
      * Returns:
-     * {<OpenLayers.Style>} Clone of this style.
+     * {Boolean} The node has no child element nodes (nodes of type 1). 
      */
      */
-    clone: function() {
-        var options = OpenLayers.Util.extend({}, this);
-        // clone rules
-        if(this.rules) {
-            options.rules = [];
-            for(var i=0, len=this.rules.length; i<len; ++i) {
-                options.rules.push(this.rules[i].clone());
+    isSimpleContent: function(node) {
+        var simple = true;
+        for(var child=node.firstChild; child; child=child.nextSibling) {
+            if(child.nodeType === 1) {
+                simple = false;
+                break;
             }
         }
             }
         }
-        // clone context
-        options.context = this.context && OpenLayers.Util.extend({}, this.context);
-        //clone default style
-        var defaultStyle = OpenLayers.Util.extend({}, this.defaultStyle);
-        return new OpenLayers.Style(defaultStyle, options);
+        return simple;
     },
     
     },
     
-    CLASS_NAME: "OpenLayers.Style"
-});
-
-
-/**
- * Function: createLiteral
- * converts a style value holding a combination of PropertyName and Literal
- * into a Literal, taking the property values from the passed features.
- * 
- * Parameters:
- * value - {String} value to parse. If this string contains a construct like
- *         "foo ${bar}", then "foo " will be taken as literal, and "${bar}"
- *         will be replaced by the value of the "bar" attribute of the passed
- *         feature.
- * context - {Object} context to take attribute values from
- * feature - {<OpenLayers.Feature.Vector>} optional feature to pass to
- *           <OpenLayers.String.format> for evaluating functions in the
- *           context.
- * property - {String} optional, name of the property for which the literal is
- *            being created for evaluating functions in the context.
- * 
- * Returns:
- * {String} the parsed value. In the example of the value parameter above, the
- * result would be "foo valueOfBar", assuming that the passed feature has an
- * attribute named "bar" with the value "valueOfBar".
- */
-OpenLayers.Style.createLiteral = function(value, context, feature, property) {
-    if (typeof value == "string" && value.indexOf("${") != -1) {
-        value = OpenLayers.String.format(value, context, [feature, property]);
-        value = (isNaN(value) || !value) ? value : parseFloat(value);
-    }
-    return value;
-};
-    
-/**
- * Constant: OpenLayers.Style.SYMBOLIZER_PREFIXES
- * {Array} prefixes of the sld symbolizers. These are the
- * same as the main geometry types
- */
-OpenLayers.Style.SYMBOLIZER_PREFIXES = ['Point', 'Line', 'Polygon', 'Text',
-    'Raster'];
-/* ======================================================================
-    OpenLayers/Filter.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-
-/**
- * @requires OpenLayers/BaseTypes/Class.js
- * @requires OpenLayers/Util.js
- * @requires OpenLayers/Style.js
- */
-
-/**
- * Class: OpenLayers.Filter
- * This class represents an OGC Filter.
- */
-OpenLayers.Filter = OpenLayers.Class({
-    
-    /** 
-     * Constructor: OpenLayers.Filter
-     * This class represents a generic filter.
+    /**
+     * APIMethod: contentType
+     * Determine the content type for a given node.
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} Optional object whose properties will be set on the
-     *     instance.
-     * 
+     * node - {DOMElement}
+     *
      * Returns:
      * Returns:
-     * {<OpenLayers.Filter>}
+     * {Integer} One of OpenLayers.Format.XML.CONTENT_TYPE.{EMPTY,SIMPLE,COMPLEX,MIXED}
+     *     if the node has no, simple, complex, or mixed content.
      */
      */
-    initialize: function(options) {
-        OpenLayers.Util.extend(this, options);
-    },
+    contentType: function(node) {
+        var simple = false,
+            complex = false;
+            
+        var type = OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;
 
 
-    /** 
-     * APIMethod: destroy
-     * Remove reference to anything added.
-     */
-    destroy: function() {
+        for(var child=node.firstChild; child; child=child.nextSibling) {
+            switch(child.nodeType) {
+                case 1: // element
+                    complex = true;
+                    break;
+                case 8: // comment
+                    break;
+                default:
+                    simple = true;
+            }
+            if(complex && simple) {
+                break;
+            }
+        }
+        
+        if(complex && simple) {
+            type = OpenLayers.Format.XML.CONTENT_TYPE.MIXED;
+        } else if(complex) {
+            return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;
+        } else if(simple) {
+            return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE;
+        }
+        return type;
     },
 
     /**
     },
 
     /**
-     * APIMethod: evaluate
-     * Evaluates this filter in a specific context.  Instances or subclasses
-     * are supposed to override this method.
+     * APIMethod: hasAttributeNS
+     * Determine whether a node has a particular attribute matching the given
+     *     name and namespace.
      * 
      * Parameters:
      * 
      * Parameters:
-     * context - {Object} Context to use in evaluating the filter.  If a vector
-     *     feature is provided, the feature.attributes will be used as context.
+     * node - {Element} Node on which to search for an attribute.
+     * uri - {String} Namespace URI.
+     * name - {String} Local name of the attribute (without the prefix).
      * 
      * Returns:
      * 
      * Returns:
-     * {Boolean} The filter applies.
+     * {Boolean} The node has an attribute matching the name and namespace.
      */
      */
-    evaluate: function(context) {
-        return true;
+    hasAttributeNS: function(node, uri, name) {
+        var found = false;
+        if(node.hasAttributeNS) {
+            found = node.hasAttributeNS(uri, name);
+        } else {
+            found = !!this.getAttributeNodeNS(node, uri, name);
+        }
+        return found;
     },
     
     /**
     },
     
     /**
-     * APIMethod: clone
-     * Clones this filter. Should be implemented by subclasses.
-     * 
-     * Returns:
-     * {<OpenLayers.Filter>} Clone of this filter.
+     * APIMethod: setAttributeNS
+     * Adds a new attribute or changes the value of an attribute with the given
+     *     namespace and name.
+     *
+     * Parameters:
+     * node - {Element} Element node on which to set the attribute.
+     * uri - {String} Namespace URI for the attribute.
+     * name - {String} Qualified name (prefix:localname) for the attribute.
+     * value - {String} Attribute value.
      */
      */
-    clone: function() {
-        return null;
+    setAttributeNS: function(node, uri, name, value) {
+        if(node.setAttributeNS) {
+            node.setAttributeNS(uri, name, value);
+        } else {
+            if(this.xmldom) {
+                if(uri) {
+                    var attribute = node.ownerDocument.createNode(
+                        2, name, uri
+                    );
+                    attribute.nodeValue = value;
+                    node.setAttributeNode(attribute);
+                } else {
+                    node.setAttribute(name, value);
+                }
+            } else {
+                throw "setAttributeNS not implemented";
+            }
+        }
     },
     },
-    
+
     /**
     /**
-     * APIMethod: toString
+     * Method: createElementNSPlus
+     * Shorthand for creating namespaced elements with optional attributes and
+     *     child text nodes.
+     *
+     * Parameters:
+     * name - {String} The qualified node name.
+     * options - {Object} Optional object for node configuration.
+     *
+     * Valid options:
+     * uri - {String} Optional namespace uri for the element - supply a prefix
+     *     instead if the namespace uri is a property of the format's namespace
+     *     object.
+     * attributes - {Object} Optional attributes to be set using the
+     *     <setAttributes> method.
+     * value - {String} Optional text to be appended as a text node.
      *
      * Returns:
      *
      * Returns:
-     * {String} Include <OpenLayers.Format.CQL> in your build to get a CQL
-     *     representation of the filter returned. Otherwise "[Object object]"
-     *     will be returned.
+     * {Element} An element node.
      */
      */
-    toString: function() {
-        var string;
-        if (OpenLayers.Format && OpenLayers.Format.CQL) {
-            string = OpenLayers.Format.CQL.prototype.write(this);
-        } else {
-            string = Object.prototype.toString.call(this);
+    createElementNSPlus: function(name, options) {
+        options = options || {};
+        // order of prefix preference
+        // 1. in the uri option
+        // 2. in the prefix option
+        // 3. in the qualified name
+        // 4. from the defaultPrefix
+        var uri = options.uri || this.namespaces[options.prefix];
+        if(!uri) {
+            var loc = name.indexOf(":");
+            uri = this.namespaces[name.substring(0, loc)];
         }
         }
-        return string;
+        if(!uri) {
+            uri = this.namespaces[this.defaultPrefix];
+        }
+        var node = this.createElementNS(uri, name);
+        if(options.attributes) {
+            this.setAttributes(node, options.attributes);
+        }
+        var value = options.value;
+        if(value != null) {
+            node.appendChild(this.createTextNode(value));
+        }
+        return node;
     },
     
     },
     
-    CLASS_NAME: "OpenLayers.Filter"
-});
-/* ======================================================================
-    OpenLayers/Strategy/Filter.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Strategy.js
- * @requires OpenLayers/Filter.js
- */
-
-/**
- * Class: OpenLayers.Strategy.Filter
- * Strategy for limiting features that get added to a layer by 
- *     evaluating a filter.  The strategy maintains a cache of
- *     all features until removeFeatures is called on the layer.
- *
- * Inherits from:
- *  - <OpenLayers.Strategy>
- */
-OpenLayers.Strategy.Filter = OpenLayers.Class(OpenLayers.Strategy, {
-    
     /**
     /**
-     * APIProperty: filter
-     * {<OpenLayers.Filter>}  Filter for limiting features sent to the layer.
-     *     Use the <setFilter> method to update this filter after construction.
+     * Method: setAttributes
+     * Set multiple attributes given key value pairs from an object.
+     *
+     * Parameters:
+     * node - {Element} An element node.
+     * obj - {Object || Array} An object whose properties represent attribute
+     *     names and values represent attribute values.  If an attribute name
+     *     is a qualified name ("prefix:local"), the prefix will be looked up
+     *     in the parsers {namespaces} object.  If the prefix is found,
+     *     setAttributeNS will be used instead of setAttribute.
      */
      */
-    filter: null,
-    
+    setAttributes: function(node, obj) {
+        var value, uri;
+        for(var name in obj) {
+            if(obj[name] != null && obj[name].toString) {
+                value = obj[name].toString();
+                // check for qualified attribute name ("prefix:local")
+                uri = this.namespaces[name.substring(0, name.indexOf(":"))] || null;
+                this.setAttributeNS(node, uri, name, value);
+            }
+        }
+    },
+
     /**
     /**
-     * Property: cache
-     * {Array(<OpenLayers.Feature.Vector>)} List of currently cached
-     *     features.
+     * Method: getFirstElementChild
+     * Implementation of firstElementChild attribute that works on ie7 and ie8.
+     *
+     * Parameters:
+     * node - {DOMElement} The parent node (required).
+     *
+     * Returns:
+     * {DOMElement} The first child element.
      */
      */
-    cache: null,
-    
+    getFirstElementChild: function(node) {
+        if (node.firstElementChild) {
+            return node.firstElementChild;
+        }
+        else {
+            var child = node.firstChild;
+            while (child.nodeType != 1 && (child = child.nextSibling)) {}
+            return child;
+        }
+    },
+
     /**
     /**
-     * Property: caching
-     * {Boolean} The filter is currently caching features.
+     * Method: readNode
+     * Shorthand for applying one of the named readers given the node
+     *     namespace and local name.  Readers take two args (node, obj) and
+     *     generally extend or modify the second.
+     *
+     * Parameters:
+     * node - {DOMElement} The node to be read (required).
+     * obj - {Object} The object to be modified (optional).
+     *
+     * Returns:
+     * {Object} The input object, modified (or a new one if none was provided).
      */
      */
-    caching: false,
-    
+    readNode: function(node, obj) {
+        if(!obj) {
+            obj = {};
+        }
+        var group = this.readers[node.namespaceURI ? this.namespaceAlias[node.namespaceURI]: this.defaultPrefix];
+        if(group) {
+            var local = node.localName || node.nodeName.split(":").pop();
+            var reader = group[local] || group["*"];
+            if(reader) {
+                reader.apply(this, [node, obj]);
+            }
+        }
+        return obj;
+    },
+
     /**
     /**
-     * Constructor: OpenLayers.Strategy.Filter
-     * Create a new filter strategy.
+     * Method: readChildNodes
+     * Shorthand for applying the named readers to all children of a node.
+     *     For each child of type 1 (element), <readSelf> is called.
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} Optional object whose properties will be set on the
-     *     instance.
+     * node - {DOMElement} The node to be read (required).
+     * obj - {Object} The object to be modified (optional).
+     *
+     * Returns:
+     * {Object} The input object, modified.
      */
      */
+    readChildNodes: function(node, obj) {
+        if(!obj) {
+            obj = {};
+        }
+        var children = node.childNodes;
+        var child;
+        for(var i=0, len=children.length; i<len; ++i) {
+            child = children[i];
+            if(child.nodeType == 1) {
+                this.readNode(child, obj);
+            }
+        }
+        return obj;
+    },
 
     /**
 
     /**
-     * APIMethod: activate
-     * Activate the strategy.  Register any listeners, do appropriate setup.
-     *     By default, this strategy automatically activates itself when a layer
-     *     is added to a map.
+     * Method: writeNode
+     * Shorthand for applying one of the named writers and appending the
+     *     results to a node.  If a qualified name is not provided for the
+     *     second argument (and a local name is used instead), the namespace
+     *     of the parent node will be assumed.
+     *
+     * Parameters:
+     * name - {String} The name of a node to generate.  If a qualified name
+     *     (e.g. "pre:Name") is used, the namespace prefix is assumed to be
+     *     in the <writers> group.  If a local name is used (e.g. "Name") then
+     *     the namespace of the parent is assumed.  If a local name is used
+     *     and no parent is supplied, then the default namespace is assumed.
+     * obj - {Object} Structure containing data for the writer.
+     * parent - {DOMElement} Result will be appended to this node.  If no parent
+     *     is supplied, the node will not be appended to anything.
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} True if the strategy was successfully activated or false if
-     *      the strategy was already active.
+     * {DOMElement} The child node.
      */
      */
-    activate: function() {
-        var activated = OpenLayers.Strategy.prototype.activate.apply(this, arguments);
-        if (activated) {
-            this.cache = [];
-            this.layer.events.on({
-                "beforefeaturesadded": this.handleAdd,
-                "beforefeaturesremoved": this.handleRemove,
-                scope: this
-            });
+    writeNode: function(name, obj, parent) {
+        var prefix, local;
+        var split = name.indexOf(":");
+        if(split > 0) {
+            prefix = name.substring(0, split);
+            local = name.substring(split + 1);
+        } else {
+            if(parent) {
+                prefix = this.namespaceAlias[parent.namespaceURI];
+            } else {
+                prefix = this.defaultPrefix;
+            }
+            local = name;
         }
         }
-        return activated;
+        var child = this.writers[prefix][local].apply(this, [obj]);
+        if(parent) {
+            parent.appendChild(child);
+        }
+        return child;
     },
     },
-    
+
     /**
     /**
-     * APIMethod: deactivate
-     * Deactivate the strategy.  Clear the feature cache.
+     * APIMethod: getChildEl
+     * Get the first child element.  Optionally only return the first child
+     *     if it matches the given name and namespace URI.
+     *
+     * Parameters:
+     * node - {DOMElement} The parent node.
+     * name - {String} Optional node name (local) to search for.
+     * uri - {String} Optional namespace URI to search for.
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} True if the strategy was successfully deactivated or false if
-     *      the strategy was already inactive.
+     * {DOMElement} The first child.  Returns null if no element is found, if
+     *     something significant besides an element is found, or if the element
+     *     found does not match the optional name and uri.
      */
      */
-    deactivate: function() {
-        this.cache = null;
-        if (this.layer && this.layer.events) {
-            this.layer.events.un({
-                "beforefeaturesadded": this.handleAdd,
-                "beforefeaturesremoved": this.handleRemove,
-                scope: this
-            });            
-        }
-        return OpenLayers.Strategy.prototype.deactivate.apply(this, arguments);
+    getChildEl: function(node, name, uri) {
+        return node && this.getThisOrNextEl(node.firstChild, name, uri);
     },
     
     /**
     },
     
     /**
-     * Method: handleAdd
+     * APIMethod: getNextEl
+     * Get the next sibling element.  Optionally get the first sibling only
+     *     if it matches the given local name and namespace URI.
+     *
+     * Parameters:
+     * node - {DOMElement} The node.
+     * name - {String} Optional local name of the sibling to search for.
+     * uri - {String} Optional namespace URI of the sibling to search for.
+     *
+     * Returns:
+     * {DOMElement} The next sibling element.  Returns null if no element is
+     *     found, something significant besides an element is found, or the
+     *     found element does not match the optional name and uri.
      */
      */
-    handleAdd: function(event) {
-        if (!this.caching && this.filter) {
-            var features = event.features;
-            event.features = [];
-            var feature;
-            for (var i=0, ii=features.length; i<ii; ++i) {
-                feature = features[i];
-                if (this.filter.evaluate(feature)) {
-                    event.features.push(feature);
-                } else {
-                    this.cache.push(feature);
-                }
-            }
-        }
+    getNextEl: function(node, name, uri) {
+        return node && this.getThisOrNextEl(node.nextSibling, name, uri);
     },
     
     /**
     },
     
     /**
-     * Method: handleRemove
+     * Method: getThisOrNextEl
+     * Return this node or the next element node.  Optionally get the first
+     *     sibling with the given local name or namespace URI.
+     *
+     * Parameters:
+     * node - {DOMElement} The node.
+     * name - {String} Optional local name of the sibling to search for.
+     * uri - {String} Optional namespace URI of the sibling to search for.
+     *
+     * Returns:
+     * {DOMElement} The next sibling element.  Returns null if no element is
+     *     found, something significant besides an element is found, or the
+     *     found element does not match the query.
      */
      */
-    handleRemove: function(event) {
-        if (!this.caching) {
-            this.cache = [];
+    getThisOrNextEl: function(node, name, uri) {
+        outer: for(var sibling=node; sibling; sibling=sibling.nextSibling) {
+            switch(sibling.nodeType) {
+                case 1: // Element
+                    if((!name || name === (sibling.localName || sibling.nodeName.split(":").pop())) &&
+                       (!uri || uri === sibling.namespaceURI)) {
+                        // matches
+                        break outer;
+                    }
+                    sibling = null;
+                    break outer;
+                case 3: // Text
+                    if(/^\s*$/.test(sibling.nodeValue)) {
+                        break;
+                    }
+                case 4: // CDATA
+                case 6: // ENTITY_NODE
+                case 12: // NOTATION_NODE
+                case 10: // DOCUMENT_TYPE_NODE
+                case 11: // DOCUMENT_FRAGMENT_NODE
+                    sibling = null;
+                    break outer;
+            } // ignore comments and processing instructions
         }
         }
+        return sibling || null;
     },
     },
-
-    /** 
-     * APIMethod: setFilter
-     * Update the filter for this strategy.  This will re-evaluate
-     *     any features on the layer and in the cache.  Only features
-     *     for which filter.evalute(feature) returns true will be
-     *     added to the layer.  Others will be cached by the strategy.
+    
+    /**
+     * APIMethod: lookupNamespaceURI
+     * Takes a prefix and returns the namespace URI associated with it on the given
+     *     node if found (and null if not). Supplying null for the prefix will
+     *     return the default namespace.
      *
      *
+     * For browsers that support it, this calls the native lookupNamesapceURI
+     *     function.  In other browsers, this is an implementation of
+     *     http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI.
+     *
+     * For browsers that don't support the attribute.ownerElement property, this
+     *     method cannot be called on attribute nodes.
+     *     
      * Parameters:
      * Parameters:
-     * filter - {<OpenLayers.Filter>} A filter for evaluating features.
+     * node - {DOMElement} The node from which to start looking.
+     * prefix - {String} The prefix to lookup or null to lookup the default namespace.
+     * 
+     * Returns:
+     * {String} The namespace URI for the given prefix.  Returns null if the prefix
+     *     cannot be found or the node is the wrong type.
      */
      */
-    setFilter: function(filter) {
-        this.filter = filter;
-        var previousCache = this.cache;
-        this.cache = [];
-        // look through layer for features to remove from layer
-        this.handleAdd({features: this.layer.features});
-        // cache now contains features to remove from layer
-        if (this.cache.length > 0) {
-            this.caching = true;
-            this.layer.removeFeatures(this.cache.slice());
-            this.caching = false;
+    lookupNamespaceURI: function(node, prefix) {
+        var uri = null;
+        if(node) {
+            if(node.lookupNamespaceURI) {
+                uri = node.lookupNamespaceURI(prefix);
+            } else {
+                outer: switch(node.nodeType) {
+                    case 1: // ELEMENT_NODE
+                        if(node.namespaceURI !== null && node.prefix === prefix) {
+                            uri = node.namespaceURI;
+                            break outer;
+                        }
+                        var len = node.attributes.length;
+                        if(len) {
+                            var attr;
+                            for(var i=0; i<len; ++i) {
+                                attr = node.attributes[i];
+                                if(attr.prefix === "xmlns" && attr.name === "xmlns:" + prefix) {
+                                    uri = attr.value || null;
+                                    break outer;
+                                } else if(attr.name === "xmlns" && prefix === null) {
+                                    uri = attr.value || null;
+                                    break outer;
+                                }
+                            }
+                        }
+                        uri = this.lookupNamespaceURI(node.parentNode, prefix);
+                        break outer;
+                    case 2: // ATTRIBUTE_NODE
+                        uri = this.lookupNamespaceURI(node.ownerElement, prefix);
+                        break outer;
+                    case 9: // DOCUMENT_NODE
+                        uri = this.lookupNamespaceURI(node.documentElement, prefix);
+                        break outer;
+                    case 6: // ENTITY_NODE
+                    case 12: // NOTATION_NODE
+                    case 10: // DOCUMENT_TYPE_NODE
+                    case 11: // DOCUMENT_FRAGMENT_NODE
+                        break outer;
+                    default: 
+                        // TEXT_NODE (3), CDATA_SECTION_NODE (4), ENTITY_REFERENCE_NODE (5),
+                        // PROCESSING_INSTRUCTION_NODE (7), COMMENT_NODE (8)
+                        uri =  this.lookupNamespaceURI(node.parentNode, prefix);
+                        break outer;
+                }
+            }
         }
         }
-        // now look through previous cache for features to add to layer
-        if (previousCache.length > 0) {
-            var event = {features: previousCache};
-            this.handleAdd(event);
-            if (event.features.length > 0) {
-                // event has features to add to layer
-                this.caching = true;
-                this.layer.addFeatures(event.features);
-                this.caching = false;
+        return uri;
+    },
+    
+    /**
+     * Method: getXMLDoc
+     * Get an XML document for nodes that are not supported in HTML (e.g.
+     * createCDATASection). On IE, this will either return an existing or
+     * create a new <xmldom> on the instance. On other browsers, this will
+     * either return an existing or create a new shared document (see
+     * <OpenLayers.Format.XML.document>).
+     *
+     * Returns:
+     * {XMLDocument}
+     */
+    getXMLDoc: function() {
+        if (!OpenLayers.Format.XML.document && !this.xmldom) {
+            if (document.implementation && document.implementation.createDocument) {
+                OpenLayers.Format.XML.document =
+                    document.implementation.createDocument("", "", null);
+            } else if (!this.xmldom && OpenLayers.Format.XML.supportActiveX) {
+                this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
             }
         }
             }
         }
+        return OpenLayers.Format.XML.document || this.xmldom;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Strategy.Filter"
+    CLASS_NAME: "OpenLayers.Format.XML" 
 
 
-});
+});     
+
+OpenLayers.Format.XML.CONTENT_TYPE = {EMPTY: 0, SIMPLE: 1, COMPLEX: 2, MIXED: 3};
+
+/**
+ * APIFunction: OpenLayers.Format.XML.lookupNamespaceURI
+ * Takes a prefix and returns the namespace URI associated with it on the given
+ *     node if found (and null if not). Supplying null for the prefix will
+ *     return the default namespace.
+ *
+ * For browsers that support it, this calls the native lookupNamesapceURI
+ *     function.  In other browsers, this is an implementation of
+ *     http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI.
+ *
+ * For browsers that don't support the attribute.ownerElement property, this
+ *     method cannot be called on attribute nodes.
+ *     
+ * Parameters:
+ * node - {DOMElement} The node from which to start looking.
+ * prefix - {String} The prefix to lookup or null to lookup the default namespace.
+ * 
+ * Returns:
+ * {String} The namespace URI for the given prefix.  Returns null if the prefix
+ *     cannot be found or the node is the wrong type.
+ */
+OpenLayers.Format.XML.lookupNamespaceURI = OpenLayers.Function.bind(
+    OpenLayers.Format.XML.prototype.lookupNamespaceURI,
+    OpenLayers.Format.XML.prototype
+);
+
+/**
+ * Property: OpenLayers.Format.XML.document
+ * {XMLDocument} XML document to reuse for creating non-HTML compliant nodes,
+ * like document.createCDATASection.
+ */
+OpenLayers.Format.XML.document = null;
+
+/**
+ * APIFunction: OpenLayers.Format.XML.supportActiveX
+ * Returns a poolean flag to check if this browser uses ActiveX.
+ */
+OpenLayers.Format.XML.supportActiveX = (function () {
+    return (Object.getOwnPropertyDescriptor &&
+            Object.getOwnPropertyDescriptor(window, "ActiveXObject")) ||
+            ("ActiveXObject" in window);
+})();
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Tile.js
+    OpenLayers/Format/WFST.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format.js
+ */
+
+/**
+ * Function: OpenLayers.Format.WFST
+ * Used to create a versioned WFS protocol.  Default version is 1.0.0.
+ *
+ * Returns:
+ * {<OpenLayers.Format>} A WFST format of the given version.
+ */
+OpenLayers.Format.WFST = function(options) {
+    options = OpenLayers.Util.applyDefaults(
+        options, OpenLayers.Format.WFST.DEFAULTS
+    );
+    var cls = OpenLayers.Format.WFST["v"+options.version.replace(/\./g, "_")];
+    if(!cls) {
+        throw "Unsupported WFST version: " + options.version;
+    }
+    return new cls(options);
+};
+
+/**
+ * Constant: OpenLayers.Format.WFST.DEFAULTS
+ * {Object} Default properties for the WFST format.
+ */
+OpenLayers.Format.WFST.DEFAULTS = {
+    "version": "1.0.0"
+};
+/* ======================================================================
+    OpenLayers/Filter.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -14652,1071 +14436,764 @@ OpenLayers.Strategy.Filter = OpenLayers.Class(OpenLayers.Strategy, {
 /**
  * @requires OpenLayers/BaseTypes/Class.js
  * @requires OpenLayers/Util.js
 /**
  * @requires OpenLayers/BaseTypes/Class.js
  * @requires OpenLayers/Util.js
+ * @requires OpenLayers/Style.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Tile 
- * This is a class designed to designate a single tile, however
- *     it is explicitly designed to do relatively little. Tiles store 
- *     information about themselves -- such as the URL that they are related
- *     to, and their size - but do not add themselves to the layer div 
- *     automatically, for example. Create a new tile with the 
- *     <OpenLayers.Tile> constructor, or a subclass. 
- * 
- * TBD 3.0 - remove reference to url in above paragraph
- * 
+ * Class: OpenLayers.Filter
+ * This class represents an OGC Filter.
  */
  */
-OpenLayers.Tile = OpenLayers.Class({
+OpenLayers.Filter = OpenLayers.Class({
     
     
-    /**
-     * APIProperty: events
-     * {<OpenLayers.Events>} An events object that handles all 
-     *     events on the tile.
-     *
-     * Register a listener for a particular event with the following syntax:
-     * (code)
-     * tile.events.register(type, obj, listener);
-     * (end)
+    /** 
+     * Constructor: OpenLayers.Filter
+     * This class represents a generic filter.
      *
      *
-     * Supported event types:
-     * beforedraw - Triggered before the tile is drawn. Used to defer
-     *     drawing to an animation queue. To defer drawing, listeners need
-     *     to return false, which will abort drawing. The queue handler needs
-     *     to call <draw>(true) to actually draw the tile.
-     * loadstart - Triggered when tile loading starts.
-     * loadend - Triggered when tile loading ends.
-     * loaderror - Triggered before the loadend event (i.e. when the tile is
-     *     still hidden) if the tile could not be loaded.
-     * reload - Triggered when an already loading tile is reloaded.
-     * unload - Triggered before a tile is unloaded.
+     * Parameters:
+     * options - {Object} Optional object whose properties will be set on the
+     *     instance.
+     * 
+     * Returns:
+     * {<OpenLayers.Filter>}
      */
      */
-    events: null,
+    initialize: function(options) {
+        OpenLayers.Util.extend(this, options);
+    },
 
 
-    /**
-     * APIProperty: eventListeners
-     * {Object} If set as an option at construction, the eventListeners
-     *     object will be registered with <OpenLayers.Events.on>.  Object
-     *     structure must be a listeners object as shown in the example for
-     *     the events.on method.
-     *
-     * This options can be set in the ``tileOptions`` option from
-     * <OpenLayers.Layer.Grid>. For example, to be notified of the
-     * ``loadend`` event of each tiles:
-     * (code)
-     * new OpenLayers.Layer.OSM('osm', 'http://tile.openstreetmap.org/${z}/${x}/${y}.png', {
-     *     tileOptions: {
-     *         eventListeners: {
-     *             'loadend': function(evt) {
-     *                 // do something on loadend
-     *             }
-     *         }
-     *     }
-     * });
-     * (end)
+    /** 
+     * APIMethod: destroy
+     * Remove reference to anything added.
      */
      */
-    eventListeners: null,
+    destroy: function() {
+    },
 
     /**
 
     /**
-     * Property: id 
-     * {String} null
+     * APIMethod: evaluate
+     * Evaluates this filter in a specific context.  Instances or subclasses
+     * are supposed to override this method.
+     * 
+     * Parameters:
+     * context - {Object} Context to use in evaluating the filter.  If a vector
+     *     feature is provided, the feature.attributes will be used as context.
+     * 
+     * Returns:
+     * {Boolean} The filter applies.
      */
      */
-    id: null,
+    evaluate: function(context) {
+        return true;
+    },
     
     
-    /** 
-     * Property: layer 
-     * {<OpenLayers.Layer>} layer the tile is attached to 
+    /**
+     * APIMethod: clone
+     * Clones this filter. Should be implemented by subclasses.
+     * 
+     * Returns:
+     * {<OpenLayers.Filter>} Clone of this filter.
      */
      */
-    layer: null,
+    clone: function() {
+        return null;
+    },
     
     /**
     
     /**
-     * Property: url
-     * {String} url of the request.
+     * APIMethod: toString
      *
      *
-     * TBD 3.0 
-     * Deprecated. The base tile class does not need an url. This should be 
-     * handled in subclasses. Does not belong here.
+     * Returns:
+     * {String} Include <OpenLayers.Format.CQL> in your build to get a CQL
+     *     representation of the filter returned. Otherwise "[Object object]"
+     *     will be returned.
      */
      */
-    url: null,
+    toString: function() {
+        var string;
+        if (OpenLayers.Format && OpenLayers.Format.CQL) {
+            string = OpenLayers.Format.CQL.prototype.write(this);
+        } else {
+            string = Object.prototype.toString.call(this);
+        }
+        return string;
+    },
+    
+    CLASS_NAME: "OpenLayers.Filter"
+});
+/* ======================================================================
+    OpenLayers/Filter/Spatial.js
+   ====================================================================== */
 
 
-    /** 
-     * APIProperty: bounds 
-     * {<OpenLayers.Bounds>} null
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Filter.js
+ */
+
+/**
+ * Class: OpenLayers.Filter.Spatial
+ * This class represents a spatial filter.
+ * Currently implemented: BBOX, DWithin and Intersects
+ * 
+ * Inherits from:
+ * - <OpenLayers.Filter>
+ */
+OpenLayers.Filter.Spatial = OpenLayers.Class(OpenLayers.Filter, {
+
+    /**
+     * APIProperty: type
+     * {String} Type of spatial filter.
+     *
+     * The type should be one of:
+     * - OpenLayers.Filter.Spatial.BBOX
+     * - OpenLayers.Filter.Spatial.INTERSECTS
+     * - OpenLayers.Filter.Spatial.DWITHIN
+     * - OpenLayers.Filter.Spatial.WITHIN
+     * - OpenLayers.Filter.Spatial.CONTAINS
      */
      */
-    bounds: null,
+    type: null,
     
     
-    /** 
-     * Property: size 
-     * {<OpenLayers.Size>} null
+    /**
+     * APIProperty: property
+     * {String} Name of the context property to compare.
      */
      */
-    size: null,
-    
-    /** 
-     * Property: position 
-     * {<OpenLayers.Pixel>} Top Left pixel of the tile
-     */    
-    position: null,
+    property: null,
     
     /**
     
     /**
-     * Property: isLoading
-     * {Boolean} Is the tile loading?
+     * APIProperty: value
+     * {<OpenLayers.Bounds> || <OpenLayers.Geometry>} The bounds or geometry
+     *     to be used by the filter.  Use bounds for BBOX filters and geometry
+     *     for INTERSECTS or DWITHIN filters.
      */
      */
-    isLoading: false,
-    
-    /** TBD 3.0 -- remove 'url' from the list of parameters to the constructor.
-     *             there is no need for the base tile class to have a url.
+    value: null,
+
+    /**
+     * APIProperty: distance
+     * {Number} The distance to use in a DWithin spatial filter.
      */
      */
+    distance: null,
 
 
+    /**
+     * APIProperty: distanceUnits
+     * {String} The units to use for the distance, e.g. 'm'.
+     */
+    distanceUnits: null,
+    
     /** 
     /** 
-     * Constructor: OpenLayers.Tile
-     * Constructor for a new <OpenLayers.Tile> instance.
-     * 
+     * Constructor: OpenLayers.Filter.Spatial
+     * Creates a spatial filter.
+     *
      * Parameters:
      * Parameters:
-     * layer - {<OpenLayers.Layer>} layer that the tile will go in.
-     * position - {<OpenLayers.Pixel>}
-     * bounds - {<OpenLayers.Bounds>}
-     * url - {<String>}
-     * size - {<OpenLayers.Size>}
-     * options - {Object}
-     */   
-    initialize: function(layer, position, bounds, url, size, options) {
-        this.layer = layer;
-        this.position = position.clone();
-        this.setBounds(bounds);
-        this.url = url;
-        if (size) {
-            this.size = size.clone();
-        }
-
-        //give the tile a unique id based on its BBOX.
-        this.id = OpenLayers.Util.createUniqueID("Tile_");
-
-        OpenLayers.Util.extend(this, options);
+     * options - {Object} An optional object with properties to set on the
+     *     filter.
+     * 
+     * Returns:
+     * {<OpenLayers.Filter.Spatial>}
+     */
 
 
-        this.events = new OpenLayers.Events(this);
-        if (this.eventListeners instanceof Object) {
-            this.events.on(this.eventListeners);
+   /**
+    * Method: evaluate
+    * Evaluates this filter for a specific feature.
+    * 
+    * Parameters:
+    * feature - {<OpenLayers.Feature.Vector>} feature to apply the filter to.
+    * 
+    * Returns:
+    * {Boolean} The feature meets filter criteria.
+    */
+    evaluate: function(feature) {
+        var intersect = false;
+        switch(this.type) {
+            case OpenLayers.Filter.Spatial.BBOX:
+            case OpenLayers.Filter.Spatial.INTERSECTS:
+                if(feature.geometry) {
+                    var geom = this.value;
+                    if(this.value.CLASS_NAME == "OpenLayers.Bounds") {
+                        geom = this.value.toGeometry();
+                    }
+                    if(feature.geometry.intersects(geom)) {
+                        intersect = true;
+                    }
+                }
+                break;
+            default:
+                throw new Error('evaluate is not implemented for this filter type.');
         }
         }
+        return intersect;
     },
 
     /**
     },
 
     /**
-     * Method: unload
-     * Call immediately before destroying if you are listening to tile
-     * events, so that counters are properly handled if tile is still
-     * loading at destroy-time. Will only fire an event if the tile is
-     * still loading.
+     * APIMethod: clone
+     * Clones this filter.
+     * 
+     * Returns:
+     * {<OpenLayers.Filter.Spatial>} Clone of this filter.
      */
      */
-    unload: function() {
-       if (this.isLoading) { 
-           this.isLoading = false; 
-           this.events.triggerEvent("unload"); 
-       }
+    clone: function() {
+        var options = OpenLayers.Util.applyDefaults({
+            value: this.value && this.value.clone && this.value.clone()
+        }, this);
+        return new OpenLayers.Filter.Spatial(options);
     },
     },
+    CLASS_NAME: "OpenLayers.Filter.Spatial"
+});
+
+OpenLayers.Filter.Spatial.BBOX = "BBOX";
+OpenLayers.Filter.Spatial.INTERSECTS = "INTERSECTS";
+OpenLayers.Filter.Spatial.DWITHIN = "DWITHIN";
+OpenLayers.Filter.Spatial.WITHIN = "WITHIN";
+OpenLayers.Filter.Spatial.CONTAINS = "CONTAINS";
+/* ======================================================================
+    OpenLayers/Filter/FeatureId.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+
+/**
+ * @requires OpenLayers/Filter.js
+ */
+
+/**
+ * Class: OpenLayers.Filter.FeatureId
+ * This class represents a ogc:FeatureId Filter, as being used for rule-based SLD
+ * styling
+ * 
+ * Inherits from:
+ * - <OpenLayers.Filter>
+ */
+OpenLayers.Filter.FeatureId = OpenLayers.Class(OpenLayers.Filter, {
+
+    /** 
+     * APIProperty: fids
+     * {Array(String)} Feature Ids to evaluate this rule against. 
+     *     To be passed inside the params object.
+     */
+    fids: null,
     
     /** 
     
     /** 
-     * APIMethod: destroy
-     * Nullify references to prevent circular references and memory leaks.
+     * Property: type
+     * {String} Type to identify this filter.
      */
      */
-    destroy:function() {
-        this.layer  = null;
-        this.bounds = null;
-        this.size = null;
-        this.position = null;
-        
-        if (this.eventListeners) {
-            this.events.un(this.eventListeners);
-        }
-        this.events.destroy();
-        this.eventListeners = null;
-        this.events = null;
-    },
+    type: "FID",
     
     
-    /**
-     * Method: draw
-     * Clear whatever is currently in the tile, then return whether or not 
-     *     it should actually be re-drawn. This is an example implementation
-     *     that can be overridden by subclasses. The minimum thing to do here
-     *     is to call <clear> and return the result from <shouldDraw>.
+    /** 
+     * Constructor: OpenLayers.Filter.FeatureId
+     * Creates an ogc:FeatureId rule.
      *
      * Parameters:
      *
      * Parameters:
-     * force - {Boolean} If true, the tile will not be cleared and no beforedraw
-     *     event will be fired. This is used for drawing tiles asynchronously
-     *     after drawing has been cancelled by returning false from a beforedraw
-     *     listener.
+     * options - {Object} An optional object with properties to set on the
+     *           rule
      * 
      * Returns:
      * 
      * Returns:
-     * {Boolean} Whether or not the tile should actually be drawn. Returns null
-     *     if a beforedraw listener returned false.
+     * {<OpenLayers.Filter.FeatureId>}
      */
      */
-    draw: function(force) {
-        if (!force) {
-            //clear tile's contents and mark as not drawn
-            this.clear();
-        }
-        var draw = this.shouldDraw();
-        if (draw && !force && this.events.triggerEvent("beforedraw") === false) {
-            draw = null;
-        }
-        return draw;
+    initialize: function(options) {
+        this.fids = [];
+        OpenLayers.Filter.prototype.initialize.apply(this, [options]);
     },
     },
-    
+
     /**
     /**
-     * Method: shouldDraw
-     * Return whether or not the tile should actually be (re-)drawn. The only
-     * case where we *wouldn't* want to draw the tile is if the tile is outside
-     * its layer's maxExtent
+     * APIMethod: evaluate
+     * evaluates this rule for a specific feature
+     * 
+     * Parameters:
+     * feature - {<OpenLayers.Feature>} feature to apply the rule to.
+     *           For vector features, the check is run against the fid,
+     *           for plain features against the id.
      * 
      * Returns:
      * 
      * Returns:
-     * {Boolean} Whether or not the tile should actually be drawn.
+     * {Boolean} true if the rule applies, false if it does not
      */
      */
-    shouldDraw: function() {        
-        var withinMaxExtent = false,
-            maxExtent = this.layer.maxExtent;
-        if (maxExtent) {
-            var map = this.layer.map;
-            var worldBounds = map.baseLayer.wrapDateLine && map.getMaxExtent();
-            if (this.bounds.intersectsBounds(maxExtent, {inclusive: false, worldBounds: worldBounds})) {
-                withinMaxExtent = true;
+    evaluate: function(feature) {
+        for (var i=0, len=this.fids.length; i<len; i++) {
+            var fid = feature.fid || feature.id;
+            if (fid == this.fids[i]) {
+                return true;
             }
         }
             }
         }
-        
-        return withinMaxExtent || this.layer.displayOutsideMaxExtent;
+        return false;
     },
     
     /**
     },
     
     /**
-     * Method: setBounds
-     * Sets the bounds on this instance
-     *
-     * Parameters:
-     * bounds {<OpenLayers.Bounds>}
-     */
-    setBounds: function(bounds) {
-        bounds = bounds.clone();
-        if (this.layer.map.baseLayer.wrapDateLine) {
-            var worldExtent = this.layer.map.getMaxExtent(),
-                tolerance = this.layer.map.getResolution();
-            bounds = bounds.wrapDateLine(worldExtent, {
-                leftTolerance: tolerance,
-                rightTolerance: tolerance
-            });
-        }
-        this.bounds = bounds;
-    },
-    
-    /** 
-     * Method: moveTo
-     * Reposition the tile.
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * redraw - {Boolean} Call draw method on tile after moving.
-     *     Default is true
-     */
-    moveTo: function (bounds, position, redraw) {
-        if (redraw == null) {
-            redraw = true;
-        }
-
-        this.setBounds(bounds);
-        this.position = position.clone();
-        if (redraw) {
-            this.draw();
-        }
-    },
-
-    /** 
-     * Method: clear
-     * Clear the tile of any bounds/position-related data so that it can 
-     *     be reused in a new location.
+     * APIMethod: clone
+     * Clones this filter.
+     * 
+     * Returns:
+     * {<OpenLayers.Filter.FeatureId>} Clone of this filter.
      */
      */
-    clear: function(draw) {
-        // to be extended by subclasses
+    clone: function() {
+        var filter = new OpenLayers.Filter.FeatureId();
+        OpenLayers.Util.extend(filter, this);
+        filter.fids = this.fids.slice();
+        return filter;
     },
     
     },
     
-    CLASS_NAME: "OpenLayers.Tile"
+    CLASS_NAME: "OpenLayers.Filter.FeatureId"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Tile/Image.js
+    OpenLayers/Format/WFST/v1.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-
 /**
 /**
- * @requires OpenLayers/Tile.js
- * @requires OpenLayers/Animation.js
- * @requires OpenLayers/Util.js
+ * @requires OpenLayers/Format/XML.js
+ * @requires OpenLayers/Format/WFST.js
+ * @requires OpenLayers/Filter/Spatial.js
+ * @requires OpenLayers/Filter/FeatureId.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Tile.Image
- * Instances of OpenLayers.Tile.Image are used to manage the image tiles
- * used by various layers.  Create a new image tile with the
- * <OpenLayers.Tile.Image> constructor.
+ * Class: OpenLayers.Format.WFST.v1
+ * Superclass for WFST parsers.
  *
  * Inherits from:
  *
  * Inherits from:
- *  - <OpenLayers.Tile>
+ *  - <OpenLayers.Format.XML>
  */
  */
-OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
+OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
+    
+    /**
+     * Property: namespaces
+     * {Object} Mapping of namespace aliases to namespace URIs.
+     */
+    namespaces: {
+        xlink: "http://www.w3.org/1999/xlink",
+        xsi: "http://www.w3.org/2001/XMLSchema-instance",
+        wfs: "http://www.opengis.net/wfs",
+        gml: "http://www.opengis.net/gml",
+        ogc: "http://www.opengis.net/ogc",
+        ows: "http://www.opengis.net/ows",
+        xmlns: "http://www.w3.org/2000/xmlns/"
+    },
+    
+    /**
+     * Property: defaultPrefix
+     */
+    defaultPrefix: "wfs",
 
     /**
 
     /**
-     * APIProperty: events
-     * {<OpenLayers.Events>} An events object that handles all 
-     *     events on the tile.
-     *
-     * Register a listener for a particular event with the following syntax:
-     * (code)
-     * tile.events.register(type, obj, listener);
-     * (end)
-     *
-     * Supported event types (in addition to the <OpenLayers.Tile> events):
-     * beforeload - Triggered before an image is prepared for loading, when the
-     *     url for the image is known already. Listeners may call <setImage> on
-     *     the tile instance. If they do so, that image will be used and no new
-     *     one will be created.
+     * Property: version
+     * {String} WFS version number.
      */
      */
+    version: null,
 
 
-    /** 
-     * APIProperty: url
-     * {String} The URL of the image being requested. No default. Filled in by
-     * layer.getURL() function. May be modified by loadstart listeners.
+    /**
+     * Property: schemaLocation
+     * {String} Schema location for a particular minor version.
      */
      */
-    url: null,
+    schemaLocations: null,
     
     
-    /** 
-     * Property: imgDiv
-     * {HTMLImageElement} The image for this tile.
+    /**
+     * APIProperty: srsName
+     * {String} URI for spatial reference system.
      */
      */
-    imgDiv: null,
+    srsName: null,
+
+    /**
+     * APIProperty: extractAttributes
+     * {Boolean} Extract attributes from GML.  Default is true.
+     */
+    extractAttributes: true,
     
     /**
     
     /**
-     * Property: frame
-     * {DOMElement} The image element is appended to the frame.  Any gutter on
-     * the image will be hidden behind the frame. If no gutter is set,
-     * this will be null.
+     * APIProperty: xy
+     * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
+     * Changing is not recommended, a new Format should be instantiated.
      */ 
      */ 
-    frame: null, 
+    xy: true,
 
 
-    /** 
-     * Property: imageReloadAttempts
-     * {Integer} Attempts to load the image.
-     */
-    imageReloadAttempts: null,
-    
     /**
     /**
-     * Property: layerAlphaHack
-     * {Boolean} True if the png alpha hack needs to be applied on the layer's div.
+     * Property: stateName
+     * {Object} Maps feature states to node names.
      */
      */
-    layerAlphaHack: null,
+    stateName: null,
     
     /**
     
     /**
-     * Property: asyncRequestId
-     * {Integer} ID of an request to see if request is still valid. This is a
-     * number which increments by 1 for each asynchronous request.
-     */
-    asyncRequestId: null,
-    
-    /**
-     * APIProperty: maxGetUrlLength
-     * {Number} If set, requests that would result in GET urls with more
-     * characters than the number provided will be made using form-encoded
-     * HTTP POST. It is good practice to avoid urls that are longer than 2048
-     * characters.
+     * Constructor: OpenLayers.Format.WFST.v1
+     * Instances of this class are not created directly.  Use the
+     *     <OpenLayers.Format.WFST.v1_0_0> or <OpenLayers.Format.WFST.v1_1_0>
+     *     constructor instead.
      *
      *
-     * Caution:
-     * Older versions of Gecko based browsers (e.g. Firefox < 3.5) and most
-     * Opera versions do not fully support this option. On all browsers,
-     * transition effects are not supported if POST requests are used.
-     */
-    maxGetUrlLength: null,
-
-    /**
-     * Property: canvasContext
-     * {CanvasRenderingContext2D} A canvas context associated with
-     * the tile image.
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
      */
      */
-    canvasContext: null,
+    initialize: function(options) {
+        // set state name mapping
+        this.stateName = {};
+        this.stateName[OpenLayers.State.INSERT] = "wfs:Insert";
+        this.stateName[OpenLayers.State.UPDATE] = "wfs:Update";
+        this.stateName[OpenLayers.State.DELETE] = "wfs:Delete";
+        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+    },
     
     /**
     
     /**
-     * APIProperty: crossOriginKeyword
-     * The value of the crossorigin keyword to use when loading images. This is
-     * only relevant when using <getCanvasContext> for tiles from remote
-     * origins and should be set to either 'anonymous' or 'use-credentials'
-     * for servers that send Access-Control-Allow-Origin headers with their
-     * tiles.
-     */
-    crossOriginKeyword: null,
-
-    /** TBD 3.0 - reorder the parameters to the init function to remove 
-     *             URL. the getUrl() function on the layer gets called on 
-     *             each draw(), so no need to specify it here.
+     * Method: getSrsName
      */
      */
+    getSrsName: function(feature, options) {
+        var srsName = options && options.srsName;
+        if(!srsName) {
+            if(feature && feature.layer) {
+                srsName = feature.layer.projection.getCode();
+            } else {
+                srsName = this.srsName;
+            }
+        }
+        return srsName;
+    },
 
 
-    /** 
-     * Constructor: OpenLayers.Tile.Image
-     * Constructor for a new <OpenLayers.Tile.Image> instance.
-     * 
+    /**
+     * APIMethod: read
+     * Parse the response from a transaction.  Because WFS is split into
+     *     Transaction requests (create, update, and delete) and GetFeature
+     *     requests (read), this method handles parsing of both types of
+     *     responses.
+     *
      * Parameters:
      * Parameters:
-     * layer - {<OpenLayers.Layer>} layer that the tile will go in.
-     * position - {<OpenLayers.Pixel>}
-     * bounds - {<OpenLayers.Bounds>}
-     * url - {<String>} Deprecated. Remove me in 3.0.
-     * size - {<OpenLayers.Size>}
-     * options - {Object}
-     */   
-    initialize: function(layer, position, bounds, url, size, options) {
-        OpenLayers.Tile.prototype.initialize.apply(this, arguments);
-
-        this.url = url; //deprecated remove me
+     * data - {String | Document} The WFST document to read
+     * options - {Object} Options for the reader
+     *
+     * Valid options properties:
+     * output - {String} either "features" or "object". The default is
+     *     "features", which means that the method will return an array of
+     *     features. If set to "object", an object with a "features" property
+     *     and other properties read by the parser will be returned.
+     *
+     * Returns:
+     * {Array | Object} Output depending on the output option.
+     */
+    read: function(data, options) {
+        options = options || {};
+        OpenLayers.Util.applyDefaults(options, {
+            output: "features"
+        });
         
         
-        this.layerAlphaHack = this.layer.alpha && OpenLayers.Util.alphaHack();
-
-        if (this.maxGetUrlLength != null || this.layer.gutter || this.layerAlphaHack) {
-            // only create frame if it's needed
-            this.frame = document.createElement("div");
-            this.frame.style.position = "absolute";
-            this.frame.style.overflow = "hidden";
+        if(typeof data == "string") { 
+            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
         }
         }
-        if (this.maxGetUrlLength != null) {
-            OpenLayers.Util.extend(this, OpenLayers.Tile.Image.IFrame);
+        if(data && data.nodeType == 9) {
+            data = data.documentElement;
+        }
+        var obj = {};
+        if(data) {
+            this.readNode(data, obj, true);
+        }
+        if(obj.features && options.output === "features") {
+            obj = obj.features;
         }
         }
+        return obj;
     },
     
     },
     
-    /** 
-     * APIMethod: destroy
-     * nullify references to prevent circular references and memory leaks
+    /**
+     * Property: readers
+     * Contains public functions, grouped by namespace prefix, that will
+     *     be applied when a namespaced node is found matching the function
+     *     name.  The function will be applied in the scope of this parser
+     *     with two arguments: the node being read and a context object passed
+     *     from the parent.
      */
      */
-    destroy: function() {
-        if (this.imgDiv)  {
-            this.clear();
-            this.imgDiv = null;
-            this.frame = null;
+    readers: {
+        "wfs": {
+            "FeatureCollection": function(node, obj) {
+                obj.features = [];
+                this.readChildNodes(node, obj);
+            }
         }
         }
-        // don't handle async requests any more
-        this.asyncRequestId = null;
-        OpenLayers.Tile.prototype.destroy.apply(this, arguments);
     },
     
     /**
     },
     
     /**
-     * Method: draw
-     * Check that a tile should be drawn, and draw it.
-     * 
+     * Method: write
+     * Given an array of features, write a WFS transaction.  This assumes
+     *     the features have a state property that determines the operation
+     *     type - insert, update, or delete.
+     *
+     * Parameters:
+     * features - {Array(<OpenLayers.Feature.Vector>)} A list of features. See
+     *     below for a more detailed description of the influence of the
+     *     feature's *modified* property.
+     * options - {Object}
+     *
+     * feature.modified rules:
+     * If a feature has a modified property set, the following checks will be
+     * made before a feature's geometry or attribute is included in an Update
+     * transaction:
+     * - *modified* is not set at all: The geometry and all attributes will be
+     *     included.
+     * - *modified.geometry* is set (null or a geometry): The geometry will be
+     *     included. If *modified.attributes* is not set, all attributes will
+     *     be included.
+     * - *modified.attributes* is set: Only the attributes set in 
+     *     *modified.attributes* will be included.
+     *     If *modified.geometry* is not set, the geometry will not be included.
+     *
+     * Valid options include:
+     * - *multi* {Boolean} If set to true, geometries will be casted to
+     *   Multi geometries before writing.
+     *
      * Returns:
      * Returns:
-     * {Boolean} Was a tile drawn? Or null if a beforedraw listener returned
-     *     false.
+     * {String} A serialized WFS transaction.
      */
      */
-    draw: function() {
-        var shouldDraw = OpenLayers.Tile.prototype.draw.apply(this, arguments);
-        if (shouldDraw) {
-            // The layer's reproject option is deprecated.
-            if (this.layer != this.layer.map.baseLayer && this.layer.reproject) {
-                // getBoundsFromBaseLayer is defined in deprecated.js.
-                this.bounds = this.getBoundsFromBaseLayer(this.position);
-            }
-            if (this.isLoading) {
-                //if we're already loading, send 'reload' instead of 'loadstart'.
-                this._loadEvent = "reload";
-            } else {
-                this.isLoading = true;
-                this._loadEvent = "loadstart";
-            }
-            this.renderTile();
-            this.positionTile();
-        } else if (shouldDraw === false) {
-            this.unload();
+    write: function(features, options) {
+        var node = this.writeNode("wfs:Transaction", {
+            features:features,
+            options: options
+        });
+        var value = this.schemaLocationAttr();
+        if(value) {
+            this.setAttributeNS(
+                node, this.namespaces["xsi"], "xsi:schemaLocation",  value
+            );
         }
         }
-        return shouldDraw;
+        return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
     },
     
     /**
     },
     
     /**
-     * Method: renderTile
-     * Internal function to actually initialize the image tile,
-     *     position it correctly, and set its url.
+     * Property: writers
+     * As a compliment to the readers property, this structure contains public
+     *     writing functions grouped by namespace alias and named like the
+     *     node names they produce.
      */
      */
-    renderTile: function() {
-        if (this.layer.async) {
-            // Asynchronous image requests call the asynchronous getURL method
-            // on the layer to fetch an image that covers 'this.bounds'.
-            var id = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
-            this.layer.getURLasync(this.bounds, function(url) {
-                if (id == this.asyncRequestId) {
-                    this.url = url;
-                    this.initImage();
+    writers: {
+        "wfs": {
+            "GetFeature": function(options) {
+                var node = this.createElementNSPlus("wfs:GetFeature", {
+                    attributes: {
+                        service: "WFS",
+                        version: this.version,
+                        handle: options && options.handle,
+                        outputFormat: options && options.outputFormat,
+                        maxFeatures: options && options.maxFeatures,
+                        viewParams: options && options.viewParams,
+                        "xsi:schemaLocation": this.schemaLocationAttr(options)
+                    }
+                });
+                if (typeof this.featureType == "string") {
+                    this.writeNode("Query", options, node);
+                } else {
+                    for (var i=0,len = this.featureType.length; i<len; i++) { 
+                        options.featureType = this.featureType[i]; 
+                        this.writeNode("Query", options, node); 
+                    } 
                 }
                 }
-            }, this);
-        } else {
-            // synchronous image requests get the url immediately.
-            this.url = this.layer.getURL(this.bounds);
-            this.initImage();
+                return node;
+            },
+            "Transaction": function(obj) {
+                obj = obj || {};
+                var options = obj.options || {};
+                var node = this.createElementNSPlus("wfs:Transaction", {
+                    attributes: {
+                        service: "WFS",
+                        version: this.version,
+                        handle: options.handle
+                    }
+                });
+                var i, len;
+                var features = obj.features;
+                if(features) {
+                    // temporarily re-assigning geometry types
+                    if (options.multi === true) {
+                        OpenLayers.Util.extend(this.geometryTypes, {
+                            "OpenLayers.Geometry.Point": "MultiPoint",
+                            "OpenLayers.Geometry.LineString": (this.multiCurve === true) ? "MultiCurve": "MultiLineString",
+                            "OpenLayers.Geometry.Polygon": (this.multiSurface === true) ? "MultiSurface" : "MultiPolygon"
+                        });
+                    }
+                    var name, feature;
+                    for(i=0, len=features.length; i<len; ++i) {
+                        feature = features[i];
+                        name = this.stateName[feature.state];
+                        if(name) {
+                            this.writeNode(name, {
+                                feature: feature, 
+                                options: options
+                            }, node);
+                        }
+                    }
+                    // switch back to original geometry types assignment
+                    if (options.multi === true) {
+                        this.setGeometryTypes();
+                    }
+                }
+                if (options.nativeElements) {
+                    for (i=0, len=options.nativeElements.length; i<len; ++i) {
+                        this.writeNode("wfs:Native", 
+                            options.nativeElements[i], node);
+                    }
+                }
+                return node;
+            },
+            "Native": function(nativeElement) {
+                var node = this.createElementNSPlus("wfs:Native", {
+                    attributes: {
+                        vendorId: nativeElement.vendorId,
+                        safeToIgnore: nativeElement.safeToIgnore
+                    },
+                    value: nativeElement.value
+                });
+                return node;
+            },
+            "Insert": function(obj) {
+                var feature = obj.feature;
+                var options = obj.options;
+                var node = this.createElementNSPlus("wfs:Insert", {
+                    attributes: {
+                        handle: options && options.handle
+                    }
+                });
+                this.srsName = this.getSrsName(feature);
+                this.writeNode("feature:_typeName", feature, node);
+                return node;
+            },
+            "Update": function(obj) {
+                var feature = obj.feature;
+                var options = obj.options;
+                var node = this.createElementNSPlus("wfs:Update", {
+                    attributes: {
+                        handle: options && options.handle,
+                        typeName: (this.featureNS ? this.featurePrefix + ":" : "") +
+                            this.featureType
+                    }
+                });
+                if(this.featureNS) {
+                    this.setAttributeNS(
+                        node, this.namespaces.xmlns,
+                        "xmlns:" + this.featurePrefix, this.featureNS
+                    );
+                }
+                
+                // add in geometry
+                var modified = feature.modified;
+                if (this.geometryName !== null && (!modified || modified.geometry !== undefined)) {
+                    this.srsName = this.getSrsName(feature);
+                    this.writeNode(
+                        "Property", {name: this.geometryName, value: feature.geometry}, node
+                    );
+                }
+        
+                // add in attributes
+                for(var key in feature.attributes) {
+                    if(feature.attributes[key] !== undefined &&
+                                (!modified || !modified.attributes ||
+                                (modified.attributes && (key in modified.attributes)))) {
+                        this.writeNode(
+                            "Property", {name: key, value: feature.attributes[key]}, node
+                        );
+                    }
+                }
+                
+                // add feature id filter
+                this.writeNode("ogc:Filter", new OpenLayers.Filter.FeatureId({
+                    fids: [feature.fid]
+                }), node);
+        
+                return node;
+            },
+            "Property": function(obj) {
+                var node = this.createElementNSPlus("wfs:Property");
+                this.writeNode("Name", obj.name, node);
+                if(obj.value !== null) {
+                    this.writeNode("Value", obj.value, node);
+                }
+                return node;
+            },
+            "Name": function(name) {
+                return this.createElementNSPlus("wfs:Name", {value: name});
+            },
+            "Value": function(obj) {
+                var node;
+                if(obj instanceof OpenLayers.Geometry) {
+                    node = this.createElementNSPlus("wfs:Value");
+                    var geom = this.writeNode("feature:_geometry", obj).firstChild;
+                    node.appendChild(geom);
+                } else {
+                    node = this.createElementNSPlus("wfs:Value", {value: obj});                
+                }
+                return node;
+            },
+            "Delete": function(obj) {
+                var feature = obj.feature;
+                var options = obj.options;
+                var node = this.createElementNSPlus("wfs:Delete", {
+                    attributes: {
+                        handle: options && options.handle,
+                        typeName: (this.featureNS ? this.featurePrefix + ":" : "") +
+                            this.featureType
+                    }
+                });
+                if(this.featureNS) {
+                    this.setAttributeNS(
+                        node, this.namespaces.xmlns,
+                        "xmlns:" + this.featurePrefix, this.featureNS
+                    );
+                }
+                this.writeNode("ogc:Filter", new OpenLayers.Filter.FeatureId({
+                    fids: [feature.fid]
+                }), node);
+                return node;
+            }
         }
     },
 
     /**
         }
     },
 
     /**
-     * Method: positionTile
-     * Using the properties currenty set on the layer, position the tile correctly.
-     * This method is used both by the async and non-async versions of the Tile.Image
-     * code.
+     * Method: schemaLocationAttr
+     * Generate the xsi:schemaLocation attribute value.
+     *
+     * Returns:
+     * {String} The xsi:schemaLocation attribute or undefined if none.
      */
      */
-    positionTile: function() {
-        var style = this.getTile().style,
-            size = this.frame ? this.size :
-                this.layer.getImageSize(this.bounds),
-            ratio = 1;
-        if (this.layer instanceof OpenLayers.Layer.Grid) {
-            ratio = this.layer.getServerResolution() / this.layer.map.getResolution();
+    schemaLocationAttr: function(options) {
+        options = OpenLayers.Util.extend({
+            featurePrefix: this.featurePrefix,
+            schema: this.schema
+        }, options);
+        var schemaLocations = OpenLayers.Util.extend({}, this.schemaLocations);
+        if(options.schema) {
+            schemaLocations[options.featurePrefix] = options.schema;
         }
         }
-        style.left = this.position.x + "px";
-        style.top = this.position.y + "px";
-        style.width = Math.round(ratio * size.w) + "px";
-        style.height = Math.round(ratio * size.h) + "px";
-    },
-
-    /** 
-     * Method: clear
-     * Remove the tile from the DOM, clear it of any image related data so that
-     * it can be reused in a new location.
-     */
-    clear: function() {
-        OpenLayers.Tile.prototype.clear.apply(this, arguments);
-        var img = this.imgDiv;
-        if (img) {
-            var tile = this.getTile();
-            if (tile.parentNode === this.layer.div) {
-                this.layer.div.removeChild(tile);
-            }
-            this.setImgSrc();
-            if (this.layerAlphaHack === true) {
-                img.style.filter = "";
+        var parts = [];
+        var uri;
+        for(var key in schemaLocations) {
+            uri = this.namespaces[key];
+            if(uri) {
+                parts.push(uri + " " + schemaLocations[key]);
             }
             }
-            OpenLayers.Element.removeClass(img, "olImageLoadError");
         }
         }
-        this.canvasContext = null;
+        var value = parts.join(" ") || undefined;
+        return value;
     },
     
     /**
     },
     
     /**
-     * Method: getImage
-     * Returns or creates and returns the tile image.
+     * Method: setFilterProperty
+     * Set the property of each spatial filter.
+     *
+     * Parameters:
+     * filter - {<OpenLayers.Filter>}
      */
      */
-    getImage: function() {
-        if (!this.imgDiv) {
-            this.imgDiv = OpenLayers.Tile.Image.IMAGE.cloneNode(false);
-
-            var style = this.imgDiv.style;
-            if (this.frame) {
-                var left = 0, top = 0;
-                if (this.layer.gutter) {
-                    left = this.layer.gutter / this.layer.tileSize.w * 100;
-                    top = this.layer.gutter / this.layer.tileSize.h * 100;
-                }
-                style.left = -left + "%";
-                style.top = -top + "%";
-                style.width = (2 * left + 100) + "%";
-                style.height = (2 * top + 100) + "%";
-            }
-            style.visibility = "hidden";
-            style.opacity = 0;
-            if (this.layer.opacity < 1) {
-                style.filter = 'alpha(opacity=' +
-                               (this.layer.opacity * 100) +
-                               ')';
-            }
-            style.position = "absolute";
-            if (this.layerAlphaHack) {
-                // move the image out of sight
-                style.paddingTop = style.height;
-                style.height = "0";
-                style.width = "100%";
+    setFilterProperty: function(filter) {
+        if(filter.filters) {
+            for(var i=0, len=filter.filters.length; i<len; ++i) {
+                OpenLayers.Format.WFST.v1.prototype.setFilterProperty.call(this, filter.filters[i]);
             }
             }
-            if (this.frame) {
-                this.frame.appendChild(this.imgDiv);
+        } else {
+            if(filter instanceof OpenLayers.Filter.Spatial && !filter.property) {
+                // got a spatial filter without property, so set it
+                filter.property = this.geometryName;
             }
         }
             }
         }
-
-        return this.imgDiv;
-    },
-    
-    /**
-     * APIMethod: setImage
-     * Sets the image element for this tile. This method should only be called
-     * from beforeload listeners.
-     *
-     * Parameters
-     * img - {HTMLImageElement} The image to use for this tile.
-     */
-    setImage: function(img) {
-        this.imgDiv = img;
     },
 
     },
 
-    /**
-     * Method: initImage
-     * Creates the content for the frame on the tile.
-     */
-    initImage: function() {
-        if (!this.url && !this.imgDiv) {
-            // fast path out - if there is no tile url and no previous image
-            this.isLoading = false;
-            return;
-        }
-        this.events.triggerEvent('beforeload');
-        this.layer.div.appendChild(this.getTile());
-        this.events.triggerEvent(this._loadEvent);
-        var img = this.getImage();
-        var src = img.getAttribute('src') || '';
-        if (this.url && OpenLayers.Util.isEquivalentUrl(src, this.url)) {
-            this._loadTimeout = window.setTimeout(
-                OpenLayers.Function.bind(this.onImageLoad, this), 0
-            );
-        } else {
-            this.stopLoading();
-            if (this.crossOriginKeyword) {
-                img.removeAttribute("crossorigin");
-            }
-            OpenLayers.Event.observe(img, "load",
-                OpenLayers.Function.bind(this.onImageLoad, this)
-            );
-            OpenLayers.Event.observe(img, "error",
-                OpenLayers.Function.bind(this.onImageError, this)
-            );
-            this.imageReloadAttempts = 0;
-            this.setImgSrc(this.url);
-        }
-    },
-    
-    /**
-     * Method: setImgSrc
-     * Sets the source for the tile image
-     *
-     * Parameters:
-     * url - {String} or undefined to hide the image
-     */
-    setImgSrc: function(url) {
-        var img = this.imgDiv;
-        if (url) {
-            img.style.visibility = 'hidden';
-            img.style.opacity = 0;
-            // don't set crossOrigin if the url is a data URL
-            if (this.crossOriginKeyword) {
-                if (url.substr(0, 5) !== 'data:') {
-                    img.setAttribute("crossorigin", this.crossOriginKeyword);
-                } else {
-                    img.removeAttribute("crossorigin");
-                }
-            }
-            img.src = url;
-        } else {
-            // Remove reference to the image, and leave it to the browser's
-            // caching and garbage collection.
-            this.stopLoading();
-            this.imgDiv = null;
-            if (img.parentNode) {
-                img.parentNode.removeChild(img);
-            }
-        }
-    },
-    
-    /**
-     * Method: getTile
-     * Get the tile's markup.
-     *
-     * Returns:
-     * {DOMElement} The tile's markup
-     */
-    getTile: function() {
-        return this.frame ? this.frame : this.getImage();
-    },
-
-    /**
-     * Method: createBackBuffer
-     * Create a backbuffer for this tile. A backbuffer isn't exactly a clone
-     * of the tile's markup, because we want to avoid the reloading of the
-     * image. So we clone the frame, and steal the image from the tile.
-     *
-     * Returns:
-     * {DOMElement} The markup, or undefined if the tile has no image
-     * or if it's currently loading.
-     */
-    createBackBuffer: function() {
-        if (!this.imgDiv || this.isLoading) {
-            return;
-        }
-        var backBuffer;
-        if (this.frame) {
-            backBuffer = this.frame.cloneNode(false);
-            backBuffer.appendChild(this.imgDiv);
-        } else {
-            backBuffer = this.imgDiv;
-        }
-        this.imgDiv = null;
-        return backBuffer;
-    },
-
-    /**
-     * Method: onImageLoad
-     * Handler for the image onload event
-     */
-    onImageLoad: function() {
-        var img = this.imgDiv;
-        this.stopLoading();
-        img.style.visibility = 'inherit';
-        img.style.opacity = this.layer.opacity;
-        this.isLoading = false;
-        this.canvasContext = null;
-        this.events.triggerEvent("loadend");
-
-        if (this.layerAlphaHack === true) {
-            img.style.filter =
-                "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
-                img.src + "', sizingMethod='scale')";
-        }
-    },
-    
-    /**
-     * Method: onImageError
-     * Handler for the image onerror event
-     */
-    onImageError: function() {
-        var img = this.imgDiv;
-        if (img.src != null) {
-            this.imageReloadAttempts++;
-            if (this.imageReloadAttempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
-                this.setImgSrc(this.layer.getURL(this.bounds));
-            } else {
-                OpenLayers.Element.addClass(img, "olImageLoadError");
-                this.events.triggerEvent("loaderror");
-                this.onImageLoad();
-            }
-        }
-    },
-    
-    /**
-     * Method: stopLoading
-     * Stops a loading sequence so <onImageLoad> won't be executed.
-     */
-    stopLoading: function() {
-        OpenLayers.Event.stopObservingElement(this.imgDiv);
-        window.clearTimeout(this._loadTimeout);
-        delete this._loadTimeout;
-    },
-
-    /**
-     * APIMethod: getCanvasContext
-     * Returns a canvas context associated with the tile image (with
-     * the image drawn on it).
-     * Returns undefined if the browser does not support canvas, if
-     * the tile has no image or if it's currently loading.
-     *
-     * The function returns a canvas context instance but the
-     * underlying canvas is still available in the 'canvas' property:
-     * (code)
-     * var context = tile.getCanvasContext();
-     * if (context) {
-     *     var data = context.canvas.toDataURL('image/jpeg');
-     * }
-     * (end)
-     *
-     * Returns:
-     * {Boolean}
-     */
-    getCanvasContext: function() {
-        if (OpenLayers.CANVAS_SUPPORTED && this.imgDiv && !this.isLoading) {
-            if (!this.canvasContext) {
-                var canvas = document.createElement("canvas");
-                canvas.width = this.size.w;
-                canvas.height = this.size.h;
-                this.canvasContext = canvas.getContext("2d");
-                this.canvasContext.drawImage(this.imgDiv, 0, 0);
-            }
-            return this.canvasContext;
-        }
-    },
-
-    CLASS_NAME: "OpenLayers.Tile.Image"
-
-});
-
-/** 
- * Constant: OpenLayers.Tile.Image.IMAGE
- * {HTMLImageElement} The image for a tile.
- */
-OpenLayers.Tile.Image.IMAGE = (function() {
-    var img = new Image();
-    img.className = "olTileImage";
-    // avoid image gallery menu in IE6
-    img.galleryImg = "no";
-    return img;
-}());
-
-/* ======================================================================
-    OpenLayers/Layer/Image.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-/**
- * @requires OpenLayers/Layer.js
- * @requires OpenLayers/Tile/Image.js
- */
-
-/**
- * Class: OpenLayers.Layer.Image
- * Instances of OpenLayers.Layer.Image are used to display data from a web
- * accessible image as a map layer.  Create a new image layer with the
- * <OpenLayers.Layer.Image> constructor.
- *
- * Inherits from:
- *  - <OpenLayers.Layer>
- */
-OpenLayers.Layer.Image = OpenLayers.Class(OpenLayers.Layer, {
-
-    /**
-     * Property: isBaseLayer
-     * {Boolean} The layer is a base layer.  Default is true.  Set this property
-     * in the layer options
-     */
-    isBaseLayer: true,
-    
-    /**
-     * Property: url
-     * {String} URL of the image to use
-     */
-    url: null,
-
-    /**
-     * Property: extent
-     * {<OpenLayers.Bounds>} The image bounds in map units.  This extent will
-     *     also be used as the default maxExtent for the layer.  If you wish
-     *     to have a maxExtent that is different than the image extent, set the
-     *     maxExtent property of the options argument (as with any other layer).
-     */
-    extent: null,
-    
-    /**
-     * Property: size
-     * {<OpenLayers.Size>} The image size in pixels
-     */
-    size: null,
-
-    /**
-     * Property: tile
-     * {<OpenLayers.Tile.Image>}
-     */
-    tile: null,
-
-    /**
-     * Property: aspectRatio
-     * {Float} The ratio of height/width represented by a single pixel in the
-     * graphic
-     */
-    aspectRatio: null,
-
-    /**
-     * Constructor: OpenLayers.Layer.Image
-     * Create a new image layer
-     *
-     * Parameters:
-     * name - {String} A name for the layer.
-     * url - {String} Relative or absolute path to the image
-     * extent - {<OpenLayers.Bounds>} The extent represented by the image
-     * size - {<OpenLayers.Size>} The size (in pixels) of the image
-     * options - {Object} Hashtable of extra options to tag onto the layer
-     */
-    initialize: function(name, url, extent, size, options) {
-        this.url = url;
-        this.extent = extent;
-        this.maxExtent = extent;
-        this.size = size;
-        OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
-
-        this.aspectRatio = (this.extent.getHeight() / this.size.h) /
-                           (this.extent.getWidth() / this.size.w);
-    },    
-
-    /**
-     * Method: destroy
-     * Destroy this layer
-     */
-    destroy: function() {
-        if (this.tile) {
-            this.removeTileMonitoringHooks(this.tile);
-            this.tile.destroy();
-            this.tile = null;
-        }
-        OpenLayers.Layer.prototype.destroy.apply(this, arguments);
-    },
-    
-    /**
-     * Method: clone
-     * Create a clone of this layer
-     *
-     * Paramters:
-     * obj - {Object} An optional layer (is this ever used?)
-     *
-     * Returns:
-     * {<OpenLayers.Layer.Image>} An exact copy of this layer
-     */
-    clone: function(obj) {
-        
-        if(obj == null) {
-            obj = new OpenLayers.Layer.Image(this.name,
-                                               this.url,
-                                               this.extent,
-                                               this.size,
-                                               this.getOptions());
-        }
-
-        //get all additions from superclasses
-        obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
-
-        // copy/set any non-init, non-simple values here
-
-        return obj;
-    },    
-    
-    /**
-     * APIMethod: setMap
-     * 
-     * Parameters:
-     * map - {<OpenLayers.Map>}
-     */
-    setMap: function(map) {
-        /**
-         * If nothing to do with resolutions has been set, assume a single
-         * resolution determined by ratio*extent/size - if an image has a
-         * pixel aspect ratio different than one (as calculated above), the
-         * image will be stretched in one dimension only.
-         */
-        if( this.options.maxResolution == null ) {
-            this.options.maxResolution = this.aspectRatio *
-                                         this.extent.getWidth() /
-                                         this.size.w;
-        }
-        OpenLayers.Layer.prototype.setMap.apply(this, arguments);
-    },
-
-    /** 
-     * Method: moveTo
-     * Create the tile for the image or resize it for the new resolution
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * zoomChanged - {Boolean}
-     * dragging - {Boolean}
-     */
-    moveTo:function(bounds, zoomChanged, dragging) {
-        OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
-
-        var firstRendering = (this.tile == null);
-
-        if(zoomChanged || firstRendering) {
-
-            //determine new tile size
-            this.setTileSize();
-
-            //determine new position (upper left corner of new bounds)
-            var ulPx = this.map.getLayerPxFromLonLat({
-                lon: this.extent.left,
-                lat: this.extent.top
-            });
-
-            if(firstRendering) {
-                //create the new tile
-                this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent, 
-                                                      null, this.tileSize);
-                this.addTileMonitoringHooks(this.tile);
-            } else {
-                //just resize the tile and set it's new position
-                this.tile.size = this.tileSize.clone();
-                this.tile.position = ulPx.clone();
-            }
-            this.tile.draw();
-        }
-    }, 
-
-    /**
-     * Set the tile size based on the map size.
-     */
-    setTileSize: function() {
-        var tileWidth = this.extent.getWidth() / this.map.getResolution();
-        var tileHeight = this.extent.getHeight() / this.map.getResolution();
-        this.tileSize = new OpenLayers.Size(tileWidth, tileHeight);
-    },
-
-    /** 
-     * Method: addTileMonitoringHooks
-     * This function takes a tile as input and adds the appropriate hooks to 
-     *     the tile so that the layer can keep track of the loading tiles.
-     * 
-     * Parameters: 
-     * tile - {<OpenLayers.Tile>}
-     */
-    addTileMonitoringHooks: function(tile) {
-        tile.onLoadStart = function() {
-            this.events.triggerEvent("loadstart");
-        };
-        tile.events.register("loadstart", this, tile.onLoadStart);
-      
-        tile.onLoadEnd = function() {
-            this.events.triggerEvent("loadend");
-        };
-        tile.events.register("loadend", this, tile.onLoadEnd);
-        tile.events.register("unload", this, tile.onLoadEnd);
-    },
-
-    /** 
-     * Method: removeTileMonitoringHooks
-     * This function takes a tile as input and removes the tile hooks 
-     *     that were added in <addTileMonitoringHooks>.
-     * 
-     * Parameters: 
-     * tile - {<OpenLayers.Tile>}
-     */
-    removeTileMonitoringHooks: function(tile) {
-        tile.unload();
-        tile.events.un({
-            "loadstart": tile.onLoadStart,
-            "loadend": tile.onLoadEnd,
-            "unload": tile.onLoadEnd,
-            scope: this
-        });
-    },
-    
-    /**
-     * APIMethod: setUrl
-     * 
-     * Parameters:
-     * newUrl - {String}
-     */
-    setUrl: function(newUrl) {
-        this.url = newUrl;
-        this.tile.draw();
-    },
-
-    /** 
-     * APIMethod: getURL
-     * The url we return is always the same (the image itself never changes)
-     *     so we can ignore the bounds parameter (it will always be the same, 
-     *     anyways) 
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     */
-    getURL: function(bounds) {
-        return this.url;
-    },
+    CLASS_NAME: "OpenLayers.Format.WFST.v1" 
 
 
-    CLASS_NAME: "OpenLayers.Layer.Image"
 });
 /* ======================================================================
     OpenLayers/Geometry.js
    ====================================================================== */
 
 });
 /* ======================================================================
     OpenLayers/Geometry.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -16197,7 +15674,7 @@ OpenLayers.Geometry.distanceSquaredToSegment = function(point, segment) {
     var y2 = segment.y2;
     var dx = x2 - x1;
     var dy = y2 - y1;
     var y2 = segment.y2;
     var dx = x2 - x1;
     var dy = y2 - y1;
-    var along = ((dx * (x0 - x1)) + (dy * (y0 - y1))) /
+    var along = (dx == 0 && dy == 0) ? 0 : ((dx * (x0 - x1)) + (dy * (y0 - y1))) /
                 (Math.pow(dx, 2) + Math.pow(dy, 2));
     var x, y;
     if(along <= 0.0) {
                 (Math.pow(dx, 2) + Math.pow(dy, 2));
     var x, y;
     if(along <= 0.0) {
@@ -16217,10 +15694,10 @@ OpenLayers.Geometry.distanceSquaredToSegment = function(point, segment) {
     };
 };
 /* ======================================================================
     };
 };
 /* ======================================================================
-    OpenLayers/Geometry/Collection.js
+    OpenLayers/Geometry/Point.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -16230,51 +15707,338 @@ OpenLayers.Geometry.distanceSquaredToSegment = function(point, segment) {
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Geometry.Collection
- * A Collection is exactly what it sounds like: A collection of different 
- * Geometries. These are stored in the local parameter <components> (which
- * can be passed as a parameter to the constructor). 
- * 
- * As new geometries are added to the collection, they are NOT cloned. 
- * When removing geometries, they need to be specified by reference (ie you 
- * have to pass in the *exact* geometry to be removed).
+ * Class: OpenLayers.Geometry.Point
+ * Point geometry class. 
  * 
  * 
- * The <getArea> and <getLength> functions here merely iterate through
- * the components, summing their respective areas and lengths.
- *
- * Create a new instance with the <OpenLayers.Geometry.Collection> constructor.
- *
  * Inherits from:
  *  - <OpenLayers.Geometry> 
  */
  * Inherits from:
  *  - <OpenLayers.Geometry> 
  */
-OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {
+OpenLayers.Geometry.Point = OpenLayers.Class(OpenLayers.Geometry, {
 
 
-    /**
-     * APIProperty: components
-     * {Array(<OpenLayers.Geometry>)} The component parts of this geometry
+    /** 
+     * APIProperty: 
+     * {float} 
      */
      */
-    components: null,
-    
-    /**
-     * Property: componentTypes
-     * {Array(String)} An array of class names representing the types of
-     * components that the collection can include.  A null value means the
-     * component types are not restricted.
+    x: null,
+
+    /** 
+     * APIProperty: y 
+     * {float} 
      */
      */
-    componentTypes: null,
+    y: null,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Geometry.Collection
-     * Creates a Geometry Collection -- a list of geoms.
-     *
-     * Parameters: 
-     * components - {Array(<OpenLayers.Geometry>)} Optional array of geometries
+     * Constructor: OpenLayers.Geometry.Point
+     * Construct a point geometry.
      *
      *
+     * Parameters:
+     * x - {float} 
+     * y - {float}
+     * 
      */
      */
-    initialize: function (components) {
+    initialize: function(x, y) {
         OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
         OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
-        this.components = [];
-        if (components != null) {
+        
+        this.x = parseFloat(x);
+        this.y = parseFloat(y);
+    },
+
+    /**
+     * APIMethod: clone
+     * 
+     * Returns:
+     * {<OpenLayers.Geometry.Point>} An exact clone of this OpenLayers.Geometry.Point
+     */
+    clone: function(obj) {
+        if (obj == null) {
+            obj = new OpenLayers.Geometry.Point(this.x, this.y);
+        }
+
+        // catch any randomly tagged-on properties
+        OpenLayers.Util.applyDefaults(obj, this);
+
+        return obj;
+    },
+
+    /** 
+     * Method: calculateBounds
+     * Create a new Bounds based on the lon/lat
+     */
+    calculateBounds: function () {
+        this.bounds = new OpenLayers.Bounds(this.x, this.y,
+                                            this.x, this.y);
+    },
+
+    /**
+     * APIMethod: distanceTo
+     * Calculate the closest distance between two geometries (on the x-y plane).
+     *
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>} The target geometry.
+     * options - {Object} Optional properties for configuring the distance
+     *     calculation.
+     *
+     * Valid options:
+     * details - {Boolean} Return details from the distance calculation.
+     *     Default is false.
+     * edge - {Boolean} Calculate the distance from this geometry to the
+     *     nearest edge of the target geometry.  Default is true.  If true,
+     *     calling distanceTo from a geometry that is wholly contained within
+     *     the target will result in a non-zero distance.  If false, whenever
+     *     geometries intersect, calling distanceTo will return 0.  If false,
+     *     details cannot be returned.
+     *
+     * Returns:
+     * {Number | Object} The distance between this geometry and the target.
+     *     If details is true, the return will be an object with distance,
+     *     x0, y0, x1, and x2 properties.  The x0 and y0 properties represent
+     *     the coordinates of the closest point on this geometry. The x1 and y1
+     *     properties represent the coordinates of the closest point on the
+     *     target geometry.
+     */
+    distanceTo: function(geometry, options) {
+        var edge = !(options && options.edge === false);
+        var details = edge && options && options.details;
+        var distance, x0, y0, x1, y1, result;
+        if(geometry instanceof OpenLayers.Geometry.Point) {
+            x0 = this.x;
+            y0 = this.y;
+            x1 = geometry.x;
+            y1 = geometry.y;
+            distance = Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2));
+            result = !details ?
+                distance : {x0: x0, y0: y0, x1: x1, y1: y1, distance: distance};
+        } else {
+            result = geometry.distanceTo(this, options);
+            if(details) {
+                // switch coord order since this geom is target
+                result = {
+                    x0: result.x1, y0: result.y1,
+                    x1: result.x0, y1: result.y0,
+                    distance: result.distance
+                };
+            }
+        }
+        return result;
+    },
+    
+    /** 
+     * APIMethod: equals
+     * Determine whether another geometry is equivalent to this one.  Geometries
+     *     are considered equivalent if all components have the same coordinates.
+     * 
+     * Parameters:
+     * geom - {<OpenLayers.Geometry.Point>} The geometry to test. 
+     *
+     * Returns:
+     * {Boolean} The supplied geometry is equivalent to this geometry.
+     */
+    equals: function(geom) {
+        var equals = false;
+        if (geom != null) {
+            equals = ((this.x == geom.x && this.y == geom.y) ||
+                      (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
+        }
+        return equals;
+    },
+    
+    /**
+     * Method: toShortString
+     *
+     * Returns:
+     * {String} Shortened String representation of Point object. 
+     *         (ex. <i>"5, 42"</i>)
+     */
+    toShortString: function() {
+        return (this.x + ", " + this.y);
+    },
+    
+    /**
+     * APIMethod: move
+     * Moves a geometry by the given displacement along positive x and y axes.
+     *     This modifies the position of the geometry and clears the cached
+     *     bounds.
+     *
+     * Parameters:
+     * x - {Float} Distance to move geometry in positive x direction. 
+     * y - {Float} Distance to move geometry in positive y direction.
+     */
+    move: function(x, y) {
+        this.x = this.x + x;
+        this.y = this.y + y;
+        this.clearBounds();
+    },
+
+    /**
+     * APIMethod: rotate
+     * Rotate a point around another.
+     *
+     * Parameters:
+     * angle - {Float} Rotation angle in degrees (measured counterclockwise
+     *                 from the positive x-axis)
+     * origin - {<OpenLayers.Geometry.Point>} Center point for the rotation
+     */
+    rotate: function(angle, origin) {
+        angle *= Math.PI / 180;
+        var radius = this.distanceTo(origin);
+        var theta = angle + Math.atan2(this.y - origin.y, this.x - origin.x);
+        this.x = origin.x + (radius * Math.cos(theta));
+        this.y = origin.y + (radius * Math.sin(theta));
+        this.clearBounds();
+    },
+    
+    /**
+     * APIMethod: getCentroid
+     *
+     * Returns:
+     * {<OpenLayers.Geometry.Point>} The centroid of the collection
+     */
+    getCentroid: function() {
+        return new OpenLayers.Geometry.Point(this.x, this.y);
+    },
+
+    /**
+     * APIMethod: resize
+     * Resize a point relative to some origin.  For points, this has the effect
+     *     of scaling a vector (from the origin to the point).  This method is
+     *     more useful on geometry collection subclasses.
+     *
+     * Parameters:
+     * scale - {Float} Ratio of the new distance from the origin to the old
+     *                 distance from the origin.  A scale of 2 doubles the
+     *                 distance between the point and origin.
+     * origin - {<OpenLayers.Geometry.Point>} Point of origin for resizing
+     * ratio - {Float} Optional x:y ratio for resizing.  Default ratio is 1.
+     * 
+     * Returns:
+     * {<OpenLayers.Geometry>} - The current geometry. 
+     */
+    resize: function(scale, origin, ratio) {
+        ratio = (ratio == undefined) ? 1 : ratio;
+        this.x = origin.x + (scale * ratio * (this.x - origin.x));
+        this.y = origin.y + (scale * (this.y - origin.y));
+        this.clearBounds();
+        return this;
+    },
+    
+    /**
+     * APIMethod: intersects
+     * Determine if the input geometry intersects this one.
+     *
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>} Any type of geometry.
+     *
+     * Returns:
+     * {Boolean} The input geometry intersects this one.
+     */
+    intersects: function(geometry) {
+        var intersect = false;
+        if(geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
+            intersect = this.equals(geometry);
+        } else {
+            intersect = geometry.intersects(this);
+        }
+        return intersect;
+    },
+    
+    /**
+     * APIMethod: transform
+     * Translate the x,y properties of the point from source to dest.
+     * 
+     * Parameters:
+     * source - {<OpenLayers.Projection>} 
+     * dest - {<OpenLayers.Projection>}
+     * 
+     * Returns:
+     * {<OpenLayers.Geometry>} 
+     */
+    transform: function(source, dest) {
+        if ((source && dest)) {
+            OpenLayers.Projection.transform(
+                this, source, dest); 
+            this.bounds = null;
+        }       
+        return this;
+    },
+
+    /**
+     * APIMethod: getVertices
+     * Return a list of all points in this geometry.
+     *
+     * Parameters:
+     * nodes - {Boolean} For lines, only return vertices that are
+     *     endpoints.  If false, for lines, only vertices that are not
+     *     endpoints will be returned.  If not provided, all vertices will
+     *     be returned.
+     *
+     * Returns:
+     * {Array} A list of all vertices in the geometry.
+     */
+    getVertices: function(nodes) {
+        return [this];
+    },
+
+    CLASS_NAME: "OpenLayers.Geometry.Point"
+});
+/* ======================================================================
+    OpenLayers/Geometry/Collection.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Geometry.js
+ */
+
+/**
+ * Class: OpenLayers.Geometry.Collection
+ * A Collection is exactly what it sounds like: A collection of different 
+ * Geometries. These are stored in the local parameter <components> (which
+ * can be passed as a parameter to the constructor). 
+ * 
+ * As new geometries are added to the collection, they are NOT cloned. 
+ * When removing geometries, they need to be specified by reference (ie you 
+ * have to pass in the *exact* geometry to be removed).
+ * 
+ * The <getArea> and <getLength> functions here merely iterate through
+ * the components, summing their respective areas and lengths.
+ *
+ * Create a new instance with the <OpenLayers.Geometry.Collection> constructor.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Geometry> 
+ */
+OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {
+
+    /**
+     * APIProperty: components
+     * {Array(<OpenLayers.Geometry>)} The component parts of this geometry
+     */
+    components: null,
+    
+    /**
+     * Property: componentTypes
+     * {Array(String)} An array of class names representing the types of
+     * components that the collection can include.  A null value means the
+     * component types are not restricted.
+     */
+    componentTypes: null,
+
+    /**
+     * Constructor: OpenLayers.Geometry.Collection
+     * Creates a Geometry Collection -- a list of geoms.
+     *
+     * Parameters: 
+     * components - {Array(<OpenLayers.Geometry>)} Optional array of geometries
+     *
+     */
+    initialize: function (components) {
+        OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
+        this.components = [];
+        if (components != null) {
             this.addComponents(components);
         }
     },
             this.addComponents(components);
         }
     },
@@ -16297,7 +16061,8 @@ OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {
      * {<OpenLayers.Geometry.Collection>} An exact clone of this collection
      */
     clone: function() {
      * {<OpenLayers.Geometry.Collection>} An exact clone of this collection
      */
     clone: function() {
-        var geometry = eval("new " + this.CLASS_NAME + "()");
+        var Constructor = OpenLayers.Util.getConstructor(this.CLASS_NAME);
+        var geometry = new Constructor();
         for(var i=0, len=this.components.length; i<len; i++) {
             geometry.addComponent(this.components[i].clone());
         }
         for(var i=0, len=this.components.length; i<len; i++) {
             geometry.addComponent(this.components[i].clone());
         }
@@ -16784,428 +16549,141 @@ OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {
     CLASS_NAME: "OpenLayers.Geometry.Collection"
 });
 /* ======================================================================
     CLASS_NAME: "OpenLayers.Geometry.Collection"
 });
 /* ======================================================================
-    OpenLayers/Geometry/Point.js
+    OpenLayers/Geometry/MultiPoint.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Geometry.js
+ * @requires OpenLayers/Geometry/Collection.js
+ * @requires OpenLayers/Geometry/Point.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Geometry.Point
- * Point geometry class. 
- * 
+ * Class: OpenLayers.Geometry.MultiPoint
+ * MultiPoint is a collection of Points.  Create a new instance with the
+ * <OpenLayers.Geometry.MultiPoint> constructor.
+ *
  * Inherits from:
  * Inherits from:
- *  - <OpenLayers.Geometry> 
+ *  - <OpenLayers.Geometry.Collection>
+ *  - <OpenLayers.Geometry>
  */
  */
-OpenLayers.Geometry.Point = OpenLayers.Class(OpenLayers.Geometry, {
+OpenLayers.Geometry.MultiPoint = OpenLayers.Class(
+  OpenLayers.Geometry.Collection, {
 
 
-    /** 
-     * APIProperty: x 
-     * {float} 
+    /**
+     * Property: componentTypes
+     * {Array(String)} An array of class names representing the types of
+     * components that the collection can include.  A null value means the
+     * component types are not restricted.
      */
      */
-    x: null,
+    componentTypes: ["OpenLayers.Geometry.Point"],
 
 
-    /** 
-     * APIProperty: y 
-     * {float} 
+    /**
+     * Constructor: OpenLayers.Geometry.MultiPoint
+     * Create a new MultiPoint Geometry
+     *
+     * Parameters:
+     * components - {Array(<OpenLayers.Geometry.Point>)} 
+     *
+     * Returns:
+     * {<OpenLayers.Geometry.MultiPoint>}
      */
      */
-    y: null,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Geometry.Point
-     * Construct a point geometry.
+     * APIMethod: addPoint
+     * Wrapper for <OpenLayers.Geometry.Collection.addComponent>
      *
      * Parameters:
      *
      * Parameters:
-     * x - {float} 
-     * y - {float}
-     * 
+     * point - {<OpenLayers.Geometry.Point>} Point to be added
+     * index - {Integer} Optional index
      */
      */
-    initialize: function(x, y) {
-        OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
-        
-        this.x = parseFloat(x);
-        this.y = parseFloat(y);
+    addPoint: function(point, index) {
+        this.addComponent(point, index);
     },
     },
-
+    
     /**
     /**
-     * APIMethod: clone
-     * 
-     * Returns:
-     * {<OpenLayers.Geometry.Point>} An exact clone of this OpenLayers.Geometry.Point
+     * APIMethod: removePoint
+     * Wrapper for <OpenLayers.Geometry.Collection.removeComponent>
+     *
+     * Parameters:
+     * point - {<OpenLayers.Geometry.Point>} Point to be removed
      */
      */
-    clone: function(obj) {
-        if (obj == null) {
-            obj = new OpenLayers.Geometry.Point(this.x, this.y);
-        }
+    removePoint: function(point){
+        this.removeComponent(point);
+    },
 
 
-        // catch any randomly tagged-on properties
-        OpenLayers.Util.applyDefaults(obj, this);
+    CLASS_NAME: "OpenLayers.Geometry.MultiPoint"
+});
+/* ======================================================================
+    OpenLayers/Geometry/Curve.js
+   ====================================================================== */
 
 
-        return obj;
-    },
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
 
 
-    /** 
-     * Method: calculateBounds
-     * Create a new Bounds based on the lon/lat
+/**
+ * @requires OpenLayers/Geometry/MultiPoint.js
+ */
+
+/**
+ * Class: OpenLayers.Geometry.Curve
+ * A Curve is a MultiPoint, whose points are assumed to be connected. To 
+ * this end, we provide a "getLength()" function, which iterates through 
+ * the points, summing the distances between them. 
+ * 
+ * Inherits: 
+ *  - <OpenLayers.Geometry.MultiPoint>
+ */
+OpenLayers.Geometry.Curve = OpenLayers.Class(OpenLayers.Geometry.MultiPoint, {
+
+    /**
+     * Property: componentTypes
+     * {Array(String)} An array of class names representing the types of 
+     *                 components that the collection can include.  A null 
+     *                 value means the component types are not restricted.
      */
      */
-    calculateBounds: function () {
-        this.bounds = new OpenLayers.Bounds(this.x, this.y,
-                                            this.x, this.y);
-    },
+    componentTypes: ["OpenLayers.Geometry.Point"],
 
     /**
 
     /**
-     * APIMethod: distanceTo
-     * Calculate the closest distance between two geometries (on the x-y plane).
-     *
+     * Constructor: OpenLayers.Geometry.Curve
+     * 
      * Parameters:
      * Parameters:
-     * geometry - {<OpenLayers.Geometry>} The target geometry.
-     * options - {Object} Optional properties for configuring the distance
-     *     calculation.
-     *
-     * Valid options:
-     * details - {Boolean} Return details from the distance calculation.
-     *     Default is false.
-     * edge - {Boolean} Calculate the distance from this geometry to the
-     *     nearest edge of the target geometry.  Default is true.  If true,
-     *     calling distanceTo from a geometry that is wholly contained within
-     *     the target will result in a non-zero distance.  If false, whenever
-     *     geometries intersect, calling distanceTo will return 0.  If false,
-     *     details cannot be returned.
-     *
-     * Returns:
-     * {Number | Object} The distance between this geometry and the target.
-     *     If details is true, the return will be an object with distance,
-     *     x0, y0, x1, and x2 properties.  The x0 and y0 properties represent
-     *     the coordinates of the closest point on this geometry. The x1 and y1
-     *     properties represent the coordinates of the closest point on the
-     *     target geometry.
+     * point - {Array(<OpenLayers.Geometry.Point>)}
      */
      */
-    distanceTo: function(geometry, options) {
-        var edge = !(options && options.edge === false);
-        var details = edge && options && options.details;
-        var distance, x0, y0, x1, y1, result;
-        if(geometry instanceof OpenLayers.Geometry.Point) {
-            x0 = this.x;
-            y0 = this.y;
-            x1 = geometry.x;
-            y1 = geometry.y;
-            distance = Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2));
-            result = !details ?
-                distance : {x0: x0, y0: y0, x1: x1, y1: y1, distance: distance};
-        } else {
-            result = geometry.distanceTo(this, options);
-            if(details) {
-                // switch coord order since this geom is target
-                result = {
-                    x0: result.x1, y0: result.y1,
-                    x1: result.x0, y1: result.y0,
-                    distance: result.distance
-                };
-            }
-        }
-        return result;
-    },
     
     
-    /** 
-     * APIMethod: equals
-     * Determine whether another geometry is equivalent to this one.  Geometries
-     *     are considered equivalent if all components have the same coordinates.
+    /**
+     * APIMethod: getLength
      * 
      * 
-     * Parameters:
-     * geom - {<OpenLayers.Geometry.Point>} The geometry to test. 
-     *
      * Returns:
      * Returns:
-     * {Boolean} The supplied geometry is equivalent to this geometry.
+     * {Float} The length of the curve
      */
      */
-    equals: function(geom) {
-        var equals = false;
-        if (geom != null) {
-            equals = ((this.x == geom.x && this.y == geom.y) ||
-                      (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
+    getLength: function() {
+        var length = 0.0;
+        if ( this.components && (this.components.length > 1)) {
+            for(var i=1, len=this.components.length; i<len; i++) {
+                length += this.components[i-1].distanceTo(this.components[i]);
+            }
         }
         }
-        return equals;
+        return length;
     },
     },
-    
+
     /**
     /**
-     * Method: toShortString
+     * APIMethod: getGeodesicLength
+     * Calculate the approximate length of the geometry were it projected onto
+     *     the earth.
      *
      *
+     * projection - {<OpenLayers.Projection>} The spatial reference system
+     *     for the geometry coordinates.  If not provided, Geographic/WGS84 is
+     *     assumed.
+     * 
      * Returns:
      * Returns:
-     * {String} Shortened String representation of Point object. 
-     *         (ex. <i>"5, 42"</i>)
-     */
-    toShortString: function() {
-        return (this.x + ", " + this.y);
-    },
-    
-    /**
-     * APIMethod: move
-     * Moves a geometry by the given displacement along positive x and y axes.
-     *     This modifies the position of the geometry and clears the cached
-     *     bounds.
-     *
-     * Parameters:
-     * x - {Float} Distance to move geometry in positive x direction. 
-     * y - {Float} Distance to move geometry in positive y direction.
-     */
-    move: function(x, y) {
-        this.x = this.x + x;
-        this.y = this.y + y;
-        this.clearBounds();
-    },
-
-    /**
-     * APIMethod: rotate
-     * Rotate a point around another.
-     *
-     * Parameters:
-     * angle - {Float} Rotation angle in degrees (measured counterclockwise
-     *                 from the positive x-axis)
-     * origin - {<OpenLayers.Geometry.Point>} Center point for the rotation
-     */
-    rotate: function(angle, origin) {
-        angle *= Math.PI / 180;
-        var radius = this.distanceTo(origin);
-        var theta = angle + Math.atan2(this.y - origin.y, this.x - origin.x);
-        this.x = origin.x + (radius * Math.cos(theta));
-        this.y = origin.y + (radius * Math.sin(theta));
-        this.clearBounds();
-    },
-    
-    /**
-     * APIMethod: getCentroid
-     *
-     * Returns:
-     * {<OpenLayers.Geometry.Point>} The centroid of the collection
-     */
-    getCentroid: function() {
-        return new OpenLayers.Geometry.Point(this.x, this.y);
-    },
-
-    /**
-     * APIMethod: resize
-     * Resize a point relative to some origin.  For points, this has the effect
-     *     of scaling a vector (from the origin to the point).  This method is
-     *     more useful on geometry collection subclasses.
-     *
-     * Parameters:
-     * scale - {Float} Ratio of the new distance from the origin to the old
-     *                 distance from the origin.  A scale of 2 doubles the
-     *                 distance between the point and origin.
-     * origin - {<OpenLayers.Geometry.Point>} Point of origin for resizing
-     * ratio - {Float} Optional x:y ratio for resizing.  Default ratio is 1.
-     * 
-     * Returns:
-     * {<OpenLayers.Geometry>} - The current geometry. 
-     */
-    resize: function(scale, origin, ratio) {
-        ratio = (ratio == undefined) ? 1 : ratio;
-        this.x = origin.x + (scale * ratio * (this.x - origin.x));
-        this.y = origin.y + (scale * (this.y - origin.y));
-        this.clearBounds();
-        return this;
-    },
-    
-    /**
-     * APIMethod: intersects
-     * Determine if the input geometry intersects this one.
-     *
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>} Any type of geometry.
-     *
-     * Returns:
-     * {Boolean} The input geometry intersects this one.
-     */
-    intersects: function(geometry) {
-        var intersect = false;
-        if(geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
-            intersect = this.equals(geometry);
-        } else {
-            intersect = geometry.intersects(this);
-        }
-        return intersect;
-    },
-    
-    /**
-     * APIMethod: transform
-     * Translate the x,y properties of the point from source to dest.
-     * 
-     * Parameters:
-     * source - {<OpenLayers.Projection>} 
-     * dest - {<OpenLayers.Projection>}
-     * 
-     * Returns:
-     * {<OpenLayers.Geometry>} 
-     */
-    transform: function(source, dest) {
-        if ((source && dest)) {
-            OpenLayers.Projection.transform(
-                this, source, dest); 
-            this.bounds = null;
-        }       
-        return this;
-    },
-
-    /**
-     * APIMethod: getVertices
-     * Return a list of all points in this geometry.
-     *
-     * Parameters:
-     * nodes - {Boolean} For lines, only return vertices that are
-     *     endpoints.  If false, for lines, only vertices that are not
-     *     endpoints will be returned.  If not provided, all vertices will
-     *     be returned.
-     *
-     * Returns:
-     * {Array} A list of all vertices in the geometry.
-     */
-    getVertices: function(nodes) {
-        return [this];
-    },
-
-    CLASS_NAME: "OpenLayers.Geometry.Point"
-});
-/* ======================================================================
-    OpenLayers/Geometry/MultiPoint.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Geometry/Collection.js
- * @requires OpenLayers/Geometry/Point.js
- */
-
-/**
- * Class: OpenLayers.Geometry.MultiPoint
- * MultiPoint is a collection of Points.  Create a new instance with the
- * <OpenLayers.Geometry.MultiPoint> constructor.
- *
- * Inherits from:
- *  - <OpenLayers.Geometry.Collection>
- *  - <OpenLayers.Geometry>
- */
-OpenLayers.Geometry.MultiPoint = OpenLayers.Class(
-  OpenLayers.Geometry.Collection, {
-
-    /**
-     * Property: componentTypes
-     * {Array(String)} An array of class names representing the types of
-     * components that the collection can include.  A null value means the
-     * component types are not restricted.
-     */
-    componentTypes: ["OpenLayers.Geometry.Point"],
-
-    /**
-     * Constructor: OpenLayers.Geometry.MultiPoint
-     * Create a new MultiPoint Geometry
-     *
-     * Parameters:
-     * components - {Array(<OpenLayers.Geometry.Point>)} 
-     *
-     * Returns:
-     * {<OpenLayers.Geometry.MultiPoint>}
-     */
-
-    /**
-     * APIMethod: addPoint
-     * Wrapper for <OpenLayers.Geometry.Collection.addComponent>
-     *
-     * Parameters:
-     * point - {<OpenLayers.Geometry.Point>} Point to be added
-     * index - {Integer} Optional index
-     */
-    addPoint: function(point, index) {
-        this.addComponent(point, index);
-    },
-    
-    /**
-     * APIMethod: removePoint
-     * Wrapper for <OpenLayers.Geometry.Collection.removeComponent>
-     *
-     * Parameters:
-     * point - {<OpenLayers.Geometry.Point>} Point to be removed
-     */
-    removePoint: function(point){
-        this.removeComponent(point);
-    },
-
-    CLASS_NAME: "OpenLayers.Geometry.MultiPoint"
-});
-/* ======================================================================
-    OpenLayers/Geometry/Curve.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Geometry/MultiPoint.js
- */
-
-/**
- * Class: OpenLayers.Geometry.Curve
- * A Curve is a MultiPoint, whose points are assumed to be connected. To 
- * this end, we provide a "getLength()" function, which iterates through 
- * the points, summing the distances between them. 
- * 
- * Inherits: 
- *  - <OpenLayers.Geometry.MultiPoint>
- */
-OpenLayers.Geometry.Curve = OpenLayers.Class(OpenLayers.Geometry.MultiPoint, {
-
-    /**
-     * Property: componentTypes
-     * {Array(String)} An array of class names representing the types of 
-     *                 components that the collection can include.  A null 
-     *                 value means the component types are not restricted.
-     */
-    componentTypes: ["OpenLayers.Geometry.Point"],
-
-    /**
-     * Constructor: OpenLayers.Geometry.Curve
-     * 
-     * Parameters:
-     * point - {Array(<OpenLayers.Geometry.Point>)}
-     */
-    
-    /**
-     * APIMethod: getLength
-     * 
-     * Returns:
-     * {Float} The length of the curve
-     */
-    getLength: function() {
-        var length = 0.0;
-        if ( this.components && (this.components.length > 1)) {
-            for(var i=1, len=this.components.length; i<len; i++) {
-                length += this.components[i-1].distanceTo(this.components[i]);
-            }
-        }
-        return length;
-    },
-
-    /**
-     * APIMethod: getGeodesicLength
-     * Calculate the approximate length of the geometry were it projected onto
-     *     the earth.
-     *
-     * projection - {<OpenLayers.Projection>} The spatial reference system
-     *     for the geometry coordinates.  If not provided, Geographic/WGS84 is
-     *     assumed.
-     * 
-     * Returns:
-     * {Float} The appoximate geodesic length of the geometry in meters.
+     * {Float} The appoximate geodesic length of the geometry in meters.
      */
     getGeodesicLength: function(projection) {
         var geom = this;  // so we can work with a clone if needed
      */
     getGeodesicLength: function(projection) {
         var geom = this;  // so we can work with a clone if needed
@@ -17237,7 +16715,7 @@ OpenLayers.Geometry.Curve = OpenLayers.Class(OpenLayers.Geometry.MultiPoint, {
     OpenLayers/Geometry/LineString.js
    ====================================================================== */
 
     OpenLayers/Geometry/LineString.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -17697,26 +17175,22 @@ OpenLayers.Geometry.LineString = OpenLayers.Class(OpenLayers.Geometry.Curve, {
                 result = OpenLayers.Geometry.distanceToSegment(geometry, seg);
                 if(result.distance < min) {
                     min = result.distance;
                 result = OpenLayers.Geometry.distanceToSegment(geometry, seg);
                 if(result.distance < min) {
                     min = result.distance;
-                    best = result;
-                    if(min === 0) {
-                        break;
+                    if(details) {
+                        best = {
+                            distance: min,
+                            x0: result.x, y0: result.y,
+                            x1: x, y1: y,
+                            index: i,
+                            indexDistance: new OpenLayers.Geometry.Point(seg.x1, seg.y1).distanceTo(geometry)
+                        };
+                    } else {
+                        best = min;
                     }
                     }
-                } else {
-                    // if distance increases and we cross y0 to the right of x0, no need to keep looking.
-                    if(seg.x2 > x && ((y > seg.y1 && y < seg.y2) || (y < seg.y1 && y > seg.y2))) {
+                    if(min === 0) {
                         break;
                     }
                 }
             }
                         break;
                     }
                 }
             }
-            if(details) {
-                best = {
-                    distance: best.distance,
-                    x0: best.x, y0: best.y,
-                    x1: x, y1: y
-                };
-            } else {
-                best = best.distance;
-            }
         } else if(geometry instanceof OpenLayers.Geometry.LineString) { 
             var segs0 = this.getSortedSegments();
             var segs1 = geometry.getSortedSegments();
         } else if(geometry instanceof OpenLayers.Geometry.LineString) { 
             var segs0 = this.getSortedSegments();
             var segs1 = geometry.getSortedSegments();
@@ -17796,7 +17270,7 @@ OpenLayers.Geometry.LineString = OpenLayers.Class(OpenLayers.Geometry.Curve, {
      *
      *
      * Parameters:
      *
      *
      * Parameters:
-     * tolerance - {number} threshhold for simplification in map units
+     * tolerance - {number} threshold for simplification in map units
      *
      * Returns:
      * {OpenLayers.Geometry.LineString} the simplified LineString
      *
      * Returns:
      * {OpenLayers.Geometry.LineString} the simplified LineString
@@ -17883,11 +17357,409 @@ OpenLayers.Geometry.LineString = OpenLayers.Class(OpenLayers.Geometry.Curve, {
 
     CLASS_NAME: "OpenLayers.Geometry.LineString"
 });
 
     CLASS_NAME: "OpenLayers.Geometry.LineString"
 });
+
+
+/**
+ * Function: OpenLayers.Geometry.LineString.geodesic
+ *
+ * Parameters:
+ * interpolate - {function(number): OpenLayers.Geometry.Point} Interpolate
+ *     function.
+ * transform - {function(OpenLayers.Geometry.Point): OpenLayers.Geometry.Point}
+ *     Transform from longitude/latitude to projected coordinates.
+ * squaredTolerance - {number} Squared tolerance.
+ *
+ * Returns:
+ * {OpenLayers.Geometry.LineString}
+ */
+OpenLayers.Geometry.LineString.geodesic =
+        function(interpolate, transform, squaredTolerance) {
+    // FIXME reduce garbage generation
+    // FIXME optimize stack operations
+
+    var components = [];
+
+    var geoA = interpolate(0);
+    var geoB = interpolate(1);
+
+    var a = transform(geoA);
+    var b = transform(geoB);
+
+    var geoStack = [geoB, geoA];
+    var stack = [b, a];
+    var fractionStack = [1, 0];
+
+    var fractions = {};
+
+    var maxIterations = 1e5;
+    var geoM, m, fracA, fracB, fracM, key;
+
+    while (--maxIterations > 0 && fractionStack.length > 0) {
+        // Pop the a coordinate off the stack
+        fracA = fractionStack.pop();
+        geoA = geoStack.pop();
+        a = stack.pop();
+        // Add the a coordinate if it has not been added yet
+        key = fracA.toString();
+        if (!(key in fractions)) {
+            components.push(a);
+            fractions[key] = true;
+        }
+        // Pop the b coordinate off the stack
+        fracB = fractionStack.pop();
+        geoB = geoStack.pop();
+        b = stack.pop();
+        // Find the m point between the a and b coordinates
+        fracM = (fracA + fracB) / 2;
+        geoM = interpolate(fracM);
+        m = transform(geoM);
+        if (OpenLayers.Geometry.distanceSquaredToSegment(m, {x1: a.x, y1: a.y,
+                x2: b.x, y2: b.y}).distance < squaredTolerance) {
+            // If the m point is sufficiently close to the straight line, then
+            // we discard it. Just use the b coordinate and move on to the next
+            // line segment.
+            components.push(b);
+            key = fracB.toString();
+            fractions[key] = true;
+        } else {
+            // Otherwise, we need to subdivide the current line segment.
+            // Split it into two and push the two line segments onto the stack.
+            fractionStack.push(fracB, fracM, fracM, fracA);
+            stack.push(b, m, m, a);
+            geoStack.push(geoB, geoM, geoM, geoA);
+        }
+    }
+
+    return new OpenLayers.Geometry.LineString(components);
+};
+
+
+/**
+ * Function: OpenLayers.Geometry.LineString.geodesicMeridian
+ * Generate a meridian (line at constant longitude).
+ *
+ * Parameters:
+ * lon - {number} Longitude.
+ * lat1 - {number} Latitude 1.
+ * lat2 - {number} Latitude 2.
+ * projection - {OpenLayers.Projection} Projection.
+ * squaredTolerance - {number} Squared tolerance.
+ *
+ * Returns:
+ * {OpenLayers.Geometry.LineString} Line geometry for the meridian at <lon>.
+ */
+OpenLayers.Geometry.LineString.geodesicMeridian =
+        function(lon, lat1, lat2, projection, squaredTolerance) {
+    var epsg4326Projection = new OpenLayers.Projection('EPSG:4326');
+    return OpenLayers.Geometry.LineString.geodesic(
+        function(frac) {
+            return new OpenLayers.Geometry.Point(
+                    lon, lat1 + ((lat2 - lat1) * frac));
+        },
+        function(point) {
+            return point.transform(epsg4326Projection, projection);
+        },
+        squaredTolerance
+  );
+};
+
+
+/**
+ * Function: OpenLayers.Geometry.LineString.geodesicParallel
+ * Generate a parallel (line at constant latitude).
+ *
+ * Parameters:
+ * lat - {number} Latitude.
+ * lon1 - {number} Longitude 1.
+ * lon2 - {number} Longitude 2.
+ * projection {OpenLayers.Projection} Projection.
+ * squaredTolerance - {number} Squared tolerance.
+ *
+ * Returns:
+ * {OpenLayers.Geometry.LineString} Line geometry for the parallel at <lat>.
+ */
+OpenLayers.Geometry.LineString.geodesicParallel =
+        function(lat, lon1, lon2, projection, squaredTolerance) {
+    var epsg4326Projection = new OpenLayers.Projection('EPSG:4326');
+    return OpenLayers.Geometry.LineString.geodesic(
+        function(frac) {
+            return new OpenLayers.Geometry.Point(
+                    lon1 + ((lon2 - lon1) * frac), lat);
+        },
+        function(point) {
+            return point.transform(epsg4326Projection, projection);
+        },
+        squaredTolerance
+    );
+};
+
+/* ======================================================================
+    OpenLayers/Geometry/MultiLineString.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Geometry/Collection.js
+ * @requires OpenLayers/Geometry/LineString.js
+ */
+
+/**
+ * Class: OpenLayers.Geometry.MultiLineString
+ * A MultiLineString is a geometry with multiple <OpenLayers.Geometry.LineString>
+ * components.
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Geometry.Collection>
+ *  - <OpenLayers.Geometry> 
+ */
+OpenLayers.Geometry.MultiLineString = OpenLayers.Class(
+  OpenLayers.Geometry.Collection, {
+
+    /**
+     * Property: componentTypes
+     * {Array(String)} An array of class names representing the types of
+     * components that the collection can include.  A null value means the
+     * component types are not restricted.
+     */
+    componentTypes: ["OpenLayers.Geometry.LineString"],
+
+    /**
+     * Constructor: OpenLayers.Geometry.MultiLineString
+     * Constructor for a MultiLineString Geometry.
+     *
+     * Parameters: 
+     * components - {Array(<OpenLayers.Geometry.LineString>)} 
+     *
+     */
+    
+    /**
+     * Method: split
+     * Use this geometry (the source) to attempt to split a target geometry.
+     * 
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>} The target geometry.
+     * options - {Object} Properties of this object will be used to determine
+     *     how the split is conducted.
+     *
+     * Valid options:
+     * mutual - {Boolean} Split the source geometry in addition to the target
+     *     geometry.  Default is false.
+     * edge - {Boolean} Allow splitting when only edges intersect.  Default is
+     *     true.  If false, a vertex on the source must be within the tolerance
+     *     distance of the intersection to be considered a split.
+     * tolerance - {Number} If a non-null value is provided, intersections
+     *     within the tolerance distance of an existing vertex on the source
+     *     will be assumed to occur at the vertex.
+     * 
+     * Returns:
+     * {Array} A list of geometries (of this same type as the target) that
+     *     result from splitting the target with the source geometry.  The
+     *     source and target geometry will remain unmodified.  If no split
+     *     results, null will be returned.  If mutual is true and a split
+     *     results, return will be an array of two arrays - the first will be
+     *     all geometries that result from splitting the source geometry and
+     *     the second will be all geometries that result from splitting the
+     *     target geometry.
+     */
+    split: function(geometry, options) {
+        var results = null;
+        var mutual = options && options.mutual;
+        var splits, sourceLine, sourceLines, sourceSplit, targetSplit;
+        var sourceParts = [];
+        var targetParts = [geometry];
+        for(var i=0, len=this.components.length; i<len; ++i) {
+            sourceLine = this.components[i];
+            sourceSplit = false;
+            for(var j=0; j < targetParts.length; ++j) { 
+                splits = sourceLine.split(targetParts[j], options);
+                if(splits) {
+                    if(mutual) {
+                        sourceLines = splits[0];
+                        for(var k=0, klen=sourceLines.length; k<klen; ++k) {
+                            if(k===0 && sourceParts.length) {
+                                sourceParts[sourceParts.length-1].addComponent(
+                                    sourceLines[k]
+                                );
+                            } else {
+                                sourceParts.push(
+                                    new OpenLayers.Geometry.MultiLineString([
+                                        sourceLines[k]
+                                    ])
+                                );
+                            }
+                        }
+                        sourceSplit = true;
+                        splits = splits[1];
+                    }
+                    if(splits.length) {
+                        // splice in new target parts
+                        splits.unshift(j, 1);
+                        Array.prototype.splice.apply(targetParts, splits);
+                        break;
+                    }
+                }
+            }
+            if(!sourceSplit) {
+                // source line was not hit
+                if(sourceParts.length) {
+                    // add line to existing multi
+                    sourceParts[sourceParts.length-1].addComponent(
+                        sourceLine.clone()
+                    );
+                } else {
+                    // create a fresh multi
+                    sourceParts = [
+                        new OpenLayers.Geometry.MultiLineString(
+                            sourceLine.clone()
+                        )
+                    ];
+                }
+            }
+        }
+        if(sourceParts && sourceParts.length > 1) {
+            sourceSplit = true;
+        } else {
+            sourceParts = [];
+        }
+        if(targetParts && targetParts.length > 1) {
+            targetSplit = true;
+        } else {
+            targetParts = [];
+        }
+        if(sourceSplit || targetSplit) {
+            if(mutual) {
+                results = [sourceParts, targetParts];
+            } else {
+                results = targetParts;
+            }
+        }
+        return results;
+    },
+    
+    /**
+     * Method: splitWith
+     * Split this geometry (the target) with the given geometry (the source).
+     *
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>} A geometry used to split this
+     *     geometry (the source).
+     * options - {Object} Properties of this object will be used to determine
+     *     how the split is conducted.
+     *
+     * Valid options:
+     * mutual - {Boolean} Split the source geometry in addition to the target
+     *     geometry.  Default is false.
+     * edge - {Boolean} Allow splitting when only edges intersect.  Default is
+     *     true.  If false, a vertex on the source must be within the tolerance
+     *     distance of the intersection to be considered a split.
+     * tolerance - {Number} If a non-null value is provided, intersections
+     *     within the tolerance distance of an existing vertex on the source
+     *     will be assumed to occur at the vertex.
+     * 
+     * Returns:
+     * {Array} A list of geometries (of this same type as the target) that
+     *     result from splitting the target with the source geometry.  The
+     *     source and target geometry will remain unmodified.  If no split
+     *     results, null will be returned.  If mutual is true and a split
+     *     results, return will be an array of two arrays - the first will be
+     *     all geometries that result from splitting the source geometry and
+     *     the second will be all geometries that result from splitting the
+     *     target geometry.
+     */
+    splitWith: function(geometry, options) {
+        var results = null;
+        var mutual = options && options.mutual;
+        var splits, targetLine, sourceLines, sourceSplit, targetSplit, sourceParts, targetParts;
+        if(geometry instanceof OpenLayers.Geometry.LineString) {
+            targetParts = [];
+            sourceParts = [geometry];
+            for(var i=0, len=this.components.length; i<len; ++i) {
+                targetSplit = false;
+                targetLine = this.components[i];
+                for(var j=0; j<sourceParts.length; ++j) {
+                    splits = sourceParts[j].split(targetLine, options);
+                    if(splits) {
+                        if(mutual) {
+                            sourceLines = splits[0];
+                            if(sourceLines.length) {
+                                // splice in new source parts
+                                sourceLines.unshift(j, 1);
+                                Array.prototype.splice.apply(sourceParts, sourceLines);
+                                j += sourceLines.length - 2;
+                            }
+                            splits = splits[1];
+                            if(splits.length === 0) {
+                                splits = [targetLine.clone()];
+                            }
+                        }
+                        for(var k=0, klen=splits.length; k<klen; ++k) {
+                            if(k===0 && targetParts.length) {
+                                targetParts[targetParts.length-1].addComponent(
+                                    splits[k]
+                                );
+                            } else {
+                                targetParts.push(
+                                    new OpenLayers.Geometry.MultiLineString([
+                                        splits[k]
+                                    ])
+                                );
+                            }
+                        }
+                        targetSplit = true;                    
+                    }
+                }
+                if(!targetSplit) {
+                    // target component was not hit
+                    if(targetParts.length) {
+                        // add it to any existing multi-line
+                        targetParts[targetParts.length-1].addComponent(
+                            targetLine.clone()
+                        );
+                    } else {
+                        // or start with a fresh multi-line
+                        targetParts = [
+                            new OpenLayers.Geometry.MultiLineString([
+                                targetLine.clone()
+                            ])
+                        ];
+                    }
+                    
+                }
+            }
+        } else {
+            results = geometry.split(this);
+        }
+        if(sourceParts && sourceParts.length > 1) {
+            sourceSplit = true;
+        } else {
+            sourceParts = [];
+        }
+        if(targetParts && targetParts.length > 1) {
+            targetSplit = true;
+        } else {
+            targetParts = [];
+        }
+        if(sourceSplit || targetSplit) {
+            if(mutual) {
+                results = [sourceParts, targetParts];
+            } else {
+                results = targetParts;
+            }
+        }
+        return results;
+    },
+
+    CLASS_NAME: "OpenLayers.Geometry.MultiLineString"
+});
 /* ======================================================================
     OpenLayers/Geometry/LinearRing.js
    ====================================================================== */
 
 /* ======================================================================
     OpenLayers/Geometry/LinearRing.js
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
@@ -18175,7 +18047,7 @@ OpenLayers.Geometry.LinearRing = OpenLayers.Class(
                         (2 + Math.sin(OpenLayers.Util.rad(p1.y)) +
                         Math.sin(OpenLayers.Util.rad(p2.y)));
             }
                         (2 + Math.sin(OpenLayers.Util.rad(p1.y)) +
                         Math.sin(OpenLayers.Util.rad(p2.y)));
             }
-            area = area * 6378137.0 * 6378137.0 / 2.0;
+            area = area * OpenLayers.Util.VincentyConstants.a * OpenLayers.Util.VincentyConstants.a / 2.0;
         }
         return area;
     },
         }
         return area;
     },
@@ -18321,11104 +18193,10416 @@ OpenLayers.Geometry.LinearRing = OpenLayers.Class(
     CLASS_NAME: "OpenLayers.Geometry.LinearRing"
 });
 /* ======================================================================
     CLASS_NAME: "OpenLayers.Geometry.LinearRing"
 });
 /* ======================================================================
-    OpenLayers/Layer/HTTPRequest.js
+    OpenLayers/Geometry/Polygon.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-
 /**
 /**
- * @requires OpenLayers/Layer.js
+ * @requires OpenLayers/Geometry/Collection.js
+ * @requires OpenLayers/Geometry/LinearRing.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Layer.HTTPRequest
+ * Class: OpenLayers.Geometry.Polygon 
+ * Polygon is a collection of Geometry.LinearRings. 
  * 
  * 
- * Inherits from: 
- *  - <OpenLayers.Layer>
+ * Inherits from:
+ *  - <OpenLayers.Geometry.Collection> 
+ *  - <OpenLayers.Geometry> 
  */
  */
-OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
-
-    /** 
-     * Constant: URL_HASH_FACTOR
-     * {Float} Used to hash URL param strings for multi-WMS server selection.
-     *         Set to the Golden Ratio per Knuth's recommendation.
-     */
-    URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2,
-
-    /** 
-     * Property: url
-     * {Array(String) or String} This is either an array of url strings or 
-     *                           a single url string. 
-     */
-    url: null,
+OpenLayers.Geometry.Polygon = OpenLayers.Class(
+  OpenLayers.Geometry.Collection, {
 
 
-    /** 
-     * Property: params
-     * {Object} Hashtable of key/value parameters
-     */
-    params: null,
-    
-    /** 
-     * APIProperty: reproject
-     * *Deprecated*. See http://docs.openlayers.org/library/spherical_mercator.html
-     * for information on the replacement for this functionality. 
-     * {Boolean} Whether layer should reproject itself based on base layer 
-     *           locations. This allows reprojection onto commercial layers. 
-     *           Default is false: Most layers can't reproject, but layers 
-     *           which can create non-square geographic pixels can, like WMS.
-     *           
+    /**
+     * Property: componentTypes
+     * {Array(String)} An array of class names representing the types of
+     * components that the collection can include.  A null value means the
+     * component types are not restricted.
      */
      */
-    reproject: false,
+    componentTypes: ["OpenLayers.Geometry.LinearRing"],
 
     /**
 
     /**
-     * Constructor: OpenLayers.Layer.HTTPRequest
-     * 
+     * Constructor: OpenLayers.Geometry.Polygon
+     * Constructor for a Polygon geometry. 
+     * The first ring (this.component[0])is the outer bounds of the polygon and 
+     * all subsequent rings (this.component[1-n]) are internal holes.
+     *
+     *
      * Parameters:
      * Parameters:
-     * name - {String}
-     * url - {Array(String) or String}
-     * params - {Object}
-     * options - {Object} Hashtable of extra options to tag onto the layer
+     * components - {Array(<OpenLayers.Geometry.LinearRing>)} 
      */
      */
-    initialize: function(name, url, params, options) {
-        OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
-        this.url = url;
-        if (!this.params) {
-            this.params = OpenLayers.Util.extend({}, params);
-        }
-    },
 
 
-    /**
-     * APIMethod: destroy
-     */
-    destroy: function() {
-        this.url = null;
-        this.params = null;
-        OpenLayers.Layer.prototype.destroy.apply(this, arguments); 
-    },
-    
-    /**
-     * APIMethod: clone
-     * 
-     * Parameters:
-     * obj - {Object}
+    /** 
+     * APIMethod: getArea
+     * Calculated by subtracting the areas of the internal holes from the 
+     *   area of the outer hole.
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Layer.HTTPRequest>} An exact clone of this 
-     *                                  <OpenLayers.Layer.HTTPRequest>
+     * {float} The area of the geometry
      */
      */
-    clone: function (obj) {
-        
-        if (obj == null) {
-            obj = new OpenLayers.Layer.HTTPRequest(this.name,
-                                                   this.url,
-                                                   this.params,
-                                                   this.getOptions());
+    getArea: function() {
+        var area = 0.0;
+        if ( this.components && (this.components.length > 0)) {
+            area += Math.abs(this.components[0].getArea());
+            for (var i=1, len=this.components.length; i<len; i++) {
+                area -= Math.abs(this.components[i].getArea());
+            }
         }
         }
-        
-        //get all additions from superclasses
-        obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
-
-        // copy/set any non-init, non-simple values here
-        
-        return obj;
+        return area;
     },
 
     /** 
     },
 
     /** 
-     * APIMethod: setUrl
-     * 
+     * APIMethod: getGeodesicArea
+     * Calculate the approximate area of the polygon were it projected onto
+     *     the earth.
+     *
      * Parameters:
      * Parameters:
-     * newUrl - {String}
-     */
-    setUrl: function(newUrl) {
-        this.url = newUrl;
-    },
-
-    /**
-     * APIMethod: mergeNewParams
+     * projection - {<OpenLayers.Projection>} The spatial reference system
+     *     for the geometry coordinates.  If not provided, Geographic/WGS84 is
+     *     assumed.
      * 
      * 
-     * Parameters:
-     * newParams - {Object}
+     * Reference:
+     * Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for
+     *     Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion
+     *     Laboratory, Pasadena, CA, June 2007 http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409
      *
      * Returns:
      *
      * Returns:
-     * redrawn: {Boolean} whether the layer was actually redrawn.
+     * {float} The approximate geodesic area of the polygon in square meters.
      */
      */
-    mergeNewParams:function(newParams) {
-        this.params = OpenLayers.Util.extend(this.params, newParams);
-        var ret = this.redraw();
-        if(this.map != null) {
-            this.map.events.triggerEvent("changelayer", {
-                layer: this,
-                property: "params"
-            });
+    getGeodesicArea: function(projection) {
+        var area = 0.0;
+        if(this.components && (this.components.length > 0)) {
+            area += Math.abs(this.components[0].getGeodesicArea(projection));
+            for(var i=1, len=this.components.length; i<len; i++) {
+                area -= Math.abs(this.components[i].getGeodesicArea(projection));
+            }
         }
         }
-        return ret;
+        return area;
     },
 
     /**
     },
 
     /**
-     * APIMethod: redraw
-     * Redraws the layer.  Returns true if the layer was redrawn, false if not.
+     * Method: containsPoint
+     * Test if a point is inside a polygon.  Points on a polygon edge are
+     *     considered inside.
      *
      * Parameters:
      *
      * Parameters:
-     * force - {Boolean} Force redraw by adding random parameter.
+     * point - {<OpenLayers.Geometry.Point>}
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} The layer was redrawn.
+     * {Boolean | Number} The point is inside the polygon.  Returns 1 if the
+     *     point is on an edge.  Returns boolean otherwise.
      */
      */
-    redraw: function(force) { 
-        if (force) {
-            return this.mergeNewParams({"_olSalt": Math.random()});
-        } else {
-            return OpenLayers.Layer.prototype.redraw.apply(this, []);
+    containsPoint: function(point) {
+        var numRings = this.components.length;
+        var contained = false;
+        if(numRings > 0) {
+            // check exterior ring - 1 means on edge, boolean otherwise
+            contained = this.components[0].containsPoint(point);
+            if(contained !== 1) {
+                if(contained && numRings > 1) {
+                    // check interior rings
+                    var hole;
+                    for(var i=1; i<numRings; ++i) {
+                        hole = this.components[i].containsPoint(point);
+                        if(hole) {
+                            if(hole === 1) {
+                                // on edge
+                                contained = 1;
+                            } else {
+                                // in hole
+                                contained = false;
+                            }                            
+                            break;
+                        }
+                    }
+                }
+            }
         }
         }
+        return contained;
     },
     },
-    
+
     /**
     /**
-     * Method: selectUrl
-     * selectUrl() implements the standard floating-point multiplicative
-     *     hash function described by Knuth, and hashes the contents of the 
-     *     given param string into a float between 0 and 1. This float is then
-     *     scaled to the size of the provided urls array, and used to select
-     *     a URL.
+     * APIMethod: intersects
+     * Determine if the input geometry intersects this one.
      *
      * Parameters:
      *
      * Parameters:
-     * paramString - {String}
-     * urls - {Array(String)}
-     * 
+     * geometry - {<OpenLayers.Geometry>} Any type of geometry.
+     *
      * Returns:
      * Returns:
-     * {String} An entry from the urls array, deterministically selected based
-     *          on the paramString.
+     * {Boolean} The input geometry intersects this one.
      */
      */
-    selectUrl: function(paramString, urls) {
-        var product = 1;
-        for (var i=0, len=paramString.length; i<len; i++) { 
-            product *= paramString.charCodeAt(i) * this.URL_HASH_FACTOR; 
-            product -= Math.floor(product); 
+    intersects: function(geometry) {
+        var intersect = false;
+        var i, len;
+        if(geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
+            intersect = this.containsPoint(geometry);
+        } else if(geometry.CLASS_NAME == "OpenLayers.Geometry.LineString" ||
+                  geometry.CLASS_NAME == "OpenLayers.Geometry.LinearRing") {
+            // check if rings/linestrings intersect
+            for(i=0, len=this.components.length; i<len; ++i) {
+                intersect = geometry.intersects(this.components[i]);
+                if(intersect) {
+                    break;
+                }
+            }
+            if(!intersect) {
+                // check if this poly contains points of the ring/linestring
+                for(i=0, len=geometry.components.length; i<len; ++i) {
+                    intersect = this.containsPoint(geometry.components[i]);
+                    if(intersect) {
+                        break;
+                    }
+                }
+            }
+        } else {
+            for(i=0, len=geometry.components.length; i<len; ++ i) {
+                intersect = this.intersects(geometry.components[i]);
+                if(intersect) {
+                    break;
+                }
+            }
         }
         }
-        return urls[Math.floor(product * urls.length)];
+        // check case where this poly is wholly contained by another
+        if(!intersect && geometry.CLASS_NAME == "OpenLayers.Geometry.Polygon") {
+            // exterior ring points will be contained in the other geometry
+            var ring = this.components[0];
+            for(i=0, len=ring.components.length; i<len; ++i) {
+                intersect = geometry.containsPoint(ring.components[i]);
+                if(intersect) {
+                    break;
+                }
+            }
+        }
+        return intersect;
     },
 
     },
 
-    /** 
-     * Method: getFullRequestString
-     * Combine url with layer's params and these newParams. 
-     *   
-     *    does checking on the serverPath variable, allowing for cases when it 
-     *     is supplied with trailing ? or &, as well as cases where not. 
-     *
-     *    return in formatted string like this:
-     *        "server?key1=value1&key2=value2&key3=value3"
-     * 
-     * WARNING: The altUrl parameter is deprecated and will be removed in 3.0.
+    /**
+     * APIMethod: distanceTo
+     * Calculate the closest distance between two geometries (on the x-y plane).
      *
      * Parameters:
      *
      * Parameters:
-     * newParams - {Object}
-     * altUrl - {String} Use this as the url instead of the layer's url
-     *   
-     * Returns: 
-     * {String}
+     * geometry - {<OpenLayers.Geometry>} The target geometry.
+     * options - {Object} Optional properties for configuring the distance
+     *     calculation.
+     *
+     * Valid options:
+     * details - {Boolean} Return details from the distance calculation.
+     *     Default is false.
+     * edge - {Boolean} Calculate the distance from this geometry to the
+     *     nearest edge of the target geometry.  Default is true.  If true,
+     *     calling distanceTo from a geometry that is wholly contained within
+     *     the target will result in a non-zero distance.  If false, whenever
+     *     geometries intersect, calling distanceTo will return 0.  If false,
+     *     details cannot be returned.
+     *
+     * Returns:
+     * {Number | Object} The distance between this geometry and the target.
+     *     If details is true, the return will be an object with distance,
+     *     x0, y0, x1, and y1 properties.  The x0 and y0 properties represent
+     *     the coordinates of the closest point on this geometry. The x1 and y1
+     *     properties represent the coordinates of the closest point on the
+     *     target geometry.
      */
      */
-    getFullRequestString:function(newParams, altUrl) {
-
-        // if not altUrl passed in, use layer's url
-        var url = altUrl || this.url;
-        
-        // create a new params hashtable with all the layer params and the 
-        // new params together. then convert to string
-        var allParams = OpenLayers.Util.extend({}, this.params);
-        allParams = OpenLayers.Util.extend(allParams, newParams);
-        var paramsString = OpenLayers.Util.getParameterString(allParams);
-        
-        // if url is not a string, it should be an array of strings, 
-        // in which case we will deterministically select one of them in 
-        // order to evenly distribute requests to different urls.
-        //
-        if (OpenLayers.Util.isArray(url)) {
-            url = this.selectUrl(paramsString, url);
-        }   
-        // ignore parameters that are already in the url search string
-        var urlParams = 
-            OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url));
-        for(var key in allParams) {
-            if(key.toUpperCase() in urlParams) {
-                delete allParams[key];
-            }
+    distanceTo: function(geometry, options) {
+        var edge = !(options && options.edge === false);
+        var result;
+        // this is the case where we might not be looking for distance to edge
+        if(!edge && this.intersects(geometry)) {
+            result = 0;
+        } else {
+            result = OpenLayers.Geometry.Collection.prototype.distanceTo.apply(
+                this, [geometry, options]
+            );
         }
         }
-        paramsString = OpenLayers.Util.getParameterString(allParams);
-        
-        return OpenLayers.Util.urlAppend(url, paramsString);
+        return result;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Layer.HTTPRequest"
+    CLASS_NAME: "OpenLayers.Geometry.Polygon"
 });
 });
+
+/**
+ * APIMethod: createRegularPolygon
+ * Create a regular polygon around a radius. Useful for creating circles 
+ * and the like.
+ *
+ * Parameters:
+ * origin - {<OpenLayers.Geometry.Point>} center of polygon.
+ * radius - {Float} distance to vertex, in map units.
+ * sides - {Integer} Number of sides. 20 approximates a circle.
+ * rotation - {Float} original angle of rotation, in degrees.
+ */
+OpenLayers.Geometry.Polygon.createRegularPolygon = function(origin, radius, sides, rotation) {  
+    var angle = Math.PI * ((1/sides) - (1/2));
+    if(rotation) {
+        angle += (rotation / 180) * Math.PI;
+    }
+    var rotatedAngle, x, y;
+    var points = [];
+    for(var i=0; i<sides; ++i) {
+        rotatedAngle = angle + (i * 2 * Math.PI / sides);
+        x = origin.x + (radius * Math.cos(rotatedAngle));
+        y = origin.y + (radius * Math.sin(rotatedAngle));
+        points.push(new OpenLayers.Geometry.Point(x, y));
+    }
+    var ring = new OpenLayers.Geometry.LinearRing(points);
+    return new OpenLayers.Geometry.Polygon([ring]);
+};
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Layer/Grid.js
+    OpenLayers/Geometry/MultiPolygon.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-
 /**
 /**
- * @requires OpenLayers/Layer/HTTPRequest.js
- * @requires OpenLayers/Tile/Image.js
+ * @requires OpenLayers/Geometry/Collection.js
+ * @requires OpenLayers/Geometry/Polygon.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Layer.Grid
- * Base class for layers that use a lattice of tiles.  Create a new grid
- * layer with the <OpenLayers.Layer.Grid> constructor.
- *
+ * Class: OpenLayers.Geometry.MultiPolygon
+ * MultiPolygon is a geometry with multiple <OpenLayers.Geometry.Polygon>
+ * components.  Create a new instance with the <OpenLayers.Geometry.MultiPolygon>
+ * constructor.
+ * 
  * Inherits from:
  * Inherits from:
- *  - <OpenLayers.Layer.HTTPRequest>
+ *  - <OpenLayers.Geometry.Collection>
  */
  */
-OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
-    
-    /**
-     * APIProperty: tileSize
-     * {<OpenLayers.Size>}
-     */
-    tileSize: null,
-
-    /**
-     * Property: tileOriginCorner
-     * {String} If the <tileOrigin> property is not provided, the tile origin 
-     *     will be derived from the layer's <maxExtent>.  The corner of the 
-     *     <maxExtent> used is determined by this property.  Acceptable values
-     *     are "tl" (top left), "tr" (top right), "bl" (bottom left), and "br"
-     *     (bottom right).  Default is "bl".
-     */
-    tileOriginCorner: "bl",
-    
-    /**
-     * APIProperty: tileOrigin
-     * {<OpenLayers.LonLat>} Optional origin for aligning the grid of tiles.
-     *     If provided, requests for tiles at all resolutions will be aligned
-     *     with this location (no tiles shall overlap this location).  If
-     *     not provided, the grid of tiles will be aligned with the layer's
-     *     <maxExtent>.  Default is ``null``.
-     */
-    tileOrigin: null,
-    
-    /** APIProperty: tileOptions
-     *  {Object} optional configuration options for <OpenLayers.Tile> instances
-     *  created by this Layer, if supported by the tile class.
-     */
-    tileOptions: null,
-
-    /**
-     * APIProperty: tileClass
-     * {<OpenLayers.Tile>} The tile class to use for this layer.
-     *     Defaults is OpenLayers.Tile.Image.
-     */
-    tileClass: OpenLayers.Tile.Image,
-    
-    /**
-     * Property: grid
-     * {Array(Array(<OpenLayers.Tile>))} This is an array of rows, each row is 
-     *     an array of tiles.
-     */
-    grid: null,
-
-    /**
-     * APIProperty: singleTile
-     * {Boolean} Moves the layer into single-tile mode, meaning that one tile 
-     *     will be loaded. The tile's size will be determined by the 'ratio'
-     *     property. When the tile is dragged such that it does not cover the 
-     *     entire viewport, it is reloaded.
-     */
-    singleTile: false,
-
-    /** APIProperty: ratio
-     *  {Float} Used only when in single-tile mode, this specifies the 
-     *          ratio of the size of the single tile to the size of the map.
-     *          Default value is 1.5.
-     */
-    ratio: 1.5,
+OpenLayers.Geometry.MultiPolygon = OpenLayers.Class(
+  OpenLayers.Geometry.Collection, {
 
     /**
 
     /**
-     * APIProperty: buffer
-     * {Integer} Used only when in gridded mode, this specifies the number of 
-     *           extra rows and colums of tiles on each side which will
-     *           surround the minimum grid tiles to cover the map.
-     *           For very slow loading layers, a larger value may increase
-     *           performance somewhat when dragging, but will increase bandwidth
-     *           use significantly. 
+     * Property: componentTypes
+     * {Array(String)} An array of class names representing the types of
+     * components that the collection can include.  A null value means the
+     * component types are not restricted.
      */
      */
-    buffer: 0,
+    componentTypes: ["OpenLayers.Geometry.Polygon"],
 
     /**
 
     /**
-     * APIProperty: transitionEffect
-     * {String} The transition effect to use when the map is zoomed.
-     * Two posible values:
+     * Constructor: OpenLayers.Geometry.MultiPolygon
+     * Create a new MultiPolygon geometry
      *
      *
-     * "resize" - Existing tiles are resized on zoom to provide a visual
-     *     effect of the zoom having taken place immediately.  As the
-     *     new tiles become available, they are drawn on top of the
-     *     resized tiles (this is the default setting).
-     * "map-resize" - Existing tiles are resized on zoom and placed below the
-     *     base layer.  New tiles for the base layer will cover existing tiles.
-     *     This setting is recommended when having an overlay duplicated during
-     *     the transition is undesirable (e.g. street labels or big transparent
-     *     fills). 
-     * null - No transition effect.
+     * Parameters:
+     * components - {Array(<OpenLayers.Geometry.Polygon>)} An array of polygons
+     *              used to generate the MultiPolygon
      *
      *
-     * Using "resize" on non-opaque layers can cause undesired visual
-     * effects.  Set transitionEffect to null in this case.
      */
      */
-    transitionEffect: "resize",
 
 
-    /**
-     * APIProperty: numLoadingTiles
-     * {Integer} How many tiles are still loading?
-     */
-    numLoadingTiles: 0,
+    CLASS_NAME: "OpenLayers.Geometry.MultiPolygon"
+});
+/* ======================================================================
+    OpenLayers/Format/GML.js
+   ====================================================================== */
 
 
-    /**
-     * Property: serverResolutions
-     * {Array(Number}} This property is documented in subclasses as
-     *     an API property.
-     */
-    serverResolutions: null,
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
 
 
-    /**
-     * Property: loading
-     * {Boolean} Indicates if tiles are being loaded.
-     */
-    loading: false,
-    
-    /**
-     * Property: backBuffer
-     * {DOMElement} The back buffer.
-     */
-    backBuffer: null,
+/**
+ * @requires OpenLayers/Format/XML.js
+ * @requires OpenLayers/Feature/Vector.js
+ * @requires OpenLayers/Geometry/Point.js
+ * @requires OpenLayers/Geometry/MultiPoint.js
+ * @requires OpenLayers/Geometry/LineString.js
+ * @requires OpenLayers/Geometry/MultiLineString.js
+ * @requires OpenLayers/Geometry/Polygon.js
+ * @requires OpenLayers/Geometry/MultiPolygon.js
+ */
 
 
+/**
+ * Class: OpenLayers.Format.GML
+ * Read/Write GML. Create a new instance with the <OpenLayers.Format.GML>
+ *     constructor.  Supports the GML simple features profile.
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
+    
     /**
     /**
-     * Property: gridResolution
-     * {Number} The resolution of the current grid. Used for backbuffer and
-     *     client zoom. This property is updated every time the grid is
-     *     initialized.
+     * APIProperty: featureNS
+     * {String} Namespace used for feature attributes.  Default is
+     *     "http://mapserver.gis.umn.edu/mapserver".
      */
      */
-    gridResolution: null,
-
+    featureNS: "http://mapserver.gis.umn.edu/mapserver",
+    
     /**
     /**
-     * Property: backBufferResolution
-     * {Number} The resolution of the current back buffer. This property is
-     *     updated each time a back buffer is created.
+     * APIProperty: featurePrefix
+     * {String} Namespace alias (or prefix) for feature nodes.  Default is
+     *     "feature".
      */
      */
-    backBufferResolution: null,
-
+    featurePrefix: "feature",
+    
     /**
     /**
-     * Property: backBufferLonLat
-     * {Object} The top-left corner of the current back buffer. Includes lon
-     *     and lat properties. This object is updated each time a back buffer
-     *     is created.
+     * APIProperty: featureName
+     * {String} Element name for features. Default is "featureMember".
      */
      */
-    backBufferLonLat: null,
-
+    featureName: "featureMember", 
+    
     /**
     /**
-     * Property: backBufferTimerId
-     * {Number} The id of the back buffer timer. This timer is used to
-     *     delay the removal of the back buffer, thereby preventing
-     *     flash effects caused by tile animation.
+     * APIProperty: layerName
+     * {String} Name of data layer. Default is "features".
      */
      */
-    backBufferTimerId: null,
-
+    layerName: "features",
+    
     /**
     /**
-     * APIProperty: removeBackBufferDelay
-     * {Number} Delay for removing the backbuffer when all tiles have finished
-     *     loading. Can be set to 0 when no css opacity transitions for the
-     *     olTileImage class are used. Default is 0 for <singleTile> layers,
-     *     2500 for tiled layers. See <className> for more information on
-     *     tile animation.
+     * APIProperty: geometryName
+     * {String} Name of geometry element.  Defaults to "geometry".
      */
      */
-    removeBackBufferDelay: null,
-
-    /**
-     * APIProperty: className
-     * {String} Name of the class added to the layer div. If not set in the
-     *     options passed to the constructor then className defaults to
-     *     "olLayerGridSingleTile" for single tile layers (see <singleTile>),
-     *     and "olLayerGrid" for non single tile layers.
-     *
-     * Note:
-     *
-     * The displaying of tiles is not animated by default for single tile
-     *     layers - OpenLayers' default theme (style.css) includes this:
-     * (code)
-     * .olLayerGrid .olTileImage {
-     *     -webkit-transition: opacity 0.2s linear;
-     *     -moz-transition: opacity 0.2s linear;
-     *     -o-transition: opacity 0.2s linear;
-     *     transition: opacity 0.2s linear;
-     *  }
-     * (end)
-     * To animate tile displaying for any grid layer the following
-     *     CSS rule can be used:
-     * (code)
-     * .olTileImage {
-     *     -webkit-transition: opacity 0.2s linear;
-     *     -moz-transition: opacity 0.2s linear;
-     *     -o-transition: opacity 0.2s linear;
-     *     transition: opacity 0.2s linear;
-     * }
-     * (end)
-     * In that case, to avoid flash effects, <removeBackBufferDelay>
-     *     should not be zero.
+    geometryName: "geometry",
+    
+    /** 
+     * APIProperty: collectionName
+     * {String} Name of featureCollection element.
      */
      */
-    className: null,
+    collectionName: "FeatureCollection",
     
     /**
     
     /**
-     * Register a listener for a particular event with the following syntax:
-     * (code)
-     * layer.events.register(type, obj, listener);
-     * (end)
-     *
-     * Listeners will be called with a reference to an event object.  The
-     *     properties of this event depends on exactly what happened.
-     *
-     * All event objects have at least the following properties:
-     * object - {Object} A reference to layer.events.object.
-     * element - {DOMElement} A reference to layer.events.element.
-     *
-     * Supported event types:
-     * addtile - Triggered when a tile is added to this layer. Listeners receive
-     *     an object as first argument, which has a tile property that
-     *     references the tile that has been added.
-     * tileloadstart - Triggered when a tile starts loading. Listeners receive
-     *     an object as first argument, which has a tile property that
-     *     references the tile that starts loading.
-     * tileloaded - Triggered when each new tile is
-     *     loaded, as a means of progress update to listeners.
-     *     listeners can access 'numLoadingTiles' if they wish to keep
-     *     track of the loading progress. Listeners are called with an object
-     *     with a 'tile' property as first argument, making the loaded tile
-     *     available to the listener, and an 'aborted' property, which will be
-     *     true when loading was aborted and no tile data is available.
-     * tileerror - Triggered before the tileloaded event (i.e. when the tile is
-     *     still hidden) if a tile failed to load. Listeners receive an object
-     *     as first argument, which has a tile property that references the
-     *     tile that could not be loaded.
-     * retile - Triggered when the layer recreates its tile grid.
+     * APIProperty: gmlns
+     * {String} GML Namespace.
      */
      */
+    gmlns: "http://www.opengis.net/gml",
 
     /**
 
     /**
-     * Property: gridLayout
-     * {Object} Object containing properties tilelon, tilelat, startcol,
-     * startrow
+     * APIProperty: extractAttributes
+     * {Boolean} Extract attributes from GML.
      */
      */
-    gridLayout: null,
+    extractAttributes: true,
     
     /**
     
     /**
-     * Property: rowSign
-     * {Number} 1 for grids starting at the top, -1 for grids starting at the
-     * bottom. This is used for several grid index and offset calculations.
-     */
-    rowSign: null,
-
-    /**
-     * Property: transitionendEvents
-     * {Array} Event names for transitionend
-     */
-    transitionendEvents: [
-        'transitionend', 'webkitTransitionEnd', 'otransitionend',
-        'oTransitionEnd'
-    ],
-
+     * APIProperty: xy
+     * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
+     * Changing is not recommended, a new Format should be instantiated.
+     */ 
+    xy: true,
+    
     /**
     /**
-     * Constructor: OpenLayers.Layer.Grid
-     * Create a new grid layer
+     * Constructor: OpenLayers.Format.GML
+     * Create a new parser for GML.
      *
      * Parameters:
      *
      * Parameters:
-     * name - {String}
-     * url - {String}
-     * params - {Object}
-     * options - {Object} Hashtable of extra options to tag onto the layer
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
      */
      */
-    initialize: function(name, url, params, options) {
-        OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this, 
-                                                                arguments);
-        this.grid = [];
-        this._removeBackBuffer = OpenLayers.Function.bind(this.removeBackBuffer, this);
-
-        this.initProperties();
-
-        this.rowSign = this.tileOriginCorner.substr(0, 1) === "t" ? 1 : -1;
+    initialize: function(options) {
+        // compile regular expressions once instead of every time they are used
+        this.regExes = {
+            trimSpace: (/^\s*|\s*$/g),
+            removeSpace: (/\s*/g),
+            splitSpace: (/\s+/),
+            trimComma: (/\s*,\s*/g)
+        };
+        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
     },
 
     /**
     },
 
     /**
-     * Method: initProperties
-     * Set any properties that depend on the value of singleTile.
-     * Currently sets removeBackBufferDelay and className
-     */
-    initProperties: function() {
-        if (this.options.removeBackBufferDelay === undefined) {
-            this.removeBackBufferDelay = this.singleTile ? 0 : 2500;
-        }
-
-        if (this.options.className === undefined) {
-            this.className = this.singleTile ? 'olLayerGridSingleTile' :
-                                               'olLayerGrid';
-        }
-    },
-
-    /**
-     * Method: setMap
-     *
-     * Parameters:
-     * map - {<OpenLayers.Map>} The map.
-     */
-    setMap: function(map) {
-        OpenLayers.Layer.HTTPRequest.prototype.setMap.call(this, map);
-        OpenLayers.Element.addClass(this.div, this.className);
-    },
-
-    /**
-     * Method: removeMap
-     * Called when the layer is removed from the map.
-     *
-     * Parameters:
-     * map - {<OpenLayers.Map>} The map.
-     */
-    removeMap: function(map) {
-        this.removeBackBuffer();
-    },
-
-    /**
-     * APIMethod: destroy
-     * Deconstruct the layer and clear the grid.
-     */
-    destroy: function() {
-        this.removeBackBuffer();
-        this.clearGrid();
-
-        this.grid = null;
-        this.tileSize = null;
-        OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments); 
-    },
-
-    /**
-     * APIMethod: mergeNewParams
-     * Refetches tiles with new params merged, keeping a backbuffer. Each
-     * loading new tile will have a css class of '.olTileReplacing'. If a
-     * stylesheet applies a 'display: none' style to that class, any fade-in
-     * transition will not apply, and backbuffers for each tile will be removed
-     * as soon as the tile is loaded.
+     * APIMethod: read
+     * Read data from a string, and return a list of features. 
      * 
      * Parameters:
      * 
      * Parameters:
-     * newParams - {Object}
+     * data - {String} or {DOMElement} data to read/parse.
      *
      * Returns:
      *
      * Returns:
-     * redrawn: {Boolean} whether the layer was actually redrawn.
-     */
-
-    /**
-     * Method: clearGrid
-     * Go through and remove all tiles from the grid, calling
-     *    destroy() on each of them to kill circular references
+     * {Array(<OpenLayers.Feature.Vector>)} An array of features.
      */
      */
-    clearGrid:function() {
-        if (this.grid) {
-            for(var iRow=0, len=this.grid.length; iRow<len; iRow++) {
-                var row = this.grid[iRow];
-                for(var iCol=0, clen=row.length; iCol<clen; iCol++) {
-                    var tile = row[iCol];
-                    this.destroyTile(tile);
-                }
-            }
-            this.grid = [];
-            this.gridResolution = null;
-            this.gridLayout = null;
+    read: function(data) {
+        if(typeof data == "string") { 
+            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
         }
         }
-    },
-
-   /**
-    * APIMethod: addOptions
-    * 
-    * Parameters:
-    * newOptions - {Object}
-    * reinitialize - {Boolean} If set to true, and if resolution options of the
-    *     current baseLayer were changed, the map will be recentered to make
-    *     sure that it is displayed with a valid resolution, and a
-    *     changebaselayer event will be triggered.
-    */
-    addOptions: function (newOptions, reinitialize) {
-        var singleTileChanged = newOptions.singleTile !== undefined && 
-            newOptions.singleTile !== this.singleTile;
-        OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this, arguments);
-        if (this.map && singleTileChanged) {
-            this.initProperties();
-            this.clearGrid();
-            this.tileSize = this.options.tileSize;
-            this.setTileSize();
-            this.moveTo(null, true);
+        var featureNodes = this.getElementsByTagNameNS(data.documentElement,
+                                                       this.gmlns,
+                                                       this.featureName);
+        var features = [];
+        for(var i=0; i<featureNodes.length; i++) {
+            var feature = this.parseFeature(featureNodes[i]);
+            if(feature) {
+                features.push(feature);
+            }
         }
         }
+        return features;
     },
     
     /**
     },
     
     /**
-     * APIMethod: clone
-     * Create a clone of this layer
-     *
+     * Method: parseFeature
+     * This function is the core of the GML parsing code in OpenLayers.
+     *    It creates the geometries that are then attached to the returned
+     *    feature, and calls parseAttributes() to get attribute data out.
+     *    
      * Parameters:
      * Parameters:
-     * obj - {Object} Is this ever used?
-     * 
-     * Returns:
-     * {<OpenLayers.Layer.Grid>} An exact clone of this OpenLayers.Layer.Grid
+     * node - {DOMElement} A GML feature node. 
      */
      */
-    clone: function (obj) {
-        
-        if (obj == null) {
-            obj = new OpenLayers.Layer.Grid(this.name,
-                                            this.url,
-                                            this.params,
-                                            this.getOptions());
+    parseFeature: function(node) {
+        // only accept one geometry per feature - look for highest "order"
+        var order = ["MultiPolygon", "Polygon",
+                     "MultiLineString", "LineString",
+                     "MultiPoint", "Point", "Envelope"];
+        // FIXME: In case we parse a feature with no geometry, but boundedBy an Envelope,
+        // this code creates a geometry derived from the Envelope. This is not correct.
+        var type, nodeList, geometry, parser;
+        for(var i=0; i<order.length; ++i) {
+            type = order[i];
+            nodeList = this.getElementsByTagNameNS(node, this.gmlns, type);
+            if(nodeList.length > 0) {
+                // only deal with first geometry of this type
+                parser = this.parseGeometry[type.toLowerCase()];
+                if(parser) {
+                    geometry = parser.apply(this, [nodeList[0]]);
+                    if (this.internalProjection && this.externalProjection) {
+                        geometry.transform(this.externalProjection, 
+                                           this.internalProjection); 
+                    }                       
+                } else {
+                    throw new TypeError("Unsupported geometry type: " + type);
+                }
+                // stop looking for different geometry types
+                break;
+            }
         }
 
         }
 
-        //get all additions from superclasses
-        obj = OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this, [obj]);
-
-        // copy/set any non-init, non-simple values here
-        if (this.tileSize != null) {
-            obj.tileSize = this.tileSize.clone();
+        var bounds;
+        var boxNodes = this.getElementsByTagNameNS(node, this.gmlns, "Box");
+        for(i=0; i<boxNodes.length; ++i) {
+            var boxNode = boxNodes[i];
+            var box = this.parseGeometry["box"].apply(this, [boxNode]);
+            var parentNode = boxNode.parentNode;
+            var parentName = parentNode.localName ||
+                             parentNode.nodeName.split(":").pop();
+            if(parentName === "boundedBy") {
+                bounds = box;
+            } else {
+                geometry = box.toGeometry();
+            }
         }
         
         }
         
-        // we do not want to copy reference to grid, so we make a new array
-        obj.grid = [];
-        obj.gridResolution = null;
-        // same for backbuffer
-        obj.backBuffer = null;
-        obj.backBufferTimerId = null;
-        obj.loading = false;
-        obj.numLoadingTiles = 0;
-
-        return obj;
-    },    
-
-    /**
-     * Method: moveTo
-     * This function is called whenever the map is moved. All the moving
-     * of actual 'tiles' is done by the map, but moveTo's role is to accept
-     * a bounds and make sure the data that that bounds requires is pre-loaded.
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * zoomChanged - {Boolean}
-     * dragging - {Boolean}
-     */
-    moveTo:function(bounds, zoomChanged, dragging) {
-
-        OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this, arguments);
-
-        bounds = bounds || this.map.getExtent();
-
-        if (bounds != null) {
-             
-            // if grid is empty or zoom has changed, we *must* re-tile
-            var forceReTile = !this.grid.length || zoomChanged;
-            
-            // total bounds of the tiles
-            var tilesBounds = this.getTilesBounds();            
-
-            // the new map resolution
-            var resolution = this.map.getResolution();
-
-            // the server-supported resolution for the new map resolution
-            var serverResolution = this.getServerResolution(resolution);
-
-            if (this.singleTile) {
+        // construct feature (optionally with attributes)
+        var attributes;
+        if(this.extractAttributes) {
+            attributes = this.parseAttributes(node);
+        }
+        var feature = new OpenLayers.Feature.Vector(geometry, attributes);
+        feature.bounds = bounds;
+        
+        var firstChild = this.getFirstElementChild(node);
+        feature.gml = {
+            featureType: firstChild.nodeName.split(":")[1],
+            featureNS: firstChild.namespaceURI,
+            featureNSPrefix: firstChild.prefix
+        };
+        feature.type = feature.gml.featureType;
                 
                 
-                // We want to redraw whenever even the slightest part of the 
-                //  current bounds is not contained by our tile.
-                //  (thus, we do not specify partial -- its default is false)
-
-                if ( forceReTile ||
-                     (!dragging && !tilesBounds.containsBounds(bounds))) {
-
-                    // In single tile mode with no transition effect, we insert
-                    // a non-scaled backbuffer when the layer is moved. But if
-                    // a zoom occurs right after a move, i.e. before the new
-                    // image is received, we need to remove the backbuffer, or
-                    // an ill-positioned image will be visible during the zoom
-                    // transition.
-
-                    if(zoomChanged && this.transitionEffect !== 'resize') {
-                        this.removeBackBuffer();
-                    }
-
-                    if(!zoomChanged || this.transitionEffect === 'resize') {
-                        this.applyBackBuffer(resolution);
-                    }
-
-                    this.initSingleTile(bounds);
-                }
-            } else {
-
-                // if the bounds have changed such that they are not even 
-                // *partially* contained by our tiles (e.g. when user has 
-                // programmatically panned to the other side of the earth on
-                // zoom level 18), then moveGriddedTiles could potentially have
-                // to run through thousands of cycles, so we want to reTile
-                // instead (thus, partial true).  
-                forceReTile = forceReTile ||
-                    !tilesBounds.intersectsBounds(bounds, {
-                        worldBounds: this.map.baseLayer.wrapDateLine &&
-                            this.map.getMaxExtent()
-                    });
-
-                if(forceReTile) {
-                    if(zoomChanged && (this.transitionEffect === 'resize' ||
-                                          this.gridResolution === resolution)) {
-                        this.applyBackBuffer(resolution);
-                    }
-                    this.initGriddedTiles(bounds);
-                } else {
-                    this.moveGriddedTiles();
+        // assign fid - this can come from a "fid" or "id" attribute
+        var childNode = node.firstChild;
+        var fid;
+        while(childNode) {
+            if(childNode.nodeType == 1) {
+                fid = childNode.getAttribute("fid") ||
+                      childNode.getAttribute("id");
+                if(fid) {
+                    break;
                 }
             }
                 }
             }
+            childNode = childNode.nextSibling;
         }
         }
+        feature.fid = fid;
+        return feature;
     },
     },
-
+    
     /**
     /**
-     * Method: getTileData
-     * Given a map location, retrieve a tile and the pixel offset within that
-     *     tile corresponding to the location.  If there is not an existing 
-     *     tile in the grid that covers the given location, null will be 
-     *     returned.
-     *
-     * Parameters:
-     * loc - {<OpenLayers.LonLat>} map location
-     *
-     * Returns:
-     * {Object} Object with the following properties: tile ({<OpenLayers.Tile>}),
-     *     i ({Number} x-pixel offset from top left), and j ({Integer} y-pixel
-     *     offset from top left).
+     * Property: parseGeometry
+     * Properties of this object are the functions that parse geometries based
+     *     on their type.
      */
      */
-    getTileData: function(loc) {
-        var data = null,
-            x = loc.lon,
-            y = loc.lat,
-            numRows = this.grid.length;
-
-        if (this.map && numRows) {
-            var res = this.map.getResolution(),
-                tileWidth = this.tileSize.w,
-                tileHeight = this.tileSize.h,
-                bounds = this.grid[0][0].bounds,
-                left = bounds.left,
-                top = bounds.top;
+    parseGeometry: {
+        
+        /**
+         * Method: parseGeometry.point
+         * Given a GML node representing a point geometry, create an OpenLayers
+         *     point geometry.
+         *
+         * Parameters:
+         * node - {DOMElement} A GML node.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry.Point>} A point geometry.
+         */
+        point: function(node) {
+            /**
+             * Three coordinate variations to consider:
+             * 1) <gml:pos>x y z</gml:pos>
+             * 2) <gml:coordinates>x, y, z</gml:coordinates>
+             * 3) <gml:coord><gml:X>x</gml:X><gml:Y>y</gml:Y></gml:coord>
+             */
+            var nodeList, coordString;
+            var coords = [];
 
 
-            if (x < left) {
-                // deal with multiple worlds
-                if (this.map.baseLayer.wrapDateLine) {
-                    var worldWidth = this.map.getMaxExtent().getWidth();
-                    var worldsAway = Math.ceil((left - x) / worldWidth);
-                    x += worldWidth * worldsAway;
-                }
+            // look for <gml:pos>
+            var nodeList = this.getElementsByTagNameNS(node, this.gmlns, "pos");
+            if(nodeList.length > 0) {
+                coordString = nodeList[0].firstChild.nodeValue;
+                coordString = coordString.replace(this.regExes.trimSpace, "");
+                coords = coordString.split(this.regExes.splitSpace);
             }
             }
-            // tile distance to location (fractional number of tiles);
-            var dtx = (x - left) / (res * tileWidth);
-            var dty = (top - y) / (res * tileHeight);
-            // index of tile in grid
-            var col = Math.floor(dtx);
-            var row = Math.floor(dty);
-            if (row >= 0 && row < numRows) {
-                var tile = this.grid[row][col];
-                if (tile) {
-                    data = {
-                        tile: tile,
-                        // pixel index within tile
-                        i: Math.floor((dtx - col) * tileWidth),
-                        j: Math.floor((dty - row) * tileHeight)
-                    };                    
+
+            // look for <gml:coordinates>
+            if(coords.length == 0) {
+                nodeList = this.getElementsByTagNameNS(node, this.gmlns,
+                                                       "coordinates");
+                if(nodeList.length > 0) {
+                    coordString = nodeList[0].firstChild.nodeValue;
+                    coordString = coordString.replace(this.regExes.removeSpace,
+                                                      "");
+                    coords = coordString.split(",");
                 }
             }
                 }
             }
-        }
-        return data;
-    },
-    
-    /**
-     * Method: destroyTile
-     *
-     * Parameters:
-     * tile - {<OpenLayers.Tile>}
-     */
-    destroyTile: function(tile) {
-        this.removeTileMonitoringHooks(tile);
-        tile.destroy();
-    },
 
 
-    /**
-     * Method: getServerResolution
-     * Return the closest server-supported resolution.
-     *
-     * Parameters:
-     * resolution - {Number} The base resolution. If undefined the
-     *     map resolution is used.
-     *
-     * Returns:
-     * {Number} The closest server resolution value.
-     */
-    getServerResolution: function(resolution) {
-        var distance = Number.POSITIVE_INFINITY;
-        resolution = resolution || this.map.getResolution();
-        if(this.serverResolutions &&
-           OpenLayers.Util.indexOf(this.serverResolutions, resolution) === -1) {
-            var i, newDistance, newResolution, serverResolution;
-            for(i=this.serverResolutions.length-1; i>= 0; i--) {
-                newResolution = this.serverResolutions[i];
-                newDistance = Math.abs(newResolution - resolution);
-                if (newDistance > distance) {
-                    break;
+            // look for <gml:coord>
+            if(coords.length == 0) {
+                nodeList = this.getElementsByTagNameNS(node, this.gmlns,
+                                                       "coord");
+                if(nodeList.length > 0) {
+                    var xList = this.getElementsByTagNameNS(nodeList[0],
+                                                            this.gmlns, "X");
+                    var yList = this.getElementsByTagNameNS(nodeList[0],
+                                                            this.gmlns, "Y");
+                    if(xList.length > 0 && yList.length > 0) {
+                        coords = [xList[0].firstChild.nodeValue,
+                                  yList[0].firstChild.nodeValue];
+                    }
                 }
                 }
-                distance = newDistance;
-                serverResolution = newResolution;
             }
             }
-            resolution = serverResolution;
-        }
-        return resolution;
-    },
-
-    /**
-     * Method: getServerZoom
-     * Return the zoom value corresponding to the best matching server
-     * resolution, taking into account <serverResolutions> and <zoomOffset>.
-     *
-     * Returns:
-     * {Number} The closest server supported zoom. This is not the map zoom
-     *     level, but an index of the server's resolutions array.
-     */
-    getServerZoom: function() {
-        var resolution = this.getServerResolution();
-        return this.serverResolutions ?
-            OpenLayers.Util.indexOf(this.serverResolutions, resolution) :
-            this.map.getZoomForResolution(resolution) + (this.zoomOffset || 0);
-    },
-
-    /**
-     * Method: applyBackBuffer
-     * Create, insert, scale and position a back buffer for the layer.
-     *
-     * Parameters:
-     * resolution - {Number} The resolution to transition to.
-     */
-    applyBackBuffer: function(resolution) {
-        if(this.backBufferTimerId !== null) {
-            this.removeBackBuffer();
-        }
-        var backBuffer = this.backBuffer;
-        if(!backBuffer) {
-            backBuffer = this.createBackBuffer();
-            if(!backBuffer) {
-                return;
+                
+            // preserve third dimension
+            if(coords.length == 2) {
+                coords[2] = null;
             }
             }
-            if (resolution === this.gridResolution) {
-                this.div.insertBefore(backBuffer, this.div.firstChild);
-            } else {
-                this.map.baseLayer.div.parentNode.insertBefore(backBuffer, this.map.baseLayer.div);
+            
+            if (this.xy) {
+                return new OpenLayers.Geometry.Point(coords[0], coords[1],
+                                                 coords[2]);
             }
             }
-            this.backBuffer = backBuffer;
-
-            // set some information in the instance for subsequent
-            // calls to applyBackBuffer where the same back buffer
-            // is reused
-            var topLeftTileBounds = this.grid[0][0].bounds;
-            this.backBufferLonLat = {
-                lon: topLeftTileBounds.left,
-                lat: topLeftTileBounds.top
-            };
-            this.backBufferResolution = this.gridResolution;
-        }
+            else{
+                return new OpenLayers.Geometry.Point(coords[1], coords[0],
+                                                 coords[2]);
+            }
+        },
         
         
-        var ratio = this.backBufferResolution / resolution;
-
-        // scale the tiles inside the back buffer
-        var tiles = backBuffer.childNodes, tile;
-        for (var i=tiles.length-1; i>=0; --i) {
-            tile = tiles[i];
-            tile.style.top = ((ratio * tile._i * tile._h) | 0) + 'px';
-            tile.style.left = ((ratio * tile._j * tile._w) | 0) + 'px';
-            tile.style.width = Math.round(ratio * tile._w) + 'px';
-            tile.style.height = Math.round(ratio * tile._h) + 'px';
-        }
-
-        // and position it (based on the grid's top-left corner)
-        var position = this.getViewPortPxFromLonLat(
-                this.backBufferLonLat, resolution);
-        var leftOffset = this.map.layerContainerOriginPx.x;
-        var topOffset = this.map.layerContainerOriginPx.y;
-        backBuffer.style.left = Math.round(position.x - leftOffset) + 'px';
-        backBuffer.style.top = Math.round(position.y - topOffset) + 'px';
-    },
-
-    /**
-     * Method: createBackBuffer
-     * Create a back buffer.
-     *
-     * Returns:
-     * {DOMElement} The DOM element for the back buffer, undefined if the
-     * grid isn't initialized yet.
-     */
-    createBackBuffer: function() {
-        var backBuffer;
-        if(this.grid.length > 0) {
-            backBuffer = document.createElement('div');
-            backBuffer.id = this.div.id + '_bb';
-            backBuffer.className = 'olBackBuffer';
-            backBuffer.style.position = 'absolute';
-            var map = this.map;
-            backBuffer.style.zIndex = this.transitionEffect === 'resize' ?
-                    this.getZIndex() - 1 :
-                    // 'map-resize':
-                    map.Z_INDEX_BASE.BaseLayer -
-                            (map.getNumLayers() - map.getLayerIndex(this));
-            for(var i=0, lenI=this.grid.length; i<lenI; i++) {
-                for(var j=0, lenJ=this.grid[i].length; j<lenJ; j++) {
-                    var tile = this.grid[i][j],
-                        markup = this.grid[i][j].createBackBuffer();
-                    if (markup) {
-                        markup._i = i;
-                        markup._j = j;
-                        markup._w = tile.size.w;
-                        markup._h = tile.size.h;
-                        markup.id = tile.id + '_bb';
-                        backBuffer.appendChild(markup);
+        /**
+         * Method: parseGeometry.multipoint
+         * Given a GML node representing a multipoint geometry, create an
+         *     OpenLayers multipoint geometry.
+         *
+         * Parameters:
+         * node - {DOMElement} A GML node.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry.MultiPoint>} A multipoint geometry.
+         */
+        multipoint: function(node) {
+            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
+                                                       "Point");
+            var components = [];
+            if(nodeList.length > 0) {
+                var point;
+                for(var i=0; i<nodeList.length; ++i) {
+                    point = this.parseGeometry.point.apply(this, [nodeList[i]]);
+                    if(point) {
+                        components.push(point);
                     }
                 }
             }
                     }
                 }
             }
-        }
-        return backBuffer;
-    },
+            return new OpenLayers.Geometry.MultiPoint(components);
+        },
+        
+        /**
+         * Method: parseGeometry.linestring
+         * Given a GML node representing a linestring geometry, create an
+         *     OpenLayers linestring geometry.
+         *
+         * Parameters:
+         * node - {DOMElement} A GML node.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry.LineString>} A linestring geometry.
+         */
+        linestring: function(node, ring) {
+            /**
+             * Two coordinate variations to consider:
+             * 1) <gml:posList dimension="d">x0 y0 z0 x1 y1 z1</gml:posList>
+             * 2) <gml:coordinates>x0, y0, z0 x1, y1, z1</gml:coordinates>
+             */
+            var nodeList, coordString;
+            var coords = [];
+            var points = [];
 
 
-    /**
-     * Method: removeBackBuffer
-     * Remove back buffer from DOM.
-     */
-    removeBackBuffer: function() {
-        if (this._transitionElement) {
-            for (var i=this.transitionendEvents.length-1; i>=0; --i) {
-                OpenLayers.Event.stopObserving(this._transitionElement,
-                    this.transitionendEvents[i], this._removeBackBuffer);
+            // look for <gml:posList>
+            nodeList = this.getElementsByTagNameNS(node, this.gmlns, "posList");
+            if(nodeList.length > 0) {
+                coordString = this.getChildValue(nodeList[0]);
+                coordString = coordString.replace(this.regExes.trimSpace, "");
+                coords = coordString.split(this.regExes.splitSpace);
+                var dim = parseInt(nodeList[0].getAttribute("dimension"));
+                var j, x, y, z;
+                for(var i=0; i<coords.length/dim; ++i) {
+                    j = i * dim;
+                    x = coords[j];
+                    y = coords[j+1];
+                    z = (dim == 2) ? null : coords[j+2];
+                    if (this.xy) {
+                        points.push(new OpenLayers.Geometry.Point(x, y, z));
+                    } else {
+                        points.push(new OpenLayers.Geometry.Point(y, x, z));
+                    }
+                }
             }
             }
-            delete this._transitionElement;
-        }
-        if(this.backBuffer) {
-            if (this.backBuffer.parentNode) {
-                this.backBuffer.parentNode.removeChild(this.backBuffer);
+
+            // look for <gml:coordinates>
+            if(coords.length == 0) {
+                nodeList = this.getElementsByTagNameNS(node, this.gmlns,
+                                                       "coordinates");
+                if(nodeList.length > 0) {
+                    coordString = this.getChildValue(nodeList[0]);
+                    coordString = coordString.replace(this.regExes.trimSpace,
+                                                      "");
+                    coordString = coordString.replace(this.regExes.trimComma,
+                                                      ",");
+                    var pointList = coordString.split(this.regExes.splitSpace);
+                    for(var i=0; i<pointList.length; ++i) {
+                        coords = pointList[i].split(",");
+                        if(coords.length == 2) {
+                            coords[2] = null;
+                        }
+                        if (this.xy) {
+                            points.push(new OpenLayers.Geometry.Point(coords[0],
+                                                                  coords[1],
+                                                                  coords[2]));
+                        } else {
+                            points.push(new OpenLayers.Geometry.Point(coords[1],
+                                                                  coords[0],
+                                                                  coords[2]));
+                        }
+                    }
+                }
             }
             }
-            this.backBuffer = null;
-            this.backBufferResolution = null;
-            if(this.backBufferTimerId !== null) {
-                window.clearTimeout(this.backBufferTimerId);
-                this.backBufferTimerId = null;
+
+            var line = null;
+            if(points.length != 0) {
+                if(ring) {
+                    line = new OpenLayers.Geometry.LinearRing(points);
+                } else {
+                    line = new OpenLayers.Geometry.LineString(points);
+                }
+            }
+            return line;
+        },
+        
+        /**
+         * Method: parseGeometry.multilinestring
+         * Given a GML node representing a multilinestring geometry, create an
+         *     OpenLayers multilinestring geometry.
+         *
+         * Parameters:
+         * node - {DOMElement} A GML node.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry.MultiLineString>} A multilinestring geometry.
+         */
+        multilinestring: function(node) {
+            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
+                                                       "LineString");
+            var components = [];
+            if(nodeList.length > 0) {
+                var line;
+                for(var i=0; i<nodeList.length; ++i) {
+                    line = this.parseGeometry.linestring.apply(this,
+                                                               [nodeList[i]]);
+                    if(line) {
+                        components.push(line);
+                    }
+                }
+            }
+            return new OpenLayers.Geometry.MultiLineString(components);
+        },
+        
+        /**
+         * Method: parseGeometry.polygon
+         * Given a GML node representing a polygon geometry, create an
+         *     OpenLayers polygon geometry.
+         *
+         * Parameters:
+         * node - {DOMElement} A GML node.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry.Polygon>} A polygon geometry.
+         */
+        polygon: function(node) {
+            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
+                                                       "LinearRing");
+            var components = [];
+            if(nodeList.length > 0) {
+                // this assumes exterior ring first, inner rings after
+                var ring;
+                for(var i=0; i<nodeList.length; ++i) {
+                    ring = this.parseGeometry.linestring.apply(this,
+                                                        [nodeList[i], true]);
+                    if(ring) {
+                        components.push(ring);
+                    }
+                }
+            }
+            return new OpenLayers.Geometry.Polygon(components);
+        },
+        
+        /**
+         * Method: parseGeometry.multipolygon
+         * Given a GML node representing a multipolygon geometry, create an
+         *     OpenLayers multipolygon geometry.
+         *
+         * Parameters:
+         * node - {DOMElement} A GML node.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry.MultiPolygon>} A multipolygon geometry.
+         */
+        multipolygon: function(node) {
+            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
+                                                       "Polygon");
+            var components = [];
+            if(nodeList.length > 0) {
+                var polygon;
+                for(var i=0; i<nodeList.length; ++i) {
+                    polygon = this.parseGeometry.polygon.apply(this,
+                                                               [nodeList[i]]);
+                    if(polygon) {
+                        components.push(polygon);
+                    }
+                }
+            }
+            return new OpenLayers.Geometry.MultiPolygon(components);
+        },
+        
+        envelope: function(node) {
+            var components = [];
+            var coordString;
+            var envelope;
+            
+            var lpoint = this.getElementsByTagNameNS(node, this.gmlns, "lowerCorner");
+            if (lpoint.length > 0) {
+                var coords = [];
+                
+                if(lpoint.length > 0) {
+                    coordString = lpoint[0].firstChild.nodeValue;
+                    coordString = coordString.replace(this.regExes.trimSpace, "");
+                    coords = coordString.split(this.regExes.splitSpace);
+                }
+                
+                if(coords.length == 2) {
+                    coords[2] = null;
+                }
+                if (this.xy) {
+                    var lowerPoint = new OpenLayers.Geometry.Point(coords[0], coords[1],coords[2]);
+                } else {
+                    var lowerPoint = new OpenLayers.Geometry.Point(coords[1], coords[0],coords[2]);
+                }
+            }
+            
+            var upoint = this.getElementsByTagNameNS(node, this.gmlns, "upperCorner");
+            if (upoint.length > 0) {
+                var coords = [];
+                
+                if(upoint.length > 0) {
+                    coordString = upoint[0].firstChild.nodeValue;
+                    coordString = coordString.replace(this.regExes.trimSpace, "");
+                    coords = coordString.split(this.regExes.splitSpace);
+                }
+                
+                if(coords.length == 2) {
+                    coords[2] = null;
+                }
+                if (this.xy) {
+                    var upperPoint = new OpenLayers.Geometry.Point(coords[0], coords[1],coords[2]);
+                } else {
+                    var upperPoint = new OpenLayers.Geometry.Point(coords[1], coords[0],coords[2]);
+                }
+            }
+            
+            if (lowerPoint && upperPoint) {
+                components.push(new OpenLayers.Geometry.Point(lowerPoint.x, lowerPoint.y));
+                components.push(new OpenLayers.Geometry.Point(upperPoint.x, lowerPoint.y));
+                components.push(new OpenLayers.Geometry.Point(upperPoint.x, upperPoint.y));
+                components.push(new OpenLayers.Geometry.Point(lowerPoint.x, upperPoint.y));
+                components.push(new OpenLayers.Geometry.Point(lowerPoint.x, lowerPoint.y));
+                
+                var ring = new OpenLayers.Geometry.LinearRing(components);
+                envelope = new OpenLayers.Geometry.Polygon([ring]);
+            }
+            return envelope; 
+        },
+
+        /**
+         * Method: parseGeometry.box
+         * Given a GML node representing a box geometry, create an
+         *     OpenLayers.Bounds.
+         *
+         * Parameters:
+         * node - {DOMElement} A GML node.
+         *
+         * Returns:
+         * {<OpenLayers.Bounds>} A bounds representing the box.
+         */
+        box: function(node) {
+            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
+                                                   "coordinates");
+            var coordString;
+            var coords, beginPoint = null, endPoint = null;
+            if (nodeList.length > 0) {
+                coordString = nodeList[0].firstChild.nodeValue;
+                coords = coordString.split(" ");
+                if (coords.length == 2) {
+                    beginPoint = coords[0].split(",");
+                    endPoint = coords[1].split(",");
+                }
+            }
+            if (beginPoint !== null && endPoint !== null) {
+                return new OpenLayers.Bounds(parseFloat(beginPoint[0]),
+                    parseFloat(beginPoint[1]),
+                    parseFloat(endPoint[0]),
+                    parseFloat(endPoint[1]) );
             }
         }
             }
         }
+        
     },
     },
-
+    
     /**
     /**
-     * Method: moveByPx
-     * Move the layer based on pixel vector.
+     * Method: parseAttributes
      *
      * Parameters:
      *
      * Parameters:
-     * dx - {Number}
-     * dy - {Number}
+     * node - {DOMElement}
+     *
+     * Returns:
+     * {Object} An attributes object.
      */
      */
-    moveByPx: function(dx, dy) {
-        if (!this.singleTile) {
-            this.moveGriddedTiles();
+    parseAttributes: function(node) {
+        var attributes = {};
+        // assume attributes are children of the first type 1 child
+        var childNode = node.firstChild;
+        var children, i, child, grandchildren, grandchild, name, value;
+        while(childNode) {
+            if(childNode.nodeType == 1) {
+                // attributes are type 1 children with one type 3 child
+                children = childNode.childNodes;
+                for(i=0; i<children.length; ++i) {
+                    child = children[i];
+                    if(child.nodeType == 1) {
+                        grandchildren = child.childNodes;
+                        if(grandchildren.length == 1) {
+                            grandchild = grandchildren[0];
+                            if(grandchild.nodeType == 3 ||
+                               grandchild.nodeType == 4) {
+                                name = (child.prefix) ?
+                                        child.nodeName.split(":")[1] :
+                                        child.nodeName;
+                                value = grandchild.nodeValue.replace(
+                                                this.regExes.trimSpace, "");
+                                attributes[name] = value;
+                            }
+                        } else {
+                            // If child has no childNodes (grandchildren),
+                            // set an attribute with null value.
+                            // e.g. <prefix:fieldname/> becomes
+                            // {fieldname: null}
+                            attributes[child.nodeName.split(":").pop()] = null;
+                        }
+                    }
+                }
+                break;
+            }
+            childNode = childNode.nextSibling;
         }
         }
+        return attributes;
     },
     },
-
+    
     /**
     /**
-     * APIMethod: setTileSize
-     * Check if we are in singleTile mode and if so, set the size as a ratio
-     *     of the map size (as specified by the layer's 'ratio' property).
+     * APIMethod: write
+     * Generate a GML document string given a list of features. 
      * 
      * Parameters:
      * 
      * Parameters:
-     * size - {<OpenLayers.Size>}
-     */
-    setTileSize: function(size) { 
-        if (this.singleTile) {
-            size = this.map.getSize();
-            size.h = parseInt(size.h * this.ratio, 10);
-            size.w = parseInt(size.w * this.ratio, 10);
-        } 
-        OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this, [size]);
-    },
-
-    /**
-     * APIMethod: getTilesBounds
-     * Return the bounds of the tile grid.
+     * features - {Array(<OpenLayers.Feature.Vector>)} List of features to
+     *     serialize into a string.
      *
      * Returns:
      *
      * Returns:
-     * {<OpenLayers.Bounds>} A Bounds object representing the bounds of all the
-     *     currently loaded tiles (including those partially or not at all seen 
-     *     onscreen).
-     */
-    getTilesBounds: function() {    
-        var bounds = null; 
-        
-        var length = this.grid.length;
-        if (length) {
-            var bottomLeftTileBounds = this.grid[length - 1][0].bounds,
-                width = this.grid[0].length * bottomLeftTileBounds.getWidth(),
-                height = this.grid.length * bottomLeftTileBounds.getHeight();
-            
-            bounds = new OpenLayers.Bounds(bottomLeftTileBounds.left, 
-                                           bottomLeftTileBounds.bottom,
-                                           bottomLeftTileBounds.left + width, 
-                                           bottomLeftTileBounds.bottom + height);
-        }   
-        return bounds;
-    },
-
-    /**
-     * Method: initSingleTile
-     * 
-     * Parameters: 
-     * bounds - {<OpenLayers.Bounds>}
+     * {String} A string representing the GML document.
      */
      */
-    initSingleTile: function(bounds) {
-        this.events.triggerEvent("retile");
-
-        //determine new tile bounds
-        var center = bounds.getCenterLonLat();
-        var tileWidth = bounds.getWidth() * this.ratio;
-        var tileHeight = bounds.getHeight() * this.ratio;
-                                       
-        var tileBounds = 
-            new OpenLayers.Bounds(center.lon - (tileWidth/2),
-                                  center.lat - (tileHeight/2),
-                                  center.lon + (tileWidth/2),
-                                  center.lat + (tileHeight/2));
-  
-        var px = this.map.getLayerPxFromLonLat({
-            lon: tileBounds.left,
-            lat: tileBounds.top
-        });
-
-        if (!this.grid.length) {
-            this.grid[0] = [];
+    write: function(features) {
+        if(!(OpenLayers.Util.isArray(features))) {
+            features = [features];
         }
         }
-
-        var tile = this.grid[0][0];
-        if (!tile) {
-            tile = this.addTile(tileBounds, px);
-            
-            this.addTileMonitoringHooks(tile);
-            tile.draw();
-            this.grid[0][0] = tile;
-        } else {
-            tile.moveTo(tileBounds, px);
-        }           
-        
-        //remove all but our single tile
-        this.removeExcessTiles(1,1);
-
-        // store the resolution of the grid
-        this.gridResolution = this.getServerResolution();
+        var gml = this.createElementNS("http://www.opengis.net/wfs",
+                                       "wfs:" + this.collectionName);
+        for(var i=0; i<features.length; i++) {
+            gml.appendChild(this.createFeatureXML(features[i]));
+        }
+        return OpenLayers.Format.XML.prototype.write.apply(this, [gml]);
     },
 
     /** 
     },
 
     /** 
-     * Method: calculateGridLayout
-     * Generate parameters for the grid layout.
+     * Method: createFeatureXML
+     * Accept an OpenLayers.Feature.Vector, and build a GML node for it.
      *
      * Parameters:
      *
      * Parameters:
-     * bounds - {<OpenLayers.Bound>|Object} OpenLayers.Bounds or an
-     *     object with a 'left' and 'top' properties.
-     * origin - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
-     *     object with a 'lon' and 'lat' properties.
-     * resolution - {Number}
+     * feature - {<OpenLayers.Feature.Vector>} The feature to be built as GML.
      *
      * Returns:
      *
      * Returns:
-     * {Object} Object containing properties tilelon, tilelat, startcol,
-     * startrow
+     * {DOMElement} A node reprensting the feature in GML.
      */
      */
-    calculateGridLayout: function(bounds, origin, resolution) {
-        var tilelon = resolution * this.tileSize.w;
-        var tilelat = resolution * this.tileSize.h;
-        
-        var offsetlon = bounds.left - origin.lon;
-        var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
-        
-        var rowSign = this.rowSign;
-
-        var offsetlat = rowSign * (origin.lat - bounds.top + tilelat);  
-        var tilerow = Math[~rowSign ? 'floor' : 'ceil'](offsetlat/tilelat) - this.buffer * rowSign;
-        
-        return { 
-          tilelon: tilelon, tilelat: tilelat,
-          startcol: tilecol, startrow: tilerow
-        };
-
-    },
-    
-    /**
-     * Method: getTileOrigin
-     * Determine the origin for aligning the grid of tiles.  If a <tileOrigin>
-     *     property is supplied, that will be returned.  Otherwise, the origin
-     *     will be derived from the layer's <maxExtent> property.  In this case,
-     *     the tile origin will be the corner of the <maxExtent> given by the 
-     *     <tileOriginCorner> property.
-     *
-     * Returns:
-     * {<OpenLayers.LonLat>} The tile origin.
+    createFeatureXML: function(feature) {
+        var geometry = feature.geometry;
+        var geometryNode = this.buildGeometryNode(geometry);
+        var geomContainer = this.createElementNS(this.featureNS,
+                                                 this.featurePrefix + ":" +
+                                                 this.geometryName);
+        geomContainer.appendChild(geometryNode);
+        var featureNode = this.createElementNS(this.gmlns,
+                                               "gml:" + this.featureName);
+        var featureContainer = this.createElementNS(this.featureNS,
+                                                    this.featurePrefix + ":" +
+                                                    this.layerName);
+        var fid = feature.fid || feature.id;
+        featureContainer.setAttribute("fid", fid);
+        featureContainer.appendChild(geomContainer);
+        for(var attr in feature.attributes) {
+            var attrText = this.createTextNode(feature.attributes[attr]); 
+            var nodename = attr.substring(attr.lastIndexOf(":") + 1);
+            var attrContainer = this.createElementNS(this.featureNS,
+                                                     this.featurePrefix + ":" +
+                                                     nodename);
+            attrContainer.appendChild(attrText);
+            featureContainer.appendChild(attrContainer);
+        }    
+        featureNode.appendChild(featureContainer);
+        return featureNode;
+    },
+    
+    /**
+     * APIMethod: buildGeometryNode
      */
      */
-    getTileOrigin: function() {
-        var origin = this.tileOrigin;
-        if (!origin) {
-            var extent = this.getMaxExtent();
-            var edges = ({
-                "tl": ["left", "top"],
-                "tr": ["right", "top"],
-                "bl": ["left", "bottom"],
-                "br": ["right", "bottom"]
-            })[this.tileOriginCorner];
-            origin = new OpenLayers.LonLat(extent[edges[0]], extent[edges[1]]);
+    buildGeometryNode: function(geometry) {
+        if (this.externalProjection && this.internalProjection) {
+            geometry = geometry.clone();
+            geometry.transform(this.internalProjection, 
+                               this.externalProjection);
+        }    
+        var className = geometry.CLASS_NAME;
+        var type = className.substring(className.lastIndexOf(".") + 1);
+        var builder = this.buildGeometry[type.toLowerCase()];
+        return builder.apply(this, [geometry]);
+    },
+
+    /**
+     * Property: buildGeometry
+     * Object containing methods to do the actual geometry node building
+     *     based on geometry type.
+     */
+    buildGeometry: {
+        // TBD retrieve the srs from layer
+        // srsName is non-standard, so not including it until it's right.
+        // gml.setAttribute("srsName",
+        //                  "http://www.opengis.net/gml/srs/epsg.xml#4326");
+
+        /**
+         * Method: buildGeometry.point
+         * Given an OpenLayers point geometry, create a GML point.
+         *
+         * Parameters:
+         * geometry - {<OpenLayers.Geometry.Point>} A point geometry.
+         *
+         * Returns:
+         * {DOMElement} A GML point node.
+         */
+        point: function(geometry) {
+            var gml = this.createElementNS(this.gmlns, "gml:Point");
+            gml.appendChild(this.buildCoordinatesNode(geometry));
+            return gml;
+        },
+        
+        /**
+         * Method: buildGeometry.multipoint
+         * Given an OpenLayers multipoint geometry, create a GML multipoint.
+         *
+         * Parameters:
+         * geometry - {<OpenLayers.Geometry.MultiPoint>} A multipoint geometry.
+         *
+         * Returns:
+         * {DOMElement} A GML multipoint node.
+         */
+        multipoint: function(geometry) {
+            var gml = this.createElementNS(this.gmlns, "gml:MultiPoint");
+            var points = geometry.components;
+            var pointMember, pointGeom;
+            for(var i=0; i<points.length; i++) { 
+                pointMember = this.createElementNS(this.gmlns,
+                                                   "gml:pointMember");
+                pointGeom = this.buildGeometry.point.apply(this,
+                                                               [points[i]]);
+                pointMember.appendChild(pointGeom);
+                gml.appendChild(pointMember);
+            }
+            return gml;            
+        },
+        
+        /**
+         * Method: buildGeometry.linestring
+         * Given an OpenLayers linestring geometry, create a GML linestring.
+         *
+         * Parameters:
+         * geometry - {<OpenLayers.Geometry.LineString>} A linestring geometry.
+         *
+         * Returns:
+         * {DOMElement} A GML linestring node.
+         */
+        linestring: function(geometry) {
+            var gml = this.createElementNS(this.gmlns, "gml:LineString");
+            gml.appendChild(this.buildCoordinatesNode(geometry));
+            return gml;
+        },
+        
+        /**
+         * Method: buildGeometry.multilinestring
+         * Given an OpenLayers multilinestring geometry, create a GML
+         *     multilinestring.
+         *
+         * Parameters:
+         * geometry - {<OpenLayers.Geometry.MultiLineString>} A multilinestring
+         *     geometry.
+         *
+         * Returns:
+         * {DOMElement} A GML multilinestring node.
+         */
+        multilinestring: function(geometry) {
+            var gml = this.createElementNS(this.gmlns, "gml:MultiLineString");
+            var lines = geometry.components;
+            var lineMember, lineGeom;
+            for(var i=0; i<lines.length; ++i) {
+                lineMember = this.createElementNS(this.gmlns,
+                                                  "gml:lineStringMember");
+                lineGeom = this.buildGeometry.linestring.apply(this,
+                                                                   [lines[i]]);
+                lineMember.appendChild(lineGeom);
+                gml.appendChild(lineMember);
+            }
+            return gml;
+        },
+        
+        /**
+         * Method: buildGeometry.linearring
+         * Given an OpenLayers linearring geometry, create a GML linearring.
+         *
+         * Parameters:
+         * geometry - {<OpenLayers.Geometry.LinearRing>} A linearring geometry.
+         *
+         * Returns:
+         * {DOMElement} A GML linearring node.
+         */
+        linearring: function(geometry) {
+            var gml = this.createElementNS(this.gmlns, "gml:LinearRing");
+            gml.appendChild(this.buildCoordinatesNode(geometry));
+            return gml;
+        },
+        
+        /**
+         * Method: buildGeometry.polygon
+         * Given an OpenLayers polygon geometry, create a GML polygon.
+         *
+         * Parameters:
+         * geometry - {<OpenLayers.Geometry.Polygon>} A polygon geometry.
+         *
+         * Returns:
+         * {DOMElement} A GML polygon node.
+         */
+        polygon: function(geometry) {
+            var gml = this.createElementNS(this.gmlns, "gml:Polygon");
+            var rings = geometry.components;
+            var ringMember, ringGeom, type;
+            for(var i=0; i<rings.length; ++i) {
+                type = (i==0) ? "outerBoundaryIs" : "innerBoundaryIs";
+                ringMember = this.createElementNS(this.gmlns,
+                                                  "gml:" + type);
+                ringGeom = this.buildGeometry.linearring.apply(this,
+                                                                   [rings[i]]);
+                ringMember.appendChild(ringGeom);
+                gml.appendChild(ringMember);
+            }
+            return gml;
+        },
+        
+        /**
+         * Method: buildGeometry.multipolygon
+         * Given an OpenLayers multipolygon geometry, create a GML multipolygon.
+         *
+         * Parameters:
+         * geometry - {<OpenLayers.Geometry.MultiPolygon>} A multipolygon
+         *     geometry.
+         *
+         * Returns:
+         * {DOMElement} A GML multipolygon node.
+         */
+        multipolygon: function(geometry) {
+            var gml = this.createElementNS(this.gmlns, "gml:MultiPolygon");
+            var polys = geometry.components;
+            var polyMember, polyGeom;
+            for(var i=0; i<polys.length; ++i) {
+                polyMember = this.createElementNS(this.gmlns,
+                                                  "gml:polygonMember");
+                polyGeom = this.buildGeometry.polygon.apply(this,
+                                                                [polys[i]]);
+                polyMember.appendChild(polyGeom);
+                gml.appendChild(polyMember);
+            }
+            return gml;
+
+        },
+        /**
+         * Method: buildGeometry.bounds
+         * Given an OpenLayers bounds, create a GML box.
+         *
+         * Parameters:
+         * bounds - {<OpenLayers.Geometry.Bounds>} A bounds object.
+         *
+         * Returns:
+         * {DOMElement} A GML box node.
+         */
+        bounds: function(bounds) {
+            var gml = this.createElementNS(this.gmlns, "gml:Box");
+            gml.appendChild(this.buildCoordinatesNode(bounds));
+            return gml;
         }
         }
-        return origin;
     },
 
     /**
     },
 
     /**
-     * Method: getTileBoundsForGridIndex
+     * Method: buildCoordinates
+     * builds the coordinates XmlNode
+     * (code)
+     * <gml:coordinates decimal="." cs="," ts=" ">...</gml:coordinates>
+     * (end)
      *
      *
-     * Parameters:
-     * row - {Number} The row of the grid
-     * col - {Number} The column of the grid
+     * Parameters: 
+     * geometry - {<OpenLayers.Geometry>} 
      *
      * Returns:
      *
      * Returns:
-     * {<OpenLayers.Bounds>} The bounds for the tile at (row, col)
+     * {XmlNode} created xmlNode
      */
      */
-    getTileBoundsForGridIndex: function(row, col) {
-        var origin = this.getTileOrigin();
-        var tileLayout = this.gridLayout;
-        var tilelon = tileLayout.tilelon;
-        var tilelat = tileLayout.tilelat;
-        var startcol = tileLayout.startcol;
-        var startrow = tileLayout.startrow;
-        var rowSign = this.rowSign;
-        return new OpenLayers.Bounds(
-            origin.lon + (startcol + col) * tilelon,
-            origin.lat - (startrow + row * rowSign) * tilelat * rowSign,
-            origin.lon + (startcol + col + 1) * tilelon,
-            origin.lat - (startrow + (row - 1) * rowSign) * tilelat * rowSign
-        );
+    buildCoordinatesNode: function(geometry) {
+        var coordinatesNode = this.createElementNS(this.gmlns,
+                                                   "gml:coordinates");
+        coordinatesNode.setAttribute("decimal", ".");
+        coordinatesNode.setAttribute("cs", ",");
+        coordinatesNode.setAttribute("ts", " ");
+
+        var parts = [];
+
+        if(geometry instanceof OpenLayers.Bounds){
+            parts.push(geometry.left + "," + geometry.bottom);
+            parts.push(geometry.right + "," + geometry.top);
+        } else {
+            var points = (geometry.components) ? geometry.components : [geometry];
+            for(var i=0; i<points.length; i++) {
+                parts.push(points[i].x + "," + points[i].y);                
+            }            
+        }
+
+        var txtNode = this.createTextNode(parts.join(" "));
+        coordinatesNode.appendChild(txtNode);
+        
+        return coordinatesNode;
     },
 
     },
 
+    CLASS_NAME: "OpenLayers.Format.GML" 
+});
+/* ======================================================================
+    OpenLayers/Format/GML/Base.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XML.js
+ * @requires OpenLayers/Format/GML.js
+ */
+
+/**
+ * Though required in the full build, if the GML format is excluded, we set
+ * the namespace here.
+ */
+if(!OpenLayers.Format.GML) {
+    OpenLayers.Format.GML = {};
+}
+
+/**
+ * Class: OpenLayers.Format.GML.Base
+ * Superclass for GML parsers.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
+
     /**
     /**
-     * Method: initGriddedTiles
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
+     * Property: namespaces
+     * {Object} Mapping of namespace aliases to namespace URIs.
      */
      */
-    initGriddedTiles:function(bounds) {
-        this.events.triggerEvent("retile");
-
-        // work out mininum number of rows and columns; this is the number of
-        // tiles required to cover the viewport plus at least one for panning
+    namespaces: {
+        gml: "http://www.opengis.net/gml",
+        xlink: "http://www.w3.org/1999/xlink",
+        xsi: "http://www.w3.org/2001/XMLSchema-instance",
+        wfs: "http://www.opengis.net/wfs" // this is a convenience for reading wfs:FeatureCollection
+    },
 
 
-        var viewSize = this.map.getSize();
-        
-        var origin = this.getTileOrigin();
-        var resolution = this.map.getResolution(),
-            serverResolution = this.getServerResolution(),
-            ratio = resolution / serverResolution,
-            tileSize = {
-                w: this.tileSize.w / ratio,
-                h: this.tileSize.h / ratio
-            };
+    /**
+     * Property: defaultPrefix
+     */
+    defaultPrefix: "gml",
 
 
-        var minRows = Math.ceil(viewSize.h/tileSize.h) + 
-                      2 * this.buffer + 1;
-        var minCols = Math.ceil(viewSize.w/tileSize.w) +
-                      2 * this.buffer + 1;
+    /**
+     * Property: schemaLocation
+     * {String} Schema location for a particular minor version.
+     */
+    schemaLocation: null,
 
 
-        var tileLayout = this.calculateGridLayout(bounds, origin, serverResolution);
-        this.gridLayout = tileLayout;
-        
-        var tilelon = tileLayout.tilelon;
-        var tilelat = tileLayout.tilelat;
-        
-        var layerContainerDivLeft = this.map.layerContainerOriginPx.x;
-        var layerContainerDivTop = this.map.layerContainerOriginPx.y;
+    /**
+     * APIProperty: featureType
+     * {Array(String) or String} The local (without prefix) feature typeName(s).
+     */
+    featureType: null,
 
 
-        var tileBounds = this.getTileBoundsForGridIndex(0, 0);
-        var startPx = this.map.getViewPortPxFromLonLat(
-            new OpenLayers.LonLat(tileBounds.left, tileBounds.top)
-        );
-        startPx.x = Math.round(startPx.x) - layerContainerDivLeft;
-        startPx.y = Math.round(startPx.y) - layerContainerDivTop;
+    /**
+     * APIProperty: featureNS
+     * {String} The feature namespace.  Must be set in the options at
+     *     construction.
+     */
+    featureNS: null,
 
 
-        var tileData = [], center = this.map.getCenter();
+    /**
+     * APIProperty: featurePrefix
+     * {String} Namespace alias (or prefix) for feature nodes.  Default is
+     *     "feature".
+     */
+    featurePrefix: "feature",
 
 
-        var rowidx = 0;
-        do {
-            var row = this.grid[rowidx];
-            if (!row) {
-                row = [];
-                this.grid.push(row);
-            }
-            
-            var colidx = 0;
-            do {
-                tileBounds = this.getTileBoundsForGridIndex(rowidx, colidx);
-                var px = startPx.clone();
-                px.x = px.x + colidx * Math.round(tileSize.w);
-                px.y = px.y + rowidx * Math.round(tileSize.h);
-                var tile = row[colidx];
-                if (!tile) {
-                    tile = this.addTile(tileBounds, px);
-                    this.addTileMonitoringHooks(tile);
-                    row.push(tile);
-                } else {
-                    tile.moveTo(tileBounds, px, false);
-                }
-                var tileCenter = tileBounds.getCenterLonLat();
-                tileData.push({
-                    tile: tile,
-                    distance: Math.pow(tileCenter.lon - center.lon, 2) +
-                        Math.pow(tileCenter.lat - center.lat, 2)
-                });
-     
-                colidx += 1;
-            } while ((tileBounds.right <= bounds.right + tilelon * this.buffer)
-                     || colidx < minCols);
-             
-            rowidx += 1;
-        } while((tileBounds.bottom >= bounds.bottom - tilelat * this.buffer)
-                || rowidx < minRows);
-        
-        //shave off exceess rows and colums
-        this.removeExcessTiles(rowidx, colidx);
+    /**
+     * APIProperty: geometry
+     * {String} Name of geometry element.  Defaults to "geometry". If null, it
+     * will be set on <read> when the first geometry is parsed.
+     */
+    geometryName: "geometry",
 
 
-        var resolution = this.getServerResolution();
-        // store the resolution of the grid
-        this.gridResolution = resolution;
+    /**
+     * APIProperty: extractAttributes
+     * {Boolean} Extract attributes from GML.  Default is true.
+     */
+    extractAttributes: true,
 
 
-        //now actually draw the tiles
-        tileData.sort(function(a, b) {
-            return a.distance - b.distance; 
-        });
-        for (var i=0, ii=tileData.length; i<ii; ++i) {
-            tileData[i].tile.draw();
-        }
-    },
+    /**
+     * APIProperty: srsName
+     * {String} URI for spatial reference system.  This is optional for
+     *     single part geometries and mandatory for collections and multis.
+     *     If set, the srsName attribute will be written for all geometries.
+     *     Default is null.
+     */
+    srsName: null,
 
     /**
 
     /**
-     * Method: getMaxExtent
-     * Get this layer's maximum extent. (Implemented as a getter for
-     *     potential specific implementations in sub-classes.)
-     *
-     * Returns:
-     * {<OpenLayers.Bounds>}
+     * APIProperty: xy
+     * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
+     * Changing is not recommended, a new Format should be instantiated.
      */
      */
-    getMaxExtent: function() {
-        return this.maxExtent;
-    },
-    
+    xy: true,
+
     /**
     /**
-     * APIMethod: addTile
-     * Create a tile, initialize it, and add it to the layer div. 
-     *
-     * Parameters
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     *
-     * Returns:
-     * {<OpenLayers.Tile>} The added OpenLayers.Tile
+     * Property: geometryTypes
+     * {Object} Maps OpenLayers geometry class names to GML element names.
+     *     Use <setGeometryTypes> before accessing this property.
      */
      */
-    addTile: function(bounds, position) {
-        var tile = new this.tileClass(
-            this, position, bounds, null, this.tileSize, this.tileOptions
-        );
-        this.events.triggerEvent("addtile", {tile: tile});
-        return tile;
-    },
-    
-    /** 
-     * Method: addTileMonitoringHooks
-     * This function takes a tile as input and adds the appropriate hooks to 
-     *     the tile so that the layer can keep track of the loading tiles.
-     * 
-     * Parameters: 
-     * tile - {<OpenLayers.Tile>}
+    geometryTypes: null,
+
+    /**
+     * Property: singleFeatureType
+     * {Boolean} True if there is only 1 featureType, and not an array
+     *     of featuretypes.
      */
      */
-    addTileMonitoringHooks: function(tile) {
-        
-        var replacingCls = 'olTileReplacing';
+    singleFeatureType: null,
 
 
-        tile.onLoadStart = function() {
-            //if that was first tile then trigger a 'loadstart' on the layer
-            if (this.loading === false) {
-                this.loading = true;
-                this.events.triggerEvent("loadstart");
-            }
-            this.events.triggerEvent("tileloadstart", {tile: tile});
-            this.numLoadingTiles++;
-            if (!this.singleTile && this.backBuffer && this.gridResolution === this.backBufferResolution) {
-                OpenLayers.Element.addClass(tile.getTile(), replacingCls);
-            }
-        };
-      
-        tile.onLoadEnd = function(evt) {
-            this.numLoadingTiles--;
-            var aborted = evt.type === 'unload';
-            this.events.triggerEvent("tileloaded", {
-                tile: tile,
-                aborted: aborted
-            });
-            if (!this.singleTile && !aborted && this.backBuffer && this.gridResolution === this.backBufferResolution) {
-                var tileDiv = tile.getTile();
-                if (OpenLayers.Element.getStyle(tileDiv, 'display') === 'none') {
-                    var bufferTile = document.getElementById(tile.id + '_bb');
-                    if (bufferTile) {
-                        bufferTile.parentNode.removeChild(bufferTile);
-                    }
-                }
-                OpenLayers.Element.removeClass(tileDiv, replacingCls);
-            }
-            //if that was the last tile, then trigger a 'loadend' on the layer
-            if (this.numLoadingTiles === 0) {
-                if (this.backBuffer) {
-                    if (this.backBuffer.childNodes.length === 0) {
-                        // no tiles transitioning, remove immediately
-                        this.removeBackBuffer();
-                    } else {
-                        // wait until transition has ended or delay has passed
-                        this._transitionElement = aborted ?
-                            this.div.lastChild : tile.imgDiv;
-                        var transitionendEvents = this.transitionendEvents;
-                        for (var i=transitionendEvents.length-1; i>=0; --i) {
-                            OpenLayers.Event.observe(this._transitionElement,
-                                transitionendEvents[i],
-                                this._removeBackBuffer);
-                        }
-                        // the removal of the back buffer is delayed to prevent
-                        // flash effects due to the animation of tile displaying
-                        this.backBufferTimerId = window.setTimeout(
-                            this._removeBackBuffer, this.removeBackBufferDelay
-                        );
-                    }
-                }
-                this.loading = false;
-                this.events.triggerEvent("loadend");
-            }
-        };
-        
-        tile.onLoadError = function() {
-            this.events.triggerEvent("tileerror", {tile: tile});
-        };
-        
-        tile.events.on({
-            "loadstart": tile.onLoadStart,
-            "loadend": tile.onLoadEnd,
-            "unload": tile.onLoadEnd,
-            "loaderror": tile.onLoadError,
-            scope: this
-        });
-    },
-
-    /** 
-     * Method: removeTileMonitoringHooks
-     * This function takes a tile as input and removes the tile hooks 
-     *     that were added in addTileMonitoringHooks()
-     * 
-     * Parameters: 
-     * tile - {<OpenLayers.Tile>}
-     */
-    removeTileMonitoringHooks: function(tile) {
-        tile.unload();
-        tile.events.un({
-            "loadstart": tile.onLoadStart,
-            "loadend": tile.onLoadEnd,
-            "unload": tile.onLoadEnd,
-            "loaderror": tile.onLoadError,
-            scope: this
-        });
-    },
-    
     /**
     /**
-     * Method: moveGriddedTiles
+     * Property: autoConfig
+     * {Boolean} Indicates if the format was configured without a <featureNS>,
+     * but auto-configured <featureNS> and <featureType> during read.
+     * Subclasses making use of <featureType> auto-configuration should make
+     * the first call to the <readNode> method (usually in the read method)
+     * with true as 3rd argument, so the auto-configured featureType can be
+     * reset and the format can be reused for subsequent reads with data from
+     * different featureTypes. Set to false after read if you want to keep the
+     * auto-configured values.
      */
      */
-    moveGriddedTiles: function() {
-        var buffer = this.buffer + 1;
-        while(true) {
-            var tlTile = this.grid[0][0];
-            var tlViewPort = {
-                x: tlTile.position.x +
-                    this.map.layerContainerOriginPx.x,
-                y: tlTile.position.y +
-                    this.map.layerContainerOriginPx.y
-            };
-            var ratio = this.getServerResolution() / this.map.getResolution();
-            var tileSize = {
-                w: Math.round(this.tileSize.w * ratio),
-                h: Math.round(this.tileSize.h * ratio)
-            };
-            if (tlViewPort.x > -tileSize.w * (buffer - 1)) {
-                this.shiftColumn(true, tileSize);
-            } else if (tlViewPort.x < -tileSize.w * buffer) {
-                this.shiftColumn(false, tileSize);
-            } else if (tlViewPort.y > -tileSize.h * (buffer - 1)) {
-                this.shiftRow(true, tileSize);
-            } else if (tlViewPort.y < -tileSize.h * buffer) {
-                this.shiftRow(false, tileSize);
-            } else {
-                break;
-            }
-        }
-    },
 
     /**
 
     /**
-     * Method: shiftRow
-     * Shifty grid work
-     *
-     * Parameters:
-     * prepend - {Boolean} if true, prepend to beginning.
-     *                          if false, then append to end
-     * tileSize - {Object} rendered tile size; object with w and h properties
+     * Property: regExes
+     * Compiled regular expressions for manipulating strings.
      */
      */
-    shiftRow: function(prepend, tileSize) {
-        var grid = this.grid;
-        var rowIndex = prepend ? 0 : (grid.length - 1);
-        var sign = prepend ? -1 : 1;
-        var rowSign = this.rowSign;
-        var tileLayout = this.gridLayout;
-        tileLayout.startrow += sign * rowSign;
-
-        var modelRow = grid[rowIndex];
-        var row = grid[prepend ? 'pop' : 'shift']();
-        for (var i=0, len=row.length; i<len; i++) {
-            var tile = row[i];
-            var position = modelRow[i].position.clone();
-            position.y += tileSize.h * sign;
-            tile.moveTo(this.getTileBoundsForGridIndex(rowIndex, i), position);
-        }
-        grid[prepend ? 'unshift' : 'push'](row);
+    regExes: {
+        trimSpace: (/^\s*|\s*$/g),
+        removeSpace: (/\s*/g),
+        splitSpace: (/\s+/),
+        trimComma: (/\s*,\s*/g),
+        featureMember: (/^(.*:)?featureMembers?$/)
     },
 
     /**
     },
 
     /**
-     * Method: shiftColumn
-     * Shift grid work in the other dimension
+     * Constructor: OpenLayers.Format.GML.Base
+     * Instances of this class are not created directly.  Use the
+     *     <OpenLayers.Format.GML.v2> or <OpenLayers.Format.GML.v3> constructor
+     *     instead.
      *
      * Parameters:
      *
      * Parameters:
-     * prepend - {Boolean} if true, prepend to beginning.
-     *                          if false, then append to end
-     * tileSize - {Object} rendered tile size; object with w and h properties
-     */
-    shiftColumn: function(prepend, tileSize) {
-        var grid = this.grid;
-        var colIndex = prepend ? 0 : (grid[0].length - 1);
-        var sign = prepend ? -1 : 1;
-        var tileLayout = this.gridLayout;
-        tileLayout.startcol += sign;
-
-        for (var i=0, len=grid.length; i<len; i++) {
-            var row = grid[i];
-            var position = row[colIndex].position.clone();
-            var tile = row[prepend ? 'pop' : 'shift']();            
-            position.x += tileSize.w * sign;
-            tile.moveTo(this.getTileBoundsForGridIndex(i, colIndex), position);
-            row[prepend ? 'unshift' : 'push'](tile);
-        }
-    },
-
-    /**
-     * Method: removeExcessTiles
-     * When the size of the map or the buffer changes, we may need to
-     *     remove some excess rows and columns.
-     * 
-     * Parameters:
-     * rows - {Integer} Maximum number of rows we want our grid to have.
-     * columns - {Integer} Maximum number of columns we want our grid to have.
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
+     *
+     * Valid options properties:
+     * featureType - {Array(String) or String} Local (without prefix) feature
+     *     typeName(s) (required for write).
+     * featureNS - {String} Feature namespace (required for write).
+     * geometryName - {String} Geometry element name (required for write).
      */
      */
-    removeExcessTiles: function(rows, columns) {
-        var i, l;
-        
-        // remove extra rows
-        while (this.grid.length > rows) {
-            var row = this.grid.pop();
-            for (i=0, l=row.length; i<l; i++) {
-                var tile = row[i];
-                this.destroyTile(tile);
-            }
-        }
-        
-        // remove extra columns
-        for (i=0, l=this.grid.length; i<l; i++) {
-            while (this.grid[i].length > columns) {
-                var row = this.grid[i];
-                var tile = row.pop();
-                this.destroyTile(tile);
-            }
+    initialize: function(options) {
+        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+        this.setGeometryTypes();
+        if(options && options.featureNS) {
+            this.setNamespace(this.featurePrefix, options.featureNS);
         }
         }
+        this.singleFeatureType = !options || (typeof options.featureType === "string");
     },
 
     /**
     },
 
     /**
-     * Method: onMapResize
-     * For singleTile layers, this will set a new tile size according to the
-     * dimensions of the map pane.
-     */
-    onMapResize: function() {
-        if (this.singleTile) {
-            this.clearGrid();
-            this.setTileSize();
-        }
-    },
-    
-    /**
-     * APIMethod: getTileBounds
-     * Returns The tile bounds for a layer given a pixel location.
+     * Method: read
      *
      * Parameters:
      *
      * Parameters:
-     * viewPortPx - {<OpenLayers.Pixel>} The location in the viewport.
+     * data - {DOMElement} A gml:featureMember element, a gml:featureMembers
+     *     element, or an element containing either of the above at any level.
      *
      * Returns:
      *
      * Returns:
-     * {<OpenLayers.Bounds>} Bounds of the tile at the given pixel location.
-     */
-    getTileBounds: function(viewPortPx) {
-        var maxExtent = this.maxExtent;
-        var resolution = this.getResolution();
-        var tileMapWidth = resolution * this.tileSize.w;
-        var tileMapHeight = resolution * this.tileSize.h;
-        var mapPoint = this.getLonLatFromViewPortPx(viewPortPx);
-        var tileLeft = maxExtent.left + (tileMapWidth *
-                                         Math.floor((mapPoint.lon -
-                                                     maxExtent.left) /
-                                                    tileMapWidth));
-        var tileBottom = maxExtent.bottom + (tileMapHeight *
-                                             Math.floor((mapPoint.lat -
-                                                         maxExtent.bottom) /
-                                                        tileMapHeight));
-        return new OpenLayers.Bounds(tileLeft, tileBottom,
-                                     tileLeft + tileMapWidth,
-                                     tileBottom + tileMapHeight);
-    },
-
-    CLASS_NAME: "OpenLayers.Layer.Grid"
-});
-/* ======================================================================
-    OpenLayers/Layer/XYZ.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Layer/Grid.js
- */
-
-/** 
- * Class: OpenLayers.Layer.XYZ
- * The XYZ class is designed to make it easier for people who have tiles
- * arranged by a standard XYZ grid. 
- * 
- * Inherits from:
- *  - <OpenLayers.Layer.Grid>
- */
-OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
-    
-    /**
-     * APIProperty: isBaseLayer
-     * Default is true, as this is designed to be a base tile source. 
-     */
-    isBaseLayer: true,
-    
-    /**
-     * APIProperty: sphericalMercator
-     * Whether the tile extents should be set to the defaults for 
-     *    spherical mercator. Useful for things like OpenStreetMap.
-     *    Default is false, except for the OSM subclass.
-     */
-    sphericalMercator: false,
-
-    /**
-     * APIProperty: zoomOffset
-     * {Number} If your cache has more zoom levels than you want to provide
-     *     access to with this layer, supply a zoomOffset.  This zoom offset
-     *     is added to the current map zoom level to determine the level
-     *     for a requested tile.  For example, if you supply a zoomOffset
-     *     of 3, when the map is at the zoom 0, tiles will be requested from
-     *     level 3 of your cache.  Default is 0 (assumes cache level and map
-     *     zoom are equivalent).  Using <zoomOffset> is an alternative to
-     *     setting <serverResolutions> if you only want to expose a subset
-     *     of the server resolutions.
-     */
-    zoomOffset: 0,
-    
-    /**
-     * APIProperty: serverResolutions
-     * {Array} A list of all resolutions available on the server.  Only set this
-     *     property if the map resolutions differ from the server. This
-     *     property serves two purposes. (a) <serverResolutions> can include
-     *     resolutions that the server supports and that you don't want to
-     *     provide with this layer; you can also look at <zoomOffset>, which is
-     *     an alternative to <serverResolutions> for that specific purpose.
-     *     (b) The map can work with resolutions that aren't supported by
-     *     the server, i.e. that aren't in <serverResolutions>. When the
-     *     map is displayed in such a resolution data for the closest
-     *     server-supported resolution is loaded and the layer div is
-     *     stretched as necessary.
-     */
-    serverResolutions: null,
-
-    /**
-     * Constructor: OpenLayers.Layer.XYZ
-     *
-     * Parameters:
-     * name - {String}
-     * url - {String}
-     * options - {Object} Hashtable of extra options to tag onto the layer
+     * {Array(<OpenLayers.Feature.Vector>)} An array of features.
      */
      */
-    initialize: function(name, url, options) {
-        if (options && options.sphericalMercator || this.sphericalMercator) {
-            options = OpenLayers.Util.extend({
-                projection: "EPSG:900913",
-                numZoomLevels: 19
-            }, options);
+    read: function(data) {
+        if(typeof data == "string") {
+            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
         }
         }
-        OpenLayers.Layer.Grid.prototype.initialize.apply(this, [
-            name || this.name, url || this.url, {}, options
-        ]);
-    },
-    
-    /**
-     * APIMethod: clone
-     * Create a clone of this layer
-     *
-     * Parameters:
-     * obj - {Object} Is this ever used?
-     * 
-     * Returns:
-     * {<OpenLayers.Layer.XYZ>} An exact clone of this OpenLayers.Layer.XYZ
-     */
-    clone: function (obj) {
-        
-        if (obj == null) {
-            obj = new OpenLayers.Layer.XYZ(this.name,
-                                            this.url,
-                                            this.getOptions());
+        if(data && data.nodeType == 9) {
+            data = data.documentElement;
         }
         }
-
-        //get all additions from superclasses
-        obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
-
-        return obj;
-    },    
-
-    /**
-     * Method: getURL
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     *
-     * Returns:
-     * {String} A string with the layer's url and parameters and also the
-     *          passed-in bounds and appropriate tile size specified as
-     *          parameters
-     */
-    getURL: function (bounds) {
-        var xyz = this.getXYZ(bounds);
-        var url = this.url;
-        if (OpenLayers.Util.isArray(url)) {
-            var s = '' + xyz.x + xyz.y + xyz.z;
-            url = this.selectUrl(s, url);
+        var features = [];
+        this.readNode(data, {features: features}, true);
+        if(features.length == 0) {
+            // look for gml:featureMember elements
+            var elements = this.getElementsByTagNameNS(
+                data, this.namespaces.gml, "featureMember"
+            );
+            if(elements.length) {
+                for(var i=0, len=elements.length; i<len; ++i) {
+                    this.readNode(elements[i], {features: features}, true);
+                }
+            } else {
+                // look for gml:featureMembers elements (this is v3, but does no harm here)
+                var elements = this.getElementsByTagNameNS(
+                    data, this.namespaces.gml, "featureMembers"
+                );
+                if(elements.length) {
+                    // there can be only one
+                    this.readNode(elements[0], {features: features}, true);
+                }
+            }
         }
         }
-        
-        return OpenLayers.String.format(url, xyz);
+        return features;
     },
     },
-    
+
     /**
     /**
-     * Method: getXYZ
-     * Calculates x, y and z for the given bounds.
+     * Method: readNode
+     * Shorthand for applying one of the named readers given the node
+     *     namespace and local name.  Readers take two args (node, obj) and
+     *     generally extend or modify the second.
      *
      * Parameters:
      *
      * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
+     * node - {DOMElement} The node to be read (required).
+     * obj - {Object} The object to be modified (optional).
+     * first - {Boolean} Should be set to true for the first node read. This
+     *     is usually the readNode call in the read method. Without this being
+     *     set, auto-configured properties will stick on subsequent reads.
      *
      * Returns:
      *
      * Returns:
-     * {Object} - an object with x, y and z properties.
+     * {Object} The input object, modified (or a new one if none was provided).
      */
      */
-    getXYZ: function(bounds) {
-        var res = this.getServerResolution();
-        var x = Math.round((bounds.left - this.maxExtent.left) /
-            (res * this.tileSize.w));
-        var y = Math.round((this.maxExtent.top - bounds.top) /
-            (res * this.tileSize.h));
-        var z = this.getServerZoom();
-
-        if (this.wrapDateLine) {
-            var limit = Math.pow(2, z);
-            x = ((x % limit) + limit) % limit;
+    readNode: function(node, obj, first) {
+        // on subsequent calls of format.read(), we want to reset auto-
+        // configured properties and auto-configure again.
+        if (first === true && this.autoConfig === true) {
+            this.featureType = null;
+            delete this.namespaceAlias[this.featureNS];
+            delete this.namespaces["feature"];
+            this.featureNS = null;
         }
         }
-
-        return {'x': x, 'y': y, 'z': z};
-    },
-    
-    /* APIMethod: setMap
-     * When the layer is added to a map, then we can fetch our origin 
-     *    (if we don't have one.) 
-     * 
-     * Parameters:
-     * map - {<OpenLayers.Map>}
-     */
-    setMap: function(map) {
-        OpenLayers.Layer.Grid.prototype.setMap.apply(this, arguments);
-        if (!this.tileOrigin) { 
-            this.tileOrigin = new OpenLayers.LonLat(this.maxExtent.left,
-                                                this.maxExtent.bottom);
-        }                                       
+        // featureType auto-configuration
+        if (!this.featureNS && (!(node.prefix in this.namespaces) &&
+                node.parentNode.namespaceURI == this.namespaces["gml"] &&
+                this.regExes.featureMember.test(node.parentNode.nodeName))) {
+            this.featureType = node.nodeName.split(":").pop();
+            this.setNamespace("feature", node.namespaceURI);
+            this.featureNS = node.namespaceURI;
+            this.autoConfig = true;
+        }
+        return OpenLayers.Format.XML.prototype.readNode.apply(this, [node, obj]);
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Layer.XYZ"
-});
-/* ======================================================================
-    OpenLayers/Layer/OSM.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Layer/XYZ.js
- */
-
-/**
- * Class: OpenLayers.Layer.OSM
- * This layer allows accessing OpenStreetMap tiles. By default the OpenStreetMap
- *    hosted tile.openstreetmap.org Mapnik tileset is used. If you wish to use
- *    a different layer instead, you need to provide a different
- *    URL to the constructor. Here's an example for using OpenCycleMap:
- * 
- * (code)
- *     new OpenLayers.Layer.OSM("OpenCycleMap", 
- *       ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
- *        "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
- *        "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"]); 
- * (end)
- *
- * Inherits from:
- *  - <OpenLayers.Layer.XYZ>
- */
-OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {
-
     /**
     /**
-     * APIProperty: name
-     * {String} The layer name. Defaults to "OpenStreetMap" if the first
-     * argument to the constructor is null or undefined.
-     */
-    name: "OpenStreetMap",
-
-    /**
-     * APIProperty: url
-     * {String} The tileset URL scheme. Defaults to
-     * : http://[a|b|c].tile.openstreetmap.org/${z}/${x}/${y}.png
-     * (the official OSM tileset) if the second argument to the constructor
-     * is null or undefined. To use another tileset you can have something
-     * like this:
-     * (code)
-     *     new OpenLayers.Layer.OSM("OpenCycleMap", 
-     *       ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
-     *        "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
-     *        "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"]); 
-     * (end)
-     */
-    url: [
-        'http://a.tile.openstreetmap.org/${z}/${x}/${y}.png',
-        'http://b.tile.openstreetmap.org/${z}/${x}/${y}.png',
-        'http://c.tile.openstreetmap.org/${z}/${x}/${y}.png'
-    ],
-
-    /**
-     * Property: attribution
-     * {String} The layer attribution.
-     */
-    attribution: "&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors",
-
-    /**
-     * Property: sphericalMercator
-     * {Boolean}
+     * Property: readers
+     * Contains public functions, grouped by namespace prefix, that will
+     *     be applied when a namespaced node is found matching the function
+     *     name.  The function will be applied in the scope of this parser
+     *     with two arguments: the node being read and a context object passed
+     *     from the parent.
      */
      */
-    sphericalMercator: true,
+    readers: {
+        "gml": {
+            "_inherit": function(node, obj, container) {
+                // To be implemented by version specific parsers
+            },
+            "featureMember": function(node, obj) {
+                this.readChildNodes(node, obj);
+            },
+            "featureMembers": function(node, obj) {
+                this.readChildNodes(node, obj);
+            },
+            "name": function(node, obj) {
+                obj.name = this.getChildValue(node);
+            },
+            "boundedBy": function(node, obj) {
+                var container = {};
+                this.readChildNodes(node, container);
+                if(container.components && container.components.length > 0) {
+                    obj.bounds = container.components[0];
+                }
+            },
+            "Point": function(node, container) {
+                var obj = {points: []};
+                this.readChildNodes(node, obj);
+                if(!container.components) {
+                    container.components = [];
+                }
+                container.components.push(obj.points[0]);
+            },
+            "coordinates": function(node, obj) {
+                var str = this.getChildValue(node).replace(
+                    this.regExes.trimSpace, ""
+                );
+                str = str.replace(this.regExes.trimComma, ",");
+                var pointList = str.split(this.regExes.splitSpace);
+                var coords;
+                var numPoints = pointList.length;
+                var points = new Array(numPoints);
+                for(var i=0; i<numPoints; ++i) {
+                    coords = pointList[i].split(",");
+                    if (this.xy) {
+                        points[i] = new OpenLayers.Geometry.Point(
+                            coords[0], coords[1], coords[2]
+                        );
+                    } else {
+                        points[i] = new OpenLayers.Geometry.Point(
+                            coords[1], coords[0], coords[2]
+                        );
+                    }
+                }
+                obj.points = points;
+            },
+            "coord": function(node, obj) {
+                var coord = {};
+                this.readChildNodes(node, coord);
+                if(!obj.points) {
+                    obj.points = [];
+                }
+                obj.points.push(new OpenLayers.Geometry.Point(
+                    coord.x, coord.y, coord.z
+                ));
+            },
+            "X": function(node, coord) {
+                coord.x = this.getChildValue(node);
+            },
+            "Y": function(node, coord) {
+                coord.y = this.getChildValue(node);
+            },
+            "Z": function(node, coord) {
+                coord.z = this.getChildValue(node);
+            },
+            "MultiPoint": function(node, container) {
+                var obj = {components: []};
+                this.readers.gml._inherit.apply(this, [node, obj, container]);
+                this.readChildNodes(node, obj);
+                container.components = [
+                    new OpenLayers.Geometry.MultiPoint(obj.components)
+                ];
+            },
+            "pointMember": function(node, obj) {
+                this.readChildNodes(node, obj);
+            },
+            "LineString": function(node, container) {
+                var obj = {};
+                this.readers.gml._inherit.apply(this, [node, obj, container]);
+                this.readChildNodes(node, obj);
+                if(!container.components) {
+                    container.components = [];
+                }
+                container.components.push(
+                    new OpenLayers.Geometry.LineString(obj.points)
+                );
+            },
+            "MultiLineString": function(node, container) {
+                var obj = {components: []};
+                this.readers.gml._inherit.apply(this, [node, obj, container]);
+                this.readChildNodes(node, obj);
+                container.components = [
+                    new OpenLayers.Geometry.MultiLineString(obj.components)
+                ];
+            },
+            "lineStringMember": function(node, obj) {
+                this.readChildNodes(node, obj);
+            },
+            "Polygon": function(node, container) {
+                var obj = {outer: null, inner: []};
+                this.readers.gml._inherit.apply(this, [node, obj, container]);
+                this.readChildNodes(node, obj);
+                obj.inner.unshift(obj.outer);
+                if(!container.components) {
+                    container.components = [];
+                }
+                container.components.push(
+                    new OpenLayers.Geometry.Polygon(obj.inner)
+                );
+            },
+            "LinearRing": function(node, obj) {
+                var container = {};
+                this.readers.gml._inherit.apply(this, [node, container]);
+                this.readChildNodes(node, container);
+                obj.components = [new OpenLayers.Geometry.LinearRing(
+                    container.points
+                )];
+            },
+            "MultiPolygon": function(node, container) {
+                var obj = {components: []};
+                this.readers.gml._inherit.apply(this, [node, obj, container]);
+                this.readChildNodes(node, obj);
+                container.components = [
+                    new OpenLayers.Geometry.MultiPolygon(obj.components)
+                ];
+            },
+            "polygonMember": function(node, obj) {
+                this.readChildNodes(node, obj);
+            },
+            "GeometryCollection": function(node, container) {
+                var obj = {components: []};
+                this.readers.gml._inherit.apply(this, [node, obj, container]);
+                this.readChildNodes(node, obj);
+                container.components = [
+                    new OpenLayers.Geometry.Collection(obj.components)
+                ];
+            },
+            "geometryMember": function(node, obj) {
+                this.readChildNodes(node, obj);
+            }
+        },
+        "feature": {
+            "*": function(node, obj) {
+                // The node can either be named like the featureType, or it
+                // can be a child of the feature:featureType.  Children can be
+                // geometry or attributes.
+                var name;
+                var local = node.localName || node.nodeName.split(":").pop();
+                // Since an attribute can have the same name as the feature type
+                // we only want to read the node as a feature if the parent
+                // node can have feature nodes as children.  In this case, the
+                // obj.features property is set.
+                if (obj.features) {
+                    if (!this.singleFeatureType &&
+                        (OpenLayers.Util.indexOf(this.featureType, local) !== -1)) {
+                        name = "_typeName";
+                    } else if(local === this.featureType) {
+                        name = "_typeName";
+                    }
+                } else {
+                    // Assume attribute elements have one child node and that the child
+                    // is a text node.  Otherwise assume it is a geometry node.
+                    if(node.childNodes.length == 0 ||
+                       (node.childNodes.length == 1 && node.firstChild.nodeType == 3)) {
+                        if(this.extractAttributes) {
+                            name = "_attribute";
+                        }
+                    } else {
+                        name = "_geometry";
+                    }
+                }
+                if(name) {
+                    this.readers.feature[name].apply(this, [node, obj]);
+                }
+            },
+            "_typeName": function(node, obj) {
+                var container = {components: [], attributes: {}};
+                this.readChildNodes(node, container);
+                // look for common gml namespaced elements
+                if(container.name) {
+                    container.attributes.name = container.name;
+                }
+                var feature = new OpenLayers.Feature.Vector(
+                    container.components[0], container.attributes
+                );
+                if (!this.singleFeatureType) {
+                    feature.type = node.nodeName.split(":").pop();
+                    feature.namespace = node.namespaceURI;
+                }
+                var fid = node.getAttribute("fid") ||
+                    this.getAttributeNS(node, this.namespaces["gml"], "id");
+                if(fid) {
+                    feature.fid = fid;
+                }
+                if(this.internalProjection && this.externalProjection &&
+                   feature.geometry) {
+                    feature.geometry.transform(
+                        this.externalProjection, this.internalProjection
+                    );
+                }
+                if(container.bounds) {
+                    feature.bounds = container.bounds;
+                }
+                obj.features.push(feature);
+            },
+            "_geometry": function(node, obj) {
+                if (!this.geometryName) {
+                    this.geometryName = node.nodeName.split(":").pop();
+                }
+                this.readChildNodes(node, obj);
+            },
+            "_attribute": function(node, obj) {
+                var local = node.localName || node.nodeName.split(":").pop();
+                var value = this.getChildValue(node);
+                obj.attributes[local] = value;
+            }
+        },
+        "wfs": {
+            "FeatureCollection": function(node, obj) {
+                this.readChildNodes(node, obj);
+            }
+        }
+    },
 
     /**
 
     /**
-     * Property: wrapDateLine
-     * {Boolean}
-     */
-    wrapDateLine: true,
-
-    /** APIProperty: tileOptions
-     *  {Object} optional configuration options for <OpenLayers.Tile> instances
-     *  created by this Layer. Default is
-     *
-     *  (code)
-     *  {crossOriginKeyword: 'anonymous'}
-     *  (end)
-     *
-     *  When using OSM tilesets other than the default ones, it may be
-     *  necessary to set this to
+     * Method: write
      *
      *
-     *  (code)
-     *  {crossOriginKeyword: null}
-     *  (end)
+     * Parameters:
+     * features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector}
+     *     An array of features or a single feature.
      *
      *
-     *  if the server does not send Access-Control-Allow-Origin headers.
+     * Returns:
+     * {String} Given an array of features, a doc with a gml:featureMembers
+     *     element will be returned.  Given a single feature, a doc with a
+     *     gml:featureMember element will be returned.
      */
      */
-    tileOptions: null,
+    write: function(features) {
+        var name;
+        if(OpenLayers.Util.isArray(features)) {
+            name = "featureMembers";
+        } else {
+            name = "featureMember";
+        }
+        var root = this.writeNode("gml:" + name, features);
+        this.setAttributeNS(
+            root, this.namespaces["xsi"],
+            "xsi:schemaLocation", this.schemaLocation
+        );
+
+        return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
+    },
 
     /**
 
     /**
-     * Constructor: OpenLayers.Layer.OSM
-     *
-     * Parameters:
-     * name - {String} The layer name.
-     * url - {String} The tileset URL scheme.
-     * options - {Object} Configuration options for the layer. Any inherited
-     *     layer option can be set in this object (e.g.
-     *     <OpenLayers.Layer.Grid.buffer>).
+     * Property: writers
+     * As a compliment to the readers property, this structure contains public
+     *     writing functions grouped by namespace alias and named like the
+     *     node names they produce.
      */
      */
-    initialize: function(name, url, options) {
-        OpenLayers.Layer.XYZ.prototype.initialize.apply(this, arguments);
-        this.tileOptions = OpenLayers.Util.extend({
-            crossOriginKeyword: 'anonymous'
-        }, this.options && this.options.tileOptions);
+    writers: {
+        "gml": {
+            "featureMember": function(feature) {
+                var node = this.createElementNSPlus("gml:featureMember");
+                this.writeNode("feature:_typeName", feature, node);
+                return node;
+            },
+            "MultiPoint": function(geometry) {
+                var node = this.createElementNSPlus("gml:MultiPoint");
+                var components = geometry.components || [geometry];
+                for(var i=0, ii=components.length; i<ii; ++i) {
+                    this.writeNode("pointMember", components[i], node);
+                }
+                return node;
+            },
+            "pointMember": function(geometry) {
+                var node = this.createElementNSPlus("gml:pointMember");
+                this.writeNode("Point", geometry, node);
+                return node;
+            },
+            "MultiLineString": function(geometry) {
+                var node = this.createElementNSPlus("gml:MultiLineString");
+                var components = geometry.components || [geometry];
+                for(var i=0, ii=components.length; i<ii; ++i) {
+                    this.writeNode("lineStringMember", components[i], node);
+                }
+                return node;
+            },
+            "lineStringMember": function(geometry) {
+                var node = this.createElementNSPlus("gml:lineStringMember");
+                this.writeNode("LineString", geometry, node);
+                return node;
+            },
+            "MultiPolygon": function(geometry) {
+                var node = this.createElementNSPlus("gml:MultiPolygon");
+                var components = geometry.components || [geometry];
+                for(var i=0, ii=components.length; i<ii; ++i) {
+                    this.writeNode(
+                        "polygonMember", components[i], node
+                    );
+                }
+                return node;
+            },
+            "polygonMember": function(geometry) {
+                var node = this.createElementNSPlus("gml:polygonMember");
+                this.writeNode("Polygon", geometry, node);
+                return node;
+            },
+            "GeometryCollection": function(geometry) {
+                var node = this.createElementNSPlus("gml:GeometryCollection");
+                for(var i=0, len=geometry.components.length; i<len; ++i) {
+                    this.writeNode("geometryMember", geometry.components[i], node);
+                }
+                return node;
+            },
+            "geometryMember": function(geometry) {
+                var node = this.createElementNSPlus("gml:geometryMember");
+                var child = this.writeNode("feature:_geometry", geometry);
+                node.appendChild(child.firstChild);
+                return node;
+            }
+        },
+        "feature": {
+            "_typeName": function(feature) {
+                var node = this.createElementNSPlus(this.featurePrefix + ":" + this.featureType, {
+                    attributes: {fid: feature.fid}
+                });
+                if(feature.geometry) {
+                    this.writeNode("feature:_geometry", feature.geometry, node);
+                }
+                for(var name in feature.attributes) {
+                    var value = feature.attributes[name];
+                    if(value != null) {
+                        this.writeNode(
+                            "feature:_attribute",
+                            {name: name, value: value}, node
+                        );
+                    }
+                }
+                return node;
+            },
+            "_geometry": function(geometry) {
+                if(this.externalProjection && this.internalProjection) {
+                    geometry = geometry.clone().transform(
+                        this.internalProjection, this.externalProjection
+                    );
+                }
+                var node = this.createElementNSPlus(
+                    this.featurePrefix + ":" + this.geometryName
+                );
+                var type = this.geometryTypes[geometry.CLASS_NAME];
+                var child = this.writeNode("gml:" + type, geometry, node);
+                if(this.srsName) {
+                    child.setAttribute("srsName", this.srsName);
+                }
+                return node;
+            },
+            "_attribute": function(obj) {
+                return this.createElementNSPlus(this.featurePrefix + ":" + obj.name, {
+                    value: obj.value
+                });
+            }
+        },
+        "wfs": {
+            "FeatureCollection": function(features) {
+                /**
+                 * This is only here because GML2 only describes abstract
+                 * feature collections.  Typically, you would not be using
+                 * the GML format to write wfs elements.  This just provides
+                 * some way to write out lists of features.  GML3 defines the
+                 * featureMembers element, so that is used by default instead.
+                 */
+                var node = this.createElementNSPlus("wfs:FeatureCollection");
+                for(var i=0, len=features.length; i<len; ++i) {
+                    this.writeNode("gml:featureMember", features[i], node);
+                }
+                return node;
+            }
+        }
     },
 
     /**
     },
 
     /**
-     * Method: clone
+     * Method: setGeometryTypes
+     * Sets the <geometryTypes> mapping.
      */
      */
-    clone: function(obj) {
-        if (obj == null) {
-            obj = new OpenLayers.Layer.OSM(
-                this.name, this.url, this.getOptions());
-        }
-        obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
-        return obj;
+    setGeometryTypes: function() {
+        this.geometryTypes = {
+            "OpenLayers.Geometry.Point": "Point",
+            "OpenLayers.Geometry.MultiPoint": "MultiPoint",
+            "OpenLayers.Geometry.LineString": "LineString",
+            "OpenLayers.Geometry.MultiLineString": "MultiLineString",
+            "OpenLayers.Geometry.Polygon": "Polygon",
+            "OpenLayers.Geometry.MultiPolygon": "MultiPolygon",
+            "OpenLayers.Geometry.Collection": "GeometryCollection"
+        };
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Layer.OSM"
+    CLASS_NAME: "OpenLayers.Format.GML.Base"
+
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Renderer.js
+    OpenLayers/Format/GML/v2.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Format/GML/Base.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Renderer 
- * This is the base class for all renderers.
- *
- * This is based on a merger code written by Paul Spencer and Bertil Chapuis.
- * It is largely composed of virtual functions that are to be implemented
- * in technology-specific subclasses, but there is some generic code too.
- * 
- * The functions that *are* implemented here merely deal with the maintenance
- *  of the size and extent variables, as well as the cached 'resolution' 
- *  value. 
- * 
- * A note to the user that all subclasses should use getResolution() instead
- *  of directly accessing this.resolution in order to correctly use the 
- *  cacheing system.
+ * Class: OpenLayers.Format.GML.v2
+ * Parses GML version 2.
  *
  *
+ * Inherits from:
+ *  - <OpenLayers.Format.GML.Base>
  */
  */
-OpenLayers.Renderer = OpenLayers.Class({
-
-    /** 
-     * Property: container
-     * {DOMElement} 
-     */
-    container: null,
+OpenLayers.Format.GML.v2 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
     
     /**
     
     /**
-     * Property: root
-     * {DOMElement}
-     */
-    root: null,
-
-    /** 
-     * Property: extent
-     * {<OpenLayers.Bounds>}
+     * Property: schemaLocation
+     * {String} Schema location for a particular minor version.
      */
      */
-    extent: null,
+    schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",
 
     /**
 
     /**
-     * Property: locked
-     * {Boolean} If the renderer is currently in a state where many things
-     *     are changing, the 'locked' property is set to true. This means 
-     *     that renderers can expect at least one more drawFeature event to be
-     *     called with the 'locked' property set to 'true': In some renderers,
-     *     this might make sense to use as a 'only update local information'
-     *     flag. 
-     */  
-    locked: false,
-    
-    /** 
-     * Property: size
-     * {<OpenLayers.Size>} 
-     */
-    size: null,
-    
-    /**
-     * Property: resolution
-     * {Float} cache of current map resolution
-     */
-    resolution: null,
-    
-    /**
-     * Property: map  
-     * {<OpenLayers.Map>} Reference to the map -- this is set in Vector's setMap()
-     */
-    map: null,
-    
-    /**
-     * Property: featureDx
-     * {Number} Feature offset in x direction. Will be calculated for and
-     * applied to the current feature while rendering (see
-     * <calculateFeatureDx>).
-     */
-    featureDx: 0,
-    
-    /**
-     * Constructor: OpenLayers.Renderer 
+     * Constructor: OpenLayers.Format.GML.v2
+     * Create a parser for GML v2.
      *
      * Parameters:
      *
      * Parameters:
-     * containerID - {<String>} 
-     * options - {Object} options for this renderer. See sublcasses for
-     *     supported options.
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
+     *
+     * Valid options properties:
+     * featureType - {String} Local (without prefix) feature typeName (required).
+     * featureNS - {String} Feature namespace (required).
+     * geometryName - {String} Geometry element name.
      */
      */
-    initialize: function(containerID, options) {
-        this.container = OpenLayers.Util.getElement(containerID);
-        OpenLayers.Util.extend(this, options);
+    initialize: function(options) {
+        OpenLayers.Format.GML.Base.prototype.initialize.apply(this, [options]);
     },
     },
-    
+
     /**
     /**
-     * APIMethod: destroy
+     * Property: readers
+     * Contains public functions, grouped by namespace prefix, that will
+     *     be applied when a namespaced node is found matching the function
+     *     name.  The function will be applied in the scope of this parser
+     *     with two arguments: the node being read and a context object passed
+     *     from the parent.
      */
      */
-    destroy: function() {
-        this.container = null;
-        this.extent = null;
-        this.size =  null;
-        this.resolution = null;
-        this.map = null;
+    readers: {
+        "gml": OpenLayers.Util.applyDefaults({
+            "outerBoundaryIs": function(node, container) {
+                var obj = {};
+                this.readChildNodes(node, obj);
+                container.outer = obj.components[0];
+            },
+            "innerBoundaryIs": function(node, container) {
+                var obj = {};
+                this.readChildNodes(node, obj);
+                container.inner.push(obj.components[0]);
+            },
+            "Box": function(node, container) {
+                var obj = {};
+                this.readChildNodes(node, obj);
+                if(!container.components) {
+                    container.components = [];
+                }
+                var min = obj.points[0];
+                var max = obj.points[1];
+                container.components.push(
+                    new OpenLayers.Bounds(min.x, min.y, max.x, max.y)
+                );
+            }
+        }, OpenLayers.Format.GML.Base.prototype.readers["gml"]),
+        "feature": OpenLayers.Format.GML.Base.prototype.readers["feature"],
+        "wfs": OpenLayers.Format.GML.Base.prototype.readers["wfs"]
     },
 
     /**
     },
 
     /**
-     * APIMethod: supported
-     * This should be overridden by specific subclasses
-     * 
-     * Returns:
-     * {Boolean} Whether or not the browser supports the renderer class
-     */
-    supported: function() {
-        return false;
-    },    
-    
-    /**
-     * Method: setExtent
-     * Set the visible part of the layer.
-     *
-     * Resolution has probably changed, so we nullify the resolution 
-     * cache (this.resolution) -- this way it will be re-computed when 
-     * next it is needed.
-     * We nullify the resolution cache (this.resolution) if resolutionChanged
-     * is set to true - this way it will be re-computed on the next
-     * getResolution() request.
+     * Method: write
      *
      * Parameters:
      *
      * Parameters:
-     * extent - {<OpenLayers.Bounds>}
-     * resolutionChanged - {Boolean}
+     * features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector}
+     *     An array of features or a single feature.
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} true to notify the layer that the new extent does not exceed
-     *     the coordinate range, and the features will not need to be redrawn.
-     *     False otherwise.
+     * {String} Given an array of features, a doc with a gml:featureMembers
+     *     element will be returned.  Given a single feature, a doc with a
+     *     gml:featureMember element will be returned.
      */
      */
-    setExtent: function(extent, resolutionChanged) {
-        this.extent = extent.clone();
-        if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
-            var ratio = extent.getWidth() / this.map.getExtent().getWidth(),
-                extent = extent.scale(1 / ratio);
-            this.extent = extent.wrapDateLine(this.map.getMaxExtent()).scale(ratio);
-        }
-        if (resolutionChanged) {
-            this.resolution = null;
+    write: function(features) {
+        var name;
+        if(OpenLayers.Util.isArray(features)) {
+            // GML2 only has abstract feature collections
+            // wfs provides a feature collection from a well-known schema
+            name = "wfs:FeatureCollection";
+        } else {
+            name = "gml:featureMember";
         }
         }
-        return true;
-    },
-    
-    /**
-     * Method: setSize
-     * Sets the size of the drawing surface.
-     * 
-     * Resolution has probably changed, so we nullify the resolution 
-     * cache (this.resolution) -- this way it will be re-computed when 
-     * next it is needed.
-     *
-     * Parameters:
-     * size - {<OpenLayers.Size>} 
-     */
-    setSize: function(size) {
-        this.size = size.clone();
-        this.resolution = null;
-    },
-    
-    /** 
-     * Method: getResolution
-     * Uses cached copy of resolution if available to minimize computing
-     * 
-     * Returns:
-     * {Float} The current map's resolution
-     */
-    getResolution: function() {
-        this.resolution = this.resolution || this.map.getResolution();
-        return this.resolution;
+        var root = this.writeNode(name, features);
+        this.setAttributeNS(
+            root, this.namespaces["xsi"],
+            "xsi:schemaLocation", this.schemaLocation
+        );
+
+        return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
     },
     },
-    
+
     /**
     /**
-     * Method: drawFeature
-     * Draw the feature.  The optional style argument can be used
-     * to override the feature's own style.  This method should only
-     * be called from layer.drawFeature().
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} 
-     * style - {<Object>}
-     * 
-     * Returns:
-     * {Boolean} true if the feature has been drawn completely, false if not,
-     *     undefined if the feature had no geometry
+     * Property: writers
+     * As a compliment to the readers property, this structure contains public
+     *     writing functions grouped by namespace alias and named like the
+     *     node names they produce.
      */
      */
-    drawFeature: function(feature, style) {
-        if(style == null) {
-            style = feature.style;
-        }
-        if (feature.geometry) {
-            var bounds = feature.geometry.getBounds();
-            if(bounds) {
-                var worldBounds;
-                if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
-                    worldBounds = this.map.getMaxExtent();
+    writers: {
+        "gml": OpenLayers.Util.applyDefaults({
+            "Point": function(geometry) {
+                var node = this.createElementNSPlus("gml:Point");
+                this.writeNode("coordinates", [geometry], node);
+                return node;
+            },
+            "coordinates": function(points) {
+                var numPoints = points.length;
+                var parts = new Array(numPoints);
+                var point;
+                for(var i=0; i<numPoints; ++i) {
+                    point = points[i];
+                    if(this.xy) {
+                        parts[i] = point.x + "," + point.y;
+                    } else {
+                        parts[i] = point.y + "," + point.x;
+                    }
+                    if(point.z != undefined) { // allow null or undefined
+                        parts[i] += "," + point.z;
+                    }
                 }
                 }
-                if (!bounds.intersectsBounds(this.extent, {worldBounds: worldBounds})) {
-                    style = {display: "none"};
-                } else {
-                    this.calculateFeatureDx(bounds, worldBounds);
+                return this.createElementNSPlus("gml:coordinates", {
+                    attributes: {
+                        decimal: ".", cs: ",", ts: " "
+                    },
+                    value: (numPoints == 1) ? parts[0] : parts.join(" ")
+                });
+            },
+            "LineString": function(geometry) {
+                var node = this.createElementNSPlus("gml:LineString");
+                this.writeNode("coordinates", geometry.components, node);
+                return node;
+            },
+            "Polygon": function(geometry) {
+                var node = this.createElementNSPlus("gml:Polygon");
+                this.writeNode("outerBoundaryIs", geometry.components[0], node);
+                for(var i=1; i<geometry.components.length; ++i) {
+                    this.writeNode(
+                        "innerBoundaryIs", geometry.components[i], node
+                    );
                 }
                 }
-                var rendered = this.drawGeometry(feature.geometry, style, feature.id);
-                if(style.display != "none" && style.label && rendered !== false) {
-
-                    var location = feature.geometry.getCentroid(); 
-                    if(style.labelXOffset || style.labelYOffset) {
-                        var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
-                        var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
-                        var res = this.getResolution();
-                        location.move(xOffset*res, yOffset*res);
-                    }
-                    this.drawText(feature.id, style, location);
-                } else {
-                    this.removeText(feature.id);
+                return node;
+            },
+            "outerBoundaryIs": function(ring) {
+                var node = this.createElementNSPlus("gml:outerBoundaryIs");
+                this.writeNode("LinearRing", ring, node);
+                return node;
+            },
+            "innerBoundaryIs": function(ring) {
+                var node = this.createElementNSPlus("gml:innerBoundaryIs");
+                this.writeNode("LinearRing", ring, node);
+                return node;
+            },
+            "LinearRing": function(ring) {
+                var node = this.createElementNSPlus("gml:LinearRing");
+                this.writeNode("coordinates", ring.components, node);
+                return node;
+            },
+            "Box": function(bounds) {
+                var node = this.createElementNSPlus("gml:Box");
+                this.writeNode("coordinates", [
+                    {x: bounds.left, y: bounds.bottom},
+                    {x: bounds.right, y: bounds.top}
+                ], node);
+                // srsName attribute is optional for gml:Box
+                if(this.srsName) {
+                    node.setAttribute("srsName", this.srsName);
                 }
                 }
-                return rendered;
+                return node;
             }
             }
-        }
+        }, OpenLayers.Format.GML.Base.prototype.writers["gml"]),
+        "feature": OpenLayers.Format.GML.Base.prototype.writers["feature"],
+        "wfs": OpenLayers.Format.GML.Base.prototype.writers["wfs"]
     },
     },
+    
+    CLASS_NAME: "OpenLayers.Format.GML.v2" 
+
+});
+/* ======================================================================
+    OpenLayers/Format/OGCExceptionReport.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XML.js
+ */
+
+/**
+ * Class: OpenLayers.Format.OGCExceptionReport
+ * Class to read exception reports for various OGC services and versions.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.OGCExceptionReport = OpenLayers.Class(OpenLayers.Format.XML, {
 
     /**
 
     /**
-     * Method: calculateFeatureDx
-     * {Number} Calculates the feature offset in x direction. Looking at the
-     * center of the feature bounds and the renderer extent, we calculate how
-     * many world widths the two are away from each other. This distance is
-     * used to shift the feature as close as possible to the center of the
-     * current enderer extent, which ensures that the feature is visible in the
-     * current viewport.
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>} Bounds of the feature
-     * worldBounds - {<OpenLayers.Bounds>} Bounds of the world
+     * Property: namespaces
+     * {Object} Mapping of namespace aliases to namespace URIs.
      */
      */
-    calculateFeatureDx: function(bounds, worldBounds) {
-        this.featureDx = 0;
-        if (worldBounds) {
-            var worldWidth = worldBounds.getWidth(),
-                rendererCenterX = (this.extent.left + this.extent.right) / 2,
-                featureCenterX = (bounds.left + bounds.right) / 2,
-                worldsAway = Math.round((featureCenterX - rendererCenterX) / worldWidth);
-            this.featureDx = worldsAway * worldWidth;
-        }
+    namespaces: {
+        ogc: "http://www.opengis.net/ogc"
     },
 
     },
 
-    /** 
-     * Method: drawGeometry
-     * 
-     * Draw a geometry.  This should only be called from the renderer itself.
-     * Use layer.drawFeature() from outside the renderer.
-     * virtual function
-     *
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>} 
-     * style - {Object} 
-     * featureId - {<String>} 
-     */
-    drawGeometry: function(geometry, style, featureId) {},
-        
     /**
     /**
-     * Method: drawText
-     * Function for drawing text labels.
-     * This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * featureId - {String}
-     * style -
-     * location - {<OpenLayers.Geometry.Point>}
+     * Property: regExes
+     * Compiled regular expressions for manipulating strings.
      */
      */
-    drawText: function(featureId, style, location) {},
+    regExes: {
+        trimSpace: (/^\s*|\s*$/g),
+        removeSpace: (/\s*/g),
+        splitSpace: (/\s+/),
+        trimComma: (/\s*,\s*/g)
+    },
 
     /**
 
     /**
-     * Method: removeText
-     * Function for removing text labels.
-     * This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * featureId - {String}
+     * Property: defaultPrefix
      */
      */
-    removeText: function(featureId) {},
-    
+    defaultPrefix: "ogc",
+
     /**
     /**
-     * Method: clear
-     * Clear all vectors from the renderer.
-     * virtual function.
-     */    
-    clear: function() {},
+     * Constructor: OpenLayers.Format.OGCExceptionReport
+     * Create a new parser for OGC exception reports.
+     *
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
+     */
 
     /**
 
     /**
-     * Method: getFeatureIdFromEvent
-     * Returns a feature id from an event on the renderer.  
-     * How this happens is specific to the renderer.  This should be
-     * called from layer.getFeatureFromEvent().
-     * Virtual function.
-     * 
+     * APIMethod: read
+     * Read OGC exception report data from a string, and return an object with
+     * information about the exceptions.
+     *
      * Parameters:
      * Parameters:
-     * evt - {<OpenLayers.Event>} 
+     * data - {String} or {DOMElement} data to read/parse.
      *
      * Returns:
      *
      * Returns:
-     * {String} A feature id or undefined.
+     * {Object} Information about the exceptions that occurred.
      */
      */
-    getFeatureIdFromEvent: function(evt) {},
-    
+    read: function(data) {
+        var result;
+        if(typeof data == "string") {
+            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
+        }
+        var root = data.documentElement;
+        var exceptionInfo = {exceptionReport: null}; 
+        if (root) {
+            this.readChildNodes(data, exceptionInfo);
+            if (exceptionInfo.exceptionReport === null) {
+                // fall-back to OWSCommon since this is a common output format for exceptions
+                // we cannot easily use the ows readers directly since they differ for 1.0 and 1.1
+                exceptionInfo = new OpenLayers.Format.OWSCommon().read(data);
+            }
+        }
+        return exceptionInfo;
+    },
+
     /**
     /**
-     * Method: eraseFeatures 
-     * This is called by the layer to erase features
-     * 
-     * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>)} 
+     * Property: readers
+     * Contains public functions, grouped by namespace prefix, that will
+     *     be applied when a namespaced node is found matching the function
+     *     name.  The function will be applied in the scope of this parser
+     *     with two arguments: the node being read and a context object passed
+     *     from the parent.
      */
      */
-    eraseFeatures: function(features) {
-        if(!(OpenLayers.Util.isArray(features))) {
-            features = [features];
-        }
-        for(var i=0, len=features.length; i<len; ++i) {
-            var feature = features[i];
-            this.eraseGeometry(feature.geometry, feature.id);
-            this.removeText(feature.id);
+    readers: {
+        "ogc": {
+            "ServiceExceptionReport": function(node, obj) {
+                obj.exceptionReport = {exceptions: []};
+                this.readChildNodes(node, obj.exceptionReport);
+            },
+            "ServiceException": function(node, exceptionReport) {
+                var exception = {
+                    code: node.getAttribute("code"),
+                    locator: node.getAttribute("locator"),
+                    text: this.getChildValue(node)
+                };
+                exceptionReport.exceptions.push(exception);
+            }
         }
     },
     
         }
     },
     
+    CLASS_NAME: "OpenLayers.Format.OGCExceptionReport"
+    
+});
+/* ======================================================================
+    OpenLayers/Format/XML/VersionedOGC.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XML.js
+ * @requires OpenLayers/Format/OGCExceptionReport.js
+ */
+
+/**
+ * Class: OpenLayers.Format.XML.VersionedOGC
+ * Base class for versioned formats, i.e. a format which supports multiple
+ * versions.
+ *
+ * To enable checking if parsing succeeded, you will need to define a property
+ * called errorProperty on the parser you want to check. The parser will then
+ * check the returned object to see if that property is present. If it is, it
+ * assumes the parsing was successful. If it is not present (or is null), it will
+ * pass the document through an OGCExceptionReport parser.
+ * 
+ * If errorProperty is undefined for the parser, this error checking mechanism
+ * will be disabled.
+ *
+ *
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.XML.VersionedOGC = OpenLayers.Class(OpenLayers.Format.XML, {
+    
     /**
     /**
-     * Method: eraseGeometry
-     * Remove a geometry from the renderer (by id).
-     * virtual function.
-     * 
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>} 
-     * featureId - {String}
+     * APIProperty: defaultVersion
+     * {String} Version number to assume if none found.
      */
      */
-    eraseGeometry: function(geometry, featureId) {},
+    defaultVersion: null,
     
     /**
     
     /**
-     * Method: moveRoot
-     * moves this renderer's root to a (different) renderer.
-     * To be implemented by subclasses that require a common renderer root for
-     * feature selection.
-     * 
-     * Parameters:
-     * renderer - {<OpenLayers.Renderer>} target renderer for the moved root
+     * APIProperty: version
+     * {String} Specify a version string if one is known.
      */
      */
-    moveRoot: function(renderer) {},
+    version: null,
 
     /**
 
     /**
-     * Method: getRenderLayerId
-     * Gets the layer that this renderer's output appears on. If moveRoot was
-     * used, this will be different from the id of the layer containing the
-     * features rendered by this renderer.
-     * 
-     * Returns:
-     * {String} the id of the output layer.
+     * APIProperty: profile
+     * {String} If provided, use a custom profile.
      */
      */
-    getRenderLayerId: function() {
-        return this.container.id;
+    profile: null,
+
+    /**
+     * APIProperty: allowFallback
+     * {Boolean} If a profiled parser cannot be found for the returned version,
+     * use a non-profiled parser as the fallback. Application code using this
+     * should take into account that the return object structure might be
+     * missing the specifics of the profile. Defaults to false.
+     */
+    allowFallback: false,
+
+    /**
+     * Property: name
+     * {String} The name of this parser, this is the part of the CLASS_NAME
+     * except for "OpenLayers.Format."
+     */
+    name: null,
+
+    /**
+     * APIProperty: stringifyOutput
+     * {Boolean} If true, write will return a string otherwise a DOMElement.
+     * Default is false.
+     */
+    stringifyOutput: false,
+
+    /**
+     * Property: parser
+     * {Object} Instance of the versioned parser.  Cached for multiple read and
+     *     write calls of the same version.
+     */
+    parser: null,
+
+    /**
+     * Constructor: OpenLayers.Format.XML.VersionedOGC.
+     * Constructor.
+     *
+     * Parameters:
+     * options - {Object} Optional object whose properties will be set on
+     *     the object.
+     */
+    initialize: function(options) {
+        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+        var className = this.CLASS_NAME;
+        this.name = className.substring(className.lastIndexOf(".")+1);
     },
     },
-    
+
     /**
     /**
-     * Method: applyDefaultSymbolizer
-     * 
+     * Method: getVersion
+     * Returns the version to use. Subclasses can override this function
+     * if a different version detection is needed.
+     *
      * Parameters:
      * Parameters:
-     * symbolizer - {Object}
-     * 
+     * root - {DOMElement}
+     * options - {Object} Optional configuration object.
+     *
      * Returns:
      * Returns:
-     * {Object}
+     * {String} The version to use.
      */
      */
-    applyDefaultSymbolizer: function(symbolizer) {
-        var result = OpenLayers.Util.extend({},
-            OpenLayers.Renderer.defaultSymbolizer);
-        if(symbolizer.stroke === false) {
-            delete result.strokeWidth;
-            delete result.strokeColor;
+    getVersion: function(root, options) {
+        var version;
+        // read
+        if (root) {
+            version = this.version;
+            if(!version) {
+                version = root.getAttribute("version");
+                if(!version) {
+                    version = this.defaultVersion;
+                }
+            }
+        } else { // write
+            version = (options && options.version) || 
+                this.version || this.defaultVersion;
         }
         }
-        if(symbolizer.fill === false) {
-            delete result.fillColor;
+        return version;
+    },
+
+    /**
+     * Method: getParser
+     * Get an instance of the cached parser if available, otherwise create one.
+     *
+     * Parameters:
+     * version - {String}
+     *
+     * Returns:
+     * {<OpenLayers.Format>}
+     */
+    getParser: function(version) {
+        version = version || this.defaultVersion;
+        var profile = this.profile ? "_" + this.profile : "";
+        if(!this.parser || this.parser.VERSION != version) {
+            var format = OpenLayers.Format[this.name][
+                "v" + version.replace(/\./g, "_") + profile
+            ];
+            if(!format) {
+                if (profile !== "" && this.allowFallback) {
+                    // fallback to the non-profiled version of the parser
+                    profile = "";
+                    format = OpenLayers.Format[this.name][
+                        "v" + version.replace(/\./g, "_")
+                    ];
+                }
+                if (!format) {
+                    throw "Can't find a " + this.name + " parser for version " +
+                          version + profile;
+                }
+            }
+            this.parser = new format(this.options);
         }
         }
-        OpenLayers.Util.extend(result, symbolizer);
-        return result;
+        return this.parser;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Renderer"
-});
+    /**
+     * APIMethod: write
+     * Write a document.
+     *
+     * Parameters:
+     * obj - {Object} An object representing the document.
+     * options - {Object} Optional configuration object.
+     *
+     * Returns:
+     * {String} The document as a string
+     */
+    write: function(obj, options) {
+        var version = this.getVersion(null, options);
+        this.parser = this.getParser(version);
+        var root = this.parser.write(obj, options);
+        if (this.stringifyOutput === false) {
+            return root;
+        } else {
+            return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
+        }
+    },
 
 
-/**
- * Constant: OpenLayers.Renderer.defaultSymbolizer
- * {Object} Properties from this symbolizer will be applied to symbolizers
- *     with missing properties. This can also be used to set a global
- *     symbolizer default in OpenLayers. To be SLD 1.x compliant, add the
- *     following code before rendering any vector features:
- * (code)
- * OpenLayers.Renderer.defaultSymbolizer = {
- *     fillColor: "#808080",
- *     fillOpacity: 1,
- *     strokeColor: "#000000",
- *     strokeOpacity: 1,
- *     strokeWidth: 1,
- *     pointRadius: 3,
- *     graphicName: "square"
- * };
- * (end)
- */
-OpenLayers.Renderer.defaultSymbolizer = {
-    fillColor: "#000000",
-    strokeColor: "#000000",
-    strokeWidth: 2,
-    fillOpacity: 1,
-    strokeOpacity: 1,
-    pointRadius: 0,
-    labelAlign: 'cm'
-};
-    
+    /**
+     * APIMethod: read
+     * Read a doc and return an object representing the document.
+     *
+     * Parameters:
+     * data - {String | DOMElement} Data to read.
+     * options - {Object} Options for the reader.
+     *
+     * Returns:
+     * {Object} An object representing the document.
+     */
+    read: function(data, options) {
+        if(typeof data == "string") {
+            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
+        }
+        var root = data.documentElement;
+        var version = this.getVersion(root);
+        this.parser = this.getParser(version);          // Select the parser
+        var obj = this.parser.read(data, options);      // Parse the data
 
 
+        var errorProperty = this.parser.errorProperty || null;
+        if (errorProperty !== null && obj[errorProperty] === undefined) {
+            // an error must have happened, so parse it and report back
+            var format = new OpenLayers.Format.OGCExceptionReport();
+            obj.error = format.read(data);
+        }
+        obj.version = version;
+        obj.requestType = this.name;
+        return obj;
+    },
 
 
-/**
- * Constant: OpenLayers.Renderer.symbol
- * Coordinate arrays for well known (named) symbols.
- */
-OpenLayers.Renderer.symbol = {
-    "star": [350,75, 379,161, 469,161, 397,215, 423,301, 350,250, 277,301,
-            303,215, 231,161, 321,161, 350,75],
-    "cross": [4,0, 6,0, 6,4, 10,4, 10,6, 6,6, 6,10, 4,10, 4,6, 0,6, 0,4, 4,4,
-            4,0],
-    "x": [0,0, 25,0, 50,35, 75,0, 100,0, 65,50, 100,100, 75,100, 50,65, 25,100, 0,100, 35,50, 0,0],
-    "square": [0,0, 0,1, 1,1, 1,0, 0,0],
-    "triangle": [0,10, 10,10, 5,0, 0,10]
-};
+    CLASS_NAME: "OpenLayers.Format.XML.VersionedOGC"
+});
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Renderer/Canvas.js
+    OpenLayers/Filter/Logical.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
+
 /**
 /**
- * @requires OpenLayers/Renderer.js
+ * @requires OpenLayers/Filter.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Renderer.Canvas 
- * A renderer based on the 2D 'canvas' drawing element.
+ * Class: OpenLayers.Filter.Logical
+ * This class represents ogc:And, ogc:Or and ogc:Not rules.
  * 
  * 
- * Inherits:
- *  - <OpenLayers.Renderer>
+ * Inherits from:
+ * - <OpenLayers.Filter>
  */
  */
-OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
+OpenLayers.Filter.Logical = OpenLayers.Class(OpenLayers.Filter, {
+
+    /**
+     * APIProperty: filters
+     * {Array(<OpenLayers.Filter>)} Child filters for this filter.
+     */
+    filters: null, 
+     
+    /**
+     * APIProperty: type
+     * {String} type of logical operator. Available types are:
+     * - OpenLayers.Filter.Logical.AND = "&&";
+     * - OpenLayers.Filter.Logical.OR  = "||";
+     * - OpenLayers.Filter.Logical.NOT = "!";
+     */
+    type: null,
+
+    /** 
+     * Constructor: OpenLayers.Filter.Logical
+     * Creates a logical filter (And, Or, Not).
+     *
+     * Parameters:
+     * options - {Object} An optional object with properties to set on the
+     *     filter.
+     * 
+     * Returns:
+     * {<OpenLayers.Filter.Logical>}
+     */
+    initialize: function(options) {
+        this.filters = [];
+        OpenLayers.Filter.prototype.initialize.apply(this, [options]);
+    },
     
     
+    /** 
+     * APIMethod: destroy
+     * Remove reference to child filters.
+     */
+    destroy: function() {
+        this.filters = null;
+        OpenLayers.Filter.prototype.destroy.apply(this);
+    },
+
     /**
     /**
-     * APIProperty: hitDetection
-     * {Boolean} Allow for hit detection of features.  Default is true.
+     * APIMethod: evaluate
+     * Evaluates this filter in a specific context.
+     * 
+     * Parameters:
+     * context - {Object} Context to use in evaluating the filter.  A vector
+     *     feature may also be provided to evaluate feature attributes in 
+     *     comparison filters or geometries in spatial filters.
+     * 
+     * Returns:
+     * {Boolean} The filter applies.
      */
      */
-    hitDetection: true,
+    evaluate: function(context) {
+        var i, len;
+        switch(this.type) {
+            case OpenLayers.Filter.Logical.AND:
+                for (i=0, len=this.filters.length; i<len; i++) {
+                    if (this.filters[i].evaluate(context) == false) {
+                        return false;
+                    }
+                }
+                return true;
+                
+            case OpenLayers.Filter.Logical.OR:
+                for (i=0, len=this.filters.length; i<len; i++) {
+                    if (this.filters[i].evaluate(context) == true) {
+                        return true;
+                    }
+                }
+                return false;
+            
+            case OpenLayers.Filter.Logical.NOT:
+                return (!this.filters[0].evaluate(context));
+        }
+        return undefined;
+    },
     
     /**
     
     /**
-     * Property: hitOverflow
-     * {Number} The method for converting feature identifiers to color values
-     *     supports 16777215 sequential values.  Two features cannot be 
-     *     predictably detected if their identifiers differ by more than this
-     *     value.  The hitOverflow allows for bigger numbers (but the 
-     *     difference in values is still limited).
+     * APIMethod: clone
+     * Clones this filter.
+     * 
+     * Returns:
+     * {<OpenLayers.Filter.Logical>} Clone of this filter.
      */
      */
-    hitOverflow: 0,
+    clone: function() {
+        var filters = [];        
+        for(var i=0, len=this.filters.length; i<len; ++i) {
+            filters.push(this.filters[i].clone());
+        }
+        return new OpenLayers.Filter.Logical({
+            type: this.type,
+            filters: filters
+        });
+    },
+    
+    CLASS_NAME: "OpenLayers.Filter.Logical"
+});
+
+
+OpenLayers.Filter.Logical.AND = "&&";
+OpenLayers.Filter.Logical.OR  = "||";
+OpenLayers.Filter.Logical.NOT = "!";
+/* ======================================================================
+    OpenLayers/Filter/Comparison.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Filter.js
+ */
+
+/**
+ * Class: OpenLayers.Filter.Comparison
+ * This class represents a comparison filter.
+ * 
+ * Inherits from:
+ * - <OpenLayers.Filter>
+ */
+OpenLayers.Filter.Comparison = OpenLayers.Class(OpenLayers.Filter, {
 
     /**
 
     /**
-     * Property: canvas
-     * {Canvas} The canvas context object.
+     * APIProperty: type
+     * {String} type: type of the comparison. This is one of
+     * - OpenLayers.Filter.Comparison.EQUAL_TO                 = "==";
+     * - OpenLayers.Filter.Comparison.NOT_EQUAL_TO             = "!=";
+     * - OpenLayers.Filter.Comparison.LESS_THAN                = "<";
+     * - OpenLayers.Filter.Comparison.GREATER_THAN             = ">";
+     * - OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO    = "<=";
+     * - OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
+     * - OpenLayers.Filter.Comparison.BETWEEN                  = "..";
+     * - OpenLayers.Filter.Comparison.LIKE                     = "~";
+     * - OpenLayers.Filter.Comparison.IS_NULL                  = "NULL";
      */
      */
-    canvas: null, 
+    type: null,
     
     /**
     
     /**
-     * Property: features
-     * {Object} Internal object of feature/style pairs for use in redrawing the layer.
+     * APIProperty: property
+     * {String}
+     * name of the context property to compare
      */
      */
-    features: null,
+    property: null,
     
     /**
     
     /**
-     * Property: pendingRedraw
-     * {Boolean} The renderer needs a redraw call to render features added while
-     *     the renderer was locked.
+     * APIProperty: value
+     * {Number} or {String}
+     * comparison value for binary comparisons. In the case of a String, this
+     * can be a combination of text and propertyNames in the form
+     * "literal ${propertyName}"
      */
      */
-    pendingRedraw: false,
+    value: null,
     
     /**
     
     /**
-     * Property: cachedSymbolBounds
-     * {Object} Internal cache of calculated symbol extents.
+     * Property: matchCase
+     * {Boolean} Force case sensitive searches for EQUAL_TO and NOT_EQUAL_TO
+     *     comparisons.  The Filter Encoding 1.1 specification added a matchCase
+     *     attribute to ogc:PropertyIsEqualTo and ogc:PropertyIsNotEqualTo
+     *     elements.  This property will be serialized with those elements only
+     *     if using the v1.1.0 filter format. However, when evaluating filters
+     *     here, the matchCase property will always be respected (for EQUAL_TO
+     *     and NOT_EQUAL_TO).  Default is true. 
      */
      */
-    cachedSymbolBounds: {},
+    matchCase: true,
     
     /**
     
     /**
-     * Constructor: OpenLayers.Renderer.Canvas
-     *
-     * Parameters:
-     * containerID - {<String>}
-     * options - {Object} Optional properties to be set on the renderer.
+     * APIProperty: lowerBoundary
+     * {Number} or {String}
+     * lower boundary for between comparisons. In the case of a String, this
+     * can be a combination of text and propertyNames in the form
+     * "literal ${propertyName}"
      */
      */
-    initialize: function(containerID, options) {
-        OpenLayers.Renderer.prototype.initialize.apply(this, arguments);
-        this.root = document.createElement("canvas");
-        this.container.appendChild(this.root);
-        this.canvas = this.root.getContext("2d");
-        this.features = {};
-        if (this.hitDetection) {
-            this.hitCanvas = document.createElement("canvas");
-            this.hitContext = this.hitCanvas.getContext("2d");
-        }
-    },
+    lowerBoundary: null,
     
     /**
     
     /**
-     * Method: setExtent
-     * Set the visible part of the layer.
-     *
-     * Parameters:
-     * extent - {<OpenLayers.Bounds>}
-     * resolutionChanged - {Boolean}
-     *
-     * Returns:
-     * {Boolean} true to notify the layer that the new extent does not exceed
-     *     the coordinate range, and the features will not need to be redrawn.
-     *     False otherwise.
+     * APIProperty: upperBoundary
+     * {Number} or {String}
+     * upper boundary for between comparisons. In the case of a String, this
+     * can be a combination of text and propertyNames in the form
+     * "literal ${propertyName}"
      */
      */
-    setExtent: function() {
-        OpenLayers.Renderer.prototype.setExtent.apply(this, arguments);
-        // always redraw features
-        return false;
-    },
-    
+    upperBoundary: null,
+
     /** 
     /** 
-     * Method: eraseGeometry
-     * Erase a geometry from the renderer. Because the Canvas renderer has
-     *     'memory' of the features that it has drawn, we have to remove the
-     *     feature so it doesn't redraw.   
-     * 
+     * Constructor: OpenLayers.Filter.Comparison
+     * Creates a comparison rule.
+     *
      * Parameters:
      * Parameters:
-     * geometry - {<OpenLayers.Geometry>}
-     * featureId - {String}
+     * options - {Object} An optional object with properties to set on the
+     *           rule
+     * 
+     * Returns:
+     * {<OpenLayers.Filter.Comparison>}
      */
      */
-    eraseGeometry: function(geometry, featureId) {
-        this.eraseFeatures(this.features[featureId][0]);
+    initialize: function(options) {
+        OpenLayers.Filter.prototype.initialize.apply(this, [options]);
+        // since matchCase on PropertyIsLike is not schema compliant, we only
+        // want to use this if explicitly asked for
+        if (this.type === OpenLayers.Filter.Comparison.LIKE 
+            && options.matchCase === undefined) {
+                this.matchCase = null;
+        }
     },
 
     /**
     },
 
     /**
-     * APIMethod: supported
+     * APIMethod: evaluate
+     * Evaluates this filter in a specific context.
      * 
      * 
-     * Returns:
-     * {Boolean} Whether or not the browser supports the renderer class
-     */
-    supported: function() {
-        return OpenLayers.CANVAS_SUPPORTED;
-    },    
-    
-    /**
-     * Method: setSize
-     * Sets the size of the drawing surface.
-     *
-     * Once the size is updated, redraw the canvas.
-     *
      * Parameters:
      * Parameters:
-     * size - {<OpenLayers.Size>} 
+     * context - {Object} Context to use in evaluating the filter.  If a vector
+     *     feature is provided, the feature.attributes will be used as context.
+     * 
+     * Returns:
+     * {Boolean} The filter applies.
      */
      */
-    setSize: function(size) {
-        this.size = size.clone();
-        var root = this.root;
-        root.style.width = size.w + "px";
-        root.style.height = size.h + "px";
-        root.width = size.w;
-        root.height = size.h;
-        this.resolution = null;
-        if (this.hitDetection) {
-            var hitCanvas = this.hitCanvas;
-            hitCanvas.style.width = size.w + "px";
-            hitCanvas.style.height = size.h + "px";
-            hitCanvas.width = size.w;
-            hitCanvas.height = size.h;
-        }
-    },
-    
-    /**
-     * Method: drawFeature
-     * Draw the feature. Stores the feature in the features list,
-     * then redraws the layer. 
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} 
-     * style - {<Object>} 
-     *
-     * Returns:
-     * {Boolean} The feature has been drawn completely.  If the feature has no
-     *     geometry, undefined will be returned.  If the feature is not rendered
-     *     for other reasons, false will be returned.
-     */
-    drawFeature: function(feature, style) {
-        var rendered;
-        if (feature.geometry) {
-            style = this.applyDefaultSymbolizer(style || feature.style);
-            // don't render if display none or feature outside extent
-            var bounds = feature.geometry.getBounds();
-
-            var worldBounds;
-            if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
-                worldBounds = this.map.getMaxExtent();
-            }
-
-            var intersects = bounds && bounds.intersectsBounds(this.extent, {worldBounds: worldBounds});
-
-            rendered = (style.display !== "none") && !!bounds && intersects;
-            if (rendered) {
-                // keep track of what we have rendered for redraw
-                this.features[feature.id] = [feature, style];
-            }
-            else {
-                // remove from features tracked for redraw
-                delete(this.features[feature.id]);
-            }
-            this.pendingRedraw = true;
-        }
-        if (this.pendingRedraw && !this.locked) {
-            this.redraw();
-            this.pendingRedraw = false;
+    evaluate: function(context) {
+        if (context instanceof OpenLayers.Feature.Vector) {
+            context = context.attributes;
         }
         }
-        return rendered;
-    },
-
-    /** 
-     * Method: drawGeometry
-     * Used when looping (in redraw) over the features; draws
-     * the canvas. 
-     *
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>} 
-     * style - {Object} 
-     */
-    drawGeometry: function(geometry, style, featureId) {
-        var className = geometry.CLASS_NAME;
-        if ((className == "OpenLayers.Geometry.Collection") ||
-            (className == "OpenLayers.Geometry.MultiPoint") ||
-            (className == "OpenLayers.Geometry.MultiLineString") ||
-            (className == "OpenLayers.Geometry.MultiPolygon")) {
-            for (var i = 0; i < geometry.components.length; i++) {
-                this.drawGeometry(geometry.components[i], style, featureId);
-            }
-            return;
+        var result = false;
+        var got = context[this.property];
+        if (got === undefined) {
+            return false;
         }
         }
-        switch (geometry.CLASS_NAME) {
-            case "OpenLayers.Geometry.Point":
-                this.drawPoint(geometry, style, featureId);
+        var exp;
+        switch(this.type) {
+            case OpenLayers.Filter.Comparison.EQUAL_TO:
+                exp = this.value;
+                if(!this.matchCase &&
+                   typeof got == "string" && typeof exp == "string") {
+                    result = (got.toUpperCase() == exp.toUpperCase());
+                } else {
+                    result = (got == exp);
+                }
                 break;
                 break;
-            case "OpenLayers.Geometry.LineString":
-                this.drawLineString(geometry, style, featureId);
+            case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:
+                exp = this.value;
+                if(!this.matchCase &&
+                   typeof got == "string" && typeof exp == "string") {
+                    result = (got.toUpperCase() != exp.toUpperCase());
+                } else {
+                    result = (got != exp);
+                }
                 break;
                 break;
-            case "OpenLayers.Geometry.LinearRing":
-                this.drawLinearRing(geometry, style, featureId);
+            case OpenLayers.Filter.Comparison.LESS_THAN:
+                result = got < this.value;
                 break;
                 break;
-            case "OpenLayers.Geometry.Polygon":
-                this.drawPolygon(geometry, style, featureId);
+            case OpenLayers.Filter.Comparison.GREATER_THAN:
+                result = got > this.value;
                 break;
                 break;
-            default:
+            case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:
+                result = got <= this.value;
+                break;
+            case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:
+                result = got >= this.value;
+                break;
+            case OpenLayers.Filter.Comparison.BETWEEN:
+                result = (got >= this.lowerBoundary) &&
+                    (got <= this.upperBoundary);
+                break;
+            case OpenLayers.Filter.Comparison.LIKE:
+                var regexp = new RegExp(this.value, "gi");
+                result = regexp.test(got);
+                break;
+            case OpenLayers.Filter.Comparison.IS_NULL:
+                result = (got === null);
                 break;
         }
                 break;
         }
+        return result;
     },
     },
-
+    
     /**
     /**
-     * Method: drawExternalGraphic
-     * Called to draw External graphics. 
+     * APIMethod: value2regex
+     * Converts the value of this rule into a regular expression string,
+     * according to the wildcard characters specified. This method has to
+     * be called after instantiation of this class, if the value is not a
+     * regular expression already.
      * 
      * 
-     * Parameters: 
-     * geometry - {<OpenLayers.Geometry>}
-     * style    - {Object}
-     * featureId - {String}
-     */ 
-    drawExternalGraphic: function(geometry, style, featureId) {
-        var img = new Image();
-
-        var title = style.title || style.graphicTitle;        
-        if (title) {
-            img.title = title;           
+     * Parameters:
+     * wildCard   - {Char} wildcard character in the above value, default
+     *              is "*"
+     * singleChar - {Char} single-character wildcard in the above value
+     *              default is "."
+     * escapeChar - {Char} escape character in the above value, default is
+     *              "!"
+     * 
+     * Returns:
+     * {String} regular expression string
+     */
+    value2regex: function(wildCard, singleChar, escapeChar) {
+        if (wildCard == ".") {
+            throw new Error("'.' is an unsupported wildCard character for " +
+                            "OpenLayers.Filter.Comparison");
         }
         }
-
-        var width = style.graphicWidth || style.graphicHeight;
-        var height = style.graphicHeight || style.graphicWidth;
-        width = width ? width : style.pointRadius * 2;
-        height = height ? height : style.pointRadius * 2;
-        var xOffset = (style.graphicXOffset != undefined) ?
-           style.graphicXOffset : -(0.5 * width);
-        var yOffset = (style.graphicYOffset != undefined) ?
-           style.graphicYOffset : -(0.5 * height);
-
-        var opacity = style.graphicOpacity || style.fillOpacity;
         
         
-        var onLoad = function() {
-            if(!this.features[featureId]) {
-                return;
-            }
-            var pt = this.getLocalXY(geometry);
-            var p0 = pt[0];
-            var p1 = pt[1];
-            if(!isNaN(p0) && !isNaN(p1)) {
-                var x = (p0 + xOffset) | 0;
-                var y = (p1 + yOffset) | 0;
-                var canvas = this.canvas;
-                canvas.globalAlpha = opacity;
-                var factor = OpenLayers.Renderer.Canvas.drawImageScaleFactor ||
-                    (OpenLayers.Renderer.Canvas.drawImageScaleFactor =
-                        /android 2.1/.test(navigator.userAgent.toLowerCase()) ?
-                            // 320 is the screen width of the G1 phone, for
-                            // which drawImage works out of the box.
-                            320 / window.screen.width : 1
-                    );
-                canvas.drawImage(
-                    img, x*factor, y*factor, width*factor, height*factor
-                );
-                if (this.hitDetection) {
-                    this.setHitContextStyle("fill", featureId);
-                    this.hitContext.fillRect(x, y, width, height);
-                }
-            }
-        };
 
 
-        img.onload = OpenLayers.Function.bind(onLoad, this);
-        img.src = style.externalGraphic;
+        // set UMN MapServer defaults for unspecified parameters
+        wildCard = wildCard ? wildCard : "*";
+        singleChar = singleChar ? singleChar : ".";
+        escapeChar = escapeChar ? escapeChar : "!";
+        
+        this.value = this.value.replace(
+                new RegExp("\\"+escapeChar+"(.|$)", "g"), "\\$1");
+        this.value = this.value.replace(
+                new RegExp("\\"+singleChar, "g"), ".");
+        this.value = this.value.replace(
+                new RegExp("\\"+wildCard, "g"), ".*");
+        this.value = this.value.replace(
+                new RegExp("\\\\.\\*", "g"), "\\"+wildCard);
+        this.value = this.value.replace(
+                new RegExp("\\\\\\.", "g"), "\\"+singleChar);
+        
+        return this.value;
     },
     },
-
+    
     /**
     /**
-     * Method: drawNamedSymbol
-     * Called to draw Well Known Graphic Symbol Name. 
-     * This method is only called by the renderer itself.
+     * Method: regex2value
+     * Convert the value of this rule from a regular expression string into an
+     *     ogc literal string using a wildCard of *, a singleChar of ., and an
+     *     escape of !.  Leaves the <value> property unmodified.
      * 
      * 
-     * Parameters: 
-     * geometry - {<OpenLayers.Geometry>}
-     * style    - {Object}
-     * featureId - {String}
-     */ 
-    drawNamedSymbol: function(geometry, style, featureId) {
-        var x, y, cx, cy, i, symbolBounds, scaling, angle;
-        var unscaledStrokeWidth;
-        var deg2rad = Math.PI / 180.0;
-        
-        var symbol = OpenLayers.Renderer.symbol[style.graphicName];
-         
-        if (!symbol) {
-            throw new Error(style.graphicName + ' is not a valid symbol name');
-        }
-        
-        if (!symbol.length || symbol.length < 2) return;
-        
-        var pt = this.getLocalXY(geometry);
-        var p0 = pt[0];
-        var p1 = pt[1];
-       
-        if (isNaN(p0) || isNaN(p1)) return;
-        
-        // Use rounded line caps
-        this.canvas.lineCap = "round";
-        this.canvas.lineJoin = "round";
-        
-        if (this.hitDetection) {
-            this.hitContext.lineCap = "round";
-            this.hitContext.lineJoin = "round";
-        }
-        
-        // Scale and rotate symbols, using precalculated bounds whenever possible.
-        if (style.graphicName in this.cachedSymbolBounds) {
-            symbolBounds = this.cachedSymbolBounds[style.graphicName];
-        } else {
-            symbolBounds = new OpenLayers.Bounds();
-            for(i = 0; i < symbol.length; i+=2) {
-                symbolBounds.extend(new OpenLayers.LonLat(symbol[i], symbol[i+1]));
-            }
-            this.cachedSymbolBounds[style.graphicName] = symbolBounds;
-        }
+     * Returns:
+     * {String} A string value.
+     */
+    regex2value: function() {
         
         
-        // Push symbol scaling, translation and rotation onto the transformation stack in reverse order.
-        // Don't forget to apply all canvas transformations to the hitContext canvas as well(!)
-        this.canvas.save();
-        if (this.hitDetection) { this.hitContext.save(); }
+        var value = this.value;
         
         
-        // Step 3: place symbol at the desired location
-        this.canvas.translate(p0,p1);
-        if (this.hitDetection) { this.hitContext.translate(p0,p1); }
+        // replace ! with !!
+        value = value.replace(/!/g, "!!");
+
+        // replace \. with !. (watching out for \\.)
+        value = value.replace(/(\\)?\\\./g, function($0, $1) {
+            return $1 ? $0 : "!.";
+        });
         
         
-        // Step 2a. rotate the symbol if necessary
-        angle = deg2rad * style.rotation; // will be NaN when style.rotation is undefined.
-        if (!isNaN(angle)) {
-            this.canvas.rotate(angle);
-            if (this.hitDetection) { this.hitContext.rotate(angle); }
-        }
-                
-        // // Step 2: scale symbol such that pointRadius equals half the maximum symbol dimension.
-        scaling = 2.0 * style.pointRadius / Math.max(symbolBounds.getWidth(), symbolBounds.getHeight());
-        this.canvas.scale(scaling,scaling);
-        if (this.hitDetection) { this.hitContext.scale(scaling,scaling); }
+        // replace \* with #* (watching out for \\*)
+        value = value.replace(/(\\)?\\\*/g, function($0, $1) {
+            return $1 ? $0 : "!*";
+        });
         
         
-        // Step 1: center the symbol at the origin        
-        cx = symbolBounds.getCenterLonLat().lon;
-        cy = symbolBounds.getCenterLonLat().lat;
-        this.canvas.translate(-cx,-cy);
-        if (this.hitDetection) { this.hitContext.translate(-cx,-cy); }        
-
-        // Don't forget to scale stroke widths, because they are affected by canvas scale transformations as well(!)
-        // Alternative: scale symbol coordinates manually, so stroke width scaling is not needed anymore.
-        unscaledStrokeWidth = style.strokeWidth;
-        style.strokeWidth = unscaledStrokeWidth / scaling;
-            
-        if (style.fill !== false) {
-            this.setCanvasStyle("fill", style);
-            this.canvas.beginPath();
-            for (i=0; i<symbol.length; i=i+2) {
-                x = symbol[i];
-                y = symbol[i+1];
-                if (i == 0) this.canvas.moveTo(x,y);
-                this.canvas.lineTo(x,y);
-            }
-            this.canvas.closePath();
-            this.canvas.fill();
+        // replace \\ with \
+        value = value.replace(/\\\\/g, "\\");
 
 
-            if (this.hitDetection) {
-                this.setHitContextStyle("fill", featureId, style);
-                this.hitContext.beginPath();
-                for (i=0; i<symbol.length; i=i+2) {
-                    x = symbol[i];
-                    y = symbol[i+1];
-                    if (i == 0) this.canvas.moveTo(x,y);
-                    this.hitContext.lineTo(x,y);
-                }
-                this.hitContext.closePath();
-                this.hitContext.fill();
-            }
-        }  
-        
-        if (style.stroke !== false) {
-            this.setCanvasStyle("stroke", style);
-            this.canvas.beginPath();
-            for (i=0; i<symbol.length; i=i+2) {
-                x = symbol[i];
-                y = symbol[i+1];
-                if (i == 0) this.canvas.moveTo(x,y);
-                this.canvas.lineTo(x,y);
-            }
-            this.canvas.closePath();
-            this.canvas.stroke();
-            
-            
-            if (this.hitDetection) {
-                this.setHitContextStyle("stroke", featureId, style, scaling);
-                this.hitContext.beginPath();
-                for (i=0; i<symbol.length; i=i+2) {
-                    x = symbol[i];
-                    y = symbol[i+1];
-                    if (i == 0) this.hitContext.moveTo(x,y);
-                    this.hitContext.lineTo(x,y);
-                }
-                this.hitContext.closePath();
-                this.hitContext.stroke();
-            }
-            
-        }
+        // convert .* to * (the sequence #.* is not allowed)
+        value = value.replace(/\.\*/g, "*");
         
         
-        style.strokeWidth = unscaledStrokeWidth;
-        this.canvas.restore();
-        if (this.hitDetection) { this.hitContext.restore(); }
-        this.setCanvasStyle("reset");  
+        return value;
     },
     },
-
+    
     /**
     /**
-     * Method: setCanvasStyle
-     * Prepare the canvas for drawing by setting various global settings.
-     *
-     * Parameters:
-     * type - {String} one of 'stroke', 'fill', or 'reset'
-     * style - {Object} Symbolizer hash
+     * APIMethod: clone
+     * Clones this filter.
+     * 
+     * Returns:
+     * {<OpenLayers.Filter.Comparison>} Clone of this filter.
      */
      */
-    setCanvasStyle: function(type, style) {
-        if (type === "fill") {     
-            this.canvas.globalAlpha = style['fillOpacity'];
-            this.canvas.fillStyle = style['fillColor'];
-        } else if (type === "stroke") {  
-            this.canvas.globalAlpha = style['strokeOpacity'];
-            this.canvas.strokeStyle = style['strokeColor'];
-            this.canvas.lineWidth = style['strokeWidth'];
-        } else {
-            this.canvas.globalAlpha = 0;
-            this.canvas.lineWidth = 1;
-        }
+    clone: function() {
+        return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison(), this);
     },
     
     },
     
+    CLASS_NAME: "OpenLayers.Filter.Comparison"
+});
+
+
+OpenLayers.Filter.Comparison.EQUAL_TO                 = "==";
+OpenLayers.Filter.Comparison.NOT_EQUAL_TO             = "!=";
+OpenLayers.Filter.Comparison.LESS_THAN                = "<";
+OpenLayers.Filter.Comparison.GREATER_THAN             = ">";
+OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO    = "<=";
+OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
+OpenLayers.Filter.Comparison.BETWEEN                  = "..";
+OpenLayers.Filter.Comparison.LIKE                     = "~";
+OpenLayers.Filter.Comparison.IS_NULL                  = "NULL";
+/* ======================================================================
+    OpenLayers/Format/Filter.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XML/VersionedOGC.js
+ * @requires OpenLayers/Filter/FeatureId.js
+ * @requires OpenLayers/Filter/Logical.js
+ * @requires OpenLayers/Filter/Comparison.js
+ */
+
+/**
+ * Class: OpenLayers.Format.Filter
+ * Read/Write ogc:Filter. Create a new instance with the <OpenLayers.Format.Filter>
+ *     constructor.
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Format.XML.VersionedOGC>
+ */
+OpenLayers.Format.Filter = OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC, {
+    
     /**
     /**
-     * Method: featureIdToHex
-     * Convert a feature ID string into an RGB hex string.
+     * APIProperty: defaultVersion
+     * {String} Version number to assume if none found.  Default is "1.0.0".
+     */
+    defaultVersion: "1.0.0",
+    
+    /**
+     * APIMethod: write
+     * Write an ogc:Filter given a filter object.
      *
      * Parameters:
      *
      * Parameters:
-     * featureId - {String} Feature id
+     * filter - {<OpenLayers.Filter>} An filter.
+     * options - {Object} Optional configuration object.
      *
      * Returns:
      *
      * Returns:
-     * {String} RGB hex string.
+     * {Elment} An ogc:Filter element node.
      */
      */
-    featureIdToHex: function(featureId) {
-        var id = Number(featureId.split("_").pop()) + 1; // zero for no feature
-        if (id >= 16777216) {
-            this.hitOverflow = id - 16777215;
-            id = id % 16777216 + 1;
-        }
-        var hex = "000000" + id.toString(16);
-        var len = hex.length;
-        hex = "#" + hex.substring(len-6, len);
-        return hex;
-    },
     
     /**
     
     /**
-     * Method: setHitContextStyle
-     * Prepare the hit canvas for drawing by setting various global settings.
+     * APIMethod: read
+     * Read and Filter doc and return an object representing the Filter.
      *
      * Parameters:
      *
      * Parameters:
-     * type - {String} one of 'stroke', 'fill', or 'reset'
-     * featureId - {String} The feature id.
-     * symbolizer - {<OpenLayers.Symbolizer>} The symbolizer.
+     * data - {String | DOMElement} Data to read.
+     *
+     * Returns:
+     * {<OpenLayers.Filter>} A filter object.
      */
      */
-    setHitContextStyle: function(type, featureId, symbolizer, strokeScaling) {
-        var hex = this.featureIdToHex(featureId);
-        if (type == "fill") {
-            this.hitContext.globalAlpha = 1.0;
-            this.hitContext.fillStyle = hex;
-        } else if (type == "stroke") {  
-            this.hitContext.globalAlpha = 1.0;
-            this.hitContext.strokeStyle = hex;
-            // bump up stroke width to deal with antialiasing. If strokeScaling is defined, we're rendering a symbol 
-            // on a transformed canvas, so the antialias width bump has to scale as well.
-            if (typeof strokeScaling === "undefined") {
-                this.hitContext.lineWidth = symbolizer.strokeWidth + 2;
-            } else {
-                if (!isNaN(strokeScaling)) { this.hitContext.lineWidth = symbolizer.strokeWidth + 2.0 / strokeScaling; }
-            }
-        } else {
-            this.hitContext.globalAlpha = 0;
-            this.hitContext.lineWidth = 1;
-        }
-    },
 
 
-    /**
-     * Method: drawPoint
-     * This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * geometry - {<OpenLayers.Geometry>}
-     * style    - {Object}
-     * featureId - {String}
-     */ 
-    drawPoint: function(geometry, style, featureId) {
-        if(style.graphic !== false) {
-            if(style.externalGraphic) {
-                this.drawExternalGraphic(geometry, style, featureId);
-            } else if (style.graphicName && (style.graphicName != "circle")) {
-                this.drawNamedSymbol(geometry, style, featureId);
-            } else {
-                var pt = this.getLocalXY(geometry);
-                var p0 = pt[0];
-                var p1 = pt[1];
-                if(!isNaN(p0) && !isNaN(p1)) {
-                    var twoPi = Math.PI*2;
-                    var radius = style.pointRadius;
-                    if(style.fill !== false) {
-                        this.setCanvasStyle("fill", style);
-                        this.canvas.beginPath();
-                        this.canvas.arc(p0, p1, radius, 0, twoPi, true);
-                        this.canvas.fill();
-                        if (this.hitDetection) {
-                            this.setHitContextStyle("fill", featureId, style);
-                            this.hitContext.beginPath();
-                            this.hitContext.arc(p0, p1, radius, 0, twoPi, true);
-                            this.hitContext.fill();
-                        }
-                    }
+    CLASS_NAME: "OpenLayers.Format.Filter" 
+});
+/* ======================================================================
+    OpenLayers/Filter/Function.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Filter.js
+ */
+
+/**
+ * Class: OpenLayers.Filter.Function
+ * This class represents a filter function.
+ * We are using this class for creation of complex 
+ * filters that can contain filter functions as values.
+ * Nesting function as other functions parameter is supported.
+ * 
+ * Inherits from:
+ * - <OpenLayers.Filter>
+ */
+OpenLayers.Filter.Function = OpenLayers.Class(OpenLayers.Filter, {
 
 
-                    if(style.stroke !== false) {
-                        this.setCanvasStyle("stroke", style);
-                        this.canvas.beginPath();
-                        this.canvas.arc(p0, p1, radius, 0, twoPi, true);
-                        this.canvas.stroke();
-                        if (this.hitDetection) {
-                            this.setHitContextStyle("stroke", featureId, style);
-                            this.hitContext.beginPath();
-                            this.hitContext.arc(p0, p1, radius, 0, twoPi, true);
-                            this.hitContext.stroke();
-                        }
-                        this.setCanvasStyle("reset");
-                    }
-                }
-            }
-        }
-    },
-    
-    /**
-     * Method: drawLineString
-     * This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * geometry - {<OpenLayers.Geometry>}
-     * style    - {Object}
-     * featureId - {String}
-     */ 
-    drawLineString: function(geometry, style, featureId) {
-        style = OpenLayers.Util.applyDefaults({fill: false}, style);
-        this.drawLinearRing(geometry, style, featureId);
-    },    
-    
-    /**
-     * Method: drawLinearRing
-     * This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * geometry - {<OpenLayers.Geometry>}
-     * style    - {Object}
-     * featureId - {String}
-     */ 
-    drawLinearRing: function(geometry, style, featureId) {
-        if (style.fill !== false) {
-            this.setCanvasStyle("fill", style);
-            this.renderPath(this.canvas, geometry, style, featureId, "fill");
-            if (this.hitDetection) {
-                this.setHitContextStyle("fill", featureId, style);
-                this.renderPath(this.hitContext, geometry, style, featureId, "fill");
-            }
-        }
-        if (style.stroke !== false) {
-            this.setCanvasStyle("stroke", style);
-            this.renderPath(this.canvas, geometry, style, featureId, "stroke");
-            if (this.hitDetection) {
-                this.setHitContextStyle("stroke", featureId, style);
-                this.renderPath(this.hitContext, geometry, style, featureId, "stroke");
-            }
-        }
-        this.setCanvasStyle("reset");
-    },
-    
     /**
     /**
-     * Method: renderPath
-     * Render a path with stroke and optional fill.
+     * APIProperty: name
+     * {String} Name of the function.
      */
      */
-    renderPath: function(context, geometry, style, featureId, type) {
-        var components = geometry.components;
-        var len = components.length;
-        context.beginPath();
-        var start = this.getLocalXY(components[0]);
-        var x = start[0];
-        var y = start[1];
-        if (!isNaN(x) && !isNaN(y)) {
-            context.moveTo(start[0], start[1]);
-            for (var i=1; i<len; ++i) {
-                var pt = this.getLocalXY(components[i]);
-                context.lineTo(pt[0], pt[1]);
-            }
-            if (type === "fill") {
-                context.fill();
-            } else {
-                context.stroke();
-            }
-        }
-    },
-    
-    /**
-     * Method: drawPolygon
-     * This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * geometry - {<OpenLayers.Geometry>}
-     * style    - {Object}
-     * featureId - {String}
-     */ 
-    drawPolygon: function(geometry, style, featureId) {
-        var components = geometry.components;
-        var len = components.length;
-        this.drawLinearRing(components[0], style, featureId);
-        // erase inner rings
-        for (var i=1; i<len; ++i) {
-            /** 
-             * Note that this is overly agressive.  Here we punch holes through 
-             * all previously rendered features on the same canvas.  A better 
-             * solution for polygons with interior rings would be to draw the 
-             * polygon on a sketch canvas first.  We could erase all holes 
-             * there and then copy the drawing to the layer canvas. 
-             * TODO: http://trac.osgeo.org/openlayers/ticket/3130 
-             */
-            this.canvas.globalCompositeOperation = "destination-out";
-            if (this.hitDetection) {
-                this.hitContext.globalCompositeOperation = "destination-out";
-            }
-            this.drawLinearRing(
-                components[i], 
-                OpenLayers.Util.applyDefaults({stroke: false, fillOpacity: 1.0}, style),
-                featureId
-            );
-            this.canvas.globalCompositeOperation = "source-over";
-            if (this.hitDetection) {
-                this.hitContext.globalCompositeOperation = "source-over";
-            }
-            this.drawLinearRing(
-                components[i], 
-                OpenLayers.Util.applyDefaults({fill: false}, style),
-                featureId
-            );
-        }
-    },
+    name: null,
     
     /**
     
     /**
-     * Method: drawText
-     * This method is only called by the renderer itself.
-     *
-     * Parameters:
-     * location - {<OpenLayers.Point>}
-     * style    - {Object}
+     * APIProperty: params
+     * {Array(<OpenLayers.Filter.Function> || String || Number)} Function parameters
+     * For now support only other Functions, String or Number
      */
      */
-    drawText: function(location, style) {
-        var pt = this.getLocalXY(location);
-
-        this.setCanvasStyle("reset");
-        this.canvas.fillStyle = style.fontColor;
-        this.canvas.globalAlpha = style.fontOpacity || 1.0;
-        var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
-                         "normal", // "font-variant" not supported
-                         style.fontWeight ? style.fontWeight : "normal",
-                         style.fontSize ? style.fontSize : "1em",
-                         style.fontFamily ? style.fontFamily : "sans-serif"].join(" ");
-        var labelRows = style.label.split('\n');
-        var numRows = labelRows.length;
-        if (this.canvas.fillText) {
-            // HTML5
-            this.canvas.font = fontStyle;
-            this.canvas.textAlign =
-                OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[0]] ||
-                "center";
-            this.canvas.textBaseline =
-                OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[1]] ||
-                "middle";
-            var vfactor =
-                OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[1]];
-            if (vfactor == null) {
-                vfactor = -.5;
-            }
-            var lineHeight =
-                this.canvas.measureText('Mg').height ||
-                this.canvas.measureText('xx').width;
-            pt[1] += lineHeight*vfactor*(numRows-1);
-            for (var i = 0; i < numRows; i++) {
-                if (style.labelOutlineWidth) {
-                    this.canvas.save();
-                    this.canvas.globalAlpha = style.labelOutlineOpacity || style.fontOpacity || 1.0;
-                    this.canvas.strokeStyle = style.labelOutlineColor;
-                    this.canvas.lineWidth = style.labelOutlineWidth;
-                    this.canvas.strokeText(labelRows[i], pt[0], pt[1] + (lineHeight*i) + 1);
-                    this.canvas.restore();
-                }
-                this.canvas.fillText(labelRows[i], pt[0], pt[1] + (lineHeight*i));
-            }
-        } else if (this.canvas.mozDrawText) {
-            // Mozilla pre-Gecko1.9.1 (<FF3.1)
-            this.canvas.mozTextStyle = fontStyle;
-            // No built-in text alignment, so we measure and adjust the position
-            var hfactor =
-                OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[0]];
-            if (hfactor == null) {
-                hfactor = -.5;
-            }
-            var vfactor =
-                OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[1]];
-            if (vfactor == null) {
-                vfactor = -.5;
-            }
-            var lineHeight = this.canvas.mozMeasureText('xx');
-            pt[1] += lineHeight*(1 + (vfactor*numRows));
-            for (var i = 0; i < numRows; i++) {
-                var x = pt[0] + (hfactor*this.canvas.mozMeasureText(labelRows[i]));
-                var y = pt[1] + (i*lineHeight);
-                this.canvas.translate(x, y);
-                this.canvas.mozDrawText(labelRows[i]);
-                this.canvas.translate(-x, -y);
-            }
-        }
-        this.setCanvasStyle("reset");
-    },
+    params: null,  
     
     
-    /**
-     * Method: getLocalXY
-     * transform geographic xy into pixel xy
+    /** 
+     * Constructor: OpenLayers.Filter.Function
+     * Creates a filter function.
      *
      *
-     * Parameters: 
-     * point - {<OpenLayers.Geometry.Point>}
-     */
-    getLocalXY: function(point) {
-        var resolution = this.getResolution();
-        var extent = this.extent;
-        var x = ((point.x - this.featureDx) / resolution + (-extent.left / resolution));
-        var y = ((extent.top / resolution) - point.y / resolution);
-        return [x, y];
-    },
-
-    /**
-     * Method: clear
-     * Clear all vectors from the renderer.
-     */    
-    clear: function() {
-        var height = this.root.height;
-        var width = this.root.width;
-        this.canvas.clearRect(0, 0, width, height);
-        this.features = {};
-        if (this.hitDetection) {
-            this.hitContext.clearRect(0, 0, width, height);
-        }
-    },
-
-    /**
-     * Method: getFeatureIdFromEvent
-     * Returns a feature id from an event on the renderer.  
-     * 
      * Parameters:
      * Parameters:
-     * evt - {<OpenLayers.Event>} 
-     *
-     * Returns:
-     * {<OpenLayers.Feature.Vector} A feature or undefined.  This method returns a 
-     *     feature instead of a feature id to avoid an unnecessary lookup on the
-     *     layer.
-     */
-    getFeatureIdFromEvent: function(evt) {
-        var featureId, feature;
-        
-        if (this.hitDetection && this.root.style.display !== "none") {
-            // this dragging check should go in the feature handler
-            if (!this.map.dragging) {
-                var xy = evt.xy;
-                var x = xy.x | 0;
-                var y = xy.y | 0;
-                var data = this.hitContext.getImageData(x, y, 1, 1).data;
-                if (data[3] === 255) { // antialiased
-                    var id = data[2] + (256 * (data[1] + (256 * data[0])));
-                    if (id) {
-                        featureId = "OpenLayers_Feature_Vector_" + (id - 1 + this.hitOverflow);
-                        try {
-                            feature = this.features[featureId][0];
-                        } catch(err) {
-                            // Because of antialiasing on the canvas, when the hit location is at a point where the edge of
-                            // one symbol intersects the interior of another symbol, a wrong hit color (and therefore id) results.
-                            // todo: set Antialiasing = 'off' on the hitContext as soon as browsers allow it.
-                        }
-                    }
-                }
-            }
-        }
-        return feature;
-    },
-    
-    /**
-     * Method: eraseFeatures 
-     * This is called by the layer to erase features; removes the feature from
-     *     the list, then redraws the layer.
+     * options - {Object} An optional object with properties to set on the
+     *     function.
      * 
      * 
-     * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>)} 
-     */
-    eraseFeatures: function(features) {
-        if(!(OpenLayers.Util.isArray(features))) {
-            features = [features];
-        }
-        for(var i=0; i<features.length; ++i) {
-            delete this.features[features[i].id];
-        }
-        this.redraw();
-    },
-
-    /**
-     * Method: redraw
-     * The real 'meat' of the function: any time things have changed,
-     *     redraw() can be called to loop over all the data and (you guessed
-     *     it) redraw it.  Unlike Elements-based Renderers, we can't interact
-     *     with things once they're drawn, to remove them, for example, so
-     *     instead we have to just clear everything and draw from scratch.
+     * Returns:
+     * {<OpenLayers.Filter.Function>}
      */
      */
-    redraw: function() {
-        if (!this.locked) {
-            var height = this.root.height;
-            var width = this.root.width;
-            this.canvas.clearRect(0, 0, width, height);
-            if (this.hitDetection) {
-                this.hitContext.clearRect(0, 0, width, height);
-            }
-            var labelMap = [];
-            var feature, geometry, style;
-            var worldBounds = (this.map.baseLayer && this.map.baseLayer.wrapDateLine) && this.map.getMaxExtent();
-            for (var id in this.features) {
-                if (!this.features.hasOwnProperty(id)) { continue; }
-                feature = this.features[id][0];
-                geometry = feature.geometry;
-                this.calculateFeatureDx(geometry.getBounds(), worldBounds);
-                style = this.features[id][1];
-                this.drawGeometry(geometry, style, feature.id);
-                if(style.label) {
-                    labelMap.push([feature, style]);
-                }
-            }
-            var item;
-            for (var i=0, len=labelMap.length; i<len; ++i) {
-                item = labelMap[i];
-                this.drawText(item[0].geometry.getCentroid(), item[1]);
-            }
-        }    
-    },
 
 
-    CLASS_NAME: "OpenLayers.Renderer.Canvas"
+    CLASS_NAME: "OpenLayers.Filter.Function"
 });
 
 });
 
-/**
- * Constant: OpenLayers.Renderer.Canvas.LABEL_ALIGN
- * {Object}
- */
-OpenLayers.Renderer.Canvas.LABEL_ALIGN = {
-    "l": "left",
-    "r": "right",
-    "t": "top",
-    "b": "bottom"
-};
-
-/**
- * Constant: OpenLayers.Renderer.Canvas.LABEL_FACTOR
- * {Object}
- */
-OpenLayers.Renderer.Canvas.LABEL_FACTOR = {
-    "l": 0,
-    "r": -1,
-    "t": 0,
-    "b": -1
-};
-
-/**
- * Constant: OpenLayers.Renderer.Canvas.drawImageScaleFactor
- * {Number} Scale factor to apply to the canvas drawImage arguments. This
- *     is always 1 except for Android 2.1 devices, to work around
- *     http://code.google.com/p/android/issues/detail?id=5141.
- */
-OpenLayers.Renderer.Canvas.drawImageScaleFactor = null;
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Layer/Bing.js
+    OpenLayers/BaseTypes/Date.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Layer/XYZ.js
+ * @requires OpenLayers/SingleFile.js
  */
 
  */
 
-/** 
- * Class: OpenLayers.Layer.Bing
- * Bing layer using direct tile access as provided by Bing Maps REST Services.
- * See http://msdn.microsoft.com/en-us/library/ff701713.aspx for more
- * information. Note: Terms of Service compliant use requires the map to be
- * configured with an <OpenLayers.Control.Attribution> control and the
- * attribution placed on or near the map.
- * 
- * Inherits from:
- *  - <OpenLayers.Layer.XYZ>
+/**
+ * Namespace: OpenLayers.Date
+ * Contains implementations of Date.parse and date.toISOString that match the
+ *     ECMAScript 5 specification for parsing RFC 3339 dates.
+ *     http://tools.ietf.org/html/rfc3339
  */
  */
-OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
+OpenLayers.Date = {
 
 
-    /**
-     * Property: key
-     * {String} API key for Bing maps, get your own key 
-     *     at http://bingmapsportal.com/ .
+    /** 
+     * APIProperty: dateRegEx
+     * The regex to be used for validating dates. You can provide your own
+     * regex for instance for adding support for years before BC. Default
+     * value is: /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/
      */
      */
-    key: null,
+    dateRegEx: /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,
 
     /**
 
     /**
-     * Property: serverResolutions
-     * {Array} the resolutions provided by the Bing servers.
-     */
-    serverResolutions: [
-        156543.03390625, 78271.516953125, 39135.7584765625,
-        19567.87923828125, 9783.939619140625, 4891.9698095703125,
-        2445.9849047851562, 1222.9924523925781, 611.4962261962891,
-        305.74811309814453, 152.87405654907226, 76.43702827453613,
-        38.218514137268066, 19.109257068634033, 9.554628534317017,
-        4.777314267158508, 2.388657133579254, 1.194328566789627,
-        0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
-        0.07464553542435169
-    ],
-    
-    /**
-     * Property: attributionTemplate
-     * {String}
+     * APIMethod: toISOString
+     * Generates a string representing a date.  The format of the string follows
+     *     the profile of ISO 8601 for date and time on the Internet (see
+     *     http://tools.ietf.org/html/rfc3339).  If the toISOString method is
+     *     available on the Date prototype, that is used.  The toISOString
+     *     method for Date instances is defined in ECMA-262.
+     *
+     * Parameters:
+     * date - {Date} A date object.
+     *
+     * Returns:
+     * {String} A string representing the date (e.g.
+     *     "2010-08-07T16:58:23.123Z").  If the date does not have a valid time
+     *     (i.e. isNaN(date.getTime())) this method returns the string "Invalid
+     *     Date".  The ECMA standard says the toISOString method should throw
+     *     RangeError in this case, but Firefox returns a string instead.  For
+     *     best results, use isNaN(date.getTime()) to determine date validity
+     *     before generating date strings.
      */
      */
-    attributionTemplate: '<span class="olBingAttribution ${type}">' +
-         '<div><a target="_blank" href="http://www.bing.com/maps/">' +
-         '<img src="${logo}" /></a></div>${copyrights}' +
-         '<a style="white-space: nowrap" target="_blank" '+
-         'href="http://www.microsoft.com/maps/product/terms.html">' +
-         'Terms of Use</a></span>',
+    toISOString: (function() {
+        if ("toISOString" in Date.prototype) {
+            return function(date) {
+                return date.toISOString();
+            };
+        } else {
+            return function(date) {
+                var str;
+                if (isNaN(date.getTime())) {
+                    // ECMA-262 says throw RangeError, Firefox returns
+                    // "Invalid Date"
+                    str = "Invalid Date";
+                } else {
+                    str =
+                        date.getUTCFullYear() + "-" +
+                        OpenLayers.Number.zeroPad(date.getUTCMonth() + 1, 2) + "-" +
+                        OpenLayers.Number.zeroPad(date.getUTCDate(), 2) + "T" +
+                        OpenLayers.Number.zeroPad(date.getUTCHours(), 2) + ":" +
+                        OpenLayers.Number.zeroPad(date.getUTCMinutes(), 2) + ":" +
+                        OpenLayers.Number.zeroPad(date.getUTCSeconds(), 2) + "." +
+                        OpenLayers.Number.zeroPad(date.getUTCMilliseconds(), 3) + "Z";
+                }
+                return str;
+            };
+        }
+
+    })(),
 
     /**
 
     /**
-     * Property: metadata
-     * {Object} Metadata for this layer, as returned by the callback script
-     */
-    metadata: null,
-
-    /**
-     * Property: protocolRegex
-     * {RegExp} Regular expression to match and replace http: in bing urls
-     */
-    protocolRegex: /^http:/i,
-    
-    /**
-     * APIProperty: type
-     * {String} The layer identifier.  Any non-birdseye imageryType
-     *     from http://msdn.microsoft.com/en-us/library/ff701716.aspx can be
-     *     used.  Default is "Road".
-     */
-    type: "Road",
-    
-    /**
-     * APIProperty: culture
-     * {String} The culture identifier.  See http://msdn.microsoft.com/en-us/library/ff701709.aspx
-     * for the definition and the possible values.  Default is "en-US".
-     */
-    culture: "en-US",
-    
-    /**
-     * APIProperty: metadataParams
-     * {Object} Optional url parameters for the Get Imagery Metadata request
-     * as described here: http://msdn.microsoft.com/en-us/library/ff701716.aspx
-     */
-    metadataParams: null,
-
-    /** APIProperty: tileOptions
-     *  {Object} optional configuration options for <OpenLayers.Tile> instances
-     *  created by this Layer. Default is
-     *
-     *  (code)
-     *  {crossOriginKeyword: 'anonymous'}
-     *  (end)
-     */
-    tileOptions: null,
-
-    /** APIProperty: protocol
-     *  {String} Protocol to use to fetch Imagery Metadata, tiles and bing logo
-     *  Can be 'http:' 'https:' or ''
-     *
-     *  Warning: tiles may not be available under both HTTP and HTTPS protocols.
-     *  Microsoft approved use of both HTTP and HTTPS urls for tiles. However
-     *  this is undocumented and the Imagery Metadata API always returns HTTP
-     *  urls.
-     *
-     *  Default is '', unless when executed from a file:/// uri, in which case
-     *  it is 'http:'.
-     */
-    protocol: ~window.location.href.indexOf('http') ? '' : 'http:',
-
-    /**
-     * Constructor: OpenLayers.Layer.Bing
-     * Create a new Bing layer.
-     *
-     * Example:
-     * (code)
-     * var road = new OpenLayers.Layer.Bing({
-     *     name: "My Bing Aerial Layer",
-     *     type: "Aerial",
-     *     key: "my-api-key-here",
-     * });
-     * (end)
+     * APIMethod: parse
+     * Generate a date object from a string.  The format for the string follows
+     *     the profile of ISO 8601 for date and time on the Internet (see
+     *     http://tools.ietf.org/html/rfc3339).  We don't call the native
+     *     Date.parse because of inconsistency between implmentations.  In
+     *     Chrome, calling Date.parse with a string that doesn't contain any
+     *     indication of the timezone (e.g. "2011"), the date is interpreted
+     *     in local time.  On Firefox, the assumption is UTC.
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} Configuration properties for the layer.
-     *
-     * Required configuration properties:
-     * key - {String} Bing Maps API key for your application. Get one at
-     *     http://bingmapsportal.com/.
-     * type - {String} The layer identifier.  Any non-birdseye imageryType
-     *     from http://msdn.microsoft.com/en-us/library/ff701716.aspx can be
-     *     used.
-     *
-     * Any other documented layer properties can be provided in the config object.
-     */
-    initialize: function(options) {
-        options = OpenLayers.Util.applyDefaults({
-            sphericalMercator: true
-        }, options);
-        var name = options.name || "Bing " + (options.type || this.type);
-        
-        var newArgs = [name, null, options];
-        OpenLayers.Layer.XYZ.prototype.initialize.apply(this, newArgs);
-        this.tileOptions = OpenLayers.Util.extend({
-            crossOriginKeyword: 'anonymous'
-        }, this.options.tileOptions);
-        this.loadMetadata(); 
-    },
-
-    /**
-     * Method: loadMetadata
-     */
-    loadMetadata: function() {
-        this._callbackId = "_callback_" + this.id.replace(/\./g, "_");
-        // link the processMetadata method to the global scope and bind it
-        // to this instance
-        window[this._callbackId] = OpenLayers.Function.bind(
-            OpenLayers.Layer.Bing.processMetadata, this
-        );
-        var params = OpenLayers.Util.applyDefaults({
-            key: this.key,
-            jsonp: this._callbackId,
-            include: "ImageryProviders"
-        }, this.metadataParams);
-        var url = this.protocol + "//dev.virtualearth.net/REST/v1/Imagery/Metadata/" +
-            this.type + "?" + OpenLayers.Util.getParameterString(params);
-        var script = document.createElement("script");
-        script.type = "text/javascript";
-        script.src = url;
-        script.id = this._callbackId;
-        document.getElementsByTagName("head")[0].appendChild(script);
-    },
-    
-    /**
-     * Method: initLayer
-     *
-     * Sets layer properties according to the metadata provided by the API
-     */
-    initLayer: function() {
-        var res = this.metadata.resourceSets[0].resources[0];
-        var url = res.imageUrl.replace("{quadkey}", "${quadkey}");
-        url = url.replace("{culture}", this.culture);
-        url = url.replace(this.protocolRegex, this.protocol);
-        this.url = [];
-        for (var i=0; i<res.imageUrlSubdomains.length; ++i) {
-            this.url.push(url.replace("{subdomain}", res.imageUrlSubdomains[i]));
-        }
-        this.addOptions({
-            maxResolution: Math.min(
-                this.serverResolutions[res.zoomMin],
-                this.maxResolution || Number.POSITIVE_INFINITY
-            ),
-            numZoomLevels: Math.min(
-                res.zoomMax + 1 - res.zoomMin, this.numZoomLevels
-            )
-        }, true);
-        if (!this.isBaseLayer) {
-            this.redraw();
-        }
-        this.updateAttribution();
-    },
-    
-    /**
-     * Method: getURL
+     * str - {String} A string representing the date (e.g.
+     *     "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z",
+     *     "2010-08-07T11:58:23.123-06").
      *
      *
-     * Paramters:
-     * bounds - {<OpenLayers.Bounds>}
-     */
-    getURL: function(bounds) {
-        if (!this.url) {
-            return;
-        }
-        var xyz = this.getXYZ(bounds), x = xyz.x, y = xyz.y, z = xyz.z;
-        var quadDigits = [];
-        for (var i = z; i > 0; --i) {
-            var digit = '0';
-            var mask = 1 << (i - 1);
-            if ((x & mask) != 0) {
-                digit++;
-            }
-            if ((y & mask) != 0) {
-                digit++;
-                digit++;
-            }
-            quadDigits.push(digit);
-        }
-        var quadKey = quadDigits.join("");
-        var url = this.selectUrl('' + x + y + z, this.url);
-
-        return OpenLayers.String.format(url, {'quadkey': quadKey});
-    },
-    
-    /**
-     * Method: updateAttribution
-     * Updates the attribution according to the requirements outlined in
-     * http://gis.638310.n2.nabble.com/Bing-imagery-td5789168.html
+     * Returns:
+     * {Date} A date object.  If the string could not be parsed, an invalid
+     *     date is returned (i.e. isNaN(date.getTime())).
      */
      */
-    updateAttribution: function() {
-        var metadata = this.metadata;
-        if (!metadata.resourceSets || !this.map || !this.map.center) {
-            return;
-        }
-        var res = metadata.resourceSets[0].resources[0];
-        var extent = this.map.getExtent().transform(
-            this.map.getProjectionObject(),
-            new OpenLayers.Projection("EPSG:4326")
-        );
-        var providers = res.imageryProviders || [],
-            zoom = OpenLayers.Util.indexOf(this.serverResolutions,
-                                           this.getServerResolution()),
-            copyrights = "", provider, i, ii, j, jj, bbox, coverage;
-        for (i=0,ii=providers.length; i<ii; ++i) {
-            provider = providers[i];
-            for (j=0,jj=provider.coverageAreas.length; j<jj; ++j) {
-                coverage = provider.coverageAreas[j];
-                // axis order provided is Y,X
-                bbox = OpenLayers.Bounds.fromArray(coverage.bbox, true);
-                if (extent.intersectsBounds(bbox) &&
-                        zoom <= coverage.zoomMax && zoom >= coverage.zoomMin) {
-                    copyrights += provider.attribution + " ";
+    parse: function(str) {
+        var date;
+        var match = str.match(this.dateRegEx);
+        if (match && (match[1] || match[7])) { // must have at least year or time
+            var year = parseInt(match[1], 10) || 0;
+            var month = (parseInt(match[2], 10) - 1) || 0;
+            var day = parseInt(match[3], 10) || 1;
+            date = new Date(Date.UTC(year, month, day));
+            // optional time
+            var type = match[7];
+            if (type) {
+                var hours = parseInt(match[4], 10);
+                var minutes = parseInt(match[5], 10);
+                var secFrac = parseFloat(match[6]);
+                var seconds = secFrac | 0;
+                var milliseconds = Math.round(1000 * (secFrac - seconds));
+                date.setUTCHours(hours, minutes, seconds, milliseconds);
+                // check offset
+                if (type !== "Z") {
+                    var hoursOffset = parseInt(type, 10);
+                    var minutesOffset = parseInt(match[8], 10) || 0;
+                    var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
+                    date = new Date(date.getTime() + offset);
                 }
             }
                 }
             }
+        } else {
+            date = new Date("invalid");
         }
         }
-        var logo = metadata.brandLogoUri.replace(this.protocolRegex, this.protocol);
-        this.attribution = OpenLayers.String.format(this.attributionTemplate, {
-            type: this.type.toLowerCase(),
-            logo: logo,
-            copyrights: copyrights
-        });
-        this.map && this.map.events.triggerEvent("changelayer", {
-            layer: this,
-            property: "attribution"
-        });
-    },
-    
-    /**
-     * Method: setMap
-     */
-    setMap: function() {
-        OpenLayers.Layer.XYZ.prototype.setMap.apply(this, arguments);
-        this.map.events.register("moveend", this, this.updateAttribution);
-    },
-    
-    /**
-     * APIMethod: clone
-     * 
-     * Parameters:
-     * obj - {Object}
-     * 
-     * Returns:
-     * {<OpenLayers.Layer.Bing>} An exact clone of this <OpenLayers.Layer.Bing>
-     */
-    clone: function(obj) {
-        if (obj == null) {
-            obj = new OpenLayers.Layer.Bing(this.options);
-        }
-        //get all additions from superclasses
-        obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
-        // copy/set any non-init, non-simple values here
-        return obj;
-    },
-    
-    /**
-     * Method: destroy
-     */
-    destroy: function() {
-        this.map &&
-            this.map.events.unregister("moveend", this, this.updateAttribution);
-        OpenLayers.Layer.XYZ.prototype.destroy.apply(this, arguments);
-    },
-    
-    CLASS_NAME: "OpenLayers.Layer.Bing"
-});
-
-/**
- * Function: OpenLayers.Layer.Bing.processMetadata
- * This function will be bound to an instance, linked to the global scope with
- * an id, and called by the JSONP script returned by the API.
- *
- * Parameters:
- * metadata - {Object} metadata as returned by the API
- */
-OpenLayers.Layer.Bing.processMetadata = function(metadata) {
-    this.metadata = metadata;
-    this.initLayer();
-    var script = document.getElementById(this._callbackId);
-    script.parentNode.removeChild(script);
-    window[this._callbackId] = undefined; // cannot delete from window in IE
-    delete this._callbackId;
+        return date;
+    }
 };
 /* ======================================================================
 };
 /* ======================================================================
-    OpenLayers/Handler.js
+    OpenLayers/Format/Filter/v1.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
-
 /**
 /**
- * @requires OpenLayers/BaseTypes/Class.js
- * @requires OpenLayers/Events.js
+ * @requires OpenLayers/Format/Filter.js
+ * @requires OpenLayers/Format/XML.js
+ * @requires OpenLayers/Filter/Function.js
+ * @requires OpenLayers/BaseTypes/Date.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Handler
- * Base class to construct a higher-level handler for event sequences.  All
- *     handlers have activate and deactivate methods.  In addition, they have
- *     methods named like browser events.  When a handler is activated, any
- *     additional methods named like a browser event is registered as a
- *     listener for the corresponding event.  When a handler is deactivated,
- *     those same methods are unregistered as event listeners.
+ * Class: OpenLayers.Format.Filter.v1
+ * Superclass for Filter version 1 parsers.
  *
  *
- * Handlers also typically have a callbacks object with keys named like
- *     the abstracted events or event sequences that they are in charge of
- *     handling.  The controls that wrap handlers define the methods that
- *     correspond to these abstract events - so instead of listening for
- *     individual browser events, they only listen for the abstract events
- *     defined by the handler.
- *     
- * Handlers are created by controls, which ultimately have the responsibility
- *     of making changes to the the state of the application.  Handlers
- *     themselves may make temporary changes, but in general are expected to
- *     return the application in the same state that they found it.
+ * Inherits from:
+ *  - <OpenLayers.Format.XML>
  */
  */
-OpenLayers.Handler = OpenLayers.Class({
-
-    /**
-     * Property: id
-     * {String}
-     */
-    id: null,
-        
-    /**
-     * APIProperty: control
-     * {<OpenLayers.Control>}. The control that initialized this handler.  The
-     *     control is assumed to have a valid map property - that map is used
-     *     in the handler's own setMap method.
-     */
-    control: null,
-
+OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
+    
     /**
     /**
-     * Property: map
-     * {<OpenLayers.Map>}
+     * Property: namespaces
+     * {Object} Mapping of namespace aliases to namespace URIs.
      */
      */
-    map: null,
+    namespaces: {
+        ogc: "http://www.opengis.net/ogc",
+        gml: "http://www.opengis.net/gml",
+        xlink: "http://www.w3.org/1999/xlink",
+        xsi: "http://www.w3.org/2001/XMLSchema-instance"
+    },
 
     /**
 
     /**
-     * APIProperty: keyMask
-     * {Integer} Use bitwise operators and one or more of the OpenLayers.Handler
-     *     constants to construct a keyMask.  The keyMask is used by
-     *     <checkModifiers>.  If the keyMask matches the combination of keys
-     *     down on an event, checkModifiers returns true.
-     *
-     * Example:
-     * (code)
-     *     // handler only responds if the Shift key is down
-     *     handler.keyMask = OpenLayers.Handler.MOD_SHIFT;
-     *
-     *     // handler only responds if Ctrl-Shift is down
-     *     handler.keyMask = OpenLayers.Handler.MOD_SHIFT |
-     *                       OpenLayers.Handler.MOD_CTRL;
-     * (end)
+     * Property: defaultPrefix
      */
      */
-    keyMask: null,
+    defaultPrefix: "ogc",
 
     /**
 
     /**
-     * Property: active
-     * {Boolean}
-     */
-    active: false,
-    
-    /**
-     * Property: evt
-     * {Event} This property references the last event handled by the handler.
-     *     Note that this property is not part of the stable API.  Use of the
-     *     evt property should be restricted to controls in the library
-     *     or other applications that are willing to update with changes to
-     *     the OpenLayers code.
+     * Property: schemaLocation
+     * {String} Schema location for a particular minor version.
      */
      */
-    evt: null,
+    schemaLocation: null,
     
     /**
     
     /**
-     * Property: touch
-     * {Boolean} Indicates the support of touch events. When touch events are 
-     *     started touch will be true and all mouse related listeners will do 
-     *     nothing.
-     */
-    touch: false,
-
-    /**
-     * Constructor: OpenLayers.Handler
-     * Construct a handler.
+     * Constructor: OpenLayers.Format.Filter.v1
+     * Instances of this class are not created directly.  Use the
+     *     <OpenLayers.Format.Filter> constructor instead.
      *
      * Parameters:
      *
      * Parameters:
-     * control - {<OpenLayers.Control>} The control that initialized this
-     *     handler.  The control is assumed to have a valid map property; that
-     *     map is used in the handler's own setMap method.  If a map property
-     *     is present in the options argument it will be used instead.
-     * callbacks - {Object} An object whose properties correspond to abstracted
-     *     events or sequences of browser events.  The values for these
-     *     properties are functions defined by the control that get called by
-     *     the handler.
      * options - {Object} An optional object whose properties will be set on
      * options - {Object} An optional object whose properties will be set on
-     *     the handler.
+     *     this instance.
      */
      */
-    initialize: function(control, callbacks, options) {
-        OpenLayers.Util.extend(this, options);
-        this.control = control;
-        this.callbacks = callbacks;
-
-        var map = this.map || control.map;
-        if (map) {
-            this.setMap(map); 
-        }
-        
-        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
+    initialize: function(options) {
+        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
     },
     
     /**
     },
     
     /**
-     * Method: setMap
-     */
-    setMap: function (map) {
-        this.map = map;
-    },
-
-    /**
-     * Method: checkModifiers
-     * Check the keyMask on the handler.  If no <keyMask> is set, this always
-     *     returns true.  If a <keyMask> is set and it matches the combination
-     *     of keys down on an event, this returns true.
+     * Method: read
+     *
+     * Parameters:
+     * data - {DOMElement} A Filter document element.
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} The keyMask matches the keys down on an event.
-     */
-    checkModifiers: function (evt) {
-        if(this.keyMask == null) {
-            return true;
-        }
-        /* calculate the keyboard modifier mask for this event */
-        var keyModifiers =
-            (evt.shiftKey ? OpenLayers.Handler.MOD_SHIFT : 0) |
-            (evt.ctrlKey  ? OpenLayers.Handler.MOD_CTRL  : 0) |
-            (evt.altKey   ? OpenLayers.Handler.MOD_ALT   : 0) |
-            (evt.metaKey  ? OpenLayers.Handler.MOD_META  : 0);
-    
-        /* if it differs from the handler object's key mask,
-           bail out of the event handler */
-        return (keyModifiers == this.keyMask);
-    },
-
-    /**
-     * APIMethod: activate
-     * Turn on the handler.  Returns false if the handler was already active.
-     * 
-     * Returns: 
-     * {Boolean} The handler was activated.
+     * {<OpenLayers.Filter>} A filter object.
      */
      */
-    activate: function() {
-        if(this.active) {
-            return false;
-        }
-        // register for event handlers defined on this class.
-        var events = OpenLayers.Events.prototype.BROWSER_EVENTS;
-        for (var i=0, len=events.length; i<len; i++) {
-            if (this[events[i]]) {
-                this.register(events[i], this[events[i]]); 
-            }
-        } 
-        this.active = true;
-        return true;
+    read: function(data) {
+        var obj = {};
+        this.readers.ogc["Filter"].apply(this, [data, obj]);
+        return obj.filter;
     },
     
     /**
     },
     
     /**
-     * APIMethod: deactivate
-     * Turn off the handler.  Returns false if the handler was already inactive.
-     * 
-     * Returns:
-     * {Boolean} The handler was deactivated.
+     * Property: readers
+     * Contains public functions, grouped by namespace prefix, that will
+     *     be applied when a namespaced node is found matching the function
+     *     name.  The function will be applied in the scope of this parser
+     *     with two arguments: the node being read and a context object passed
+     *     from the parent.
      */
      */
-    deactivate: function() {
-        if(!this.active) {
-            return false;
-        }
-        // unregister event handlers defined on this class.
-        var events = OpenLayers.Events.prototype.BROWSER_EVENTS;
-        for (var i=0, len=events.length; i<len; i++) {
-            if (this[events[i]]) {
-                this.unregister(events[i], this[events[i]]); 
+    readers: {
+        "ogc": {
+            "_expression": function(node) {
+                // only the simplest of ogc:expression handled
+                // "some text and an <PropertyName>attribute</PropertyName>"}
+                var obj, value = "";
+                for(var child=node.firstChild; child; child=child.nextSibling) {
+                    switch(child.nodeType) {
+                        case 1:
+                            obj = this.readNode(child);
+                            if (obj.property) {
+                                value += "${" + obj.property + "}";
+                            } else if (obj.value !== undefined) {
+                                value += obj.value;
+                            }
+                            break;
+                        case 3: // text node
+                        case 4: // cdata section
+                            value += child.nodeValue;
+                    }
+                }
+                return value;
+            },
+            "Filter": function(node, parent) {
+                // Filters correspond to subclasses of OpenLayers.Filter.
+                // Since they contain information we don't persist, we
+                // create a temporary object and then pass on the filter
+                // (ogc:Filter) to the parent obj.
+                var obj = {
+                    fids: [],
+                    filters: []
+                };
+                this.readChildNodes(node, obj);
+                if(obj.fids.length > 0) {
+                    parent.filter = new OpenLayers.Filter.FeatureId({
+                        fids: obj.fids
+                    });
+                } else if(obj.filters.length > 0) {
+                    parent.filter = obj.filters[0];
+                }
+            },
+            "FeatureId": function(node, obj) {
+                var fid = node.getAttribute("fid");
+                if(fid) {
+                    obj.fids.push(fid);
+                }
+            },
+            "And": function(node, obj) {
+                var filter = new OpenLayers.Filter.Logical({
+                    type: OpenLayers.Filter.Logical.AND
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "Or": function(node, obj) {
+                var filter = new OpenLayers.Filter.Logical({
+                    type: OpenLayers.Filter.Logical.OR
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "Not": function(node, obj) {
+                var filter = new OpenLayers.Filter.Logical({
+                    type: OpenLayers.Filter.Logical.NOT
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "PropertyIsLessThan": function(node, obj) {
+                var filter = new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.LESS_THAN
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "PropertyIsGreaterThan": function(node, obj) {
+                var filter = new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.GREATER_THAN
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "PropertyIsLessThanOrEqualTo": function(node, obj) {
+                var filter = new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "PropertyIsGreaterThanOrEqualTo": function(node, obj) {
+                var filter = new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "PropertyIsBetween": function(node, obj) {
+                var filter = new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.BETWEEN
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "Literal": function(node, obj) {
+                obj.value = OpenLayers.String.numericIf(
+                    this.getChildValue(node), true);
+            },
+            "PropertyName": function(node, filter) {
+                filter.property = this.getChildValue(node);
+            },
+            "LowerBoundary": function(node, filter) {
+                filter.lowerBoundary = OpenLayers.String.numericIf(
+                    this.readers.ogc._expression.call(this, node), true);
+            },
+            "UpperBoundary": function(node, filter) {
+                filter.upperBoundary = OpenLayers.String.numericIf(
+                    this.readers.ogc._expression.call(this, node), true);
+            },
+            "Intersects": function(node, obj) {
+                this.readSpatial(node, obj, OpenLayers.Filter.Spatial.INTERSECTS);
+            },
+            "Within": function(node, obj) {
+                this.readSpatial(node, obj, OpenLayers.Filter.Spatial.WITHIN);
+            },
+            "Contains": function(node, obj) {
+                this.readSpatial(node, obj, OpenLayers.Filter.Spatial.CONTAINS);
+            },
+            "DWithin": function(node, obj) {
+                this.readSpatial(node, obj, OpenLayers.Filter.Spatial.DWITHIN);
+            },
+            "Distance": function(node, obj) {
+                obj.distance = parseInt(this.getChildValue(node));
+                obj.distanceUnits = node.getAttribute("units");
+            },
+            "Function": function(node, obj) {
+                //TODO write decoder for it
+                return;
+            },
+            "PropertyIsNull": function(node, obj) {
+                var filter = new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.IS_NULL
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
             }
             }
-        } 
-        this.touch = false;
-        this.active = false;
-        return true;
+        }
     },
     },
-
+    
     /**
     /**
-     * Method: startTouch
-     * Start touch events, this method must be called by subclasses in 
-     *     "touchstart" method. When touch events are started <touch> will be
-     *     true and all mouse related listeners will do nothing.
+     * Method: readSpatial
+     *
+     * Read a {<OpenLayers.Filter.Spatial>} filter.
+     * 
+     * Parameters:
+     * node - {DOMElement} A DOM element that contains an ogc:expression.
+     * obj - {Object} The target object.
+     * type - {String} One of the OpenLayers.Filter.Spatial.* constants.
+     *
+     * Returns:
+     * {<OpenLayers.Filter.Spatial>} The created filter.
      */
      */
-    startTouch: function() {
-        if (!this.touch) {
-            this.touch = true;
-            var events = [
-                "mousedown", "mouseup", "mousemove", "click", "dblclick",
-                "mouseout"
-            ];
-            for (var i=0, len=events.length; i<len; i++) {
-                if (this[events[i]]) {
-                    this.unregister(events[i], this[events[i]]); 
-                }
-            } 
-        }
+    readSpatial: function(node, obj, type) {
+        var filter = new OpenLayers.Filter.Spatial({
+            type: type
+        });
+        this.readChildNodes(node, filter);
+        filter.value = filter.components[0];
+        delete filter.components;
+        obj.filters.push(filter);
     },
 
     /**
     },
 
     /**
-    * Method: callback
-    * Trigger the control's named callback with the given arguments
-    *
-    * Parameters:
-    * name - {String} The key for the callback that is one of the properties
-    *     of the handler's callbacks object.
-    * args - {Array(*)} An array of arguments (any type) with which to call 
-    *     the callback (defined by the control).
-    */
-    callback: function (name, args) {
-        if (name && this.callbacks[name]) {
-            this.callbacks[name].apply(this.control, args);
+     * APIMethod: encodeLiteral
+     * Generates the string representation of a value for use in <Literal> 
+     *     elements.  The default encoder writes Date values as ISO 8601 
+     *     strings.
+     *
+     * Parameters:
+     * value - {Object} Literal value to encode
+     *
+     * Returns:
+     * {String} String representation of the provided value.
+     */
+    encodeLiteral: function(value) {
+        if (value instanceof Date) {
+            value = OpenLayers.Date.toISOString(value);
         }
         }
+        return value;
     },
 
     /**
     },
 
     /**
-    * Method: register
-    * register an event on the map
-    */
-    register: function (name, method) {
-        // TODO: deal with registerPriority in 3.0
-        this.map.events.registerPriority(name, this, method);
-        this.map.events.registerPriority(name, this, this.setEvent);
-    },
-
-    /**
-    * Method: unregister
-    * unregister an event from the map
-    */
-    unregister: function (name, method) {
-        this.map.events.unregister(name, this, method);   
-        this.map.events.unregister(name, this, this.setEvent);
-    },
+     * Method: writeOgcExpression
+     * Limited support for writing OGC expressions. Currently it supports
+     * (<OpenLayers.Filter.Function> || String || Number)
+     *
+     * Parameters:
+     * value - (<OpenLayers.Filter.Function> || String || Number)
+     * node - {DOMElement} A parent DOM element 
+     *
+     * Returns:
+     * {DOMElement} Updated node element.
+     */
+    writeOgcExpression: function(value, node) {
+        if (value instanceof OpenLayers.Filter.Function){
+            this.writeNode("Function", value, node);
+        } else {
+            this.writeNode("Literal", value, node);
+        }
+        return node;
+    },    
     
     /**
     
     /**
-     * Method: setEvent
-     * With each registered browser event, the handler sets its own evt
-     *     property.  This property can be accessed by controls if needed
-     *     to get more information about the event that the handler is
-     *     processing.
-     *
-     * This allows modifier keys on the event to be checked (alt, shift, ctrl,
-     *     and meta cannot be checked with the keyboard handler).  For a
-     *     control to determine which modifier keys are associated with the
-     *     event that a handler is currently processing, it should access
-     *     (code)handler.evt.altKey || handler.evt.shiftKey ||
-     *     handler.evt.ctrlKey || handler.evt.metaKey(end).
+     * Method: write
      *
      * Parameters:
      *
      * Parameters:
-     * evt - {Event} The browser event.
+     * filter - {<OpenLayers.Filter>} A filter object.
+     *
+     * Returns:
+     * {DOMElement} An ogc:Filter element.
      */
      */
-    setEvent: function(evt) {
-        this.evt = evt;
-        return true;
+    write: function(filter) {
+        return this.writers.ogc["Filter"].apply(this, [filter]);
+    },
+    
+    /**
+     * Property: writers
+     * As a compliment to the readers property, this structure contains public
+     *     writing functions grouped by namespace alias and named like the
+     *     node names they produce.
+     */
+    writers: {
+        "ogc": {
+            "Filter": function(filter) {
+                var node = this.createElementNSPlus("ogc:Filter");
+                this.writeNode(this.getFilterType(filter), filter, node);
+                return node;
+            },
+            "_featureIds": function(filter) {
+                var node = this.createDocumentFragment();
+                for (var i=0, ii=filter.fids.length; i<ii; ++i) {
+                    this.writeNode("ogc:FeatureId", filter.fids[i], node);
+                }
+                return node;
+            },
+            "FeatureId": function(fid) {
+                return this.createElementNSPlus("ogc:FeatureId", {
+                    attributes: {fid: fid}
+                });
+            },
+            "And": function(filter) {
+                var node = this.createElementNSPlus("ogc:And");
+                var childFilter;
+                for (var i=0, ii=filter.filters.length; i<ii; ++i) {
+                    childFilter = filter.filters[i];
+                    this.writeNode(
+                        this.getFilterType(childFilter), childFilter, node
+                    );
+                }
+                return node;
+            },
+            "Or": function(filter) {
+                var node = this.createElementNSPlus("ogc:Or");
+                var childFilter;
+                for (var i=0, ii=filter.filters.length; i<ii; ++i) {
+                    childFilter = filter.filters[i];
+                    this.writeNode(
+                        this.getFilterType(childFilter), childFilter, node
+                    );
+                }
+                return node;
+            },
+            "Not": function(filter) {
+                var node = this.createElementNSPlus("ogc:Not");
+                var childFilter = filter.filters[0];
+                this.writeNode(
+                    this.getFilterType(childFilter), childFilter, node
+                );
+                return node;
+            },
+            "PropertyIsLessThan": function(filter) {
+                var node = this.createElementNSPlus("ogc:PropertyIsLessThan");
+                // no ogc:expression handling for PropertyName for now
+                this.writeNode("PropertyName", filter, node);
+                // handle Literals or Functions for now
+                this.writeOgcExpression(filter.value, node);
+                return node;
+            },
+            "PropertyIsGreaterThan": function(filter) {
+                var node = this.createElementNSPlus("ogc:PropertyIsGreaterThan");
+                // no ogc:expression handling for PropertyName for now
+                this.writeNode("PropertyName", filter, node);
+                // handle Literals or Functions for now
+                this.writeOgcExpression(filter.value, node);
+                return node;
+            },
+            "PropertyIsLessThanOrEqualTo": function(filter) {
+                var node = this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");
+                // no ogc:expression handling for PropertyName for now
+                this.writeNode("PropertyName", filter, node);
+                // handle Literals or Functions for now
+                this.writeOgcExpression(filter.value, node);
+                return node;
+            },
+            "PropertyIsGreaterThanOrEqualTo": function(filter) {
+                var node = this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");
+                // no ogc:expression handling for PropertyName for now
+                this.writeNode("PropertyName", filter, node);
+                // handle Literals or Functions for now
+                this.writeOgcExpression(filter.value, node);
+                return node;
+            },
+            "PropertyIsBetween": function(filter) {
+                var node = this.createElementNSPlus("ogc:PropertyIsBetween");
+                // no ogc:expression handling for PropertyName for now
+                this.writeNode("PropertyName", filter, node);
+                this.writeNode("LowerBoundary", filter, node);
+                this.writeNode("UpperBoundary", filter, node);
+                return node;
+            },
+            "PropertyName": function(filter) {
+                // no ogc:expression handling for now
+                return this.createElementNSPlus("ogc:PropertyName", {
+                    value: filter.property
+                });
+            },
+            "Literal": function(value) {
+                var encode = this.encodeLiteral ||
+                    OpenLayers.Format.Filter.v1.prototype.encodeLiteral;
+                return this.createElementNSPlus("ogc:Literal", {
+                    value: encode(value)
+                });
+            },
+            "LowerBoundary": function(filter) {
+                // handle Literals or Functions for now
+                var node = this.createElementNSPlus("ogc:LowerBoundary");
+                this.writeOgcExpression(filter.lowerBoundary, node);
+                return node;
+            },
+            "UpperBoundary": function(filter) {
+                // handle Literals or Functions for now
+                var node = this.createElementNSPlus("ogc:UpperBoundary");
+                this.writeNode("Literal", filter.upperBoundary, node);
+                return node;
+            },
+            "INTERSECTS": function(filter) {
+                return this.writeSpatial(filter, "Intersects");
+            },
+            "WITHIN": function(filter) {
+                return this.writeSpatial(filter, "Within");
+            },
+            "CONTAINS": function(filter) {
+                return this.writeSpatial(filter, "Contains");
+            },
+            "DWITHIN": function(filter) {
+                var node = this.writeSpatial(filter, "DWithin");
+                this.writeNode("Distance", filter, node);
+                return node;
+            },
+            "Distance": function(filter) {
+                return this.createElementNSPlus("ogc:Distance", {
+                    attributes: {
+                        units: filter.distanceUnits
+                    },
+                    value: filter.distance
+                });
+            },
+            "Function": function(filter) {
+                var node = this.createElementNSPlus("ogc:Function", {
+                    attributes: {
+                        name: filter.name
+                    }
+                });
+                var params = filter.params;
+                for(var i=0, len=params.length; i<len; i++){
+                    this.writeOgcExpression(params[i], node);
+                }
+                return node;
+            },
+            "PropertyIsNull": function(filter) {
+                var node = this.createElementNSPlus("ogc:PropertyIsNull");
+                this.writeNode("PropertyName", filter, node);
+                return node;
+            }
+        }
     },
 
     /**
     },
 
     /**
-     * Method: destroy
-     * Deconstruct the handler.
+     * Method: getFilterType
      */
      */
-    destroy: function () {
-        // unregister event listeners
-        this.deactivate();
-        // eliminate circular references
-        this.control = this.map = null;        
+    getFilterType: function(filter) {
+        var filterType = this.filterMap[filter.type];
+        if(!filterType) {
+            throw "Filter writing not supported for rule type: " + filter.type;
+        }
+        return filterType;
+    },
+    
+    /**
+     * Property: filterMap
+     * {Object} Contains a member for each filter type.  Values are node names
+     *     for corresponding OGC Filter child elements.
+     */
+    filterMap: {
+        "&&": "And",
+        "||": "Or",
+        "!": "Not",
+        "==": "PropertyIsEqualTo",
+        "!=": "PropertyIsNotEqualTo",
+        "<": "PropertyIsLessThan",
+        ">": "PropertyIsGreaterThan",
+        "<=": "PropertyIsLessThanOrEqualTo",
+        ">=": "PropertyIsGreaterThanOrEqualTo",
+        "..": "PropertyIsBetween",
+        "~": "PropertyIsLike",
+        "NULL": "PropertyIsNull",
+        "BBOX": "BBOX",
+        "DWITHIN": "DWITHIN",
+        "WITHIN": "WITHIN",
+        "CONTAINS": "CONTAINS",
+        "INTERSECTS": "INTERSECTS",
+        "FID": "_featureIds"
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Handler"
-});
+    CLASS_NAME: "OpenLayers.Format.Filter.v1" 
 
 
-/**
- * Constant: OpenLayers.Handler.MOD_NONE
- * If set as the <keyMask>, <checkModifiers> returns false if any key is down.
- */
-OpenLayers.Handler.MOD_NONE  = 0;
+});
+/* ======================================================================
+    OpenLayers/Format/Filter/v1_0_0.js
+   ====================================================================== */
 
 
-/**
- * Constant: OpenLayers.Handler.MOD_SHIFT
- * If set as the <keyMask>, <checkModifiers> returns false if Shift is down.
- */
-OpenLayers.Handler.MOD_SHIFT = 1;
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
 
 /**
 
 /**
- * Constant: OpenLayers.Handler.MOD_CTRL
- * If set as the <keyMask>, <checkModifiers> returns false if Ctrl is down.
+ * @requires OpenLayers/Format/GML/v2.js
+ * @requires OpenLayers/Format/Filter/v1.js
  */
  */
-OpenLayers.Handler.MOD_CTRL  = 2;
 
 /**
 
 /**
- * Constant: OpenLayers.Handler.MOD_ALT
- * If set as the <keyMask>, <checkModifiers> returns false if Alt is down.
+ * Class: OpenLayers.Format.Filter.v1_0_0
+ * Write ogc:Filter version 1.0.0.
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Format.GML.v2>
+ *  - <OpenLayers.Format.Filter.v1>
  */
  */
-OpenLayers.Handler.MOD_ALT   = 4;
-
-/**
- * Constant: OpenLayers.Handler.MOD_META
- * If set as the <keyMask>, <checkModifiers> returns false if Cmd is down.
- */
-OpenLayers.Handler.MOD_META  = 8;
-
-
-/* ======================================================================
-    OpenLayers/Handler/MouseWheel.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Handler.js
- */
-
-/**
- * Class: OpenLayers.Handler.MouseWheel
- * Handler for wheel up/down events.
- * 
- * Inherits from:
- *  - <OpenLayers.Handler>
- */
-OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
-    /** 
-     * Property: wheelListener 
-     * {function} 
-     */
-    wheelListener: null,
-
-    /**
-     * Property: interval
-     * {Integer} In order to increase server performance, an interval (in 
-     *     milliseconds) can be set to reduce the number of up/down events 
-     *     called. If set, a new up/down event will not be set until the 
-     *     interval has passed. 
-     *     Defaults to 0, meaning no interval. 
-     */
-    interval: 0,
-    
-    /**
-     * Property: maxDelta
-     * {Integer} Maximum delta to collect before breaking from the current
-     *    interval. In cumulative mode, this also limits the maximum delta
-     *    returned from the handler. Default is Number.POSITIVE_INFINITY.
-     */
-    maxDelta: Number.POSITIVE_INFINITY,
+OpenLayers.Format.Filter.v1_0_0 = OpenLayers.Class(
+    OpenLayers.Format.GML.v2, OpenLayers.Format.Filter.v1, {
     
     /**
     
     /**
-     * Property: delta
-     * {Integer} When interval is set, delta collects the mousewheel z-deltas
-     *     of the events that occur within the interval.
-     *      See also the cumulative option
+     * Constant: VERSION
+     * {String} 1.0.0
      */
      */
-    delta: 0,
+    VERSION: "1.0.0",
     
     /**
     
     /**
-     * Property: cumulative
-     * {Boolean} When interval is set: true to collect all the mousewheel 
-     *     z-deltas, false to only record the delta direction (positive or
-     *     negative)
+     * Property: schemaLocation
+     * {String} http://www.opengis.net/ogc/filter/1.0.0/filter.xsd
      */
      */
-    cumulative: true,
-    
+    schemaLocation: "http://www.opengis.net/ogc/filter/1.0.0/filter.xsd",
+
     /**
     /**
-     * Constructor: OpenLayers.Handler.MouseWheel
+     * Constructor: OpenLayers.Format.Filter.v1_0_0
+     * Instances of this class are not created directly.  Use the
+     *     <OpenLayers.Format.Filter> constructor instead.
      *
      * Parameters:
      *
      * Parameters:
-     * control - {<OpenLayers.Control>} 
-     * callbacks - {Object} An object containing a single function to be
-     *                          called when the drag operation is finished.
-     *                          The callback should expect to recieve a single
-     *                          argument, the point geometry.
-     * options - {Object} 
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
      */
      */
-    initialize: function(control, callbacks, options) {
-        OpenLayers.Handler.prototype.initialize.apply(this, arguments);
-        this.wheelListener = OpenLayers.Function.bindAsEventListener(
-            this.onWheelEvent, this
+    initialize: function(options) {
+        OpenLayers.Format.GML.v2.prototype.initialize.apply(
+            this, [options]
         );
     },
 
     /**
         );
     },
 
     /**
-     * Method: destroy
-     */    
-    destroy: function() {
-        OpenLayers.Handler.prototype.destroy.apply(this, arguments);
-        this.wheelListener = null;
+     * Property: readers
+     * Contains public functions, grouped by namespace prefix, that will
+     *     be applied when a namespaced node is found matching the function
+     *     name.  The function will be applied in the scope of this parser
+     *     with two arguments: the node being read and a context object passed
+     *     from the parent.
+     */
+    readers: {
+        "ogc": OpenLayers.Util.applyDefaults({
+            "PropertyIsEqualTo": function(node, obj) {
+                var filter = new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.EQUAL_TO
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "PropertyIsNotEqualTo": function(node, obj) {
+                var filter = new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO
+                });
+                this.readChildNodes(node, filter);
+                obj.filters.push(filter);
+            },
+            "PropertyIsLike": function(node, obj) {
+                var filter = new OpenLayers.Filter.Comparison({
+                    type: OpenLayers.Filter.Comparison.LIKE
+                });
+                this.readChildNodes(node, filter);
+                var wildCard = node.getAttribute("wildCard");
+                var singleChar = node.getAttribute("singleChar");
+                var esc = node.getAttribute("escape");
+                filter.value2regex(wildCard, singleChar, esc);
+                obj.filters.push(filter);
+            }
+        }, OpenLayers.Format.Filter.v1.prototype.readers["ogc"]),
+        "gml": OpenLayers.Format.GML.v2.prototype.readers["gml"],
+        "feature": OpenLayers.Format.GML.v2.prototype.readers["feature"]        
     },
 
     /**
     },
 
     /**
-     *  Mouse ScrollWheel code thanks to http://adomas.org/javascript-mouse-wheel/
-     */
-
-    /** 
-     * Method: onWheelEvent
-     * Catch the wheel event and handle it xbrowserly
-     * 
-     * Parameters:
-     * e - {Event} 
+     * Property: writers
+     * As a compliment to the readers property, this structure contains public
+     *     writing functions grouped by namespace alias and named like the
+     *     node names they produce.
      */
      */
-    onWheelEvent: function(e){
-        
-        // make sure we have a map and check keyboard modifiers
-        if (!this.map || !this.checkModifiers(e)) {
-            return;
-        }
-        
-        // Ride up the element's DOM hierarchy to determine if it or any of 
-        //  its ancestors was: 
-        //   * specifically marked as scrollable (CSS overflow property)
-        //   * one of our layer divs or a div marked as scrollable
-        //     ('olScrollable' CSS class)
-        //   * the map div
-        //
-        var overScrollableDiv = false;
-        var allowScroll = false;
-        var overMapDiv = false;
-        
-        var elem = OpenLayers.Event.element(e);
-        while((elem != null) && !overMapDiv && !overScrollableDiv) {
-
-            if (!overScrollableDiv) {
-                try {
-                    var overflow;
-                    if (elem.currentStyle) {
-                        overflow = elem.currentStyle["overflow"];
-                    } else {
-                        var style = 
-                            document.defaultView.getComputedStyle(elem, null);
-                        overflow = style.getPropertyValue("overflow");
-                    }
-                    overScrollableDiv = ( overflow && 
-                        (overflow == "auto") || (overflow == "scroll") );
-                } catch(err) {
-                    //sometimes when scrolling in a popup, this causes 
-                    // obscure browser error
-                }
-            }
-
-            if (!allowScroll) {
-                allowScroll = OpenLayers.Element.hasClass(elem, 'olScrollable');
-                if (!allowScroll) {
-                    for (var i = 0, len = this.map.layers.length; i < len; i++) {
-                        // Are we in the layer div? Note that we have two cases
-                        // here: one is to catch EventPane layers, which have a
-                        // pane above the layer (layer.pane)
-                        var layer = this.map.layers[i];
-                        if (elem == layer.div || elem == layer.pane) {
-                            allowScroll = true;
-                            break;
-                        }
-                    }
-                }
-            }
-            overMapDiv = (elem == this.map.div);
-
-            elem = elem.parentNode;
-        }
-        
-        // Logic below is the following:
-        //
-        // If we are over a scrollable div or not over the map div:
-        //  * do nothing (let the browser handle scrolling)
-        //
-        //    otherwise 
-        // 
-        //    If we are over the layer div or a 'olScrollable' div:
-        //     * zoom/in out
-        //     then
-        //     * kill event (so as not to also scroll the page after zooming)
-        //
-        //       otherwise
-        //
-        //       Kill the event (dont scroll the page if we wheel over the 
-        //        layerswitcher or the pan/zoom control)
-        //
-        if (!overScrollableDiv && overMapDiv) {
-            if (allowScroll) {
-                var delta = 0;
-                
-                if (e.wheelDelta) {
-                    delta = e.wheelDelta;
-                    if (delta % 160 === 0) {
-                        // opera have steps of 160 instead of 120
-                        delta = delta * 0.75;
+    writers: {
+        "ogc": OpenLayers.Util.applyDefaults({
+            "PropertyIsEqualTo": function(filter) {
+                var node = this.createElementNSPlus("ogc:PropertyIsEqualTo");
+                // no ogc:expression handling for PropertyName for now
+                this.writeNode("PropertyName", filter, node);
+                // handle Literals or Functions for now
+                this.writeOgcExpression(filter.value, node);
+                return node;
+            },
+            "PropertyIsNotEqualTo": function(filter) {
+                var node = this.createElementNSPlus("ogc:PropertyIsNotEqualTo");
+                // no ogc:expression handling for PropertyName for now
+                this.writeNode("PropertyName", filter, node);
+                // handle Literals or Functions for now
+                this.writeOgcExpression(filter.value, node);
+                return node;
+            },
+            "PropertyIsLike": function(filter) {
+                var node = this.createElementNSPlus("ogc:PropertyIsLike", {
+                    attributes: {
+                        wildCard: "*", singleChar: ".", escape: "!"
                     }
                     }
-                    delta = delta / 120;
-                } else if (e.detail) {
-                    // detail in Firefox on OS X is 1/3 of Windows
-                    // so force delta 1 / -1
-                    delta = - (e.detail / Math.abs(e.detail));
-                }
-                this.delta += delta;
-
-                window.clearTimeout(this._timeoutId);
-                if(this.interval && Math.abs(this.delta) < this.maxDelta) {
-                    // store e because window.event might change during delay
-                    var evt = OpenLayers.Util.extend({}, e);
-                    this._timeoutId = window.setTimeout(
-                        OpenLayers.Function.bind(function(){
-                            this.wheelZoom(evt);
-                        }, this),
-                        this.interval
-                    );
-                } else {
-                    this.wheelZoom(e);
+                });
+                // no ogc:expression handling for now
+                this.writeNode("PropertyName", filter, node);
+                // convert regex string to ogc string
+                this.writeNode("Literal", filter.regex2value(), node);
+                return node;
+            },
+            "BBOX": function(filter) {
+                var node = this.createElementNSPlus("ogc:BBOX");
+                // PropertyName is mandatory in 1.0.0, but e.g. GeoServer also
+                // accepts filters without it. When this is used with
+                // OpenLayers.Protocol.WFS, OpenLayers.Format.WFST will set a
+                // missing filter.property to the geometryName that is
+                // configured with the protocol, which defaults to "the_geom".
+                // So the only way to omit this mandatory property is to not
+                // set the property on the filter and to set the geometryName
+                // on the WFS protocol to null. The latter also happens when
+                // the protocol is configured without a geometryName and a
+                // featureNS.
+                filter.property && this.writeNode("PropertyName", filter, node);
+                var box = this.writeNode("gml:Box", filter.value, node);
+                if(filter.projection) {
+                    box.setAttribute("srsName", filter.projection);
                 }
                 }
+                return node;
             }
             }
-            OpenLayers.Event.stop(e);
-        }
+        }, OpenLayers.Format.Filter.v1.prototype.writers["ogc"]),
+        "gml": OpenLayers.Format.GML.v2.prototype.writers["gml"],
+        "feature": OpenLayers.Format.GML.v2.prototype.writers["feature"]
     },
 
     /**
     },
 
     /**
-     * Method: wheelZoom
-     * Given the wheel event, we carry out the appropriate zooming in or out,
-     *     based on the 'wheelDelta' or 'detail' property of the event.
-     * 
+     * Method: writeSpatial
+     *
+     * Read a {<OpenLayers.Filter.Spatial>} filter and converts it into XML.
+     *
      * Parameters:
      * Parameters:
-     * e - {Event}
-     */
-    wheelZoom: function(e) {
-        var delta = this.delta;
-        this.delta = 0;
-        
-        if (delta) {
-            e.xy = this.map.events.getMousePosition(e);
-            if (delta < 0) {
-                this.callback("down",
-                    [e, this.cumulative ? Math.max(-this.maxDelta, delta) : -1]);
-            } else {
-                this.callback("up",
-                    [e, this.cumulative ? Math.min(this.maxDelta, delta) : 1]);
-            }
-        }
-    },
-    
-    /**
-     * Method: activate 
+     * filter - {<OpenLayers.Filter.Spatial>} The filter.
+     * name - {String} Name of the generated XML element.
+     *
+     * Returns:
+     * {DOMElement} The created XML element.
      */
      */
-    activate: function (evt) {
-        if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
-            //register mousewheel events specifically on the window and document
-            var wheelListener = this.wheelListener;
-            OpenLayers.Event.observe(window, "DOMMouseScroll", wheelListener);
-            OpenLayers.Event.observe(window, "mousewheel", wheelListener);
-            OpenLayers.Event.observe(document, "mousewheel", wheelListener);
-            return true;
+    writeSpatial: function(filter, name) {
+        var node = this.createElementNSPlus("ogc:"+name);
+        this.writeNode("PropertyName", filter, node);
+        if(filter.value instanceof OpenLayers.Filter.Function) {
+            this.writeNode("Function", filter.value, node);
         } else {
         } else {
-            return false;
-        }
-    },
-
-    /**
-     * Method: deactivate 
-     */
-    deactivate: function (evt) {
-        if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
-            // unregister mousewheel events specifically on the window and document
-            var wheelListener = this.wheelListener;
-            OpenLayers.Event.stopObserving(window, "DOMMouseScroll", wheelListener);
-            OpenLayers.Event.stopObserving(window, "mousewheel", wheelListener);
-            OpenLayers.Event.stopObserving(document, "mousewheel", wheelListener);
-            return true;
+        var child;
+        if(filter.value instanceof OpenLayers.Geometry) {
+            child = this.writeNode("feature:_geometry", filter.value).firstChild;
         } else {
         } else {
-            return false;
+            child = this.writeNode("gml:Box", filter.value);
+        }
+        if(filter.projection) {
+            child.setAttribute("srsName", filter.projection);
         }
         }
+        node.appendChild(child);
+        }
+        return node;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Handler.MouseWheel"
+
+    CLASS_NAME: "OpenLayers.Format.Filter.v1_0_0" 
+
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Geometry/MultiLineString.js
+    OpenLayers/Format/WFST/v1_0_0.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Geometry/Collection.js
- * @requires OpenLayers/Geometry/LineString.js
+ * @requires OpenLayers/Format/WFST/v1.js
+ * @requires OpenLayers/Format/Filter/v1_0_0.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Geometry.MultiLineString
- * A MultiLineString is a geometry with multiple <OpenLayers.Geometry.LineString>
- * components.
- * 
+ * Class: OpenLayers.Format.WFST.v1_0_0
+ * A format for creating WFS v1.0.0 transactions.  Create a new instance with the
+ *     <OpenLayers.Format.WFST.v1_0_0> constructor.
+ *
  * Inherits from:
  * Inherits from:
- *  - <OpenLayers.Geometry.Collection>
- *  - <OpenLayers.Geometry> 
+ *  - <OpenLayers.Format.Filter.v1_0_0>
+ *  - <OpenLayers.Format.WFST.v1>
  */
  */
-OpenLayers.Geometry.MultiLineString = OpenLayers.Class(
-  OpenLayers.Geometry.Collection, {
+OpenLayers.Format.WFST.v1_0_0 = OpenLayers.Class(
+    OpenLayers.Format.Filter.v1_0_0, OpenLayers.Format.WFST.v1, {
 
     /**
 
     /**
-     * Property: componentTypes
-     * {Array(String)} An array of class names representing the types of
-     * components that the collection can include.  A null value means the
-     * component types are not restricted.
+     * Property: version
+     * {String} WFS version number.
      */
      */
-    componentTypes: ["OpenLayers.Geometry.LineString"],
+    version: "1.0.0",
 
     /**
 
     /**
-     * Constructor: OpenLayers.Geometry.MultiLineString
-     * Constructor for a MultiLineString Geometry.
+     * APIProperty: srsNameInQuery
+     * {Boolean} If true the reference system is passed in Query requests
+     *     via the "srsName" attribute to the "wfs:Query" element, this
+     *     property defaults to false as it isn't WFS 1.0.0 compliant.
+     */
+    srsNameInQuery: false,
+
+    /**
+     * Property: schemaLocations
+     * {Object} Properties are namespace aliases, values are schema locations.
+     */
+    schemaLocations: {
+        "wfs": "http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"
+    },
+
+    /**
+     * Constructor: OpenLayers.Format.WFST.v1_0_0
+     * A class for parsing and generating WFS v1.0.0 transactions.
      *
      *
-     * Parameters: 
-     * components - {Array(<OpenLayers.Geometry.LineString>)} 
+     * Parameters:
+     * options - {Object} Optional object whose properties will be set on the
+     *     instance.
      *
      *
+     * Valid options properties:
+     * featureType - {String} Local (without prefix) feature typeName (required).
+     * featureNS - {String} Feature namespace (optional).
+     * featurePrefix - {String} Feature namespace alias (optional - only used
+     *     if featureNS is provided).  Default is 'feature'.
+     * geometryName - {String} Name of geometry attribute.  Default is 'the_geom'.
      */
      */
-    
+    initialize: function(options) {
+        OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this, [options]);
+        OpenLayers.Format.WFST.v1.prototype.initialize.apply(this, [options]);
+    },
+
     /**
     /**
-     * Method: split
-     * Use this geometry (the source) to attempt to split a target geometry.
-     * 
+     * Method: readNode
+     * Shorthand for applying one of the named readers given the node
+     *     namespace and local name.  Readers take two args (node, obj) and
+     *     generally extend or modify the second.
+     *
      * Parameters:
      * Parameters:
-     * geometry - {<OpenLayers.Geometry>} The target geometry.
-     * options - {Object} Properties of this object will be used to determine
-     *     how the split is conducted.
+     * node - {DOMElement} The node to be read (required).
+     * obj - {Object} The object to be modified (optional).
+     * first - {Boolean} Should be set to true for the first node read. This
+     *     is usually the readNode call in the read method. Without this being
+     *     set, auto-configured properties will stick on subsequent reads.
      *
      *
-     * Valid options:
-     * mutual - {Boolean} Split the source geometry in addition to the target
-     *     geometry.  Default is false.
-     * edge - {Boolean} Allow splitting when only edges intersect.  Default is
-     *     true.  If false, a vertex on the source must be within the tolerance
-     *     distance of the intersection to be considered a split.
-     * tolerance - {Number} If a non-null value is provided, intersections
-     *     within the tolerance distance of an existing vertex on the source
-     *     will be assumed to occur at the vertex.
-     * 
      * Returns:
      * Returns:
-     * {Array} A list of geometries (of this same type as the target) that
-     *     result from splitting the target with the source geometry.  The
-     *     source and target geometry will remain unmodified.  If no split
-     *     results, null will be returned.  If mutual is true and a split
-     *     results, return will be an array of two arrays - the first will be
-     *     all geometries that result from splitting the source geometry and
-     *     the second will be all geometries that result from splitting the
-     *     target geometry.
+     * {Object} The input object, modified (or a new one if none was provided).
      */
      */
-    split: function(geometry, options) {
-        var results = null;
-        var mutual = options && options.mutual;
-        var splits, sourceLine, sourceLines, sourceSplit, targetSplit;
-        var sourceParts = [];
-        var targetParts = [geometry];
-        for(var i=0, len=this.components.length; i<len; ++i) {
-            sourceLine = this.components[i];
-            sourceSplit = false;
-            for(var j=0; j < targetParts.length; ++j) { 
-                splits = sourceLine.split(targetParts[j], options);
-                if(splits) {
-                    if(mutual) {
-                        sourceLines = splits[0];
-                        for(var k=0, klen=sourceLines.length; k<klen; ++k) {
-                            if(k===0 && sourceParts.length) {
-                                sourceParts[sourceParts.length-1].addComponent(
-                                    sourceLines[k]
-                                );
-                            } else {
-                                sourceParts.push(
-                                    new OpenLayers.Geometry.MultiLineString([
-                                        sourceLines[k]
-                                    ])
-                                );
-                            }
-                        }
-                        sourceSplit = true;
-                        splits = splits[1];
-                    }
-                    if(splits.length) {
-                        // splice in new target parts
-                        splits.unshift(j, 1);
-                        Array.prototype.splice.apply(targetParts, splits);
-                        break;
-                    }
-                }
-            }
-            if(!sourceSplit) {
-                // source line was not hit
-                if(sourceParts.length) {
-                    // add line to existing multi
-                    sourceParts[sourceParts.length-1].addComponent(
-                        sourceLine.clone()
-                    );
-                } else {
-                    // create a fresh multi
-                    sourceParts = [
-                        new OpenLayers.Geometry.MultiLineString(
-                            sourceLine.clone()
-                        )
-                    ];
-                }
-            }
-        }
-        if(sourceParts && sourceParts.length > 1) {
-            sourceSplit = true;
-        } else {
-            sourceParts = [];
-        }
-        if(targetParts && targetParts.length > 1) {
-            targetSplit = true;
-        } else {
-            targetParts = [];
-        }
-        if(sourceSplit || targetSplit) {
-            if(mutual) {
-                results = [sourceParts, targetParts];
-            } else {
-                results = targetParts;
+    readNode: function(node, obj, first) {
+        // Not the superclass, only the mixin classes inherit from
+        // Format.GML.v2. We need this because we don't want to get readNode
+        // from the superclass's superclass, which is OpenLayers.Format.XML.
+        return OpenLayers.Format.GML.v2.prototype.readNode.apply(this, arguments);
+    },
+
+    /**
+     * Property: readers
+     * Contains public functions, grouped by namespace prefix, that will
+     *     be applied when a namespaced node is found matching the function
+     *     name.  The function will be applied in the scope of this parser
+     *     with two arguments: the node being read and a context object passed
+     *     from the parent.
+     */
+    readers: {
+        "wfs": OpenLayers.Util.applyDefaults({
+            "WFS_TransactionResponse": function(node, obj) {
+                obj.insertIds = [];
+                obj.success = false;
+                this.readChildNodes(node, obj);
+            },
+            "InsertResult": function(node, container) {
+                var obj = {fids: []};
+                this.readChildNodes(node, obj);
+                container.insertIds = container.insertIds.concat(obj.fids);
+            },
+            "TransactionResult": function(node, obj) {
+                this.readChildNodes(node, obj);
+            },
+            "Status": function(node, obj) {
+                this.readChildNodes(node, obj);
+            },
+            "SUCCESS": function(node, obj) {
+                obj.success = true;
             }
             }
-        }
-        return results;
+        }, OpenLayers.Format.WFST.v1.prototype.readers["wfs"]),
+        "gml": OpenLayers.Format.GML.v2.prototype.readers["gml"],
+        "feature": OpenLayers.Format.GML.v2.prototype.readers["feature"],
+        "ogc": OpenLayers.Format.Filter.v1_0_0.prototype.readers["ogc"]
     },
     },
-    
+
     /**
     /**
-     * Method: splitWith
-     * Split this geometry (the target) with the given geometry (the source).
-     *
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>} A geometry used to split this
-     *     geometry (the source).
-     * options - {Object} Properties of this object will be used to determine
-     *     how the split is conducted.
-     *
-     * Valid options:
-     * mutual - {Boolean} Split the source geometry in addition to the target
-     *     geometry.  Default is false.
-     * edge - {Boolean} Allow splitting when only edges intersect.  Default is
-     *     true.  If false, a vertex on the source must be within the tolerance
-     *     distance of the intersection to be considered a split.
-     * tolerance - {Number} If a non-null value is provided, intersections
-     *     within the tolerance distance of an existing vertex on the source
-     *     will be assumed to occur at the vertex.
-     * 
-     * Returns:
-     * {Array} A list of geometries (of this same type as the target) that
-     *     result from splitting the target with the source geometry.  The
-     *     source and target geometry will remain unmodified.  If no split
-     *     results, null will be returned.  If mutual is true and a split
-     *     results, return will be an array of two arrays - the first will be
-     *     all geometries that result from splitting the source geometry and
-     *     the second will be all geometries that result from splitting the
-     *     target geometry.
+     * Property: writers
+     * As a compliment to the readers property, this structure contains public
+     *     writing functions grouped by namespace alias and named like the
+     *     node names they produce.
      */
      */
-    splitWith: function(geometry, options) {
-        var results = null;
-        var mutual = options && options.mutual;
-        var splits, targetLine, sourceLines, sourceSplit, targetSplit, sourceParts, targetParts;
-        if(geometry instanceof OpenLayers.Geometry.LineString) {
-            targetParts = [];
-            sourceParts = [geometry];
-            for(var i=0, len=this.components.length; i<len; ++i) {
-                targetSplit = false;
-                targetLine = this.components[i];
-                for(var j=0; j<sourceParts.length; ++j) {
-                    splits = sourceParts[j].split(targetLine, options);
-                    if(splits) {
-                        if(mutual) {
-                            sourceLines = splits[0];
-                            if(sourceLines.length) {
-                                // splice in new source parts
-                                sourceLines.unshift(j, 1);
-                                Array.prototype.splice.apply(sourceParts, sourceLines);
-                                j += sourceLines.length - 2;
-                            }
-                            splits = splits[1];
-                            if(splits.length === 0) {
-                                splits = [targetLine.clone()];
-                            }
-                        }
-                        for(var k=0, klen=splits.length; k<klen; ++k) {
-                            if(k===0 && targetParts.length) {
-                                targetParts[targetParts.length-1].addComponent(
-                                    splits[k]
-                                );
-                            } else {
-                                targetParts.push(
-                                    new OpenLayers.Geometry.MultiLineString([
-                                        splits[k]
-                                    ])
-                                );
-                            }
-                        }
-                        targetSplit = true;                    
+    writers: {
+        "wfs": OpenLayers.Util.applyDefaults({
+            "Query": function(options) {
+                options = OpenLayers.Util.extend({
+                    featureNS: this.featureNS,
+                    featurePrefix: this.featurePrefix,
+                    featureType: this.featureType,
+                    srsName: this.srsName,
+                    srsNameInQuery: this.srsNameInQuery
+                }, options);
+                var prefix = options.featurePrefix;
+                var node = this.createElementNSPlus("wfs:Query", {
+                    attributes: {
+                        typeName: (options.featureNS ? prefix + ":" : "") +
+                            options.featureType
                     }
                     }
+                });
+                if(options.srsNameInQuery && options.srsName) {
+                    node.setAttribute("srsName", options.srsName);
                 }
                 }
-                if(!targetSplit) {
-                    // target component was not hit
-                    if(targetParts.length) {
-                        // add it to any existing multi-line
-                        targetParts[targetParts.length-1].addComponent(
-                            targetLine.clone()
+                if(options.featureNS) {
+                    this.setAttributeNS(
+                        node, this.namespaces.xmlns,
+                        "xmlns:" + prefix, options.featureNS
+                    );
+                }
+                if(options.propertyNames) {
+                    for(var i=0,len = options.propertyNames.length; i<len; i++) {
+                        this.writeNode(
+                            "ogc:PropertyName",
+                            {property: options.propertyNames[i]},
+                            node
                         );
                         );
-                    } else {
-                        // or start with a fresh multi-line
-                        targetParts = [
-                            new OpenLayers.Geometry.MultiLineString([
-                                targetLine.clone()
-                            ])
-                        ];
                     }
                     }
-                    
                 }
                 }
+                if(options.filter) {
+                    this.setFilterProperty(options.filter);
+                    this.writeNode("ogc:Filter", options.filter, node);
+                }
+                return node;
             }
             }
-        } else {
-            results = geometry.split(this);
-        }
-        if(sourceParts && sourceParts.length > 1) {
-            sourceSplit = true;
-        } else {
-            sourceParts = [];
-        }
-        if(targetParts && targetParts.length > 1) {
-            targetSplit = true;
-        } else {
-            targetParts = [];
-        }
-        if(sourceSplit || targetSplit) {
-            if(mutual) {
-                results = [sourceParts, targetParts];
-            } else {
-                results = targetParts;
-            }
-        }
-        return results;
+        }, OpenLayers.Format.WFST.v1.prototype.writers["wfs"]),
+        "gml": OpenLayers.Format.GML.v2.prototype.writers["gml"],
+        "feature": OpenLayers.Format.GML.v2.prototype.writers["feature"],
+        "ogc": OpenLayers.Format.Filter.v1_0_0.prototype.writers["ogc"]
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Geometry.MultiLineString"
+    CLASS_NAME: "OpenLayers.Format.WFST.v1_0_0"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Format.js
+    OpenLayers/Protocol/WFS/v1_0_0.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/BaseTypes/Class.js
- * @requires OpenLayers/Util.js
+ * @requires OpenLayers/Protocol/WFS/v1.js
+ * @requires OpenLayers/Format/WFST/v1_0_0.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Format
- * Base class for format reading/writing a variety of formats.  Subclasses
- *     of OpenLayers.Format are expected to have read and write methods.
+ * Class: OpenLayers.Protocol.WFS.v1_0_0
+ * A WFS v1.0.0 protocol for vector layers.  Create a new instance with the
+ *     <OpenLayers.Protocol.WFS.v1_0_0> constructor.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Protocol.WFS.v1>
  */
  */
-OpenLayers.Format = OpenLayers.Class({
-    
-    /**
-     * Property: options
-     * {Object} A reference to options passed to the constructor.
-     */
-    options: null,
-    
-    /**
-     * APIProperty: externalProjection
-     * {<OpenLayers.Projection>} When passed a externalProjection and
-     *     internalProjection, the format will reproject the geometries it
-     *     reads or writes. The externalProjection is the projection used by
-     *     the content which is passed into read or which comes out of write.
-     *     In order to reproject, a projection transformation function for the
-     *     specified projections must be available. This support may be 
-     *     provided via proj4js or via a custom transformation function. See
-     *     {<OpenLayers.Projection.addTransform>} for more information on
-     *     custom transformations.
-     */
-    externalProjection: null,
-
-    /**
-     * APIProperty: internalProjection
-     * {<OpenLayers.Projection>} When passed a externalProjection and
-     *     internalProjection, the format will reproject the geometries it
-     *     reads or writes. The internalProjection is the projection used by
-     *     the geometries which are returned by read or which are passed into
-     *     write.  In order to reproject, a projection transformation function
-     *     for the specified projections must be available. This support may be
-     *     provided via proj4js or via a custom transformation function. See
-     *     {<OpenLayers.Projection.addTransform>} for more information on
-     *     custom transformations.
-     */
-    internalProjection: null,
-
-    /**
-     * APIProperty: data
-     * {Object} When <keepData> is true, this is the parsed string sent to
-     *     <read>.
-     */
-    data: null,
-
-    /**
-     * APIProperty: keepData
-     * {Object} Maintain a reference (<data>) to the most recently read data.
-     *     Default is false.
-     */
-    keepData: false,
-
-    /**
-     * Constructor: OpenLayers.Format
-     * Instances of this class are not useful.  See one of the subclasses.
-     *
-     * Parameters:
-     * options - {Object} An optional object with properties to set on the
-     *           format
-     *
-     * Valid options:
-     * keepData - {Boolean} If true, upon <read>, the data property will be
-     *     set to the parsed object (e.g. the json or xml object).
-     *
-     * Returns:
-     * An instance of OpenLayers.Format
-     */
-    initialize: function(options) {
-        OpenLayers.Util.extend(this, options);
-        this.options = options;
-    },
+OpenLayers.Protocol.WFS.v1_0_0 = OpenLayers.Class(OpenLayers.Protocol.WFS.v1, {
     
     /**
     
     /**
-     * APIMethod: destroy
-     * Clean up.
-     */
-    destroy: function() {
-    },
-
-    /**
-     * Method: read
-     * Read data from a string, and return an object whose type depends on the
-     * subclass. 
-     * 
-     * Parameters:
-     * data - {string} Data to read/parse.
-     *
-     * Returns:
-     * Depends on the subclass
+     * Property: version
+     * {String} WFS version number.
      */
      */
-    read: function(data) {
-        throw new Error('Read not implemented.');
-    },
+    version: "1.0.0",
     
     /**
     
     /**
-     * Method: write
-     * Accept an object, and return a string. 
+     * Constructor: OpenLayers.Protocol.WFS.v1_0_0
+     * A class for giving layers WFS v1.0.0 protocol.
      *
      * Parameters:
      *
      * Parameters:
-     * object - {Object} Object to be serialized
+     * options - {Object} Optional object whose properties will be set on the
+     *     instance.
      *
      *
-     * Returns:
-     * {String} A string representation of the object.
+     * Valid options properties:
+     * featureType - {String} Local (without prefix) feature typeName (required).
+     * featureNS - {String} Feature namespace (optional).
+     * featurePrefix - {String} Feature namespace alias (optional - only used
+     *     if featureNS is provided).  Default is 'feature'.
+     * geometryName - {String} Name of geometry attribute.  Default is 'the_geom'.
      */
      */
-    write: function(object) {
-        throw new Error('Write not implemented.');
-    },
-
-    CLASS_NAME: "OpenLayers.Format"
-});     
+   
+    CLASS_NAME: "OpenLayers.Protocol.WFS.v1_0_0" 
+});
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Format/XML.js
+    OpenLayers/Control.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Format.js
+ * @requires OpenLayers/BaseTypes/Class.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Format.XML
- * Read and write XML.  For cross-browser XML generation, use methods on an
- *     instance of the XML format class instead of on <code>document<end>.
- *     The DOM creation and traversing methods exposed here all mimic the
- *     W3C XML DOM methods.  Create a new parser with the
- *     <OpenLayers.Format.XML> constructor.
+ * Class: OpenLayers.Control
+ * Controls affect the display or behavior of the map. They allow everything
+ * from panning and zooming to displaying a scale indicator. Controls by 
+ * default are added to the map they are contained within however it is
+ * possible to add a control to an external div by passing the div in the
+ * options parameter.
+ * 
+ * Example:
+ * The following example shows how to add many of the common controls
+ * to a map.
+ * 
+ * > var map = new OpenLayers.Map('map', { controls: [] });
+ * >
+ * > map.addControl(new OpenLayers.Control.PanZoomBar());
+ * > map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
+ * > map.addControl(new OpenLayers.Control.Permalink());
+ * > map.addControl(new OpenLayers.Control.Permalink('permalink'));
+ * > map.addControl(new OpenLayers.Control.MousePosition());
+ * > map.addControl(new OpenLayers.Control.OverviewMap());
+ * > map.addControl(new OpenLayers.Control.KeyboardDefaults());
  *
  *
- * Inherits from:
- *  - <OpenLayers.Format>
+ * The next code fragment is a quick example of how to intercept 
+ * shift-mouse click to display the extent of the bounding box
+ * dragged out by the user.  Usually controls are not created
+ * in exactly this manner.  See the source for a more complete 
+ * example:
+ *
+ * > var control = new OpenLayers.Control();
+ * > OpenLayers.Util.extend(control, {
+ * >     draw: function () {
+ * >         // this Handler.Box will intercept the shift-mousedown
+ * >         // before Control.MouseDefault gets to see it
+ * >         this.box = new OpenLayers.Handler.Box( control, 
+ * >             {"done": this.notice},
+ * >             {keyMask: OpenLayers.Handler.MOD_SHIFT});
+ * >         this.box.activate();
+ * >     },
+ * >
+ * >     notice: function (bounds) {
+ * >         OpenLayers.Console.userError(bounds);
+ * >     }
+ * > }); 
+ * > map.addControl(control);
+ * 
  */
  */
-OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
-    
-    /**
-     * Property: namespaces
-     * {Object} Mapping of namespace aliases to namespace URIs.  Properties
-     *     of this object should not be set individually.  Read-only.  All
-     *     XML subclasses should have their own namespaces object.  Use
-     *     <setNamespace> to add or set a namespace alias after construction.
+OpenLayers.Control = OpenLayers.Class({
+
+    /** 
+     * Property: id 
+     * {String} 
      */
      */
-    namespaces: null,
+    id: null,
     
     
-    /**
-     * Property: namespaceAlias
-     * {Object} Mapping of namespace URI to namespace alias.  This object
-     *     is read-only.  Use <setNamespace> to add or set a namespace alias.
+    /** 
+     * Property: map 
+     * {<OpenLayers.Map>} this gets set in the addControl() function in
+     * OpenLayers.Map 
      */
      */
-    namespaceAlias: null,
-    
-    /**
-     * Property: defaultPrefix
-     * {String} The default namespace alias for creating element nodes.
+    map: null,
+
+    /** 
+     * APIProperty: div 
+     * {DOMElement} The element that contains the control, if not present the 
+     *     control is placed inside the map.
      */
      */
-    defaultPrefix: null,
-    
-    /**
-     * Property: readers
-     * Contains public functions, grouped by namespace prefix, that will
-     *     be applied when a namespaced node is found matching the function
-     *     name.  The function will be applied in the scope of this parser
-     *     with two arguments: the node being read and a context object passed
-     *     from the parent.
+    div: null,
+
+    /** 
+     * APIProperty: type 
+     * {Number} Controls can have a 'type'. The type determines the type of
+     * interactions which are possible with them when they are placed in an
+     * <OpenLayers.Control.Panel>. 
      */
      */
-    readers: {},
+    type: null, 
+
+    /** 
+     * Property: allowSelection
+     * {Boolean} By default, controls do not allow selection, because
+     * it may interfere with map dragging. If this is true, OpenLayers
+     * will not prevent selection of the control.
+     * Default is false.
+     */
+    allowSelection: false,  
+
+    /** 
+     * Property: displayClass 
+     * {string}  This property is used for CSS related to the drawing of the
+     * Control. 
+     */
+    displayClass: "",
     
     /**
     
     /**
-     * Property: writers
-     * As a compliment to the <readers> property, this structure contains public
-     *     writing functions grouped by namespace alias and named like the
-     *     node names they produce.
-     */
-    writers: {},
+    * APIProperty: title  
+    * {string}  This property is used for showing a tooltip over the  
+    * Control.  
+    */ 
+    title: "",
 
     /**
 
     /**
-     * Property: xmldom
-     * {XMLDom} If this browser uses ActiveX, this will be set to a XMLDOM
-     *     object.  It is not intended to be a browser sniffing property.
-     *     Instead, the xmldom property is used instead of <code>document<end>
-     *     where namespaced node creation methods are not supported. In all
-     *     other browsers, this remains null.
+     * APIProperty: autoActivate
+     * {Boolean} Activate the control when it is added to a map.  Default is
+     *     false.
      */
      */
-    xmldom: null,
+    autoActivate: false,
 
 
-    /**
-     * Constructor: OpenLayers.Format.XML
-     * Construct an XML parser.  The parser is used to read and write XML.
-     *     Reading XML from a string returns a DOM element.  Writing XML from
-     *     a DOM element returns a string.
-     *
-     * Parameters:
-     * options - {Object} Optional object whose properties will be set on
-     *     the object.
+    /** 
+     * APIProperty: active 
+     * {Boolean} The control is active (read-only).  Use <activate> and 
+     *     <deactivate> to change control state.
      */
      */
-    initialize: function(options) {
-        if(window.ActiveXObject) {
-            this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
-        }
-        OpenLayers.Format.prototype.initialize.apply(this, [options]);
-        // clone the namespace object and set all namespace aliases
-        this.namespaces = OpenLayers.Util.extend({}, this.namespaces);
-        this.namespaceAlias = {};
-        for(var alias in this.namespaces) {
-            this.namespaceAlias[this.namespaces[alias]] = alias;
-        }
-    },
-    
-    /**
-     * APIMethod: destroy
-     * Clean up.
-     */
-    destroy: function() {
-        this.xmldom = null;
-        OpenLayers.Format.prototype.destroy.apply(this, arguments);
-    },
-    
-    /**
-     * Method: setNamespace
-     * Set a namespace alias and URI for the format.
-     *
-     * Parameters:
-     * alias - {String} The namespace alias (prefix).
-     * uri - {String} The namespace URI.
-     */
-    setNamespace: function(alias, uri) {
-        this.namespaces[alias] = uri;
-        this.namespaceAlias[uri] = alias;
-    },
+    active: null,
 
     /**
 
     /**
-     * APIMethod: read
-     * Deserialize a XML string and return a DOM node.
-     *
-     * Parameters:
-     * text - {String} A XML string
-     
-     * Returns:
-     * {DOMElement} A DOM node
+     * Property: handlerOptions
+     * {Object} Used to set non-default properties on the control's handler
      */
      */
-    read: function(text) {
-        var index = text.indexOf('<');
-        if(index > 0) {
-            text = text.substring(index);
-        }
-        var node = OpenLayers.Util.Try(
-            OpenLayers.Function.bind((
-                function() {
-                    var xmldom;
-                    /**
-                     * Since we want to be able to call this method on the prototype
-                     * itself, this.xmldom may not exist even if in IE.
-                     */
-                    if(window.ActiveXObject && !this.xmldom) {
-                        xmldom = new ActiveXObject("Microsoft.XMLDOM");
-                    } else {
-                        xmldom = this.xmldom;
-                        
-                    }
-                    xmldom.loadXML(text);
-                    return xmldom;
-                }
-            ), this),
-            function() {
-                return new DOMParser().parseFromString(text, 'text/xml');
-            },
-            function() {
-                var req = new XMLHttpRequest();
-                req.open("GET", "data:" + "text/xml" +
-                         ";charset=utf-8," + encodeURIComponent(text), false);
-                if(req.overrideMimeType) {
-                    req.overrideMimeType("text/xml");
-                }
-                req.send(null);
-                return req.responseXML;
-            }
-        );
-
-        if(this.keepData) {
-            this.data = node;
-        }
-
-        return node;
-    },
+    handlerOptions: null,
 
 
-    /**
-     * APIMethod: write
-     * Serialize a DOM node into a XML string.
-     * 
-     * Parameters:
-     * node - {DOMElement} A DOM node.
-     *
-     * Returns:
-     * {String} The XML string representation of the input node.
+    /** 
+     * Property: handler 
+     * {<OpenLayers.Handler>} null
      */
      */
-    write: function(node) {
-        var data;
-        if(this.xmldom) {
-            data = node.xml;
-        } else {
-            var serializer = new XMLSerializer();
-            if (node.nodeType == 1) {
-                // Add nodes to a document before serializing. Everything else
-                // is serialized as is. This may need more work. See #1218 .
-                var doc = document.implementation.createDocument("", "", null);
-                if (doc.importNode) {
-                    node = doc.importNode(node, true);
-                }
-                doc.appendChild(node);
-                data = serializer.serializeToString(doc);
-            } else {
-                data = serializer.serializeToString(node);
-            }
-        }
-        return data;
-    },
+    handler: null,
 
     /**
 
     /**
-     * APIMethod: createElementNS
-     * Create a new element with namespace.  This node can be appended to
-     *     another node with the standard node.appendChild method.  For
-     *     cross-browser support, this method must be used instead of
-     *     document.createElementNS.
-     *
-     * Parameters:
-     * uri - {String} Namespace URI for the element.
-     * name - {String} The qualified name of the element (prefix:localname).
-     * 
-     * Returns:
-     * {Element} A DOM element with namespace.
+     * APIProperty: eventListeners
+     * {Object} If set as an option at construction, the eventListeners
+     *     object will be registered with <OpenLayers.Events.on>.  Object
+     *     structure must be a listeners object as shown in the example for
+     *     the events.on method.
      */
      */
-    createElementNS: function(uri, name) {
-        var element;
-        if(this.xmldom) {
-            if(typeof uri == "string") {
-                element = this.xmldom.createNode(1, name, uri);
-            } else {
-                element = this.xmldom.createNode(1, name, "");
-            }
-        } else {
-            element = document.createElementNS(uri, name);
-        }
-        return element;
-    },
+    eventListeners: null,
 
 
-    /**
-     * APIMethod: createDocumentFragment
-     * Create a document fragment node that can be appended to another node
-     *     created by createElementNS.  This will call 
-     *     document.createDocumentFragment outside of IE.  In IE, the ActiveX
-     *     object's createDocumentFragment method is used.
+    /** 
+     * APIProperty: events
+     * {<OpenLayers.Events>} Events instance for listeners and triggering
+     *     control specific events.
      *
      *
-     * Returns:
-     * {Element} A document fragment.
+     * Register a listener for a particular event with the following syntax:
+     * (code)
+     * control.events.register(type, obj, listener);
+     * (end)
+     *
+     * Listeners will be called with a reference to an event object.  The
+     *     properties of this event depends on exactly what happened.
+     *
+     * All event objects have at least the following properties:
+     * object - {Object} A reference to control.events.object (a reference
+     *      to the control).
+     * element - {DOMElement} A reference to control.events.element (which
+     *      will be null unless documented otherwise).
+     *
+     * Supported map event types:
+     * activate - Triggered when activated.
+     * deactivate - Triggered when deactivated.
      */
      */
-    createDocumentFragment: function() {
-        var element;
-        if (this.xmldom) {
-            element = this.xmldom.createDocumentFragment();
-        } else {
-            element = document.createDocumentFragment();
-        }
-        return element;
-    },
+    events: null,
 
     /**
 
     /**
-     * APIMethod: createTextNode
-     * Create a text node.  This node can be appended to another node with
-     *     the standard node.appendChild method.  For cross-browser support,
-     *     this method must be used instead of document.createTextNode.
+     * Constructor: OpenLayers.Control
+     * Create an OpenLayers Control.  The options passed as a parameter
+     * directly extend the control.  For example passing the following:
      * 
      * 
-     * Parameters:
-     * text - {String} The text of the node.
+     * > var control = new OpenLayers.Control({div: myDiv});
+     *
+     * Overrides the default div attribute value of null.
      * 
      * 
-     * Returns: 
-     * {DOMElement} A DOM text node.
+     * Parameters:
+     * options - {Object} 
      */
      */
-    createTextNode: function(text) {
-        var node;
-        if (typeof text !== "string") {
-            text = String(text);
+    initialize: function (options) {
+        // We do this before the extend so that instances can override
+        // className in options.
+        this.displayClass = 
+            this.CLASS_NAME.replace("OpenLayers.", "ol").replace(/\./g, "");
+        
+        OpenLayers.Util.extend(this, options);
+        
+        this.events = new OpenLayers.Events(this);
+        if(this.eventListeners instanceof Object) {
+            this.events.on(this.eventListeners);
         }
         }
-        if(this.xmldom) {
-            node = this.xmldom.createTextNode(text);
-        } else {
-            node = document.createTextNode(text);
+        if (this.id == null) {
+            this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
         }
         }
-        return node;
     },
 
     /**
     },
 
     /**
-     * APIMethod: getElementsByTagNameNS
-     * Get a list of elements on a node given the namespace URI and local name.
-     *     To return all nodes in a given namespace, use '*' for the name
-     *     argument.  To return all nodes of a given (local) name, regardless
-     *     of namespace, use '*' for the uri argument.
-     * 
-     * Parameters:
-     * node - {Element} Node on which to search for other nodes.
-     * uri - {String} Namespace URI.
-     * name - {String} Local name of the tag (without the prefix).
-     * 
-     * Returns:
-     * {NodeList} A node list or array of elements.
+     * Method: destroy
+     * The destroy method is used to perform any clean up before the control
+     * is dereferenced.  Typically this is where event listeners are removed
+     * to prevent memory leaks.
      */
      */
-    getElementsByTagNameNS: function(node, uri, name) {
-        var elements = [];
-        if(node.getElementsByTagNameNS) {
-            elements = node.getElementsByTagNameNS(uri, name);
-        } else {
-            // brute force method
-            var allNodes = node.getElementsByTagName("*");
-            var potentialNode, fullName;
-            for(var i=0, len=allNodes.length; i<len; ++i) {
-                potentialNode = allNodes[i];
-                fullName = (potentialNode.prefix) ?
-                           (potentialNode.prefix + ":" + name) : name;
-                if((name == "*") || (fullName == potentialNode.nodeName)) {
-                    if((uri == "*") || (uri == potentialNode.namespaceURI)) {
-                        elements.push(potentialNode);
-                    }
-                }
+    destroy: function () {
+        if(this.events) {
+            if(this.eventListeners) {
+                this.events.un(this.eventListeners);
             }
             }
+            this.events.destroy();
+            this.events = null;
         }
         }
-        return elements;
-    },
+        this.eventListeners = null;
 
 
-    /**
-     * APIMethod: getAttributeNodeNS
-     * Get an attribute node given the namespace URI and local name.
-     * 
-     * Parameters:
-     * node - {Element} Node on which to search for attribute nodes.
-     * uri - {String} Namespace URI.
-     * name - {String} Local name of the attribute (without the prefix).
-     * 
-     * Returns:
-     * {DOMElement} An attribute node or null if none found.
-     */
-    getAttributeNodeNS: function(node, uri, name) {
-        var attributeNode = null;
-        if(node.getAttributeNodeNS) {
-            attributeNode = node.getAttributeNodeNS(uri, name);
-        } else {
-            var attributes = node.attributes;
-            var potentialNode, fullName;
-            for(var i=0, len=attributes.length; i<len; ++i) {
-                potentialNode = attributes[i];
-                if(potentialNode.namespaceURI == uri) {
-                    fullName = (potentialNode.prefix) ?
-                               (potentialNode.prefix + ":" + name) : name;
-                    if(fullName == potentialNode.nodeName) {
-                        attributeNode = potentialNode;
-                        break;
-                    }
+        // eliminate circular references
+        if (this.handler) {
+            this.handler.destroy();
+            this.handler = null;
+        }
+        if(this.handlers) {
+            for(var key in this.handlers) {
+                if(this.handlers.hasOwnProperty(key) &&
+                   typeof this.handlers[key].destroy == "function") {
+                    this.handlers[key].destroy();
                 }
             }
                 }
             }
+            this.handlers = null;
         }
         }
-        return attributeNode;
+        if (this.map) {
+            this.map.removeControl(this);
+            this.map = null;
+        }
+        this.div = null;
     },
 
     },
 
-    /**
-     * APIMethod: getAttributeNS
-     * Get an attribute value given the namespace URI and local name.
-     * 
+    /** 
+     * Method: setMap
+     * Set the map property for the control. This is done through an accessor
+     * so that subclasses can override this and take special action once 
+     * they have their map variable set. 
+     *
      * Parameters:
      * Parameters:
-     * node - {Element} Node on which to search for an attribute.
-     * uri - {String} Namespace URI.
-     * name - {String} Local name of the attribute (without the prefix).
-     * 
-     * Returns:
-     * {String} An attribute value or and empty string if none found.
+     * map - {<OpenLayers.Map>} 
      */
      */
-    getAttributeNS: function(node, uri, name) {
-        var attributeValue = "";
-        if(node.getAttributeNS) {
-            attributeValue = node.getAttributeNS(uri, name) || "";
-        } else {
-            var attributeNode = this.getAttributeNodeNS(node, uri, name);
-            if(attributeNode) {
-                attributeValue = attributeNode.nodeValue;
-            }
+    setMap: function(map) {
+        this.map = map;
+        if (this.handler) {
+            this.handler.setMap(map);
         }
         }
-        return attributeValue;
     },
     },
-    
+  
     /**
     /**
-     * APIMethod: getChildValue
-     * Get the textual value of the node if it exists, or return an
-     *     optional default string.  Returns an empty string if no first child
-     *     exists and no default value is supplied.
+     * Method: draw
+     * The draw method is called when the control is ready to be displayed
+     * on the page.  If a div has not been created one is created.  Controls
+     * with a visual component will almost always want to override this method 
+     * to customize the look of control. 
      *
      * Parameters:
      *
      * Parameters:
-     * node - {DOMElement} The element used to look for a first child value.
-     * def - {String} Optional string to return in the event that no
-     *     first child value exists.
+     * px - {<OpenLayers.Pixel>} The top-left pixel position of the control
+     *      or null.
      *
      * Returns:
      *
      * Returns:
-     * {String} The value of the first child of the given node.
+     * {DOMElement} A reference to the DIV DOMElement containing the control
      */
      */
-    getChildValue: function(node, def) {
-        var value = def || "";
-        if(node) {
-            for(var child=node.firstChild; child; child=child.nextSibling) {
-                switch(child.nodeType) {
-                    case 3: // text node
-                    case 4: // cdata section
-                        value += child.nodeValue;
-                }
+    draw: function (px) {
+        if (this.div == null) {
+            this.div = OpenLayers.Util.createDiv(this.id);
+            this.div.className = this.displayClass;
+            if (!this.allowSelection) {
+                this.div.className += " olControlNoSelect";
+                this.div.setAttribute("unselectable", "on", 0);
+                this.div.onselectstart = OpenLayers.Function.False; 
+            }    
+            if (this.title != "") {
+                this.div.title = this.title;
             }
         }
             }
         }
-        return value;
+        if (px != null) {
+            this.position = px.clone();
+        }
+        this.moveTo(this.position);
+        return this.div;
     },
 
     /**
     },
 
     /**
-     * APIMethod: isSimpleContent
-     * Test if the given node has only simple content (i.e. no child element
-     *     nodes).
+     * Method: moveTo
+     * Sets the left and top style attributes to the passed in pixel 
+     * coordinates.
      *
      * Parameters:
      *
      * Parameters:
-     * node - {DOMElement} An element node.
-     *
-     * Returns:
-     * {Boolean} The node has no child element nodes (nodes of type 1). 
+     * px - {<OpenLayers.Pixel>}
      */
      */
-    isSimpleContent: function(node) {
-        var simple = true;
-        for(var child=node.firstChild; child; child=child.nextSibling) {
-            if(child.nodeType === 1) {
-                simple = false;
-                break;
-            }
+    moveTo: function (px) {
+        if ((px != null) && (this.div != null)) {
+            this.div.style.left = px.x + "px";
+            this.div.style.top = px.y + "px";
         }
         }
-        return simple;
     },
     },
-    
+
     /**
     /**
-     * APIMethod: contentType
-     * Determine the content type for a given node.
-     *
-     * Parameters:
-     * node - {DOMElement}
-     *
+     * APIMethod: activate
+     * Explicitly activates a control and its associated
+     * handler if one has been set.  Controls can be
+     * deactivated by calling the deactivate() method.
+     * 
      * Returns:
      * Returns:
-     * {Integer} One of OpenLayers.Format.XML.CONTENT_TYPE.{EMPTY,SIMPLE,COMPLEX,MIXED}
-     *     if the node has no, simple, complex, or mixed content.
+     * {Boolean}  True if the control was successfully activated or
+     *            false if the control was already active.
      */
      */
-    contentType: function(node) {
-        var simple = false,
-            complex = false;
-            
-        var type = OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;
-
-        for(var child=node.firstChild; child; child=child.nextSibling) {
-            switch(child.nodeType) {
-                case 1: // element
-                    complex = true;
-                    break;
-                case 8: // comment
-                    break;
-                default:
-                    simple = true;
-            }
-            if(complex && simple) {
-                break;
-            }
+    activate: function () {
+        if (this.active) {
+            return false;
         }
         }
-        
-        if(complex && simple) {
-            type = OpenLayers.Format.XML.CONTENT_TYPE.MIXED;
-        } else if(complex) {
-            return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;
-        } else if(simple) {
-            return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE;
+        if (this.handler) {
+            this.handler.activate();
         }
         }
-        return type;
+        this.active = true;
+        if(this.map) {
+            OpenLayers.Element.addClass(
+                this.map.viewPortDiv,
+                this.displayClass.replace(/ /g, "") + "Active"
+            );
+        }
+        this.events.triggerEvent("activate");
+        return true;
     },
     },
-
+    
     /**
     /**
-     * APIMethod: hasAttributeNS
-     * Determine whether a node has a particular attribute matching the given
-     *     name and namespace.
-     * 
-     * Parameters:
-     * node - {Element} Node on which to search for an attribute.
-     * uri - {String} Namespace URI.
-     * name - {String} Local name of the attribute (without the prefix).
+     * APIMethod: deactivate
+     * Deactivates a control and its associated handler if any.  The exact
+     * effect of this depends on the control itself.
      * 
      * Returns:
      * 
      * Returns:
-     * {Boolean} The node has an attribute matching the name and namespace.
+     * {Boolean} True if the control was effectively deactivated or false
+     *           if the control was already inactive.
      */
      */
-    hasAttributeNS: function(node, uri, name) {
-        var found = false;
-        if(node.hasAttributeNS) {
-            found = node.hasAttributeNS(uri, name);
-        } else {
-            found = !!this.getAttributeNodeNS(node, uri, name);
+    deactivate: function () {
+        if (this.active) {
+            if (this.handler) {
+                this.handler.deactivate();
+            }
+            this.active = false;
+            if(this.map) {
+                OpenLayers.Element.removeClass(
+                    this.map.viewPortDiv,
+                    this.displayClass.replace(/ /g, "") + "Active"
+                );
+            }
+            this.events.triggerEvent("deactivate");
+            return true;
         }
         }
-        return found;
+        return false;
     },
     },
-    
-    /**
-     * APIMethod: setAttributeNS
-     * Adds a new attribute or changes the value of an attribute with the given
-     *     namespace and name.
-     *
-     * Parameters:
-     * node - {Element} Element node on which to set the attribute.
-     * uri - {String} Namespace URI for the attribute.
-     * name - {String} Qualified name (prefix:localname) for the attribute.
-     * value - {String} Attribute value.
+
+    CLASS_NAME: "OpenLayers.Control"
+});
+
+/**
+ * Constant: OpenLayers.Control.TYPE_BUTTON
+ */
+OpenLayers.Control.TYPE_BUTTON = 1;
+
+/**
+ * Constant: OpenLayers.Control.TYPE_TOGGLE
+ */
+OpenLayers.Control.TYPE_TOGGLE = 2;
+
+/**
+ * Constant: OpenLayers.Control.TYPE_TOOL
+ */
+OpenLayers.Control.TYPE_TOOL   = 3;
+/* ======================================================================
+    OpenLayers/Handler.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Events.js
+ */
+
+/**
+ * Class: OpenLayers.Handler
+ * Base class to construct a higher-level handler for event sequences.  All
+ *     handlers have activate and deactivate methods.  In addition, they have
+ *     methods named like browser events.  When a handler is activated, any
+ *     additional methods named like a browser event is registered as a
+ *     listener for the corresponding event.  When a handler is deactivated,
+ *     those same methods are unregistered as event listeners.
+ *
+ * Handlers also typically have a callbacks object with keys named like
+ *     the abstracted events or event sequences that they are in charge of
+ *     handling.  The controls that wrap handlers define the methods that
+ *     correspond to these abstract events - so instead of listening for
+ *     individual browser events, they only listen for the abstract events
+ *     defined by the handler.
+ *     
+ * Handlers are created by controls, which ultimately have the responsibility
+ *     of making changes to the the state of the application.  Handlers
+ *     themselves may make temporary changes, but in general are expected to
+ *     return the application in the same state that they found it.
+ */
+OpenLayers.Handler = OpenLayers.Class({
+
+    /**
+     * Property: id
+     * {String}
      */
      */
-    setAttributeNS: function(node, uri, name, value) {
-        if(node.setAttributeNS) {
-            node.setAttributeNS(uri, name, value);
-        } else {
-            if(this.xmldom) {
-                if(uri) {
-                    var attribute = node.ownerDocument.createNode(
-                        2, name, uri
-                    );
-                    attribute.nodeValue = value;
-                    node.setAttributeNode(attribute);
-                } else {
-                    node.setAttribute(name, value);
-                }
-            } else {
-                throw "setAttributeNS not implemented";
-            }
-        }
-    },
+    id: null,
+        
+    /**
+     * APIProperty: control
+     * {<OpenLayers.Control>}. The control that initialized this handler.  The
+     *     control is assumed to have a valid map property - that map is used
+     *     in the handler's own setMap method.
+     */
+    control: null,
 
     /**
 
     /**
-     * Method: createElementNSPlus
-     * Shorthand for creating namespaced elements with optional attributes and
-     *     child text nodes.
-     *
-     * Parameters:
-     * name - {String} The qualified node name.
-     * options - {Object} Optional object for node configuration.
+     * Property: map
+     * {<OpenLayers.Map>}
+     */
+    map: null,
+
+    /**
+     * APIProperty: keyMask
+     * {Integer} Use bitwise operators and one or more of the OpenLayers.Handler
+     *     constants to construct a keyMask.  The keyMask is used by
+     *     <checkModifiers>.  If the keyMask matches the combination of keys
+     *     down on an event, checkModifiers returns true.
      *
      *
-     * Valid options:
-     * uri - {String} Optional namespace uri for the element - supply a prefix
-     *     instead if the namespace uri is a property of the format's namespace
-     *     object.
-     * attributes - {Object} Optional attributes to be set using the
-     *     <setAttributes> method.
-     * value - {String} Optional text to be appended as a text node.
+     * Example:
+     * (code)
+     *     // handler only responds if the Shift key is down
+     *     handler.keyMask = OpenLayers.Handler.MOD_SHIFT;
      *
      *
-     * Returns:
-     * {Element} An element node.
+     *     // handler only responds if Ctrl-Shift is down
+     *     handler.keyMask = OpenLayers.Handler.MOD_SHIFT |
+     *                       OpenLayers.Handler.MOD_CTRL;
+     * (end)
      */
      */
-    createElementNSPlus: function(name, options) {
-        options = options || {};
-        // order of prefix preference
-        // 1. in the uri option
-        // 2. in the prefix option
-        // 3. in the qualified name
-        // 4. from the defaultPrefix
-        var uri = options.uri || this.namespaces[options.prefix];
-        if(!uri) {
-            var loc = name.indexOf(":");
-            uri = this.namespaces[name.substring(0, loc)];
-        }
-        if(!uri) {
-            uri = this.namespaces[this.defaultPrefix];
-        }
-        var node = this.createElementNS(uri, name);
-        if(options.attributes) {
-            this.setAttributes(node, options.attributes);
-        }
-        var value = options.value;
-        if(value != null) {
-            node.appendChild(this.createTextNode(value));
-        }
-        return node;
-    },
+    keyMask: null,
+
+    /**
+     * Property: active
+     * {Boolean}
+     */
+    active: false,
     
     /**
     
     /**
-     * Method: setAttributes
-     * Set multiple attributes given key value pairs from an object.
+     * Property: evt
+     * {Event} This property references the last event handled by the handler.
+     *     Note that this property is not part of the stable API.  Use of the
+     *     evt property should be restricted to controls in the library
+     *     or other applications that are willing to update with changes to
+     *     the OpenLayers code.
+     */
+    evt: null,
+    
+    /**
+     * Property: touch
+     * {Boolean} Indicates the support of touch events. When touch events are 
+     *     started touch will be true and all mouse related listeners will do 
+     *     nothing.
+     */
+    touch: false,
+
+    /**
+     * Constructor: OpenLayers.Handler
+     * Construct a handler.
      *
      * Parameters:
      *
      * Parameters:
-     * node - {Element} An element node.
-     * obj - {Object || Array} An object whose properties represent attribute
-     *     names and values represent attribute values.  If an attribute name
-     *     is a qualified name ("prefix:local"), the prefix will be looked up
-     *     in the parsers {namespaces} object.  If the prefix is found,
-     *     setAttributeNS will be used instead of setAttribute.
+     * control - {<OpenLayers.Control>} The control that initialized this
+     *     handler.  The control is assumed to have a valid map property; that
+     *     map is used in the handler's own setMap method.  If a map property
+     *     is present in the options argument it will be used instead.
+     * callbacks - {Object} An object whose properties correspond to abstracted
+     *     events or sequences of browser events.  The values for these
+     *     properties are functions defined by the control that get called by
+     *     the handler.
+     * options - {Object} An optional object whose properties will be set on
+     *     the handler.
      */
      */
-    setAttributes: function(node, obj) {
-        var value, uri;
-        for(var name in obj) {
-            if(obj[name] != null && obj[name].toString) {
-                value = obj[name].toString();
-                // check for qualified attribute name ("prefix:local")
-                uri = this.namespaces[name.substring(0, name.indexOf(":"))] || null;
-                this.setAttributeNS(node, uri, name, value);
-            }
+    initialize: function(control, callbacks, options) {
+        OpenLayers.Util.extend(this, options);
+        this.control = control;
+        this.callbacks = callbacks;
+
+        var map = this.map || control.map;
+        if (map) {
+            this.setMap(map); 
         }
         }
+        
+        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
+    },
+    
+    /**
+     * Method: setMap
+     */
+    setMap: function (map) {
+        this.map = map;
     },
 
     /**
     },
 
     /**
-     * Method: readNode
-     * Shorthand for applying one of the named readers given the node
-     *     namespace and local name.  Readers take two args (node, obj) and
-     *     generally extend or modify the second.
-     *
-     * Parameters:
-     * node - {DOMElement} The node to be read (required).
-     * obj - {Object} The object to be modified (optional).
+     * Method: checkModifiers
+     * Check the keyMask on the handler.  If no <keyMask> is set, this always
+     *     returns true.  If a <keyMask> is set and it matches the combination
+     *     of keys down on an event, this returns true.
      *
      * Returns:
      *
      * Returns:
-     * {Object} The input object, modified (or a new one if none was provided).
+     * {Boolean} The keyMask matches the keys down on an event.
      */
      */
-    readNode: function(node, obj) {
-        if(!obj) {
-            obj = {};
-        }
-        var group = this.readers[node.namespaceURI ? this.namespaceAlias[node.namespaceURI]: this.defaultPrefix];
-        if(group) {
-            var local = node.localName || node.nodeName.split(":").pop();
-            var reader = group[local] || group["*"];
-            if(reader) {
-                reader.apply(this, [node, obj]);
-            }
+    checkModifiers: function (evt) {
+        if(this.keyMask == null) {
+            return true;
         }
         }
-        return obj;
+        /* calculate the keyboard modifier mask for this event */
+        var keyModifiers =
+            (evt.shiftKey ? OpenLayers.Handler.MOD_SHIFT : 0) |
+            (evt.ctrlKey  ? OpenLayers.Handler.MOD_CTRL  : 0) |
+            (evt.altKey   ? OpenLayers.Handler.MOD_ALT   : 0) |
+            (evt.metaKey  ? OpenLayers.Handler.MOD_META  : 0);
+    
+        /* if it differs from the handler object's key mask,
+           bail out of the event handler */
+        return (keyModifiers == this.keyMask);
     },
 
     /**
     },
 
     /**
-     * Method: readChildNodes
-     * Shorthand for applying the named readers to all children of a node.
-     *     For each child of type 1 (element), <readSelf> is called.
-     *
-     * Parameters:
-     * node - {DOMElement} The node to be read (required).
-     * obj - {Object} The object to be modified (optional).
-     *
-     * Returns:
-     * {Object} The input object, modified.
+     * APIMethod: activate
+     * Turn on the handler.  Returns false if the handler was already active.
+     * 
+     * Returns: 
+     * {Boolean} The handler was activated.
      */
      */
-    readChildNodes: function(node, obj) {
-        if(!obj) {
-            obj = {};
+    activate: function() {
+        if(this.active) {
+            return false;
         }
         }
-        var children = node.childNodes;
-        var child;
-        for(var i=0, len=children.length; i<len; ++i) {
-            child = children[i];
-            if(child.nodeType == 1) {
-                this.readNode(child, obj);
+        // register for event handlers defined on this class.
+        var events = OpenLayers.Events.prototype.BROWSER_EVENTS;
+        for (var i=0, len=events.length; i<len; i++) {
+            if (this[events[i]]) {
+                this.register(events[i], this[events[i]]); 
             }
             }
-        }
-        return obj;
+        } 
+        this.active = true;
+        return true;
     },
     },
-
+    
     /**
     /**
-     * Method: writeNode
-     * Shorthand for applying one of the named writers and appending the
-     *     results to a node.  If a qualified name is not provided for the
-     *     second argument (and a local name is used instead), the namespace
-     *     of the parent node will be assumed.
-     *
-     * Parameters:
-     * name - {String} The name of a node to generate.  If a qualified name
-     *     (e.g. "pre:Name") is used, the namespace prefix is assumed to be
-     *     in the <writers> group.  If a local name is used (e.g. "Name") then
-     *     the namespace of the parent is assumed.  If a local name is used
-     *     and no parent is supplied, then the default namespace is assumed.
-     * obj - {Object} Structure containing data for the writer.
-     * parent - {DOMElement} Result will be appended to this node.  If no parent
-     *     is supplied, the node will not be appended to anything.
-     *
+     * APIMethod: deactivate
+     * Turn off the handler.  Returns false if the handler was already inactive.
+     * 
      * Returns:
      * Returns:
-     * {DOMElement} The child node.
+     * {Boolean} The handler was deactivated.
      */
      */
-    writeNode: function(name, obj, parent) {
-        var prefix, local;
-        var split = name.indexOf(":");
-        if(split > 0) {
-            prefix = name.substring(0, split);
-            local = name.substring(split + 1);
-        } else {
-            if(parent) {
-                prefix = this.namespaceAlias[parent.namespaceURI];
-            } else {
-                prefix = this.defaultPrefix;
+    deactivate: function() {
+        if(!this.active) {
+            return false;
+        }
+        // unregister event handlers defined on this class.
+        var events = OpenLayers.Events.prototype.BROWSER_EVENTS;
+        for (var i=0, len=events.length; i<len; i++) {
+            if (this[events[i]]) {
+                this.unregister(events[i], this[events[i]]); 
             }
             }
-            local = name;
+        } 
+        this.touch = false;
+        this.active = false;
+        return true;
+    },
+
+    /**
+     * Method: startTouch
+     * Start touch events, this method must be called by subclasses in 
+     *     "touchstart" method. When touch events are started <touch> will be
+     *     true and all mouse related listeners will do nothing.
+     */
+    startTouch: function() {
+        if (!this.touch) {
+            this.touch = true;
+            var events = [
+                "mousedown", "mouseup", "mousemove", "click", "dblclick",
+                "mouseout"
+            ];
+            for (var i=0, len=events.length; i<len; i++) {
+                if (this[events[i]]) {
+                    this.unregister(events[i], this[events[i]]); 
+                }
+            } 
         }
         }
-        var child = this.writers[prefix][local].apply(this, [obj]);
-        if(parent) {
-            parent.appendChild(child);
+    },
+
+    /**
+    * Method: callback
+    * Trigger the control's named callback with the given arguments
+    *
+    * Parameters:
+    * name - {String} The key for the callback that is one of the properties
+    *     of the handler's callbacks object.
+    * args - {Array(*)} An array of arguments (any type) with which to call 
+    *     the callback (defined by the control).
+    */
+    callback: function (name, args) {
+        if (name && this.callbacks[name]) {
+            this.callbacks[name].apply(this.control, args);
         }
         }
-        return child;
     },
 
     /**
     },
 
     /**
-     * APIMethod: getChildEl
-     * Get the first child element.  Optionally only return the first child
-     *     if it matches the given name and namespace URI.
-     *
-     * Parameters:
-     * node - {DOMElement} The parent node.
-     * name - {String} Optional node name (local) to search for.
-     * uri - {String} Optional namespace URI to search for.
-     *
-     * Returns:
-     * {DOMElement} The first child.  Returns null if no element is found, if
-     *     something significant besides an element is found, or if the element
-     *     found does not match the optional name and uri.
-     */
-    getChildEl: function(node, name, uri) {
-        return node && this.getThisOrNextEl(node.firstChild, name, uri);
+    * Method: register
+    * register an event on the map
+    */
+    register: function (name, method) {
+        // TODO: deal with registerPriority in 3.0
+        this.map.events.registerPriority(name, this, method);
+        this.map.events.registerPriority(name, this, this.setEvent);
     },
     },
-    
+
     /**
     /**
-     * APIMethod: getNextEl
-     * Get the next sibling element.  Optionally get the first sibling only
-     *     if it matches the given local name and namespace URI.
-     *
-     * Parameters:
-     * node - {DOMElement} The node.
-     * name - {String} Optional local name of the sibling to search for.
-     * uri - {String} Optional namespace URI of the sibling to search for.
-     *
-     * Returns:
-     * {DOMElement} The next sibling element.  Returns null if no element is
-     *     found, something significant besides an element is found, or the
-     *     found element does not match the optional name and uri.
-     */
-    getNextEl: function(node, name, uri) {
-        return node && this.getThisOrNextEl(node.nextSibling, name, uri);
+    * Method: unregister
+    * unregister an event from the map
+    */
+    unregister: function (name, method) {
+        this.map.events.unregister(name, this, method);   
+        this.map.events.unregister(name, this, this.setEvent);
     },
     
     /**
     },
     
     /**
-     * Method: getThisOrNextEl
-     * Return this node or the next element node.  Optionally get the first
-     *     sibling with the given local name or namespace URI.
+     * Method: setEvent
+     * With each registered browser event, the handler sets its own evt
+     *     property.  This property can be accessed by controls if needed
+     *     to get more information about the event that the handler is
+     *     processing.
      *
      *
-     * Parameters:
-     * node - {DOMElement} The node.
-     * name - {String} Optional local name of the sibling to search for.
-     * uri - {String} Optional namespace URI of the sibling to search for.
+     * This allows modifier keys on the event to be checked (alt, shift, ctrl,
+     *     and meta cannot be checked with the keyboard handler).  For a
+     *     control to determine which modifier keys are associated with the
+     *     event that a handler is currently processing, it should access
+     *     (code)handler.evt.altKey || handler.evt.shiftKey ||
+     *     handler.evt.ctrlKey || handler.evt.metaKey(end).
      *
      *
-     * Returns:
-     * {DOMElement} The next sibling element.  Returns null if no element is
-     *     found, something significant besides an element is found, or the
-     *     found element does not match the query.
+     * Parameters:
+     * evt - {Event} The browser event.
      */
      */
-    getThisOrNextEl: function(node, name, uri) {
-        outer: for(var sibling=node; sibling; sibling=sibling.nextSibling) {
-            switch(sibling.nodeType) {
-                case 1: // Element
-                    if((!name || name === (sibling.localName || sibling.nodeName.split(":").pop())) &&
-                       (!uri || uri === sibling.namespaceURI)) {
-                        // matches
-                        break outer;
-                    }
-                    sibling = null;
-                    break outer;
-                case 3: // Text
-                    if(/^\s*$/.test(sibling.nodeValue)) {
-                        break;
-                    }
-                case 4: // CDATA
-                case 6: // ENTITY_NODE
-                case 12: // NOTATION_NODE
-                case 10: // DOCUMENT_TYPE_NODE
-                case 11: // DOCUMENT_FRAGMENT_NODE
-                    sibling = null;
-                    break outer;
-            } // ignore comments and processing instructions
-        }
-        return sibling || null;
+    setEvent: function(evt) {
+        this.evt = evt;
+        return true;
     },
     },
-    
+
     /**
     /**
-     * APIMethod: lookupNamespaceURI
-     * Takes a prefix and returns the namespace URI associated with it on the given
-     *     node if found (and null if not). Supplying null for the prefix will
-     *     return the default namespace.
-     *
-     * For browsers that support it, this calls the native lookupNamesapceURI
-     *     function.  In other browsers, this is an implementation of
-     *     http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI.
-     *
-     * For browsers that don't support the attribute.ownerElement property, this
-     *     method cannot be called on attribute nodes.
-     *     
-     * Parameters:
-     * node - {DOMElement} The node from which to start looking.
-     * prefix - {String} The prefix to lookup or null to lookup the default namespace.
-     * 
-     * Returns:
-     * {String} The namespace URI for the given prefix.  Returns null if the prefix
-     *     cannot be found or the node is the wrong type.
+     * Method: destroy
+     * Deconstruct the handler.
      */
      */
-    lookupNamespaceURI: function(node, prefix) {
-        var uri = null;
-        if(node) {
-            if(node.lookupNamespaceURI) {
-                uri = node.lookupNamespaceURI(prefix);
-            } else {
-                outer: switch(node.nodeType) {
-                    case 1: // ELEMENT_NODE
-                        if(node.namespaceURI !== null && node.prefix === prefix) {
-                            uri = node.namespaceURI;
-                            break outer;
-                        }
-                        var len = node.attributes.length;
-                        if(len) {
-                            var attr;
-                            for(var i=0; i<len; ++i) {
-                                attr = node.attributes[i];
-                                if(attr.prefix === "xmlns" && attr.name === "xmlns:" + prefix) {
-                                    uri = attr.value || null;
-                                    break outer;
-                                } else if(attr.name === "xmlns" && prefix === null) {
-                                    uri = attr.value || null;
-                                    break outer;
-                                }
-                            }
-                        }
-                        uri = this.lookupNamespaceURI(node.parentNode, prefix);
-                        break outer;
-                    case 2: // ATTRIBUTE_NODE
-                        uri = this.lookupNamespaceURI(node.ownerElement, prefix);
-                        break outer;
-                    case 9: // DOCUMENT_NODE
-                        uri = this.lookupNamespaceURI(node.documentElement, prefix);
-                        break outer;
-                    case 6: // ENTITY_NODE
-                    case 12: // NOTATION_NODE
-                    case 10: // DOCUMENT_TYPE_NODE
-                    case 11: // DOCUMENT_FRAGMENT_NODE
-                        break outer;
-                    default: 
-                        // TEXT_NODE (3), CDATA_SECTION_NODE (4), ENTITY_REFERENCE_NODE (5),
-                        // PROCESSING_INSTRUCTION_NODE (7), COMMENT_NODE (8)
-                        uri =  this.lookupNamespaceURI(node.parentNode, prefix);
-                        break outer;
-                }
-            }
-        }
-        return uri;
-    },
-    
-    /**
-     * Method: getXMLDoc
-     * Get an XML document for nodes that are not supported in HTML (e.g.
-     * createCDATASection). On IE, this will either return an existing or
-     * create a new <xmldom> on the instance. On other browsers, this will
-     * either return an existing or create a new shared document (see
-     * <OpenLayers.Format.XML.document>).
-     *
-     * Returns:
-     * {XMLDocument}
-     */
-    getXMLDoc: function() {
-        if (!OpenLayers.Format.XML.document && !this.xmldom) {
-            if (document.implementation && document.implementation.createDocument) {
-                OpenLayers.Format.XML.document =
-                    document.implementation.createDocument("", "", null);
-            } else if (!this.xmldom && window.ActiveXObject) {
-                this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
-            }
-        }
-        return OpenLayers.Format.XML.document || this.xmldom;
+    destroy: function () {
+        // unregister event listeners
+        this.deactivate();
+        // eliminate circular references
+        this.control = this.map = null;        
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Format.XML" 
+    CLASS_NAME: "OpenLayers.Handler"
+});
 
 
-});     
+/**
+ * Constant: OpenLayers.Handler.MOD_NONE
+ * If set as the <keyMask>, <checkModifiers> returns false if any key is down.
+ */
+OpenLayers.Handler.MOD_NONE  = 0;
 
 
-OpenLayers.Format.XML.CONTENT_TYPE = {EMPTY: 0, SIMPLE: 1, COMPLEX: 2, MIXED: 3};
+/**
+ * Constant: OpenLayers.Handler.MOD_SHIFT
+ * If set as the <keyMask>, <checkModifiers> returns false if Shift is down.
+ */
+OpenLayers.Handler.MOD_SHIFT = 1;
 
 /**
 
 /**
- * APIFunction: OpenLayers.Format.XML.lookupNamespaceURI
- * Takes a prefix and returns the namespace URI associated with it on the given
- *     node if found (and null if not). Supplying null for the prefix will
- *     return the default namespace.
- *
- * For browsers that support it, this calls the native lookupNamesapceURI
- *     function.  In other browsers, this is an implementation of
- *     http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI.
- *
- * For browsers that don't support the attribute.ownerElement property, this
- *     method cannot be called on attribute nodes.
- *     
- * Parameters:
- * node - {DOMElement} The node from which to start looking.
- * prefix - {String} The prefix to lookup or null to lookup the default namespace.
- * 
- * Returns:
- * {String} The namespace URI for the given prefix.  Returns null if the prefix
- *     cannot be found or the node is the wrong type.
+ * Constant: OpenLayers.Handler.MOD_CTRL
+ * If set as the <keyMask>, <checkModifiers> returns false if Ctrl is down.
  */
  */
-OpenLayers.Format.XML.lookupNamespaceURI = OpenLayers.Function.bind(
-    OpenLayers.Format.XML.prototype.lookupNamespaceURI,
-    OpenLayers.Format.XML.prototype
-);
+OpenLayers.Handler.MOD_CTRL  = 2;
 
 /**
 
 /**
- * Property: OpenLayers.Format.XML.document
- * {XMLDocument} XML document to reuse for creating non-HTML compliant nodes,
- * like document.createCDATASection.
+ * Constant: OpenLayers.Handler.MOD_ALT
+ * If set as the <keyMask>, <checkModifiers> returns false if Alt is down.
  */
  */
-OpenLayers.Format.XML.document = null;
+OpenLayers.Handler.MOD_ALT   = 4;
+
+/**
+ * Constant: OpenLayers.Handler.MOD_META
+ * If set as the <keyMask>, <checkModifiers> returns false if Cmd is down.
+ */
+OpenLayers.Handler.MOD_META  = 8;
+
+
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Format/OGCExceptionReport.js
+    OpenLayers/Handler/Drag.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Format/XML.js
+ * @requires OpenLayers/Handler.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Format.OGCExceptionReport
- * Class to read exception reports for various OGC services and versions.
+ * Class: OpenLayers.Handler.Drag
+ * The drag handler is used to deal with sequences of browser events related
+ *     to dragging.  The handler is used by controls that want to know when
+ *     a drag sequence begins, when a drag is happening, and when it has
+ *     finished.
+ *
+ * Controls that use the drag handler typically construct it with callbacks
+ *     for 'down', 'move', and 'done'.  Callbacks for these keys are called
+ *     when the drag begins, with each move, and when the drag is done.  In
+ *     addition, controls can have callbacks keyed to 'up' and 'out' if they
+ *     care to differentiate between the types of events that correspond with
+ *     the end of a drag sequence.  If no drag actually occurs (no mouse move)
+ *     the 'down' and 'up' callbacks will be called, but not the 'done'
+ *     callback.
+ *
+ * Create a new drag handler with the <OpenLayers.Handler.Drag> constructor.
  *
  * Inherits from:
  *
  * Inherits from:
- *  - <OpenLayers.Format.XML>
+ *  - <OpenLayers.Handler>
  */
  */
-OpenLayers.Format.OGCExceptionReport = OpenLayers.Class(OpenLayers.Format.XML, {
-
-    /**
-     * Property: namespaces
-     * {Object} Mapping of namespace aliases to namespace URIs.
+OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
+  
+    /** 
+     * Property: started
+     * {Boolean} When a mousedown or touchstart event is received, we want to
+     * record it, but not set 'dragging' until the mouse moves after starting.
      */
      */
-    namespaces: {
-        ogc: "http://www.opengis.net/ogc"
-    },
+    started: false,
 
     /**
 
     /**
-     * Property: regExes
-     * Compiled regular expressions for manipulating strings.
+     * Property: stopDown
+     * {Boolean} Stop propagation of mousedown events from getting to listeners
+     *     on the same element.  Default is true.
      */
      */
-    regExes: {
-        trimSpace: (/^\s*|\s*$/g),
-        removeSpace: (/\s*/g),
-        splitSpace: (/\s+/),
-        trimComma: (/\s*,\s*/g)
-    },
+    stopDown: true,
 
 
-    /**
-     * Property: defaultPrefix
+    /** 
+     * Property: dragging 
+     * {Boolean} 
      */
      */
-    defaultPrefix: "ogc",
+    dragging: false,
 
 
-    /**
-     * Constructor: OpenLayers.Format.OGCExceptionReport
-     * Create a new parser for OGC exception reports.
-     *
-     * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *     this instance.
+    /** 
+     * Property: last
+     * {<OpenLayers.Pixel>} The last pixel location of the drag.
      */
      */
+    last: null,
 
 
-    /**
-     * APIMethod: read
-     * Read OGC exception report data from a string, and return an object with
-     * information about the exceptions.
-     *
-     * Parameters:
-     * data - {String} or {DOMElement} data to read/parse.
-     *
-     * Returns:
-     * {Object} Information about the exceptions that occurred.
+    /** 
+     * Property: start
+     * {<OpenLayers.Pixel>} The first pixel location of the drag.
      */
      */
-    read: function(data) {
-        var result;
-        if(typeof data == "string") {
-            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
-        }
-        var root = data.documentElement;
-        var exceptionInfo = {exceptionReport: null}; 
-        if (root) {
-            this.readChildNodes(data, exceptionInfo);
-            if (exceptionInfo.exceptionReport === null) {
-                // fall-back to OWSCommon since this is a common output format for exceptions
-                // we cannot easily use the ows readers directly since they differ for 1.0 and 1.1
-                exceptionInfo = new OpenLayers.Format.OWSCommon().read(data);
-            }
-        }
-        return exceptionInfo;
-    },
+    start: null,
 
     /**
 
     /**
-     * Property: readers
-     * Contains public functions, grouped by namespace prefix, that will
-     *     be applied when a namespaced node is found matching the function
-     *     name.  The function will be applied in the scope of this parser
-     *     with two arguments: the node being read and a context object passed
-     *     from the parent.
+     * Property: lastMoveEvt
+     * {Object} The last mousemove event that occurred. Used to
+     *     position the map correctly when our "delay drag"
+     *     timeout expired.
      */
      */
-    readers: {
-        "ogc": {
-            "ServiceExceptionReport": function(node, obj) {
-                obj.exceptionReport = {exceptions: []};
-                this.readChildNodes(node, obj.exceptionReport);
-            },
-            "ServiceException": function(node, exceptionReport) {
-                var exception = {
-                    code: node.getAttribute("code"),
-                    locator: node.getAttribute("locator"),
-                    text: this.getChildValue(node)
-                };
-                exceptionReport.exceptions.push(exception);
-            }
-        }
-    },
-    
-    CLASS_NAME: "OpenLayers.Format.OGCExceptionReport"
-    
-});
-/* ======================================================================
-    OpenLayers/Format/XML/VersionedOGC.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Format/XML.js
- * @requires OpenLayers/Format/OGCExceptionReport.js
- */
+    lastMoveEvt: null,
 
 
-/**
- * Class: OpenLayers.Format.XML.VersionedOGC
- * Base class for versioned formats, i.e. a format which supports multiple
- * versions.
- *
- * To enable checking if parsing succeeded, you will need to define a property
- * called errorProperty on the parser you want to check. The parser will then
- * check the returned object to see if that property is present. If it is, it
- * assumes the parsing was successful. If it is not present (or is null), it will
- * pass the document through an OGCExceptionReport parser.
- * 
- * If errorProperty is undefined for the parser, this error checking mechanism
- * will be disabled.
- *
- *
- * 
- * Inherits from:
- *  - <OpenLayers.Format.XML>
- */
-OpenLayers.Format.XML.VersionedOGC = OpenLayers.Class(OpenLayers.Format.XML, {
-    
     /**
     /**
-     * APIProperty: defaultVersion
-     * {String} Version number to assume if none found.
+     * Property: oldOnselectstart
+     * {Function}
      */
      */
-    defaultVersion: null,
+    oldOnselectstart: null,
     
     /**
     
     /**
-     * APIProperty: version
-     * {String} Specify a version string if one is known.
-     */
-    version: null,
-
-    /**
-     * APIProperty: profile
-     * {String} If provided, use a custom profile.
-     */
-    profile: null,
-
-    /**
-     * APIProperty: allowFallback
-     * {Boolean} If a profiled parser cannot be found for the returned version,
-     * use a non-profiled parser as the fallback. Application code using this
-     * should take into account that the return object structure might be
-     * missing the specifics of the profile. Defaults to false.
+     * Property: interval
+     * {Integer} In order to increase performance, an interval (in 
+     *     milliseconds) can be set to reduce the number of drag events 
+     *     called. If set, a new drag event will not be set until the 
+     *     interval has passed. 
+     *     Defaults to 0, meaning no interval. 
      */
      */
-    allowFallback: false,
-
+    interval: 0,
+    
     /**
     /**
-     * Property: name
-     * {String} The name of this parser, this is the part of the CLASS_NAME
-     * except for "OpenLayers.Format."
+     * Property: timeoutId
+     * {String} The id of the timeout used for the mousedown interval.
+     *     This is "private", and should be left alone.
      */
      */
-    name: null,
-
+    timeoutId: null,
+    
     /**
     /**
-     * APIProperty: stringifyOutput
-     * {Boolean} If true, write will return a string otherwise a DOMElement.
-     * Default is false.
+     * APIProperty: documentDrag
+     * {Boolean} If set to true, the handler will also handle mouse moves when
+     *     the cursor has moved out of the map viewport. Default is false.
      */
      */
-    stringifyOutput: false,
-
+    documentDrag: false,
+    
     /**
     /**
-     * Property: parser
-     * {Object} Instance of the versioned parser.  Cached for multiple read and
-     *     write calls of the same version.
+     * Property: documentEvents
+     * {Boolean} Are we currently observing document events?
      */
      */
-    parser: null,
+    documentEvents: null,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Format.XML.VersionedOGC.
-     * Constructor.
-     *
+     * Constructor: OpenLayers.Handler.Drag
+     * Returns OpenLayers.Handler.Drag
+     * 
      * Parameters:
      * Parameters:
-     * options - {Object} Optional object whose properties will be set on
-     *     the object.
+     * control - {<OpenLayers.Control>} The control that is making use of
+     *     this handler.  If a handler is being used without a control, the
+     *     handlers setMap method must be overridden to deal properly with
+     *     the map.
+     * callbacks - {Object} An object containing a single function to be
+     *     called when the drag operation is finished. The callback should
+     *     expect to receive a single argument, the pixel location of the event.
+     *     Callbacks for 'move' and 'done' are supported. You can also speficy
+     *     callbacks for 'down', 'up', and 'out' to respond to those events.
+     * options - {Object} 
      */
      */
-    initialize: function(options) {
-        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
-        var className = this.CLASS_NAME;
-        this.name = className.substring(className.lastIndexOf(".")+1);
+    initialize: function(control, callbacks, options) {
+        OpenLayers.Handler.prototype.initialize.apply(this, arguments);
+        
+        if (this.documentDrag === true) {
+            var me = this;
+            this._docMove = function(evt) {
+                me.mousemove({
+                    xy: {x: evt.clientX, y: evt.clientY},
+                    element: document
+                });
+            };
+            this._docUp = function(evt) {
+                me.mouseup({xy: {x: evt.clientX, y: evt.clientY}});
+            };
+        }
     },
 
     },
 
+    
     /**
     /**
-     * Method: getVersion
-     * Returns the version to use. Subclasses can override this function
-     * if a different version detection is needed.
+     * Method: dragstart
+     * This private method is factorized from mousedown and touchstart methods
      *
      * Parameters:
      *
      * Parameters:
-     * root - {DOMElement}
-     * options - {Object} Optional configuration object.
+     * evt - {Event} The event
      *
      * Returns:
      *
      * Returns:
-     * {String} The version to use.
+     * {Boolean} Let the event propagate.
      */
      */
-    getVersion: function(root, options) {
-        var version;
-        // read
-        if (root) {
-            version = this.version;
-            if(!version) {
-                version = root.getAttribute("version");
-                if(!version) {
-                    version = this.defaultVersion;
-                }
+    dragstart: function (evt) {
+        var propagate = true;
+        this.dragging = false;
+        if (this.checkModifiers(evt) &&
+               this._pointerId == evt.pointerId &&
+               (OpenLayers.Event.isLeftClick(evt) ||
+                OpenLayers.Event.isSingleTouch(evt))) {
+            this.started = true;
+            this.start = evt.xy;
+            this.last = evt.xy;
+            OpenLayers.Element.addClass(
+                this.map.viewPortDiv, "olDragDown"
+            );
+            this.down(evt);
+            this.callback("down", [evt.xy]);
+
+            // prevent document dragging
+            OpenLayers.Event.preventDefault(evt);
+
+            if(!this.oldOnselectstart) {
+                this.oldOnselectstart = document.onselectstart ?
+                    document.onselectstart : OpenLayers.Function.True;
             }
             }
-        } else { // write
-            version = (options && options.version) || 
-                this.version || this.defaultVersion;
+            document.onselectstart = OpenLayers.Function.False;
+
+            propagate = !this.stopDown;
+        } else {
+            delete this._pointerId;
+            this.started = false;
+            this.start = null;
+            this.last = null;
         }
         }
-        return version;
+        return propagate;
     },
 
     /**
     },
 
     /**
-     * Method: getParser
-     * Get an instance of the cached parser if available, otherwise create one.
+     * Method: dragmove
+     * This private method is factorized from mousemove and touchmove methods
      *
      * Parameters:
      *
      * Parameters:
-     * version - {String}
+     * evt - {Event} The event
      *
      * Returns:
      *
      * Returns:
-     * {<OpenLayers.Format>}
+     * {Boolean} Let the event propagate.
      */
      */
-    getParser: function(version) {
-        version = version || this.defaultVersion;
-        var profile = this.profile ? "_" + this.profile : "";
-        if(!this.parser || this.parser.VERSION != version) {
-            var format = OpenLayers.Format[this.name][
-                "v" + version.replace(/\./g, "_") + profile
-            ];
-            if(!format) {
-                if (profile !== "" && this.allowFallback) {
-                    // fallback to the non-profiled version of the parser
-                    profile = "";
-                    format = OpenLayers.Format[this.name][
-                        "v" + version.replace(/\./g, "_")
-                    ];
-                }
-                if (!format) {
-                    throw "Can't find a " + this.name + " parser for version " +
-                          version + profile;
+    dragmove: function (evt) {
+        this.lastMoveEvt = evt;
+        if (this.started && this._pointerId == evt.pointerId &&
+            !this.timeoutId && (evt.xy.x != this.last.x ||
+                                evt.xy.y != this.last.y)) {
+            if(this.documentDrag === true && this.documentEvents) {
+                if(evt.element === document) {
+                    this.adjustXY(evt);
+                    // do setEvent manually because the documentEvents are not
+                    // registered with the map
+                    this.setEvent(evt);
+                } else {
+                    this.removeDocumentEvents();
                 }
             }
                 }
             }
-            this.parser = new format(this.options);
+            if (this.interval > 0) {
+                this.timeoutId = setTimeout(
+                    OpenLayers.Function.bind(this.removeTimeout, this),
+                    this.interval);
+            }
+            this.dragging = true;
+
+            this.move(evt);
+            this.callback("move", [evt.xy]);
+            if(!this.oldOnselectstart) {
+                this.oldOnselectstart = document.onselectstart;
+                document.onselectstart = OpenLayers.Function.False;
+            }
+            this.last = evt.xy;
         }
         }
-        return this.parser;
+        return true;
     },
 
     /**
     },
 
     /**
-     * APIMethod: write
-     * Write a document.
+     * Method: dragend
+     * This private method is factorized from mouseup and touchend methods
      *
      * Parameters:
      *
      * Parameters:
-     * obj - {Object} An object representing the document.
-     * options - {Object} Optional configuration object.
+     * evt - {Event} The event
      *
      * Returns:
      *
      * Returns:
-     * {String} The document as a string
+     * {Boolean} Let the event propagate.
      */
      */
-    write: function(obj, options) {
-        var version = this.getVersion(null, options);
-        this.parser = this.getParser(version);
-        var root = this.parser.write(obj, options);
-        if (this.stringifyOutput === false) {
-            return root;
-        } else {
-            return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
-        }
-    },
+    dragend: function (evt) {
+        if (this.started && this._pointerId == evt.pointerId) {
+            if(this.documentDrag === true && this.documentEvents) {
+                this.adjustXY(evt);
+                this.removeDocumentEvents();
+            }
+            var dragged = (this.start != this.last);
+            this.started = false;
+            this.dragging = false;
+            delete this._pointerId;
+            OpenLayers.Element.removeClass(
+                this.map.viewPortDiv, "olDragDown"
+            );
+            this.up(evt);
+            this.callback("up", [evt.xy]);
+            if(dragged) {
+                this.callback("done", [evt.xy]);
+            }
+            document.onselectstart = this.oldOnselectstart;
+        }
+        return true;
+    },
 
     /**
 
     /**
-     * APIMethod: read
-     * Read a doc and return an object representing the document.
+     * The four methods below (down, move, up, and out) are used by subclasses
+     *     to do their own processing related to these mouse events.
+     */
+
+    /**
+     * Method: down
+     * This method is called during the handling of the mouse down event.
+     *     Subclasses can do their own processing here.
      *
      * Parameters:
      *
      * Parameters:
-     * data - {String | DOMElement} Data to read.
-     * options - {Object} Options for the reader.
-     *
-     * Returns:
-     * {Object} An object representing the document.
+     * evt - {Event} The mouse down event
      */
      */
-    read: function(data, options) {
-        if(typeof data == "string") {
-            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
-        }
-        var root = data.documentElement;
-        var version = this.getVersion(root);
-        this.parser = this.getParser(version);          // Select the parser
-        var obj = this.parser.read(data, options);      // Parse the data
-
-        var errorProperty = this.parser.errorProperty || null;
-        if (errorProperty !== null && obj[errorProperty] === undefined) {
-            // an error must have happened, so parse it and report back
-            var format = new OpenLayers.Format.OGCExceptionReport();
-            obj.error = format.read(data);
-        }
-        obj.version = version;
-        return obj;
+    down: function(evt) {
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Format.XML.VersionedOGC"
-});
-/* ======================================================================
-    OpenLayers/Filter/FeatureId.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-
-/**
- * @requires OpenLayers/Filter.js
- */
+    /**
+     * Method: move
+     * This method is called during the handling of the mouse move event.
+     *     Subclasses can do their own processing here.
+     *
+     * Parameters:
+     * evt - {Event} The mouse move event
+     *
+     */
+    move: function(evt) {
+    },
 
 
-/**
- * Class: OpenLayers.Filter.FeatureId
- * This class represents a ogc:FeatureId Filter, as being used for rule-based SLD
- * styling
- * 
- * Inherits from:
- * - <OpenLayers.Filter>
- */
-OpenLayers.Filter.FeatureId = OpenLayers.Class(OpenLayers.Filter, {
+    /**
+     * Method: up
+     * This method is called during the handling of the mouse up event.
+     *     Subclasses can do their own processing here.
+     *
+     * Parameters:
+     * evt - {Event} The mouse up event
+     */
+    up: function(evt) {
+    },
 
 
-    /** 
-     * APIProperty: fids
-     * {Array(String)} Feature Ids to evaluate this rule against. 
-     *     To be passed inside the params object.
+    /**
+     * Method: out
+     * This method is called during the handling of the mouse out event.
+     *     Subclasses can do their own processing here.
+     *
+     * Parameters:
+     * evt - {Event} The mouse out event
      */
      */
-    fids: null,
-    
-    /** 
-     * Property: type
-     * {String} Type to identify this filter.
+    out: function(evt) {
+    },
+
+    /**
+     * The methods below are part of the magic of event handling.  Because
+     *     they are named like browser events, they are registered as listeners
+     *     for the events they represent.
      */
      */
-    type: "FID",
-    
-    /** 
-     * Constructor: OpenLayers.Filter.FeatureId
-     * Creates an ogc:FeatureId rule.
+
+    /**
+     * Method: mousedown
+     * Handle mousedown events
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} An optional object with properties to set on the
-     *           rule
-     * 
+     * evt - {Event}
+     *
      * Returns:
      * Returns:
-     * {<OpenLayers.Filter.FeatureId>}
+     * {Boolean} Let the event propagate.
      */
      */
-    initialize: function(options) {
-        this.fids = [];
-        OpenLayers.Filter.prototype.initialize.apply(this, [options]);
+    mousedown: function(evt) {
+        return this.dragstart(evt);
     },
 
     /**
     },
 
     /**
-     * APIMethod: evaluate
-     * evaluates this rule for a specific feature
-     * 
+     * Method: touchstart
+     * Handle touchstart events
+     *
      * Parameters:
      * Parameters:
-     * feature - {<OpenLayers.Feature>} feature to apply the rule to.
-     *           For vector features, the check is run against the fid,
-     *           for plain features against the id.
-     * 
+     * evt - {Event}
+     *
      * Returns:
      * Returns:
-     * {Boolean} true if the rule applies, false if it does not
+     * {Boolean} Let the event propagate.
      */
      */
-    evaluate: function(feature) {
-        for (var i=0, len=this.fids.length; i<len; i++) {
-            var fid = feature.fid || feature.id;
-            if (fid == this.fids[i]) {
-                return true;
-            }
+    touchstart: function(evt) {
+        this.startTouch();
+        // only allow the first pointer event to be monitored by noting its pointerId
+        // which is unique in the pointer model (and undefined in the touch model)
+        if (!("_pointerId" in this)) {
+            this._pointerId = evt.pointerId;
         }
         }
-        return false;
+        return this.dragstart(evt);
     },
     },
-    
+
     /**
     /**
-     * APIMethod: clone
-     * Clones this filter.
-     * 
+     * Method: mousemove
+     * Handle mousemove events
+     *
+     * Parameters:
+     * evt - {Event}
+     *
      * Returns:
      * Returns:
-     * {<OpenLayers.Filter.FeatureId>} Clone of this filter.
+     * {Boolean} Let the event propagate.
      */
      */
-    clone: function() {
-        var filter = new OpenLayers.Filter.FeatureId();
-        OpenLayers.Util.extend(filter, this);
-        filter.fids = this.fids.slice();
-        return filter;
+    mousemove: function(evt) {
+        return this.dragmove(evt);
     },
     },
-    
-    CLASS_NAME: "OpenLayers.Filter.FeatureId"
-});
-/* ======================================================================
-    OpenLayers/Filter/Logical.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-
-/**
- * @requires OpenLayers/Filter.js
- */
-
-/**
- * Class: OpenLayers.Filter.Logical
- * This class represents ogc:And, ogc:Or and ogc:Not rules.
- * 
- * Inherits from:
- * - <OpenLayers.Filter>
- */
-OpenLayers.Filter.Logical = OpenLayers.Class(OpenLayers.Filter, {
 
     /**
 
     /**
-     * APIProperty: filters
-     * {Array(<OpenLayers.Filter>)} Child filters for this filter.
+     * Method: touchmove
+     * Handle touchmove events
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Boolean} Let the event propagate.
      */
      */
-    filters: null, 
-     
+    touchmove: function(evt) {
+        return this.dragmove(evt);
+    },
+
     /**
     /**
-     * APIProperty: type
-     * {String} type of logical operator. Available types are:
-     * - OpenLayers.Filter.Logical.AND = "&&";
-     * - OpenLayers.Filter.Logical.OR  = "||";
-     * - OpenLayers.Filter.Logical.NOT = "!";
+     * Method: removeTimeout
+     * Private. Called by mousemove() to remove the drag timeout.
      */
      */
-    type: null,
+    removeTimeout: function() {
+        this.timeoutId = null;
+        // if timeout expires while we're still dragging (mouseup
+        // hasn't occurred) then call mousemove to move to the
+        // correct position
+        if(this.dragging) {
+            this.mousemove(this.lastMoveEvt);
+        }
+    },
 
 
-    /** 
-     * Constructor: OpenLayers.Filter.Logical
-     * Creates a logical filter (And, Or, Not).
+    /**
+     * Method: mouseup
+     * Handle mouseup events
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} An optional object with properties to set on the
-     *     filter.
-     * 
+     * evt - {Event}
+     *
      * Returns:
      * Returns:
-     * {<OpenLayers.Filter.Logical>}
+     * {Boolean} Let the event propagate.
      */
      */
-    initialize: function(options) {
-        this.filters = [];
-        OpenLayers.Filter.prototype.initialize.apply(this, [options]);
+    mouseup: function(evt) {
+        return this.dragend(evt);
     },
     },
-    
-    /** 
-     * APIMethod: destroy
-     * Remove reference to child filters.
+
+    /**
+     * Method: touchend
+     * Handle touchend events
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Boolean} Let the event propagate.
      */
      */
-    destroy: function() {
-        this.filters = null;
-        OpenLayers.Filter.prototype.destroy.apply(this);
+    touchend: function(evt) {
+        // override evt.xy with last position since touchend does not have
+        // any touch position
+        evt.xy = this.last;
+        return this.dragend(evt);
     },
 
     /**
     },
 
     /**
-     * APIMethod: evaluate
-     * Evaluates this filter in a specific context.
-     * 
+     * Method: mouseout
+     * Handle mouseout events
+     *
      * Parameters:
      * Parameters:
-     * context - {Object} Context to use in evaluating the filter.  A vector
-     *     feature may also be provided to evaluate feature attributes in 
-     *     comparison filters or geometries in spatial filters.
-     * 
+     * evt - {Event}
+     *
      * Returns:
      * Returns:
-     * {Boolean} The filter applies.
+     * {Boolean} Let the event propagate.
      */
      */
-    evaluate: function(context) {
-        var i, len;
-        switch(this.type) {
-            case OpenLayers.Filter.Logical.AND:
-                for (i=0, len=this.filters.length; i<len; i++) {
-                    if (this.filters[i].evaluate(context) == false) {
-                        return false;
-                    }
+    mouseout: function (evt) {
+        if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.viewPortDiv)) {
+            if(this.documentDrag === true) {
+                this.addDocumentEvents();
+            } else {
+                var dragged = (this.start != this.last);
+                this.started = false; 
+                this.dragging = false;
+                OpenLayers.Element.removeClass(
+                    this.map.viewPortDiv, "olDragDown"
+                );
+                this.out(evt);
+                this.callback("out", []);
+                if(dragged) {
+                    this.callback("done", [evt.xy]);
                 }
                 }
-                return true;
-                
-            case OpenLayers.Filter.Logical.OR:
-                for (i=0, len=this.filters.length; i<len; i++) {
-                    if (this.filters[i].evaluate(context) == true) {
-                        return true;
-                    }
+                if(document.onselectstart) {
+                    document.onselectstart = this.oldOnselectstart;
                 }
                 }
-                return false;
-            
-            case OpenLayers.Filter.Logical.NOT:
-                return (!this.filters[0].evaluate(context));
+            }
         }
         }
-        return undefined;
+        return true;
     },
     },
-    
+
     /**
     /**
-     * APIMethod: clone
-     * Clones this filter.
+     * Method: click
+     * The drag handler captures the click event.  If something else registers
+     *     for clicks on the same element, its listener will not be called 
+     *     after a drag.
+     * 
+     * Parameters: 
+     * evt - {Event} 
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Filter.Logical>} Clone of this filter.
+     * {Boolean} Let the event propagate.
      */
      */
-    clone: function() {
-        var filters = [];        
-        for(var i=0, len=this.filters.length; i<len; ++i) {
-            filters.push(this.filters[i].clone());
+    click: function (evt) {
+        // let the click event propagate only if the mouse moved
+        return (this.start == this.last);
+    },
+
+    /**
+     * Method: activate
+     * Activate the handler.
+     * 
+     * Returns:
+     * {Boolean} The handler was successfully activated.
+     */
+    activate: function() {
+        var activated = false;
+        if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
+            this.dragging = false;
+            activated = true;
         }
         }
-        return new OpenLayers.Filter.Logical({
-            type: this.type,
-            filters: filters
-        });
+        return activated;
     },
     },
-    
-    CLASS_NAME: "OpenLayers.Filter.Logical"
-});
 
 
+    /**
+     * Method: deactivate 
+     * Deactivate the handler.
+     * 
+     * Returns:
+     * {Boolean} The handler was successfully deactivated.
+     */
+    deactivate: function() {
+        var deactivated = false;
+        if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+            this.started = false;
+            this.dragging = false;
+            this.start = null;
+            this.last = null;
+            deactivated = true;
+            OpenLayers.Element.removeClass(
+                this.map.viewPortDiv, "olDragDown"
+            );
+        }
+        return deactivated;
+    },
+    
+    /**
+     * Method: adjustXY
+     * Converts event coordinates that are relative to the document body to
+     * ones that are relative to the map viewport. The latter is the default in
+     * OpenLayers.
+     * 
+     * Parameters:
+     * evt - {Object}
+     */
+    adjustXY: function(evt) {
+        var pos = OpenLayers.Util.pagePosition(this.map.viewPortDiv);
+        evt.xy.x -= pos[0];
+        evt.xy.y -= pos[1];
+    },
+    
+    /**
+     * Method: addDocumentEvents
+     * Start observing document events when documentDrag is true and the mouse
+     * cursor leaves the map viewport while dragging.
+     */
+    addDocumentEvents: function() {
+        OpenLayers.Element.addClass(document.body, "olDragDown");
+        this.documentEvents = true;
+        OpenLayers.Event.observe(document, "mousemove", this._docMove);
+        OpenLayers.Event.observe(document, "mouseup", this._docUp);
+    },
+    
+    /**
+     * Method: removeDocumentEvents
+     * Stops observing document events when documentDrag is true and the mouse
+     * cursor re-enters the map viewport while dragging.
+     */
+    removeDocumentEvents: function() {
+        OpenLayers.Element.removeClass(document.body, "olDragDown");
+        this.documentEvents = false;
+        OpenLayers.Event.stopObserving(document, "mousemove", this._docMove);
+        OpenLayers.Event.stopObserving(document, "mouseup", this._docUp);
+    },
 
 
-OpenLayers.Filter.Logical.AND = "&&";
-OpenLayers.Filter.Logical.OR  = "||";
-OpenLayers.Filter.Logical.NOT = "!";
+    CLASS_NAME: "OpenLayers.Handler.Drag"
+});
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Filter/Comparison.js
+    OpenLayers/Handler/Box.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Filter.js
+ * @requires OpenLayers/Handler.js
+ * @requires OpenLayers/Handler/Drag.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Filter.Comparison
- * This class represents a comparison filter.
- * 
+ * Class: OpenLayers.Handler.Box
+ * Handler for dragging a rectangle across the map.  Box is displayed 
+ * on mouse down, moves on mouse move, and is finished on mouse up.
+ *
  * Inherits from:
  * Inherits from:
- * - <OpenLayers.Filter>
+ *  - <OpenLayers.Handler> 
  */
  */
-OpenLayers.Filter.Comparison = OpenLayers.Class(OpenLayers.Filter, {
+OpenLayers.Handler.Box = OpenLayers.Class(OpenLayers.Handler, {
 
 
-    /**
-     * APIProperty: type
-     * {String} type: type of the comparison. This is one of
-     * - OpenLayers.Filter.Comparison.EQUAL_TO                 = "==";
-     * - OpenLayers.Filter.Comparison.NOT_EQUAL_TO             = "!=";
-     * - OpenLayers.Filter.Comparison.LESS_THAN                = "<";
-     * - OpenLayers.Filter.Comparison.GREATER_THAN             = ">";
-     * - OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO    = "<=";
-     * - OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
-     * - OpenLayers.Filter.Comparison.BETWEEN                  = "..";
-     * - OpenLayers.Filter.Comparison.LIKE                     = "~";
-     * - OpenLayers.Filter.Comparison.IS_NULL                  = "NULL";
-     */
-    type: null,
-    
-    /**
-     * APIProperty: property
-     * {String}
-     * name of the context property to compare
+    /** 
+     * Property: dragHandler 
+     * {<OpenLayers.Handler.Drag>} 
      */
      */
-    property: null,
-    
+    dragHandler: null,
+
     /**
     /**
-     * APIProperty: value
-     * {Number} or {String}
-     * comparison value for binary comparisons. In the case of a String, this
-     * can be a combination of text and propertyNames in the form
-     * "literal ${propertyName}"
+     * APIProperty: boxDivClassName
+     * {String} The CSS class to use for drawing the box. Default is
+     *     olHandlerBoxZoomBox
      */
      */
-    value: null,
+    boxDivClassName: 'olHandlerBoxZoomBox',
     
     /**
     
     /**
-     * Property: matchCase
-     * {Boolean} Force case sensitive searches for EQUAL_TO and NOT_EQUAL_TO
-     *     comparisons.  The Filter Encoding 1.1 specification added a matchCase
-     *     attribute to ogc:PropertyIsEqualTo and ogc:PropertyIsNotEqualTo
-     *     elements.  This property will be serialized with those elements only
-     *     if using the v1.1.0 filter format. However, when evaluating filters
-     *     here, the matchCase property will always be respected (for EQUAL_TO
-     *     and NOT_EQUAL_TO).  Default is true. 
+     * Property: boxOffsets
+     * {Object} Caches box offsets from css. This is used by the getBoxOffsets
+     * method.
      */
      */
-    matchCase: true,
-    
+    boxOffsets: null,
+
     /**
     /**
-     * APIProperty: lowerBoundary
-     * {Number} or {String}
-     * lower boundary for between comparisons. In the case of a String, this
-     * can be a combination of text and propertyNames in the form
-     * "literal ${propertyName}"
-     */
-    lowerBoundary: null,
-    
-    /**
-     * APIProperty: upperBoundary
-     * {Number} or {String}
-     * upper boundary for between comparisons. In the case of a String, this
-     * can be a combination of text and propertyNames in the form
-     * "literal ${propertyName}"
-     */
-    upperBoundary: null,
-
-    /** 
-     * Constructor: OpenLayers.Filter.Comparison
-     * Creates a comparison rule.
+     * Constructor: OpenLayers.Handler.Box
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} An optional object with properties to set on the
-     *           rule
-     * 
-     * Returns:
-     * {<OpenLayers.Filter.Comparison>}
+     * control - {<OpenLayers.Control>} 
+     * callbacks - {Object} An object with a properties whose values are
+     *     functions.  Various callbacks described below.
+     * options - {Object} 
+     *
+     * Named callbacks:
+     * start - Called when the box drag operation starts.
+     * done - Called when the box drag operation is finished.
+     *     The callback should expect to receive a single argument, the box 
+     *     bounds or a pixel. If the box dragging didn't span more than a 5 
+     *     pixel distance, a pixel will be returned instead of a bounds object.
      */
      */
-    initialize: function(options) {
-        OpenLayers.Filter.prototype.initialize.apply(this, [options]);
-        // since matchCase on PropertyIsLike is not schema compliant, we only
-        // want to use this if explicitly asked for
-        if (this.type === OpenLayers.Filter.Comparison.LIKE 
-            && options.matchCase === undefined) {
-                this.matchCase = null;
-        }
+    initialize: function(control, callbacks, options) {
+        OpenLayers.Handler.prototype.initialize.apply(this, arguments);
+        this.dragHandler = new OpenLayers.Handler.Drag(
+            this, 
+            {
+                down: this.startBox, 
+                move: this.moveBox, 
+                out: this.removeBox,
+                up: this.endBox
+            }, 
+            {keyMask: this.keyMask}
+        );
     },
 
     /**
     },
 
     /**
-     * APIMethod: evaluate
-     * Evaluates this filter in a specific context.
-     * 
-     * Parameters:
-     * context - {Object} Context to use in evaluating the filter.  If a vector
-     *     feature is provided, the feature.attributes will be used as context.
-     * 
-     * Returns:
-     * {Boolean} The filter applies.
+     * Method: destroy
      */
      */
-    evaluate: function(context) {
-        if (context instanceof OpenLayers.Feature.Vector) {
-            context = context.attributes;
-        }
-        var result = false;
-        var got = context[this.property];
-        var exp;
-        switch(this.type) {
-            case OpenLayers.Filter.Comparison.EQUAL_TO:
-                exp = this.value;
-                if(!this.matchCase &&
-                   typeof got == "string" && typeof exp == "string") {
-                    result = (got.toUpperCase() == exp.toUpperCase());
-                } else {
-                    result = (got == exp);
-                }
-                break;
-            case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:
-                exp = this.value;
-                if(!this.matchCase &&
-                   typeof got == "string" && typeof exp == "string") {
-                    result = (got.toUpperCase() != exp.toUpperCase());
-                } else {
-                    result = (got != exp);
-                }
-                break;
-            case OpenLayers.Filter.Comparison.LESS_THAN:
-                result = got < this.value;
-                break;
-            case OpenLayers.Filter.Comparison.GREATER_THAN:
-                result = got > this.value;
-                break;
-            case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:
-                result = got <= this.value;
-                break;
-            case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:
-                result = got >= this.value;
-                break;
-            case OpenLayers.Filter.Comparison.BETWEEN:
-                result = (got >= this.lowerBoundary) &&
-                    (got <= this.upperBoundary);
-                break;
-            case OpenLayers.Filter.Comparison.LIKE:
-                var regexp = new RegExp(this.value, "gi");
-                result = regexp.test(got);
-                break;
-            case OpenLayers.Filter.Comparison.IS_NULL:
-                result = (got === null);
-                break;
-        }
-        return result;
+    destroy: function() {
+        OpenLayers.Handler.prototype.destroy.apply(this, arguments);
+        if (this.dragHandler) {
+            this.dragHandler.destroy();
+            this.dragHandler = null;
+        }            
     },
     },
-    
+
     /**
     /**
-     * APIMethod: value2regex
-     * Converts the value of this rule into a regular expression string,
-     * according to the wildcard characters specified. This method has to
-     * be called after instantiation of this class, if the value is not a
-     * regular expression already.
-     * 
-     * Parameters:
-     * wildCard   - {Char} wildcard character in the above value, default
-     *              is "*"
-     * singleChar - {Char} single-character wildcard in the above value
-     *              default is "."
-     * escapeChar - {Char} escape character in the above value, default is
-     *              "!"
-     * 
-     * Returns:
-     * {String} regular expression string
+     * Method: setMap
      */
      */
-    value2regex: function(wildCard, singleChar, escapeChar) {
-        if (wildCard == ".") {
-            throw new Error("'.' is an unsupported wildCard character for " +
-                            "OpenLayers.Filter.Comparison");
+    setMap: function (map) {
+        OpenLayers.Handler.prototype.setMap.apply(this, arguments);
+        if (this.dragHandler) {
+            this.dragHandler.setMap(map);
         }
         }
-        
+    },
 
 
-        // set UMN MapServer defaults for unspecified parameters
-        wildCard = wildCard ? wildCard : "*";
-        singleChar = singleChar ? singleChar : ".";
-        escapeChar = escapeChar ? escapeChar : "!";
+    /**
+    * Method: startBox
+    *
+    * Parameters:
+    * xy - {<OpenLayers.Pixel>}
+    */
+    startBox: function (xy) {
+        this.callback("start", []);
+        this.zoomBox = OpenLayers.Util.createDiv('zoomBox', {
+            x: -9999, y: -9999
+        });
+        this.zoomBox.className = this.boxDivClassName;                                         
+        this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
         
         
-        this.value = this.value.replace(
-                new RegExp("\\"+escapeChar+"(.|$)", "g"), "\\$1");
-        this.value = this.value.replace(
-                new RegExp("\\"+singleChar, "g"), ".");
-        this.value = this.value.replace(
-                new RegExp("\\"+wildCard, "g"), ".*");
-        this.value = this.value.replace(
-                new RegExp("\\\\.\\*", "g"), "\\"+wildCard);
-        this.value = this.value.replace(
-                new RegExp("\\\\\\.", "g"), "\\"+singleChar);
+        this.map.viewPortDiv.appendChild(this.zoomBox);
         
         
-        return this.value;
+        OpenLayers.Element.addClass(
+            this.map.viewPortDiv, "olDrawBox"
+        );
     },
     },
-    
+
     /**
     /**
-     * Method: regex2value
-     * Convert the value of this rule from a regular expression string into an
-     *     ogc literal string using a wildCard of *, a singleChar of ., and an
-     *     escape of !.  Leaves the <value> property unmodified.
-     * 
-     * Returns:
-     * {String} A string value.
+    * Method: moveBox
+    */
+    moveBox: function (xy) {
+        var startX = this.dragHandler.start.x;
+        var startY = this.dragHandler.start.y;
+        var deltaX = Math.abs(startX - xy.x);
+        var deltaY = Math.abs(startY - xy.y);
+
+        var offset = this.getBoxOffsets();
+        this.zoomBox.style.width = (deltaX + offset.width + 1) + "px";
+        this.zoomBox.style.height = (deltaY + offset.height + 1) + "px";
+        this.zoomBox.style.left = (xy.x < startX ?
+            startX - deltaX - offset.left : startX - offset.left) + "px";
+        this.zoomBox.style.top = (xy.y < startY ?
+            startY - deltaY - offset.top : startY - offset.top) + "px";
+    },
+
+    /**
+    * Method: endBox
+    */
+    endBox: function(end) {
+        var result;
+        if (Math.abs(this.dragHandler.start.x - end.x) > 5 ||    
+            Math.abs(this.dragHandler.start.y - end.y) > 5) {   
+            var start = this.dragHandler.start;
+            var top = Math.min(start.y, end.y);
+            var bottom = Math.max(start.y, end.y);
+            var left = Math.min(start.x, end.x);
+            var right = Math.max(start.x, end.x);
+            result = new OpenLayers.Bounds(left, bottom, right, top);
+        } else {
+            result = this.dragHandler.start.clone(); // i.e. OL.Pixel
+        } 
+        this.removeBox();
+
+        this.callback("done", [result]);
+    },
+
+    /**
+     * Method: removeBox
+     * Remove the zoombox from the screen and nullify our reference to it.
      */
      */
-    regex2value: function() {
-        
-        var value = this.value;
-        
-        // replace ! with !!
-        value = value.replace(/!/g, "!!");
+    removeBox: function() {
+        this.map.viewPortDiv.removeChild(this.zoomBox);
+        this.zoomBox = null;
+        this.boxOffsets = null;
+        OpenLayers.Element.removeClass(
+            this.map.viewPortDiv, "olDrawBox"
+        );
 
 
-        // replace \. with !. (watching out for \\.)
-        value = value.replace(/(\\)?\\\./g, function($0, $1) {
-            return $1 ? $0 : "!.";
-        });
-        
-        // replace \* with #* (watching out for \\*)
-        value = value.replace(/(\\)?\\\*/g, function($0, $1) {
-            return $1 ? $0 : "!*";
-        });
-        
-        // replace \\ with \
-        value = value.replace(/\\\\/g, "\\");
+    },
 
 
-        // convert .* to * (the sequence #.* is not allowed)
-        value = value.replace(/\.\*/g, "*");
-        
-        return value;
+    /**
+     * Method: activate
+     */
+    activate: function () {
+        if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
+            this.dragHandler.activate();
+            return true;
+        } else {
+            return false;
+        }
+    },
+
+    /**
+     * Method: deactivate
+     */
+    deactivate: function () {
+        if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+            if (this.dragHandler.deactivate()) {
+                if (this.zoomBox) {
+                    this.removeBox();
+                }
+            }
+            return true;
+        } else {
+            return false;
+        }
     },
     
     /**
     },
     
     /**
-     * APIMethod: clone
-     * Clones this filter.
+     * Method: getBoxOffsets
+     * Determines border offsets for a box, according to the box model.
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Filter.Comparison>} Clone of this filter.
+     * {Object} an object with the following offsets:
+     *     - left
+     *     - right
+     *     - top
+     *     - bottom
+     *     - width
+     *     - height
      */
      */
-    clone: function() {
-        return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison(), this);
+    getBoxOffsets: function() {
+        if (!this.boxOffsets) {
+            // Determine the box model. If the testDiv's clientWidth is 3, then
+            // the borders are outside and we are dealing with the w3c box
+            // model. Otherwise, the browser uses the traditional box model and
+            // the borders are inside the box bounds, leaving us with a
+            // clientWidth of 1.
+            var testDiv = document.createElement("div");
+            //testDiv.style.visibility = "hidden";
+            testDiv.style.position = "absolute";
+            testDiv.style.border = "1px solid black";
+            testDiv.style.width = "3px";
+            document.body.appendChild(testDiv);
+            var w3cBoxModel = testDiv.clientWidth == 3;
+            document.body.removeChild(testDiv);
+            
+            var left = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
+                "border-left-width"));
+            var right = parseInt(OpenLayers.Element.getStyle(
+                this.zoomBox, "border-right-width"));
+            var top = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
+                "border-top-width"));
+            var bottom = parseInt(OpenLayers.Element.getStyle(
+                this.zoomBox, "border-bottom-width"));
+            this.boxOffsets = {
+                left: left,
+                right: right,
+                top: top,
+                bottom: bottom,
+                width: w3cBoxModel === false ? left + right : 0,
+                height: w3cBoxModel === false ? top + bottom : 0
+            };
+        }
+        return this.boxOffsets;
     },
     },
-    
-    CLASS_NAME: "OpenLayers.Filter.Comparison"
+  
+    CLASS_NAME: "OpenLayers.Handler.Box"
 });
 });
-
-
-OpenLayers.Filter.Comparison.EQUAL_TO                 = "==";
-OpenLayers.Filter.Comparison.NOT_EQUAL_TO             = "!=";
-OpenLayers.Filter.Comparison.LESS_THAN                = "<";
-OpenLayers.Filter.Comparison.GREATER_THAN             = ">";
-OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO    = "<=";
-OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
-OpenLayers.Filter.Comparison.BETWEEN                  = "..";
-OpenLayers.Filter.Comparison.LIKE                     = "~";
-OpenLayers.Filter.Comparison.IS_NULL                  = "NULL";
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Format/Filter.js
+    OpenLayers/Control/ZoomBox.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Format/XML/VersionedOGC.js
- * @requires OpenLayers/Filter/FeatureId.js
- * @requires OpenLayers/Filter/Logical.js
- * @requires OpenLayers/Filter/Comparison.js
+ * @requires OpenLayers/Control.js
+ * @requires OpenLayers/Handler/Box.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Format.Filter
- * Read/Write ogc:Filter. Create a new instance with the <OpenLayers.Format.Filter>
- *     constructor.
- * 
+ * Class: OpenLayers.Control.ZoomBox
+ * The ZoomBox control enables zooming directly to a given extent, by drawing 
+ * a box on the map. The box is drawn by holding down shift, whilst dragging 
+ * the mouse.
+ *
  * Inherits from:
  * Inherits from:
- *  - <OpenLayers.Format.XML.VersionedOGC>
+ *  - <OpenLayers.Control>
  */
  */
-OpenLayers.Format.Filter = OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC, {
-    
+OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
     /**
     /**
-     * APIProperty: defaultVersion
-     * {String} Version number to assume if none found.  Default is "1.0.0".
+     * Property: type
+     * {OpenLayers.Control.TYPE}
      */
      */
-    defaultVersion: "1.0.0",
-    
+    type: OpenLayers.Control.TYPE_TOOL,
+
     /**
     /**
-     * APIMethod: write
-     * Write an ogc:Filter given a filter object.
-     *
-     * Parameters:
-     * filter - {<OpenLayers.Filter>} An filter.
-     * options - {Object} Optional configuration object.
-     *
-     * Returns:
-     * {Elment} An ogc:Filter element node.
+     * Property: out
+     * {Boolean} Should the control be used for zooming out?
+     */
+    out: false,
+
+    /**
+     * APIProperty: keyMask
+     * {Integer} Zoom only occurs if the keyMask matches the combination of 
+     *     keys down. Use bitwise operators and one or more of the
+     *     <OpenLayers.Handler> constants to construct a keyMask. Leave null if 
+     *     not used mask. Default is null.
+     */
+    keyMask: null,
+
+    /**
+     * APIProperty: alwaysZoom
+     * {Boolean} Always zoom in/out when box drawn, even if the zoom level does
+     * not change.
      */
      */
+    alwaysZoom: false,
     
     /**
     
     /**
-     * APIMethod: read
-     * Read and Filter doc and return an object representing the Filter.
+     * APIProperty: zoomOnClick
+     * {Boolean} Should we zoom when no box was dragged, i.e. the user only
+     * clicked? Default is true.
+     */
+    zoomOnClick: true,
+
+    /**
+     * Method: draw
+     */    
+    draw: function() {
+        this.handler = new OpenLayers.Handler.Box( this,
+                            {done: this.zoomBox}, {keyMask: this.keyMask} );
+    },
+
+    /**
+     * Method: zoomBox
      *
      * Parameters:
      *
      * Parameters:
-     * data - {String | DOMElement} Data to read.
-     *
-     * Returns:
-     * {<OpenLayers.Filter>} A filter object.
+     * position - {<OpenLayers.Bounds>} or {<OpenLayers.Pixel>}
      */
      */
+    zoomBox: function (position) {
+        if (position instanceof OpenLayers.Bounds) {
+            var bounds,
+                targetCenterPx = position.getCenterPixel();
+            if (!this.out) {
+                var minXY = this.map.getLonLatFromPixel({
+                    x: position.left,
+                    y: position.bottom
+                });
+                var maxXY = this.map.getLonLatFromPixel({
+                    x: position.right,
+                    y: position.top
+                });
+                bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
+                                               maxXY.lon, maxXY.lat);
+            } else {
+                var pixWidth = position.right - position.left;
+                var pixHeight = position.bottom - position.top;
+                var zoomFactor = Math.min((this.map.size.h / pixHeight),
+                    (this.map.size.w / pixWidth));
+                var extent = this.map.getExtent();
+                var center = this.map.getLonLatFromPixel(targetCenterPx);
+                var xmin = center.lon - (extent.getWidth()/2)*zoomFactor;
+                var xmax = center.lon + (extent.getWidth()/2)*zoomFactor;
+                var ymin = center.lat - (extent.getHeight()/2)*zoomFactor;
+                var ymax = center.lat + (extent.getHeight()/2)*zoomFactor;
+                bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);
+            }
+            // always zoom in/out 
+            var lastZoom = this.map.getZoom(),
+                size = this.map.getSize(),
+                centerPx = {x: size.w / 2, y: size.h / 2},
+                zoom = this.map.getZoomForExtent(bounds),
+                oldRes = this.map.getResolution(),
+                newRes = this.map.getResolutionForZoom(zoom);
+            if (oldRes == newRes) {
+                this.map.setCenter(this.map.getLonLatFromPixel(targetCenterPx));
+            } else {
+              var zoomOriginPx = {
+                    x: (oldRes * targetCenterPx.x - newRes * centerPx.x) /
+                        (oldRes - newRes),
+                    y: (oldRes * targetCenterPx.y - newRes * centerPx.y) /
+                        (oldRes - newRes)
+                };
+                this.map.zoomTo(zoom, zoomOriginPx);
+            }
+            if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){ 
+                this.map.zoomTo(lastZoom + (this.out ? -1 : 1)); 
+            }
+        } else if (this.zoomOnClick) { // it's a pixel
+            if (!this.out) {
+                this.map.zoomTo(this.map.getZoom() + 1, position);
+            } else {
+                this.map.zoomTo(this.map.getZoom() - 1, position);
+            }
+        }
+    },
 
 
-    CLASS_NAME: "OpenLayers.Format.Filter" 
+    CLASS_NAME: "OpenLayers.Control.ZoomBox"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Format/WFST.js
+    OpenLayers/Control/DragPan.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Format.js
+ * @requires OpenLayers/Control.js
+ * @requires OpenLayers/Handler/Drag.js
  */
 
 /**
  */
 
 /**
- * Function: OpenLayers.Format.WFST
- * Used to create a versioned WFS protocol.  Default version is 1.0.0.
+ * Class: OpenLayers.Control.DragPan
+ * The DragPan control pans the map with a drag of the mouse.
  *
  *
- * Returns:
- * {<OpenLayers.Format>} A WFST format of the given version.
+ * Inherits from:
+ *  - <OpenLayers.Control>
  */
  */
-OpenLayers.Format.WFST = function(options) {
-    options = OpenLayers.Util.applyDefaults(
-        options, OpenLayers.Format.WFST.DEFAULTS
-    );
-    var cls = OpenLayers.Format.WFST["v"+options.version.replace(/\./g, "_")];
-    if(!cls) {
-        throw "Unsupported WFST version: " + options.version;
-    }
-    return new cls(options);
-};
-
-/**
- * Constant: OpenLayers.Format.WFST.DEFAULTS
- * {Object} Default properties for the WFST format.
- */
-OpenLayers.Format.WFST.DEFAULTS = {
-    "version": "1.0.0"
-};
-/* ======================================================================
-    OpenLayers/Filter/Spatial.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Filter.js
- */
-
-/**
- * Class: OpenLayers.Filter.Spatial
- * This class represents a spatial filter.
- * Currently implemented: BBOX, DWithin and Intersects
- * 
- * Inherits from:
- * - <OpenLayers.Filter>
- */
-OpenLayers.Filter.Spatial = OpenLayers.Class(OpenLayers.Filter, {
+OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
 
 
+    /** 
+     * Property: type
+     * {OpenLayers.Control.TYPES}
+     */
+    type: OpenLayers.Control.TYPE_TOOL,
+    
     /**
     /**
-     * APIProperty: type
-     * {String} Type of spatial filter.
-     *
-     * The type should be one of:
-     * - OpenLayers.Filter.Spatial.BBOX
-     * - OpenLayers.Filter.Spatial.INTERSECTS
-     * - OpenLayers.Filter.Spatial.DWITHIN
-     * - OpenLayers.Filter.Spatial.WITHIN
-     * - OpenLayers.Filter.Spatial.CONTAINS
+     * Property: panned
+     * {Boolean} The map moved.
      */
      */
-    type: null,
+    panned: false,
     
     /**
     
     /**
-     * APIProperty: property
-     * {String} Name of the context property to compare.
+     * Property: interval
+     * {Integer} The number of milliseconds that should ellapse before
+     *     panning the map again. Defaults to 0 milliseconds, which means that
+     *     no separate cycle is used for panning. In most cases you won't want
+     *     to change this value. For slow machines/devices larger values can be
+     *     tried out.
      */
      */
-    property: null,
+    interval: 0,
     
     /**
     
     /**
-     * APIProperty: value
-     * {<OpenLayers.Bounds> || <OpenLayers.Geometry>} The bounds or geometry
-     *     to be used by the filter.  Use bounds for BBOX filters and geometry
-     *     for INTERSECTS or DWITHIN filters.
+     * APIProperty: documentDrag
+     * {Boolean} If set to true, mouse dragging will continue even if the
+     *     mouse cursor leaves the map viewport. Default is false.
      */
      */
-    value: null,
+    documentDrag: false,
 
     /**
 
     /**
-     * APIProperty: distance
-     * {Number} The distance to use in a DWithin spatial filter.
+     * Property: kinetic
+     * {<OpenLayers.Kinetic>} The OpenLayers.Kinetic object.
      */
      */
-    distance: null,
+    kinetic: null,
 
     /**
 
     /**
-     * APIProperty: distanceUnits
-     * {String} The units to use for the distance, e.g. 'm'.
+     * APIProperty: enableKinetic
+     * {Boolean} Set this option to enable "kinetic dragging". Can be
+     *     set to true or to an object. If set to an object this
+     *     object will be passed to the {<OpenLayers.Kinetic>}
+     *     constructor. Defaults to true.
+     *     To get kinetic dragging, ensure that OpenLayers/Kinetic.js is
+     *     included in your build config.
      */
      */
-    distanceUnits: null,
-    
-    /** 
-     * Constructor: OpenLayers.Filter.Spatial
-     * Creates a spatial filter.
-     *
-     * Parameters:
-     * options - {Object} An optional object with properties to set on the
-     *     filter.
-     * 
-     * Returns:
-     * {<OpenLayers.Filter.Spatial>}
+    enableKinetic: true,
+
+    /**
+     * APIProperty: kineticInterval
+     * {Integer} Interval in milliseconds between 2 steps in the "kinetic
+     *     scrolling". Applies only if enableKinetic is set. Defaults
+     *     to 10 milliseconds.
      */
      */
+    kineticInterval: 10,
 
 
-   /**
-    * Method: evaluate
-    * Evaluates this filter for a specific feature.
-    * 
+
+    /**
+     * Method: draw
+     * Creates a Drag handler, using <panMap> and
+     * <panMapDone> as callbacks.
+     */    
+    draw: function() {
+        if (this.enableKinetic && OpenLayers.Kinetic) {
+            var config = {interval: this.kineticInterval};
+            if(typeof this.enableKinetic === "object") {
+                config = OpenLayers.Util.extend(config, this.enableKinetic);
+            }
+            this.kinetic = new OpenLayers.Kinetic(config);
+        }
+        this.handler = new OpenLayers.Handler.Drag(this, {
+                "move": this.panMap,
+                "done": this.panMapDone,
+                "down": this.panMapStart
+            }, {
+                interval: this.interval,
+                documentDrag: this.documentDrag
+            }
+        );
+    },
+
+    /**
+     * Method: panMapStart
+     */
+    panMapStart: function() {
+        if(this.kinetic) {
+            this.kinetic.begin();
+        }
+    },
+
+    /**
+    * Method: panMap
+    *
     * Parameters:
     * Parameters:
-    * feature - {<OpenLayers.Feature.Vector>} feature to apply the filter to.
-    * 
-    * Returns:
-    * {Boolean} The feature meets filter criteria.
+    * xy - {<OpenLayers.Pixel>} Pixel of the mouse position
     */
     */
-    evaluate: function(feature) {
-        var intersect = false;
-        switch(this.type) {
-            case OpenLayers.Filter.Spatial.BBOX:
-            case OpenLayers.Filter.Spatial.INTERSECTS:
-                if(feature.geometry) {
-                    var geom = this.value;
-                    if(this.value.CLASS_NAME == "OpenLayers.Bounds") {
-                        geom = this.value.toGeometry();
-                    }
-                    if(feature.geometry.intersects(geom)) {
-                        intersect = true;
-                    }
-                }
-                break;
-            default:
-                throw new Error('evaluate is not implemented for this filter type.');
+    panMap: function(xy) {
+        if(this.kinetic) {
+            this.kinetic.update(xy);
         }
         }
-        return intersect;
+        this.panned = true;
+        this.map.pan(
+            this.handler.last.x - xy.x,
+            this.handler.last.y - xy.y,
+            {dragging: true, animate: false}
+        );
     },
     },
-
+    
     /**
     /**
-     * APIMethod: clone
-     * Clones this filter.
-     * 
-     * Returns:
-     * {<OpenLayers.Filter.Spatial>} Clone of this filter.
+     * Method: panMapDone
+     * Finish the panning operation.  Only call setCenter (through <panMap>)
+     *     if the map has actually been moved.
+     *
+     * Parameters:
+     * xy - {<OpenLayers.Pixel>} Pixel of the mouse position
      */
      */
-    clone: function() {
-        var options = OpenLayers.Util.applyDefaults({
-            value: this.value && this.value.clone && this.value.clone()
-        }, this);
-        return new OpenLayers.Filter.Spatial(options);
+    panMapDone: function(xy) {
+        if(this.panned) {
+            var res = null;
+            if (this.kinetic) {
+                res = this.kinetic.end(xy);
+            }
+            this.map.pan(
+                this.handler.last.x - xy.x,
+                this.handler.last.y - xy.y,
+                {dragging: !!res, animate: false}
+            );
+            if (res) {
+                var self = this;
+                this.kinetic.move(res, function(x, y, end) {
+                    self.map.pan(x, y, {dragging: !end, animate: false});
+                });
+            }
+            this.panned = false;
+        }
     },
     },
-    CLASS_NAME: "OpenLayers.Filter.Spatial"
-});
 
 
-OpenLayers.Filter.Spatial.BBOX = "BBOX";
-OpenLayers.Filter.Spatial.INTERSECTS = "INTERSECTS";
-OpenLayers.Filter.Spatial.DWITHIN = "DWITHIN";
-OpenLayers.Filter.Spatial.WITHIN = "WITHIN";
-OpenLayers.Filter.Spatial.CONTAINS = "CONTAINS";
+    CLASS_NAME: "OpenLayers.Control.DragPan"
+});
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Format/WFST/v1.js
+    OpenLayers/Handler/MouseWheel.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Format/XML.js
- * @requires OpenLayers/Format/WFST.js
- * @requires OpenLayers/Filter/Spatial.js
- * @requires OpenLayers/Filter/FeatureId.js
+ * @requires OpenLayers/Handler.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Format.WFST.v1
- * Superclass for WFST parsers.
- *
+ * Class: OpenLayers.Handler.MouseWheel
+ * Handler for wheel up/down events.
+ * 
  * Inherits from:
  * Inherits from:
- *  - <OpenLayers.Format.XML>
+ *  - <OpenLayers.Handler>
  */
  */
-OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
-    
-    /**
-     * Property: namespaces
-     * {Object} Mapping of namespace aliases to namespace URIs.
-     */
-    namespaces: {
-        xlink: "http://www.w3.org/1999/xlink",
-        xsi: "http://www.w3.org/2001/XMLSchema-instance",
-        wfs: "http://www.opengis.net/wfs",
-        gml: "http://www.opengis.net/gml",
-        ogc: "http://www.opengis.net/ogc",
-        ows: "http://www.opengis.net/ows"
-    },
-    
-    /**
-     * Property: defaultPrefix
-     */
-    defaultPrefix: "wfs",
-
-    /**
-     * Property: version
-     * {String} WFS version number.
+OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
+    /** 
+     * Property: wheelListener 
+     * {function} 
      */
      */
-    version: null,
+    wheelListener: null,
 
     /**
 
     /**
-     * Property: schemaLocation
-     * {String} Schema location for a particular minor version.
+     * Property: interval
+     * {Integer} In order to increase server performance, an interval (in 
+     *     milliseconds) can be set to reduce the number of up/down events 
+     *     called. If set, a new up/down event will not be set until the 
+     *     interval has passed. 
+     *     Defaults to 0, meaning no interval. 
      */
      */
-    schemaLocations: null,
+    interval: 0,
     
     /**
     
     /**
-     * APIProperty: srsName
-     * {String} URI for spatial reference system.
+     * Property: maxDelta
+     * {Integer} Maximum delta to collect before breaking from the current
+     *    interval. In cumulative mode, this also limits the maximum delta
+     *    returned from the handler. Default is Number.POSITIVE_INFINITY.
      */
      */
-    srsName: null,
-
+    maxDelta: Number.POSITIVE_INFINITY,
+    
     /**
     /**
-     * APIProperty: extractAttributes
-     * {Boolean} Extract attributes from GML.  Default is true.
+     * Property: delta
+     * {Integer} When interval is set, delta collects the mousewheel z-deltas
+     *     of the events that occur within the interval.
+     *      See also the cumulative option
      */
      */
-    extractAttributes: true,
+    delta: 0,
     
     /**
     
     /**
-     * APIProperty: xy
-     * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
-     * Changing is not recommended, a new Format should be instantiated.
-     */ 
-    xy: true,
-
-    /**
-     * Property: stateName
-     * {Object} Maps feature states to node names.
+     * Property: cumulative
+     * {Boolean} When interval is set: true to collect all the mousewheel 
+     *     z-deltas, false to only record the delta direction (positive or
+     *     negative)
      */
      */
-    stateName: null,
+    cumulative: true,
     
     /**
     
     /**
-     * Constructor: OpenLayers.Format.WFST.v1
-     * Instances of this class are not created directly.  Use the
-     *     <OpenLayers.Format.WFST.v1_0_0> or <OpenLayers.Format.WFST.v1_1_0>
-     *     constructor instead.
+     * Constructor: OpenLayers.Handler.MouseWheel
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *     this instance.
+     * control - {<OpenLayers.Control>} 
+     * callbacks - {Object} An object containing a single function to be
+     *                          called when the drag operation is finished.
+     *                          The callback should expect to receive a single
+     *                          argument, the point geometry.
+     * options - {Object} 
      */
      */
-    initialize: function(options) {
-        // set state name mapping
-        this.stateName = {};
-        this.stateName[OpenLayers.State.INSERT] = "wfs:Insert";
-        this.stateName[OpenLayers.State.UPDATE] = "wfs:Update";
-        this.stateName[OpenLayers.State.DELETE] = "wfs:Delete";
-        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+    initialize: function(control, callbacks, options) {
+        OpenLayers.Handler.prototype.initialize.apply(this, arguments);
+        this.wheelListener = OpenLayers.Function.bindAsEventListener(
+            this.onWheelEvent, this
+        );
     },
     },
-    
+
     /**
     /**
-     * Method: getSrsName
-     */
-    getSrsName: function(feature, options) {
-        var srsName = options && options.srsName;
-        if(!srsName) {
-            if(feature && feature.layer) {
-                srsName = feature.layer.projection.getCode();
-            } else {
-                srsName = this.srsName;
-            }
-        }
-        return srsName;
+     * Method: destroy
+     */    
+    destroy: function() {
+        OpenLayers.Handler.prototype.destroy.apply(this, arguments);
+        this.wheelListener = null;
     },
 
     /**
     },
 
     /**
-     * APIMethod: read
-     * Parse the response from a transaction.  Because WFS is split into
-     *     Transaction requests (create, update, and delete) and GetFeature
-     *     requests (read), this method handles parsing of both types of
-     *     responses.
-     *
+     *  Mouse ScrollWheel code thanks to http://adomas.org/javascript-mouse-wheel/
+     */
+
+    /** 
+     * Method: onWheelEvent
+     * Catch the wheel event and handle it xbrowserly
+     * 
      * Parameters:
      * Parameters:
-     * data - {String | Document} The WFST document to read
-     * options - {Object} Options for the reader
-     *
-     * Valid options properties:
-     * output - {String} either "features" or "object". The default is
-     *     "features", which means that the method will return an array of
-     *     features. If set to "object", an object with a "features" property
-     *     and other properties read by the parser will be returned.
-     *
-     * Returns:
-     * {Array | Object} Output depending on the output option.
+     * e - {Event} 
      */
      */
-    read: function(data, options) {
-        options = options || {};
-        OpenLayers.Util.applyDefaults(options, {
-            output: "features"
-        });
+    onWheelEvent: function(e){
         
         
-        if(typeof data == "string") { 
-            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
-        }
-        if(data && data.nodeType == 9) {
-            data = data.documentElement;
+        // make sure we have a map and check keyboard modifiers
+        if (!this.map || !this.checkModifiers(e)) {
+            return;
         }
         }
-        var obj = {};
-        if(data) {
-            this.readNode(data, obj, true);
+        
+        // Ride up the element's DOM hierarchy to determine if it or any of 
+        //  its ancestors was: 
+        //   * specifically marked as scrollable (CSS overflow property)
+        //   * one of our layer divs or a div marked as scrollable
+        //     ('olScrollable' CSS class)
+        //   * the map div
+        //
+        var overScrollableDiv = false;
+        var allowScroll = false;
+        var overMapDiv = false;
+        
+        var elem = OpenLayers.Event.element(e);
+        while((elem != null) && !overMapDiv && !overScrollableDiv) {
+
+            if (!overScrollableDiv) {
+                try {
+                    var overflow;
+                    if (elem.currentStyle) {
+                        overflow = elem.currentStyle["overflow"];
+                    } else {
+                        var style = 
+                            document.defaultView.getComputedStyle(elem, null);
+                        overflow = style.getPropertyValue("overflow");
+                    }
+                    overScrollableDiv = ( overflow && 
+                        (overflow == "auto") || (overflow == "scroll") );
+                } catch(err) {
+                    //sometimes when scrolling in a popup, this causes 
+                    // obscure browser error
+                }
+            }
+
+            if (!allowScroll) {
+                allowScroll = OpenLayers.Element.hasClass(elem, 'olScrollable');
+                if (!allowScroll) {
+                    for (var i = 0, len = this.map.layers.length; i < len; i++) {
+                        // Are we in the layer div? Note that we have two cases
+                        // here: one is to catch EventPane layers, which have a
+                        // pane above the layer (layer.pane)
+                        var layer = this.map.layers[i];
+                        if (elem == layer.div || elem == layer.pane) {
+                            allowScroll = true;
+                            break;
+                        }
+                    }
+                }
+            }
+            overMapDiv = (elem == this.map.div);
+
+            elem = elem.parentNode;
         }
         }
-        if(obj.features && options.output === "features") {
-            obj = obj.features;
+        
+        // Logic below is the following:
+        //
+        // If we are over a scrollable div or not over the map div:
+        //  * do nothing (let the browser handle scrolling)
+        //
+        //    otherwise 
+        // 
+        //    If we are over the layer div or a 'olScrollable' div:
+        //     * zoom/in out
+        //     then
+        //     * kill event (so as not to also scroll the page after zooming)
+        //
+        //       otherwise
+        //
+        //       Kill the event (dont scroll the page if we wheel over the 
+        //        layerswitcher or the pan/zoom control)
+        //
+        if (!overScrollableDiv && overMapDiv) {
+            if (allowScroll) {
+                var delta = 0;
+                
+                if (e.wheelDelta) {
+                    delta = e.wheelDelta;
+                    if (delta % 160 === 0) {
+                        // opera have steps of 160 instead of 120
+                        delta = delta * 0.75;
+                    }
+                    delta = delta / 120;
+                } else if (e.detail) {
+                    // detail in Firefox on OS X is 1/3 of Windows
+                    // so force delta 1 / -1
+                    delta = - (e.detail / Math.abs(e.detail));
+                }
+                this.delta += delta;
+
+                window.clearTimeout(this._timeoutId);
+                if(this.interval && Math.abs(this.delta) < this.maxDelta) {
+                    // store e because window.event might change during delay
+                    var evt = OpenLayers.Util.extend({}, e);
+                    this._timeoutId = window.setTimeout(
+                        OpenLayers.Function.bind(function(){
+                            this.wheelZoom(evt);
+                        }, this),
+                        this.interval
+                    );
+                } else {
+                    this.wheelZoom(e);
+                }
+            }
+            OpenLayers.Event.stop(e);
         }
         }
-        return obj;
     },
     },
-    
+
     /**
     /**
-     * Property: readers
-     * Contains public functions, grouped by namespace prefix, that will
-     *     be applied when a namespaced node is found matching the function
-     *     name.  The function will be applied in the scope of this parser
-     *     with two arguments: the node being read and a context object passed
-     *     from the parent.
-     */
-    readers: {
-        "wfs": {
-            "FeatureCollection": function(node, obj) {
-                obj.features = [];
-                this.readChildNodes(node, obj);
-            }
-        }
-    },
-    
-    /**
-     * Method: write
-     * Given an array of features, write a WFS transaction.  This assumes
-     *     the features have a state property that determines the operation
-     *     type - insert, update, or delete.
-     *
+     * Method: wheelZoom
+     * Given the wheel event, we carry out the appropriate zooming in or out,
+     *     based on the 'wheelDelta' or 'detail' property of the event.
+     * 
      * Parameters:
      * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>)} A list of features. See
-     *     below for a more detailed description of the influence of the
-     *     feature's *modified* property.
-     * options - {Object}
-     *
-     * feature.modified rules:
-     * If a feature has a modified property set, the following checks will be
-     * made before a feature's geometry or attribute is included in an Update
-     * transaction:
-     * - *modified* is not set at all: The geometry and all attributes will be
-     *     included.
-     * - *modified.geometry* is set (null or a geometry): The geometry will be
-     *     included. If *modified.attributes* is not set, all attributes will
-     *     be included.
-     * - *modified.attributes* is set: Only the attributes set (i.e. to null or
-     *     a value) in *modified.attributes* will be included. 
-     *     If *modified.geometry* is not set, the geometry will not be included.
-     *
-     * Valid options include:
-     * - *multi* {Boolean} If set to true, geometries will be casted to
-     *   Multi geometries before writing.
-     *
-     * Returns:
-     * {String} A serialized WFS transaction.
-     */
-    write: function(features, options) {
-        var node = this.writeNode("wfs:Transaction", {
-            features:features,
-            options: options
-        });
-        var value = this.schemaLocationAttr();
-        if(value) {
-            this.setAttributeNS(
-                node, this.namespaces["xsi"], "xsi:schemaLocation",  value
-            );
-        }
-        return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
-    },
-    
-    /**
-     * Property: writers
-     * As a compliment to the readers property, this structure contains public
-     *     writing functions grouped by namespace alias and named like the
-     *     node names they produce.
+     * e - {Event}
      */
      */
-    writers: {
-        "wfs": {
-            "GetFeature": function(options) {
-                var node = this.createElementNSPlus("wfs:GetFeature", {
-                    attributes: {
-                        service: "WFS",
-                        version: this.version,
-                        handle: options && options.handle,
-                        outputFormat: options && options.outputFormat,
-                        maxFeatures: options && options.maxFeatures,
-                        "xsi:schemaLocation": this.schemaLocationAttr(options)
-                    }
-                });
-                if (typeof this.featureType == "string") {
-                    this.writeNode("Query", options, node);
-                } else {
-                    for (var i=0,len = this.featureType.length; i<len; i++) { 
-                        options.featureType = this.featureType[i]; 
-                        this.writeNode("Query", options, node); 
-                    } 
-                }
-                return node;
-            },
-            "Transaction": function(obj) {
-                obj = obj || {};
-                var options = obj.options || {};
-                var node = this.createElementNSPlus("wfs:Transaction", {
-                    attributes: {
-                        service: "WFS",
-                        version: this.version,
-                        handle: options.handle
-                    }
-                });
-                var i, len;
-                var features = obj.features;
-                if(features) {
-                    // temporarily re-assigning geometry types
-                    if (options.multi === true) {
-                        OpenLayers.Util.extend(this.geometryTypes, {
-                            "OpenLayers.Geometry.Point": "MultiPoint",
-                            "OpenLayers.Geometry.LineString": (this.multiCurve === true) ? "MultiCurve": "MultiLineString",
-                            "OpenLayers.Geometry.Polygon": (this.multiSurface === true) ? "MultiSurface" : "MultiPolygon"
-                        });
-                    }
-                    var name, feature;
-                    for(i=0, len=features.length; i<len; ++i) {
-                        feature = features[i];
-                        name = this.stateName[feature.state];
-                        if(name) {
-                            this.writeNode(name, {
-                                feature: feature, 
-                                options: options
-                            }, node);
-                        }
-                    }
-                    // switch back to original geometry types assignment
-                    if (options.multi === true) {
-                        this.setGeometryTypes();
-                    }
-                }
-                if (options.nativeElements) {
-                    for (i=0, len=options.nativeElements.length; i<len; ++i) {
-                        this.writeNode("wfs:Native", 
-                            options.nativeElements[i], node);
-                    }
-                }
-                return node;
-            },
-            "Native": function(nativeElement) {
-                var node = this.createElementNSPlus("wfs:Native", {
-                    attributes: {
-                        vendorId: nativeElement.vendorId,
-                        safeToIgnore: nativeElement.safeToIgnore
-                    },
-                    value: nativeElement.value
-                });
-                return node;
-            },
-            "Insert": function(obj) {
-                var feature = obj.feature;
-                var options = obj.options;
-                var node = this.createElementNSPlus("wfs:Insert", {
-                    attributes: {
-                        handle: options && options.handle
-                    }
-                });
-                this.srsName = this.getSrsName(feature);
-                this.writeNode("feature:_typeName", feature, node);
-                return node;
-            },
-            "Update": function(obj) {
-                var feature = obj.feature;
-                var options = obj.options;
-                var node = this.createElementNSPlus("wfs:Update", {
-                    attributes: {
-                        handle: options && options.handle,
-                        typeName: (this.featureNS ? this.featurePrefix + ":" : "") +
-                            this.featureType
-                    }
-                });
-                if(this.featureNS) {
-                    node.setAttribute("xmlns:" + this.featurePrefix, this.featureNS);
-                }
-                
-                // add in geometry
-                var modified = feature.modified;
-                if (this.geometryName !== null && (!modified || modified.geometry !== undefined)) {
-                    this.srsName = this.getSrsName(feature);
-                    this.writeNode(
-                        "Property", {name: this.geometryName, value: feature.geometry}, node
-                    );
-                }
-        
-                // add in attributes
-                for(var key in feature.attributes) {
-                    if(feature.attributes[key] !== undefined &&
-                                (!modified || !modified.attributes ||
-                                (modified.attributes && modified.attributes[key] !== undefined))) {
-                        this.writeNode(
-                            "Property", {name: key, value: feature.attributes[key]}, node
-                        );
-                    }
-                }
-                
-                // add feature id filter
-                this.writeNode("ogc:Filter", new OpenLayers.Filter.FeatureId({
-                    fids: [feature.fid]
-                }), node);
+    wheelZoom: function(e) {
+        var delta = this.delta;
+        this.delta = 0;
         
         
-                return node;
-            },
-            "Property": function(obj) {
-                var node = this.createElementNSPlus("wfs:Property");
-                this.writeNode("Name", obj.name, node);
-                if(obj.value !== null) {
-                    this.writeNode("Value", obj.value, node);
-                }
-                return node;
-            },
-            "Name": function(name) {
-                return this.createElementNSPlus("wfs:Name", {value: name});
-            },
-            "Value": function(obj) {
-                var node;
-                if(obj instanceof OpenLayers.Geometry) {
-                    node = this.createElementNSPlus("wfs:Value");
-                    var geom = this.writeNode("feature:_geometry", obj).firstChild;
-                    node.appendChild(geom);
-                } else {
-                    node = this.createElementNSPlus("wfs:Value", {value: obj});                
-                }
-                return node;
-            },
-            "Delete": function(obj) {
-                var feature = obj.feature;
-                var options = obj.options;
-                var node = this.createElementNSPlus("wfs:Delete", {
-                    attributes: {
-                        handle: options && options.handle,
-                        typeName: (this.featureNS ? this.featurePrefix + ":" : "") +
-                            this.featureType
-                    }
-                });
-                if(this.featureNS) {
-                    node.setAttribute("xmlns:" + this.featurePrefix, this.featureNS);
-                }
-                this.writeNode("ogc:Filter", new OpenLayers.Filter.FeatureId({
-                    fids: [feature.fid]
-                }), node);
-                return node;
+        if (delta) {
+            e.xy = this.map.events.getMousePosition(e);
+            if (delta < 0) {
+                this.callback("down",
+                    [e, this.cumulative ? Math.max(-this.maxDelta, delta) : -1]);
+            } else {
+                this.callback("up",
+                    [e, this.cumulative ? Math.min(this.maxDelta, delta) : 1]);
             }
         }
     },
             }
         }
     },
-
+    
     /**
     /**
-     * Method: schemaLocationAttr
-     * Generate the xsi:schemaLocation attribute value.
-     *
-     * Returns:
-     * {String} The xsi:schemaLocation attribute or undefined if none.
+     * Method: activate 
      */
      */
-    schemaLocationAttr: function(options) {
-        options = OpenLayers.Util.extend({
-            featurePrefix: this.featurePrefix,
-            schema: this.schema
-        }, options);
-        var schemaLocations = OpenLayers.Util.extend({}, this.schemaLocations);
-        if(options.schema) {
-            schemaLocations[options.featurePrefix] = options.schema;
-        }
-        var parts = [];
-        var uri;
-        for(var key in schemaLocations) {
-            uri = this.namespaces[key];
-            if(uri) {
-                parts.push(uri + " " + schemaLocations[key]);
-            }
+    activate: function (evt) {
+        if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
+            //register mousewheel events specifically on the window and document
+            var wheelListener = this.wheelListener;
+            OpenLayers.Event.observe(window, "DOMMouseScroll", wheelListener);
+            OpenLayers.Event.observe(window, "mousewheel", wheelListener);
+            OpenLayers.Event.observe(document, "mousewheel", wheelListener);
+            return true;
+        } else {
+            return false;
         }
         }
-        var value = parts.join(" ") || undefined;
-        return value;
     },
     },
-    
+
     /**
     /**
-     * Method: setFilterProperty
-     * Set the property of each spatial filter.
-     *
-     * Parameters:
-     * filter - {<OpenLayers.Filter>}
+     * Method: deactivate 
      */
      */
-    setFilterProperty: function(filter) {
-        if(filter.filters) {
-            for(var i=0, len=filter.filters.length; i<len; ++i) {
-                OpenLayers.Format.WFST.v1.prototype.setFilterProperty.call(this, filter.filters[i]);
-            }
+    deactivate: function (evt) {
+        if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+            // unregister mousewheel events specifically on the window and document
+            var wheelListener = this.wheelListener;
+            OpenLayers.Event.stopObserving(window, "DOMMouseScroll", wheelListener);
+            OpenLayers.Event.stopObserving(window, "mousewheel", wheelListener);
+            OpenLayers.Event.stopObserving(document, "mousewheel", wheelListener);
+            return true;
         } else {
         } else {
-            if(filter instanceof OpenLayers.Filter.Spatial && !filter.property) {
-                // got a spatial filter without property, so set it
-                filter.property = this.geometryName;
-            }
+            return false;
         }
     },
 
         }
     },
 
-    CLASS_NAME: "OpenLayers.Format.WFST.v1" 
-
+    CLASS_NAME: "OpenLayers.Handler.MouseWheel"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Geometry/Polygon.js
+    OpenLayers/Handler/Click.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Geometry/Collection.js
- * @requires OpenLayers/Geometry/LinearRing.js
+ * @requires OpenLayers/Handler.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Geometry.Polygon 
- * Polygon is a collection of Geometry.LinearRings. 
+ * Class: OpenLayers.Handler.Click
+ * A handler for mouse clicks.  The intention of this handler is to give
+ *     controls more flexibility with handling clicks.  Browsers trigger
+ *     click events twice for a double-click.  In addition, the mousedown,
+ *     mousemove, mouseup sequence fires a click event.  With this handler,
+ *     controls can decide whether to ignore clicks associated with a double
+ *     click.  By setting a <pixelTolerance>, controls can also ignore clicks
+ *     that include a drag.  Create a new instance with the
+ *     <OpenLayers.Handler.Click> constructor.
  * 
  * Inherits from:
  * 
  * Inherits from:
- *  - <OpenLayers.Geometry.Collection> 
- *  - <OpenLayers.Geometry> 
+ *  - <OpenLayers.Handler> 
  */
  */
-OpenLayers.Geometry.Polygon = OpenLayers.Class(
-  OpenLayers.Geometry.Collection, {
+OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
+    /**
+     * APIProperty: delay
+     * {Number} Number of milliseconds between clicks before the event is
+     *     considered a double-click.
+     */
+    delay: 300,
+    
+    /**
+     * APIProperty: single
+     * {Boolean} Handle single clicks.  Default is true.  If false, clicks
+     * will not be reported.  If true, single-clicks will be reported.
+     */
+    single: true,
+    
+    /**
+     * APIProperty: double
+     * {Boolean} Handle double-clicks.  Default is false.
+     */
+    'double': false,
+    
+    /**
+     * APIProperty: pixelTolerance
+     * {Number} Maximum number of pixels between mouseup and mousedown for an
+     *     event to be considered a click.  Default is 0.  If set to an
+     *     integer value, clicks with a drag greater than the value will be
+     *     ignored.  This property can only be set when the handler is
+     *     constructed.
+     */
+    pixelTolerance: 0,
+        
+    /**
+     * APIProperty: dblclickTolerance
+     * {Number} Maximum distance in pixels between clicks for a sequence of 
+     *     events to be considered a double click.  Default is 13.  If the
+     *     distance between two clicks is greater than this value, a double-
+     *     click will not be fired.
+     */
+    dblclickTolerance: 13,
+        
+    /**
+     * APIProperty: stopSingle
+     * {Boolean} Stop other listeners from being notified of clicks.  Default
+     *     is false.  If true, any listeners registered before this one for 
+     *     click or rightclick events will not be notified.
+     */
+    stopSingle: false,
+    
+    /**
+     * APIProperty: stopDouble
+     * {Boolean} Stop other listeners from being notified of double-clicks.
+     *     Default is false.  If true, any click listeners registered before
+     *     this one will not be notified of *any* double-click events.
+     * 
+     * The one caveat with stopDouble is that given a map with two click
+     *     handlers, one with stopDouble true and the other with stopSingle
+     *     true, the stopSingle handler should be activated last to get
+     *     uniform cross-browser performance.  Since IE triggers one click
+     *     with a dblclick and FF triggers two, if a stopSingle handler is
+     *     activated first, all it gets in IE is a single click when the
+     *     second handler stops propagation on the dblclick.
+     */
+    stopDouble: false,
 
     /**
 
     /**
-     * Property: componentTypes
-     * {Array(String)} An array of class names representing the types of
-     * components that the collection can include.  A null value means the
-     * component types are not restricted.
+     * Property: timerId
+     * {Number} The id of the timeout waiting to clear the <delayedCall>.
      */
      */
-    componentTypes: ["OpenLayers.Geometry.LinearRing"],
+    timerId: null,
+    
+    /**
+     * Property: down
+     * {Object} Object that store relevant information about the last
+     *     mousedown or touchstart. Its 'xy' OpenLayers.Pixel property gives
+     *     the average location of the mouse/touch event. Its 'touches'
+     *     property records clientX/clientY of each touches.
+     */
+    down: null,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Geometry.Polygon
-     * Constructor for a Polygon geometry. 
-     * The first ring (this.component[0])is the outer bounds of the polygon and 
-     * all subsequent rings (this.component[1-n]) are internal holes.
-     *
-     *
-     * Parameters:
-     * components - {Array(<OpenLayers.Geometry.LinearRing>)} 
+     * Property: last
+     * {Object} Object that store relevant information about the last
+     *     mousemove or touchmove. Its 'xy' OpenLayers.Pixel property gives
+     *     the average location of the mouse/touch event. Its 'touches'
+     *     property records clientX/clientY of each touches.
      */
      */
+    last: null,
 
     /** 
 
     /** 
-     * APIMethod: getArea
-     * Calculated by subtracting the areas of the internal holes from the 
-     *   area of the outer hole.
+     * Property: first
+     * {Object} When waiting for double clicks, this object will store 
+     *     information about the first click in a two click sequence.
+     */
+    first: null,
+
+    /**
+     * Property: rightclickTimerId
+     * {Number} The id of the right mouse timeout waiting to clear the 
+     *     <delayedEvent>.
+     */
+    rightclickTimerId: null,
+    
+    /**
+     * Constructor: OpenLayers.Handler.Click
+     * Create a new click handler.
      * 
      * 
+     * Parameters:
+     * control - {<OpenLayers.Control>} The control that is making use of
+     *     this handler.  If a handler is being used without a control, the
+     *     handler's setMap method must be overridden to deal properly with
+     *     the map.
+     * callbacks - {Object} An object with keys corresponding to callbacks
+     *     that will be called by the handler. The callbacks should
+     *     expect to receive a single argument, the click event.
+     *     Callbacks for 'click' and 'dblclick' are supported.
+     * options - {Object} Optional object whose properties will be set on the
+     *     handler.
+     */
+    
+    /**
+     * Method: touchstart
+     * Handle touchstart.
+     *
      * Returns:
      * Returns:
-     * {float} The area of the geometry
+     * {Boolean} Continue propagating this event.
      */
      */
-    getArea: function() {
-        var area = 0.0;
-        if ( this.components && (this.components.length > 0)) {
-            area += Math.abs(this.components[0].getArea());
-            for (var i=1, len=this.components.length; i<len; i++) {
-                area -= Math.abs(this.components[i].getArea());
-            }
-        }
-        return area;
+    touchstart: function(evt) {
+        this.startTouch();
+        this.down = this.getEventInfo(evt);
+        this.last = this.getEventInfo(evt);
+        return true;
     },
     },
-
-    /** 
-     * APIMethod: getGeodesicArea
-     * Calculate the approximate area of the polygon were it projected onto
-     *     the earth.
-     *
-     * Parameters:
-     * projection - {<OpenLayers.Projection>} The spatial reference system
-     *     for the geometry coordinates.  If not provided, Geographic/WGS84 is
-     *     assumed.
-     * 
-     * Reference:
-     * Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for
-     *     Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion
-     *     Laboratory, Pasadena, CA, June 2007 http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409
+    
+    /**
+     * Method: touchmove
+     *    Store position of last move, because touchend event can have
+     *    an empty "touches" property.
      *
      * Returns:
      *
      * Returns:
-     * {float} The approximate geodesic area of the polygon in square meters.
+     * {Boolean} Continue propagating this event.
      */
      */
-    getGeodesicArea: function(projection) {
-        var area = 0.0;
-        if(this.components && (this.components.length > 0)) {
-            area += Math.abs(this.components[0].getGeodesicArea(projection));
-            for(var i=1, len=this.components.length; i<len; i++) {
-                area -= Math.abs(this.components[i].getGeodesicArea(projection));
-            }
-        }
-        return area;
+    touchmove: function(evt) {
+        this.last = this.getEventInfo(evt);
+        return true;
     },
 
     /**
     },
 
     /**
-     * Method: containsPoint
-     * Test if a point is inside a polygon.  Points on a polygon edge are
-     *     considered inside.
-     *
-     * Parameters:
-     * point - {<OpenLayers.Geometry.Point>}
+     * Method: touchend
+     *   Correctly set event xy property, and add lastTouches to have
+     *   touches property from last touchstart or touchmove
      *
      * Returns:
      *
      * Returns:
-     * {Boolean | Number} The point is inside the polygon.  Returns 1 if the
-     *     point is on an edge.  Returns boolean otherwise.
+     * {Boolean} Continue propagating this event.
      */
      */
-    containsPoint: function(point) {
-        var numRings = this.components.length;
-        var contained = false;
-        if(numRings > 0) {
-            // check exterior ring - 1 means on edge, boolean otherwise
-            contained = this.components[0].containsPoint(point);
-            if(contained !== 1) {
-                if(contained && numRings > 1) {
-                    // check interior rings
-                    var hole;
-                    for(var i=1; i<numRings; ++i) {
-                        hole = this.components[i].containsPoint(point);
-                        if(hole) {
-                            if(hole === 1) {
-                                // on edge
-                                contained = 1;
-                            } else {
-                                // in hole
-                                contained = false;
-                            }                            
-                            break;
-                        }
-                    }
-                }
-            }
+    touchend: function(evt) {
+        // touchstart may not have been allowed to propagate
+        if (this.down) {
+            evt.xy = this.last.xy;
+            evt.lastTouches = this.last.touches;
+            this.handleSingle(evt);
+            this.down = null;
         }
         }
-        return contained;
+        return true;
     },
 
     /**
     },
 
     /**
-     * APIMethod: intersects
-     * Determine if the input geometry intersects this one.
+     * Method: mousedown
+     * Handle mousedown.
      *
      *
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>} Any type of geometry.
+     * Returns:
+     * {Boolean} Continue propagating this event.
+     */
+    mousedown: function(evt) {
+        this.down = this.getEventInfo(evt);
+        this.last = this.getEventInfo(evt);
+        return true;
+    },
+
+    /**
+     * Method: mouseup
+     * Handle mouseup.  Installed to support collection of right mouse events.
+     * 
+     * Returns:
+     * {Boolean} Continue propagating this event.
+     */
+    mouseup: function (evt) {
+        var propagate = true;
+
+        // Collect right mouse clicks from the mouseup
+        //  IE - ignores the second right click in mousedown so using
+        //  mouseup instead
+        if (this.checkModifiers(evt) && this.control.handleRightClicks &&
+           OpenLayers.Event.isRightClick(evt)) {
+            propagate = this.rightclick(evt);
+        }
+
+        return propagate;
+    },
+    
+    /**
+     * Method: rightclick
+     * Handle rightclick.  For a dblrightclick, we get two clicks so we need 
+     *     to always register for dblrightclick to properly handle single 
+     *     clicks.
+     *     
+     * Returns:
+     * {Boolean} Continue propagating this event.
+     */
+    rightclick: function(evt) {
+        if(this.passesTolerance(evt)) {
+           if(this.rightclickTimerId != null) {
+                //Second click received before timeout this must be 
+                // a double click
+                this.clearTimer();
+                this.callback('dblrightclick', [evt]);
+                return !this.stopDouble;
+            } else { 
+                //Set the rightclickTimerId, send evt only if double is 
+                // true else trigger single
+                var clickEvent = this['double'] ?
+                    OpenLayers.Util.extend({}, evt) : 
+                    this.callback('rightclick', [evt]);
+
+                var delayedRightCall = OpenLayers.Function.bind(
+                    this.delayedRightCall, 
+                    this, 
+                    clickEvent
+                );
+                this.rightclickTimerId = window.setTimeout(
+                    delayedRightCall, this.delay
+                );
+            } 
+        }
+        return !this.stopSingle;
+    },
+    
+    /**
+     * Method: delayedRightCall
+     * Sets <rightclickTimerId> to null.  And optionally triggers the 
+     *     rightclick callback if evt is set.
+     */
+    delayedRightCall: function(evt) {
+        this.rightclickTimerId = null;
+        if (evt) {
+           this.callback('rightclick', [evt]);
+        }
+    },
+    
+    /**
+     * Method: click
+     * Handle click events from the browser.  This is registered as a listener
+     *     for click events and should not be called from other events in this
+     *     handler.
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} The input geometry intersects this one.
+     * {Boolean} Continue propagating this event.
      */
      */
-    intersects: function(geometry) {
-        var intersect = false;
-        var i, len;
-        if(geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
-            intersect = this.containsPoint(geometry);
-        } else if(geometry.CLASS_NAME == "OpenLayers.Geometry.LineString" ||
-                  geometry.CLASS_NAME == "OpenLayers.Geometry.LinearRing") {
-            // check if rings/linestrings intersect
-            for(i=0, len=this.components.length; i<len; ++i) {
-                intersect = geometry.intersects(this.components[i]);
-                if(intersect) {
-                    break;
-                }
+    click: function(evt) {
+        if (!this.last) {
+            this.last = this.getEventInfo(evt);
+        }
+        this.handleSingle(evt);
+        return !this.stopSingle;
+    },
+
+    /**
+     * Method: dblclick
+     * Handle dblclick.  For a dblclick, we get two clicks in some browsers
+     *     (FF) and one in others (IE).  So we need to always register for
+     *     dblclick to properly handle single clicks.  This method is registered
+     *     as a listener for the dblclick browser event.  It should *not* be
+     *     called by other methods in this handler.
+     *     
+     * Returns:
+     * {Boolean} Continue propagating this event.
+     */
+    dblclick: function(evt) {
+        this.handleDouble(evt);
+        return !this.stopDouble;
+    },
+    
+    /** 
+     * Method: handleDouble
+     * Handle double-click sequence.
+     */
+    handleDouble: function(evt) {
+        if (this.passesDblclickTolerance(evt)) {
+            if (this["double"]) {
+                this.callback("dblclick", [evt]);
             }
             }
-            if(!intersect) {
-                // check if this poly contains points of the ring/linestring
-                for(i=0, len=geometry.components.length; i<len; ++i) {
-                    intersect = this.containsPoint(geometry.components[i]);
-                    if(intersect) {
-                        break;
+            // to prevent a dblclick from firing the click callback in IE
+            this.clearTimer();
+        }
+    },
+    
+    /** 
+     * Method: handleSingle
+     * Handle single click sequence.
+     */
+    handleSingle: function(evt) {
+        if (this.passesTolerance(evt)) {
+            if (this.timerId != null) {
+                // already received a click
+                if (this.last.touches && this.last.touches.length === 1) {
+                    // touch device, no dblclick event - this may be a double
+                    if (this["double"]) {
+                        // on Android don't let the browser zoom on the page
+                        OpenLayers.Event.preventDefault(evt);
                     }
                     }
+                    this.handleDouble(evt);
                 }
                 }
-            }
-        } else {
-            for(i=0, len=geometry.components.length; i<len; ++ i) {
-                intersect = this.intersects(geometry.components[i]);
-                if(intersect) {
-                    break;
-                }
-            }
-        }
-        // check case where this poly is wholly contained by another
-        if(!intersect && geometry.CLASS_NAME == "OpenLayers.Geometry.Polygon") {
-            // exterior ring points will be contained in the other geometry
-            var ring = this.components[0];
-            for(i=0, len=ring.components.length; i<len; ++i) {
-                intersect = geometry.containsPoint(ring.components[i]);
-                if(intersect) {
-                    break;
+                // if we're not in a touch environment we clear the click timer
+                // if we've got a second touch, we'll get two touchend events
+                if (!this.last.touches || this.last.touches.length !== 2) {
+                    this.clearTimer();
                 }
                 }
+            } else {
+                // remember the first click info so we can compare to the second
+                this.first = this.getEventInfo(evt);
+                // set the timer, send evt only if single is true
+                //use a clone of the event object because it will no longer 
+                //be a valid event object in IE in the timer callback
+                var clickEvent = this.single ?
+                    OpenLayers.Util.extend({}, evt) : null;
+                this.queuePotentialClick(clickEvent);
             }
         }
             }
         }
-        return intersect;
+    },
+    
+    /** 
+     * Method: queuePotentialClick
+     * This method is separated out largely to make testing easier (so we
+     *     don't have to override window.setTimeout)
+     */
+    queuePotentialClick: function(evt) {
+        this.timerId = window.setTimeout(
+            OpenLayers.Function.bind(this.delayedCall, this, evt),
+            this.delay
+        );
     },
 
     /**
     },
 
     /**
-     * APIMethod: distanceTo
-     * Calculate the closest distance between two geometries (on the x-y plane).
+     * Method: passesTolerance
+     * Determine whether the event is within the optional pixel tolerance.  Note
+     *     that the pixel tolerance check only works if mousedown events get to
+     *     the listeners registered here.  If they are stopped by other elements,
+     *     the <pixelTolerance> will have no effect here (this method will always
+     *     return true).
      *
      *
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>} The target geometry.
-     * options - {Object} Optional properties for configuring the distance
-     *     calculation.
+     * Returns:
+     * {Boolean} The click is within the pixel tolerance (if specified).
+     */
+    passesTolerance: function(evt) {
+        var passes = true;
+        if (this.pixelTolerance != null && this.down && this.down.xy) {
+            passes = this.pixelTolerance >= this.down.xy.distanceTo(evt.xy);
+            // for touch environments, we also enforce that all touches
+            // start and end within the given tolerance to be considered a click
+            if (passes && this.touch && 
+                this.down.touches.length === this.last.touches.length) {
+                // the touchend event doesn't come with touches, so we check
+                // down and last
+                for (var i=0, ii=this.down.touches.length; i<ii; ++i) {
+                    if (this.getTouchDistance(
+                            this.down.touches[i], 
+                            this.last.touches[i]
+                        ) > this.pixelTolerance) {
+                        passes = false;
+                        break;
+                    }
+                }
+            }
+        }
+        return passes;
+    },
+    
+    /** 
+     * Method: getTouchDistance
      *
      *
-     * Valid options:
-     * details - {Boolean} Return details from the distance calculation.
-     *     Default is false.
-     * edge - {Boolean} Calculate the distance from this geometry to the
-     *     nearest edge of the target geometry.  Default is true.  If true,
-     *     calling distanceTo from a geometry that is wholly contained within
-     *     the target will result in a non-zero distance.  If false, whenever
-     *     geometries intersect, calling distanceTo will return 0.  If false,
-     *     details cannot be returned.
+     * Returns:
+     * {Boolean} The pixel displacement between two touches.
+     */
+    getTouchDistance: function(from, to) {
+        return Math.sqrt(
+            Math.pow(from.clientX - to.clientX, 2) +
+            Math.pow(from.clientY - to.clientY, 2)
+        );
+    },
+    
+    /**
+     * Method: passesDblclickTolerance
+     * Determine whether the event is within the optional double-cick pixel 
+     *     tolerance.
      *
      * Returns:
      *
      * Returns:
-     * {Number | Object} The distance between this geometry and the target.
-     *     If details is true, the return will be an object with distance,
-     *     x0, y0, x1, and y1 properties.  The x0 and y0 properties represent
-     *     the coordinates of the closest point on this geometry. The x1 and y1
-     *     properties represent the coordinates of the closest point on the
-     *     target geometry.
+     * {Boolean} The click is within the double-click pixel tolerance.
      */
      */
-    distanceTo: function(geometry, options) {
-        var edge = !(options && options.edge === false);
-        var result;
-        // this is the case where we might not be looking for distance to edge
-        if(!edge && this.intersects(geometry)) {
-            result = 0;
-        } else {
-            result = OpenLayers.Geometry.Collection.prototype.distanceTo.apply(
-                this, [geometry, options]
-            );
+    passesDblclickTolerance: function(evt) {
+        var passes = true;
+        if (this.down && this.first) {
+            passes = this.down.xy.distanceTo(this.first.xy) <= this.dblclickTolerance;
         }
         }
-        return result;
+        return passes;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Geometry.Polygon"
-});
-
-/**
- * APIMethod: createRegularPolygon
- * Create a regular polygon around a radius. Useful for creating circles 
- * and the like.
- *
- * Parameters:
- * origin - {<OpenLayers.Geometry.Point>} center of polygon.
- * radius - {Float} distance to vertex, in map units.
- * sides - {Integer} Number of sides. 20 approximates a circle.
- * rotation - {Float} original angle of rotation, in degrees.
- */
-OpenLayers.Geometry.Polygon.createRegularPolygon = function(origin, radius, sides, rotation) {  
-    var angle = Math.PI * ((1/sides) - (1/2));
-    if(rotation) {
-        angle += (rotation / 180) * Math.PI;
-    }
-    var rotatedAngle, x, y;
-    var points = [];
-    for(var i=0; i<sides; ++i) {
-        rotatedAngle = angle + (i * 2 * Math.PI / sides);
-        x = origin.x + (radius * Math.cos(rotatedAngle));
-        y = origin.y + (radius * Math.sin(rotatedAngle));
-        points.push(new OpenLayers.Geometry.Point(x, y));
-    }
-    var ring = new OpenLayers.Geometry.LinearRing(points);
-    return new OpenLayers.Geometry.Polygon([ring]);
-};
-/* ======================================================================
-    OpenLayers/Geometry/MultiPolygon.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Geometry/Collection.js
- * @requires OpenLayers/Geometry/Polygon.js
- */
-
-/**
- * Class: OpenLayers.Geometry.MultiPolygon
- * MultiPolygon is a geometry with multiple <OpenLayers.Geometry.Polygon>
- * components.  Create a new instance with the <OpenLayers.Geometry.MultiPolygon>
- * constructor.
- * 
- * Inherits from:
- *  - <OpenLayers.Geometry.Collection>
- */
-OpenLayers.Geometry.MultiPolygon = OpenLayers.Class(
-  OpenLayers.Geometry.Collection, {
-
     /**
     /**
-     * Property: componentTypes
-     * {Array(String)} An array of class names representing the types of
-     * components that the collection can include.  A null value means the
-     * component types are not restricted.
+     * Method: clearTimer
+     * Clear the timer and set <timerId> to null.
      */
      */
-    componentTypes: ["OpenLayers.Geometry.Polygon"],
+    clearTimer: function() {
+        if (this.timerId != null) {
+            window.clearTimeout(this.timerId);
+            this.timerId = null;
+        }
+        if (this.rightclickTimerId != null) {
+            window.clearTimeout(this.rightclickTimerId);
+            this.rightclickTimerId = null;
+        }
+    },
+    
+    /**
+     * Method: delayedCall
+     * Sets <timerId> to null.  And optionally triggers the click callback if
+     *     evt is set.
+     */
+    delayedCall: function(evt) {
+        this.timerId = null;
+        if (evt) {
+            this.callback("click", [evt]);
+        }
+    },
 
     /**
 
     /**
-     * Constructor: OpenLayers.Geometry.MultiPolygon
-     * Create a new MultiPolygon geometry
+     * Method: getEventInfo
+     * This method allows us to store event information without storing the
+     *     actual event.  In touch devices (at least), the same event is 
+     *     modified between touchstart, touchmove, and touchend.
      *
      *
-     * Parameters:
-     * components - {Array(<OpenLayers.Geometry.Polygon>)} An array of polygons
-     *              used to generate the MultiPolygon
+     * Returns:
+     * {Object} An object with event related info.
+     */
+    getEventInfo: function(evt) {
+        var touches;
+        if (evt.touches) {
+            var len = evt.touches.length;
+            touches = new Array(len);
+            var touch;
+            for (var i=0; i<len; i++) {
+                touch = evt.touches[i];
+                touches[i] = {
+                    clientX: touch.olClientX,
+                    clientY: touch.olClientY
+                };
+            }
+        }
+        return {
+            xy: evt.xy,
+            touches: touches
+        };
+    },
+
+    /**
+     * APIMethod: deactivate
+     * Deactivate the handler.
      *
      *
+     * Returns:
+     * {Boolean} The handler was successfully deactivated.
      */
      */
+    deactivate: function() {
+        var deactivated = false;
+        if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+            this.clearTimer();
+            this.down = null;
+            this.first = null;
+            this.last = null;
+            deactivated = true;
+        }
+        return deactivated;
+    },
 
 
-    CLASS_NAME: "OpenLayers.Geometry.MultiPolygon"
+    CLASS_NAME: "OpenLayers.Handler.Click"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Format/GML.js
+    OpenLayers/Control/Navigation.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Format/XML.js
- * @requires OpenLayers/Feature/Vector.js
- * @requires OpenLayers/Geometry/Point.js
- * @requires OpenLayers/Geometry/MultiPoint.js
- * @requires OpenLayers/Geometry/LineString.js
- * @requires OpenLayers/Geometry/MultiLineString.js
- * @requires OpenLayers/Geometry/Polygon.js
- * @requires OpenLayers/Geometry/MultiPolygon.js
+ * @requires OpenLayers/Control/ZoomBox.js
+ * @requires OpenLayers/Control/DragPan.js
+ * @requires OpenLayers/Handler/MouseWheel.js
+ * @requires OpenLayers/Handler/Click.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Format.GML
- * Read/Write GML. Create a new instance with the <OpenLayers.Format.GML>
- *     constructor.  Supports the GML simple features profile.
+ * Class: OpenLayers.Control.Navigation
+ * The navigation control handles map browsing with mouse events (dragging,
+ *     double-clicking, and scrolling the wheel).  Create a new navigation 
+ *     control with the <OpenLayers.Control.Navigation> control.  
  * 
  * 
- * Inherits from:
- *  - <OpenLayers.Format.XML>
+ *     Note that this control is added to the map by default (if no controls 
+ *     array is sent in the options object to the <OpenLayers.Map> 
+ *     constructor).
+ * 
+ * Inherits:
+ *  - <OpenLayers.Control>
  */
  */
-OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
-    
-    /**
-     * APIProperty: featureNS
-     * {String} Namespace used for feature attributes.  Default is
-     *     "http://mapserver.gis.umn.edu/mapserver".
+OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
+
+    /** 
+     * Property: dragPan
+     * {<OpenLayers.Control.DragPan>} 
      */
      */
-    featureNS: "http://mapserver.gis.umn.edu/mapserver",
-    
+    dragPan: null,
+
     /**
     /**
-     * APIProperty: featurePrefix
-     * {String} Namespace alias (or prefix) for feature nodes.  Default is
-     *     "feature".
+     * APIProperty: dragPanOptions
+     * {Object} Options passed to the DragPan control.
      */
      */
-    featurePrefix: "feature",
-    
+    dragPanOptions: null,
+
     /**
     /**
-     * APIProperty: featureName
-     * {String} Element name for features. Default is "featureMember".
+     * Property: pinchZoom
+     * {<OpenLayers.Control.PinchZoom>}
      */
      */
-    featureName: "featureMember", 
-    
+    pinchZoom: null,
+
     /**
     /**
-     * APIProperty: layerName
-     * {String} Name of data layer. Default is "features".
+     * APIProperty: pinchZoomOptions
+     * {Object} Options passed to the PinchZoom control.
      */
      */
-    layerName: "features",
-    
+    pinchZoomOptions: null,
+
     /**
     /**
-     * APIProperty: geometryName
-     * {String} Name of geometry element.  Defaults to "geometry".
+     * APIProperty: documentDrag
+     * {Boolean} Allow panning of the map by dragging outside map viewport.
+     *     Default is false.
      */
      */
-    geometryName: "geometry",
-    
+    documentDrag: false,
+
     /** 
     /** 
-     * APIProperty: collectionName
-     * {String} Name of featureCollection element.
+     * Property: zoomBox
+     * {<OpenLayers.Control.ZoomBox>}
      */
      */
-    collectionName: "FeatureCollection",
-    
+    zoomBox: null,
+
     /**
     /**
-     * APIProperty: gmlns
-     * {String} GML Namespace.
+     * APIProperty: zoomBoxEnabled
+     * {Boolean} Whether the user can draw a box to zoom
      */
      */
-    gmlns: "http://www.opengis.net/gml",
+    zoomBoxEnabled: true, 
 
     /**
 
     /**
-     * APIProperty: extractAttributes
-     * {Boolean} Extract attributes from GML.
+     * APIProperty: zoomWheelEnabled
+     * {Boolean} Whether the mousewheel should zoom the map
      */
      */
-    extractAttributes: true,
+    zoomWheelEnabled: true,
     
     /**
     
     /**
-     * APIProperty: xy
-     * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
-     * Changing is not recommended, a new Format should be instantiated.
-     */ 
-    xy: true,
+     * Property: mouseWheelOptions
+     * {Object} Options passed to the MouseWheel control (only useful if
+     *     <zoomWheelEnabled> is set to true). Default is no options for maps
+     *     with fractionalZoom set to true, otherwise
+     *     {cumulative: false, interval: 50, maxDelta: 6} 
+     */
+    mouseWheelOptions: null,
+
+    /**
+     * APIProperty: handleRightClicks
+     * {Boolean} Whether or not to handle right clicks. Default is false.
+     */
+    handleRightClicks: false,
+
+    /**
+     * APIProperty: zoomBoxKeyMask
+     * {Integer} <OpenLayers.Handler> key code of the key, which has to be
+     *    pressed, while drawing the zoom box with the mouse on the screen. 
+     *    You should probably set handleRightClicks to true if you use this
+     *    with MOD_CTRL, to disable the context menu for machines which use
+     *    CTRL-Click as a right click.
+     * Default: <OpenLayers.Handler.MOD_SHIFT>
+     */
+    zoomBoxKeyMask: OpenLayers.Handler.MOD_SHIFT,
     
     /**
     
     /**
-     * Constructor: OpenLayers.Format.GML
-     * Create a new parser for GML.
-     *
+     * APIProperty: autoActivate
+     * {Boolean} Activate the control when it is added to a map.  Default is
+     *     true.
+     */
+    autoActivate: true,
+
+    /**
+     * Constructor: OpenLayers.Control.Navigation
+     * Create a new navigation control
+     * 
      * Parameters:
      * options - {Object} An optional object whose properties will be set on
      * Parameters:
      * options - {Object} An optional object whose properties will be set on
-     *     this instance.
+     *                    the control
      */
     initialize: function(options) {
      */
     initialize: function(options) {
-        // compile regular expressions once instead of every time they are used
-        this.regExes = {
-            trimSpace: (/^\s*|\s*$/g),
-            removeSpace: (/\s*/g),
-            splitSpace: (/\s+/),
-            trimComma: (/\s*,\s*/g)
-        };
-        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+        this.handlers = {};
+        OpenLayers.Control.prototype.initialize.apply(this, arguments);
     },
 
     /**
     },
 
     /**
-     * APIMethod: read
-     * Read data from a string, and return a list of features. 
-     * 
-     * Parameters:
-     * data - {String} or {DOMElement} data to read/parse.
-     *
-     * Returns:
-     * {Array(<OpenLayers.Feature.Vector>)} An array of features.
+     * Method: destroy
+     * The destroy method is used to perform any clean up before the control
+     * is dereferenced.  Typically this is where event listeners are removed
+     * to prevent memory leaks.
      */
      */
-    read: function(data) {
-        if(typeof data == "string") { 
-            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
+    destroy: function() {
+        this.deactivate();
+
+        if (this.dragPan) {
+            this.dragPan.destroy();
         }
         }
-        var featureNodes = this.getElementsByTagNameNS(data.documentElement,
-                                                       this.gmlns,
-                                                       this.featureName);
-        var features = [];
-        for(var i=0; i<featureNodes.length; i++) {
-            var feature = this.parseFeature(featureNodes[i]);
-            if(feature) {
-                features.push(feature);
-            }
+        this.dragPan = null;
+
+        if (this.zoomBox) {
+            this.zoomBox.destroy();
         }
         }
-        return features;
+        this.zoomBox = null;
+
+        if (this.pinchZoom) {
+            this.pinchZoom.destroy();
+        }
+        this.pinchZoom = null;
+
+        OpenLayers.Control.prototype.destroy.apply(this,arguments);
     },
     
     /**
     },
     
     /**
-     * Method: parseFeature
-     * This function is the core of the GML parsing code in OpenLayers.
-     *    It creates the geometries that are then attached to the returned
-     *    feature, and calls parseAttributes() to get attribute data out.
-     *    
-     * Parameters:
-     * node - {DOMElement} A GML feature node. 
+     * Method: activate
      */
      */
-    parseFeature: function(node) {
-        // only accept one geometry per feature - look for highest "order"
-        var order = ["MultiPolygon", "Polygon",
-                     "MultiLineString", "LineString",
-                     "MultiPoint", "Point", "Envelope"];
-        // FIXME: In case we parse a feature with no geometry, but boundedBy an Envelope,
-        // this code creates a geometry derived from the Envelope. This is not correct.
-        var type, nodeList, geometry, parser;
-        for(var i=0; i<order.length; ++i) {
-            type = order[i];
-            nodeList = this.getElementsByTagNameNS(node, this.gmlns, type);
-            if(nodeList.length > 0) {
-                // only deal with first geometry of this type
-                parser = this.parseGeometry[type.toLowerCase()];
-                if(parser) {
-                    geometry = parser.apply(this, [nodeList[0]]);
-                    if (this.internalProjection && this.externalProjection) {
-                        geometry.transform(this.externalProjection, 
-                                           this.internalProjection); 
-                    }                       
-                } else {
-                    throw new TypeError("Unsupported geometry type: " + type);
-                }
-                // stop looking for different geometry types
-                break;
-            }
+    activate: function() {
+        this.dragPan.activate();
+        if (this.zoomWheelEnabled) {
+            this.handlers.wheel.activate();
+        }    
+        this.handlers.click.activate();
+        if (this.zoomBoxEnabled) {
+            this.zoomBox.activate();
+        }
+        if (this.pinchZoom) {
+            this.pinchZoom.activate();
         }
         }
+        return OpenLayers.Control.prototype.activate.apply(this,arguments);
+    },
 
 
-        var bounds;
-        var boxNodes = this.getElementsByTagNameNS(node, this.gmlns, "Box");
-        for(i=0; i<boxNodes.length; ++i) {
-            var boxNode = boxNodes[i];
-            var box = this.parseGeometry["box"].apply(this, [boxNode]);
-            var parentNode = boxNode.parentNode;
-            var parentName = parentNode.localName ||
-                             parentNode.nodeName.split(":").pop();
-            if(parentName === "boundedBy") {
-                bounds = box;
-            } else {
-                geometry = box.toGeometry();
-            }
+    /**
+     * Method: deactivate
+     */
+    deactivate: function() {
+        if (this.pinchZoom) {
+            this.pinchZoom.deactivate();
         }
         }
-        
-        // construct feature (optionally with attributes)
-        var attributes;
-        if(this.extractAttributes) {
-            attributes = this.parseAttributes(node);
+        this.zoomBox.deactivate();
+        this.dragPan.deactivate();
+        this.handlers.click.deactivate();
+        this.handlers.wheel.deactivate();
+        return OpenLayers.Control.prototype.deactivate.apply(this,arguments);
+    },
+    
+    /**
+     * Method: draw
+     */
+    draw: function() {
+        // disable right mouse context menu for support of right click events
+        if (this.handleRightClicks) {
+            this.map.viewPortDiv.oncontextmenu = OpenLayers.Function.False;
         }
         }
-        var feature = new OpenLayers.Feature.Vector(geometry, attributes);
-        feature.bounds = bounds;
-        
-        feature.gml = {
-            featureType: node.firstChild.nodeName.split(":")[1],
-            featureNS: node.firstChild.namespaceURI,
-            featureNSPrefix: node.firstChild.prefix
+
+        var clickCallbacks = { 
+            'click': this.defaultClick,
+            'dblclick': this.defaultDblClick, 
+            'dblrightclick': this.defaultDblRightClick 
         };
         };
-                
-        // assign fid - this can come from a "fid" or "id" attribute
-        var childNode = node.firstChild;
-        var fid;
-        while(childNode) {
-            if(childNode.nodeType == 1) {
-                fid = childNode.getAttribute("fid") ||
-                      childNode.getAttribute("id");
-                if(fid) {
-                    break;
-                }
-            }
-            childNode = childNode.nextSibling;
+        var clickOptions = {
+            'double': true, 
+            'stopDouble': true
+        };
+        this.handlers.click = new OpenLayers.Handler.Click(
+            this, clickCallbacks, clickOptions
+        );
+        this.dragPan = new OpenLayers.Control.DragPan(
+            OpenLayers.Util.extend({
+                map: this.map,
+                documentDrag: this.documentDrag
+            }, this.dragPanOptions)
+        );
+        this.zoomBox = new OpenLayers.Control.ZoomBox(
+                    {map: this.map, keyMask: this.zoomBoxKeyMask});
+        this.dragPan.draw();
+        this.zoomBox.draw();
+        var wheelOptions = this.map.fractionalZoom ? {} : {
+            cumulative: false,
+            interval: 50,
+            maxDelta: 6
+        };
+        this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
+            this, {up : this.wheelUp, down: this.wheelDown},
+            OpenLayers.Util.extend(wheelOptions, this.mouseWheelOptions)
+        );
+        if (OpenLayers.Control.PinchZoom) {
+            this.pinchZoom = new OpenLayers.Control.PinchZoom(
+                OpenLayers.Util.extend(
+                    {map: this.map}, this.pinchZoomOptions));
         }
         }
-        feature.fid = fid;
-        return feature;
     },
     },
-    
+
     /**
     /**
-     * Property: parseGeometry
-     * Properties of this object are the functions that parse geometries based
-     *     on their type.
+     * Method: defaultClick
+     *
+     * Parameters:
+     * evt - {Event}
      */
      */
-    parseGeometry: {
-        
-        /**
-         * Method: parseGeometry.point
-         * Given a GML node representing a point geometry, create an OpenLayers
-         *     point geometry.
-         *
-         * Parameters:
-         * node - {DOMElement} A GML node.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry.Point>} A point geometry.
-         */
-        point: function(node) {
-            /**
-             * Three coordinate variations to consider:
-             * 1) <gml:pos>x y z</gml:pos>
-             * 2) <gml:coordinates>x, y, z</gml:coordinates>
-             * 3) <gml:coord><gml:X>x</gml:X><gml:Y>y</gml:Y></gml:coord>
-             */
-            var nodeList, coordString;
-            var coords = [];
-
-            // look for <gml:pos>
-            var nodeList = this.getElementsByTagNameNS(node, this.gmlns, "pos");
-            if(nodeList.length > 0) {
-                coordString = nodeList[0].firstChild.nodeValue;
-                coordString = coordString.replace(this.regExes.trimSpace, "");
-                coords = coordString.split(this.regExes.splitSpace);
-            }
+    defaultClick: function (evt) {
+        if (evt.lastTouches && evt.lastTouches.length == 2) {
+            this.map.zoomOut();
+        }
+    },
 
 
-            // look for <gml:coordinates>
-            if(coords.length == 0) {
-                nodeList = this.getElementsByTagNameNS(node, this.gmlns,
-                                                       "coordinates");
-                if(nodeList.length > 0) {
-                    coordString = nodeList[0].firstChild.nodeValue;
-                    coordString = coordString.replace(this.regExes.removeSpace,
-                                                      "");
-                    coords = coordString.split(",");
-                }
-            }
+    /**
+     * Method: defaultDblClick 
+     * 
+     * Parameters:
+     * evt - {Event} 
+     */
+    defaultDblClick: function (evt) {
+        this.map.zoomTo(this.map.zoom + 1, evt.xy);
+    },
 
 
-            // look for <gml:coord>
-            if(coords.length == 0) {
-                nodeList = this.getElementsByTagNameNS(node, this.gmlns,
-                                                       "coord");
-                if(nodeList.length > 0) {
-                    var xList = this.getElementsByTagNameNS(nodeList[0],
-                                                            this.gmlns, "X");
-                    var yList = this.getElementsByTagNameNS(nodeList[0],
-                                                            this.gmlns, "Y");
-                    if(xList.length > 0 && yList.length > 0) {
-                        coords = [xList[0].firstChild.nodeValue,
-                                  yList[0].firstChild.nodeValue];
-                    }
-                }
-            }
-                
-            // preserve third dimension
-            if(coords.length == 2) {
-                coords[2] = null;
-            }
-            
-            if (this.xy) {
-                return new OpenLayers.Geometry.Point(coords[0], coords[1],
-                                                 coords[2]);
-            }
-            else{
-                return new OpenLayers.Geometry.Point(coords[1], coords[0],
-                                                 coords[2]);
-            }
-        },
-        
-        /**
-         * Method: parseGeometry.multipoint
-         * Given a GML node representing a multipoint geometry, create an
-         *     OpenLayers multipoint geometry.
-         *
-         * Parameters:
-         * node - {DOMElement} A GML node.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry.MultiPoint>} A multipoint geometry.
-         */
-        multipoint: function(node) {
-            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
-                                                       "Point");
-            var components = [];
-            if(nodeList.length > 0) {
-                var point;
-                for(var i=0; i<nodeList.length; ++i) {
-                    point = this.parseGeometry.point.apply(this, [nodeList[i]]);
-                    if(point) {
-                        components.push(point);
-                    }
-                }
-            }
-            return new OpenLayers.Geometry.MultiPoint(components);
-        },
-        
-        /**
-         * Method: parseGeometry.linestring
-         * Given a GML node representing a linestring geometry, create an
-         *     OpenLayers linestring geometry.
-         *
-         * Parameters:
-         * node - {DOMElement} A GML node.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry.LineString>} A linestring geometry.
-         */
-        linestring: function(node, ring) {
-            /**
-             * Two coordinate variations to consider:
-             * 1) <gml:posList dimension="d">x0 y0 z0 x1 y1 z1</gml:posList>
-             * 2) <gml:coordinates>x0, y0, z0 x1, y1, z1</gml:coordinates>
-             */
-            var nodeList, coordString;
-            var coords = [];
-            var points = [];
+    /**
+     * Method: defaultDblRightClick 
+     * 
+     * Parameters:
+     * evt - {Event} 
+     */
+    defaultDblRightClick: function (evt) {
+        this.map.zoomTo(this.map.zoom - 1, evt.xy);
+    },
+    
+    /**
+     * Method: wheelChange  
+     *
+     * Parameters:
+     * evt - {Event}
+     * deltaZ - {Integer}
+     */
+    wheelChange: function(evt, deltaZ) {
+        if (!this.map.fractionalZoom) {
+            deltaZ =  Math.round(deltaZ);
+        }
+        var currentZoom = this.map.getZoom(),
+            newZoom = currentZoom + deltaZ;
+        newZoom = Math.max(newZoom, 0);
+        newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
+        if (newZoom === currentZoom) {
+            return;
+        }
+        this.map.zoomTo(newZoom, evt.xy);
+    },
 
 
-            // look for <gml:posList>
-            nodeList = this.getElementsByTagNameNS(node, this.gmlns, "posList");
-            if(nodeList.length > 0) {
-                coordString = this.getChildValue(nodeList[0]);
-                coordString = coordString.replace(this.regExes.trimSpace, "");
-                coords = coordString.split(this.regExes.splitSpace);
-                var dim = parseInt(nodeList[0].getAttribute("dimension"));
-                var j, x, y, z;
-                for(var i=0; i<coords.length/dim; ++i) {
-                    j = i * dim;
-                    x = coords[j];
-                    y = coords[j+1];
-                    z = (dim == 2) ? null : coords[j+2];
-                    if (this.xy) {
-                        points.push(new OpenLayers.Geometry.Point(x, y, z));
-                    } else {
-                        points.push(new OpenLayers.Geometry.Point(y, x, z));
-                    }
-                }
-            }
+    /** 
+     * Method: wheelUp
+     * User spun scroll wheel up
+     * 
+     * Parameters:
+     * evt - {Event}
+     * delta - {Integer}
+     */
+    wheelUp: function(evt, delta) {
+        this.wheelChange(evt, delta || 1);
+    },
 
 
-            // look for <gml:coordinates>
-            if(coords.length == 0) {
-                nodeList = this.getElementsByTagNameNS(node, this.gmlns,
-                                                       "coordinates");
-                if(nodeList.length > 0) {
-                    coordString = this.getChildValue(nodeList[0]);
-                    coordString = coordString.replace(this.regExes.trimSpace,
-                                                      "");
-                    coordString = coordString.replace(this.regExes.trimComma,
-                                                      ",");
-                    var pointList = coordString.split(this.regExes.splitSpace);
-                    for(var i=0; i<pointList.length; ++i) {
-                        coords = pointList[i].split(",");
-                        if(coords.length == 2) {
-                            coords[2] = null;
-                        }
-                        if (this.xy) {
-                            points.push(new OpenLayers.Geometry.Point(coords[0],
-                                                                  coords[1],
-                                                                  coords[2]));
-                        } else {
-                            points.push(new OpenLayers.Geometry.Point(coords[1],
-                                                                  coords[0],
-                                                                  coords[2]));
-                        }
-                    }
-                }
-            }
+    /** 
+     * Method: wheelDown
+     * User spun scroll wheel down
+     * 
+     * Parameters:
+     * evt - {Event}
+     * delta - {Integer}
+     */
+    wheelDown: function(evt, delta) {
+        this.wheelChange(evt, delta || -1);
+    },
+    
+    /**
+     * Method: disableZoomBox
+     */
+    disableZoomBox : function() {
+        this.zoomBoxEnabled = false;
+        this.zoomBox.deactivate();       
+    },
+    
+    /**
+     * Method: enableZoomBox
+     */
+    enableZoomBox : function() {
+        this.zoomBoxEnabled = true;
+        if (this.active) {
+            this.zoomBox.activate();
+        }    
+    },
+    
+    /**
+     * Method: disableZoomWheel
+     */
+    
+    disableZoomWheel : function() {
+        this.zoomWheelEnabled = false;
+        this.handlers.wheel.deactivate();       
+    },
+    
+    /**
+     * Method: enableZoomWheel
+     */
+    
+    enableZoomWheel : function() {
+        this.zoomWheelEnabled = true;
+        if (this.active) {
+            this.handlers.wheel.activate();
+        }    
+    },
 
 
-            var line = null;
-            if(points.length != 0) {
-                if(ring) {
-                    line = new OpenLayers.Geometry.LinearRing(points);
-                } else {
-                    line = new OpenLayers.Geometry.LineString(points);
-                }
-            }
-            return line;
-        },
-        
-        /**
-         * Method: parseGeometry.multilinestring
-         * Given a GML node representing a multilinestring geometry, create an
-         *     OpenLayers multilinestring geometry.
-         *
-         * Parameters:
-         * node - {DOMElement} A GML node.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry.MultiLineString>} A multilinestring geometry.
-         */
-        multilinestring: function(node) {
-            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
-                                                       "LineString");
-            var components = [];
-            if(nodeList.length > 0) {
-                var line;
-                for(var i=0; i<nodeList.length; ++i) {
-                    line = this.parseGeometry.linestring.apply(this,
-                                                               [nodeList[i]]);
-                    if(line) {
-                        components.push(line);
-                    }
-                }
-            }
-            return new OpenLayers.Geometry.MultiLineString(components);
-        },
-        
-        /**
-         * Method: parseGeometry.polygon
-         * Given a GML node representing a polygon geometry, create an
-         *     OpenLayers polygon geometry.
-         *
-         * Parameters:
-         * node - {DOMElement} A GML node.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry.Polygon>} A polygon geometry.
-         */
-        polygon: function(node) {
-            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
-                                                       "LinearRing");
-            var components = [];
-            if(nodeList.length > 0) {
-                // this assumes exterior ring first, inner rings after
-                var ring;
-                for(var i=0; i<nodeList.length; ++i) {
-                    ring = this.parseGeometry.linestring.apply(this,
-                                                        [nodeList[i], true]);
-                    if(ring) {
-                        components.push(ring);
-                    }
-                }
-            }
-            return new OpenLayers.Geometry.Polygon(components);
-        },
-        
-        /**
-         * Method: parseGeometry.multipolygon
-         * Given a GML node representing a multipolygon geometry, create an
-         *     OpenLayers multipolygon geometry.
-         *
-         * Parameters:
-         * node - {DOMElement} A GML node.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry.MultiPolygon>} A multipolygon geometry.
-         */
-        multipolygon: function(node) {
-            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
-                                                       "Polygon");
-            var components = [];
-            if(nodeList.length > 0) {
-                var polygon;
-                for(var i=0; i<nodeList.length; ++i) {
-                    polygon = this.parseGeometry.polygon.apply(this,
-                                                               [nodeList[i]]);
-                    if(polygon) {
-                        components.push(polygon);
-                    }
-                }
-            }
-            return new OpenLayers.Geometry.MultiPolygon(components);
-        },
-        
-        envelope: function(node) {
-            var components = [];
-            var coordString;
-            var envelope;
-            
-            var lpoint = this.getElementsByTagNameNS(node, this.gmlns, "lowerCorner");
-            if (lpoint.length > 0) {
-                var coords = [];
-                
-                if(lpoint.length > 0) {
-                    coordString = lpoint[0].firstChild.nodeValue;
-                    coordString = coordString.replace(this.regExes.trimSpace, "");
-                    coords = coordString.split(this.regExes.splitSpace);
-                }
-                
-                if(coords.length == 2) {
-                    coords[2] = null;
-                }
-                if (this.xy) {
-                    var lowerPoint = new OpenLayers.Geometry.Point(coords[0], coords[1],coords[2]);
-                } else {
-                    var lowerPoint = new OpenLayers.Geometry.Point(coords[1], coords[0],coords[2]);
-                }
-            }
-            
-            var upoint = this.getElementsByTagNameNS(node, this.gmlns, "upperCorner");
-            if (upoint.length > 0) {
-                var coords = [];
-                
-                if(upoint.length > 0) {
-                    coordString = upoint[0].firstChild.nodeValue;
-                    coordString = coordString.replace(this.regExes.trimSpace, "");
-                    coords = coordString.split(this.regExes.splitSpace);
-                }
-                
-                if(coords.length == 2) {
-                    coords[2] = null;
-                }
-                if (this.xy) {
-                    var upperPoint = new OpenLayers.Geometry.Point(coords[0], coords[1],coords[2]);
-                } else {
-                    var upperPoint = new OpenLayers.Geometry.Point(coords[1], coords[0],coords[2]);
-                }
-            }
-            
-            if (lowerPoint && upperPoint) {
-                components.push(new OpenLayers.Geometry.Point(lowerPoint.x, lowerPoint.y));
-                components.push(new OpenLayers.Geometry.Point(upperPoint.x, lowerPoint.y));
-                components.push(new OpenLayers.Geometry.Point(upperPoint.x, upperPoint.y));
-                components.push(new OpenLayers.Geometry.Point(lowerPoint.x, upperPoint.y));
-                components.push(new OpenLayers.Geometry.Point(lowerPoint.x, lowerPoint.y));
-                
-                var ring = new OpenLayers.Geometry.LinearRing(components);
-                envelope = new OpenLayers.Geometry.Polygon([ring]);
-            }
-            return envelope; 
-        },
+    CLASS_NAME: "OpenLayers.Control.Navigation"
+});
+/* ======================================================================
+    OpenLayers/Events/buttonclick.js
+   ====================================================================== */
 
 
-        /**
-         * Method: parseGeometry.box
-         * Given a GML node representing a box geometry, create an
-         *     OpenLayers.Bounds.
-         *
-         * Parameters:
-         * node - {DOMElement} A GML node.
-         *
-         * Returns:
-         * {<OpenLayers.Bounds>} A bounds representing the box.
-         */
-        box: function(node) {
-            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
-                                                   "coordinates");
-            var coordString;
-            var coords, beginPoint = null, endPoint = null;
-            if (nodeList.length > 0) {
-                coordString = nodeList[0].firstChild.nodeValue;
-                coords = coordString.split(" ");
-                if (coords.length == 2) {
-                    beginPoint = coords[0].split(",");
-                    endPoint = coords[1].split(",");
-                }
-            }
-            if (beginPoint !== null && endPoint !== null) {
-                return new OpenLayers.Bounds(parseFloat(beginPoint[0]),
-                    parseFloat(beginPoint[1]),
-                    parseFloat(endPoint[0]),
-                    parseFloat(endPoint[1]) );
-            }
-        }
-        
-    },
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Events.js
+ */
+
+/**
+ * Class: OpenLayers.Events.buttonclick
+ * Extension event type for handling buttons on top of a dom element. This
+ *     event type fires "buttonclick" on its <target> when a button was
+ *     clicked. Buttons are detected by the "olButton" class.
+ *
+ * This event type makes sure that button clicks do not interfere with other
+ *     events that are registered on the same <element>.
+ *
+ * Event types provided by this extension:
+ * - *buttonclick* Triggered when a button is clicked. Listeners receive an
+ *     object with a *buttonElement* property referencing the dom element of
+ *     the clicked button, and an *buttonXY* property with the click position
+ *     relative to the button.
+ */
+OpenLayers.Events.buttonclick = OpenLayers.Class({
     
     /**
     
     /**
-     * Method: parseAttributes
+     * Property: target
+     * {<OpenLayers.Events>} The events instance that the buttonclick event will
+     * be triggered on.
+     */
+    target: null,
+    
+    /**
+     * Property: events
+     * {Array} Events to observe and conditionally stop from propagating when
+     *     an element with the olButton class (or its olAlphaImg child) is
+     *     clicked.
+     */
+    events: [
+        'mousedown', 'mouseup', 'click', 'dblclick',
+        'touchstart', 'touchmove', 'touchend', 'keydown'
+    ],
+    
+    /**
+     * Property: startRegEx
+     * {RegExp} Regular expression to test Event.type for events that start
+     *     a buttonclick sequence.
+     */
+    startRegEx: /^mousedown|touchstart$/,
+
+    /**
+     * Property: cancelRegEx
+     * {RegExp} Regular expression to test Event.type for events that cancel
+     *     a buttonclick sequence.
+     */
+    cancelRegEx: /^touchmove$/,
+
+    /**
+     * Property: completeRegEx
+     * {RegExp} Regular expression to test Event.type for events that complete
+     *     a buttonclick sequence.
+     */
+    completeRegEx: /^mouseup|touchend$/,
+
+    /**
+     * Property: isDeviceTouchCapable
+     * {Boolean} Tells whether the browser detects touch events.
+     */
+    isDeviceTouchCapable: 'ontouchstart' in window ||
+        window.DocumentTouch && document instanceof window.DocumentTouch,
+    
+    /**
+     * Property: startEvt
+     * {Event} The event that started the click sequence
+     */
+    
+    /**
+     * Constructor: OpenLayers.Events.buttonclick
+     * Construct a buttonclick event type. Applications are not supposed to
+     *     create instances of this class - they are created on demand by
+     *     <OpenLayers.Events> instances.
      *
      * Parameters:
      *
      * Parameters:
-     * node - {DOMElement}
-     *
-     * Returns:
-     * {Object} An attributes object.
+     * target - {<OpenLayers.Events>} The events instance that the buttonclick
+     *     event will be triggered on.
      */
      */
-    parseAttributes: function(node) {
-        var attributes = {};
-        // assume attributes are children of the first type 1 child
-        var childNode = node.firstChild;
-        var children, i, child, grandchildren, grandchild, name, value;
-        while(childNode) {
-            if(childNode.nodeType == 1) {
-                // attributes are type 1 children with one type 3 child
-                children = childNode.childNodes;
-                for(i=0; i<children.length; ++i) {
-                    child = children[i];
-                    if(child.nodeType == 1) {
-                        grandchildren = child.childNodes;
-                        if(grandchildren.length == 1) {
-                            grandchild = grandchildren[0];
-                            if(grandchild.nodeType == 3 ||
-                               grandchild.nodeType == 4) {
-                                name = (child.prefix) ?
-                                        child.nodeName.split(":")[1] :
-                                        child.nodeName;
-                                value = grandchild.nodeValue.replace(
-                                                this.regExes.trimSpace, "");
-                                attributes[name] = value;
-                            }
-                        } else {
-                            // If child has no childNodes (grandchildren),
-                            // set an attribute with null value.
-                            // e.g. <prefix:fieldname/> becomes
-                            // {fieldname: null}
-                            attributes[child.nodeName.split(":").pop()] = null;
-                        }
-                    }
-                }
-                break;
-            }
-            childNode = childNode.nextSibling;
+    initialize: function(target) {
+        this.target = target;
+        for (var i=this.events.length-1; i>=0; --i) {
+            this.target.register(this.events[i], this, this.buttonClick, {
+                extension: true
+            });
         }
         }
-        return attributes;
     },
     
     /**
     },
     
     /**
-     * APIMethod: write
-     * Generate a GML document string given a list of features. 
-     * 
-     * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>)} List of features to
-     *     serialize into a string.
-     *
-     * Returns:
-     * {String} A string representing the GML document.
+     * Method: destroy
      */
      */
-    write: function(features) {
-        if(!(OpenLayers.Util.isArray(features))) {
-            features = [features];
-        }
-        var gml = this.createElementNS("http://www.opengis.net/wfs",
-                                       "wfs:" + this.collectionName);
-        for(var i=0; i<features.length; i++) {
-            gml.appendChild(this.createFeatureXML(features[i]));
+    destroy: function() {
+        for (var i=this.events.length-1; i>=0; --i) {
+            this.target.unregister(this.events[i], this, this.buttonClick);
         }
         }
-        return OpenLayers.Format.XML.prototype.write.apply(this, [gml]);
+        delete this.target;
     },
 
     },
 
-    /** 
-     * Method: createFeatureXML
-     * Accept an OpenLayers.Feature.Vector, and build a GML node for it.
+    /**
+     * Method: getPressedButton
+     * Get the pressed button, if any. Returns undefined if no button
+     * was pressed.
      *
      *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} The feature to be built as GML.
+     * Arguments:
+     * element - {DOMElement} The event target.
      *
      * Returns:
      *
      * Returns:
-     * {DOMElement} A node reprensting the feature in GML.
+     * {DOMElement} The button element, or undefined.
      */
      */
-    createFeatureXML: function(feature) {
-        var geometry = feature.geometry;
-        var geometryNode = this.buildGeometryNode(geometry);
-        var geomContainer = this.createElementNS(this.featureNS,
-                                                 this.featurePrefix + ":" +
-                                                 this.geometryName);
-        geomContainer.appendChild(geometryNode);
-        var featureNode = this.createElementNS(this.gmlns,
-                                               "gml:" + this.featureName);
-        var featureContainer = this.createElementNS(this.featureNS,
-                                                    this.featurePrefix + ":" +
-                                                    this.layerName);
-        var fid = feature.fid || feature.id;
-        featureContainer.setAttribute("fid", fid);
-        featureContainer.appendChild(geomContainer);
-        for(var attr in feature.attributes) {
-            var attrText = this.createTextNode(feature.attributes[attr]); 
-            var nodename = attr.substring(attr.lastIndexOf(":") + 1);
-            var attrContainer = this.createElementNS(this.featureNS,
-                                                     this.featurePrefix + ":" +
-                                                     nodename);
-            attrContainer.appendChild(attrText);
-            featureContainer.appendChild(attrContainer);
-        }    
-        featureNode.appendChild(featureContainer);
-        return featureNode;
+    getPressedButton: function(element) {
+        var depth = 3, // limit the search depth
+            button;
+        do {
+            if(OpenLayers.Element.hasClass(element, "olButton")) {
+                // hit!
+                button = element;
+                break;
+            }
+            element = element.parentNode;
+        } while(--depth > 0 && element);
+        return button;
     },
     
     /**
     },
     
     /**
-     * APIMethod: buildGeometryNode
+     * Method: ignore
+     * Check for event target elements that should be ignored by OpenLayers.
+     *
+     * Parameters:
+     * element - {DOMElement} The event target.
      */
      */
-    buildGeometryNode: function(geometry) {
-        if (this.externalProjection && this.internalProjection) {
-            geometry = geometry.clone();
-            geometry.transform(this.internalProjection, 
-                               this.externalProjection);
-        }    
-        var className = geometry.CLASS_NAME;
-        var type = className.substring(className.lastIndexOf(".") + 1);
-        var builder = this.buildGeometry[type.toLowerCase()];
-        return builder.apply(this, [geometry]);
+    ignore: function(element) {
+        var depth = 3,
+            ignore = false;
+        do {
+            if (element.nodeName.toLowerCase() === 'a') {
+                ignore = true;
+                break;
+            }
+            element = element.parentNode;
+        } while (--depth > 0 && element);
+        return ignore;
     },
 
     /**
     },
 
     /**
-     * Property: buildGeometry
-     * Object containing methods to do the actual geometry node building
-     *     based on geometry type.
+     * Method: buttonClick
+     * Check if a button was clicked, and fire the buttonclick event
+     *
+     * Parameters:
+     * evt - {Event}
      */
      */
-    buildGeometry: {
-        // TBD retrieve the srs from layer
-        // srsName is non-standard, so not including it until it's right.
-        // gml.setAttribute("srsName",
-        //                  "http://www.opengis.net/gml/srs/epsg.xml#4326");
+    buttonClick: function(evt) {
+        var propagate = true,
+            element = OpenLayers.Event.element(evt);
 
 
-        /**
-         * Method: buildGeometry.point
-         * Given an OpenLayers point geometry, create a GML point.
-         *
-         * Parameters:
-         * geometry - {<OpenLayers.Geometry.Point>} A point geometry.
-         *
-         * Returns:
-         * {DOMElement} A GML point node.
-         */
-        point: function(geometry) {
-            var gml = this.createElementNS(this.gmlns, "gml:Point");
-            gml.appendChild(this.buildCoordinatesNode(geometry));
-            return gml;
-        },
-        
-        /**
-         * Method: buildGeometry.multipoint
-         * Given an OpenLayers multipoint geometry, create a GML multipoint.
-         *
-         * Parameters:
-         * geometry - {<OpenLayers.Geometry.MultiPoint>} A multipoint geometry.
-         *
-         * Returns:
-         * {DOMElement} A GML multipoint node.
-         */
-        multipoint: function(geometry) {
-            var gml = this.createElementNS(this.gmlns, "gml:MultiPoint");
-            var points = geometry.components;
-            var pointMember, pointGeom;
-            for(var i=0; i<points.length; i++) { 
-                pointMember = this.createElementNS(this.gmlns,
-                                                   "gml:pointMember");
-                pointGeom = this.buildGeometry.point.apply(this,
-                                                               [points[i]]);
-                pointMember.appendChild(pointGeom);
-                gml.appendChild(pointMember);
-            }
-            return gml;            
-        },
-        
-        /**
-         * Method: buildGeometry.linestring
-         * Given an OpenLayers linestring geometry, create a GML linestring.
-         *
-         * Parameters:
-         * geometry - {<OpenLayers.Geometry.LineString>} A linestring geometry.
-         *
-         * Returns:
-         * {DOMElement} A GML linestring node.
-         */
-        linestring: function(geometry) {
-            var gml = this.createElementNS(this.gmlns, "gml:LineString");
-            gml.appendChild(this.buildCoordinatesNode(geometry));
-            return gml;
-        },
-        
-        /**
-         * Method: buildGeometry.multilinestring
-         * Given an OpenLayers multilinestring geometry, create a GML
-         *     multilinestring.
-         *
-         * Parameters:
-         * geometry - {<OpenLayers.Geometry.MultiLineString>} A multilinestring
-         *     geometry.
-         *
-         * Returns:
-         * {DOMElement} A GML multilinestring node.
-         */
-        multilinestring: function(geometry) {
-            var gml = this.createElementNS(this.gmlns, "gml:MultiLineString");
-            var lines = geometry.components;
-            var lineMember, lineGeom;
-            for(var i=0; i<lines.length; ++i) {
-                lineMember = this.createElementNS(this.gmlns,
-                                                  "gml:lineStringMember");
-                lineGeom = this.buildGeometry.linestring.apply(this,
-                                                                   [lines[i]]);
-                lineMember.appendChild(lineGeom);
-                gml.appendChild(lineMember);
-            }
-            return gml;
-        },
-        
-        /**
-         * Method: buildGeometry.linearring
-         * Given an OpenLayers linearring geometry, create a GML linearring.
-         *
-         * Parameters:
-         * geometry - {<OpenLayers.Geometry.LinearRing>} A linearring geometry.
-         *
-         * Returns:
-         * {DOMElement} A GML linearring node.
-         */
-        linearring: function(geometry) {
-            var gml = this.createElementNS(this.gmlns, "gml:LinearRing");
-            gml.appendChild(this.buildCoordinatesNode(geometry));
-            return gml;
-        },
-        
-        /**
-         * Method: buildGeometry.polygon
-         * Given an OpenLayers polygon geometry, create a GML polygon.
-         *
-         * Parameters:
-         * geometry - {<OpenLayers.Geometry.Polygon>} A polygon geometry.
-         *
-         * Returns:
-         * {DOMElement} A GML polygon node.
-         */
-        polygon: function(geometry) {
-            var gml = this.createElementNS(this.gmlns, "gml:Polygon");
-            var rings = geometry.components;
-            var ringMember, ringGeom, type;
-            for(var i=0; i<rings.length; ++i) {
-                type = (i==0) ? "outerBoundaryIs" : "innerBoundaryIs";
-                ringMember = this.createElementNS(this.gmlns,
-                                                  "gml:" + type);
-                ringGeom = this.buildGeometry.linearring.apply(this,
-                                                                   [rings[i]]);
-                ringMember.appendChild(ringGeom);
-                gml.appendChild(ringMember);
-            }
-            return gml;
-        },
-        
-        /**
-         * Method: buildGeometry.multipolygon
-         * Given an OpenLayers multipolygon geometry, create a GML multipolygon.
-         *
-         * Parameters:
-         * geometry - {<OpenLayers.Geometry.MultiPolygon>} A multipolygon
-         *     geometry.
-         *
-         * Returns:
-         * {DOMElement} A GML multipolygon node.
-         */
-        multipolygon: function(geometry) {
-            var gml = this.createElementNS(this.gmlns, "gml:MultiPolygon");
-            var polys = geometry.components;
-            var polyMember, polyGeom;
-            for(var i=0; i<polys.length; ++i) {
-                polyMember = this.createElementNS(this.gmlns,
-                                                  "gml:polygonMember");
-                polyGeom = this.buildGeometry.polygon.apply(this,
-                                                                [polys[i]]);
-                polyMember.appendChild(polyGeom);
-                gml.appendChild(polyMember);
+        if (element &&
+           (OpenLayers.Event.isLeftClick(evt) &&
+            !this.isDeviceTouchCapable ||
+            !~evt.type.indexOf("mouse"))) {
+            // was a button pressed?
+            var button = this.getPressedButton(element);
+            if (button) {
+                if (evt.type === "keydown") {
+                    switch (evt.keyCode) {
+                    case OpenLayers.Event.KEY_RETURN:
+                    case OpenLayers.Event.KEY_SPACE:
+                        this.target.triggerEvent("buttonclick", {
+                            buttonElement: button
+                        });
+                        OpenLayers.Event.stop(evt);
+                        propagate = false;
+                        break;
+                    }
+                } else if (this.startEvt) {
+                    if (this.completeRegEx.test(evt.type)) {
+                        var pos = OpenLayers.Util.pagePosition(button);
+                        var viewportElement = OpenLayers.Util.getViewportElement();
+                        var scrollTop = window.pageYOffset || viewportElement.scrollTop;
+                        var scrollLeft = window.pageXOffset || viewportElement.scrollLeft;
+                        pos[0] = pos[0] - scrollLeft;
+                        pos[1] = pos[1] - scrollTop;
+                        
+                        this.target.triggerEvent("buttonclick", {
+                            buttonElement: button,
+                            buttonXY: {
+                                x: this.startEvt.clientX - pos[0],
+                                y: this.startEvt.clientY - pos[1]
+                            }
+                        });
+                    }
+                    if (this.cancelRegEx.test(evt.type)) {
+                        if (evt.touches && this.startEvt.touches &&
+                                (Math.abs(evt.touches[0].olClientX - this.startEvt.touches[0].olClientX) > 4 ||
+                                Math.abs(evt.touches[0].olClientY - this.startEvt.touches[0].olClientY)) > 4) {
+                            delete this.startEvt;
+                        }
+                    }
+                    OpenLayers.Event.stop(evt);
+                    propagate = false;
+                }
+                if (this.startRegEx.test(evt.type)) {
+                    this.startEvt = evt;
+                    OpenLayers.Event.stop(evt);
+                    propagate = false;
+                }
+            } else {
+                propagate = !this.ignore(OpenLayers.Event.element(evt));
+                delete this.startEvt;
             }
             }
-            return gml;
-
-        },
-        /**
-         * Method: buildGeometry.bounds
-         * Given an OpenLayers bounds, create a GML box.
-         *
-         * Parameters:
-         * bounds - {<OpenLayers.Geometry.Bounds>} A bounds object.
-         *
-         * Returns:
-         * {DOMElement} A GML box node.
-         */
-        bounds: function(bounds) {
-            var gml = this.createElementNS(this.gmlns, "gml:Box");
-            gml.appendChild(this.buildCoordinatesNode(bounds));
-            return gml;
-        }
-    },
-
-    /**
-     * Method: buildCoordinates
-     * builds the coordinates XmlNode
-     * (code)
-     * <gml:coordinates decimal="." cs="," ts=" ">...</gml:coordinates>
-     * (end)
-     *
-     * Parameters: 
-     * geometry - {<OpenLayers.Geometry>} 
-     *
-     * Returns:
-     * {XmlNode} created xmlNode
-     */
-    buildCoordinatesNode: function(geometry) {
-        var coordinatesNode = this.createElementNS(this.gmlns,
-                                                   "gml:coordinates");
-        coordinatesNode.setAttribute("decimal", ".");
-        coordinatesNode.setAttribute("cs", ",");
-        coordinatesNode.setAttribute("ts", " ");
-
-        var parts = [];
-
-        if(geometry instanceof OpenLayers.Bounds){
-            parts.push(geometry.left + "," + geometry.bottom);
-            parts.push(geometry.right + "," + geometry.top);
-        } else {
-            var points = (geometry.components) ? geometry.components : [geometry];
-            for(var i=0; i<points.length; i++) {
-                parts.push(points[i].x + "," + points[i].y);                
-            }            
         }
         }
-
-        var txtNode = this.createTextNode(parts.join(" "));
-        coordinatesNode.appendChild(txtNode);
-        
-        return coordinatesNode;
-    },
-
-    CLASS_NAME: "OpenLayers.Format.GML" 
+        return propagate;
+    }
+    
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Format/GML/Base.js
+    OpenLayers/Control/PanZoom.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-/**
- * @requires OpenLayers/Format/XML.js
- * @requires OpenLayers/Format/GML.js
- */
 
 /**
 
 /**
- * Though required in the full build, if the GML format is excluded, we set
- * the namespace here.
+ * @requires OpenLayers/Control.js
+ * @requires OpenLayers/Events/buttonclick.js
  */
  */
-if(!OpenLayers.Format.GML) {
-    OpenLayers.Format.GML = {};
-}
 
 /**
 
 /**
- * Class: OpenLayers.Format.GML.Base
- * Superclass for GML parsers.
+ * Class: OpenLayers.Control.PanZoom
+ * The PanZoom is a visible control, composed of a
+ * <OpenLayers.Control.PanPanel> and a <OpenLayers.Control.ZoomPanel>. By
+ * default it is drawn in the upper left corner of the map.
  *
  * Inherits from:
  *
  * Inherits from:
- *  - <OpenLayers.Format.XML>
+ *  - <OpenLayers.Control>
  */
  */
-OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
-    
-    /**
-     * Property: namespaces
-     * {Object} Mapping of namespace aliases to namespace URIs.
+OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, {
+
+    /** 
+     * APIProperty: slideFactor
+     * {Integer} Number of pixels by which we'll pan the map in any direction 
+     *     on clicking the arrow buttons.  If you want to pan by some ratio
+     *     of the map dimensions, use <slideRatio> instead.
      */
      */
-    namespaces: {
-        gml: "http://www.opengis.net/gml",
-        xlink: "http://www.w3.org/1999/xlink",
-        xsi: "http://www.w3.org/2001/XMLSchema-instance",
-        wfs: "http://www.opengis.net/wfs" // this is a convenience for reading wfs:FeatureCollection
-    },
-    
-    /**
-     * Property: defaultPrefix
+    slideFactor: 50,
+
+    /** 
+     * APIProperty: slideRatio
+     * {Number} The fraction of map width/height by which we'll pan the map            
+     *     on clicking the arrow buttons.  Default is null.  If set, will
+     *     override <slideFactor>. E.g. if slideRatio is .5, then the Pan Up
+     *     button will pan up half the map height. 
      */
      */
-    defaultPrefix: "gml",
+    slideRatio: null,
 
 
-    /**
-     * Property: schemaLocation
-     * {String} Schema location for a particular minor version.
+    /** 
+     * Property: buttons
+     * {Array(DOMElement)} Array of Button Divs 
      */
      */
-    schemaLocation: null,
-    
-    /**
-     * APIProperty: featureType
-     * {Array(String) or String} The local (without prefix) feature typeName(s).
+    buttons: null,
+
+    /** 
+     * Property: position
+     * {<OpenLayers.Pixel>} 
      */
      */
-    featureType: null,
-    
+    position: null,
+
     /**
     /**
-     * APIProperty: featureNS
-     * {String} The feature namespace.  Must be set in the options at
-     *     construction.
+     * Constructor: OpenLayers.Control.PanZoom
+     * 
+     * Parameters:
+     * options - {Object}
      */
      */
-    featureNS: null,
+    initialize: function(options) {
+        this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,
+                                             OpenLayers.Control.PanZoom.Y);
+        OpenLayers.Control.prototype.initialize.apply(this, arguments);
+    },
 
     /**
 
     /**
-     * APIProperty: geometry
-     * {String} Name of geometry element.  Defaults to "geometry". If null, it
-     * will be set on <read> when the first geometry is parsed.
+     * APIMethod: destroy
      */
      */
-    geometryName: "geometry",
+    destroy: function() {
+        if (this.map && !this.outsideViewport) {
+            this.map.events.unregister("buttonclick", this, this.onButtonClick);
+        }
+        this.removeButtons();
+        this.buttons = null;
+        this.position = null;
+        OpenLayers.Control.prototype.destroy.apply(this, arguments);
+    },
 
 
-    /**
-     * APIProperty: extractAttributes
-     * {Boolean} Extract attributes from GML.  Default is true.
+    /** 
+     * Method: setMap
+     *
+     * Properties:
+     * map - {<OpenLayers.Map>} 
      */
      */
-    extractAttributes: true,
-    
+    setMap: function(map) {
+        OpenLayers.Control.prototype.setMap.apply(this, arguments);
+        var target;
+        if (this.outsideViewport) {
+            this.events.attachToElement(this.div);
+            target = this;
+        } else {
+            target = this.map;
+        }
+        target.events.register('buttonclick', this, this.onButtonClick);
+    },
+
     /**
     /**
-     * APIProperty: srsName
-     * {String} URI for spatial reference system.  This is optional for
-     *     single part geometries and mandatory for collections and multis.
-     *     If set, the srsName attribute will be written for all geometries.
-     *     Default is null.
+     * Method: draw
+     *
+     * Parameters:
+     * px - {<OpenLayers.Pixel>} 
+     * 
+     * Returns:
+     * {DOMElement} A reference to the container div for the PanZoom control.
      */
      */
-    srsName: null,
+    draw: function(px) {
+        // initialize our internal div
+        OpenLayers.Control.prototype.draw.apply(this, arguments);
+        px = this.position;
 
 
-    /**
-     * APIProperty: xy
-     * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
-     * Changing is not recommended, a new Format should be instantiated.
-     */ 
-    xy: true,
+        // place the controls
+        this.buttons = [];
 
 
-    /**
-     * Property: geometryTypes
-     * {Object} Maps OpenLayers geometry class names to GML element names.
-     *     Use <setGeometryTypes> before accessing this property.
-     */
-    geometryTypes: null,
+        var sz = {w: 18, h: 18};
+        var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
 
 
+        this._addButton("panup", "north-mini.png", centered, sz);
+        px.y = centered.y+sz.h;
+        this._addButton("panleft", "west-mini.png", px, sz);
+        this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz);
+        this._addButton("pandown", "south-mini.png", 
+                        centered.add(0, sz.h*2), sz);
+        this._addButton("zoomin", "zoom-plus-mini.png", 
+                        centered.add(0, sz.h*3+5), sz);
+        this._addButton("zoomworld", "zoom-world-mini.png", 
+                        centered.add(0, sz.h*4+5), sz);
+        this._addButton("zoomout", "zoom-minus-mini.png", 
+                        centered.add(0, sz.h*5+5), sz);
+        return this.div;
+    },
+    
     /**
     /**
-     * Property: singleFeatureType
-     * {Boolean} True if there is only 1 featureType, and not an array
-     *     of featuretypes.
+     * Method: _addButton
+     * 
+     * Parameters:
+     * id - {String} 
+     * img - {String} 
+     * xy - {<OpenLayers.Pixel>} 
+     * sz - {<OpenLayers.Size>} 
+     * 
+     * Returns:
+     * {DOMElement} A Div (an alphaImageDiv, to be precise) that contains the
+     *     image of the button, and has all the proper event handlers set.
      */
      */
-    singleFeatureType: null,
+    _addButton:function(id, img, xy, sz) {
+        var imgLocation = OpenLayers.Util.getImageLocation(img);
+        var btn = OpenLayers.Util.createAlphaImageDiv(
+                                    this.id + "_" + id, 
+                                    xy, sz, imgLocation, "absolute");
+        btn.style.cursor = "pointer";
+        //we want to add the outer div
+        this.div.appendChild(btn);
+        btn.action = id;
+        btn.className = "olButton";
+    
+        //we want to remember/reference the outer div
+        this.buttons.push(btn);
+        return btn;
+    },
     
     /**
     
     /**
-     * Property: autoConfig
-     * {Boolean} Indicates if the format was configured without a <featureNS>,
-     * but auto-configured <featureNS> and <featureType> during read.
-     * Subclasses making use of <featureType> auto-configuration should make
-     * the first call to the <readNode> method (usually in the read method)
-     * with true as 3rd argument, so the auto-configured featureType can be
-     * reset and the format can be reused for subsequent reads with data from
-     * different featureTypes. Set to false after read if you want to keep the
-     * auto-configured values.
+     * Method: _removeButton
+     * 
+     * Parameters:
+     * btn - {Object}
      */
      */
-
+    _removeButton: function(btn) {
+        this.div.removeChild(btn);
+        OpenLayers.Util.removeItem(this.buttons, btn);
+    },
+    
     /**
     /**
-     * Property: regExes
-     * Compiled regular expressions for manipulating strings.
+     * Method: removeButtons
      */
      */
-    regExes: {
-        trimSpace: (/^\s*|\s*$/g),
-        removeSpace: (/\s*/g),
-        splitSpace: (/\s+/),
-        trimComma: (/\s*,\s*/g),
-        featureMember: (/^(.*:)?featureMembers?$/)
+    removeButtons: function() {
+        for(var i=this.buttons.length-1; i>=0; --i) {
+            this._removeButton(this.buttons[i]);
+        }
     },
     },
-
+    
     /**
     /**
-     * Constructor: OpenLayers.Format.GML.Base
-     * Instances of this class are not created directly.  Use the
-     *     <OpenLayers.Format.GML.v2> or <OpenLayers.Format.GML.v3> constructor
-     *     instead.
+     * Method: onButtonClick
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *     this instance.
-     *
-     * Valid options properties:
-     * featureType - {Array(String) or String} Local (without prefix) feature 
-     *     typeName(s) (required for write).
-     * featureNS - {String} Feature namespace (required for write).
-     * geometryName - {String} Geometry element name (required for write).
+     * evt - {Event}
      */
      */
-    initialize: function(options) {
-        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
-        this.setGeometryTypes();
-        if(options && options.featureNS) {
-            this.setNamespace("feature", options.featureNS);
+    onButtonClick: function(evt) {
+        var btn = evt.buttonElement;
+        switch (btn.action) {
+            case "panup": 
+                this.map.pan(0, -this.getSlideFactor("h"));
+                break;
+            case "pandown": 
+                this.map.pan(0, this.getSlideFactor("h"));
+                break;
+            case "panleft": 
+                this.map.pan(-this.getSlideFactor("w"), 0);
+                break;
+            case "panright": 
+                this.map.pan(this.getSlideFactor("w"), 0);
+                break;
+            case "zoomin": 
+                this.map.zoomIn(); 
+                break;
+            case "zoomout": 
+                this.map.zoomOut(); 
+                break;
+            case "zoomworld": 
+                this.map.zoomToMaxExtent(); 
+                break;
         }
         }
-        this.singleFeatureType = !options || (typeof options.featureType === "string");
     },
     
     /**
     },
     
     /**
-     * Method: read
+     * Method: getSlideFactor
      *
      * Parameters:
      *
      * Parameters:
-     * data - {DOMElement} A gml:featureMember element, a gml:featureMembers
-     *     element, or an element containing either of the above at any level.
+     * dim - {String} "w" or "h" (for width or height).
      *
      * Returns:
      *
      * Returns:
-     * {Array(<OpenLayers.Feature.Vector>)} An array of features.
+     * {Number} The slide factor for panning in the requested direction.
      */
      */
-    read: function(data) {
-        if(typeof data == "string") { 
-            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
-        }
-        if(data && data.nodeType == 9) {
-            data = data.documentElement;
-        }
-        var features = [];
-        this.readNode(data, {features: features}, true);
-        if(features.length == 0) {
-            // look for gml:featureMember elements
-            var elements = this.getElementsByTagNameNS(
-                data, this.namespaces.gml, "featureMember"
-            );
-            if(elements.length) {
-                for(var i=0, len=elements.length; i<len; ++i) {
-                    this.readNode(elements[i], {features: features}, true);
-                }
-            } else {
-                // look for gml:featureMembers elements (this is v3, but does no harm here)
-                var elements = this.getElementsByTagNameNS(
-                    data, this.namespaces.gml, "featureMembers"
-                );
-                if(elements.length) {
-                    // there can be only one
-                    this.readNode(elements[0], {features: features}, true);
-                }
-            }
-        }
-        return features;
+    getSlideFactor: function(dim) {
+        return this.slideRatio ?
+            this.map.getSize()[dim] * this.slideRatio :
+            this.slideFactor;
     },
     },
-    
+
+    CLASS_NAME: "OpenLayers.Control.PanZoom"
+});
+
+/**
+ * Constant: X
+ * {Integer}
+ */
+OpenLayers.Control.PanZoom.X = 4;
+
+/**
+ * Constant: Y
+ * {Integer}
+ */
+OpenLayers.Control.PanZoom.Y = 4;
+/* ======================================================================
+    OpenLayers/Handler/Pinch.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Handler.js
+ */
+
+/**
+ * Class: OpenLayers.Handler.Pinch
+ * The pinch handler is used to deal with sequences of browser events related
+ *     to pinch gestures. The handler is used by controls that want to know
+ *     when a pinch sequence begins, when a pinch is happening, and when it has
+ *     finished.
+ *
+ * Controls that use the pinch handler typically construct it with callbacks
+ *     for 'start', 'move', and 'done'.  Callbacks for these keys are
+ *     called when the pinch begins, with each change, and when the pinch is
+ *     done.
+ *
+ * Create a new pinch handler with the <OpenLayers.Handler.Pinch> constructor.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Handler>
+ */
+OpenLayers.Handler.Pinch = OpenLayers.Class(OpenLayers.Handler, {
+
     /**
     /**
-     * Method: readNode
-     * Shorthand for applying one of the named readers given the node
-     *     namespace and local name.  Readers take two args (node, obj) and
-     *     generally extend or modify the second.
+     * Property: started
+     * {Boolean} When a touchstart event is received, we want to record it,
+     *     but not set 'pinching' until the touchmove get started after
+     *     starting.
+     */
+    started: false,
+
+    /**
+     * Property: stopDown
+     * {Boolean} Stop propagation of touchstart events from getting to
+     *     listeners on the same element. Default is false.
+     */
+    stopDown: false,
+
+    /**
+     * Property: pinching
+     * {Boolean}
+     */
+    pinching: false,
+
+    /**
+     * Property: last
+     * {Object} Object that store informations related to pinch last touch.
+     */
+    last: null,
+
+    /**
+     * Property: start
+     * {Object} Object that store informations related to pinch touchstart.
+     */
+    start: null,
+
+    /**
+     * Constructor: OpenLayers.Handler.Pinch
+     * Returns OpenLayers.Handler.Pinch
      *
      * Parameters:
      *
      * Parameters:
-     * node - {DOMElement} The node to be read (required).
-     * obj - {Object} The object to be modified (optional).
-     * first - {Boolean} Should be set to true for the first node read. This
-     *     is usually the readNode call in the read method. Without this being
-     *     set, auto-configured properties will stick on subsequent reads.
+     * control - {<OpenLayers.Control>} The control that is making use of
+     *     this handler.  If a handler is being used without a control, the
+     *     handlers setMap method must be overridden to deal properly with
+     *     the map.
+     * callbacks - {Object} An object containing functions to be called when
+     *     the pinch operation start, change, or is finished. The callbacks
+     *     should expect to receive an object argument, which contains
+     *     information about scale, distance, and position of touch points.
+     * options - {Object}
+     */
+
+    /**
+     * Method: touchstart
+     * Handle touchstart events
+     *
+     * Parameters:
+     * evt - {Event}
      *
      * Returns:
      *
      * Returns:
-     * {Object} The input object, modified (or a new one if none was provided).
+     * {Boolean} Let the event propagate.
      */
      */
-    readNode: function(node, obj, first) {
-        // on subsequent calls of format.read(), we want to reset auto-
-        // configured properties and auto-configure again.
-        if (first === true && this.autoConfig === true) {
-            this.featureType = null;
-            delete this.namespaceAlias[this.featureNS];
-            delete this.namespaces["feature"];
-            this.featureNS = null;
-        }
-        // featureType auto-configuration
-        if (!this.featureNS && (!(node.prefix in this.namespaces) &&
-                node.parentNode.namespaceURI == this.namespaces["gml"] &&
-                this.regExes.featureMember.test(node.parentNode.nodeName))) {
-            this.featureType = node.nodeName.split(":").pop();
-            this.setNamespace("feature", node.namespaceURI);
-            this.featureNS = node.namespaceURI;
-            this.autoConfig = true;
+    touchstart: function(evt) {
+        var propagate = true;
+        this.pinching = false;
+        if (OpenLayers.Event.isMultiTouch(evt)) {
+            this.started = true;
+            this.last = this.start = {
+                distance: this.getDistance(evt.touches),
+                delta: 0,
+                scale: 1
+            };
+            this.callback("start", [evt, this.start]);
+            propagate = !this.stopDown;
+        } else if (this.started) {
+            // Some webkit versions send fake single-touch events during
+            // multitouch, which cause the drag handler to trigger
+            return false;
+        } else {
+            this.started = false;
+            this.start = null;
+            this.last = null;
         }
         }
-        return OpenLayers.Format.XML.prototype.readNode.apply(this, [node, obj]);
+        // prevent document dragging
+        OpenLayers.Event.preventDefault(evt);
+        return propagate;
     },
     },
-    
+
     /**
     /**
-     * Property: readers
-     * Contains public functions, grouped by namespace prefix, that will
-     *     be applied when a namespaced node is found matching the function
-     *     name.  The function will be applied in the scope of this parser
-     *     with two arguments: the node being read and a context object passed
-     *     from the parent.
+     * Method: touchmove
+     * Handle touchmove events
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Boolean} Let the event propagate.
      */
      */
-    readers: {
-        "gml": {
-            "_inherit": function(node, obj, container) {
-                // To be implemented by version specific parsers
-            },
-            "featureMember": function(node, obj) {
-                this.readChildNodes(node, obj);
-            },
-            "featureMembers": function(node, obj) {
-                this.readChildNodes(node, obj);                
-            },
-            "name": function(node, obj) {
-                obj.name = this.getChildValue(node);
-            },
-            "boundedBy": function(node, obj) {
-                var container = {};
-                this.readChildNodes(node, container);
-                if(container.components && container.components.length > 0) {
-                    obj.bounds = container.components[0];
-                }
-            },
-            "Point": function(node, container) {
-                var obj = {points: []};
-                this.readChildNodes(node, obj);
-                if(!container.components) {
-                    container.components = [];
-                }
-                container.components.push(obj.points[0]);
-            },
-            "coordinates": function(node, obj) {
-                var str = this.getChildValue(node).replace(
-                    this.regExes.trimSpace, ""
-                );
-                str = str.replace(this.regExes.trimComma, ",");
-                var pointList = str.split(this.regExes.splitSpace);
-                var coords;
-                var numPoints = pointList.length;
-                var points = new Array(numPoints);
-                for(var i=0; i<numPoints; ++i) {
-                    coords = pointList[i].split(",");
-                    if (this.xy) {
-                        points[i] = new OpenLayers.Geometry.Point(
-                            coords[0], coords[1], coords[2]
-                        );
-                    } else {
-                        points[i] = new OpenLayers.Geometry.Point(
-                            coords[1], coords[0], coords[2]
-                        );
-                    }
-                }
-                obj.points = points;
-            },
-            "coord": function(node, obj) {
-                var coord = {};
-                this.readChildNodes(node, coord);
-                if(!obj.points) {
-                    obj.points = [];
-                }
-                obj.points.push(new OpenLayers.Geometry.Point(
-                    coord.x, coord.y, coord.z
-                ));
-            },
-            "X": function(node, coord) {
-                coord.x = this.getChildValue(node);
-            },
-            "Y": function(node, coord) {
-                coord.y = this.getChildValue(node);
-            },
-            "Z": function(node, coord) {
-                coord.z = this.getChildValue(node);
-            },
-            "MultiPoint": function(node, container) {
-                var obj = {components: []};
-                this.readers.gml._inherit.apply(this, [node, obj, container]);
-                this.readChildNodes(node, obj);
-                container.components = [
-                    new OpenLayers.Geometry.MultiPoint(obj.components)
-                ];
-            },
-            "pointMember": function(node, obj) {
-                this.readChildNodes(node, obj);
-            },
-            "LineString": function(node, container) {
-                var obj = {};
-                this.readers.gml._inherit.apply(this, [node, obj, container]);
-                this.readChildNodes(node, obj);
-                if(!container.components) {
-                    container.components = [];
-                }
-                container.components.push(
-                    new OpenLayers.Geometry.LineString(obj.points)
-                );
-            },
-            "MultiLineString": function(node, container) {
-                var obj = {components: []};
-                this.readers.gml._inherit.apply(this, [node, obj, container]);
-                this.readChildNodes(node, obj);
-                container.components = [
-                    new OpenLayers.Geometry.MultiLineString(obj.components)
-                ];
-            },
-            "lineStringMember": function(node, obj) {
-                this.readChildNodes(node, obj);
-            },
-            "Polygon": function(node, container) {
-                var obj = {outer: null, inner: []};
-                this.readers.gml._inherit.apply(this, [node, obj, container]);
-                this.readChildNodes(node, obj);
-                obj.inner.unshift(obj.outer);
-                if(!container.components) {
-                    container.components = [];
-                }
-                container.components.push(
-                    new OpenLayers.Geometry.Polygon(obj.inner)
-                );
-            },
-            "LinearRing": function(node, obj) {
-                var container = {};
-                this.readers.gml._inherit.apply(this, [node, container]);
-                this.readChildNodes(node, container);
-                obj.components = [new OpenLayers.Geometry.LinearRing(
-                    container.points
-                )];
-            },
-            "MultiPolygon": function(node, container) {
-                var obj = {components: []};
-                this.readers.gml._inherit.apply(this, [node, obj, container]);
-                this.readChildNodes(node, obj);
-                container.components = [
-                    new OpenLayers.Geometry.MultiPolygon(obj.components)
-                ];
-            },
-            "polygonMember": function(node, obj) {
-                this.readChildNodes(node, obj);
-            },
-            "GeometryCollection": function(node, container) {
-                var obj = {components: []};
-                this.readers.gml._inherit.apply(this, [node, obj, container]);
-                this.readChildNodes(node, obj);
-                container.components = [
-                    new OpenLayers.Geometry.Collection(obj.components)
-                ];
-            },
-            "geometryMember": function(node, obj) {
-                this.readChildNodes(node, obj);
-            }
-        },
-        "feature": {
-            "*": function(node, obj) {
-                // The node can either be named like the featureType, or it
-                // can be a child of the feature:featureType.  Children can be
-                // geometry or attributes.
-                var name;
-                var local = node.localName || node.nodeName.split(":").pop();
-                // Since an attribute can have the same name as the feature type
-                // we only want to read the node as a feature if the parent
-                // node can have feature nodes as children.  In this case, the
-                // obj.features property is set.
-                if (obj.features) {
-                    if (!this.singleFeatureType &&
-                        (OpenLayers.Util.indexOf(this.featureType, local) !== -1)) {
-                        name = "_typeName";
-                    } else if(local === this.featureType) {
-                        name = "_typeName";
-                    }
-                } else {
-                    // Assume attribute elements have one child node and that the child
-                    // is a text node.  Otherwise assume it is a geometry node.
-                    if(node.childNodes.length == 0 ||
-                       (node.childNodes.length == 1 && node.firstChild.nodeType == 3)) {
-                        if(this.extractAttributes) {
-                            name = "_attribute";
-                        }
-                    } else {
-                        name = "_geometry";
-                    }
-                }
-                if(name) {
-                    this.readers.feature[name].apply(this, [node, obj]);
-                }
-            },
-            "_typeName": function(node, obj) {
-                var container = {components: [], attributes: {}};
-                this.readChildNodes(node, container);
-                // look for common gml namespaced elements
-                if(container.name) {
-                    container.attributes.name = container.name;
-                }
-                var feature = new OpenLayers.Feature.Vector(
-                    container.components[0], container.attributes
-                );
-                if (!this.singleFeatureType) {
-                    feature.type = node.nodeName.split(":").pop();
-                    feature.namespace = node.namespaceURI;
-                }
-                var fid = node.getAttribute("fid") ||
-                    this.getAttributeNS(node, this.namespaces["gml"], "id");
-                if(fid) {
-                    feature.fid = fid;
-                }
-                if(this.internalProjection && this.externalProjection &&
-                   feature.geometry) {
-                    feature.geometry.transform(
-                        this.externalProjection, this.internalProjection
-                    );
-                }
-                if(container.bounds) {
-                    feature.bounds = container.bounds;
-                }
-                obj.features.push(feature);
-            },
-            "_geometry": function(node, obj) {
-                if (!this.geometryName) {
-                    this.geometryName = node.nodeName.split(":").pop();
-                }
-                this.readChildNodes(node, obj);
-            },
-            "_attribute": function(node, obj) {
-                var local = node.localName || node.nodeName.split(":").pop();
-                var value = this.getChildValue(node);
-                obj.attributes[local] = value;
-            }
-        },
-        "wfs": {
-            "FeatureCollection": function(node, obj) {
-                this.readChildNodes(node, obj);
-            }
+    touchmove: function(evt) {
+        if (this.started && OpenLayers.Event.isMultiTouch(evt)) {
+            this.pinching = true;
+            var current = this.getPinchData(evt);
+            this.callback("move", [evt, current]);
+            this.last = current;
+            // prevent document dragging
+            OpenLayers.Event.stop(evt);
+        } else if (this.started) {
+            // Some webkit versions send fake single-touch events during
+            // multitouch, which cause the drag handler to trigger
+            return false;
         }
         }
+        return true;
     },
     },
-    
+
     /**
     /**
-     * Method: write
+     * Method: touchend
+     * Handle touchend events
      *
      * Parameters:
      *
      * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector}
-     *     An array of features or a single feature.
+     * evt - {Event}
      *
      * Returns:
      *
      * Returns:
-     * {String} Given an array of features, a doc with a gml:featureMembers
-     *     element will be returned.  Given a single feature, a doc with a
-     *     gml:featureMember element will be returned.
+     * {Boolean} Let the event propagate.
      */
      */
-    write: function(features) {
-        var name;
-        if(OpenLayers.Util.isArray(features)) {
-            name = "featureMembers";
-        } else {
-            name = "featureMember";
+    touchend: function(evt) {
+        if (this.started && !OpenLayers.Event.isMultiTouch(evt)) {
+            this.started = false;
+            this.pinching = false;
+            this.callback("done", [evt, this.start, this.last]);
+            this.start = null;
+            this.last = null;
+            return false;
         }
         }
-        var root = this.writeNode("gml:" + name, features);
-        this.setAttributeNS(
-            root, this.namespaces["xsi"],
-            "xsi:schemaLocation", this.schemaLocation
-        );
+        return true;
+    },
 
 
-        return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
+    /**
+     * Method: activate
+     * Activate the handler.
+     *
+     * Returns:
+     * {Boolean} The handler was successfully activated.
+     */
+    activate: function() {
+        var activated = false;
+        if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
+            this.pinching = false;
+            activated = true;
+        }
+        return activated;
     },
     },
-    
+
     /**
     /**
-     * Property: writers
-     * As a compliment to the readers property, this structure contains public
-     *     writing functions grouped by namespace alias and named like the
-     *     node names they produce.
+     * Method: deactivate
+     * Deactivate the handler.
+     *
+     * Returns:
+     * {Boolean} The handler was successfully deactivated.
      */
      */
-    writers: {
-        "gml": {
-            "featureMember": function(feature) {
-                var node = this.createElementNSPlus("gml:featureMember");
-                this.writeNode("feature:_typeName", feature, node);
-                return node;
-            },
-            "MultiPoint": function(geometry) {
-                var node = this.createElementNSPlus("gml:MultiPoint");
-                var components = geometry.components || [geometry];
-                for(var i=0, ii=components.length; i<ii; ++i) {
-                    this.writeNode("pointMember", components[i], node);
-                }
-                return node;
-            },
-            "pointMember": function(geometry) {
-                var node = this.createElementNSPlus("gml:pointMember");
-                this.writeNode("Point", geometry, node);
-                return node;
-            },
-            "MultiLineString": function(geometry) {
-                var node = this.createElementNSPlus("gml:MultiLineString");
-                var components = geometry.components || [geometry];
-                for(var i=0, ii=components.length; i<ii; ++i) {
-                    this.writeNode("lineStringMember", components[i], node);
-                }
-                return node;
-            },
-            "lineStringMember": function(geometry) {
-                var node = this.createElementNSPlus("gml:lineStringMember");
-                this.writeNode("LineString", geometry, node);
-                return node;
-            },
-            "MultiPolygon": function(geometry) {
-                var node = this.createElementNSPlus("gml:MultiPolygon");
-                var components = geometry.components || [geometry];
-                for(var i=0, ii=components.length; i<ii; ++i) {
-                    this.writeNode(
-                        "polygonMember", components[i], node
-                    );
-                }
-                return node;
-            },
-            "polygonMember": function(geometry) {
-                var node = this.createElementNSPlus("gml:polygonMember");
-                this.writeNode("Polygon", geometry, node);
-                return node;
-            },
-            "GeometryCollection": function(geometry) {
-                var node = this.createElementNSPlus("gml:GeometryCollection");
-                for(var i=0, len=geometry.components.length; i<len; ++i) {
-                    this.writeNode("geometryMember", geometry.components[i], node);
-                }
-                return node;
-            },
-            "geometryMember": function(geometry) {
-                var node = this.createElementNSPlus("gml:geometryMember");
-                var child = this.writeNode("feature:_geometry", geometry);
-                node.appendChild(child.firstChild);
-                return node;
-            }
-        },
-        "feature": {
-            "_typeName": function(feature) {
-                var node = this.createElementNSPlus("feature:" + this.featureType, {
-                    attributes: {fid: feature.fid}
-                });
-                if(feature.geometry) {
-                    this.writeNode("feature:_geometry", feature.geometry, node);
-                }
-                for(var name in feature.attributes) {
-                    var value = feature.attributes[name];
-                    if(value != null) {
-                        this.writeNode(
-                            "feature:_attribute",
-                            {name: name, value: value}, node
-                        );
+    deactivate: function() {
+        var deactivated = false;
+        if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+            this.started = false;
+            this.pinching = false;
+            this.start = null;
+            this.last = null;
+            deactivated = true;
+        }
+        return deactivated;
+    },
+
+    /**
+     * Method: getDistance
+     * Get the distance in pixels between two touches.
+     *
+     * Parameters:
+     * touches - {Array(Object)}
+     *
+     * Returns:
+     * {Number} The distance in pixels.
+     */
+    getDistance: function(touches) {
+        var t0 = touches[0];
+        var t1 = touches[1];
+        return Math.sqrt(
+            Math.pow(t0.olClientX - t1.olClientX, 2) +
+            Math.pow(t0.olClientY - t1.olClientY, 2)
+        );
+    },
+
+
+    /**
+     * Method: getPinchData
+     * Get informations about the pinch event.
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Object} Object that contains data about the current pinch.
+     */
+    getPinchData: function(evt) {
+        var distance = this.getDistance(evt.touches);
+        var scale = distance / this.start.distance;
+        return {
+            distance: distance,
+            delta: this.last.distance - distance,
+            scale: scale
+        };
+    },
+
+    CLASS_NAME: "OpenLayers.Handler.Pinch"
+});
+
+/* ======================================================================
+    OpenLayers/Control/PinchZoom.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Handler/Pinch.js
+ */
+
+/**
+ * Class: OpenLayers.Control.PinchZoom
+ *
+ * Inherits:
+ *  - <OpenLayers.Control>
+ */
+OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
+
+    /** 
+     * Property: type
+     * {OpenLayers.Control.TYPES}
+     */
+    type: OpenLayers.Control.TYPE_TOOL,
+
+    /**
+     * Property: pinchOrigin
+     * {Object} Cached object representing the pinch start (in pixels).
+     */
+    pinchOrigin: null,    
+    
+    /**
+     * Property: currentCenter
+     * {Object} Cached object representing the latest pinch center (in pixels).
+     */
+    currentCenter: null,    
+
+    /**
+     * APIProperty: autoActivate
+     * {Boolean} Activate the control when it is added to a map.  Default is
+     *     true.
+     */
+    autoActivate: true,
+
+    /**
+     * APIProperty: preserveCenter
+     * {Boolean} Set this to true if you don't want the map center to change
+     *     while pinching. For example you may want to set preserveCenter to
+     *     true when the user location is being watched and you want to preserve
+     *     the user location at the center of the map even if he zooms in or
+     *     out using pinch. This property's value can be changed any time on an
+     *     existing instance. Default is false.
+     */
+    preserveCenter: false,
+    
+    /**
+     * APIProperty: handlerOptions
+     * {Object} Used to set non-default properties on the pinch handler
+     */
+
+    /**
+     * Constructor: OpenLayers.Control.PinchZoom
+     * Create a control for zooming with pinch gestures.  This works on devices
+     *     with multi-touch support.
+     *
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *                    the control
+     */
+    initialize: function(options) {
+        OpenLayers.Control.prototype.initialize.apply(this, arguments);
+        this.handler = new OpenLayers.Handler.Pinch(this, {
+            start: this.pinchStart,
+            move: this.pinchMove,
+            done: this.pinchDone
+        }, this.handlerOptions);
+    },
+    
+    /**
+     * Method: pinchStart
+     *
+     * Parameters:
+     * evt - {Event}
+     * pinchData - {Object} pinch data object related to the current touchmove
+     *     of the pinch gesture. This give us the current scale of the pinch.
+     */
+    pinchStart: function(evt, pinchData) {
+        var xy = (this.preserveCenter) ?
+            this.map.getPixelFromLonLat(this.map.getCenter()) : evt.xy;
+        this.pinchOrigin = xy;
+        this.currentCenter = xy;
+    },
+    
+    /**
+     * Method: pinchMove
+     *
+     * Parameters:
+     * evt - {Event}
+     * pinchData - {Object} pinch data object related to the current touchmove
+     *     of the pinch gesture. This give us the current scale of the pinch.
+     */
+    pinchMove: function(evt, pinchData) {
+        var scale = pinchData.scale;
+        var containerOrigin = this.map.layerContainerOriginPx;
+        var pinchOrigin = this.pinchOrigin;
+        var current = (this.preserveCenter) ?
+            this.map.getPixelFromLonLat(this.map.getCenter()) : evt.xy;
+
+        var dx = Math.round((containerOrigin.x + current.x - pinchOrigin.x) + (scale - 1) * (containerOrigin.x - pinchOrigin.x));
+        var dy = Math.round((containerOrigin.y + current.y - pinchOrigin.y) + (scale - 1) * (containerOrigin.y - pinchOrigin.y));
+
+        this.map.applyTransform(dx, dy, scale);
+        this.currentCenter = current;
+    },
+
+    /**
+     * Method: pinchDone
+     *
+     * Parameters:
+     * evt - {Event}
+     * start - {Object} pinch data object related to the touchstart event that
+     *     started the pinch gesture.
+     * last - {Object} pinch data object related to the last touchmove event
+     *     of the pinch gesture. This give us the final scale of the pinch.
+     */
+    pinchDone: function(evt, start, last) {
+        this.map.applyTransform();
+        var zoom = this.map.getZoomForResolution(this.map.getResolution() / last.scale, true);
+        if (zoom !== this.map.getZoom() || !this.currentCenter.equals(this.pinchOrigin)) {
+            var resolution = this.map.getResolutionForZoom(zoom);
+
+            var location = this.map.getLonLatFromPixel(this.pinchOrigin);
+            var zoomPixel = this.currentCenter;        
+            var size = this.map.getSize();
+
+            location.lon += resolution * ((size.w / 2) - zoomPixel.x);
+            location.lat -= resolution * ((size.h / 2) - zoomPixel.y);
+
+            // Force a reflow before calling setCenter. This is to work
+            // around an issue occurring in iOS.
+            //
+            // See https://github.com/openlayers/ol2/pull/351.
+            //
+            // Without a reflow setting the layer container div's top left
+            // style properties to "0px" - as done in Map.moveTo when zoom
+            // is changed - won't actually correctly reposition the layer
+            // container div.
+            //
+            // Also, we need to use a statement that the Google Closure
+            // compiler won't optimize away.
+            this.map.div.clientWidth = this.map.div.clientWidth;
+
+            this.map.setCenter(location, zoom);
+        }
+    },
+
+    CLASS_NAME: "OpenLayers.Control.PinchZoom"
+
+});
+/* ======================================================================
+    OpenLayers/Control/TouchNavigation.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Control/DragPan.js
+ * @requires OpenLayers/Control/PinchZoom.js
+ * @requires OpenLayers/Handler/Click.js
+ */
+
+/**
+ * Class: OpenLayers.Control.TouchNavigation
+ * The navigation control handles map browsing with touch events (dragging,
+ *     double-tapping, tap with two fingers, and pinch zoom).  Create a new 
+ *     control with the <OpenLayers.Control.TouchNavigation> constructor.
+ *
+ * If you’re only targeting touch enabled devices with your mapping application,
+ *     you can create a map with only a TouchNavigation control. The 
+ *     <OpenLayers.Control.Navigation> control is mobile ready by default, but 
+ *     you can generate a smaller build of the library by only including this
+ *     touch navigation control if you aren't concerned about mouse interaction.
+ *
+ * Inherits:
+ *  - <OpenLayers.Control>
+ */
+OpenLayers.Control.TouchNavigation = OpenLayers.Class(OpenLayers.Control, {
+
+    /**
+     * Property: dragPan
+     * {<OpenLayers.Control.DragPan>}
+     */
+    dragPan: null,
+
+    /**
+     * APIProperty: dragPanOptions
+     * {Object} Options passed to the DragPan control.
+     */
+    dragPanOptions: null,
+
+    /**
+     * Property: pinchZoom
+     * {<OpenLayers.Control.PinchZoom>}
+     */
+    pinchZoom: null,
+
+    /**
+     * APIProperty: pinchZoomOptions
+     * {Object} Options passed to the PinchZoom control.
+     */
+    pinchZoomOptions: null,
+
+    /**
+     * APIProperty: clickHandlerOptions
+     * {Object} Options passed to the Click handler.
+     */
+    clickHandlerOptions: null,
+
+    /**
+     * APIProperty: documentDrag
+     * {Boolean} Allow panning of the map by dragging outside map viewport.
+     *     Default is false.
+     */
+    documentDrag: false,
+
+    /**
+     * APIProperty: autoActivate
+     * {Boolean} Activate the control when it is added to a map.  Default is
+     *     true.
+     */
+    autoActivate: true,
+
+    /**
+     * Constructor: OpenLayers.Control.TouchNavigation
+     * Create a new navigation control
+     *
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *                    the control
+     */
+    initialize: function(options) {
+        this.handlers = {};
+        OpenLayers.Control.prototype.initialize.apply(this, arguments);
+    },
+
+    /**
+     * Method: destroy
+     * The destroy method is used to perform any clean up before the control
+     * is dereferenced.  Typically this is where event listeners are removed
+     * to prevent memory leaks.
+     */
+    destroy: function() {
+        this.deactivate();
+        if(this.dragPan) {
+            this.dragPan.destroy();
+        }
+        this.dragPan = null;
+        if (this.pinchZoom) {
+            this.pinchZoom.destroy();
+            delete this.pinchZoom;
+        }
+        OpenLayers.Control.prototype.destroy.apply(this,arguments);
+    },
+
+    /**
+     * Method: activate
+     */
+    activate: function() {
+        if(OpenLayers.Control.prototype.activate.apply(this,arguments)) {
+            this.dragPan.activate();
+            this.handlers.click.activate();
+            this.pinchZoom.activate();
+            return true;
+        }
+        return false;
+    },
+
+    /**
+     * Method: deactivate
+     */
+    deactivate: function() {
+        if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)) {
+            this.dragPan.deactivate();
+            this.handlers.click.deactivate();
+            this.pinchZoom.deactivate();
+            return true;
+        }
+        return false;
+    },
+    
+    /**
+     * Method: draw
+     */
+    draw: function() {
+        var clickCallbacks = {
+            click: this.defaultClick,
+            dblclick: this.defaultDblClick
+        };
+        var clickOptions = OpenLayers.Util.extend({
+            "double": true,
+            stopDouble: true,
+            pixelTolerance: 2
+        }, this.clickHandlerOptions);
+        this.handlers.click = new OpenLayers.Handler.Click(
+            this, clickCallbacks, clickOptions
+        );
+        this.dragPan = new OpenLayers.Control.DragPan(
+            OpenLayers.Util.extend({
+                map: this.map,
+                documentDrag: this.documentDrag
+            }, this.dragPanOptions)
+        );
+        this.dragPan.draw();
+        this.pinchZoom = new OpenLayers.Control.PinchZoom(
+            OpenLayers.Util.extend({map: this.map}, this.pinchZoomOptions)
+        );
+    },
+
+    /**
+     * Method: defaultClick
+     *
+     * Parameters:
+     * evt - {Event}
+     */
+    defaultClick: function (evt) {
+        if(evt.lastTouches && evt.lastTouches.length == 2) {
+            this.map.zoomOut();
+        }
+    },
+
+    /**
+     * Method: defaultDblClick
+     *
+     * Parameters:
+     * evt - {Event}
+     */
+    defaultDblClick: function (evt) {
+        this.map.zoomTo(this.map.zoom + 1, evt.xy);
+    },
+
+    CLASS_NAME: "OpenLayers.Control.TouchNavigation"
+});
+/* ======================================================================
+    OpenLayers/Control/Attribution.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Control.js
+ */
+
+/**
+ * Class: OpenLayers.Control.Attribution
+ * The attribution control adds attribution from layers to the map display. 
+ * It uses 'attribution' property of each layer.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Control>
+ */
+OpenLayers.Control.Attribution = 
+  OpenLayers.Class(OpenLayers.Control, {
+    
+    /**
+     * APIProperty: separator
+     * {String} String used to separate layers.
+     */
+    separator: ", ",
+
+    /**
+     * APIProperty: template
+     * {String} Template for the global attribution markup. This has to include the
+     *     substring "${layers}", which will be replaced by the layer specific
+     *     attributions, separated by <separator>. The default is "${layers}".
+     */
+    template: "${layers}",
+
+    /**
+     * APIProperty: layerTemplate
+     * {String} Template for the layer specific attribution. This has to include
+     *     the substrings "${href}" and "${title}", which will be replaced by
+     *     the layer specific attribution object properties.
+     *     The default is '<a href="${href}" target="_blank">${title}</a>'.
+     */
+    layerTemplate: '<a href="${href}" target="_blank">${title}</a>',
+
+    /**
+     * Constructor: OpenLayers.Control.Attribution 
+     * 
+     * Parameters:
+     * options - {Object} Options for control.
+     */
+
+    /** 
+     * Method: destroy
+     * Destroy control.
+     */
+    destroy: function() {
+        this.map.events.un({
+            "removelayer": this.updateAttribution,
+            "addlayer": this.updateAttribution,
+            "changelayer": this.updateAttribution,
+            "changebaselayer": this.updateAttribution,
+            scope: this
+        });
+        
+        OpenLayers.Control.prototype.destroy.apply(this, arguments);
+    },    
+    
+    /**
+     * Method: draw
+     * Initialize control.
+     * 
+     * Returns: 
+     * {DOMElement} A reference to the DIV DOMElement containing the control
+     */    
+    draw: function() {
+        OpenLayers.Control.prototype.draw.apply(this, arguments);
+        
+        this.map.events.on({
+            'changebaselayer': this.updateAttribution,
+            'changelayer': this.updateAttribution,
+            'addlayer': this.updateAttribution,
+            'removelayer': this.updateAttribution,
+            scope: this
+        });
+        this.updateAttribution();
+        
+        return this.div;    
+    },
+
+    /**
+     * Method: updateAttribution
+     * Update attribution string.
+     */
+    updateAttribution: function() {
+        var attributions = [], attribution;
+        if (this.map && this.map.layers) {
+            for(var i=0, len=this.map.layers.length; i<len; i++) {
+                var layer = this.map.layers[i];
+                if (layer.attribution && layer.getVisibility()) {
+                    attribution = (typeof layer.attribution == "object") ?
+                        OpenLayers.String.format(
+                            this.layerTemplate, layer.attribution) :
+                        layer.attribution;
+                    // add attribution only if attribution text is unique
+                    if (OpenLayers.Util.indexOf(
+                                    attributions, attribution) === -1) {
+                        attributions.push( attribution );
                     }
                 }
                     }
                 }
-                return node;
-            },
-            "_geometry": function(geometry) {
-                if(this.externalProjection && this.internalProjection) {
-                    geometry = geometry.clone().transform(
-                        this.internalProjection, this.externalProjection
-                    );
-                }    
-                var node = this.createElementNSPlus(
-                    "feature:" + this.geometryName
-                );
-                var type = this.geometryTypes[geometry.CLASS_NAME];
-                var child = this.writeNode("gml:" + type, geometry, node);
-                if(this.srsName) {
-                    child.setAttribute("srsName", this.srsName);
-                }
-                return node;
-            },
-            "_attribute": function(obj) {
-                return this.createElementNSPlus("feature:" + obj.name, {
-                    value: obj.value
-                });
-            }
-        },
-        "wfs": {
-            "FeatureCollection": function(features) {
-                /**
-                 * This is only here because GML2 only describes abstract
-                 * feature collections.  Typically, you would not be using
-                 * the GML format to write wfs elements.  This just provides
-                 * some way to write out lists of features.  GML3 defines the
-                 * featureMembers element, so that is used by default instead.
-                 */
-                var node = this.createElementNSPlus("wfs:FeatureCollection");
-                for(var i=0, len=features.length; i<len; ++i) {
-                    this.writeNode("gml:featureMember", features[i], node);
-                }
-                return node;
-            }
+            } 
+            this.div.innerHTML = OpenLayers.String.format(this.template, {
+                layers: attributions.join(this.separator)
+            });
+        }
+    },
+
+    CLASS_NAME: "OpenLayers.Control.Attribution"
+});
+/* ======================================================================
+    OpenLayers/Control/Zoom.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Control.js
+ * @requires OpenLayers/Events/buttonclick.js
+ */
+
+/**
+ * Class: OpenLayers.Control.Zoom
+ * The Zoom control is a pair of +/- links for zooming in and out.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Control>
+ */
+OpenLayers.Control.Zoom = OpenLayers.Class(OpenLayers.Control, {
+    
+    /**
+     * APIProperty: zoomInText
+     * {String}
+     * Text for zoom-in link.  Default is "+".
+     */
+    zoomInText: "+",
+
+    /**
+     * APIProperty: zoomInId
+     * {String}
+     * Instead of having the control create a zoom in link, you can provide 
+     *     the identifier for an anchor element already added to the document.
+     *     By default, an element with id "olZoomInLink" will be searched for
+     *     and used if it exists.
+     */
+    zoomInId: "olZoomInLink",
+
+    /**
+     * APIProperty: zoomOutText
+     * {String}
+     * Text for zoom-out link.  Default is "\u2212".
+     */
+    zoomOutText: "\u2212",
+
+    /**
+     * APIProperty: zoomOutId
+     * {String}
+     * Instead of having the control create a zoom out link, you can provide 
+     *     the identifier for an anchor element already added to the document.
+     *     By default, an element with id "olZoomOutLink" will be searched for
+     *     and used if it exists.
+     */
+    zoomOutId: "olZoomOutLink",
+
+    /**
+     * Method: draw
+     *
+     * Returns:
+     * {DOMElement} A reference to the DOMElement containing the zoom links.
+     */
+    draw: function() {
+        var div = OpenLayers.Control.prototype.draw.apply(this),
+            links = this.getOrCreateLinks(div),
+            zoomIn = links.zoomIn,
+            zoomOut = links.zoomOut,
+            eventsInstance = this.map.events;
+        
+        if (zoomOut.parentNode !== div) {
+            eventsInstance = this.events;
+            eventsInstance.attachToElement(zoomOut.parentNode);
+        }
+        eventsInstance.register("buttonclick", this, this.onZoomClick);
+        
+        this.zoomInLink = zoomIn;
+        this.zoomOutLink = zoomOut;
+        return div;
+    },
+    
+    /**
+     * Method: getOrCreateLinks
+     * 
+     * Parameters:
+     * el - {DOMElement}
+     *
+     * Return: 
+     * {Object} Object with zoomIn and zoomOut properties referencing links.
+     */
+    getOrCreateLinks: function(el) {
+        var zoomIn = document.getElementById(this.zoomInId),
+            zoomOut = document.getElementById(this.zoomOutId);
+        if (!zoomIn) {
+            zoomIn = document.createElement("a");
+            zoomIn.href = "#zoomIn";
+            zoomIn.appendChild(document.createTextNode(this.zoomInText));
+            zoomIn.className = "olControlZoomIn";
+            el.appendChild(zoomIn);
+        }
+        OpenLayers.Element.addClass(zoomIn, "olButton");
+        if (!zoomOut) {
+            zoomOut = document.createElement("a");
+            zoomOut.href = "#zoomOut";
+            zoomOut.appendChild(document.createTextNode(this.zoomOutText));
+            zoomOut.className = "olControlZoomOut";
+            el.appendChild(zoomOut);
+        }
+        OpenLayers.Element.addClass(zoomOut, "olButton");
+        return {
+            zoomIn: zoomIn, zoomOut: zoomOut
+        };
+    },
+    
+    /**
+     * Method: onZoomClick
+     * Called when zoomin/out link is clicked.
+     */
+    onZoomClick: function(evt) {
+        var button = evt.buttonElement;
+        if (button === this.zoomInLink) {
+            this.map.zoomIn();
+        } else if (button === this.zoomOutLink) {
+            this.map.zoomOut();
+        }
+    },
+
+    /** 
+     * Method: destroy
+     * Clean up.
+     */
+    destroy: function() {
+        if (this.map) {
+            this.map.events.unregister("buttonclick", this, this.onZoomClick);
+        }
+        delete this.zoomInLink;
+        delete this.zoomOutLink;
+        OpenLayers.Control.prototype.destroy.apply(this);
+    },
+
+    CLASS_NAME: "OpenLayers.Control.Zoom"
+});
+/* ======================================================================
+    OpenLayers/Handler/Feature.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+
+/**
+ * @requires OpenLayers/Handler.js
+ */
+
+/**
+ * Class: OpenLayers.Handler.Feature 
+ * Handler to respond to mouse events related to a drawn feature.  Callbacks
+ *     with the following keys will be notified of the following events
+ *     associated with features: click, clickout, over, out, and dblclick.
+ *
+ * This handler stops event propagation for mousedown and mouseup if those
+ *     browser events target features that can be selected.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Handler>
+ */
+OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
+
+    /**
+     * Property: EVENTMAP
+     * {Object} A object mapping the browser events to objects with callback
+     *     keys for in and out.
+     */
+    EVENTMAP: {
+        'click': {'in': 'click', 'out': 'clickout'},
+        'mousemove': {'in': 'over', 'out': 'out'},
+        'dblclick': {'in': 'dblclick', 'out': null},
+        'mousedown': {'in': null, 'out': null},
+        'mouseup': {'in': null, 'out': null},
+        'touchstart': {'in': 'click', 'out': 'clickout'}
+    },
+
+    /**
+     * Property: feature
+     * {<OpenLayers.Feature.Vector>} The last feature that was hovered.
+     */
+    feature: null,
+
+    /**
+     * Property: lastFeature
+     * {<OpenLayers.Feature.Vector>} The last feature that was handled.
+     */
+    lastFeature: null,
+
+    /**
+     * Property: down
+     * {<OpenLayers.Pixel>} The location of the last mousedown.
+     */
+    down: null,
+
+    /**
+     * Property: up
+     * {<OpenLayers.Pixel>} The location of the last mouseup.
+     */
+    up: null,
+    
+    /**
+     * Property: clickTolerance
+     * {Number} The number of pixels the mouse can move between mousedown
+     *     and mouseup for the event to still be considered a click.
+     *     Dragging the map should not trigger the click and clickout callbacks
+     *     unless the map is moved by less than this tolerance. Defaults to 4.
+     */
+    clickTolerance: 4,
+
+    /**
+     * Property: geometryTypes
+     * To restrict dragging to a limited set of geometry types, send a list
+     * of strings corresponding to the geometry class names.
+     * 
+     * @type Array(String)
+     */
+    geometryTypes: null,
+
+    /**
+     * Property: stopClick
+     * {Boolean} If stopClick is set to true, handled clicks do not
+     *      propagate to other click listeners. Otherwise, handled clicks
+     *      do propagate. Unhandled clicks always propagate, whatever the
+     *      value of stopClick. Defaults to true.
+     */
+    stopClick: true,
+
+    /**
+     * Property: stopDown
+     * {Boolean} If stopDown is set to true, handled mousedowns do not
+     *      propagate to other mousedown listeners. Otherwise, handled
+     *      mousedowns do propagate. Unhandled mousedowns always propagate,
+     *      whatever the value of stopDown. Defaults to true.
+     */
+    stopDown: true,
+
+    /**
+     * Property: stopUp
+     * {Boolean} If stopUp is set to true, handled mouseups do not
+     *      propagate to other mouseup listeners. Otherwise, handled mouseups
+     *      do propagate. Unhandled mouseups always propagate, whatever the
+     *      value of stopUp. Defaults to false.
+     */
+    stopUp: false,
+    
+    /**
+     * Constructor: OpenLayers.Handler.Feature
+     *
+     * Parameters:
+     * control - {<OpenLayers.Control>} 
+     * layer - {<OpenLayers.Layer.Vector>}
+     * callbacks - {Object} An object with a 'over' property whos value is
+     *     a function to be called when the mouse is over a feature. The 
+     *     callback should expect to receive a single argument, the feature.
+     * options - {Object} 
+     */
+    initialize: function(control, layer, callbacks, options) {
+        OpenLayers.Handler.prototype.initialize.apply(this, [control, callbacks, options]);
+        this.layer = layer;
+    },
+
+    /**
+     * Method: touchstart
+     * Handle touchstart events
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Boolean} Let the event propagate.
+     */
+    touchstart: function(evt) {
+        this.startTouch(); 
+        return OpenLayers.Event.isMultiTouch(evt) ?
+                true : this.mousedown(evt);
+    },
+
+    /**
+     * Method: touchmove
+     * Handle touchmove events. We just prevent the browser default behavior,
+     *    for Android Webkit not to select text when moving the finger after
+     *    selecting a feature.
+     *
+     * Parameters:
+     * evt - {Event}
+     */
+    touchmove: function(evt) {
+        OpenLayers.Event.preventDefault(evt);
+    },
+
+    /**
+     * Method: mousedown
+     * Handle mouse down.  Stop propagation if a feature is targeted by this
+     *     event (stops map dragging during feature selection).
+     * 
+     * Parameters:
+     * evt - {Event} 
+     */
+    mousedown: function(evt) {
+        // Feature selection is only done with a left click. Other handlers may stop the
+        // propagation of left-click mousedown events but not right-click mousedown events.
+        // This mismatch causes problems when comparing the location of the down and up
+        // events in the click function so it is important ignore right-clicks.
+        if (OpenLayers.Event.isLeftClick(evt) || OpenLayers.Event.isSingleTouch(evt)) {
+            this.down = evt.xy;
         }
         }
+        return this.handle(evt) ? !this.stopDown : true;
     },
     
     /**
     },
     
     /**
-     * Method: setGeometryTypes
-     * Sets the <geometryTypes> mapping.
+     * Method: mouseup
+     * Handle mouse up.  Stop propagation if a feature is targeted by this
+     *     event.
+     * 
+     * Parameters:
+     * evt - {Event} 
      */
      */
-    setGeometryTypes: function() {
-        this.geometryTypes = {
-            "OpenLayers.Geometry.Point": "Point",
-            "OpenLayers.Geometry.MultiPoint": "MultiPoint",
-            "OpenLayers.Geometry.LineString": "LineString",
-            "OpenLayers.Geometry.MultiLineString": "MultiLineString",
-            "OpenLayers.Geometry.Polygon": "Polygon",
-            "OpenLayers.Geometry.MultiPolygon": "MultiPolygon",
-            "OpenLayers.Geometry.Collection": "GeometryCollection"
-        };
+    mouseup: function(evt) {
+        this.up = evt.xy;
+        return this.handle(evt) ? !this.stopUp : true;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Format.GML.Base" 
-
-});
-/* ======================================================================
-    OpenLayers/Format/GML/v2.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Format/GML/Base.js
- */
-
-/**
- * Class: OpenLayers.Format.GML.v2
- * Parses GML version 2.
- *
- * Inherits from:
- *  - <OpenLayers.Format.GML.Base>
- */
-OpenLayers.Format.GML.v2 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
-    
     /**
     /**
-     * Property: schemaLocation
-     * {String} Schema location for a particular minor version.
+     * Method: click
+     * Handle click.  Call the "click" callback if click on a feature,
+     *     or the "clickout" callback if click outside any feature.
+     * 
+     * Parameters:
+     * evt - {Event} 
+     *
+     * Returns:
+     * {Boolean}
      */
      */
-    schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",
-
+    click: function(evt) {
+        return this.handle(evt) ? !this.stopClick : true;
+    },
+        
     /**
     /**
-     * Constructor: OpenLayers.Format.GML.v2
-     * Create a parser for GML v2.
-     *
+     * Method: mousemove
+     * Handle mouse moves.  Call the "over" callback if moving in to a feature,
+     *     or the "out" callback if moving out of a feature.
+     * 
      * Parameters:
      * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *     this instance.
+     * evt - {Event} 
      *
      *
-     * Valid options properties:
-     * featureType - {String} Local (without prefix) feature typeName (required).
-     * featureNS - {String} Feature namespace (required).
-     * geometryName - {String} Geometry element name.
+     * Returns:
+     * {Boolean}
      */
      */
-    initialize: function(options) {
-        OpenLayers.Format.GML.Base.prototype.initialize.apply(this, [options]);
+    mousemove: function(evt) {
+        if (!this.callbacks['over'] && !this.callbacks['out']) {
+            return true;
+        }     
+        this.handle(evt);
+        return true;
     },
     },
-
+    
     /**
     /**
-     * Property: readers
-     * Contains public functions, grouped by namespace prefix, that will
-     *     be applied when a namespaced node is found matching the function
-     *     name.  The function will be applied in the scope of this parser
-     *     with two arguments: the node being read and a context object passed
-     *     from the parent.
+     * Method: dblclick
+     * Handle dblclick.  Call the "dblclick" callback if dblclick on a feature.
+     *
+     * Parameters:
+     * evt - {Event} 
+     *
+     * Returns:
+     * {Boolean}
      */
      */
-    readers: {
-        "gml": OpenLayers.Util.applyDefaults({
-            "outerBoundaryIs": function(node, container) {
-                var obj = {};
-                this.readChildNodes(node, obj);
-                container.outer = obj.components[0];
-            },
-            "innerBoundaryIs": function(node, container) {
-                var obj = {};
-                this.readChildNodes(node, obj);
-                container.inner.push(obj.components[0]);
-            },
-            "Box": function(node, container) {
-                var obj = {};
-                this.readChildNodes(node, obj);
-                if(!container.components) {
-                    container.components = [];
-                }
-                var min = obj.points[0];
-                var max = obj.points[1];
-                container.components.push(
-                    new OpenLayers.Bounds(min.x, min.y, max.x, max.y)
-                );
-            }
-        }, OpenLayers.Format.GML.Base.prototype.readers["gml"]),
-        "feature": OpenLayers.Format.GML.Base.prototype.readers["feature"],
-        "wfs": OpenLayers.Format.GML.Base.prototype.readers["wfs"]
+    dblclick: function(evt) {
+        return !this.handle(evt);
     },
 
     /**
     },
 
     /**
-     * Method: write
+     * Method: geometryTypeMatches
+     * Return true if the geometry type of the passed feature matches
+     *     one of the geometry types in the geometryTypes array.
      *
      * Parameters:
      *
      * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector}
-     *     An array of features or a single feature.
+     * feature - {<OpenLayers.Vector.Feature>}
      *
      * Returns:
      *
      * Returns:
-     * {String} Given an array of features, a doc with a gml:featureMembers
-     *     element will be returned.  Given a single feature, a doc with a
-     *     gml:featureMember element will be returned.
+     * {Boolean}
      */
      */
-    write: function(features) {
-        var name;
-        if(OpenLayers.Util.isArray(features)) {
-            // GML2 only has abstract feature collections
-            // wfs provides a feature collection from a well-known schema
-            name = "wfs:FeatureCollection";
-        } else {
-            name = "gml:featureMember";
-        }
-        var root = this.writeNode(name, features);
-        this.setAttributeNS(
-            root, this.namespaces["xsi"],
-            "xsi:schemaLocation", this.schemaLocation
-        );
-
-        return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
+    geometryTypeMatches: function(feature) {
+        return this.geometryTypes == null ||
+            OpenLayers.Util.indexOf(this.geometryTypes,
+                                    feature.geometry.CLASS_NAME) > -1;
     },
 
     /**
     },
 
     /**
-     * Property: writers
-     * As a compliment to the readers property, this structure contains public
-     *     writing functions grouped by namespace alias and named like the
-     *     node names they produce.
+     * Method: handle
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Boolean} The event occurred over a relevant feature.
      */
      */
-    writers: {
-        "gml": OpenLayers.Util.applyDefaults({
-            "Point": function(geometry) {
-                var node = this.createElementNSPlus("gml:Point");
-                this.writeNode("coordinates", [geometry], node);
-                return node;
-            },
-            "coordinates": function(points) {
-                var numPoints = points.length;
-                var parts = new Array(numPoints);
-                var point;
-                for(var i=0; i<numPoints; ++i) {
-                    point = points[i];
-                    if(this.xy) {
-                        parts[i] = point.x + "," + point.y;
-                    } else {
-                        parts[i] = point.y + "," + point.x;
-                    }
-                    if(point.z != undefined) { // allow null or undefined
-                        parts[i] += "," + point.z;
+    handle: function(evt) {
+        if(this.feature && !this.feature.layer) {
+            // feature has been destroyed
+            this.feature = null;
+        }
+        var type = evt.type;
+        var handled = false;
+        var previouslyIn = !!(this.feature); // previously in a feature
+        var click = (type == "click" || type == "dblclick" || type == "touchstart");
+        this.feature = this.layer.getFeatureFromEvent(evt);
+        if(this.feature && !this.feature.layer) {
+            // feature has been destroyed
+            this.feature = null;
+        }
+        if(this.lastFeature && !this.lastFeature.layer) {
+            // last feature has been destroyed
+            this.lastFeature = null;
+        }
+        if(this.feature) {
+            if(type === "touchstart") {
+                // stop the event to prevent Android Webkit from
+                // "flashing" the map div
+                OpenLayers.Event.preventDefault(evt);
+            }
+            var inNew = (this.feature != this.lastFeature);
+            if(this.geometryTypeMatches(this.feature)) {
+                // in to a feature
+                if(previouslyIn && inNew) {
+                    // out of last feature and in to another
+                    if(this.lastFeature) {
+                        this.triggerCallback(type, 'out', [this.lastFeature]);
                     }
                     }
+                    this.triggerCallback(type, 'in', [this.feature]);
+                } else if(!previouslyIn || click) {
+                    // in feature for the first time
+                    this.triggerCallback(type, 'in', [this.feature]);
                 }
                 }
-                return this.createElementNSPlus("gml:coordinates", {
-                    attributes: {
-                        decimal: ".", cs: ",", ts: " "
-                    },
-                    value: (numPoints == 1) ? parts[0] : parts.join(" ")
-                });
-            },
-            "LineString": function(geometry) {
-                var node = this.createElementNSPlus("gml:LineString");
-                this.writeNode("coordinates", geometry.components, node);
-                return node;
-            },
-            "Polygon": function(geometry) {
-                var node = this.createElementNSPlus("gml:Polygon");
-                this.writeNode("outerBoundaryIs", geometry.components[0], node);
-                for(var i=1; i<geometry.components.length; ++i) {
-                    this.writeNode(
-                        "innerBoundaryIs", geometry.components[i], node
-                    );
+                this.lastFeature = this.feature;
+                handled = true;
+            } else {
+                // not in to a feature
+                if(this.lastFeature && (previouslyIn && inNew || click)) {
+                    // out of last feature for the first time
+                    this.triggerCallback(type, 'out', [this.lastFeature]);
                 }
                 }
-                return node;
-            },
-            "outerBoundaryIs": function(ring) {
-                var node = this.createElementNSPlus("gml:outerBoundaryIs");
-                this.writeNode("LinearRing", ring, node);
-                return node;
-            },
-            "innerBoundaryIs": function(ring) {
-                var node = this.createElementNSPlus("gml:innerBoundaryIs");
-                this.writeNode("LinearRing", ring, node);
-                return node;
-            },
-            "LinearRing": function(ring) {
-                var node = this.createElementNSPlus("gml:LinearRing");
-                this.writeNode("coordinates", ring.components, node);
-                return node;
-            },
-            "Box": function(bounds) {
-                var node = this.createElementNSPlus("gml:Box");
-                this.writeNode("coordinates", [
-                    {x: bounds.left, y: bounds.bottom},
-                    {x: bounds.right, y: bounds.top}
-                ], node);
-                // srsName attribute is optional for gml:Box
-                if(this.srsName) {
-                    node.setAttribute("srsName", this.srsName);
+                // next time the mouse goes in a feature whose geometry type
+                // doesn't match we don't want to call the 'out' callback
+                // again, so let's set this.feature to null so that
+                // previouslyIn will evaluate to false the next time
+                // we enter handle. Yes, a bit hackish...
+                this.feature = null;
+            }
+        } else if(this.lastFeature && (previouslyIn || click)) {
+            this.triggerCallback(type, 'out', [this.lastFeature]);
+        }
+        return handled;
+    },
+    
+    /**
+     * Method: triggerCallback
+     * Call the callback keyed in the event map with the supplied arguments.
+     *     For click and clickout, the <clickTolerance> is checked first.
+     *
+     * Parameters:
+     * type - {String}
+     */
+    triggerCallback: function(type, mode, args) {
+        var key = this.EVENTMAP[type][mode];
+        if(key) {
+            if(type == 'click' && this.up && this.down) {
+                // for click/clickout, only trigger callback if tolerance is met
+                var dpx = Math.sqrt(
+                    Math.pow(this.up.x - this.down.x, 2) +
+                    Math.pow(this.up.y - this.down.y, 2)
+                );
+                if(dpx <= this.clickTolerance) {
+                    this.callback(key, args);
                 }
                 }
-                return node;
+                // we're done with this set of events now: clear the cached
+                // positions so we can't trip over them later (this can occur
+                // if one of the up/down events gets eaten before it gets to us
+                // but we still get the click)
+                this.up = this.down = null;
+            } else {
+                this.callback(key, args);
             }
             }
-        }, OpenLayers.Format.GML.Base.prototype.writers["gml"]),
-        "feature": OpenLayers.Format.GML.Base.prototype.writers["feature"],
-        "wfs": OpenLayers.Format.GML.Base.prototype.writers["wfs"]
+        }
+    },
+
+    /**
+     * Method: activate 
+     * Turn on the handler.  Returns false if the handler was already active.
+     *
+     * Returns:
+     * {Boolean}
+     */
+    activate: function() {
+        var activated = false;
+        if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
+            this.moveLayerToTop();
+            this.map.events.on({
+                "removelayer": this.handleMapEvents,
+                "changelayer": this.handleMapEvents,
+                scope: this
+            });
+            activated = true;
+        }
+        return activated;
     },
     
     },
     
-    CLASS_NAME: "OpenLayers.Format.GML.v2" 
+    /**
+     * Method: deactivate 
+     * Turn off the handler.  Returns false if the handler was already active.
+     *
+     * Returns: 
+     * {Boolean}
+     */
+    deactivate: function() {
+        var deactivated = false;
+        if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+            this.moveLayerBack();
+            this.feature = null;
+            this.lastFeature = null;
+            this.down = null;
+            this.up = null;
+            this.map.events.un({
+                "removelayer": this.handleMapEvents,
+                "changelayer": this.handleMapEvents,
+                scope: this
+            });
+            deactivated = true;
+        }
+        return deactivated;
+    },
+    
+    /**
+     * Method: handleMapEvents
+     * 
+     * Parameters:
+     * evt - {Object}
+     */
+    handleMapEvents: function(evt) {
+        if (evt.type == "removelayer" || evt.property == "order") {
+            this.moveLayerToTop();
+        }
+    },
+    
+    /**
+     * Method: moveLayerToTop
+     * Moves the layer for this handler to the top, so mouse events can reach
+     * it.
+     */
+    moveLayerToTop: function() {
+        var index = Math.max(this.map.Z_INDEX_BASE['Feature'] - 1,
+            this.layer.getZIndex()) + 1;
+        this.layer.setZIndex(index);
+        
+    },
+    
+    /**
+     * Method: moveLayerBack
+     * Moves the layer back to the position determined by the map's layers
+     * array.
+     */
+    moveLayerBack: function() {
+        var index = this.layer.getZIndex() - 1;
+        if (index >= this.map.Z_INDEX_BASE['Feature']) {
+            this.layer.setZIndex(index);
+        } else {
+            this.map.setLayerZIndex(this.layer,
+                this.map.getLayerIndex(this.layer));
+        }
+    },
 
 
+    CLASS_NAME: "OpenLayers.Handler.Feature"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Filter/Function.js
+    OpenLayers/Layer.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
+
 /**
 /**
- * @requires OpenLayers/Filter.js
+ * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Map.js
+ * @requires OpenLayers/Projection.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Filter.Function
- * This class represents a filter function.
- * We are using this class for creation of complex 
- * filters that can contain filter functions as values.
- * Nesting function as other functions parameter is supported.
- * 
- * Inherits from:
- * - <OpenLayers.Filter>
+ * Class: OpenLayers.Layer
  */
  */
-OpenLayers.Filter.Function = OpenLayers.Class(OpenLayers.Filter, {
+OpenLayers.Layer = OpenLayers.Class({
+
+    /**
+     * APIProperty: id
+     * {String}
+     */
+    id: null,
+
+    /** 
+     * APIProperty: name
+     * {String}
+     */
+    name: null,
+
+    /** 
+     * APIProperty: div
+     * {DOMElement}
+     */
+    div: null,
+
+    /**
+     * APIProperty: opacity
+     * {Float} The layer's opacity. Float number between 0.0 and 1.0. Default
+     * is 1.
+     */
+    opacity: 1,
+
+    /**
+     * APIProperty: alwaysInRange
+     * {Boolean} If a layer's display should not be scale-based, this should 
+     *     be set to true. This will cause the layer, as an overlay, to always 
+     *     be 'active', by always returning true from the calculateInRange() 
+     *     function. 
+     * 
+     *     If not explicitly specified for a layer, its value will be 
+     *     determined on startup in initResolutions() based on whether or not 
+     *     any scale-specific properties have been set as options on the 
+     *     layer. If no scale-specific options have been set on the layer, we 
+     *     assume that it should always be in range.
+     * 
+     *     See #987 for more info.
+     */
+    alwaysInRange: null,   
+
+    /**
+     * Constant: RESOLUTION_PROPERTIES
+     * {Array} The properties that are used for calculating resolutions
+     *     information.
+     */
+    RESOLUTION_PROPERTIES: [
+        'scales', 'resolutions',
+        'maxScale', 'minScale',
+        'maxResolution', 'minResolution',
+        'numZoomLevels', 'maxZoomLevel'
+    ],
+
+    /**
+     * APIProperty: events
+     * {<OpenLayers.Events>}
+     *
+     * Register a listener for a particular event with the following syntax:
+     * (code)
+     * layer.events.register(type, obj, listener);
+     * (end)
+     *
+     * Listeners will be called with a reference to an event object.  The
+     *     properties of this event depends on exactly what happened.
+     *
+     * All event objects have at least the following properties:
+     * object - {Object} A reference to layer.events.object.
+     * element - {DOMElement} A reference to layer.events.element.
+     *
+     * Supported map event types:
+     * loadstart - Triggered when layer loading starts.  When using a Vector 
+     *     layer with a Fixed or BBOX strategy, the event object includes 
+     *     a *filter* property holding the OpenLayers.Filter used when 
+     *     calling read on the protocol.
+     * loadend - Triggered when layer loading ends.  When using a Vector layer
+     *     with a Fixed or BBOX strategy, the event object includes a 
+     *     *response* property holding an OpenLayers.Protocol.Response object.
+     * visibilitychanged - Triggered when the layer's visibility property is
+     *     changed, e.g. by turning the layer on or off in the layer switcher.
+     *     Note that the actual visibility of the layer can also change if it
+     *     gets out of range (see <calculateInRange>). If you also want to catch
+     *     these cases, register for the map's 'changelayer' event instead.
+     * move - Triggered when layer moves (triggered with every mousemove
+     *     during a drag).
+     * moveend - Triggered when layer is done moving, object passed as
+     *     argument has a zoomChanged boolean property which tells that the
+     *     zoom has changed.
+     * added - Triggered after the layer is added to a map.  Listeners will
+     *     receive an object with a *map* property referencing the map and a
+     *     *layer* property referencing the layer.
+     * removed - Triggered after the layer is removed from the map.  Listeners
+     *     will receive an object with a *map* property referencing the map and
+     *     a *layer* property referencing the layer.
+     */
+    events: null,
 
     /**
 
     /**
-     * APIProperty: name
-     * {String} Name of the function.
+     * APIProperty: map
+     * {<OpenLayers.Map>} This variable is set when the layer is added to 
+     *     the map, via the accessor function setMap().
      */
      */
-    name: null,
+    map: null,
     
     /**
     
     /**
-     * APIProperty: params
-     * {Array(<OpenLayers.Filter.Function> || String || Number)} Function parameters
-     * For now support only other Functions, String or Number
+     * APIProperty: isBaseLayer
+     * {Boolean} Whether or not the layer is a base layer. This should be set 
+     *     individually by all subclasses. Default is false
      */
      */
-    params: null,  
-    
-    /** 
-     * Constructor: OpenLayers.Filter.Function
-     * Creates a filter function.
-     *
-     * Parameters:
-     * options - {Object} An optional object with properties to set on the
-     *     function.
-     * 
-     * Returns:
-     * {<OpenLayers.Filter.Function>}
+    isBaseLayer: false,
+    /**
+     * Property: alpha
+     * {Boolean} The layer's images have an alpha channel.  Default is false.
      */
      */
+    alpha: false,
 
 
-    CLASS_NAME: "OpenLayers.Filter.Function"
-});
-
-/* ======================================================================
-    OpenLayers/BaseTypes/Date.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
+    /** 
+     * APIProperty: displayInLayerSwitcher
+     * {Boolean} Display the layer's name in the layer switcher.  Default is
+     *     true.
+     */
+    displayInLayerSwitcher: true,
 
 
-/**
- * @requires OpenLayers/SingleFile.js
- */
+    /**
+     * APIProperty: visibility
+     * {Boolean} The layer should be displayed in the map.  Default is true.
+     */
+    visibility: true,
 
 
-/**
- * Namespace: OpenLayers.Date
- * Contains implementations of Date.parse and date.toISOString that match the
- *     ECMAScript 5 specification for parsing RFC 3339 dates.
- *     http://tools.ietf.org/html/rfc3339
- */
-OpenLayers.Date = {
+    /**
+     * APIProperty: attribution
+     * {<Object>} or {<String>} Attribution information, displayed when an
+     *     <OpenLayers.Control.Attribution> has been added to the map.
+     *
+     *     An object is required to store the full attribution information
+     *     from a WMS capabilities response. Example attribution object:
+     *     {title:"",href:"",logo:{format:"",width:10,height:10,href:""}}
+     */
+    attribution: null,
 
     /** 
 
     /** 
-     * APIProperty: dateRegEx
-     * The regex to be used for validating dates. You can provide your own
-     * regex for instance for adding support for years before BC. Default
-     * value is: /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/
+     * Property: inRange
+     * {Boolean} The current map resolution is within the layer's min/max 
+     *     range. This is set in <OpenLayers.Map.setCenter> whenever the zoom 
+     *     changes.
      */
      */
-    dateRegEx: /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,
-
+    inRange: false,
+    
     /**
     /**
-     * APIMethod: toISOString
-     * Generates a string representing a date.  The format of the string follows
-     *     the profile of ISO 8601 for date and time on the Internet (see
-     *     http://tools.ietf.org/html/rfc3339).  If the toISOString method is
-     *     available on the Date prototype, that is used.  The toISOString
-     *     method for Date instances is defined in ECMA-262.
-     *
-     * Parameters:
-     * date - {Date} A date object.
-     *
-     * Returns:
-     * {String} A string representing the date (e.g.
-     *     "2010-08-07T16:58:23.123Z").  If the date does not have a valid time
-     *     (i.e. isNaN(date.getTime())) this method returns the string "Invalid
-     *     Date".  The ECMA standard says the toISOString method should throw
-     *     RangeError in this case, but Firefox returns a string instead.  For
-     *     best results, use isNaN(date.getTime()) to determine date validity
-     *     before generating date strings.
+     * Propery: imageSize
+     * {<OpenLayers.Size>} For layers with a gutter, the image is larger than 
+     *     the tile by twice the gutter in each dimension.
      */
      */
-    toISOString: (function() {
-        if ("toISOString" in Date.prototype) {
-            return function(date) {
-                return date.toISOString();
-            };
-        } else {
-            return function(date) {
-                var str;
-                if (isNaN(date.getTime())) {
-                    // ECMA-262 says throw RangeError, Firefox returns
-                    // "Invalid Date"
-                    str = "Invalid Date";
-                } else {
-                    str =
-                        date.getUTCFullYear() + "-" +
-                        OpenLayers.Number.zeroPad(date.getUTCMonth() + 1, 2) + "-" +
-                        OpenLayers.Number.zeroPad(date.getUTCDate(), 2) + "T" +
-                        OpenLayers.Number.zeroPad(date.getUTCHours(), 2) + ":" +
-                        OpenLayers.Number.zeroPad(date.getUTCMinutes(), 2) + ":" +
-                        OpenLayers.Number.zeroPad(date.getUTCSeconds(), 2) + "." +
-                        OpenLayers.Number.zeroPad(date.getUTCMilliseconds(), 3) + "Z";
-                }
-                return str;
-            };
-        }
+    imageSize: null,
+    
+  // OPTIONS
 
 
-    })(),
+    /** 
+     * Property: options
+     * {Object} An optional object whose properties will be set on the layer.
+     *     Any of the layer properties can be set as a property of the options
+     *     object and sent to the constructor when the layer is created.
+     */
+    options: null,
 
     /**
 
     /**
-     * APIMethod: parse
-     * Generate a date object from a string.  The format for the string follows
-     *     the profile of ISO 8601 for date and time on the Internet (see
-     *     http://tools.ietf.org/html/rfc3339).  We don't call the native
-     *     Date.parse because of inconsistency between implmentations.  In
-     *     Chrome, calling Date.parse with a string that doesn't contain any
-     *     indication of the timezone (e.g. "2011"), the date is interpreted
-     *     in local time.  On Firefox, the assumption is UTC.
-     *
-     * Parameters:
-     * str - {String} A string representing the date (e.g.
-     *     "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z",
-     *     "2010-08-07T11:58:23.123-06").
-     *
-     * Returns:
-     * {Date} A date object.  If the string could not be parsed, an invalid
-     *     date is returned (i.e. isNaN(date.getTime())).
+     * APIProperty: eventListeners
+     * {Object} If set as an option at construction, the eventListeners
+     *     object will be registered with <OpenLayers.Events.on>.  Object
+     *     structure must be a listeners object as shown in the example for
+     *     the events.on method.
      */
      */
-    parse: function(str) {
-        var date;
-        var match = str.match(this.dateRegEx);
-        if (match && (match[1] || match[7])) { // must have at least year or time
-            var year = parseInt(match[1], 10) || 0;
-            var month = (parseInt(match[2], 10) - 1) || 0;
-            var day = parseInt(match[3], 10) || 1;
-            date = new Date(Date.UTC(year, month, day));
-            // optional time
-            var type = match[7];
-            if (type) {
-                var hours = parseInt(match[4], 10);
-                var minutes = parseInt(match[5], 10);
-                var secFrac = parseFloat(match[6]);
-                var seconds = secFrac | 0;
-                var milliseconds = Math.round(1000 * (secFrac - seconds));
-                date.setUTCHours(hours, minutes, seconds, milliseconds);
-                // check offset
-                if (type !== "Z") {
-                    var hoursOffset = parseInt(type, 10);
-                    var minutesOffset = parseInt(match[8], 10) || 0;
-                    var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
-                    date = new Date(date.getTime() + offset);
-                }
-            }
-        } else {
-            date = new Date("invalid");
-        }
-        return date;
-    }
-};
-/* ======================================================================
-    OpenLayers/Format/Filter/v1.js
-   ====================================================================== */
+    eventListeners: null,
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-/**
- * @requires OpenLayers/Format/Filter.js
- * @requires OpenLayers/Format/XML.js
- * @requires OpenLayers/Filter/Function.js
- * @requires OpenLayers/BaseTypes/Date.js
- */
+    /**
+     * APIProperty: gutter
+     * {Integer} Determines the width (in pixels) of the gutter around image
+     *     tiles to ignore.  By setting this property to a non-zero value,
+     *     images will be requested that are wider and taller than the tile
+     *     size by a value of 2 x gutter.  This allows artifacts of rendering
+     *     at tile edges to be ignored.  Set a gutter value that is equal to
+     *     half the size of the widest symbol that needs to be displayed.
+     *     Defaults to zero.  Non-tiled layers always have zero gutter.
+     */ 
+    gutter: 0, 
 
 
-/**
- * Class: OpenLayers.Format.Filter.v1
- * Superclass for Filter version 1 parsers.
- *
- * Inherits from:
- *  - <OpenLayers.Format.XML>
- */
-OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
+    /**
+     * APIProperty: projection
+     * {<OpenLayers.Projection>} or {<String>} Specifies the projection of the layer.
+     *     Can be set in the layer options. If not specified in the layer options,
+     *     it is set to the default projection specified in the map,
+     *     when the layer is added to the map.
+     *     Projection along with default maxExtent and resolutions
+     *     are set automatically with commercial baselayers in EPSG:3857,
+     *     such as Google, Bing and OpenStreetMap, and do not need to be specified.
+     *     Otherwise, if specifying projection, also set maxExtent,
+     *     maxResolution or resolutions as appropriate.
+     *     When using vector layers with strategies, layer projection should be set
+     *     to the projection of the source data if that is different from the map default.
+     * 
+     *     Can be either a string or an <OpenLayers.Projection> object;
+     *     if a string is passed, will be converted to an object when
+     *     the layer is added to the map.
+     * 
+     */
+    projection: null,    
     
     /**
     
     /**
-     * Property: namespaces
-     * {Object} Mapping of namespace aliases to namespace URIs.
+     * APIProperty: units
+     * {String} The layer map units.  Defaults to null.  Possible values
+     *     are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'.
+     *     Normally taken from the projection.
+     *     Only required if both map and layers do not define a projection,
+     *     or if they define a projection which does not define units.
      */
      */
-    namespaces: {
-        ogc: "http://www.opengis.net/ogc",
-        gml: "http://www.opengis.net/gml",
-        xlink: "http://www.w3.org/1999/xlink",
-        xsi: "http://www.w3.org/2001/XMLSchema-instance"
-    },
+    units: null,
 
     /**
 
     /**
-     * Property: defaultPrefix
+     * APIProperty: scales
+     * {Array}  An array of map scales in descending order.  The values in the
+     *     array correspond to the map scale denominator.  Note that these
+     *     values only make sense if the display (monitor) resolution of the
+     *     client is correctly guessed by whomever is configuring the
+     *     application.  In addition, the units property must also be set.
+     *     Use <resolutions> instead wherever possible.
      */
      */
-    defaultPrefix: "ogc",
+    scales: null,
 
     /**
 
     /**
-     * Property: schemaLocation
-     * {String} Schema location for a particular minor version.
+     * APIProperty: resolutions
+     * {Array} A list of map resolutions (map units per pixel) in descending
+     *     order.  If this is not set in the layer constructor, it will be set
+     *     based on other resolution related properties (maxExtent,
+     *     maxResolution, maxScale, etc.).
      */
      */
-    schemaLocation: null,
+    resolutions: null,
     
     /**
     
     /**
-     * Constructor: OpenLayers.Format.Filter.v1
-     * Instances of this class are not created directly.  Use the
-     *     <OpenLayers.Format.Filter> constructor instead.
-     *
-     * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *     this instance.
+     * APIProperty: maxExtent
+     * {<OpenLayers.Bounds>|Array} If provided as an array, the array
+     *     should consist of four values (left, bottom, right, top).
+     *     The maximum extent for the layer.  Defaults to null.
+     * 
+     *     The center of these bounds will not stray outside
+     *     of the viewport extent during panning.  In addition, if
+     *     <displayOutsideMaxExtent> is set to false, data will not be
+     *     requested that falls completely outside of these bounds.
      */
      */
-    initialize: function(options) {
-        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
-    },
+    maxExtent: null,
     
     /**
     
     /**
-     * Method: read
-     *
-     * Parameters:
-     * data - {DOMElement} A Filter document element.
-     *
-     * Returns:
-     * {<OpenLayers.Filter>} A filter object.
+     * APIProperty: minExtent
+     * {<OpenLayers.Bounds>|Array} If provided as an array, the array
+     *     should consist of four values (left, bottom, right, top).
+     *     The minimum extent for the layer.  Defaults to null.
      */
      */
-    read: function(data) {
-        var obj = {};
-        this.readers.ogc["Filter"].apply(this, [data, obj]);
-        return obj.filter;
-    },
+    minExtent: null,
     
     /**
     
     /**
-     * Property: readers
-     * Contains public functions, grouped by namespace prefix, that will
-     *     be applied when a namespaced node is found matching the function
-     *     name.  The function will be applied in the scope of this parser
-     *     with two arguments: the node being read and a context object passed
-     *     from the parent.
+     * APIProperty: maxResolution
+     * {Float} Default max is 360 deg / 256 px, which corresponds to
+     *     zoom level 0 on gmaps.  Specify a different value in the layer 
+     *     options if you are not using the default <OpenLayers.Map.tileSize>
+     *     and displaying the whole world.
      */
      */
-    readers: {
-        "ogc": {
-            "_expression": function(node) {
-                // only the simplest of ogc:expression handled
-                // "some text and an <PropertyName>attribute</PropertyName>"}
-                var obj, value = "";
-                for(var child=node.firstChild; child; child=child.nextSibling) {
-                    switch(child.nodeType) {
-                        case 1:
-                            obj = this.readNode(child);
-                            if (obj.property) {
-                                value += "${" + obj.property + "}";
-                            } else if (obj.value !== undefined) {
-                                value += obj.value;
-                            }
-                            break;
-                        case 3: // text node
-                        case 4: // cdata section
-                            value += child.nodeValue;
-                    }
-                }
-                return value;
-            },
-            "Filter": function(node, parent) {
-                // Filters correspond to subclasses of OpenLayers.Filter.
-                // Since they contain information we don't persist, we
-                // create a temporary object and then pass on the filter
-                // (ogc:Filter) to the parent obj.
-                var obj = {
-                    fids: [],
-                    filters: []
-                };
-                this.readChildNodes(node, obj);
-                if(obj.fids.length > 0) {
-                    parent.filter = new OpenLayers.Filter.FeatureId({
-                        fids: obj.fids
-                    });
-                } else if(obj.filters.length > 0) {
-                    parent.filter = obj.filters[0];
-                }
-            },
-            "FeatureId": function(node, obj) {
-                var fid = node.getAttribute("fid");
-                if(fid) {
-                    obj.fids.push(fid);
-                }
-            },
-            "And": function(node, obj) {
-                var filter = new OpenLayers.Filter.Logical({
-                    type: OpenLayers.Filter.Logical.AND
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "Or": function(node, obj) {
-                var filter = new OpenLayers.Filter.Logical({
-                    type: OpenLayers.Filter.Logical.OR
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "Not": function(node, obj) {
-                var filter = new OpenLayers.Filter.Logical({
-                    type: OpenLayers.Filter.Logical.NOT
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "PropertyIsLessThan": function(node, obj) {
-                var filter = new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.LESS_THAN
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "PropertyIsGreaterThan": function(node, obj) {
-                var filter = new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.GREATER_THAN
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "PropertyIsLessThanOrEqualTo": function(node, obj) {
-                var filter = new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "PropertyIsGreaterThanOrEqualTo": function(node, obj) {
-                var filter = new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "PropertyIsBetween": function(node, obj) {
-                var filter = new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.BETWEEN
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "Literal": function(node, obj) {
-                obj.value = OpenLayers.String.numericIf(
-                    this.getChildValue(node), true);
-            },
-            "PropertyName": function(node, filter) {
-                filter.property = this.getChildValue(node);
-            },
-            "LowerBoundary": function(node, filter) {
-                filter.lowerBoundary = OpenLayers.String.numericIf(
-                    this.readers.ogc._expression.call(this, node), true);
-            },
-            "UpperBoundary": function(node, filter) {
-                filter.upperBoundary = OpenLayers.String.numericIf(
-                    this.readers.ogc._expression.call(this, node), true);
-            },
-            "Intersects": function(node, obj) {
-                this.readSpatial(node, obj, OpenLayers.Filter.Spatial.INTERSECTS);
-            },
-            "Within": function(node, obj) {
-                this.readSpatial(node, obj, OpenLayers.Filter.Spatial.WITHIN);
-            },
-            "Contains": function(node, obj) {
-                this.readSpatial(node, obj, OpenLayers.Filter.Spatial.CONTAINS);
-            },
-            "DWithin": function(node, obj) {
-                this.readSpatial(node, obj, OpenLayers.Filter.Spatial.DWITHIN);
-            },
-            "Distance": function(node, obj) {
-                obj.distance = parseInt(this.getChildValue(node));
-                obj.distanceUnits = node.getAttribute("units");
-            },
-            "Function": function(node, obj) {
-                //TODO write decoder for it
-                return;
-            },
-            "PropertyIsNull": function(node, obj) {
-                var filter = new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.IS_NULL
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
+    maxResolution: null,
+
+    /**
+     * APIProperty: minResolution
+     * {Float}
+     */
+    minResolution: null,
+
+    /**
+     * APIProperty: numZoomLevels
+     * {Integer}
+     */
+    numZoomLevels: null,
+    
+    /**
+     * APIProperty: minScale
+     * {Float}
+     */
+    minScale: null,
+    
+    /**
+     * APIProperty: maxScale
+     * {Float}
+     */
+    maxScale: null,
+
+    /**
+     * APIProperty: displayOutsideMaxExtent
+     * {Boolean} Request map tiles that are completely outside of the max 
+     *     extent for this layer. Defaults to false.
+     */
+    displayOutsideMaxExtent: false,
+
+    /**
+     * APIProperty: wrapDateLine
+     * {Boolean} Wraps the world at the international dateline, so the map can
+     * be panned infinitely in longitudinal direction. Only use this on the
+     * base layer, and only if the layer's maxExtent equals the world bounds.
+     * #487 for more info.   
+     */
+    wrapDateLine: false,
+    
+    /**
+     * Property: metadata
+     * {Object} This object can be used to store additional information on a
+     *     layer object.
+     */
+    metadata: null,
+    
+    /**
+     * Constructor: OpenLayers.Layer
+     *
+     * Parameters:
+     * name - {String} The layer name
+     * options - {Object} Hashtable of extra options to tag onto the layer
+     */
+    initialize: function(name, options) {
+
+        this.metadata = {};
+        
+        options = OpenLayers.Util.extend({}, options);
+        // make sure we respect alwaysInRange if set on the prototype
+        if (this.alwaysInRange != null) {
+            options.alwaysInRange = this.alwaysInRange;
+        }
+        this.addOptions(options);
+
+        this.name = name;
+        
+        if (this.id == null) {
+
+            this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
+
+            this.div = OpenLayers.Util.createDiv(this.id);
+            this.div.style.width = "100%";
+            this.div.style.height = "100%";
+            this.div.dir = "ltr";
+
+            this.events = new OpenLayers.Events(this, this.div);
+            if(this.eventListeners instanceof Object) {
+                this.events.on(this.eventListeners);
             }
             }
+
         }
     },
     
     /**
         }
     },
     
     /**
-     * Method: readSpatial
+     * Method: destroy
+     * Destroy is a destructor: this is to alleviate cyclic references which
+     *     the Javascript garbage cleaner can not take care of on its own.
      *
      *
-     * Read a {<OpenLayers.Filter.Spatial>} filter.
-     * 
      * Parameters:
      * Parameters:
-     * node - {DOMElement} A DOM element that contains an ogc:expression.
-     * obj - {Object} The target object.
-     * type - {String} One of the OpenLayers.Filter.Spatial.* constants.
-     *
-     * Returns:
-     * {<OpenLayers.Filter.Spatial>} The created filter.
+     * setNewBaseLayer - {Boolean} Set a new base layer when this layer has
+     *     been destroyed.  Default is true.
      */
      */
-    readSpatial: function(node, obj, type) {
-        var filter = new OpenLayers.Filter.Spatial({
-            type: type
-        });
-        this.readChildNodes(node, filter);
-        filter.value = filter.components[0];
-        delete filter.components;
-        obj.filters.push(filter);
-    },
+    destroy: function(setNewBaseLayer) {
+        if (setNewBaseLayer == null) {
+            setNewBaseLayer = true;
+        }
+        if (this.map != null) {
+            this.map.removeLayer(this, setNewBaseLayer);
+        }
+        this.projection = null;
+        this.map = null;
+        this.name = null;
+        this.div = null;
+        this.options = null;
 
 
+        if (this.events) {
+            if(this.eventListeners) {
+                this.events.un(this.eventListeners);
+            }
+            this.events.destroy();
+        }
+        this.eventListeners = null;
+        this.events = null;
+    },
+    
+   /**
+    * Method: clone
+    *
+    * Parameters:
+    * obj - {<OpenLayers.Layer>} The layer to be cloned
+    *
+    * Returns:
+    * {<OpenLayers.Layer>} An exact clone of this <OpenLayers.Layer>
+    */
+    clone: function (obj) {
+        
+        if (obj == null) {
+            obj = new OpenLayers.Layer(this.name, this.getOptions());
+        }
+        
+        // catch any randomly tagged-on properties
+        OpenLayers.Util.applyDefaults(obj, this);
+        
+        // a cloned layer should never have its map property set
+        //  because it has not been added to a map yet. 
+        obj.map = null;
+        
+        return obj;
+    },
+    
     /**
     /**
-     * APIMethod: encodeLiteral
-     * Generates the string representation of a value for use in <Literal> 
-     *     elements.  The default encoder writes Date values as ISO 8601 
-     *     strings.
+     * Method: getOptions
+     * Extracts an object from the layer with the properties that were set as
+     *     options, but updates them with the values currently set on the
+     *     instance.
+     * 
+     * Returns:
+     * {Object} the <options> of the layer, representing the current state.
+     */
+    getOptions: function() {
+        var options = {};
+        for(var o in this.options) {
+            options[o] = this[o];
+        }
+        return options;
+    },
+    
+    /** 
+     * APIMethod: setName
+     * Sets the new layer name for this layer.  Can trigger a changelayer event
+     *     on the map.
      *
      * Parameters:
      *
      * Parameters:
-     * value - {Object} Literal value to encode
+     * newName - {String} The new name.
+     */
+    setName: function(newName) {
+        if (newName != this.name) {
+            this.name = newName;
+            if (this.map != null) {
+                this.map.events.triggerEvent("changelayer", {
+                    layer: this,
+                    property: "name"
+                });
+            }
+        }
+    },    
+    
+   /**
+    * APIMethod: addOptions
+    * 
+    * Parameters:
+    * newOptions - {Object}
+    * reinitialize - {Boolean} If set to true, and if resolution options of the
+    *     current baseLayer were changed, the map will be recentered to make
+    *     sure that it is displayed with a valid resolution, and a
+    *     changebaselayer event will be triggered.
+    */
+    addOptions: function (newOptions, reinitialize) {
+
+        if (this.options == null) {
+            this.options = {};
+        }
+        
+        if (newOptions) {
+            // make sure this.projection references a projection object
+            if(typeof newOptions.projection == "string") {
+                newOptions.projection = new OpenLayers.Projection(newOptions.projection);
+            }
+            if (newOptions.projection) {
+                // get maxResolution, units and maxExtent from projection defaults if
+                // they are not defined already
+                OpenLayers.Util.applyDefaults(newOptions,
+                    OpenLayers.Projection.defaults[newOptions.projection.getCode()]);
+            }
+            // allow array for extents
+            if (newOptions.maxExtent && !(newOptions.maxExtent instanceof OpenLayers.Bounds)) {
+                newOptions.maxExtent = new OpenLayers.Bounds(newOptions.maxExtent);
+            }
+            if (newOptions.minExtent && !(newOptions.minExtent instanceof OpenLayers.Bounds)) {
+                newOptions.minExtent = new OpenLayers.Bounds(newOptions.minExtent);
+            }
+        }
+
+        // update our copy for clone
+        OpenLayers.Util.extend(this.options, newOptions);
+
+        // add new options to this
+        OpenLayers.Util.extend(this, newOptions);
+        
+        // get the units from the projection, if we have a projection
+        // and it it has units
+        if(this.projection && this.projection.getUnits()) {
+            this.units = this.projection.getUnits();
+        }
+
+        // re-initialize resolutions if necessary, i.e. if any of the
+        // properties of the "properties" array defined below is set
+        // in the new options
+        if(this.map) {
+            // store current resolution so we can try to restore it later
+            var resolution = this.map.getResolution();
+            var properties = this.RESOLUTION_PROPERTIES.concat(
+                ["projection", "units", "minExtent", "maxExtent"]
+            );
+            for(var o in newOptions) {
+                if(newOptions.hasOwnProperty(o) &&
+                   OpenLayers.Util.indexOf(properties, o) >= 0) {
+
+                    this.initResolutions();
+                    if (reinitialize && this.map.baseLayer === this) {
+                        // update map position, and restore previous resolution
+                        this.map.setCenter(this.map.getCenter(),
+                            this.map.getZoomForResolution(resolution),
+                            false, true
+                        );
+                        // trigger a changebaselayer event to make sure that
+                        // all controls (especially
+                        // OpenLayers.Control.PanZoomBar) get notified of the
+                        // new options
+                        this.map.events.triggerEvent("changebaselayer", {
+                            layer: this
+                        });
+                    }
+                    break;
+                }
+            }
+        }
+    },
+
+    /**
+     * APIMethod: onMapResize
+     * This function can be implemented by subclasses
+     */
+    onMapResize: function() {
+        //this function can be implemented by subclasses  
+    },
+
+    /**
+     * APIMethod: redraw
+     * Redraws the layer.  Returns true if the layer was redrawn, false if not.
      *
      * Returns:
      *
      * Returns:
-     * {String} String representation of the provided value.
+     * {Boolean} The layer was redrawn.
      */
      */
-    encodeLiteral: function(value) {
-        if (value instanceof Date) {
-            value = OpenLayers.Date.toISOString(value);
+    redraw: function() {
+        var redrawn = false;
+        if (this.map) {
+
+            // min/max Range may have changed
+            this.inRange = this.calculateInRange();
+
+            // map's center might not yet be set
+            var extent = this.getExtent();
+
+            if (extent && this.inRange && this.visibility) {
+                var zoomChanged = true;
+                this.moveTo(extent, zoomChanged, false);
+                this.events.triggerEvent("moveend",
+                    {"zoomChanged": zoomChanged});
+                redrawn = true;
+            }
         }
         }
-        return value;
+        return redrawn;
     },
 
     /**
     },
 
     /**
-     * Method: writeOgcExpression
-     * Limited support for writing OGC expressions. Currently it supports
-     * (<OpenLayers.Filter.Function> || String || Number)
-     *
+     * Method: moveTo
+     * 
      * Parameters:
      * Parameters:
-     * value - (<OpenLayers.Filter.Function> || String || Number)
-     * node - {DOMElement} A parent DOM element 
-     *
-     * Returns:
-     * {DOMElement} Updated node element.
+     * bounds - {<OpenLayers.Bounds>}
+     * zoomChanged - {Boolean} Tells when zoom has changed, as layers have to
+     *     do some init work in that case.
+     * dragging - {Boolean}
      */
      */
-    writeOgcExpression: function(value, node) {
-        if (value instanceof OpenLayers.Filter.Function){
-            this.writeNode("Function", value, node);
-        } else {
-            this.writeNode("Literal", value, node);
+    moveTo:function(bounds, zoomChanged, dragging) {
+        var display = this.visibility;
+        if (!this.isBaseLayer) {
+            display = display && this.inRange;
         }
         }
-        return node;
-    },    
-    
+        this.display(display);
+    },
+
     /**
     /**
-     * Method: write
+     * Method: moveByPx
+     * Move the layer based on pixel vector. To be implemented by subclasses.
      *
      * Parameters:
      *
      * Parameters:
-     * filter - {<OpenLayers.Filter>} A filter object.
-     *
-     * Returns:
-     * {DOMElement} An ogc:Filter element.
+     * dx - {Number} The x coord of the displacement vector.
+     * dy - {Number} The y coord of the displacement vector.
      */
      */
-    write: function(filter) {
-        return this.writers.ogc["Filter"].apply(this, [filter]);
+    moveByPx: function(dx, dy) {
     },
     },
-    
+
     /**
     /**
-     * Property: writers
-     * As a compliment to the readers property, this structure contains public
-     *     writing functions grouped by namespace alias and named like the
-     *     node names they produce.
+     * Method: setMap
+     * Set the map property for the layer. This is done through an accessor
+     *     so that subclasses can override this and take special action once 
+     *     they have their map variable set. 
+     * 
+     *     Here we take care to bring over any of the necessary default 
+     *     properties from the map. 
+     * 
+     * Parameters:
+     * map - {<OpenLayers.Map>}
      */
      */
-    writers: {
-        "ogc": {
-            "Filter": function(filter) {
-                var node = this.createElementNSPlus("ogc:Filter");
-                this.writeNode(this.getFilterType(filter), filter, node);
-                return node;
-            },
-            "_featureIds": function(filter) {
-                var node = this.createDocumentFragment();
-                for (var i=0, ii=filter.fids.length; i<ii; ++i) {
-                    this.writeNode("ogc:FeatureId", filter.fids[i], node);
-                }
-                return node;
-            },
-            "FeatureId": function(fid) {
-                return this.createElementNSPlus("ogc:FeatureId", {
-                    attributes: {fid: fid}
-                });
-            },
-            "And": function(filter) {
-                var node = this.createElementNSPlus("ogc:And");
-                var childFilter;
-                for (var i=0, ii=filter.filters.length; i<ii; ++i) {
-                    childFilter = filter.filters[i];
-                    this.writeNode(
-                        this.getFilterType(childFilter), childFilter, node
-                    );
-                }
-                return node;
-            },
-            "Or": function(filter) {
-                var node = this.createElementNSPlus("ogc:Or");
-                var childFilter;
-                for (var i=0, ii=filter.filters.length; i<ii; ++i) {
-                    childFilter = filter.filters[i];
-                    this.writeNode(
-                        this.getFilterType(childFilter), childFilter, node
-                    );
-                }
-                return node;
-            },
-            "Not": function(filter) {
-                var node = this.createElementNSPlus("ogc:Not");
-                var childFilter = filter.filters[0];
-                this.writeNode(
-                    this.getFilterType(childFilter), childFilter, node
-                );
-                return node;
-            },
-            "PropertyIsLessThan": function(filter) {
-                var node = this.createElementNSPlus("ogc:PropertyIsLessThan");
-                // no ogc:expression handling for PropertyName for now
-                this.writeNode("PropertyName", filter, node);
-                // handle Literals or Functions for now
-                this.writeOgcExpression(filter.value, node);
-                return node;
-            },
-            "PropertyIsGreaterThan": function(filter) {
-                var node = this.createElementNSPlus("ogc:PropertyIsGreaterThan");
-                // no ogc:expression handling for PropertyName for now
-                this.writeNode("PropertyName", filter, node);
-                // handle Literals or Functions for now
-                this.writeOgcExpression(filter.value, node);
-                return node;
-            },
-            "PropertyIsLessThanOrEqualTo": function(filter) {
-                var node = this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");
-                // no ogc:expression handling for PropertyName for now
-                this.writeNode("PropertyName", filter, node);
-                // handle Literals or Functions for now
-                this.writeOgcExpression(filter.value, node);
-                return node;
-            },
-            "PropertyIsGreaterThanOrEqualTo": function(filter) {
-                var node = this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");
-                // no ogc:expression handling for PropertyName for now
-                this.writeNode("PropertyName", filter, node);
-                // handle Literals or Functions for now
-                this.writeOgcExpression(filter.value, node);
-                return node;
-            },
-            "PropertyIsBetween": function(filter) {
-                var node = this.createElementNSPlus("ogc:PropertyIsBetween");
-                // no ogc:expression handling for PropertyName for now
-                this.writeNode("PropertyName", filter, node);
-                this.writeNode("LowerBoundary", filter, node);
-                this.writeNode("UpperBoundary", filter, node);
-                return node;
-            },
-            "PropertyName": function(filter) {
-                // no ogc:expression handling for now
-                return this.createElementNSPlus("ogc:PropertyName", {
-                    value: filter.property
-                });
-            },
-            "Literal": function(value) {
-                var encode = this.encodeLiteral ||
-                    OpenLayers.Format.Filter.v1.prototype.encodeLiteral;
-                return this.createElementNSPlus("ogc:Literal", {
-                    value: encode(value)
-                });
-            },
-            "LowerBoundary": function(filter) {
-                // handle Literals or Functions for now
-                var node = this.createElementNSPlus("ogc:LowerBoundary");
-                this.writeOgcExpression(filter.lowerBoundary, node);
-                return node;
-            },
-            "UpperBoundary": function(filter) {
-                // handle Literals or Functions for now
-                var node = this.createElementNSPlus("ogc:UpperBoundary");
-                this.writeNode("Literal", filter.upperBoundary, node);
-                return node;
-            },
-            "INTERSECTS": function(filter) {
-                return this.writeSpatial(filter, "Intersects");
-            },
-            "WITHIN": function(filter) {
-                return this.writeSpatial(filter, "Within");
-            },
-            "CONTAINS": function(filter) {
-                return this.writeSpatial(filter, "Contains");
-            },
-            "DWITHIN": function(filter) {
-                var node = this.writeSpatial(filter, "DWithin");
-                this.writeNode("Distance", filter, node);
-                return node;
-            },
-            "Distance": function(filter) {
-                return this.createElementNSPlus("ogc:Distance", {
-                    attributes: {
-                        units: filter.distanceUnits
-                    },
-                    value: filter.distance
-                });
-            },
-            "Function": function(filter) {
-                var node = this.createElementNSPlus("ogc:Function", {
-                    attributes: {
-                        name: filter.name
-                    }
-                });
-                var params = filter.params;
-                for(var i=0, len=params.length; i<len; i++){
-                    this.writeOgcExpression(params[i], node);
-                }
-                return node;
-            },
-            "PropertyIsNull": function(filter) {
-                var node = this.createElementNSPlus("ogc:PropertyIsNull");
-                this.writeNode("PropertyName", filter, node);
-                return node;
+    setMap: function(map) {
+        if (this.map == null) {
+        
+            this.map = map;
+            
+            // grab some essential layer data from the map if it hasn't already
+            //  been set
+            this.maxExtent = this.maxExtent || this.map.maxExtent;
+            this.minExtent = this.minExtent || this.map.minExtent;
+
+            this.projection = this.projection || this.map.projection;
+            if (typeof this.projection == "string") {
+                this.projection = new OpenLayers.Projection(this.projection);
+            }
+
+            // Check the projection to see if we can get units -- if not, refer
+            // to properties.
+            if (this.projection && this.projection.getUnits()) {
+                this.units = this.projection.getUnits();
+            }
+            else {
+                this.units = this.units || this.map.units;
+            }
+            
+            this.initResolutions();
+            
+            if (!this.isBaseLayer) {
+                this.inRange = this.calculateInRange();
+                var show = ((this.visibility) && (this.inRange));
+                this.div.style.display = show ? "" : "none";
             }
             }
+            
+            // deal with gutters
+            this.setTileSize();
         }
     },
         }
     },
-
+    
     /**
     /**
-     * Method: getFilterType
+     * Method: afterAdd
+     * Called at the end of the map.addLayer sequence.  At this point, the map
+     *     will have a base layer.  To be overridden by subclasses.
      */
      */
-    getFilterType: function(filter) {
-        var filterType = this.filterMap[filter.type];
-        if(!filterType) {
-            throw "Filter writing not supported for rule type: " + filter.type;
-        }
-        return filterType;
+    afterAdd: function() {
     },
     
     /**
     },
     
     /**
-     * Property: filterMap
-     * {Object} Contains a member for each filter type.  Values are node names
-     *     for corresponding OGC Filter child elements.
+     * APIMethod: removeMap
+     * Just as setMap() allows each layer the possibility to take a 
+     *     personalized action on being added to the map, removeMap() allows
+     *     each layer to take a personalized action on being removed from it. 
+     *     For now, this will be mostly unused, except for the EventPane layer,
+     *     which needs this hook so that it can remove the special invisible
+     *     pane. 
+     * 
+     * Parameters:
+     * map - {<OpenLayers.Map>}
      */
      */
-    filterMap: {
-        "&&": "And",
-        "||": "Or",
-        "!": "Not",
-        "==": "PropertyIsEqualTo",
-        "!=": "PropertyIsNotEqualTo",
-        "<": "PropertyIsLessThan",
-        ">": "PropertyIsGreaterThan",
-        "<=": "PropertyIsLessThanOrEqualTo",
-        ">=": "PropertyIsGreaterThanOrEqualTo",
-        "..": "PropertyIsBetween",
-        "~": "PropertyIsLike",
-        "NULL": "PropertyIsNull",
-        "BBOX": "BBOX",
-        "DWITHIN": "DWITHIN",
-        "WITHIN": "WITHIN",
-        "CONTAINS": "CONTAINS",
-        "INTERSECTS": "INTERSECTS",
-        "FID": "_featureIds"
+    removeMap: function(map) {
+        //to be overridden by subclasses
     },
     },
-
-    CLASS_NAME: "OpenLayers.Format.Filter.v1" 
-
-});
-/* ======================================================================
-    OpenLayers/Format/Filter/v1_0_0.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Format/GML/v2.js
- * @requires OpenLayers/Format/Filter/v1.js
- */
-
-/**
- * Class: OpenLayers.Format.Filter.v1_0_0
- * Write ogc:Filter version 1.0.0.
- * 
- * Inherits from:
- *  - <OpenLayers.Format.GML.v2>
- *  - <OpenLayers.Format.Filter.v1>
- */
-OpenLayers.Format.Filter.v1_0_0 = OpenLayers.Class(
-    OpenLayers.Format.GML.v2, OpenLayers.Format.Filter.v1, {
     
     /**
     
     /**
-     * Constant: VERSION
-     * {String} 1.0.0
-     */
-    VERSION: "1.0.0",
-    
+     * APIMethod: getImageSize
+     *
+     * Parameters:
+     * bounds - {<OpenLayers.Bounds>} optional tile bounds, can be used
+     *     by subclasses that have to deal with different tile sizes at the
+     *     layer extent edges (e.g. Zoomify)
+     * 
+     * Returns:
+     * {<OpenLayers.Size>} The size that the image should be, taking into 
+     *     account gutters.
+     */ 
+    getImageSize: function(bounds) { 
+        return (this.imageSize || this.tileSize); 
+    },    
+  
     /**
     /**
-     * Property: schemaLocation
-     * {String} http://www.opengis.net/ogc/filter/1.0.0/filter.xsd
+     * APIMethod: setTileSize
+     * Set the tile size based on the map size.  This also sets layer.imageSize
+     *     or use by Tile.Image.
+     * 
+     * Parameters:
+     * size - {<OpenLayers.Size>}
      */
      */
-    schemaLocation: "http://www.opengis.net/ogc/filter/1.0.0/filter.xsd",
+    setTileSize: function(size) {
+        var tileSize = (size) ? size :
+                                ((this.tileSize) ? this.tileSize :
+                                                   this.map.getTileSize());
+        this.tileSize = tileSize;
+        if(this.gutter) {
+          // layers with gutters need non-null tile sizes
+          //if(tileSize == null) {
+          //    OpenLayers.console.error("Error in layer.setMap() for " +
+          //                              this.name + ": layers with " +
+          //                              "gutters need non-null tile sizes");
+          //}
+            this.imageSize = new OpenLayers.Size(tileSize.w + (2*this.gutter), 
+                                                 tileSize.h + (2*this.gutter)); 
+        }
+    },
 
     /**
 
     /**
-     * Constructor: OpenLayers.Format.Filter.v1_0_0
-     * Instances of this class are not created directly.  Use the
-     *     <OpenLayers.Format.Filter> constructor instead.
-     *
-     * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *     this instance.
+     * APIMethod: getVisibility
+     * 
+     * Returns:
+     * {Boolean} The layer should be displayed (if in range).
      */
      */
-    initialize: function(options) {
-        OpenLayers.Format.GML.v2.prototype.initialize.apply(
-            this, [options]
-        );
+    getVisibility: function() {
+        return this.visibility;
     },
 
     },
 
-    /**
-     * Property: readers
-     * Contains public functions, grouped by namespace prefix, that will
-     *     be applied when a namespaced node is found matching the function
-     *     name.  The function will be applied in the scope of this parser
-     *     with two arguments: the node being read and a context object passed
-     *     from the parent.
+    /** 
+     * APIMethod: setVisibility
+     * Set the visibility flag for the layer and hide/show & redraw 
+     *     accordingly. Fire event unless otherwise specified
+     * 
+     * Note that visibility is no longer simply whether or not the layer's
+     *     style.display is set to "block". Now we store a 'visibility' state 
+     *     property on the layer class, this allows us to remember whether or 
+     *     not we *desire* for a layer to be visible. In the case where the 
+     *     map's resolution is out of the layer's range, this desire may be 
+     *     subverted.
+     * 
+     * Parameters:
+     * visibility - {Boolean} Whether or not to display the layer (if in range)
      */
      */
-    readers: {
-        "ogc": OpenLayers.Util.applyDefaults({
-            "PropertyIsEqualTo": function(node, obj) {
-                var filter = new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.EQUAL_TO
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "PropertyIsNotEqualTo": function(node, obj) {
-                var filter = new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO
-                });
-                this.readChildNodes(node, filter);
-                obj.filters.push(filter);
-            },
-            "PropertyIsLike": function(node, obj) {
-                var filter = new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.LIKE
+    setVisibility: function(visibility) {
+        if (visibility != this.visibility) {
+            this.visibility = visibility;
+            this.display(visibility);
+            this.redraw();
+            if (this.map != null) {
+                this.map.events.triggerEvent("changelayer", {
+                    layer: this,
+                    property: "visibility"
                 });
                 });
-                this.readChildNodes(node, filter);
-                var wildCard = node.getAttribute("wildCard");
-                var singleChar = node.getAttribute("singleChar");
-                var esc = node.getAttribute("escape");
-                filter.value2regex(wildCard, singleChar, esc);
-                obj.filters.push(filter);
             }
             }
-        }, OpenLayers.Format.Filter.v1.prototype.readers["ogc"]),
-        "gml": OpenLayers.Format.GML.v2.prototype.readers["gml"],
-        "feature": OpenLayers.Format.GML.v2.prototype.readers["feature"]        
+            this.events.triggerEvent("visibilitychanged");
+        }
     },
 
     },
 
-    /**
-     * Property: writers
-     * As a compliment to the readers property, this structure contains public
-     *     writing functions grouped by namespace alias and named like the
-     *     node names they produce.
+    /** 
+     * APIMethod: display
+     * Hide or show the Layer. This is designed to be used internally, and 
+     *     is not generally the way to enable or disable the layer. For that,
+     *     use the setVisibility function instead..
+     * 
+     * Parameters:
+     * display - {Boolean}
      */
      */
-    writers: {
-        "ogc": OpenLayers.Util.applyDefaults({
-            "PropertyIsEqualTo": function(filter) {
-                var node = this.createElementNSPlus("ogc:PropertyIsEqualTo");
-                // no ogc:expression handling for PropertyName for now
-                this.writeNode("PropertyName", filter, node);
-                // handle Literals or Functions for now
-                this.writeOgcExpression(filter.value, node);
-                return node;
-            },
-            "PropertyIsNotEqualTo": function(filter) {
-                var node = this.createElementNSPlus("ogc:PropertyIsNotEqualTo");
-                // no ogc:expression handling for PropertyName for now
-                this.writeNode("PropertyName", filter, node);
-                // handle Literals or Functions for now
-                this.writeOgcExpression(filter.value, node);
-                return node;
-            },
-            "PropertyIsLike": function(filter) {
-                var node = this.createElementNSPlus("ogc:PropertyIsLike", {
-                    attributes: {
-                        wildCard: "*", singleChar: ".", escape: "!"
-                    }
-                });
-                // no ogc:expression handling for now
-                this.writeNode("PropertyName", filter, node);
-                // convert regex string to ogc string
-                this.writeNode("Literal", filter.regex2value(), node);
-                return node;
-            },
-            "BBOX": function(filter) {
-                var node = this.createElementNSPlus("ogc:BBOX");
-                // PropertyName is mandatory in 1.0.0, but e.g. GeoServer also
-                // accepts filters without it. When this is used with
-                // OpenLayers.Protocol.WFS, OpenLayers.Format.WFST will set a
-                // missing filter.property to the geometryName that is
-                // configured with the protocol, which defaults to "the_geom".
-                // So the only way to omit this mandatory property is to not
-                // set the property on the filter and to set the geometryName
-                // on the WFS protocol to null. The latter also happens when
-                // the protocol is configured without a geometryName and a
-                // featureNS.
-                filter.property && this.writeNode("PropertyName", filter, node);
-                var box = this.writeNode("gml:Box", filter.value, node);
-                if(filter.projection) {
-                    box.setAttribute("srsName", filter.projection);
-                }
-                return node;
-            }
-        }, OpenLayers.Format.Filter.v1.prototype.writers["ogc"]),
-        "gml": OpenLayers.Format.GML.v2.prototype.writers["gml"],
-        "feature": OpenLayers.Format.GML.v2.prototype.writers["feature"]
+    display: function(display) {
+        if (display != (this.div.style.display != "none")) {
+            this.div.style.display = (display && this.calculateInRange()) ? "block" : "none";
+        }
     },
 
     /**
     },
 
     /**
-     * Method: writeSpatial
-     *
-     * Read a {<OpenLayers.Filter.Spatial>} filter and converts it into XML.
-     *
-     * Parameters:
-     * filter - {<OpenLayers.Filter.Spatial>} The filter.
-     * name - {String} Name of the generated XML element.
-     *
+     * APIMethod: calculateInRange
+     * 
      * Returns:
      * Returns:
-     * {DOMElement} The created XML element.
+     * {Boolean} The layer is displayable at the current map's current
+     *     resolution. Note that if 'alwaysInRange' is true for the layer, 
+     *     this function will always return true.
      */
      */
-    writeSpatial: function(filter, name) {
-        var node = this.createElementNSPlus("ogc:"+name);
-        this.writeNode("PropertyName", filter, node);
-        if(filter.value instanceof OpenLayers.Filter.Function) {
-            this.writeNode("Function", filter.value, node);
-        } else {
-        var child;
-        if(filter.value instanceof OpenLayers.Geometry) {
-            child = this.writeNode("feature:_geometry", filter.value).firstChild;
+    calculateInRange: function() {
+        var inRange = false;
+
+        if (this.alwaysInRange) {
+            inRange = true;
         } else {
         } else {
-            child = this.writeNode("gml:Box", filter.value);
-        }
-        if(filter.projection) {
-            child.setAttribute("srsName", filter.projection);
+            if (this.map) {
+                var resolution = this.map.getResolution();
+                inRange = ( (resolution >= this.minResolution) &&
+                            (resolution <= this.maxResolution) );
+            }
         }
         }
-        node.appendChild(child);
+        return inRange;
+    },
+
+    /** 
+     * APIMethod: setIsBaseLayer
+     * 
+     * Parameters:
+     * isBaseLayer - {Boolean}
+     */
+    setIsBaseLayer: function(isBaseLayer) {
+        if (isBaseLayer != this.isBaseLayer) {
+            this.isBaseLayer = isBaseLayer;
+            if (this.map != null) {
+                this.map.events.triggerEvent("changebaselayer", {
+                    layer: this
+                });
+            }
         }
         }
-        return node;
     },
 
     },
 
+  /********************************************************/
+  /*                                                      */
+  /*                 Baselayer Functions                  */
+  /*                                                      */
+  /********************************************************/
+  
+    /** 
+     * Method: initResolutions
+     * This method's responsibility is to set up the 'resolutions' array 
+     *     for the layer -- this array is what the layer will use to interface
+     *     between the zoom levels of the map and the resolution display 
+     *     of the layer.
+     * 
+     * The user has several options that determine how the array is set up.
+     *  
+     * For a detailed explanation, see the following wiki from the 
+     *     openlayers.org homepage:
+     *     http://trac.openlayers.org/wiki/SettingZoomLevels
+     */
+    initResolutions: function() {
 
 
-    CLASS_NAME: "OpenLayers.Format.Filter.v1_0_0" 
+        // ok we want resolutions, here's our strategy:
+        //
+        // 1. if resolutions are defined in the layer config, use them
+        // 2. else, if scales are defined in the layer config then derive
+        //    resolutions from these scales
+        // 3. else, attempt to calculate resolutions from maxResolution,
+        //    minResolution, numZoomLevels, maxZoomLevel set in the
+        //    layer config
+        // 4. if we still don't have resolutions, and if resolutions
+        //    are defined in the same, use them
+        // 5. else, if scales are defined in the map then derive
+        //    resolutions from these scales
+        // 6. else, attempt to calculate resolutions from maxResolution,
+        //    minResolution, numZoomLevels, maxZoomLevel set in the
+        //    map
+        // 7. hope for the best!
 
 
-});
-/* ======================================================================
-    OpenLayers/Format/WFST/v1_0_0.js
-   ====================================================================== */
+        var i, len, p;
+        var props = {}, alwaysInRange = true;
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
+        // get resolution data from layer config
+        // (we also set alwaysInRange in the layer as appropriate)
+        for(i=0, len=this.RESOLUTION_PROPERTIES.length; i<len; i++) {
+            p = this.RESOLUTION_PROPERTIES[i];
+            props[p] = this.options[p];
+            if(alwaysInRange && this.options[p]) {
+                alwaysInRange = false;
+            }
+        }
+        if(this.options.alwaysInRange == null) {
+            this.alwaysInRange = alwaysInRange;
+        }
 
 
-/**
- * @requires OpenLayers/Format/WFST/v1.js
- * @requires OpenLayers/Format/Filter/v1_0_0.js
- */
+        // if we don't have resolutions then attempt to derive them from scales
+        if(props.resolutions == null) {
+            props.resolutions = this.resolutionsFromScales(props.scales);
+        }
 
 
-/**
- * Class: OpenLayers.Format.WFST.v1_0_0
- * A format for creating WFS v1.0.0 transactions.  Create a new instance with the
- *     <OpenLayers.Format.WFST.v1_0_0> constructor.
- *
- * Inherits from:
- *  - <OpenLayers.Format.Filter.v1_0_0>
- *  - <OpenLayers.Format.WFST.v1>
- */
-OpenLayers.Format.WFST.v1_0_0 = OpenLayers.Class(
-    OpenLayers.Format.Filter.v1_0_0, OpenLayers.Format.WFST.v1, {
-    
-    /**
-     * Property: version
-     * {String} WFS version number.
-     */
-    version: "1.0.0",
+        // if we still don't have resolutions then attempt to calculate them
+        if(props.resolutions == null) {
+            props.resolutions = this.calculateResolutions(props);
+        }
 
 
-    /**
-     * APIProperty: srsNameInQuery
-     * {Boolean} If true the reference system is passed in Query requests
-     *     via the "srsName" attribute to the "wfs:Query" element, this
-     *     property defaults to false as it isn't WFS 1.0.0 compliant.
-     */
-    srsNameInQuery: false,
-    
-    /**
-     * Property: schemaLocations
-     * {Object} Properties are namespace aliases, values are schema locations.
-     */
-    schemaLocations: {
-        "wfs": "http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"
+        // if we couldn't calculate resolutions then we look at we have
+        // in the map
+        if(props.resolutions == null) {
+            for(i=0, len=this.RESOLUTION_PROPERTIES.length; i<len; i++) {
+                p = this.RESOLUTION_PROPERTIES[i];
+                props[p] = this.options[p] != null ?
+                    this.options[p] : this.map[p];
+            }
+            if(props.resolutions == null) {
+                props.resolutions = this.resolutionsFromScales(props.scales);
+            }
+            if(props.resolutions == null) {
+                props.resolutions = this.calculateResolutions(props);
+            }
+        }
+
+        // ok, we new need to set properties in the instance
+
+        // get maxResolution from the config if it's defined there
+        var maxResolution;
+        if(this.options.maxResolution &&
+           this.options.maxResolution !== "auto") {
+            maxResolution = this.options.maxResolution;
+        }
+        if(this.options.minScale) {
+            maxResolution = OpenLayers.Util.getResolutionFromScale(
+                this.options.minScale, this.units);
+        }
+
+        // get minResolution from the config if it's defined there
+        var minResolution;
+        if(this.options.minResolution &&
+           this.options.minResolution !== "auto") {
+            minResolution = this.options.minResolution;
+        }
+        if(this.options.maxScale) {
+            minResolution = OpenLayers.Util.getResolutionFromScale(
+                this.options.maxScale, this.units);
+        }
+
+        if(props.resolutions) {
+
+            //sort resolutions array descendingly
+            props.resolutions.sort(function(a, b) {
+                return (b - a);
+            });
+
+            // if we still don't have a maxResolution get it from the
+            // resolutions array
+            if(!maxResolution) {
+                maxResolution = props.resolutions[0];
+            }
+
+            // if we still don't have a minResolution get it from the
+            // resolutions array
+            if(!minResolution) {
+                var lastIdx = props.resolutions.length - 1;
+                minResolution = props.resolutions[lastIdx];
+            }
+        }
+
+        this.resolutions = props.resolutions;
+        if(this.resolutions) {
+            len = this.resolutions.length;
+            this.scales = new Array(len);
+            for(i=0; i<len; i++) {
+                this.scales[i] = OpenLayers.Util.getScaleFromResolution(
+                    this.resolutions[i], this.units);
+            }
+            this.numZoomLevels = len;
+        }
+        this.minResolution = minResolution;
+        if(minResolution) {
+            this.maxScale = OpenLayers.Util.getScaleFromResolution(
+                minResolution, this.units);
+        }
+        this.maxResolution = maxResolution;
+        if(maxResolution) {
+            this.minScale = OpenLayers.Util.getScaleFromResolution(
+                maxResolution, this.units);
+        }
     },
 
     /**
     },
 
     /**
-     * Constructor: OpenLayers.Format.WFST.v1_0_0
-     * A class for parsing and generating WFS v1.0.0 transactions.
+     * Method: resolutionsFromScales
+     * Derive resolutions from scales.
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} Optional object whose properties will be set on the
-     *     instance.
+     * scales - {Array(Number)} Scales
      *
      *
-     * Valid options properties:
-     * featureType - {String} Local (without prefix) feature typeName (required).
-     * featureNS - {String} Feature namespace (optional).
-     * featurePrefix - {String} Feature namespace alias (optional - only used
-     *     if featureNS is provided).  Default is 'feature'.
-     * geometryName - {String} Name of geometry attribute.  Default is 'the_geom'.
+     * Returns
+     * {Array(Number)} Resolutions
      */
      */
-    initialize: function(options) {
-        OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this, [options]);
-        OpenLayers.Format.WFST.v1.prototype.initialize.apply(this, [options]);
+    resolutionsFromScales: function(scales) {
+        if(scales == null) {
+            return;
+        }
+        var resolutions, i, len;
+        len = scales.length;
+        resolutions = new Array(len);
+        for(i=0; i<len; i++) {
+            resolutions[i] = OpenLayers.Util.getResolutionFromScale(
+                scales[i], this.units);
+        }
+        return resolutions;
     },
     },
-    
+
     /**
     /**
-     * Method: readNode
-     * Shorthand for applying one of the named readers given the node
-     *     namespace and local name.  Readers take two args (node, obj) and
-     *     generally extend or modify the second.
+     * Method: calculateResolutions
+     * Calculate resolutions based on the provided properties.
      *
      * Parameters:
      *
      * Parameters:
-     * node - {DOMElement} The node to be read (required).
-     * obj - {Object} The object to be modified (optional).
-     * first - {Boolean} Should be set to true for the first node read. This
-     *     is usually the readNode call in the read method. Without this being
-     *     set, auto-configured properties will stick on subsequent reads.
+     * props - {Object} Properties
      *
      * Returns:
      *
      * Returns:
-     * {Object} The input object, modified (or a new one if none was provided).
-     */
-    readNode: function(node, obj, first) {
-        // Not the superclass, only the mixin classes inherit from
-        // Format.GML.v2. We need this because we don't want to get readNode
-        // from the superclass's superclass, which is OpenLayers.Format.XML.
-        return OpenLayers.Format.GML.v2.prototype.readNode.apply(this, arguments);
-    },
-    
-    /**
-     * Property: readers
-     * Contains public functions, grouped by namespace prefix, that will
-     *     be applied when a namespaced node is found matching the function
-     *     name.  The function will be applied in the scope of this parser
-     *     with two arguments: the node being read and a context object passed
-     *     from the parent.
+     * {Array({Number})} Array of resolutions.
      */
      */
-    readers: {
-        "wfs": OpenLayers.Util.applyDefaults({
-            "WFS_TransactionResponse": function(node, obj) {
-                obj.insertIds = [];
-                obj.success = false;
-                this.readChildNodes(node, obj);
-            },
-            "InsertResult": function(node, container) {
-                var obj = {fids: []};
-                this.readChildNodes(node, obj);
-                container.insertIds = container.insertIds.concat(obj.fids);
-            },
-            "TransactionResult": function(node, obj) {
-                this.readChildNodes(node, obj);
-            },
-            "Status": function(node, obj) {
-                this.readChildNodes(node, obj);
-            },
-            "SUCCESS": function(node, obj) {
-                obj.success = true;
-            }
-        }, OpenLayers.Format.WFST.v1.prototype.readers["wfs"]),
-        "gml": OpenLayers.Format.GML.v2.prototype.readers["gml"],
-        "feature": OpenLayers.Format.GML.v2.prototype.readers["feature"],
-        "ogc": OpenLayers.Format.Filter.v1_0_0.prototype.readers["ogc"]
-    },
+    calculateResolutions: function(props) {
 
 
-    /**
-     * Property: writers
-     * As a compliment to the readers property, this structure contains public
-     *     writing functions grouped by namespace alias and named like the
-     *     node names they produce.
-     */
-    writers: {
-        "wfs": OpenLayers.Util.applyDefaults({
-            "Query": function(options) {
-                options = OpenLayers.Util.extend({
-                    featureNS: this.featureNS,
-                    featurePrefix: this.featurePrefix,
-                    featureType: this.featureType,
-                    srsName: this.srsName,
-                    srsNameInQuery: this.srsNameInQuery
-                }, options);
-                var prefix = options.featurePrefix;
-                var node = this.createElementNSPlus("wfs:Query", {
-                    attributes: {
-                        typeName: (prefix ? prefix + ":" : "") +
-                            options.featureType
-                    }
-                });
-                if(options.srsNameInQuery && options.srsName) {
-                    node.setAttribute("srsName", options.srsName);
-                }
-                if(options.featureNS) {
-                    node.setAttribute("xmlns:" + prefix, options.featureNS);
-                }
-                if(options.propertyNames) {
-                    for(var i=0,len = options.propertyNames.length; i<len; i++) {
-                        this.writeNode(
-                            "ogc:PropertyName", 
-                            {property: options.propertyNames[i]},
-                            node
-                        );
-                    }
-                }
-                if(options.filter) {
-                    this.setFilterProperty(options.filter);
-                    this.writeNode("ogc:Filter", options.filter, node);
-                }
-                return node;
-            }
-        }, OpenLayers.Format.WFST.v1.prototype.writers["wfs"]),
-        "gml": OpenLayers.Format.GML.v2.prototype.writers["gml"],
-        "feature": OpenLayers.Format.GML.v2.prototype.writers["feature"],
-        "ogc": OpenLayers.Format.Filter.v1_0_0.prototype.writers["ogc"]
-    },
-   
-    CLASS_NAME: "OpenLayers.Format.WFST.v1_0_0" 
-});
-/* ======================================================================
-    OpenLayers/Renderer/Elements.js
-   ====================================================================== */
+        var viewSize, wRes, hRes;
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
+        // determine maxResolution
+        var maxResolution = props.maxResolution;
+        if(props.minScale != null) {
+            maxResolution =
+                OpenLayers.Util.getResolutionFromScale(props.minScale,
+                                                       this.units);
+        } else if(maxResolution == "auto" && this.maxExtent != null) {
+            viewSize = this.map.getSize();
+            wRes = this.maxExtent.getWidth() / viewSize.w;
+            hRes = this.maxExtent.getHeight() / viewSize.h;
+            maxResolution = Math.max(wRes, hRes);
+        }
 
 
-/**
- * @requires OpenLayers/Renderer.js
- */
+        // determine minResolution
+        var minResolution = props.minResolution;
+        if(props.maxScale != null) {
+            minResolution =
+                OpenLayers.Util.getResolutionFromScale(props.maxScale,
+                                                       this.units);
+        } else if(props.minResolution == "auto" && this.minExtent != null) {
+            viewSize = this.map.getSize();
+            wRes = this.minExtent.getWidth() / viewSize.w;
+            hRes = this.minExtent.getHeight()/ viewSize.h;
+            minResolution = Math.max(wRes, hRes);
+        }
 
 
-/**
- * Class: OpenLayers.ElementsIndexer
- * This class takes care of figuring out which order elements should be
- *     placed in the DOM based on given indexing methods. 
- */
-OpenLayers.ElementsIndexer = OpenLayers.Class({
-   
-    /**
-     * Property: maxZIndex
-     * {Integer} This is the largest-most z-index value for a node
-     *     contained within the indexer.
-     */
-    maxZIndex: null,
-    
-    /**
-     * Property: order
-     * {Array<String>} This is an array of node id's stored in the
-     *     order that they should show up on screen. Id's higher up in the
-     *     array (higher array index) represent nodes with higher z-indeces.
-     */
-    order: null, 
-    
-    /**
-     * Property: indices
-     * {Object} This is a hash that maps node ids to their z-index value
-     *     stored in the indexer. This is done to make finding a nodes z-index 
-     *     value O(1).
-     */
-    indices: null,
-    
-    /**
-     * Property: compare
-     * {Function} This is the function used to determine placement of
-     *     of a new node within the indexer. If null, this defaults to to
-     *     the Z_ORDER_DRAWING_ORDER comparison method.
-     */
-    compare: null,
-    
-    /**
-     * APIMethod: initialize
-     * Create a new indexer with 
-     * 
-     * Parameters:
-     * yOrdering - {Boolean} Whether to use y-ordering.
-     */
-    initialize: function(yOrdering) {
+        if(typeof maxResolution !== "number" &&
+           typeof minResolution !== "number" &&
+           this.maxExtent != null) {
+            // maxResolution for default grid sets assumes that at zoom
+            // level zero, the whole world fits on one tile.
+            var tileSize = this.map.getTileSize();
+            maxResolution = Math.max(
+                this.maxExtent.getWidth() / tileSize.w,
+                this.maxExtent.getHeight() / tileSize.h
+            );
+        }
 
 
-        this.compare = yOrdering ? 
-            OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER :
-            OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;
+        // determine numZoomLevels
+        var maxZoomLevel = props.maxZoomLevel;
+        var numZoomLevels = props.numZoomLevels;
+        if(typeof minResolution === "number" &&
+           typeof maxResolution === "number" && numZoomLevels === undefined) {
+            var ratio = maxResolution / minResolution;
+            numZoomLevels = Math.floor(Math.log(ratio) / Math.log(2)) + 1;
+        } else if(numZoomLevels === undefined && maxZoomLevel != null) {
+            numZoomLevels = maxZoomLevel + 1;
+        }
 
 
-        this.clear();
+        // are we able to calculate resolutions?
+        if(typeof numZoomLevels !== "number" || numZoomLevels <= 0 ||
+           (typeof maxResolution !== "number" &&
+                typeof minResolution !== "number")) {
+            return;
+        }
+
+        // now we have numZoomLevels and at least one of maxResolution
+        // or minResolution, we can populate the resolutions array
+
+        var resolutions = new Array(numZoomLevels);
+        var base = 2;
+        if(typeof minResolution == "number" &&
+           typeof maxResolution == "number") {
+            // if maxResolution and minResolution are set, we calculate
+            // the base for exponential scaling that starts at
+            // maxResolution and ends at minResolution in numZoomLevels
+            // steps.
+            base = Math.pow(
+                    (maxResolution / minResolution),
+                (1 / (numZoomLevels - 1))
+            );
+        }
+
+        var i;
+        if(typeof maxResolution === "number") {
+            for(i=0; i<numZoomLevels; i++) {
+                resolutions[i] = maxResolution / Math.pow(base, i);
+            }
+        } else {
+            for(i=0; i<numZoomLevels; i++) {
+                resolutions[numZoomLevels - 1 - i] =
+                    minResolution * Math.pow(base, i);
+            }
+        }
+
+        return resolutions;
     },
     },
-    
+
     /**
     /**
-     * APIMethod: insert
-     * Insert a new node into the indexer. In order to find the correct 
-     *     positioning for the node to be inserted, this method uses a binary 
-     *     search. This makes inserting O(log(n)). 
-     * 
-     * Parameters:
-     * newNode - {DOMElement} The new node to be inserted.
+     * APIMethod: getResolution
      * 
      * 
-     * Returns
-     * {DOMElement} the node before which we should insert our newNode, or
-     *     null if newNode can just be appended.
+     * Returns:
+     * {Float} The currently selected resolution of the map, taken from the
+     *     resolutions array, indexed by current zoom level.
      */
      */
-    insert: function(newNode) {
-        // If the node is known to the indexer, remove it so we can
-        // recalculate where it should go.
-        if (this.exists(newNode)) {
-            this.remove(newNode);
-        }
-        
-        var nodeId = newNode.id;
-        
-        this.determineZIndex(newNode);       
-
-        var leftIndex = -1;
-        var rightIndex = this.order.length;
-        var middle;
+    getResolution: function() {
+        var zoom = this.map.getZoom();
+        return this.getResolutionForZoom(zoom);
+    },
 
 
-        while (rightIndex - leftIndex > 1) {
-            middle = parseInt((leftIndex + rightIndex) / 2);
-            
-            var placement = this.compare(this, newNode,
-                OpenLayers.Util.getElement(this.order[middle]));
-            
-            if (placement > 0) {
-                leftIndex = middle;
-            } else {
-                rightIndex = middle;
-            } 
-        }
-        
-        this.order.splice(rightIndex, 0, nodeId);
-        this.indices[nodeId] = this.getZIndex(newNode);
-        
-        // If the new node should be before another in the index
-        // order, return the node before which we have to insert the new one;
-        // else, return null to indicate that the new node can be appended.
-        return this.getNextElement(rightIndex);
+    /** 
+     * APIMethod: getExtent
+     * 
+     * Returns:
+     * {<OpenLayers.Bounds>} A Bounds object which represents the lon/lat 
+     *     bounds of the current viewPort.
+     */
+    getExtent: function() {
+        // just use stock map calculateBounds function -- passing no arguments
+        //  means it will user map's current center & resolution
+        //
+        return this.map.calculateBounds();
     },
     },
-    
+
     /**
     /**
-     * APIMethod: remove
+     * APIMethod: getZoomForExtent
      * 
      * Parameters:
      * 
      * Parameters:
-     * node - {DOMElement} The node to be removed.
+     * extent - {<OpenLayers.Bounds>}
+     * closest - {Boolean} Find the zoom level that most closely fits the 
+     *     specified bounds. Note that this may result in a zoom that does 
+     *     not exactly contain the entire extent.
+     *     Default is false.
+     *
+     * Returns:
+     * {Integer} The index of the zoomLevel (entry in the resolutions array) 
+     *     for the passed-in extent. We do this by calculating the ideal 
+     *     resolution for the given extent (based on the map size) and then 
+     *     calling getZoomForResolution(), passing along the 'closest'
+     *     parameter.
      */
      */
-    remove: function(node) {
-        var nodeId = node.id;
-        var arrayIndex = OpenLayers.Util.indexOf(this.order, nodeId);
-        if (arrayIndex >= 0) {
-            // Remove it from the order array, as well as deleting the node
-            // from the indeces hash.
-            this.order.splice(arrayIndex, 1);
-            delete this.indices[nodeId];
-            
-            // Reset the maxium z-index based on the last item in the 
-            // order array.
-            if (this.order.length > 0) {
-                var lastId = this.order[this.order.length - 1];
-                this.maxZIndex = this.indices[lastId];
-            } else {
-                this.maxZIndex = 0;
-            }
-        }
+    getZoomForExtent: function(extent, closest) {
+        var viewSize = this.map.getSize();
+        var idealResolution = Math.max( extent.getWidth()  / viewSize.w,
+                                        extent.getHeight() / viewSize.h );
+
+        return this.getZoomForResolution(idealResolution, closest);
     },
     
     },
     
-    /**
-     * APIMethod: clear
+    /** 
+     * Method: getDataExtent
+     * Calculates the max extent which includes all of the data for the layer.
+     *     This function is to be implemented by subclasses.
+     * 
+     * Returns:
+     * {<OpenLayers.Bounds>}
      */
      */
-    clear: function() {
-        this.order = [];
-        this.indices = {};
-        this.maxZIndex = 0;
+    getDataExtent: function () {
+        //to be implemented by subclasses
     },
     },
-    
+
     /**
     /**
-     * APIMethod: exists
-     *
+     * APIMethod: getResolutionForZoom
+     * 
      * Parameters:
      * Parameters:
-     * node - {DOMElement} The node to test for existence.
-     *
+     * zoom - {Float}
+     * 
      * Returns:
      * Returns:
-     * {Boolean} Whether or not the node exists in the indexer?
+     * {Float} A suitable resolution for the specified zoom.
      */
      */
-    exists: function(node) {
-        return (this.indices[node.id] != null);
+    getResolutionForZoom: function(zoom) {
+        zoom = Math.max(0, Math.min(zoom, this.resolutions.length - 1));
+        var resolution;
+        if(this.map.fractionalZoom) {
+            var low = Math.floor(zoom);
+            var high = Math.ceil(zoom);
+            resolution = this.resolutions[low] -
+                ((zoom-low) * (this.resolutions[low]-this.resolutions[high]));
+        } else {
+            resolution = this.resolutions[Math.round(zoom)];
+        }
+        return resolution;
     },
 
     /**
     },
 
     /**
-     * APIMethod: getZIndex
-     * Get the z-index value for the current node from the node data itself.
+     * APIMethod: getZoomForResolution
      * 
      * Parameters:
      * 
      * Parameters:
-     * node - {DOMElement} The node whose z-index to get.
+     * resolution - {Float}
+     * closest - {Boolean} Find the zoom level that corresponds to the absolute 
+     *     closest resolution, which may result in a zoom whose corresponding
+     *     resolution is actually smaller than we would have desired (if this
+     *     is being called from a getZoomForExtent() call, then this means that
+     *     the returned zoom index might not actually contain the entire 
+     *     extent specified... but it'll be close).
+     *     Default is false.
      * 
      * Returns:
      * 
      * Returns:
-     * {Integer} The z-index value for the specified node (from the node 
-     *     data itself).
+     * {Integer} The index of the zoomLevel (entry in the resolutions array) 
+     *     that corresponds to the best fit resolution given the passed in 
+     *     value and the 'closest' specification.
      */
      */
-    getZIndex: function(node) {
-        return node._style.graphicZIndex;  
+    getZoomForResolution: function(resolution, closest) {
+        var zoom, i, len;
+        if(this.map.fractionalZoom) {
+            var lowZoom = 0;
+            var highZoom = this.resolutions.length - 1;
+            var highRes = this.resolutions[lowZoom];
+            var lowRes = this.resolutions[highZoom];
+            var res;
+            for(i=0, len=this.resolutions.length; i<len; ++i) {
+                res = this.resolutions[i];
+                if(res >= resolution) {
+                    highRes = res;
+                    lowZoom = i;
+                }
+                if(res <= resolution) {
+                    lowRes = res;
+                    highZoom = i;
+                    break;
+                }
+            }
+            var dRes = highRes - lowRes;
+            if(dRes > 0) {
+                zoom = lowZoom + ((highRes - resolution) / dRes);
+            } else {
+                zoom = lowZoom;
+            }
+        } else {
+            var diff;
+            var minDiff = Number.POSITIVE_INFINITY;
+            for(i=0, len=this.resolutions.length; i<len; i++) {            
+                if (closest) {
+                    diff = Math.abs(this.resolutions[i] - resolution);
+                    if (diff > minDiff) {
+                        break;
+                    }
+                    minDiff = diff;
+                } else {
+                    if (this.resolutions[i] < resolution) {
+                        break;
+                    }
+                }
+            }
+            zoom = Math.max(0, i-1);
+        }
+        return zoom;
     },
     
     /**
     },
     
     /**
-     * Method: determineZIndex
-     * Determine the z-index for the current node if there isn't one, 
-     *     and set the maximum value if we've found a new maximum.
+     * APIMethod: getLonLatFromViewPortPx
      * 
      * Parameters:
      * 
      * Parameters:
-     * node - {DOMElement} 
-     */
-    determineZIndex: function(node) {
-        var zIndex = node._style.graphicZIndex;
-        
-        // Everything must have a zIndex. If none is specified,
-        // this means the user *must* (hint: assumption) want this
-        // node to succomb to drawing order. To enforce drawing order
-        // over all indexing methods, we'll create a new z-index that's
-        // greater than any currently in the indexer.
-        if (zIndex == null) {
-            zIndex = this.maxZIndex;
-            node._style.graphicZIndex = zIndex; 
-        } else if (zIndex > this.maxZIndex) {
-            this.maxZIndex = zIndex;
+     * viewPortPx - {<OpenLayers.Pixel>|Object} An OpenLayers.Pixel or
+     *                                          an object with a 'x'
+     *                                          and 'y' properties.
+     *
+     * Returns:
+     * {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in 
+     *     view port <OpenLayers.Pixel>, translated into lon/lat by the layer.
+     */
+    getLonLatFromViewPortPx: function (viewPortPx) {
+        var lonlat = null;
+        var map = this.map;
+        if (viewPortPx != null && map.minPx) {
+            var res = map.getResolution();
+            var maxExtent = map.getMaxExtent({restricted: true});
+            var lon = (viewPortPx.x - map.minPx.x) * res + maxExtent.left;
+            var lat = (map.minPx.y - viewPortPx.y) * res + maxExtent.top;
+            lonlat = new OpenLayers.LonLat(lon, lat);
+
+            if (this.wrapDateLine) {
+                lonlat = lonlat.wrapDateLine(this.maxExtent);
+            }
         }
         }
+        return lonlat;
     },
 
     /**
     },
 
     /**
-     * APIMethod: getNextElement
-     * Get the next element in the order stack.
+     * APIMethod: getViewPortPxFromLonLat
+     * Returns a pixel location given a map location.  This method will return
+     *     fractional pixel values.
      * 
      * Parameters:
      * 
      * Parameters:
-     * index - {Integer} The index of the current node in this.order.
-     * 
-     * Returns:
-     * {DOMElement} the node following the index passed in, or
-     *     null.
+     * lonlat - {<OpenLayers.LonLat>|Object} An OpenLayers.LonLat or
+     *                                       an object with a 'lon'
+     *                                       and 'lat' properties.
+     *
+     * Returns: 
+     * {<OpenLayers.Pixel>} An <OpenLayers.Pixel> which is the passed-in 
+     *     lonlat translated into view port pixels.
      */
      */
-    getNextElement: function(index) {
-        var nextIndex = index + 1;
-        if (nextIndex < this.order.length) {
-            var nextElement = OpenLayers.Util.getElement(this.order[nextIndex]);
-            if (nextElement == undefined) {
-                nextElement = this.getNextElement(nextIndex);
-            }
-            return nextElement;
-        } else {
-            return null;
-        } 
+    getViewPortPxFromLonLat: function (lonlat, resolution) {
+        var px = null; 
+        if (lonlat != null) {
+            resolution = resolution || this.map.getResolution();
+            var extent = this.map.calculateBounds(null, resolution);
+            px = new OpenLayers.Pixel(
+                (1/resolution * (lonlat.lon - extent.left)),
+                (1/resolution * (extent.top - lonlat.lat))
+            );    
+        }
+        return px;
     },
     
     },
     
-    CLASS_NAME: "OpenLayers.ElementsIndexer"
-});
-
-/**
- * Namespace: OpenLayers.ElementsIndexer.IndexingMethods
- * These are the compare methods for figuring out where a new node should be 
- *     placed within the indexer. These methods are very similar to general 
- *     sorting methods in that they return -1, 0, and 1 to specify the 
- *     direction in which new nodes fall in the ordering.
- */
-OpenLayers.ElementsIndexer.IndexingMethods = {
-    
     /**
     /**
-     * Method: Z_ORDER
-     * This compare method is used by other comparison methods.
-     *     It can be used individually for ordering, but is not recommended,
-     *     because it doesn't subscribe to drawing order.
+     * APIMethod: setOpacity
+     * Sets the opacity for the entire layer (all images)
      * 
      * Parameters:
      * 
      * Parameters:
-     * indexer - {<OpenLayers.ElementsIndexer>}
-     * newNode - {DOMElement}
-     * nextNode - {DOMElement}
-     * 
-     * Returns:
-     * {Integer}
+     * opacity - {Float}
      */
      */
-    Z_ORDER: function(indexer, newNode, nextNode) {
-        var newZIndex = indexer.getZIndex(newNode);
-
-        var returnVal = 0;
-        if (nextNode) {
-            var nextZIndex = indexer.getZIndex(nextNode);
-            returnVal = newZIndex - nextZIndex; 
+    setOpacity: function(opacity) {
+        if (opacity != this.opacity) {
+            this.opacity = opacity;
+            var childNodes = this.div.childNodes;
+            for(var i = 0, len = childNodes.length; i < len; ++i) {
+                var element = childNodes[i].firstChild || childNodes[i];
+                var lastChild = childNodes[i].lastChild;
+                //TODO de-uglify this
+                if (lastChild && lastChild.nodeName.toLowerCase() === "iframe") {
+                    element = lastChild.parentNode;
+                }
+                OpenLayers.Util.modifyDOMElement(element, null, null, null, 
+                                                 null, null, null, opacity);
+            }
+            if (this.map != null) {
+                this.map.events.triggerEvent("changelayer", {
+                    layer: this,
+                    property: "opacity"
+                });
+            }
         }
         }
-        
-        return returnVal;
     },
 
     /**
     },
 
     /**
-     * APIMethod: Z_ORDER_DRAWING_ORDER
-     * This method orders nodes by their z-index, but does so in a way
-     *     that, if there are other nodes with the same z-index, the newest 
-     *     drawn will be the front most within that z-index. This is the 
-     *     default indexing method.
+     * Method: getZIndex
      * 
      * 
-     * Parameters:
-     * indexer - {<OpenLayers.ElementsIndexer>}
-     * newNode - {DOMElement}
-     * nextNode - {DOMElement}
+     * Returns: 
+     * {Integer} the z-index of this layer
+     */    
+    getZIndex: function () {
+        return this.div.style.zIndex;
+    },
+
+    /**
+     * Method: setZIndex
      * 
      * 
-     * Returns:
-     * {Integer}
-     */
-    Z_ORDER_DRAWING_ORDER: function(indexer, newNode, nextNode) {
-        var returnVal = OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(
-            indexer, 
-            newNode, 
-            nextNode
-        );
-        
-        // Make Z_ORDER subscribe to drawing order by pushing it above
-        // all of the other nodes with the same z-index.
-        if (nextNode && returnVal == 0) {
-            returnVal = 1;
-        }
-        
-        return returnVal;
+     * Parameters: 
+     * zIndex - {Integer}
+     */    
+    setZIndex: function (zIndex) {
+        this.div.style.zIndex = zIndex;
     },
 
     /**
     },
 
     /**
-     * APIMethod: Z_ORDER_Y_ORDER
-     * This one should really be called Z_ORDER_Y_ORDER_DRAWING_ORDER, as it
-     *     best describes which ordering methods have precedence (though, the 
-     *     name would be too long). This method orders nodes by their z-index, 
-     *     but does so in a way that, if there are other nodes with the same 
-     *     z-index, the nodes with the lower y position will be "closer" than 
-     *     those with a higher y position. If two nodes have the exact same y 
-     *     position, however, then this method will revert to using drawing  
-     *     order to decide placement.
+     * Method: adjustBounds
+     * This function will take a bounds, and if wrapDateLine option is set
+     *     on the layer, it will return a bounds which is wrapped around the 
+     *     world. We do not wrap for bounds which *cross* the 
+     *     maxExtent.left/right, only bounds which are entirely to the left 
+     *     or entirely to the right.
      * 
      * Parameters:
      * 
      * Parameters:
-     * indexer - {<OpenLayers.ElementsIndexer>}
-     * newNode - {DOMElement}
-     * nextNode - {DOMElement}
-     * 
-     * Returns:
-     * {Integer}
+     * bounds - {<OpenLayers.Bounds>}
      */
      */
-    Z_ORDER_Y_ORDER: function(indexer, newNode, nextNode) {
-        var returnVal = OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(
-            indexer, 
-            newNode, 
-            nextNode
-        );
-        
-        if (nextNode && returnVal === 0) {            
-            var result = nextNode._boundsBottom - newNode._boundsBottom;
-            returnVal = (result === 0) ? 1 : result;
+    adjustBounds: function (bounds) {
+
+        if (this.gutter) {
+            // Adjust the extent of a bounds in map units by the 
+            // layer's gutter in pixels.
+            var mapGutter = this.gutter * this.map.getResolution();
+            bounds = new OpenLayers.Bounds(bounds.left - mapGutter,
+                                           bounds.bottom - mapGutter,
+                                           bounds.right + mapGutter,
+                                           bounds.top + mapGutter);
         }
         }
-        
-        return returnVal;       
-    }
-};
+
+        if (this.wrapDateLine) {
+            // wrap around the date line, within the limits of rounding error
+            var wrappingOptions = { 
+                'rightTolerance':this.getResolution(),
+                'leftTolerance':this.getResolution()
+            };    
+            bounds = bounds.wrapDateLine(this.maxExtent, wrappingOptions);
+                              
+        }
+        return bounds;
+    },
+
+    CLASS_NAME: "OpenLayers.Layer"
+});
+/* ======================================================================
+    OpenLayers/Renderer.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
 
 /**
 
 /**
- * Class: OpenLayers.Renderer.Elements
- * This is another virtual class in that it should never be instantiated by 
- *  itself as a Renderer. It exists because there is *tons* of shared 
- *  functionality between different vector libraries which use nodes/elements
- *  as a base for rendering vectors. 
+ * @requires OpenLayers/BaseTypes/Class.js
+ */
+
+/**
+ * Class: OpenLayers.Renderer 
+ * This is the base class for all renderers.
+ *
+ * This is based on a merger code written by Paul Spencer and Bertil Chapuis.
+ * It is largely composed of virtual functions that are to be implemented
+ * in technology-specific subclasses, but there is some generic code too.
  * 
  * 
- * The highlevel bits of code that are implemented here are the adding and 
- *  removing of geometries, which is essentially the same for any 
- *  element-based renderer. The details of creating each node and drawing the
- *  paths are of course different, but the machinery is the same. 
+ * The functions that *are* implemented here merely deal with the maintenance
+ *  of the size and extent variables, as well as the cached 'resolution' 
+ *  value. 
  * 
  * 
- * Inherits:
- *  - <OpenLayers.Renderer>
+ * A note to the user that all subclasses should use getResolution() instead
+ *  of directly accessing this.resolution in order to correctly use the 
+ *  cacheing system.
+ *
  */
  */
-OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, {
+OpenLayers.Renderer = OpenLayers.Class({
 
 
-    /**
-     * Property: rendererRoot
-     * {DOMElement}
+    /** 
+     * Property: container
+     * {DOMElement} 
      */
      */
-    rendererRoot: null,
+    container: null,
     
     /**
      * Property: root
      * {DOMElement}
      */
     root: null,
     
     /**
      * Property: root
      * {DOMElement}
      */
     root: null,
-    
-    /**
-     * Property: vectorRoot
-     * {DOMElement}
-     */
-    vectorRoot: null,
 
 
-    /**
-     * Property: textRoot
-     * {DOMElement}
+    /** 
+     * Property: extent
+     * {<OpenLayers.Bounds>}
      */
      */
-    textRoot: null,
+    extent: null,
 
     /**
 
     /**
-     * Property: xmlns
-     * {String}
-     */    
-    xmlns: null,
-    
-    /**
-     * Property: xOffset
-     * {Number} Offset to apply to the renderer viewport translation in x
-     * direction. If the renderer extent's center is on the right of the
-     * dateline (i.e. exceeds the world bounds), we shift the viewport to the
-     * left by one world width. This avoids that features disappear from the
-     * map viewport. Because our dateline handling logic in other places
-     * ensures that extents crossing the dateline always have a center
-     * exceeding the world bounds on the left, we need this offset to make sure
-     * that the same is true for the renderer extent in pixel space as well.
-     */
-    xOffset: 0,
-    
-    /**
-     * Property: rightOfDateLine
-     * {Boolean} Keeps track of the location of the map extent relative to the
-     * date line. The <setExtent> method compares this value (which is the one
-     * from the previous <setExtent> call) with the current position of the map
-     * extent relative to the date line and updates the xOffset when the extent
-     * has moved from one side of the date line to the other.
-     */
-    
-    /**
-     * Property: Indexer
-     * {<OpenLayers.ElementIndexer>} An instance of OpenLayers.ElementsIndexer 
-     *     created upon initialization if the zIndexing or yOrdering options
-     *     passed to this renderer's constructor are set to true.
-     */
-    indexer: null, 
+     * Property: locked
+     * {Boolean} If the renderer is currently in a state where many things
+     *     are changing, the 'locked' property is set to true. This means 
+     *     that renderers can expect at least one more drawFeature event to be
+     *     called with the 'locked' property set to 'true': In some renderers,
+     *     this might make sense to use as a 'only update local information'
+     *     flag. 
+     */  
+    locked: false,
     
     
-    /**
-     * Constant: BACKGROUND_ID_SUFFIX
-     * {String}
+    /** 
+     * Property: size
+     * {<OpenLayers.Size>} 
      */
      */
-    BACKGROUND_ID_SUFFIX: "_background",
+    size: null,
     
     /**
     
     /**
-     * Constant: LABEL_ID_SUFFIX
-     * {String}
+     * Property: resolution
+     * {Float} cache of current map resolution
      */
      */
-    LABEL_ID_SUFFIX: "_label",
+    resolution: null,
     
     /**
     
     /**
-     * Constant: LABEL_OUTLINE_SUFFIX
-     * {String}
-     */
-    LABEL_OUTLINE_SUFFIX: "_outline",
-
-    /**
-     * Constructor: OpenLayers.Renderer.Elements
-     * 
-     * Parameters:
-     * containerID - {String}
-     * options - {Object} options for this renderer. 
-     *
-     * Supported options are:
-     *     yOrdering - {Boolean} Whether to use y-ordering
-     *     zIndexing - {Boolean} Whether to use z-indexing. Will be ignored
-     *         if yOrdering is set to true.
+     * Property: map  
+     * {<OpenLayers.Map>} Reference to the map -- this is set in Vector's setMap()
      */
      */
-    initialize: function(containerID, options) {
-        OpenLayers.Renderer.prototype.initialize.apply(this, arguments);
-
-        this.rendererRoot = this.createRenderRoot();
-        this.root = this.createRoot("_root");
-        this.vectorRoot = this.createRoot("_vroot");
-        this.textRoot = this.createRoot("_troot");
-        
-        this.root.appendChild(this.vectorRoot);
-        this.root.appendChild(this.textRoot);
-        
-        this.rendererRoot.appendChild(this.root);
-        this.container.appendChild(this.rendererRoot);
-        
-        if(options && (options.zIndexing || options.yOrdering)) {
-            this.indexer = new OpenLayers.ElementsIndexer(options.yOrdering);
-        }
-    },
+    map: null,
     
     /**
     
     /**
-     * Method: destroy
+     * Property: featureDx
+     * {Number} Feature offset in x direction. Will be calculated for and
+     * applied to the current feature while rendering (see
+     * <calculateFeatureDx>).
      */
      */
-    destroy: function() {
-
-        this.clear(); 
-
-        this.rendererRoot = null;
-        this.root = null;
-        this.xmlns = null;
-
-        OpenLayers.Renderer.prototype.destroy.apply(this, arguments);
-    },
-    
-    /**
-     * Method: clear
-     * Remove all the elements from the root
-     */    
-    clear: function() {
-        var child;
-        var root = this.vectorRoot;
-        if (root) {
-            while (child = root.firstChild) {
-                root.removeChild(child);
-            }
-        }
-        root = this.textRoot;
-        if (root) {
-            while (child = root.firstChild) {
-                root.removeChild(child);
-            }
-        }
-        if (this.indexer) {
-            this.indexer.clear();
-        }
-    },
+    featureDx: 0,
     
     /**
     
     /**
-     * Method: setExtent
-     * Set the visible part of the layer.
-     *
-     * Parameters:
-     * extent - {<OpenLayers.Bounds>}
-     * resolutionChanged - {Boolean}
-     *
-     * Returns:
-     * {Boolean} true to notify the layer that the new extent does not exceed
-     *     the coordinate range, and the features will not need to be redrawn.
-     *     False otherwise.
-     */
-    setExtent: function(extent, resolutionChanged) {
-        var coordSysUnchanged = OpenLayers.Renderer.prototype.setExtent.apply(this, arguments);
-        var resolution = this.getResolution();
-        if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
-            var rightOfDateLine,
-                ratio = extent.getWidth() / this.map.getExtent().getWidth(),
-                extent = extent.scale(1 / ratio),
-                world = this.map.getMaxExtent();
-            if (world.right > extent.left && world.right < extent.right) {
-                rightOfDateLine = true;
-            } else if (world.left > extent.left && world.left < extent.right) {
-                rightOfDateLine = false;
-            }
-            if (rightOfDateLine !== this.rightOfDateLine || resolutionChanged) {
-                coordSysUnchanged = false;
-                this.xOffset = rightOfDateLine === true ?
-                    world.getWidth() / resolution : 0;
-            }
-            this.rightOfDateLine = rightOfDateLine;
-        }
-        return coordSysUnchanged;
-    },
-
-    /** 
-     * Method: getNodeType
-     * This function is in charge of asking the specific renderer which type
-     *     of node to create for the given geometry and style. All geometries
-     *     in an Elements-based renderer consist of one node and some
-     *     attributes. We have the nodeFactory() function which creates a node
-     *     for us, but it takes a 'type' as input, and that is precisely what
-     *     this function tells us.  
-     *  
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>}
-     * style - {Object}
-     * 
-     * Returns:
-     * {String} The corresponding node type for the specified geometry
-     */
-    getNodeType: function(geometry, style) { },
-
-    /** 
-     * Method: drawGeometry 
-     * Draw the geometry, creating new nodes, setting paths, setting style,
-     *     setting featureId on the node.  This method should only be called
-     *     by the renderer itself.
+     * Constructor: OpenLayers.Renderer 
      *
      * Parameters:
      *
      * Parameters:
-     * geometry - {<OpenLayers.Geometry>}
-     * style - {Object}
-     * featureId - {String}
-     * 
-     * Returns:
-     * {Boolean} true if the geometry has been drawn completely; null if
-     *     incomplete; false otherwise
+     * containerID - {<String>} 
+     * options - {Object} options for this renderer. See sublcasses for
+     *     supported options.
      */
      */
-    drawGeometry: function(geometry, style, featureId) {
-        var className = geometry.CLASS_NAME;
-        var rendered = true;
-        if ((className == "OpenLayers.Geometry.Collection") ||
-            (className == "OpenLayers.Geometry.MultiPoint") ||
-            (className == "OpenLayers.Geometry.MultiLineString") ||
-            (className == "OpenLayers.Geometry.MultiPolygon")) {
-            for (var i = 0, len=geometry.components.length; i<len; i++) {
-                rendered = this.drawGeometry(
-                    geometry.components[i], style, featureId) && rendered;
-            }
-            return rendered;
-        }
-
-        rendered = false;
-        var removeBackground = false;
-        if (style.display != "none") {
-            if (style.backgroundGraphic) {
-                this.redrawBackgroundNode(geometry.id, geometry, style,
-                    featureId);
-            } else {
-                removeBackground = true;
-            }
-            rendered = this.redrawNode(geometry.id, geometry, style,
-                featureId);
-        }
-        if (rendered == false) {
-            var node = document.getElementById(geometry.id);
-            if (node) {
-                if (node._style.backgroundGraphic) {
-                    removeBackground = true;
-                }
-                node.parentNode.removeChild(node);
-            }
-        }
-        if (removeBackground) {
-            var node = document.getElementById(
-                geometry.id + this.BACKGROUND_ID_SUFFIX);
-            if (node) {
-                node.parentNode.removeChild(node);
-            }
-        }
-        return rendered;
+    initialize: function(containerID, options) {
+        this.container = OpenLayers.Util.getElement(containerID);
+        OpenLayers.Util.extend(this, options);
     },
     
     /**
     },
     
     /**
-     * Method: redrawNode
-     * 
-     * Parameters:
-     * id - {String}
-     * geometry - {<OpenLayers.Geometry>}
-     * style - {Object}
-     * featureId - {String}
-     * 
-     * Returns:
-     * {Boolean} true if the complete geometry could be drawn, null if parts of
-     *     the geometry could not be drawn, false otherwise
+     * APIMethod: destroy
      */
      */
-    redrawNode: function(id, geometry, style, featureId) {
-        style = this.applyDefaultSymbolizer(style);
-        // Get the node if it's already on the map.
-        var node = this.nodeFactory(id, this.getNodeType(geometry, style));
-        
-        // Set the data for the node, then draw it.
-        node._featureId = featureId;
-        node._boundsBottom = geometry.getBounds().bottom;
-        node._geometryClass = geometry.CLASS_NAME;
-        node._style = style;
-
-        var drawResult = this.drawGeometryNode(node, geometry, style);
-        if(drawResult === false) {
-            return false;
-        }
-         
-        node = drawResult.node;
-        
-        // Insert the node into the indexer so it can show us where to
-        // place it. Note that this operation is O(log(n)). If there's a
-        // performance problem (when dragging, for instance) this is
-        // likely where it would be.
-        if (this.indexer) {
-            var insert = this.indexer.insert(node);
-            if (insert) {
-                this.vectorRoot.insertBefore(node, insert);
-            } else {
-                this.vectorRoot.appendChild(node);
-            }
-        } else {
-            // if there's no indexer, simply append the node to root,
-            // but only if the node is a new one
-            if (node.parentNode !== this.vectorRoot){ 
-                this.vectorRoot.appendChild(node);
-            }
-        }
-        
-        this.postDraw(node);
-        
-        return drawResult.complete;
+    destroy: function() {
+        this.container = null;
+        this.extent = null;
+        this.size =  null;
+        this.resolution = null;
+        this.map = null;
     },
     },
-    
+
     /**
     /**
-     * Method: redrawBackgroundNode
-     * Redraws the node using special 'background' style properties. Basically
-     *     just calls redrawNode(), but instead of directly using the 
-     *     'externalGraphic', 'graphicXOffset', 'graphicYOffset', and 
-     *     'graphicZIndex' properties directly from the specified 'style' 
-     *     parameter, we create a new style object and set those properties 
-     *     from the corresponding 'background'-prefixed properties from 
-     *     specified 'style' parameter.
-     * 
-     * Parameters:
-     * id - {String}
-     * geometry - {<OpenLayers.Geometry>}
-     * style - {Object}
-     * featureId - {String}
+     * APIMethod: supported
+     * This should be overridden by specific subclasses
      * 
      * Returns:
      * 
      * Returns:
-     * {Boolean} true if the complete geometry could be drawn, null if parts of
-     *     the geometry could not be drawn, false otherwise
+     * {Boolean} Whether or not the browser supports the renderer class
      */
      */
-    redrawBackgroundNode: function(id, geometry, style, featureId) {
-        var backgroundStyle = OpenLayers.Util.extend({}, style);
-        
-        // Set regular style attributes to apply to the background styles.
-        backgroundStyle.externalGraphic = backgroundStyle.backgroundGraphic;
-        backgroundStyle.graphicXOffset = backgroundStyle.backgroundXOffset;
-        backgroundStyle.graphicYOffset = backgroundStyle.backgroundYOffset;
-        backgroundStyle.graphicZIndex = backgroundStyle.backgroundGraphicZIndex;
-        backgroundStyle.graphicWidth = backgroundStyle.backgroundWidth || backgroundStyle.graphicWidth;
-        backgroundStyle.graphicHeight = backgroundStyle.backgroundHeight || backgroundStyle.graphicHeight;
-        
-        // Erase background styles.
-        backgroundStyle.backgroundGraphic = null;
-        backgroundStyle.backgroundXOffset = null;
-        backgroundStyle.backgroundYOffset = null;
-        backgroundStyle.backgroundGraphicZIndex = null;
-        
-        return this.redrawNode(
-            id + this.BACKGROUND_ID_SUFFIX, 
-            geometry, 
-            backgroundStyle, 
-            null
-        );
-    },
-
+    supported: function() {
+        return false;
+    },    
+    
     /**
     /**
-     * Method: drawGeometryNode
-     * Given a node, draw a geometry on the specified layer.
-     *     node and geometry are required arguments, style is optional.
-     *     This method is only called by the render itself.
+     * Method: setExtent
+     * Set the visible part of the layer.
+     *
+     * Resolution has probably changed, so we nullify the resolution 
+     * cache (this.resolution) -- this way it will be re-computed when 
+     * next it is needed.
+     * We nullify the resolution cache (this.resolution) if resolutionChanged
+     * is set to true - this way it will be re-computed on the next
+     * getResolution() request.
      *
      * Parameters:
      *
      * Parameters:
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * style - {Object}
-     * 
+     * extent - {<OpenLayers.Bounds>}
+     * resolutionChanged - {Boolean}
+     *
      * Returns:
      * Returns:
-     * {Object} a hash with properties "node" (the drawn node) and "complete"
-     *     (null if parts of the geometry could not be drawn, false if nothing
-     *     could be drawn)
+     * {Boolean} true to notify the layer that the new extent does not exceed
+     *     the coordinate range, and the features will not need to be redrawn.
+     *     False otherwise.
      */
      */
-    drawGeometryNode: function(node, geometry, style) {
-        style = style || node._style;
-
-        var options = {
-            'isFilled': style.fill === undefined ?
-                true :
-                style.fill,
-            'isStroked': style.stroke === undefined ?
-                !!style.strokeWidth :
-                style.stroke
-        };
-        var drawn;
-        switch (geometry.CLASS_NAME) {
-            case "OpenLayers.Geometry.Point":
-                if(style.graphic === false) {
-                    options.isFilled = false;
-                    options.isStroked = false;
-                }
-                drawn = this.drawPoint(node, geometry);
-                break;
-            case "OpenLayers.Geometry.LineString":
-                options.isFilled = false;
-                drawn = this.drawLineString(node, geometry);
-                break;
-            case "OpenLayers.Geometry.LinearRing":
-                drawn = this.drawLinearRing(node, geometry);
-                break;
-            case "OpenLayers.Geometry.Polygon":
-                drawn = this.drawPolygon(node, geometry);
-                break;
-            case "OpenLayers.Geometry.Rectangle":
-                drawn = this.drawRectangle(node, geometry);
-                break;
-            default:
-                break;
+    setExtent: function(extent, resolutionChanged) {
+        this.extent = extent.clone();
+        if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
+            var ratio = extent.getWidth() / this.map.getExtent().getWidth(),
+                extent = extent.scale(1 / ratio);
+            this.extent = extent.wrapDateLine(this.map.getMaxExtent()).scale(ratio);
         }
         }
-
-        node._options = options; 
-
-        //set style
-        //TBD simplify this
-        if (drawn != false) {
-            return {
-                node: this.setStyle(node, style, options, geometry),
-                complete: drawn
-            };
-        } else {
-            return false;
+        if (resolutionChanged) {
+            this.resolution = null;
         }
         }
+        return true;
     },
     
     /**
     },
     
     /**
-     * Method: postDraw
-     * Things that have do be done after the geometry node is appended
-     *     to its parent node. To be overridden by subclasses.
+     * Method: setSize
+     * Sets the size of the drawing surface.
      * 
      * 
+     * Resolution has probably changed, so we nullify the resolution 
+     * cache (this.resolution) -- this way it will be re-computed when 
+     * next it is needed.
+     *
      * Parameters:
      * Parameters:
-     * node - {DOMElement}
+     * size - {<OpenLayers.Size>} 
      */
      */
-    postDraw: function(node) {},
+    setSize: function(size) {
+        this.size = size.clone();
+        this.resolution = null;
+    },
     
     
-    /**
-     * Method: drawPoint
-     * Virtual function for drawing Point Geometry. 
-     *     Should be implemented by subclasses.
-     *     This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
+    /** 
+     * Method: getResolution
+     * Uses cached copy of resolution if available to minimize computing
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement} or false if the renderer could not draw the point
-     */ 
-    drawPoint: function(node, geometry) {},
-
+     * {Float} The current map's resolution
+     */
+    getResolution: function() {
+        this.resolution = this.resolution || this.map.getResolution();
+        return this.resolution;
+    },
+    
     /**
     /**
-     * Method: drawLineString
-     * Virtual function for drawing LineString Geometry. 
-     *     Should be implemented by subclasses.
-     *     This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
+     * Method: drawFeature
+     * Draw the feature.  The optional style argument can be used
+     * to override the feature's own style.  This method should only
+     * be called from layer.drawFeature().
+     *
+     * Parameters:
+     * feature - {<OpenLayers.Feature.Vector>} 
+     * style - {<Object>}
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement} or null if the renderer could not draw all components of
-     *     the linestring, or false if nothing could be drawn
-     */ 
-    drawLineString: function(node, geometry) {},
+     * {Boolean} true if the feature has been drawn completely, false if not,
+     *     undefined if the feature had no geometry
+     */
+    drawFeature: function(feature, style) {
+        if(style == null) {
+            style = feature.style;
+        }
+        if (feature.geometry) {
+            var bounds = feature.geometry.getBounds();
+            if(bounds) {
+                var worldBounds;
+                if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
+                    worldBounds = this.map.getMaxExtent();
+                }
+                if (!bounds.intersectsBounds(this.extent, {worldBounds: worldBounds})) {
+                    style = {display: "none"};
+                } else {
+                    this.calculateFeatureDx(bounds, worldBounds);
+                }
+                var rendered = this.drawGeometry(feature.geometry, style, feature.id);
+                if(style.display != "none" && style.label && rendered !== false) {
 
 
-    /**
-     * Method: drawLinearRing
-     * Virtual function for drawing LinearRing Geometry. 
-     *     Should be implemented by subclasses.
-     *     This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * 
-     * Returns:
-     * {DOMElement} or null if the renderer could not draw all components
-     *     of the linear ring, or false if nothing could be drawn
-     */ 
-    drawLinearRing: function(node, geometry) {},
+                    var location = feature.geometry.getCentroid(); 
+                    if(style.labelXOffset || style.labelYOffset) {
+                        var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
+                        var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
+                        var res = this.getResolution();
+                        location.move(xOffset*res, yOffset*res);
+                    }
+                    this.drawText(feature.id, style, location);
+                } else {
+                    this.removeText(feature.id);
+                }
+                return rendered;
+            }
+        }
+    },
 
     /**
 
     /**
-     * Method: drawPolygon
-     * Virtual function for drawing Polygon Geometry. 
-     *    Should be implemented by subclasses.
-     *    This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * 
-     * Returns:
-     * {DOMElement} or null if the renderer could not draw all components
-     *     of the polygon, or false if nothing could be drawn
-     */ 
-    drawPolygon: function(node, geometry) {},
+     * Method: calculateFeatureDx
+     * {Number} Calculates the feature offset in x direction. Looking at the
+     * center of the feature bounds and the renderer extent, we calculate how
+     * many world widths the two are away from each other. This distance is
+     * used to shift the feature as close as possible to the center of the
+     * current enderer extent, which ensures that the feature is visible in the
+     * current viewport.
+     *
+     * Parameters:
+     * bounds - {<OpenLayers.Bounds>} Bounds of the feature
+     * worldBounds - {<OpenLayers.Bounds>} Bounds of the world
+     */
+    calculateFeatureDx: function(bounds, worldBounds) {
+        this.featureDx = 0;
+        if (worldBounds) {
+            var worldWidth = worldBounds.getWidth(),
+                rendererCenterX = (this.extent.left + this.extent.right) / 2,
+                featureCenterX = (bounds.left + bounds.right) / 2,
+                worldsAway = Math.round((featureCenterX - rendererCenterX) / worldWidth);
+            this.featureDx = worldsAway * worldWidth;
+        }
+    },
 
 
-    /**
-     * Method: drawRectangle
-     * Virtual function for drawing Rectangle Geometry. 
-     *     Should be implemented by subclasses.
-     *     This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
+    /** 
+     * Method: drawGeometry
      * 
      * 
-     * Returns:
-     * {DOMElement} or false if the renderer could not draw the rectangle
-     */ 
-    drawRectangle: function(node, geometry) {},
-
+     * Draw a geometry.  This should only be called from the renderer itself.
+     * Use layer.drawFeature() from outside the renderer.
+     * virtual function
+     *
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>} 
+     * style - {Object} 
+     * featureId - {<String>} 
+     */
+    drawGeometry: function(geometry, style, featureId) {},
+        
     /**
     /**
-     * Method: drawCircle
-     * Virtual function for drawing Circle Geometry. 
-     *     Should be implemented by subclasses.
-     *     This method is only called by the renderer itself.
+     * Method: drawText
+     * Function for drawing text labels.
+     * This method is only called by the renderer itself.
      * 
      * Parameters: 
      * 
      * Parameters: 
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * 
-     * Returns:
-     * {DOMElement} or false if the renderer could not draw the circle
-     */ 
-    drawCircle: function(node, geometry) {},
+     * featureId - {String}
+     * style -
+     * location - {<OpenLayers.Geometry.Point>}
+     */
+    drawText: function(featureId, style, location) {},
 
     /**
      * Method: removeText
 
     /**
      * Method: removeText
-     * Removes a label
+     * Function for removing text labels.
+     * This method is only called by the renderer itself.
      * 
      * 
-     * Parameters:
+     * Parameters: 
      * featureId - {String}
      */
      * featureId - {String}
      */
-    removeText: function(featureId) {
-        var label = document.getElementById(featureId + this.LABEL_ID_SUFFIX);
-        if (label) {
-            this.textRoot.removeChild(label);
-        }
-        var outline = document.getElementById(featureId + this.LABEL_OUTLINE_SUFFIX);
-        if (outline) {
-            this.textRoot.removeChild(outline);
-        }
-    },
+    removeText: function(featureId) {},
+    
+    /**
+     * Method: clear
+     * Clear all vectors from the renderer.
+     * virtual function.
+     */    
+    clear: function() {},
 
     /**
      * Method: getFeatureIdFromEvent
 
     /**
      * Method: getFeatureIdFromEvent
+     * Returns a feature id from an event on the renderer.  
+     * How this happens is specific to the renderer.  This should be
+     * called from layer.getFeatureFromEvent().
+     * Virtual function.
      * 
      * Parameters:
      * 
      * Parameters:
-     * evt - {Object} An <OpenLayers.Event> object
+     * evt - {<OpenLayers.Event>} 
      *
      * Returns:
      * {String} A feature id or undefined.
      */
      *
      * Returns:
      * {String} A feature id or undefined.
      */
-    getFeatureIdFromEvent: function(evt) {
-        var target = evt.target;
-        var useElement = target && target.correspondingUseElement;
-        var node = useElement ? useElement : (target || evt.srcElement);
-        return node._featureId;
-    },
-
-    /** 
-     * Method: eraseGeometry
-     * Erase a geometry from the renderer. In the case of a multi-geometry, 
-     *     we cycle through and recurse on ourselves. Otherwise, we look for a 
-     *     node with the geometry.id, destroy its geometry, and remove it from
-     *     the DOM.
-     * 
-     * Parameters:
-     * geometry - {<OpenLayers.Geometry>}
-     * featureId - {String}
-     */
-    eraseGeometry: function(geometry, featureId) {
-        if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
-            (geometry.CLASS_NAME == "OpenLayers.Geometry.MultiLineString") ||
-            (geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPolygon") ||
-            (geometry.CLASS_NAME == "OpenLayers.Geometry.Collection")) {
-            for (var i=0, len=geometry.components.length; i<len; i++) {
-                this.eraseGeometry(geometry.components[i], featureId);
-            }
-        } else {    
-            var element = OpenLayers.Util.getElement(geometry.id);
-            if (element && element.parentNode) {
-                if (element.geometry) {
-                    element.geometry.destroy();
-                    element.geometry = null;
-                }
-                element.parentNode.removeChild(element);
-
-                if (this.indexer) {
-                    this.indexer.remove(element);
-                }
-                
-                if (element._style.backgroundGraphic) {
-                    var backgroundId = geometry.id + this.BACKGROUND_ID_SUFFIX;
-                    var bElem = OpenLayers.Util.getElement(backgroundId);
-                    if (bElem && bElem.parentNode) {
-                        // No need to destroy the geometry since the element and the background
-                        // node share the same geometry.
-                        bElem.parentNode.removeChild(bElem);
-                    }
-                }
-            }
-        }
-    },
-
-    /** 
-     * Method: nodeFactory
-     * Create new node of the specified type, with the (optional) specified id.
-     * 
-     * If node already exists with same ID and a different type, we remove it
-     *     and then call ourselves again to recreate it.
-     * 
-     * Parameters:
-     * id - {String}
-     * type - {String} type Kind of node to draw.
-     * 
-     * Returns:
-     * {DOMElement} A new node of the given type and id.
-     */
-    nodeFactory: function(id, type) {
-        var node = OpenLayers.Util.getElement(id);
-        if (node) {
-            if (!this.nodeTypeCompare(node, type)) {
-                node.parentNode.removeChild(node);
-                node = this.nodeFactory(id, type);
-            }
-        } else {
-            node = this.createNode(type, id);
-        }
-        return node;
-    },
+    getFeatureIdFromEvent: function(evt) {},
     
     
-    /** 
-     * Method: nodeTypeCompare
+    /**
+     * Method: eraseFeatures 
+     * This is called by the layer to erase features
      * 
      * Parameters:
      * 
      * Parameters:
-     * node - {DOMElement}
-     * type - {String} Kind of node
-     * 
-     * Returns:
-     * {Boolean} Whether or not the specified node is of the specified type
-     *     This function must be overridden by subclasses.
+     * features - {Array(<OpenLayers.Feature.Vector>)} 
      */
      */
-    nodeTypeCompare: function(node, type) {},
+    eraseFeatures: function(features) {
+        if(!(OpenLayers.Util.isArray(features))) {
+            features = [features];
+        }
+        for(var i=0, len=features.length; i<len; ++i) {
+            var feature = features[i];
+            this.eraseGeometry(feature.geometry, feature.id);
+            this.removeText(feature.id);
+        }
+    },
     
     
-    /** 
-     * Method: createNode
+    /**
+     * Method: eraseGeometry
+     * Remove a geometry from the renderer (by id).
+     * virtual function.
      * 
      * Parameters:
      * 
      * Parameters:
-     * type - {String} Kind of node to draw.
-     * id - {String} Id for node.
-     * 
-     * Returns:
-     * {DOMElement} A new node of the given type and id.
-     *     This function must be overridden by subclasses.
+     * geometry - {<OpenLayers.Geometry>} 
+     * featureId - {String}
      */
      */
-    createNode: function(type, id) {},
-
+    eraseGeometry: function(geometry, featureId) {},
+    
     /**
      * Method: moveRoot
     /**
      * Method: moveRoot
-     * moves this renderer's root to a different renderer.
+     * moves this renderer's root to a (different) renderer.
+     * To be implemented by subclasses that require a common renderer root for
+     * feature selection.
      * 
      * Parameters:
      * renderer - {<OpenLayers.Renderer>} target renderer for the moved root
      */
      * 
      * Parameters:
      * renderer - {<OpenLayers.Renderer>} target renderer for the moved root
      */
-    moveRoot: function(renderer) {
-        var root = this.root;
-        if(renderer.root.parentNode == this.rendererRoot) {
-            root = renderer.root;
-        }
-        root.parentNode.removeChild(root);
-        renderer.rendererRoot.appendChild(root);
-    },
-    
+    moveRoot: function(renderer) {},
+
     /**
      * Method: getRenderLayerId
      * Gets the layer that this renderer's output appears on. If moveRoot was
     /**
      * Method: getRenderLayerId
      * Gets the layer that this renderer's output appears on. If moveRoot was
@@ -29429,5705 +28613,6500 @@ OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, {
      * {String} the id of the output layer.
      */
     getRenderLayerId: function() {
      * {String} the id of the output layer.
      */
     getRenderLayerId: function() {
-        return this.root.parentNode.parentNode.id;
+        return this.container.id;
     },
     
     /**
     },
     
     /**
-     * Method: isComplexSymbol
-     * Determines if a symbol cannot be rendered using drawCircle
+     * Method: applyDefaultSymbolizer
      * 
      * Parameters:
      * 
      * Parameters:
-     * graphicName - {String}
+     * symbolizer - {Object}
      * 
      * 
-     * Returns
-     * {Boolean} true if the symbol is complex, false if not
+     * Returns:
+     * {Object}
      */
      */
-    isComplexSymbol: function(graphicName) {
-        return (graphicName != "circle") && !!graphicName;
+    applyDefaultSymbolizer: function(symbolizer) {
+        var result = OpenLayers.Util.extend({},
+            OpenLayers.Renderer.defaultSymbolizer);
+        if(symbolizer.stroke === false) {
+            delete result.strokeWidth;
+            delete result.strokeColor;
+        }
+        if(symbolizer.fill === false) {
+            delete result.fillColor;
+        }
+        OpenLayers.Util.extend(result, symbolizer);
+        return result;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Renderer.Elements"
+    CLASS_NAME: "OpenLayers.Renderer"
 });
 
 });
 
+/**
+ * Constant: OpenLayers.Renderer.defaultSymbolizer
+ * {Object} Properties from this symbolizer will be applied to symbolizers
+ *     with missing properties. This can also be used to set a global
+ *     symbolizer default in OpenLayers. To be SLD 1.x compliant, add the
+ *     following code before rendering any vector features:
+ * (code)
+ * OpenLayers.Renderer.defaultSymbolizer = {
+ *     fillColor: "#808080",
+ *     fillOpacity: 1,
+ *     strokeColor: "#000000",
+ *     strokeOpacity: 1,
+ *     strokeWidth: 1,
+ *     pointRadius: 3,
+ *     graphicName: "square"
+ * };
+ * (end)
+ */
+OpenLayers.Renderer.defaultSymbolizer = {
+    fillColor: "#000000",
+    strokeColor: "#000000",
+    strokeWidth: 2,
+    fillOpacity: 1,
+    strokeOpacity: 1,
+    pointRadius: 0,
+    labelAlign: 'cm'
+};
+    
+
+
+/**
+ * Constant: OpenLayers.Renderer.symbol
+ * Coordinate arrays for well known (named) symbols.
+ */
+OpenLayers.Renderer.symbol = {
+    "star": [350,75, 379,161, 469,161, 397,215, 423,301, 350,250, 277,301,
+            303,215, 231,161, 321,161, 350,75],
+    "cross": [4,0, 6,0, 6,4, 10,4, 10,6, 6,6, 6,10, 4,10, 4,6, 0,6, 0,4, 4,4,
+            4,0],
+    "x": [0,0, 25,0, 50,35, 75,0, 100,0, 65,50, 100,100, 75,100, 50,65, 25,100, 0,100, 35,50, 0,0],
+    "square": [0,0, 0,1, 1,1, 1,0, 0,0],
+    "triangle": [0,10, 10,10, 5,0, 0,10]
+};
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Control/Zoom.js
+    OpenLayers/Layer/Vector.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Control.js
- * @requires OpenLayers/Events/buttonclick.js
+ * @requires OpenLayers/Layer.js
+ * @requires OpenLayers/Renderer.js
+ * @requires OpenLayers/StyleMap.js
+ * @requires OpenLayers/Feature/Vector.js
+ * @requires OpenLayers/Console.js
+ * @requires OpenLayers/Lang.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Control.Zoom
- * The Zoom control is a pair of +/- links for zooming in and out.
+ * Class: OpenLayers.Layer.Vector
+ * Instances of OpenLayers.Layer.Vector are used to render vector data from
+ *     a variety of sources. Create a new vector layer with the
+ *     <OpenLayers.Layer.Vector> constructor.
  *
  * Inherits from:
  *
  * Inherits from:
- *  - <OpenLayers.Control>
+ *  - <OpenLayers.Layer>
  */
  */
-OpenLayers.Control.Zoom = OpenLayers.Class(OpenLayers.Control, {
-    
+OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
+
     /**
     /**
-     * APIProperty: zoomInText
-     * {String}
-     * Text for zoom-in link.  Default is "+".
+     * APIProperty: events
+     * {<OpenLayers.Events>}
+     *
+     * Register a listener for a particular event with the following syntax:
+     * (code)
+     * layer.events.register(type, obj, listener);
+     * (end)
+     *
+     * Listeners will be called with a reference to an event object.  The
+     *     properties of this event depends on exactly what happened.
+     *
+     * All event objects have at least the following properties:
+     * object - {Object} A reference to layer.events.object.
+     * element - {DOMElement} A reference to layer.events.element.
+     *
+     * Supported map event types (in addition to those from <OpenLayers.Layer.events>):
+     * beforefeatureadded - Triggered before a feature is added.  Listeners
+     *      will receive an object with a *feature* property referencing the
+     *      feature to be added.  To stop the feature from being added, a
+     *      listener should return false.
+     * beforefeaturesadded - Triggered before an array of features is added.
+     *      Listeners will receive an object with a *features* property
+     *      referencing the feature to be added. To stop the features from
+     *      being added, a listener should return false.
+     * featureadded - Triggered after a feature is added.  The event
+     *      object passed to listeners will have a *feature* property with a
+     *      reference to the added feature.
+     * featuresadded - Triggered after features are added.  The event
+     *      object passed to listeners will have a *features* property with a
+     *      reference to an array of added features.
+     * beforefeatureremoved - Triggered before a feature is removed. Listeners
+     *      will receive an object with a *feature* property referencing the
+     *      feature to be removed.
+     * beforefeaturesremoved - Triggered before multiple features are removed. 
+     *      Listeners will receive an object with a *features* property
+     *      referencing the features to be removed.
+     * featureremoved - Triggered after a feature is removed. The event
+     *      object passed to listeners will have a *feature* property with a
+     *      reference to the removed feature.
+     * featuresremoved - Triggered after features are removed. The event
+     *      object passed to listeners will have a *features* property with a
+     *      reference to an array of removed features.
+     * beforefeatureselected - Triggered before a feature is selected.  Listeners
+     *      will receive an object with a *feature* property referencing the
+     *      feature to be selected. To stop the feature from being selectd, a
+     *      listener should return false.
+     * featureselected - Triggered after a feature is selected.  Listeners
+     *      will receive an object with a *feature* property referencing the
+     *      selected feature.
+     * featureunselected - Triggered after a feature is unselected.
+     *      Listeners will receive an object with a *feature* property
+     *      referencing the unselected feature.
+     * beforefeaturemodified - Triggered when a feature is selected to 
+     *      be modified.  Listeners will receive an object with a *feature* 
+     *      property referencing the selected feature.
+     * featuremodified - Triggered when a feature has been modified.
+     *      Listeners will receive an object with a *feature* property referencing 
+     *      the modified feature.
+     * afterfeaturemodified - Triggered when a feature is finished being modified.
+     *      Listeners will receive an object with a *feature* property referencing 
+     *      the modified feature.
+     * vertexmodified - Triggered when a vertex within any feature geometry
+     *      has been modified.  Listeners will receive an object with a
+     *      *feature* property referencing the modified feature, a *vertex*
+     *      property referencing the vertex modified (always a point geometry),
+     *      and a *pixel* property referencing the pixel location of the
+     *      modification.
+     * vertexremoved - Triggered when a vertex within any feature geometry
+     *      has been deleted.  Listeners will receive an object with a
+     *      *feature* property referencing the modified feature, a *vertex*
+     *      property referencing the vertex modified (always a point geometry),
+     *      and a *pixel* property referencing the pixel location of the
+     *      removal.
+     * sketchstarted - Triggered when a feature sketch bound for this layer
+     *      is started.  Listeners will receive an object with a *feature*
+     *      property referencing the new sketch feature and a *vertex* property
+     *      referencing the creation point.
+     * sketchmodified - Triggered when a feature sketch bound for this layer
+     *      is modified.  Listeners will receive an object with a *vertex*
+     *      property referencing the modified vertex and a *feature* property
+     *      referencing the sketch feature.
+     * sketchcomplete - Triggered when a feature sketch bound for this layer
+     *      is complete.  Listeners will receive an object with a *feature*
+     *      property referencing the sketch feature.  By returning false, a
+     *      listener can stop the sketch feature from being added to the layer.
+     * refresh - Triggered when something wants a strategy to ask the protocol
+     *      for a new set of features.
      */
      */
-    zoomInText: "+",
 
     /**
 
     /**
-     * APIProperty: zoomInId
-     * {String}
-     * Instead of having the control create a zoom in link, you can provide 
-     *     the identifier for an anchor element already added to the document.
-     *     By default, an element with id "olZoomInLink" will be searched for
-     *     and used if it exists.
+     * APIProperty: isBaseLayer
+     * {Boolean} The layer is a base layer.  Default is false.  Set this property
+     * in the layer options.
      */
      */
-    zoomInId: "olZoomInLink",
+    isBaseLayer: false,
+
+    /** 
+     * APIProperty: isFixed
+     * {Boolean} Whether the layer remains in one place while dragging the
+     * map. Note that setting this to true will move the layer to the bottom
+     * of the layer stack.
+     */
+    isFixed: false,
 
 
+    /** 
+     * APIProperty: features
+     * {Array(<OpenLayers.Feature.Vector>)} 
+     */
+    features: null,
+    
+    /** 
+     * Property: filter
+     * {<OpenLayers.Filter>} The filter set in this layer,
+     *     a strategy launching read requests can combined
+     *     this filter with its own filter.
+     */
+    filter: null,
+    
+    /** 
+     * Property: selectedFeatures
+     * {Array(<OpenLayers.Feature.Vector>)} 
+     */
+    selectedFeatures: null,
+    
     /**
     /**
-     * APIProperty: zoomOutText
-     * {String}
-     * Text for zoom-out link.  Default is "\u2212".
+     * Property: unrenderedFeatures
+     * {Object} hash of features, keyed by feature.id, that the renderer
+     *     failed to draw
      */
      */
-    zoomOutText: "\u2212",
+    unrenderedFeatures: null,
 
     /**
 
     /**
-     * APIProperty: zoomOutId
-     * {String}
-     * Instead of having the control create a zoom out link, you can provide 
-     *     the identifier for an anchor element already added to the document.
-     *     By default, an element with id "olZoomOutLink" will be searched for
-     *     and used if it exists.
+     * APIProperty: reportError
+     * {Boolean} report friendly error message when loading of renderer
+     * fails.
      */
      */
-    zoomOutId: "olZoomOutLink",
+    reportError: true, 
 
 
+    /** 
+     * APIProperty: style
+     * {Object} Default style for the layer
+     */
+    style: null,
+    
     /**
     /**
-     * Method: draw
-     *
-     * Returns:
-     * {DOMElement} A reference to the DOMElement containing the zoom links.
+     * Property: styleMap
+     * {<OpenLayers.StyleMap>}
      */
      */
-    draw: function() {
-        var div = OpenLayers.Control.prototype.draw.apply(this),
-            links = this.getOrCreateLinks(div),
-            zoomIn = links.zoomIn,
-            zoomOut = links.zoomOut,
-            eventsInstance = this.map.events;
-        
-        if (zoomOut.parentNode !== div) {
-            eventsInstance = this.events;
-            eventsInstance.attachToElement(zoomOut.parentNode);
-        }
-        eventsInstance.register("buttonclick", this, this.onZoomClick);
-        
-        this.zoomInLink = zoomIn;
-        this.zoomOutLink = zoomOut;
-        return div;
-    },
+    styleMap: null,
     
     /**
     
     /**
-     * Method: getOrCreateLinks
-     * 
-     * Parameters:
-     * el - {DOMElement}
-     *
-     * Return: 
-     * {Object} Object with zoomIn and zoomOut properties referencing links.
+     * Property: strategies
+     * {Array(<OpenLayers.Strategy>})} Optional list of strategies for the layer.
      */
      */
-    getOrCreateLinks: function(el) {
-        var zoomIn = document.getElementById(this.zoomInId),
-            zoomOut = document.getElementById(this.zoomOutId);
-        if (!zoomIn) {
-            zoomIn = document.createElement("a");
-            zoomIn.href = "#zoomIn";
-            zoomIn.appendChild(document.createTextNode(this.zoomInText));
-            zoomIn.className = "olControlZoomIn";
-            el.appendChild(zoomIn);
-        }
-        OpenLayers.Element.addClass(zoomIn, "olButton");
-        if (!zoomOut) {
-            zoomOut = document.createElement("a");
-            zoomOut.href = "#zoomOut";
-            zoomOut.appendChild(document.createTextNode(this.zoomOutText));
-            zoomOut.className = "olControlZoomOut";
-            el.appendChild(zoomOut);
-        }
-        OpenLayers.Element.addClass(zoomOut, "olButton");
-        return {
-            zoomIn: zoomIn, zoomOut: zoomOut
-        };
-    },
+    strategies: null,
     
     /**
     
     /**
-     * Method: onZoomClick
-     * Called when zoomin/out link is clicked.
+     * Property: protocol
+     * {<OpenLayers.Protocol>} Optional protocol for the layer.
      */
      */
-    onZoomClick: function(evt) {
-        var button = evt.buttonElement;
-        if (button === this.zoomInLink) {
-            this.map.zoomIn();
-        } else if (button === this.zoomOutLink) {
-            this.map.zoomOut();
-        }
-    },
-
+    protocol: null,
+    
+    /**
+     * Property: renderers
+     * {Array(String)} List of supported Renderer classes. Add to this list to
+     * add support for additional renderers. This list is ordered:
+     * the first renderer which returns true for the  'supported()'
+     * method will be used, if not defined in the 'renderer' option.
+     */
+    renderers: ['SVG', 'VML', 'Canvas'],
+    
     /** 
     /** 
-     * Method: destroy
-     * Clean up.
+     * Property: renderer
+     * {<OpenLayers.Renderer>}
      */
      */
-    destroy: function() {
-        if (this.map) {
-            this.map.events.unregister("buttonclick", this, this.onZoomClick);
-        }
-        delete this.zoomInLink;
-        delete this.zoomOutLink;
-        OpenLayers.Control.prototype.destroy.apply(this);
-    },
-
-    CLASS_NAME: "OpenLayers.Control.Zoom"
-});
-/* ======================================================================
-    OpenLayers/Protocol.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/BaseTypes/Class.js
- */
-
-/**
- * Class: OpenLayers.Protocol
- * Abstract vector layer protocol class.  Not to be instantiated directly.  Use
- *     one of the protocol subclasses instead.
- */
-OpenLayers.Protocol = OpenLayers.Class({
+    renderer: null,
     
     /**
     
     /**
-     * Property: format
-     * {<OpenLayers.Format>} The format used by this protocol.
+     * APIProperty: rendererOptions
+     * {Object} Options for the renderer. See {<OpenLayers.Renderer>} for
+     *     supported options.
      */
      */
-    format: null,
+    rendererOptions: null,
     
     
-    /**
-     * Property: options
-     * {Object} Any options sent to the constructor.
+    /** 
+     * APIProperty: geometryType
+     * {String} geometryType allows you to limit the types of geometries this
+     * layer supports. This should be set to something like
+     * "OpenLayers.Geometry.Point" to limit types.
      */
      */
-    options: null,
+    geometryType: null,
 
 
-    /**
-     * Property: autoDestroy
-     * {Boolean} The creator of the protocol can set autoDestroy to false
-     *      to fully control when the protocol is destroyed. Defaults to
-     *      true.
-     */
-    autoDestroy: true,
-   
-    /**
-     * Property: defaultFilter
-     * {<OpenLayers.Filter>} Optional default filter to read requests
+    /** 
+     * Property: drawn
+     * {Boolean} Whether the Vector Layer features have been drawn yet.
      */
      */
-    defaultFilter: null,
+    drawn: false,
     
     
+    /** 
+     * APIProperty: ratio
+     * {Float} This specifies the ratio of the size of the visiblity of the Vector Layer features to the size of the map.
+     */   
+    ratio: 1,
+
     /**
     /**
-     * Constructor: OpenLayers.Protocol
-     * Abstract class for vector protocols.  Create instances of a subclass.
+     * Constructor: OpenLayers.Layer.Vector
+     * Create a new vector layer
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} Optional object whose properties will be set on the
-     *     instance.
+     * name - {String} A name for the layer
+     * options - {Object} Optional object with non-default properties to set on
+     *           the layer.
+     *
+     * Returns:
+     * {<OpenLayers.Layer.Vector>} A new vector layer
      */
      */
-    initialize: function(options) {
-        options = options || {};
-        OpenLayers.Util.extend(this, options);
-        this.options = options;
+    initialize: function(name, options) {
+        OpenLayers.Layer.prototype.initialize.apply(this, arguments);
+
+        // allow user-set renderer, otherwise assign one
+        if (!this.renderer || !this.renderer.supported()) {  
+            this.assignRenderer();
+        }
+
+        // if no valid renderer found, display error
+        if (!this.renderer || !this.renderer.supported()) {
+            this.renderer = null;
+            this.displayError();
+        } 
+
+        if (!this.styleMap) {
+            this.styleMap = new OpenLayers.StyleMap();
+        }
+
+        this.features = [];
+        this.selectedFeatures = [];
+        this.unrenderedFeatures = {};
+        
+        // Allow for custom layer behavior
+        if(this.strategies){
+            for(var i=0, len=this.strategies.length; i<len; i++) {
+                this.strategies[i].setLayer(this);
+            }
+        }
+
     },
 
     /**
     },
 
     /**
-     * Method: mergeWithDefaultFilter
-     * Merge filter passed to the read method with the default one
-     *
-     * Parameters:
-     * filter - {<OpenLayers.Filter>}
+     * APIMethod: destroy
+     * Destroy this layer
      */
      */
-    mergeWithDefaultFilter: function(filter) {
-        var merged;
-        if (filter && this.defaultFilter) {
-            merged = new OpenLayers.Filter.Logical({
-                type: OpenLayers.Filter.Logical.AND,
-                filters: [this.defaultFilter, filter]
-            });
-        } else {
-            merged = filter || this.defaultFilter || undefined;
+    destroy: function() {
+        if (this.strategies) {
+            var strategy, i, len;
+            for(i=0, len=this.strategies.length; i<len; i++) {
+                strategy = this.strategies[i];
+                if(strategy.autoDestroy) {
+                    strategy.destroy();
+                }
+            }
+            this.strategies = null;
+        }
+        if (this.protocol) {
+            if(this.protocol.autoDestroy) {
+                this.protocol.destroy();
+            }
+            this.protocol = null;
         }
         }
-        return merged;
+        this.destroyFeatures();
+        this.features = null;
+        this.selectedFeatures = null;
+        this.unrenderedFeatures = null;
+        if (this.renderer) {
+            this.renderer.destroy();
+        }
+        this.renderer = null;
+        this.geometryType = null;
+        this.drawn = null;
+        OpenLayers.Layer.prototype.destroy.apply(this, arguments);  
     },
 
     /**
     },
 
     /**
-     * APIMethod: destroy
-     * Clean up the protocol.
-     */
-    destroy: function() {
-        this.options = null;
-        this.format = null;
-    },
-    
-    /**
-     * APIMethod: read
-     * Construct a request for reading new features.
-     *
-     * Parameters:
-     * options - {Object} Optional object for configuring the request.
+     * Method: clone
+     * Create a clone of this layer.
+     * 
+     * Note: Features of the layer are also cloned.
      *
      * Returns:
      *
      * Returns:
-     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
-     * object, the same object will be passed to the callback function passed
-     * if one exists in the options object.
+     * {<OpenLayers.Layer.Vector>} An exact clone of this layer
      */
      */
-    read: function(options) {
-        options = options || {};
-        options.filter = this.mergeWithDefaultFilter(options.filter);
-    },
-    
+    clone: function (obj) {
+        
+        if (obj == null) {
+            obj = new OpenLayers.Layer.Vector(this.name, this.getOptions());
+        }
+
+        //get all additions from superclasses
+        obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
+
+        // copy/set any non-init, non-simple values here
+        var features = this.features;
+        var len = features.length;
+        var clonedFeatures = new Array(len);
+        for(var i=0; i<len; ++i) {
+            clonedFeatures[i] = features[i].clone();
+        }
+        obj.features = clonedFeatures;
+
+        return obj;
+    },    
     
     /**
     
     /**
-     * APIMethod: create
-     * Construct a request for writing newly created features.
+     * Method: refresh
+     * Ask the layer to request features again and redraw them.  Triggers
+     *     the refresh event if the layer is in range and visible.
      *
      * Parameters:
      *
      * Parameters:
-     * features - {Array({<OpenLayers.Feature.Vector>})} or
-     *            {<OpenLayers.Feature.Vector>}
-     * options - {Object} Optional object for configuring the request.
-     *
-     * Returns:
-     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
-     * object, the same object will be passed to the callback function passed
-     * if one exists in the options object.
+     * obj - {Object} Optional object with properties for any listener of
+     *     the refresh event.
      */
      */
-    create: function() {
+    refresh: function(obj) {
+        if(this.calculateInRange() && this.visibility) {
+            this.events.triggerEvent("refresh", obj);
+        }
     },
     },
-    
-    /**
-     * APIMethod: update
-     * Construct a request updating modified features.
-     *
-     * Parameters:
-     * features - {Array({<OpenLayers.Feature.Vector>})} or
-     *            {<OpenLayers.Feature.Vector>}
-     * options - {Object} Optional object for configuring the request.
-     *
-     * Returns:
-     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
-     * object, the same object will be passed to the callback function passed
-     * if one exists in the options object.
-     */
-    update: function() {
+
+    /** 
+     * Method: assignRenderer
+     * Iterates through the available renderer implementations and selects 
+     * and assigns the first one whose "supported()" function returns true.
+     */    
+    assignRenderer: function()  {
+        for (var i=0, len=this.renderers.length; i<len; i++) {
+            var rendererClass = this.renderers[i];
+            var renderer = (typeof rendererClass == "function") ?
+                rendererClass :
+                OpenLayers.Renderer[rendererClass];
+            if (renderer && renderer.prototype.supported()) {
+                this.renderer = new renderer(this.div, this.rendererOptions);
+                break;
+            }  
+        }  
     },
     },
-    
-    /**
-     * APIMethod: delete
-     * Construct a request deleting a removed feature.
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>}
-     * options - {Object} Optional object for configuring the request.
-     *
-     * Returns:
-     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
-     * object, the same object will be passed to the callback function passed
-     * if one exists in the options object.
+
+    /** 
+     * Method: displayError 
+     * Let the user know their browser isn't supported.
      */
      */
-    "delete": function() {
+    displayError: function() {
+        if (this.reportError) {
+            OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported", 
+                                     {renderers: this. renderers.join('\n')}));
+        }    
     },
 
     },
 
-    /**
-     * APIMethod: commit
-     * Go over the features and for each take action
-     * based on the feature state. Possible actions are create,
-     * update and delete.
-     *
+    /** 
+     * Method: setMap
+     * The layer has been added to the map. 
+     * 
+     * If there is no renderer set, the layer can't be used. Remove it.
+     * Otherwise, give the renderer a reference to the map and set its size.
+     * 
      * Parameters:
      * Parameters:
-     * features - {Array({<OpenLayers.Feature.Vector>})}
-     * options - {Object} Object whose possible keys are "create", "update",
-     *      "delete", "callback" and "scope", the values referenced by the
-     *      first three are objects as passed to the "create", "update", and
-     *      "delete" methods, the value referenced by the "callback" key is
-     *      a function which is called when the commit operation is complete
-     *      using the scope referenced by the "scope" key.
-     *
-     * Returns:
-     * {Array({<OpenLayers.Protocol.Response>})} An array of
-     * <OpenLayers.Protocol.Response> objects.
+     * map - {<OpenLayers.Map>} 
      */
      */
-    commit: function() {
+    setMap: function(map) {        
+        OpenLayers.Layer.prototype.setMap.apply(this, arguments);
+
+        if (!this.renderer) {
+            this.map.removeLayer(this);
+        } else {
+            this.renderer.map = this.map;
+
+            var newSize = this.map.getSize();
+            newSize.w = newSize.w * this.ratio;
+            newSize.h = newSize.h * this.ratio;
+            this.renderer.setSize(newSize);
+        }
     },
 
     /**
     },
 
     /**
-     * Method: abort
-     * Abort an ongoing request.
-     *
-     * Parameters:
-     * response - {<OpenLayers.Protocol.Response>}
+     * Method: afterAdd
+     * Called at the end of the map.addLayer sequence.  At this point, the map
+     *     will have a base layer.  Any autoActivate strategies will be
+     *     activated here.
      */
      */
-    abort: function(response) {
+    afterAdd: function() {
+        if(this.strategies) {
+            var strategy, i, len;
+            for(i=0, len=this.strategies.length; i<len; i++) {
+                strategy = this.strategies[i];
+                if(strategy.autoActivate) {
+                    strategy.activate();
+                }
+            }
+        }
     },
     },
-   
+
     /**
     /**
-     * Method: createCallback
-     * Returns a function that applies the given public method with resp and
-     *     options arguments.
+     * Method: removeMap
+     * The layer has been removed from the map.
      *
      * Parameters:
      *
      * Parameters:
-     * method - {Function} The method to be applied by the callback.
-     * response - {<OpenLayers.Protocol.Response>} The protocol response object.
-     * options - {Object} Options sent to the protocol method
+     * map - {<OpenLayers.Map>}
      */
      */
-    createCallback: function(method, response, options) {
-        return OpenLayers.Function.bind(function() {
-            method.apply(this, [response, options]);
-        }, this);
+    removeMap: function(map) {
+        this.drawn = false;
+        if(this.strategies) {
+            var strategy, i, len;
+            for(i=0, len=this.strategies.length; i<len; i++) {
+                strategy = this.strategies[i];
+                if(strategy.autoActivate) {
+                    strategy.deactivate();
+                }
+            }
+        }
     },
     },
-   
-    CLASS_NAME: "OpenLayers.Protocol" 
-});
-
-/**
- * Class: OpenLayers.Protocol.Response
- * Protocols return Response objects to their users.
- */
-OpenLayers.Protocol.Response = OpenLayers.Class({
-    /**
-     * Property: code
-     * {Number} - OpenLayers.Protocol.Response.SUCCESS or
-     *            OpenLayers.Protocol.Response.FAILURE
-     */
-    code: null,
-
-    /**
-     * Property: requestType
-     * {String} The type of request this response corresponds to. Either
-     *      "create", "read", "update" or "delete".
-     */
-    requestType: null,
-
+    
     /**
     /**
-     * Property: last
-     * {Boolean} - true if this is the last response expected in a commit,
-     * false otherwise, defaults to true.
+     * Method: onMapResize
+     * Notify the renderer of the change in size. 
+     * 
      */
      */
-    last: true,
+    onMapResize: function() {
+        OpenLayers.Layer.prototype.onMapResize.apply(this, arguments);
+        
+        var newSize = this.map.getSize();
+        newSize.w = newSize.w * this.ratio;
+        newSize.h = newSize.h * this.ratio;
+        this.renderer.setSize(newSize);
+    },
 
     /**
 
     /**
-     * Property: features
-     * {Array({<OpenLayers.Feature.Vector>})} or {<OpenLayers.Feature.Vector>}
-     * The features returned in the response by the server. Depending on the 
-     * protocol's read payload, either features or data will be populated.
+     * Method: moveTo
+     *  Reset the vector layer's div so that it once again is lined up with 
+     *   the map. Notify the renderer of the change of extent, and in the
+     *   case of a change of zoom level (resolution), have the 
+     *   renderer redraw features.
+     * 
+     *  If the layer has not yet been drawn, cycle through the layer's 
+     *   features and draw each one.
+     * 
+     * Parameters:
+     * bounds - {<OpenLayers.Bounds>} 
+     * zoomChanged - {Boolean} 
+     * dragging - {Boolean} 
      */
      */
-    features: null,
+    moveTo: function(bounds, zoomChanged, dragging) {
+        OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
+        
+        var coordSysUnchanged = true;
+        if (!dragging) {
+            this.renderer.root.style.visibility = 'hidden';
 
 
-    /**
-     * Property: data
-     * {Object}
-     * The data returned in the response by the server. Depending on the 
-     * protocol's read payload, either features or data will be populated.
-     */
-    data: null,
+            var viewSize = this.map.getSize(),
+                viewWidth = viewSize.w,
+                viewHeight = viewSize.h,
+                offsetLeft = (viewWidth / 2 * this.ratio) - viewWidth / 2,
+                offsetTop = (viewHeight / 2 * this.ratio) - viewHeight / 2;
+            offsetLeft += this.map.layerContainerOriginPx.x;
+            offsetLeft = -Math.round(offsetLeft);
+            offsetTop += this.map.layerContainerOriginPx.y;
+            offsetTop = -Math.round(offsetTop);
 
 
-    /**
-     * Property: reqFeatures
-     * {Array({<OpenLayers.Feature.Vector>})} or {<OpenLayers.Feature.Vector>}
-     * The features provided by the user and placed in the request by the
-     *      protocol.
-     */
-    reqFeatures: null,
+            this.div.style.left = offsetLeft + 'px';
+            this.div.style.top = offsetTop + 'px';
 
 
-    /**
-     * Property: priv
-     */
-    priv: null,
+            var extent = this.map.getExtent().scale(this.ratio);
+            coordSysUnchanged = this.renderer.setExtent(extent, zoomChanged);
 
 
-    /**
-     * Property: error
-     * {Object} The error object in case a service exception was encountered.
-     */
-    error: null,
+            this.renderer.root.style.visibility = 'visible';
 
 
-    /**
-     * Constructor: OpenLayers.Protocol.Response
-     *
+            // Force a reflow on gecko based browsers to prevent jump/flicker.
+            // This seems to happen on only certain configurations; it was originally
+            // noticed in FF 2.0 and Linux.
+            if (OpenLayers.IS_GECKO === true) {
+                this.div.scrollLeft = this.div.scrollLeft;
+            }
+            
+            if (!zoomChanged && coordSysUnchanged) {
+                for (var i in this.unrenderedFeatures) {
+                    var feature = this.unrenderedFeatures[i];
+                    this.drawFeature(feature);
+                }
+            }
+        }
+        if (!this.drawn || zoomChanged || !coordSysUnchanged) {
+            this.drawn = true;
+            var feature;
+            for(var i=0, len=this.features.length; i<len; i++) {
+                this.renderer.locked = (i !== (len - 1));
+                feature = this.features[i];
+                this.drawFeature(feature);
+            }
+        }    
+    },
+    
+    /** 
+     * APIMethod: display
+     * Hide or show the Layer
+     * 
      * Parameters:
      * Parameters:
-     * options - {Object} Optional object whose properties will be set on the
-     *     instance.
+     * display - {Boolean}
      */
      */
-    initialize: function(options) {
-        OpenLayers.Util.extend(this, options);
+    display: function(display) {
+        OpenLayers.Layer.prototype.display.apply(this, arguments);
+        // we need to set the display style of the root in case it is attached
+        // to a foreign layer
+        var currentDisplay = this.div.style.display;
+        if(currentDisplay != this.renderer.root.style.display) {
+            this.renderer.root.style.display = currentDisplay;
+        }
     },
 
     /**
     },
 
     /**
-     * Method: success
+     * APIMethod: addFeatures
+     * Add Features to the layer.
      *
      *
-     * Returns:
-     * {Boolean} - true on success, false otherwise
+     * Parameters:
+     * features - {Array(<OpenLayers.Feature.Vector>)} 
+     * options - {Object}
      */
      */
-    success: function() {
-        return this.code > 0;
-    },
+    addFeatures: function(features, options) {
+        if (!(OpenLayers.Util.isArray(features))) {
+            features = [features];
+        }
+        
+        var notify = !options || !options.silent;
+        if(notify) {
+            var event = {features: features};
+            var ret = this.events.triggerEvent("beforefeaturesadded", event);
+            if(ret === false) {
+                return;
+            }
+            features = event.features;
+        }
+        
+        // Track successfully added features for featuresadded event, since
+        // beforefeatureadded can veto single features.
+        var featuresAdded = [];
+        for (var i=0, len=features.length; i<len; i++) {
+            if (i != (features.length - 1)) {
+                this.renderer.locked = true;
+            } else {
+                this.renderer.locked = false;
+            }    
+            var feature = features[i];
+            
+            if (this.geometryType &&
+              !(feature.geometry instanceof this.geometryType)) {
+                throw new TypeError('addFeatures: component should be an ' +
+                                    this.geometryType.prototype.CLASS_NAME);
+              }
 
 
-    CLASS_NAME: "OpenLayers.Protocol.Response"
-});
+            //give feature reference to its layer
+            feature.layer = this;
 
 
-OpenLayers.Protocol.Response.SUCCESS = 1;
-OpenLayers.Protocol.Response.FAILURE = 0;
-/* ======================================================================
-    OpenLayers/Protocol/WFS.js
-   ====================================================================== */
+            if (!feature.style && this.style) {
+                feature.style = OpenLayers.Util.extend({}, this.style);
+            }
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
+            if (notify) {
+                if(this.events.triggerEvent("beforefeatureadded",
+                                            {feature: feature}) === false) {
+                    continue;
+                }
+                this.preFeatureInsert(feature);
+            }
 
 
-/**
- * @requires OpenLayers/Protocol.js
- */
+            featuresAdded.push(feature);
+            this.features.push(feature);
+            this.drawFeature(feature);
+            
+            if (notify) {
+                this.events.triggerEvent("featureadded", {
+                    feature: feature
+                });
+                this.onFeatureInsert(feature);
+            }
+        }
+        
+        if(notify) {
+            this.events.triggerEvent("featuresadded", {features: featuresAdded});
+        }
+    },
 
 
-/**
- * Class: OpenLayers.Protocol.WFS
- * Used to create a versioned WFS protocol.  Default version is 1.0.0.
- *
- * Returns:
- * {<OpenLayers.Protocol>} A WFS protocol of the given version.
- *
- * Example:
- * (code)
- *     var protocol = new OpenLayers.Protocol.WFS({
- *         version: "1.1.0",
- *         url:  "http://demo.opengeo.org/geoserver/wfs",
- *         featureType: "tasmania_roads",
- *         featureNS: "http://www.openplans.org/topp",
- *         geometryName: "the_geom"
- *     });
- * (end)
- *
- * See the protocols for specific WFS versions for more detail.
- */
-OpenLayers.Protocol.WFS = function(options) {
-    options = OpenLayers.Util.applyDefaults(
-        options, OpenLayers.Protocol.WFS.DEFAULTS
-    );
-    var cls = OpenLayers.Protocol.WFS["v"+options.version.replace(/\./g, "_")];
-    if(!cls) {
-        throw "Unsupported WFS version: " + options.version;
-    }
-    return new cls(options);
-};
 
 
-/**
- * Function: fromWMSLayer
- * Convenience function to create a WFS protocol from a WMS layer.  This makes
- *     the assumption that a WFS requests can be issued at the same URL as
- *     WMS requests and that a WFS featureType exists with the same name as the
- *     WMS layer.
- *     
- * This function is designed to auto-configure <url>, <featureType>,
- *     <featurePrefix> and <srsName> for WFS <version> 1.1.0. Note that
- *     srsName matching with the WMS layer will not work with WFS 1.0.0.
- * 
- * Parameters:
- * layer - {<OpenLayers.Layer.WMS>} WMS layer that has a matching WFS
- *     FeatureType at the same server url with the same typename.
- * options - {Object} Default properties to be set on the protocol.
- *
- * Returns:
- * {<OpenLayers.Protocol.WFS>}
- */
-OpenLayers.Protocol.WFS.fromWMSLayer = function(layer, options) {
-    var typeName, featurePrefix;
-    var param = layer.params["LAYERS"];
-    var parts = (OpenLayers.Util.isArray(param) ? param[0] : param).split(":");
-    if(parts.length > 1) {
-        featurePrefix = parts[0];
-    }
-    typeName = parts.pop();
-    var protocolOptions = {
-        url: layer.url,
-        featureType: typeName,
-        featurePrefix: featurePrefix,
-        srsName: layer.projection && layer.projection.getCode() ||
-                 layer.map && layer.map.getProjectionObject().getCode(),
-        version: "1.1.0"
-    };
-    return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(
-        options, protocolOptions
-    ));
-};
+    /**
+     * APIMethod: removeFeatures
+     * Remove features from the layer.  This erases any drawn features and
+     *     removes them from the layer's control.  The beforefeatureremoved
+     *     and featureremoved events will be triggered for each feature.  The
+     *     featuresremoved event will be triggered after all features have
+     *     been removed.  To suppress event triggering, use the silent option.
+     * 
+     * Parameters:
+     * features - {Array(<OpenLayers.Feature.Vector>)} List of features to be
+     *     removed.
+     * options - {Object} Optional properties for changing behavior of the
+     *     removal.
+     *
+     * Valid options:
+     * silent - {Boolean} Suppress event triggering.  Default is false.
+     */
+    removeFeatures: function(features, options) {
+        if(!features || features.length === 0) {
+            return;
+        }
+        if (features === this.features) {
+            return this.removeAllFeatures(options);
+        }
+        if (!(OpenLayers.Util.isArray(features))) {
+            features = [features];
+        }
+        if (features === this.selectedFeatures) {
+            features = features.slice();
+        }
+
+        var notify = !options || !options.silent;
+        
+        if (notify) {
+            this.events.triggerEvent(
+                "beforefeaturesremoved", {features: features}
+            );
+        }
+
+        for (var i = features.length - 1; i >= 0; i--) {
+            // We remain locked so long as we're not at 0
+            // and the 'next' feature has a geometry. We do the geometry check
+            // because if all the features after the current one are 'null', we
+            // won't call eraseGeometry, so we break the 'renderer functions
+            // will always be called with locked=false *last*' rule. The end result
+            // is a possible gratiutious unlocking to save a loop through the rest 
+            // of the list checking the remaining features every time. So long as
+            // null geoms are rare, this is probably okay.    
+            if (i != 0 && features[i-1].geometry) {
+                this.renderer.locked = true;
+            } else {
+                this.renderer.locked = false;
+            }
+    
+            var feature = features[i];
+            delete this.unrenderedFeatures[feature.id];
 
 
-/**
- * Constant: OpenLayers.Protocol.WFS.DEFAULTS
- */
-OpenLayers.Protocol.WFS.DEFAULTS = {
-    "version": "1.0.0"
-};
-/* ======================================================================
-    OpenLayers/Layer/Markers.js
-   ====================================================================== */
+            if (notify) {
+                this.events.triggerEvent("beforefeatureremoved", {
+                    feature: feature
+                });
+            }
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
+            this.features = OpenLayers.Util.removeItem(this.features, feature);
+            // feature has no layer at this point
+            feature.layer = null;
 
 
+            if (feature.geometry) {
+                this.renderer.eraseFeatures(feature);
+            }
+                    
+            //in the case that this feature is one of the selected features, 
+            // remove it from that array as well.
+            if (OpenLayers.Util.indexOf(this.selectedFeatures, feature) != -1){
+                OpenLayers.Util.removeItem(this.selectedFeatures, feature);
+            }
 
 
-/**
- * @requires OpenLayers/Layer.js
- */
+            if (notify) {
+                this.events.triggerEvent("featureremoved", {
+                    feature: feature
+                });
+            }
+        }
 
 
-/**
- * Class: OpenLayers.Layer.Markers
- * 
- * Inherits from:
- *  - <OpenLayers.Layer> 
- */
-OpenLayers.Layer.Markers = OpenLayers.Class(OpenLayers.Layer, {
-    
-    /** 
-     * APIProperty: isBaseLayer 
-     * {Boolean} Markers layer is never a base layer.  
-     */
-    isBaseLayer: false,
+        if (notify) {
+            this.events.triggerEvent("featuresremoved", {features: features});
+        }
+    },
     
     /** 
     
     /** 
-     * APIProperty: markers 
-     * {Array(<OpenLayers.Marker>)} internal marker list 
+     * APIMethod: removeAllFeatures
+     * Remove all features from the layer.
+     *
+     * Parameters:
+     * options - {Object} Optional properties for changing behavior of the
+     *     removal.
+     *
+     * Valid options:
+     * silent - {Boolean} Suppress event triggering.  Default is false.
      */
      */
-    markers: null,
-
+    removeAllFeatures: function(options) {
+        var notify = !options || !options.silent;
+        var features = this.features;
+        if (notify) {
+            this.events.triggerEvent(
+                "beforefeaturesremoved", {features: features}
+            );
+        }
+        var feature;
+        for (var i = features.length-1; i >= 0; i--) {
+            feature = features[i];
+            if (notify) {
+                this.events.triggerEvent("beforefeatureremoved", {
+                    feature: feature
+                });
+            }
+            feature.layer = null;
+            if (notify) {
+                this.events.triggerEvent("featureremoved", {
+                    feature: feature
+                });
+            }
+        }
+        this.renderer.clear();
+        this.features = [];
+        this.unrenderedFeatures = {};
+        this.selectedFeatures = [];
+        if (notify) {
+            this.events.triggerEvent("featuresremoved", {features: features});
+        }
+    },
 
 
-    /** 
-     * Property: drawn 
-     * {Boolean} internal state of drawing. This is a workaround for the fact
-     * that the map does not call moveTo with a zoomChanged when the map is
-     * first starting up. This lets us catch the case where we have *never*
-     * drawn the layer, and draw it even if the zoom hasn't changed.
-     */
-    drawn: false,
-    
     /**
     /**
-     * Constructor: OpenLayers.Layer.Markers 
-     * Create a Markers layer.
+     * APIMethod: destroyFeatures
+     * Erase and destroy features on the layer.
      *
      * Parameters:
      *
      * Parameters:
-     * name - {String} 
-     * options - {Object} Hashtable of extra options to tag onto the layer
+     * features - {Array(<OpenLayers.Feature.Vector>)} An optional array of
+     *     features to destroy.  If not supplied, all features on the layer
+     *     will be destroyed.
+     * options - {Object}
      */
      */
-    initialize: function(name, options) {
-        OpenLayers.Layer.prototype.initialize.apply(this, arguments);
-        this.markers = [];
+    destroyFeatures: function(features, options) {
+        var all = (features == undefined); // evaluates to true if
+                                           // features is null
+        if(all) {
+            features = this.features;
+        }
+        if(features) {
+            this.removeFeatures(features, options);
+            for(var i=features.length-1; i>=0; i--) {
+                features[i].destroy();
+            }
+        }
+    },
+
+    /**
+     * APIMethod: drawFeature
+     * Draw (or redraw) a feature on the layer.  If the optional style argument
+     * is included, this style will be used.  If no style is included, the
+     * feature's style will be used.  If the feature doesn't have a style,
+     * the layer's style will be used.
+     * 
+     * This function is not designed to be used when adding features to 
+     * the layer (use addFeatures instead). It is meant to be used when
+     * the style of a feature has changed, or in some other way needs to 
+     * visually updated *after* it has already been added to a layer. You
+     * must add the feature to the layer for most layer-related events to 
+     * happen.
+     *
+     * Parameters: 
+     * feature - {<OpenLayers.Feature.Vector>} 
+     * style - {String | Object} Named render intent or full symbolizer object.
+     */
+    drawFeature: function(feature, style) {
+        // don't try to draw the feature with the renderer if the layer is not 
+        // drawn itself
+        if (!this.drawn) {
+            return;
+        }
+        if (typeof style != "object") {
+            if(!style && feature.state === OpenLayers.State.DELETE) {
+                style = "delete";
+            }
+            var renderIntent = style || feature.renderIntent;
+            style = feature.style || this.style;
+            if (!style) {
+                style = this.styleMap.createSymbolizer(feature, renderIntent);
+            }
+        }
+        
+        var drawn = this.renderer.drawFeature(feature, style);
+        //TODO remove the check for null when we get rid of Renderer.SVG
+        if (drawn === false || drawn === null) {
+            this.unrenderedFeatures[feature.id] = feature;
+        } else {
+            delete this.unrenderedFeatures[feature.id];
+        }
     },
     
     /**
     },
     
     /**
-     * APIMethod: destroy 
+     * Method: eraseFeatures
+     * Erase features from the layer.
+     *
+     * Parameters:
+     * features - {Array(<OpenLayers.Feature.Vector>)} 
      */
      */
-    destroy: function() {
-        this.clearMarkers();
-        this.markers = null;
-        OpenLayers.Layer.prototype.destroy.apply(this, arguments);
+    eraseFeatures: function(features) {
+        this.renderer.eraseFeatures(features);
     },
 
     /**
     },
 
     /**
-     * APIMethod: setOpacity
-     * Sets the opacity for all the markers.
-     * 
+     * Method: getFeatureFromEvent
+     * Given an event, return a feature if the event occurred over one.
+     * Otherwise, return null.
+     *
      * Parameters:
      * Parameters:
-     * opacity - {Float}
+     * evt - {Event} 
+     *
+     * Returns:
+     * {<OpenLayers.Feature.Vector>} A feature if one was under the event.
      */
      */
-    setOpacity: function(opacity) {
-        if (opacity != this.opacity) {
-            this.opacity = opacity;
-            for (var i=0, len=this.markers.length; i<len; i++) {
-                this.markers[i].setOpacity(this.opacity);
+    getFeatureFromEvent: function(evt) {
+        if (!this.renderer) {
+            throw new Error('getFeatureFromEvent called on layer with no ' +
+                            'renderer. This usually means you destroyed a ' +
+                            'layer, but not some handler which is associated ' +
+                            'with it.');
+        }
+        var feature = null;
+        var featureId = this.renderer.getFeatureIdFromEvent(evt);
+        if (featureId) {
+            if (typeof featureId === "string") {
+                feature = this.getFeatureById(featureId);
+            } else {
+                feature = featureId;
             }
         }
             }
         }
+        return feature;
     },
 
     },
 
-    /** 
-     * Method: moveTo
+    /**
+     * APIMethod: getFeatureBy
+     * Given a property value, return the feature if it exists in the features array
      *
      * Parameters:
      *
      * Parameters:
-     * bounds - {<OpenLayers.Bounds>} 
-     * zoomChanged - {Boolean} 
-     * dragging - {Boolean} 
+     * property - {String}
+     * value - {String}
+     *
+     * Returns:
+     * {<OpenLayers.Feature.Vector>} A feature corresponding to the given
+     * property value or null if there is no such feature.
      */
      */
-    moveTo:function(bounds, zoomChanged, dragging) {
-        OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
-
-        if (zoomChanged || !this.drawn) {
-            for(var i=0, len=this.markers.length; i<len; i++) {
-                this.drawMarker(this.markers[i]);
+    getFeatureBy: function(property, value) {
+        //TBD - would it be more efficient to use a hash for this.features?
+        var feature = null;
+        for(var i=0, len=this.features.length; i<len; ++i) {
+            if(this.features[i][property] == value) {
+                feature = this.features[i];
+                break;
             }
             }
-            this.drawn = true;
         }
         }
+        return feature;
     },
 
     /**
     },
 
     /**
-     * APIMethod: addMarker
+     * APIMethod: getFeatureById
+     * Given a feature id, return the feature if it exists in the features array
      *
      * Parameters:
      *
      * Parameters:
-     * marker - {<OpenLayers.Marker>} 
+     * featureId - {String}
+     *
+     * Returns:
+     * {<OpenLayers.Feature.Vector>} A feature corresponding to the given
+     * featureId or null if there is no such feature.
      */
      */
-    addMarker: function(marker) {
-        this.markers.push(marker);
-
-        if (this.opacity < 1) {
-            marker.setOpacity(this.opacity);
-        }
-
-        if (this.map && this.map.getExtent()) {
-            marker.map = this.map;
-            this.drawMarker(marker);
-        }
+    getFeatureById: function(featureId) {
+        return this.getFeatureBy('id', featureId);
     },
 
     /**
     },
 
     /**
-     * APIMethod: removeMarker
+     * APIMethod: getFeatureByFid
+     * Given a feature fid, return the feature if it exists in the features array
      *
      * Parameters:
      *
      * Parameters:
-     * marker - {<OpenLayers.Marker>} 
+     * featureFid - {String}
+     *
+     * Returns:
+     * {<OpenLayers.Feature.Vector>} A feature corresponding to the given
+     * featureFid or null if there is no such feature.
      */
      */
-    removeMarker: function(marker) {
-        if (this.markers && this.markers.length) {
-            OpenLayers.Util.removeItem(this.markers, marker);
-            marker.erase();
-        }
+    getFeatureByFid: function(featureFid) {
+        return this.getFeatureBy('fid', featureFid);
     },
     },
-
+    
     /**
     /**
-     * Method: clearMarkers
-     * This method removes all markers from a layer. The markers are not
-     * destroyed by this function, but are removed from the list of markers.
+     * APIMethod: getFeaturesByAttribute
+     * Returns an array of features that have the given attribute key set to the
+     * given value. Comparison of attribute values takes care of datatypes, e.g.
+     * the string '1234' is not equal to the number 1234.
+     *
+     * Parameters:
+     * attrName - {String}
+     * attrValue - {Mixed}
+     *
+     * Returns:
+     * Array({<OpenLayers.Feature.Vector>}) An array of features that have the 
+     * passed named attribute set to the given value.
      */
      */
-    clearMarkers: function() {
-        if (this.markers != null) {
-            while(this.markers.length > 0) {
-                this.removeMarker(this.markers[0]);
+    getFeaturesByAttribute: function(attrName, attrValue) {
+        var i,
+            feature,    
+            len = this.features.length,
+            foundFeatures = [];
+        for(i = 0; i < len; i++) {            
+            feature = this.features[i];
+            if(feature && feature.attributes) {
+                if (feature.attributes[attrName] === attrValue) {
+                    foundFeatures.push(feature);
+                }
             }
         }
             }
         }
+        return foundFeatures;
     },
 
     },
 
-    /** 
-     * Method: drawMarker
-     * Calculate the pixel location for the marker, create it, and 
-     *    add it to the layer's div
+    /**
+     * Unselect the selected features
+     * i.e. clears the featureSelection array
+     * change the style back
+    clearSelection: function() {
+
+       var vectorLayer = this.map.vectorLayer;
+        for (var i = 0; i < this.map.featureSelection.length; i++) {
+            var featureSelection = this.map.featureSelection[i];
+            vectorLayer.drawFeature(featureSelection, vectorLayer.style);
+        }
+        this.map.featureSelection = [];
+    },
+     */
+
+
+    /**
+     * APIMethod: onFeatureInsert
+     * method called after a feature is inserted.
+     * Does nothing by default. Override this if you
+     * need to do something on feature updates.
      *
      *
-     * Parameters:
-     * marker - {<OpenLayers.Marker>} 
+     * Parameters: 
+     * feature - {<OpenLayers.Feature.Vector>} 
      */
      */
-    drawMarker: function(marker) {
-        var px = this.map.getLayerPxFromLonLat(marker.lonlat);
-        if (px == null) {
-            marker.display(false);
-        } else {
-            if (!marker.isDrawn()) {
-                var markerImg = marker.draw(px);
-                this.div.appendChild(markerImg);
-            } else if(marker.icon) {
-                marker.icon.moveTo(px);
-            }
-        }
+    onFeatureInsert: function(feature) {
     },
     
     },
     
+    /**
+     * APIMethod: preFeatureInsert
+     * method called before a feature is inserted.
+     * Does nothing by default. Override this if you
+     * need to do something when features are first added to the
+     * layer, but before they are drawn, such as adjust the style.
+     *
+     * Parameters:
+     * feature - {<OpenLayers.Feature.Vector>} 
+     */
+    preFeatureInsert: function(feature) {
+    },
+
     /** 
      * APIMethod: getDataExtent
     /** 
      * APIMethod: getDataExtent
-     * Calculates the max extent which includes all of the markers.
+     * Calculates the max extent which includes all of the features.
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Bounds>}
+     * {<OpenLayers.Bounds>} or null if the layer has no features with
+     * geometries.
      */
     getDataExtent: function () {
         var maxExtent = null;
      */
     getDataExtent: function () {
         var maxExtent = null;
-        
-        if ( this.markers && (this.markers.length > 0)) {
-            var maxExtent = new OpenLayers.Bounds();
-            for(var i=0, len=this.markers.length; i<len; i++) {
-                var marker = this.markers[i];
-                maxExtent.extend(marker.lonlat);
+        var features = this.features;
+        if(features && (features.length > 0)) {
+            var geometry = null;
+            for(var i=0, len=features.length; i<len; i++) {
+                geometry = features[i].geometry;
+                if (geometry) {
+                    if (maxExtent === null) {
+                        maxExtent = new OpenLayers.Bounds();
+                    }
+                    maxExtent.extend(geometry.getBounds());
+                }
             }
         }
             }
         }
-
         return maxExtent;
     },
 
         return maxExtent;
     },
 
-    CLASS_NAME: "OpenLayers.Layer.Markers"
+    CLASS_NAME: "OpenLayers.Layer.Vector"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Strategy/BBOX.js
+    OpenLayers/Layer/Vector/RootContainer.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Strategy.js
- * @requires OpenLayers/Filter/Spatial.js
+ * @requires OpenLayers/Layer/Vector.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Strategy.BBOX
- * A simple strategy that reads new features when the viewport invalidates
- *     some bounds.
+ * Class: OpenLayers.Layer.Vector.RootContainer
+ * A special layer type to combine multiple vector layers inside a single
+ *     renderer root container. This class is not supposed to be instantiated
+ *     from user space, it is a helper class for controls that require event
+ *     processing for multiple vector layers.
  *
  * Inherits from:
  *
  * Inherits from:
- *  - <OpenLayers.Strategy>
- */
-OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
-    
-    /**
-     * Property: bounds
-     * {<OpenLayers.Bounds>} The current data bounds (in the same projection
-     *     as the layer - not always the same projection as the map).
-     */
-    bounds: null,
-    
-    /** 
-     * Property: resolution 
-     * {Float} The current data resolution. 
-     */ 
-    resolution: null, 
-           
-    /**
-     * APIProperty: ratio
-     * {Float} The ratio of the data bounds to the viewport bounds (in each
-     *     dimension).  Default is 2.
-     */
-    ratio: 2,
-
-    /** 
-     * Property: resFactor 
-     * {Float} Optional factor used to determine when previously requested 
-     *     features are invalid.  If set, the resFactor will be compared to the
-     *     resolution of the previous request to the current map resolution.
-     *     If resFactor > (old / new) and 1/resFactor < (old / new).  If you
-     *     set a resFactor of 1, data will be requested every time the
-     *     resolution changes.  If you set a resFactor of 3, data will be
-     *     requested if the old resolution is 3 times the new, or if the new is
-     *     3 times the old.  If the old bounds do not contain the new bounds
-     *     new data will always be requested (with or without considering
-     *     resFactor). 
-     */ 
-    resFactor: null, 
+ *  - <OpenLayers.Layer.Vector>
+ */
+OpenLayers.Layer.Vector.RootContainer = OpenLayers.Class(OpenLayers.Layer.Vector, {
     
     /**
     
     /**
-     * Property: response
-     * {<OpenLayers.Protocol.Response>} The protocol response object returned
-     *      by the layer protocol.
-     */
-    response: null,
-
-    /**
-     * Constructor: OpenLayers.Strategy.BBOX
-     * Create a new BBOX strategy.
-     *
-     * Parameters:
-     * options - {Object} Optional object whose properties will be set on the
-     *     instance.
+     * Property: displayInLayerSwitcher
+     * Set to false for this layer type
      */
      */
+    displayInLayerSwitcher: false,
     
     /**
     
     /**
-     * Method: activate
-     * Set up strategy with regard to reading new batches of remote data.
-     * 
-     * Returns:
-     * {Boolean} The strategy was successfully activated.
+     * APIProperty: layers
+     * Layers that are attached to this container. Required config option.
      */
      */
-    activate: function() {
-        var activated = OpenLayers.Strategy.prototype.activate.call(this);
-        if(activated) {
-            this.layer.events.on({
-                "moveend": this.update,
-                "refresh": this.update,
-                "visibilitychanged": this.update,
-                scope: this
-            });
-            this.update();
-        }
-        return activated;
-    },
+    layers: null,
     
     /**
     
     /**
-     * Method: deactivate
-     * Tear down strategy with regard to reading new batches of remote data.
+     * Constructor: OpenLayers.Layer.Vector.RootContainer
+     * Create a new root container for multiple vector layer. This constructor
+     * is not supposed to be used from user space, it is only to be used by
+     * controls that need feature selection across multiple vector layers.
+     *
+     * Parameters:
+     * name - {String} A name for the layer
+     * options - {Object} Optional object with non-default properties to set on
+     *           the layer.
      * 
      * 
+     * Required options properties:
+     * layers - {Array(<OpenLayers.Layer.Vector>)} The layers managed by this
+     *     container
+     *
      * Returns:
      * Returns:
-     * {Boolean} The strategy was successfully deactivated.
+     * {<OpenLayers.Layer.Vector.RootContainer>} A new vector layer root
+     *     container
      */
      */
-    deactivate: function() {
-        var deactivated = OpenLayers.Strategy.prototype.deactivate.call(this);
-        if(deactivated) {
-            this.layer.events.un({
-                "moveend": this.update,
-                "refresh": this.update,
-                "visibilitychanged": this.update,
-                scope: this
-            });
-        }
-        return deactivated;
-    },
-
+    
     /**
     /**
-     * Method: update
-     * Callback function called on "moveend" or "refresh" layer events.
-     *
-     * Parameters:
-     * options - {Object} Optional object whose properties will determine
-     *     the behaviour of this Strategy
-     *
-     * Valid options include:
-     * force - {Boolean} if true, new data must be unconditionally read.
-     * noAbort - {Boolean} if true, do not abort previous requests.
+     * Method: display
      */
      */
-    update: function(options) {
-        var mapBounds = this.getMapBounds();
-        if (mapBounds !== null && ((options && options.force) ||
-          (this.layer.visibility && this.layer.calculateInRange() && this.invalidBounds(mapBounds)))) {
-            this.calculateBounds(mapBounds);
-            this.resolution = this.layer.map.getResolution(); 
-            this.triggerRead(options);
-        }
-    },
+    display: function() {},
     
     /**
     
     /**
-     * Method: getMapBounds
-     * Get the map bounds expressed in the same projection as this layer.
-     *
+     * Method: getFeatureFromEvent
+     * walk through the layers to find the feature returned by the event
+     * 
+     * Parameters:
+     * evt - {Object} event object with a feature property
+     * 
      * Returns:
      * Returns:
-     * {<OpenLayers.Bounds>} Map bounds in the projection of the layer.
+     * {<OpenLayers.Feature.Vector>}
      */
      */
-    getMapBounds: function() {
-        if (this.layer.map === null) {
-            return null;
-        }
-        var bounds = this.layer.map.getExtent();
-        if(bounds && !this.layer.projection.equals(
-                this.layer.map.getProjectionObject())) {
-            bounds = bounds.clone().transform(
-                this.layer.map.getProjectionObject(), this.layer.projection
-            );
+    getFeatureFromEvent: function(evt) {
+        var layers = this.layers;
+        var feature;
+        for(var i=0; i<layers.length; i++) {
+            feature = layers[i].getFeatureFromEvent(evt);
+            if(feature) {
+                return feature;
+            }
         }
         }
-        return bounds;
     },
     },
-
+    
     /**
     /**
-     * Method: invalidBounds
-     * Determine whether the previously requested set of features is invalid. 
-     *     This occurs when the new map bounds do not contain the previously 
-     *     requested bounds.  In addition, if <resFactor> is set, it will be 
-     *     considered.
-     *
+     * Method: setMap
+     * 
      * Parameters:
      * Parameters:
-     * mapBounds - {<OpenLayers.Bounds>} the current map extent, will be
-     *      retrieved from the map object if not provided
-     *
-     * Returns:
-     * {Boolean} 
+     * map - {<OpenLayers.Map>}
      */
      */
-    invalidBounds: function(mapBounds) {
-        if(!mapBounds) {
-            mapBounds = this.getMapBounds();
-        }
-        var invalid = !this.bounds || !this.bounds.containsBounds(mapBounds);
-        if(!invalid && this.resFactor) {
-            var ratio = this.resolution / this.layer.map.getResolution();
-            invalid = (ratio >= this.resFactor || ratio <= (1 / this.resFactor));
-        }
-        return invalid;
+    setMap: function(map) {
+        OpenLayers.Layer.Vector.prototype.setMap.apply(this, arguments);
+        this.collectRoots();
+        map.events.register("changelayer", this, this.handleChangeLayer);
     },
     },
+    
     /**
     /**
-     * Method: calculateBounds
-     *
+     * Method: removeMap
+     * 
      * Parameters:
      * Parameters:
-     * mapBounds - {<OpenLayers.Bounds>} the current map extent, will be
-     *      retrieved from the map object if not provided
+     * map - {<OpenLayers.Map>}
      */
      */
-    calculateBounds: function(mapBounds) {
-        if(!mapBounds) {
-            mapBounds = this.getMapBounds();
-        }
-        var center = mapBounds.getCenterLonLat();
-        var dataWidth = mapBounds.getWidth() * this.ratio;
-        var dataHeight = mapBounds.getHeight() * this.ratio;
-        this.bounds = new OpenLayers.Bounds(
-            center.lon - (dataWidth / 2),
-            center.lat - (dataHeight / 2),
-            center.lon + (dataWidth / 2),
-            center.lat + (dataHeight / 2)
-        );
+    removeMap: function(map) {
+        map.events.unregister("changelayer", this, this.handleChangeLayer);
+        this.resetRoots();
+        OpenLayers.Layer.Vector.prototype.removeMap.apply(this, arguments);
     },
     
     /**
     },
     
     /**
-     * Method: triggerRead
-     *
-     * Parameters:
-     * options - {Object} Additional options for the protocol's read method 
-     *     (optional)
-     *
-     * Returns:
-     * {<OpenLayers.Protocol.Response>} The protocol response object
-     *      returned by the layer protocol.
+     * Method: collectRoots
+     * Collects the root nodes of all layers this control is configured with
+     * and moveswien the nodes to this control's layer
      */
      */
-    triggerRead: function(options) {
-        if (this.response && !(options && options.noAbort === true)) {
-            this.layer.protocol.abort(this.response);
-            this.layer.events.triggerEvent("loadend");
+    collectRoots: function() {
+        var layer;
+        // walk through all map layers, because we want to keep the order
+        for(var i=0; i<this.map.layers.length; ++i) {
+            layer = this.map.layers[i];
+            if(OpenLayers.Util.indexOf(this.layers, layer) != -1) {
+                layer.renderer.moveRoot(this.renderer);
+            }
         }
         }
-        var evt = {filter: this.createFilter()};
-        this.layer.events.triggerEvent("loadstart", evt);
-        this.response = this.layer.protocol.read(
-            OpenLayers.Util.applyDefaults({
-                filter: evt.filter,
-                callback: this.merge,
-                scope: this
-        }, options));
     },
     },
+    
     /**
     /**
-     * Method: createFilter
-     * Creates a spatial BBOX filter. If the layer that this strategy belongs
-     * to has a filter property, this filter will be combined with the BBOX 
-     * filter.
-     * 
-     * Returns
-     * {<OpenLayers.Filter>} The filter object.
+     * Method: resetRoots
+     * Resets the root nodes back into the layers they belong to.
      */
      */
-    createFilter: function() {
-        var filter = new OpenLayers.Filter.Spatial({
-            type: OpenLayers.Filter.Spatial.BBOX,
-            value: this.bounds,
-            projection: this.layer.projection
-        });
-        if (this.layer.filter) {
-            filter = new OpenLayers.Filter.Logical({
-                type: OpenLayers.Filter.Logical.AND,
-                filters: [this.layer.filter, filter]
-            });
+    resetRoots: function() {
+        var layer;
+        for(var i=0; i<this.layers.length; ++i) {
+            layer = this.layers[i];
+            if(this.renderer && layer.renderer.getRenderLayerId() == this.id) {
+                this.renderer.moveRoot(layer.renderer);
+            }
         }
         }
-        return filter;
     },
     },
-   
+    
     /**
     /**
-     * Method: merge
-     * Given a list of features, determine which ones to add to the layer.
-     *     If the layer projection differs from the map projection, features
-     *     will be transformed from the layer projection to the map projection.
-     *
+     * Method: handleChangeLayer
+     * Event handler for the map's changelayer event. We need to rebuild
+     * this container's layer dom if order of one of its layers changes.
+     * This handler is added with the setMap method, and removed with the
+     * removeMap method.
+     * 
      * Parameters:
      * Parameters:
-     * resp - {<OpenLayers.Protocol.Response>} The response object passed
-     *      by the protocol.
+     * evt - {Object}
      */
      */
-    merge: function(resp) {
-        this.layer.destroyFeatures();
-        if (resp.success()) {
-            var features = resp.features;
-            if(features && features.length > 0) {
-                var remote = this.layer.projection;
-                var local = this.layer.map.getProjectionObject();
-                if(!local.equals(remote)) {
-                    var geom;
-                    for(var i=0, len=features.length; i<len; ++i) {
-                        geom = features[i].geometry;
-                        if(geom) {
-                            geom.transform(remote, local);
-                        }
-                    }
-                }
-                this.layer.addFeatures(features);
-            }
-        } else {
-            this.bounds = null;
+    handleChangeLayer: function(evt) {
+        var layer = evt.layer;
+        if(evt.property == "order" &&
+                        OpenLayers.Util.indexOf(this.layers, layer) != -1) {
+            this.resetRoots();
+            this.collectRoots();
         }
         }
-        this.response = null;
-        this.layer.events.triggerEvent("loadend", {response: resp});
     },
     },
-   
-    CLASS_NAME: "OpenLayers.Strategy.BBOX" 
+
+    CLASS_NAME: "OpenLayers.Layer.Vector.RootContainer"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Handler/Feature.js
+    OpenLayers/Control/SelectFeature.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 
 /**
- * @requires OpenLayers/Handler.js
+ * @requires OpenLayers/Control.js
+ * @requires OpenLayers/Feature/Vector.js
+ * @requires OpenLayers/Handler/Feature.js
+ * @requires OpenLayers/Layer/Vector/RootContainer.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Handler.Feature 
- * Handler to respond to mouse events related to a drawn feature.  Callbacks
- *     with the following keys will be notified of the following events
- *     associated with features: click, clickout, over, out, and dblclick.
- *
- * This handler stops event propagation for mousedown and mouseup if those
- *     browser events target features that can be selected.
+ * Class: OpenLayers.Control.SelectFeature
+ * The SelectFeature control selects vector features from a given layer on
+ * click or hover.
  *
  * Inherits from:
  *
  * Inherits from:
- *  - <OpenLayers.Handler>
+ *  - <OpenLayers.Control>
  */
  */
-OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
+OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
 
     /**
 
     /**
-     * Property: EVENTMAP
-     * {Object} A object mapping the browser events to objects with callback
-     *     keys for in and out.
+     * APIProperty: events
+     * {<OpenLayers.Events>} Events instance for listeners and triggering
+     *     control specific events.
+     *
+     * Register a listener for a particular event with the following syntax:
+     * (code)
+     * control.events.register(type, obj, listener);
+     * (end)
+     *
+     * Supported event types (in addition to those from <OpenLayers.Control.events>):
+     * beforefeaturehighlighted - Triggered before a feature is highlighted
+     * featurehighlighted - Triggered when a feature is highlighted
+     * featureunhighlighted - Triggered when a feature is unhighlighted
+     * boxselectionstart - Triggered before box selection starts
+     * boxselectionend - Triggered after box selection ends
      */
      */
-    EVENTMAP: {
-        'click': {'in': 'click', 'out': 'clickout'},
-        'mousemove': {'in': 'over', 'out': 'out'},
-        'dblclick': {'in': 'dblclick', 'out': null},
-        'mousedown': {'in': null, 'out': null},
-        'mouseup': {'in': null, 'out': null},
-        'touchstart': {'in': 'click', 'out': 'clickout'}
-    },
 
     /**
 
     /**
-     * Property: feature
-     * {<OpenLayers.Feature.Vector>} The last feature that was hovered.
+     * APIProperty: multipleKey
+     * {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets
+     *     the <multiple> property to true.  Default is null.
      */
      */
-    feature: null,
+    multipleKey: null,
 
     /**
 
     /**
-     * Property: lastFeature
-     * {<OpenLayers.Feature.Vector>} The last feature that was handled.
+     * APIProperty: toggleKey
+     * {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets
+     *     the <toggle> property to true.  Default is null.
      */
      */
-    lastFeature: null,
+    toggleKey: null,
 
     /**
 
     /**
-     * Property: down
-     * {<OpenLayers.Pixel>} The location of the last mousedown.
+     * APIProperty: multiple
+     * {Boolean} Allow selection of multiple geometries.  Default is false.
      */
      */
-    down: null,
+    multiple: false,
 
     /**
 
     /**
-     * Property: up
-     * {<OpenLayers.Pixel>} The location of the last mouseup.
+     * APIProperty: clickout
+     * {Boolean} Unselect features when clicking outside any feature.
+     *     Default is true.
      */
      */
-    up: null,
-    
+    clickout: true,
+
     /**
     /**
-     * Property: clickTolerance
-     * {Number} The number of pixels the mouse can move between mousedown
-     *     and mouseup for the event to still be considered a click.
-     *     Dragging the map should not trigger the click and clickout callbacks
-     *     unless the map is moved by less than this tolerance. Defaults to 4.
+     * APIProperty: toggle
+     * {Boolean} Unselect a selected feature on click.  Default is false.  Only
+     *     has meaning if hover is false.
      */
      */
-    clickTolerance: 4,
+    toggle: false,
 
     /**
 
     /**
-     * Property: geometryTypes
-     * To restrict dragging to a limited set of geometry types, send a list
-     * of strings corresponding to the geometry class names.
-     * 
-     * @type Array(String)
+     * APIProperty: hover
+     * {Boolean} Select on mouse over and deselect on mouse out.  If true, this
+     * ignores clicks and only listens to mouse moves.
+     */
+    hover: false,
+
+    /**
+     * APIProperty: highlightOnly
+     * {Boolean} If true do not actually select features (that is place them in
+     * the layer's selected features array), just highlight them. This property
+     * has no effect if hover is false. Defaults to false.
+     */
+    highlightOnly: false,
+
+    /**
+     * APIProperty: box
+     * {Boolean} Allow feature selection by drawing a box.
+     */
+    box: false,
+
+    /**
+     * APIProperty: onBeforeSelect
+     * {Function} Optional function to be called before a feature is selected.
+     *     The function should expect to be called with a feature.
+     */
+    onBeforeSelect: function() {},
+
+    /**
+     * APIProperty: onSelect
+     * {Function} Optional function to be called when a feature is selected.
+     *     The function should expect to be called with a feature.
+     */
+    onSelect: function() {},
+
+    /**
+     * APIProperty: onUnselect
+     * {Function} Optional function to be called when a feature is unselected.
+     *     The function should expect to be called with a feature.
+     */
+    onUnselect: function() {},
+
+    /**
+     * APIProperty: scope
+     * {Object} The scope to use with the onBeforeSelect, onSelect, onUnselect
+     *     callbacks. If null the scope will be this control.
+     */
+    scope: null,
+
+    /**
+     * APIProperty: geometryTypes
+     * {Array(String)} To restrict selecting to a limited set of geometry types,
+     *     send a list of strings corresponding to the geometry class names.
      */
     geometryTypes: null,
 
     /**
      */
     geometryTypes: null,
 
     /**
-     * Property: stopClick
-     * {Boolean} If stopClick is set to true, handled clicks do not
-     *      propagate to other click listeners. Otherwise, handled clicks
-     *      do propagate. Unhandled clicks always propagate, whatever the
-     *      value of stopClick. Defaults to true.
+     * Property: layer
+     * {<OpenLayers.Layer.Vector>} The vector layer with a common renderer
+     * root for all layers this control is configured with (if an array of
+     * layers was passed to the constructor), or the vector layer the control
+     * was configured with (if a single layer was passed to the constructor).
      */
      */
-    stopClick: true,
+    layer: null,
 
     /**
 
     /**
-     * Property: stopDown
-     * {Boolean} If stopDown is set to true, handled mousedowns do not
-     *      propagate to other mousedown listeners. Otherwise, handled
-     *      mousedowns do propagate. Unhandled mousedowns always propagate,
-     *      whatever the value of stopDown. Defaults to true.
+     * Property: layers
+     * {Array(<OpenLayers.Layer.Vector>)} The layers this control will work on,
+     * or null if the control was configured with a single layer
      */
      */
-    stopDown: true,
+    layers: null,
 
     /**
 
     /**
-     * Property: stopUp
-     * {Boolean} If stopUp is set to true, handled mouseups do not
-     *      propagate to other mouseup listeners. Otherwise, handled mouseups
-     *      do propagate. Unhandled mouseups always propagate, whatever the
-     *      value of stopUp. Defaults to false.
+     * APIProperty: callbacks
+     * {Object} The functions that are sent to the handlers.feature for callback
      */
      */
-    stopUp: false,
-    
+    callbacks: null,
+
+    /**
+     * APIProperty: selectStyle
+     * {Object} Hash of styles
+     */
+    selectStyle: null,
+
+    /**
+     * APIProperty: renderIntent
+     * {String} key used to retrieve the select style from the layer's
+     * style map.
+     */
+    renderIntent: "select",
+
+    /**
+     * Property: handlers
+     * {Object} Object with references to multiple <OpenLayers.Handler>
+     *     instances.
+     */
+    handlers: null,
+
+    /**
+     * Constructor: OpenLayers.Control.SelectFeature
+     * Create a new control for selecting features.
+     *
+     * Parameters:
+     * layers - {<OpenLayers.Layer.Vector>}, or an array of vector layers. The
+     *     layer(s) this control will select features from.
+     * options - {Object}
+     */
+    initialize: function(layers, options) {
+        OpenLayers.Control.prototype.initialize.apply(this, [options]);
+
+        if(this.scope === null) {
+            this.scope = this;
+        }
+        this.initLayer(layers);
+        var callbacks = {
+            click: this.clickFeature,
+            clickout: this.clickoutFeature
+        };
+        if (this.hover) {
+            callbacks.over = this.overFeature;
+            callbacks.out = this.outFeature;
+        }
+
+        this.callbacks = OpenLayers.Util.extend(callbacks, this.callbacks);
+        this.handlers = {
+            feature: new OpenLayers.Handler.Feature(
+                this, this.layer, this.callbacks,
+                {geometryTypes: this.geometryTypes}
+            )
+        };
+
+        if (this.box) {
+            this.handlers.box = new OpenLayers.Handler.Box(
+                this, {done: this.selectBox},
+                {boxDivClassName: "olHandlerBoxSelectFeature"}
+            );
+        }
+    },
+
     /**
     /**
-     * Constructor: OpenLayers.Handler.Feature
+     * Method: initLayer
+     * Assign the layer property. If layers is an array, we need to use
+     *     a RootContainer.
      *
      * Parameters:
      *
      * Parameters:
-     * control - {<OpenLayers.Control>} 
-     * layer - {<OpenLayers.Layer.Vector>}
-     * callbacks - {Object} An object with a 'over' property whos value is
-     *     a function to be called when the mouse is over a feature. The 
-     *     callback should expect to recieve a single argument, the feature.
-     * options - {Object} 
+     * layers - {<OpenLayers.Layer.Vector>}, or an array of vector layers.
      */
      */
-    initialize: function(control, layer, callbacks, options) {
-        OpenLayers.Handler.prototype.initialize.apply(this, [control, callbacks, options]);
-        this.layer = layer;
+    initLayer: function(layers) {
+        if(OpenLayers.Util.isArray(layers)) {
+            this.layers = layers;
+            this.layer = new OpenLayers.Layer.Vector.RootContainer(
+                this.id + "_container", {
+                    layers: layers
+                }
+            );
+        } else {
+            this.layer = layers;
+        }
     },
 
     /**
     },
 
     /**
-     * Method: touchstart
-     * Handle touchstart events
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * Method: destroy
      */
      */
-    touchstart: function(evt) {
-        this.startTouch(); 
-        return OpenLayers.Event.isMultiTouch(evt) ?
-                true : this.mousedown(evt);
+    destroy: function() {
+        if(this.active && this.layers) {
+            this.map.removeLayer(this.layer);
+        }
+        OpenLayers.Control.prototype.destroy.apply(this, arguments);
+        if(this.layers) {
+            this.layer.destroy();
+        }
     },
 
     /**
     },
 
     /**
-     * Method: touchmove
-     * Handle touchmove events. We just prevent the browser default behavior,
-     *    for Android Webkit not to select text when moving the finger after
-     *    selecting a feature.
+     * Method: activate
+     * Activates the control.
      *
      *
-     * Parameters:
-     * evt - {Event}
+     * Returns:
+     * {Boolean} The control was effectively activated.
      */
      */
-    touchmove: function(evt) {
-        OpenLayers.Event.preventDefault(evt);
+    activate: function () {
+        if (!this.active) {
+            if(this.layers) {
+                this.map.addLayer(this.layer);
+            }
+            this.handlers.feature.activate();
+            if(this.box && this.handlers.box) {
+                this.handlers.box.activate();
+            }
+        }
+        return OpenLayers.Control.prototype.activate.apply(
+            this, arguments
+        );
     },
 
     /**
     },
 
     /**
-     * Method: mousedown
-     * Handle mouse down.  Stop propagation if a feature is targeted by this
-     *     event (stops map dragging during feature selection).
-     * 
-     * Parameters:
-     * evt - {Event} 
+     * Method: deactivate
+     * Deactivates the control.
+     *
+     * Returns:
+     * {Boolean} The control was effectively deactivated.
      */
      */
-    mousedown: function(evt) {
-        // Feature selection is only done with a left click. Other handlers may stop the
-        // propagation of left-click mousedown events but not right-click mousedown events.
-        // This mismatch causes problems when comparing the location of the down and up
-        // events in the click function so it is important ignore right-clicks.
-        if (OpenLayers.Event.isLeftClick(evt) || OpenLayers.Event.isSingleTouch(evt)) {
-            this.down = evt.xy;
+    deactivate: function () {
+        if (this.active) {
+            this.handlers.feature.deactivate();
+            if(this.handlers.box) {
+                this.handlers.box.deactivate();
+            }
+            if(this.layers) {
+                this.map.removeLayer(this.layer);
+            }
         }
         }
-        return this.handle(evt) ? !this.stopDown : true;
+        return OpenLayers.Control.prototype.deactivate.apply(
+            this, arguments
+        );
     },
     },
-    
+
     /**
     /**
-     * Method: mouseup
-     * Handle mouse up.  Stop propagation if a feature is targeted by this
-     *     event.
-     * 
+     * Method: unselectAll
+     * Unselect all selected features.  To unselect all except for a single
+     *     feature, set the options.except property to the feature.
+     *
      * Parameters:
      * Parameters:
-     * evt - {Event} 
+     * options - {Object} Optional configuration object.
      */
      */
-    mouseup: function(evt) {
-        this.up = evt.xy;
-        return this.handle(evt) ? !this.stopUp : true;
+    unselectAll: function(options) {
+        // we'll want an option to suppress notification here
+        var layers = this.layers || [this.layer],
+            layer, feature, l, numExcept;
+        for(l=0; l<layers.length; ++l) {
+            layer = layers[l];
+            numExcept = 0;
+            //layer.selectedFeatures is null when layer is destroyed and
+            //one of it's preremovelayer listener calls setLayer
+            //with another layer on this control
+            if(layer.selectedFeatures != null) {
+                while(layer.selectedFeatures.length > numExcept) {
+                    feature = layer.selectedFeatures[numExcept];
+                    if(!options || options.except != feature) {
+                        this.unselect(feature);
+                    } else {
+                        ++numExcept;
+                    }
+                }
+            }
+        }
     },
 
     /**
     },
 
     /**
-     * Method: click
-     * Handle click.  Call the "click" callback if click on a feature,
-     *     or the "clickout" callback if click outside any feature.
-     * 
-     * Parameters:
-     * evt - {Event} 
+     * Method: clickFeature
+     * Called on click in a feature
+     * Only responds if this.hover is false.
      *
      *
-     * Returns:
-     * {Boolean}
+     * Parameters:
+     * feature - {<OpenLayers.Feature.Vector>}
      */
      */
-    click: function(evt) {
-        return this.handle(evt) ? !this.stopClick : true;
+    clickFeature: function(feature) {
+        if(!this.hover) {
+            var selected = (OpenLayers.Util.indexOf(
+                feature.layer.selectedFeatures, feature) > -1);
+            if(selected) {
+                if(this.toggleSelect()) {
+                    this.unselect(feature);
+                } else if(!this.multipleSelect()) {
+                    this.unselectAll({except: feature});
+                }
+            } else {
+                if(!this.multipleSelect()) {
+                    this.unselectAll({except: feature});
+                }
+                this.select(feature);
+            }
+        }
     },
     },
-        
+
     /**
     /**
-     * Method: mousemove
-     * Handle mouse moves.  Call the "over" callback if moving in to a feature,
-     *     or the "out" callback if moving out of a feature.
-     * 
-     * Parameters:
-     * evt - {Event} 
+     * Method: multipleSelect
+     * Allow for multiple selected features based on <multiple> property and
+     *     <multipleKey> event modifier.
      *
      * Returns:
      *
      * Returns:
-     * {Boolean}
+     * {Boolean} Allow for multiple selected features.
      */
      */
-    mousemove: function(evt) {
-        if (!this.callbacks['over'] && !this.callbacks['out']) {
-            return true;
-        }     
-        this.handle(evt);
-        return true;
+    multipleSelect: function() {
+        return this.multiple || (this.handlers.feature.evt &&
+                                 this.handlers.feature.evt[this.multipleKey]);
     },
     },
-    
+
     /**
     /**
-     * Method: dblclick
-     * Handle dblclick.  Call the "dblclick" callback if dblclick on a feature.
-     *
-     * Parameters:
-     * evt - {Event} 
+     * Method: toggleSelect
+     * Event should toggle the selected state of a feature based on <toggle>
+     *     property and <toggleKey> event modifier.
      *
      * Returns:
      *
      * Returns:
-     * {Boolean}
+     * {Boolean} Toggle the selected state of a feature.
      */
      */
-    dblclick: function(evt) {
-        return !this.handle(evt);
+    toggleSelect: function() {
+        return this.toggle || (this.handlers.feature.evt &&
+                               this.handlers.feature.evt[this.toggleKey]);
     },
 
     /**
     },
 
     /**
-     * Method: geometryTypeMatches
-     * Return true if the geometry type of the passed feature matches
-     *     one of the geometry types in the geometryTypes array.
+     * Method: clickoutFeature
+     * Called on click outside a previously clicked (selected) feature.
+     * Only responds if this.hover is false.
      *
      * Parameters:
      * feature - {<OpenLayers.Vector.Feature>}
      *
      * Parameters:
      * feature - {<OpenLayers.Vector.Feature>}
-     *
-     * Returns:
-     * {Boolean}
      */
      */
-    geometryTypeMatches: function(feature) {
-        return this.geometryTypes == null ||
-            OpenLayers.Util.indexOf(this.geometryTypes,
-                                    feature.geometry.CLASS_NAME) > -1;
+    clickoutFeature: function(feature) {
+        if(!this.hover && this.clickout) {
+            this.unselectAll();
+        }
     },
 
     /**
     },
 
     /**
-     * Method: handle
+     * Method: overFeature
+     * Called on over a feature.
+     * Only responds if this.hover is true.
      *
      * Parameters:
      *
      * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} The event occurred over a relevant feature.
+     * feature - {<OpenLayers.Feature.Vector>}
      */
      */
-    handle: function(evt) {
-        if(this.feature && !this.feature.layer) {
-            // feature has been destroyed
-            this.feature = null;
-        }
-        var type = evt.type;
-        var handled = false;
-        var previouslyIn = !!(this.feature); // previously in a feature
-        var click = (type == "click" || type == "dblclick" || type == "touchstart");
-        this.feature = this.layer.getFeatureFromEvent(evt);
-        if(this.feature && !this.feature.layer) {
-            // feature has been destroyed
-            this.feature = null;
-        }
-        if(this.lastFeature && !this.lastFeature.layer) {
-            // last feature has been destroyed
-            this.lastFeature = null;
-        }
-        if(this.feature) {
-            if(type === "touchstart") {
-                // stop the event to prevent Android Webkit from
-                // "flashing" the map div
-                OpenLayers.Event.preventDefault(evt);
-            }
-            var inNew = (this.feature != this.lastFeature);
-            if(this.geometryTypeMatches(this.feature)) {
-                // in to a feature
-                if(previouslyIn && inNew) {
-                    // out of last feature and in to another
-                    if(this.lastFeature) {
-                        this.triggerCallback(type, 'out', [this.lastFeature]);
-                    }
-                    this.triggerCallback(type, 'in', [this.feature]);
-                } else if(!previouslyIn || click) {
-                    // in feature for the first time
-                    this.triggerCallback(type, 'in', [this.feature]);
-                }
-                this.lastFeature = this.feature;
-                handled = true;
-            } else {
-                // not in to a feature
-                if(this.lastFeature && (previouslyIn && inNew || click)) {
-                    // out of last feature for the first time
-                    this.triggerCallback(type, 'out', [this.lastFeature]);
-                }
-                // next time the mouse goes in a feature whose geometry type
-                // doesn't match we don't want to call the 'out' callback
-                // again, so let's set this.feature to null so that
-                // previouslyIn will evaluate to false the next time
-                // we enter handle. Yes, a bit hackish...
-                this.feature = null;
+    overFeature: function(feature) {
+        var layer = feature.layer;
+        if(this.hover) {
+            if(this.highlightOnly) {
+                this.highlight(feature);
+            } else if(OpenLayers.Util.indexOf(
+                layer.selectedFeatures, feature) == -1) {
+                this.select(feature);
             }
             }
-        } else if(this.lastFeature && (previouslyIn || click)) {
-            this.triggerCallback(type, 'out', [this.lastFeature]);
         }
         }
-        return handled;
     },
     },
-    
+
     /**
     /**
-     * Method: triggerCallback
-     * Call the callback keyed in the event map with the supplied arguments.
-     *     For click and clickout, the <clickTolerance> is checked first.
+     * Method: outFeature
+     * Called on out of a selected feature.
+     * Only responds if this.hover is true.
      *
      * Parameters:
      *
      * Parameters:
-     * type - {String}
+     * feature - {<OpenLayers.Feature.Vector>}
      */
      */
-    triggerCallback: function(type, mode, args) {
-        var key = this.EVENTMAP[type][mode];
-        if(key) {
-            if(type == 'click' && this.up && this.down) {
-                // for click/clickout, only trigger callback if tolerance is met
-                var dpx = Math.sqrt(
-                    Math.pow(this.up.x - this.down.x, 2) +
-                    Math.pow(this.up.y - this.down.y, 2)
-                );
-                if(dpx <= this.clickTolerance) {
-                    this.callback(key, args);
+    outFeature: function(feature) {
+        if(this.hover) {
+            if(this.highlightOnly) {
+                // we do nothing if we're not the last highlighter of the
+                // feature
+                if(feature._lastHighlighter == this.id) {
+                    // if another select control had highlighted the feature before
+                    // we did it ourself then we use that control to highlight the
+                    // feature as it was before we highlighted it, else we just
+                    // unhighlight it
+                    if(feature._prevHighlighter &&
+                       feature._prevHighlighter != this.id) {
+                        delete feature._lastHighlighter;
+                        var control = this.map.getControl(
+                            feature._prevHighlighter);
+                        if(control) {
+                            control.highlight(feature);
+                        }
+                    } else {
+                        this.unhighlight(feature);
+                    }
                 }
                 }
-                // we're done with this set of events now: clear the cached
-                // positions so we can't trip over them later (this can occur
-                // if one of the up/down events gets eaten before it gets to us
-                // but we still get the click)
-                this.up = this.down = null;
             } else {
             } else {
-                this.callback(key, args);
+                this.unselect(feature);
             }
         }
     },
 
     /**
             }
         }
     },
 
     /**
-     * Method: activate 
-     * Turn on the handler.  Returns false if the handler was already active.
+     * Method: highlight
+     * Redraw feature with the select style.
      *
      *
-     * Returns:
-     * {Boolean}
+     * Parameters:
+     * feature - {<OpenLayers.Feature.Vector>}
      */
      */
-    activate: function() {
-        var activated = false;
-        if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
-            this.moveLayerToTop();
-            this.map.events.on({
-                "removelayer": this.handleMapEvents,
-                "changelayer": this.handleMapEvents,
-                scope: this
-            });
-            activated = true;
+    highlight: function(feature) {
+        var layer = feature.layer;
+        var cont = this.events.triggerEvent("beforefeaturehighlighted", {
+            feature : feature
+        });
+        if(cont !== false) {
+            feature._prevHighlighter = feature._lastHighlighter;
+            feature._lastHighlighter = this.id;
+            var style = this.selectStyle || this.renderIntent;
+            layer.drawFeature(feature, style);
+            this.events.triggerEvent("featurehighlighted", {feature : feature});
         }
         }
-        return activated;
     },
     },
-    
+
     /**
     /**
-     * Method: deactivate 
-     * Turn off the handler.  Returns false if the handler was already active.
+     * Method: unhighlight
+     * Redraw feature with the "default" style
      *
      *
-     * Returns: 
-     * {Boolean}
-     */
-    deactivate: function() {
-        var deactivated = false;
-        if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
-            this.moveLayerBack();
-            this.feature = null;
-            this.lastFeature = null;
-            this.down = null;
-            this.up = null;
-            this.map.events.un({
-                "removelayer": this.handleMapEvents,
-                "changelayer": this.handleMapEvents,
-                scope: this
-            });
-            deactivated = true;
-        }
-        return deactivated;
-    },
-    
-    /**
-     * Method: handleMapEvents
-     * 
      * Parameters:
      * Parameters:
-     * evt - {Object}
-     */
-    handleMapEvents: function(evt) {
-        if (evt.type == "removelayer" || evt.property == "order") {
-            this.moveLayerToTop();
-        }
-    },
-    
-    /**
-     * Method: moveLayerToTop
-     * Moves the layer for this handler to the top, so mouse events can reach
-     * it.
-     */
-    moveLayerToTop: function() {
-        var index = Math.max(this.map.Z_INDEX_BASE['Feature'] - 1,
-            this.layer.getZIndex()) + 1;
-        this.layer.setZIndex(index);
-        
-    },
-    
-    /**
-     * Method: moveLayerBack
-     * Moves the layer back to the position determined by the map's layers
-     * array.
+     * feature - {<OpenLayers.Feature.Vector>}
      */
      */
-    moveLayerBack: function() {
-        var index = this.layer.getZIndex() - 1;
-        if (index >= this.map.Z_INDEX_BASE['Feature']) {
-            this.layer.setZIndex(index);
+    unhighlight: function(feature) {
+        var layer = feature.layer;
+        // three cases:
+        // 1. there's no other highlighter, in that case _prev is undefined,
+        //    and we just need to undef _last
+        // 2. another control highlighted the feature after we did it, in
+        //    that case _last references this other control, and we just
+        //    need to undef _prev
+        // 3. another control highlighted the feature before we did it, in
+        //    that case _prev references this other control, and we need to
+        //    set _last to _prev and undef _prev
+        if(feature._prevHighlighter == undefined) {
+            delete feature._lastHighlighter;
+        } else if(feature._prevHighlighter == this.id) {
+            delete feature._prevHighlighter;
         } else {
         } else {
-            this.map.setLayerZIndex(this.layer,
-                this.map.getLayerIndex(this.layer));
+            feature._lastHighlighter = feature._prevHighlighter;
+            delete feature._prevHighlighter;
         }
         }
+        layer.drawFeature(feature, feature.style || feature.layer.style ||
+            "default");
+        this.events.triggerEvent("featureunhighlighted", {feature : feature});
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Handler.Feature"
-});
-/* ======================================================================
-    OpenLayers/StyleMap.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/BaseTypes/Class.js
- * @requires OpenLayers/Style.js
- * @requires OpenLayers/Feature/Vector.js
- */
-/**
- * Class: OpenLayers.StyleMap
- */
-OpenLayers.StyleMap = OpenLayers.Class({
-    
     /**
     /**
-     * Property: styles
-     * {Object} Hash of {<OpenLayers.Style>}, keyed by names of well known
-     * rendering intents (e.g. "default", "temporary", "select", "delete").
+     * Method: select
+     * Add feature to the layer's selectedFeature array, render the feature as
+     * selected, and call the onSelect function.
+     *
+     * Parameters:
+     * feature - {<OpenLayers.Feature.Vector>}
      */
      */
-    styles: null,
-    
-    /**
-     * Property: extendDefault
-     * {Boolean} if true, every render intent will extend the symbolizers
-     * specified for the "default" intent at rendering time. Otherwise, every
-     * rendering intent will be treated as a completely independent style.
+    select: function(feature) {
+        var cont = this.onBeforeSelect.call(this.scope, feature);
+        var layer = feature.layer;
+        if(cont !== false) {
+            cont = layer.events.triggerEvent("beforefeatureselected", {
+                feature: feature
+            });
+            if(cont !== false) {
+                layer.selectedFeatures.push(feature);
+                this.highlight(feature);
+                // if the feature handler isn't involved in the feature
+                // selection (because the box handler is used or the
+                // feature is selected programatically) we fake the
+                // feature handler to allow unselecting on click
+                if(!this.handlers.feature.lastFeature) {
+                    this.handlers.feature.lastFeature = layer.selectedFeatures[0];
+                }
+                layer.events.triggerEvent("featureselected", {feature: feature});
+                this.onSelect.call(this.scope, feature);
+            }
+        }
+    },
+
+    /**
+     * Method: unselect
+     * Remove feature from the layer's selectedFeature array, render the feature as
+     * normal, and call the onUnselect function.
+     *
+     * Parameters:
+     * feature - {<OpenLayers.Feature.Vector>}
      */
      */
-    extendDefault: true,
-    
+    unselect: function(feature) {
+        var layer = feature.layer;
+        // Store feature style for restoration later
+        this.unhighlight(feature);
+        OpenLayers.Util.removeItem(layer.selectedFeatures, feature);
+        layer.events.triggerEvent("featureunselected", {feature: feature});
+        this.onUnselect.call(this.scope, feature);
+    },
+
     /**
     /**
-     * Constructor: OpenLayers.StyleMap
-     * 
+     * Method: selectBox
+     * Callback from the handlers.box set up when <box> selection is true
+     *     on.
+     *
      * Parameters:
      * Parameters:
-     * style   - {Object} Optional. Either a style hash, or a style object, or
-     *           a hash of style objects (style hashes) keyed by rendering
-     *           intent. If just one style hash or style object is passed,
-     *           this will be used for all known render intents (default,
-     *           select, temporary)
-     * options - {Object} optional hash of additional options for this
-     *           instance
+     * position - {<OpenLayers.Bounds> || <OpenLayers.Pixel> }
      */
      */
-    initialize: function (style, options) {
-        this.styles = {
-            "default": new OpenLayers.Style(
-                OpenLayers.Feature.Vector.style["default"]),
-            "select": new OpenLayers.Style(
-                OpenLayers.Feature.Vector.style["select"]),
-            "temporary": new OpenLayers.Style(
-                OpenLayers.Feature.Vector.style["temporary"]),
-            "delete": new OpenLayers.Style(
-                OpenLayers.Feature.Vector.style["delete"])
-        };
-        
-        // take whatever the user passed as style parameter and convert it
-        // into parts of stylemap.
-        if(style instanceof OpenLayers.Style) {
-            // user passed a style object
-            this.styles["default"] = style;
-            this.styles["select"] = style;
-            this.styles["temporary"] = style;
-            this.styles["delete"] = style;
-        } else if(typeof style == "object") {
-            for(var key in style) {
-                if(style[key] instanceof OpenLayers.Style) {
-                    // user passed a hash of style objects
-                    this.styles[key] = style[key];
-                } else if(typeof style[key] == "object") {
-                    // user passsed a hash of style hashes
-                    this.styles[key] = new OpenLayers.Style(style[key]);
-                } else {
-                    // user passed a style hash (i.e. symbolizer)
-                    this.styles["default"] = new OpenLayers.Style(style);
-                    this.styles["select"] = new OpenLayers.Style(style);
-                    this.styles["temporary"] = new OpenLayers.Style(style);
-                    this.styles["delete"] = new OpenLayers.Style(style);
-                    break;
+    selectBox: function(position) {
+        if (position instanceof OpenLayers.Bounds) {
+            var minXY = this.map.getLonLatFromPixel({
+                x: position.left,
+                y: position.bottom
+            });
+            var maxXY = this.map.getLonLatFromPixel({
+                x: position.right,
+                y: position.top
+            });
+            var bounds = new OpenLayers.Bounds(
+                minXY.lon, minXY.lat, maxXY.lon, maxXY.lat
+            );
+
+            // if multiple is false, first deselect currently selected features
+            if (!this.multipleSelect()) {
+                this.unselectAll();
+            }
+
+            // because we're using a box, we consider we want multiple selection
+            var prevMultiple = this.multiple;
+            this.multiple = true;
+            var layers = this.layers || [this.layer];
+            this.events.triggerEvent("boxselectionstart", {layers: layers});
+            var layer;
+            for(var l=0; l<layers.length; ++l) {
+                layer = layers[l];
+                for(var i=0, len = layer.features.length; i<len; ++i) {
+                    var feature = layer.features[i];
+                    // check if the feature is displayed
+                    if (!feature.getVisibility()) {
+                        continue;
+                    }
+
+                    if (this.geometryTypes == null || OpenLayers.Util.indexOf(
+                            this.geometryTypes, feature.geometry.CLASS_NAME) > -1) {
+                        if (bounds.toGeometry().intersects(feature.geometry)) {
+                            if (OpenLayers.Util.indexOf(layer.selectedFeatures, feature) == -1) {
+                                this.select(feature);
+                            }
+                        }
+                    }
                 }
             }
                 }
             }
+            this.multiple = prevMultiple;
+            this.events.triggerEvent("boxselectionend", {layers: layers});
         }
         }
-        OpenLayers.Util.extend(this, options);
     },
 
     /**
     },
 
     /**
-     * Method: destroy
+     * Method: setMap
+     * Set the map property for the control.
+     *
+     * Parameters:
+     * map - {<OpenLayers.Map>}
      */
      */
-    destroy: function() {
-        for(var key in this.styles) {
-            this.styles[key].destroy();
+    setMap: function(map) {
+        this.handlers.feature.setMap(map);
+        if (this.box) {
+            this.handlers.box.setMap(map);
         }
         }
-        this.styles = null;
+        OpenLayers.Control.prototype.setMap.apply(this, arguments);
     },
     },
-    
+
     /**
     /**
-     * Method: createSymbolizer
-     * Creates the symbolizer for a feature for a render intent.
-     * 
+     * APIMethod: setLayer
+     * Attach a new layer to the control, overriding any existing layers.
+     *
      * Parameters:
      * Parameters:
-     * feature - {<OpenLayers.Feature>} The feature to evaluate the rules
-     *           of the intended style against.
-     * intent  - {String} The intent determines the symbolizer that will be
-     *           used to draw the feature. Well known intents are "default"
-     *           (for just drawing the features), "select" (for selected
-     *           features) and "temporary" (for drawing features).
-     * 
-     * Returns:
-     * {Object} symbolizer hash
+     * layers - Array of {<OpenLayers.Layer.Vector>} or a single
+     *     {<OpenLayers.Layer.Vector>}
      */
      */
-    createSymbolizer: function(feature, intent) {
-        if(!feature) {
-            feature = new OpenLayers.Feature.Vector();
-        }
-        if(!this.styles[intent]) {
-            intent = "default";
+    setLayer: function(layers) {
+        var isActive = this.active;
+        this.unselectAll();
+        this.deactivate();
+        if(this.layers) {
+            this.layer.destroy();
+            this.layers = null;
         }
         }
-        feature.renderIntent = intent;
-        var defaultSymbolizer = {};
-        if(this.extendDefault && intent != "default") {
-            defaultSymbolizer = this.styles["default"].createSymbolizer(feature);
+        this.initLayer(layers);
+        this.handlers.feature.layer = this.layer;
+        if (isActive) {
+            this.activate();
         }
         }
-        return OpenLayers.Util.extend(defaultSymbolizer,
-            this.styles[intent].createSymbolizer(feature));
     },
     
     /**
     },
     
     /**
-     * Method: addUniqueValueRules
-     * Convenience method to create comparison rules for unique values of a
-     * property. The rules will be added to the style object for a specified
-     * rendering intent. This method is a shortcut for creating something like
-     * the "unique value legends" familiar from well known desktop GIS systems
-     * 
+     * APIMethod: addLayer
+     * Add a layer to the control, making the existing layers still selectable
+     *
      * Parameters:
      * Parameters:
-     * renderIntent - {String} rendering intent to add the rules to
-     * property     - {String} values of feature attributes to create the
-     *                rules for
-     * symbolizers  - {Object} Hash of symbolizers, keyed by the desired
-     *                property values 
-     * context      - {Object} An optional object with properties that
-     *                symbolizers' property values should be evaluated
-     *                against. If no context is specified, feature.attributes
-     *                will be used
+     * layer - element <OpenLayers.Layer.Vector> 
      */
      */
-    addUniqueValueRules: function(renderIntent, property, symbolizers, context) {
-        var rules = [];
-        for (var value in symbolizers) {
-            rules.push(new OpenLayers.Rule({
-                symbolizer: symbolizers[value],
-                context: context,
-                filter: new OpenLayers.Filter.Comparison({
-                    type: OpenLayers.Filter.Comparison.EQUAL_TO,
-                    property: property,
-                    value: value
-                })
-            }));
+    addLayer: function( layer ) {
+        var isActive = this.active;
+        this.deactivate();
+        if (this.layers == null) {
+            if (this.layer != null) {
+                this.layers = [this.layer];
+                this.layers.push(layer);
+            } else {
+                this.layers = [layer];
+            }
+        } else {       
+            this.layers.push(layer);
         }
         }
-        this.styles[renderIntent].addRules(rules);
-    },
+        this.initLayer(this.layers);
+        this.handlers.feature.layer = this.layer;
+        if (isActive) {
+            this.activate();
+        }
+    },     
 
 
-    CLASS_NAME: "OpenLayers.StyleMap"
+    CLASS_NAME: "OpenLayers.Control.SelectFeature"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Layer/Vector.js
+    OpenLayers/Format/JSON.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Layer.js
- * @requires OpenLayers/Renderer.js
- * @requires OpenLayers/StyleMap.js
- * @requires OpenLayers/Feature/Vector.js
- * @requires OpenLayers/Console.js
- * @requires OpenLayers/Lang.js
+ * Note:
+ * This work draws heavily from the public domain JSON serializer/deserializer
+ *     at http://www.json.org/json.js. Rewritten so that it doesn't modify
+ *     basic data prototypes.
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Layer.Vector
- * Instances of OpenLayers.Layer.Vector are used to render vector data from
- *     a variety of sources. Create a new vector layer with the
- *     <OpenLayers.Layer.Vector> constructor.
+ * @requires OpenLayers/Format.js
+ */
+
+/**
+ * Class: OpenLayers.Format.JSON
+ * A parser to read/write JSON safely.  Create a new instance with the
+ *     <OpenLayers.Format.JSON> constructor.
  *
  * Inherits from:
  *
  * Inherits from:
- *  - <OpenLayers.Layer>
+ *  - <OpenLayers.Format>
  */
  */
-OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
-
-    /**
-     * APIProperty: events
-     * {<OpenLayers.Events>}
-     *
-     * Register a listener for a particular event with the following syntax:
-     * (code)
-     * layer.events.register(type, obj, listener);
-     * (end)
-     *
-     * Listeners will be called with a reference to an event object.  The
-     *     properties of this event depends on exactly what happened.
-     *
-     * All event objects have at least the following properties:
-     * object - {Object} A reference to layer.events.object.
-     * element - {DOMElement} A reference to layer.events.element.
-     *
-     * Supported map event types (in addition to those from <OpenLayers.Layer.events>):
-     * beforefeatureadded - Triggered before a feature is added.  Listeners
-     *      will receive an object with a *feature* property referencing the
-     *      feature to be added.  To stop the feature from being added, a
-     *      listener should return false.
-     * beforefeaturesadded - Triggered before an array of features is added.
-     *      Listeners will receive an object with a *features* property
-     *      referencing the feature to be added. To stop the features from
-     *      being added, a listener should return false.
-     * featureadded - Triggered after a feature is added.  The event
-     *      object passed to listeners will have a *feature* property with a
-     *      reference to the added feature.
-     * featuresadded - Triggered after features are added.  The event
-     *      object passed to listeners will have a *features* property with a
-     *      reference to an array of added features.
-     * beforefeatureremoved - Triggered before a feature is removed. Listeners
-     *      will receive an object with a *feature* property referencing the
-     *      feature to be removed.
-     * beforefeaturesremoved - Triggered before multiple features are removed. 
-     *      Listeners will receive an object with a *features* property
-     *      referencing the features to be removed.
-     * featureremoved - Triggerd after a feature is removed. The event
-     *      object passed to listeners will have a *feature* property with a
-     *      reference to the removed feature.
-     * featuresremoved - Triggered after features are removed. The event
-     *      object passed to listeners will have a *features* property with a
-     *      reference to an array of removed features.
-     * beforefeatureselected - Triggered before a feature is selected.  Listeners
-     *      will receive an object with a *feature* property referencing the
-     *      feature to be selected. To stop the feature from being selectd, a
-     *      listener should return false.
-     * featureselected - Triggered after a feature is selected.  Listeners
-     *      will receive an object with a *feature* property referencing the
-     *      selected feature.
-     * featureunselected - Triggered after a feature is unselected.
-     *      Listeners will receive an object with a *feature* property
-     *      referencing the unselected feature.
-     * beforefeaturemodified - Triggered when a feature is selected to 
-     *      be modified.  Listeners will receive an object with a *feature* 
-     *      property referencing the selected feature.
-     * featuremodified - Triggered when a feature has been modified.
-     *      Listeners will receive an object with a *feature* property referencing 
-     *      the modified feature.
-     * afterfeaturemodified - Triggered when a feature is finished being modified.
-     *      Listeners will receive an object with a *feature* property referencing 
-     *      the modified feature.
-     * vertexmodified - Triggered when a vertex within any feature geometry
-     *      has been modified.  Listeners will receive an object with a
-     *      *feature* property referencing the modified feature, a *vertex*
-     *      property referencing the vertex modified (always a point geometry),
-     *      and a *pixel* property referencing the pixel location of the
-     *      modification.
-     * vertexremoved - Triggered when a vertex within any feature geometry
-     *      has been deleted.  Listeners will receive an object with a
-     *      *feature* property referencing the modified feature, a *vertex*
-     *      property referencing the vertex modified (always a point geometry),
-     *      and a *pixel* property referencing the pixel location of the
-     *      removal.
-     * sketchstarted - Triggered when a feature sketch bound for this layer
-     *      is started.  Listeners will receive an object with a *feature*
-     *      property referencing the new sketch feature and a *vertex* property
-     *      referencing the creation point.
-     * sketchmodified - Triggered when a feature sketch bound for this layer
-     *      is modified.  Listeners will receive an object with a *vertex*
-     *      property referencing the modified vertex and a *feature* property
-     *      referencing the sketch feature.
-     * sketchcomplete - Triggered when a feature sketch bound for this layer
-     *      is complete.  Listeners will receive an object with a *feature*
-     *      property referencing the sketch feature.  By returning false, a
-     *      listener can stop the sketch feature from being added to the layer.
-     * refresh - Triggered when something wants a strategy to ask the protocol
-     *      for a new set of features.
-     */
-
-    /**
-     * APIProperty: isBaseLayer
-     * {Boolean} The layer is a base layer.  Default is false.  Set this property
-     * in the layer options.
-     */
-    isBaseLayer: false,
-
-    /** 
-     * APIProperty: isFixed
-     * {Boolean} Whether the layer remains in one place while dragging the
-     * map. Note that setting this to true will move the layer to the bottom
-     * of the layer stack.
-     */
-    isFixed: false,
-
-    /** 
-     * APIProperty: features
-     * {Array(<OpenLayers.Feature.Vector>)} 
-     */
-    features: null,
-    
-    /** 
-     * Property: filter
-     * {<OpenLayers.Filter>} The filter set in this layer,
-     *     a strategy launching read requests can combined
-     *     this filter with its own filter.
-     */
-    filter: null,
-    
-    /** 
-     * Property: selectedFeatures
-     * {Array(<OpenLayers.Feature.Vector>)} 
-     */
-    selectedFeatures: null,
+OpenLayers.Format.JSON = OpenLayers.Class(OpenLayers.Format, {
     
     /**
     
     /**
-     * Property: unrenderedFeatures
-     * {Object} hash of features, keyed by feature.id, that the renderer
-     *     failed to draw
-     */
-    unrenderedFeatures: null,
-
-    /**
-     * APIProperty: reportError
-     * {Boolean} report friendly error message when loading of renderer
-     * fails.
-     */
-    reportError: true, 
-
-    /** 
-     * APIProperty: style
-     * {Object} Default style for the layer
+     * APIProperty: indent
+     * {String} For "pretty" printing, the indent string will be used once for
+     *     each indentation level.
      */
      */
-    style: null,
+    indent: "    ",
     
     /**
     
     /**
-     * Property: styleMap
-     * {<OpenLayers.StyleMap>}
+     * APIProperty: space
+     * {String} For "pretty" printing, the space string will be used after
+     *     the ":" separating a name/value pair.
      */
      */
-    styleMap: null,
+    space: " ",
     
     /**
     
     /**
-     * Property: strategies
-     * {Array(<OpenLayers.Strategy>})} Optional list of strategies for the layer.
+     * APIProperty: newline
+     * {String} For "pretty" printing, the newline string will be used at the
+     *     end of each name/value pair or array item.
      */
      */
-    strategies: null,
+    newline: "\n",
     
     /**
     
     /**
-     * Property: protocol
-     * {<OpenLayers.Protocol>} Optional protocol for the layer.
+     * Property: level
+     * {Integer} For "pretty" printing, this is incremented/decremented during
+     *     serialization.
      */
      */
-    protocol: null,
-    
+    level: 0,
+
     /**
     /**
-     * Property: renderers
-     * {Array(String)} List of supported Renderer classes. Add to this list to
-     * add support for additional renderers. This list is ordered:
-     * the first renderer which returns true for the  'supported()'
-     * method will be used, if not defined in the 'renderer' option.
-     */
-    renderers: ['SVG', 'VML', 'Canvas'],
-    
-    /** 
-     * Property: renderer
-     * {<OpenLayers.Renderer>}
+     * Property: pretty
+     * {Boolean} Serialize with extra whitespace for structure.  This is set
+     *     by the <write> method.
      */
      */
-    renderer: null,
-    
+    pretty: false,
+
     /**
     /**
-     * APIProperty: rendererOptions
-     * {Object} Options for the renderer. See {<OpenLayers.Renderer>} for
-     *     supported options.
-     */
-    rendererOptions: null,
-    
-    /** 
-     * APIProperty: geometryType
-     * {String} geometryType allows you to limit the types of geometries this
-     * layer supports. This should be set to something like
-     * "OpenLayers.Geometry.Point" to limit types.
+     * Property: nativeJSON
+     * {Boolean} Does the browser support native json?
      */
      */
-    geometryType: null,
+    nativeJSON: (function() {
+        return !!(window.JSON && typeof JSON.parse == "function" && typeof JSON.stringify == "function");
+    })(),
 
 
-    /** 
-     * Property: drawn
-     * {Boolean} Whether the Vector Layer features have been drawn yet.
+    /**
+     * Constructor: OpenLayers.Format.JSON
+     * Create a new parser for JSON.
+     *
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
      */
      */
-    drawn: false,
-    
-    /** 
-     * APIProperty: ratio
-     * {Float} This specifies the ratio of the size of the visiblity of the Vector Layer features to the size of the map.
-     */   
-    ratio: 1,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Layer.Vector
-     * Create a new vector layer
+     * APIMethod: read
+     * Deserialize a json string.
      *
      * Parameters:
      *
      * Parameters:
-     * name - {String} A name for the layer
-     * options - {Object} Optional object with non-default properties to set on
-     *           the layer.
-     *
+     * json - {String} A JSON string
+     * filter - {Function} A function which will be called for every key and
+     *     value at every level of the final result. Each value will be
+     *     replaced by the result of the filter function. This can be used to
+     *     reform generic objects into instances of classes, or to transform
+     *     date strings into Date objects.
+     *     
      * Returns:
      * Returns:
-     * {<OpenLayers.Layer.Vector>} A new vector layer
+     * {Object} An object, array, string, or number .
      */
      */
-    initialize: function(name, options) {
-        OpenLayers.Layer.prototype.initialize.apply(this, arguments);
-
-        // allow user-set renderer, otherwise assign one
-        if (!this.renderer || !this.renderer.supported()) {  
-            this.assignRenderer();
-        }
+    read: function(json, filter) {
+        var object;
+        if (this.nativeJSON) {
+            object = JSON.parse(json, filter);
+        } else try {
+            /**
+             * Parsing happens in three stages. In the first stage, we run the
+             *     text against a regular expression which looks for non-JSON
+             *     characters. We are especially concerned with '()' and 'new'
+             *     because they can cause invocation, and '=' because it can
+             *     cause mutation. But just to be safe, we will reject all
+             *     unexpected characters.
+             */
+            if (/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g, '@').
+                                replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
+                                replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
 
 
-        // if no valid renderer found, display error
-        if (!this.renderer || !this.renderer.supported()) {
-            this.renderer = null;
-            this.displayError();
-        } 
+                /**
+                 * In the second stage we use the eval function to compile the
+                 *     text into a JavaScript structure. The '{' operator is
+                 *     subject to a syntactic ambiguity in JavaScript - it can
+                 *     begin a block or an object literal. We wrap the text in
+                 *     parens to eliminate the ambiguity.
+                 */
+                object = eval('(' + json + ')');
 
 
-        if (!this.styleMap) {
-            this.styleMap = new OpenLayers.StyleMap();
+                /**
+                 * In the optional third stage, we recursively walk the new
+                 *     structure, passing each name/value pair to a filter
+                 *     function for possible transformation.
+                 */
+                if(typeof filter === 'function') {
+                    function walk(k, v) {
+                        if(v && typeof v === 'object') {
+                            for(var i in v) {
+                                if(v.hasOwnProperty(i)) {
+                                    v[i] = walk(i, v[i]);
+                                }
+                            }
+                        }
+                        return filter(k, v);
+                    }
+                    object = walk('', object);
+                }
+            }
+        } catch(e) {
+            // Fall through if the regexp test fails.
         }
 
         }
 
-        this.features = [];
-        this.selectedFeatures = [];
-        this.unrenderedFeatures = {};
-        
-        // Allow for custom layer behavior
-        if(this.strategies){
-            for(var i=0, len=this.strategies.length; i<len; i++) {
-                this.strategies[i].setLayer(this);
-            }
+        if(this.keepData) {
+            this.data = object;
         }
 
         }
 
+        return object;
     },
 
     /**
     },
 
     /**
-     * APIMethod: destroy
-     * Destroy this layer
+     * APIMethod: write
+     * Serialize an object into a JSON string.
+     *
+     * Parameters:
+     * value - {String} The object, array, string, number, boolean or date
+     *     to be serialized.
+     * pretty - {Boolean} Structure the output with newlines and indentation.
+     *     Default is false.
+     *
+     * Returns:
+     * {String} The JSON string representation of the input value.
      */
      */
-    destroy: function() {
-        if (this.strategies) {
-            var strategy, i, len;
-            for(i=0, len=this.strategies.length; i<len; i++) {
-                strategy = this.strategies[i];
-                if(strategy.autoDestroy) {
-                    strategy.destroy();
-                }
-            }
-            this.strategies = null;
-        }
-        if (this.protocol) {
-            if(this.protocol.autoDestroy) {
-                this.protocol.destroy();
+    write: function(value, pretty) {
+        this.pretty = !!pretty;
+        var json = null;
+        var type = typeof value;
+        if(this.serialize[type]) {
+            try {
+                json = (!this.pretty && this.nativeJSON) ?
+                    JSON.stringify(value) :
+                    this.serialize[type].apply(this, [value]);
+            } catch(err) {
+                OpenLayers.Console.error("Trouble serializing: " + err);
             }
             }
-            this.protocol = null;
-        }
-        this.destroyFeatures();
-        this.features = null;
-        this.selectedFeatures = null;
-        this.unrenderedFeatures = null;
-        if (this.renderer) {
-            this.renderer.destroy();
         }
         }
-        this.renderer = null;
-        this.geometryType = null;
-        this.drawn = null;
-        OpenLayers.Layer.prototype.destroy.apply(this, arguments);  
+        return json;
     },
     },
-
+    
     /**
     /**
-     * Method: clone
-     * Create a clone of this layer.
-     * 
-     * Note: Features of the layer are also cloned.
+     * Method: writeIndent
+     * Output an indentation string depending on the indentation level.
      *
      * Returns:
      *
      * Returns:
-     * {<OpenLayers.Layer.Vector>} An exact clone of this layer
+     * {String} An appropriate indentation string.
      */
      */
-    clone: function (obj) {
-        
-        if (obj == null) {
-            obj = new OpenLayers.Layer.Vector(this.name, this.getOptions());
-        }
-
-        //get all additions from superclasses
-        obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
-
-        // copy/set any non-init, non-simple values here
-        var features = this.features;
-        var len = features.length;
-        var clonedFeatures = new Array(len);
-        for(var i=0; i<len; ++i) {
-            clonedFeatures[i] = features[i].clone();
+    writeIndent: function() {
+        var pieces = [];
+        if(this.pretty) {
+            for(var i=0; i<this.level; ++i) {
+                pieces.push(this.indent);
+            }
         }
         }
-        obj.features = clonedFeatures;
-
-        return obj;
-    },    
+        return pieces.join('');
+    },
     
     /**
     
     /**
-     * Method: refresh
-     * Ask the layer to request features again and redraw them.  Triggers
-     *     the refresh event if the layer is in range and visible.
+     * Method: writeNewline
+     * Output a string representing a newline if in pretty printing mode.
      *
      *
-     * Parameters:
-     * obj - {Object} Optional object with properties for any listener of
-     *     the refresh event.
+     * Returns:
+     * {String} A string representing a new line.
      */
      */
-    refresh: function(obj) {
-        if(this.calculateInRange() && this.visibility) {
-            this.events.triggerEvent("refresh", obj);
-        }
-    },
-
-    /** 
-     * Method: assignRenderer
-     * Iterates through the available renderer implementations and selects 
-     * and assigns the first one whose "supported()" function returns true.
-     */    
-    assignRenderer: function()  {
-        for (var i=0, len=this.renderers.length; i<len; i++) {
-            var rendererClass = this.renderers[i];
-            var renderer = (typeof rendererClass == "function") ?
-                rendererClass :
-                OpenLayers.Renderer[rendererClass];
-            if (renderer && renderer.prototype.supported()) {
-                this.renderer = new renderer(this.div, this.rendererOptions);
-                break;
-            }  
-        }  
+    writeNewline: function() {
+        return (this.pretty) ? this.newline : '';
     },
     },
-
-    /** 
-     * Method: displayError 
-     * Let the user know their browser isn't supported.
+    
+    /**
+     * Method: writeSpace
+     * Output a string representing a space if in pretty printing mode.
+     *
+     * Returns:
+     * {String} A space.
      */
      */
-    displayError: function() {
-        if (this.reportError) {
-            OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported", 
-                                     {renderers: this. renderers.join('\n')}));
-        }    
+    writeSpace: function() {
+        return (this.pretty) ? this.space : '';
     },
 
     },
 
-    /** 
-     * Method: setMap
-     * The layer has been added to the map. 
-     * 
-     * If there is no renderer set, the layer can't be used. Remove it.
-     * Otherwise, give the renderer a reference to the map and set its size.
-     * 
-     * Parameters:
-     * map - {<OpenLayers.Map>} 
+    /**
+     * Property: serialize
+     * Object with properties corresponding to the serializable data types.
+     *     Property values are functions that do the actual serializing.
      */
      */
-    setMap: function(map) {        
-        OpenLayers.Layer.prototype.setMap.apply(this, arguments);
+    serialize: {
+        /**
+         * Method: serialize.object
+         * Transform an object into a JSON string.
+         *
+         * Parameters:
+         * object - {Object} The object to be serialized.
+         * 
+         * Returns:
+         * {String} A JSON string representing the object.
+         */
+        'object': function(object) {
+            // three special objects that we want to treat differently
+            if(object == null) {
+                return "null";
+            }
+            if(object.constructor == Date) {
+                return this.serialize.date.apply(this, [object]);
+            }
+            if(object.constructor == Array) {
+                return this.serialize.array.apply(this, [object]);
+            }
+            var pieces = ['{'];
+            this.level += 1;
+            var key, keyJSON, valueJSON;
+            
+            var addComma = false;
+            for(key in object) {
+                if(object.hasOwnProperty(key)) {
+                    // recursive calls need to allow for sub-classing
+                    keyJSON = OpenLayers.Format.JSON.prototype.write.apply(this,
+                                                    [key, this.pretty]);
+                    valueJSON = OpenLayers.Format.JSON.prototype.write.apply(this,
+                                                    [object[key], this.pretty]);
+                    if(keyJSON != null && valueJSON != null) {
+                        if(addComma) {
+                            pieces.push(',');
+                        }
+                        pieces.push(this.writeNewline(), this.writeIndent(),
+                                    keyJSON, ':', this.writeSpace(), valueJSON);
+                        addComma = true;
+                    }
+                }
+            }
+            
+            this.level -= 1;
+            pieces.push(this.writeNewline(), this.writeIndent(), '}');
+            return pieces.join('');
+        },
+        
+        /**
+         * Method: serialize.array
+         * Transform an array into a JSON string.
+         *
+         * Parameters:
+         * array - {Array} The array to be serialized
+         * 
+         * Returns:
+         * {String} A JSON string representing the array.
+         */
+        'array': function(array) {
+            var json;
+            var pieces = ['['];
+            this.level += 1;
+    
+            for(var i=0, len=array.length; i<len; ++i) {
+                // recursive calls need to allow for sub-classing
+                json = OpenLayers.Format.JSON.prototype.write.apply(this,
+                                                    [array[i], this.pretty]);
+                if(json != null) {
+                    if(i > 0) {
+                        pieces.push(',');
+                    }
+                    pieces.push(this.writeNewline(), this.writeIndent(), json);
+                }
+            }
 
 
-        if (!this.renderer) {
-            this.map.removeLayer(this);
-        } else {
-            this.renderer.map = this.map;
+            this.level -= 1;    
+            pieces.push(this.writeNewline(), this.writeIndent(), ']');
+            return pieces.join('');
+        },
+        
+        /**
+         * Method: serialize.string
+         * Transform a string into a JSON string.
+         *
+         * Parameters:
+         * string - {String} The string to be serialized
+         * 
+         * Returns:
+         * {String} A JSON string representing the string.
+         */
+        'string': function(string) {
+            // If the string contains no control characters, no quote characters, and no
+            // backslash characters, then we can simply slap some quotes around it.
+            // Otherwise we must also replace the offending characters with safe
+            // sequences.    
+            var m = {
+                '\b': '\\b',
+                '\t': '\\t',
+                '\n': '\\n',
+                '\f': '\\f',
+                '\r': '\\r',
+                '"' : '\\"',
+                '\\': '\\\\'
+            };
+            if(/["\\\x00-\x1f]/.test(string)) {
+                return '"' + string.replace(/([\x00-\x1f\\"])/g, function(a, b) {
+                    var c = m[b];
+                    if(c) {
+                        return c;
+                    }
+                    c = b.charCodeAt();
+                    return '\\u00' +
+                        Math.floor(c / 16).toString(16) +
+                        (c % 16).toString(16);
+                }) + '"';
+            }
+            return '"' + string + '"';
+        },
 
 
-            var newSize = this.map.getSize();
-            newSize.w = newSize.w * this.ratio;
-            newSize.h = newSize.h * this.ratio;
-            this.renderer.setSize(newSize);
+        /**
+         * Method: serialize.number
+         * Transform a number into a JSON string.
+         *
+         * Parameters:
+         * number - {Number} The number to be serialized.
+         *
+         * Returns:
+         * {String} A JSON string representing the number.
+         */
+        'number': function(number) {
+            return isFinite(number) ? String(number) : "null";
+        },
+        
+        /**
+         * Method: serialize.boolean
+         * Transform a boolean into a JSON string.
+         *
+         * Parameters:
+         * bool - {Boolean} The boolean to be serialized.
+         * 
+         * Returns:
+         * {String} A JSON string representing the boolean.
+         */
+        'boolean': function(bool) {
+            return String(bool);
+        },
+        
+        /**
+         * Method: serialize.object
+         * Transform a date into a JSON string.
+         *
+         * Parameters:
+         * date - {Date} The date to be serialized.
+         * 
+         * Returns:
+         * {String} A JSON string representing the date.
+         */
+        'date': function(date) {    
+            function format(number) {
+                // Format integers to have at least two digits.
+                return (number < 10) ? '0' + number : number;
+            }
+            return '"' + date.getFullYear() + '-' +
+                    format(date.getMonth() + 1) + '-' +
+                    format(date.getDate()) + 'T' +
+                    format(date.getHours()) + ':' +
+                    format(date.getMinutes()) + ':' +
+                    format(date.getSeconds()) + '"';
         }
     },
 
         }
     },
 
+    CLASS_NAME: "OpenLayers.Format.JSON" 
+
+});     
+/* ======================================================================
+    OpenLayers/Format/GeoJSON.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/JSON.js
+ * @requires OpenLayers/Feature/Vector.js
+ * @requires OpenLayers/Geometry/Point.js
+ * @requires OpenLayers/Geometry/MultiPoint.js
+ * @requires OpenLayers/Geometry/LineString.js
+ * @requires OpenLayers/Geometry/MultiLineString.js
+ * @requires OpenLayers/Geometry/Polygon.js
+ * @requires OpenLayers/Geometry/MultiPolygon.js
+ * @requires OpenLayers/Console.js
+ */
+
+/**
+ * Class: OpenLayers.Format.GeoJSON
+ * Read and write GeoJSON. Create a new parser with the
+ *     <OpenLayers.Format.GeoJSON> constructor.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Format.JSON>
+ */
+OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
+
     /**
     /**
-     * Method: afterAdd
-     * Called at the end of the map.addLayer sequence.  At this point, the map
-     *     will have a base layer.  Any autoActivate strategies will be
-     *     activated here.
+     * APIProperty: ignoreExtraDims
+     * {Boolean} Ignore dimensions higher than 2 when reading geometry
+     * coordinates.
+     */ 
+    ignoreExtraDims: false,
+    
+    /**
+     * Constructor: OpenLayers.Format.GeoJSON
+     * Create a new parser for GeoJSON.
+     *
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
      */
      */
-    afterAdd: function() {
-        if(this.strategies) {
-            var strategy, i, len;
-            for(i=0, len=this.strategies.length; i<len; i++) {
-                strategy = this.strategies[i];
-                if(strategy.autoActivate) {
-                    strategy.activate();
-                }
-            }
-        }
-    },
 
     /**
 
     /**
-     * Method: removeMap
-     * The layer has been removed from the map.
+     * APIMethod: read
+     * Deserialize a GeoJSON string.
      *
      * Parameters:
      *
      * Parameters:
-     * map - {<OpenLayers.Map>}
+     * json - {String} A GeoJSON string
+     * type - {String} Optional string that determines the structure of
+     *     the output.  Supported values are "Geometry", "Feature", and
+     *     "FeatureCollection".  If absent or null, a default of
+     *     "FeatureCollection" is assumed.
+     * filter - {Function} A function which will be called for every key and
+     *     value at every level of the final result. Each value will be
+     *     replaced by the result of the filter function. This can be used to
+     *     reform generic objects into instances of classes, or to transform
+     *     date strings into Date objects.
+     *
+     * Returns: 
+     * {Object} The return depends on the value of the type argument. If type
+     *     is "FeatureCollection" (the default), the return will be an array
+     *     of <OpenLayers.Feature.Vector>. If type is "Geometry", the input json
+     *     must represent a single geometry, and the return will be an
+     *     <OpenLayers.Geometry>.  If type is "Feature", the input json must
+     *     represent a single feature, and the return will be an
+     *     <OpenLayers.Feature.Vector>.
      */
      */
-    removeMap: function(map) {
-        this.drawn = false;
-        if(this.strategies) {
-            var strategy, i, len;
-            for(i=0, len=this.strategies.length; i<len; i++) {
-                strategy = this.strategies[i];
-                if(strategy.autoActivate) {
-                    strategy.deactivate();
-                }
+    read: function(json, type, filter) {
+        type = (type) ? type : "FeatureCollection";
+        var results = null;
+        var obj = null;
+        if (typeof json == "string") {
+            obj = OpenLayers.Format.JSON.prototype.read.apply(this,
+                                                              [json, filter]);
+        } else { 
+            obj = json;
+        }    
+        if(!obj) {
+            OpenLayers.Console.error("Bad JSON: " + json);
+        } else if(typeof(obj.type) != "string") {
+            OpenLayers.Console.error("Bad GeoJSON - no type: " + json);
+        } else if(this.isValidType(obj, type)) {
+            switch(type) {
+                case "Geometry":
+                    try {
+                        results = this.parseGeometry(obj);
+                    } catch(err) {
+                        OpenLayers.Console.error(err);
+                    }
+                    break;
+                case "Feature":
+                    try {
+                        results = this.parseFeature(obj);
+                        results.type = "Feature";
+                    } catch(err) {
+                        OpenLayers.Console.error(err);
+                    }
+                    break;
+                case "FeatureCollection":
+                    // for type FeatureCollection, we allow input to be any type
+                    results = [];
+                    switch(obj.type) {
+                        case "Feature":
+                            try {
+                                results.push(this.parseFeature(obj));
+                            } catch(err) {
+                                results = null;
+                                OpenLayers.Console.error(err);
+                            }
+                            break;
+                        case "FeatureCollection":
+                            for(var i=0, len=obj.features.length; i<len; ++i) {
+                                try {
+                                    results.push(this.parseFeature(obj.features[i]));
+                                } catch(err) {
+                                    results = null;
+                                    OpenLayers.Console.error(err);
+                                }
+                            }
+                            break;
+                        default:
+                            try {
+                                var geom = this.parseGeometry(obj);
+                                results.push(new OpenLayers.Feature.Vector(geom));
+                            } catch(err) {
+                                results = null;
+                                OpenLayers.Console.error(err);
+                            }
+                    }
+                break;
             }
         }
             }
         }
+        return results;
     },
     
     /**
     },
     
     /**
-     * Method: onMapResize
-     * Notify the renderer of the change in size. 
-     * 
-     */
-    onMapResize: function() {
-        OpenLayers.Layer.prototype.onMapResize.apply(this, arguments);
-        
-        var newSize = this.map.getSize();
-        newSize.w = newSize.w * this.ratio;
-        newSize.h = newSize.h * this.ratio;
-        this.renderer.setSize(newSize);
-    },
-
-    /**
-     * Method: moveTo
-     *  Reset the vector layer's div so that it once again is lined up with 
-     *   the map. Notify the renderer of the change of extent, and in the
-     *   case of a change of zoom level (resolution), have the 
-     *   renderer redraw features.
-     * 
-     *  If the layer has not yet been drawn, cycle through the layer's 
-     *   features and draw each one.
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>} 
-     * zoomChanged - {Boolean} 
-     * dragging - {Boolean} 
+     * Method: isValidType
+     * Check if a GeoJSON object is a valid representative of the given type.
+     *
+     * Returns:
+     * {Boolean} The object is valid GeoJSON object of the given type.
      */
      */
-    moveTo: function(bounds, zoomChanged, dragging) {
-        OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
-        
-        var coordSysUnchanged = true;
-        if (!dragging) {
-            this.renderer.root.style.visibility = 'hidden';
-
-            var viewSize = this.map.getSize(),
-                viewWidth = viewSize.w,
-                viewHeight = viewSize.h,
-                offsetLeft = (viewWidth / 2 * this.ratio) - viewWidth / 2,
-                offsetTop = (viewHeight / 2 * this.ratio) - viewHeight / 2;
-            offsetLeft += this.map.layerContainerOriginPx.x;
-            offsetLeft = -Math.round(offsetLeft);
-            offsetTop += this.map.layerContainerOriginPx.y;
-            offsetTop = -Math.round(offsetTop);
-
-            this.div.style.left = offsetLeft + 'px';
-            this.div.style.top = offsetTop + 'px';
-
-            var extent = this.map.getExtent().scale(this.ratio);
-            coordSysUnchanged = this.renderer.setExtent(extent, zoomChanged);
-
-            this.renderer.root.style.visibility = 'visible';
-
-            // Force a reflow on gecko based browsers to prevent jump/flicker.
-            // This seems to happen on only certain configurations; it was originally
-            // noticed in FF 2.0 and Linux.
-            if (OpenLayers.IS_GECKO === true) {
-                this.div.scrollLeft = this.div.scrollLeft;
-            }
-            
-            if (!zoomChanged && coordSysUnchanged) {
-                for (var i in this.unrenderedFeatures) {
-                    var feature = this.unrenderedFeatures[i];
-                    this.drawFeature(feature);
+    isValidType: function(obj, type) {
+        var valid = false;
+        switch(type) {
+            case "Geometry":
+                if(OpenLayers.Util.indexOf(
+                    ["Point", "MultiPoint", "LineString", "MultiLineString",
+                     "Polygon", "MultiPolygon", "Box", "GeometryCollection"],
+                    obj.type) == -1) {
+                    // unsupported geometry type
+                    OpenLayers.Console.error("Unsupported geometry type: " +
+                                              obj.type);
+                } else {
+                    valid = true;
+                }
+                break;
+            case "FeatureCollection":
+                // allow for any type to be converted to a feature collection
+                valid = true;
+                break;
+            default:
+                // for Feature types must match
+                if(obj.type == type) {
+                    valid = true;
+                } else {
+                    OpenLayers.Console.error("Cannot convert types from " +
+                                              obj.type + " to " + type);
                 }
                 }
-            }
         }
         }
-        if (!this.drawn || zoomChanged || !coordSysUnchanged) {
-            this.drawn = true;
-            var feature;
-            for(var i=0, len=this.features.length; i<len; i++) {
-                this.renderer.locked = (i !== (len - 1));
-                feature = this.features[i];
-                this.drawFeature(feature);
-            }
-        }    
+        return valid;
     },
     
     },
     
-    /** 
-     * APIMethod: display
-     * Hide or show the Layer
-     * 
-     * Parameters:
-     * display - {Boolean}
-     */
-    display: function(display) {
-        OpenLayers.Layer.prototype.display.apply(this, arguments);
-        // we need to set the display style of the root in case it is attached
-        // to a foreign layer
-        var currentDisplay = this.div.style.display;
-        if(currentDisplay != this.renderer.root.style.display) {
-            this.renderer.root.style.display = currentDisplay;
-        }
-    },
-
     /**
     /**
-     * APIMethod: addFeatures
-     * Add Features to the layer.
+     * Method: parseFeature
+     * Convert a feature object from GeoJSON into an
+     *     <OpenLayers.Feature.Vector>.
      *
      * Parameters:
      *
      * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>)} 
-     * options - {Object}
+     * obj - {Object} An object created from a GeoJSON object
+     *
+     * Returns:
+     * {<OpenLayers.Feature.Vector>} A feature.
      */
      */
-    addFeatures: function(features, options) {
-        if (!(OpenLayers.Util.isArray(features))) {
-            features = [features];
-        }
-        
-        var notify = !options || !options.silent;
-        if(notify) {
-            var event = {features: features};
-            var ret = this.events.triggerEvent("beforefeaturesadded", event);
-            if(ret === false) {
-                return;
-            }
-            features = event.features;
+    parseFeature: function(obj) {
+        var feature, geometry, attributes, bbox;
+        attributes = (obj.properties) ? obj.properties : {};
+        bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
+        try {
+            geometry = this.parseGeometry(obj.geometry);
+        } catch(err) {
+            // deal with bad geometries
+            throw err;
         }
         }
-        
-        // Track successfully added features for featuresadded event, since
-        // beforefeatureadded can veto single features.
-        var featuresAdded = [];
-        for (var i=0, len=features.length; i<len; i++) {
-            if (i != (features.length - 1)) {
-                this.renderer.locked = true;
-            } else {
-                this.renderer.locked = false;
-            }    
-            var feature = features[i];
-            
-            if (this.geometryType &&
-              !(feature.geometry instanceof this.geometryType)) {
-                throw new TypeError('addFeatures: component should be an ' +
-                                    this.geometryType.prototype.CLASS_NAME);
-              }
-
-            //give feature reference to its layer
-            feature.layer = this;
-
-            if (!feature.style && this.style) {
-                feature.style = OpenLayers.Util.extend({}, this.style);
-            }
-
-            if (notify) {
-                if(this.events.triggerEvent("beforefeatureadded",
-                                            {feature: feature}) === false) {
-                    continue;
-                }
-                this.preFeatureInsert(feature);
-            }
-
-            featuresAdded.push(feature);
-            this.features.push(feature);
-            this.drawFeature(feature);
-            
-            if (notify) {
-                this.events.triggerEvent("featureadded", {
-                    feature: feature
-                });
-                this.onFeatureInsert(feature);
-            }
+        feature = new OpenLayers.Feature.Vector(geometry, attributes);
+        if(bbox) {
+            feature.bounds = OpenLayers.Bounds.fromArray(bbox);
         }
         }
-        
-        if(notify) {
-            this.events.triggerEvent("featuresadded", {features: featuresAdded});
+        if(obj.id) {
+            feature.fid = obj.id;
         }
         }
+        return feature;
     },
     },
-
-
+    
     /**
     /**
-     * APIMethod: removeFeatures
-     * Remove features from the layer.  This erases any drawn features and
-     *     removes them from the layer's control.  The beforefeatureremoved
-     *     and featureremoved events will be triggered for each feature.  The
-     *     featuresremoved event will be triggered after all features have
-     *     been removed.  To supress event triggering, use the silent option.
-     * 
+     * Method: parseGeometry
+     * Convert a geometry object from GeoJSON into an <OpenLayers.Geometry>.
+     *
      * Parameters:
      * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>)} List of features to be
-     *     removed.
-     * options - {Object} Optional properties for changing behavior of the
-     *     removal.
+     * obj - {Object} An object created from a GeoJSON object
      *
      *
-     * Valid options:
-     * silent - {Boolean} Supress event triggering.  Default is false.
+     * Returns: 
+     * {<OpenLayers.Geometry>} A geometry.
      */
      */
-    removeFeatures: function(features, options) {
-        if(!features || features.length === 0) {
-            return;
-        }
-        if (features === this.features) {
-            return this.removeAllFeatures(options);
-        }
-        if (!(OpenLayers.Util.isArray(features))) {
-            features = [features];
-        }
-        if (features === this.selectedFeatures) {
-            features = features.slice();
-        }
-
-        var notify = !options || !options.silent;
-        
-        if (notify) {
-            this.events.triggerEvent(
-                "beforefeaturesremoved", {features: features}
-            );
+    parseGeometry: function(obj) {
+        if (obj == null) {
+            return null;
         }
         }
-
-        for (var i = features.length - 1; i >= 0; i--) {
-            // We remain locked so long as we're not at 0
-            // and the 'next' feature has a geometry. We do the geometry check
-            // because if all the features after the current one are 'null', we
-            // won't call eraseGeometry, so we break the 'renderer functions
-            // will always be called with locked=false *last*' rule. The end result
-            // is a possible gratiutious unlocking to save a loop through the rest 
-            // of the list checking the remaining features every time. So long as
-            // null geoms are rare, this is probably okay.    
-            if (i != 0 && features[i-1].geometry) {
-                this.renderer.locked = true;
-            } else {
-                this.renderer.locked = false;
+        var geometry, collection = false;
+        if(obj.type == "GeometryCollection") {
+            if(!(OpenLayers.Util.isArray(obj.geometries))) {
+                throw "GeometryCollection must have geometries array: " + obj;
             }
             }
-    
-            var feature = features[i];
-            delete this.unrenderedFeatures[feature.id];
-
-            if (notify) {
-                this.events.triggerEvent("beforefeatureremoved", {
-                    feature: feature
-                });
+            var numGeom = obj.geometries.length;
+            var components = new Array(numGeom);
+            for(var i=0; i<numGeom; ++i) {
+                components[i] = this.parseGeometry.apply(
+                    this, [obj.geometries[i]]
+                );
             }
             }
-
-            this.features = OpenLayers.Util.removeItem(this.features, feature);
-            // feature has no layer at this point
-            feature.layer = null;
-
-            if (feature.geometry) {
-                this.renderer.eraseFeatures(feature);
+            geometry = new OpenLayers.Geometry.Collection(components);
+            collection = true;
+        } else {
+            if(!(OpenLayers.Util.isArray(obj.coordinates))) {
+                throw "Geometry must have coordinates array: " + obj;
             }
             }
-                    
-            //in the case that this feature is one of the selected features, 
-            // remove it from that array as well.
-            if (OpenLayers.Util.indexOf(this.selectedFeatures, feature) != -1){
-                OpenLayers.Util.removeItem(this.selectedFeatures, feature);
+            if(!this.parseCoords[obj.type.toLowerCase()]) {
+                throw "Unsupported geometry type: " + obj.type;
             }
             }
-
-            if (notify) {
-                this.events.triggerEvent("featureremoved", {
-                    feature: feature
-                });
+            try {
+                geometry = this.parseCoords[obj.type.toLowerCase()].apply(
+                    this, [obj.coordinates]
+                );
+            } catch(err) {
+                // deal with bad coordinates
+                throw err;
             }
         }
             }
         }
-
-        if (notify) {
-            this.events.triggerEvent("featuresremoved", {features: features});
-        }
+        // We don't reproject collections because the children are reprojected
+        // for us when they are created.
+        if (this.internalProjection && this.externalProjection && !collection) {
+            geometry.transform(this.externalProjection, 
+                               this.internalProjection); 
+        }                       
+        return geometry;
     },
     
     },
     
-    /** 
-     * APIMethod: removeAllFeatures
-     * Remove all features from the layer.
-     *
-     * Parameters:
-     * options - {Object} Optional properties for changing behavior of the
-     *     removal.
-     *
-     * Valid options:
-     * silent - {Boolean} Supress event triggering.  Default is false.
-     */
-    removeAllFeatures: function(options) {
-        var notify = !options || !options.silent;
-        var features = this.features;
-        if (notify) {
-            this.events.triggerEvent(
-                "beforefeaturesremoved", {features: features}
-            );
-        }
-        var feature;
-        for (var i = features.length-1; i >= 0; i--) {
-            feature = features[i];
-            if (notify) {
-                this.events.triggerEvent("beforefeatureremoved", {
-                    feature: feature
-                });
-            }
-            feature.layer = null;
-            if (notify) {
-                this.events.triggerEvent("featureremoved", {
-                    feature: feature
-                });
-            }
-        }
-        this.renderer.clear();
-        this.features = [];
-        this.unrenderedFeatures = {};
-        this.selectedFeatures = [];
-        if (notify) {
-            this.events.triggerEvent("featuresremoved", {features: features});
-        }
-    },
-
     /**
     /**
-     * APIMethod: destroyFeatures
-     * Erase and destroy features on the layer.
-     *
-     * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>)} An optional array of
-     *     features to destroy.  If not supplied, all features on the layer
-     *     will be destroyed.
-     * options - {Object}
+     * Property: parseCoords
+     * Object with properties corresponding to the GeoJSON geometry types.
+     *     Property values are functions that do the actual parsing.
      */
      */
-    destroyFeatures: function(features, options) {
-        var all = (features == undefined); // evaluates to true if
-                                           // features is null
-        if(all) {
-            features = this.features;
-        }
-        if(features) {
-            this.removeFeatures(features, options);
-            for(var i=features.length-1; i>=0; i--) {
-                features[i].destroy();
+    parseCoords: {
+        /**
+         * Method: parseCoords.point
+         * Convert a coordinate array from GeoJSON into an
+         *     <OpenLayers.Geometry>.
+         *
+         * Parameters:
+         * array - {Object} The coordinates array from the GeoJSON fragment.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry>} A geometry.
+         */
+        "point": function(array) {
+            if (this.ignoreExtraDims == false && 
+                  array.length != 2) {
+                    throw "Only 2D points are supported: " + array;
             }
             }
-        }
-    },
+            return new OpenLayers.Geometry.Point(array[0], array[1]);
+        },
+        
+        /**
+         * Method: parseCoords.multipoint
+         * Convert a coordinate array from GeoJSON into an
+         *     <OpenLayers.Geometry>.
+         *
+         * Parameters:
+         * array - {Object} The coordinates array from the GeoJSON fragment.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry>} A geometry.
+         */
+        "multipoint": function(array) {
+            var points = [];
+            var p = null;
+            for(var i=0, len=array.length; i<len; ++i) {
+                try {
+                    p = this.parseCoords["point"].apply(this, [array[i]]);
+                } catch(err) {
+                    throw err;
+                }
+                points.push(p);
+            }
+            return new OpenLayers.Geometry.MultiPoint(points);
+        },
 
 
-    /**
-     * APIMethod: drawFeature
-     * Draw (or redraw) a feature on the layer.  If the optional style argument
-     * is included, this style will be used.  If no style is included, the
-     * feature's style will be used.  If the feature doesn't have a style,
-     * the layer's style will be used.
-     * 
-     * This function is not designed to be used when adding features to 
-     * the layer (use addFeatures instead). It is meant to be used when
-     * the style of a feature has changed, or in some other way needs to 
-     * visually updated *after* it has already been added to a layer. You
-     * must add the feature to the layer for most layer-related events to 
-     * happen.
-     *
-     * Parameters: 
-     * feature - {<OpenLayers.Feature.Vector>} 
-     * style - {String | Object} Named render intent or full symbolizer object.
-     */
-    drawFeature: function(feature, style) {
-        // don't try to draw the feature with the renderer if the layer is not 
-        // drawn itself
-        if (!this.drawn) {
-            return;
-        }
-        if (typeof style != "object") {
-            if(!style && feature.state === OpenLayers.State.DELETE) {
-                style = "delete";
+        /**
+         * Method: parseCoords.linestring
+         * Convert a coordinate array from GeoJSON into an
+         *     <OpenLayers.Geometry>.
+         *
+         * Parameters:
+         * array - {Object} The coordinates array from the GeoJSON fragment.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry>} A geometry.
+         */
+        "linestring": function(array) {
+            var points = [];
+            var p = null;
+            for(var i=0, len=array.length; i<len; ++i) {
+                try {
+                    p = this.parseCoords["point"].apply(this, [array[i]]);
+                } catch(err) {
+                    throw err;
+                }
+                points.push(p);
             }
             }
-            var renderIntent = style || feature.renderIntent;
-            style = feature.style || this.style;
-            if (!style) {
-                style = this.styleMap.createSymbolizer(feature, renderIntent);
+            return new OpenLayers.Geometry.LineString(points);
+        },
+        
+        /**
+         * Method: parseCoords.multilinestring
+         * Convert a coordinate array from GeoJSON into an
+         *     <OpenLayers.Geometry>.
+         *
+         * Parameters:
+         * array - {Object} The coordinates array from the GeoJSON fragment.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry>} A geometry.
+         */
+        "multilinestring": function(array) {
+            var lines = [];
+            var l = null;
+            for(var i=0, len=array.length; i<len; ++i) {
+                try {
+                    l = this.parseCoords["linestring"].apply(this, [array[i]]);
+                } catch(err) {
+                    throw err;
+                }
+                lines.push(l);
             }
             }
-        }
+            return new OpenLayers.Geometry.MultiLineString(lines);
+        },
         
         
-        var drawn = this.renderer.drawFeature(feature, style);
-        //TODO remove the check for null when we get rid of Renderer.SVG
-        if (drawn === false || drawn === null) {
-            this.unrenderedFeatures[feature.id] = feature;
-        } else {
-            delete this.unrenderedFeatures[feature.id];
-        }
-    },
-    
-    /**
-     * Method: eraseFeatures
-     * Erase features from the layer.
-     *
-     * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>)} 
-     */
-    eraseFeatures: function(features) {
-        this.renderer.eraseFeatures(features);
-    },
+        /**
+         * Method: parseCoords.polygon
+         * Convert a coordinate array from GeoJSON into an
+         *     <OpenLayers.Geometry>.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry>} A geometry.
+         */
+        "polygon": function(array) {
+            var rings = [];
+            var r, l;
+            for(var i=0, len=array.length; i<len; ++i) {
+                try {
+                    l = this.parseCoords["linestring"].apply(this, [array[i]]);
+                } catch(err) {
+                    throw err;
+                }
+                r = new OpenLayers.Geometry.LinearRing(l.components);
+                rings.push(r);
+            }
+            return new OpenLayers.Geometry.Polygon(rings);
+        },
 
 
-    /**
-     * Method: getFeatureFromEvent
-     * Given an event, return a feature if the event occurred over one.
-     * Otherwise, return null.
-     *
-     * Parameters:
-     * evt - {Event} 
-     *
-     * Returns:
-     * {<OpenLayers.Feature.Vector>} A feature if one was under the event.
-     */
-    getFeatureFromEvent: function(evt) {
-        if (!this.renderer) {
-            throw new Error('getFeatureFromEvent called on layer with no ' +
-                            'renderer. This usually means you destroyed a ' +
-                            'layer, but not some handler which is associated ' +
-                            'with it.');
-        }
-        var feature = null;
-        var featureId = this.renderer.getFeatureIdFromEvent(evt);
-        if (featureId) {
-            if (typeof featureId === "string") {
-                feature = this.getFeatureById(featureId);
-            } else {
-                feature = featureId;
+        /**
+         * Method: parseCoords.multipolygon
+         * Convert a coordinate array from GeoJSON into an
+         *     <OpenLayers.Geometry>.
+         *
+         * Parameters:
+         * array - {Object} The coordinates array from the GeoJSON fragment.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry>} A geometry.
+         */
+        "multipolygon": function(array) {
+            var polys = [];
+            var p = null;
+            for(var i=0, len=array.length; i<len; ++i) {
+                try {
+                    p = this.parseCoords["polygon"].apply(this, [array[i]]);
+                } catch(err) {
+                    throw err;
+                }
+                polys.push(p);
             }
             }
-        }
-        return feature;
-    },
+            return new OpenLayers.Geometry.MultiPolygon(polys);
+        },
 
 
-    /**
-     * APIMethod: getFeatureBy
-     * Given a property value, return the feature if it exists in the features array
-     *
-     * Parameters:
-     * property - {String}
-     * value - {String}
-     *
-     * Returns:
-     * {<OpenLayers.Feature.Vector>} A feature corresponding to the given
-     * property value or null if there is no such feature.
-     */
-    getFeatureBy: function(property, value) {
-        //TBD - would it be more efficient to use a hash for this.features?
-        var feature = null;
-        for(var i=0, len=this.features.length; i<len; ++i) {
-            if(this.features[i][property] == value) {
-                feature = this.features[i];
-                break;
+        /**
+         * Method: parseCoords.box
+         * Convert a coordinate array from GeoJSON into an
+         *     <OpenLayers.Geometry>.
+         *
+         * Parameters:
+         * array - {Object} The coordinates array from the GeoJSON fragment.
+         *
+         * Returns:
+         * {<OpenLayers.Geometry>} A geometry.
+         */
+        "box": function(array) {
+            if(array.length != 2) {
+                throw "GeoJSON box coordinates must have 2 elements";
             }
             }
+            return new OpenLayers.Geometry.Polygon([
+                new OpenLayers.Geometry.LinearRing([
+                    new OpenLayers.Geometry.Point(array[0][0], array[0][1]),
+                    new OpenLayers.Geometry.Point(array[1][0], array[0][1]),
+                    new OpenLayers.Geometry.Point(array[1][0], array[1][1]),
+                    new OpenLayers.Geometry.Point(array[0][0], array[1][1]),
+                    new OpenLayers.Geometry.Point(array[0][0], array[0][1])
+                ])
+            ]);
         }
         }
-        return feature;
+
     },
 
     /**
     },
 
     /**
-     * APIMethod: getFeatureById
-     * Given a feature id, return the feature if it exists in the features array
+     * APIMethod: write
+     * Serialize a feature, geometry, array of features into a GeoJSON string.
      *
      * Parameters:
      *
      * Parameters:
-     * featureId - {String}
+     * obj - {Object} An <OpenLayers.Feature.Vector>, <OpenLayers.Geometry>,
+     *     or an array of features.
+     * pretty - {Boolean} Structure the output with newlines and indentation.
+     *     Default is false.
      *
      * Returns:
      *
      * Returns:
-     * {<OpenLayers.Feature.Vector>} A feature corresponding to the given
-     * featureId or null if there is no such feature.
+     * {String} The GeoJSON string representation of the input geometry,
+     *     features, or array of features.
      */
      */
-    getFeatureById: function(featureId) {
-        return this.getFeatureBy('id', featureId);
+    write: function(obj, pretty) {
+        var geojson = {
+            "type": null
+        };
+        if(OpenLayers.Util.isArray(obj)) {
+            geojson.type = "FeatureCollection";
+            var numFeatures = obj.length;
+            geojson.features = new Array(numFeatures);
+            for(var i=0; i<numFeatures; ++i) {
+                var element = obj[i];
+                if(!element instanceof OpenLayers.Feature.Vector) {
+                    var msg = "FeatureCollection only supports collections " +
+                              "of features: " + element;
+                    throw msg;
+                }
+                geojson.features[i] = this.extract.feature.apply(
+                    this, [element]
+                );
+            }
+        } else if (obj.CLASS_NAME.indexOf("OpenLayers.Geometry") == 0) {
+            geojson = this.extract.geometry.apply(this, [obj]);
+        } else if (obj instanceof OpenLayers.Feature.Vector) {
+            geojson = this.extract.feature.apply(this, [obj]);
+            if(obj.layer && obj.layer.projection) {
+                geojson.crs = this.createCRSObject(obj);
+            }
+        }
+        return OpenLayers.Format.JSON.prototype.write.apply(this,
+                                                            [geojson, pretty]);
     },
 
     /**
     },
 
     /**
-     * APIMethod: getFeatureByFid
-     * Given a feature fid, return the feature if it exists in the features array
+     * Method: createCRSObject
+     * Create the CRS object for an object.
      *
      * Parameters:
      *
      * Parameters:
-     * featureFid - {String}
+     * object - {<OpenLayers.Feature.Vector>} 
      *
      * Returns:
      *
      * Returns:
-     * {<OpenLayers.Feature.Vector>} A feature corresponding to the given
-     * featureFid or null if there is no such feature.
+     * {Object} An object which can be assigned to the crs property
+     * of a GeoJSON object.
      */
      */
-    getFeatureByFid: function(featureFid) {
-        return this.getFeatureBy('fid', featureFid);
+    createCRSObject: function(object) {
+       var proj = object.layer.projection.toString();
+       var crs = {};
+       if (proj.match(/epsg:/i)) {
+           var code = parseInt(proj.substring(proj.indexOf(":") + 1));
+           if (code == 4326) {
+               crs = {
+                   "type": "name",
+                   "properties": {
+                       "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
+                   }
+               };
+           } else {    
+               crs = {
+                   "type": "name",
+                   "properties": {
+                       "name": "EPSG:" + code
+                   }
+               };
+           }    
+       }
+       return crs;
     },
     
     /**
     },
     
     /**
-     * APIMethod: getFeaturesByAttribute
-     * Returns an array of features that have the given attribute key set to the
-     * given value. Comparison of attribute values takes care of datatypes, e.g.
-     * the string '1234' is not equal to the number 1234.
-     *
-     * Parameters:
-     * attrName - {String}
-     * attrValue - {Mixed}
-     *
-     * Returns:
-     * Array({<OpenLayers.Feature.Vector>}) An array of features that have the 
-     * passed named attribute set to the given value.
+     * Property: extract
+     * Object with properties corresponding to the GeoJSON types.
+     *     Property values are functions that do the actual value extraction.
      */
      */
-    getFeaturesByAttribute: function(attrName, attrValue) {
-        var i,
-            feature,    
-            len = this.features.length,
-            foundFeatures = [];
-        for(i = 0; i < len; i++) {            
-            feature = this.features[i];
-            if(feature && feature.attributes) {
-                if (feature.attributes[attrName] === attrValue) {
-                    foundFeatures.push(feature);
-                }
+    extract: {
+        /**
+         * Method: extract.feature
+         * Return a partial GeoJSON object representing a single feature.
+         *
+         * Parameters:
+         * feature - {<OpenLayers.Feature.Vector>}
+         *
+         * Returns:
+         * {Object} An object representing the point.
+         */
+        'feature': function(feature) {
+            var geom = this.extract.geometry.apply(this, [feature.geometry]);
+            var json = {
+                "type": "Feature",
+                "properties": feature.attributes,
+                "geometry": geom
+            };
+            if (feature.fid != null) {
+                json.id = feature.fid;
             }
             }
-        }
-        return foundFeatures;
-    },
+            return json;
+        },
+        
+        /**
+         * Method: extract.geometry
+         * Return a GeoJSON object representing a single geometry.
+         *
+         * Parameters:
+         * geometry - {<OpenLayers.Geometry>}
+         *
+         * Returns:
+         * {Object} An object representing the geometry.
+         */
+        'geometry': function(geometry) {
+            if (geometry == null) {
+                return null;
+            }
+            if (this.internalProjection && this.externalProjection) {
+                geometry = geometry.clone();
+                geometry.transform(this.internalProjection, 
+                                   this.externalProjection);
+            }                       
+            var geometryType = geometry.CLASS_NAME.split('.')[2];
+            var data = this.extract[geometryType.toLowerCase()].apply(this, [geometry]);
+            var json;
+            if(geometryType == "Collection") {
+                json = {
+                    "type": "GeometryCollection",
+                    "geometries": data
+                };
+            } else {
+                json = {
+                    "type": geometryType,
+                    "coordinates": data
+                };
+            }
+            
+            return json;
+        },
 
 
-    /**
-     * Unselect the selected features
-     * i.e. clears the featureSelection array
-     * change the style back
-    clearSelection: function() {
+        /**
+         * Method: extract.point
+         * Return an array of coordinates from a point.
+         *
+         * Parameters:
+         * point - {<OpenLayers.Geometry.Point>}
+         *
+         * Returns: 
+         * {Array} An array of coordinates representing the point.
+         */
+        'point': function(point) {
+            return [point.x, point.y];
+        },
 
 
-       var vectorLayer = this.map.vectorLayer;
-        for (var i = 0; i < this.map.featureSelection.length; i++) {
-            var featureSelection = this.map.featureSelection[i];
-            vectorLayer.drawFeature(featureSelection, vectorLayer.style);
+        /**
+         * Method: extract.multipoint
+         * Return an array of point coordinates from a multipoint.
+         *
+         * Parameters:
+         * multipoint - {<OpenLayers.Geometry.MultiPoint>}
+         *
+         * Returns:
+         * {Array} An array of point coordinate arrays representing
+         *     the multipoint.
+         */
+        'multipoint': function(multipoint) {
+            var array = [];
+            for(var i=0, len=multipoint.components.length; i<len; ++i) {
+                array.push(this.extract.point.apply(this, [multipoint.components[i]]));
+            }
+            return array;
+        },
+        
+        /**
+         * Method: extract.linestring
+         * Return an array of coordinate arrays from a linestring.
+         *
+         * Parameters:
+         * linestring - {<OpenLayers.Geometry.LineString>}
+         *
+         * Returns:
+         * {Array} An array of coordinate arrays representing
+         *     the linestring.
+         */
+        'linestring': function(linestring) {
+            var array = [];
+            for(var i=0, len=linestring.components.length; i<len; ++i) {
+                array.push(this.extract.point.apply(this, [linestring.components[i]]));
+            }
+            return array;
+        },
+
+        /**
+         * Method: extract.multilinestring
+         * Return an array of linestring arrays from a linestring.
+         * 
+         * Parameters:
+         * multilinestring - {<OpenLayers.Geometry.MultiLineString>}
+         * 
+         * Returns:
+         * {Array} An array of linestring arrays representing
+         *     the multilinestring.
+         */
+        'multilinestring': function(multilinestring) {
+            var array = [];
+            for(var i=0, len=multilinestring.components.length; i<len; ++i) {
+                array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
+            }
+            return array;
+        },
+        
+        /**
+         * Method: extract.polygon
+         * Return an array of linear ring arrays from a polygon.
+         *
+         * Parameters:
+         * polygon - {<OpenLayers.Geometry.Polygon>}
+         * 
+         * Returns:
+         * {Array} An array of linear ring arrays representing the polygon.
+         */
+        'polygon': function(polygon) {
+            var array = [];
+            for(var i=0, len=polygon.components.length; i<len; ++i) {
+                array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
+            }
+            return array;
+        },
+
+        /**
+         * Method: extract.multipolygon
+         * Return an array of polygon arrays from a multipolygon.
+         * 
+         * Parameters:
+         * multipolygon - {<OpenLayers.Geometry.MultiPolygon>}
+         * 
+         * Returns:
+         * {Array} An array of polygon arrays representing
+         *     the multipolygon
+         */
+        'multipolygon': function(multipolygon) {
+            var array = [];
+            for(var i=0, len=multipolygon.components.length; i<len; ++i) {
+                array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
+            }
+            return array;
+        },
+        
+        /**
+         * Method: extract.collection
+         * Return an array of geometries from a geometry collection.
+         * 
+         * Parameters:
+         * collection - {<OpenLayers.Geometry.Collection>}
+         * 
+         * Returns:
+         * {Array} An array of geometry objects representing the geometry
+         *     collection.
+         */
+        'collection': function(collection) {
+            var len = collection.components.length;
+            var array = new Array(len);
+            for(var i=0; i<len; ++i) {
+                array[i] = this.extract.geometry.apply(
+                    this, [collection.components[i]]
+                );
+            }
+            return array;
         }
         }
-        this.map.featureSelection = [];
+        
+
     },
     },
-     */
 
 
+    CLASS_NAME: "OpenLayers.Format.GeoJSON" 
 
 
-    /**
-     * APIMethod: onFeatureInsert
-     * method called after a feature is inserted.
-     * Does nothing by default. Override this if you
-     * need to do something on feature updates.
-     *
-     * Parameters: 
-     * feature - {<OpenLayers.Feature.Vector>} 
-     */
-    onFeatureInsert: function(feature) {
-    },
-    
-    /**
-     * APIMethod: preFeatureInsert
-     * method called before a feature is inserted.
-     * Does nothing by default. Override this if you
-     * need to do something when features are first added to the
-     * layer, but before they are drawn, such as adjust the style.
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} 
-     */
-    preFeatureInsert: function(feature) {
-    },
+});     
+/* ======================================================================
+    OpenLayers/Lang/de.js
+   ====================================================================== */
+
+/* Translators (2009 onwards):
+ *  - Grille chompa
+ *  - Nikiwaibel
+ *  - Umherirrender
+ */
+
+/**
+ * @requires OpenLayers/Lang.js
+ */
+
+/**
+ * Namespace: OpenLayers.Lang["de"]
+ * Dictionary for Deutsch.  Keys for entries are used in calls to
+ *     <OpenLayers.Lang.translate>.  Entry bodies are normal strings or
+ *     strings formatted for use with <OpenLayers.String.format> calls.
+ */
+OpenLayers.Lang["de"] = OpenLayers.Util.applyDefaults({
+
+    'unhandledRequest': "Unbehandelte Anfragerückmeldung ${statusText}",
+
+    'Permalink': "Permalink",
+
+    'Overlays': "Overlays",
+
+    'Base Layer': "Grundkarte",
+
+    'noFID': "Ein Feature, für das keine FID existiert, kann nicht aktualisiert werden.",
+
+    'browserNotSupported': "Ihr Browser unterstützt keine Vektordarstellung. Aktuell unterstützte Renderer:\n${renderers}",
+
+    'minZoomLevelError': "Die \x3ccode\x3eminZoomLevel\x3c/code\x3e-Eigenschaft ist nur für die Verwendung mit \x3ccode\x3eFixedZoomLevels\x3c/code\x3e-untergeordneten Layers vorgesehen. Das dieser \x3ctt\x3ewfs\x3c/tt\x3e-Layer die \x3ccode\x3eminZoomLevel\x3c/code\x3e-Eigenschaft Ã¼berprüft ist ein Relikt der Vergangenheit. Wir können diese Ãœberprüfung nicht entfernen, ohne das OL basierende Applikationen nicht mehr funktionieren. Daher markieren wir es als veraltet - die \x3ccode\x3eminZoomLevel\x3c/code\x3e-Überprüfung wird in Version 3.0 entfernt werden. Bitte verwenden Sie stattdessen die Min-/Max-Lösung, wie sie unter http://trac.openlayers.org/wiki/SettingZoomLevels beschrieben ist.",
+
+    'commitSuccess': "WFS-Transaktion: Erfolgreich ${response}",
+
+    'commitFailed': "WFS-Transaktion: Fehlgeschlagen ${response}",
 
 
-    /** 
-     * APIMethod: getDataExtent
-     * Calculates the max extent which includes all of the features.
-     * 
-     * Returns:
-     * {<OpenLayers.Bounds>} or null if the layer has no features with
-     * geometries.
-     */
-    getDataExtent: function () {
-        var maxExtent = null;
-        var features = this.features;
-        if(features && (features.length > 0)) {
-            var geometry = null;
-            for(var i=0, len=features.length; i<len; i++) {
-                geometry = features[i].geometry;
-                if (geometry) {
-                    if (maxExtent === null) {
-                        maxExtent = new OpenLayers.Bounds();
-                    }
-                    maxExtent.extend(geometry.getBounds());
-                }
-            }
-        }
-        return maxExtent;
-    },
+    'googleWarning': "Der Google-Layer konnte nicht korrekt geladen werden.\x3cbr\x3e\x3cbr\x3eUm diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.\x3cbr\x3e\x3cbr\x3eSehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der Google-Maps-Bibliothek nicht eingebunden wurde oder keinen gültigen API-Schlüssel für Ihre URL enthält.\x3cbr\x3e\x3cbr\x3eEntwickler: Besuche \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3edas Wiki\x3c/a\x3e für Hilfe zum korrekten Einbinden des Google-Layers",
+
+    'getLayerWarning': "Der ${layerType}-Layer konnte nicht korrekt geladen werden.\x3cbr\x3e\x3cbr\x3eUm diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.\x3cbr\x3e\x3cbr\x3eSehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der \'${layerLib}\'-Bibliothek nicht eingebunden wurde.\x3cbr\x3e\x3cbr\x3eEntwickler: Besuche \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3edas Wiki\x3c/a\x3e für Hilfe zum korrekten Einbinden von Layern",
+
+    'Scale = 1 : ${scaleDenom}': "Maßstab = 1 : ${scaleDenom}",
+
+    'W': "W",
+
+    'E': "O",
+
+    'N': "N",
+
+    'S': "S",
+
+    'reprojectDeprecated': "Sie verwenden die â€žReproject“-Option des Layers ${layerName}. Diese Option ist veraltet: Sie wurde entwickelt um die Anzeige von Daten auf kommerziellen Basiskarten zu unterstützen, aber diese Funktion sollte jetzt durch Unterstützung der â€žSpherical Mercator“ erreicht werden. Weitere Informationen sind unter http://trac.openlayers.org/wiki/SphericalMercator verfügbar.",
+
+    'methodDeprecated': "Die Methode ist veraltet und wird in 3.0 entfernt. Bitte verwende stattdessen ${newMethod}."
 
 
-    CLASS_NAME: "OpenLayers.Layer.Vector"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Layer/Vector/RootContainer.js
+    OpenLayers/Lang/en.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
 /**
 /**
- * @requires OpenLayers/Layer/Vector.js
+ * @requires OpenLayers/Lang.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Layer.Vector.RootContainer
- * A special layer type to combine multiple vector layers inside a single
- *     renderer root container. This class is not supposed to be instantiated
- *     from user space, it is a helper class for controls that require event
- *     processing for multiple vector layers.
- *
- * Inherits from:
- *  - <OpenLayers.Layer.Vector>
+ * Namespace: OpenLayers.Lang["en"]
+ * Dictionary for English.  Keys for entries are used in calls to
+ *     <OpenLayers.Lang.translate>.  Entry bodies are normal strings or
+ *     strings formatted for use with <OpenLayers.String.format> calls.
  */
  */
-OpenLayers.Layer.Vector.RootContainer = OpenLayers.Class(OpenLayers.Layer.Vector, {
-    
-    /**
-     * Property: displayInLayerSwitcher
-     * Set to false for this layer type
-     */
-    displayInLayerSwitcher: false,
-    
-    /**
-     * APIProperty: layers
-     * Layers that are attached to this container. Required config option.
-     */
-    layers: null,
-    
-    /**
-     * Constructor: OpenLayers.Layer.Vector.RootContainer
-     * Create a new root container for multiple vector layer. This constructor
-     * is not supposed to be used from user space, it is only to be used by
-     * controls that need feature selection across multiple vector layers.
-     *
-     * Parameters:
-     * name - {String} A name for the layer
-     * options - {Object} Optional object with non-default properties to set on
-     *           the layer.
-     * 
-     * Required options properties:
-     * layers - {Array(<OpenLayers.Layer.Vector>)} The layers managed by this
-     *     container
-     *
-     * Returns:
-     * {<OpenLayers.Layer.Vector.RootContainer>} A new vector layer root
-     *     container
-     */
-    
-    /**
-     * Method: display
-     */
-    display: function() {},
-    
-    /**
-     * Method: getFeatureFromEvent
-     * walk through the layers to find the feature returned by the event
-     * 
-     * Parameters:
-     * evt - {Object} event object with a feature property
-     * 
-     * Returns:
-     * {<OpenLayers.Feature.Vector>}
-     */
-    getFeatureFromEvent: function(evt) {
-        var layers = this.layers;
-        var feature;
-        for(var i=0; i<layers.length; i++) {
-            feature = layers[i].getFeatureFromEvent(evt);
-            if(feature) {
-                return feature;
-            }
-        }
-    },
-    
-    /**
-     * Method: setMap
-     * 
-     * Parameters:
-     * map - {<OpenLayers.Map>}
-     */
-    setMap: function(map) {
-        OpenLayers.Layer.Vector.prototype.setMap.apply(this, arguments);
-        this.collectRoots();
-        map.events.register("changelayer", this, this.handleChangeLayer);
-    },
-    
-    /**
-     * Method: removeMap
-     * 
-     * Parameters:
-     * map - {<OpenLayers.Map>}
-     */
-    removeMap: function(map) {
-        map.events.unregister("changelayer", this, this.handleChangeLayer);
-        this.resetRoots();
-        OpenLayers.Layer.Vector.prototype.removeMap.apply(this, arguments);
-    },
-    
-    /**
-     * Method: collectRoots
-     * Collects the root nodes of all layers this control is configured with
-     * and moveswien the nodes to this control's layer
-     */
-    collectRoots: function() {
-        var layer;
-        // walk through all map layers, because we want to keep the order
-        for(var i=0; i<this.map.layers.length; ++i) {
-            layer = this.map.layers[i];
-            if(OpenLayers.Util.indexOf(this.layers, layer) != -1) {
-                layer.renderer.moveRoot(this.renderer);
-            }
-        }
-    },
-    
-    /**
-     * Method: resetRoots
-     * Resets the root nodes back into the layers they belong to.
-     */
-    resetRoots: function() {
-        var layer;
-        for(var i=0; i<this.layers.length; ++i) {
-            layer = this.layers[i];
-            if(this.renderer && layer.renderer.getRenderLayerId() == this.id) {
-                this.renderer.moveRoot(layer.renderer);
-            }
-        }
-    },
+OpenLayers.Lang.en = {
+
+    'unhandledRequest': "Unhandled request return ${statusText}",
+
+    'Permalink': "Permalink",
+
+    'Overlays': "Overlays",
+
+    'Base Layer': "Base Layer",
+
+    'noFID': "Can't update a feature for which there is no FID.",
+
+    'browserNotSupported':
+        "Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",
+
+    // console message
+    'minZoomLevelError':
+        "The minZoomLevel property is only intended for use " +
+        "with the FixedZoomLevels-descendent layers. That this " +
+        "wfs layer checks for minZoomLevel is a relic of the" +
+        "past. We cannot, however, remove it without possibly " +
+        "breaking OL based applications that may depend on it." +
+        " Therefore we are deprecating it -- the minZoomLevel " +
+        "check below will be removed at 3.0. Please instead " +
+        "use min/max resolution setting as described here: " +
+        "http://trac.openlayers.org/wiki/SettingZoomLevels",
+
+    'commitSuccess': "WFS Transaction: SUCCESS ${response}",
+
+    'commitFailed': "WFS Transaction: FAILED ${response}",
+
+    'googleWarning':
+        "The Google Layer was unable to load correctly.<br><br>" +
+        "To get rid of this message, select a new BaseLayer " +
+        "in the layer switcher in the upper-right corner.<br><br>" +
+        "Most likely, this is because the Google Maps library " +
+        "script was either not included, or does not contain the " +
+        "correct API key for your site.<br><br>" +
+        "Developers: For help getting this working correctly, " +
+        "<a href='http://trac.openlayers.org/wiki/Google' " +
+        "target='_blank'>click here</a>",
+
+    'getLayerWarning':
+        "The ${layerType} Layer was unable to load correctly.<br><br>" +
+        "To get rid of this message, select a new BaseLayer " +
+        "in the layer switcher in the upper-right corner.<br><br>" +
+        "Most likely, this is because the ${layerLib} library " +
+        "script was not correctly included.<br><br>" +
+        "Developers: For help getting this working correctly, " +
+        "<a href='http://trac.openlayers.org/wiki/${layerLib}' " +
+        "target='_blank'>click here</a>",
+
+    'Scale = 1 : ${scaleDenom}': "Scale = 1 : ${scaleDenom}",
     
     
-    /**
-     * Method: handleChangeLayer
-     * Event handler for the map's changelayer event. We need to rebuild
-     * this container's layer dom if order of one of its layers changes.
-     * This handler is added with the setMap method, and removed with the
-     * removeMap method.
-     * 
-     * Parameters:
-     * evt - {Object}
-     */
-    handleChangeLayer: function(evt) {
-        var layer = evt.layer;
-        if(evt.property == "order" &&
-                        OpenLayers.Util.indexOf(this.layers, layer) != -1) {
-            this.resetRoots();
-            this.collectRoots();
-        }
-    },
+    //labels for the graticule control
+    'W': 'W',
+    'E': 'E',
+    'N': 'N',
+    'S': 'S',
+    'Graticule': 'Graticule',
 
 
-    CLASS_NAME: "OpenLayers.Layer.Vector.RootContainer"
-});
+    // console message
+    'reprojectDeprecated':
+        "You are using the 'reproject' option " +
+        "on the ${layerName} layer. This option is deprecated: " +
+        "its use was designed to support displaying data over commercial " + 
+        "basemaps, but that functionality should now be achieved by using " +
+        "Spherical Mercator support. More information is available from " +
+        "http://trac.openlayers.org/wiki/SphericalMercator.",
+
+    // console message
+    'methodDeprecated':
+        "This method has been deprecated and will be removed in 3.0. " +
+        "Please use ${newMethod} instead.",
+
+    // **** end ****
+    'end': ''
+    
+};
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Control/SelectFeature.js
+    OpenLayers/Popup.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-
 /**
 /**
- * @requires OpenLayers/Control.js
- * @requires OpenLayers/Feature/Vector.js
- * @requires OpenLayers/Handler/Feature.js
- * @requires OpenLayers/Layer/Vector/RootContainer.js
+ * @requires OpenLayers/BaseTypes/Class.js
  */
 
  */
 
+
 /**
 /**
- * Class: OpenLayers.Control.SelectFeature
- * The SelectFeature control selects vector features from a given layer on 
- * click or hover. 
+ * Class: OpenLayers.Popup
+ * A popup is a small div that can opened and closed on the map.
+ * Typically opened in response to clicking on a marker.  
+ * See <OpenLayers.Marker>.  Popup's don't require their own
+ * layer and are added the the map using the <OpenLayers.Map.addPopup>
+ * method.
  *
  *
- * Inherits from:
- *  - <OpenLayers.Control>
+ * Example:
+ * (code)
+ * popup = new OpenLayers.Popup("chicken", 
+ *                    new OpenLayers.LonLat(5,40),
+ *                    new OpenLayers.Size(200,200),
+ *                    "example popup",
+ *                    true);
+ *       
+ * map.addPopup(popup);
+ * (end)
  */
  */
-OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
+OpenLayers.Popup = OpenLayers.Class({
 
     /** 
 
     /** 
-     * APIProperty: events
-     * {<OpenLayers.Events>} Events instance for listeners and triggering
-     *     control specific events.
-     *
-     * Register a listener for a particular event with the following syntax:
-     * (code)
-     * control.events.register(type, obj, listener);
-     * (end)
-     *
-     * Supported event types (in addition to those from <OpenLayers.Control.events>):
-     * beforefeaturehighlighted - Triggered before a feature is highlighted
-     * featurehighlighted - Triggered when a feature is highlighted
-     * featureunhighlighted - Triggered when a feature is unhighlighted
-     * boxselectionstart - Triggered before box selection starts
-     * boxselectionend - Triggered after box selection ends
-     */
-    
-    /**
-     * Property: multipleKey
-     * {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets
-     *     the <multiple> property to true.  Default is null.
-     */
-    multipleKey: null,
-    
-    /**
-     * Property: toggleKey
-     * {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets
-     *     the <toggle> property to true.  Default is null.
+     * Property: events  
+     * {<OpenLayers.Events>} custom event manager 
      */
      */
-    toggleKey: null,
+    events: null,
     
     
-    /**
-     * APIProperty: multiple
-     * {Boolean} Allow selection of multiple geometries.  Default is false.
+    /** Property: id
+     * {String} the unique identifier assigned to this popup.
      */
      */
-    multiple: false, 
+    id: "",
 
 
-    /**
-     * APIProperty: clickout
-     * {Boolean} Unselect features when clicking outside any feature.
-     *     Default is true.
+    /** 
+     * Property: lonlat 
+     * {<OpenLayers.LonLat>} the position of this popup on the map
      */
      */
-    clickout: true,
+    lonlat: null,
 
 
-    /**
-     * APIProperty: toggle
-     * {Boolean} Unselect a selected feature on click.  Default is false.  Only
-     *     has meaning if hover is false.
+    /** 
+     * Property: div 
+     * {DOMElement} the div that contains this popup.
      */
      */
-    toggle: false,
+    div: null,
 
 
-    /**
-     * APIProperty: hover
-     * {Boolean} Select on mouse over and deselect on mouse out.  If true, this
-     * ignores clicks and only listens to mouse moves.
+    /** 
+     * Property: contentSize 
+     * {<OpenLayers.Size>} the width and height of the content.
      */
      */
-    hover: false,
+    contentSize: null,    
 
 
-    /**
-     * APIProperty: highlightOnly
-     * {Boolean} If true do not actually select features (that is place them in 
-     * the layer's selected features array), just highlight them. This property
-     * has no effect if hover is false. Defaults to false.
-     */
-    highlightOnly: false,
-    
-    /**
-     * APIProperty: box
-     * {Boolean} Allow feature selection by drawing a box.
-     */
-    box: false,
-    
-    /**
-     * Property: onBeforeSelect 
-     * {Function} Optional function to be called before a feature is selected.
-     *     The function should expect to be called with a feature.
-     */
-    onBeforeSelect: function() {},
-    
-    /**
-     * APIProperty: onSelect 
-     * {Function} Optional function to be called when a feature is selected.
-     *     The function should expect to be called with a feature.
+    /** 
+     * Property: size 
+     * {<OpenLayers.Size>} the width and height of the popup.
      */
      */
-    onSelect: function() {},
+    size: null,    
 
 
-    /**
-     * APIProperty: onUnselect
-     * {Function} Optional function to be called when a feature is unselected.
-     *     The function should expect to be called with a feature.
+    /** 
+     * Property: contentHTML 
+     * {String} An HTML string for this popup to display.
      */
      */
-    onUnselect: function() {},
+    contentHTML: null,
     
     
-    /**
-     * Property: scope
-     * {Object} The scope to use with the onBeforeSelect, onSelect, onUnselect
-     *     callbacks. If null the scope will be this control.
-     */
-    scope: null,
-
-    /**
-     * APIProperty: geometryTypes
-     * {Array(String)} To restrict selecting to a limited set of geometry types,
-     *     send a list of strings corresponding to the geometry class names.
-     */
-    geometryTypes: null,
-
-    /**
-     * Property: layer
-     * {<OpenLayers.Layer.Vector>} The vector layer with a common renderer
-     * root for all layers this control is configured with (if an array of
-     * layers was passed to the constructor), or the vector layer the control
-     * was configured with (if a single layer was passed to the constructor).
+    /** 
+     * Property: backgroundColor 
+     * {String} the background color used by the popup.
      */
      */
-    layer: null,
+    backgroundColor: "",
     
     
-    /**
-     * Property: layers
-     * {Array(<OpenLayers.Layer.Vector>)} The layers this control will work on,
-     * or null if the control was configured with a single layer
+    /** 
+     * Property: opacity 
+     * {float} the opacity of this popup (between 0.0 and 1.0)
      */
      */
-    layers: null,
-    
-    /**
-     * APIProperty: callbacks
-     * {Object} The functions that are sent to the handlers.feature for callback
+    opacity: "",
+
+    /** 
+     * Property: border 
+     * {String} the border size of the popup.  (eg 2px)
      */
      */
-    callbacks: null,
+    border: "",
     
     
-    /**
-     * APIProperty: selectStyle 
-     * {Object} Hash of styles
+    /** 
+     * Property: contentDiv 
+     * {DOMElement} a reference to the element that holds the content of
+     *              the div.
      */
      */
-    selectStyle: null,
+    contentDiv: null,
     
     
-    /**
-     * Property: renderIntent
-     * {String} key used to retrieve the select style from the layer's
-     * style map.
-     */
-    renderIntent: "select",
-
-    /**
-     * Property: handlers
-     * {Object} Object with references to multiple <OpenLayers.Handler>
-     *     instances.
+    /** 
+     * Property: groupDiv 
+     * {DOMElement} First and only child of 'div'. The group Div contains the
+     *     'contentDiv' and the 'closeDiv'.
      */
      */
-    handlers: null,
+    groupDiv: null,
 
 
-    /**
-     * Constructor: OpenLayers.Control.SelectFeature
-     * Create a new control for selecting features.
-     *
-     * Parameters:
-     * layers - {<OpenLayers.Layer.Vector>}, or an array of vector layers. The
-     *     layer(s) this control will select features from.
-     * options - {Object} 
+    /** 
+     * Property: closeDiv
+     * {DOMElement} the optional closer image
      */
      */
-    initialize: function(layers, options) {
-        OpenLayers.Control.prototype.initialize.apply(this, [options]);
-        
-        if(this.scope === null) {
-            this.scope = this;
-        }
-        this.initLayer(layers);
-        var callbacks = {
-            click: this.clickFeature,
-            clickout: this.clickoutFeature
-        };
-        if (this.hover) {
-            callbacks.over = this.overFeature;
-            callbacks.out = this.outFeature;
-        }
-             
-        this.callbacks = OpenLayers.Util.extend(callbacks, this.callbacks);
-        this.handlers = {
-            feature: new OpenLayers.Handler.Feature(
-                this, this.layer, this.callbacks,
-                {geometryTypes: this.geometryTypes}
-            )
-        };
+    closeDiv: null,
 
 
-        if (this.box) {
-            this.handlers.box = new OpenLayers.Handler.Box(
-                this, {done: this.selectBox},
-                {boxDivClassName: "olHandlerBoxSelectFeature"}
-            ); 
-        }
-    },
+    /** 
+     * APIProperty: autoSize
+     * {Boolean} Resize the popup to auto-fit the contents.
+     *     Default is false.
+     */
+    autoSize: false,
 
     /**
 
     /**
-     * Method: initLayer
-     * Assign the layer property. If layers is an array, we need to use
-     *     a RootContainer.
-     *
-     * Parameters:
-     * layers - {<OpenLayers.Layer.Vector>}, or an array of vector layers.
+     * APIProperty: minSize
+     * {<OpenLayers.Size>} Minimum size allowed for the popup's contents.
      */
      */
-    initLayer: function(layers) {
-        if(OpenLayers.Util.isArray(layers)) {
-            this.layers = layers;
-            this.layer = new OpenLayers.Layer.Vector.RootContainer(
-                this.id + "_container", {
-                    layers: layers
-                }
-            );
-        } else {
-            this.layer = layers;
-        }
-    },
-    
+    minSize: null,
+
     /**
     /**
-     * Method: destroy
+     * APIProperty: maxSize
+     * {<OpenLayers.Size>} Maximum size allowed for the popup's contents.
      */
      */
-    destroy: function() {
-        if(this.active && this.layers) {
-            this.map.removeLayer(this.layer);
-        }
-        OpenLayers.Control.prototype.destroy.apply(this, arguments);
-        if(this.layers) {
-            this.layer.destroy();
-        }
-    },
+    maxSize: null,
 
 
-    /**
-     * Method: activate
-     * Activates the control.
-     * 
-     * Returns:
-     * {Boolean} The control was effectively activated.
+    /** 
+     * Property: displayClass
+     * {String} The CSS class of the popup.
      */
      */
-    activate: function () {
-        if (!this.active) {
-            if(this.layers) {
-                this.map.addLayer(this.layer);
-            }
-            this.handlers.feature.activate();
-            if(this.box && this.handlers.box) {
-                this.handlers.box.activate();
-            }
-        }
-        return OpenLayers.Control.prototype.activate.apply(
-            this, arguments
-        );
-    },
+    displayClass: "olPopup",
 
 
-    /**
-     * Method: deactivate
-     * Deactivates the control.
+    /** 
+     * Property: contentDisplayClass
+     * {String} The CSS class of the popup content div.
+     */
+    contentDisplayClass: "olPopupContent",
+
+    /** 
+     * Property: padding 
+     * {int or <OpenLayers.Bounds>} An extra opportunity to specify internal 
+     *     padding of the content div inside the popup. This was originally
+     *     confused with the css padding as specified in style.css's 
+     *     'olPopupContent' class. We would like to get rid of this altogether,
+     *     except that it does come in handy for the framed and anchoredbubble
+     *     popups, who need to maintain yet another barrier between their 
+     *     content and the outer border of the popup itself. 
      * 
      * 
-     * Returns:
-     * {Boolean} The control was effectively deactivated.
+     *     Note that in order to not break API, we must continue to support 
+     *     this property being set as an integer. Really, though, we'd like to 
+     *     have this specified as a Bounds object so that user can specify
+     *     distinct left, top, right, bottom paddings. With the 3.0 release
+     *     we can make this only a bounds.
      */
      */
-    deactivate: function () {
-        if (this.active) {
-            this.handlers.feature.deactivate();
-            if(this.handlers.box) {
-                this.handlers.box.deactivate();
-            }
-            if(this.layers) {
-                this.map.removeLayer(this.layer);
-            }
-        }
-        return OpenLayers.Control.prototype.deactivate.apply(
-            this, arguments
-        );
-    },
+    padding: 0,
 
 
-    /**
-     * Method: unselectAll
-     * Unselect all selected features.  To unselect all except for a single
-     *     feature, set the options.except property to the feature.
-     *
-     * Parameters:
-     * options - {Object} Optional configuration object.
+    /** 
+     * Property: disableFirefoxOverflowHack
+     * {Boolean} The hack for overflow in Firefox causes all elements 
+     *     to be re-drawn, which causes Flash elements to be 
+     *     re-initialized, which is troublesome.
+     *     With this property the hack can be disabled.
      */
      */
-    unselectAll: function(options) {
-        // we'll want an option to supress notification here
-        var layers = this.layers || [this.layer],
-            layer, feature, l, numExcept;
-        for(l=0; l<layers.length; ++l) {
-            layer = layers[l];
-            numExcept = 0;
-            //layer.selectedFeatures is null when layer is destroyed and 
-            //one of it's preremovelayer listener calls setLayer 
-            //with another layer on this control
-            if(layer.selectedFeatures != null) {
-                while(layer.selectedFeatures.length > numExcept) {
-                    feature = layer.selectedFeatures[numExcept];
-                    if(!options || options.except != feature) {
-                        this.unselect(feature);
-                    } else {
-                        ++numExcept;
-                    }
-                }
-            }
-        }
-    },
+    disableFirefoxOverflowHack: false,
 
     /**
 
     /**
-     * Method: clickFeature
-     * Called on click in a feature
-     * Only responds if this.hover is false.
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} 
+     * Method: fixPadding
+     * To be removed in 3.0, this function merely helps us to deal with the 
+     *     case where the user may have set an integer value for padding, 
+     *     instead of an <OpenLayers.Bounds> object.
      */
      */
-    clickFeature: function(feature) {
-        if(!this.hover) {
-            var selected = (OpenLayers.Util.indexOf(
-                feature.layer.selectedFeatures, feature) > -1);
-            if(selected) {
-                if(this.toggleSelect()) {
-                    this.unselect(feature);
-                } else if(!this.multipleSelect()) {
-                    this.unselectAll({except: feature});
-                }
-            } else {
-                if(!this.multipleSelect()) {
-                    this.unselectAll({except: feature});
-                }
-                this.select(feature);
-            }
+    fixPadding: function() {
+        if (typeof this.padding == "number") {
+            this.padding = new OpenLayers.Bounds(
+                this.padding, this.padding, this.padding, this.padding
+            );
         }
     },
 
     /**
         }
     },
 
     /**
-     * Method: multipleSelect
-     * Allow for multiple selected features based on <multiple> property and
-     *     <multipleKey> event modifier.
-     *
-     * Returns:
-     * {Boolean} Allow for multiple selected features.
+     * APIProperty: panMapIfOutOfView
+     * {Boolean} When drawn, pan map such that the entire popup is visible in
+     *     the current viewport (if necessary).
+     *     Default is false.
      */
      */
-    multipleSelect: function() {
-        return this.multiple || (this.handlers.feature.evt &&
-                                 this.handlers.feature.evt[this.multipleKey]);
-    },
+    panMapIfOutOfView: false,
     
     /**
     
     /**
-     * Method: toggleSelect
-     * Event should toggle the selected state of a feature based on <toggle>
-     *     property and <toggleKey> event modifier.
-     *
-     * Returns:
-     * {Boolean} Toggle the selected state of a feature.
+     * APIProperty: keepInMap 
+     * {Boolean} If panMapIfOutOfView is false, and this property is true, 
+     *     contrain the popup such that it always fits in the available map
+     *     space. By default, this is not set on the base class. If you are
+     *     creating popups that are near map edges and not allowing pannning,
+     *     and especially if you have a popup which has a
+     *     fixedRelativePosition, setting this to false may be a smart thing to
+     *     do. Subclasses may want to override this setting.
+     *   
+     *     Default is false.
      */
      */
-    toggleSelect: function() {
-        return this.toggle || (this.handlers.feature.evt &&
-                               this.handlers.feature.evt[this.toggleKey]);
-    },
+    keepInMap: false,
 
     /**
 
     /**
-     * Method: clickoutFeature
-     * Called on click outside a previously clicked (selected) feature.
-     * Only responds if this.hover is false.
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Vector.Feature>} 
+     * APIProperty: closeOnMove
+     * {Boolean} When map pans, close the popup.
+     *     Default is false.
      */
      */
-    clickoutFeature: function(feature) {
-        if(!this.hover && this.clickout) {
-            this.unselectAll();
-        }
-    },
-
-    /**
-     * Method: overFeature
-     * Called on over a feature.
-     * Only responds if this.hover is true.
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} 
+    closeOnMove: false,
+    
+    /** 
+     * Property: map 
+     * {<OpenLayers.Map>} this gets set in Map.js when the popup is added to the map
      */
      */
-    overFeature: function(feature) {
-        var layer = feature.layer;
-        if(this.hover) {
-            if(this.highlightOnly) {
-                this.highlight(feature);
-            } else if(OpenLayers.Util.indexOf(
-                layer.selectedFeatures, feature) == -1) {
-                this.select(feature);
-            }
+    map: null,
+
+    /** 
+    * Constructor: OpenLayers.Popup
+    * Create a popup.
+    * 
+    * Parameters: 
+    * id - {String} a unqiue identifier for this popup.  If null is passed
+    *               an identifier will be automatically generated. 
+    * lonlat - {<OpenLayers.LonLat>}  The position on the map the popup will
+    *                                 be shown.
+    * contentSize - {<OpenLayers.Size>} The size of the content.
+    * contentHTML - {String}          An HTML string to display inside the   
+    *                                 popup.
+    * closeBox - {Boolean}            Whether to display a close box inside
+    *                                 the popup.
+    * closeBoxCallback - {Function}   Function to be called on closeBox click.
+    */
+    initialize:function(id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback) {
+        if (id == null) {
+            id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
         }
         }
-    },
 
 
-    /**
-     * Method: outFeature
-     * Called on out of a selected feature.
-     * Only responds if this.hover is true.
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} 
-     */
-    outFeature: function(feature) {
-        if(this.hover) {
-            if(this.highlightOnly) {
-                // we do nothing if we're not the last highlighter of the
-                // feature
-                if(feature._lastHighlighter == this.id) {
-                    // if another select control had highlighted the feature before
-                    // we did it ourself then we use that control to highlight the
-                    // feature as it was before we highlighted it, else we just
-                    // unhighlight it
-                    if(feature._prevHighlighter &&
-                       feature._prevHighlighter != this.id) {
-                        delete feature._lastHighlighter;
-                        var control = this.map.getControl(
-                            feature._prevHighlighter);
-                        if(control) {
-                            control.highlight(feature);
-                        }
-                    } else {
-                        this.unhighlight(feature);
-                    }
-                }
-            } else {
-                this.unselect(feature);
-            }
+        this.id = id;
+        this.lonlat = lonlat;
+
+        this.contentSize = (contentSize != null) ? contentSize 
+                                  : new OpenLayers.Size(
+                                                   OpenLayers.Popup.WIDTH,
+                                                   OpenLayers.Popup.HEIGHT);
+        if (contentHTML != null) { 
+             this.contentHTML = contentHTML;
         }
         }
+        this.backgroundColor = OpenLayers.Popup.COLOR;
+        this.opacity = OpenLayers.Popup.OPACITY;
+        this.border = OpenLayers.Popup.BORDER;
+
+        this.div = OpenLayers.Util.createDiv(this.id, null, null, 
+                                             null, null, null, "hidden");
+        this.div.className = this.displayClass;
+        
+        var groupDivId = this.id + "_GroupDiv";
+        this.groupDiv = OpenLayers.Util.createDiv(groupDivId, null, null, 
+                                                    null, "relative", null,
+                                                    "hidden");
+
+        var id = this.div.id + "_contentDiv";
+        this.contentDiv = OpenLayers.Util.createDiv(id, null, this.contentSize.clone(), 
+                                                    null, "relative");
+        this.contentDiv.className = this.contentDisplayClass;
+        this.groupDiv.appendChild(this.contentDiv);
+        this.div.appendChild(this.groupDiv);
+
+        if (closeBox) {
+            this.addCloseBox(closeBoxCallback);
+        } 
+
+        this.registerEvents();
     },
 
     },
 
-    /**
-     * Method: highlight
-     * Redraw feature with the select style.
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} 
+    /** 
+     * Method: destroy
+     * nullify references to prevent circular references and memory leaks
      */
      */
-    highlight: function(feature) {
-        var layer = feature.layer;
-        var cont = this.events.triggerEvent("beforefeaturehighlighted", {
-            feature : feature
-        });
-        if(cont !== false) {
-            feature._prevHighlighter = feature._lastHighlighter;
-            feature._lastHighlighter = this.id;
-            var style = this.selectStyle || this.renderIntent;
-            layer.drawFeature(feature, style);
-            this.events.triggerEvent("featurehighlighted", {feature : feature});
+    destroy: function() {
+
+        this.id = null;
+        this.lonlat = null;
+        this.size = null;
+        this.contentHTML = null;
+        
+        this.backgroundColor = null;
+        this.opacity = null;
+        this.border = null;
+        
+        if (this.closeOnMove && this.map) {
+            this.map.events.unregister("movestart", this, this.hide);
         }
         }
-    },
 
 
-    /**
-     * Method: unhighlight
-     * Redraw feature with the "default" style
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} 
-     */
-    unhighlight: function(feature) {
-        var layer = feature.layer;
-        // three cases:
-        // 1. there's no other highlighter, in that case _prev is undefined,
-        //    and we just need to undef _last
-        // 2. another control highlighted the feature after we did it, in
-        //    that case _last references this other control, and we just
-        //    need to undef _prev
-        // 3. another control highlighted the feature before we did it, in
-        //    that case _prev references this other control, and we need to
-        //    set _last to _prev and undef _prev
-        if(feature._prevHighlighter == undefined) {
-            delete feature._lastHighlighter;
-        } else if(feature._prevHighlighter == this.id) {
-            delete feature._prevHighlighter;
-        } else {
-            feature._lastHighlighter = feature._prevHighlighter;
-            delete feature._prevHighlighter;
+        this.events.destroy();
+        this.events = null;
+        
+        if (this.closeDiv) {
+            OpenLayers.Event.stopObservingElement(this.closeDiv); 
+            this.groupDiv.removeChild(this.closeDiv);
         }
         }
-        layer.drawFeature(feature, feature.style || feature.layer.style ||
-            "default");
-        this.events.triggerEvent("featureunhighlighted", {feature : feature});
-    },
-    
-    /**
-     * Method: select
-     * Add feature to the layer's selectedFeature array, render the feature as
-     * selected, and call the onSelect function.
-     * 
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>} 
-     */
-    select: function(feature) {
-        var cont = this.onBeforeSelect.call(this.scope, feature);
-        var layer = feature.layer;
-        if(cont !== false) {
-            cont = layer.events.triggerEvent("beforefeatureselected", {
-                feature: feature
-            });
-            if(cont !== false) {
-                layer.selectedFeatures.push(feature);
-                this.highlight(feature);
-                // if the feature handler isn't involved in the feature
-                // selection (because the box handler is used or the
-                // feature is selected programatically) we fake the
-                // feature handler to allow unselecting on click
-                if(!this.handlers.feature.lastFeature) {
-                    this.handlers.feature.lastFeature = layer.selectedFeatures[0];
-                }
-                layer.events.triggerEvent("featureselected", {feature: feature});
-                this.onSelect.call(this.scope, feature);
-            }
+        this.closeDiv = null;
+        
+        this.div.removeChild(this.groupDiv);
+        this.groupDiv = null;
+
+        if (this.map != null) {
+            this.map.removePopup(this);
         }
         }
+        this.map = null;
+        this.div = null;
+        
+        this.autoSize = null;
+        this.minSize = null;
+        this.maxSize = null;
+        this.padding = null;
+        this.panMapIfOutOfView = null;
     },
 
     },
 
-    /**
-     * Method: unselect
-     * Remove feature from the layer's selectedFeature array, render the feature as
-     * normal, and call the onUnselect function.
-     *
-     * Parameters:
-     * feature - {<OpenLayers.Feature.Vector>}
-     */
-    unselect: function(feature) {
-        var layer = feature.layer;
-        // Store feature style for restoration later
-        this.unhighlight(feature);
-        OpenLayers.Util.removeItem(layer.selectedFeatures, feature);
-        layer.events.triggerEvent("featureunselected", {feature: feature});
-        this.onUnselect.call(this.scope, feature);
-    },
-    
-    /**
-     * Method: selectBox
-     * Callback from the handlers.box set up when <box> selection is true
-     *     on.
-     *
-     * Parameters:
-     * position - {<OpenLayers.Bounds> || <OpenLayers.Pixel> }  
-     */
-    selectBox: function(position) {
-        if (position instanceof OpenLayers.Bounds) {
-            var minXY = this.map.getLonLatFromPixel({
-                x: position.left,
-                y: position.bottom
-            });
-            var maxXY = this.map.getLonLatFromPixel({
-                x: position.right,
-                y: position.top
-            });
-            var bounds = new OpenLayers.Bounds(
-                minXY.lon, minXY.lat, maxXY.lon, maxXY.lat
-            );
-            
-            // if multiple is false, first deselect currently selected features
-            if (!this.multipleSelect()) {
-                this.unselectAll();
-            }
-            
-            // because we're using a box, we consider we want multiple selection
-            var prevMultiple = this.multiple;
-            this.multiple = true;
-            var layers = this.layers || [this.layer];
-            this.events.triggerEvent("boxselectionstart", {layers: layers}); 
-            var layer;
-            for(var l=0; l<layers.length; ++l) {
-                layer = layers[l];
-                for(var i=0, len = layer.features.length; i<len; ++i) {
-                    var feature = layer.features[i];
-                    // check if the feature is displayed
-                    if (!feature.getVisibility()) {
-                        continue;
-                    }
+    /** 
+    * Method: draw
+    * Constructs the elements that make up the popup.
+    *
+    * Parameters:
+    * px - {<OpenLayers.Pixel>} the position the popup in pixels.
+    * 
+    * Returns:
+    * {DOMElement} Reference to a div that contains the drawn popup
+    */
+    draw: function(px) {
+        if (px == null) {
+            if ((this.lonlat != null) && (this.map != null)) {
+                px = this.map.getLayerPxFromLonLat(this.lonlat);
+            }
+        }
 
 
-                    if (this.geometryTypes == null || OpenLayers.Util.indexOf(
-                            this.geometryTypes, feature.geometry.CLASS_NAME) > -1) {
-                        if (bounds.toGeometry().intersects(feature.geometry)) {
-                            if (OpenLayers.Util.indexOf(layer.selectedFeatures, feature) == -1) {
-                                this.select(feature);
-                            }
-                        }
-                    }
+        // this assumes that this.map already exists, which is okay because 
+        // this.draw is only called once the popup has been added to the map.
+        if (this.closeOnMove) {
+            this.map.events.register("movestart", this, this.hide);
+        }
+        
+        //listen to movestart, moveend to disable overflow (FF bug)
+        if (!this.disableFirefoxOverflowHack && OpenLayers.BROWSER_NAME == 'firefox') {
+            this.map.events.register("movestart", this, function() {
+                var style = document.defaultView.getComputedStyle(
+                    this.contentDiv, null
+                );
+                var currentOverflow = style.getPropertyValue("overflow");
+                if (currentOverflow != "hidden") {
+                    this.contentDiv._oldOverflow = currentOverflow;
+                    this.contentDiv.style.overflow = "hidden";
                 }
                 }
-            }
-            this.multiple = prevMultiple;
-            this.events.triggerEvent("boxselectionend", {layers: layers}); 
+            });
+            this.map.events.register("moveend", this, function() {
+                var oldOverflow = this.contentDiv._oldOverflow;
+                if (oldOverflow) {
+                    this.contentDiv.style.overflow = oldOverflow;
+                    this.contentDiv._oldOverflow = null;
+                }
+            });
+        }
+
+        this.moveTo(px);
+        if (!this.autoSize && !this.size) {
+            this.setSize(this.contentSize);
         }
         }
+        this.setBackgroundColor();
+        this.setOpacity();
+        this.setBorder();
+        this.setContentHTML();
+        
+        if (this.panMapIfOutOfView) {
+            this.panIntoView();
+        }    
+
+        return this.div;
     },
 
     /** 
     },
 
     /** 
-     * Method: setMap
-     * Set the map property for the control. 
-     * 
-     * Parameters:
-     * map - {<OpenLayers.Map>} 
+     * Method: updatePosition
+     * if the popup has a lonlat and its map members set, 
+     * then have it move itself to its proper position
      */
      */
-    setMap: function(map) {
-        this.handlers.feature.setMap(map);
-        if (this.box) {
-            this.handlers.box.setMap(map);
+    updatePosition: function() {
+        if ((this.lonlat) && (this.map)) {
+            var px = this.map.getLayerPxFromLonLat(this.lonlat);
+            if (px) {
+                this.moveTo(px);           
+            }    
         }
         }
-        OpenLayers.Control.prototype.setMap.apply(this, arguments);
     },
     },
-    
+
     /**
     /**
-     * APIMethod: setLayer
-     * Attach a new layer to the control, overriding any existing layers.
-     *
+     * Method: moveTo
+     * 
      * Parameters:
      * Parameters:
-     * layers - Array of {<OpenLayers.Layer.Vector>} or a single
-     *     {<OpenLayers.Layer.Vector>}
+     * px - {<OpenLayers.Pixel>} the top and left position of the popup div. 
      */
      */
-    setLayer: function(layers) {
-        var isActive = this.active;
-        this.unselectAll();
-        this.deactivate();
-        if(this.layers) {
-            this.layer.destroy();
-            this.layers = null;
-        }
-        this.initLayer(layers);
-        this.handlers.feature.layer = this.layer;
-        if (isActive) {
-            this.activate();
+    moveTo: function(px) {
+        if ((px != null) && (this.div != null)) {
+            this.div.style.left = px.x + "px";
+            this.div.style.top = px.y + "px";
         }
     },
         }
     },
-    
-    CLASS_NAME: "OpenLayers.Control.SelectFeature"
-});
-/* ======================================================================
-    OpenLayers/Control/Attribution.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Control.js
- */
 
 
-/**
- * Class: OpenLayers.Control.Attribution
- * The attribution control adds attribution from layers to the map display. 
- * It uses 'attribution' property of each layer.
- *
- * Inherits from:
- *  - <OpenLayers.Control>
- */
-OpenLayers.Control.Attribution = 
-  OpenLayers.Class(OpenLayers.Control, {
-    
     /**
     /**
-     * APIProperty: separator
-     * {String} String used to separate layers.
+     * Method: visible
+     *
+     * Returns:      
+     * {Boolean} Boolean indicating whether or not the popup is visible
      */
      */
-    separator: ", ",
-    
+    visible: function() {
+        return OpenLayers.Element.visible(this.div);
+    },
+
     /**
     /**
-     * APIProperty: template
-     * {String} Template for the attribution. This has to include the substring
-     *     "${layers}", which will be replaced by the layer specific
-     *     attributions, separated by <separator>. The default is "${layers}".
+     * Method: toggle
+     * Toggles visibility of the popup.
      */
      */
-    template: "${layers}",
-    
+    toggle: function() {
+        if (this.visible()) {
+            this.hide();
+        } else {
+            this.show();
+        }
+    },
+
     /**
     /**
-     * Constructor: OpenLayers.Control.Attribution 
-     * 
-     * Parameters:
-     * options - {Object} Options for control.
+     * Method: show
+     * Makes the popup visible.
      */
      */
+    show: function() {
+        this.div.style.display = '';
 
 
-    /** 
-     * Method: destroy
-     * Destroy control.
-     */
-    destroy: function() {
-        this.map.events.un({
-            "removelayer": this.updateAttribution,
-            "addlayer": this.updateAttribution,
-            "changelayer": this.updateAttribution,
-            "changebaselayer": this.updateAttribution,
-            scope: this
-        });
-        
-        OpenLayers.Control.prototype.destroy.apply(this, arguments);
-    },    
-    
-    /**
-     * Method: draw
-     * Initialize control.
-     * 
-     * Returns: 
-     * {DOMElement} A reference to the DIV DOMElement containing the control
-     */    
-    draw: function() {
-        OpenLayers.Control.prototype.draw.apply(this, arguments);
-        
-        this.map.events.on({
-            'changebaselayer': this.updateAttribution,
-            'changelayer': this.updateAttribution,
-            'addlayer': this.updateAttribution,
-            'removelayer': this.updateAttribution,
-            scope: this
-        });
-        this.updateAttribution();
-        
-        return this.div;    
+        if (this.panMapIfOutOfView) {
+            this.panIntoView();
+        }    
     },
 
     /**
     },
 
     /**
-     * Method: updateAttribution
-     * Update attribution string.
+     * Method: hide
+     * Makes the popup invisible.
      */
      */
-    updateAttribution: function() {
-        var attributions = [];
-        if (this.map && this.map.layers) {
-            for(var i=0, len=this.map.layers.length; i<len; i++) {
-                var layer = this.map.layers[i];
-                if (layer.attribution && layer.getVisibility()) {
-                    // add attribution only if attribution text is unique
-                    if (OpenLayers.Util.indexOf(
-                                    attributions, layer.attribution) === -1) {
-                        attributions.push( layer.attribution );
-                    }
-                }
-            } 
-            this.div.innerHTML = OpenLayers.String.format(this.template, {
-                layers: attributions.join(this.separator)
-            });
-        }
+    hide: function() {
+        this.div.style.display = 'none';
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Control.Attribution"
-});
-/* ======================================================================
-    OpenLayers/Handler/Drag.js
-   ====================================================================== */
+    /**
+     * Method: setSize
+     * Used to adjust the size of the popup. 
+     *
+     * Parameters:
+     * contentSize - {<OpenLayers.Size>} the new size for the popup's 
+     *     contents div (in pixels).
+     */
+    setSize:function(contentSize) { 
+        this.size = contentSize.clone(); 
+        
+        // if our contentDiv has a css 'padding' set on it by a stylesheet, we 
+        //  must add that to the desired "size". 
+        var contentDivPadding = this.getContentDivPadding();
+        var wPadding = contentDivPadding.left + contentDivPadding.right;
+        var hPadding = contentDivPadding.top + contentDivPadding.bottom;
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
+        // take into account the popup's 'padding' property
+        this.fixPadding();
+        wPadding += this.padding.left + this.padding.right;
+        hPadding += this.padding.top + this.padding.bottom;
 
 
-/**
- * @requires OpenLayers/Handler.js
- */
+        // make extra space for the close div
+        if (this.closeDiv) {
+            var closeDivWidth = parseInt(this.closeDiv.style.width);
+            wPadding += closeDivWidth + contentDivPadding.right;
+        }
 
 
-/**
- * Class: OpenLayers.Handler.Drag
- * The drag handler is used to deal with sequences of browser events related
- *     to dragging.  The handler is used by controls that want to know when
- *     a drag sequence begins, when a drag is happening, and when it has
- *     finished.
- *
- * Controls that use the drag handler typically construct it with callbacks
- *     for 'down', 'move', and 'done'.  Callbacks for these keys are called
- *     when the drag begins, with each move, and when the drag is done.  In
- *     addition, controls can have callbacks keyed to 'up' and 'out' if they
- *     care to differentiate between the types of events that correspond with
- *     the end of a drag sequence.  If no drag actually occurs (no mouse move)
- *     the 'down' and 'up' callbacks will be called, but not the 'done'
- *     callback.
- *
- * Create a new drag handler with the <OpenLayers.Handler.Drag> constructor.
- *
- * Inherits from:
- *  - <OpenLayers.Handler>
- */
-OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
-  
-    /** 
-     * Property: started
-     * {Boolean} When a mousedown or touchstart event is received, we want to
-     * record it, but not set 'dragging' until the mouse moves after starting.
-     */
-    started: false,
+        //increase size of the main popup div to take into account the 
+        // users's desired padding and close div.        
+        this.size.w += wPadding;
+        this.size.h += hPadding;
+
+        //now if our browser is IE, we need to actually make the contents 
+        // div itself bigger to take its own padding into effect. this makes 
+        // me want to shoot someone, but so it goes.
+        if (OpenLayers.BROWSER_NAME == "msie") {
+            this.contentSize.w += 
+                contentDivPadding.left + contentDivPadding.right;
+            this.contentSize.h += 
+                contentDivPadding.bottom + contentDivPadding.top;
+        }
+
+        if (this.div != null) {
+            this.div.style.width = this.size.w + "px";
+            this.div.style.height = this.size.h + "px";
+        }
+        if (this.contentDiv != null){
+            this.contentDiv.style.width = contentSize.w + "px";
+            this.contentDiv.style.height = contentSize.h + "px";
+        }
+    },  
 
     /**
 
     /**
-     * Property: stopDown
-     * {Boolean} Stop propagation of mousedown events from getting to listeners
-     *     on the same element.  Default is true.
+     * APIMethod: updateSize
+     * Auto size the popup so that it precisely fits its contents (as 
+     *     determined by this.contentDiv.innerHTML). Popup size will, of
+     *     course, be limited by the available space on the current map
      */
      */
-    stopDown: true,
+    updateSize: function() {
+        
+        // determine actual render dimensions of the contents by putting its
+        // contents into a fake contentDiv (for the CSS) and then measuring it
+        var preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" + 
+            this.contentDiv.innerHTML + 
+            "</div>";
+        var containerElement = (this.map) ? this.map.div : document.body;
+        var realSize = OpenLayers.Util.getRenderedDimensions(
+            preparedHTML, null, {
+                displayClass: this.displayClass,
+                containerElement: containerElement
+            }
+        );
 
 
-    /** 
-     * Property: dragging 
-     * {Boolean} 
-     */
-    dragging: false,
+        // is the "real" size of the div is safe to display in our map?
+        var safeSize = this.getSafeContentSize(realSize);
 
 
-    /** 
-     * Property: last
-     * {<OpenLayers.Pixel>} The last pixel location of the drag.
-     */
-    last: null,
+        var newSize = null;
+        if (safeSize.equals(realSize)) {
+            //real size of content is small enough to fit on the map, 
+            // so we use real size.
+            newSize = realSize;
 
 
-    /** 
-     * Property: start
-     * {<OpenLayers.Pixel>} The first pixel location of the drag.
-     */
-    start: null,
+        } else {
 
 
-    /**
-     * Property: lastMoveEvt
-     * {Object} The last mousemove event that occurred. Used to
-     *     position the map correctly when our "delay drag"
-     *     timeout expired.
-     */
-    lastMoveEvt: null,
+            // make a new 'size' object with the clipped dimensions 
+            // set or null if not clipped.
+            var fixedSize = {
+                w: (safeSize.w < realSize.w) ? safeSize.w : null,
+                h: (safeSize.h < realSize.h) ? safeSize.h : null
+            };
+        
+            if (fixedSize.w && fixedSize.h) {
+                //content is too big in both directions, so we will use 
+                // max popup size (safeSize), knowing well that it will 
+                // overflow both ways.                
+                newSize = safeSize;
+            } else {
+                //content is clipped in only one direction, so we need to 
+                // run getRenderedDimensions() again with a fixed dimension
+                var clippedSize = OpenLayers.Util.getRenderedDimensions(
+                    preparedHTML, fixedSize, {
+                        displayClass: this.contentDisplayClass,
+                        containerElement: containerElement
+                    }
+                );
+                
+                //if the clipped size is still the same as the safeSize, 
+                // that means that our content must be fixed in the 
+                // offending direction. If overflow is 'auto', this means 
+                // we are going to have a scrollbar for sure, so we must 
+                // adjust for that.
+                //
+                var currentOverflow = OpenLayers.Element.getStyle(
+                    this.contentDiv, "overflow"
+                );
+                if ( (currentOverflow != "hidden") && 
+                     (clippedSize.equals(safeSize)) ) {
+                    var scrollBar = OpenLayers.Util.getScrollbarWidth();
+                    if (fixedSize.w) {
+                        clippedSize.h += scrollBar;
+                    } else {
+                        clippedSize.w += scrollBar;
+                    }
+                }
+                
+                newSize = this.getSafeContentSize(clippedSize);
+            }
+        }                        
+        this.setSize(newSize);     
+    },    
 
     /**
 
     /**
-     * Property: oldOnselectstart
-     * {Function}
+     * Method: setBackgroundColor
+     * Sets the background color of the popup.
+     *
+     * Parameters:
+     * color - {String} the background color.  eg "#FFBBBB"
      */
      */
-    oldOnselectstart: null,
+    setBackgroundColor:function(color) { 
+        if (color != undefined) {
+            this.backgroundColor = color; 
+        }
+        
+        if (this.div != null) {
+            this.div.style.backgroundColor = this.backgroundColor;
+        }
+    },  
     
     /**
     
     /**
-     * Property: interval
-     * {Integer} In order to increase performance, an interval (in 
-     *     milliseconds) can be set to reduce the number of drag events 
-     *     called. If set, a new drag event will not be set until the 
-     *     interval has passed. 
-     *     Defaults to 0, meaning no interval. 
+     * Method: setOpacity
+     * Sets the opacity of the popup.
+     * 
+     * Parameters:
+     * opacity - {float} A value between 0.0 (transparent) and 1.0 (solid).   
      */
      */
-    interval: 0,
+    setOpacity:function(opacity) { 
+        if (opacity != undefined) {
+            this.opacity = opacity; 
+        }
+        
+        if (this.div != null) {
+            // for Mozilla and Safari
+            this.div.style.opacity = this.opacity;
+
+            // for IE
+            this.div.style.filter = 'alpha(opacity=' + this.opacity*100 + ')';
+        }
+    },  
     
     /**
     
     /**
-     * Property: timeoutId
-     * {String} The id of the timeout used for the mousedown interval.
-     *     This is "private", and should be left alone.
+     * Method: setBorder
+     * Sets the border style of the popup.
+     *
+     * Parameters:
+     * border - {String} The border style value. eg 2px 
      */
      */
-    timeoutId: null,
+    setBorder:function(border) { 
+        if (border != undefined) {
+            this.border = border;
+        }
+        
+        if (this.div != null) {
+            this.div.style.border = this.border;
+        }
+    },      
     
     /**
     
     /**
-     * APIProperty: documentDrag
-     * {Boolean} If set to true, the handler will also handle mouse moves when
-     *     the cursor has moved out of the map viewport. Default is false.
+     * Method: setContentHTML
+     * Allows the user to set the HTML content of the popup.
+     *
+     * Parameters:
+     * contentHTML - {String} HTML for the div.
      */
      */
-    documentDrag: false,
+    setContentHTML:function(contentHTML) {
+
+        if (contentHTML != null) {
+            this.contentHTML = contentHTML;
+        }
+       
+        if ((this.contentDiv != null) && 
+            (this.contentHTML != null) &&
+            (this.contentHTML != this.contentDiv.innerHTML)) {
+       
+            this.contentDiv.innerHTML = this.contentHTML;
+       
+            if (this.autoSize) {
+                
+                //if popup has images, listen for when they finish
+                // loading and resize accordingly
+                this.registerImageListeners();
+
+                //auto size the popup to its current contents
+                this.updateSize();
+            }
+        }    
+
+    },
+    
+    /**
+     * Method: registerImageListeners
+     * Called when an image contained by the popup loaded. this function
+     *     updates the popup size, then unregisters the image load listener.
+     */   
+    registerImageListeners: function() { 
+
+        // As the images load, this function will call updateSize() to 
+        // resize the popup to fit the content div (which presumably is now
+        // bigger than when the image was not loaded).
+        // 
+        // If the 'panMapIfOutOfView' property is set, we will pan the newly
+        // resized popup back into view.
+        // 
+        // Note that this function, when called, will have 'popup' and 
+        // 'img' properties in the context.
+        //
+        var onImgLoad = function() {
+            if (this.popup.id === null) { // this.popup has been destroyed!
+                return;
+            }
+            this.popup.updateSize();
+     
+            if ( this.popup.visible() && this.popup.panMapIfOutOfView ) {
+                this.popup.panIntoView();
+            }
+
+            OpenLayers.Event.stopObserving(
+                this.img, "load", this.img._onImgLoad
+            );
     
     
-    /**
-     * Property: documentEvents
-     * {Boolean} Are we currently observing document events?
-     */
-    documentEvents: null,
+        };
+
+        //cycle through the images and if their size is 0x0, that means that 
+        // they haven't been loaded yet, so we attach the listener, which 
+        // will fire when the images finish loading and will resize the 
+        // popup accordingly to its new size.
+        var images = this.contentDiv.getElementsByTagName("img");
+        for (var i = 0, len = images.length; i < len; i++) {
+            var img = images[i];
+            if (img.width == 0 || img.height == 0) {
+
+                var context = {
+                    'popup': this,
+                    'img': img
+                };
+
+                //expando this function to the image itself before registering
+                // it. This way we can easily and properly unregister it.
+                img._onImgLoad = OpenLayers.Function.bind(onImgLoad, context);
+
+                OpenLayers.Event.observe(img, 'load', img._onImgLoad);
+            }    
+        } 
+    },
 
     /**
 
     /**
-     * Constructor: OpenLayers.Handler.Drag
-     * Returns OpenLayers.Handler.Drag
+     * APIMethod: getSafeContentSize
      * 
      * Parameters:
      * 
      * Parameters:
-     * control - {<OpenLayers.Control>} The control that is making use of
-     *     this handler.  If a handler is being used without a control, the
-     *     handlers setMap method must be overridden to deal properly with
-     *     the map.
-     * callbacks - {Object} An object containing a single function to be
-     *     called when the drag operation is finished. The callback should
-     *     expect to recieve a single argument, the pixel location of the event.
-     *     Callbacks for 'move' and 'done' are supported. You can also speficy
-     *     callbacks for 'down', 'up', and 'out' to respond to those events.
-     * options - {Object} 
+     * size - {<OpenLayers.Size>} Desired size to make the popup.
+     * 
+     * Returns:
+     * {<OpenLayers.Size>} A size to make the popup which is neither smaller
+     *     than the specified minimum size, nor bigger than the maximum 
+     *     size (which is calculated relative to the size of the viewport).
      */
      */
-    initialize: function(control, callbacks, options) {
-        OpenLayers.Handler.prototype.initialize.apply(this, arguments);
+    getSafeContentSize: function(size) {
+
+        var safeContentSize = size.clone();
+
+        // if our contentDiv has a css 'padding' set on it by a stylesheet, we 
+        //  must add that to the desired "size". 
+        var contentDivPadding = this.getContentDivPadding();
+        var wPadding = contentDivPadding.left + contentDivPadding.right;
+        var hPadding = contentDivPadding.top + contentDivPadding.bottom;
+
+        // take into account the popup's 'padding' property
+        this.fixPadding();
+        wPadding += this.padding.left + this.padding.right;
+        hPadding += this.padding.top + this.padding.bottom;
+
+        if (this.closeDiv) {
+            var closeDivWidth = parseInt(this.closeDiv.style.width);
+            wPadding += closeDivWidth + contentDivPadding.right;
+        }
+
+        // prevent the popup from being smaller than a specified minimal size
+        if (this.minSize) {
+            safeContentSize.w = Math.max(safeContentSize.w, 
+                (this.minSize.w - wPadding));
+            safeContentSize.h = Math.max(safeContentSize.h, 
+                (this.minSize.h - hPadding));
+        }
+
+        // prevent the popup from being bigger than a specified maximum size
+        if (this.maxSize) {
+            safeContentSize.w = Math.min(safeContentSize.w, 
+                (this.maxSize.w - wPadding));
+            safeContentSize.h = Math.min(safeContentSize.h, 
+                (this.maxSize.h - hPadding));
+        }
         
         
-        if (this.documentDrag === true) {
-            var me = this;
-            this._docMove = function(evt) {
-                me.mousemove({
-                    xy: {x: evt.clientX, y: evt.clientY},
-                    element: document
-                });
-            };
-            this._docUp = function(evt) {
-                me.mouseup({xy: {x: evt.clientX, y: evt.clientY}});
-            };
+        //make sure the desired size to set doesn't result in a popup that 
+        // is bigger than the map's viewport.
+        //
+        if (this.map && this.map.size) {
+            
+            var extraX = 0, extraY = 0;
+            if (this.keepInMap && !this.panMapIfOutOfView) {
+                var px = this.map.getPixelFromLonLat(this.lonlat);
+                switch (this.relativePosition) {
+                    case "tr":
+                        extraX = px.x;
+                        extraY = this.map.size.h - px.y;
+                        break;
+                    case "tl":
+                        extraX = this.map.size.w - px.x;
+                        extraY = this.map.size.h - px.y;
+                        break;
+                    case "bl":
+                        extraX = this.map.size.w - px.x;
+                        extraY = px.y;
+                        break;
+                    case "br":
+                        extraX = px.x;
+                        extraY = px.y;
+                        break;
+                    default:    
+                        extraX = px.x;
+                        extraY = this.map.size.h - px.y;
+                        break;
+                }
+            }    
+          
+            var maxY = this.map.size.h - 
+                this.map.paddingForPopups.top - 
+                this.map.paddingForPopups.bottom - 
+                hPadding - extraY;
+            
+            var maxX = this.map.size.w - 
+                this.map.paddingForPopups.left - 
+                this.map.paddingForPopups.right - 
+                wPadding - extraX;
+            
+            safeContentSize.w = Math.min(safeContentSize.w, maxX);
+            safeContentSize.h = Math.min(safeContentSize.h, maxY);
         }
         }
+        
+        return safeContentSize;
     },
     },
-
     
     /**
     
     /**
-     * Method: dragstart
-     * This private method is factorized from mousedown and touchstart methods
+     * Method: getContentDivPadding
+     * Glorious, oh glorious hack in order to determine the css 'padding' of 
+     *     the contentDiv. IE/Opera return null here unless we actually add the 
+     *     popup's main 'div' element (which contains contentDiv) to the DOM. 
+     *     So we make it invisible and then add it to the document temporarily. 
      *
      *
-     * Parameters:
-     * evt - {Event} The event
+     *     Once we've taken the padding readings we need, we then remove it 
+     *     from the DOM (it will actually get added to the DOM in 
+     *     Map.js's addPopup)
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} Let the event propagate.
+     * {<OpenLayers.Bounds>}
      */
      */
-    dragstart: function (evt) {
-        var propagate = true;
-        this.dragging = false;
-        if (this.checkModifiers(evt) &&
-               (OpenLayers.Event.isLeftClick(evt) ||
-                OpenLayers.Event.isSingleTouch(evt))) {
-            this.started = true;
-            this.start = evt.xy;
-            this.last = evt.xy;
-            OpenLayers.Element.addClass(
-                this.map.viewPortDiv, "olDragDown"
-            );
-            this.down(evt);
-            this.callback("down", [evt.xy]);
+    getContentDivPadding: function() {
 
 
-            // prevent document dragging
-            OpenLayers.Event.preventDefault(evt);
+        //use cached value if we have it
+        var contentDivPadding = this._contentDivPadding;
+        if (!contentDivPadding) {
 
 
-            if(!this.oldOnselectstart) {
-                this.oldOnselectstart = document.onselectstart ?
-                    document.onselectstart : OpenLayers.Function.True;
+            if (this.div.parentNode == null) {
+                //make the div invisible and add it to the page        
+                this.div.style.display = "none";
+                document.body.appendChild(this.div);
             }
             }
-            document.onselectstart = OpenLayers.Function.False;
+                    
+            //read the padding settings from css, put them in an OL.Bounds        
+            contentDivPadding = new OpenLayers.Bounds(
+                OpenLayers.Element.getStyle(this.contentDiv, "padding-left"),
+                OpenLayers.Element.getStyle(this.contentDiv, "padding-bottom"),
+                OpenLayers.Element.getStyle(this.contentDiv, "padding-right"),
+                OpenLayers.Element.getStyle(this.contentDiv, "padding-top")
+            );
+    
+            //cache the value
+            this._contentDivPadding = contentDivPadding;
 
 
-            propagate = !this.stopDown;
-        } else {
-            this.started = false;
-            this.start = null;
-            this.last = null;
+            if (this.div.parentNode == document.body) {
+                //remove the div from the page and make it visible again
+                document.body.removeChild(this.div);
+                this.div.style.display = "";
+            }
         }
         }
-        return propagate;
+        return contentDivPadding;
     },
 
     /**
     },
 
     /**
-     * Method: dragmove
-     * This private method is factorized from mousemove and touchmove methods
-     *
+     * Method: addCloseBox
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event} The event
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * callback - {Function} The callback to be called when the close button
+     *     is clicked.
      */
      */
-    dragmove: function (evt) {
-        this.lastMoveEvt = evt;
-        if (this.started && !this.timeoutId && (evt.xy.x != this.last.x ||
-                                                evt.xy.y != this.last.y)) {
-            if(this.documentDrag === true && this.documentEvents) {
-                if(evt.element === document) {
-                    this.adjustXY(evt);
-                    // do setEvent manually because the documentEvents are not
-                    // registered with the map
-                    this.setEvent(evt);
-                } else {
-                    this.removeDocumentEvents();
-                }
-            }
-            if (this.interval > 0) {
-                this.timeoutId = setTimeout(
-                    OpenLayers.Function.bind(this.removeTimeout, this),
-                    this.interval);
-            }
-            this.dragging = true;
+    addCloseBox: function(callback) {
 
 
-            this.move(evt);
-            this.callback("move", [evt.xy]);
-            if(!this.oldOnselectstart) {
-                this.oldOnselectstart = document.onselectstart;
-                document.onselectstart = OpenLayers.Function.False;
-            }
-            this.last = evt.xy;
-        }
-        return true;
+        this.closeDiv = OpenLayers.Util.createDiv(
+            this.id + "_close", null, {w: 17, h: 17}
+        );
+        this.closeDiv.className = "olPopupCloseBox"; 
+        
+        // use the content div's css padding to determine if we should
+        //  padd the close div
+        var contentDivPadding = this.getContentDivPadding();
+         
+        this.closeDiv.style.right = contentDivPadding.right + "px";
+        this.closeDiv.style.top = contentDivPadding.top + "px";
+        this.groupDiv.appendChild(this.closeDiv);
+
+        var closePopup = callback || function(e) {
+            this.hide();
+            OpenLayers.Event.stop(e);
+        };
+        OpenLayers.Event.observe(this.closeDiv, "touchend", 
+                OpenLayers.Function.bindAsEventListener(closePopup, this));
+        OpenLayers.Event.observe(this.closeDiv, "click", 
+                OpenLayers.Function.bindAsEventListener(closePopup, this));
     },
 
     /**
     },
 
     /**
-     * Method: dragend
-     * This private method is factorized from mouseup and touchend methods
-     *
-     * Parameters:
-     * evt - {Event} The event
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * Method: panIntoView
+     * Pans the map such that the popup is totaly viewable (if necessary)
      */
      */
-    dragend: function (evt) {
-        if (this.started) {
-            if(this.documentDrag === true && this.documentEvents) {
-                this.adjustXY(evt);
-                this.removeDocumentEvents();
-            }
-            var dragged = (this.start != this.last);
-            this.started = false;
-            this.dragging = false;
-            OpenLayers.Element.removeClass(
-                this.map.viewPortDiv, "olDragDown"
-            );
-            this.up(evt);
-            this.callback("up", [evt.xy]);
-            if(dragged) {
-                this.callback("done", [evt.xy]);
-            }
-            document.onselectstart = this.oldOnselectstart;
+    panIntoView: function() {
+        
+        var mapSize = this.map.getSize();
+    
+        //start with the top left corner of the popup, in px, 
+        // relative to the viewport
+        var origTL = this.map.getViewPortPxFromLayerPx( new OpenLayers.Pixel(
+            parseInt(this.div.style.left),
+            parseInt(this.div.style.top)
+        ));
+        var newTL = origTL.clone();
+    
+        //new left (compare to margins, using this.size to calculate right)
+        if (origTL.x < this.map.paddingForPopups.left) {
+            newTL.x = this.map.paddingForPopups.left;
+        } else 
+        if ( (origTL.x + this.size.w) > (mapSize.w - this.map.paddingForPopups.right)) {
+            newTL.x = mapSize.w - this.map.paddingForPopups.right - this.size.w;
         }
         }
-        return true;
+        
+        //new top (compare to margins, using this.size to calculate bottom)
+        if (origTL.y < this.map.paddingForPopups.top) {
+            newTL.y = this.map.paddingForPopups.top;
+        } else 
+        if ( (origTL.y + this.size.h) > (mapSize.h - this.map.paddingForPopups.bottom)) {
+            newTL.y = mapSize.h - this.map.paddingForPopups.bottom - this.size.h;
+        }
+        
+        var dx = origTL.x - newTL.x;
+        var dy = origTL.y - newTL.y;
+        
+        this.map.pan(dx, dy);
     },
 
     },
 
-    /**
-     * The four methods below (down, move, up, and out) are used by subclasses
-     *     to do their own processing related to these mouse events.
+    /** 
+     * Method: registerEvents
+     * Registers events on the popup.
+     *
+     * Do this in a separate function so that subclasses can 
+     *   choose to override it if they wish to deal differently
+     *   with mouse events
+     * 
+     *   Note in the following handler functions that some special
+     *    care is needed to deal correctly with mousing and popups. 
+     *   
+     *   Because the user might select the zoom-rectangle option and
+     *    then drag it over a popup, we need a safe way to allow the
+     *    mousemove and mouseup events to pass through the popup when
+     *    they are initiated from outside. The same procedure is needed for
+     *    touchmove and touchend events.
+     * 
+     *   Otherwise, we want to essentially kill the event propagation
+     *    for all other events, though we have to do so carefully, 
+     *    without disabling basic html functionality, like clicking on 
+     *    hyperlinks or drag-selecting text.
      */
      */
+     registerEvents:function() {
+        this.events = new OpenLayers.Events(this, this.div, null, true);
 
 
-    /**
-     * Method: down
-     * This method is called during the handling of the mouse down event.
-     *     Subclasses can do their own processing here.
-     *
+        function onTouchstart(evt) {
+            OpenLayers.Event.stop(evt, true);
+        }
+        this.events.on({
+            "mousedown": this.onmousedown,
+            "mousemove": this.onmousemove,
+            "mouseup": this.onmouseup,
+            "click": this.onclick,
+            "mouseout": this.onmouseout,
+            "dblclick": this.ondblclick,
+            "touchstart": onTouchstart,
+            scope: this
+        });
+        
+     },
+
+    /** 
+     * Method: onmousedown 
+     * When mouse goes down within the popup, make a note of
+     *   it locally, and then do not propagate the mousedown 
+     *   (but do so safely so that user can select text inside)
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event} The mouse down event
+     * evt - {Event} 
      */
      */
-    down: function(evt) {
+    onmousedown: function (evt) {
+        this.mousedown = true;
+        OpenLayers.Event.stop(evt, true);
     },
 
     },
 
-    /**
-     * Method: move
-     * This method is called during the handling of the mouse move event.
-     *     Subclasses can do their own processing here.
-     *
+    /** 
+     * Method: onmousemove
+     * If the drag was started within the popup, then 
+     *   do not propagate the mousemove (but do so safely
+     *   so that user can select text inside)
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event} The mouse move event
-     *
+     * evt - {Event} 
      */
      */
-    move: function(evt) {
+    onmousemove: function (evt) {
+        if (this.mousedown) {
+            OpenLayers.Event.stop(evt, true);
+        }
     },
 
     },
 
-    /**
-     * Method: up
-     * This method is called during the handling of the mouse up event.
-     *     Subclasses can do their own processing here.
-     *
+    /** 
+     * Method: onmouseup
+     * When mouse comes up within the popup, after going down 
+     *   in it, reset the flag, and then (once again) do not 
+     *   propagate the event, but do so safely so that user can 
+     *   select text inside
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event} The mouse up event
+     * evt - {Event} 
      */
      */
-    up: function(evt) {
+    onmouseup: function (evt) {
+        if (this.mousedown) {
+            this.mousedown = false;
+            OpenLayers.Event.stop(evt, true);
+        }
     },
 
     /**
     },
 
     /**
-     * Method: out
-     * This method is called during the handling of the mouse out event.
-     *     Subclasses can do their own processing here.
-     *
+     * Method: onclick
+     * Ignore clicks, but allowing default browser handling
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event} The mouse out event
+     * evt - {Event} 
      */
      */
-    out: function(evt) {
+    onclick: function (evt) {
+        OpenLayers.Event.stop(evt, true);
     },
 
     },
 
-    /**
-     * The methods below are part of the magic of event handling.  Because
-     *     they are named like browser events, they are registered as listeners
-     *     for the events they represent.
+    /** 
+     * Method: onmouseout
+     * When mouse goes out of the popup set the flag to false so that
+     *   if they let go and then drag back in, we won't be confused.
+     * 
+     * Parameters:
+     * evt - {Event} 
      */
      */
-
-    /**
-     * Method: mousedown
-     * Handle mousedown events
-     *
+    onmouseout: function (evt) {
+        this.mousedown = false;
+    },
+    
+    /** 
+     * Method: ondblclick
+     * Ignore double-clicks, but allowing default browser handling
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * evt - {Event} 
      */
      */
-    mousedown: function(evt) {
-        return this.dragstart(evt);
+    ondblclick: function (evt) {
+        OpenLayers.Event.stop(evt, true);
     },
 
     },
 
-    /**
-     * Method: touchstart
-     * Handle touchstart events
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+    CLASS_NAME: "OpenLayers.Popup"
+});
+
+OpenLayers.Popup.WIDTH = 200;
+OpenLayers.Popup.HEIGHT = 200;
+OpenLayers.Popup.COLOR = "white";
+OpenLayers.Popup.OPACITY = 1;
+OpenLayers.Popup.BORDER = "0px";
+/* ======================================================================
+    OpenLayers/Popup/Anchored.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+
+/**
+ * @requires OpenLayers/Popup.js
+ */
+
+/**
+ * Class: OpenLayers.Popup.Anchored
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Popup>
+ */
+OpenLayers.Popup.Anchored = 
+  OpenLayers.Class(OpenLayers.Popup, {
+
+    /** 
+     * Property: relativePosition
+     * {String} Relative position of the popup ("br", "tr", "tl" or "bl").
      */
      */
-    touchstart: function(evt) {
-        this.startTouch();
-        return this.dragstart(evt);
-    },
-
+    relativePosition: null,
+    
     /**
     /**
-     * Method: mousemove
-     * Handle mousemove events
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * APIProperty: keepInMap 
+     * {Boolean} If panMapIfOutOfView is false, and this property is true, 
+     *     contrain the popup such that it always fits in the available map
+     *     space. By default, this is set. If you are creating popups that are
+     *     near map edges and not allowing pannning, and especially if you have
+     *     a popup which has a fixedRelativePosition, setting this to false may
+     *     be a smart thing to do.
+     *   
+     *     For anchored popups, default is true, since subclasses will
+     *     usually want this functionality.
      */
      */
-    mousemove: function(evt) {
-        return this.dragmove(evt);
-    },
+    keepInMap: true,
 
     /**
 
     /**
-     * Method: touchmove
-     * Handle touchmove events
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * Property: anchor
+     * {Object} Object to which we'll anchor the popup. Must expose a 
+     *     'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>).
      */
      */
-    touchmove: function(evt) {
-        return this.dragmove(evt);
-    },
+    anchor: null,
 
 
-    /**
-     * Method: removeTimeout
-     * Private. Called by mousemove() to remove the drag timeout.
-     */
-    removeTimeout: function() {
-        this.timeoutId = null;
-        // if timeout expires while we're still dragging (mouseup
-        // hasn't occurred) then call mousemove to move to the
-        // correct position
-        if(this.dragging) {
-            this.mousemove(this.lastMoveEvt);
-        }
-    },
+    /** 
+    * Constructor: OpenLayers.Popup.Anchored
+    * 
+    * Parameters:
+    * id - {String}
+    * lonlat - {<OpenLayers.LonLat>}
+    * contentSize - {<OpenLayers.Size>}
+    * contentHTML - {String}
+    * anchor - {Object} Object which must expose a 'size' <OpenLayers.Size> 
+    *     and 'offset' <OpenLayers.Pixel> (generally an <OpenLayers.Icon>).
+    * closeBox - {Boolean}
+    * closeBoxCallback - {Function} Function to be called on closeBox click.
+    */
+    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox,
+                        closeBoxCallback) {
+        var newArguments = [
+            id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback
+        ];
+        OpenLayers.Popup.prototype.initialize.apply(this, newArguments);
 
 
-    /**
-     * Method: mouseup
-     * Handle mouseup events
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
-     */
-    mouseup: function(evt) {
-        return this.dragend(evt);
+        this.anchor = (anchor != null) ? anchor 
+                                       : { size: new OpenLayers.Size(0,0),
+                                           offset: new OpenLayers.Pixel(0,0)};
     },
 
     /**
     },
 
     /**
-     * Method: touchend
-     * Handle touchend events
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * APIMethod: destroy
      */
      */
-    touchend: function(evt) {
-        // override evt.xy with last position since touchend does not have
-        // any touch position
-        evt.xy = this.last;
-        return this.dragend(evt);
+    destroy: function() {
+        this.anchor = null;
+        this.relativePosition = null;
+        
+        OpenLayers.Popup.prototype.destroy.apply(this, arguments);        
     },
 
     /**
     },
 
     /**
-     * Method: mouseout
-     * Handle mouseout events
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * APIMethod: show
+     * Overridden from Popup since user might hide popup and then show() it 
+     *     in a new location (meaning we might want to update the relative
+     *     position on the show)
      */
      */
-    mouseout: function (evt) {
-        if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.viewPortDiv)) {
-            if(this.documentDrag === true) {
-                this.addDocumentEvents();
-            } else {
-                var dragged = (this.start != this.last);
-                this.started = false; 
-                this.dragging = false;
-                OpenLayers.Element.removeClass(
-                    this.map.viewPortDiv, "olDragDown"
-                );
-                this.out(evt);
-                this.callback("out", []);
-                if(dragged) {
-                    this.callback("done", [evt.xy]);
-                }
-                if(document.onselectstart) {
-                    document.onselectstart = this.oldOnselectstart;
-                }
-            }
-        }
-        return true;
+    show: function() {
+        this.updatePosition();
+        OpenLayers.Popup.prototype.show.apply(this, arguments);
     },
 
     /**
     },
 
     /**
-     * Method: click
-     * The drag handler captures the click event.  If something else registers
-     *     for clicks on the same element, its listener will not be called 
-     *     after a drag.
+     * Method: moveTo
+     * Since the popup is moving to a new px, it might need also to be moved
+     *     relative to where the marker is. We first calculate the new 
+     *     relativePosition, and then we calculate the new px where we will 
+     *     put the popup, based on the new relative position. 
      * 
      * 
-     * Parameters: 
-     * evt - {Event} 
+     *     If the relativePosition has changed, we must also call 
+     *     updateRelativePosition() to make any visual changes to the popup 
+     *     which are associated with putting it in a new relativePosition.
      * 
      * 
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * Parameters:
+     * px - {<OpenLayers.Pixel>}
      */
      */
-    click: function (evt) {
-        // let the click event propagate only if the mouse moved
-        return (this.start == this.last);
-    },
+    moveTo: function(px) {
+        var oldRelativePosition = this.relativePosition;
+        this.relativePosition = this.calculateRelativePosition(px);
 
 
-    /**
-     * Method: activate
-     * Activate the handler.
-     * 
-     * Returns:
-     * {Boolean} The handler was successfully activated.
-     */
-    activate: function() {
-        var activated = false;
-        if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
-            this.dragging = false;
-            activated = true;
+        OpenLayers.Popup.prototype.moveTo.call(this, this.calculateNewPx(px));
+        
+        //if this move has caused the popup to change its relative position, 
+        // we need to make the appropriate cosmetic changes.
+        if (this.relativePosition != oldRelativePosition) {
+            this.updateRelativePosition();
         }
         }
-        return activated;
     },
 
     /**
     },
 
     /**
-     * Method: deactivate 
-     * Deactivate the handler.
+     * APIMethod: setSize
      * 
      * 
-     * Returns:
-     * {Boolean} The handler was successfully deactivated.
+     * Parameters:
+     * contentSize - {<OpenLayers.Size>} the new size for the popup's 
+     *     contents div (in pixels).
      */
      */
-    deactivate: function() {
-        var deactivated = false;
-        if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
-            this.started = false;
-            this.dragging = false;
-            this.start = null;
-            this.last = null;
-            deactivated = true;
-            OpenLayers.Element.removeClass(
-                this.map.viewPortDiv, "olDragDown"
-            );
+    setSize:function(contentSize) { 
+        OpenLayers.Popup.prototype.setSize.apply(this, arguments);
+
+        if ((this.lonlat) && (this.map)) {
+            var px = this.map.getLayerPxFromLonLat(this.lonlat);
+            this.moveTo(px);
         }
         }
-        return deactivated;
-    },
+    },  
     
     
-    /**
-     * Method: adjustXY
-     * Converts event coordinates that are relative to the document body to
-     * ones that are relative to the map viewport. The latter is the default in
-     * OpenLayers.
+    /** 
+     * Method: calculateRelativePosition
      * 
      * Parameters:
      * 
      * Parameters:
-     * evt - {Object}
+     * px - {<OpenLayers.Pixel>}
+     * 
+     * Returns:
+     * {String} The relative position ("br" "tr" "tl" "bl") at which the popup
+     *     should be placed.
      */
      */
-    adjustXY: function(evt) {
-        var pos = OpenLayers.Util.pagePosition(this.map.viewPortDiv);
-        evt.xy.x -= pos[0];
-        evt.xy.y -= pos[1];
-    },
-    
+    calculateRelativePosition:function(px) {
+        var lonlat = this.map.getLonLatFromLayerPx(px);        
+        
+        var extent = this.map.getExtent();
+        var quadrant = extent.determineQuadrant(lonlat);
+        
+        return OpenLayers.Bounds.oppositeQuadrant(quadrant);
+    }, 
+
     /**
     /**
-     * Method: addDocumentEvents
-     * Start observing document events when documentDrag is true and the mouse
-     * cursor leaves the map viewport while dragging.
+     * Method: updateRelativePosition
+     * The popup has been moved to a new relative location, so we may want to 
+     *     make some cosmetic adjustments to it. 
+     * 
+     *     Note that in the classic Anchored popup, there is nothing to do 
+     *     here, since the popup looks exactly the same in all four positions.
+     *     Subclasses such as Framed, however, will want to do something
+     *     special here.
      */
      */
-    addDocumentEvents: function() {
-        OpenLayers.Element.addClass(document.body, "olDragDown");
-        this.documentEvents = true;
-        OpenLayers.Event.observe(document, "mousemove", this._docMove);
-        OpenLayers.Event.observe(document, "mouseup", this._docUp);
+    updateRelativePosition: function() {
+        //to be overridden by subclasses
     },
     },
-    
-    /**
-     * Method: removeDocumentEvents
-     * Stops observing document events when documentDrag is true and the mouse
-     * cursor re-enters the map viewport while dragging.
+
+    /** 
+     * Method: calculateNewPx
+     * 
+     * Parameters:
+     * px - {<OpenLayers.Pixel>}
+     * 
+     * Returns:
+     * {<OpenLayers.Pixel>} The the new px position of the popup on the screen
+     *     relative to the passed-in px.
      */
      */
-    removeDocumentEvents: function() {
-        OpenLayers.Element.removeClass(document.body, "olDragDown");
-        this.documentEvents = false;
-        OpenLayers.Event.stopObserving(document, "mousemove", this._docMove);
-        OpenLayers.Event.stopObserving(document, "mouseup", this._docUp);
+    calculateNewPx:function(px) {
+        var newPx = px.offset(this.anchor.offset);
+        
+        //use contentSize if size is not already set
+        var size = this.size || this.contentSize;
+
+        var top = (this.relativePosition.charAt(0) == 't');
+        newPx.y += (top) ? -size.h : this.anchor.size.h;
+        
+        var left = (this.relativePosition.charAt(1) == 'l');
+        newPx.x += (left) ? -size.w : this.anchor.size.w;
+
+        return newPx;   
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Handler.Drag"
+    CLASS_NAME: "OpenLayers.Popup.Anchored"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Handler/Box.js
+    OpenLayers/Popup/Framed.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Handler.js
- * @requires OpenLayers/Handler/Drag.js
+ * @requires OpenLayers/Popup/Anchored.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Handler.Box
- * Handler for dragging a rectangle across the map.  Box is displayed 
- * on mouse down, moves on mouse move, and is finished on mouse up.
- *
+ * Class: OpenLayers.Popup.Framed
+ * 
  * Inherits from:
  * Inherits from:
- *  - <OpenLayers.Handler> 
+ *  - <OpenLayers.Popup.Anchored>
  */
  */
-OpenLayers.Handler.Box = OpenLayers.Class(OpenLayers.Handler, {
+OpenLayers.Popup.Framed =
+  OpenLayers.Class(OpenLayers.Popup.Anchored, {
 
 
-    /** 
-     * Property: dragHandler 
-     * {<OpenLayers.Handler.Drag>} 
+    /**
+     * Property: imageSrc
+     * {String} location of the image to be used as the popup frame
      */
      */
-    dragHandler: null,
+    imageSrc: null,
 
     /**
 
     /**
-     * APIProperty: boxDivClassName
-     * {String} The CSS class to use for drawing the box. Default is
-     *     olHandlerBoxZoomBox
+     * Property: imageSize
+     * {<OpenLayers.Size>} Size (measured in pixels) of the image located
+     *     by the 'imageSrc' property.
      */
      */
-    boxDivClassName: 'olHandlerBoxZoomBox',
-    
+    imageSize: null,
+
     /**
     /**
-     * Property: boxOffsets
-     * {Object} Caches box offsets from css. This is used by the getBoxOffsets
-     * method.
+     * APIProperty: isAlphaImage
+     * {Boolean} The image has some alpha and thus needs to use the alpha 
+     *     image hack. Note that setting this to true will have no noticeable
+     *     effect in FF or IE7 browsers, but will all but crush the ie6 
+     *     browser. 
+     *     Default is false.
      */
      */
-    boxOffsets: null,
+    isAlphaImage: false,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Handler.Box
-     *
+     * Property: positionBlocks
+     * {Object} Hash of different position blocks (Object/Hashs). Each block 
+     *     will be keyed by a two-character 'relativePosition' 
+     *     code string (ie "tl", "tr", "bl", "br"). Block properties are 
+     *     'offset', 'padding' (self-explanatory), and finally the 'blocks'
+     *     parameter, which is an array of the block objects. 
+     * 
+     *     Each block object must have 'size', 'anchor', and 'position' 
+     *     properties.
+     * 
+     *     Note that positionBlocks should never be modified at runtime.
+     */
+    positionBlocks: null,
+
+    /**
+     * Property: blocks
+     * {Array[Object]} Array of objects, each of which is one "block" of the 
+     *     popup. Each block has a 'div' and an 'image' property, both of 
+     *     which are DOMElements, and the latter of which is appended to the 
+     *     former. These are reused as the popup goes changing positions for
+     *     great economy and elegance.
+     */
+    blocks: null,
+
+    /** 
+     * APIProperty: fixedRelativePosition
+     * {Boolean} We want the framed popup to work dynamically placed relative
+     *     to its anchor but also in just one fixed position. A well designed
+     *     framed popup will have the pixels and logic to display itself in 
+     *     any of the four relative positions, but (understandably), this will
+     *     not be the case for all of them. By setting this property to 'true', 
+     *     framed popup will not recalculate for the best placement each time
+     *     it's open, but will always open the same way. 
+     *     Note that if this is set to true, it is generally advisable to also
+     *     set the 'panIntoView' property to true so that the popup can be 
+     *     scrolled into view (since it will often be offscreen on open)
+     *     Default is false.
+     */
+    fixedRelativePosition: false,
+
+    /** 
+     * Constructor: OpenLayers.Popup.Framed
+     * 
      * Parameters:
      * Parameters:
-     * control - {<OpenLayers.Control>} 
-     * callbacks - {Object} An object with a properties whose values are
-     *     functions.  Various callbacks described below.
-     * options - {Object} 
-     *
-     * Named callbacks:
-     * start - Called when the box drag operation starts.
-     * done - Called when the box drag operation is finished.
-     *     The callback should expect to receive a single argument, the box 
-     *     bounds or a pixel. If the box dragging didn't span more than a 5 
-     *     pixel distance, a pixel will be returned instead of a bounds object.
+     * id - {String}
+     * lonlat - {<OpenLayers.LonLat>}
+     * contentSize - {<OpenLayers.Size>}
+     * contentHTML - {String}
+     * anchor - {Object} Object to which we'll anchor the popup. Must expose 
+     *     a 'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>) 
+     *     (Note that this is generally an <OpenLayers.Icon>).
+     * closeBox - {Boolean}
+     * closeBoxCallback - {Function} Function to be called on closeBox click.
      */
      */
-    initialize: function(control, callbacks, options) {
-        OpenLayers.Handler.prototype.initialize.apply(this, arguments);
-        this.dragHandler = new OpenLayers.Handler.Drag(
-            this, 
-            {
-                down: this.startBox, 
-                move: this.moveBox, 
-                out: this.removeBox,
-                up: this.endBox
-            }, 
-            {keyMask: this.keyMask}
-        );
+    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 
+                        closeBoxCallback) {
+
+        OpenLayers.Popup.Anchored.prototype.initialize.apply(this, arguments);
+
+        if (this.fixedRelativePosition) {
+            //based on our decided relativePostion, set the current padding
+            // this keeps us from getting into trouble 
+            this.updateRelativePosition();
+            
+            //make calculateRelativePosition always return the specified
+            // fixed position.
+            this.calculateRelativePosition = function(px) {
+                return this.relativePosition;
+            };
+        }
+
+        this.contentDiv.style.position = "absolute";
+        this.contentDiv.style.zIndex = 1;
+
+        if (closeBox) {
+            this.closeDiv.style.zIndex = 1;
+        }
+
+        this.groupDiv.style.position = "absolute";
+        this.groupDiv.style.top = "0px";
+        this.groupDiv.style.left = "0px";
+        this.groupDiv.style.height = "100%";
+        this.groupDiv.style.width = "100%";
     },
 
     },
 
-    /**
-     * Method: destroy
+    /** 
+     * APIMethod: destroy
      */
     destroy: function() {
      */
     destroy: function() {
-        OpenLayers.Handler.prototype.destroy.apply(this, arguments);
-        if (this.dragHandler) {
-            this.dragHandler.destroy();
-            this.dragHandler = null;
-        }            
+        this.imageSrc = null;
+        this.imageSize = null;
+        this.isAlphaImage = null;
+
+        this.fixedRelativePosition = false;
+        this.positionBlocks = null;
+
+        //remove our blocks
+        for(var i = 0; i < this.blocks.length; i++) {
+            var block = this.blocks[i];
+
+            if (block.image) {
+                block.div.removeChild(block.image);
+            }
+            block.image = null;
+
+            if (block.div) {
+                this.groupDiv.removeChild(block.div);
+            }
+            block.div = null;
+        }
+        this.blocks = null;
+
+        OpenLayers.Popup.Anchored.prototype.destroy.apply(this, arguments);
+    },
+
+    /**
+     * APIMethod: setBackgroundColor
+     */
+    setBackgroundColor:function(color) {
+        //does nothing since the framed popup's entire scheme is based on a 
+        // an image -- changing the background color makes no sense. 
+    },
+
+    /**
+     * APIMethod: setBorder
+     */
+    setBorder:function() {
+        //does nothing since the framed popup's entire scheme is based on a 
+        // an image -- changing the popup's border makes no sense. 
     },
 
     /**
     },
 
     /**
-     * Method: setMap
+     * Method: setOpacity
+     * Sets the opacity of the popup.
+     * 
+     * Parameters:
+     * opacity - {float} A value between 0.0 (transparent) and 1.0 (solid).   
      */
      */
-    setMap: function (map) {
-        OpenLayers.Handler.prototype.setMap.apply(this, arguments);
-        if (this.dragHandler) {
-            this.dragHandler.setMap(map);
-        }
+    setOpacity:function(opacity) {
+        //does nothing since we suppose that we'll never apply an opacity
+        // to a framed popup
     },
 
     /**
     },
 
     /**
-    * Method: startBox
-    *
-    * Parameters:
-    * xy - {<OpenLayers.Pixel>}
-    */
-    startBox: function (xy) {
-        this.callback("start", []);
-        this.zoomBox = OpenLayers.Util.createDiv('zoomBox', {
-            x: -9999, y: -9999
-        });
-        this.zoomBox.className = this.boxDivClassName;                                         
-        this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
-        
-        this.map.viewPortDiv.appendChild(this.zoomBox);
-        
-        OpenLayers.Element.addClass(
-            this.map.viewPortDiv, "olDrawBox"
-        );
+     * APIMethod: setSize
+     * Overridden here, because we need to update the blocks whenever the size
+     *     of the popup has changed.
+     * 
+     * Parameters:
+     * contentSize - {<OpenLayers.Size>} the new size for the popup's 
+     *     contents div (in pixels).
+     */
+    setSize:function(contentSize) { 
+        OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments);
+
+        this.updateBlocks();
     },
 
     /**
     },
 
     /**
-    * Method: moveBox
-    */
-    moveBox: function (xy) {
-        var startX = this.dragHandler.start.x;
-        var startY = this.dragHandler.start.y;
-        var deltaX = Math.abs(startX - xy.x);
-        var deltaY = Math.abs(startY - xy.y);
+     * Method: updateRelativePosition
+     * When the relative position changes, we need to set the new padding 
+     *     BBOX on the popup, reposition the close div, and update the blocks.
+     */
+    updateRelativePosition: function() {
 
 
-        var offset = this.getBoxOffsets();
-        this.zoomBox.style.width = (deltaX + offset.width + 1) + "px";
-        this.zoomBox.style.height = (deltaY + offset.height + 1) + "px";
-        this.zoomBox.style.left = (xy.x < startX ?
-            startX - deltaX - offset.left : startX - offset.left) + "px";
-        this.zoomBox.style.top = (xy.y < startY ?
-            startY - deltaY - offset.top : startY - offset.top) + "px";
-    },
+        //update the padding
+        this.padding = this.positionBlocks[this.relativePosition].padding;
 
 
-    /**
-    * Method: endBox
-    */
-    endBox: function(end) {
-        var result;
-        if (Math.abs(this.dragHandler.start.x - end.x) > 5 ||    
-            Math.abs(this.dragHandler.start.y - end.y) > 5) {   
-            var start = this.dragHandler.start;
-            var top = Math.min(start.y, end.y);
-            var bottom = Math.max(start.y, end.y);
-            var left = Math.min(start.x, end.x);
-            var right = Math.max(start.x, end.x);
-            result = new OpenLayers.Bounds(left, bottom, right, top);
-        } else {
-            result = this.dragHandler.start.clone(); // i.e. OL.Pixel
-        } 
-        this.removeBox();
+        //update the position of our close box to new padding
+        if (this.closeDiv) {
+            // use the content div's css padding to determine if we should
+            //  padd the close div
+            var contentDivPadding = this.getContentDivPadding();
 
 
-        this.callback("done", [result]);
+            this.closeDiv.style.right = contentDivPadding.right + 
+                                        this.padding.right + "px";
+            this.closeDiv.style.top = contentDivPadding.top + 
+                                      this.padding.top + "px";
+        }
+
+        this.updateBlocks();
     },
 
     },
 
-    /**
-     * Method: removeBox
-     * Remove the zoombox from the screen and nullify our reference to it.
+    /** 
+     * Method: calculateNewPx
+     * Besides the standard offset as determined by the Anchored class, our 
+     *     Framed popups have a special 'offset' property for each of their 
+     *     positions, which is used to offset the popup relative to its anchor.
+     * 
+     * Parameters:
+     * px - {<OpenLayers.Pixel>}
+     * 
+     * Returns:
+     * {<OpenLayers.Pixel>} The the new px position of the popup on the screen
+     *     relative to the passed-in px.
      */
      */
-    removeBox: function() {
-        this.map.viewPortDiv.removeChild(this.zoomBox);
-        this.zoomBox = null;
-        this.boxOffsets = null;
-        OpenLayers.Element.removeClass(
-            this.map.viewPortDiv, "olDrawBox"
+    calculateNewPx:function(px) {
+        var newPx = OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(
+            this, arguments
         );
 
         );
 
+        newPx = newPx.offset(this.positionBlocks[this.relativePosition].offset);
+
+        return newPx;
     },
 
     /**
     },
 
     /**
-     * Method: activate
+     * Method: createBlocks
      */
      */
-    activate: function () {
-        if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
-            this.dragHandler.activate();
-            return true;
-        } else {
-            return false;
+    createBlocks: function() {
+        this.blocks = [];
+
+        //since all positions contain the same number of blocks, we can 
+        // just pick the first position and use its blocks array to create
+        // our blocks array
+        var firstPosition = null;
+        for(var key in this.positionBlocks) {
+            firstPosition = key;
+            break;
+        }
+        
+        var position = this.positionBlocks[firstPosition];
+        for (var i = 0; i < position.blocks.length; i++) {
+
+            var block = {};
+            this.blocks.push(block);
+
+            var divId = this.id + '_FrameDecorationDiv_' + i;
+            block.div = OpenLayers.Util.createDiv(divId, 
+                null, null, null, "absolute", null, "hidden", null
+            );
+
+            var imgId = this.id + '_FrameDecorationImg_' + i;
+            var imageCreator = 
+                (this.isAlphaImage) ? OpenLayers.Util.createAlphaImageDiv
+                                    : OpenLayers.Util.createImage;
+
+            block.image = imageCreator(imgId, 
+                null, this.imageSize, this.imageSrc, 
+                "absolute", null, null, null
+            );
+
+            block.div.appendChild(block.image);
+            this.groupDiv.appendChild(block.div);
         }
     },
 
     /**
         }
     },
 
     /**
-     * Method: deactivate
+     * Method: updateBlocks
+     * Internal method, called on initialize and when the popup's relative
+     *     position has changed. This function takes care of re-positioning
+     *     the popup's blocks in their appropropriate places.
      */
      */
-    deactivate: function () {
-        if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
-            if (this.dragHandler.deactivate()) {
-                if (this.zoomBox) {
-                    this.removeBox();
-                }
-            }
-            return true;
-        } else {
-            return false;
+    updateBlocks: function() {
+        if (!this.blocks) {
+            this.createBlocks();
         }
         }
-    },
+        
+        if (this.size && this.relativePosition) {
+            var position = this.positionBlocks[this.relativePosition];
+            for (var i = 0; i < position.blocks.length; i++) {
     
     
-    /**
-     * Method: getBoxOffsets
-     * Determines border offsets for a box, according to the box model.
-     * 
-     * Returns:
-     * {Object} an object with the following offsets:
-     *     - left
-     *     - right
-     *     - top
-     *     - bottom
-     *     - width
-     *     - height
-     */
-    getBoxOffsets: function() {
-        if (!this.boxOffsets) {
-            // Determine the box model. If the testDiv's clientWidth is 3, then
-            // the borders are outside and we are dealing with the w3c box
-            // model. Otherwise, the browser uses the traditional box model and
-            // the borders are inside the box bounds, leaving us with a
-            // clientWidth of 1.
-            var testDiv = document.createElement("div");
-            //testDiv.style.visibility = "hidden";
-            testDiv.style.position = "absolute";
-            testDiv.style.border = "1px solid black";
-            testDiv.style.width = "3px";
-            document.body.appendChild(testDiv);
-            var w3cBoxModel = testDiv.clientWidth == 3;
-            document.body.removeChild(testDiv);
-            
-            var left = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
-                "border-left-width"));
-            var right = parseInt(OpenLayers.Element.getStyle(
-                this.zoomBox, "border-right-width"));
-            var top = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
-                "border-top-width"));
-            var bottom = parseInt(OpenLayers.Element.getStyle(
-                this.zoomBox, "border-bottom-width"));
-            this.boxOffsets = {
-                left: left,
-                right: right,
-                top: top,
-                bottom: bottom,
-                width: w3cBoxModel === false ? left + right : 0,
-                height: w3cBoxModel === false ? top + bottom : 0
-            };
+                var positionBlock = position.blocks[i];
+                var block = this.blocks[i];
+    
+                // adjust sizes
+                var l = positionBlock.anchor.left;
+                var b = positionBlock.anchor.bottom;
+                var r = positionBlock.anchor.right;
+                var t = positionBlock.anchor.top;
+    
+                //note that we use the isNaN() test here because if the 
+                // size object is initialized with a "auto" parameter, the 
+                // size constructor calls parseFloat() on the string, 
+                // which will turn it into NaN
+                //
+                var w = (isNaN(positionBlock.size.w)) ? this.size.w - (r + l) 
+                                                      : positionBlock.size.w;
+    
+                var h = (isNaN(positionBlock.size.h)) ? this.size.h - (b + t) 
+                                                      : positionBlock.size.h;
+    
+                block.div.style.width = (w < 0 ? 0 : w) + 'px';
+                block.div.style.height = (h < 0 ? 0 : h) + 'px';
+    
+                block.div.style.left = (l != null) ? l + 'px' : '';
+                block.div.style.bottom = (b != null) ? b + 'px' : '';
+                block.div.style.right = (r != null) ? r + 'px' : '';            
+                block.div.style.top = (t != null) ? t + 'px' : '';
+    
+                block.image.style.left = positionBlock.position.x + 'px';
+                block.image.style.top = positionBlock.position.y + 'px';
+            }
+    
+            this.contentDiv.style.left = this.padding.left + "px";
+            this.contentDiv.style.top = this.padding.top + "px";
         }
         }
-        return this.boxOffsets;
     },
     },
-  
-    CLASS_NAME: "OpenLayers.Handler.Box"
+
+    CLASS_NAME: "OpenLayers.Popup.Framed"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Control/ZoomBox.js
+    OpenLayers/Popup/FramedCloud.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Control.js
- * @requires OpenLayers/Handler/Box.js
+ * @requires OpenLayers/Popup/Framed.js
+ * @requires OpenLayers/Util.js
+ * @requires OpenLayers/BaseTypes/Bounds.js
+ * @requires OpenLayers/BaseTypes/Pixel.js
+ * @requires OpenLayers/BaseTypes/Size.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Control.ZoomBox
- * The ZoomBox control enables zooming directly to a given extent, by drawing 
- * a box on the map. The box is drawn by holding down shift, whilst dragging 
- * the mouse.
- *
- * Inherits from:
- *  - <OpenLayers.Control>
+ * Class: OpenLayers.Popup.FramedCloud
+ * 
+ * Inherits from: 
+ *  - <OpenLayers.Popup.Framed>
  */
  */
-OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
-    /**
-     * Property: type
-     * {OpenLayers.Control.TYPE}
+OpenLayers.Popup.FramedCloud = 
+  OpenLayers.Class(OpenLayers.Popup.Framed, {
+
+    /** 
+     * Property: contentDisplayClass
+     * {String} The CSS class of the popup content div.
      */
      */
-    type: OpenLayers.Control.TYPE_TOOL,
+    contentDisplayClass: "olFramedCloudPopupContent",
 
     /**
 
     /**
-     * Property: out
-     * {Boolean} Should the control be used for zooming out?
+     * APIProperty: autoSize
+     * {Boolean} Framed Cloud is autosizing by default.
      */
      */
-    out: false,
+    autoSize: true,
 
     /**
 
     /**
-     * APIProperty: keyMask
-     * {Integer} Zoom only occurs if the keyMask matches the combination of 
-     *     keys down. Use bitwise operators and one or more of the
-     *     <OpenLayers.Handler> constants to construct a keyMask. Leave null if 
-     *     not used mask. Default is null.
+     * APIProperty: panMapIfOutOfView
+     * {Boolean} Framed Cloud does pan into view by default.
      */
      */
-    keyMask: null,
+    panMapIfOutOfView: true,
 
     /**
 
     /**
-     * APIProperty: alwaysZoom
-     * {Boolean} Always zoom in/out when box drawn, even if the zoom level does
-     * not change.
+     * APIProperty: imageSize
+     * {<OpenLayers.Size>}
      */
      */
-    alwaysZoom: false,
-    
+    imageSize: new OpenLayers.Size(1276, 736),
+
     /**
     /**
-     * APIProperty: zoomOnClick
-     * {Boolean} Should we zoom when no box was dragged, i.e. the user only
-     * clicked? Default is true.
+     * APIProperty: isAlphaImage
+     * {Boolean} The FramedCloud does not use an alpha image (in honor of the 
+     *     good ie6 folk out there)
      */
      */
-    zoomOnClick: true,
+    isAlphaImage: false,
 
 
-    /**
-     * Method: draw
-     */    
-    draw: function() {
-        this.handler = new OpenLayers.Handler.Box( this,
-                            {done: this.zoomBox}, {keyMask: this.keyMask} );
-    },
+    /** 
+     * APIProperty: fixedRelativePosition
+     * {Boolean} The Framed Cloud popup works in just one fixed position.
+     */
+    fixedRelativePosition: false,
 
     /**
 
     /**
-     * Method: zoomBox
-     *
-     * Parameters:
-     * position - {<OpenLayers.Bounds>} or {<OpenLayers.Pixel>}
+     * Property: positionBlocks
+     * {Object} Hash of differen position blocks, keyed by relativePosition
+     *     two-character code string (ie "tl", "tr", "bl", "br")
      */
      */
-    zoomBox: function (position) {
-        if (position instanceof OpenLayers.Bounds) {
-            var bounds,
-                targetCenterPx = position.getCenterPixel();
-            if (!this.out) {
-                var minXY = this.map.getLonLatFromPixel({
-                    x: position.left,
-                    y: position.bottom
-                });
-                var maxXY = this.map.getLonLatFromPixel({
-                    x: position.right,
-                    y: position.top
-                });
-                bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
-                                               maxXY.lon, maxXY.lat);
-            } else {
-                var pixWidth = position.right - position.left;
-                var pixHeight = position.bottom - position.top;
-                var zoomFactor = Math.min((this.map.size.h / pixHeight),
-                    (this.map.size.w / pixWidth));
-                var extent = this.map.getExtent();
-                var center = this.map.getLonLatFromPixel(targetCenterPx);
-                var xmin = center.lon - (extent.getWidth()/2)*zoomFactor;
-                var xmax = center.lon + (extent.getWidth()/2)*zoomFactor;
-                var ymin = center.lat - (extent.getHeight()/2)*zoomFactor;
-                var ymax = center.lat + (extent.getHeight()/2)*zoomFactor;
-                bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);
-            }
-            // always zoom in/out 
-            var lastZoom = this.map.getZoom(),
-                size = this.map.getSize(),
-                centerPx = {x: size.w / 2, y: size.h / 2},
-                zoom = this.map.getZoomForExtent(bounds),
-                oldRes = this.map.getResolution(),
-                newRes = this.map.getResolutionForZoom(zoom);
-            if (oldRes == newRes) {
-                this.map.setCenter(this.map.getLonLatFromPixel(targetCenterPx));
-            } else {
-              var zoomOriginPx = {
-                    x: (oldRes * targetCenterPx.x - newRes * centerPx.x) /
-                        (oldRes - newRes),
-                    y: (oldRes * targetCenterPx.y - newRes * centerPx.y) /
-                        (oldRes - newRes)
-                };
-                this.map.zoomTo(zoom, zoomOriginPx);
-            }
-            if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){ 
-                this.map.zoomTo(lastZoom + (this.out ? -1 : 1)); 
-            }
-        } else if (this.zoomOnClick) { // it's a pixel
-            if (!this.out) {
-                this.map.zoomTo(this.map.getZoom() + 1, position);
-            } else {
-                this.map.zoomTo(this.map.getZoom() - 1, position);
-            }
+    positionBlocks: {
+        "tl": {
+            'offset': new OpenLayers.Pixel(44, 0),
+            'padding': new OpenLayers.Bounds(8, 40, 8, 9),
+            'blocks': [
+                { // top-left
+                    size: new OpenLayers.Size('auto', 'auto'),
+                    anchor: new OpenLayers.Bounds(0, 51, 22, 0),
+                    position: new OpenLayers.Pixel(0, 0)
+                },
+                { //top-right
+                    size: new OpenLayers.Size(22, 'auto'),
+                    anchor: new OpenLayers.Bounds(null, 50, 0, 0),
+                    position: new OpenLayers.Pixel(-1238, 0)
+                },
+                { //bottom-left
+                    size: new OpenLayers.Size('auto', 19),
+                    anchor: new OpenLayers.Bounds(0, 32, 22, null),
+                    position: new OpenLayers.Pixel(0, -631)
+                },
+                { //bottom-right
+                    size: new OpenLayers.Size(22, 18),
+                    anchor: new OpenLayers.Bounds(null, 32, 0, null),
+                    position: new OpenLayers.Pixel(-1238, -632)
+                },
+                { // stem
+                    size: new OpenLayers.Size(81, 35),
+                    anchor: new OpenLayers.Bounds(null, 0, 0, null),
+                    position: new OpenLayers.Pixel(0, -688)
+                }
+            ]
+        },
+        "tr": {
+            'offset': new OpenLayers.Pixel(-45, 0),
+            'padding': new OpenLayers.Bounds(8, 40, 8, 9),
+            'blocks': [
+                { // top-left
+                    size: new OpenLayers.Size('auto', 'auto'),
+                    anchor: new OpenLayers.Bounds(0, 51, 22, 0),
+                    position: new OpenLayers.Pixel(0, 0)
+                },
+                { //top-right
+                    size: new OpenLayers.Size(22, 'auto'),
+                    anchor: new OpenLayers.Bounds(null, 50, 0, 0),
+                    position: new OpenLayers.Pixel(-1238, 0)
+                },
+                { //bottom-left
+                    size: new OpenLayers.Size('auto', 19),
+                    anchor: new OpenLayers.Bounds(0, 32, 22, null),
+                    position: new OpenLayers.Pixel(0, -631)
+                },
+                { //bottom-right
+                    size: new OpenLayers.Size(22, 19),
+                    anchor: new OpenLayers.Bounds(null, 32, 0, null),
+                    position: new OpenLayers.Pixel(-1238, -631)
+                },
+                { // stem
+                    size: new OpenLayers.Size(81, 35),
+                    anchor: new OpenLayers.Bounds(0, 0, null, null),
+                    position: new OpenLayers.Pixel(-215, -687)
+                }
+            ]
+        },
+        "bl": {
+            'offset': new OpenLayers.Pixel(45, 0),
+            'padding': new OpenLayers.Bounds(8, 9, 8, 40),
+            'blocks': [
+                { // top-left
+                    size: new OpenLayers.Size('auto', 'auto'),
+                    anchor: new OpenLayers.Bounds(0, 21, 22, 32),
+                    position: new OpenLayers.Pixel(0, 0)
+                },
+                { //top-right
+                    size: new OpenLayers.Size(22, 'auto'),
+                    anchor: new OpenLayers.Bounds(null, 21, 0, 32),
+                    position: new OpenLayers.Pixel(-1238, 0)
+                },
+                { //bottom-left
+                    size: new OpenLayers.Size('auto', 21),
+                    anchor: new OpenLayers.Bounds(0, 0, 22, null),
+                    position: new OpenLayers.Pixel(0, -629)
+                },
+                { //bottom-right
+                    size: new OpenLayers.Size(22, 21),
+                    anchor: new OpenLayers.Bounds(null, 0, 0, null),
+                    position: new OpenLayers.Pixel(-1238, -629)
+                },
+                { // stem
+                    size: new OpenLayers.Size(81, 33),
+                    anchor: new OpenLayers.Bounds(null, null, 0, 0),
+                    position: new OpenLayers.Pixel(-101, -674)
+                }
+            ]
+        },
+        "br": {
+            'offset': new OpenLayers.Pixel(-44, 0),
+            'padding': new OpenLayers.Bounds(8, 9, 8, 40),
+            'blocks': [
+                { // top-left
+                    size: new OpenLayers.Size('auto', 'auto'),
+                    anchor: new OpenLayers.Bounds(0, 21, 22, 32),
+                    position: new OpenLayers.Pixel(0, 0)
+                },
+                { //top-right
+                    size: new OpenLayers.Size(22, 'auto'),
+                    anchor: new OpenLayers.Bounds(null, 21, 0, 32),
+                    position: new OpenLayers.Pixel(-1238, 0)
+                },
+                { //bottom-left
+                    size: new OpenLayers.Size('auto', 21),
+                    anchor: new OpenLayers.Bounds(0, 0, 22, null),
+                    position: new OpenLayers.Pixel(0, -629)
+                },
+                { //bottom-right
+                    size: new OpenLayers.Size(22, 21),
+                    anchor: new OpenLayers.Bounds(null, 0, 0, null),
+                    position: new OpenLayers.Pixel(-1238, -629)
+                },
+                { // stem
+                    size: new OpenLayers.Size(81, 33),
+                    anchor: new OpenLayers.Bounds(0, null, null, 0),
+                    position: new OpenLayers.Pixel(-311, -674)
+                }
+            ]
         }
     },
 
         }
     },
 
-    CLASS_NAME: "OpenLayers.Control.ZoomBox"
+    /**
+     * APIProperty: minSize
+     * {<OpenLayers.Size>}
+     */
+    minSize: new OpenLayers.Size(105, 10),
+
+    /**
+     * APIProperty: maxSize
+     * {<OpenLayers.Size>}
+     */
+    maxSize: new OpenLayers.Size(1200, 660),
+
+    /** 
+     * Constructor: OpenLayers.Popup.FramedCloud
+     * 
+     * Parameters:
+     * id - {String}
+     * lonlat - {<OpenLayers.LonLat>}
+     * contentSize - {<OpenLayers.Size>}
+     * contentHTML - {String}
+     * anchor - {Object} Object to which we'll anchor the popup. Must expose 
+     *     a 'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>) 
+     *     (Note that this is generally an <OpenLayers.Icon>).
+     * closeBox - {Boolean}
+     * closeBoxCallback - {Function} Function to be called on closeBox click.
+     */
+    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 
+                        closeBoxCallback) {
+
+        this.imageSrc = OpenLayers.Util.getImageLocation('cloud-popup-relative.png');
+        OpenLayers.Popup.Framed.prototype.initialize.apply(this, arguments);
+        this.contentDiv.className = this.contentDisplayClass;
+    },
+
+    CLASS_NAME: "OpenLayers.Popup.FramedCloud"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Control/DragPan.js
+    OpenLayers/Renderer/Canvas.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Control.js
- * @requires OpenLayers/Handler/Drag.js
+ * @requires OpenLayers/Renderer.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Control.DragPan
- * The DragPan control pans the map with a drag of the mouse.
- *
- * Inherits from:
- *  - <OpenLayers.Control>
+ * Class: OpenLayers.Renderer.Canvas 
+ * A renderer based on the 2D 'canvas' drawing element.
+ * 
+ * Inherits:
+ *  - <OpenLayers.Renderer>
  */
  */
-OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
+OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
+    
+    /**
+     * APIProperty: hitDetection
+     * {Boolean} Allow for hit detection of features.  Default is true.
+     */
+    hitDetection: true,
+    
+    /**
+     * Property: hitOverflow
+     * {Number} The method for converting feature identifiers to color values
+     *     supports 16777215 sequential values.  Two features cannot be 
+     *     predictably detected if their identifiers differ by more than this
+     *     value.  The hitOverflow allows for bigger numbers (but the 
+     *     difference in values is still limited).
+     */
+    hitOverflow: 0,
 
 
-    /** 
-     * Property: type
-     * {OpenLayers.Control.TYPES}
+    /**
+     * Property: canvas
+     * {Canvas} The canvas context object.
      */
      */
-    type: OpenLayers.Control.TYPE_TOOL,
+    canvas: null, 
     
     /**
     
     /**
-     * Property: panned
-     * {Boolean} The map moved.
+     * Property: features
+     * {Object} Internal object of feature/style pairs for use in redrawing the layer.
      */
      */
-    panned: false,
+    features: null,
     
     /**
     
     /**
-     * Property: interval
-     * {Integer} The number of milliseconds that should ellapse before
-     *     panning the map again. Defaults to 0 milliseconds, which means that
-     *     no separate cycle is used for panning. In most cases you won't want
-     *     to change this value. For slow machines/devices larger values can be
-     *     tried out.
+     * Property: pendingRedraw
+     * {Boolean} The renderer needs a redraw call to render features added while
+     *     the renderer was locked.
      */
      */
-    interval: 0,
+    pendingRedraw: false,
     
     /**
     
     /**
-     * APIProperty: documentDrag
-     * {Boolean} If set to true, mouse dragging will continue even if the
-     *     mouse cursor leaves the map viewport. Default is false.
+     * Property: cachedSymbolBounds
+     * {Object} Internal cache of calculated symbol extents.
      */
      */
-    documentDrag: false,
-
+    cachedSymbolBounds: {},
+    
     /**
     /**
-     * Property: kinetic
-     * {<OpenLayers.Kinetic>} The OpenLayers.Kinetic object.
+     * Constructor: OpenLayers.Renderer.Canvas
+     *
+     * Parameters:
+     * containerID - {<String>}
+     * options - {Object} Optional properties to be set on the renderer.
      */
      */
-    kinetic: null,
-
+    initialize: function(containerID, options) {
+        OpenLayers.Renderer.prototype.initialize.apply(this, arguments);
+        this.root = document.createElement("canvas");
+        this.container.appendChild(this.root);
+        this.canvas = this.root.getContext("2d");
+        this._clearRectId = OpenLayers.Util.createUniqueID();
+        this.features = {};
+        if (this.hitDetection) {
+            this.hitCanvas = document.createElement("canvas");
+            this.hitContext = this.hitCanvas.getContext("2d");
+        }
+    },
+    
     /**
     /**
-     * APIProperty: enableKinetic
-     * {Boolean} Set this option to enable "kinetic dragging". Can be
-     *     set to true or to an object. If set to an object this
-     *     object will be passed to the {<OpenLayers.Kinetic>}
-     *     constructor. Defaults to true.
-     *     To get kinetic dragging, ensure that OpenLayers/Kinetic.js is
-     *     included in your build config.
+     * Method: setExtent
+     * Set the visible part of the layer.
+     *
+     * Parameters:
+     * extent - {<OpenLayers.Bounds>}
+     * resolutionChanged - {Boolean}
+     *
+     * Returns:
+     * {Boolean} true to notify the layer that the new extent does not exceed
+     *     the coordinate range, and the features will not need to be redrawn.
+     *     False otherwise.
      */
      */
-    enableKinetic: true,
+    setExtent: function() {
+        OpenLayers.Renderer.prototype.setExtent.apply(this, arguments);
+        // always redraw features
+        return false;
+    },
+    
+    /** 
+     * Method: eraseGeometry
+     * Erase a geometry from the renderer. Because the Canvas renderer has
+     *     'memory' of the features that it has drawn, we have to remove the
+     *     feature so it doesn't redraw.   
+     * 
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>}
+     * featureId - {String}
+     */
+    eraseGeometry: function(geometry, featureId) {
+        this.eraseFeatures(this.features[featureId][0]);
+    },
 
     /**
 
     /**
-     * APIProperty: kineticInterval
-     * {Integer} Interval in milliseconds between 2 steps in the "kinetic
-     *     scrolling". Applies only if enableKinetic is set. Defaults
-     *     to 10 milliseconds.
+     * APIMethod: supported
+     * 
+     * Returns:
+     * {Boolean} Whether or not the browser supports the renderer class
      */
      */
-    kineticInterval: 10,
+    supported: function() {
+        return OpenLayers.CANVAS_SUPPORTED;
+    },    
+    
+    /**
+     * Method: setSize
+     * Sets the size of the drawing surface.
+     *
+     * Once the size is updated, redraw the canvas.
+     *
+     * Parameters:
+     * size - {<OpenLayers.Size>} 
+     */
+    setSize: function(size) {
+        this.size = size.clone();
+        var root = this.root;
+        root.style.width = size.w + "px";
+        root.style.height = size.h + "px";
+        root.width = size.w;
+        root.height = size.h;
+        this.resolution = null;
+        if (this.hitDetection) {
+            var hitCanvas = this.hitCanvas;
+            hitCanvas.style.width = size.w + "px";
+            hitCanvas.style.height = size.h + "px";
+            hitCanvas.width = size.w;
+            hitCanvas.height = size.h;
+        }
+    },
+    
+    /**
+     * Method: drawFeature
+     * Draw the feature. Stores the feature in the features list,
+     * then redraws the layer. 
+     *
+     * Parameters:
+     * feature - {<OpenLayers.Feature.Vector>} 
+     * style - {<Object>} 
+     *
+     * Returns:
+     * {Boolean} The feature has been drawn completely.  If the feature has no
+     *     geometry, undefined will be returned.  If the feature is not rendered
+     *     for other reasons, false will be returned.
+     */
+    drawFeature: function(feature, style) {
+        var rendered;
+        if (feature.geometry) {
+            style = this.applyDefaultSymbolizer(style || feature.style);
+            // don't render if display none or feature outside extent
+            var bounds = feature.geometry.getBounds();
 
 
+            var worldBounds;
+            if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
+                worldBounds = this.map.getMaxExtent();
+            }
 
 
-    /**
-     * Method: draw
-     * Creates a Drag handler, using <panMap> and
-     * <panMapDone> as callbacks.
-     */    
-    draw: function() {
-        if (this.enableKinetic && OpenLayers.Kinetic) {
-            var config = {interval: this.kineticInterval};
-            if(typeof this.enableKinetic === "object") {
-                config = OpenLayers.Util.extend(config, this.enableKinetic);
+            var intersects = bounds && bounds.intersectsBounds(this.extent, {worldBounds: worldBounds});
+
+            rendered = (style.display !== "none") && !!bounds && intersects;
+            if (rendered) {
+                // keep track of what we have rendered for redraw
+                this.features[feature.id] = [feature, style];
             }
             }
-            this.kinetic = new OpenLayers.Kinetic(config);
+            else {
+                // remove from features tracked for redraw
+                delete(this.features[feature.id]);
+            }
+            this.pendingRedraw = true;
         }
         }
-        this.handler = new OpenLayers.Handler.Drag(this, {
-                "move": this.panMap,
-                "done": this.panMapDone,
-                "down": this.panMapStart
-            }, {
-                interval: this.interval,
-                documentDrag: this.documentDrag
+        if (this.pendingRedraw && !this.locked) {
+            this.redraw();
+            this.pendingRedraw = false;
+        }
+        return rendered;
+    },
+
+    /** 
+     * Method: drawGeometry
+     * Used when looping (in redraw) over the features; draws
+     * the canvas. 
+     *
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>} 
+     * style - {Object} 
+     */
+    drawGeometry: function(geometry, style, featureId) {
+        var className = geometry.CLASS_NAME;
+        if ((className == "OpenLayers.Geometry.Collection") ||
+            (className == "OpenLayers.Geometry.MultiPoint") ||
+            (className == "OpenLayers.Geometry.MultiLineString") ||
+            (className == "OpenLayers.Geometry.MultiPolygon")) {
+            var worldBounds = (this.map.baseLayer && this.map.baseLayer.wrapDateLine) && this.map.getMaxExtent();
+            for (var i = 0; i < geometry.components.length; i++) {
+                this.calculateFeatureDx(geometry.components[i].getBounds(), worldBounds);
+                this.drawGeometry(geometry.components[i], style, featureId);
             }
             }
-        );
+            return;
+        }
+        switch (geometry.CLASS_NAME) {
+            case "OpenLayers.Geometry.Point":
+                this.drawPoint(geometry, style, featureId);
+                break;
+            case "OpenLayers.Geometry.LineString":
+                this.drawLineString(geometry, style, featureId);
+                break;
+            case "OpenLayers.Geometry.LinearRing":
+                this.drawLinearRing(geometry, style, featureId);
+                break;
+            case "OpenLayers.Geometry.Polygon":
+                this.drawPolygon(geometry, style, featureId);
+                break;
+            default:
+                break;
+        }
     },
 
     /**
     },
 
     /**
-     * Method: panMapStart
-     */
-    panMapStart: function() {
-        if(this.kinetic) {
-            this.kinetic.begin();
+     * Method: drawExternalGraphic
+     * Called to draw External graphics. 
+     * 
+     * Parameters: 
+     * geometry - {<OpenLayers.Geometry>}
+     * style    - {Object}
+     * featureId - {String}
+     */ 
+    drawExternalGraphic: function(geometry, style, featureId) {
+        var img = new Image();
+
+        var title = style.title || style.graphicTitle;        
+        if (title) {
+            img.title = title;           
+        }
+
+        var width = style.graphicWidth || style.graphicHeight;
+        var height = style.graphicHeight || style.graphicWidth;
+        width = width ? width : style.pointRadius * 2;
+        height = height ? height : style.pointRadius * 2;
+        var xOffset = (style.graphicXOffset != undefined) ?
+           style.graphicXOffset : -(0.5 * width);
+        var yOffset = (style.graphicYOffset != undefined) ?
+           style.graphicYOffset : -(0.5 * height);
+        var _clearRectId = this._clearRectId;
+
+        var opacity = style.graphicOpacity || style.fillOpacity;
+        
+        var onLoad = function() {
+            if(!this.features[featureId] ||
+                                     _clearRectId !== this._clearRectId) {
+                return;
+            }
+            var pt = this.getLocalXY(geometry);
+            var p0 = pt[0];
+            var p1 = pt[1];
+            if(!isNaN(p0) && !isNaN(p1)) {
+                var x = (p0 + xOffset) | 0;
+                var y = (p1 + yOffset) | 0;
+                var canvas = this.canvas;
+                canvas.globalAlpha = opacity;
+                var factor = OpenLayers.Renderer.Canvas.drawImageScaleFactor ||
+                    (OpenLayers.Renderer.Canvas.drawImageScaleFactor =
+                        /android 2.1/.test(navigator.userAgent.toLowerCase()) ?
+                            // 320 is the screen width of the G1 phone, for
+                            // which drawImage works out of the box.
+                            320 / window.screen.width : 1
+                    );
+                canvas.drawImage(
+                    img, x*factor, y*factor, width*factor, height*factor
+                );
+                if (this.hitDetection) {
+                    this.setHitContextStyle("fill", featureId);
+                    this.hitContext.fillRect(x, y, width, height);
+                }
+            }
+        };
+        img.onload = OpenLayers.Function.bind(onLoad, this);
+        img.src = style.externalGraphic;
+        if (img.complete) {
+            img.onload();
+            img.onload = null;
+        }
+    },
+
+    /**
+     * Method: drawNamedSymbol
+     * Called to draw Well Known Graphic Symbol Name. 
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * geometry - {<OpenLayers.Geometry>}
+     * style    - {Object}
+     * featureId - {String}
+     */ 
+    drawNamedSymbol: function(geometry, style, featureId) {
+        var x, y, cx, cy, i, symbolBounds, scaling, angle;
+        var unscaledStrokeWidth;
+        var deg2rad = Math.PI / 180.0;
+        
+        var symbol = OpenLayers.Renderer.symbol[style.graphicName];
+         
+        if (!symbol) {
+            throw new Error(style.graphicName + ' is not a valid symbol name');
+        }
+        
+        if (!symbol.length || symbol.length < 2) return;
+        
+        var pt = this.getLocalXY(geometry);
+        var p0 = pt[0];
+        var p1 = pt[1];
+       
+        if (isNaN(p0) || isNaN(p1)) return;
+        
+        // Use rounded line caps
+        this.canvas.lineCap = "round";
+        this.canvas.lineJoin = "round";
+        
+        if (this.hitDetection) {
+            this.hitContext.lineCap = "round";
+            this.hitContext.lineJoin = "round";
+        }
+        
+        // Scale and rotate symbols, using precalculated bounds whenever possible.
+        if (style.graphicName in this.cachedSymbolBounds) {
+            symbolBounds = this.cachedSymbolBounds[style.graphicName];
+        } else {
+            symbolBounds = new OpenLayers.Bounds();
+            for(i = 0; i < symbol.length; i+=2) {
+                symbolBounds.extend(new OpenLayers.LonLat(symbol[i], symbol[i+1]));
+            }
+            this.cachedSymbolBounds[style.graphicName] = symbolBounds;
+        }
+        
+        // Push symbol scaling, translation and rotation onto the transformation stack in reverse order.
+        // Don't forget to apply all canvas transformations to the hitContext canvas as well(!)
+        this.canvas.save();
+        if (this.hitDetection) { this.hitContext.save(); }
+        
+        // Step 3: place symbol at the desired location
+        this.canvas.translate(p0,p1);
+        if (this.hitDetection) { this.hitContext.translate(p0,p1); }
+        
+        // Step 2a. rotate the symbol if necessary
+        angle = deg2rad * style.rotation; // will be NaN when style.rotation is undefined.
+        if (!isNaN(angle)) {
+            this.canvas.rotate(angle);
+            if (this.hitDetection) { this.hitContext.rotate(angle); }
+        }
+                
+        // // Step 2: scale symbol such that pointRadius equals half the maximum symbol dimension.
+        scaling = 2.0 * style.pointRadius / Math.max(symbolBounds.getWidth(), symbolBounds.getHeight());
+        this.canvas.scale(scaling,scaling);
+        if (this.hitDetection) { this.hitContext.scale(scaling,scaling); }
+        
+        // Step 1: center the symbol at the origin        
+        cx = symbolBounds.getCenterLonLat().lon;
+        cy = symbolBounds.getCenterLonLat().lat;
+        this.canvas.translate(-cx,-cy);
+        if (this.hitDetection) { this.hitContext.translate(-cx,-cy); }        
+
+        // Don't forget to scale stroke widths, because they are affected by canvas scale transformations as well(!)
+        // Alternative: scale symbol coordinates manually, so stroke width scaling is not needed anymore.
+        unscaledStrokeWidth = style.strokeWidth;
+        style.strokeWidth = unscaledStrokeWidth / scaling;
+            
+        if (style.fill !== false) {
+            this.setCanvasStyle("fill", style);
+            this.canvas.beginPath();
+            for (i=0; i<symbol.length; i=i+2) {
+                x = symbol[i];
+                y = symbol[i+1];
+                if (i == 0) this.canvas.moveTo(x,y);
+                this.canvas.lineTo(x,y);
+            }
+            this.canvas.closePath();
+            this.canvas.fill();
+
+            if (this.hitDetection) {
+                this.setHitContextStyle("fill", featureId, style);
+                this.hitContext.beginPath();
+                for (i=0; i<symbol.length; i=i+2) {
+                    x = symbol[i];
+                    y = symbol[i+1];
+                    if (i == 0) this.canvas.moveTo(x,y);
+                    this.hitContext.lineTo(x,y);
+                }
+                this.hitContext.closePath();
+                this.hitContext.fill();
+            }
+        }  
+        
+        if (style.stroke !== false) {
+            this.setCanvasStyle("stroke", style);
+            this.canvas.beginPath();
+            for (i=0; i<symbol.length; i=i+2) {
+                x = symbol[i];
+                y = symbol[i+1];
+                if (i == 0) this.canvas.moveTo(x,y);
+                this.canvas.lineTo(x,y);
+            }
+            this.canvas.closePath();
+            this.canvas.stroke();
+            
+            
+            if (this.hitDetection) {
+                this.setHitContextStyle("stroke", featureId, style, scaling);
+                this.hitContext.beginPath();
+                for (i=0; i<symbol.length; i=i+2) {
+                    x = symbol[i];
+                    y = symbol[i+1];
+                    if (i == 0) this.hitContext.moveTo(x,y);
+                    this.hitContext.lineTo(x,y);
+                }
+                this.hitContext.closePath();
+                this.hitContext.stroke();
+            }
+            
         }
         }
+        
+        style.strokeWidth = unscaledStrokeWidth;
+        this.canvas.restore();
+        if (this.hitDetection) { this.hitContext.restore(); }
+        this.setCanvasStyle("reset");  
     },
 
     /**
     },
 
     /**
-    * Method: panMap
-    *
-    * Parameters:
-    * xy - {<OpenLayers.Pixel>} Pixel of the mouse position
-    */
-    panMap: function(xy) {
-        if(this.kinetic) {
-            this.kinetic.update(xy);
-        }
-        this.panned = true;
-        this.map.pan(
-            this.handler.last.x - xy.x,
-            this.handler.last.y - xy.y,
-            {dragging: true, animate: false}
-        );
-    },
-    
-    /**
-     * Method: panMapDone
-     * Finish the panning operation.  Only call setCenter (through <panMap>)
-     *     if the map has actually been moved.
+     * Method: setCanvasStyle
+     * Prepare the canvas for drawing by setting various global settings.
      *
      * Parameters:
      *
      * Parameters:
-     * xy - {<OpenLayers.Pixel>} Pixel of the mouse position
+     * type - {String} one of 'stroke', 'fill', or 'reset'
+     * style - {Object} Symbolizer hash
      */
      */
-    panMapDone: function(xy) {
-        if(this.panned) {
-            var res = null;
-            if (this.kinetic) {
-                res = this.kinetic.end(xy);
-            }
-            this.map.pan(
-                this.handler.last.x - xy.x,
-                this.handler.last.y - xy.y,
-                {dragging: !!res, animate: false}
-            );
-            if (res) {
-                var self = this;
-                this.kinetic.move(res, function(x, y, end) {
-                    self.map.pan(x, y, {dragging: !end, animate: false});
-                });
-            }
-            this.panned = false;
+    setCanvasStyle: function(type, style) {
+        if (type === "fill") {     
+            this.canvas.globalAlpha = style['fillOpacity'];
+            this.canvas.fillStyle = style['fillColor'];
+        } else if (type === "stroke") {  
+            this.canvas.globalAlpha = style['strokeOpacity'];
+            this.canvas.strokeStyle = style['strokeColor'];
+            this.canvas.lineWidth = style['strokeWidth'];
+        } else {
+            this.canvas.globalAlpha = 0;
+            this.canvas.lineWidth = 1;
         }
     },
         }
     },
-
-    CLASS_NAME: "OpenLayers.Control.DragPan"
-});
-/* ======================================================================
-    OpenLayers/Handler/Click.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Handler.js
- */
-
-/**
- * Class: OpenLayers.Handler.Click
- * A handler for mouse clicks.  The intention of this handler is to give
- *     controls more flexibility with handling clicks.  Browsers trigger
- *     click events twice for a double-click.  In addition, the mousedown,
- *     mousemove, mouseup sequence fires a click event.  With this handler,
- *     controls can decide whether to ignore clicks associated with a double
- *     click.  By setting a <pixelTolerance>, controls can also ignore clicks
- *     that include a drag.  Create a new instance with the
- *     <OpenLayers.Handler.Click> constructor.
- * 
- * Inherits from:
- *  - <OpenLayers.Handler> 
- */
-OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
-    /**
-     * APIProperty: delay
-     * {Number} Number of milliseconds between clicks before the event is
-     *     considered a double-click.
-     */
-    delay: 300,
-    
-    /**
-     * APIProperty: single
-     * {Boolean} Handle single clicks.  Default is true.  If false, clicks
-     * will not be reported.  If true, single-clicks will be reported.
-     */
-    single: true,
-    
-    /**
-     * APIProperty: double
-     * {Boolean} Handle double-clicks.  Default is false.
-     */
-    'double': false,
-    
-    /**
-     * APIProperty: pixelTolerance
-     * {Number} Maximum number of pixels between mouseup and mousedown for an
-     *     event to be considered a click.  Default is 0.  If set to an
-     *     integer value, clicks with a drag greater than the value will be
-     *     ignored.  This property can only be set when the handler is
-     *     constructed.
-     */
-    pixelTolerance: 0,
-        
-    /**
-     * APIProperty: dblclickTolerance
-     * {Number} Maximum distance in pixels between clicks for a sequence of 
-     *     events to be considered a double click.  Default is 13.  If the
-     *     distance between two clicks is greater than this value, a double-
-     *     click will not be fired.
-     */
-    dblclickTolerance: 13,
-        
-    /**
-     * APIProperty: stopSingle
-     * {Boolean} Stop other listeners from being notified of clicks.  Default
-     *     is false.  If true, any listeners registered before this one for 
-     *     click or rightclick events will not be notified.
-     */
-    stopSingle: false,
-    
-    /**
-     * APIProperty: stopDouble
-     * {Boolean} Stop other listeners from being notified of double-clicks.
-     *     Default is false.  If true, any click listeners registered before
-     *     this one will not be notified of *any* double-click events.
-     * 
-     * The one caveat with stopDouble is that given a map with two click
-     *     handlers, one with stopDouble true and the other with stopSingle
-     *     true, the stopSingle handler should be activated last to get
-     *     uniform cross-browser performance.  Since IE triggers one click
-     *     with a dblclick and FF triggers two, if a stopSingle handler is
-     *     activated first, all it gets in IE is a single click when the
-     *     second handler stops propagation on the dblclick.
-     */
-    stopDouble: false,
-
-    /**
-     * Property: timerId
-     * {Number} The id of the timeout waiting to clear the <delayedCall>.
-     */
-    timerId: null,
-    
-    /**
-     * Property: down
-     * {Object} Object that store relevant information about the last
-     *     mousedown or touchstart. Its 'xy' OpenLayers.Pixel property gives
-     *     the average location of the mouse/touch event. Its 'touches'
-     *     property records clientX/clientY of each touches.
-     */
-    down: null,
-
-    /**
-     * Property: last
-     * {Object} Object that store relevant information about the last
-     *     mousemove or touchmove. Its 'xy' OpenLayers.Pixel property gives
-     *     the average location of the mouse/touch event. Its 'touches'
-     *     property records clientX/clientY of each touches.
-     */
-    last: null,
-
-    /** 
-     * Property: first
-     * {Object} When waiting for double clicks, this object will store 
-     *     information about the first click in a two click sequence.
-     */
-    first: null,
-
-    /**
-     * Property: rightclickTimerId
-     * {Number} The id of the right mouse timeout waiting to clear the 
-     *     <delayedEvent>.
-     */
-    rightclickTimerId: null,
     
     /**
     
     /**
-     * Constructor: OpenLayers.Handler.Click
-     * Create a new click handler.
-     * 
+     * Method: featureIdToHex
+     * Convert a feature ID string into an RGB hex string.
+     *
      * Parameters:
      * Parameters:
-     * control - {<OpenLayers.Control>} The control that is making use of
-     *     this handler.  If a handler is being used without a control, the
-     *     handler's setMap method must be overridden to deal properly with
-     *     the map.
-     * callbacks - {Object} An object with keys corresponding to callbacks
-     *     that will be called by the handler. The callbacks should
-     *     expect to recieve a single argument, the click event.
-     *     Callbacks for 'click' and 'dblclick' are supported.
-     * options - {Object} Optional object whose properties will be set on the
-     *     handler.
-     */
-    
-    /**
-     * Method: touchstart
-     * Handle touchstart.
+     * featureId - {String} Feature id
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} Continue propagating this event.
+     * {String} RGB hex string.
      */
      */
-    touchstart: function(evt) {
-        this.startTouch();
-        this.down = this.getEventInfo(evt);
-        this.last = this.getEventInfo(evt);
-        return true;
+    featureIdToHex: function(featureId) {
+        var id = Number(featureId.split("_").pop()) + 1; // zero for no feature
+        if (id >= 16777216) {
+            this.hitOverflow = id - 16777215;
+            id = id % 16777216 + 1;
+        }
+        var hex = "000000" + id.toString(16);
+        var len = hex.length;
+        hex = "#" + hex.substring(len-6, len);
+        return hex;
     },
     
     /**
     },
     
     /**
-     * Method: touchmove
-     *    Store position of last move, because touchend event can have
-     *    an empty "touches" property.
-     *
-     * Returns:
-     * {Boolean} Continue propagating this event.
-     */
-    touchmove: function(evt) {
-        this.last = this.getEventInfo(evt);
-        return true;
-    },
-
-    /**
-     * Method: touchend
-     *   Correctly set event xy property, and add lastTouches to have
-     *   touches property from last touchstart or touchmove
+     * Method: setHitContextStyle
+     * Prepare the hit canvas for drawing by setting various global settings.
      *
      *
-     * Returns:
-     * {Boolean} Continue propagating this event.
+     * Parameters:
+     * type - {String} one of 'stroke', 'fill', or 'reset'
+     * featureId - {String} The feature id.
+     * symbolizer - {<OpenLayers.Symbolizer>} The symbolizer.
      */
      */
-    touchend: function(evt) {
-        // touchstart may not have been allowed to propagate
-        if (this.down) {
-            evt.xy = this.last.xy;
-            evt.lastTouches = this.last.touches;
-            this.handleSingle(evt);
-            this.down = null;
+    setHitContextStyle: function(type, featureId, symbolizer, strokeScaling) {
+        var hex = this.featureIdToHex(featureId);
+        if (type == "fill") {
+            this.hitContext.globalAlpha = 1.0;
+            this.hitContext.fillStyle = hex;
+        } else if (type == "stroke") {  
+            this.hitContext.globalAlpha = 1.0;
+            this.hitContext.strokeStyle = hex;
+            // bump up stroke width to deal with antialiasing. If strokeScaling is defined, we're rendering a symbol 
+            // on a transformed canvas, so the antialias width bump has to scale as well.
+            if (typeof strokeScaling === "undefined") {
+                this.hitContext.lineWidth = symbolizer.strokeWidth + 2;
+            } else {
+                if (!isNaN(strokeScaling)) { this.hitContext.lineWidth = symbolizer.strokeWidth + 2.0 / strokeScaling; }
+            }
+        } else {
+            this.hitContext.globalAlpha = 0;
+            this.hitContext.lineWidth = 1;
         }
         }
-        return true;
-    },
-
-    /**
-     * Method: mousedown
-     * Handle mousedown.
-     *
-     * Returns:
-     * {Boolean} Continue propagating this event.
-     */
-    mousedown: function(evt) {
-        this.down = this.getEventInfo(evt);
-        this.last = this.getEventInfo(evt);
-        return true;
     },
 
     /**
     },
 
     /**
-     * Method: mouseup
-     * Handle mouseup.  Installed to support collection of right mouse events.
+     * Method: drawPoint
+     * This method is only called by the renderer itself.
      * 
      * 
-     * Returns:
-     * {Boolean} Continue propagating this event.
-     */
-    mouseup: function (evt) {
-        var propagate = true;
-
-        // Collect right mouse clicks from the mouseup
-        //  IE - ignores the second right click in mousedown so using
-        //  mouseup instead
-        if (this.checkModifiers(evt) && this.control.handleRightClicks &&
-           OpenLayers.Event.isRightClick(evt)) {
-            propagate = this.rightclick(evt);
-        }
-
-        return propagate;
-    },
-    
-    /**
-     * Method: rightclick
-     * Handle rightclick.  For a dblrightclick, we get two clicks so we need 
-     *     to always register for dblrightclick to properly handle single 
-     *     clicks.
-     *     
-     * Returns:
-     * {Boolean} Continue propagating this event.
-     */
-    rightclick: function(evt) {
-        if(this.passesTolerance(evt)) {
-           if(this.rightclickTimerId != null) {
-                //Second click received before timeout this must be 
-                // a double click
-                this.clearTimer();
-                this.callback('dblrightclick', [evt]);
-                return !this.stopDouble;
-            } else { 
-                //Set the rightclickTimerId, send evt only if double is 
-                // true else trigger single
-                var clickEvent = this['double'] ?
-                    OpenLayers.Util.extend({}, evt) : 
-                    this.callback('rightclick', [evt]);
+     * Parameters: 
+     * geometry - {<OpenLayers.Geometry>}
+     * style    - {Object}
+     * featureId - {String}
+     */ 
+    drawPoint: function(geometry, style, featureId) {
+        if(style.graphic !== false) {
+            if(style.externalGraphic) {
+                this.drawExternalGraphic(geometry, style, featureId);
+            } else if (style.graphicName && (style.graphicName != "circle")) {
+                this.drawNamedSymbol(geometry, style, featureId);
+            } else {
+                var pt = this.getLocalXY(geometry);
+                var p0 = pt[0];
+                var p1 = pt[1];
+                if(!isNaN(p0) && !isNaN(p1)) {
+                    var twoPi = Math.PI*2;
+                    var radius = style.pointRadius;
+                    if(style.fill !== false) {
+                        this.setCanvasStyle("fill", style);
+                        this.canvas.beginPath();
+                        this.canvas.arc(p0, p1, radius, 0, twoPi, true);
+                        this.canvas.fill();
+                        if (this.hitDetection) {
+                            this.setHitContextStyle("fill", featureId, style);
+                            this.hitContext.beginPath();
+                            this.hitContext.arc(p0, p1, radius, 0, twoPi, true);
+                            this.hitContext.fill();
+                        }
+                    }
 
 
-                var delayedRightCall = OpenLayers.Function.bind(
-                    this.delayedRightCall, 
-                    this, 
-                    clickEvent
-                );
-                this.rightclickTimerId = window.setTimeout(
-                    delayedRightCall, this.delay
-                );
-            } 
+                    if(style.stroke !== false) {
+                        this.setCanvasStyle("stroke", style);
+                        this.canvas.beginPath();
+                        this.canvas.arc(p0, p1, radius, 0, twoPi, true);
+                        this.canvas.stroke();
+                        if (this.hitDetection) {
+                            this.setHitContextStyle("stroke", featureId, style);
+                            this.hitContext.beginPath();
+                            this.hitContext.arc(p0, p1, radius, 0, twoPi, true);
+                            this.hitContext.stroke();
+                        }
+                        this.setCanvasStyle("reset");
+                    }
+                }
+            }
         }
         }
-        return !this.stopSingle;
     },
     
     /**
     },
     
     /**
-     * Method: delayedRightCall
-     * Sets <rightclickTimerId> to null.  And optionally triggers the 
-     *     rightclick callback if evt is set.
-     */
-    delayedRightCall: function(evt) {
-        this.rightclickTimerId = null;
-        if (evt) {
-           this.callback('rightclick', [evt]);
-        }
-    },
+     * Method: drawLineString
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * geometry - {<OpenLayers.Geometry>}
+     * style    - {Object}
+     * featureId - {String}
+     */ 
+    drawLineString: function(geometry, style, featureId) {
+        style = OpenLayers.Util.applyDefaults({fill: false}, style);
+        this.drawLinearRing(geometry, style, featureId);
+    },    
     
     /**
     
     /**
-     * Method: click
-     * Handle click events from the browser.  This is registered as a listener
-     *     for click events and should not be called from other events in this
-     *     handler.
-     *
-     * Returns:
-     * {Boolean} Continue propagating this event.
-     */
-    click: function(evt) {
-        if (!this.last) {
-            this.last = this.getEventInfo(evt);
+     * Method: drawLinearRing
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * geometry - {<OpenLayers.Geometry>}
+     * style    - {Object}
+     * featureId - {String}
+     */ 
+    drawLinearRing: function(geometry, style, featureId) {
+        if (style.fill !== false) {
+            this.setCanvasStyle("fill", style);
+            this.renderPath(this.canvas, geometry, style, featureId, "fill");
+            if (this.hitDetection) {
+                this.setHitContextStyle("fill", featureId, style);
+                this.renderPath(this.hitContext, geometry, style, featureId, "fill");
+            }
         }
         }
-        this.handleSingle(evt);
-        return !this.stopSingle;
-    },
-
-    /**
-     * Method: dblclick
-     * Handle dblclick.  For a dblclick, we get two clicks in some browsers
-     *     (FF) and one in others (IE).  So we need to always register for
-     *     dblclick to properly handle single clicks.  This method is registered
-     *     as a listener for the dblclick browser event.  It should *not* be
-     *     called by other methods in this handler.
-     *     
-     * Returns:
-     * {Boolean} Continue propagating this event.
-     */
-    dblclick: function(evt) {
-        this.handleDouble(evt);
-        return !this.stopDouble;
-    },
-    
-    /** 
-     * Method: handleDouble
-     * Handle double-click sequence.
-     */
-    handleDouble: function(evt) {
-        if (this.passesDblclickTolerance(evt)) {
-            if (this["double"]) {
-                this.callback("dblclick", [evt]);
+        if (style.stroke !== false) {
+            this.setCanvasStyle("stroke", style);
+            this.renderPath(this.canvas, geometry, style, featureId, "stroke");
+            if (this.hitDetection) {
+                this.setHitContextStyle("stroke", featureId, style);
+                this.renderPath(this.hitContext, geometry, style, featureId, "stroke");
             }
             }
-            // to prevent a dblclick from firing the click callback in IE
-            this.clearTimer();
         }
         }
+        this.setCanvasStyle("reset");
     },
     
     },
     
-    /** 
-     * Method: handleSingle
-     * Handle single click sequence.
+    /**
+     * Method: renderPath
+     * Render a path with stroke and optional fill.
      */
      */
-    handleSingle: function(evt) {
-        if (this.passesTolerance(evt)) {
-            if (this.timerId != null) {
-                // already received a click
-                if (this.last.touches && this.last.touches.length === 1) {
-                    // touch device, no dblclick event - this may be a double
-                    if (this["double"]) {
-                        // on Android don't let the browser zoom on the page
-                        OpenLayers.Event.preventDefault(evt);
-                    }
-                    this.handleDouble(evt);
-                }
-                // if we're not in a touch environment we clear the click timer
-                // if we've got a second touch, we'll get two touchend events
-                if (!this.last.touches || this.last.touches.length !== 2) {
-                    this.clearTimer();
-                }
+    renderPath: function(context, geometry, style, featureId, type) {
+        var components = geometry.components;
+        var len = components.length;
+        context.beginPath();
+        var start = this.getLocalXY(components[0]);
+        var x = start[0];
+        var y = start[1];
+        if (!isNaN(x) && !isNaN(y)) {
+            context.moveTo(start[0], start[1]);
+            for (var i=1; i<len; ++i) {
+                var pt = this.getLocalXY(components[i]);
+                context.lineTo(pt[0], pt[1]);
+            }
+            if (type === "fill") {
+                context.fill();
             } else {
             } else {
-                // remember the first click info so we can compare to the second
-                this.first = this.getEventInfo(evt);
-                // set the timer, send evt only if single is true
-                //use a clone of the event object because it will no longer 
-                //be a valid event object in IE in the timer callback
-                var clickEvent = this.single ?
-                    OpenLayers.Util.extend({}, evt) : null;
-                this.queuePotentialClick(clickEvent);
+                context.stroke();
             }
         }
     },
     
             }
         }
     },
     
-    /** 
-     * Method: queuePotentialClick
-     * This method is separated out largely to make testing easier (so we
-     *     don't have to override window.setTimeout)
-     */
-    queuePotentialClick: function(evt) {
-        this.timerId = window.setTimeout(
-            OpenLayers.Function.bind(this.delayedCall, this, evt),
-            this.delay
-        );
-    },
-
     /**
     /**
-     * Method: passesTolerance
-     * Determine whether the event is within the optional pixel tolerance.  Note
-     *     that the pixel tolerance check only works if mousedown events get to
-     *     the listeners registered here.  If they are stopped by other elements,
-     *     the <pixelTolerance> will have no effect here (this method will always
-     *     return true).
-     *
-     * Returns:
-     * {Boolean} The click is within the pixel tolerance (if specified).
-     */
-    passesTolerance: function(evt) {
-        var passes = true;
-        if (this.pixelTolerance != null && this.down && this.down.xy) {
-            passes = this.pixelTolerance >= this.down.xy.distanceTo(evt.xy);
-            // for touch environments, we also enforce that all touches
-            // start and end within the given tolerance to be considered a click
-            if (passes && this.touch && 
-                this.down.touches.length === this.last.touches.length) {
-                // the touchend event doesn't come with touches, so we check
-                // down and last
-                for (var i=0, ii=this.down.touches.length; i<ii; ++i) {
-                    if (this.getTouchDistance(
-                            this.down.touches[i], 
-                            this.last.touches[i]
-                        ) > this.pixelTolerance) {
-                        passes = false;
-                        break;
-                    }
-                }
+     * Method: drawPolygon
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * geometry - {<OpenLayers.Geometry>}
+     * style    - {Object}
+     * featureId - {String}
+     */ 
+    drawPolygon: function(geometry, style, featureId) {
+        var components = geometry.components;
+        var len = components.length;
+        this.drawLinearRing(components[0], style, featureId);
+        // erase inner rings
+        for (var i=1; i<len; ++i) {
+            /** 
+             * Note that this is overly aggressive.  Here we punch holes through 
+             * all previously rendered features on the same canvas.  A better 
+             * solution for polygons with interior rings would be to draw the 
+             * polygon on a sketch canvas first.  We could erase all holes 
+             * there and then copy the drawing to the layer canvas. 
+             * TODO: http://trac.osgeo.org/openlayers/ticket/3130 
+             */
+            this.canvas.globalCompositeOperation = "destination-out";
+            if (this.hitDetection) {
+                this.hitContext.globalCompositeOperation = "destination-out";
+            }
+            this.drawLinearRing(
+                components[i], 
+                OpenLayers.Util.applyDefaults({stroke: false, fillOpacity: 1.0}, style),
+                featureId
+            );
+            this.canvas.globalCompositeOperation = "source-over";
+            if (this.hitDetection) {
+                this.hitContext.globalCompositeOperation = "source-over";
             }
             }
+            this.drawLinearRing(
+                components[i], 
+                OpenLayers.Util.applyDefaults({fill: false}, style),
+                featureId
+            );
         }
         }
-        return passes;
     },
     
     },
     
-    /** 
-     * Method: getTouchDistance
+    /**
+     * Method: drawText
+     * This method is only called by the renderer itself.
      *
      *
-     * Returns:
-     * {Boolean} The pixel displacement between two touches.
+     * Parameters:
+     * location - {<OpenLayers.Point>}
+     * style    - {Object}
      */
      */
-    getTouchDistance: function(from, to) {
-        return Math.sqrt(
-            Math.pow(from.clientX - to.clientX, 2) +
-            Math.pow(from.clientY - to.clientY, 2)
-        );
+    drawText: function(location, style) {
+        var pt = this.getLocalXY(location);
+
+        this.setCanvasStyle("reset");
+        this.canvas.fillStyle = style.fontColor;
+        this.canvas.globalAlpha = style.fontOpacity || 1.0;
+        var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
+                         "normal", // "font-variant" not supported
+                         style.fontWeight ? style.fontWeight : "normal",
+                         style.fontSize ? style.fontSize : "1em",
+                         style.fontFamily ? style.fontFamily : "sans-serif"].join(" ");
+        var labelRows = style.label.split('\n');
+        var numRows = labelRows.length;
+        if (this.canvas.fillText) {
+            // HTML5
+            this.canvas.font = fontStyle;
+            this.canvas.textAlign =
+                OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[0]] ||
+                "center";
+            this.canvas.textBaseline =
+                OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[1]] ||
+                "middle";
+            var vfactor =
+                OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[1]];
+            if (vfactor == null) {
+                vfactor = -.5;
+            }
+            var lineHeight =
+                this.canvas.measureText('Mg').height ||
+                this.canvas.measureText('xx').width;
+            pt[1] += lineHeight*vfactor*(numRows-1);
+            for (var i = 0; i < numRows; i++) {
+                if (style.labelOutlineWidth) {
+                    this.canvas.save();
+                    this.canvas.globalAlpha = style.labelOutlineOpacity || style.fontOpacity || 1.0;
+                    this.canvas.strokeStyle = style.labelOutlineColor;
+                    this.canvas.lineWidth = style.labelOutlineWidth;
+                    this.canvas.strokeText(labelRows[i], pt[0], pt[1] + (lineHeight*i) + 1);
+                    this.canvas.restore();
+                }
+                this.canvas.fillText(labelRows[i], pt[0], pt[1] + (lineHeight*i));
+            }
+        } else if (this.canvas.mozDrawText) {
+            // Mozilla pre-Gecko1.9.1 (<FF3.1)
+            this.canvas.mozTextStyle = fontStyle;
+            // No built-in text alignment, so we measure and adjust the position
+            var hfactor =
+                OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[0]];
+            if (hfactor == null) {
+                hfactor = -.5;
+            }
+            var vfactor =
+                OpenLayers.Renderer.Canvas.LABEL_FACTOR[style.labelAlign[1]];
+            if (vfactor == null) {
+                vfactor = -.5;
+            }
+            var lineHeight = this.canvas.mozMeasureText('xx');
+            pt[1] += lineHeight*(1 + (vfactor*numRows));
+            for (var i = 0; i < numRows; i++) {
+                var x = pt[0] + (hfactor*this.canvas.mozMeasureText(labelRows[i]));
+                var y = pt[1] + (i*lineHeight);
+                this.canvas.translate(x, y);
+                this.canvas.mozDrawText(labelRows[i]);
+                this.canvas.translate(-x, -y);
+            }
+        }
+        this.setCanvasStyle("reset");
     },
     
     /**
     },
     
     /**
-     * Method: passesDblclickTolerance
-     * Determine whether the event is within the optional double-cick pixel 
-     *     tolerance.
+     * Method: getLocalXY
+     * transform geographic xy into pixel xy
      *
      *
-     * Returns:
-     * {Boolean} The click is within the double-click pixel tolerance.
+     * Parameters: 
+     * point - {<OpenLayers.Geometry.Point>}
      */
      */
-    passesDblclickTolerance: function(evt) {
-        var passes = true;
-        if (this.down && this.first) {
-            passes = this.down.xy.distanceTo(this.first.xy) <= this.dblclickTolerance;
-        }
-        return passes;
+    getLocalXY: function(point) {
+        var resolution = this.getResolution();
+        var extent = this.extent;
+        var x = ((point.x - this.featureDx) / resolution + (-extent.left / resolution));
+        var y = ((extent.top / resolution) - point.y / resolution);
+        return [x, y];
     },
 
     /**
     },
 
     /**
-     * Method: clearTimer
-     * Clear the timer and set <timerId> to null.
-     */
-    clearTimer: function() {
-        if (this.timerId != null) {
-            window.clearTimeout(this.timerId);
-            this.timerId = null;
-        }
-        if (this.rightclickTimerId != null) {
-            window.clearTimeout(this.rightclickTimerId);
-            this.rightclickTimerId = null;
-        }
+     * Method: clear
+     * Clear all vectors from the renderer.
+     */    
+    clear: function() {
+        this.clearCanvas();
+        this.features = {};
     },
     },
-    
+
     /**
     /**
-     * Method: delayedCall
-     * Sets <timerId> to null.  And optionally triggers the click callback if
-     *     evt is set.
-     */
-    delayedCall: function(evt) {
-        this.timerId = null;
-        if (evt) {
-            this.callback("click", [evt]);
+     * Method: clearCanvas
+     * Clear the canvas element of the renderer.
+     */    
+    clearCanvas: function() {
+        var height = this.root.height;
+        var width = this.root.width;
+        this.canvas.clearRect(0, 0, width, height);
+        this._clearRectId = OpenLayers.Util.createUniqueID();
+        if (this.hitDetection) {
+            this.hitContext.clearRect(0, 0, width, height);
         }
     },
 
     /**
         }
     },
 
     /**
-     * Method: getEventInfo
-     * This method allows us to store event information without storing the
-     *     actual event.  In touch devices (at least), the same event is 
-     *     modified between touchstart, touchmove, and touchend.
+     * Method: getFeatureIdFromEvent
+     * Returns a feature id from an event on the renderer.  
+     * 
+     * Parameters:
+     * evt - {<OpenLayers.Event>} 
      *
      * Returns:
      *
      * Returns:
-     * {Object} An object with event related info.
+     * {<OpenLayers.Feature.Vector} A feature or undefined.  This method returns a 
+     *     feature instead of a feature id to avoid an unnecessary lookup on the
+     *     layer.
      */
      */
-    getEventInfo: function(evt) {
-        var touches;
-        if (evt.touches) {
-            var len = evt.touches.length;
-            touches = new Array(len);
-            var touch;
-            for (var i=0; i<len; i++) {
-                touch = evt.touches[i];
-                touches[i] = {
-                    clientX: touch.olClientX,
-                    clientY: touch.olClientY
-                };
+    getFeatureIdFromEvent: function(evt) {
+        var featureId, feature;
+        
+        if (this.hitDetection && this.root.style.display !== "none") {
+            // this dragging check should go in the feature handler
+            if (!this.map.dragging) {
+                var xy = evt.xy;
+                var x = xy.x | 0;
+                var y = xy.y | 0;
+                var data = this.hitContext.getImageData(x, y, 1, 1).data;
+                if (data[3] === 255) { // antialiased
+                    var id = data[2] + (256 * (data[1] + (256 * data[0])));
+                    if (id) {
+                        featureId = "OpenLayers_Feature_Vector_" + (id - 1 + this.hitOverflow);
+                        try {
+                            feature = this.features[featureId][0];
+                        } catch(err) {
+                            // Because of antialiasing on the canvas, when the hit location is at a point where the edge of
+                            // one symbol intersects the interior of another symbol, a wrong hit color (and therefore id) results.
+                            // todo: set Antialiasing = 'off' on the hitContext as soon as browsers allow it.
+                        }
+                    }
+                }
             }
         }
             }
         }
-        return {
-            xy: evt.xy,
-            touches: touches
-        };
+        return feature;
     },
     },
-
+    
     /**
     /**
-     * APIMethod: deactivate
-     * Deactivate the handler.
-     *
-     * Returns:
-     * {Boolean} The handler was successfully deactivated.
+     * Method: eraseFeatures 
+     * This is called by the layer to erase features; removes the feature from
+     *     the list, then redraws the layer.
+     * 
+     * Parameters:
+     * features - {Array(<OpenLayers.Feature.Vector>)} 
      */
      */
-    deactivate: function() {
-        var deactivated = false;
-        if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
-            this.clearTimer();
-            this.down = null;
-            this.first = null;
-            this.last = null;
-            deactivated = true;
+    eraseFeatures: function(features) {
+        if(!(OpenLayers.Util.isArray(features))) {
+            features = [features];
         }
         }
-        return deactivated;
+        for(var i=0; i<features.length; ++i) {
+            delete this.features[features[i].id];
+        }
+        this.redraw();
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Handler.Click"
+    /**
+     * Method: redraw
+     * The real 'meat' of the function: any time things have changed,
+     *     redraw() can be called to loop over all the data and (you guessed
+     *     it) redraw it.  Unlike Elements-based Renderers, we can't interact
+     *     with things once they're drawn, to remove them, for example, so
+     *     instead we have to just clear everything and draw from scratch.
+     */
+    redraw: function() {
+        if (!this.locked) {
+            this.clearCanvas();
+            var labelMap = [];
+            var feature, geometry, style;
+            var worldBounds = (this.map.baseLayer && this.map.baseLayer.wrapDateLine) && this.map.getMaxExtent();
+            for (var id in this.features) {
+                if (!this.features.hasOwnProperty(id)) { continue; }
+                feature = this.features[id][0];
+                geometry = feature.geometry;
+                this.calculateFeatureDx(geometry.getBounds(), worldBounds);
+                style = this.features[id][1];
+                this.drawGeometry(geometry, style, feature.id);
+                if(style.label) {
+                    labelMap.push([feature, style]);
+                }
+            }
+            var item;
+            for (var i=0, len=labelMap.length; i<len; ++i) {
+                item = labelMap[i];
+                this.drawText(item[0].geometry.getCentroid(), item[1]);
+            }
+        }    
+    },
+
+    CLASS_NAME: "OpenLayers.Renderer.Canvas"
 });
 });
+
+/**
+ * Constant: OpenLayers.Renderer.Canvas.LABEL_ALIGN
+ * {Object}
+ */
+OpenLayers.Renderer.Canvas.LABEL_ALIGN = {
+    "l": "left",
+    "r": "right",
+    "t": "top",
+    "b": "bottom"
+};
+
+/**
+ * Constant: OpenLayers.Renderer.Canvas.LABEL_FACTOR
+ * {Object}
+ */
+OpenLayers.Renderer.Canvas.LABEL_FACTOR = {
+    "l": 0,
+    "r": -1,
+    "t": 0,
+    "b": -1
+};
+
+/**
+ * Constant: OpenLayers.Renderer.Canvas.drawImageScaleFactor
+ * {Number} Scale factor to apply to the canvas drawImage arguments. This
+ *     is always 1 except for Android 2.1 devices, to work around
+ *     http://code.google.com/p/android/issues/detail?id=5141.
+ */
+OpenLayers.Renderer.Canvas.drawImageScaleFactor = null;
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Control/Navigation.js
+    OpenLayers/Renderer/Elements.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Control/ZoomBox.js
- * @requires OpenLayers/Control/DragPan.js
- * @requires OpenLayers/Handler/MouseWheel.js
- * @requires OpenLayers/Handler/Click.js
+ * @requires OpenLayers/Renderer.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Control.Navigation
- * The navigation control handles map browsing with mouse events (dragging,
- *     double-clicking, and scrolling the wheel).  Create a new navigation 
- *     control with the <OpenLayers.Control.Navigation> control.  
- * 
- *     Note that this control is added to the map by default (if no controls 
- *     array is sent in the options object to the <OpenLayers.Map> 
- *     constructor).
- * 
- * Inherits:
- *  - <OpenLayers.Control>
+ * Class: OpenLayers.ElementsIndexer
+ * This class takes care of figuring out which order elements should be
+ *     placed in the DOM based on given indexing methods. 
  */
  */
-OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
-
-    /** 
-     * Property: dragPan
-     * {<OpenLayers.Control.DragPan>} 
-     */
-    dragPan: null,
-
-    /**
-     * APIProperty: dragPanOptions
-     * {Object} Options passed to the DragPan control.
-     */
-    dragPanOptions: null,
-
-    /**
-     * Property: pinchZoom
-     * {<OpenLayers.Control.PinchZoom>}
-     */
-    pinchZoom: null,
-
-    /**
-     * APIProperty: pinchZoomOptions
-     * {Object} Options passed to the PinchZoom control.
-     */
-    pinchZoomOptions: null,
-
-    /**
-     * APIProperty: documentDrag
-     * {Boolean} Allow panning of the map by dragging outside map viewport.
-     *     Default is false.
-     */
-    documentDrag: false,
-
-    /** 
-     * Property: zoomBox
-     * {<OpenLayers.Control.ZoomBox>}
-     */
-    zoomBox: null,
-
-    /**
-     * APIProperty: zoomBoxEnabled
-     * {Boolean} Whether the user can draw a box to zoom
-     */
-    zoomBoxEnabled: true, 
-
+OpenLayers.ElementsIndexer = OpenLayers.Class({
+   
     /**
     /**
-     * APIProperty: zoomWheelEnabled
-     * {Boolean} Whether the mousewheel should zoom the map
+     * Property: maxZIndex
+     * {Integer} This is the largest-most z-index value for a node
+     *     contained within the indexer.
      */
      */
-    zoomWheelEnabled: true,
+    maxZIndex: null,
     
     /**
     
     /**
-     * Property: mouseWheelOptions
-     * {Object} Options passed to the MouseWheel control (only useful if
-     *     <zoomWheelEnabled> is set to true). Default is no options for maps
-     *     with fractionalZoom set to true, otherwise
-     *     {cumulative: false, interval: 50, maxDelta: 6} 
-     */
-    mouseWheelOptions: null,
-
-    /**
-     * APIProperty: handleRightClicks
-     * {Boolean} Whether or not to handle right clicks. Default is false.
+     * Property: order
+     * {Array<String>} This is an array of node id's stored in the
+     *     order that they should show up on screen. Id's higher up in the
+     *     array (higher array index) represent nodes with higher z-indeces.
      */
      */
-    handleRightClicks: false,
-
+    order: null, 
+    
     /**
     /**
-     * APIProperty: zoomBoxKeyMask
-     * {Integer} <OpenLayers.Handler> key code of the key, which has to be
-     *    pressed, while drawing the zoom box with the mouse on the screen. 
-     *    You should probably set handleRightClicks to true if you use this
-     *    with MOD_CTRL, to disable the context menu for machines which use
-     *    CTRL-Click as a right click.
-     * Default: <OpenLayers.Handler.MOD_SHIFT>
+     * Property: indices
+     * {Object} This is a hash that maps node ids to their z-index value
+     *     stored in the indexer. This is done to make finding a nodes z-index 
+     *     value O(1).
      */
      */
-    zoomBoxKeyMask: OpenLayers.Handler.MOD_SHIFT,
+    indices: null,
     
     /**
     
     /**
-     * APIProperty: autoActivate
-     * {Boolean} Activate the control when it is added to a map.  Default is
-     *     true.
+     * Property: compare
+     * {Function} This is the function used to determine placement of
+     *     of a new node within the indexer. If null, this defaults to to
+     *     the Z_ORDER_DRAWING_ORDER comparison method.
      */
      */
-    autoActivate: true,
-
+    compare: null,
+    
     /**
     /**
-     * Constructor: OpenLayers.Control.Navigation
-     * Create a new navigation control
+     * APIMethod: initialize
+     * Create a new indexer with 
      * 
      * Parameters:
      * 
      * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *                    the control
+     * yOrdering - {Boolean} Whether to use y-ordering.
      */
      */
-    initialize: function(options) {
-        this.handlers = {};
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
-    },
+    initialize: function(yOrdering) {
+
+        this.compare = yOrdering ? 
+            OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER :
+            OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;
 
 
+        this.clear();
+    },
+    
     /**
     /**
-     * Method: destroy
-     * The destroy method is used to perform any clean up before the control
-     * is dereferenced.  Typically this is where event listeners are removed
-     * to prevent memory leaks.
+     * APIMethod: insert
+     * Insert a new node into the indexer. In order to find the correct 
+     *     positioning for the node to be inserted, this method uses a binary 
+     *     search. This makes inserting O(log(n)). 
+     * 
+     * Parameters:
+     * newNode - {DOMElement} The new node to be inserted.
+     * 
+     * Returns
+     * {DOMElement} the node before which we should insert our newNode, or
+     *     null if newNode can just be appended.
      */
      */
-    destroy: function() {
-        this.deactivate();
-
-        if (this.dragPan) {
-            this.dragPan.destroy();
+    insert: function(newNode) {
+        // If the node is known to the indexer, remove it so we can
+        // recalculate where it should go.
+        if (this.exists(newNode)) {
+            this.remove(newNode);
         }
         }
-        this.dragPan = null;
+        
+        var nodeId = newNode.id;
+        
+        this.determineZIndex(newNode);       
 
 
-        if (this.zoomBox) {
-            this.zoomBox.destroy();
-        }
-        this.zoomBox = null;
+        var leftIndex = -1;
+        var rightIndex = this.order.length;
+        var middle;
 
 
-        if (this.pinchZoom) {
-            this.pinchZoom.destroy();
+        while (rightIndex - leftIndex > 1) {
+            middle = parseInt((leftIndex + rightIndex) / 2);
+            
+            var placement = this.compare(this, newNode,
+                OpenLayers.Util.getElement(this.order[middle]));
+            
+            if (placement > 0) {
+                leftIndex = middle;
+            } else {
+                rightIndex = middle;
+            } 
         }
         }
-        this.pinchZoom = null;
-
-        OpenLayers.Control.prototype.destroy.apply(this,arguments);
+        
+        this.order.splice(rightIndex, 0, nodeId);
+        this.indices[nodeId] = this.getZIndex(newNode);
+        
+        // If the new node should be before another in the index
+        // order, return the node before which we have to insert the new one;
+        // else, return null to indicate that the new node can be appended.
+        return this.getNextElement(rightIndex);
     },
     
     /**
     },
     
     /**
-     * Method: activate
+     * APIMethod: remove
+     * 
+     * Parameters:
+     * node - {DOMElement} The node to be removed.
      */
      */
-    activate: function() {
-        this.dragPan.activate();
-        if (this.zoomWheelEnabled) {
-            this.handlers.wheel.activate();
-        }    
-        this.handlers.click.activate();
-        if (this.zoomBoxEnabled) {
-            this.zoomBox.activate();
-        }
-        if (this.pinchZoom) {
-            this.pinchZoom.activate();
+    remove: function(node) {
+        var nodeId = node.id;
+        var arrayIndex = OpenLayers.Util.indexOf(this.order, nodeId);
+        if (arrayIndex >= 0) {
+            // Remove it from the order array, as well as deleting the node
+            // from the indeces hash.
+            this.order.splice(arrayIndex, 1);
+            delete this.indices[nodeId];
+            
+            // Reset the maxium z-index based on the last item in the 
+            // order array.
+            if (this.order.length > 0) {
+                var lastId = this.order[this.order.length - 1];
+                this.maxZIndex = this.indices[lastId];
+            } else {
+                this.maxZIndex = 0;
+            }
         }
         }
-        return OpenLayers.Control.prototype.activate.apply(this,arguments);
     },
     },
-
+    
     /**
     /**
-     * Method: deactivate
+     * APIMethod: clear
      */
      */
-    deactivate: function() {
-        if (this.pinchZoom) {
-            this.pinchZoom.deactivate();
-        }
-        this.zoomBox.deactivate();
-        this.dragPan.deactivate();
-        this.handlers.click.deactivate();
-        this.handlers.wheel.deactivate();
-        return OpenLayers.Control.prototype.deactivate.apply(this,arguments);
+    clear: function() {
+        this.order = [];
+        this.indices = {};
+        this.maxZIndex = 0;
     },
     
     /**
     },
     
     /**
-     * Method: draw
+     * APIMethod: exists
+     *
+     * Parameters:
+     * node - {DOMElement} The node to test for existence.
+     *
+     * Returns:
+     * {Boolean} Whether or not the node exists in the indexer?
      */
      */
-    draw: function() {
-        // disable right mouse context menu for support of right click events
-        if (this.handleRightClicks) {
-            this.map.viewPortDiv.oncontextmenu = OpenLayers.Function.False;
-        }
-
-        var clickCallbacks = { 
-            'click': this.defaultClick,
-            'dblclick': this.defaultDblClick, 
-            'dblrightclick': this.defaultDblRightClick 
-        };
-        var clickOptions = {
-            'double': true, 
-            'stopDouble': true
-        };
-        this.handlers.click = new OpenLayers.Handler.Click(
-            this, clickCallbacks, clickOptions
-        );
-        this.dragPan = new OpenLayers.Control.DragPan(
-            OpenLayers.Util.extend({
-                map: this.map,
-                documentDrag: this.documentDrag
-            }, this.dragPanOptions)
-        );
-        this.zoomBox = new OpenLayers.Control.ZoomBox(
-                    {map: this.map, keyMask: this.zoomBoxKeyMask});
-        this.dragPan.draw();
-        this.zoomBox.draw();
-        var wheelOptions = this.map.fractionalZoom ? {} : {
-            cumulative: false,
-            interval: 50,
-            maxDelta: 6
-        };
-        this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
-            this, {up : this.wheelUp, down: this.wheelDown},
-            OpenLayers.Util.extend(wheelOptions, this.mouseWheelOptions)
-        );
-        if (OpenLayers.Control.PinchZoom) {
-            this.pinchZoom = new OpenLayers.Control.PinchZoom(
-                OpenLayers.Util.extend(
-                    {map: this.map}, this.pinchZoomOptions));
-        }
+    exists: function(node) {
+        return (this.indices[node.id] != null);
     },
 
     /**
     },
 
     /**
-     * Method: defaultClick
-     *
+     * APIMethod: getZIndex
+     * Get the z-index value for the current node from the node data itself.
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event}
+     * node - {DOMElement} The node whose z-index to get.
+     * 
+     * Returns:
+     * {Integer} The z-index value for the specified node (from the node 
+     *     data itself).
      */
      */
-    defaultClick: function (evt) {
-        if (evt.lastTouches && evt.lastTouches.length == 2) {
-            this.map.zoomOut();
-        }
+    getZIndex: function(node) {
+        return node._style.graphicZIndex;  
     },
     },
-
+    
     /**
     /**
-     * Method: defaultDblClick 
+     * Method: determineZIndex
+     * Determine the z-index for the current node if there isn't one, 
+     *     and set the maximum value if we've found a new maximum.
      * 
      * Parameters:
      * 
      * Parameters:
-     * evt - {Event} 
+     * node - {DOMElement} 
      */
      */
-    defaultDblClick: function (evt) {
-        this.map.zoomTo(this.map.zoom + 1, evt.xy);
+    determineZIndex: function(node) {
+        var zIndex = node._style.graphicZIndex;
+        
+        // Everything must have a zIndex. If none is specified,
+        // this means the user *must* (hint: assumption) want this
+        // node to succomb to drawing order. To enforce drawing order
+        // over all indexing methods, we'll create a new z-index that's
+        // greater than any currently in the indexer.
+        if (zIndex == null) {
+            zIndex = this.maxZIndex;
+            node._style.graphicZIndex = zIndex; 
+        } else if (zIndex > this.maxZIndex) {
+            this.maxZIndex = zIndex;
+        }
     },
 
     /**
     },
 
     /**
-     * Method: defaultDblRightClick 
+     * APIMethod: getNextElement
+     * Get the next element in the order stack.
      * 
      * Parameters:
      * 
      * Parameters:
-     * evt - {Event} 
+     * index - {Integer} The index of the current node in this.order.
+     * 
+     * Returns:
+     * {DOMElement} the node following the index passed in, or
+     *     null.
      */
      */
-    defaultDblRightClick: function (evt) {
-        this.map.zoomTo(this.map.zoom - 1, evt.xy);
+    getNextElement: function(index) {
+        for (var nextIndex = index + 1, nextElement = undefined;
+            (nextIndex < this.order.length) && (nextElement == undefined);
+            nextIndex++) {
+            nextElement = OpenLayers.Util.getElement(this.order[nextIndex]);
+        }
+        
+        return nextElement || null;
     },
     
     },
     
+    CLASS_NAME: "OpenLayers.ElementsIndexer"
+});
+
+/**
+ * Namespace: OpenLayers.ElementsIndexer.IndexingMethods
+ * These are the compare methods for figuring out where a new node should be 
+ *     placed within the indexer. These methods are very similar to general 
+ *     sorting methods in that they return -1, 0, and 1 to specify the 
+ *     direction in which new nodes fall in the ordering.
+ */
+OpenLayers.ElementsIndexer.IndexingMethods = {
+    
     /**
     /**
-     * Method: wheelChange  
-     *
+     * Method: Z_ORDER
+     * This compare method is used by other comparison methods.
+     *     It can be used individually for ordering, but is not recommended,
+     *     because it doesn't subscribe to drawing order.
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event}
-     * deltaZ - {Integer}
+     * indexer - {<OpenLayers.ElementsIndexer>}
+     * newNode - {DOMElement}
+     * nextNode - {DOMElement}
+     * 
+     * Returns:
+     * {Integer}
      */
      */
-    wheelChange: function(evt, deltaZ) {
-        if (!this.map.fractionalZoom) {
-            deltaZ =  Math.round(deltaZ);
-        }
-        var currentZoom = this.map.getZoom(),
-            newZoom = currentZoom + deltaZ;
-        newZoom = Math.max(newZoom, 0);
-        newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
-        if (newZoom === currentZoom) {
-            return;
+    Z_ORDER: function(indexer, newNode, nextNode) {
+        var newZIndex = indexer.getZIndex(newNode);
+
+        var returnVal = 0;
+        if (nextNode) {
+            var nextZIndex = indexer.getZIndex(nextNode);
+            returnVal = newZIndex - nextZIndex; 
         }
         }
-        this.map.zoomTo(newZoom, evt.xy);
+        
+        return returnVal;
     },
 
     },
 
-    /** 
-     * Method: wheelUp
-     * User spun scroll wheel up
+    /**
+     * APIMethod: Z_ORDER_DRAWING_ORDER
+     * This method orders nodes by their z-index, but does so in a way
+     *     that, if there are other nodes with the same z-index, the newest 
+     *     drawn will be the front most within that z-index. This is the 
+     *     default indexing method.
      * 
      * Parameters:
      * 
      * Parameters:
-     * evt - {Event}
-     * delta - {Integer}
+     * indexer - {<OpenLayers.ElementsIndexer>}
+     * newNode - {DOMElement}
+     * nextNode - {DOMElement}
+     * 
+     * Returns:
+     * {Integer}
      */
      */
-    wheelUp: function(evt, delta) {
-        this.wheelChange(evt, delta || 1);
+    Z_ORDER_DRAWING_ORDER: function(indexer, newNode, nextNode) {
+        var returnVal = OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(
+            indexer, 
+            newNode, 
+            nextNode
+        );
+        
+        // Make Z_ORDER subscribe to drawing order by pushing it above
+        // all of the other nodes with the same z-index.
+        if (nextNode && returnVal == 0) {
+            returnVal = 1;
+        }
+        
+        return returnVal;
     },
 
     },
 
-    /** 
-     * Method: wheelDown
-     * User spun scroll wheel down
+    /**
+     * APIMethod: Z_ORDER_Y_ORDER
+     * This one should really be called Z_ORDER_Y_ORDER_DRAWING_ORDER, as it
+     *     best describes which ordering methods have precedence (though, the 
+     *     name would be too long). This method orders nodes by their z-index, 
+     *     but does so in a way that, if there are other nodes with the same 
+     *     z-index, the nodes with the lower y position will be "closer" than 
+     *     those with a higher y position. If two nodes have the exact same y 
+     *     position, however, then this method will revert to using drawing  
+     *     order to decide placement.
      * 
      * Parameters:
      * 
      * Parameters:
-     * evt - {Event}
-     * delta - {Integer}
+     * indexer - {<OpenLayers.ElementsIndexer>}
+     * newNode - {DOMElement}
+     * nextNode - {DOMElement}
+     * 
+     * Returns:
+     * {Integer}
      */
      */
-    wheelDown: function(evt, delta) {
-        this.wheelChange(evt, delta || -1);
-    },
-    
+    Z_ORDER_Y_ORDER: function(indexer, newNode, nextNode) {
+        var returnVal = OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(
+            indexer, 
+            newNode, 
+            nextNode
+        );
+        
+        if (nextNode && returnVal === 0) {            
+            var result = nextNode._boundsBottom - newNode._boundsBottom;
+            returnVal = (result === 0) ? 1 : result;
+        }
+        
+        return returnVal;       
+    }
+};
+
+/**
+ * Class: OpenLayers.Renderer.Elements
+ * This is another virtual class in that it should never be instantiated by 
+ *  itself as a Renderer. It exists because there is *tons* of shared 
+ *  functionality between different vector libraries which use nodes/elements
+ *  as a base for rendering vectors. 
+ * 
+ * The highlevel bits of code that are implemented here are the adding and 
+ *  removing of geometries, which is essentially the same for any 
+ *  element-based renderer. The details of creating each node and drawing the
+ *  paths are of course different, but the machinery is the same. 
+ * 
+ * Inherits:
+ *  - <OpenLayers.Renderer>
+ */
+OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, {
+
     /**
     /**
-     * Method: disableZoomBox
+     * Property: rendererRoot
+     * {DOMElement}
      */
      */
-    disableZoomBox : function() {
-        this.zoomBoxEnabled = false;
-        this.zoomBox.deactivate();       
-    },
+    rendererRoot: null,
     
     /**
     
     /**
-     * Method: enableZoomBox
+     * Property: root
+     * {DOMElement}
      */
      */
-    enableZoomBox : function() {
-        this.zoomBoxEnabled = true;
-        if (this.active) {
-            this.zoomBox.activate();
-        }    
-    },
+    root: null,
     
     /**
     
     /**
-     * Method: disableZoomWheel
+     * Property: vectorRoot
+     * {DOMElement}
      */
      */
-    
-    disableZoomWheel : function() {
-        this.zoomWheelEnabled = false;
-        this.handlers.wheel.deactivate();       
-    },
-    
+    vectorRoot: null,
+
     /**
     /**
-     * Method: enableZoomWheel
+     * Property: textRoot
+     * {DOMElement}
      */
      */
-    
-    enableZoomWheel : function() {
-        this.zoomWheelEnabled = true;
-        if (this.active) {
-            this.handlers.wheel.activate();
-        }    
-    },
-
-    CLASS_NAME: "OpenLayers.Control.Navigation"
-});
-/* ======================================================================
-    OpenLayers/Renderer/SVG.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Renderer/Elements.js
- */
-
-/**
- * Class: OpenLayers.Renderer.SVG
- * 
- * Inherits:
- *  - <OpenLayers.Renderer.Elements>
- */
-OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
+    textRoot: null,
 
 
-    /** 
+    /**
      * Property: xmlns
      * {String}
      * Property: xmlns
      * {String}
+     */    
+    xmlns: null,
+    
+    /**
+     * Property: xOffset
+     * {Number} Offset to apply to the renderer viewport translation in x
+     * direction. If the renderer extent's center is on the right of the
+     * dateline (i.e. exceeds the world bounds), we shift the viewport to the
+     * left by one world width. This avoids that features disappear from the
+     * map viewport. Because our dateline handling logic in other places
+     * ensures that extents crossing the dateline always have a center
+     * exceeding the world bounds on the left, we need this offset to make sure
+     * that the same is true for the renderer extent in pixel space as well.
      */
      */
-    xmlns: "http://www.w3.org/2000/svg",
+    xOffset: 0,
     
     /**
     
     /**
-     * Property: xlinkns
-     * {String}
+     * Property: rightOfDateLine
+     * {Boolean} Keeps track of the location of the map extent relative to the
+     * date line. The <setExtent> method compares this value (which is the one
+     * from the previous <setExtent> call) with the current position of the map
+     * extent relative to the date line and updates the xOffset when the extent
+     * has moved from one side of the date line to the other.
      */
      */
-    xlinkns: "http://www.w3.org/1999/xlink",
-
+    
     /**
     /**
-     * Constant: MAX_PIXEL
-     * {Integer} Firefox has a limitation where values larger or smaller than  
-     *           about 15000 in an SVG document lock the browser up. This 
-     *           works around it.
+     * Property: Indexer
+     * {<OpenLayers.ElementIndexer>} An instance of OpenLayers.ElementsIndexer 
+     *     created upon initialization if the zIndexing or yOrdering options
+     *     passed to this renderer's constructor are set to true.
      */
      */
-    MAX_PIXEL: 15000,
-
+    indexer: null, 
+    
     /**
     /**
-     * Property: translationParameters
-     * {Object} Hash with "x" and "y" properties
+     * Constant: BACKGROUND_ID_SUFFIX
+     * {String}
      */
      */
-    translationParameters: null,
+    BACKGROUND_ID_SUFFIX: "_background",
     
     /**
     
     /**
-     * Property: symbolMetrics
-     * {Object} Cache for symbol metrics according to their svg coordinate
-     *     space. This is an object keyed by the symbol's id, and values are
-     *     an array of [width, centerX, centerY].
+     * Constant: LABEL_ID_SUFFIX
+     * {String}
      */
      */
-    symbolMetrics: null,
+    LABEL_ID_SUFFIX: "_label",
     
     /**
     
     /**
-     * Constructor: OpenLayers.Renderer.SVG
+     * Constant: LABEL_OUTLINE_SUFFIX
+     * {String}
+     */
+    LABEL_OUTLINE_SUFFIX: "_outline",
+
+    /**
+     * Constructor: OpenLayers.Renderer.Elements
      * 
      * Parameters:
      * containerID - {String}
      * 
      * Parameters:
      * containerID - {String}
+     * options - {Object} options for this renderer. 
+     *
+     * Supported options are:
+     *     yOrdering - {Boolean} Whether to use y-ordering
+     *     zIndexing - {Boolean} Whether to use z-indexing. Will be ignored
+     *         if yOrdering is set to true.
      */
      */
-    initialize: function(containerID) {
-        if (!this.supported()) { 
-            return; 
-        }
-        OpenLayers.Renderer.Elements.prototype.initialize.apply(this, 
-                                                                arguments);
-        this.translationParameters = {x: 0, y: 0};
+    initialize: function(containerID, options) {
+        OpenLayers.Renderer.prototype.initialize.apply(this, arguments);
+
+        this.rendererRoot = this.createRenderRoot();
+        this.root = this.createRoot("_root");
+        this.vectorRoot = this.createRoot("_vroot");
+        this.textRoot = this.createRoot("_troot");
+        
+        this.root.appendChild(this.vectorRoot);
+        this.root.appendChild(this.textRoot);
+        
+        this.rendererRoot.appendChild(this.root);
+        this.container.appendChild(this.rendererRoot);
         
         
-        this.symbolMetrics = {};
+        if(options && (options.zIndexing || options.yOrdering)) {
+            this.indexer = new OpenLayers.ElementsIndexer(options.yOrdering);
+        }
     },
     },
-
+    
     /**
     /**
-     * APIMethod: supported
-     * 
-     * Returns:
-     * {Boolean} Whether or not the browser supports the SVG renderer
+     * Method: destroy
      */
      */
-    supported: function() {
-        var svgFeature = "http://www.w3.org/TR/SVG11/feature#";
-        return (document.implementation && 
-           (document.implementation.hasFeature("org.w3c.svg", "1.0") || 
-            document.implementation.hasFeature(svgFeature + "SVG", "1.1") || 
-            document.implementation.hasFeature(svgFeature + "BasicStructure", "1.1") ));
-    },    
+    destroy: function() {
+
+        this.clear(); 
+
+        this.rendererRoot = null;
+        this.root = null;
+        this.xmlns = null;
 
 
+        OpenLayers.Renderer.prototype.destroy.apply(this, arguments);
+    },
+    
     /**
     /**
-     * Method: inValidRange
-     * See #669 for more information
-     *
-     * Parameters:
-     * x      - {Integer}
-     * y      - {Integer}
-     * xyOnly - {Boolean} whether or not to just check for x and y, which means
-     *     to not take the current translation parameters into account if true.
-     * 
-     * Returns:
-     * {Boolean} Whether or not the 'x' and 'y' coordinates are in the  
-     *           valid range.
-     */ 
-    inValidRange: function(x, y, xyOnly) {
-        var left = x + (xyOnly ? 0 : this.translationParameters.x);
-        var top = y + (xyOnly ? 0 : this.translationParameters.y);
-        return (left >= -this.MAX_PIXEL && left <= this.MAX_PIXEL &&
-                top >= -this.MAX_PIXEL && top <= this.MAX_PIXEL);
+     * Method: clear
+     * Remove all the elements from the root
+     */    
+    clear: function() {
+        var child;
+        var root = this.vectorRoot;
+        if (root) {
+            while (child = root.firstChild) {
+                root.removeChild(child);
+            }
+        }
+        root = this.textRoot;
+        if (root) {
+            while (child = root.firstChild) {
+                root.removeChild(child);
+            }
+        }
+        if (this.indexer) {
+            this.indexer.clear();
+        }
     },
     },
-
+    
     /**
      * Method: setExtent
     /**
      * Method: setExtent
-     * 
+     * Set the visible part of the layer.
+     *
      * Parameters:
      * extent - {<OpenLayers.Bounds>}
      * resolutionChanged - {Boolean}
      * Parameters:
      * extent - {<OpenLayers.Bounds>}
      * resolutionChanged - {Boolean}
-     * 
+     *
      * Returns:
      * {Boolean} true to notify the layer that the new extent does not exceed
      *     the coordinate range, and the features will not need to be redrawn.
      *     False otherwise.
      */
     setExtent: function(extent, resolutionChanged) {
      * Returns:
      * {Boolean} true to notify the layer that the new extent does not exceed
      *     the coordinate range, and the features will not need to be redrawn.
      *     False otherwise.
      */
     setExtent: function(extent, resolutionChanged) {
-        var coordSysUnchanged = OpenLayers.Renderer.Elements.prototype.setExtent.apply(this, arguments);
-        
-        var resolution = this.getResolution(),
-            left = -extent.left / resolution,
-            top = extent.top / resolution;
-
-        // If the resolution has changed, start over changing the corner, because
-        // the features will redraw.
-        if (resolutionChanged) {
-            this.left = left;
-            this.top = top;
-            // Set the viewbox
-            var extentString = "0 0 " + this.size.w + " " + this.size.h;
-
-            this.rendererRoot.setAttributeNS(null, "viewBox", extentString);
-            this.translate(this.xOffset, 0);
-            return true;
-        } else {
-            var inRange = this.translate(left - this.left + this.xOffset, top - this.top);
-            if (!inRange) {
-                // recenter the coordinate system
-                this.setExtent(extent, true);
+        var coordSysUnchanged = OpenLayers.Renderer.prototype.setExtent.apply(this, arguments);
+        var resolution = this.getResolution();
+        if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
+            var rightOfDateLine,
+                ratio = extent.getWidth() / this.map.getExtent().getWidth(),
+                extent = extent.scale(1 / ratio),
+                world = this.map.getMaxExtent();
+            if (world.right > extent.left && world.right < extent.right) {
+                rightOfDateLine = true;
+            } else if (world.left > extent.left && world.left < extent.right) {
+                rightOfDateLine = false;
             }
             }
-            return coordSysUnchanged && inRange;
-        }
-    },
-    
-    /**
-     * Method: translate
-     * Transforms the SVG coordinate system
-     * 
-     * Parameters:
-     * x - {Float}
-     * y - {Float}
-     * 
-     * Returns:
-     * {Boolean} true if the translation parameters are in the valid coordinates
-     *     range, false otherwise.
-     */
-    translate: function(x, y) {
-        if (!this.inValidRange(x, y, true)) {
-            return false;
-        } else {
-            var transformString = "";
-            if (x || y) {
-                transformString = "translate(" + x + "," + y + ")";
+            if (rightOfDateLine !== this.rightOfDateLine || resolutionChanged) {
+                coordSysUnchanged = false;
+                this.xOffset = rightOfDateLine === true ?
+                    world.getWidth() / resolution : 0;
             }
             }
-            this.root.setAttributeNS(null, "transform", transformString);
-            this.translationParameters = {x: x, y: y};
-            return true;
+            this.rightOfDateLine = rightOfDateLine;
         }
         }
-    },
-
-    /**
-     * Method: setSize
-     * Sets the size of the drawing surface.
-     * 
-     * Parameters:
-     * size - {<OpenLayers.Size>} The size of the drawing surface
-     */
-    setSize: function(size) {
-        OpenLayers.Renderer.prototype.setSize.apply(this, arguments);
-        
-        this.rendererRoot.setAttributeNS(null, "width", this.size.w);
-        this.rendererRoot.setAttributeNS(null, "height", this.size.h);
+        return coordSysUnchanged;
     },
 
     /** 
     },
 
     /** 
-     * Method: getNodeType 
-     * 
+     * Method: getNodeType
+     * This function is in charge of asking the specific renderer which type
+     *     of node to create for the given geometry and style. All geometries
+     *     in an Elements-based renderer consist of one node and some
+     *     attributes. We have the nodeFactory() function which creates a node
+     *     for us, but it takes a 'type' as input, and that is precisely what
+     *     this function tells us.  
+     *  
      * Parameters:
      * geometry - {<OpenLayers.Geometry>}
      * style - {Object}
      * Parameters:
      * geometry - {<OpenLayers.Geometry>}
      * style - {Object}
@@ -35135,345 +35114,265 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
      * Returns:
      * {String} The corresponding node type for the specified geometry
      */
      * Returns:
      * {String} The corresponding node type for the specified geometry
      */
-    getNodeType: function(geometry, style) {
-        var nodeType = null;
-        switch (geometry.CLASS_NAME) {
-            case "OpenLayers.Geometry.Point":
-                if (style.externalGraphic) {
-                    nodeType = "image";
-                } else if (this.isComplexSymbol(style.graphicName)) {
-                    nodeType = "svg";
-                } else {
-                    nodeType = "circle";
-                }
-                break;
-            case "OpenLayers.Geometry.Rectangle":
-                nodeType = "rect";
-                break;
-            case "OpenLayers.Geometry.LineString":
-                nodeType = "polyline";
-                break;
-            case "OpenLayers.Geometry.LinearRing":
-                nodeType = "polygon";
-                break;
-            case "OpenLayers.Geometry.Polygon":
-            case "OpenLayers.Geometry.Curve":
-                nodeType = "path";
-                break;
-            default:
-                break;
-        }
-        return nodeType;
-    },
+    getNodeType: function(geometry, style) { },
 
     /** 
 
     /** 
-     * Method: setStyle
-     * Use to set all the style attributes to a SVG node.
-     * 
-     * Takes care to adjust stroke width and point radius to be
-     * resolution-relative
+     * Method: drawGeometry 
+     * Draw the geometry, creating new nodes, setting paths, setting style,
+     *     setting featureId on the node.  This method should only be called
+     *     by the renderer itself.
      *
      * Parameters:
      *
      * Parameters:
-     * node - {SVGDomElement} An SVG element to decorate
+     * geometry - {<OpenLayers.Geometry>}
      * style - {Object}
      * style - {Object}
-     * options - {Object} Currently supported options include 
-     *                              'isFilled' {Boolean} and
-     *                              'isStroked' {Boolean}
+     * featureId - {String}
+     * 
+     * Returns:
+     * {Boolean} true if the geometry has been drawn completely; null if
+     *     incomplete; false otherwise
      */
      */
-    setStyle: function(node, style, options) {
-        style = style  || node._style;
-        options = options || node._options;
-
-        var title = style.title || style.graphicTitle;
-        if (title) {
-            node.setAttributeNS(null, "title", title);
-            //Standards-conformant SVG
-            // Prevent duplicate nodes. See issue https://github.com/openlayers/openlayers/issues/92 
-            var titleNode = node.getElementsByTagName("title");
-            if (titleNode.length > 0) {
-                titleNode[0].firstChild.textContent = title;
-            } else {
-                var label = this.nodeFactory(null, "title");
-                label.textContent = title;
-                node.appendChild(label);
+    drawGeometry: function(geometry, style, featureId) {
+        var className = geometry.CLASS_NAME;
+        var rendered = true;
+        if ((className == "OpenLayers.Geometry.Collection") ||
+            (className == "OpenLayers.Geometry.MultiPoint") ||
+            (className == "OpenLayers.Geometry.MultiLineString") ||
+            (className == "OpenLayers.Geometry.MultiPolygon")) {
+            for (var i = 0, len=geometry.components.length; i<len; i++) {
+                rendered = this.drawGeometry(
+                    geometry.components[i], style, featureId) && rendered;
             }
             }
+            return rendered;
         }
 
         }
 
-        var r = parseFloat(node.getAttributeNS(null, "r"));
-        var widthFactor = 1;
-        var pos;
-        if (node._geometryClass == "OpenLayers.Geometry.Point" && r) {
-            node.style.visibility = "";
-            if (style.graphic === false) {
-                node.style.visibility = "hidden";
-            } else if (style.externalGraphic) {
-                pos = this.getPosition(node);
-                if (style.graphicWidth && style.graphicHeight) {
-                  node.setAttributeNS(null, "preserveAspectRatio", "none");
-                }
-                var width = style.graphicWidth || style.graphicHeight;
-                var height = style.graphicHeight || style.graphicWidth;
-                width = width ? width : style.pointRadius*2;
-                height = height ? height : style.pointRadius*2;
-                var xOffset = (style.graphicXOffset != undefined) ?
-                    style.graphicXOffset : -(0.5 * width);
-                var yOffset = (style.graphicYOffset != undefined) ?
-                    style.graphicYOffset : -(0.5 * height);
-
-                var opacity = style.graphicOpacity || style.fillOpacity;
-                
-                node.setAttributeNS(null, "x", (pos.x + xOffset).toFixed());
-                node.setAttributeNS(null, "y", (pos.y + yOffset).toFixed());
-                node.setAttributeNS(null, "width", width);
-                node.setAttributeNS(null, "height", height);
-                node.setAttributeNS(this.xlinkns, "xlink:href", style.externalGraphic);
-                node.setAttributeNS(null, "style", "opacity: "+opacity);
-                node.onclick = OpenLayers.Event.preventDefault;
-            } else if (this.isComplexSymbol(style.graphicName)) {
-                // the symbol viewBox is three times as large as the symbol
-                var offset = style.pointRadius * 3;
-                var size = offset * 2;
-                var src = this.importSymbol(style.graphicName);
-                pos = this.getPosition(node);
-                widthFactor = this.symbolMetrics[src.id][0] * 3 / size;
-                
-                // remove the node from the dom before we modify it. This
-                // prevents various rendering issues in Safari and FF
-                var parent = node.parentNode;
-                var nextSibling = node.nextSibling;
-                if(parent) {
-                    parent.removeChild(node);
-                }
-                
-                // The more appropriate way to implement this would be use/defs,
-                // but due to various issues in several browsers, it is safer to
-                // copy the symbols instead of referencing them. 
-                // See e.g. ticket http://trac.osgeo.org/openlayers/ticket/2985 
-                // and this email thread
-                // http://osgeo-org.1803224.n2.nabble.com/Select-Control-Ctrl-click-on-Feature-with-a-graphicName-opens-new-browser-window-tc5846039.html
-                node.firstChild && node.removeChild(node.firstChild);
-                node.appendChild(src.firstChild.cloneNode(true));
-                node.setAttributeNS(null, "viewBox", src.getAttributeNS(null, "viewBox"));
-                
-                node.setAttributeNS(null, "width", size);
-                node.setAttributeNS(null, "height", size);
-                node.setAttributeNS(null, "x", pos.x - offset);
-                node.setAttributeNS(null, "y", pos.y - offset);
-                
-                // now that the node has all its new properties, insert it
-                // back into the dom where it was
-                if(nextSibling) {
-                    parent.insertBefore(node, nextSibling);
-                } else if(parent) {
-                    parent.appendChild(node);
-                }
+        rendered = false;
+        var removeBackground = false;
+        if (style.display != "none") {
+            if (style.backgroundGraphic) {
+                this.redrawBackgroundNode(geometry.id, geometry, style,
+                    featureId);
             } else {
             } else {
-                node.setAttributeNS(null, "r", style.pointRadius);
+                removeBackground = true;
             }
             }
-
-            var rotation = style.rotation;
-            
-            if ((rotation !== undefined || node._rotation !== undefined) && pos) {
-                node._rotation = rotation;
-                rotation |= 0;
-                if (node.nodeName !== "svg") { 
-                    node.setAttributeNS(null, "transform", 
-                        "rotate(" + rotation + " " + pos.x + " " + 
-                        pos.y + ")"); 
-                } else {
-                    var metrics = this.symbolMetrics[src.id];
-                    node.firstChild.setAttributeNS(null, "transform", "rotate(" 
-                        + rotation + " " 
-                        + metrics[1] + " "
-                        + metrics[2] + ")");
+            rendered = this.redrawNode(geometry.id, geometry, style,
+                featureId);
+        }
+        if (rendered == false) {
+            var node = document.getElementById(geometry.id);
+            if (node) {
+                if (node._style.backgroundGraphic) {
+                    removeBackground = true;
                 }
                 }
+                node.parentNode.removeChild(node);
             }
         }
             }
         }
-        
-        if (options.isFilled) {
-            node.setAttributeNS(null, "fill", style.fillColor);
-            node.setAttributeNS(null, "fill-opacity", style.fillOpacity);
-        } else {
-            node.setAttributeNS(null, "fill", "none");
-        }
-
-        if (options.isStroked) {
-            node.setAttributeNS(null, "stroke", style.strokeColor);
-            node.setAttributeNS(null, "stroke-opacity", style.strokeOpacity);
-            node.setAttributeNS(null, "stroke-width", style.strokeWidth * widthFactor);
-            node.setAttributeNS(null, "stroke-linecap", style.strokeLinecap || "round");
-            // Hard-coded linejoin for now, to make it look the same as in VML.
-            // There is no strokeLinejoin property yet for symbolizers.
-            node.setAttributeNS(null, "stroke-linejoin", "round");
-            style.strokeDashstyle && node.setAttributeNS(null,
-                "stroke-dasharray", this.dashStyle(style, widthFactor));
-        } else {
-            node.setAttributeNS(null, "stroke", "none");
-        }
-        
-        if (style.pointerEvents) {
-            node.setAttributeNS(null, "pointer-events", style.pointerEvents);
-        }
-                
-        if (style.cursor != null) {
-            node.setAttributeNS(null, "cursor", style.cursor);
+        if (removeBackground) {
+            var node = document.getElementById(
+                geometry.id + this.BACKGROUND_ID_SUFFIX);
+            if (node) {
+                node.parentNode.removeChild(node);
+            }
         }
         }
-        
-        return node;
+        return rendered;
     },
     },
-
-    /** 
-     * Method: dashStyle
+    
+    /**
+     * Method: redrawNode
      * 
      * Parameters:
      * 
      * Parameters:
+     * id - {String}
+     * geometry - {<OpenLayers.Geometry>}
      * style - {Object}
      * style - {Object}
-     * widthFactor - {Number}
+     * featureId - {String}
      * 
      * Returns:
      * 
      * Returns:
-     * {String} A SVG compliant 'stroke-dasharray' value
+     * {Boolean} true if the complete geometry could be drawn, null if parts of
+     *     the geometry could not be drawn, false otherwise
      */
      */
-    dashStyle: function(style, widthFactor) {
-        var w = style.strokeWidth * widthFactor;
-        var str = style.strokeDashstyle;
-        switch (str) {
-            case 'solid':
-                return 'none';
-            case 'dot':
-                return [1, 4 * w].join();
-            case 'dash':
-                return [4 * w, 4 * w].join();
-            case 'dashdot':
-                return [4 * w, 4 * w, 1, 4 * w].join();
-            case 'longdash':
-                return [8 * w, 4 * w].join();
-            case 'longdashdot':
-                return [8 * w, 4 * w, 1, 4 * w].join();
-            default:
-                return OpenLayers.String.trim(str).replace(/\s+/g, ",");
+    redrawNode: function(id, geometry, style, featureId) {
+        style = this.applyDefaultSymbolizer(style);
+        // Get the node if it's already on the map.
+        var node = this.nodeFactory(id, this.getNodeType(geometry, style));
+        
+        // Set the data for the node, then draw it.
+        node._featureId = featureId;
+        node._boundsBottom = geometry.getBounds().bottom;
+        node._geometryClass = geometry.CLASS_NAME;
+        node._style = style;
+
+        var drawResult = this.drawGeometryNode(node, geometry, style);
+        if(drawResult === false) {
+            return false;
         }
         }
-    },
-    
-    /** 
-     * Method: createNode
-     * 
-     * Parameters:
-     * type - {String} Kind of node to draw
-     * id - {String} Id for node
-     * 
-     * Returns:
-     * {DOMElement} A new node of the given type and id
-     */
-    createNode: function(type, id) {
-        var node = document.createElementNS(this.xmlns, type);
-        if (id) {
-            node.setAttributeNS(null, "id", id);
+         
+        node = drawResult.node;
+        
+        // Insert the node into the indexer so it can show us where to
+        // place it. Note that this operation is O(log(n)). If there's a
+        // performance problem (when dragging, for instance) this is
+        // likely where it would be.
+        if (this.indexer) {
+            var insert = this.indexer.insert(node);
+            if (insert) {
+                this.vectorRoot.insertBefore(node, insert);
+            } else {
+                this.vectorRoot.appendChild(node);
+            }
+        } else {
+            // if there's no indexer, simply append the node to root,
+            // but only if the node is a new one
+            if (node.parentNode !== this.vectorRoot){ 
+                this.vectorRoot.appendChild(node);
+            }
         }
         }
-        return node;    
+        
+        this.postDraw(node);
+        
+        return drawResult.complete;
     },
     
     },
     
-    /** 
-     * Method: nodeTypeCompare
+    /**
+     * Method: redrawBackgroundNode
+     * Redraws the node using special 'background' style properties. Basically
+     *     just calls redrawNode(), but instead of directly using the 
+     *     'externalGraphic', 'graphicXOffset', 'graphicYOffset', and 
+     *     'graphicZIndex' properties directly from the specified 'style' 
+     *     parameter, we create a new style object and set those properties 
+     *     from the corresponding 'background'-prefixed properties from 
+     *     specified 'style' parameter.
      * 
      * Parameters:
      * 
      * Parameters:
-     * node - {SVGDomElement} An SVG element
-     * type - {String} Kind of node
-     * 
-     * Returns:
-     * {Boolean} Whether or not the specified node is of the specified type
-     */
-    nodeTypeCompare: function(node, type) {
-        return (type == node.nodeName);
-    },
-   
-    /**
-     * Method: createRenderRoot
+     * id - {String}
+     * geometry - {<OpenLayers.Geometry>}
+     * style - {Object}
+     * featureId - {String}
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement} The specific render engine's root element
+     * {Boolean} true if the complete geometry could be drawn, null if parts of
+     *     the geometry could not be drawn, false otherwise
      */
      */
-    createRenderRoot: function() {
-        var svg = this.nodeFactory(this.container.id + "_svgRoot", "svg");
-        svg.style.display = "block";
-        return svg;
+    redrawBackgroundNode: function(id, geometry, style, featureId) {
+        var backgroundStyle = OpenLayers.Util.extend({}, style);
+        
+        // Set regular style attributes to apply to the background styles.
+        backgroundStyle.externalGraphic = backgroundStyle.backgroundGraphic;
+        backgroundStyle.graphicXOffset = backgroundStyle.backgroundXOffset;
+        backgroundStyle.graphicYOffset = backgroundStyle.backgroundYOffset;
+        backgroundStyle.graphicZIndex = backgroundStyle.backgroundGraphicZIndex;
+        backgroundStyle.graphicWidth = backgroundStyle.backgroundWidth || backgroundStyle.graphicWidth;
+        backgroundStyle.graphicHeight = backgroundStyle.backgroundHeight || backgroundStyle.graphicHeight;
+        
+        // Erase background styles.
+        backgroundStyle.backgroundGraphic = null;
+        backgroundStyle.backgroundXOffset = null;
+        backgroundStyle.backgroundYOffset = null;
+        backgroundStyle.backgroundGraphicZIndex = null;
+        
+        return this.redrawNode(
+            id + this.BACKGROUND_ID_SUFFIX, 
+            geometry, 
+            backgroundStyle, 
+            null
+        );
     },
 
     /**
     },
 
     /**
-     * Method: createRoot
-     * 
+     * Method: drawGeometryNode
+     * Given a node, draw a geometry on the specified layer.
+     *     node and geometry are required arguments, style is optional.
+     *     This method is only called by the render itself.
+     *
      * Parameters:
      * Parameters:
-     * suffix - {String} suffix to append to the id
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * style - {Object}
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement}
+     * {Object} a hash with properties "node" (the drawn node) and "complete"
+     *     (null if parts of the geometry could not be drawn, false if nothing
+     *     could be drawn)
      */
      */
-    createRoot: function(suffix) {
-        return this.nodeFactory(this.container.id + suffix, "g");
-    },
+    drawGeometryNode: function(node, geometry, style) {
+        style = style || node._style;
 
 
-    /**
-     * Method: createDefs
-     *
-     * Returns:
-     * {DOMElement} The element to which we'll add the symbol definitions
-     */
-    createDefs: function() {
-        var defs = this.nodeFactory(this.container.id + "_defs", "defs");
-        this.rendererRoot.appendChild(defs);
-        return defs;
-    },
+        var options = {
+            'isFilled': style.fill === undefined ?
+                true :
+                style.fill,
+            'isStroked': style.stroke === undefined ?
+                !!style.strokeWidth :
+                style.stroke
+        };
+        var drawn;
+        switch (geometry.CLASS_NAME) {
+            case "OpenLayers.Geometry.Point":
+                if(style.graphic === false) {
+                    options.isFilled = false;
+                    options.isStroked = false;
+                }
+                drawn = this.drawPoint(node, geometry);
+                break;
+            case "OpenLayers.Geometry.LineString":
+                options.isFilled = false;
+                drawn = this.drawLineString(node, geometry);
+                break;
+            case "OpenLayers.Geometry.LinearRing":
+                drawn = this.drawLinearRing(node, geometry);
+                break;
+            case "OpenLayers.Geometry.Polygon":
+                drawn = this.drawPolygon(node, geometry);
+                break;
+            case "OpenLayers.Geometry.Rectangle":
+                drawn = this.drawRectangle(node, geometry);
+                break;
+            default:
+                break;
+        }
 
 
-    /**************************************
-     *                                    *
-     *     GEOMETRY DRAWING FUNCTIONS     *
-     *                                    *
-     **************************************/
+        node._options = options; 
 
 
+        //set style
+        //TBD simplify this
+        if (drawn != false) {
+            return {
+                node: this.setStyle(node, style, options, geometry),
+                complete: drawn
+            };
+        } else {
+            return false;
+        }
+    },
+    
     /**
     /**
-     * Method: drawPoint
-     * This method is only called by the renderer itself.
+     * Method: postDraw
+     * Things that have do be done after the geometry node is appended
+     *     to its parent node. To be overridden by subclasses.
      * 
      * 
-     * Parameters: 
+     * Parameters:
      * node - {DOMElement}
      * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * 
-     * Returns:
-     * {DOMElement} or false if the renderer could not draw the point
-     */ 
-    drawPoint: function(node, geometry) {
-        return this.drawCircle(node, geometry, 1);
-    },
-
+     */
+    postDraw: function(node) {},
+    
     /**
     /**
-     * Method: drawCircle
-     * This method is only called by the renderer itself.
+     * Method: drawPoint
+     * Virtual function for drawing Point Geometry. 
+     *     Should be implemented by subclasses.
+     *     This method is only called by the renderer itself.
      * 
      * Parameters: 
      * node - {DOMElement}
      * geometry - {<OpenLayers.Geometry>}
      * 
      * Parameters: 
      * node - {DOMElement}
      * geometry - {<OpenLayers.Geometry>}
-     * radius - {Float}
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement} or false if the renderer could not draw the circle
-     */
-    drawCircle: function(node, geometry, radius) {
-        var resolution = this.getResolution();
-        var x = ((geometry.x - this.featureDx) / resolution + this.left);
-        var y = (this.top - geometry.y / resolution);
+     * {DOMElement} or false if the renderer could not draw the point
+     */ 
+    drawPoint: function(node, geometry) {},
 
 
-        if (this.inValidRange(x, y)) { 
-            node.setAttributeNS(null, "cx", x);
-            node.setAttributeNS(null, "cy", y);
-            node.setAttributeNS(null, "r", radius);
-            return node;
-        } else {
-            return false;
-        }    
-            
-    },
-    
     /**
      * Method: drawLineString
     /**
      * Method: drawLineString
-     * This method is only called by the renderer itself.
+     * Virtual function for drawing LineString Geometry. 
+     *     Should be implemented by subclasses.
+     *     This method is only called by the renderer itself.
      * 
      * Parameters: 
      * node - {DOMElement}
      * 
      * Parameters: 
      * node - {DOMElement}
@@ -35483,19 +35382,13 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
      * {DOMElement} or null if the renderer could not draw all components of
      *     the linestring, or false if nothing could be drawn
      */ 
      * {DOMElement} or null if the renderer could not draw all components of
      *     the linestring, or false if nothing could be drawn
      */ 
-    drawLineString: function(node, geometry) {
-        var componentsResult = this.getComponentsString(geometry.components);
-        if (componentsResult.path) {
-            node.setAttributeNS(null, "points", componentsResult.path);
-            return (componentsResult.complete ? node : null);  
-        } else {
-            return false;
-        }
-    },
-    
+    drawLineString: function(node, geometry) {},
+
     /**
      * Method: drawLinearRing
     /**
      * Method: drawLinearRing
-     * This method is only called by the renderer itself.
+     * Virtual function for drawing LinearRing Geometry. 
+     *     Should be implemented by subclasses.
+     *     This method is only called by the renderer itself.
      * 
      * Parameters: 
      * node - {DOMElement}
      * 
      * Parameters: 
      * node - {DOMElement}
@@ -35505,19 +35398,13 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
      * {DOMElement} or null if the renderer could not draw all components
      *     of the linear ring, or false if nothing could be drawn
      */ 
      * {DOMElement} or null if the renderer could not draw all components
      *     of the linear ring, or false if nothing could be drawn
      */ 
-    drawLinearRing: function(node, geometry) {
-        var componentsResult = this.getComponentsString(geometry.components);
-        if (componentsResult.path) {
-            node.setAttributeNS(null, "points", componentsResult.path);
-            return (componentsResult.complete ? node : null);  
-        } else {
-            return false;
-        }
-    },
-    
+    drawLinearRing: function(node, geometry) {},
+
     /**
      * Method: drawPolygon
     /**
      * Method: drawPolygon
-     * This method is only called by the renderer itself.
+     * Virtual function for drawing Polygon Geometry. 
+     *    Should be implemented by subclasses.
+     *    This method is only called by the renderer itself.
      * 
      * Parameters: 
      * node - {DOMElement}
      * 
      * Parameters: 
      * node - {DOMElement}
@@ -35527,36 +35414,13 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
      * {DOMElement} or null if the renderer could not draw all components
      *     of the polygon, or false if nothing could be drawn
      */ 
      * {DOMElement} or null if the renderer could not draw all components
      *     of the polygon, or false if nothing could be drawn
      */ 
-    drawPolygon: function(node, geometry) {
-        var d = "";
-        var draw = true;
-        var complete = true;
-        var linearRingResult, path;
-        for (var j=0, len=geometry.components.length; j<len; j++) {
-            d += " M";
-            linearRingResult = this.getComponentsString(
-                geometry.components[j].components, " ");
-            path = linearRingResult.path;
-            if (path) {
-                d += " " + path;
-                complete = linearRingResult.complete && complete;
-            } else {
-                draw = false;
-            }
-        }
-        d += " z";
-        if (draw) {
-            node.setAttributeNS(null, "d", d);
-            node.setAttributeNS(null, "fill-rule", "evenodd");
-            return complete ? node : null;
-        } else {
-            return false;
-        }    
-    },
-    
+    drawPolygon: function(node, geometry) {},
+
     /**
      * Method: drawRectangle
     /**
      * Method: drawRectangle
-     * This method is only called by the renderer itself.
+     * Virtual function for drawing Rectangle Geometry. 
+     *     Should be implemented by subclasses.
+     *     This method is only called by the renderer itself.
      * 
      * Parameters: 
      * node - {DOMElement}
      * 
      * Parameters: 
      * node - {DOMElement}
@@ -35565,7815 +35429,8088 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
      * Returns:
      * {DOMElement} or false if the renderer could not draw the rectangle
      */ 
      * Returns:
      * {DOMElement} or false if the renderer could not draw the rectangle
      */ 
-    drawRectangle: function(node, geometry) {
-        var resolution = this.getResolution();
-        var x = ((geometry.x - this.featureDx) / resolution + this.left);
-        var y = (this.top - geometry.y / resolution);
+    drawRectangle: function(node, geometry) {},
 
 
-        if (this.inValidRange(x, y)) { 
-            node.setAttributeNS(null, "x", x);
-            node.setAttributeNS(null, "y", y);
-            node.setAttributeNS(null, "width", geometry.width / resolution);
-            node.setAttributeNS(null, "height", geometry.height / resolution);
-            return node;
-        } else {
-            return false;
-        }
-    },
-    
     /**
     /**
-     * Method: drawText
-     * This method is only called by the renderer itself.
-     *
+     * Method: drawCircle
+     * Virtual function for drawing Circle Geometry. 
+     *     Should be implemented by subclasses.
+     *     This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or false if the renderer could not draw the circle
+     */ 
+    drawCircle: function(node, geometry) {},
+
+    /**
+     * Method: removeText
+     * Removes a label
+     * 
      * Parameters:
      * featureId - {String}
      * Parameters:
      * featureId - {String}
-     * style -
-     * location - {<OpenLayers.Geometry.Point>}
      */
      */
-    drawText: function(featureId, style, location) {
-        var drawOutline = (!!style.labelOutlineWidth);
-        // First draw text in halo color and size and overlay the
-        // normal text afterwards
-        if (drawOutline) {
-            var outlineStyle = OpenLayers.Util.extend({}, style);
-            outlineStyle.fontColor = outlineStyle.labelOutlineColor;
-            outlineStyle.fontStrokeColor = outlineStyle.labelOutlineColor;
-            outlineStyle.fontStrokeWidth = style.labelOutlineWidth;
-            if (style.labelOutlineOpacity) {
-                outlineStyle.fontOpacity = style.labelOutlineOpacity;
-            }
-            delete outlineStyle.labelOutlineWidth;
-            this.drawText(featureId, outlineStyle, location);
-        }
-
-        var resolution = this.getResolution();
-
-        var x = ((location.x - this.featureDx) / resolution + this.left);
-        var y = (location.y / resolution - this.top);
-
-        var suffix = (drawOutline)?this.LABEL_OUTLINE_SUFFIX:this.LABEL_ID_SUFFIX;
-        var label = this.nodeFactory(featureId + suffix, "text");
-
-        label.setAttributeNS(null, "x", x);
-        label.setAttributeNS(null, "y", -y);
-
-        if (style.fontColor) {
-            label.setAttributeNS(null, "fill", style.fontColor);
-        }
-        if (style.fontStrokeColor) {
-            label.setAttributeNS(null, "stroke", style.fontStrokeColor);
-        }
-        if (style.fontStrokeWidth) {
-            label.setAttributeNS(null, "stroke-width", style.fontStrokeWidth);
-        }
-        if (style.fontOpacity) {
-            label.setAttributeNS(null, "opacity", style.fontOpacity);
-        }
-        if (style.fontFamily) {
-            label.setAttributeNS(null, "font-family", style.fontFamily);
-        }
-        if (style.fontSize) {
-            label.setAttributeNS(null, "font-size", style.fontSize);
-        }
-        if (style.fontWeight) {
-            label.setAttributeNS(null, "font-weight", style.fontWeight);
-        }
-        if (style.fontStyle) {
-            label.setAttributeNS(null, "font-style", style.fontStyle);
-        }
-        if (style.labelSelect === true) {
-            label.setAttributeNS(null, "pointer-events", "visible");
-            label._featureId = featureId;
-        } else {
-            label.setAttributeNS(null, "pointer-events", "none");
-        }
-        var align = style.labelAlign || OpenLayers.Renderer.defaultSymbolizer.labelAlign;
-        label.setAttributeNS(null, "text-anchor",
-            OpenLayers.Renderer.SVG.LABEL_ALIGN[align[0]] || "middle");
-
-        if (OpenLayers.IS_GECKO === true) {
-            label.setAttributeNS(null, "dominant-baseline",
-                OpenLayers.Renderer.SVG.LABEL_ALIGN[align[1]] || "central");
-        }
-
-        var labelRows = style.label.split('\n');
-        var numRows = labelRows.length;
-        while (label.childNodes.length > numRows) {
-            label.removeChild(label.lastChild);
+    removeText: function(featureId) {
+        var label = document.getElementById(featureId + this.LABEL_ID_SUFFIX);
+        if (label) {
+            this.textRoot.removeChild(label);
         }
         }
-        for (var i = 0; i < numRows; i++) {
-            var tspan = this.nodeFactory(featureId + suffix + "_tspan_" + i, "tspan");
-            if (style.labelSelect === true) {
-                tspan._featureId = featureId;
-                tspan._geometry = location;
-                tspan._geometryClass = location.CLASS_NAME;
-            }
-            if (OpenLayers.IS_GECKO === false) {
-                tspan.setAttributeNS(null, "baseline-shift",
-                    OpenLayers.Renderer.SVG.LABEL_VSHIFT[align[1]] || "-35%");
-            }
-            tspan.setAttribute("x", x);
-            if (i == 0) {
-                var vfactor = OpenLayers.Renderer.SVG.LABEL_VFACTOR[align[1]];
-                if (vfactor == null) {
-                     vfactor = -.5;
-                }
-                tspan.setAttribute("dy", (vfactor*(numRows-1)) + "em");
-            } else {
-                tspan.setAttribute("dy", "1em");
-            }
-            tspan.textContent = (labelRows[i] === '') ? ' ' : labelRows[i];
-            if (!tspan.parentNode) {
-                label.appendChild(tspan);
-            }
+        var outline = document.getElementById(featureId + this.LABEL_OUTLINE_SUFFIX);
+        if (outline) {
+            this.textRoot.removeChild(outline);
         }
         }
+    },
 
 
-        if (!label.parentNode) {
-            this.textRoot.appendChild(label);
-        }
+    /**
+     * Method: getFeatureIdFromEvent
+     * 
+     * Parameters:
+     * evt - {Object} An <OpenLayers.Event> object
+     *
+     * Returns:
+     * {String} A feature id or undefined.
+     */
+    getFeatureIdFromEvent: function(evt) {
+        var target = evt.target;
+        var useElement = target && target.correspondingUseElement;
+        var node = useElement ? useElement : (target || evt.srcElement);
+        return node._featureId;
     },
     },
-    
+
     /** 
     /** 
-     * Method: getComponentString
+     * Method: eraseGeometry
+     * Erase a geometry from the renderer. In the case of a multi-geometry, 
+     *     we cycle through and recurse on ourselves. Otherwise, we look for a 
+     *     node with the geometry.id, destroy its geometry, and remove it from
+     *     the DOM.
      * 
      * Parameters:
      * 
      * Parameters:
-     * components - {Array(<OpenLayers.Geometry.Point>)} Array of points
-     * separator - {String} character between coordinate pairs. Defaults to ","
-     * 
-     * Returns:
-     * {Object} hash with properties "path" (the string created from the
-     *     components and "complete" (false if the renderer was unable to
-     *     draw all components)
+     * geometry - {<OpenLayers.Geometry>}
+     * featureId - {String}
      */
      */
-    getComponentsString: function(components, separator) {
-        var renderCmp = [];
-        var complete = true;
-        var len = components.length;
-        var strings = [];
-        var str, component;
-        for(var i=0; i<len; i++) {
-            component = components[i];
-            renderCmp.push(component);
-            str = this.getShortString(component);
-            if (str) {
-                strings.push(str);
-            } else {
-                // The current component is outside the valid range. Let's
-                // see if the previous or next component is inside the range.
-                // If so, add the coordinate of the intersection with the
-                // valid range bounds.
-                if (i > 0) {
-                    if (this.getShortString(components[i - 1])) {
-                        strings.push(this.clipLine(components[i],
-                            components[i-1]));
-                    }
+    eraseGeometry: function(geometry, featureId) {
+        if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
+            (geometry.CLASS_NAME == "OpenLayers.Geometry.MultiLineString") ||
+            (geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPolygon") ||
+            (geometry.CLASS_NAME == "OpenLayers.Geometry.Collection")) {
+            for (var i=0, len=geometry.components.length; i<len; i++) {
+                this.eraseGeometry(geometry.components[i], featureId);
+            }
+        } else {    
+            var element = OpenLayers.Util.getElement(geometry.id);
+            if (element && element.parentNode) {
+                if (element.geometry) {
+                    element.geometry.destroy();
+                    element.geometry = null;
                 }
                 }
-                if (i < len - 1) {
-                    if (this.getShortString(components[i + 1])) {
-                        strings.push(this.clipLine(components[i],
-                            components[i+1]));
+                element.parentNode.removeChild(element);
+
+                if (this.indexer) {
+                    this.indexer.remove(element);
+                }
+                
+                if (element._style.backgroundGraphic) {
+                    var backgroundId = geometry.id + this.BACKGROUND_ID_SUFFIX;
+                    var bElem = OpenLayers.Util.getElement(backgroundId);
+                    if (bElem && bElem.parentNode) {
+                        // No need to destroy the geometry since the element and the background
+                        // node share the same geometry.
+                        bElem.parentNode.removeChild(bElem);
                     }
                 }
                     }
                 }
-                complete = false;
             }
         }
             }
         }
-
-        return {
-            path: strings.join(separator || ","),
-            complete: complete
-        };
-    },
-    
-    /**
-     * Method: clipLine
-     * Given two points (one inside the valid range, and one outside),
-     * clips the line betweeen the two points so that the new points are both
-     * inside the valid range.
-     * 
-     * Parameters:
-     * badComponent - {<OpenLayers.Geometry.Point>} original geometry of the
-     *     invalid point
-     * goodComponent - {<OpenLayers.Geometry.Point>} original geometry of the
-     *     valid point
-     * Returns
-     * {String} the SVG coordinate pair of the clipped point (like
-     *     getShortString), or an empty string if both passed componets are at
-     *     the same point.
-     */
-    clipLine: function(badComponent, goodComponent) {
-        if (goodComponent.equals(badComponent)) {
-            return "";
-        }
-        var resolution = this.getResolution();
-        var maxX = this.MAX_PIXEL - this.translationParameters.x;
-        var maxY = this.MAX_PIXEL - this.translationParameters.y;
-        var x1 = (goodComponent.x - this.featureDx) / resolution + this.left;
-        var y1 = this.top - goodComponent.y / resolution;
-        var x2 = (badComponent.x - this.featureDx) / resolution + this.left;
-        var y2 = this.top - badComponent.y / resolution;
-        var k;
-        if (x2 < -maxX || x2 > maxX) {
-            k = (y2 - y1) / (x2 - x1);
-            x2 = x2 < 0 ? -maxX : maxX;
-            y2 = y1 + (x2 - x1) * k;
-        }
-        if (y2 < -maxY || y2 > maxY) {
-            k = (x2 - x1) / (y2 - y1);
-            y2 = y2 < 0 ? -maxY : maxY;
-            x2 = x1 + (y2 - y1) * k;
-        }
-        return x2 + "," + y2;
     },
 
     /** 
     },
 
     /** 
-     * Method: getShortString
+     * Method: nodeFactory
+     * Create new node of the specified type, with the (optional) specified id.
+     * 
+     * If node already exists with same ID and a different type, we remove it
+     *     and then call ourselves again to recreate it.
      * 
      * Parameters:
      * 
      * Parameters:
-     * point - {<OpenLayers.Geometry.Point>}
+     * id - {String}
+     * type - {String} type Kind of node to draw.
      * 
      * Returns:
      * 
      * Returns:
-     * {String} or false if point is outside the valid range
+     * {DOMElement} A new node of the given type and id.
      */
      */
-    getShortString: function(point) {
-        var resolution = this.getResolution();
-        var x = ((point.x - this.featureDx) / resolution + this.left);
-        var y = (this.top - point.y / resolution);
-
-        if (this.inValidRange(x, y)) { 
-            return x + "," + y;
+    nodeFactory: function(id, type) {
+        var node = OpenLayers.Util.getElement(id);
+        if (node) {
+            if (!this.nodeTypeCompare(node, type)) {
+                node.parentNode.removeChild(node);
+                node = this.nodeFactory(id, type);
+            }
         } else {
         } else {
-            return false;
+            node = this.createNode(type, id);
         }
         }
+        return node;
     },
     },
-    
-    /**
-     * Method: getPosition
-     * Finds the position of an svg node.
+    
+    /** 
+     * Method: nodeTypeCompare
      * 
      * Parameters:
      * node - {DOMElement}
      * 
      * Parameters:
      * node - {DOMElement}
+     * type - {String} Kind of node
      * 
      * Returns:
      * 
      * Returns:
-     * {Object} hash with x and y properties, representing the coordinates
-     *     within the svg coordinate system
+     * {Boolean} Whether or not the specified node is of the specified type
+     *     This function must be overridden by subclasses.
      */
      */
-    getPosition: function(node) {
-        return({
-            x: parseFloat(node.getAttributeNS(null, "cx")),
-            y: parseFloat(node.getAttributeNS(null, "cy"))
-        });
-    },
-
-    /**
-     * Method: importSymbol
-     * add a new symbol definition from the rendererer's symbol hash
+    nodeTypeCompare: function(node, type) {},
+    
+    /** 
+     * Method: createNode
      * 
      * Parameters:
      * 
      * Parameters:
-     * graphicName - {String} name of the symbol to import
+     * type - {String} Kind of node to draw.
+     * id - {String} Id for node.
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement} - the imported symbol
-     */      
-    importSymbol: function (graphicName)  {
-        if (!this.defs) {
-            // create svg defs tag
-            this.defs = this.createDefs();
-        }
-        var id = this.container.id + "-" + graphicName;
-        
-        // check if symbol already exists in the defs
-        var existing = document.getElementById(id);
-        if (existing != null) {
-            return existing;
-        }
-        
-        var symbol = OpenLayers.Renderer.symbol[graphicName];
-        if (!symbol) {
-            throw new Error(graphicName + ' is not a valid symbol name');
-        }
-
-        var symbolNode = this.nodeFactory(id, "symbol");
-        var node = this.nodeFactory(null, "polygon");
-        symbolNode.appendChild(node);
-        var symbolExtent = new OpenLayers.Bounds(
-                                    Number.MAX_VALUE, Number.MAX_VALUE, 0, 0);
+     * {DOMElement} A new node of the given type and id.
+     *     This function must be overridden by subclasses.
+     */
+    createNode: function(type, id) {},
 
 
-        var points = [];
-        var x,y;
-        for (var i=0; i<symbol.length; i=i+2) {
-            x = symbol[i];
-            y = symbol[i+1];
-            symbolExtent.left = Math.min(symbolExtent.left, x);
-            symbolExtent.bottom = Math.min(symbolExtent.bottom, y);
-            symbolExtent.right = Math.max(symbolExtent.right, x);
-            symbolExtent.top = Math.max(symbolExtent.top, y);
-            points.push(x, ",", y);
+    /**
+     * Method: moveRoot
+     * moves this renderer's root to a different renderer.
+     * 
+     * Parameters:
+     * renderer - {<OpenLayers.Renderer>} target renderer for the moved root
+     */
+    moveRoot: function(renderer) {
+        var root = this.root;
+        if(renderer.root.parentNode == this.rendererRoot) {
+            root = renderer.root;
         }
         }
-        
-        node.setAttributeNS(null, "points", points.join(" "));
-        
-        var width = symbolExtent.getWidth();
-        var height = symbolExtent.getHeight();
-        // create a viewBox three times as large as the symbol itself,
-        // to allow for strokeWidth being displayed correctly at the corners.
-        var viewBox = [symbolExtent.left - width,
-                        symbolExtent.bottom - height, width * 3, height * 3];
-        symbolNode.setAttributeNS(null, "viewBox", viewBox.join(" "));
-        this.symbolMetrics[id] = [
-            Math.max(width, height),
-            symbolExtent.getCenterLonLat().lon,
-            symbolExtent.getCenterLonLat().lat
-        ];
-        
-        this.defs.appendChild(symbolNode);
-        return symbolNode;
+        root.parentNode.removeChild(root);
+        renderer.rendererRoot.appendChild(root);
     },
     
     /**
     },
     
     /**
-     * Method: getFeatureIdFromEvent
+     * Method: getRenderLayerId
+     * Gets the layer that this renderer's output appears on. If moveRoot was
+     * used, this will be different from the id of the layer containing the
+     * features rendered by this renderer.
      * 
      * 
-     * Parameters:
-     * evt - {Object} An <OpenLayers.Event> object
-     *
      * Returns:
      * Returns:
-     * {String} A feature id or undefined.
+     * {String} the id of the output layer.
      */
      */
-    getFeatureIdFromEvent: function(evt) {
-        var featureId = OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this, arguments);
-        if(!featureId) {
-            var target = evt.target;
-            featureId = target.parentNode && target != this.rendererRoot ?
-                target.parentNode._featureId : undefined;
-        }
-        return featureId;
+    getRenderLayerId: function() {
+        return this.root.parentNode.parentNode.id;
+    },
+    
+    /**
+     * Method: isComplexSymbol
+     * Determines if a symbol cannot be rendered using drawCircle
+     * 
+     * Parameters:
+     * graphicName - {String}
+     * 
+     * Returns
+     * {Boolean} true if the symbol is complex, false if not
+     */
+    isComplexSymbol: function(graphicName) {
+        return (graphicName != "circle") && !!graphicName;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Renderer.SVG"
+    CLASS_NAME: "OpenLayers.Renderer.Elements"
 });
 
 });
 
-/**
- * Constant: OpenLayers.Renderer.SVG.LABEL_ALIGN
- * {Object}
- */
-OpenLayers.Renderer.SVG.LABEL_ALIGN = {
-    "l": "start",
-    "r": "end",
-    "b": "bottom",
-    "t": "hanging"
-};
-
-/**
- * Constant: OpenLayers.Renderer.SVG.LABEL_VSHIFT
- * {Object}
- */
-OpenLayers.Renderer.SVG.LABEL_VSHIFT = {
-    // according to
-    // http://www.w3.org/Graphics/SVG/Test/20061213/htmlObjectHarness/full-text-align-02-b.html
-    // a baseline-shift of -70% shifts the text exactly from the
-    // bottom to the top of the baseline, so -35% moves the text to
-    // the center of the baseline.
-    "t": "-70%",
-    "b": "0"    
-};
-
-/**
- * Constant: OpenLayers.Renderer.SVG.LABEL_VFACTOR
- * {Object}
- */
-OpenLayers.Renderer.SVG.LABEL_VFACTOR = {
-    "t": 0,
-    "b": -1
-};
-
-/**
- * Function: OpenLayers.Renderer.SVG.preventDefault
- * *Deprecated*.  Use <OpenLayers.Event.preventDefault> method instead.
- * Used to prevent default events (especially opening images in a new tab on
- * ctrl-click) from being executed for externalGraphic symbols
- */
-OpenLayers.Renderer.SVG.preventDefault = function(e) {
-    OpenLayers.Event.preventDefault(e);
-};
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Control/PanZoom.js
+    OpenLayers/Renderer/SVG.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-
 /**
 /**
- * @requires OpenLayers/Control.js
- * @requires OpenLayers/Events/buttonclick.js
+ * @requires OpenLayers/Renderer/Elements.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Control.PanZoom
- * The PanZoom is a visible control, composed of a
- * <OpenLayers.Control.PanPanel> and a <OpenLayers.Control.ZoomPanel>. By
- * default it is drawn in the upper left corner of the map.
- *
- * Inherits from:
- *  - <OpenLayers.Control>
+ * Class: OpenLayers.Renderer.SVG
+ * 
+ * Inherits:
+ *  - <OpenLayers.Renderer.Elements>
  */
  */
-OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, {
+OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
 
     /** 
 
     /** 
-     * APIProperty: slideFactor
-     * {Integer} Number of pixels by which we'll pan the map in any direction 
-     *     on clicking the arrow buttons.  If you want to pan by some ratio
-     *     of the map dimensions, use <slideRatio> instead.
+     * Property: xmlns
+     * {String}
      */
      */
-    slideFactor: 50,
+    xmlns: "http://www.w3.org/2000/svg",
+    
+    /**
+     * Property: xlinkns
+     * {String}
+     */
+    xlinkns: "http://www.w3.org/1999/xlink",
 
 
-    /** 
-     * APIProperty: slideRatio
-     * {Number} The fraction of map width/height by which we'll pan the map            
-     *     on clicking the arrow buttons.  Default is null.  If set, will
-     *     override <slideFactor>. E.g. if slideRatio is .5, then the Pan Up
-     *     button will pan up half the map height. 
+    /**
+     * Constant: MAX_PIXEL
+     * {Integer} Firefox has a limitation where values larger or smaller than  
+     *           about 15000 in an SVG document lock the browser up. This 
+     *           works around it.
      */
      */
-    slideRatio: null,
+    MAX_PIXEL: 15000,
 
 
-    /** 
-     * Property: buttons
-     * {Array(DOMElement)} Array of Button Divs 
+    /**
+     * Property: translationParameters
+     * {Object} Hash with "x" and "y" properties
      */
      */
-    buttons: null,
+    translationParameters: null,
+    
+    /**
+     * Property: symbolMetrics
+     * {Object} Cache for symbol metrics according to their svg coordinate
+     *     space. This is an object keyed by the symbol's id, and values are
+     *     an array of [width, centerX, centerY].
+     */
+    symbolMetrics: null,
+    
+    /**
+     * Constructor: OpenLayers.Renderer.SVG
+     * 
+     * Parameters:
+     * containerID - {String}
+     */
+    initialize: function(containerID) {
+        if (!this.supported()) { 
+            return; 
+        }
+        OpenLayers.Renderer.Elements.prototype.initialize.apply(this, 
+                                                                arguments);
+        this.translationParameters = {x: 0, y: 0};
+        
+        this.symbolMetrics = {};
+    },
 
 
-    /** 
-     * Property: position
-     * {<OpenLayers.Pixel>} 
+    /**
+     * APIMethod: supported
+     * 
+     * Returns:
+     * {Boolean} Whether or not the browser supports the SVG renderer
      */
      */
-    position: null,
+    supported: function() {
+        var svgFeature = "http://www.w3.org/TR/SVG11/feature#";
+        return (document.implementation && 
+           (document.implementation.hasFeature("org.w3c.svg", "1.0") || 
+            document.implementation.hasFeature(svgFeature + "SVG", "1.1") || 
+            document.implementation.hasFeature(svgFeature + "BasicStructure", "1.1") ));
+    },    
 
     /**
 
     /**
-     * Constructor: OpenLayers.Control.PanZoom
+     * Method: inValidRange
+     * See #669 for more information
+     *
+     * Parameters:
+     * x      - {Integer}
+     * y      - {Integer}
+     * xyOnly - {Boolean} whether or not to just check for x and y, which means
+     *     to not take the current translation parameters into account if true.
+     * 
+     * Returns:
+     * {Boolean} Whether or not the 'x' and 'y' coordinates are in the  
+     *           valid range.
+     */ 
+    inValidRange: function(x, y, xyOnly) {
+        var left = x + (xyOnly ? 0 : this.translationParameters.x);
+        var top = y + (xyOnly ? 0 : this.translationParameters.y);
+        return (left >= -this.MAX_PIXEL && left <= this.MAX_PIXEL &&
+                top >= -this.MAX_PIXEL && top <= this.MAX_PIXEL);
+    },
+
+    /**
+     * Method: setExtent
      * 
      * Parameters:
      * 
      * Parameters:
-     * options - {Object}
+     * extent - {<OpenLayers.Bounds>}
+     * resolutionChanged - {Boolean}
+     * 
+     * Returns:
+     * {Boolean} true to notify the layer that the new extent does not exceed
+     *     the coordinate range, and the features will not need to be redrawn.
+     *     False otherwise.
      */
      */
-    initialize: function(options) {
-        this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,
-                                             OpenLayers.Control.PanZoom.Y);
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
+    setExtent: function(extent, resolutionChanged) {
+        var coordSysUnchanged = OpenLayers.Renderer.Elements.prototype.setExtent.apply(this, arguments);
+        
+        var resolution = this.getResolution(),
+            left = -extent.left / resolution,
+            top = extent.top / resolution;
+
+        // If the resolution has changed, start over changing the corner, because
+        // the features will redraw.
+        if (resolutionChanged) {
+            this.left = left;
+            this.top = top;
+            // Set the viewbox
+            var extentString = "0 0 " + this.size.w + " " + this.size.h;
+
+            this.rendererRoot.setAttributeNS(null, "viewBox", extentString);
+            this.translate(this.xOffset, 0);
+            return true;
+        } else {
+            var inRange = this.translate(left - this.left + this.xOffset, top - this.top);
+            if (!inRange) {
+                // recenter the coordinate system
+                this.setExtent(extent, true);
+            }
+            return coordSysUnchanged && inRange;
+        }
+    },
+    
+    /**
+     * Method: translate
+     * Transforms the SVG coordinate system
+     * 
+     * Parameters:
+     * x - {Float}
+     * y - {Float}
+     * 
+     * Returns:
+     * {Boolean} true if the translation parameters are in the valid coordinates
+     *     range, false otherwise.
+     */
+    translate: function(x, y) {
+        if (!this.inValidRange(x, y, true)) {
+            return false;
+        } else {
+            var transformString = "";
+            if (x || y) {
+                transformString = "translate(" + x + "," + y + ")";
+            }
+            this.root.setAttributeNS(null, "transform", transformString);
+            this.translationParameters = {x: x, y: y};
+            return true;
+        }
+    },
+
+    /**
+     * Method: setSize
+     * Sets the size of the drawing surface.
+     * 
+     * Parameters:
+     * size - {<OpenLayers.Size>} The size of the drawing surface
+     */
+    setSize: function(size) {
+        OpenLayers.Renderer.prototype.setSize.apply(this, arguments);
+        
+        this.rendererRoot.setAttributeNS(null, "width", this.size.w);
+        this.rendererRoot.setAttributeNS(null, "height", this.size.h);
+    },
+
+    /** 
+     * Method: getNodeType 
+     * 
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>}
+     * style - {Object}
+     * 
+     * Returns:
+     * {String} The corresponding node type for the specified geometry
+     */
+    getNodeType: function(geometry, style) {
+        var nodeType = null;
+        switch (geometry.CLASS_NAME) {
+            case "OpenLayers.Geometry.Point":
+                if (style.externalGraphic) {
+                    nodeType = "image";
+                } else if (this.isComplexSymbol(style.graphicName)) {
+                    nodeType = "svg";
+                } else {
+                    nodeType = "circle";
+                }
+                break;
+            case "OpenLayers.Geometry.Rectangle":
+                nodeType = "rect";
+                break;
+            case "OpenLayers.Geometry.LineString":
+                nodeType = "polyline";
+                break;
+            case "OpenLayers.Geometry.LinearRing":
+                nodeType = "polygon";
+                break;
+            case "OpenLayers.Geometry.Polygon":
+            case "OpenLayers.Geometry.Curve":
+                nodeType = "path";
+                break;
+            default:
+                break;
+        }
+        return nodeType;
     },
 
     },
 
-    /**
-     * APIMethod: destroy
-     */
-    destroy: function() {
-        if (this.map) {
-            this.map.events.unregister("buttonclick", this, this.onButtonClick);
+    /** 
+     * Method: setStyle
+     * Use to set all the style attributes to a SVG node.
+     * 
+     * Takes care to adjust stroke width and point radius to be
+     * resolution-relative
+     *
+     * Parameters:
+     * node - {SVGDomElement} An SVG element to decorate
+     * style - {Object}
+     * options - {Object} Currently supported options include 
+     *                              'isFilled' {Boolean} and
+     *                              'isStroked' {Boolean}
+     */
+    setStyle: function(node, style, options) {
+        style = style  || node._style;
+        options = options || node._options;
+
+        var title = style.title || style.graphicTitle;
+        if (title) {
+            node.setAttributeNS(null, "title", title);
+            //Standards-conformant SVG
+            // Prevent duplicate nodes. See issue https://github.com/openlayers/ol2/issues/92 
+            var titleNode = node.getElementsByTagName("title");
+            if (titleNode.length > 0) {
+                titleNode[0].firstChild.textContent = title;
+            } else {
+                var label = this.nodeFactory(null, "title");
+                label.textContent = title;
+                node.appendChild(label);
+            }
+        }
+
+        var r = parseFloat(node.getAttributeNS(null, "r"));
+        var widthFactor = 1;
+        var pos;
+        if (node._geometryClass == "OpenLayers.Geometry.Point" && r) {
+            node.style.visibility = "";
+            if (style.graphic === false) {
+                node.style.visibility = "hidden";
+            } else if (style.externalGraphic) {
+                pos = this.getPosition(node);
+                if (style.graphicWidth && style.graphicHeight) {
+                  node.setAttributeNS(null, "preserveAspectRatio", "none");
+                }
+                var width = style.graphicWidth || style.graphicHeight;
+                var height = style.graphicHeight || style.graphicWidth;
+                width = width ? width : style.pointRadius*2;
+                height = height ? height : style.pointRadius*2;
+                var xOffset = (style.graphicXOffset != undefined) ?
+                    style.graphicXOffset : -(0.5 * width);
+                var yOffset = (style.graphicYOffset != undefined) ?
+                    style.graphicYOffset : -(0.5 * height);
+
+                var opacity = style.graphicOpacity || style.fillOpacity;
+                
+                node.setAttributeNS(null, "x", (pos.x + xOffset).toFixed());
+                node.setAttributeNS(null, "y", (pos.y + yOffset).toFixed());
+                node.setAttributeNS(null, "width", width);
+                node.setAttributeNS(null, "height", height);
+                node.setAttributeNS(this.xlinkns, "xlink:href", style.externalGraphic);
+                node.setAttributeNS(null, "style", "opacity: "+opacity);
+                node.onclick = OpenLayers.Event.preventDefault;
+            } else if (this.isComplexSymbol(style.graphicName)) {
+                // the symbol viewBox is three times as large as the symbol
+                var offset = style.pointRadius * 3;
+                var size = offset * 2;
+                var src = this.importSymbol(style.graphicName);
+                pos = this.getPosition(node);
+                widthFactor = this.symbolMetrics[src.id][0] * 3 / size;
+                
+                // remove the node from the dom before we modify it. This
+                // prevents various rendering issues in Safari and FF
+                var parent = node.parentNode;
+                var nextSibling = node.nextSibling;
+                if(parent) {
+                    parent.removeChild(node);
+                }
+                
+                // The more appropriate way to implement this would be use/defs,
+                // but due to various issues in several browsers, it is safer to
+                // copy the symbols instead of referencing them. 
+                // See e.g. ticket http://trac.osgeo.org/openlayers/ticket/2985 
+                // and this email thread
+                // http://osgeo-org.1803224.n2.nabble.com/Select-Control-Ctrl-click-on-Feature-with-a-graphicName-opens-new-browser-window-tc5846039.html
+                node.firstChild && node.removeChild(node.firstChild);
+                node.appendChild(src.firstChild.cloneNode(true));
+                node.setAttributeNS(null, "viewBox", src.getAttributeNS(null, "viewBox"));
+                
+                node.setAttributeNS(null, "width", size);
+                node.setAttributeNS(null, "height", size);
+                node.setAttributeNS(null, "x", pos.x - offset);
+                node.setAttributeNS(null, "y", pos.y - offset);
+                
+                // now that the node has all its new properties, insert it
+                // back into the dom where it was
+                if(nextSibling) {
+                    parent.insertBefore(node, nextSibling);
+                } else if(parent) {
+                    parent.appendChild(node);
+                }
+            } else {
+                node.setAttributeNS(null, "r", style.pointRadius);
+            }
+
+            var rotation = style.rotation;
+            
+            if ((rotation !== undefined || node._rotation !== undefined) && pos) {
+                node._rotation = rotation;
+                rotation |= 0;
+                if (node.nodeName !== "svg") { 
+                    node.setAttributeNS(null, "transform", 
+                        "rotate(" + rotation + " " + pos.x + " " + 
+                        pos.y + ")"); 
+                } else {
+                    var metrics = this.symbolMetrics[src.id];
+                    node.firstChild.setAttributeNS(null, "transform", "rotate(" 
+                        + rotation + " " 
+                        + metrics[1] + " "
+                        + metrics[2] + ")");
+                }
+            }
+        }
+        
+        if (options.isFilled) {
+            node.setAttributeNS(null, "fill", style.fillColor);
+            node.setAttributeNS(null, "fill-opacity", style.fillOpacity);
+        } else {
+            node.setAttributeNS(null, "fill", "none");
         }
         }
-        this.removeButtons();
-        this.buttons = null;
-        this.position = null;
-        OpenLayers.Control.prototype.destroy.apply(this, arguments);
-    },
 
 
-    /** 
-     * Method: setMap
-     *
-     * Properties:
-     * map - {<OpenLayers.Map>} 
-     */
-    setMap: function(map) {
-        OpenLayers.Control.prototype.setMap.apply(this, arguments);
-        this.map.events.register("buttonclick", this, this.onButtonClick);
+        if (options.isStroked) {
+            node.setAttributeNS(null, "stroke", style.strokeColor);
+            node.setAttributeNS(null, "stroke-opacity", style.strokeOpacity);
+            node.setAttributeNS(null, "stroke-width", style.strokeWidth * widthFactor);
+            node.setAttributeNS(null, "stroke-linecap", style.strokeLinecap || "round");
+            // Hard-coded linejoin for now, to make it look the same as in VML.
+            // There is no strokeLinejoin property yet for symbolizers.
+            node.setAttributeNS(null, "stroke-linejoin", "round");
+            style.strokeDashstyle && node.setAttributeNS(null,
+                "stroke-dasharray", this.dashStyle(style, widthFactor));
+        } else {
+            node.setAttributeNS(null, "stroke", "none");
+        }
+        
+        if (style.pointerEvents) {
+            node.setAttributeNS(null, "pointer-events", style.pointerEvents);
+        }
+                
+        if (style.cursor != null) {
+            node.setAttributeNS(null, "cursor", style.cursor);
+        }
+        
+        return node;
     },
 
     },
 
-    /**
-     * Method: draw
-     *
+    /** 
+     * Method: dashStyle
+     * 
      * Parameters:
      * Parameters:
-     * px - {<OpenLayers.Pixel>} 
+     * style - {Object}
+     * widthFactor - {Number}
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement} A reference to the container div for the PanZoom control.
+     * {String} A SVG compliant 'stroke-dasharray' value
      */
      */
-    draw: function(px) {
-        // initialize our internal div
-        OpenLayers.Control.prototype.draw.apply(this, arguments);
-        px = this.position;
-
-        // place the controls
-        this.buttons = [];
-
-        var sz = {w: 18, h: 18};
-        var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
-
-        this._addButton("panup", "north-mini.png", centered, sz);
-        px.y = centered.y+sz.h;
-        this._addButton("panleft", "west-mini.png", px, sz);
-        this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz);
-        this._addButton("pandown", "south-mini.png", 
-                        centered.add(0, sz.h*2), sz);
-        this._addButton("zoomin", "zoom-plus-mini.png", 
-                        centered.add(0, sz.h*3+5), sz);
-        this._addButton("zoomworld", "zoom-world-mini.png", 
-                        centered.add(0, sz.h*4+5), sz);
-        this._addButton("zoomout", "zoom-minus-mini.png", 
-                        centered.add(0, sz.h*5+5), sz);
-        return this.div;
+    dashStyle: function(style, widthFactor) {
+        var w = style.strokeWidth * widthFactor;
+        var str = style.strokeDashstyle;
+        switch (str) {
+            case 'solid':
+                return 'none';
+            case 'dot':
+                return [1, 4 * w].join();
+            case 'dash':
+                return [4 * w, 4 * w].join();
+            case 'dashdot':
+                return [4 * w, 4 * w, 1, 4 * w].join();
+            case 'longdash':
+                return [8 * w, 4 * w].join();
+            case 'longdashdot':
+                return [8 * w, 4 * w, 1, 4 * w].join();
+            default:
+                return OpenLayers.String.trim(str).replace(/\s+/g, ",");
+        }
     },
     
     },
     
-    /**
-     * Method: _addButton
+    /** 
+     * Method: createNode
      * 
      * Parameters:
      * 
      * Parameters:
-     * id - {String} 
-     * img - {String} 
-     * xy - {<OpenLayers.Pixel>} 
-     * sz - {<OpenLayers.Size>} 
+     * type - {String} Kind of node to draw
+     * id - {String} Id for node
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement} A Div (an alphaImageDiv, to be precise) that contains the
-     *     image of the button, and has all the proper event handlers set.
+     * {DOMElement} A new node of the given type and id
      */
      */
-    _addButton:function(id, img, xy, sz) {
-        var imgLocation = OpenLayers.Util.getImageLocation(img);
-        var btn = OpenLayers.Util.createAlphaImageDiv(
-                                    this.id + "_" + id, 
-                                    xy, sz, imgLocation, "absolute");
-        btn.style.cursor = "pointer";
-        //we want to add the outer div
-        this.div.appendChild(btn);
-        btn.action = id;
-        btn.className = "olButton";
-    
-        //we want to remember/reference the outer div
-        this.buttons.push(btn);
-        return btn;
+    createNode: function(type, id) {
+        var node = document.createElementNS(this.xmlns, type);
+        if (id) {
+            node.setAttributeNS(null, "id", id);
+        }
+        return node;    
     },
     
     },
     
-    /**
-     * Method: _removeButton
+    /** 
+     * Method: nodeTypeCompare
      * 
      * Parameters:
      * 
      * Parameters:
-     * btn - {Object}
+     * node - {SVGDomElement} An SVG element
+     * type - {String} Kind of node
+     * 
+     * Returns:
+     * {Boolean} Whether or not the specified node is of the specified type
      */
      */
-    _removeButton: function(btn) {
-        this.div.removeChild(btn);
-        OpenLayers.Util.removeItem(this.buttons, btn);
+    nodeTypeCompare: function(node, type) {
+        return (type == node.nodeName);
     },
     },
-    
+   
     /**
     /**
-     * Method: removeButtons
+     * Method: createRenderRoot
+     * 
+     * Returns:
+     * {DOMElement} The specific render engine's root element
      */
      */
-    removeButtons: function() {
-        for(var i=this.buttons.length-1; i>=0; --i) {
-            this._removeButton(this.buttons[i]);
-        }
+    createRenderRoot: function() {
+        var svg = this.nodeFactory(this.container.id + "_svgRoot", "svg");
+        svg.style.display = "block";
+        return svg;
     },
     },
-    
+
     /**
     /**
-     * Method: onButtonClick
-     *
+     * Method: createRoot
+     * 
      * Parameters:
      * Parameters:
-     * evt - {Event}
+     * suffix - {String} suffix to append to the id
+     * 
+     * Returns:
+     * {DOMElement}
      */
      */
-    onButtonClick: function(evt) {
-        var btn = evt.buttonElement;
-        switch (btn.action) {
-            case "panup": 
-                this.map.pan(0, -this.getSlideFactor("h"));
-                break;
-            case "pandown": 
-                this.map.pan(0, this.getSlideFactor("h"));
-                break;
-            case "panleft": 
-                this.map.pan(-this.getSlideFactor("w"), 0);
-                break;
-            case "panright": 
-                this.map.pan(this.getSlideFactor("w"), 0);
-                break;
-            case "zoomin": 
-                this.map.zoomIn(); 
-                break;
-            case "zoomout": 
-                this.map.zoomOut(); 
-                break;
-            case "zoomworld": 
-                this.map.zoomToMaxExtent(); 
-                break;
-        }
+    createRoot: function(suffix) {
+        return this.nodeFactory(this.container.id + suffix, "g");
     },
     },
-    
+
     /**
     /**
-     * Method: getSlideFactor
-     *
-     * Parameters:
-     * dim - {String} "w" or "h" (for width or height).
+     * Method: createDefs
      *
      * Returns:
      *
      * Returns:
-     * {Number} The slide factor for panning in the requested direction.
+     * {DOMElement} The element to which we'll add the symbol definitions
      */
      */
-    getSlideFactor: function(dim) {
-        return this.slideRatio ?
-            this.map.getSize()[dim] * this.slideRatio :
-            this.slideFactor;
+    createDefs: function() {
+        var defs = this.nodeFactory(this.container.id + "_defs", "defs");
+        this.rendererRoot.appendChild(defs);
+        return defs;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Control.PanZoom"
-});
-
-/**
- * Constant: X
- * {Integer}
- */
-OpenLayers.Control.PanZoom.X = 4;
-
-/**
- * Constant: Y
- * {Integer}
- */
-OpenLayers.Control.PanZoom.Y = 4;
-/* ======================================================================
-    OpenLayers/Icon.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/BaseTypes/Class.js
- */
-
-/**
- * Class: OpenLayers.Icon
- * 
- * The icon represents a graphical icon on the screen.  Typically used in
- * conjunction with a <OpenLayers.Marker> to represent markers on a screen.
- *
- * An icon has a url, size and position.  It also contains an offset which 
- * allows the center point to be represented correctly.  This can be
- * provided either as a fixed offset or a function provided to calculate
- * the desired offset. 
- * 
- */
-OpenLayers.Icon = OpenLayers.Class({
-    
-    /** 
-     * Property: url 
-     * {String}  image url
-     */
-    url: null,
-    
-    /** 
-     * Property: size 
-     * {<OpenLayers.Size>|Object} An OpenLayers.Size or
-     * an object with a 'w' and 'h' properties.
-     */
-    size: null,
-
-    /** 
-     * Property: offset 
-     * {<OpenLayers.Pixel>|Object} distance in pixels to offset the
-     * image when being rendered. An OpenLayers.Pixel or an object
-     * with a 'x' and 'y' properties.
-     */
-    offset: null,    
-    
-    /** 
-     * Property: calculateOffset 
-     * {Function} Function to calculate the offset (based on the size)
-     */
-    calculateOffset: null,    
-    
-    /** 
-     * Property: imageDiv 
-     * {DOMElement} 
-     */
-    imageDiv: null,
-
-    /** 
-     * Property: px 
-     * {<OpenLayers.Pixel>|Object} An OpenLayers.Pixel or an object
-     * with a 'x' and 'y' properties.
-     */
-    px: null,
-    
-    /** 
-     * Constructor: OpenLayers.Icon
-     * Creates an icon, which is an image tag in a div.  
-     *
-     * url - {String} 
-     * size - {<OpenLayers.Size>|Object} An OpenLayers.Size or an
-     *                                   object with a 'w' and 'h'
-     *                                   properties.
-     * offset - {<OpenLayers.Pixel>|Object} An OpenLayers.Pixel or an
-     *                                      object with a 'x' and 'y'
-     *                                      properties.
-     * calculateOffset - {Function} 
-     */
-    initialize: function(url, size, offset, calculateOffset) {
-        this.url = url;
-        this.size = size || {w: 20, h: 20};
-        this.offset = offset || {x: -(this.size.w/2), y: -(this.size.h/2)};
-        this.calculateOffset = calculateOffset;
-
-        var id = OpenLayers.Util.createUniqueID("OL_Icon_");
-        this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id);
-    },
-    
-    /** 
-     * Method: destroy
-     * Nullify references and remove event listeners to prevent circular 
-     * references and memory leaks
-     */
-    destroy: function() {
-        // erase any drawn elements
-        this.erase();
+    /**************************************
+     *                                    *
+     *     GEOMETRY DRAWING FUNCTIONS     *
+     *                                    *
+     **************************************/
 
 
-        OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild); 
-        this.imageDiv.innerHTML = "";
-        this.imageDiv = null;
+    /**
+     * Method: drawPoint
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or false if the renderer could not draw the point
+     */ 
+    drawPoint: function(node, geometry) {
+        return this.drawCircle(node, geometry, 1);
     },
 
     },
 
-    /** 
-     * Method: clone
+    /**
+     * Method: drawCircle
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * radius - {Float}
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Icon>} A fresh copy of the icon.
+     * {DOMElement} or false if the renderer could not draw the circle
      */
      */
-    clone: function() {
-        return new OpenLayers.Icon(this.url, 
-                                   this.size, 
-                                   this.offset, 
-                                   this.calculateOffset);
+    drawCircle: function(node, geometry, radius) {
+        var resolution = this.getResolution();
+        var x = ((geometry.x - this.featureDx) / resolution + this.left);
+        var y = (this.top - geometry.y / resolution);
+
+        if (this.inValidRange(x, y)) { 
+            node.setAttributeNS(null, "cx", x);
+            node.setAttributeNS(null, "cy", y);
+            node.setAttributeNS(null, "r", radius);
+            return node;
+        } else {
+            return false;
+        }    
+            
     },
     
     /**
     },
     
     /**
-     * Method: setSize
+     * Method: drawLineString
+     * This method is only called by the renderer itself.
      * 
      * 
-     * Parameters:
-     * size - {<OpenLayers.Size>|Object} An OpenLayers.Size or
-     * an object with a 'w' and 'h' properties.
-     */
-    setSize: function(size) {
-        if (size != null) {
-            this.size = size;
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or null if the renderer could not draw all components of
+     *     the linestring, or false if nothing could be drawn
+     */ 
+    drawLineString: function(node, geometry) {
+        var componentsResult = this.getComponentsString(geometry.components);
+        if (componentsResult.path) {
+            node.setAttributeNS(null, "points", componentsResult.path);
+            return (componentsResult.complete ? node : null);  
+        } else {
+            return false;
         }
         }
-        this.draw();
     },
     
     /**
     },
     
     /**
-     * Method: setUrl
+     * Method: drawLinearRing
+     * This method is only called by the renderer itself.
      * 
      * 
-     * Parameters:
-     * url - {String} 
-     */
-    setUrl: function(url) {
-        if (url != null) {
-            this.url = url;
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or null if the renderer could not draw all components
+     *     of the linear ring, or false if nothing could be drawn
+     */ 
+    drawLinearRing: function(node, geometry) {
+        var componentsResult = this.getComponentsString(geometry.components);
+        if (componentsResult.path) {
+            node.setAttributeNS(null, "points", componentsResult.path);
+            return (componentsResult.complete ? node : null);  
+        } else {
+            return false;
         }
         }
-        this.draw();
     },
     },
-
-    /** 
-     * Method: draw
-     * Move the div to the given pixel.
+    
+    /**
+     * Method: drawPolygon
+     * This method is only called by the renderer itself.
      * 
      * 
-     * Parameters:
-     * px - {<OpenLayers.Pixel>|Object} An OpenLayers.Pixel or an
-     *                                  object with a 'x' and 'y' properties.
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement} A new DOM Image of this icon set at the location passed-in
-     */
-    draw: function(px) {
-        OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, 
-                                            null, 
-                                            null, 
-                                            this.size, 
-                                            this.url, 
-                                            "absolute");
-        this.moveTo(px);
-        return this.imageDiv;
-    }, 
-
-    /** 
-     * Method: erase
-     * Erase the underlying image element.
-     */
-    erase: function() {
-        if (this.imageDiv != null && this.imageDiv.parentNode != null) {
-            OpenLayers.Element.remove(this.imageDiv);
-        }
-    }, 
-    
-    /** 
-     * Method: setOpacity
-     * Change the icon's opacity
-     *
-     * Parameters:
-     * opacity - {float} 
-     */
-    setOpacity: function(opacity) {
-        OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null, 
-                                            null, null, null, null, opacity);
-
+     * {DOMElement} or null if the renderer could not draw all components
+     *     of the polygon, or false if nothing could be drawn
+     */ 
+    drawPolygon: function(node, geometry) {
+        var d = "";
+        var draw = true;
+        var complete = true;
+        var linearRingResult, path;
+        for (var j=0, len=geometry.components.length; j<len; j++) {
+            d += " M";
+            linearRingResult = this.getComponentsString(
+                geometry.components[j].components, " ");
+            path = linearRingResult.path;
+            if (path) {
+                d += " " + path;
+                complete = linearRingResult.complete && complete;
+            } else {
+                draw = false;
+            }
+        }
+        d += " z";
+        if (draw) {
+            node.setAttributeNS(null, "d", d);
+            node.setAttributeNS(null, "fill-rule", "evenodd");
+            return complete ? node : null;
+        } else {
+            return false;
+        }    
     },
     
     /**
     },
     
     /**
-     * Method: moveTo
-     * move icon to passed in px.
-     *
-     * Parameters:
-     * px - {<OpenLayers.Pixel>|Object} the pixel position to move to.
-     * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
-     */
-    moveTo: function (px) {
-        //if no px passed in, use stored location
-        if (px != null) {
-            this.px = px;
-        }
+     * Method: drawRectangle
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or false if the renderer could not draw the rectangle
+     */ 
+    drawRectangle: function(node, geometry) {
+        var resolution = this.getResolution();
+        var x = ((geometry.x - this.featureDx) / resolution + this.left);
+        var y = (this.top - geometry.y / resolution);
 
 
-        if (this.imageDiv != null) {
-            if (this.px == null) {
-                this.display(false);
-            } else {
-                if (this.calculateOffset) {
-                    this.offset = this.calculateOffset(this.size);  
-                }
-                OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, {
-                    x: this.px.x + this.offset.x,
-                    y: this.px.y + this.offset.y
-                });
-            }
+        if (this.inValidRange(x, y)) { 
+            node.setAttributeNS(null, "x", x);
+            node.setAttributeNS(null, "y", y);
+            node.setAttributeNS(null, "width", geometry.width / resolution);
+            node.setAttributeNS(null, "height", geometry.height / resolution);
+            return node;
+        } else {
+            return false;
         }
     },
     
         }
     },
     
-    /** 
-     * Method: display
-     * Hide or show the icon
+    /**
+     * Method: drawText
+     * This method is only called by the renderer itself.
      *
      * Parameters:
      *
      * Parameters:
-     * display - {Boolean} 
+     * featureId - {String}
+     * style -
+     * location - {<OpenLayers.Geometry.Point>}
      */
      */
-    display: function(display) {
-        this.imageDiv.style.display = (display) ? "" : "none"; 
-    },
-    
+    drawText: function(featureId, style, location) {
+        var drawOutline = (!!style.labelOutlineWidth);
+        // First draw text in halo color and size and overlay the
+        // normal text afterwards
+        if (drawOutline) {
+            var outlineStyle = OpenLayers.Util.extend({}, style);
+            outlineStyle.fontColor = outlineStyle.labelOutlineColor;
+            outlineStyle.fontStrokeColor = outlineStyle.labelOutlineColor;
+            outlineStyle.fontStrokeWidth = style.labelOutlineWidth;
+            if (style.labelOutlineOpacity) {
+                outlineStyle.fontOpacity = style.labelOutlineOpacity;
+            }
+            delete outlineStyle.labelOutlineWidth;
+            this.drawText(featureId, outlineStyle, location);
+        }
 
 
-    /**
-     * APIMethod: isDrawn
-     * 
-     * Returns:
-     * {Boolean} Whether or not the icon is drawn.
-     */
-    isDrawn: function() {
-        // nodeType 11 for ie, whose nodes *always* have a parentNode
-        // (of type document fragment)
-        var isDrawn = (this.imageDiv && this.imageDiv.parentNode && 
-                       (this.imageDiv.parentNode.nodeType != 11));    
+        var resolution = this.getResolution();
 
 
-        return isDrawn;   
-    },
+        var x = ((location.x - this.featureDx) / resolution + this.left);
+        var y = (location.y / resolution - this.top);
 
 
-    CLASS_NAME: "OpenLayers.Icon"
-});
-/* ======================================================================
-    OpenLayers/Marker.js
-   ====================================================================== */
+        var suffix = (drawOutline)?this.LABEL_OUTLINE_SUFFIX:this.LABEL_ID_SUFFIX;
+        var label = this.nodeFactory(featureId + suffix, "text");
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
+        label.setAttributeNS(null, "x", x);
+        label.setAttributeNS(null, "y", -y);
 
 
+        if (style.fontColor) {
+            label.setAttributeNS(null, "fill", style.fontColor);
+        }
+        if (style.fontStrokeColor) {
+            label.setAttributeNS(null, "stroke", style.fontStrokeColor);
+        }
+        if (style.fontStrokeWidth) {
+            label.setAttributeNS(null, "stroke-width", style.fontStrokeWidth);
+        }
+        if (style.fontOpacity) {
+            label.setAttributeNS(null, "opacity", style.fontOpacity);
+        }
+        if (style.fontFamily) {
+            label.setAttributeNS(null, "font-family", style.fontFamily);
+        }
+        if (style.fontSize) {
+            label.setAttributeNS(null, "font-size", style.fontSize);
+        }
+        if (style.fontWeight) {
+            label.setAttributeNS(null, "font-weight", style.fontWeight);
+        }
+        if (style.fontStyle) {
+            label.setAttributeNS(null, "font-style", style.fontStyle);
+        }
+        if (style.labelSelect === true) {
+            label.setAttributeNS(null, "pointer-events", "visible");
+            label._featureId = featureId;
+        } else {
+            label.setAttributeNS(null, "pointer-events", "none");
+        }
+        var align = style.labelAlign || OpenLayers.Renderer.defaultSymbolizer.labelAlign;
+        label.setAttributeNS(null, "text-anchor",
+            OpenLayers.Renderer.SVG.LABEL_ALIGN[align[0]] || "middle");
 
 
-/**
- * @requires OpenLayers/BaseTypes/Class.js
- * @requires OpenLayers/Events.js
- * @requires OpenLayers/Icon.js
- */
+        if (OpenLayers.IS_GECKO === true) {
+            label.setAttributeNS(null, "dominant-baseline",
+                OpenLayers.Renderer.SVG.LABEL_ALIGN[align[1]] || "central");
+        }
 
 
-/**
- * Class: OpenLayers.Marker
- * Instances of OpenLayers.Marker are a combination of a 
- * <OpenLayers.LonLat> and an <OpenLayers.Icon>.  
- *
- * Markers are generally added to a special layer called
- * <OpenLayers.Layer.Markers>.
- *
- * Example:
- * (code)
- * var markers = new OpenLayers.Layer.Markers( "Markers" );
- * map.addLayer(markers);
- *
- * var size = new OpenLayers.Size(21,25);
- * var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
- * var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png', size, offset);
- * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
- * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone()));
- *
- * (end)
- *
- * Note that if you pass an icon into the Marker constructor, it will take
- * that icon and use it. This means that you should not share icons between
- * markers -- you use them once, but you should clone() for any additional
- * markers using that same icon.
- */
-OpenLayers.Marker = OpenLayers.Class({
-    
-    /** 
-     * Property: icon 
-     * {<OpenLayers.Icon>} The icon used by this marker.
-     */
-    icon: null,
+        var labelRows = style.label.split('\n');
+        var numRows = labelRows.length;
+        while (label.childNodes.length > numRows) {
+            label.removeChild(label.lastChild);
+        }
+        for (var i = 0; i < numRows; i++) {
+            var tspan = this.nodeFactory(featureId + suffix + "_tspan_" + i, "tspan");
+            if (style.labelSelect === true) {
+                tspan._featureId = featureId;
+                tspan._geometry = location;
+                tspan._geometryClass = location.CLASS_NAME;
+            }
+            if (OpenLayers.IS_GECKO === false) {
+                tspan.setAttributeNS(null, "baseline-shift",
+                    OpenLayers.Renderer.SVG.LABEL_VSHIFT[align[1]] || "-35%");
+            }
+            tspan.setAttribute("x", x);
+            if (i == 0) {
+                var vfactor = OpenLayers.Renderer.SVG.LABEL_VFACTOR[align[1]];
+                if (vfactor == null) {
+                     vfactor = -.5;
+                }
+                tspan.setAttribute("dy", (vfactor*(numRows-1)) + "em");
+            } else {
+                tspan.setAttribute("dy", "1em");
+            }
+            tspan.textContent = (labelRows[i] === '') ? ' ' : labelRows[i];
+            if (!tspan.parentNode) {
+                label.appendChild(tspan);
+            }
+        }
 
 
-    /** 
-     * Property: lonlat 
-     * {<OpenLayers.LonLat>} location of object
-     */
-    lonlat: null,
-    
-    /** 
-     * Property: events 
-     * {<OpenLayers.Events>} the event handler.
-     */
-    events: null,
-    
-    /** 
-     * Property: map 
-     * {<OpenLayers.Map>} the map this marker is attached to
-     */
-    map: null,
+        if (!label.parentNode) {
+            this.textRoot.appendChild(label);
+        }
+    },
     
     /** 
     
     /** 
-     * Constructor: OpenLayers.Marker
-     *
+     * Method: getComponentString
+     * 
      * Parameters:
      * Parameters:
-     * lonlat - {<OpenLayers.LonLat>} the position of this marker
-     * icon - {<OpenLayers.Icon>}  the icon for this marker
+     * components - {Array(<OpenLayers.Geometry.Point>)} Array of points
+     * separator - {String} character between coordinate pairs. Defaults to ","
+     * 
+     * Returns:
+     * {Object} hash with properties "path" (the string created from the
+     *     components and "complete" (false if the renderer was unable to
+     *     draw all components)
      */
      */
-    initialize: function(lonlat, icon) {
-        this.lonlat = lonlat;
-        
-        var newIcon = (icon) ? icon : OpenLayers.Marker.defaultIcon();
-        if (this.icon == null) {
-            this.icon = newIcon;
-        } else {
-            this.icon.url = newIcon.url;
-            this.icon.size = newIcon.size;
-            this.icon.offset = newIcon.offset;
-            this.icon.calculateOffset = newIcon.calculateOffset;
+    getComponentsString: function(components, separator) {
+        var renderCmp = [];
+        var complete = true;
+        var len = components.length;
+        var strings = [];
+        var str, component;
+        for(var i=0; i<len; i++) {
+            component = components[i];
+            renderCmp.push(component);
+            str = this.getShortString(component);
+            if (str) {
+                strings.push(str);
+            } else {
+                // The current component is outside the valid range. Let's
+                // see if the previous or next component is inside the range.
+                // If so, add the coordinate of the intersection with the
+                // valid range bounds.
+                if (i > 0) {
+                    if (this.getShortString(components[i - 1])) {
+                        strings.push(this.clipLine(components[i],
+                            components[i-1]));
+                    }
+                }
+                if (i < len - 1) {
+                    if (this.getShortString(components[i + 1])) {
+                        strings.push(this.clipLine(components[i],
+                            components[i+1]));
+                    }
+                }
+                complete = false;
+            }
         }
         }
-        this.events = new OpenLayers.Events(this, this.icon.imageDiv);
+
+        return {
+            path: strings.join(separator || ","),
+            complete: complete
+        };
     },
     
     /**
     },
     
     /**
-     * APIMethod: destroy
-     * Destroy the marker. You must first remove the marker from any 
-     * layer which it has been added to, or you will get buggy behavior.
-     * (This can not be done within the marker since the marker does not
-     * know which layer it is attached to.)
+     * Method: clipLine
+     * Given two points (one inside the valid range, and one outside),
+     * clips the line betweeen the two points so that the new points are both
+     * inside the valid range.
+     * 
+     * Parameters:
+     * badComponent - {<OpenLayers.Geometry.Point>} original geometry of the
+     *     invalid point
+     * goodComponent - {<OpenLayers.Geometry.Point>} original geometry of the
+     *     valid point
+     * Returns
+     * {String} the SVG coordinate pair of the clipped point (like
+     *     getShortString), or an empty string if both passed componets are at
+     *     the same point.
      */
      */
-    destroy: function() {
-        // erase any drawn features
-        this.erase();
-
-        this.map = null;
-
-        this.events.destroy();
-        this.events = null;
-
-        if (this.icon != null) {
-            this.icon.destroy();
-            this.icon = null;
+    clipLine: function(badComponent, goodComponent) {
+        if (goodComponent.equals(badComponent)) {
+            return "";
+        }
+        var resolution = this.getResolution();
+        var maxX = this.MAX_PIXEL - this.translationParameters.x;
+        var maxY = this.MAX_PIXEL - this.translationParameters.y;
+        var x1 = (goodComponent.x - this.featureDx) / resolution + this.left;
+        var y1 = this.top - goodComponent.y / resolution;
+        var x2 = (badComponent.x - this.featureDx) / resolution + this.left;
+        var y2 = this.top - badComponent.y / resolution;
+        var k;
+        if (x2 < -maxX || x2 > maxX) {
+            k = (y2 - y1) / (x2 - x1);
+            x2 = x2 < 0 ? -maxX : maxX;
+            y2 = y1 + (x2 - x1) * k;
+        }
+        if (y2 < -maxY || y2 > maxY) {
+            k = (x2 - x1) / (y2 - y1);
+            y2 = y2 < 0 ? -maxY : maxY;
+            x2 = x1 + (y2 - y1) * k;
         }
         }
+        return x2 + "," + y2;
     },
     },
-    
-    /** 
-    * Method: draw
-    * Calls draw on the icon, and returns that output.
-    * 
-    * Parameters:
-    * px - {<OpenLayers.Pixel>}
-    * 
-    * Returns:
-    * {DOMElement} A new DOM Image with this marker's icon set at the 
-    * location passed-in
-    */
-    draw: function(px) {
-        return this.icon.draw(px);
-    }, 
 
     /** 
 
     /** 
-    * Method: erase
-    * Erases any drawn elements for this marker.
-    */
-    erase: function() {
-        if (this.icon != null) {
-            this.icon.erase();
-        }
-    }, 
+     * Method: getShortString
+     * 
+     * Parameters:
+     * point - {<OpenLayers.Geometry.Point>}
+     * 
+     * Returns:
+     * {String} or false if point is outside the valid range
+     */
+    getShortString: function(point) {
+        var resolution = this.getResolution();
+        var x = ((point.x - this.featureDx) / resolution + this.left);
+        var y = (this.top - point.y / resolution);
 
 
-    /**
-    * Method: moveTo
-    * Move the marker to the new location.
-    *
-    * Parameters:
-    * px - {<OpenLayers.Pixel>|Object} the pixel position to move to.
-    * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
-    */
-    moveTo: function (px) {
-        if ((px != null) && (this.icon != null)) {
-            this.icon.moveTo(px);
-        }           
-        this.lonlat = this.map.getLonLatFromLayerPx(px);
+        if (this.inValidRange(x, y)) { 
+            return x + "," + y;
+        } else {
+            return false;
+        }
     },
     },
-
+    
     /**
     /**
-     * APIMethod: isDrawn
+     * Method: getPosition
+     * Finds the position of an svg node.
+     * 
+     * Parameters:
+     * node - {DOMElement}
      * 
      * Returns:
      * 
      * Returns:
-     * {Boolean} Whether or not the marker is drawn.
+     * {Object} hash with x and y properties, representing the coordinates
+     *     within the svg coordinate system
      */
      */
-    isDrawn: function() {
-        var isDrawn = (this.icon && this.icon.isDrawn());
-        return isDrawn;   
+    getPosition: function(node) {
+        return({
+            x: parseFloat(node.getAttributeNS(null, "cx")),
+            y: parseFloat(node.getAttributeNS(null, "cy"))
+        });
     },
 
     /**
     },
 
     /**
-     * Method: onScreen
-     *
+     * Method: importSymbol
+     * add a new symbol definition from the rendererer's symbol hash
+     * 
+     * Parameters:
+     * graphicName - {String} name of the symbol to import
+     * 
      * Returns:
      * Returns:
-     * {Boolean} Whether or not the marker is currently visible on screen.
-     */
-    onScreen:function() {
+     * {DOMElement} - the imported symbol
+     */      
+    importSymbol: function (graphicName)  {
+        if (!this.defs) {
+            // create svg defs tag
+            this.defs = this.createDefs();
+        }
+        var id = this.container.id + "-" + graphicName;
         
         
-        var onScreen = false;
-        if (this.map) {
-            var screenBounds = this.map.getExtent();
-            onScreen = screenBounds.containsLonLat(this.lonlat);
-        }    
-        return onScreen;
-    },
-    
-    /**
-     * Method: inflate
-     * Englarges the markers icon by the specified ratio.
-     *
-     * Parameters:
-     * inflate - {float} the ratio to enlarge the marker by (passing 2
-     *                   will double the size).
-     */
-    inflate: function(inflate) {
-        if (this.icon) {
-            this.icon.setSize({
-                w: this.icon.size.w * inflate,
-                h: this.icon.size.h * inflate
-            });
-        }        
+        // check if symbol already exists in the defs
+        var existing = document.getElementById(id);
+        if (existing != null) {
+            return existing;
+        }
+        
+        var symbol = OpenLayers.Renderer.symbol[graphicName];
+        if (!symbol) {
+            throw new Error(graphicName + ' is not a valid symbol name');
+        }
+
+        var symbolNode = this.nodeFactory(id, "symbol");
+        var node = this.nodeFactory(null, "polygon");
+        symbolNode.appendChild(node);
+        var symbolExtent = new OpenLayers.Bounds(
+                                    Number.MAX_VALUE, Number.MAX_VALUE, 0, 0);
+
+        var points = [];
+        var x,y;
+        for (var i=0; i<symbol.length; i=i+2) {
+            x = symbol[i];
+            y = symbol[i+1];
+            symbolExtent.left = Math.min(symbolExtent.left, x);
+            symbolExtent.bottom = Math.min(symbolExtent.bottom, y);
+            symbolExtent.right = Math.max(symbolExtent.right, x);
+            symbolExtent.top = Math.max(symbolExtent.top, y);
+            points.push(x, ",", y);
+        }
+        
+        node.setAttributeNS(null, "points", points.join(" "));
+        
+        var width = symbolExtent.getWidth();
+        var height = symbolExtent.getHeight();
+        // create a viewBox three times as large as the symbol itself,
+        // to allow for strokeWidth being displayed correctly at the corners.
+        var viewBox = [symbolExtent.left - width,
+                        symbolExtent.bottom - height, width * 3, height * 3];
+        symbolNode.setAttributeNS(null, "viewBox", viewBox.join(" "));
+        this.symbolMetrics[id] = [
+            Math.max(width, height),
+            symbolExtent.getCenterLonLat().lon,
+            symbolExtent.getCenterLonLat().lat
+        ];
+        
+        this.defs.appendChild(symbolNode);
+        return symbolNode;
     },
     
     },
     
-    /** 
-     * Method: setOpacity
-     * Change the opacity of the marker by changin the opacity of 
-     *   its icon
-     * 
-     * Parameters:
-     * opacity - {float}  Specified as fraction (0.4, etc)
-     */
-    setOpacity: function(opacity) {
-        this.icon.setOpacity(opacity);
-    },
-
     /**
     /**
-     * Method: setUrl
-     * Change URL of the Icon Image.
-     * 
-     * url - {String} 
-     */
-    setUrl: function(url) {
-        this.icon.setUrl(url);
-    },    
-
-    /** 
-     * Method: display
-     * Hide or show the icon
+     * Method: getFeatureIdFromEvent
      * 
      * 
-     * display - {Boolean} 
+     * Parameters:
+     * evt - {Object} An <OpenLayers.Event> object
+     *
+     * Returns:
+     * {String} A feature id or undefined.
      */
      */
-    display: function(display) {
-        this.icon.display(display);
+    getFeatureIdFromEvent: function(evt) {
+        var featureId = OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this, arguments);
+        if(!featureId) {
+            var target = evt.target;
+            featureId = target.parentNode && target != this.rendererRoot ?
+                target.parentNode._featureId : undefined;
+        }
+        return featureId;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Marker"
+    CLASS_NAME: "OpenLayers.Renderer.SVG"
 });
 
 });
 
+/**
+ * Constant: OpenLayers.Renderer.SVG.LABEL_ALIGN
+ * {Object}
+ */
+OpenLayers.Renderer.SVG.LABEL_ALIGN = {
+    "l": "start",
+    "r": "end",
+    "b": "bottom",
+    "t": "hanging"
+};
+
+/**
+ * Constant: OpenLayers.Renderer.SVG.LABEL_VSHIFT
+ * {Object}
+ */
+OpenLayers.Renderer.SVG.LABEL_VSHIFT = {
+    // according to
+    // http://www.w3.org/Graphics/SVG/Test/20061213/htmlObjectHarness/full-text-align-02-b.html
+    // a baseline-shift of -70% shifts the text exactly from the
+    // bottom to the top of the baseline, so -35% moves the text to
+    // the center of the baseline.
+    "t": "-70%",
+    "b": "0"    
+};
 
 /**
 
 /**
- * Function: defaultIcon
- * Creates a default <OpenLayers.Icon>.
- * 
- * Returns:
- * {<OpenLayers.Icon>} A default OpenLayers.Icon to use for a marker
+ * Constant: OpenLayers.Renderer.SVG.LABEL_VFACTOR
+ * {Object}
  */
  */
-OpenLayers.Marker.defaultIcon = function() {
-    return new OpenLayers.Icon(OpenLayers.Util.getImageLocation("marker.png"),
-                               {w: 21, h: 25}, {x: -10.5, y: -25});
+OpenLayers.Renderer.SVG.LABEL_VFACTOR = {
+    "t": 0,
+    "b": -1
 };
 };
-    
 
 
+/**
+ * Function: OpenLayers.Renderer.SVG.preventDefault
+ * *Deprecated*.  Use <OpenLayers.Event.preventDefault> method instead.
+ * Used to prevent default events (especially opening images in a new tab on
+ * ctrl-click) from being executed for externalGraphic symbols
+ */
+OpenLayers.Renderer.SVG.preventDefault = function(e) {
+    OpenLayers.Event.preventDefault(e);
+};
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Popup.js
+    OpenLayers/Renderer/VML.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Renderer/Elements.js
  */
 
  */
 
-
 /**
 /**
- * Class: OpenLayers.Popup
- * A popup is a small div that can opened and closed on the map.
- * Typically opened in response to clicking on a marker.  
- * See <OpenLayers.Marker>.  Popup's don't require their own
- * layer and are added the the map using the <OpenLayers.Map.addPopup>
- * method.
+ * Class: OpenLayers.Renderer.VML
+ * Render vector features in browsers with VML capability.  Construct a new
+ * VML renderer with the <OpenLayers.Renderer.VML> constructor.
+ * 
+ * Note that for all calculations in this class, we use (num | 0) to truncate a 
+ * float value to an integer. This is done because it seems that VML doesn't 
+ * support float values.
  *
  *
- * Example:
- * (code)
- * popup = new OpenLayers.Popup("chicken", 
- *                    new OpenLayers.LonLat(5,40),
- *                    new OpenLayers.Size(200,200),
- *                    "example popup",
- *                    true);
- *       
- * map.addPopup(popup);
- * (end)
+ * Inherits from:
+ *  - <OpenLayers.Renderer.Elements>
  */
  */
-OpenLayers.Popup = OpenLayers.Class({
-
-    /** 
-     * Property: events  
-     * {<OpenLayers.Events>} custom event manager 
-     */
-    events: null,
-    
-    /** Property: id
-     * {String} the unique identifier assigned to this popup.
-     */
-    id: "",
-
-    /** 
-     * Property: lonlat 
-     * {<OpenLayers.LonLat>} the position of this popup on the map
-     */
-    lonlat: null,
-
-    /** 
-     * Property: div 
-     * {DOMElement} the div that contains this popup.
-     */
-    div: null,
-
-    /** 
-     * Property: contentSize 
-     * {<OpenLayers.Size>} the width and height of the content.
-     */
-    contentSize: null,    
-
-    /** 
-     * Property: size 
-     * {<OpenLayers.Size>} the width and height of the popup.
-     */
-    size: null,    
-
-    /** 
-     * Property: contentHTML 
-     * {String} An HTML string for this popup to display.
-     */
-    contentHTML: null,
-    
-    /** 
-     * Property: backgroundColor 
-     * {String} the background color used by the popup.
-     */
-    backgroundColor: "",
-    
-    /** 
-     * Property: opacity 
-     * {float} the opacity of this popup (between 0.0 and 1.0)
-     */
-    opacity: "",
-
-    /** 
-     * Property: border 
-     * {String} the border size of the popup.  (eg 2px)
-     */
-    border: "",
-    
-    /** 
-     * Property: contentDiv 
-     * {DOMElement} a reference to the element that holds the content of
-     *              the div.
-     */
-    contentDiv: null,
-    
-    /** 
-     * Property: groupDiv 
-     * {DOMElement} First and only child of 'div'. The group Div contains the
-     *     'contentDiv' and the 'closeDiv'.
-     */
-    groupDiv: null,
-
-    /** 
-     * Property: closeDiv
-     * {DOMElement} the optional closer image
-     */
-    closeDiv: null,
-
-    /** 
-     * APIProperty: autoSize
-     * {Boolean} Resize the popup to auto-fit the contents.
-     *     Default is false.
-     */
-    autoSize: false,
-
-    /**
-     * APIProperty: minSize
-     * {<OpenLayers.Size>} Minimum size allowed for the popup's contents.
-     */
-    minSize: null,
-
-    /**
-     * APIProperty: maxSize
-     * {<OpenLayers.Size>} Maximum size allowed for the popup's contents.
-     */
-    maxSize: null,
-
-    /** 
-     * Property: displayClass
-     * {String} The CSS class of the popup.
-     */
-    displayClass: "olPopup",
-
-    /** 
-     * Property: contentDisplayClass
-     * {String} The CSS class of the popup content div.
-     */
-    contentDisplayClass: "olPopupContent",
-
-    /** 
-     * Property: padding 
-     * {int or <OpenLayers.Bounds>} An extra opportunity to specify internal 
-     *     padding of the content div inside the popup. This was originally
-     *     confused with the css padding as specified in style.css's 
-     *     'olPopupContent' class. We would like to get rid of this altogether,
-     *     except that it does come in handy for the framed and anchoredbubble
-     *     popups, who need to maintain yet another barrier between their 
-     *     content and the outer border of the popup itself. 
-     * 
-     *     Note that in order to not break API, we must continue to support 
-     *     this property being set as an integer. Really, though, we'd like to 
-     *     have this specified as a Bounds object so that user can specify
-     *     distinct left, top, right, bottom paddings. With the 3.0 release
-     *     we can make this only a bounds.
-     */
-    padding: 0,
-
-    /** 
-     * Property: disableFirefoxOverflowHack
-     * {Boolean} The hack for overflow in Firefox causes all elements 
-     *     to be re-drawn, which causes Flash elements to be 
-     *     re-initialized, which is troublesome.
-     *     With this property the hack can be disabled.
-     */
-    disableFirefoxOverflowHack: false,
-
-    /**
-     * Method: fixPadding
-     * To be removed in 3.0, this function merely helps us to deal with the 
-     *     case where the user may have set an integer value for padding, 
-     *     instead of an <OpenLayers.Bounds> object.
-     */
-    fixPadding: function() {
-        if (typeof this.padding == "number") {
-            this.padding = new OpenLayers.Bounds(
-                this.padding, this.padding, this.padding, this.padding
-            );
-        }
-    },
+OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
 
     /**
 
     /**
-     * APIProperty: panMapIfOutOfView
-     * {Boolean} When drawn, pan map such that the entire popup is visible in
-     *     the current viewport (if necessary).
-     *     Default is false.
+     * Property: xmlns
+     * {String} XML Namespace URN
      */
      */
-    panMapIfOutOfView: false,
+    xmlns: "urn:schemas-microsoft-com:vml",
     
     /**
     
     /**
-     * APIProperty: keepInMap 
-     * {Boolean} If panMapIfOutOfView is false, and this property is true, 
-     *     contrain the popup such that it always fits in the available map
-     *     space. By default, this is not set on the base class. If you are
-     *     creating popups that are near map edges and not allowing pannning,
-     *     and especially if you have a popup which has a
-     *     fixedRelativePosition, setting this to false may be a smart thing to
-     *     do. Subclasses may want to override this setting.
-     *   
-     *     Default is false.
+     * Property: symbolCache
+     * {DOMElement} node holding symbols. This hash is keyed by symbol name,
+     *     and each value is a hash with a "path" and an "extent" property.
      */
      */
-    keepInMap: false,
+    symbolCache: {},
 
     /**
 
     /**
-     * APIProperty: closeOnMove
-     * {Boolean} When map pans, close the popup.
-     *     Default is false.
+     * Property: offset
+     * {Object} Hash with "x" and "y" properties
      */
      */
-    closeOnMove: false,
+    offset: null,
     
     
-    /** 
-     * Property: map 
-     * {<OpenLayers.Map>} this gets set in Map.js when the popup is added to the map
+    /**
+     * Constructor: OpenLayers.Renderer.VML
+     * Create a new VML renderer.
+     *
+     * Parameters:
+     * containerID - {String} The id for the element that contains the renderer
      */
      */
-    map: null,
-
-    /** 
-    * Constructor: OpenLayers.Popup
-    * Create a popup.
-    * 
-    * Parameters: 
-    * id - {String} a unqiue identifier for this popup.  If null is passed
-    *               an identifier will be automatically generated. 
-    * lonlat - {<OpenLayers.LonLat>}  The position on the map the popup will
-    *                                 be shown.
-    * contentSize - {<OpenLayers.Size>} The size of the content.
-    * contentHTML - {String}          An HTML string to display inside the   
-    *                                 popup.
-    * closeBox - {Boolean}            Whether to display a close box inside
-    *                                 the popup.
-    * closeBoxCallback - {Function}   Function to be called on closeBox click.
-    */
-    initialize:function(id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback) {
-        if (id == null) {
-            id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
+    initialize: function(containerID) {
+        if (!this.supported()) { 
+            return; 
         }
         }
+        if (!document.namespaces.olv) {
+            document.namespaces.add("olv", this.xmlns);
+            var style = document.createStyleSheet();
+            var shapes = ['shape','rect', 'oval', 'fill', 'stroke', 'imagedata', 'group','textbox']; 
+            for (var i = 0, len = shapes.length; i < len; i++) {
 
 
-        this.id = id;
-        this.lonlat = lonlat;
-
-        this.contentSize = (contentSize != null) ? contentSize 
-                                  : new OpenLayers.Size(
-                                                   OpenLayers.Popup.WIDTH,
-                                                   OpenLayers.Popup.HEIGHT);
-        if (contentHTML != null) { 
-             this.contentHTML = contentHTML;
+                style.addRule('olv\\:' + shapes[i], "behavior: url(#default#VML); " +
+                              "position: absolute; display: inline-block;");
+            }                  
         }
         }
-        this.backgroundColor = OpenLayers.Popup.COLOR;
-        this.opacity = OpenLayers.Popup.OPACITY;
-        this.border = OpenLayers.Popup.BORDER;
-
-        this.div = OpenLayers.Util.createDiv(this.id, null, null, 
-                                             null, null, null, "hidden");
-        this.div.className = this.displayClass;
         
         
-        var groupDivId = this.id + "_GroupDiv";
-        this.groupDiv = OpenLayers.Util.createDiv(groupDivId, null, null, 
-                                                    null, "relative", null,
-                                                    "hidden");
-
-        var id = this.div.id + "_contentDiv";
-        this.contentDiv = OpenLayers.Util.createDiv(id, null, this.contentSize.clone(), 
-                                                    null, "relative");
-        this.contentDiv.className = this.contentDisplayClass;
-        this.groupDiv.appendChild(this.contentDiv);
-        this.div.appendChild(this.groupDiv);
-
-        if (closeBox) {
-            this.addCloseBox(closeBoxCallback);
-        } 
-
-        this.registerEvents();
+        OpenLayers.Renderer.Elements.prototype.initialize.apply(this, 
+                                                                arguments);
     },
 
     },
 
-    /** 
-     * Method: destroy
-     * nullify references to prevent circular references and memory leaks
+    /**
+     * APIMethod: supported
+     * Determine whether a browser supports this renderer.
+     *
+     * Returns:
+     * {Boolean} The browser supports the VML renderer
      */
      */
-    destroy: function() {
-
-        this.id = null;
-        this.lonlat = null;
-        this.size = null;
-        this.contentHTML = null;
-        
-        this.backgroundColor = null;
-        this.opacity = null;
-        this.border = null;
-        
-        if (this.closeOnMove && this.map) {
-            this.map.events.unregister("movestart", this, this.hide);
-        }
-
-        this.events.destroy();
-        this.events = null;
-        
-        if (this.closeDiv) {
-            OpenLayers.Event.stopObservingElement(this.closeDiv); 
-            this.groupDiv.removeChild(this.closeDiv);
-        }
-        this.closeDiv = null;
-        
-        this.div.removeChild(this.groupDiv);
-        this.groupDiv = null;
-
-        if (this.map != null) {
-            this.map.removePopup(this);
-        }
-        this.map = null;
-        this.div = null;
-        
-        this.autoSize = null;
-        this.minSize = null;
-        this.maxSize = null;
-        this.padding = null;
-        this.panMapIfOutOfView = null;
-    },
+    supported: function() {
+        return !!(document.namespaces);
+    },    
 
 
-    /** 
-    * Method: draw
-    * Constructs the elements that make up the popup.
-    *
-    * Parameters:
-    * px - {<OpenLayers.Pixel>} the position the popup in pixels.
-    * 
-    * Returns:
-    * {DOMElement} Reference to a div that contains the drawn popup
-    */
-    draw: function(px) {
-        if (px == null) {
-            if ((this.lonlat != null) && (this.map != null)) {
-                px = this.map.getLayerPxFromLonLat(this.lonlat);
-            }
+    /**
+     * Method: setExtent
+     * Set the renderer's extent
+     *
+     * Parameters:
+     * extent - {<OpenLayers.Bounds>}
+     * resolutionChanged - {Boolean}
+     * 
+     * Returns:
+     * {Boolean} true to notify the layer that the new extent does not exceed
+     *     the coordinate range, and the features will not need to be redrawn.
+     */
+    setExtent: function(extent, resolutionChanged) {
+        var coordSysUnchanged = OpenLayers.Renderer.Elements.prototype.setExtent.apply(this, arguments);
+        var resolution = this.getResolution();
+    
+        var left = (extent.left/resolution) | 0;
+        var top = (extent.top/resolution - this.size.h) | 0;
+        if (resolutionChanged || !this.offset) {
+            this.offset = {x: left, y: top};
+            left = 0;
+            top = 0;
+        } else {
+            left = left - this.offset.x;
+            top = top - this.offset.y;
         }
 
         }
 
-        // this assumes that this.map already exists, which is okay because 
-        // this.draw is only called once the popup has been added to the map.
-        if (this.closeOnMove) {
-            this.map.events.register("movestart", this, this.hide);
-        }
         
         
-        //listen to movestart, moveend to disable overflow (FF bug)
-        if (!this.disableFirefoxOverflowHack && OpenLayers.BROWSER_NAME == 'firefox') {
-            this.map.events.register("movestart", this, function() {
-                var style = document.defaultView.getComputedStyle(
-                    this.contentDiv, null
-                );
-                var currentOverflow = style.getPropertyValue("overflow");
-                if (currentOverflow != "hidden") {
-                    this.contentDiv._oldOverflow = currentOverflow;
-                    this.contentDiv.style.overflow = "hidden";
-                }
-            });
-            this.map.events.register("moveend", this, function() {
-                var oldOverflow = this.contentDiv._oldOverflow;
-                if (oldOverflow) {
-                    this.contentDiv.style.overflow = oldOverflow;
-                    this.contentDiv._oldOverflow = null;
-                }
-            });
-        }
+        var org = (left - this.xOffset) + " " + top;
+        this.root.coordorigin = org;
+        var roots = [this.root, this.vectorRoot, this.textRoot];
+        var root;
+        for(var i=0, len=roots.length; i<len; ++i) {
+            root = roots[i];
 
 
-        this.moveTo(px);
-        if (!this.autoSize && !this.size) {
-            this.setSize(this.contentSize);
+            var size = this.size.w + " " + this.size.h;
+            root.coordsize = size;
+            
         }
         }
-        this.setBackgroundColor();
-        this.setOpacity();
-        this.setBorder();
-        this.setContentHTML();
+        // flip the VML display Y axis upside down so it 
+        // matches the display Y axis of the map
+        this.root.style.flip = "y";
         
         
-        if (this.panMapIfOutOfView) {
-            this.panIntoView();
-        }    
-
-        return this.div;
+        return coordSysUnchanged;
     },
 
     },
 
-    /** 
-     * Method: updatePosition
-     * if the popup has a lonlat and its map members set, 
-     * then have it move itself to its proper position
-     */
-    updatePosition: function() {
-        if ((this.lonlat) && (this.map)) {
-            var px = this.map.getLayerPxFromLonLat(this.lonlat);
-            if (px) {
-                this.moveTo(px);           
-            }    
-        }
-    },
 
     /**
 
     /**
-     * Method: moveTo
-     * 
+     * Method: setSize
+     * Set the size of the drawing surface
+     *
      * Parameters:
      * Parameters:
-     * px - {<OpenLayers.Pixel>} the top and left position of the popup div. 
+     * size - {<OpenLayers.Size>} the size of the drawing surface
      */
      */
-    moveTo: function(px) {
-        if ((px != null) && (this.div != null)) {
-            this.div.style.left = px.x + "px";
-            this.div.style.top = px.y + "px";
+    setSize: function(size) {
+        OpenLayers.Renderer.prototype.setSize.apply(this, arguments);
+        
+        // setting width and height on all roots to avoid flicker which we
+        // would get with 100% width and height on child roots
+        var roots = [
+            this.rendererRoot,
+            this.root,
+            this.vectorRoot,
+            this.textRoot
+        ];
+        var w = this.size.w + "px";
+        var h = this.size.h + "px";
+        var root;
+        for(var i=0, len=roots.length; i<len; ++i) {
+            root = roots[i];
+            root.style.width = w;
+            root.style.height = h;
         }
     },
 
     /**
         }
     },
 
     /**
-     * Method: visible
+     * Method: getNodeType
+     * Get the node type for a geometry and style
      *
      *
-     * Returns:      
-     * {Boolean} Boolean indicating whether or not the popup is visible
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>}
+     * style - {Object}
+     *
+     * Returns:
+     * {String} The corresponding node type for the specified geometry
      */
      */
-    visible: function() {
-        return OpenLayers.Element.visible(this.div);
+    getNodeType: function(geometry, style) {
+        var nodeType = null;
+        switch (geometry.CLASS_NAME) {
+            case "OpenLayers.Geometry.Point":
+                if (style.externalGraphic) {
+                    nodeType = "olv:rect";
+                } else if (this.isComplexSymbol(style.graphicName)) {
+                    nodeType = "olv:shape";
+                } else {
+                    nodeType = "olv:oval";
+                }
+                break;
+            case "OpenLayers.Geometry.Rectangle":
+                nodeType = "olv:rect";
+                break;
+            case "OpenLayers.Geometry.LineString":
+            case "OpenLayers.Geometry.LinearRing":
+            case "OpenLayers.Geometry.Polygon":
+            case "OpenLayers.Geometry.Curve":
+                nodeType = "olv:shape";
+                break;
+            default:
+                break;
+        }
+        return nodeType;
     },
 
     /**
     },
 
     /**
-     * Method: toggle
-     * Toggles visibility of the popup.
+     * Method: setStyle
+     * Use to set all the style attributes to a VML node.
+     *
+     * Parameters:
+     * node - {DOMElement} An VML element to decorate
+     * style - {Object}
+     * options - {Object} Currently supported options include 
+     *                              'isFilled' {Boolean} and
+     *                              'isStroked' {Boolean}
+     * geometry - {<OpenLayers.Geometry>}
      */
      */
-    toggle: function() {
-        if (this.visible()) {
-            this.hide();
-        } else {
-            this.show();
+    setStyle: function(node, style, options, geometry) {
+        style = style  || node._style;
+        options = options || node._options;
+        var fillColor = style.fillColor;
+
+        var title = style.title || style.graphicTitle;
+        if (title) {
+            node.title = title;
+        } 
+
+        if (node._geometryClass === "OpenLayers.Geometry.Point") {
+            if (style.externalGraphic) {
+                options.isFilled = true;
+                var width = style.graphicWidth || style.graphicHeight;
+                var height = style.graphicHeight || style.graphicWidth;
+                width = width ? width : style.pointRadius*2;
+                height = height ? height : style.pointRadius*2;
+
+                var resolution = this.getResolution();
+                var xOffset = (style.graphicXOffset != undefined) ?
+                    style.graphicXOffset : -(0.5 * width);
+                var yOffset = (style.graphicYOffset != undefined) ?
+                    style.graphicYOffset : -(0.5 * height);
+                
+                node.style.left = ((((geometry.x - this.featureDx)/resolution - this.offset.x)+xOffset) | 0) + "px";
+                node.style.top = (((geometry.y/resolution - this.offset.y)-(yOffset+height)) | 0) + "px";
+                node.style.width = width + "px";
+                node.style.height = height + "px";
+                node.style.flip = "y";
+                
+                // modify fillColor and options for stroke styling below
+                fillColor = "none";
+                options.isStroked = false;
+            } else if (this.isComplexSymbol(style.graphicName)) {
+                var cache = this.importSymbol(style.graphicName);
+                node.path = cache.path;
+                node.coordorigin = cache.left + "," + cache.bottom;
+                var size = cache.size;
+                node.coordsize = size + "," + size;        
+                this.drawCircle(node, geometry, style.pointRadius);
+                node.style.flip = "y";
+            } else {
+                this.drawCircle(node, geometry, style.pointRadius);
+            }
         }
         }
-    },
 
 
-    /**
-     * Method: show
-     * Makes the popup visible.
-     */
-    show: function() {
-        this.div.style.display = '';
+        // fill 
+        if (options.isFilled) { 
+            node.fillcolor = fillColor; 
+        } else { 
+            node.filled = "false"; 
+        }
+        var fills = node.getElementsByTagName("fill");
+        var fill = (fills.length == 0) ? null : fills[0];
+        if (!options.isFilled) {
+            if (fill) {
+                node.removeChild(fill);
+            }
+        } else {
+            if (!fill) {
+                fill = this.createNode('olv:fill', node.id + "_fill");
+            }
+            fill.opacity = style.fillOpacity;
 
 
-        if (this.panMapIfOutOfView) {
-            this.panIntoView();
-        }    
-    },
+            if (node._geometryClass === "OpenLayers.Geometry.Point" &&
+                    style.externalGraphic) {
 
 
-    /**
-     * Method: hide
-     * Makes the popup invisible.
-     */
-    hide: function() {
-        this.div.style.display = 'none';
+                // override fillOpacity
+                if (style.graphicOpacity) {
+                    fill.opacity = style.graphicOpacity;
+                }
+                
+                fill.src = style.externalGraphic;
+                fill.type = "frame";
+                
+                if (!(style.graphicWidth && style.graphicHeight)) {
+                  fill.aspect = "atmost";
+                }                
+            }
+            if (fill.parentNode != node) {
+                node.appendChild(fill);
+            }
+        }
+
+        // additional rendering for rotated graphics or symbols
+        var rotation = style.rotation;
+        if ((rotation !== undefined || node._rotation !== undefined)) {
+            node._rotation = rotation;
+            if (style.externalGraphic) {
+                this.graphicRotate(node, xOffset, yOffset, style);
+                // make the fill fully transparent, because we now have
+                // the graphic as imagedata element. We cannot just remove
+                // the fill, because this is part of the hack described
+                // in graphicRotate
+                fill.opacity = 0;
+            } else if(node._geometryClass === "OpenLayers.Geometry.Point") {
+                node.style.rotation = rotation || 0;
+            }
+        }
+
+        // stroke 
+        var strokes = node.getElementsByTagName("stroke");
+        var stroke = (strokes.length == 0) ? null : strokes[0];
+        if (!options.isStroked) {
+            node.stroked = false;
+            if (stroke) {
+                stroke.on = false;
+            }
+        } else {
+            if (!stroke) {
+                stroke = this.createNode('olv:stroke', node.id + "_stroke");
+                node.appendChild(stroke);
+            }
+            stroke.on = true;
+            stroke.color = style.strokeColor; 
+            stroke.weight = style.strokeWidth + "px"; 
+            stroke.opacity = style.strokeOpacity;
+            stroke.endcap = style.strokeLinecap == 'butt' ? 'flat' :
+                (style.strokeLinecap || 'round');
+            if (style.strokeDashstyle) {
+                stroke.dashstyle = this.dashStyle(style);
+            }
+        }
+        
+        if (style.cursor != "inherit" && style.cursor != null) {
+            node.style.cursor = style.cursor;
+        }
+        return node;
     },
 
     /**
     },
 
     /**
-     * Method: setSize
-     * Used to adjust the size of the popup. 
-     *
+     * Method: graphicRotate
+     * If a point is to be styled with externalGraphic and rotation, VML fills
+     * cannot be used to display the graphic, because rotation of graphic
+     * fills is not supported by the VML implementation of Internet Explorer.
+     * This method creates a olv:imagedata element inside the VML node,
+     * DXImageTransform.Matrix and BasicImage filters for rotation and
+     * opacity, and a 3-step hack to remove rendering artefacts from the
+     * graphic and preserve the ability of graphics to trigger events.
+     * Finally, OpenLayers methods are used to determine the correct
+     * insertion point of the rotated image, because DXImageTransform.Matrix
+     * does the rotation without the ability to specify a rotation center
+     * point.
+     * 
      * Parameters:
      * Parameters:
-     * contentSize - {<OpenLayers.Size>} the new size for the popup's 
-     *     contents div (in pixels).
+     * node    - {DOMElement}
+     * xOffset - {Number} rotation center relative to image, x coordinate
+     * yOffset - {Number} rotation center relative to image, y coordinate
+     * style   - {Object}
      */
      */
-    setSize:function(contentSize) { 
-        this.size = contentSize.clone(); 
+    graphicRotate: function(node, xOffset, yOffset, style) {
+        var style = style || node._style;
+        var rotation = style.rotation || 0;
         
         
-        // if our contentDiv has a css 'padding' set on it by a stylesheet, we 
-        //  must add that to the desired "size". 
-        var contentDivPadding = this.getContentDivPadding();
-        var wPadding = contentDivPadding.left + contentDivPadding.right;
-        var hPadding = contentDivPadding.top + contentDivPadding.bottom;
+        var aspectRatio, size;
+        if (!(style.graphicWidth && style.graphicHeight)) {
+            // load the image to determine its size
+            var img = new Image();
+            img.onreadystatechange = OpenLayers.Function.bind(function() {
+                if(img.readyState == "complete" ||
+                        img.readyState == "interactive") {
+                    aspectRatio = img.width / img.height;
+                    size = Math.max(style.pointRadius * 2, 
+                        style.graphicWidth || 0,
+                        style.graphicHeight || 0);
+                    xOffset = xOffset * aspectRatio;
+                    style.graphicWidth = size * aspectRatio;
+                    style.graphicHeight = size;
+                    this.graphicRotate(node, xOffset, yOffset, style);
+                }
+            }, this);
+            img.src = style.externalGraphic;
+            
+            // will be called again by the onreadystate handler
+            return;
+        } else {
+            size = Math.max(style.graphicWidth, style.graphicHeight);
+            aspectRatio = style.graphicWidth / style.graphicHeight;
+        }
+        
+        var width = Math.round(style.graphicWidth || size * aspectRatio);
+        var height = Math.round(style.graphicHeight || size);
+        node.style.width = width + "px";
+        node.style.height = height + "px";
+        
+        // Three steps are required to remove artefacts for images with
+        // transparent backgrounds (resulting from using DXImageTransform
+        // filters on svg objects), while preserving awareness for browser
+        // events on images:
+        // - Use the fill as usual (like for unrotated images) to handle
+        //   events
+        // - specify an imagedata element with the same src as the fill
+        // - style the imagedata element with an AlphaImageLoader filter
+        //   with empty src
+        var image = document.getElementById(node.id + "_image");
+        if (!image) {
+            image = this.createNode("olv:imagedata", node.id + "_image");
+            node.appendChild(image);
+        }
+        image.style.width = width + "px";
+        image.style.height = height + "px";
+        image.src = style.externalGraphic;
+        image.style.filter =
+            "progid:DXImageTransform.Microsoft.AlphaImageLoader(" + 
+            "src='', sizingMethod='scale')";
 
 
-        // take into account the popup's 'padding' property
-        this.fixPadding();
-        wPadding += this.padding.left + this.padding.right;
-        hPadding += this.padding.top + this.padding.bottom;
+        var rot = rotation * Math.PI / 180;
+        var sintheta = Math.sin(rot);
+        var costheta = Math.cos(rot);
 
 
-        // make extra space for the close div
-        if (this.closeDiv) {
-            var closeDivWidth = parseInt(this.closeDiv.style.width);
-            wPadding += closeDivWidth + contentDivPadding.right;
+        // do the rotation on the image
+        var filter =
+            "progid:DXImageTransform.Microsoft.Matrix(M11=" + costheta +
+            ",M12=" + (-sintheta) + ",M21=" + sintheta + ",M22=" + costheta +
+            ",SizingMethod='auto expand')\n";
+
+        // set the opacity (needed for the imagedata)
+        var opacity = style.graphicOpacity || style.fillOpacity;
+        if (opacity && opacity != 1) {
+            filter += 
+                "progid:DXImageTransform.Microsoft.BasicImage(opacity=" + 
+                opacity+")\n";
         }
         }
+        node.style.filter = filter;
 
 
-        //increase size of the main popup div to take into account the 
-        // users's desired padding and close div.        
-        this.size.w += wPadding;
-        this.size.h += hPadding;
+        // do the rotation again on a box, so we know the insertion point
+        var centerPoint = new OpenLayers.Geometry.Point(-xOffset, -yOffset);
+        var imgBox = new OpenLayers.Bounds(0, 0, width, height).toGeometry();
+        imgBox.rotate(style.rotation, centerPoint);
+        var imgBounds = imgBox.getBounds();
 
 
-        //now if our browser is IE, we need to actually make the contents 
-        // div itself bigger to take its own padding into effect. this makes 
-        // me want to shoot someone, but so it goes.
-        if (OpenLayers.BROWSER_NAME == "msie") {
-            this.contentSize.w += 
-                contentDivPadding.left + contentDivPadding.right;
-            this.contentSize.h += 
-                contentDivPadding.bottom + contentDivPadding.top;
-        }
+        node.style.left = Math.round(
+            parseInt(node.style.left) + imgBounds.left) + "px";
+        node.style.top = Math.round(
+            parseInt(node.style.top) - imgBounds.bottom) + "px";
+    },
 
 
-        if (this.div != null) {
-            this.div.style.width = this.size.w + "px";
-            this.div.style.height = this.size.h + "px";
+    /**
+     * Method: postDraw
+     * Does some node postprocessing to work around browser issues:
+     * - Some versions of Internet Explorer seem to be unable to set fillcolor
+     *   and strokecolor to "none" correctly before the fill node is appended
+     *   to a visible vml node. This method takes care of that and sets
+     *   fillcolor and strokecolor again if needed.
+     * - In some cases, a node won't become visible after being drawn. Setting
+     *   style.visibility to "visible" works around that.
+     * 
+     * Parameters:
+     * node - {DOMElement}
+     */
+    postDraw: function(node) {
+        node.style.visibility = "visible";
+        var fillColor = node._style.fillColor;
+        var strokeColor = node._style.strokeColor;
+        if (fillColor == "none" &&
+                node.fillcolor != fillColor) {
+            node.fillcolor = fillColor;
         }
         }
-        if (this.contentDiv != null){
-            this.contentDiv.style.width = contentSize.w + "px";
-            this.contentDiv.style.height = contentSize.h + "px";
+        if (strokeColor == "none" &&
+                node.strokecolor != strokeColor) {
+            node.strokecolor = strokeColor;
         }
         }
-    },  
+    },
+
 
     /**
 
     /**
-     * APIMethod: updateSize
-     * Auto size the popup so that it precisely fits its contents (as 
-     *     determined by this.contentDiv.innerHTML). Popup size will, of
-     *     course, be limited by the available space on the current map
+     * Method: setNodeDimension
+     * Get the geometry's bounds, convert it to our vml coordinate system, 
+     * then set the node's position, size, and local coordinate system.
+     *   
+     * Parameters:
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
      */
      */
-    updateSize: function() {
-        
-        // determine actual render dimensions of the contents by putting its
-        // contents into a fake contentDiv (for the CSS) and then measuring it
-        var preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" + 
-            this.contentDiv.innerHTML + 
-            "</div>";
-        var containerElement = (this.map) ? this.map.div : document.body;
-        var realSize = OpenLayers.Util.getRenderedDimensions(
-            preparedHTML, null, {
-                displayClass: this.displayClass,
-                containerElement: containerElement
-            }
-        );
-
-        // is the "real" size of the div is safe to display in our map?
-        var safeSize = this.getSafeContentSize(realSize);
-
-        var newSize = null;
-        if (safeSize.equals(realSize)) {
-            //real size of content is small enough to fit on the map, 
-            // so we use real size.
-            newSize = realSize;
-
-        } else {
+    setNodeDimension: function(node, geometry) {
 
 
-            // make a new 'size' object with the clipped dimensions 
-            // set or null if not clipped.
-            var fixedSize = {
-                w: (safeSize.w < realSize.w) ? safeSize.w : null,
-                h: (safeSize.h < realSize.h) ? safeSize.h : null
-            };
+        var bbox = geometry.getBounds();
+        if(bbox) {
+            var resolution = this.getResolution();
         
         
-            if (fixedSize.w && fixedSize.h) {
-                //content is too big in both directions, so we will use 
-                // max popup size (safeSize), knowing well that it will 
-                // overflow both ways.                
-                newSize = safeSize;
-            } else {
-                //content is clipped in only one direction, so we need to 
-                // run getRenderedDimensions() again with a fixed dimension
-                var clippedSize = OpenLayers.Util.getRenderedDimensions(
-                    preparedHTML, fixedSize, {
-                        displayClass: this.contentDisplayClass,
-                        containerElement: containerElement
-                    }
-                );
-                
-                //if the clipped size is still the same as the safeSize, 
-                // that means that our content must be fixed in the 
-                // offending direction. If overflow is 'auto', this means 
-                // we are going to have a scrollbar for sure, so we must 
-                // adjust for that.
-                //
-                var currentOverflow = OpenLayers.Element.getStyle(
-                    this.contentDiv, "overflow"
-                );
-                if ( (currentOverflow != "hidden") && 
-                     (clippedSize.equals(safeSize)) ) {
-                    var scrollBar = OpenLayers.Util.getScrollbarWidth();
-                    if (fixedSize.w) {
-                        clippedSize.h += scrollBar;
-                    } else {
-                        clippedSize.w += scrollBar;
+            var scaledBox = 
+                new OpenLayers.Bounds(((bbox.left - this.featureDx)/resolution - this.offset.x) | 0,
+                                      (bbox.bottom/resolution - this.offset.y) | 0,
+                                      ((bbox.right - this.featureDx)/resolution - this.offset.x) | 0,
+                                      (bbox.top/resolution - this.offset.y) | 0);
+            
+            // Set the internal coordinate system to draw the path
+            node.style.left = scaledBox.left + "px";
+            node.style.top = scaledBox.top + "px";
+            node.style.width = scaledBox.getWidth() + "px";
+            node.style.height = scaledBox.getHeight() + "px";
+    
+            node.coordorigin = scaledBox.left + " " + scaledBox.top;
+            node.coordsize = scaledBox.getWidth()+ " " + scaledBox.getHeight();
+        }
+    },
+    
+    /** 
+     * Method: dashStyle
+     * 
+     * Parameters:
+     * style - {Object}
+     * 
+     * Returns:
+     * {String} A VML compliant 'stroke-dasharray' value
+     */
+    dashStyle: function(style) {
+        var dash = style.strokeDashstyle;
+        switch (dash) {
+            case 'solid':
+            case 'dot':
+            case 'dash':
+            case 'dashdot':
+            case 'longdash':
+            case 'longdashdot':
+                return dash;
+            default:
+                // very basic guessing of dash style patterns
+                var parts = dash.split(/[ ,]/);
+                if (parts.length == 2) {
+                    if (1*parts[0] >= 2*parts[1]) {
+                        return "longdash";
                     }
                     }
+                    return (parts[0] == 1 || parts[1] == 1) ? "dot" : "dash";
+                } else if (parts.length == 4) {
+                    return (1*parts[0] >= 2*parts[1]) ? "longdashdot" :
+                        "dashdot";
                 }
                 }
-                
-                newSize = this.getSafeContentSize(clippedSize);
-            }
-        }                        
-        this.setSize(newSize);     
-    },    
+                return "solid";
+        }
+    },
 
     /**
 
     /**
-     * Method: setBackgroundColor
-     * Sets the background color of the popup.
+     * Method: createNode
+     * Create a new node
      *
      * Parameters:
      *
      * Parameters:
-     * color - {String} the background color.  eg "#FFBBBB"
+     * type - {String} Kind of node to draw
+     * id - {String} Id for node
+     *
+     * Returns:
+     * {DOMElement} A new node of the given type and id
      */
      */
-    setBackgroundColor:function(color) { 
-        if (color != undefined) {
-            this.backgroundColor = color; 
+    createNode: function(type, id) {
+        var node = document.createElement(type);
+        if (id) {
+            node.id = id;
         }
         
         }
         
-        if (this.div != null) {
-            this.div.style.backgroundColor = this.backgroundColor;
-        }
-    },  
+        // IE hack to make elements unselectable, to prevent 'blue flash'
+        // while dragging vectors; #1410
+        node.unselectable = 'on';
+        node.onselectstart = OpenLayers.Function.False;
+        
+        return node;    
+    },
     
     /**
     
     /**
-     * Method: setOpacity
-     * Sets the opacity of the popup.
-     * 
+     * Method: nodeTypeCompare
+     * Determine whether a node is of a given type
+     *
      * Parameters:
      * Parameters:
-     * opacity - {float} A value between 0.0 (transparent) and 1.0 (solid).   
+     * node - {DOMElement} An VML element
+     * type - {String} Kind of node
+     *
+     * Returns:
+     * {Boolean} Whether or not the specified node is of the specified type
      */
      */
-    setOpacity:function(opacity) { 
-        if (opacity != undefined) {
-            this.opacity = opacity; 
+    nodeTypeCompare: function(node, type) {
+
+        //split type
+        var subType = type;
+        var splitIndex = subType.indexOf(":");
+        if (splitIndex != -1) {
+            subType = subType.substr(splitIndex+1);
         }
         }
-        
-        if (this.div != null) {
-            // for Mozilla and Safari
-            this.div.style.opacity = this.opacity;
 
 
-            // for IE
-            this.div.style.filter = 'alpha(opacity=' + this.opacity*100 + ')';
+        //split nodeName
+        var nodeName = node.nodeName;
+        splitIndex = nodeName.indexOf(":");
+        if (splitIndex != -1) {
+            nodeName = nodeName.substr(splitIndex+1);
         }
         }
-    },  
-    
+
+        return (subType == nodeName);
+    },
+
     /**
     /**
-     * Method: setBorder
-     * Sets the border style of the popup.
+     * Method: createRenderRoot
+     * Create the renderer root
      *
      *
+     * Returns:
+     * {DOMElement} The specific render engine's root element
+     */
+    createRenderRoot: function() {
+        return this.nodeFactory(this.container.id + "_vmlRoot", "div");
+    },
+
+    /**
+     * Method: createRoot
+     * Create the main root element
+     * 
      * Parameters:
      * Parameters:
-     * border - {String} The border style value. eg 2px 
+     * suffix - {String} suffix to append to the id
+     *
+     * Returns:
+     * {DOMElement}
      */
      */
-    setBorder:function(border) { 
-        if (border != undefined) {
-            this.border = border;
-        }
-        
-        if (this.div != null) {
-            this.div.style.border = this.border;
-        }
-    },      
+    createRoot: function(suffix) {
+        return this.nodeFactory(this.container.id + suffix, "olv:group");
+    },
+    
+    /**************************************
+     *                                    *
+     *     GEOMETRY DRAWING FUNCTIONS     *
+     *                                    *
+     **************************************/
     
     /**
     
     /**
-     * Method: setContentHTML
-     * Allows the user to set the HTML content of the popup.
-     *
+     * Method: drawPoint
+     * Render a point
+     * 
      * Parameters:
      * Parameters:
-     * contentHTML - {String} HTML for the div.
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or false if the point could not be drawn
      */
      */
-    setContentHTML:function(contentHTML) {
+    drawPoint: function(node, geometry) {
+        return this.drawCircle(node, geometry, 1);
+    },
 
 
-        if (contentHTML != null) {
-            this.contentHTML = contentHTML;
+    /**
+     * Method: drawCircle
+     * Render a circle.
+     * Size and Center a circle given geometry (x,y center) and radius
+     * 
+     * Parameters:
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * radius - {float}
+     * 
+     * Returns:
+     * {DOMElement} or false if the circle could not ne drawn
+     */
+    drawCircle: function(node, geometry, radius) {
+        if(!isNaN(geometry.x)&& !isNaN(geometry.y)) {
+            var resolution = this.getResolution();
+
+            node.style.left = ((((geometry.x - this.featureDx) /resolution - this.offset.x) | 0) - radius) + "px";
+            node.style.top = (((geometry.y /resolution - this.offset.y) | 0) - radius) + "px";
+    
+            var diameter = radius * 2;
+            
+            node.style.width = diameter + "px";
+            node.style.height = diameter + "px";
+            return node;
         }
         }
-       
-        if ((this.contentDiv != null) && 
-            (this.contentHTML != null) &&
-            (this.contentHTML != this.contentDiv.innerHTML)) {
-       
-            this.contentDiv.innerHTML = this.contentHTML;
-       
-            if (this.autoSize) {
-                
-                //if popup has images, listen for when they finish
-                // loading and resize accordingly
-                this.registerImageListeners();
+        return false;
+    },
 
 
-                //auto size the popup to its current contents
-                this.updateSize();
-            }
-        }    
 
 
-    },
-    
     /**
     /**
-     * Method: registerImageListeners
-     * Called when an image contained by the popup loaded. this function
-     *     updates the popup size, then unregisters the image load listener.
-     */   
-    registerImageListeners: function() { 
-
-        // As the images load, this function will call updateSize() to 
-        // resize the popup to fit the content div (which presumably is now
-        // bigger than when the image was not loaded).
-        // 
-        // If the 'panMapIfOutOfView' property is set, we will pan the newly
-        // resized popup back into view.
-        // 
-        // Note that this function, when called, will have 'popup' and 
-        // 'img' properties in the context.
-        //
-        var onImgLoad = function() {
-            if (this.popup.id === null) { // this.popup has been destroyed!
-                return;
-            }
-            this.popup.updateSize();
-     
-            if ( this.popup.visible() && this.popup.panMapIfOutOfView ) {
-                this.popup.panIntoView();
-            }
+     * Method: drawLineString
+     * Render a linestring.
+     * 
+     * Parameters:
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement}
+     */
+    drawLineString: function(node, geometry) {
+        return this.drawLine(node, geometry, false);
+    },
 
 
-            OpenLayers.Event.stopObserving(
-                this.img, "load", this.img._onImgLoad
-            );
-    
-        };
+    /**
+     * Method: drawLinearRing
+     * Render a linearring
+     * 
+     * Parameters:
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement}
+     */
+    drawLinearRing: function(node, geometry) {
+        return this.drawLine(node, geometry, true);
+    },
 
 
-        //cycle through the images and if their size is 0x0, that means that 
-        // they haven't been loaded yet, so we attach the listener, which 
-        // will fire when the images finish loading and will resize the 
-        // popup accordingly to its new size.
-        var images = this.contentDiv.getElementsByTagName("img");
-        for (var i = 0, len = images.length; i < len; i++) {
-            var img = images[i];
-            if (img.width == 0 || img.height == 0) {
+    /**
+     * Method: DrawLine
+     * Render a line.
+     * 
+     * Parameters:
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * closeLine - {Boolean} Close the line? (make it a ring?)
+     * 
+     * Returns:
+     * {DOMElement}
+     */
+    drawLine: function(node, geometry, closeLine) {
 
 
-                var context = {
-                    'popup': this,
-                    'img': img
-                };
+        this.setNodeDimension(node, geometry);
 
 
-                //expando this function to the image itself before registering
-                // it. This way we can easily and properly unregister it.
-                img._onImgLoad = OpenLayers.Function.bind(onImgLoad, context);
+        var resolution = this.getResolution();
+        var numComponents = geometry.components.length;
+        var parts = new Array(numComponents);
 
 
-                OpenLayers.Event.observe(img, 'load', img._onImgLoad);
-            }    
-        } 
+        var comp, x, y;
+        for (var i = 0; i < numComponents; i++) {
+            comp = geometry.components[i];
+            x = ((comp.x - this.featureDx)/resolution - this.offset.x) | 0;
+            y = (comp.y/resolution - this.offset.y) | 0;
+            parts[i] = " " + x + "," + y + " l ";
+        }
+        var end = (closeLine) ? " x e" : " e";
+        node.path = "m" + parts.join("") + end;
+        return node;
     },
 
     /**
     },
 
     /**
-     * APIMethod: getSafeContentSize
+     * Method: drawPolygon
+     * Render a polygon
      * 
      * Parameters:
      * 
      * Parameters:
-     * size - {<OpenLayers.Size>} Desired size to make the popup.
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Size>} A size to make the popup which is neither smaller
-     *     than the specified minimum size, nor bigger than the maximum 
-     *     size (which is calculated relative to the size of the viewport).
+     * {DOMElement}
      */
      */
-    getSafeContentSize: function(size) {
+    drawPolygon: function(node, geometry) {
+        this.setNodeDimension(node, geometry);
 
 
-        var safeContentSize = size.clone();
+        var resolution = this.getResolution();
+    
+        var path = [];
+        var j, jj, points, area, first, second, i, ii, comp, pathComp, x, y;
+        for (j=0, jj=geometry.components.length; j<jj; j++) {
+            path.push("m");
+            points = geometry.components[j].components;
+            // we only close paths of interior rings with area
+            area = (j === 0);
+            first = null;
+            second = null;
+            for (i=0, ii=points.length; i<ii; i++) {
+                comp = points[i];
+                x = ((comp.x - this.featureDx) / resolution - this.offset.x) | 0;
+                y = (comp.y / resolution - this.offset.y) | 0;
+                pathComp = " " + x + "," + y;
+                path.push(pathComp);
+                if (i==0) {
+                    path.push(" l");
+                }
+                if (!area) {
+                    // IE improperly renders sub-paths that have no area.
+                    // Instead of checking the area of every ring, we confirm
+                    // the ring has at least three distinct points.  This does
+                    // not catch all non-zero area cases, but it greatly improves
+                    // interior ring digitizing and is a minor performance hit
+                    // when rendering rings with many points.
+                    if (!first) {
+                        first = pathComp;
+                    } else if (first != pathComp) {
+                        if (!second) {
+                            second = pathComp;
+                        } else if (second != pathComp) {
+                            // stop looking
+                            area = true;
+                        }
+                    }
+                }
+            }
+            path.push(area ? " x " : " ");
+        }
+        path.push("e");
+        node.path = path.join("");
+        return node;
+    },
 
 
-        // if our contentDiv has a css 'padding' set on it by a stylesheet, we 
-        //  must add that to the desired "size". 
-        var contentDivPadding = this.getContentDivPadding();
-        var wPadding = contentDivPadding.left + contentDivPadding.right;
-        var hPadding = contentDivPadding.top + contentDivPadding.bottom;
+    /**
+     * Method: drawRectangle
+     * Render a rectangle
+     * 
+     * Parameters:
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement}
+     */
+    drawRectangle: function(node, geometry) {
+        var resolution = this.getResolution();
+    
+        node.style.left = (((geometry.x - this.featureDx)/resolution - this.offset.x) | 0) + "px";
+        node.style.top = ((geometry.y/resolution - this.offset.y) | 0) + "px";
+        node.style.width = ((geometry.width/resolution) | 0) + "px";
+        node.style.height = ((geometry.height/resolution) | 0) + "px";
+        
+        return node;
+    },
+    
+    /**
+     * Method: drawText
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * featureId - {String}
+     * style -
+     * location - {<OpenLayers.Geometry.Point>}
+     */
+    drawText: function(featureId, style, location) {
+        var label = this.nodeFactory(featureId + this.LABEL_ID_SUFFIX, "olv:rect");
+        var textbox = this.nodeFactory(featureId + this.LABEL_ID_SUFFIX + "_textbox", "olv:textbox");
+        
+        var resolution = this.getResolution();
+        label.style.left = (((location.x - this.featureDx)/resolution - this.offset.x) | 0) + "px";
+        label.style.top = ((location.y/resolution - this.offset.y) | 0) + "px";
+        label.style.flip = "y";
 
 
-        // take into account the popup's 'padding' property
-        this.fixPadding();
-        wPadding += this.padding.left + this.padding.right;
-        hPadding += this.padding.top + this.padding.bottom;
+        textbox.innerText = style.label;
 
 
-        if (this.closeDiv) {
-            var closeDivWidth = parseInt(this.closeDiv.style.width);
-            wPadding += closeDivWidth + contentDivPadding.right;
+        if (style.cursor != "inherit" && style.cursor != null) {
+            textbox.style.cursor = style.cursor;
         }
         }
-
-        // prevent the popup from being smaller than a specified minimal size
-        if (this.minSize) {
-            safeContentSize.w = Math.max(safeContentSize.w, 
-                (this.minSize.w - wPadding));
-            safeContentSize.h = Math.max(safeContentSize.h, 
-                (this.minSize.h - hPadding));
+        if (style.fontColor) {
+            textbox.style.color = style.fontColor;
+        }
+        if (style.fontOpacity) {
+            textbox.style.filter = 'alpha(opacity=' + (style.fontOpacity * 100) + ')';
+        }
+        if (style.fontFamily) {
+            textbox.style.fontFamily = style.fontFamily;
+        }
+        if (style.fontSize) {
+            textbox.style.fontSize = style.fontSize;
+        }
+        if (style.fontWeight) {
+            textbox.style.fontWeight = style.fontWeight;
+        }
+        if (style.fontStyle) {
+            textbox.style.fontStyle = style.fontStyle;
+        }
+        if(style.labelSelect === true) {
+            label._featureId = featureId;
+            textbox._featureId = featureId;
+            textbox._geometry = location;
+            textbox._geometryClass = location.CLASS_NAME;
         }
         }
+        textbox.style.whiteSpace = "nowrap";
+        // fun with IE: IE7 in standards compliant mode does not display any
+        // text with a left inset of 0. So we set this to 1px and subtract one
+        // pixel later when we set label.style.left
+        textbox.inset = "1px,0px,0px,0px";
 
 
-        // prevent the popup from being bigger than a specified maximum size
-        if (this.maxSize) {
-            safeContentSize.w = Math.min(safeContentSize.w, 
-                (this.maxSize.w - wPadding));
-            safeContentSize.h = Math.min(safeContentSize.h, 
-                (this.maxSize.h - hPadding));
+        if(!label.parentNode) {
+            label.appendChild(textbox);
+            this.textRoot.appendChild(label);
         }
         }
-        
-        //make sure the desired size to set doesn't result in a popup that 
-        // is bigger than the map's viewport.
-        //
-        if (this.map && this.map.size) {
-            
-            var extraX = 0, extraY = 0;
-            if (this.keepInMap && !this.panMapIfOutOfView) {
-                var px = this.map.getPixelFromLonLat(this.lonlat);
-                switch (this.relativePosition) {
-                    case "tr":
-                        extraX = px.x;
-                        extraY = this.map.size.h - px.y;
-                        break;
-                    case "tl":
-                        extraX = this.map.size.w - px.x;
-                        extraY = this.map.size.h - px.y;
-                        break;
-                    case "bl":
-                        extraX = this.map.size.w - px.x;
-                        extraY = px.y;
-                        break;
-                    case "br":
-                        extraX = px.x;
-                        extraY = px.y;
-                        break;
-                    default:    
-                        extraX = px.x;
-                        extraY = this.map.size.h - px.y;
-                        break;
-                }
-            }    
-          
-            var maxY = this.map.size.h - 
-                this.map.paddingForPopups.top - 
-                this.map.paddingForPopups.bottom - 
-                hPadding - extraY;
-            
-            var maxX = this.map.size.w - 
-                this.map.paddingForPopups.left - 
-                this.map.paddingForPopups.right - 
-                wPadding - extraX;
-            
-            safeContentSize.w = Math.min(safeContentSize.w, maxX);
-            safeContentSize.h = Math.min(safeContentSize.h, maxY);
+
+        var align = style.labelAlign || "cm";
+        if (align.length == 1) {
+            align += "m";
         }
         }
+        var xshift = textbox.clientWidth *
+            (OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]);
+        var yshift = textbox.clientHeight *
+            (OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]);
+        label.style.left = parseInt(label.style.left)-xshift-1+"px";
+        label.style.top = parseInt(label.style.top)+yshift+"px";
         
         
-        return safeContentSize;
     },
     
     /**
     },
     
     /**
-     * Method: getContentDivPadding
-     * Glorious, oh glorious hack in order to determine the css 'padding' of 
-     *     the contentDiv. IE/Opera return null here unless we actually add the 
-     *     popup's main 'div' element (which contains contentDiv) to the DOM. 
-     *     So we make it invisible and then add it to the document temporarily. 
-     *
-     *     Once we've taken the padding readings we need, we then remove it 
-     *     from the DOM (it will actually get added to the DOM in 
-     *     Map.js's addPopup)
-     *
+     * Method: moveRoot
+     * moves this renderer's root to a different renderer.
+     * 
+     * Parameters:
+     * renderer - {<OpenLayers.Renderer>} target renderer for the moved root
+     * root - {DOMElement} optional root node. To be used when this renderer
+     *     holds roots from multiple layers to tell this method which one to
+     *     detach
+     * 
      * Returns:
      * Returns:
-     * {<OpenLayers.Bounds>}
+     * {Boolean} true if successful, false otherwise
      */
      */
-    getContentDivPadding: function() {
-
-        //use cached value if we have it
-        var contentDivPadding = this._contentDivPadding;
-        if (!contentDivPadding) {
-
-            if (this.div.parentNode == null) {
-                //make the div invisible and add it to the page        
-                this.div.style.display = "none";
-                document.body.appendChild(this.div);
-            }
-                    
-            //read the padding settings from css, put them in an OL.Bounds        
-            contentDivPadding = new OpenLayers.Bounds(
-                OpenLayers.Element.getStyle(this.contentDiv, "padding-left"),
-                OpenLayers.Element.getStyle(this.contentDiv, "padding-bottom"),
-                OpenLayers.Element.getStyle(this.contentDiv, "padding-right"),
-                OpenLayers.Element.getStyle(this.contentDiv, "padding-top")
-            );
-    
-            //cache the value
-            this._contentDivPadding = contentDivPadding;
-
-            if (this.div.parentNode == document.body) {
-                //remove the div from the page and make it visible again
-                document.body.removeChild(this.div);
-                this.div.style.display = "";
-            }
+    moveRoot: function(renderer) {
+        var layer = this.map.getLayer(renderer.container.id);
+        if(layer instanceof OpenLayers.Layer.Vector.RootContainer) {
+            layer = this.map.getLayer(this.container.id);
         }
         }
-        return contentDivPadding;
+        layer && layer.renderer.clear();
+        OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this, arguments);
+        layer && layer.redraw();
     },
     },
-
+    
     /**
     /**
-     * Method: addCloseBox
+     * Method: importSymbol
+     * add a new symbol definition from the rendererer's symbol hash
      * 
      * Parameters:
      * 
      * Parameters:
-     * callback - {Function} The callback to be called when the close button
-     *     is clicked.
-     */
-    addCloseBox: function(callback) {
-
-        this.closeDiv = OpenLayers.Util.createDiv(
-            this.id + "_close", null, {w: 17, h: 17}
-        );
-        this.closeDiv.className = "olPopupCloseBox"; 
+     * graphicName - {String} name of the symbol to import
+     * 
+     * Returns:
+     * {Object} - hash of {DOMElement} "symbol" and {Number} "size"
+     */      
+    importSymbol: function (graphicName)  {
+        var id = this.container.id + "-" + graphicName;
         
         
-        // use the content div's css padding to determine if we should
-        //  padd the close div
-        var contentDivPadding = this.getContentDivPadding();
-         
-        this.closeDiv.style.right = contentDivPadding.right + "px";
-        this.closeDiv.style.top = contentDivPadding.top + "px";
-        this.groupDiv.appendChild(this.closeDiv);
-
-        var closePopup = callback || function(e) {
-            this.hide();
-            OpenLayers.Event.stop(e);
-        };
-        OpenLayers.Event.observe(this.closeDiv, "touchend", 
-                OpenLayers.Function.bindAsEventListener(closePopup, this));
-        OpenLayers.Event.observe(this.closeDiv, "click", 
-                OpenLayers.Function.bindAsEventListener(closePopup, this));
-    },
-
-    /**
-     * Method: panIntoView
-     * Pans the map such that the popup is totaly viewable (if necessary)
-     */
-    panIntoView: function() {
+        // check if symbol already exists in the cache
+        var cache = this.symbolCache[id];
+        if (cache) {
+            return cache;
+        }
         
         
-        var mapSize = this.map.getSize();
-    
-        //start with the top left corner of the popup, in px, 
-        // relative to the viewport
-        var origTL = this.map.getViewPortPxFromLayerPx( new OpenLayers.Pixel(
-            parseInt(this.div.style.left),
-            parseInt(this.div.style.top)
-        ));
-        var newTL = origTL.clone();
-    
-        //new left (compare to margins, using this.size to calculate right)
-        if (origTL.x < this.map.paddingForPopups.left) {
-            newTL.x = this.map.paddingForPopups.left;
-        } else 
-        if ( (origTL.x + this.size.w) > (mapSize.w - this.map.paddingForPopups.right)) {
-            newTL.x = mapSize.w - this.map.paddingForPopups.right - this.size.w;
+        var symbol = OpenLayers.Renderer.symbol[graphicName];
+        if (!symbol) {
+            throw new Error(graphicName + ' is not a valid symbol name');
         }
         }
+
+        var symbolExtent = new OpenLayers.Bounds(
+                                    Number.MAX_VALUE, Number.MAX_VALUE, 0, 0);
         
         
-        //new top (compare to margins, using this.size to calculate bottom)
-        if (origTL.y < this.map.paddingForPopups.top) {
-            newTL.y = this.map.paddingForPopups.top;
-        } else 
-        if ( (origTL.y + this.size.h) > (mapSize.h - this.map.paddingForPopups.bottom)) {
-            newTL.y = mapSize.h - this.map.paddingForPopups.bottom - this.size.h;
+        var pathitems = ["m"];
+        for (var i=0; i<symbol.length; i=i+2) {
+            var x = symbol[i];
+            var y = symbol[i+1];
+            symbolExtent.left = Math.min(symbolExtent.left, x);
+            symbolExtent.bottom = Math.min(symbolExtent.bottom, y);
+            symbolExtent.right = Math.max(symbolExtent.right, x);
+            symbolExtent.top = Math.max(symbolExtent.top, y);
+
+            pathitems.push(x);
+            pathitems.push(y);
+            if (i == 0) {
+                pathitems.push("l");
+            }
+        }
+        pathitems.push("x e");
+        var path = pathitems.join(" ");
+
+        var diff = (symbolExtent.getWidth() - symbolExtent.getHeight()) / 2;
+        if(diff > 0) {
+            symbolExtent.bottom = symbolExtent.bottom - diff;
+            symbolExtent.top = symbolExtent.top + diff;
+        } else {
+            symbolExtent.left = symbolExtent.left + diff;
+            symbolExtent.right = symbolExtent.right - diff;
         }
         
         }
         
-        var dx = origTL.x - newTL.x;
-        var dy = origTL.y - newTL.y;
+        cache = {
+            path: path,
+            size: symbolExtent.getWidth(), // equals getHeight() now
+            left: symbolExtent.left,
+            bottom: symbolExtent.bottom
+        };
+        this.symbolCache[id] = cache;
         
         
-        this.map.pan(dx, dy);
+        return cache;
     },
     },
+    
+    CLASS_NAME: "OpenLayers.Renderer.VML"
+});
 
 
-    /** 
-     * Method: registerEvents
-     * Registers events on the popup.
+/**
+ * Constant: OpenLayers.Renderer.VML.LABEL_SHIFT
+ * {Object}
+ */
+OpenLayers.Renderer.VML.LABEL_SHIFT = {
+    "l": 0,
+    "c": .5,
+    "r": 1,
+    "t": 0,
+    "m": .5,
+    "b": 1
+};
+/* ======================================================================
+    OpenLayers/Tile.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+
+/**
+ * @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/Util.js
+ */
+
+/**
+ * Class: OpenLayers.Tile 
+ * This is a class designed to designate a single tile, however
+ *     it is explicitly designed to do relatively little. Tiles store 
+ *     information about themselves -- such as the URL that they are related
+ *     to, and their size - but do not add themselves to the layer div 
+ *     automatically, for example. Create a new tile with the 
+ *     <OpenLayers.Tile> constructor, or a subclass. 
+ * 
+ * TBD 3.0 - remove reference to url in above paragraph
+ * 
+ */
+OpenLayers.Tile = OpenLayers.Class({
+    
+    /**
+     * APIProperty: events
+     * {<OpenLayers.Events>} An events object that handles all 
+     *     events on the tile.
      *
      *
-     * Do this in a separate function so that subclasses can 
-     *   choose to override it if they wish to deal differently
-     *   with mouse events
-     * 
-     *   Note in the following handler functions that some special
-     *    care is needed to deal correctly with mousing and popups. 
-     *   
-     *   Because the user might select the zoom-rectangle option and
-     *    then drag it over a popup, we need a safe way to allow the
-     *    mousemove and mouseup events to pass through the popup when
-     *    they are initiated from outside. The same procedure is needed for
-     *    touchmove and touchend events.
-     * 
-     *   Otherwise, we want to essentially kill the event propagation
-     *    for all other events, though we have to do so carefully, 
-     *    without disabling basic html functionality, like clicking on 
-     *    hyperlinks or drag-selecting text.
+     * Register a listener for a particular event with the following syntax:
+     * (code)
+     * tile.events.register(type, obj, listener);
+     * (end)
+     *
+     * Supported event types:
+     * beforedraw - Triggered before the tile is drawn. Used to defer
+     *     drawing to an animation queue. To defer drawing, listeners need
+     *     to return false, which will abort drawing. The queue handler needs
+     *     to call <draw>(true) to actually draw the tile.
+     * loadstart - Triggered when tile loading starts.
+     * loadend - Triggered when tile loading ends.
+     * loaderror - Triggered before the loadend event (i.e. when the tile is
+     *     still hidden) if the tile could not be loaded.
+     * reload - Triggered when an already loading tile is reloaded.
+     * unload - Triggered before a tile is unloaded.
      */
      */
-     registerEvents:function() {
-        this.events = new OpenLayers.Events(this, this.div, null, true);
+    events: null,
 
 
-        function onTouchstart(evt) {
-            OpenLayers.Event.stop(evt, true);
-        }
-        this.events.on({
-            "mousedown": this.onmousedown,
-            "mousemove": this.onmousemove,
-            "mouseup": this.onmouseup,
-            "click": this.onclick,
-            "mouseout": this.onmouseout,
-            "dblclick": this.ondblclick,
-            "touchstart": onTouchstart,
-            scope: this
-        });
-        
-     },
+    /**
+     * APIProperty: eventListeners
+     * {Object} If set as an option at construction, the eventListeners
+     *     object will be registered with <OpenLayers.Events.on>.  Object
+     *     structure must be a listeners object as shown in the example for
+     *     the events.on method.
+     *
+     * This options can be set in the ``tileOptions`` option from
+     * <OpenLayers.Layer.Grid>. For example, to be notified of the
+     * ``loadend`` event of each tiles:
+     * (code)
+     * new OpenLayers.Layer.OSM('osm', 'http://tile.openstreetmap.org/${z}/${x}/${y}.png', {
+     *     tileOptions: {
+     *         eventListeners: {
+     *             'loadend': function(evt) {
+     *                 // do something on loadend
+     *             }
+     *         }
+     *     }
+     * });
+     * (end)
+     */
+    eventListeners: null,
 
 
+    /**
+     * Property: id 
+     * {String} null
+     */
+    id: null,
+    
     /** 
     /** 
-     * Method: onmousedown 
-     * When mouse goes down within the popup, make a note of
-     *   it locally, and then do not propagate the mousedown 
-     *   (but do so safely so that user can select text inside)
-     * 
-     * Parameters:
-     * evt - {Event} 
+     * Property: layer 
+     * {<OpenLayers.Layer>} layer the tile is attached to 
      */
      */
-    onmousedown: function (evt) {
-        this.mousedown = true;
-        OpenLayers.Event.stop(evt, true);
-    },
+    layer: null,
+    
+    /**
+     * Property: url
+     * {String} url of the request.
+     *
+     * TBD 3.0 
+     * Deprecated. The base tile class does not need an url. This should be 
+     * handled in subclasses. Does not belong here.
+     */
+    url: null,
 
     /** 
 
     /** 
-     * Method: onmousemove
-     * If the drag was started within the popup, then 
-     *   do not propagate the mousemove (but do so safely
-     *   so that user can select text inside)
+     * APIProperty: bounds 
+     * {<OpenLayers.Bounds>} null
+     */
+    bounds: null,
+    
+    /** 
+     * Property: size 
+     * {<OpenLayers.Size>} null
+     */
+    size: null,
+    
+    /** 
+     * Property: position 
+     * {<OpenLayers.Pixel>} Top Left pixel of the tile
+     */    
+    position: null,
+    
+    /**
+     * Property: isLoading
+     * {Boolean} Is the tile loading?
+     */
+    isLoading: false,
+    
+    /** TBD 3.0 -- remove 'url' from the list of parameters to the constructor.
+     *             there is no need for the base tile class to have a url.
+     */
+
+    /** 
+     * Constructor: OpenLayers.Tile
+     * Constructor for a new <OpenLayers.Tile> instance.
      * 
      * Parameters:
      * 
      * Parameters:
-     * evt - {Event} 
-     */
-    onmousemove: function (evt) {
-        if (this.mousedown) {
-            OpenLayers.Event.stop(evt, true);
+     * layer - {<OpenLayers.Layer>} layer that the tile will go in.
+     * position - {<OpenLayers.Pixel>}
+     * bounds - {<OpenLayers.Bounds>}
+     * url - {<String>}
+     * size - {<OpenLayers.Size>}
+     * options - {Object}
+     */   
+    initialize: function(layer, position, bounds, url, size, options) {
+        this.layer = layer;
+        this.position = position.clone();
+        this.setBounds(bounds);
+        this.url = url;
+        if (size) {
+            this.size = size.clone();
+        }
+
+        //give the tile a unique id based on its BBOX.
+        this.id = OpenLayers.Util.createUniqueID("Tile_");
+
+        OpenLayers.Util.extend(this, options);
+
+        this.events = new OpenLayers.Events(this);
+        if (this.eventListeners instanceof Object) {
+            this.events.on(this.eventListeners);
         }
     },
 
         }
     },
 
+    /**
+     * Method: unload
+     * Call immediately before destroying if you are listening to tile
+     * events, so that counters are properly handled if tile is still
+     * loading at destroy-time. Will only fire an event if the tile is
+     * still loading.
+     */
+    unload: function() {
+       if (this.isLoading) { 
+           this.isLoading = false; 
+           this.events.triggerEvent("unload"); 
+       }
+    },
+    
     /** 
     /** 
-     * Method: onmouseup
-     * When mouse comes up within the popup, after going down 
-     *   in it, reset the flag, and then (once again) do not 
-     *   propagate the event, but do so safely so that user can 
-     *   select text inside
-     * 
-     * Parameters:
-     * evt - {Event} 
+     * APIMethod: destroy
+     * Nullify references to prevent circular references and memory leaks.
      */
      */
-    onmouseup: function (evt) {
-        if (this.mousedown) {
-            this.mousedown = false;
-            OpenLayers.Event.stop(evt, true);
+    destroy:function() {
+        this.layer  = null;
+        this.bounds = null;
+        this.size = null;
+        this.position = null;
+        
+        if (this.eventListeners) {
+            this.events.un(this.eventListeners);
         }
         }
+        this.events.destroy();
+        this.eventListeners = null;
+        this.events = null;
     },
     },
-
+    
     /**
     /**
-     * Method: onclick
-     * Ignore clicks, but allowing default browser handling
-     * 
+     * Method: draw
+     * Clear whatever is currently in the tile, then return whether or not 
+     *     it should actually be re-drawn. This is an example implementation
+     *     that can be overridden by subclasses. The minimum thing to do here
+     *     is to call <clear> and return the result from <shouldDraw>.
+     *
      * Parameters:
      * Parameters:
-     * evt - {Event} 
+     * force - {Boolean} If true, the tile will not be cleared and no beforedraw
+     *     event will be fired. This is used for drawing tiles asynchronously
+     *     after drawing has been cancelled by returning false from a beforedraw
+     *     listener.
+     * 
+     * Returns:
+     * {Boolean} Whether or not the tile should actually be drawn. Returns null
+     *     if a beforedraw listener returned false.
      */
      */
-    onclick: function (evt) {
-        OpenLayers.Event.stop(evt, true);
+    draw: function(force) {
+        if (!force) {
+            //clear tile's contents and mark as not drawn
+            this.clear();
+        }
+        var draw = this.shouldDraw();
+        if (draw && !force && this.events.triggerEvent("beforedraw") === false) {
+            draw = null;
+        }
+        return draw;
     },
     },
-
-    /** 
-     * Method: onmouseout
-     * When mouse goes out of the popup set the flag to false so that
-     *   if they let go and then drag back in, we won't be confused.
+    
+    /**
+     * Method: shouldDraw
+     * Return whether or not the tile should actually be (re-)drawn. The only
+     * case where we *wouldn't* want to draw the tile is if the tile is outside
+     * its layer's maxExtent
      * 
      * 
+     * Returns:
+     * {Boolean} Whether or not the tile should actually be drawn.
+     */
+    shouldDraw: function() {        
+        var withinMaxExtent = false,
+            maxExtent = this.layer.maxExtent;
+        if (maxExtent) {
+            var map = this.layer.map;
+            var worldBounds = map.baseLayer.wrapDateLine && map.getMaxExtent();
+            if (this.bounds.intersectsBounds(maxExtent, {inclusive: false, worldBounds: worldBounds})) {
+                withinMaxExtent = true;
+            }
+        }
+        
+        return withinMaxExtent || this.layer.displayOutsideMaxExtent;
+    },
+    
+    /**
+     * Method: setBounds
+     * Sets the bounds on this instance
+     *
      * Parameters:
      * Parameters:
-     * evt - {Event} 
+     * bounds {<OpenLayers.Bounds>}
      */
      */
-    onmouseout: function (evt) {
-        this.mousedown = false;
+    setBounds: function(bounds) {
+        bounds = bounds.clone();
+        if (this.layer.map.baseLayer.wrapDateLine) {
+            var worldExtent = this.layer.map.getMaxExtent(),
+                tolerance = this.layer.map.getResolution();
+            bounds = bounds.wrapDateLine(worldExtent, {
+                leftTolerance: tolerance,
+                rightTolerance: tolerance
+            });
+        }
+        this.bounds = bounds;
     },
     
     /** 
     },
     
     /** 
-     * Method: ondblclick
-     * Ignore double-clicks, but allowing default browser handling
-     * 
+     * Method: moveTo
+     * Reposition the tile.
+     *
      * Parameters:
      * Parameters:
-     * evt - {Event} 
+     * bounds - {<OpenLayers.Bounds>}
+     * position - {<OpenLayers.Pixel>}
+     * redraw - {Boolean} Call draw method on tile after moving.
+     *     Default is true
      */
      */
-    ondblclick: function (evt) {
-        OpenLayers.Event.stop(evt, true);
+    moveTo: function (bounds, position, redraw) {
+        if (redraw == null) {
+            redraw = true;
+        }
+
+        this.setBounds(bounds);
+        this.position = position.clone();
+        if (redraw) {
+            this.draw();
+        }
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Popup"
+    /** 
+     * Method: clear
+     * Clear the tile of any bounds/position-related data so that it can 
+     *     be reused in a new location.
+     */
+    clear: function(draw) {
+        // to be extended by subclasses
+    },
+    
+    CLASS_NAME: "OpenLayers.Tile"
 });
 });
-
-OpenLayers.Popup.WIDTH = 200;
-OpenLayers.Popup.HEIGHT = 200;
-OpenLayers.Popup.COLOR = "white";
-OpenLayers.Popup.OPACITY = 1;
-OpenLayers.Popup.BORDER = "0px";
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Popup/Anchored.js
+    OpenLayers/Tile/Image.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 
 /**
- * @requires OpenLayers/Popup.js
+ * @requires OpenLayers/Tile.js
+ * @requires OpenLayers/Animation.js
+ * @requires OpenLayers/Util.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Popup.Anchored
- * 
+ * Class: OpenLayers.Tile.Image
+ * Instances of OpenLayers.Tile.Image are used to manage the image tiles
+ * used by various layers.  Create a new image tile with the
+ * <OpenLayers.Tile.Image> constructor.
+ *
  * Inherits from:
  * Inherits from:
- *  - <OpenLayers.Popup>
+ *  - <OpenLayers.Tile>
  */
  */
-OpenLayers.Popup.Anchored = 
-  OpenLayers.Class(OpenLayers.Popup, {
+OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
+
+    /**
+     * APIProperty: events
+     * {<OpenLayers.Events>} An events object that handles all 
+     *     events on the tile.
+     *
+     * Register a listener for a particular event with the following syntax:
+     * (code)
+     * tile.events.register(type, obj, listener);
+     * (end)
+     *
+     * Supported event types (in addition to the <OpenLayers.Tile> events):
+     * beforeload - Triggered before an image is prepared for loading, when the
+     *     url for the image is known already. Listeners may call <setImage> on
+     *     the tile instance. If they do so, that image will be used and no new
+     *     one will be created.
+     */
 
     /** 
 
     /** 
-     * Property: relativePosition
-     * {String} Relative position of the popup ("br", "tr", "tl" or "bl").
+     * APIProperty: url
+     * {String} The URL of the image being requested. No default. Filled in by
+     * layer.getURL() function. May be modified by loadstart listeners.
      */
      */
-    relativePosition: null,
+    url: null,
+    
+    /** 
+     * Property: imgDiv
+     * {HTMLImageElement} The image for this tile.
+     */
+    imgDiv: null,
     
     /**
     
     /**
-     * APIProperty: keepInMap 
-     * {Boolean} If panMapIfOutOfView is false, and this property is true, 
-     *     contrain the popup such that it always fits in the available map
-     *     space. By default, this is set. If you are creating popups that are
-     *     near map edges and not allowing pannning, and especially if you have
-     *     a popup which has a fixedRelativePosition, setting this to false may
-     *     be a smart thing to do.
-     *   
-     *     For anchored popups, default is true, since subclasses will
-     *     usually want this functionality.
+     * Property: frame
+     * {DOMElement} The image element is appended to the frame.  Any gutter on
+     * the image will be hidden behind the frame. If no gutter is set,
+     * this will be null.
+     *
+    frame: null, 
+
+    /** 
+     * Property: imageReloadAttempts
+     * {Integer} Attempts to load the image.
      */
      */
-    keepInMap: true,
+    imageReloadAttempts: null,
+    
+    /**
+     * Property: layerAlphaHack
+     * {Boolean} True if the png alpha hack needs to be applied on the layer's div.
+     */
+    layerAlphaHack: null,
+    
+    /**
+     * Property: asyncRequestId
+     * {Integer} ID of an request to see if request is still valid. This is a
+     * number which increments by 1 for each asynchronous request.
+     */
+    asyncRequestId: null,
+    
+    /**
+     * APIProperty: maxGetUrlLength
+     * {Number} If set, requests that would result in GET urls with more
+     * characters than the number provided will be made using form-encoded
+     * HTTP POST. It is good practice to avoid urls that are longer than 2048
+     * characters.
+     *
+     * Caution:
+     * Older versions of Gecko based browsers (e.g. Firefox < 3.5) and most
+     * Opera versions do not fully support this option. On all browsers,
+     * transition effects are not supported if POST requests are used.
+     */
+    maxGetUrlLength: null,
 
     /**
 
     /**
-     * Property: anchor
-     * {Object} Object to which we'll anchor the popup. Must expose a 
-     *     'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>).
+     * Property: canvasContext
+     * {CanvasRenderingContext2D} A canvas context associated with
+     * the tile image.
+     */
+    canvasContext: null,
+    
+    /**
+     * APIProperty: crossOriginKeyword
+     * The value of the crossorigin keyword to use when loading images. This is
+     * only relevant when using <getCanvasContext> for tiles from remote
+     * origins and should be set to either 'anonymous' or 'use-credentials'
+     * for servers that send Access-Control-Allow-Origin headers with their
+     * tiles.
+     */
+    crossOriginKeyword: null,
+
+    /** TBD 3.0 - reorder the parameters to the init function to remove 
+     *             URL. the getUrl() function on the layer gets called on 
+     *             each draw(), so no need to specify it here.
      */
      */
-    anchor: null,
 
     /** 
 
     /** 
-    * Constructor: OpenLayers.Popup.Anchored
-    * 
-    * Parameters:
-    * id - {String}
-    * lonlat - {<OpenLayers.LonLat>}
-    * contentSize - {<OpenLayers.Size>}
-    * contentHTML - {String}
-    * anchor - {Object} Object which must expose a 'size' <OpenLayers.Size> 
-    *     and 'offset' <OpenLayers.Pixel> (generally an <OpenLayers.Icon>).
-    * closeBox - {Boolean}
-    * closeBoxCallback - {Function} Function to be called on closeBox click.
-    */
-    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox,
-                        closeBoxCallback) {
-        var newArguments = [
-            id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback
-        ];
-        OpenLayers.Popup.prototype.initialize.apply(this, newArguments);
+     * Constructor: OpenLayers.Tile.Image
+     * Constructor for a new <OpenLayers.Tile.Image> instance.
+     * 
+     * Parameters:
+     * layer - {<OpenLayers.Layer>} layer that the tile will go in.
+     * position - {<OpenLayers.Pixel>}
+     * bounds - {<OpenLayers.Bounds>}
+     * url - {<String>} Deprecated. Remove me in 3.0.
+     * size - {<OpenLayers.Size>}
+     * options - {Object}
+     */   
+    initialize: function(layer, position, bounds, url, size, options) {
+        OpenLayers.Tile.prototype.initialize.apply(this, arguments);
 
 
-        this.anchor = (anchor != null) ? anchor 
-                                       : { size: new OpenLayers.Size(0,0),
-                                           offset: new OpenLayers.Pixel(0,0)};
-    },
+        this.url = url; //deprecated remove me
+        
+        this.layerAlphaHack = this.layer.alpha && OpenLayers.Util.alphaHack();
 
 
-    /**
+        if (this.maxGetUrlLength != null || this.layer.gutter || this.layerAlphaHack) {
+            // only create frame if it's needed
+            this.frame = document.createElement("div");
+            this.frame.style.position = "absolute";
+            this.frame.style.overflow = "hidden";
+        }
+        if (this.maxGetUrlLength != null) {
+            OpenLayers.Util.extend(this, OpenLayers.Tile.Image.IFrame);
+        }
+    },
+    
+    /** 
      * APIMethod: destroy
      * APIMethod: destroy
+     * nullify references to prevent circular references and memory leaks
      */
     destroy: function() {
      */
     destroy: function() {
-        this.anchor = null;
-        this.relativePosition = null;
-        
-        OpenLayers.Popup.prototype.destroy.apply(this, arguments);        
+        if (this.imgDiv)  {
+            this.clear();
+            this.imgDiv = null;
+            this.frame = null;
+        }
+        // don't handle async requests any more
+        this.asyncRequestId = null;
+        OpenLayers.Tile.prototype.destroy.apply(this, arguments);
+    },
+    
+    /**
+     * Method: draw
+     * Check that a tile should be drawn, and draw it.
+     * 
+     * Returns:
+     * {Boolean} Was a tile drawn? Or null if a beforedraw listener returned
+     *     false.
+     */
+    draw: function() {
+        var shouldDraw = OpenLayers.Tile.prototype.draw.apply(this, arguments);
+        if (shouldDraw) {
+            // The layer's reproject option is deprecated.
+            if (this.layer != this.layer.map.baseLayer && this.layer.reproject) {
+                // getBoundsFromBaseLayer is defined in deprecated.js.
+                this.bounds = this.getBoundsFromBaseLayer(this.position);
+            }
+            if (this.isLoading) {
+                //if we're already loading, send 'reload' instead of 'loadstart'.
+                this._loadEvent = "reload";
+            } else {
+                this.isLoading = true;
+                this._loadEvent = "loadstart";
+            }
+            this.renderTile();
+            this.positionTile();
+        } else if (shouldDraw === false) {
+            this.unload();
+        }
+        return shouldDraw;
+    },
+    
+    /**
+     * Method: renderTile
+     * Internal function to actually initialize the image tile,
+     *     position it correctly, and set its url.
+     */
+    renderTile: function() {
+        if (this.layer.async) {
+            // Asynchronous image requests call the asynchronous getURL method
+            // on the layer to fetch an image that covers 'this.bounds'.
+            var id = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
+            this.layer.getURLasync(this.bounds, function(url) {
+                if (id == this.asyncRequestId) {
+                    this.url = url;
+                    this.initImage();
+                }
+            }, this);
+        } else {
+            // synchronous image requests get the url immediately.
+            this.url = this.layer.getURL(this.bounds);
+            this.initImage();
+        }
     },
 
     /**
     },
 
     /**
-     * APIMethod: show
-     * Overridden from Popup since user might hide popup and then show() it 
-     *     in a new location (meaning we might want to update the relative
-     *     position on the show)
+     * Method: positionTile
+     * Using the properties currenty set on the layer, position the tile correctly.
+     * This method is used both by the async and non-async versions of the Tile.Image
+     * code.
      */
      */
-    show: function() {
-        this.updatePosition();
-        OpenLayers.Popup.prototype.show.apply(this, arguments);
+    positionTile: function() {
+        var style = this.getTile().style,
+            size = this.frame ? this.size :
+                this.layer.getImageSize(this.bounds),
+            ratio = 1;
+        if (this.layer instanceof OpenLayers.Layer.Grid) {
+            ratio = this.layer.getServerResolution() / this.layer.map.getResolution();
+        }
+        style.left = this.position.x + "px";
+        style.top = this.position.y + "px";
+        style.width = Math.round(ratio * size.w) + "px";
+        style.height = Math.round(ratio * size.h) + "px";
+    },
+
+    /** 
+     * Method: clear
+     * Remove the tile from the DOM, clear it of any image related data so that
+     * it can be reused in a new location.
+     */
+    clear: function() {
+        OpenLayers.Tile.prototype.clear.apply(this, arguments);
+        var img = this.imgDiv;
+        if (img) {
+            var tile = this.getTile();
+            if (tile.parentNode === this.layer.div) {
+                this.layer.div.removeChild(tile);
+            }
+            this.setImgSrc();
+            if (this.layerAlphaHack === true) {
+                img.style.filter = "";
+            }
+            OpenLayers.Element.removeClass(img, "olImageLoadError");
+        }
+        this.canvasContext = null;
     },
     },
+    
+    /**
+     * Method: getImage
+     * Returns or creates and returns the tile image.
+     */
+    getImage: function() {
+        if (!this.imgDiv) {
+            this.imgDiv = OpenLayers.Tile.Image.IMAGE.cloneNode(false);
+
+            var style = this.imgDiv.style;
+            if (this.frame) {
+                var left = 0, top = 0;
+                if (this.layer.gutter) {
+                    left = this.layer.gutter / this.layer.tileSize.w * 100;
+                    top = this.layer.gutter / this.layer.tileSize.h * 100;
+                }
+                style.left = -left + "%";
+                style.top = -top + "%";
+                style.width = (2 * left + 100) + "%";
+                style.height = (2 * top + 100) + "%";
+            }
+            style.visibility = "hidden";
+            style.opacity = 0;
+            if (this.layer.opacity < 1) {
+                style.filter = 'alpha(opacity=' +
+                               (this.layer.opacity * 100) +
+                               ')';
+            }
+            style.position = "absolute";
+            if (this.layerAlphaHack) {
+                // move the image out of sight
+                style.paddingTop = style.height;
+                style.height = "0";
+                style.width = "100%";
+            }
+            if (this.frame) {
+                this.frame.appendChild(this.imgDiv);
+            }
+        }
 
 
+        return this.imgDiv;
+    },
+    
     /**
     /**
-     * Method: moveTo
-     * Since the popup is moving to a new px, it might need also to be moved
-     *     relative to where the marker is. We first calculate the new 
-     *     relativePosition, and then we calculate the new px where we will 
-     *     put the popup, based on the new relative position. 
-     * 
-     *     If the relativePosition has changed, we must also call 
-     *     updateRelativePosition() to make any visual changes to the popup 
-     *     which are associated with putting it in a new relativePosition.
-     * 
+     * APIMethod: setImage
+     * Sets the image element for this tile. This method should only be called
+     * from beforeload listeners.
+     *
+     * Parameters
+     * img - {HTMLImageElement} The image to use for this tile.
+     */
+    setImage: function(img) {
+        this.imgDiv = img;
+    },
+
+    /**
+     * Method: initImage
+     * Creates the content for the frame on the tile.
+     */
+    initImage: function() {
+        if (!this.url && !this.imgDiv) {
+            // fast path out - if there is no tile url and no previous image
+            this.isLoading = false;
+            return;
+        }
+        this.events.triggerEvent('beforeload');
+        this.layer.div.appendChild(this.getTile());
+        this.events.triggerEvent(this._loadEvent);
+        var img = this.getImage();
+        var src = img.getAttribute('src') || '';
+        if (this.url && OpenLayers.Util.isEquivalentUrl(src, this.url)) {
+            this._loadTimeout = window.setTimeout(
+                OpenLayers.Function.bind(this.onImageLoad, this), 0
+            );
+        } else {
+            this.stopLoading();
+            if (this.crossOriginKeyword) {
+                img.removeAttribute("crossorigin");
+            }
+            OpenLayers.Event.observe(img, "load",
+                OpenLayers.Function.bind(this.onImageLoad, this)
+            );
+            OpenLayers.Event.observe(img, "error",
+                OpenLayers.Function.bind(this.onImageError, this)
+            );
+            this.imageReloadAttempts = 0;
+            this.setImgSrc(this.url);
+        }
+    },
+    
+    /**
+     * Method: setImgSrc
+     * Sets the source for the tile image
+     *
      * Parameters:
      * Parameters:
-     * px - {<OpenLayers.Pixel>}
+     * url - {String} or undefined to hide the image
      */
      */
-    moveTo: function(px) {
-        var oldRelativePosition = this.relativePosition;
-        this.relativePosition = this.calculateRelativePosition(px);
+    setImgSrc: function(url) {
+        var img = this.imgDiv;
+        if (url) {
+            img.style.visibility = 'hidden';
+            img.style.opacity = 0;
+            // don't set crossOrigin if the url is a data URL
+            if (this.crossOriginKeyword) {
+                if (url.substr(0, 5) !== 'data:') {
+                    img.setAttribute("crossorigin", this.crossOriginKeyword);
+                } else {
+                    img.removeAttribute("crossorigin");
+                }
+            }
+            img.src = url;
+        } else {
+            // Remove reference to the image, and leave it to the browser's
+            // caching and garbage collection.
+            this.stopLoading();
+            this.imgDiv = null;
+            if (img.parentNode) {
+                img.parentNode.removeChild(img);
+            }
+        }
+    },
+    
+    /**
+     * Method: getTile
+     * Get the tile's markup.
+     *
+     * Returns:
+     * {DOMElement} The tile's markup
+     */
+    getTile: function() {
+        return this.frame ? this.frame : this.getImage();
+    },
 
 
-        OpenLayers.Popup.prototype.moveTo.call(this, this.calculateNewPx(px));
-        
-        //if this move has caused the popup to change its relative position, 
-        // we need to make the appropriate cosmetic changes.
-        if (this.relativePosition != oldRelativePosition) {
-            this.updateRelativePosition();
+    /**
+     * Method: createBackBuffer
+     * Create a backbuffer for this tile. A backbuffer isn't exactly a clone
+     * of the tile's markup, because we want to avoid the reloading of the
+     * image. So we clone the frame, and steal the image from the tile.
+     *
+     * Returns:
+     * {DOMElement} The markup, or undefined if the tile has no image
+     * or if it's currently loading.
+     */
+    createBackBuffer: function() {
+        if (!this.imgDiv || this.isLoading) {
+            return;
+        }
+        var backBuffer;
+        if (this.frame) {
+            backBuffer = this.frame.cloneNode(false);
+            backBuffer.appendChild(this.imgDiv);
+        } else {
+            backBuffer = this.imgDiv;
+        }
+        this.imgDiv = null;
+        return backBuffer;
+    },
+
+    /**
+     * Method: onImageLoad
+     * Handler for the image onload event
+     */
+    onImageLoad: function() {
+        var img = this.imgDiv;
+        this.stopLoading();
+        img.style.visibility = 'inherit';
+        img.style.opacity = this.layer.opacity;
+        this.isLoading = false;
+        this.canvasContext = null;
+        this.events.triggerEvent("loadend");
+
+        if (this.layerAlphaHack === true) {
+            img.style.filter =
+                "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
+                img.src + "', sizingMethod='scale')";
         }
     },
         }
     },
-
+    
     /**
     /**
-     * APIMethod: setSize
-     * 
-     * Parameters:
-     * contentSize - {<OpenLayers.Size>} the new size for the popup's 
-     *     contents div (in pixels).
+     * Method: onImageError
+     * Handler for the image onerror event
      */
      */
-    setSize:function(contentSize) { 
-        OpenLayers.Popup.prototype.setSize.apply(this, arguments);
-
-        if ((this.lonlat) && (this.map)) {
-            var px = this.map.getLayerPxFromLonLat(this.lonlat);
-            this.moveTo(px);
+    onImageError: function() {
+        var img = this.imgDiv;
+        if (img.src != null) {
+            this.imageReloadAttempts++;
+            if (this.imageReloadAttempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
+                this.setImgSrc(this.layer.getURL(this.bounds));
+            } else {
+                OpenLayers.Element.addClass(img, "olImageLoadError");
+                this.events.triggerEvent("loaderror");
+                this.onImageLoad();
+            }
         }
         }
-    },  
+    },
     
     
-    /** 
-     * Method: calculateRelativePosition
-     * 
-     * Parameters:
-     * px - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {String} The relative position ("br" "tr" "tl" "bl") at which the popup
-     *     should be placed.
-     */
-    calculateRelativePosition:function(px) {
-        var lonlat = this.map.getLonLatFromLayerPx(px);        
-        
-        var extent = this.map.getExtent();
-        var quadrant = extent.determineQuadrant(lonlat);
-        
-        return OpenLayers.Bounds.oppositeQuadrant(quadrant);
-    }, 
-
     /**
     /**
-     * Method: updateRelativePosition
-     * The popup has been moved to a new relative location, so we may want to 
-     *     make some cosmetic adjustments to it. 
-     * 
-     *     Note that in the classic Anchored popup, there is nothing to do 
-     *     here, since the popup looks exactly the same in all four positions.
-     *     Subclasses such as Framed, however, will want to do something
-     *     special here.
+     * Method: stopLoading
+     * Stops a loading sequence so <onImageLoad> won't be executed.
      */
      */
-    updateRelativePosition: function() {
-        //to be overridden by subclasses
+    stopLoading: function() {
+        OpenLayers.Event.stopObservingElement(this.imgDiv);
+        window.clearTimeout(this._loadTimeout);
+        delete this._loadTimeout;
     },
 
     },
 
-    /** 
-     * Method: calculateNewPx
-     * 
-     * Parameters:
-     * px - {<OpenLayers.Pixel>}
-     * 
+    /**
+     * APIMethod: getCanvasContext
+     * Returns a canvas context associated with the tile image (with
+     * the image drawn on it).
+     * Returns undefined if the browser does not support canvas, if
+     * the tile has no image or if it's currently loading.
+     *
+     * The function returns a canvas context instance but the
+     * underlying canvas is still available in the 'canvas' property:
+     * (code)
+     * var context = tile.getCanvasContext();
+     * if (context) {
+     *     var data = context.canvas.toDataURL('image/jpeg');
+     * }
+     * (end)
+     *
      * Returns:
      * Returns:
-     * {<OpenLayers.Pixel>} The the new px position of the popup on the screen
-     *     relative to the passed-in px.
+     * {Boolean}
      */
      */
-    calculateNewPx:function(px) {
-        var newPx = px.offset(this.anchor.offset);
-        
-        //use contentSize if size is not already set
-        var size = this.size || this.contentSize;
-
-        var top = (this.relativePosition.charAt(0) == 't');
-        newPx.y += (top) ? -size.h : this.anchor.size.h;
-        
-        var left = (this.relativePosition.charAt(1) == 'l');
-        newPx.x += (left) ? -size.w : this.anchor.size.w;
-
-        return newPx;   
+    getCanvasContext: function() {
+        if (OpenLayers.CANVAS_SUPPORTED && this.imgDiv && !this.isLoading) {
+            if (!this.canvasContext) {
+                var canvas = document.createElement("canvas");
+                canvas.width = this.size.w;
+                canvas.height = this.size.h;
+                this.canvasContext = canvas.getContext("2d");
+                this.canvasContext.drawImage(this.imgDiv, 0, 0);
+            }
+            return this.canvasContext;
+        }
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Popup.Anchored"
+    CLASS_NAME: "OpenLayers.Tile.Image"
+
 });
 });
+
+/** 
+ * Constant: OpenLayers.Tile.Image.IMAGE
+ * {HTMLImageElement} The image for a tile.
+ */
+OpenLayers.Tile.Image.IMAGE = (function() {
+    var img = new Image();
+    img.className = "olTileImage";
+    // avoid image gallery menu in IE6
+    img.galleryImg = "no";
+    return img;
+}());
+
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Popup/Framed.js
+    OpenLayers/Layer/Image.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
-
 /**
 /**
- * @requires OpenLayers/Popup/Anchored.js
+ * @requires OpenLayers/Layer.js
+ * @requires OpenLayers/Tile/Image.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Popup.Framed
- * 
+ * Class: OpenLayers.Layer.Image
+ * Instances of OpenLayers.Layer.Image are used to display data from a web
+ * accessible image as a map layer.  Create a new image layer with the
+ * <OpenLayers.Layer.Image> constructor.
+ *
  * Inherits from:
  * Inherits from:
- *  - <OpenLayers.Popup.Anchored>
+ *  - <OpenLayers.Layer>
  */
  */
-OpenLayers.Popup.Framed =
-  OpenLayers.Class(OpenLayers.Popup.Anchored, {
+OpenLayers.Layer.Image = OpenLayers.Class(OpenLayers.Layer, {
 
     /**
 
     /**
-     * Property: imageSrc
-     * {String} location of the image to be used as the popup frame
+     * Property: isBaseLayer
+     * {Boolean} The layer is a base layer.  Default is true.  Set this property
+     * in the layer options
      */
      */
-    imageSrc: null,
-
+    isBaseLayer: true,
+    
     /**
     /**
-     * Property: imageSize
-     * {<OpenLayers.Size>} Size (measured in pixels) of the image located
-     *     by the 'imageSrc' property.
+     * Property: url
+     * {String} URL of the image to use
      */
      */
-    imageSize: null,
+    url: null,
 
     /**
 
     /**
-     * APIProperty: isAlphaImage
-     * {Boolean} The image has some alpha and thus needs to use the alpha 
-     *     image hack. Note that setting this to true will have no noticeable
-     *     effect in FF or IE7 browsers, but will all but crush the ie6 
-     *     browser. 
-     *     Default is false.
+     * Property: extent
+     * {<OpenLayers.Bounds>} The image bounds in map units.  This extent will
+     *     also be used as the default maxExtent for the layer.  If you wish
+     *     to have a maxExtent that is different than the image extent, set the
+     *     maxExtent property of the options argument (as with any other layer).
      */
      */
-    isAlphaImage: false,
-
+    extent: null,
+    
     /**
     /**
-     * Property: positionBlocks
-     * {Object} Hash of different position blocks (Object/Hashs). Each block 
-     *     will be keyed by a two-character 'relativePosition' 
-     *     code string (ie "tl", "tr", "bl", "br"). Block properties are 
-     *     'offset', 'padding' (self-explanatory), and finally the 'blocks'
-     *     parameter, which is an array of the block objects. 
-     * 
-     *     Each block object must have 'size', 'anchor', and 'position' 
-     *     properties.
-     * 
-     *     Note that positionBlocks should never be modified at runtime.
+     * Property: size
+     * {<OpenLayers.Size>} The image size in pixels
      */
      */
-    positionBlocks: null,
+    size: null,
 
     /**
 
     /**
-     * Property: blocks
-     * {Array[Object]} Array of objects, each of which is one "block" of the 
-     *     popup. Each block has a 'div' and an 'image' property, both of 
-     *     which are DOMElements, and the latter of which is appended to the 
-     *     former. These are reused as the popup goes changing positions for
-     *     great economy and elegance.
+     * Property: tile
+     * {<OpenLayers.Tile.Image>}
      */
      */
-    blocks: null,
+    tile: null,
 
 
-    /** 
-     * APIProperty: fixedRelativePosition
-     * {Boolean} We want the framed popup to work dynamically placed relative
-     *     to its anchor but also in just one fixed position. A well designed
-     *     framed popup will have the pixels and logic to display itself in 
-     *     any of the four relative positions, but (understandably), this will
-     *     not be the case for all of them. By setting this property to 'true', 
-     *     framed popup will not recalculate for the best placement each time
-     *     it's open, but will always open the same way. 
-     *     Note that if this is set to true, it is generally advisable to also
-     *     set the 'panIntoView' property to true so that the popup can be 
-     *     scrolled into view (since it will often be offscreen on open)
-     *     Default is false.
+    /**
+     * Property: aspectRatio
+     * {Float} The ratio of height/width represented by a single pixel in the
+     * graphic
      */
      */
-    fixedRelativePosition: false,
+    aspectRatio: null,
 
 
-    /** 
-     * Constructor: OpenLayers.Popup.Framed
-     * 
+    /**
+     * Constructor: OpenLayers.Layer.Image
+     * Create a new image layer
+     *
      * Parameters:
      * Parameters:
-     * id - {String}
-     * lonlat - {<OpenLayers.LonLat>}
-     * contentSize - {<OpenLayers.Size>}
-     * contentHTML - {String}
-     * anchor - {Object} Object to which we'll anchor the popup. Must expose 
-     *     a 'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>) 
-     *     (Note that this is generally an <OpenLayers.Icon>).
-     * closeBox - {Boolean}
-     * closeBoxCallback - {Function} Function to be called on closeBox click.
+     * name - {String} A name for the layer.
+     * url - {String} Relative or absolute path to the image
+     * extent - {<OpenLayers.Bounds>} The extent represented by the image
+     * size - {<OpenLayers.Size>} The size (in pixels) of the image
+     * options - {Object} Hashtable of extra options to tag onto the layer
      */
      */
-    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 
-                        closeBoxCallback) {
-
-        OpenLayers.Popup.Anchored.prototype.initialize.apply(this, arguments);
-
-        if (this.fixedRelativePosition) {
-            //based on our decided relativePostion, set the current padding
-            // this keeps us from getting into trouble 
-            this.updateRelativePosition();
-            
-            //make calculateRelativePosition always return the specified
-            // fixed position.
-            this.calculateRelativePosition = function(px) {
-                return this.relativePosition;
-            };
-        }
-
-        this.contentDiv.style.position = "absolute";
-        this.contentDiv.style.zIndex = 1;
-
-        if (closeBox) {
-            this.closeDiv.style.zIndex = 1;
-        }
+    initialize: function(name, url, extent, size, options) {
+        this.url = url;
+        this.extent = extent;
+        this.maxExtent = extent;
+        this.size = size;
+        OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
 
 
-        this.groupDiv.style.position = "absolute";
-        this.groupDiv.style.top = "0px";
-        this.groupDiv.style.left = "0px";
-        this.groupDiv.style.height = "100%";
-        this.groupDiv.style.width = "100%";
-    },
+        this.aspectRatio = (this.extent.getHeight() / this.size.h) /
+                           (this.extent.getWidth() / this.size.w);
+    },    
 
 
-    /** 
-     * APIMethod: destroy
+    /**
+     * Method: destroy
+     * Destroy this layer
      */
     destroy: function() {
      */
     destroy: function() {
-        this.imageSrc = null;
-        this.imageSize = null;
-        this.isAlphaImage = null;
-
-        this.fixedRelativePosition = false;
-        this.positionBlocks = null;
-
-        //remove our blocks
-        for(var i = 0; i < this.blocks.length; i++) {
-            var block = this.blocks[i];
-
-            if (block.image) {
-                block.div.removeChild(block.image);
-            }
-            block.image = null;
-
-            if (block.div) {
-                this.groupDiv.removeChild(block.div);
-            }
-            block.div = null;
+        if (this.tile) {
+            this.removeTileMonitoringHooks(this.tile);
+            this.tile.destroy();
+            this.tile = null;
         }
         }
-        this.blocks = null;
-
-        OpenLayers.Popup.Anchored.prototype.destroy.apply(this, arguments);
+        OpenLayers.Layer.prototype.destroy.apply(this, arguments);
     },
     },
-
+    
     /**
     /**
-     * APIMethod: setBackgroundColor
+     * Method: clone
+     * Create a clone of this layer
+     *
+     * Parameters:
+     * obj - {Object} An optional layer (is this ever used?)
+     *
+     * Returns:
+     * {<OpenLayers.Layer.Image>} An exact copy of this layer
      */
      */
-    setBackgroundColor:function(color) {
-        //does nothing since the framed popup's entire scheme is based on a 
-        // an image -- changing the background color makes no sense. 
-    },
+    clone: function(obj) {
+        
+        if(obj == null) {
+            obj = new OpenLayers.Layer.Image(this.name,
+                                               this.url,
+                                               this.extent,
+                                               this.size,
+                                               this.getOptions());
+        }
 
 
-    /**
-     * APIMethod: setBorder
-     */
-    setBorder:function() {
-        //does nothing since the framed popup's entire scheme is based on a 
-        // an image -- changing the popup's border makes no sense. 
-    },
+        //get all additions from superclasses
+        obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
 
 
+        // copy/set any non-init, non-simple values here
+
+        return obj;
+    },    
+    
     /**
     /**
-     * Method: setOpacity
-     * Sets the opacity of the popup.
+     * APIMethod: setMap
      * 
      * Parameters:
      * 
      * Parameters:
-     * opacity - {float} A value between 0.0 (transparent) and 1.0 (solid).   
+     * map - {<OpenLayers.Map>}
      */
      */
-    setOpacity:function(opacity) {
-        //does nothing since we suppose that we'll never apply an opacity
-        // to a framed popup
+    setMap: function(map) {
+        /**
+         * If nothing to do with resolutions has been set, assume a single
+         * resolution determined by ratio*extent/size - if an image has a
+         * pixel aspect ratio different than one (as calculated above), the
+         * image will be stretched in one dimension only.
+         */
+        if( this.options.maxResolution == null ) {
+            this.options.maxResolution = this.aspectRatio *
+                                         this.extent.getWidth() /
+                                         this.size.w;
+        }
+        OpenLayers.Layer.prototype.setMap.apply(this, arguments);
     },
 
     },
 
-    /**
-     * APIMethod: setSize
-     * Overridden here, because we need to update the blocks whenever the size
-     *     of the popup has changed.
+    /** 
+     * Method: moveTo
+     * Create the tile for the image or resize it for the new resolution
      * 
      * Parameters:
      * 
      * Parameters:
-     * contentSize - {<OpenLayers.Size>} the new size for the popup's 
-     *     contents div (in pixels).
+     * bounds - {<OpenLayers.Bounds>}
+     * zoomChanged - {Boolean}
+     * dragging - {Boolean}
      */
      */
-    setSize:function(contentSize) { 
-        OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments);
+    moveTo:function(bounds, zoomChanged, dragging) {
+        OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
 
 
-        this.updateBlocks();
-    },
+        var firstRendering = (this.tile == null);
 
 
-    /**
-     * Method: updateRelativePosition
-     * When the relative position changes, we need to set the new padding 
-     *     BBOX on the popup, reposition the close div, and update the blocks.
-     */
-    updateRelativePosition: function() {
+        if(zoomChanged || firstRendering) {
 
 
-        //update the padding
-        this.padding = this.positionBlocks[this.relativePosition].padding;
+            //determine new tile size
+            this.setTileSize();
 
 
-        //update the position of our close box to new padding
-        if (this.closeDiv) {
-            // use the content div's css padding to determine if we should
-            //  padd the close div
-            var contentDivPadding = this.getContentDivPadding();
+            //determine new position (upper left corner of new bounds)
+            var ulPx = this.map.getLayerPxFromLonLat({
+                lon: this.extent.left,
+                lat: this.extent.top
+            });
 
 
-            this.closeDiv.style.right = contentDivPadding.right + 
-                                        this.padding.right + "px";
-            this.closeDiv.style.top = contentDivPadding.top + 
-                                      this.padding.top + "px";
+            if(firstRendering) {
+                //create the new tile
+                this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent, 
+                                                      null, this.tileSize);
+                this.addTileMonitoringHooks(this.tile);
+            } else {
+                //just resize the tile and set it's new position
+                this.tile.size = this.tileSize.clone();
+                this.tile.position = ulPx.clone();
+            }
+            this.tile.draw();
         }
         }
+    }, 
 
 
-        this.updateBlocks();
+    /**
+     * Set the tile size based on the map size.
+     */
+    setTileSize: function() {
+        var tileWidth = this.extent.getWidth() / this.map.getResolution();
+        var tileHeight = this.extent.getHeight() / this.map.getResolution();
+        this.tileSize = new OpenLayers.Size(tileWidth, tileHeight);
     },
 
     /** 
     },
 
     /** 
-     * Method: calculateNewPx
-     * Besides the standard offset as determined by the Anchored class, our 
-     *     Framed popups have a special 'offset' property for each of their 
-     *     positions, which is used to offset the popup relative to its anchor.
-     * 
-     * Parameters:
-     * px - {<OpenLayers.Pixel>}
+     * Method: addTileMonitoringHooks
+     * This function takes a tile as input and adds the appropriate hooks to 
+     *     the tile so that the layer can keep track of the loading tiles.
      * 
      * 
-     * Returns:
-     * {<OpenLayers.Pixel>} The the new px position of the popup on the screen
-     *     relative to the passed-in px.
-     */
-    calculateNewPx:function(px) {
-        var newPx = OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(
-            this, arguments
-        );
-
-        newPx = newPx.offset(this.positionBlocks[this.relativePosition].offset);
-
-        return newPx;
-    },
-
-    /**
-     * Method: createBlocks
+     * Parameters: 
+     * tile - {<OpenLayers.Tile>}
      */
      */
-    createBlocks: function() {
-        this.blocks = [];
-
-        //since all positions contain the same number of blocks, we can 
-        // just pick the first position and use its blocks array to create
-        // our blocks array
-        var firstPosition = null;
-        for(var key in this.positionBlocks) {
-            firstPosition = key;
-            break;
-        }
-        
-        var position = this.positionBlocks[firstPosition];
-        for (var i = 0; i < position.blocks.length; i++) {
-
-            var block = {};
-            this.blocks.push(block);
-
-            var divId = this.id + '_FrameDecorationDiv_' + i;
-            block.div = OpenLayers.Util.createDiv(divId, 
-                null, null, null, "absolute", null, "hidden", null
-            );
-
-            var imgId = this.id + '_FrameDecorationImg_' + i;
-            var imageCreator = 
-                (this.isAlphaImage) ? OpenLayers.Util.createAlphaImageDiv
-                                    : OpenLayers.Util.createImage;
-
-            block.image = imageCreator(imgId, 
-                null, this.imageSize, this.imageSrc, 
-                "absolute", null, null, null
-            );
-
-            block.div.appendChild(block.image);
-            this.groupDiv.appendChild(block.div);
-        }
+    addTileMonitoringHooks: function(tile) {
+        tile.onLoadStart = function() {
+            this.events.triggerEvent("loadstart");
+        };
+        tile.events.register("loadstart", this, tile.onLoadStart);
+      
+        tile.onLoadEnd = function() {
+            this.events.triggerEvent("loadend");
+        };
+        tile.events.register("loadend", this, tile.onLoadEnd);
+        tile.events.register("unload", this, tile.onLoadEnd);
     },
 
     },
 
-    /**
-     * Method: updateBlocks
-     * Internal method, called on initialize and when the popup's relative
-     *     position has changed. This function takes care of re-positioning
-     *     the popup's blocks in their appropropriate places.
+    /** 
+     * Method: removeTileMonitoringHooks
+     * This function takes a tile as input and removes the tile hooks 
+     *     that were added in <addTileMonitoringHooks>.
+     * 
+     * Parameters: 
+     * tile - {<OpenLayers.Tile>}
      */
      */
-    updateBlocks: function() {
-        if (!this.blocks) {
-            this.createBlocks();
-        }
-        
-        if (this.size && this.relativePosition) {
-            var position = this.positionBlocks[this.relativePosition];
-            for (var i = 0; i < position.blocks.length; i++) {
-    
-                var positionBlock = position.blocks[i];
-                var block = this.blocks[i];
-    
-                // adjust sizes
-                var l = positionBlock.anchor.left;
-                var b = positionBlock.anchor.bottom;
-                var r = positionBlock.anchor.right;
-                var t = positionBlock.anchor.top;
-    
-                //note that we use the isNaN() test here because if the 
-                // size object is initialized with a "auto" parameter, the 
-                // size constructor calls parseFloat() on the string, 
-                // which will turn it into NaN
-                //
-                var w = (isNaN(positionBlock.size.w)) ? this.size.w - (r + l) 
-                                                      : positionBlock.size.w;
-    
-                var h = (isNaN(positionBlock.size.h)) ? this.size.h - (b + t) 
-                                                      : positionBlock.size.h;
-    
-                block.div.style.width = (w < 0 ? 0 : w) + 'px';
-                block.div.style.height = (h < 0 ? 0 : h) + 'px';
-    
-                block.div.style.left = (l != null) ? l + 'px' : '';
-                block.div.style.bottom = (b != null) ? b + 'px' : '';
-                block.div.style.right = (r != null) ? r + 'px' : '';            
-                block.div.style.top = (t != null) ? t + 'px' : '';
-    
-                block.image.style.left = positionBlock.position.x + 'px';
-                block.image.style.top = positionBlock.position.y + 'px';
-            }
+    removeTileMonitoringHooks: function(tile) {
+        tile.unload();
+        tile.events.un({
+            "loadstart": tile.onLoadStart,
+            "loadend": tile.onLoadEnd,
+            "unload": tile.onLoadEnd,
+            scope: this
+        });
+    },
     
     
-            this.contentDiv.style.left = this.padding.left + "px";
-            this.contentDiv.style.top = this.padding.top + "px";
-        }
+    /**
+     * APIMethod: setUrl
+     * 
+     * Parameters:
+     * newUrl - {String}
+     */
+    setUrl: function(newUrl) {
+        this.url = newUrl;
+        this.tile.draw();
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Popup.Framed"
+    /** 
+     * APIMethod: getURL
+     * The url we return is always the same (the image itself never changes)
+     *     so we can ignore the bounds parameter (it will always be the same, 
+     *     anyways) 
+     * 
+     * Parameters:
+     * bounds - {<OpenLayers.Bounds>}
+     */
+    getURL: function(bounds) {
+        return this.url;
+    },
+
+    CLASS_NAME: "OpenLayers.Layer.Image"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Format/JSON.js
+    OpenLayers/Layer/HTTPRequest.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-/**
- * Note:
- * This work draws heavily from the public domain JSON serializer/deserializer
- *     at http://www.json.org/json.js. Rewritten so that it doesn't modify
- *     basic data prototypes.
- */
 
 /**
 
 /**
- * @requires OpenLayers/Format.js
+ * @requires OpenLayers/Layer.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Format.JSON
- * A parser to read/write JSON safely.  Create a new instance with the
- *     <OpenLayers.Format.JSON> constructor.
- *
- * Inherits from:
- *  - <OpenLayers.Format>
+ * Class: OpenLayers.Layer.HTTPRequest
+ * 
+ * Inherits from: 
+ *  - <OpenLayers.Layer>
  */
  */
-OpenLayers.Format.JSON = OpenLayers.Class(OpenLayers.Format, {
-    
-    /**
-     * APIProperty: indent
-     * {String} For "pretty" printing, the indent string will be used once for
-     *     each indentation level.
-     */
-    indent: "    ",
-    
-    /**
-     * APIProperty: space
-     * {String} For "pretty" printing, the space string will be used after
-     *     the ":" separating a name/value pair.
-     */
-    space: " ",
-    
+OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
+
     /**
     /**
-     * APIProperty: newline
-     * {String} For "pretty" printing, the newline string will be used at the
-     *     end of each name/value pair or array item.
+     * APIProperty: events
+     * {<OpenLayers.Events>}
+     *
+     * Supported event types (in addition to those from <OpenLayers.Layer.events>):
+     * refresh - Triggered when a redraw is forced, to re-fetch data from the
+     *     server.
      */
      */
-    newline: "\n",
-    
-    /**
-     * Property: level
-     * {Integer} For "pretty" printing, this is incremented/decremented during
-     *     serialization.
+
+    /** 
+     * Constant: URL_HASH_FACTOR
+     * {Float} Used to hash URL param strings for multi-WMS server selection.
+     *         Set to the Golden Ratio per Knuth's recommendation.
      */
      */
-    level: 0,
+    URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2,
 
 
-    /**
-     * Property: pretty
-     * {Boolean} Serialize with extra whitespace for structure.  This is set
-     *     by the <write> method.
+    /** 
+     * Property: url
+     * {Array(String) or String} This is either an array of url strings or 
+     *                           a single url string. 
      */
      */
-    pretty: false,
+    url: null,
 
 
-    /**
-     * Property: nativeJSON
-     * {Boolean} Does the browser support native json?
+    /** 
+     * Property: params
+     * {Object} Hashtable of key/value parameters
      */
      */
-    nativeJSON: (function() {
-        return !!(window.JSON && typeof JSON.parse == "function" && typeof JSON.stringify == "function");
-    })(),
+    params: null,
+    
+    /** 
+     * APIProperty: reproject
+     * *Deprecated*. See http://docs.openlayers.org/library/spherical_mercator.html
+     * for information on the replacement for this functionality. 
+     * {Boolean} Whether layer should reproject itself based on base layer 
+     *           locations. This allows reprojection onto commercial layers. 
+     *           Default is false: Most layers can't reproject, but layers 
+     *           which can create non-square geographic pixels can, like WMS.
+     *           
+     */
+    reproject: false,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Format.JSON
-     * Create a new parser for JSON.
-     *
+     * Constructor: OpenLayers.Layer.HTTPRequest
+     * 
      * Parameters:
      * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *     this instance.
+     * name - {String}
+     * url - {Array(String) or String}
+     * params - {Object}
+     * options - {Object} Hashtable of extra options to tag onto the layer
      */
      */
+    initialize: function(name, url, params, options) {
+        OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
+        this.url = url;
+        if (!this.params) {
+            this.params = OpenLayers.Util.extend({}, params);
+        }
+    },
 
     /**
 
     /**
-     * APIMethod: read
-     * Deserialize a json string.
-     *
+     * APIMethod: destroy
+     */
+    destroy: function() {
+        this.url = null;
+        this.params = null;
+        OpenLayers.Layer.prototype.destroy.apply(this, arguments); 
+    },
+    
+    /**
+     * APIMethod: clone
+     * 
      * Parameters:
      * Parameters:
-     * json - {String} A JSON string
-     * filter - {Function} A function which will be called for every key and
-     *     value at every level of the final result. Each value will be
-     *     replaced by the result of the filter function. This can be used to
-     *     reform generic objects into instances of classes, or to transform
-     *     date strings into Date objects.
-     *     
+     * obj - {Object}
+     * 
      * Returns:
      * Returns:
-     * {Object} An object, array, string, or number .
+     * {<OpenLayers.Layer.HTTPRequest>} An exact clone of this 
+     *                                  <OpenLayers.Layer.HTTPRequest>
      */
      */
-    read: function(json, filter) {
-        var object;
-        if (this.nativeJSON) {
-            object = JSON.parse(json, filter);
-        } else try {
-            /**
-             * Parsing happens in three stages. In the first stage, we run the
-             *     text against a regular expression which looks for non-JSON
-             *     characters. We are especially concerned with '()' and 'new'
-             *     because they can cause invocation, and '=' because it can
-             *     cause mutation. But just to be safe, we will reject all
-             *     unexpected characters.
-             */
-            if (/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g, '@').
-                                replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
-                                replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-                /**
-                 * In the second stage we use the eval function to compile the
-                 *     text into a JavaScript structure. The '{' operator is
-                 *     subject to a syntactic ambiguity in JavaScript - it can
-                 *     begin a block or an object literal. We wrap the text in
-                 *     parens to eliminate the ambiguity.
-                 */
-                object = eval('(' + json + ')');
-
-                /**
-                 * In the optional third stage, we recursively walk the new
-                 *     structure, passing each name/value pair to a filter
-                 *     function for possible transformation.
-                 */
-                if(typeof filter === 'function') {
-                    function walk(k, v) {
-                        if(v && typeof v === 'object') {
-                            for(var i in v) {
-                                if(v.hasOwnProperty(i)) {
-                                    v[i] = walk(i, v[i]);
-                                }
-                            }
-                        }
-                        return filter(k, v);
-                    }
-                    object = walk('', object);
-                }
-            }
-        } catch(e) {
-            // Fall through if the regexp test fails.
-        }
-
-        if(this.keepData) {
-            this.data = object;
+    clone: function (obj) {
+        
+        if (obj == null) {
+            obj = new OpenLayers.Layer.HTTPRequest(this.name,
+                                                   this.url,
+                                                   this.params,
+                                                   this.getOptions());
         }
         }
+        
+        //get all additions from superclasses
+        obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
 
 
-        return object;
+        // copy/set any non-init, non-simple values here
+        
+        return obj;
     },
 
     },
 
-    /**
-     * APIMethod: write
-     * Serialize an object into a JSON string.
-     *
+    /** 
+     * APIMethod: setUrl
+     * 
      * Parameters:
      * Parameters:
-     * value - {String} The object, array, string, number, boolean or date
-     *     to be serialized.
-     * pretty - {Boolean} Structure the output with newlines and indentation.
-     *     Default is false.
-     *
-     * Returns:
-     * {String} The JSON string representation of the input value.
+     * newUrl - {String}
      */
      */
-    write: function(value, pretty) {
-        this.pretty = !!pretty;
-        var json = null;
-        var type = typeof value;
-        if(this.serialize[type]) {
-            try {
-                json = (!this.pretty && this.nativeJSON) ?
-                    JSON.stringify(value) :
-                    this.serialize[type].apply(this, [value]);
-            } catch(err) {
-                OpenLayers.Console.error("Trouble serializing: " + err);
-            }
-        }
-        return json;
+    setUrl: function(newUrl) {
+        this.url = newUrl;
     },
     },
-    
+
     /**
     /**
-     * Method: writeIndent
-     * Output an indentation string depending on the indentation level.
+     * APIMethod: mergeNewParams
+     * 
+     * Parameters:
+     * newParams - {Object}
      *
      * Returns:
      *
      * Returns:
-     * {String} An appropriate indentation string.
+     * redrawn: {Boolean} whether the layer was actually redrawn.
      */
      */
-    writeIndent: function() {
-        var pieces = [];
-        if(this.pretty) {
-            for(var i=0; i<this.level; ++i) {
-                pieces.push(this.indent);
-            }
+    mergeNewParams:function(newParams) {
+        this.params = OpenLayers.Util.extend(this.params, newParams);
+        var ret = this.redraw();
+        if(this.map != null) {
+            this.map.events.triggerEvent("changelayer", {
+                layer: this,
+                property: "params"
+            });
         }
         }
-        return pieces.join('');
+        return ret;
     },
     },
-    
+
     /**
     /**
-     * Method: writeNewline
-     * Output a string representing a newline if in pretty printing mode.
+     * APIMethod: redraw
+     * Redraws the layer.  Returns true if the layer was redrawn, false if not.
+     *
+     * Parameters:
+     * force - {Boolean} Force redraw by adding random parameter.
      *
      * Returns:
      *
      * Returns:
-     * {String} A string representing a new line.
+     * {Boolean} The layer was redrawn.
      */
      */
-    writeNewline: function() {
-        return (this.pretty) ? this.newline : '';
+    redraw: function(force) { 
+        if (force) {
+            this.events.triggerEvent('refresh');
+            return this.mergeNewParams({"_olSalt": Math.random()});
+        } else {
+            return OpenLayers.Layer.prototype.redraw.apply(this, []);
+        }
     },
     
     /**
     },
     
     /**
-     * Method: writeSpace
-     * Output a string representing a space if in pretty printing mode.
+     * Method: selectUrl
+     * selectUrl() implements the standard floating-point multiplicative
+     *     hash function described by Knuth, and hashes the contents of the 
+     *     given param string into a float between 0 and 1. This float is then
+     *     scaled to the size of the provided urls array, and used to select
+     *     a URL.
      *
      *
+     * Parameters:
+     * paramString - {String}
+     * urls - {Array(String)}
+     * 
      * Returns:
      * Returns:
-     * {String} A space.
-     */
-    writeSpace: function() {
-        return (this.pretty) ? this.space : '';
-    },
-
-    /**
-     * Property: serialize
-     * Object with properties corresponding to the serializable data types.
-     *     Property values are functions that do the actual serializing.
+     * {String} An entry from the urls array, deterministically selected based
+     *          on the paramString.
      */
      */
-    serialize: {
-        /**
-         * Method: serialize.object
-         * Transform an object into a JSON string.
-         *
-         * Parameters:
-         * object - {Object} The object to be serialized.
-         * 
-         * Returns:
-         * {String} A JSON string representing the object.
-         */
-        'object': function(object) {
-            // three special objects that we want to treat differently
-            if(object == null) {
-                return "null";
-            }
-            if(object.constructor == Date) {
-                return this.serialize.date.apply(this, [object]);
-            }
-            if(object.constructor == Array) {
-                return this.serialize.array.apply(this, [object]);
-            }
-            var pieces = ['{'];
-            this.level += 1;
-            var key, keyJSON, valueJSON;
-            
-            var addComma = false;
-            for(key in object) {
-                if(object.hasOwnProperty(key)) {
-                    // recursive calls need to allow for sub-classing
-                    keyJSON = OpenLayers.Format.JSON.prototype.write.apply(this,
-                                                    [key, this.pretty]);
-                    valueJSON = OpenLayers.Format.JSON.prototype.write.apply(this,
-                                                    [object[key], this.pretty]);
-                    if(keyJSON != null && valueJSON != null) {
-                        if(addComma) {
-                            pieces.push(',');
-                        }
-                        pieces.push(this.writeNewline(), this.writeIndent(),
-                                    keyJSON, ':', this.writeSpace(), valueJSON);
-                        addComma = true;
-                    }
-                }
-            }
-            
-            this.level -= 1;
-            pieces.push(this.writeNewline(), this.writeIndent(), '}');
-            return pieces.join('');
-        },
-        
-        /**
-         * Method: serialize.array
-         * Transform an array into a JSON string.
-         *
-         * Parameters:
-         * array - {Array} The array to be serialized
-         * 
-         * Returns:
-         * {String} A JSON string representing the array.
-         */
-        'array': function(array) {
-            var json;
-            var pieces = ['['];
-            this.level += 1;
-    
-            for(var i=0, len=array.length; i<len; ++i) {
-                // recursive calls need to allow for sub-classing
-                json = OpenLayers.Format.JSON.prototype.write.apply(this,
-                                                    [array[i], this.pretty]);
-                if(json != null) {
-                    if(i > 0) {
-                        pieces.push(',');
-                    }
-                    pieces.push(this.writeNewline(), this.writeIndent(), json);
-                }
-            }
-
-            this.level -= 1;    
-            pieces.push(this.writeNewline(), this.writeIndent(), ']');
-            return pieces.join('');
-        },
-        
-        /**
-         * Method: serialize.string
-         * Transform a string into a JSON string.
-         *
-         * Parameters:
-         * string - {String} The string to be serialized
-         * 
-         * Returns:
-         * {String} A JSON string representing the string.
-         */
-        'string': function(string) {
-            // If the string contains no control characters, no quote characters, and no
-            // backslash characters, then we can simply slap some quotes around it.
-            // Otherwise we must also replace the offending characters with safe
-            // sequences.    
-            var m = {
-                '\b': '\\b',
-                '\t': '\\t',
-                '\n': '\\n',
-                '\f': '\\f',
-                '\r': '\\r',
-                '"' : '\\"',
-                '\\': '\\\\'
-            };
-            if(/["\\\x00-\x1f]/.test(string)) {
-                return '"' + string.replace(/([\x00-\x1f\\"])/g, function(a, b) {
-                    var c = m[b];
-                    if(c) {
-                        return c;
-                    }
-                    c = b.charCodeAt();
-                    return '\\u00' +
-                        Math.floor(c / 16).toString(16) +
-                        (c % 16).toString(16);
-                }) + '"';
-            }
-            return '"' + string + '"';
-        },
+    selectUrl: function(paramString, urls) {
+        var product = 1;
+        for (var i=0, len=paramString.length; i<len; i++) { 
+            product *= paramString.charCodeAt(i) * this.URL_HASH_FACTOR; 
+            product -= Math.floor(product); 
+        }
+        return urls[Math.floor(product * urls.length)];
+    },
 
 
-        /**
-         * Method: serialize.number
-         * Transform a number into a JSON string.
-         *
-         * Parameters:
-         * number - {Number} The number to be serialized.
-         *
-         * Returns:
-         * {String} A JSON string representing the number.
-         */
-        'number': function(number) {
-            return isFinite(number) ? String(number) : "null";
-        },
+    /** 
+     * Method: getFullRequestString
+     * Combine url with layer's params and these newParams. 
+     *   
+     *    does checking on the serverPath variable, allowing for cases when it 
+     *     is supplied with trailing ? or &, as well as cases where not. 
+     *
+     *    return in formatted string like this:
+     *        "server?key1=value1&key2=value2&key3=value3"
+     * 
+     * WARNING: The altUrl parameter is deprecated and will be removed in 3.0.
+     *
+     * Parameters:
+     * newParams - {Object}
+     * altUrl - {String} Use this as the url instead of the layer's url
+     *   
+     * Returns: 
+     * {String}
+     */
+    getFullRequestString:function(newParams, altUrl) {
+
+        // if not altUrl passed in, use layer's url
+        var url = altUrl || this.url;
         
         
-        /**
-         * Method: serialize.boolean
-         * Transform a boolean into a JSON string.
-         *
-         * Parameters:
-         * bool - {Boolean} The boolean to be serialized.
-         * 
-         * Returns:
-         * {String} A JSON string representing the boolean.
-         */
-        'boolean': function(bool) {
-            return String(bool);
-        },
+        // create a new params hashtable with all the layer params and the 
+        // new params together. then convert to string
+        var allParams = OpenLayers.Util.extend({}, this.params);
+        allParams = OpenLayers.Util.extend(allParams, newParams);
+        var paramsString = OpenLayers.Util.getParameterString(allParams);
         
         
-        /**
-         * Method: serialize.object
-         * Transform a date into a JSON string.
-         *
-         * Parameters:
-         * date - {Date} The date to be serialized.
-         * 
-         * Returns:
-         * {String} A JSON string representing the date.
-         */
-        'date': function(date) {    
-            function format(number) {
-                // Format integers to have at least two digits.
-                return (number < 10) ? '0' + number : number;
+        // if url is not a string, it should be an array of strings, 
+        // in which case we will deterministically select one of them in 
+        // order to evenly distribute requests to different urls.
+        //
+        if (OpenLayers.Util.isArray(url)) {
+            url = this.selectUrl(paramsString, url);
+        }   
+        // ignore parameters that are already in the url search string
+        var urlParams = 
+            OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url));
+        for(var key in allParams) {
+            if(key.toUpperCase() in urlParams) {
+                delete allParams[key];
             }
             }
-            return '"' + date.getFullYear() + '-' +
-                    format(date.getMonth() + 1) + '-' +
-                    format(date.getDate()) + 'T' +
-                    format(date.getHours()) + ':' +
-                    format(date.getMinutes()) + ':' +
-                    format(date.getSeconds()) + '"';
         }
         }
+        paramsString = OpenLayers.Util.getParameterString(allParams);
+        
+        return OpenLayers.Util.urlAppend(url, paramsString);
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Format.JSON" 
-
-});     
+    CLASS_NAME: "OpenLayers.Layer.HTTPRequest"
+});
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Format/GeoJSON.js
+    OpenLayers/Layer/Grid.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
+
 /**
 /**
- * @requires OpenLayers/Format/JSON.js
- * @requires OpenLayers/Feature/Vector.js
- * @requires OpenLayers/Geometry/Point.js
- * @requires OpenLayers/Geometry/MultiPoint.js
- * @requires OpenLayers/Geometry/LineString.js
- * @requires OpenLayers/Geometry/MultiLineString.js
- * @requires OpenLayers/Geometry/Polygon.js
- * @requires OpenLayers/Geometry/MultiPolygon.js
- * @requires OpenLayers/Console.js
+ * @requires OpenLayers/Layer/HTTPRequest.js
+ * @requires OpenLayers/Tile/Image.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Format.GeoJSON
- * Read and write GeoJSON. Create a new parser with the
- *     <OpenLayers.Format.GeoJSON> constructor.
+ * Class: OpenLayers.Layer.Grid
+ * Base class for layers that use a lattice of tiles.  Create a new grid
+ * layer with the <OpenLayers.Layer.Grid> constructor.
  *
  * Inherits from:
  *
  * Inherits from:
- *  - <OpenLayers.Format.JSON>
+ *  - <OpenLayers.Layer.HTTPRequest>
  */
  */
-OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
+OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
+    
+    /**
+     * APIProperty: tileSize
+     * {<OpenLayers.Size>}
+     */
+    tileSize: null,
 
     /**
 
     /**
-     * APIProperty: ignoreExtraDims
-     * {Boolean} Ignore dimensions higher than 2 when reading geometry
-     * coordinates.
-     */ 
-    ignoreExtraDims: false,
+     * Property: tileOriginCorner
+     * {String} If the <tileOrigin> property is not provided, the tile origin 
+     *     will be derived from the layer's <maxExtent>.  The corner of the 
+     *     <maxExtent> used is determined by this property.  Acceptable values
+     *     are "tl" (top left), "tr" (top right), "bl" (bottom left), and "br"
+     *     (bottom right).  Default is "bl".
+     */
+    tileOriginCorner: "bl",
     
     /**
     
     /**
-     * Constructor: OpenLayers.Format.GeoJSON
-     * Create a new parser for GeoJSON.
+     * APIProperty: tileOrigin
+     * {<OpenLayers.LonLat>} Optional origin for aligning the grid of tiles.
+     *     If provided, requests for tiles at all resolutions will be aligned
+     *     with this location (no tiles shall overlap this location).  If
+     *     not provided, the grid of tiles will be aligned with the layer's
+     *     <maxExtent>.  Default is ``null``.
+     */
+    tileOrigin: null,
+    
+    /** APIProperty: tileOptions
+     *  {Object} optional configuration options for <OpenLayers.Tile> instances
+     *  created by this Layer, if supported by the tile class.
+     */
+    tileOptions: null,
+
+    /**
+     * APIProperty: tileClass
+     * {<OpenLayers.Tile>} The tile class to use for this layer.
+     *     Defaults is OpenLayers.Tile.Image.
+     */
+    tileClass: OpenLayers.Tile.Image,
+    
+    /**
+     * Property: grid
+     * {Array(Array(<OpenLayers.Tile>))} This is an array of rows, each row is 
+     *     an array of tiles.
+     */
+    grid: null,
+
+    /**
+     * APIProperty: singleTile
+     * {Boolean} Moves the layer into single-tile mode, meaning that one tile 
+     *     will be loaded. The tile's size will be determined by the 'ratio'
+     *     property. When the tile is dragged such that it does not cover the 
+     *     entire viewport, it is reloaded.
+     */
+    singleTile: false,
+
+    /** APIProperty: ratio
+     *  {Float} Used only when in single-tile mode, this specifies the 
+     *          ratio of the size of the single tile to the size of the map.
+     *          Default value is 1.5.
+     */
+    ratio: 1.5,
+
+    /**
+     * APIProperty: buffer
+     * {Integer} Used only when in gridded mode, this specifies the number of 
+     *           extra rows and columns of tiles on each side which will
+     *           surround the minimum grid tiles to cover the map.
+     *           For very slow loading layers, a larger value may increase
+     *           performance somewhat when dragging, but will increase bandwidth
+     *           use significantly. 
+     */
+    buffer: 0,
+
+    /**
+     * APIProperty: transitionEffect
+     * {String} The transition effect to use when the map is zoomed.
+     * Two possible values:
      *
      *
-     * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *     this instance.
+     * "resize" - Existing tiles are resized on zoom to provide a visual
+     *     effect of the zoom having taken place immediately.  As the
+     *     new tiles become available, they are drawn on top of the
+     *     resized tiles (this is the default setting).
+     * "map-resize" - Existing tiles are resized on zoom and placed below the
+     *     base layer.  New tiles for the base layer will cover existing tiles.
+     *     This setting is recommended when having an overlay duplicated during
+     *     the transition is undesirable (e.g. street labels or big transparent
+     *     fills). 
+     * null - No transition effect.
+     *
+     * Using "resize" on non-opaque layers can cause undesired visual
+     * effects.  Set transitionEffect to null in this case.
      */
      */
+    transitionEffect: "resize",
 
     /**
 
     /**
-     * APIMethod: read
-     * Deserialize a GeoJSON string.
+     * APIProperty: numLoadingTiles
+     * {Integer} How many tiles are still loading?
+     */
+    numLoadingTiles: 0,
+
+    /**
+     * Property: serverResolutions
+     * {Array(Number}} This property is documented in subclasses as
+     *     an API property.
+     */
+    serverResolutions: null,
+
+    /**
+     * Property: loading
+     * {Boolean} Indicates if tiles are being loaded.
+     */
+    loading: false,
+    
+    /**
+     * Property: backBuffer
+     * {DOMElement} The back buffer.
+     */
+    backBuffer: null,
+
+    /**
+     * Property: gridResolution
+     * {Number} The resolution of the current grid. Used for backbuffer and
+     *     client zoom. This property is updated every time the grid is
+     *     initialized.
+     */
+    gridResolution: null,
+
+    /**
+     * Property: backBufferResolution
+     * {Number} The resolution of the current back buffer. This property is
+     *     updated each time a back buffer is created.
+     */
+    backBufferResolution: null,
+
+    /**
+     * Property: backBufferLonLat
+     * {Object} The top-left corner of the current back buffer. Includes lon
+     *     and lat properties. This object is updated each time a back buffer
+     *     is created.
+     */
+    backBufferLonLat: null,
+
+    /**
+     * Property: backBufferTimerId
+     * {Number} The id of the back buffer timer. This timer is used to
+     *     delay the removal of the back buffer, thereby preventing
+     *     flash effects caused by tile animation.
+     */
+    backBufferTimerId: null,
+
+    /**
+     * APIProperty: removeBackBufferDelay
+     * {Number} Delay for removing the backbuffer when all tiles have finished
+     *     loading. Can be set to 0 when no css opacity transitions for the
+     *     olTileImage class are used. Default is 0 for <singleTile> layers,
+     *     2500 for tiled layers. See <className> for more information on
+     *     tile animation.
+     */
+    removeBackBufferDelay: null,
+
+    /**
+     * APIProperty: className
+     * {String} Name of the class added to the layer div. If not set in the
+     *     options passed to the constructor then className defaults to
+     *     "olLayerGridSingleTile" for single tile layers (see <singleTile>),
+     *     and "olLayerGrid" for non single tile layers.
      *
      *
-     * Parameters:
-     * json - {String} A GeoJSON string
-     * type - {String} Optional string that determines the structure of
-     *     the output.  Supported values are "Geometry", "Feature", and
-     *     "FeatureCollection".  If absent or null, a default of
-     *     "FeatureCollection" is assumed.
-     * filter - {Function} A function which will be called for every key and
-     *     value at every level of the final result. Each value will be
-     *     replaced by the result of the filter function. This can be used to
-     *     reform generic objects into instances of classes, or to transform
-     *     date strings into Date objects.
+     * Note:
      *
      *
-     * Returns: 
-     * {Object} The return depends on the value of the type argument. If type
-     *     is "FeatureCollection" (the default), the return will be an array
-     *     of <OpenLayers.Feature.Vector>. If type is "Geometry", the input json
-     *     must represent a single geometry, and the return will be an
-     *     <OpenLayers.Geometry>.  If type is "Feature", the input json must
-     *     represent a single feature, and the return will be an
-     *     <OpenLayers.Feature.Vector>.
+     * The displaying of tiles is not animated by default for single tile
+     *     layers - OpenLayers' default theme (style.css) includes this:
+     * (code)
+     * .olLayerGrid .olTileImage {
+     *     -webkit-transition: opacity 0.2s linear;
+     *     -moz-transition: opacity 0.2s linear;
+     *     -o-transition: opacity 0.2s linear;
+     *     transition: opacity 0.2s linear;
+     *  }
+     * (end)
+     * To animate tile displaying for any grid layer the following
+     *     CSS rule can be used:
+     * (code)
+     * .olTileImage {
+     *     -webkit-transition: opacity 0.2s linear;
+     *     -moz-transition: opacity 0.2s linear;
+     *     -o-transition: opacity 0.2s linear;
+     *     transition: opacity 0.2s linear;
+     * }
+     * (end)
+     * In that case, to avoid flash effects, <removeBackBufferDelay>
+     *     should not be zero.
      */
      */
-    read: function(json, type, filter) {
-        type = (type) ? type : "FeatureCollection";
-        var results = null;
-        var obj = null;
-        if (typeof json == "string") {
-            obj = OpenLayers.Format.JSON.prototype.read.apply(this,
-                                                              [json, filter]);
-        } else { 
-            obj = json;
-        }    
-        if(!obj) {
-            OpenLayers.Console.error("Bad JSON: " + json);
-        } else if(typeof(obj.type) != "string") {
-            OpenLayers.Console.error("Bad GeoJSON - no type: " + json);
-        } else if(this.isValidType(obj, type)) {
-            switch(type) {
-                case "Geometry":
-                    try {
-                        results = this.parseGeometry(obj);
-                    } catch(err) {
-                        OpenLayers.Console.error(err);
-                    }
-                    break;
-                case "Feature":
-                    try {
-                        results = this.parseFeature(obj);
-                        results.type = "Feature";
-                    } catch(err) {
-                        OpenLayers.Console.error(err);
-                    }
-                    break;
-                case "FeatureCollection":
-                    // for type FeatureCollection, we allow input to be any type
-                    results = [];
-                    switch(obj.type) {
-                        case "Feature":
-                            try {
-                                results.push(this.parseFeature(obj));
-                            } catch(err) {
-                                results = null;
-                                OpenLayers.Console.error(err);
-                            }
-                            break;
-                        case "FeatureCollection":
-                            for(var i=0, len=obj.features.length; i<len; ++i) {
-                                try {
-                                    results.push(this.parseFeature(obj.features[i]));
-                                } catch(err) {
-                                    results = null;
-                                    OpenLayers.Console.error(err);
-                                }
-                            }
-                            break;
-                        default:
-                            try {
-                                var geom = this.parseGeometry(obj);
-                                results.push(new OpenLayers.Feature.Vector(geom));
-                            } catch(err) {
-                                results = null;
-                                OpenLayers.Console.error(err);
-                            }
-                    }
-                break;
-            }
+    className: null,
+    
+    /**
+     * Register a listener for a particular event with the following syntax:
+     * (code)
+     * layer.events.register(type, obj, listener);
+     * (end)
+     *
+     * Listeners will be called with a reference to an event object.  The
+     *     properties of this event depends on exactly what happened.
+     *
+     * All event objects have at least the following properties:
+     * object - {Object} A reference to layer.events.object.
+     * element - {DOMElement} A reference to layer.events.element.
+     *
+     * Supported event types:
+     * addtile - Triggered when a tile is added to this layer. Listeners receive
+     *     an object as first argument, which has a tile property that
+     *     references the tile that has been added.
+     * tileloadstart - Triggered when a tile starts loading. Listeners receive
+     *     an object as first argument, which has a tile property that
+     *     references the tile that starts loading.
+     * tileloaded - Triggered when each new tile is
+     *     loaded, as a means of progress update to listeners.
+     *     listeners can access 'numLoadingTiles' if they wish to keep
+     *     track of the loading progress. Listeners are called with an object
+     *     with a 'tile' property as first argument, making the loaded tile
+     *     available to the listener, and an 'aborted' property, which will be
+     *     true when loading was aborted and no tile data is available.
+     * tileerror - Triggered before the tileloaded event (i.e. when the tile is
+     *     still hidden) if a tile failed to load. Listeners receive an object
+     *     as first argument, which has a tile property that references the
+     *     tile that could not be loaded.
+     * retile - Triggered when the layer recreates its tile grid.
+     */
+
+    /**
+     * Property: gridLayout
+     * {Object} Object containing properties tilelon, tilelat, startcol,
+     * startrow
+     */
+    gridLayout: null,
+    
+    /**
+     * Property: rowSign
+     * {Number} 1 for grids starting at the top, -1 for grids starting at the
+     * bottom. This is used for several grid index and offset calculations.
+     */
+    rowSign: null,
+
+    /**
+     * Property: transitionendEvents
+     * {Array} Event names for transitionend
+     */
+    transitionendEvents: [
+        'transitionend', 'webkitTransitionEnd', 'otransitionend',
+        'oTransitionEnd'
+    ],
+
+    /**
+     * Constructor: OpenLayers.Layer.Grid
+     * Create a new grid layer
+     *
+     * Parameters:
+     * name - {String}
+     * url - {String}
+     * params - {Object}
+     * options - {Object} Hashtable of extra options to tag onto the layer
+     */
+    initialize: function(name, url, params, options) {
+        OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this, 
+                                                                arguments);
+        this.grid = [];
+        this._removeBackBuffer = OpenLayers.Function.bind(this.removeBackBuffer, this);
+
+        this.initProperties();
+
+        this.rowSign = this.tileOriginCorner.substr(0, 1) === "t" ? 1 : -1;
+    },
+
+    /**
+     * Method: initProperties
+     * Set any properties that depend on the value of singleTile.
+     * Currently sets removeBackBufferDelay and className
+     */
+    initProperties: function() {
+        if (this.options.removeBackBufferDelay === undefined) {
+            this.removeBackBufferDelay = this.singleTile ? 0 : 2500;
         }
         }
-        return results;
+
+        if (this.options.className === undefined) {
+            this.className = this.singleTile ? 'olLayerGridSingleTile' :
+                                               'olLayerGrid';
+        }
+    },
+
+    /**
+     * Method: setMap
+     *
+     * Parameters:
+     * map - {<OpenLayers.Map>} The map.
+     */
+    setMap: function(map) {
+        OpenLayers.Layer.HTTPRequest.prototype.setMap.call(this, map);
+        OpenLayers.Element.addClass(this.div, this.className);
+    },
+
+    /**
+     * Method: removeMap
+     * Called when the layer is removed from the map.
+     *
+     * Parameters:
+     * map - {<OpenLayers.Map>} The map.
+     */
+    removeMap: function(map) {
+        this.removeBackBuffer();
     },
     },
-    
+
     /**
     /**
-     * Method: isValidType
-     * Check if a GeoJSON object is a valid representative of the given type.
-     *
-     * Returns:
-     * {Boolean} The object is valid GeoJSON object of the given type.
+     * APIMethod: destroy
+     * Deconstruct the layer and clear the grid.
      */
      */
-    isValidType: function(obj, type) {
-        var valid = false;
-        switch(type) {
-            case "Geometry":
-                if(OpenLayers.Util.indexOf(
-                    ["Point", "MultiPoint", "LineString", "MultiLineString",
-                     "Polygon", "MultiPolygon", "Box", "GeometryCollection"],
-                    obj.type) == -1) {
-                    // unsupported geometry type
-                    OpenLayers.Console.error("Unsupported geometry type: " +
-                                              obj.type);
-                } else {
-                    valid = true;
-                }
-                break;
-            case "FeatureCollection":
-                // allow for any type to be converted to a feature collection
-                valid = true;
-                break;
-            default:
-                // for Feature types must match
-                if(obj.type == type) {
-                    valid = true;
-                } else {
-                    OpenLayers.Console.error("Cannot convert types from " +
-                                              obj.type + " to " + type);
-                }
-        }
-        return valid;
+    destroy: function() {
+        this.removeBackBuffer();
+        this.clearGrid();
+
+        this.grid = null;
+        this.tileSize = null;
+        OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments); 
     },
     },
-    
+
     /**
     /**
-     * Method: parseFeature
-     * Convert a feature object from GeoJSON into an
-     *     <OpenLayers.Feature.Vector>.
-     *
+     * APIMethod: mergeNewParams
+     * Refetches tiles with new params merged, keeping a backbuffer. Each
+     * loading new tile will have a css class of '.olTileReplacing'. If a
+     * stylesheet applies a 'display: none' style to that class, any fade-in
+     * transition will not apply, and backbuffers for each tile will be removed
+     * as soon as the tile is loaded.
+     * 
      * Parameters:
      * Parameters:
-     * obj - {Object} An object created from a GeoJSON object
+     * newParams - {Object}
      *
      * Returns:
      *
      * Returns:
-     * {<OpenLayers.Feature.Vector>} A feature.
+     * redrawn: {Boolean} whether the layer was actually redrawn.
      */
      */
-    parseFeature: function(obj) {
-        var feature, geometry, attributes, bbox;
-        attributes = (obj.properties) ? obj.properties : {};
-        bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
-        try {
-            geometry = this.parseGeometry(obj.geometry);
-        } catch(err) {
-            // deal with bad geometries
-            throw err;
-        }
-        feature = new OpenLayers.Feature.Vector(geometry, attributes);
-        if(bbox) {
-            feature.bounds = OpenLayers.Bounds.fromArray(bbox);
+
+    /**
+     * Method: clearGrid
+     * Go through and remove all tiles from the grid, calling
+     *    destroy() on each of them to kill circular references
+     */
+    clearGrid:function() {
+        if (this.grid) {
+            for(var iRow=0, len=this.grid.length; iRow<len; iRow++) {
+                var row = this.grid[iRow];
+                for(var iCol=0, clen=row.length; iCol<clen; iCol++) {
+                    var tile = row[iCol];
+                    this.destroyTile(tile);
+                }
+            }
+            this.grid = [];
+            this.gridResolution = null;
+            this.gridLayout = null;
         }
         }
-        if(obj.id) {
-            feature.fid = obj.id;
+    },
+
+   /**
+    * APIMethod: addOptions
+    * 
+    * Parameters:
+    * newOptions - {Object}
+    * reinitialize - {Boolean} If set to true, and if resolution options of the
+    *     current baseLayer were changed, the map will be recentered to make
+    *     sure that it is displayed with a valid resolution, and a
+    *     changebaselayer event will be triggered.
+    */
+    addOptions: function (newOptions, reinitialize) {
+        var singleTileChanged = newOptions.singleTile !== undefined && 
+            newOptions.singleTile !== this.singleTile;
+        OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this, arguments);
+        if (this.map && singleTileChanged) {
+            this.initProperties();
+            this.clearGrid();
+            this.tileSize = this.options.tileSize;
+            this.setTileSize();
+            if (this.visibility) {
+                this.moveTo(null, true);
+            }
         }
         }
-        return feature;
     },
     
     /**
     },
     
     /**
-     * Method: parseGeometry
-     * Convert a geometry object from GeoJSON into an <OpenLayers.Geometry>.
+     * APIMethod: clone
+     * Create a clone of this layer
      *
      * Parameters:
      *
      * Parameters:
-     * obj - {Object} An object created from a GeoJSON object
-     *
-     * Returns: 
-     * {<OpenLayers.Geometry>} A geometry.
+     * obj - {Object} Is this ever used?
+     * 
+     * Returns:
+     * {<OpenLayers.Layer.Grid>} An exact clone of this OpenLayers.Layer.Grid
      */
      */
-    parseGeometry: function(obj) {
+    clone: function (obj) {
+        
         if (obj == null) {
         if (obj == null) {
-            return null;
+            obj = new OpenLayers.Layer.Grid(this.name,
+                                            this.url,
+                                            this.params,
+                                            this.getOptions());
         }
         }
-        var geometry, collection = false;
-        if(obj.type == "GeometryCollection") {
-            if(!(OpenLayers.Util.isArray(obj.geometries))) {
-                throw "GeometryCollection must have geometries array: " + obj;
-            }
-            var numGeom = obj.geometries.length;
-            var components = new Array(numGeom);
-            for(var i=0; i<numGeom; ++i) {
-                components[i] = this.parseGeometry.apply(
-                    this, [obj.geometries[i]]
-                );
-            }
-            geometry = new OpenLayers.Geometry.Collection(components);
-            collection = true;
-        } else {
-            if(!(OpenLayers.Util.isArray(obj.coordinates))) {
-                throw "Geometry must have coordinates array: " + obj;
-            }
-            if(!this.parseCoords[obj.type.toLowerCase()]) {
-                throw "Unsupported geometry type: " + obj.type;
-            }
-            try {
-                geometry = this.parseCoords[obj.type.toLowerCase()].apply(
-                    this, [obj.coordinates]
-                );
-            } catch(err) {
-                // deal with bad coordinates
-                throw err;
-            }
+
+        //get all additions from superclasses
+        obj = OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this, [obj]);
+
+        // copy/set any non-init, non-simple values here
+        if (this.tileSize != null) {
+            obj.tileSize = this.tileSize.clone();
         }
         }
-        // We don't reproject collections because the children are reprojected
-        // for us when they are created.
-        if (this.internalProjection && this.externalProjection && !collection) {
-            geometry.transform(this.externalProjection, 
-                               this.internalProjection); 
-        }                       
-        return geometry;
-    },
-    
+        
+        // we do not want to copy reference to grid, so we make a new array
+        obj.grid = [];
+        obj.gridResolution = null;
+        // same for backbuffer
+        obj.backBuffer = null;
+        obj.backBufferTimerId = null;
+        obj.loading = false;
+        obj.numLoadingTiles = 0;
+
+        return obj;
+    },    
+
     /**
     /**
-     * Property: parseCoords
-     * Object with properties corresponding to the GeoJSON geometry types.
-     *     Property values are functions that do the actual parsing.
+     * Method: moveTo
+     * This function is called whenever the map is moved. All the moving
+     * of actual 'tiles' is done by the map, but moveTo's role is to accept
+     * a bounds and make sure the data that that bounds requires is pre-loaded.
+     *
+     * Parameters:
+     * bounds - {<OpenLayers.Bounds>}
+     * zoomChanged - {Boolean}
+     * dragging - {Boolean}
      */
      */
-    parseCoords: {
-        /**
-         * Method: parseCoords.point
-         * Convert a coordinate array from GeoJSON into an
-         *     <OpenLayers.Geometry>.
-         *
-         * Parameters:
-         * array - {Object} The coordinates array from the GeoJSON fragment.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry>} A geometry.
-         */
-        "point": function(array) {
-            if (this.ignoreExtraDims == false && 
-                  array.length != 2) {
-                    throw "Only 2D points are supported: " + array;
-            }
-            return new OpenLayers.Geometry.Point(array[0], array[1]);
-        },
-        
-        /**
-         * Method: parseCoords.multipoint
-         * Convert a coordinate array from GeoJSON into an
-         *     <OpenLayers.Geometry>.
-         *
-         * Parameters:
-         * array - {Object} The coordinates array from the GeoJSON fragment.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry>} A geometry.
-         */
-        "multipoint": function(array) {
-            var points = [];
-            var p = null;
-            for(var i=0, len=array.length; i<len; ++i) {
-                try {
-                    p = this.parseCoords["point"].apply(this, [array[i]]);
-                } catch(err) {
-                    throw err;
-                }
-                points.push(p);
-            }
-            return new OpenLayers.Geometry.MultiPoint(points);
-        },
+    moveTo:function(bounds, zoomChanged, dragging) {
 
 
-        /**
-         * Method: parseCoords.linestring
-         * Convert a coordinate array from GeoJSON into an
-         *     <OpenLayers.Geometry>.
-         *
-         * Parameters:
-         * array - {Object} The coordinates array from the GeoJSON fragment.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry>} A geometry.
-         */
-        "linestring": function(array) {
-            var points = [];
-            var p = null;
-            for(var i=0, len=array.length; i<len; ++i) {
-                try {
-                    p = this.parseCoords["point"].apply(this, [array[i]]);
-                } catch(err) {
-                    throw err;
-                }
-                points.push(p);
-            }
-            return new OpenLayers.Geometry.LineString(points);
-        },
-        
-        /**
-         * Method: parseCoords.multilinestring
-         * Convert a coordinate array from GeoJSON into an
-         *     <OpenLayers.Geometry>.
-         *
-         * Parameters:
-         * array - {Object} The coordinates array from the GeoJSON fragment.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry>} A geometry.
-         */
-        "multilinestring": function(array) {
-            var lines = [];
-            var l = null;
-            for(var i=0, len=array.length; i<len; ++i) {
-                try {
-                    l = this.parseCoords["linestring"].apply(this, [array[i]]);
-                } catch(err) {
-                    throw err;
+        OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this, arguments);
+
+        bounds = bounds || this.map.getExtent();
+
+        if (bounds != null) {
+             
+            // if grid is empty or zoom has changed, we *must* re-tile
+            var forceReTile = !this.grid.length || zoomChanged;
+            
+            // total bounds of the tiles
+            var tilesBounds = this.getTilesBounds();            
+
+            // the new map resolution
+            var resolution = this.map.getResolution();
+
+            // the server-supported resolution for the new map resolution
+            var serverResolution = this.getServerResolution(resolution);
+
+            if (this.singleTile) {
+                
+                // We want to redraw whenever even the slightest part of the 
+                //  current bounds is not contained by our tile.
+                //  (thus, we do not specify partial -- its default is false)
+
+                if ( forceReTile ||
+                     (!dragging && !tilesBounds.containsBounds(bounds))) {
+
+                    // In single tile mode with no transition effect, we insert
+                    // a non-scaled backbuffer when the layer is moved. But if
+                    // a zoom occurs right after a move, i.e. before the new
+                    // image is received, we need to remove the backbuffer, or
+                    // an ill-positioned image will be visible during the zoom
+                    // transition.
+
+                    if(zoomChanged && this.transitionEffect !== 'resize') {
+                        this.removeBackBuffer();
+                    }
+
+                    if(!zoomChanged || this.transitionEffect === 'resize') {
+                        this.applyBackBuffer(resolution);
+                    }
+
+                    this.initSingleTile(bounds);
                 }
                 }
-                lines.push(l);
-            }
-            return new OpenLayers.Geometry.MultiLineString(lines);
-        },
-        
-        /**
-         * Method: parseCoords.polygon
-         * Convert a coordinate array from GeoJSON into an
-         *     <OpenLayers.Geometry>.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry>} A geometry.
-         */
-        "polygon": function(array) {
-            var rings = [];
-            var r, l;
-            for(var i=0, len=array.length; i<len; ++i) {
-                try {
-                    l = this.parseCoords["linestring"].apply(this, [array[i]]);
-                } catch(err) {
-                    throw err;
+            } else {
+
+                // if the bounds have changed such that they are not even 
+                // *partially* contained by our tiles (e.g. when user has 
+                // programmatically panned to the other side of the earth on
+                // zoom level 18), then moveGriddedTiles could potentially have
+                // to run through thousands of cycles, so we want to reTile
+                // instead (thus, partial true).  
+                forceReTile = forceReTile ||
+                    !tilesBounds.intersectsBounds(bounds, {
+                        worldBounds: this.map.baseLayer.wrapDateLine &&
+                            this.map.getMaxExtent()
+                    });
+
+                if(forceReTile) {
+                    if(zoomChanged && (this.transitionEffect === 'resize' ||
+                                          this.gridResolution === resolution)) {
+                        this.applyBackBuffer(resolution);
+                    }
+                    this.initGriddedTiles(bounds);
+                } else {
+                    this.moveGriddedTiles();
                 }
                 }
-                r = new OpenLayers.Geometry.LinearRing(l.components);
-                rings.push(r);
             }
             }
-            return new OpenLayers.Geometry.Polygon(rings);
-        },
+        }
+    },
 
 
-        /**
-         * Method: parseCoords.multipolygon
-         * Convert a coordinate array from GeoJSON into an
-         *     <OpenLayers.Geometry>.
-         *
-         * Parameters:
-         * array - {Object} The coordinates array from the GeoJSON fragment.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry>} A geometry.
-         */
-        "multipolygon": function(array) {
-            var polys = [];
-            var p = null;
-            for(var i=0, len=array.length; i<len; ++i) {
-                try {
-                    p = this.parseCoords["polygon"].apply(this, [array[i]]);
-                } catch(err) {
-                    throw err;
+    /**
+     * Method: getTileData
+     * Given a map location, retrieve a tile and the pixel offset within that
+     *     tile corresponding to the location.  If there is not an existing 
+     *     tile in the grid that covers the given location, null will be 
+     *     returned.
+     *
+     * Parameters:
+     * loc - {<OpenLayers.LonLat>} map location
+     *
+     * Returns:
+     * {Object} Object with the following properties: tile ({<OpenLayers.Tile>}),
+     *     i ({Number} x-pixel offset from top left), and j ({Integer} y-pixel
+     *     offset from top left).
+     */
+    getTileData: function(loc) {
+        var data = null,
+            x = loc.lon,
+            y = loc.lat,
+            numRows = this.grid.length;
+
+        if (this.map && numRows) {
+            var res = this.map.getResolution(),
+                tileWidth = this.tileSize.w,
+                tileHeight = this.tileSize.h,
+                bounds = this.grid[0][0].bounds,
+                left = bounds.left,
+                top = bounds.top;
+
+            if (x < left) {
+                // deal with multiple worlds
+                if (this.map.baseLayer.wrapDateLine) {
+                    var worldWidth = this.map.getMaxExtent().getWidth();
+                    var worldsAway = Math.ceil((left - x) / worldWidth);
+                    x += worldWidth * worldsAway;
                 }
                 }
-                polys.push(p);
             }
             }
-            return new OpenLayers.Geometry.MultiPolygon(polys);
-        },
-
-        /**
-         * Method: parseCoords.box
-         * Convert a coordinate array from GeoJSON into an
-         *     <OpenLayers.Geometry>.
-         *
-         * Parameters:
-         * array - {Object} The coordinates array from the GeoJSON fragment.
-         *
-         * Returns:
-         * {<OpenLayers.Geometry>} A geometry.
-         */
-        "box": function(array) {
-            if(array.length != 2) {
-                throw "GeoJSON box coordinates must have 2 elements";
+            // tile distance to location (fractional number of tiles);
+            var dtx = (x - left) / (res * tileWidth);
+            var dty = (top - y) / (res * tileHeight);
+            // index of tile in grid
+            var col = Math.floor(dtx);
+            var row = Math.floor(dty);
+            if (row >= 0 && row < numRows) {
+                var tile = this.grid[row][col];
+                if (tile) {
+                    data = {
+                        tile: tile,
+                        // pixel index within tile
+                        i: Math.floor((dtx - col) * tileWidth),
+                        j: Math.floor((dty - row) * tileHeight)
+                    };                    
+                }
             }
             }
-            return new OpenLayers.Geometry.Polygon([
-                new OpenLayers.Geometry.LinearRing([
-                    new OpenLayers.Geometry.Point(array[0][0], array[0][1]),
-                    new OpenLayers.Geometry.Point(array[1][0], array[0][1]),
-                    new OpenLayers.Geometry.Point(array[1][0], array[1][1]),
-                    new OpenLayers.Geometry.Point(array[0][0], array[1][1]),
-                    new OpenLayers.Geometry.Point(array[0][0], array[0][1])
-                ])
-            ]);
         }
         }
-
+        return data;
     },
     },
-
+    
     /**
     /**
-     * APIMethod: write
-     * Serialize a feature, geometry, array of features into a GeoJSON string.
+     * Method: destroyTile
      *
      * Parameters:
      *
      * Parameters:
-     * obj - {Object} An <OpenLayers.Feature.Vector>, <OpenLayers.Geometry>,
-     *     or an array of features.
-     * pretty - {Boolean} Structure the output with newlines and indentation.
-     *     Default is false.
+     * tile - {<OpenLayers.Tile>}
+     */
+    destroyTile: function(tile) {
+        this.removeTileMonitoringHooks(tile);
+        tile.destroy();
+    },
+
+    /**
+     * Method: getServerResolution
+     * Return the closest server-supported resolution.
+     *
+     * Parameters:
+     * resolution - {Number} The base resolution. If undefined the
+     *     map resolution is used.
      *
      * Returns:
      *
      * Returns:
-     * {String} The GeoJSON string representation of the input geometry,
-     *     features, or array of features.
+     * {Number} The closest server resolution value.
      */
      */
-    write: function(obj, pretty) {
-        var geojson = {
-            "type": null
-        };
-        if(OpenLayers.Util.isArray(obj)) {
-            geojson.type = "FeatureCollection";
-            var numFeatures = obj.length;
-            geojson.features = new Array(numFeatures);
-            for(var i=0; i<numFeatures; ++i) {
-                var element = obj[i];
-                if(!element instanceof OpenLayers.Feature.Vector) {
-                    var msg = "FeatureCollection only supports collections " +
-                              "of features: " + element;
-                    throw msg;
+    getServerResolution: function(resolution) {
+        var distance = Number.POSITIVE_INFINITY;
+        resolution = resolution || this.map.getResolution();
+        if(this.serverResolutions &&
+           OpenLayers.Util.indexOf(this.serverResolutions, resolution) === -1) {
+            var i, newDistance, newResolution, serverResolution;
+            for(i=this.serverResolutions.length-1; i>= 0; i--) {
+                newResolution = this.serverResolutions[i];
+                newDistance = Math.abs(newResolution - resolution);
+                if (newDistance > distance) {
+                    break;
                 }
                 }
-                geojson.features[i] = this.extract.feature.apply(
-                    this, [element]
-                );
-            }
-        } else if (obj.CLASS_NAME.indexOf("OpenLayers.Geometry") == 0) {
-            geojson = this.extract.geometry.apply(this, [obj]);
-        } else if (obj instanceof OpenLayers.Feature.Vector) {
-            geojson = this.extract.feature.apply(this, [obj]);
-            if(obj.layer && obj.layer.projection) {
-                geojson.crs = this.createCRSObject(obj);
+                distance = newDistance;
+                serverResolution = newResolution;
             }
             }
+            resolution = serverResolution;
         }
         }
-        return OpenLayers.Format.JSON.prototype.write.apply(this,
-                                                            [geojson, pretty]);
+        return resolution;
     },
 
     /**
     },
 
     /**
-     * Method: createCRSObject
-     * Create the CRS object for an object.
-     *
-     * Parameters:
-     * object - {<OpenLayers.Feature.Vector>} 
+     * Method: getServerZoom
+     * Return the zoom value corresponding to the best matching server
+     * resolution, taking into account <serverResolutions> and <zoomOffset>.
      *
      * Returns:
      *
      * Returns:
-     * {Object} An object which can be assigned to the crs property
-     * of a GeoJSON object.
+     * {Number} The closest server supported zoom. This is not the map zoom
+     *     level, but an index of the server's resolutions array.
      */
      */
-    createCRSObject: function(object) {
-       var proj = object.layer.projection.toString();
-       var crs = {};
-       if (proj.match(/epsg:/i)) {
-           var code = parseInt(proj.substring(proj.indexOf(":") + 1));
-           if (code == 4326) {
-               crs = {
-                   "type": "name",
-                   "properties": {
-                       "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
-                   }
-               };
-           } else {    
-               crs = {
-                   "type": "name",
-                   "properties": {
-                       "name": "EPSG:" + code
-                   }
-               };
-           }    
-       }
-       return crs;
+    getServerZoom: function() {
+        var resolution = this.getServerResolution();
+        return this.serverResolutions ?
+            OpenLayers.Util.indexOf(this.serverResolutions, resolution) :
+            this.map.getZoomForResolution(resolution) + (this.zoomOffset || 0);
     },
     },
-    
+
     /**
     /**
-     * Property: extract
-     * Object with properties corresponding to the GeoJSON types.
-     *     Property values are functions that do the actual value extraction.
+     * Method: applyBackBuffer
+     * Create, insert, scale and position a back buffer for the layer.
+     *
+     * Parameters:
+     * resolution - {Number} The resolution to transition to.
      */
      */
-    extract: {
-        /**
-         * Method: extract.feature
-         * Return a partial GeoJSON object representing a single feature.
-         *
-         * Parameters:
-         * feature - {<OpenLayers.Feature.Vector>}
-         *
-         * Returns:
-         * {Object} An object representing the point.
-         */
-        'feature': function(feature) {
-            var geom = this.extract.geometry.apply(this, [feature.geometry]);
-            var json = {
-                "type": "Feature",
-                "properties": feature.attributes,
-                "geometry": geom
-            };
-            if (feature.fid != null) {
-                json.id = feature.fid;
-            }
-            return json;
-        },
-        
-        /**
-         * Method: extract.geometry
-         * Return a GeoJSON object representing a single geometry.
-         *
-         * Parameters:
-         * geometry - {<OpenLayers.Geometry>}
-         *
-         * Returns:
-         * {Object} An object representing the geometry.
-         */
-        'geometry': function(geometry) {
-            if (geometry == null) {
-                return null;
+    applyBackBuffer: function(resolution) {
+        if(this.backBufferTimerId !== null) {
+            this.removeBackBuffer();
+        }
+        var backBuffer = this.backBuffer;
+        if(!backBuffer) {
+            backBuffer = this.createBackBuffer();
+            if(!backBuffer) {
+                return;
             }
             }
-            if (this.internalProjection && this.externalProjection) {
-                geometry = geometry.clone();
-                geometry.transform(this.internalProjection, 
-                                   this.externalProjection);
-            }                       
-            var geometryType = geometry.CLASS_NAME.split('.')[2];
-            var data = this.extract[geometryType.toLowerCase()].apply(this, [geometry]);
-            var json;
-            if(geometryType == "Collection") {
-                json = {
-                    "type": "GeometryCollection",
-                    "geometries": data
-                };
+            if (resolution === this.gridResolution) {
+                this.div.insertBefore(backBuffer, this.div.firstChild);
             } else {
             } else {
-                json = {
-                    "type": geometryType,
-                    "coordinates": data
-                };
-            }
-            
-            return json;
-        },
-
-        /**
-         * Method: extract.point
-         * Return an array of coordinates from a point.
-         *
-         * Parameters:
-         * point - {<OpenLayers.Geometry.Point>}
-         *
-         * Returns: 
-         * {Array} An array of coordinates representing the point.
-         */
-        'point': function(point) {
-            return [point.x, point.y];
-        },
-
-        /**
-         * Method: extract.multipoint
-         * Return an array of point coordinates from a multipoint.
-         *
-         * Parameters:
-         * multipoint - {<OpenLayers.Geometry.MultiPoint>}
-         *
-         * Returns:
-         * {Array} An array of point coordinate arrays representing
-         *     the multipoint.
-         */
-        'multipoint': function(multipoint) {
-            var array = [];
-            for(var i=0, len=multipoint.components.length; i<len; ++i) {
-                array.push(this.extract.point.apply(this, [multipoint.components[i]]));
-            }
-            return array;
-        },
-        
-        /**
-         * Method: extract.linestring
-         * Return an array of coordinate arrays from a linestring.
-         *
-         * Parameters:
-         * linestring - {<OpenLayers.Geometry.LineString>}
-         *
-         * Returns:
-         * {Array} An array of coordinate arrays representing
-         *     the linestring.
-         */
-        'linestring': function(linestring) {
-            var array = [];
-            for(var i=0, len=linestring.components.length; i<len; ++i) {
-                array.push(this.extract.point.apply(this, [linestring.components[i]]));
+                this.map.baseLayer.div.parentNode.insertBefore(backBuffer, this.map.baseLayer.div);
             }
             }
-            return array;
-        },
+            this.backBuffer = backBuffer;
 
 
-        /**
-         * Method: extract.multilinestring
-         * Return an array of linestring arrays from a linestring.
-         * 
-         * Parameters:
-         * multilinestring - {<OpenLayers.Geometry.MultiLineString>}
-         * 
-         * Returns:
-         * {Array} An array of linestring arrays representing
-         *     the multilinestring.
-         */
-        'multilinestring': function(multilinestring) {
-            var array = [];
-            for(var i=0, len=multilinestring.components.length; i<len; ++i) {
-                array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
-            }
-            return array;
-        },
+            // set some information in the instance for subsequent
+            // calls to applyBackBuffer where the same back buffer
+            // is reused
+            var topLeftTileBounds = this.grid[0][0].bounds;
+            this.backBufferLonLat = {
+                lon: topLeftTileBounds.left,
+                lat: topLeftTileBounds.top
+            };
+            this.backBufferResolution = this.gridResolution;
+        }
         
         
-        /**
-         * Method: extract.polygon
-         * Return an array of linear ring arrays from a polygon.
-         *
-         * Parameters:
-         * polygon - {<OpenLayers.Geometry.Polygon>}
-         * 
-         * Returns:
-         * {Array} An array of linear ring arrays representing the polygon.
-         */
-        'polygon': function(polygon) {
-            var array = [];
-            for(var i=0, len=polygon.components.length; i<len; ++i) {
-                array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
-            }
-            return array;
-        },
+        var ratio = this.backBufferResolution / resolution;
 
 
-        /**
-         * Method: extract.multipolygon
-         * Return an array of polygon arrays from a multipolygon.
-         * 
-         * Parameters:
-         * multipolygon - {<OpenLayers.Geometry.MultiPolygon>}
-         * 
-         * Returns:
-         * {Array} An array of polygon arrays representing
-         *     the multipolygon
-         */
-        'multipolygon': function(multipolygon) {
-            var array = [];
-            for(var i=0, len=multipolygon.components.length; i<len; ++i) {
-                array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
-            }
-            return array;
-        },
-        
-        /**
-         * Method: extract.collection
-         * Return an array of geometries from a geometry collection.
-         * 
-         * Parameters:
-         * collection - {<OpenLayers.Geometry.Collection>}
-         * 
-         * Returns:
-         * {Array} An array of geometry objects representing the geometry
-         *     collection.
-         */
-        'collection': function(collection) {
-            var len = collection.components.length;
-            var array = new Array(len);
-            for(var i=0; i<len; ++i) {
-                array[i] = this.extract.geometry.apply(
-                    this, [collection.components[i]]
-                );
-            }
-            return array;
+        // scale the tiles inside the back buffer
+        var tiles = backBuffer.childNodes, tile;
+        for (var i=tiles.length-1; i>=0; --i) {
+            tile = tiles[i];
+            tile.style.top = ((ratio * tile._i * backBuffer._th) | 0) + 'px';
+            tile.style.left = ((ratio * tile._j * backBuffer._tw) | 0) + 'px';
+            tile.style.width = Math.round(ratio * tile._w) + 'px';
+            tile.style.height = Math.round(ratio * tile._h) + 'px';
         }
         }
-        
 
 
+        // and position it (based on the grid's top-left corner)
+        var position = this.getViewPortPxFromLonLat(
+                this.backBufferLonLat, resolution);
+        var leftOffset = this.map.layerContainerOriginPx.x;
+        var topOffset = this.map.layerContainerOriginPx.y;
+        backBuffer.style.left = Math.round(position.x - leftOffset) + 'px';
+        backBuffer.style.top = Math.round(position.y - topOffset) + 'px';
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Format.GeoJSON" 
-
-});     
-/* ======================================================================
-    OpenLayers/Protocol/WFS/v1.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Protocol/WFS.js
- */
-
-/**
- * Class: OpenLayers.Protocol.WFS.v1
- * Abstract class for for v1.0.0 and v1.1.0 protocol.
- *
- * Inherits from:
- *  - <OpenLayers.Protocol>
- */
-OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
-    
-    /**
-     * Property: version
-     * {String} WFS version number.
-     */
-    version: null,
-    
     /**
     /**
-     * Property: srsName
-     * {String} Name of spatial reference system.  Default is "EPSG:4326".
+     * Method: createBackBuffer
+     * Create a back buffer.
+     *
+     * Returns:
+     * {DOMElement} The DOM element for the back buffer, undefined if the
+     * grid isn't initialized yet.
      */
      */
-    srsName: "EPSG:4326",
-    
+    createBackBuffer: function() {
+        var backBuffer;
+        if(this.grid.length > 0) {
+            backBuffer = document.createElement('div');
+            backBuffer.id = this.div.id + '_bb';
+            backBuffer.className = 'olBackBuffer';
+            backBuffer.style.position = 'absolute';
+            var map = this.map;
+            backBuffer.style.zIndex = this.transitionEffect === 'resize' ?
+                    this.getZIndex() - 1 :
+                    // 'map-resize':
+                    map.Z_INDEX_BASE.BaseLayer -
+                            (map.getNumLayers() - map.getLayerIndex(this));
+            for(var i=0, lenI=this.grid.length; i<lenI; i++) {
+                for(var j=0, lenJ=this.grid[i].length; j<lenJ; j++) {
+                    var tile = this.grid[i][j],
+                        markup = this.grid[i][j].createBackBuffer();
+                    if (markup) {
+                        markup._i = i;
+                        markup._j = j;
+                        markup._w = this.singleTile ?
+                                this.getImageSize(tile.bounds).w : tile.size.w;
+                        markup._h = tile.size.h;
+                        markup.id = tile.id + '_bb';
+                        backBuffer.appendChild(markup);
+                    }
+                }
+            }
+            backBuffer._tw = this.tileSize.w;
+            backBuffer._th = this.tileSize.h;
+        }
+        return backBuffer;
+    },
+
     /**
     /**
-     * Property: featureType
-     * {String} Local feature typeName.
+     * Method: removeBackBuffer
+     * Remove back buffer from DOM.
      */
      */
-    featureType: null,
-    
+    removeBackBuffer: function() {
+        if (this._transitionElement) {
+            for (var i=this.transitionendEvents.length-1; i>=0; --i) {
+                OpenLayers.Event.stopObserving(this._transitionElement,
+                    this.transitionendEvents[i], this._removeBackBuffer);
+            }
+            delete this._transitionElement;
+        }
+        if(this.backBuffer) {
+            if (this.backBuffer.parentNode) {
+                this.backBuffer.parentNode.removeChild(this.backBuffer);
+            }
+            this.backBuffer = null;
+            this.backBufferResolution = null;
+            if(this.backBufferTimerId !== null) {
+                window.clearTimeout(this.backBufferTimerId);
+                this.backBufferTimerId = null;
+            }
+        }
+    },
+
     /**
     /**
-     * Property: featureNS
-     * {String} Feature namespace.
+     * Method: moveByPx
+     * Move the layer based on pixel vector.
+     *
+     * Parameters:
+     * dx - {Number}
+     * dy - {Number}
      */
      */
-    featureNS: null,
-    
+    moveByPx: function(dx, dy) {
+        if (!this.singleTile) {
+            this.moveGriddedTiles();
+        }
+    },
+
     /**
     /**
-     * Property: geometryName
-     * {String} Name of the geometry attribute for features.  Default is
-     *     "the_geom" for WFS <version> 1.0, and null for higher versions.
+     * APIMethod: setTileSize
+     * Check if we are in singleTile mode and if so, set the size as a ratio
+     *     of the map size (as specified by the layer's 'ratio' property).
+     * 
+     * Parameters:
+     * size - {<OpenLayers.Size>}
      */
      */
-    geometryName: "the_geom",
+    setTileSize: function(size) { 
+        if (this.singleTile) {
+            size = this.map.getSize();
+            size.h = parseInt(size.h * this.ratio, 10);
+            size.w = parseInt(size.w * this.ratio, 10);
+        } 
+        OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this, [size]);
+    },
 
     /**
 
     /**
-     * Property: maxFeatures
-     * {Integer} Optional maximum number of features to retrieve.
+     * APIMethod: getTilesBounds
+     * Return the bounds of the tile grid.
+     *
+     * Returns:
+     * {<OpenLayers.Bounds>} A Bounds object representing the bounds of all the
+     *     currently loaded tiles (including those partially or not at all seen 
+     *     onscreen).
      */
      */
-    
+    getTilesBounds: function() {    
+        var bounds = null; 
+        
+        var length = this.grid.length;
+        if (length) {
+            var bottomLeftTileBounds = this.grid[length - 1][0].bounds,
+                width = this.grid[0].length * bottomLeftTileBounds.getWidth(),
+                height = this.grid.length * bottomLeftTileBounds.getHeight();
+            
+            bounds = new OpenLayers.Bounds(bottomLeftTileBounds.left, 
+                                           bottomLeftTileBounds.bottom,
+                                           bottomLeftTileBounds.left + width, 
+                                           bottomLeftTileBounds.bottom + height);
+        }   
+        return bounds;
+    },
+
     /**
     /**
-     * Property: schema
-     * {String} Optional schema location that will be included in the
-     *     schemaLocation attribute value.  Note that the feature type schema
-     *     is required for a strict XML validator (on transactions with an
-     *     insert for example), but is *not* required by the WFS specification
-     *     (since the server is supposed to know about feature type schemas).
+     * Method: initSingleTile
+     * 
+     * Parameters: 
+     * bounds - {<OpenLayers.Bounds>}
      */
      */
-    schema: null,
+    initSingleTile: function(bounds) {
+        this.events.triggerEvent("retile");
+
+        //determine new tile bounds
+        var center = bounds.getCenterLonLat();
+        var tileWidth = bounds.getWidth() * this.ratio;
+        var tileHeight = bounds.getHeight() * this.ratio;
+                                       
+        var tileBounds = 
+            new OpenLayers.Bounds(center.lon - (tileWidth/2),
+                                  center.lat - (tileHeight/2),
+                                  center.lon + (tileWidth/2),
+                                  center.lat + (tileHeight/2));
+
+        // store the resolution of the grid
+        this.gridResolution = this.getServerResolution();
+  
+        // same logic as OpenLayers.Tile#shouldDraw
+        var maxExtent = this.maxExtent;
+        if (maxExtent && (!this.displayOutsideMaxExtent ||
+                (this.map.baseLayer.wrapDateLine &&
+                this.maxExtent.equals(this.map.getMaxExtent())))) {
+            tileBounds.left = Math.max(tileBounds.left, maxExtent.left);
+            tileBounds.right = Math.min(tileBounds.right, maxExtent.right);
+        }
+
+        var px = this.map.getLayerPxFromLonLat({
+            lon: tileBounds.left,
+            lat: tileBounds.top
+        });
 
 
-    /**
-     * Property: featurePrefix
-     * {String} Namespace alias for feature type.  Default is "feature".
-     */
-    featurePrefix: "feature",
-    
-    /**
-     * Property: formatOptions
-     * {Object} Optional options for the format.  If a format is not provided,
-     *     this property can be used to extend the default format options.
-     */
-    formatOptions: null,
+        if (!this.grid.length) {
+            this.grid[0] = [];
+        }
+
+        var tile = this.grid[0][0];
+        if (!tile) {
+            tile = this.addTile(tileBounds, px);
+
+            this.addTileMonitoringHooks(tile);
+            tile.draw();
+            this.grid[0][0] = tile;
+        } else {
+            tile.moveTo(tileBounds, px);
+        }           
+        
+        //remove all but our single tile
+        this.removeExcessTiles(1,1);
+    },
 
     /** 
 
     /** 
-     * Property: readFormat 
-     * {<OpenLayers.Format>} For WFS requests it is possible to get a  
-     *     different output format than GML. In that case, we cannot parse  
-     *     the response with the default format (WFST) and we need a different 
-     *     format for reading. 
-     */ 
-    readFormat: null,
-    
-    /**
-     * Property: readOptions
-     * {Object} Optional object to pass to format's read.
-     */
-    readOptions: null,
-    
-    /**
-     * Constructor: OpenLayers.Protocol.WFS
-     * A class for giving layers WFS protocol.
+     * Method: calculateGridLayout
+     * Generate parameters for the grid layout.
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} Optional object whose properties will be set on the
-     *     instance.
+     * bounds - {<OpenLayers.Bound>|Object} OpenLayers.Bounds or an
+     *     object with a 'left' and 'top' properties.
+     * origin - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
+     *     object with a 'lon' and 'lat' properties.
+     * resolution - {Number}
      *
      *
-     * Valid options properties:
-     * url - {String} URL to send requests to (required).
-     * featureType - {String} Local (without prefix) feature typeName (required).
-     * featureNS - {String} Feature namespace (required, but can be autodetected
-     *     during the first query if GML is used as readFormat and
-     *     featurePrefix is provided and matches the prefix used by the server
-     *     for this featureType).
-     * featurePrefix - {String} Feature namespace alias (optional - only used
-     *     for writing if featureNS is provided).  Default is 'feature'.
-     * geometryName - {String} Name of geometry attribute.  The default is
-     *     'the_geom' for WFS <version> 1.0, and null for higher versions. If
-     *     null, it will be set to the name of the first geometry found in the
-     *     first read operation.
-     * multi - {Boolean} If set to true, geometries will be casted to Multi
-     *     geometries before they are written in a transaction. No casting will
-     *     be done when reading features.
+     * Returns:
+     * {Object} Object containing properties tilelon, tilelat, startcol,
+     * startrow
      */
      */
-    initialize: function(options) {
-        OpenLayers.Protocol.prototype.initialize.apply(this, [options]);
-        if(!options.format) {
-            this.format = OpenLayers.Format.WFST(OpenLayers.Util.extend({
-                version: this.version,
-                featureType: this.featureType,
-                featureNS: this.featureNS,
-                featurePrefix: this.featurePrefix,
-                geometryName: this.geometryName,
-                srsName: this.srsName,
-                schema: this.schema
-            }, this.formatOptions));
-        }
-        if (!options.geometryName && parseFloat(this.format.version) > 1.0) {
-            this.setGeometryName(null);
+    calculateGridLayout: function(bounds, origin, resolution) {
+        var tilelon = resolution * this.tileSize.w;
+        var tilelat = resolution * this.tileSize.h;
+        
+        var offsetlon = bounds.left - origin.lon;
+        var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
+        
+        var rowSign = this.rowSign;
+
+        var offsetlat = rowSign * (origin.lat - bounds.top + tilelat);  
+        var tilerow = Math[~rowSign ? 'floor' : 'ceil'](offsetlat/tilelat) - this.buffer * rowSign;
+        
+        return { 
+          tilelon: tilelon, tilelat: tilelat,
+          startcol: tilecol, startrow: tilerow
+        };
+
+    },
+
+    getImageSize: function(bounds) {
+        var tileSize = OpenLayers.Layer.HTTPRequest.prototype.getImageSize.apply(this, arguments);
+        if (this.singleTile) {
+            tileSize = new OpenLayers.Size(
+                Math.round(bounds.getWidth() / this.gridResolution),
+                tileSize.h
+            );
         }
         }
+        return tileSize;
     },
     },
-    
+
     /**
     /**
-     * APIMethod: destroy
-     * Clean up the protocol.
+     * Method: getTileOrigin
+     * Determine the origin for aligning the grid of tiles.  If a <tileOrigin>
+     *     property is supplied, that will be returned.  Otherwise, the origin
+     *     will be derived from the layer's <maxExtent> property.  In this case,
+     *     the tile origin will be the corner of the <maxExtent> given by the 
+     *     <tileOriginCorner> property.
+     *
+     * Returns:
+     * {<OpenLayers.LonLat>} The tile origin.
      */
      */
-    destroy: function() {
-        if(this.options && !this.options.format) {
-            this.format.destroy();
+    getTileOrigin: function() {
+        var origin = this.tileOrigin;
+        if (!origin) {
+            var extent = this.getMaxExtent();
+            var edges = ({
+                "tl": ["left", "top"],
+                "tr": ["right", "top"],
+                "bl": ["left", "bottom"],
+                "br": ["right", "bottom"]
+            })[this.tileOriginCorner];
+            origin = new OpenLayers.LonLat(extent[edges[0]], extent[edges[1]]);
         }
         }
-        this.format = null;
-        OpenLayers.Protocol.prototype.destroy.apply(this);
+        return origin;
     },
 
     /**
     },
 
     /**
-     * APIMethod: read
-     * Construct a request for reading new features.  Since WFS splits the
-     *     basic CRUD operations into GetFeature requests (for read) and
-     *     Transactions (for all others), this method does not make use of the
-     *     format's read method (that is only about reading transaction
-     *     responses).
+     * Method: getTileBoundsForGridIndex
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} Options for the read operation, in addition to the
-     *     options set on the instance (options set here will take precedence).
-     *
-     * To use a configured protocol to get e.g. a WFS hit count, applications
-     * could do the following:
-     *
-     * (code)
-     * protocol.read({
-     *     readOptions: {output: "object"},
-     *     resultType: "hits",
-     *     maxFeatures: null,
-     *     callback: function(resp) {
-     *         // process resp.numberOfFeatures here
-     *     }
-     * });
-     * (end)
-     *
-     * To use a configured protocol to use WFS paging (if supported by the
-     * server), applications could do the following:
-     *
-     * (code)
-     * protocol.read({
-     *     startIndex: 0,
-     *     count: 50
-     * });
-     * (end)
-     *
-     * To limit the attributes returned by the GetFeature request, applications
-     * can use the propertyNames option to specify the properties to include in
-     * the response:
+     * row - {Number} The row of the grid
+     * col - {Number} The column of the grid
      *
      *
-     * (code)
-     * protocol.read({
-     *     propertyNames: ["DURATION", "INTENSITY"]
-     * });
-     * (end)
+     * Returns:
+     * {<OpenLayers.Bounds>} The bounds for the tile at (row, col)
      */
      */
-    read: function(options) {
-        OpenLayers.Protocol.prototype.read.apply(this, arguments);
-        options = OpenLayers.Util.extend({}, options);
-        OpenLayers.Util.applyDefaults(options, this.options || {});
-        var response = new OpenLayers.Protocol.Response({requestType: "read"});
+    getTileBoundsForGridIndex: function(row, col) {
+        var origin = this.getTileOrigin();
+        var tileLayout = this.gridLayout;
+        var tilelon = tileLayout.tilelon;
+        var tilelat = tileLayout.tilelat;
+        var startcol = tileLayout.startcol;
+        var startrow = tileLayout.startrow;
+        var rowSign = this.rowSign;
+        return new OpenLayers.Bounds(
+            origin.lon + (startcol + col) * tilelon,
+            origin.lat - (startrow + row * rowSign) * tilelat * rowSign,
+            origin.lon + (startcol + col + 1) * tilelon,
+            origin.lat - (startrow + (row - 1) * rowSign) * tilelat * rowSign
+        );
+    },
+
+    /**
+     * Method: initGriddedTiles
+     * 
+     * Parameters:
+     * bounds - {<OpenLayers.Bounds>}
+     */
+    initGriddedTiles:function(bounds) {
+        this.events.triggerEvent("retile");
+
+        // work out mininum number of rows and columns; this is the number of
+        // tiles required to cover the viewport plus at least one for panning
+
+        var viewSize = this.map.getSize();
         
         
-        var data = OpenLayers.Format.XML.prototype.write.apply(
-            this.format, [this.format.writeNode("wfs:GetFeature", options)]
+        var origin = this.getTileOrigin();
+        var resolution = this.map.getResolution(),
+            serverResolution = this.getServerResolution(),
+            ratio = resolution / serverResolution,
+            tileSize = {
+                w: this.tileSize.w / ratio,
+                h: this.tileSize.h / ratio
+            };
+
+        var minRows = Math.ceil(viewSize.h/tileSize.h) + 
+                      2 * this.buffer + 1;
+        var minCols = Math.ceil(viewSize.w/tileSize.w) +
+                      2 * this.buffer + 1;
+
+        var tileLayout = this.calculateGridLayout(bounds, origin, serverResolution);
+        this.gridLayout = tileLayout;
+        
+        var tilelon = tileLayout.tilelon;
+        var tilelat = tileLayout.tilelat;
+        
+        var layerContainerDivLeft = this.map.layerContainerOriginPx.x;
+        var layerContainerDivTop = this.map.layerContainerOriginPx.y;
+
+        var tileBounds = this.getTileBoundsForGridIndex(0, 0);
+        var startPx = this.map.getViewPortPxFromLonLat(
+            new OpenLayers.LonLat(tileBounds.left, tileBounds.top)
         );
         );
+        startPx.x = Math.round(startPx.x) - layerContainerDivLeft;
+        startPx.y = Math.round(startPx.y) - layerContainerDivTop;
 
 
-        response.priv = OpenLayers.Request.POST({
-            url: options.url,
-            callback: this.createCallback(this.handleRead, response, options),
-            params: options.params,
-            headers: options.headers,
-            data: data
-        });
+        var tileData = [], center = this.map.getCenter();
 
 
-        return response;
+        var rowidx = 0;
+        do {
+            var row = this.grid[rowidx];
+            if (!row) {
+                row = [];
+                this.grid.push(row);
+            }
+            
+            var colidx = 0;
+            do {
+                tileBounds = this.getTileBoundsForGridIndex(rowidx, colidx);
+                var px = startPx.clone();
+                px.x = px.x + colidx * Math.round(tileSize.w);
+                px.y = px.y + rowidx * Math.round(tileSize.h);
+                var tile = row[colidx];
+                if (!tile) {
+                    tile = this.addTile(tileBounds, px);
+                    this.addTileMonitoringHooks(tile);
+                    row.push(tile);
+                } else {
+                    tile.moveTo(tileBounds, px, false);
+                }
+                var tileCenter = tileBounds.getCenterLonLat();
+                tileData.push({
+                    tile: tile,
+                    distance: Math.pow(tileCenter.lon - center.lon, 2) +
+                        Math.pow(tileCenter.lat - center.lat, 2)
+                });
+     
+                colidx += 1;
+            } while ((tileBounds.right <= bounds.right + tilelon * this.buffer)
+                     || colidx < minCols);
+             
+            rowidx += 1;
+        } while((tileBounds.bottom >= bounds.bottom - tilelat * this.buffer)
+                || rowidx < minRows);
+        
+        //shave off excess rows and columns
+        this.removeExcessTiles(rowidx, colidx);
+
+        var resolution = this.getServerResolution();
+        // store the resolution of the grid
+        this.gridResolution = resolution;
+
+        //now actually draw the tiles
+        tileData.sort(function(a, b) {
+            return a.distance - b.distance; 
+        });
+        for (var i=0, ii=tileData.length; i<ii; ++i) {
+            tileData[i].tile.draw();
+        }
     },
 
     /**
     },
 
     /**
-     * APIMethod: setFeatureType
-     * Change the feature type on the fly.
+     * Method: getMaxExtent
+     * Get this layer's maximum extent. (Implemented as a getter for
+     *     potential specific implementations in sub-classes.)
      *
      *
-     * Parameters:
-     * featureType - {String} Local (without prefix) feature typeName.
+     * Returns:
+     * {<OpenLayers.Bounds>}
      */
      */
-    setFeatureType: function(featureType) {
-        this.featureType = featureType;
-        this.format.featureType = featureType;
+    getMaxExtent: function() {
+        return this.maxExtent;
     },
     },
+
     /**
     /**
-     * APIMethod: setGeometryName
-     * Sets the geometryName option after instantiation.
+     * APIMethod: addTile
+     * Create a tile, initialize it, and add it to the layer div. 
      *
      *
-     * Parameters:
-     * geometryName - {String} Name of geometry attribute.
+     * Parameters
+     * bounds - {<OpenLayers.Bounds>}
+     * position - {<OpenLayers.Pixel>}
+     *
+     * Returns:
+     * {<OpenLayers.Tile>} The added OpenLayers.Tile
      */
      */
-    setGeometryName: function(geometryName) {
-        this.geometryName = geometryName;
-        this.format.geometryName = geometryName;
+    addTile: function(bounds, position) {
+        var tile = new this.tileClass(
+            this, position, bounds, null, this.tileSize, this.tileOptions
+        );
+        this.events.triggerEvent("addtile", {tile: tile});
+        return tile;
     },
     
     },
     
-    /**
-     * Method: handleRead
-     * Deal with response from the read request.
-     *
-     * Parameters:
-     * response - {<OpenLayers.Protocol.Response>} The response object to pass
-     *     to the user callback.
-     * options - {Object} The user options passed to the read call.
+    /** 
+     * Method: addTileMonitoringHooks
+     * This function takes a tile as input and adds the appropriate hooks to 
+     *     the tile so that the layer can keep track of the loading tiles.
+     * 
+     * Parameters: 
+     * tile - {<OpenLayers.Tile>}
      */
      */
-    handleRead: function(response, options) {
-        options = OpenLayers.Util.extend({}, options);
-        OpenLayers.Util.applyDefaults(options, this.options);
+    addTileMonitoringHooks: function(tile) {
+        
+        var replacingCls = 'olTileReplacing';
 
 
-        if(options.callback) {
-            var request = response.priv;
-            if(request.status >= 200 && request.status < 300) {
-                // success
-                var result = this.parseResponse(request, options.readOptions);
-                if (result && result.success !== false) { 
-                    if (options.readOptions && options.readOptions.output == "object") {
-                        OpenLayers.Util.extend(response, result);
+        tile.onLoadStart = function() {
+            //if that was first tile then trigger a 'loadstart' on the layer
+            if (this.loading === false) {
+                this.loading = true;
+                this.events.triggerEvent("loadstart");
+            }
+            this.events.triggerEvent("tileloadstart", {tile: tile});
+            this.numLoadingTiles++;
+            if (!this.singleTile && this.backBuffer && this.gridResolution === this.backBufferResolution) {
+                OpenLayers.Element.addClass(tile.getTile(), replacingCls);
+            }
+        };
+      
+        tile.onLoadEnd = function(evt) {
+            this.numLoadingTiles--;
+            var aborted = evt.type === 'unload';
+            this.events.triggerEvent("tileloaded", {
+                tile: tile,
+                aborted: aborted
+            });
+            if (!this.singleTile && !aborted && this.backBuffer && this.gridResolution === this.backBufferResolution) {
+                var tileDiv = tile.getTile();
+                if (OpenLayers.Element.getStyle(tileDiv, 'display') === 'none') {
+                    var bufferTile = document.getElementById(tile.id + '_bb');
+                    if (bufferTile) {
+                        bufferTile.parentNode.removeChild(bufferTile);
+                    }
+                }
+                OpenLayers.Element.removeClass(tileDiv, replacingCls);
+            }
+            //if that was the last tile, then trigger a 'loadend' on the layer
+            if (this.numLoadingTiles === 0) {
+                if (this.backBuffer) {
+                    if (this.backBuffer.childNodes.length === 0) {
+                        // no tiles transitioning, remove immediately
+                        this.removeBackBuffer();
                     } else {
                     } else {
-                        response.features = result;
+                        // wait until transition has ended or delay has passed
+                        this._transitionElement = aborted ?
+                            this.div.lastChild : tile.imgDiv;
+                        var transitionendEvents = this.transitionendEvents;
+                        for (var i=transitionendEvents.length-1; i>=0; --i) {
+                            OpenLayers.Event.observe(this._transitionElement,
+                                transitionendEvents[i],
+                                this._removeBackBuffer);
+                        }
+                        // the removal of the back buffer is delayed to prevent
+                        // flash effects due to the animation of tile displaying
+                        this.backBufferTimerId = window.setTimeout(
+                            this._removeBackBuffer, this.removeBackBufferDelay
+                        );
                     }
                     }
-                    response.code = OpenLayers.Protocol.Response.SUCCESS;
-                } else {
-                    // failure (service exception)
-                    response.code = OpenLayers.Protocol.Response.FAILURE;
-                    response.error = result;
                 }
                 }
-            } else {
-                // failure
-                response.code = OpenLayers.Protocol.Response.FAILURE;
+                this.loading = false;
+                this.events.triggerEvent("loadend");
             }
             }
-            options.callback.call(options.scope, response);
-        }
+        };
+        
+        tile.onLoadError = function() {
+            this.events.triggerEvent("tileerror", {tile: tile});
+        };
+        
+        tile.events.on({
+            "loadstart": tile.onLoadStart,
+            "loadend": tile.onLoadEnd,
+            "unload": tile.onLoadEnd,
+            "loaderror": tile.onLoadError,
+            scope: this
+        });
     },
 
     },
 
+    /** 
+     * Method: removeTileMonitoringHooks
+     * This function takes a tile as input and removes the tile hooks 
+     *     that were added in addTileMonitoringHooks()
+     * 
+     * Parameters: 
+     * tile - {<OpenLayers.Tile>}
+     */
+    removeTileMonitoringHooks: function(tile) {
+        tile.unload();
+        tile.events.un({
+            "loadstart": tile.onLoadStart,
+            "loadend": tile.onLoadEnd,
+            "unload": tile.onLoadEnd,
+            "loaderror": tile.onLoadError,
+            scope: this
+        });
+    },
+    
     /**
     /**
-     * Method: parseResponse
-     * Read HTTP response body and return features
-     *
-     * Parameters:
-     * request - {XMLHttpRequest} The request object
-     * options - {Object} Optional object to pass to format's read
-     *
-     * Returns:
-     * {Object} or {Array({<OpenLayers.Feature.Vector>})} or
-     *     {<OpenLayers.Feature.Vector>} 
-     * An object with a features property, an array of features or a single 
-     * feature.
+     * Method: moveGriddedTiles
      */
      */
-    parseResponse: function(request, options) {
-        var doc = request.responseXML;
-        if(!doc || !doc.documentElement) {
-            doc = request.responseText;
-        }
-        if(!doc || doc.length <= 0) {
-            return null;
-        }
-        var result = (this.readFormat !== null) ? this.readFormat.read(doc) : 
-            this.format.read(doc, options);
-        if (!this.featureNS) {
-            var format = this.readFormat || this.format;
-            this.featureNS = format.featureNS;
-            // no need to auto-configure again on subsequent reads
-            format.autoConfig = false;
-            if (!this.geometryName) {
-                this.setGeometryName(format.geometryName);
+    moveGriddedTiles: function() {
+        var buffer = this.buffer + 1;
+        while(true) {
+            var tlTile = this.grid[0][0];
+            var tlViewPort = {
+                x: tlTile.position.x +
+                    this.map.layerContainerOriginPx.x,
+                y: tlTile.position.y +
+                    this.map.layerContainerOriginPx.y
+            };
+            var ratio = this.getServerResolution() / this.map.getResolution();
+            var tileSize = {
+                w: Math.round(this.tileSize.w * ratio),
+                h: Math.round(this.tileSize.h * ratio)
+            };
+            if (tlViewPort.x > -tileSize.w * (buffer - 1)) {
+                this.shiftColumn(true, tileSize);
+            } else if (tlViewPort.x < -tileSize.w * buffer) {
+                this.shiftColumn(false, tileSize);
+            } else if (tlViewPort.y > -tileSize.h * (buffer - 1)) {
+                this.shiftRow(true, tileSize);
+            } else if (tlViewPort.y < -tileSize.h * buffer) {
+                this.shiftRow(false, tileSize);
+            } else {
+                break;
             }
         }
             }
         }
-        return result;
     },
 
     /**
     },
 
     /**
-     * Method: commit
-     * Given a list of feature, assemble a batch request for update, create,
-     *     and delete transactions.  A commit call on the prototype amounts
-     *     to writing a WFS transaction - so the write method on the format
-     *     is used.
+     * Method: shiftRow
+     * Shifty grid work
      *
      * Parameters:
      *
      * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>)}
-     * options - {Object}
-     *
-     * Valid options properties:
-     * nativeElements - {Array({Object})} Array of objects with information for writing
-     * out <Native> elements, these objects have vendorId, safeToIgnore and
-     * value properties. The <Native> element is intended to allow access to 
-     * vendor specific capabilities of any particular web feature server or 
-     * datastore.
-     *
-     * Returns:
-     * {<OpenLayers.Protocol.Response>} A response object with a features
-     *     property containing any insertIds and a priv property referencing
-     *     the XMLHttpRequest object.
+     * prepend - {Boolean} if true, prepend to beginning.
+     *                          if false, then append to end
+     * tileSize - {Object} rendered tile size; object with w and h properties
      */
      */
-    commit: function(features, options) {
+    shiftRow: function(prepend, tileSize) {
+        var grid = this.grid;
+        var rowIndex = prepend ? 0 : (grid.length - 1);
+        var sign = prepend ? -1 : 1;
+        var rowSign = this.rowSign;
+        var tileLayout = this.gridLayout;
+        tileLayout.startrow += sign * rowSign;
 
 
-        options = OpenLayers.Util.extend({}, options);
-        OpenLayers.Util.applyDefaults(options, this.options);
-        
-        var response = new OpenLayers.Protocol.Response({
-            requestType: "commit",
-            reqFeatures: features
-        });
-        response.priv = OpenLayers.Request.POST({
-            url: options.url,
-            headers: options.headers,
-            data: this.format.write(features, options),
-            callback: this.createCallback(this.handleCommit, response, options)
-        });
-        
-        return response;
+        var modelRow = grid[rowIndex];
+        var row = grid[prepend ? 'pop' : 'shift']();
+        for (var i=0, len=row.length; i<len; i++) {
+            var tile = row[i];
+            var position = modelRow[i].position.clone();
+            position.y += tileSize.h * sign;
+            tile.moveTo(this.getTileBoundsForGridIndex(rowIndex, i), position);
+        }
+        grid[prepend ? 'unshift' : 'push'](row);
     },
     },
-    
+
     /**
     /**
-     * Method: handleCommit
-     * Called when the commit request returns.
-     * 
+     * Method: shiftColumn
+     * Shift grid work in the other dimension
+     *
      * Parameters:
      * Parameters:
-     * response - {<OpenLayers.Protocol.Response>} The response object to pass
-     *     to the user callback.
-     * options - {Object} The user options passed to the commit call.
+     * prepend - {Boolean} if true, prepend to beginning.
+     *                          if false, then append to end
+     * tileSize - {Object} rendered tile size; object with w and h properties
      */
      */
-    handleCommit: function(response, options) {
-        if(options.callback) {
-            var request = response.priv;
+    shiftColumn: function(prepend, tileSize) {
+        var grid = this.grid;
+        var colIndex = prepend ? 0 : (grid[0].length - 1);
+        var sign = prepend ? -1 : 1;
+        var tileLayout = this.gridLayout;
+        tileLayout.startcol += sign;
 
 
-            // ensure that we have an xml doc
-            var data = request.responseXML;
-            if(!data || !data.documentElement) {
-                data = request.responseText;
-            }
-            
-            var obj = this.format.read(data) || {};
-            
-            response.insertIds = obj.insertIds || [];
-            if (obj.success) {
-                response.code = OpenLayers.Protocol.Response.SUCCESS;
-            } else {
-                response.code = OpenLayers.Protocol.Response.FAILURE;
-                response.error = obj;
-            }
-            options.callback.call(options.scope, response);
+        for (var i=0, len=grid.length; i<len; i++) {
+            var row = grid[i];
+            var position = row[colIndex].position.clone();
+            var tile = row[prepend ? 'pop' : 'shift']();            
+            position.x += tileSize.w * sign;
+            tile.moveTo(this.getTileBoundsForGridIndex(i, colIndex), position);
+            row[prepend ? 'unshift' : 'push'](tile);
         }
     },
         }
     },
-    
+
     /**
     /**
-     * Method: filterDelete
-     * Send a request that deletes all features by their filter.
+     * Method: removeExcessTiles
+     * When the size of the map or the buffer changes, we may need to
+     *     remove some excess rows and columns.
      * 
      * Parameters:
      * 
      * Parameters:
-     * filter - {<OpenLayers.Filter>} filter
+     * rows - {Integer} Maximum number of rows we want our grid to have.
+     * columns - {Integer} Maximum number of columns we want our grid to have.
      */
      */
-    filterDelete: function(filter, options) {
-        options = OpenLayers.Util.extend({}, options);
-        OpenLayers.Util.applyDefaults(options, this.options);    
-        
-        var response = new OpenLayers.Protocol.Response({
-            requestType: "commit"
-        });    
+    removeExcessTiles: function(rows, columns) {
+        var i, l;
         
         
-        var root = this.format.createElementNSPlus("wfs:Transaction", {
-            attributes: {
-                service: "WFS",
-                version: this.version
+        // remove extra rows
+        while (this.grid.length > rows) {
+            var row = this.grid.pop();
+            for (i=0, l=row.length; i<l; i++) {
+                var tile = row[i];
+                this.destroyTile(tile);
             }
             }
-        });
+        }
         
         
-        var deleteNode = this.format.createElementNSPlus("wfs:Delete", {
-            attributes: {
-                typeName: (options.featureNS ? this.featurePrefix + ":" : "") +
-                    options.featureType
+        // remove extra columns
+        for (i=0, l=this.grid.length; i<l; i++) {
+            while (this.grid[i].length > columns) {
+                var row = this.grid[i];
+                var tile = row.pop();
+                this.destroyTile(tile);
             }
             }
-        });       
-        
-        if(options.featureNS) {
-            deleteNode.setAttribute("xmlns:" + this.featurePrefix, options.featureNS);
         }
         }
-        var filterNode = this.format.writeNode("ogc:Filter", filter);
-        
-        deleteNode.appendChild(filterNode);
-        
-        root.appendChild(deleteNode);
-        
-        var data = OpenLayers.Format.XML.prototype.write.apply(
-            this.format, [root]
-        );
-        
-        return OpenLayers.Request.POST({
-            url: this.url,
-            callback : options.callback || function(){},
-            data: data
-        });   
-        
     },
 
     /**
     },
 
     /**
-     * Method: abort
-     * Abort an ongoing request, the response object passed to
-     * this method must come from this protocol (as a result
-     * of a read, or commit operation).
+     * Method: onMapResize
+     * For singleTile layers, this will set a new tile size according to the
+     * dimensions of the map pane.
+     */
+    onMapResize: function() {
+        if (this.singleTile) {
+            this.clearGrid();
+            this.setTileSize();
+        }
+    },
+    
+    /**
+     * APIMethod: getTileBounds
+     * Returns The tile bounds for a layer given a pixel location.
      *
      * Parameters:
      *
      * Parameters:
-     * response - {<OpenLayers.Protocol.Response>}
+     * viewPortPx - {<OpenLayers.Pixel>} The location in the viewport.
+     *
+     * Returns:
+     * {<OpenLayers.Bounds>} Bounds of the tile at the given pixel location.
      */
      */
-    abort: function(response) {
-        if (response) {
-            response.priv.abort();
-        }
+    getTileBounds: function(viewPortPx) {
+        var maxExtent = this.maxExtent;
+        var resolution = this.getResolution();
+        var tileMapWidth = resolution * this.tileSize.w;
+        var tileMapHeight = resolution * this.tileSize.h;
+        var mapPoint = this.getLonLatFromViewPortPx(viewPortPx);
+        var tileLeft = maxExtent.left + (tileMapWidth *
+                                         Math.floor((mapPoint.lon -
+                                                     maxExtent.left) /
+                                                    tileMapWidth));
+        var tileBottom = maxExtent.bottom + (tileMapHeight *
+                                             Math.floor((mapPoint.lat -
+                                                         maxExtent.bottom) /
+                                                        tileMapHeight));
+        return new OpenLayers.Bounds(tileLeft, tileBottom,
+                                     tileLeft + tileMapWidth,
+                                     tileBottom + tileMapHeight);
     },
     },
-  
-    CLASS_NAME: "OpenLayers.Protocol.WFS.v1" 
+
+    CLASS_NAME: "OpenLayers.Layer.Grid"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Layer/Google/v3.js
+    OpenLayers/Layer/XYZ.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-
 /**
 /**
- * @requires OpenLayers/Layer/Google.js
+ * @requires OpenLayers/Layer/Grid.js
  */
 
  */
 
-/**
- * Constant: OpenLayers.Layer.Google.v3
- * 
- * Mixin providing functionality specific to the Google Maps API v3.
- * 
- * To use this layer, you must include the GMaps v3 API in your html.
+/** 
+ * Class: OpenLayers.Layer.XYZ
+ * The XYZ class is designed to make it easier for people who have tiles
+ * arranged by a standard XYZ grid. 
  * 
  * 
- * Note that this layer configures the google.maps.map object with the
- * "disableDefaultUI" option set to true. Using UI controls that the Google
- * Maps API provides is not supported by the OpenLayers API.
+ * Inherits from:
+ *  - <OpenLayers.Layer.Grid>
  */
  */
-OpenLayers.Layer.Google.v3 = {
+OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
     
     /**
     
     /**
-     * Constant: DEFAULTS
-     * {Object} It is not recommended to change the properties set here. Note
-     * that Google.v3 layers only work when sphericalMercator is set to true.
-     * 
-     * (code)
-     * {
-     *     sphericalMercator: true,
-     *     projection: "EPSG:900913"
-     * }
-     * (end)
-     */
-    DEFAULTS: {
-        sphericalMercator: true,
-        projection: "EPSG:900913"
-    },
-
-    /**
-     * APIProperty: animationEnabled
-     * {Boolean} If set to true, the transition between zoom levels will be
-     *     animated (if supported by the GMaps API for the device used). Set to
-     *     false to match the zooming experience of other layer types. Default
-     *     is true. Note that the GMaps API does not give us control over zoom
-     *     animation, so if set to false, when zooming, this will make the
-     *     layer temporarily invisible, wait until GMaps reports the map being
-     *     idle, and make it visible again. The result will be a blank layer
-     *     for a few moments while zooming.
-     */
-    animationEnabled: true, 
-
-    /** 
-     * Method: loadMapObject
-     * Load the GMap and register appropriate event listeners.
+     * APIProperty: isBaseLayer
+     * Default is true, as this is designed to be a base tile source. 
      */
      */
-    loadMapObject: function() {
-        if (!this.type) {
-            this.type = google.maps.MapTypeId.ROADMAP;
-        }
-        var mapObject;
-        var cache = OpenLayers.Layer.Google.cache[this.map.id];
-        if (cache) {
-            // there are already Google layers added to this map
-            mapObject = cache.mapObject;
-            // increment the layer count
-            ++cache.count;
-        } else {
-            // this is the first Google layer for this map
-            // create GMap
-            var center = this.map.getCenter();
-            var container = document.createElement('div');
-            container.className = "olForeignContainer";
-            container.style.width = '100%';
-            container.style.height = '100%';
-            mapObject = new google.maps.Map(container, {
-                center: center ?
-                    new google.maps.LatLng(center.lat, center.lon) :
-                    new google.maps.LatLng(0, 0),
-                zoom: this.map.getZoom() || 0,
-                mapTypeId: this.type,
-                disableDefaultUI: true,
-                keyboardShortcuts: false,
-                draggable: false,
-                disableDoubleClickZoom: true,
-                scrollwheel: false,
-                streetViewControl: false
-            });
-            var googleControl = document.createElement('div');
-            googleControl.style.width = '100%';
-            googleControl.style.height = '100%';
-            mapObject.controls[google.maps.ControlPosition.TOP_LEFT].push(googleControl);
-            
-            // cache elements for use by any other google layers added to
-            // this same map
-            cache = {
-                googleControl: googleControl,
-                mapObject: mapObject,
-                count: 1
-            };
-            OpenLayers.Layer.Google.cache[this.map.id] = cache;
-        }
-        this.mapObject = mapObject;
-        this.setGMapVisibility(this.visibility);
-    },
+    isBaseLayer: true,
     
     /**
     
     /**
-     * APIMethod: onMapResize
+     * APIProperty: sphericalMercator
+     * Whether the tile extents should be set to the defaults for 
+     *    spherical mercator. Useful for things like OpenStreetMap.
+     *    Default is false, except for the OSM subclass.
      */
      */
-    onMapResize: function() {
-        if (this.visibility) {
-            google.maps.event.trigger(this.mapObject, "resize");
-        }
-    },
+    sphericalMercator: false,
 
     /**
 
     /**
-     * Method: setGMapVisibility
-     * Display the GMap container and associated elements.
-     * 
-     * Parameters:
-     * visible - {Boolean} Display the GMap elements.
-     */
-    setGMapVisibility: function(visible) {
-        var cache = OpenLayers.Layer.Google.cache[this.map.id];
-        var map = this.map;
-        if (cache) {
-            var type = this.type;
-            var layers = map.layers;
-            var layer;
-            for (var i=layers.length-1; i>=0; --i) {
-                layer = layers[i];
-                if (layer instanceof OpenLayers.Layer.Google &&
-                            layer.visibility === true && layer.inRange === true) {
-                    type = layer.type;
-                    visible = true;
-                    break;
-                }
-            }
-            var container = this.mapObject.getDiv();
-            if (visible === true) {
-                if (container.parentNode !== map.div) {
-                    if (!cache.rendered) {
-                        var me = this;
-                        google.maps.event.addListenerOnce(this.mapObject, 'tilesloaded', function() {
-                            cache.rendered = true;
-                            me.setGMapVisibility(me.getVisibility());
-                            me.moveTo(me.map.getCenter());
-                        });
-                    } else {
-                        map.div.appendChild(container);
-                        cache.googleControl.appendChild(map.viewPortDiv);
-                        google.maps.event.trigger(this.mapObject, 'resize');
-                    }
-                }
-                this.mapObject.setMapTypeId(type);                
-            } else if (cache.googleControl.hasChildNodes()) {
-                map.div.appendChild(map.viewPortDiv);
-                map.div.removeChild(container);
-            }
-        }
-    },
-    
-    /**
-     * Method: getMapContainer
-     * 
-     * Returns:
-     * {DOMElement} the GMap container's div
+     * APIProperty: zoomOffset
+     * {Number} If your cache has more zoom levels than you want to provide
+     *     access to with this layer, supply a zoomOffset.  This zoom offset
+     *     is added to the current map zoom level to determine the level
+     *     for a requested tile.  For example, if you supply a zoomOffset
+     *     of 3, when the map is at the zoom 0, tiles will be requested from
+     *     level 3 of your cache.  Default is 0 (assumes cache level and map
+     *     zoom are equivalent).  Using <zoomOffset> is an alternative to
+     *     setting <serverResolutions> if you only want to expose a subset
+     *     of the server resolutions.
      */
      */
-    getMapContainer: function() {
-        return this.mapObject.getDiv();
-    },
+    zoomOffset: 0,
     
     
-  //
-  // TRANSLATION: MapObject Bounds <-> OpenLayers.Bounds
-  //
-
-    /**
-     * APIMethod: getMapObjectBoundsFromOLBounds
-     * 
-     * Parameters:
-     * olBounds - {<OpenLayers.Bounds>}
-     * 
-     * Returns:
-     * {Object} A MapObject Bounds, translated from olBounds
-     *          Returns null if null value is passed in
-     */
-    getMapObjectBoundsFromOLBounds: function(olBounds) {
-        var moBounds = null;
-        if (olBounds != null) {
-            var sw = this.sphericalMercator ? 
-              this.inverseMercator(olBounds.bottom, olBounds.left) : 
-              new OpenLayers.LonLat(olBounds.bottom, olBounds.left);
-            var ne = this.sphericalMercator ? 
-              this.inverseMercator(olBounds.top, olBounds.right) : 
-              new OpenLayers.LonLat(olBounds.top, olBounds.right);
-            moBounds = new google.maps.LatLngBounds(
-                new google.maps.LatLng(sw.lat, sw.lon),
-                new google.maps.LatLng(ne.lat, ne.lon)
-            );
-        }
-        return moBounds;
-    },
-
-
-    /************************************
-     *                                  *
-     *   MapObject Interface Controls   *
-     *                                  *
-     ************************************/
-
-
-  // LonLat - Pixel Translation
-  
     /**
     /**
-     * APIMethod: getMapObjectLonLatFromMapObjectPixel
-     * 
-     * Parameters:
-     * moPixel - {Object} MapObject Pixel format
-     * 
-     * Returns:
-     * {Object} MapObject LonLat translated from MapObject Pixel
+     * APIProperty: serverResolutions
+     * {Array} A list of all resolutions available on the server.  Only set this
+     *     property if the map resolutions differ from the server. This
+     *     property serves two purposes. (a) <serverResolutions> can include
+     *     resolutions that the server supports and that you don't want to
+     *     provide with this layer; you can also look at <zoomOffset>, which is
+     *     an alternative to <serverResolutions> for that specific purpose.
+     *     (b) The map can work with resolutions that aren't supported by
+     *     the server, i.e. that aren't in <serverResolutions>. When the
+     *     map is displayed in such a resolution data for the closest
+     *     server-supported resolution is loaded and the layer div is
+     *     stretched as necessary.
      */
      */
-    getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
-        var size = this.map.getSize();
-        var lon = this.getLongitudeFromMapObjectLonLat(this.mapObject.center);
-        var lat = this.getLatitudeFromMapObjectLonLat(this.mapObject.center);
-        var res = this.map.getResolution();
-
-        var delta_x = moPixel.x - (size.w / 2);
-        var delta_y = moPixel.y - (size.h / 2);
-    
-        var lonlat = new OpenLayers.LonLat(
-            lon + delta_x * res,
-            lat - delta_y * res
-        ); 
-
-        if (this.wrapDateLine) {
-            lonlat = lonlat.wrapDateLine(this.maxExtent);
-        }
-        return this.getMapObjectLonLatFromLonLat(lonlat.lon, lonlat.lat);
-    },
+    serverResolutions: null,
 
     /**
 
     /**
-     * APIMethod: getMapObjectPixelFromMapObjectLonLat
-     * 
-     * Parameters:
-     * moLonLat - {Object} MapObject LonLat format
-     * 
-     * Returns:
-     * {Object} MapObject Pixel transtlated from MapObject LonLat
-     */
-    getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
-        var lon = this.getLongitudeFromMapObjectLonLat(moLonLat);
-        var lat = this.getLatitudeFromMapObjectLonLat(moLonLat);
-        var res = this.map.getResolution();
-        var extent = this.map.getExtent();
-        return this.getMapObjectPixelFromXY((1/res * (lon - extent.left)),
-                                            (1/res * (extent.top - lat)));
-    },
-
-  
-    /** 
-     * APIMethod: setMapObjectCenter
-     * Set the mapObject to the specified center and zoom
-     * 
+     * Constructor: OpenLayers.Layer.XYZ
+     *
      * Parameters:
      * Parameters:
-     * center - {Object} MapObject LonLat format
-     * zoom - {int} MapObject zoom format
-     */
-    setMapObjectCenter: function(center, zoom) {
-        if (this.animationEnabled === false && zoom != this.mapObject.zoom) {
-            var mapContainer = this.getMapContainer();
-            google.maps.event.addListenerOnce(
-                this.mapObject, 
-                "idle", 
-                function() {
-                    mapContainer.style.visibility = "";
-                }
-            );
-            mapContainer.style.visibility = "hidden";
+     * name - {String}
+     * url - {String}
+     * options - {Object} Hashtable of extra options to tag onto the layer
+     */
+    initialize: function(name, url, options) {
+        if (options && options.sphericalMercator || this.sphericalMercator) {
+            options = OpenLayers.Util.extend({
+                projection: "EPSG:900913",
+                numZoomLevels: this.serverResolutions ?
+                        this.serverResolutions.length : 19
+            }, options);
         }
         }
-        this.mapObject.setOptions({
-            center: center,
-            zoom: zoom
-        });
+        OpenLayers.Layer.Grid.prototype.initialize.apply(this, [
+            name || this.name, url || this.url, {}, options
+        ]);
     },
     },
-   
     
     
-  // Bounds
-  
-    /** 
-     * APIMethod: getMapObjectZoomFromMapObjectBounds
-     * 
+    /**
+     * APIMethod: clone
+     * Create a clone of this layer
+     *
      * Parameters:
      * Parameters:
-     * moBounds - {Object} MapObject Bounds format
+     * obj - {Object} Is this ever used?
      * 
      * Returns:
      * 
      * Returns:
-     * {Object} MapObject Zoom for specified MapObject Bounds
+     * {<OpenLayers.Layer.XYZ>} An exact clone of this OpenLayers.Layer.XYZ
      */
      */
-    getMapObjectZoomFromMapObjectBounds: function(moBounds) {
-        return this.mapObject.getBoundsZoomLevel(moBounds);
-    },
+    clone: function (obj) {
+        
+        if (obj == null) {
+            obj = new OpenLayers.Layer.XYZ(this.name,
+                                            this.url,
+                                            this.getOptions());
+        }
 
 
-    /************************************
-     *                                  *
-     *       MapObject Primitives       *
-     *                                  *
-     ************************************/
+        //get all additions from superclasses
+        obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
 
 
+        return obj;
+    },    
 
 
-  // LonLat
-    
     /**
     /**
-     * APIMethod: getMapObjectLonLatFromLonLat
-     * 
+     * Method: getURL
+     *
      * Parameters:
      * Parameters:
-     * lon - {Float}
-     * lat - {Float}
-     * 
+     * bounds - {<OpenLayers.Bounds>}
+     *
      * Returns:
      * Returns:
-     * {Object} MapObject LonLat built from lon and lat params
+     * {String} A string with the layer's url and parameters and also the
+     *          passed-in bounds and appropriate tile size specified as
+     *          parameters
      */
      */
-    getMapObjectLonLatFromLonLat: function(lon, lat) {
-        var gLatLng;
-        if(this.sphericalMercator) {
-            var lonlat = this.inverseMercator(lon, lat);
-            gLatLng = new google.maps.LatLng(lonlat.lat, lonlat.lon);
-        } else {
-            gLatLng = new google.maps.LatLng(lat, lon);
+    getURL: function (bounds) {
+        var xyz = this.getXYZ(bounds);
+        var url = this.url;
+        if (OpenLayers.Util.isArray(url)) {
+            var s = '' + xyz.x + xyz.y + xyz.z;
+            url = this.selectUrl(s, url);
         }
         }
-        return gLatLng;
+        
+        return OpenLayers.String.format(url, xyz);
     },
     
     },
     
-  // Pixel
-    
     /**
     /**
-     * APIMethod: getMapObjectPixelFromXY
-     * 
+     * Method: getXYZ
+     * Calculates x, y and z for the given bounds.
+     *
      * Parameters:
      * Parameters:
-     * x - {Integer}
-     * y - {Integer}
-     * 
+     * bounds - {<OpenLayers.Bounds>}
+     *
      * Returns:
      * Returns:
-     * {Object} MapObject Pixel from x and y parameters
+     * {Object} - an object with x, y and z properties.
      */
      */
-    getMapObjectPixelFromXY: function(x, y) {
-        return new google.maps.Point(x, y);
-    }
+    getXYZ: function(bounds) {
+        var res = this.getServerResolution();
+        var x = Math.round((bounds.left - this.tileOrigin.lon) /
+            (res * this.tileSize.w));
+        var y = Math.round((this.tileOrigin.lat - bounds.top) /
+            (res * this.tileSize.h));
+        var z = this.getServerZoom();
+
+        if (this.wrapDateLine) {
+            var limit = Math.pow(2, z);
+            x = ((x % limit) + limit) % limit;
+        }
+
+        return {'x': x, 'y': y, 'z': z};
+    },
     
     
-};
+    /* APIMethod: setMap
+     * When the layer is added to a map, then we can fetch our origin 
+     *    (if we don't have one.) 
+     * 
+     * Parameters:
+     * map - {<OpenLayers.Map>}
+     */
+    setMap: function(map) {
+        OpenLayers.Layer.Grid.prototype.setMap.apply(this, arguments);
+        if (!this.tileOrigin) { 
+            this.tileOrigin = new OpenLayers.LonLat(this.maxExtent.left,
+                                                this.maxExtent.top);
+        }                                       
+    },
+
+    CLASS_NAME: "OpenLayers.Layer.XYZ"
+});
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Request.js
+    OpenLayers/Layer/Bing.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
 /**
- * @requires OpenLayers/Events.js
- * @requires OpenLayers/Request/XMLHttpRequest.js
+ * @requires OpenLayers/Layer/XYZ.js
  */
 
  */
 
-/**
- * TODO: deprecate me
- * Use OpenLayers.Request.proxy instead.
+/** 
+ * Class: OpenLayers.Layer.Bing
+ * Bing layer using direct tile access as provided by Bing Maps REST Services.
+ * See http://msdn.microsoft.com/en-us/library/ff701713.aspx for more
+ * information. Note: Terms of Service compliant use requires the map to be
+ * configured with an <OpenLayers.Control.Attribution> control and the
+ * attribution placed on or near the map.
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Layer.XYZ>
  */
  */
-OpenLayers.ProxyHost = "";
+OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
 
 
-/**
- * Namespace: OpenLayers.Request
- * The OpenLayers.Request namespace contains convenience methods for working
- *     with XMLHttpRequests.  These methods work with a cross-browser
- *     W3C compliant <OpenLayers.Request.XMLHttpRequest> class.
- */
-if (!OpenLayers.Request) {
     /**
     /**
-     * This allows for OpenLayers/Request/XMLHttpRequest.js to be included
-     * before or after this script.
+     * Property: key
+     * {String} API key for Bing maps, get your own key 
+     *     at http://bingmapsportal.com/ .
      */
      */
-    OpenLayers.Request = {};
-}
-OpenLayers.Util.extend(OpenLayers.Request, {
+    key: null,
+
+    /**
+     * Property: serverResolutions
+     * {Array} the resolutions provided by the Bing servers.
+     */
+    serverResolutions: [
+        156543.03390625, 78271.516953125, 39135.7584765625,
+        19567.87923828125, 9783.939619140625, 4891.9698095703125,
+        2445.9849047851562, 1222.9924523925781, 611.4962261962891,
+        305.74811309814453, 152.87405654907226, 76.43702827453613,
+        38.218514137268066, 19.109257068634033, 9.554628534317017,
+        4.777314267158508, 2.388657133579254, 1.194328566789627,
+        0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
+        0.07464553542435169, 0.03732276771218, 0.01866138385609
+    ],
     
     /**
     
     /**
-     * Constant: DEFAULT_CONFIG
-     * {Object} Default configuration for all requests.
+     * Property: attributionTemplate
+     * {String}
      */
      */
-    DEFAULT_CONFIG: {
-        method: "GET",
-        url: window.location.href,
-        async: true,
-        user: undefined,
-        password: undefined,
-        params: null,
-        proxy: OpenLayers.ProxyHost,
-        headers: {},
-        data: null,
-        callback: function() {},
-        success: null,
-        failure: null,
-        scope: null
-    },
+    attributionTemplate: '<span class="olBingAttribution ${type}">' +
+         '<div><a target="_blank" href="http://www.bing.com/maps/">' +
+         '<img src="${logo}" /></a></div>${copyrights}' +
+         '<a style="white-space: nowrap" target="_blank" '+
+         'href="http://www.microsoft.com/maps/product/terms.html">' +
+         'Terms of Use</a></span>',
+
+    /**
+     * Property: metadata
+     * {Object} Metadata for this layer, as returned by the callback script
+     */
+    metadata: null,
+
+    /**
+     * Property: protocolRegex
+     * {RegExp} Regular expression to match and replace http: in bing urls
+     */
+    protocolRegex: /^http:/i,
     
     /**
     
     /**
-     * Constant: URL_SPLIT_REGEX
+     * APIProperty: type
+     * {String} The layer identifier.  Any non-birdseye imageryType
+     *     from http://msdn.microsoft.com/en-us/library/ff701716.aspx can be
+     *     used.  Default is "Road".
      */
      */
-    URL_SPLIT_REGEX: /([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,
+    type: "Road",
     
     /**
     
     /**
-     * APIProperty: events
-     * {<OpenLayers.Events>} An events object that handles all 
-     *     events on the {<OpenLayers.Request>} object.
-     *
-     * All event listeners will receive an event object with three properties:
-     * request - {<OpenLayers.Request.XMLHttpRequest>} The request object.
-     * config - {Object} The config object sent to the specific request method.
-     * requestUrl - {String} The request url.
-     * 
-     * Supported event types:
-     * complete - Triggered when we have a response from the request, if a
-     *     listener returns false, no further response processing will take
-     *     place.
-     * success - Triggered when the HTTP response has a success code (200-299).
-     * failure - Triggered when the HTTP response does not have a success code.
+     * APIProperty: culture
+     * {String} The culture identifier.  See http://msdn.microsoft.com/en-us/library/ff701709.aspx
+     * for the definition and the possible values.  Default is "en-US".
      */
      */
-    events: new OpenLayers.Events(this),
+    culture: "en-US",
     
     /**
     
     /**
-     * Method: makeSameOrigin
-     * Using the specified proxy, returns a same origin url of the provided url.
+     * APIProperty: metadataParams
+     * {Object} Optional url parameters for the Get Imagery Metadata request
+     * as described here: http://msdn.microsoft.com/en-us/library/ff701716.aspx
+     */
+    metadataParams: null,
+
+    /** APIProperty: tileOptions
+     *  {Object} optional configuration options for <OpenLayers.Tile> instances
+     *  created by this Layer. Default is
      *
      *
-     * Parameters:
-     * url - {String} An arbitrary url
-     * proxy {String|Function} The proxy to use to make the provided url a
-     *     same origin url.
+     *  (code)
+     *  {crossOriginKeyword: 'anonymous'}
+     *  (end)
+     */
+    tileOptions: null,
+
+    /** APIProperty: protocol
+     *  {String} Protocol to use to fetch Imagery Metadata, tiles and bing logo
+     *  Can be 'http:' 'https:' or ''
      *
      *
-     * Returns
-     * {String} the same origin url. If no proxy is provided, the returned url
-     *     will be the same as the provided url.
+     *  Warning: tiles may not be available under both HTTP and HTTPS protocols.
+     *  Microsoft approved use of both HTTP and HTTPS urls for tiles. However
+     *  this is undocumented and the Imagery Metadata API always returns HTTP
+     *  urls.
+     *
+     *  Default is '', unless when executed from a file:/// uri, in which case
+     *  it is 'http:'.
      */
      */
-    makeSameOrigin: function(url, proxy) {
-        var sameOrigin = url.indexOf("http") !== 0;
-        var urlParts = !sameOrigin && url.match(this.URL_SPLIT_REGEX);
-        if (urlParts) {
-            var location = window.location;
-            sameOrigin =
-                urlParts[1] == location.protocol &&
-                urlParts[3] == location.hostname;
-            var uPort = urlParts[4], lPort = location.port;
-            if (uPort != 80 && uPort != "" || lPort != "80" && lPort != "") {
-                sameOrigin = sameOrigin && uPort == lPort;
-            }
-        }
-        if (!sameOrigin) {
-            if (proxy) {
-                if (typeof proxy == "function") {
-                    url = proxy(url);
-                } else {
-                    url = proxy + encodeURIComponent(url);
-                }
-            }
-        }
-        return url;
-    },
+    protocol: ~window.location.href.indexOf('http') ? '' : 'http:',
 
     /**
 
     /**
-     * APIMethod: issue
-     * Create a new XMLHttpRequest object, open it, set any headers, bind
-     *     a callback to done state, and send any data.  It is recommended that
-     *     you use one <GET>, <POST>, <PUT>, <DELETE>, <OPTIONS>, or <HEAD>.
-     *     This method is only documented to provide detail on the configuration
-     *     options available to all request methods.
+     * Constructor: OpenLayers.Layer.Bing
+     * Create a new Bing layer.
+     *
+     * Example:
+     * (code)
+     * var road = new OpenLayers.Layer.Bing({
+     *     name: "My Bing Aerial Layer",
+     *     type: "Aerial",
+     *     key: "my-api-key-here",
+     * });
+     * (end)
      *
      * Parameters:
      *
      * Parameters:
-     * config - {Object} Object containing properties for configuring the
-     *     request.  Allowed configuration properties are described below.
-     *     This object is modified and should not be reused.
+     * options - {Object} Configuration properties for the layer.
      *
      *
-     * Allowed config properties:
-     * method - {String} One of GET, POST, PUT, DELETE, HEAD, or
-     *     OPTIONS.  Default is GET.
-     * url - {String} URL for the request.
-     * async - {Boolean} Open an asynchronous request.  Default is true.
-     * user - {String} User for relevant authentication scheme.  Set
-     *     to null to clear current user.
-     * password - {String} Password for relevant authentication scheme.
-     *     Set to null to clear current password.
-     * proxy - {String} Optional proxy.  Defaults to
-     *     <OpenLayers.ProxyHost>.
-     * params - {Object} Any key:value pairs to be appended to the
-     *     url as a query string.  Assumes url doesn't already include a query
-     *     string or hash.  Typically, this is only appropriate for <GET>
-     *     requests where the query string will be appended to the url.
-     *     Parameter values that are arrays will be
-     *     concatenated with a comma (note that this goes against form-encoding)
-     *     as is done with <OpenLayers.Util.getParameterString>.
-     * headers - {Object} Object with header:value pairs to be set on
-     *     the request.
-     * data - {String | Document} Optional data to send with the request.
-     *     Typically, this is only used with <POST> and <PUT> requests.
-     *     Make sure to provide the appropriate "Content-Type" header for your
-     *     data.  For <POST> and <PUT> requests, the content type defaults to
-     *     "application-xml".  If your data is a different content type, or
-     *     if you are using a different HTTP method, set the "Content-Type"
-     *     header to match your data type.
-     * callback - {Function} Function to call when request is done.
-     *     To determine if the request failed, check request.status (200
-     *     indicates success).
-     * success - {Function} Optional function to call if request status is in
-     *     the 200s.  This will be called in addition to callback above and
-     *     would typically only be used as an alternative.
-     * failure - {Function} Optional function to call if request status is not
-     *     in the 200s.  This will be called in addition to callback above and
-     *     would typically only be used as an alternative.
-     * scope - {Object} If callback is a public method on some object,
-     *     set the scope to that object.
+     * Required configuration properties:
+     * key - {String} Bing Maps API key for your application. Get one at
+     *     http://bingmapsportal.com/.
+     * type - {String} The layer identifier.  Any non-birdseye imageryType
+     *     from http://msdn.microsoft.com/en-us/library/ff701716.aspx can be
+     *     used.
      *
      *
-     * Returns:
-     * {XMLHttpRequest} Request object.  To abort the request before a response
-     *     is received, call abort() on the request object.
+     * Any other documented layer properties can be provided in the config object.
      */
      */
-    issue: function(config) {        
-        // apply default config - proxy host may have changed
-        var defaultConfig = OpenLayers.Util.extend(
-            this.DEFAULT_CONFIG,
-            {proxy: OpenLayers.ProxyHost}
-        );
-        config = config || {};
-        config.headers = config.headers || {};
-        config = OpenLayers.Util.applyDefaults(config, defaultConfig);
-        config.headers = OpenLayers.Util.applyDefaults(config.headers, defaultConfig.headers);
-        // Always set the "X-Requested-With" header to signal that this request
-        // was issued through the XHR-object. Since header keys are case 
-        // insensitive and we want to allow overriding of the "X-Requested-With"
-        // header through the user we cannot use applyDefaults, but have to 
-        // check manually whether we were called with a "X-Requested-With"
-        // header.
-        var customRequestedWithHeader = false,
-            headerKey;
-        for(headerKey in config.headers) {
-            if (config.headers.hasOwnProperty( headerKey )) {
-                if (headerKey.toLowerCase() === 'x-requested-with') {
-                    customRequestedWithHeader = true;
-                }
-            }
-        }
-        if (customRequestedWithHeader === false) {
-            // we did not have a custom "X-Requested-With" header
-            config.headers['X-Requested-With'] = 'XMLHttpRequest';
-        }
-
-        // create request, open, and set headers
-        var request = new OpenLayers.Request.XMLHttpRequest();
-        var url = OpenLayers.Util.urlAppend(config.url, 
-            OpenLayers.Util.getParameterString(config.params || {}));
-        url = OpenLayers.Request.makeSameOrigin(url, config.proxy);
-        request.open(
-            config.method, url, config.async, config.user, config.password
-        );
-        for(var header in config.headers) {
-            request.setRequestHeader(header, config.headers[header]);
-        }
-
-        var events = this.events;
-
-        // we want to execute runCallbacks with "this" as the
-        // execution scope
-        var self = this;
-        
-        request.onreadystatechange = function() {
-            if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
-                var proceed = events.triggerEvent(
-                    "complete",
-                    {request: request, config: config, requestUrl: url}
-                );
-                if(proceed !== false) {
-                    self.runCallbacks(
-                        {request: request, config: config, requestUrl: url}
-                    );
-                }
-            }
-        };
+    initialize: function(options) {
+        options = OpenLayers.Util.applyDefaults({
+            sphericalMercator: true
+        }, options);
+        var name = options.name || "Bing " + (options.type || this.type);
         
         
-        // send request (optionally with data) and return
-        // call in a timeout for asynchronous requests so the return is
-        // available before readyState == 4 for cached docs
-        if(config.async === false) {
-            request.send(config.data);
-        } else {
-            window.setTimeout(function(){
-                if (request.readyState !== 0) { // W3C: 0-UNSENT
-                    request.send(config.data);
-                }
-            }, 0);
-        }
-        return request;
+        var newArgs = [name, null, options];
+        OpenLayers.Layer.XYZ.prototype.initialize.apply(this, newArgs);
+        this.tileOptions = OpenLayers.Util.extend({
+            crossOriginKeyword: 'anonymous'
+        }, this.options.tileOptions);
+        this.loadMetadata(); 
     },
     },
-    
+
     /**
     /**
-     * Method: runCallbacks
-     * Calls the complete, success and failure callbacks. Application
-     *    can listen to the "complete" event, have the listener 
-     *    display a confirm window and always return false, and
-     *    execute OpenLayers.Request.runCallbacks if the user
-     *    hits "yes" in the confirm window.
-     *
-     * Parameters:
-     * options - {Object} Hash containing request, config and requestUrl keys
+     * Method: loadMetadata
      */
      */
-    runCallbacks: function(options) {
-        var request = options.request;
-        var config = options.config;
-        
-        // bind callbacks to readyState 4 (done)
-        var complete = (config.scope) ?
-            OpenLayers.Function.bind(config.callback, config.scope) :
-            config.callback;
-        
-        // optional success callback
-        var success;
-        if(config.success) {
-            success = (config.scope) ?
-                OpenLayers.Function.bind(config.success, config.scope) :
-                config.success;
-        }
-
-        // optional failure callback
-        var failure;
-        if(config.failure) {
-            failure = (config.scope) ?
-                OpenLayers.Function.bind(config.failure, config.scope) :
-                config.failure;
-        }
-
-        if (OpenLayers.Util.createUrlObject(config.url).protocol == "file:" &&
-                                                        request.responseText) {
-            request.status = 200;
-        }
-        complete(request);
-
-        if (!request.status || (request.status >= 200 && request.status < 300)) {
-            this.events.triggerEvent("success", options);
-            if(success) {
-                success(request);
-            }
-        }
-        if(request.status && (request.status < 200 || request.status >= 300)) {                    
-            this.events.triggerEvent("failure", options);
-            if(failure) {
-                failure(request);
-            }
-        }
+    loadMetadata: function() {
+        this._callbackId = "_callback_" + this.id.replace(/\./g, "_");
+        // link the processMetadata method to the global scope and bind it
+        // to this instance
+        window[this._callbackId] = OpenLayers.Function.bind(
+            OpenLayers.Layer.Bing.processMetadata, this
+        );
+        var params = OpenLayers.Util.applyDefaults({
+            key: this.key,
+            jsonp: this._callbackId,
+            include: "ImageryProviders"
+        }, this.metadataParams);
+        var url = this.protocol + "//dev.virtualearth.net/REST/v1/Imagery/Metadata/" +
+            this.type + "?" + OpenLayers.Util.getParameterString(params);
+        var script = document.createElement("script");
+        script.type = "text/javascript";
+        script.src = url;
+        script.id = this._callbackId;
+        document.getElementsByTagName("head")[0].appendChild(script);
     },
     
     /**
     },
     
     /**
-     * APIMethod: GET
-     * Send an HTTP GET request.  Additional configuration properties are
-     *     documented in the <issue> method, with the method property set
-     *     to GET.
+     * Method: initLayer
      *
      *
-     * Parameters:
-     * config - {Object} Object with properties for configuring the request.
-     *     See the <issue> method for documentation of allowed properties.
-     *     This object is modified and should not be reused.
-     * 
-     * Returns:
-     * {XMLHttpRequest} Request object.
+     * Sets layer properties according to the metadata provided by the API
      */
      */
-    GET: function(config) {
-        config = OpenLayers.Util.extend(config, {method: "GET"});
-        return OpenLayers.Request.issue(config);
+    initLayer: function() {
+        var res = this.metadata.resourceSets[0].resources[0];
+        var url = res.imageUrl.replace("{quadkey}", "${quadkey}");
+        url = url.replace("{culture}", this.culture);
+        url = url.replace(this.protocolRegex, this.protocol);
+        this.url = [];
+        for (var i=0; i<res.imageUrlSubdomains.length; ++i) {
+            this.url.push(url.replace("{subdomain}", res.imageUrlSubdomains[i]));
+        }
+        this.addOptions({
+            maxResolution: Math.min(
+                this.serverResolutions[res.zoomMin],
+                this.maxResolution || Number.POSITIVE_INFINITY
+            ),
+            numZoomLevels: Math.min(
+                res.zoomMax + 1 - res.zoomMin, this.numZoomLevels
+            )
+        }, true);
+        if (!this.isBaseLayer) {
+            this.redraw();
+        }
+        this.updateAttribution();
     },
     
     /**
     },
     
     /**
-     * APIMethod: POST
-     * Send a POST request.  Additional configuration properties are
-     *     documented in the <issue> method, with the method property set
-     *     to POST and "Content-Type" header set to "application/xml".
+     * Method: getURL
      *
      * Parameters:
      *
      * Parameters:
-     * config - {Object} Object with properties for configuring the request.
-     *     See the <issue> method for documentation of allowed properties.  The
-     *     default "Content-Type" header will be set to "application-xml" if
-     *     none is provided.  This object is modified and should not be reused.
-     * 
-     * Returns:
-     * {XMLHttpRequest} Request object.
+     * bounds - {<OpenLayers.Bounds>}
      */
      */
-    POST: function(config) {
-        config = OpenLayers.Util.extend(config, {method: "POST"});
-        // set content type to application/xml if it isn't already set
-        config.headers = config.headers ? config.headers : {};
-        if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
-            config.headers["Content-Type"] = "application/xml";
+    getURL: function(bounds) {
+        if (!this.url) {
+            return;
         }
         }
-        return OpenLayers.Request.issue(config);
+        var xyz = this.getXYZ(bounds), x = xyz.x, y = xyz.y, z = xyz.z;
+        var quadDigits = [];
+        for (var i = z; i > 0; --i) {
+            var digit = '0';
+            var mask = 1 << (i - 1);
+            if ((x & mask) != 0) {
+                digit++;
+            }
+            if ((y & mask) != 0) {
+                digit++;
+                digit++;
+            }
+            quadDigits.push(digit);
+        }
+        var quadKey = quadDigits.join("");
+        var url = this.selectUrl('' + x + y + z, this.url);
+
+        return OpenLayers.String.format(url, {'quadkey': quadKey});
     },
     
     /**
     },
     
     /**
-     * APIMethod: PUT
-     * Send an HTTP PUT request.  Additional configuration properties are
-     *     documented in the <issue> method, with the method property set
-     *     to PUT and "Content-Type" header set to "application/xml".
-     *
-     * Parameters:
-     * config - {Object} Object with properties for configuring the request.
-     *     See the <issue> method for documentation of allowed properties.  The
-     *     default "Content-Type" header will be set to "application-xml" if
-     *     none is provided.  This object is modified and should not be reused.
-     * 
-     * Returns:
-     * {XMLHttpRequest} Request object.
+     * Method: updateAttribution
+     * Updates the attribution according to the requirements outlined in
+     * http://gis.638310.n2.nabble.com/Bing-imagery-td5789168.html
      */
      */
-    PUT: function(config) {
-        config = OpenLayers.Util.extend(config, {method: "PUT"});
-        // set content type to application/xml if it isn't already set
-        config.headers = config.headers ? config.headers : {};
-        if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
-            config.headers["Content-Type"] = "application/xml";
+    updateAttribution: function() {
+        var metadata = this.metadata;
+        if (!metadata.resourceSets || !this.map || !this.map.center) {
+            return;
         }
         }
-        return OpenLayers.Request.issue(config);
+        var res = metadata.resourceSets[0].resources[0];
+        var extent = this.map.getExtent().transform(
+            this.map.getProjectionObject(),
+            new OpenLayers.Projection("EPSG:4326")
+        );
+        var providers = res.imageryProviders || [],
+            zoom = OpenLayers.Util.indexOf(this.serverResolutions,
+                                           this.getServerResolution()),
+            copyrights = "", provider, i, ii, j, jj, bbox, coverage;
+        for (i=0,ii=providers.length; i<ii; ++i) {
+            provider = providers[i];
+            for (j=0,jj=provider.coverageAreas.length; j<jj; ++j) {
+                coverage = provider.coverageAreas[j];
+                // axis order provided is Y,X
+                bbox = OpenLayers.Bounds.fromArray(coverage.bbox, true);
+                if (extent.intersectsBounds(bbox) &&
+                        zoom <= coverage.zoomMax && zoom >= coverage.zoomMin) {
+                    copyrights += provider.attribution + " ";
+                }
+            }
+        }
+        var logo = metadata.brandLogoUri.replace(this.protocolRegex, this.protocol);
+        this.attribution = OpenLayers.String.format(this.attributionTemplate, {
+            type: this.type.toLowerCase(),
+            logo: logo,
+            copyrights: copyrights
+        });
+        this.map && this.map.events.triggerEvent("changelayer", {
+            layer: this,
+            property: "attribution"
+        });
     },
     
     /**
     },
     
     /**
-     * APIMethod: DELETE
-     * Send an HTTP DELETE request.  Additional configuration properties are
-     *     documented in the <issue> method, with the method property set
-     *     to DELETE.
-     *
-     * Parameters:
-     * config - {Object} Object with properties for configuring the request.
-     *     See the <issue> method for documentation of allowed properties.
-     *     This object is modified and should not be reused.
-     * 
-     * Returns:
-     * {XMLHttpRequest} Request object.
+     * Method: setMap
      */
      */
-    DELETE: function(config) {
-        config = OpenLayers.Util.extend(config, {method: "DELETE"});
-        return OpenLayers.Request.issue(config);
+    setMap: function() {
+        OpenLayers.Layer.XYZ.prototype.setMap.apply(this, arguments);
+        this.map.events.register("moveend", this, this.updateAttribution);
     },
     },
-  
+    
     /**
     /**
-     * APIMethod: HEAD
-     * Send an HTTP HEAD request.  Additional configuration properties are
-     *     documented in the <issue> method, with the method property set
-     *     to HEAD.
-     *
+     * APIMethod: clone
+     * 
      * Parameters:
      * Parameters:
-     * config - {Object} Object with properties for configuring the request.
-     *     See the <issue> method for documentation of allowed properties.
-     *     This object is modified and should not be reused.
+     * obj - {Object}
      * 
      * Returns:
      * 
      * Returns:
-     * {XMLHttpRequest} Request object.
+     * {<OpenLayers.Layer.Bing>} An exact clone of this <OpenLayers.Layer.Bing>
      */
      */
-    HEAD: function(config) {
-        config = OpenLayers.Util.extend(config, {method: "HEAD"});
-        return OpenLayers.Request.issue(config);
+    clone: function(obj) {
+        if (obj == null) {
+            obj = new OpenLayers.Layer.Bing(this.options);
+        }
+        //get all additions from superclasses
+        obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
+        // copy/set any non-init, non-simple values here
+        return obj;
     },
     
     /**
     },
     
     /**
-     * APIMethod: OPTIONS
-     * Send an HTTP OPTIONS request.  Additional configuration properties are
-     *     documented in the <issue> method, with the method property set
-     *     to OPTIONS.
-     *
-     * Parameters:
-     * config - {Object} Object with properties for configuring the request.
-     *     See the <issue> method for documentation of allowed properties.
-     *     This object is modified and should not be reused.
-     * 
-     * Returns:
-     * {XMLHttpRequest} Request object.
+     * Method: destroy
      */
      */
-    OPTIONS: function(config) {
-        config = OpenLayers.Util.extend(config, {method: "OPTIONS"});
-        return OpenLayers.Request.issue(config);
-    }
-
+    destroy: function() {
+        this.map &&
+            this.map.events.unregister("moveend", this, this.updateAttribution);
+        OpenLayers.Layer.XYZ.prototype.destroy.apply(this, arguments);
+    },
+    
+    CLASS_NAME: "OpenLayers.Layer.Bing"
 });
 });
-/* ======================================================================
-    OpenLayers/Request/XMLHttpRequest.js
-   ====================================================================== */
-
-// XMLHttpRequest.js Copyright (C) 2010 Sergey Ilinsky (http://www.ilinsky.com)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
 
 /**
 
 /**
- * @requires OpenLayers/Request.js
+ * Function: OpenLayers.Layer.Bing.processMetadata
+ * This function will be bound to an instance, linked to the global scope with
+ * an id, and called by the JSONP script returned by the API.
+ *
+ * Parameters:
+ * metadata - {Object} metadata as returned by the API
  */
  */
+OpenLayers.Layer.Bing.processMetadata = function(metadata) {
+    this.metadata = metadata;
+    this.initLayer();
+    var script = document.getElementById(this._callbackId);
+    script.parentNode.removeChild(script);
+    window[this._callbackId] = undefined; // cannot delete from window in IE
+    delete this._callbackId;
+};
+/* ======================================================================
+    OpenLayers/Layer/Markers.js
+   ====================================================================== */
 
 
-(function () {
-
-    // Save reference to earlier defined object implementation (if any)
-    var oXMLHttpRequest    = window.XMLHttpRequest;
-
-    // Define on browser type
-    var bGecko    = !!window.controllers,
-        bIE        = window.document.all && !window.opera,
-        bIE7    = bIE && window.navigator.userAgent.match(/MSIE 7.0/);
-
-    // Enables "XMLHttpRequest()" call next to "new XMLHttpReques()"
-    function fXMLHttpRequest() {
-        this._object    = oXMLHttpRequest && !bIE7 ? new oXMLHttpRequest : new window.ActiveXObject("Microsoft.XMLHTTP");
-        this._listeners    = [];
-    };
-
-    // Constructor
-    function cXMLHttpRequest() {
-        return new fXMLHttpRequest;
-    };
-    cXMLHttpRequest.prototype    = fXMLHttpRequest.prototype;
-
-    // BUGFIX: Firefox with Firebug installed would break pages if not executed
-    if (bGecko && oXMLHttpRequest.wrapped)
-        cXMLHttpRequest.wrapped    = oXMLHttpRequest.wrapped;
-
-    // Constants
-    cXMLHttpRequest.UNSENT                = 0;
-    cXMLHttpRequest.OPENED                = 1;
-    cXMLHttpRequest.HEADERS_RECEIVED    = 2;
-    cXMLHttpRequest.LOADING                = 3;
-    cXMLHttpRequest.DONE                = 4;
-
-    // Public Properties
-    cXMLHttpRequest.prototype.readyState    = cXMLHttpRequest.UNSENT;
-    cXMLHttpRequest.prototype.responseText    = '';
-    cXMLHttpRequest.prototype.responseXML    = null;
-    cXMLHttpRequest.prototype.status        = 0;
-    cXMLHttpRequest.prototype.statusText    = '';
-
-    // Priority proposal
-    cXMLHttpRequest.prototype.priority        = "NORMAL";
-
-    // Instance-level Events Handlers
-    cXMLHttpRequest.prototype.onreadystatechange    = null;
-
-    // Class-level Events Handlers
-    cXMLHttpRequest.onreadystatechange    = null;
-    cXMLHttpRequest.onopen                = null;
-    cXMLHttpRequest.onsend                = null;
-    cXMLHttpRequest.onabort                = null;
-
-    // Public Methods
-    cXMLHttpRequest.prototype.open    = function(sMethod, sUrl, bAsync, sUser, sPassword) {
-        // Delete headers, required when object is reused
-        delete this._headers;
-
-        // When bAsync parameter value is omitted, use true as default
-        if (arguments.length < 3)
-            bAsync    = true;
-
-        // Save async parameter for fixing Gecko bug with missing readystatechange in synchronous requests
-        this._async        = bAsync;
-
-        // Set the onreadystatechange handler
-        var oRequest    = this,
-            nState        = this.readyState,
-            fOnUnload;
-
-        // BUGFIX: IE - memory leak on page unload (inter-page leak)
-        if (bIE && bAsync) {
-            fOnUnload = function() {
-                if (nState != cXMLHttpRequest.DONE) {
-                    fCleanTransport(oRequest);
-                    // Safe to abort here since onreadystatechange handler removed
-                    oRequest.abort();
-                }
-            };
-            window.attachEvent("onunload", fOnUnload);
-        }
-
-        // Add method sniffer
-        if (cXMLHttpRequest.onopen)
-            cXMLHttpRequest.onopen.apply(this, arguments);
-
-        if (arguments.length > 4)
-            this._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
-        else
-        if (arguments.length > 3)
-            this._object.open(sMethod, sUrl, bAsync, sUser);
-        else
-            this._object.open(sMethod, sUrl, bAsync);
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
 
 
-        this.readyState    = cXMLHttpRequest.OPENED;
-        fReadyStateChange(this);
 
 
-        this._object.onreadystatechange    = function() {
-            if (bGecko && !bAsync)
-                return;
+/**
+ * @requires OpenLayers/Layer.js
+ */
 
 
-            // Synchronize state
-            oRequest.readyState        = oRequest._object.readyState;
+/**
+ * Class: OpenLayers.Layer.Markers
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Layer> 
+ */
+OpenLayers.Layer.Markers = OpenLayers.Class(OpenLayers.Layer, {
+    
+    /** 
+     * APIProperty: isBaseLayer 
+     * {Boolean} Markers layer is never a base layer.  
+     */
+    isBaseLayer: false,
+    
+    /** 
+     * APIProperty: markers 
+     * {Array(<OpenLayers.Marker>)} internal marker list 
+     */
+    markers: null,
 
 
-            //
-            fSynchronizeValues(oRequest);
 
 
-            // BUGFIX: Firefox fires unnecessary DONE when aborting
-            if (oRequest._aborted) {
-                // Reset readyState to UNSENT
-                oRequest.readyState    = cXMLHttpRequest.UNSENT;
+    /** 
+     * Property: drawn 
+     * {Boolean} internal state of drawing. This is a workaround for the fact
+     * that the map does not call moveTo with a zoomChanged when the map is
+     * first starting up. This lets us catch the case where we have *never*
+     * drawn the layer, and draw it even if the zoom hasn't changed.
+     */
+    drawn: false,
+    
+    /**
+     * Constructor: OpenLayers.Layer.Markers 
+     * Create a Markers layer.
+     *
+     * Parameters:
+     * name - {String} 
+     * options - {Object} Hashtable of extra options to tag onto the layer
+     */
+    initialize: function(name, options) {
+        OpenLayers.Layer.prototype.initialize.apply(this, arguments);
+        this.markers = [];
+    },
+    
+    /**
+     * APIMethod: destroy 
+     */
+    destroy: function() {
+        this.clearMarkers();
+        this.markers = null;
+        OpenLayers.Layer.prototype.destroy.apply(this, arguments);
+    },
 
 
-                // Return now
-                return;
+    /**
+     * APIMethod: setOpacity
+     * Sets the opacity for all the markers.
+     * 
+     * Parameters:
+     * opacity - {Float}
+     */
+    setOpacity: function(opacity) {
+        if (opacity != this.opacity) {
+            this.opacity = opacity;
+            for (var i=0, len=this.markers.length; i<len; i++) {
+                this.markers[i].setOpacity(this.opacity);
             }
             }
+        }
+    },
 
 
-            if (oRequest.readyState == cXMLHttpRequest.DONE) {
-                // Free up queue
-                delete oRequest._data;
-/*                if (bAsync)
-                    fQueue_remove(oRequest);*/
-                //
-                fCleanTransport(oRequest);
-// Uncomment this block if you need a fix for IE cache
-/*
-                // BUGFIX: IE - cache issue
-                if (!oRequest._object.getResponseHeader("Date")) {
-                    // Save object to cache
-                    oRequest._cached    = oRequest._object;
-
-                    // Instantiate a new transport object
-                    cXMLHttpRequest.call(oRequest);
-
-                    // Re-send request
-                    if (sUser) {
-                         if (sPassword)
-                            oRequest._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
-                        else
-                            oRequest._object.open(sMethod, sUrl, bAsync, sUser);
-                    }
-                    else
-                        oRequest._object.open(sMethod, sUrl, bAsync);
-                    oRequest._object.setRequestHeader("If-Modified-Since", oRequest._cached.getResponseHeader("Last-Modified") || new window.Date(0));
-                    // Copy headers set
-                    if (oRequest._headers)
-                        for (var sHeader in oRequest._headers)
-                            if (typeof oRequest._headers[sHeader] == "string")    // Some frameworks prototype objects with functions
-                                oRequest._object.setRequestHeader(sHeader, oRequest._headers[sHeader]);
-
-                    oRequest._object.onreadystatechange    = function() {
-                        // Synchronize state
-                        oRequest.readyState        = oRequest._object.readyState;
-
-                        if (oRequest._aborted) {
-                            //
-                            oRequest.readyState    = cXMLHttpRequest.UNSENT;
-
-                            // Return
-                            return;
-                        }
-
-                        if (oRequest.readyState == cXMLHttpRequest.DONE) {
-                            // Clean Object
-                            fCleanTransport(oRequest);
-
-                            // get cached request
-                            if (oRequest.status == 304)
-                                oRequest._object    = oRequest._cached;
-
-                            //
-                            delete oRequest._cached;
-
-                            //
-                            fSynchronizeValues(oRequest);
-
-                            //
-                            fReadyStateChange(oRequest);
-
-                            // BUGFIX: IE - memory leak in interrupted
-                            if (bIE && bAsync)
-                                window.detachEvent("onunload", fOnUnload);
-                        }
-                    };
-                    oRequest._object.send(null);
+    /** 
+     * Method: moveTo
+     *
+     * Parameters:
+     * bounds - {<OpenLayers.Bounds>} 
+     * zoomChanged - {Boolean} 
+     * dragging - {Boolean} 
+     */
+    moveTo:function(bounds, zoomChanged, dragging) {
+        OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
 
 
-                    // Return now - wait until re-sent request is finished
-                    return;
-                };
-*/
-                // BUGFIX: IE - memory leak in interrupted
-                if (bIE && bAsync)
-                    window.detachEvent("onunload", fOnUnload);
+        if (zoomChanged || !this.drawn) {
+            for(var i=0, len=this.markers.length; i<len; i++) {
+                this.drawMarker(this.markers[i]);
             }
             }
+            this.drawn = true;
+        }
+    },
 
 
-            // BUGFIX: Some browsers (Internet Explorer, Gecko) fire OPEN readystate twice
-            if (nState != oRequest.readyState)
-                fReadyStateChange(oRequest);
+    /**
+     * APIMethod: addMarker
+     *
+     * Parameters:
+     * marker - {<OpenLayers.Marker>} 
+     */
+    addMarker: function(marker) {
+        this.markers.push(marker);
 
 
-            nState    = oRequest.readyState;
+        if (this.opacity < 1) {
+            marker.setOpacity(this.opacity);
         }
         }
-    };
-    function fXMLHttpRequest_send(oRequest) {
-        oRequest._object.send(oRequest._data);
 
 
-        // BUGFIX: Gecko - missing readystatechange calls in synchronous requests
-        if (bGecko && !oRequest._async) {
-            oRequest.readyState    = cXMLHttpRequest.OPENED;
+        if (this.map && this.map.getExtent()) {
+            marker.map = this.map;
+            this.drawMarker(marker);
+        }
+    },
 
 
-            // Synchronize state
-            fSynchronizeValues(oRequest);
+    /**
+     * APIMethod: removeMarker
+     *
+     * Parameters:
+     * marker - {<OpenLayers.Marker>} 
+     */
+    removeMarker: function(marker) {
+        if (this.markers && this.markers.length) {
+            OpenLayers.Util.removeItem(this.markers, marker);
+            marker.erase();
+        }
+    },
 
 
-            // Simulate missing states
-            while (oRequest.readyState < cXMLHttpRequest.DONE) {
-                oRequest.readyState++;
-                fReadyStateChange(oRequest);
-                // Check if we are aborted
-                if (oRequest._aborted)
-                    return;
+    /**
+     * Method: clearMarkers
+     * This method removes all markers from a layer. The markers are not
+     * destroyed by this function, but are removed from the list of markers.
+     */
+    clearMarkers: function() {
+        if (this.markers != null) {
+            while(this.markers.length > 0) {
+                this.removeMarker(this.markers[0]);
             }
         }
             }
         }
-    };
-    cXMLHttpRequest.prototype.send    = function(vData) {
-        // Add method sniffer
-        if (cXMLHttpRequest.onsend)
-            cXMLHttpRequest.onsend.apply(this, arguments);
-
-        if (!arguments.length)
-            vData    = null;
+    },
 
 
-        // BUGFIX: Safari - fails sending documents created/modified dynamically, so an explicit serialization required
-        // BUGFIX: IE - rewrites any custom mime-type to "text/xml" in case an XMLNode is sent
-        // BUGFIX: Gecko - fails sending Element (this is up to the implementation either to standard)
-        if (vData && vData.nodeType) {
-            vData    = window.XMLSerializer ? new window.XMLSerializer().serializeToString(vData) : vData.xml;
-            if (!this._headers["Content-Type"])
-                this._object.setRequestHeader("Content-Type", "application/xml");
+    /** 
+     * Method: drawMarker
+     * Calculate the pixel location for the marker, create it, and 
+     *    add it to the layer's div
+     *
+     * Parameters:
+     * marker - {<OpenLayers.Marker>} 
+     */
+    drawMarker: function(marker) {
+        var px = this.map.getLayerPxFromLonLat(marker.lonlat);
+        if (px == null) {
+            marker.display(false);
+        } else {
+            if (!marker.isDrawn()) {
+                var markerImg = marker.draw(px);
+                this.div.appendChild(markerImg);
+            } else if(marker.icon) {
+                marker.icon.moveTo(px);
+            }
+        }
+    },
+    
+    /** 
+     * APIMethod: getDataExtent
+     * Calculates the max extent which includes all of the markers.
+     * 
+     * Returns:
+     * {<OpenLayers.Bounds>}
+     */
+    getDataExtent: function () {
+        var maxExtent = null;
+        
+        if ( this.markers && (this.markers.length > 0)) {
+            var maxExtent = new OpenLayers.Bounds();
+            for(var i=0, len=this.markers.length; i<len; i++) {
+                var marker = this.markers[i];
+                maxExtent.extend(marker.lonlat);
+            }
         }
 
         }
 
-        this._data    = vData;
-/*
-        // Add to queue
-        if (this._async)
-            fQueue_add(this);
-        else*/
-            fXMLHttpRequest_send(this);
-    };
-    cXMLHttpRequest.prototype.abort    = function() {
-        // Add method sniffer
-        if (cXMLHttpRequest.onabort)
-            cXMLHttpRequest.onabort.apply(this, arguments);
-
-        // BUGFIX: Gecko - unnecessary DONE when aborting
-        if (this.readyState > cXMLHttpRequest.UNSENT)
-            this._aborted    = true;
+        return maxExtent;
+    },
 
 
-        this._object.abort();
+    CLASS_NAME: "OpenLayers.Layer.Markers"
+});
+/* ======================================================================
+    OpenLayers/Layer/OSM.js
+   ====================================================================== */
 
 
-        // BUGFIX: IE - memory leak
-        fCleanTransport(this);
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
 
 
-        this.readyState    = cXMLHttpRequest.UNSENT;
+/**
+ * @requires OpenLayers/Layer/XYZ.js
+ */
 
 
-        delete this._data;
-/*        if (this._async)
-            fQueue_remove(this);*/
-    };
-    cXMLHttpRequest.prototype.getAllResponseHeaders    = function() {
-        return this._object.getAllResponseHeaders();
-    };
-    cXMLHttpRequest.prototype.getResponseHeader    = function(sName) {
-        return this._object.getResponseHeader(sName);
-    };
-    cXMLHttpRequest.prototype.setRequestHeader    = function(sName, sValue) {
-        // BUGFIX: IE - cache issue
-        if (!this._headers)
-            this._headers    = {};
-        this._headers[sName]    = sValue;
+/**
+ * Class: OpenLayers.Layer.OSM
+ * This layer allows accessing OpenStreetMap tiles. By default the OpenStreetMap
+ *    hosted tile.openstreetmap.org Mapnik tileset is used. If you wish to use
+ *    a different layer instead, you need to provide a different
+ *    URL to the constructor. Here's an example for using OpenCycleMap:
+ * 
+ * (code)
+ *     new OpenLayers.Layer.OSM("OpenCycleMap", 
+ *       ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
+ *        "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
+ *        "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"]); 
+ * (end)
+ *
+ * Inherits from:
+ *  - <OpenLayers.Layer.XYZ>
+ */
+OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {
 
 
-        return this._object.setRequestHeader(sName, sValue);
-    };
+    /**
+     * APIProperty: name
+     * {String} The layer name. Defaults to "OpenStreetMap" if the first
+     * argument to the constructor is null or undefined.
+     */
+    name: "OpenStreetMap",
 
 
-    // EventTarget interface implementation
-    cXMLHttpRequest.prototype.addEventListener    = function(sName, fHandler, bUseCapture) {
-        for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)
-            if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)
-                return;
-        // Add listener
-        this._listeners.push([sName, fHandler, bUseCapture]);
-    };
+    /**
+     * APIProperty: url
+     * {String} The tileset URL scheme. Defaults to (protocol relative url):
+     *  //[a|b|c].tile.openstreetmap.org/${z}/${x}/${y}.png 
+     * (the official OSM tileset) if the second argument to the constructor
+     * is null or undefined. To use another tileset you can have something
+     * like this:
+     * (code)
+     *     new OpenLayers.Layer.OSM("OpenCycleMap", 
+     *       ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
+     *        "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
+     *        "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"]); 
+     * (end)
+     */
+    url: [
+        '//a.tile.openstreetmap.org/${z}/${x}/${y}.png',
+        '//b.tile.openstreetmap.org/${z}/${x}/${y}.png',
+        '//c.tile.openstreetmap.org/${z}/${x}/${y}.png'
+    ],
 
 
-    cXMLHttpRequest.prototype.removeEventListener    = function(sName, fHandler, bUseCapture) {
-        for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)
-            if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)
-                break;
-        // Remove listener
-        if (oListener)
-            this._listeners.splice(nIndex, 1);
-    };
+    /**
+     * Property: attribution
+     * {String} The layer attribution.
+     */
+    attribution: "&copy; <a href='//www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors",
 
 
-    cXMLHttpRequest.prototype.dispatchEvent    = function(oEvent) {
-        var oEventPseudo    = {
-            'type':            oEvent.type,
-            'target':        this,
-            'currentTarget':this,
-            'eventPhase':    2,
-            'bubbles':        oEvent.bubbles,
-            'cancelable':    oEvent.cancelable,
-            'timeStamp':    oEvent.timeStamp,
-            'stopPropagation':    function() {},    // There is no flow
-            'preventDefault':    function() {},    // There is no default action
-            'initEvent':        function() {}    // Original event object should be initialized
-        };
+    /**
+     * Property: sphericalMercator
+     * {Boolean}
+     */
+    sphericalMercator: true,
 
 
-        // Execute onreadystatechange
-        if (oEventPseudo.type == "readystatechange" && this.onreadystatechange)
-            (this.onreadystatechange.handleEvent || this.onreadystatechange).apply(this, [oEventPseudo]);
+    /**
+     * Property: wrapDateLine
+     * {Boolean}
+     */
+    wrapDateLine: true,
 
 
-        // Execute listeners
-        for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)
-            if (oListener[0] == oEventPseudo.type && !oListener[2])
-                (oListener[1].handleEvent || oListener[1]).apply(this, [oEventPseudo]);
-    };
+    /** APIProperty: tileOptions
+     *  {Object} optional configuration options for <OpenLayers.Tile> instances
+     *  created by this Layer. Default is
+     *
+     *  (code)
+     *  {crossOriginKeyword: 'anonymous'}
+     *  (end)
+     *
+     *  When using OSM tilesets other than the default ones, it may be
+     *  necessary to set this to
+     *
+     *  (code)
+     *  {crossOriginKeyword: null}
+     *  (end)
+     *
+     *  if the server does not send Access-Control-Allow-Origin headers.
+     */
+    tileOptions: null,
 
 
-    //
-    cXMLHttpRequest.prototype.toString    = function() {
-        return '[' + "object" + ' ' + "XMLHttpRequest" + ']';
-    };
+    /**
+     * Constructor: OpenLayers.Layer.OSM
+     *
+     * Parameters:
+     * name - {String} The layer name.
+     * url - {String} The tileset URL scheme.
+     * options - {Object} Configuration options for the layer. Any inherited
+     *     layer option can be set in this object (e.g.
+     *     <OpenLayers.Layer.Grid.buffer>).
+     */
+    initialize: function(name, url, options) {
+        OpenLayers.Layer.XYZ.prototype.initialize.apply(this, arguments);
+        this.tileOptions = OpenLayers.Util.extend({
+            crossOriginKeyword: 'anonymous'
+        }, this.options && this.options.tileOptions);
+    },
 
 
-    cXMLHttpRequest.toString    = function() {
-        return '[' + "XMLHttpRequest" + ']';
-    };
+    /**
+     * Method: clone
+     */
+    clone: function(obj) {
+        if (obj == null) {
+            obj = new OpenLayers.Layer.OSM(
+                this.name, this.url, this.getOptions());
+        }
+        obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
+        return obj;
+    },
 
 
-    // Helper function
-    function fReadyStateChange(oRequest) {
-        // Sniffing code
-        if (cXMLHttpRequest.onreadystatechange)
-            cXMLHttpRequest.onreadystatechange.apply(oRequest);
+    CLASS_NAME: "OpenLayers.Layer.OSM"
+});
+/* ======================================================================
+    OpenLayers/Layer/SphericalMercator.js
+   ====================================================================== */
 
 
-        // Fake event
-        oRequest.dispatchEvent({
-            'type':            "readystatechange",
-            'bubbles':        false,
-            'cancelable':    false,
-            'timeStamp':    new Date + 0
-        });
-    };
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
 
 
-    function fGetDocument(oRequest) {
-        var oDocument    = oRequest.responseXML,
-            sResponse    = oRequest.responseText;
-        // Try parsing responseText
-        if (bIE && sResponse && oDocument && !oDocument.documentElement && oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)) {
-            oDocument    = new window.ActiveXObject("Microsoft.XMLDOM");
-            oDocument.async                = false;
-            oDocument.validateOnParse    = false;
-            oDocument.loadXML(sResponse);
-        }
-        // Check if there is no error in document
-        if (oDocument)
-            if ((bIE && oDocument.parseError != 0) || !oDocument.documentElement || (oDocument.documentElement && oDocument.documentElement.tagName == "parsererror"))
-                return null;
-        return oDocument;
-    };
+/**
+ * @requires OpenLayers/Layer.js
+ * @requires OpenLayers/Projection.js
+ */
 
 
-    function fSynchronizeValues(oRequest) {
-        try {    oRequest.responseText    = oRequest._object.responseText;    } catch (e) {}
-        try {    oRequest.responseXML    = fGetDocument(oRequest._object);    } catch (e) {}
-        try {    oRequest.status            = oRequest._object.status;            } catch (e) {}
-        try {    oRequest.statusText        = oRequest._object.statusText;        } catch (e) {}
-    };
+/**
+ * Class: OpenLayers.Layer.SphericalMercator
+ * A mixin for layers that wraps up the pieces necessary to have a coordinate
+ *     conversion for working with commercial APIs which use a spherical
+ *     mercator projection.  Using this layer as a base layer, additional
+ *     layers can be used as overlays if they are in the same projection.
+ *
+ * A layer is given properties of this object by setting the sphericalMercator
+ *     property to true.
+ *
+ * More projection information:
+ *  - http://spatialreference.org/ref/user/google-projection/
+ *
+ * Proj4 Text:
+ *     +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0
+ *     +k=1.0 +units=m +nadgrids=@null +no_defs
+ *
+ * WKT:
+ *     900913=PROJCS["WGS84 / Simple Mercator", GEOGCS["WGS 84",
+ *     DATUM["WGS_1984", SPHEROID["WGS_1984", 6378137.0, 298.257223563]], 
+ *     PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], 
+ *     AXIS["Longitude", EAST], AXIS["Latitude", NORTH]],
+ *     PROJECTION["Mercator_1SP_Google"], 
+ *     PARAMETER["latitude_of_origin", 0.0], PARAMETER["central_meridian", 0.0], 
+ *     PARAMETER["scale_factor", 1.0], PARAMETER["false_easting", 0.0], 
+ *     PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["x", EAST],
+ *     AXIS["y", NORTH], AUTHORITY["EPSG","900913"]]
+ */
+OpenLayers.Layer.SphericalMercator = {
 
 
-    function fCleanTransport(oRequest) {
-        // BUGFIX: IE - memory leak (on-page leak)
-        oRequest._object.onreadystatechange    = new window.Function;
-    };
-/*
-    // Queue manager
-    var oQueuePending    = {"CRITICAL":[],"HIGH":[],"NORMAL":[],"LOW":[],"LOWEST":[]},
-        aQueueRunning    = [];
-    function fQueue_add(oRequest) {
-        oQueuePending[oRequest.priority in oQueuePending ? oRequest.priority : "NORMAL"].push(oRequest);
-        //
-        setTimeout(fQueue_process);
-    };
+    /**
+     * Method: getExtent
+     * Get the map's extent.
+     *
+     * Returns:
+     * {<OpenLayers.Bounds>} The map extent.
+     */
+    getExtent: function() {
+        var extent = null;
+        if (this.sphericalMercator) {
+            extent = this.map.calculateBounds();
+        } else {
+            extent = OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this);
+        }
+        return extent;
+    },
 
 
-    function fQueue_remove(oRequest) {
-        for (var nIndex = 0, bFound    = false; nIndex < aQueueRunning.length; nIndex++)
-            if (bFound)
-                aQueueRunning[nIndex - 1]    = aQueueRunning[nIndex];
-            else
-            if (aQueueRunning[nIndex] == oRequest)
-                bFound    = true;
-        if (bFound)
-            aQueueRunning.length--;
-        //
-        setTimeout(fQueue_process);
-    };
+    /**
+     * Method: getLonLatFromViewPortPx
+     * Get a map location from a pixel location
+     * 
+     * Parameters:
+     * viewPortPx - {<OpenLayers.Pixel>}
+     *
+     * Returns:
+     *  {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in view
+     *  port OpenLayers.Pixel, translated into lon/lat by map lib
+     *  If the map lib is not loaded or not centered, returns null
+     */
+    getLonLatFromViewPortPx: function (viewPortPx) {
+        return OpenLayers.Layer.prototype.getLonLatFromViewPortPx.apply(this, arguments);
+    },
+    
+    /**
+     * Method: getViewPortPxFromLonLat
+     * Get a pixel location from a map location
+     *
+     * Parameters:
+     * lonlat - {<OpenLayers.LonLat>}
+     *
+     * Returns:
+     * {<OpenLayers.Pixel>} An OpenLayers.Pixel which is the passed-in
+     * OpenLayers.LonLat, translated into view port pixels by map lib
+     * If map lib is not loaded or not centered, returns null
+     */
+    getViewPortPxFromLonLat: function (lonlat) {
+        return OpenLayers.Layer.prototype.getViewPortPxFromLonLat.apply(this, arguments);
+    },
 
 
-    function fQueue_process() {
-        if (aQueueRunning.length < 6) {
-            for (var sPriority in oQueuePending) {
-                if (oQueuePending[sPriority].length) {
-                    var oRequest    = oQueuePending[sPriority][0];
-                    oQueuePending[sPriority]    = oQueuePending[sPriority].slice(1);
-                    //
-                    aQueueRunning.push(oRequest);
-                    // Send request
-                    fXMLHttpRequest_send(oRequest);
-                    break;
-                }
-            }
+    /** 
+     * Method: initMercatorParameters 
+     * Set up the mercator parameters on the layer: resolutions,
+     *     projection, units.
+     */
+    initMercatorParameters: function() {
+        // set up properties for Mercator - assume EPSG:900913
+        this.RESOLUTIONS = [];
+        var maxResolution = 156543.03390625;
+        for(var zoom=0; zoom<=this.MAX_ZOOM_LEVEL; ++zoom) {
+            this.RESOLUTIONS[zoom] = maxResolution / Math.pow(2, zoom);
         }
         }
-    };
-*/
-    // Internet Explorer 5.0 (missing apply)
-    if (!window.Function.prototype.apply) {
-        window.Function.prototype.apply    = function(oRequest, oArguments) {
-            if (!oArguments)
-                oArguments    = [];
-            oRequest.__func    = this;
-            oRequest.__func(oArguments[0], oArguments[1], oArguments[2], oArguments[3], oArguments[4]);
-            delete oRequest.__func;
+        this.units = "m";
+        this.projection = this.projection || "EPSG:900913";
+    },
+
+    /**
+     * APIMethod: forwardMercator
+     * Given a lon,lat in EPSG:4326, return a point in Spherical Mercator.
+     *
+     * Parameters:
+     * lon - {float} 
+     * lat - {float}
+     * 
+     * Returns:
+     * {<OpenLayers.LonLat>} The coordinates transformed to Mercator.
+     */
+    forwardMercator: (function() {
+        var gg = new OpenLayers.Projection("EPSG:4326");
+        var sm = new OpenLayers.Projection("EPSG:900913");
+        return function(lon, lat) {
+            var point = OpenLayers.Projection.transform({x: lon, y: lat}, gg, sm);
+            return new OpenLayers.LonLat(point.x, point.y);
         };
         };
-    };
+    })(),
 
 
-    // Register new object with window
     /**
     /**
-     * Class: OpenLayers.Request.XMLHttpRequest
-     * Standard-compliant (W3C) cross-browser implementation of the
-     *     XMLHttpRequest object.  From
-     *     http://code.google.com/p/xmlhttprequest/.
+     * APIMethod: inverseMercator
+     * Given a x,y in Spherical Mercator, return a point in EPSG:4326.
+     *
+     * Parameters:
+     * x - {float} A map x in Spherical Mercator.
+     * y - {float} A map y in Spherical Mercator.
+     * 
+     * Returns:
+     * {<OpenLayers.LonLat>} The coordinates transformed to EPSG:4326.
      */
      */
-    if (!OpenLayers.Request) {
-        /**
-         * This allows for OpenLayers/Request.js to be included
-         * before or after this script.
-         */
-        OpenLayers.Request = {};
-    }
-    OpenLayers.Request.XMLHttpRequest = cXMLHttpRequest;
-})();
+    inverseMercator: (function() {
+        var gg = new OpenLayers.Projection("EPSG:4326");
+        var sm = new OpenLayers.Projection("EPSG:900913");
+        return function(x, y) {
+            var point = OpenLayers.Projection.transform({x: x, y: y}, sm, gg);
+            return new OpenLayers.LonLat(point.x, point.y);
+        };
+    })()
+
+};
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Lang/de.js
+    OpenLayers/Layer/EventPane.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Translators (2009 onwards):
- *  - Grille chompa
- *  - Nikiwaibel
- *  - Umherirrender
- */
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
 
 /**
 
 /**
- * @requires OpenLayers/Lang.js
+ * @requires OpenLayers/Layer.js
+ * @requires OpenLayers/Util.js
  */
 
 /**
  */
 
 /**
- * Namespace: OpenLayers.Lang["de"]
- * Dictionary for Deutsch.  Keys for entries are used in calls to
- *     <OpenLayers.Lang.translate>.  Entry bodies are normal strings or
- *     strings formatted for use with <OpenLayers.String.format> calls.
+ * Class: OpenLayers.Layer.EventPane
+ * Base class for 3rd party layers, providing a DOM element which isolates
+ * the 3rd-party layer from mouse events.
+ * Only used by Google layers.
+ *
+ * Automatically instantiated by the Google constructor, and not usually instantiated directly.
+ *
+ * Create a new event pane layer with the
+ * <OpenLayers.Layer.EventPane> constructor.
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Layer>
  */
  */
-OpenLayers.Lang["de"] = OpenLayers.Util.applyDefaults({
-
-    'unhandledRequest': "Unbehandelte Anfragerückmeldung ${statusText}",
-
-    'Permalink': "Permalink",
+OpenLayers.Layer.EventPane = OpenLayers.Class(OpenLayers.Layer, {
+    
+    /**
+     * APIProperty: smoothDragPan
+     * {Boolean} smoothDragPan determines whether non-public/internal API
+     *     methods are used for better performance while dragging EventPane 
+     *     layers. When not in sphericalMercator mode, the smoother dragging 
+     *     doesn't actually move north/south directly with the number of 
+     *     pixels moved, resulting in a slight offset when you drag your mouse 
+     *     north south with this option on. If this visual disparity bothers 
+     *     you, you should turn this option off, or use spherical mercator. 
+     *     Default is on.
+     */
+    smoothDragPan: true,
 
 
-    'Overlays': "Overlays",
+    /**
+     * Property: isBaseLayer
+     * {Boolean} EventPaned layers are always base layers, by necessity.
+     */ 
+    isBaseLayer: true,
 
 
-    'Base Layer': "Grundkarte",
+    /**
+     * APIProperty: isFixed
+     * {Boolean} EventPaned layers are fixed by default.
+     */ 
+    isFixed: true,
 
 
-    'noFID': "Ein Feature, für das keine FID existiert, kann nicht aktualisiert werden.",
+    /**
+     * Property: pane
+     * {DOMElement} A reference to the element that controls the events.
+     */
+    pane: null,
 
 
-    'browserNotSupported': "Ihr Browser unterstützt keine Vektordarstellung. Aktuell unterstützte Renderer:\n${renderers}",
 
 
-    'minZoomLevelError': "Die \x3ccode\x3eminZoomLevel\x3c/code\x3e-Eigenschaft ist nur für die Verwendung mit \x3ccode\x3eFixedZoomLevels\x3c/code\x3e-untergeordneten Layers vorgesehen. Das dieser \x3ctt\x3ewfs\x3c/tt\x3e-Layer die \x3ccode\x3eminZoomLevel\x3c/code\x3e-Eigenschaft Ã¼berprüft ist ein Relikt der Vergangenheit. Wir können diese Ãœberprüfung nicht entfernen, ohne das OL basierende Applikationen nicht mehr funktionieren. Daher markieren wir es als veraltet - die \x3ccode\x3eminZoomLevel\x3c/code\x3e-Überprüfung wird in Version 3.0 entfernt werden. Bitte verwenden Sie stattdessen die Min-/Max-Lösung, wie sie unter http://trac.openlayers.org/wiki/SettingZoomLevels beschrieben ist.",
+    /**
+     * Property: mapObject
+     * {Object} This is the object which will be used to load the 3rd party library
+     * in the case of the google layer, this will be of type GMap, 
+     * in the case of the ve layer, this will be of type VEMap
+     */ 
+    mapObject: null,
 
 
-    'commitSuccess': "WFS-Transaktion: Erfolgreich ${response}",
 
 
-    'commitFailed': "WFS-Transaktion: Fehlgeschlagen ${response}",
+    /**
+     * Constructor: OpenLayers.Layer.EventPane
+     * Create a new event pane layer
+     *
+     * Parameters:
+     * name - {String}
+     * options - {Object} Hashtable of extra options to tag onto the layer
+     */
+    initialize: function(name, options) {
+        OpenLayers.Layer.prototype.initialize.apply(this, arguments);
+        if (this.pane == null) {
+            this.pane = OpenLayers.Util.createDiv(this.div.id + "_EventPane");
+        }
+    },
+    
+    /**
+     * APIMethod: destroy
+     * Deconstruct this layer.
+     */
+    destroy: function() {
+        this.mapObject = null;
+        this.pane = null;
+        OpenLayers.Layer.prototype.destroy.apply(this, arguments); 
+    },
 
 
-    'googleWarning': "Der Google-Layer konnte nicht korrekt geladen werden.\x3cbr\x3e\x3cbr\x3eUm diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.\x3cbr\x3e\x3cbr\x3eSehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der Google-Maps-Bibliothek nicht eingebunden wurde oder keinen gültigen API-Schlüssel für Ihre URL enthält.\x3cbr\x3e\x3cbr\x3eEntwickler: Besuche \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3edas Wiki\x3c/a\x3e für Hilfe zum korrekten Einbinden des Google-Layers",
+    
+    /**
+     * Method: setMap
+     * Set the map property for the layer. This is done through an accessor
+     * so that subclasses can override this and take special action once 
+     * they have their map variable set. 
+     *
+     * Parameters:
+     * map - {<OpenLayers.Map>}
+     */
+    setMap: function(map) {
+        OpenLayers.Layer.prototype.setMap.apply(this, arguments);
+        
+        this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1;
+        this.pane.style.display = this.div.style.display;
+        this.pane.style.width="100%";
+        this.pane.style.height="100%";
+        if (OpenLayers.BROWSER_NAME == "msie") {
+            this.pane.style.background = 
+                "url(" + OpenLayers.Util.getImageLocation("blank.gif") + ")";
+        }
 
 
-    'getLayerWarning': "Der ${layerType}-Layer konnte nicht korrekt geladen werden.\x3cbr\x3e\x3cbr\x3eUm diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.\x3cbr\x3e\x3cbr\x3eSehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der \'${layerLib}\'-Bibliothek nicht eingebunden wurde.\x3cbr\x3e\x3cbr\x3eEntwickler: Besuche \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3edas Wiki\x3c/a\x3e für Hilfe zum korrekten Einbinden von Layern",
+        if (this.isFixed) {
+            this.map.viewPortDiv.appendChild(this.pane);
+        } else {
+            this.map.layerContainerDiv.appendChild(this.pane);
+        }
 
 
-    'Scale = 1 : ${scaleDenom}': "Maßstab = 1 : ${scaleDenom}",
+        // once our layer has been added to the map, we can load it
+        this.loadMapObject();
+    
+        // if map didn't load, display warning
+        if (this.mapObject == null) {
+            this.loadWarningMessage();
+        }
 
 
-    'W': "W",
+        this.map.events.register('zoomstart', this, this.onZoomStart);
+    },
 
 
-    'E': "O",
+    /**
+     * APIMethod: removeMap
+     * On being removed from the map, we'll like to remove the invisible 'pane'
+     *     div that we added to it on creation. 
+     * 
+     * Parameters:
+     * map - {<OpenLayers.Map>}
+     */
+    removeMap: function(map) {
+        this.map.events.unregister('zoomstart', this, this.onZoomStart);
 
 
-    'N': "N",
+        if (this.pane && this.pane.parentNode) {
+            this.pane.parentNode.removeChild(this.pane);
+        }
+        OpenLayers.Layer.prototype.removeMap.apply(this, arguments);
+    },
 
 
-    'S': "S",
+    /**
+     * Method: onZoomStart
+     *
+     * Parameters:
+     * evt - zoomstart event object with center and zoom properties.
+     */
+    onZoomStart: function(evt) {
+        if (this.mapObject != null) {
+            var center = this.getMapObjectLonLatFromOLLonLat(evt.center);
+            var zoom = this.getMapObjectZoomFromOLZoom(evt.zoom);
+            this.setMapObjectCenter(center, zoom, false);
+        }
+    },
+  
+    /**
+     * Method: loadWarningMessage
+     * If we can't load the map lib, then display an error message to the 
+     *     user and tell them where to go for help.
+     * 
+     *     This function sets up the layout for the warning message. Each 3rd
+     *     party layer must implement its own getWarningHTML() function to 
+     *     provide the actual warning message.
+     */
+    loadWarningMessage:function() {
 
 
-    'reprojectDeprecated': "Sie verwenden die â€žReproject“-Option des Layers ${layerName}. Diese Option ist veraltet: Sie wurde entwickelt um die Anzeige von Daten auf kommerziellen Basiskarten zu unterstützen, aber diese Funktion sollte jetzt durch Unterstützung der â€žSpherical Mercator“ erreicht werden. Weitere Informationen sind unter http://trac.openlayers.org/wiki/SphericalMercator verfügbar.",
+        this.div.style.backgroundColor = "darkblue";
 
 
-    'methodDeprecated': "Die Methode ist veraltet und wird in 3.0 entfernt. Bitte verwende stattdessen ${newMethod}."
+        var viewSize = this.map.getSize();
+        
+        var msgW = Math.min(viewSize.w, 300);
+        var msgH = Math.min(viewSize.h, 200);
+        var size = new OpenLayers.Size(msgW, msgH);
 
 
-});
-/* ======================================================================
-    OpenLayers/Popup/FramedCloud.js
-   ====================================================================== */
+        var centerPx = new OpenLayers.Pixel(viewSize.w/2, viewSize.h/2);
 
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
+        var topLeft = centerPx.add(-size.w/2, -size.h/2);            
 
 
-/**
- * @requires OpenLayers/Popup/Framed.js
- * @requires OpenLayers/Util.js
- * @requires OpenLayers/BaseTypes/Bounds.js
- * @requires OpenLayers/BaseTypes/Pixel.js
- * @requires OpenLayers/BaseTypes/Size.js
- */
+        var div = OpenLayers.Util.createDiv(this.name + "_warning", 
+                                            topLeft, 
+                                            size,
+                                            null,
+                                            null,
+                                            null,
+                                            "auto");
 
 
-/**
- * Class: OpenLayers.Popup.FramedCloud
- * 
- * Inherits from: 
- *  - <OpenLayers.Popup.Framed>
- */
-OpenLayers.Popup.FramedCloud = 
-  OpenLayers.Class(OpenLayers.Popup.Framed, {
+        div.style.padding = "7px";
+        div.style.backgroundColor = "yellow";
 
 
+        div.innerHTML = this.getWarningHTML();
+        this.div.appendChild(div);
+    },
+  
     /** 
     /** 
-     * Property: contentDisplayClass
-     * {String} The CSS class of the popup content div.
+     * Method: getWarningHTML
+     * To be implemented by subclasses.
+     * 
+     * Returns:
+     * {String} String with information on why layer is broken, how to get
+     *          it working.
      */
      */
-    contentDisplayClass: "olFramedCloudPopupContent",
-
+    getWarningHTML:function() {
+        //should be implemented by subclasses
+        return "";
+    },
+  
     /**
     /**
-     * APIProperty: autoSize
-     * {Boolean} Framed Cloud is autosizing by default.
+     * Method: display
+     * Set the display on the pane
+     *
+     * Parameters:
+     * display - {Boolean}
      */
      */
-    autoSize: true,
-
+    display: function(display) {
+        OpenLayers.Layer.prototype.display.apply(this, arguments);
+        this.pane.style.display = this.div.style.display;
+    },
+  
     /**
     /**
-     * APIProperty: panMapIfOutOfView
-     * {Boolean} Framed Cloud does pan into view by default.
+     * Method: setZIndex
+     * Set the z-index order for the pane.
+     * 
+     * Parameters:
+     * zIndex - {int}
      */
      */
-    panMapIfOutOfView: true,
-
+    setZIndex: function (zIndex) {
+        OpenLayers.Layer.prototype.setZIndex.apply(this, arguments);
+        this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1;
+    },
+    
     /**
     /**
-     * APIProperty: imageSize
-     * {<OpenLayers.Size>}
+     * Method: moveByPx
+     * Move the layer based on pixel vector. To be implemented by subclasses.
+     *
+     * Parameters:
+     * dx - {Number} The x coord of the displacement vector.
+     * dy - {Number} The y coord of the displacement vector.
      */
      */
-    imageSize: new OpenLayers.Size(1276, 736),
+    moveByPx: function(dx, dy) {
+        OpenLayers.Layer.prototype.moveByPx.apply(this, arguments);
+        
+        if (this.dragPanMapObject) {
+            this.dragPanMapObject(dx, -dy);
+        } else {
+            this.moveTo(this.map.getCachedCenter());
+        }
+    },
 
     /**
 
     /**
-     * APIProperty: isAlphaImage
-     * {Boolean} The FramedCloud does not use an alpha image (in honor of the 
-     *     good ie6 folk out there)
+     * Method: moveTo
+     * Handle calls to move the layer.
+     * 
+     * Parameters:
+     * bounds - {<OpenLayers.Bounds>}
+     * zoomChanged - {Boolean}
+     * dragging - {Boolean}
      */
      */
-    isAlphaImage: false,
+    moveTo:function(bounds, zoomChanged, dragging) {
+        OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
 
 
-    /** 
-     * APIProperty: fixedRelativePosition
-     * {Boolean} The Framed Cloud popup works in just one fixed position.
-     */
-    fixedRelativePosition: false,
+        if (this.mapObject != null) {
+
+            var newCenter = this.map.getCenter();
+            var newZoom = this.map.getZoom();
+
+            if (newCenter != null) {
+
+                var moOldCenter = this.getMapObjectCenter();
+                var oldCenter = this.getOLLonLatFromMapObjectLonLat(moOldCenter);
+
+                var moOldZoom = this.getMapObjectZoom();
+                var oldZoom= this.getOLZoomFromMapObjectZoom(moOldZoom);
+
+                if (!(newCenter.equals(oldCenter)) || newZoom != oldZoom) {
+
+                    if (!zoomChanged && oldCenter && this.dragPanMapObject && 
+                        this.smoothDragPan) {
+                        var oldPx = this.map.getViewPortPxFromLonLat(oldCenter);
+                        var newPx = this.map.getViewPortPxFromLonLat(newCenter);
+                        this.dragPanMapObject(newPx.x-oldPx.x, oldPx.y-newPx.y);
+                    } else {
+                        var center = this.getMapObjectLonLatFromOLLonLat(newCenter);
+                        var zoom = this.getMapObjectZoomFromOLZoom(newZoom);
+                        this.setMapObjectCenter(center, zoom, dragging);
+                    }
+                }
+            }
+        }
+    },
+
+
+  /********************************************************/
+  /*                                                      */
+  /*                 Baselayer Functions                  */
+  /*                                                      */
+  /********************************************************/
 
     /**
 
     /**
-     * Property: positionBlocks
-     * {Object} Hash of differen position blocks, keyed by relativePosition
-     *     two-character code string (ie "tl", "tr", "bl", "br")
+     * Method: getLonLatFromViewPortPx
+     * Get a map location from a pixel location
+     * 
+     * Parameters:
+     * viewPortPx - {<OpenLayers.Pixel>}
+     *
+     * Returns:
+     *  {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in view
+     *  port OpenLayers.Pixel, translated into lon/lat by map lib
+     *  If the map lib is not loaded or not centered, returns null
      */
      */
-    positionBlocks: {
-        "tl": {
-            'offset': new OpenLayers.Pixel(44, 0),
-            'padding': new OpenLayers.Bounds(8, 40, 8, 9),
-            'blocks': [
-                { // top-left
-                    size: new OpenLayers.Size('auto', 'auto'),
-                    anchor: new OpenLayers.Bounds(0, 51, 22, 0),
-                    position: new OpenLayers.Pixel(0, 0)
-                },
-                { //top-right
-                    size: new OpenLayers.Size(22, 'auto'),
-                    anchor: new OpenLayers.Bounds(null, 50, 0, 0),
-                    position: new OpenLayers.Pixel(-1238, 0)
-                },
-                { //bottom-left
-                    size: new OpenLayers.Size('auto', 19),
-                    anchor: new OpenLayers.Bounds(0, 32, 22, null),
-                    position: new OpenLayers.Pixel(0, -631)
-                },
-                { //bottom-right
-                    size: new OpenLayers.Size(22, 18),
-                    anchor: new OpenLayers.Bounds(null, 32, 0, null),
-                    position: new OpenLayers.Pixel(-1238, -632)
-                },
-                { // stem
-                    size: new OpenLayers.Size(81, 35),
-                    anchor: new OpenLayers.Bounds(null, 0, 0, null),
-                    position: new OpenLayers.Pixel(0, -688)
-                }
-            ]
-        },
-        "tr": {
-            'offset': new OpenLayers.Pixel(-45, 0),
-            'padding': new OpenLayers.Bounds(8, 40, 8, 9),
-            'blocks': [
-                { // top-left
-                    size: new OpenLayers.Size('auto', 'auto'),
-                    anchor: new OpenLayers.Bounds(0, 51, 22, 0),
-                    position: new OpenLayers.Pixel(0, 0)
-                },
-                { //top-right
-                    size: new OpenLayers.Size(22, 'auto'),
-                    anchor: new OpenLayers.Bounds(null, 50, 0, 0),
-                    position: new OpenLayers.Pixel(-1238, 0)
-                },
-                { //bottom-left
-                    size: new OpenLayers.Size('auto', 19),
-                    anchor: new OpenLayers.Bounds(0, 32, 22, null),
-                    position: new OpenLayers.Pixel(0, -631)
-                },
-                { //bottom-right
-                    size: new OpenLayers.Size(22, 19),
-                    anchor: new OpenLayers.Bounds(null, 32, 0, null),
-                    position: new OpenLayers.Pixel(-1238, -631)
-                },
-                { // stem
-                    size: new OpenLayers.Size(81, 35),
-                    anchor: new OpenLayers.Bounds(0, 0, null, null),
-                    position: new OpenLayers.Pixel(-215, -687)
-                }
-            ]
-        },
-        "bl": {
-            'offset': new OpenLayers.Pixel(45, 0),
-            'padding': new OpenLayers.Bounds(8, 9, 8, 40),
-            'blocks': [
-                { // top-left
-                    size: new OpenLayers.Size('auto', 'auto'),
-                    anchor: new OpenLayers.Bounds(0, 21, 22, 32),
-                    position: new OpenLayers.Pixel(0, 0)
-                },
-                { //top-right
-                    size: new OpenLayers.Size(22, 'auto'),
-                    anchor: new OpenLayers.Bounds(null, 21, 0, 32),
-                    position: new OpenLayers.Pixel(-1238, 0)
-                },
-                { //bottom-left
-                    size: new OpenLayers.Size('auto', 21),
-                    anchor: new OpenLayers.Bounds(0, 0, 22, null),
-                    position: new OpenLayers.Pixel(0, -629)
-                },
-                { //bottom-right
-                    size: new OpenLayers.Size(22, 21),
-                    anchor: new OpenLayers.Bounds(null, 0, 0, null),
-                    position: new OpenLayers.Pixel(-1238, -629)
-                },
-                { // stem
-                    size: new OpenLayers.Size(81, 33),
-                    anchor: new OpenLayers.Bounds(null, null, 0, 0),
-                    position: new OpenLayers.Pixel(-101, -674)
-                }
-            ]
-        },
-        "br": {
-            'offset': new OpenLayers.Pixel(-44, 0),
-            'padding': new OpenLayers.Bounds(8, 9, 8, 40),
-            'blocks': [
-                { // top-left
-                    size: new OpenLayers.Size('auto', 'auto'),
-                    anchor: new OpenLayers.Bounds(0, 21, 22, 32),
-                    position: new OpenLayers.Pixel(0, 0)
-                },
-                { //top-right
-                    size: new OpenLayers.Size(22, 'auto'),
-                    anchor: new OpenLayers.Bounds(null, 21, 0, 32),
-                    position: new OpenLayers.Pixel(-1238, 0)
-                },
-                { //bottom-left
-                    size: new OpenLayers.Size('auto', 21),
-                    anchor: new OpenLayers.Bounds(0, 0, 22, null),
-                    position: new OpenLayers.Pixel(0, -629)
-                },
-                { //bottom-right
-                    size: new OpenLayers.Size(22, 21),
-                    anchor: new OpenLayers.Bounds(null, 0, 0, null),
-                    position: new OpenLayers.Pixel(-1238, -629)
-                },
-                { // stem
-                    size: new OpenLayers.Size(81, 33),
-                    anchor: new OpenLayers.Bounds(0, null, null, 0),
-                    position: new OpenLayers.Pixel(-311, -674)
-                }
-            ]
+    getLonLatFromViewPortPx: function (viewPortPx) {
+        var lonlat = null;
+        if ( (this.mapObject != null) && 
+             (this.getMapObjectCenter() != null) ) {
+            var moPixel = this.getMapObjectPixelFromOLPixel(viewPortPx);
+            var moLonLat = this.getMapObjectLonLatFromMapObjectPixel(moPixel);
+            lonlat = this.getOLLonLatFromMapObjectLonLat(moLonLat);
         }
         }
+        return lonlat;
     },
 
     },
 
     /**
     /**
-     * APIProperty: minSize
-     * {<OpenLayers.Size>}
+     * Method: getViewPortPxFromLonLat
+     * Get a pixel location from a map location
+     *
+     * Parameters:
+     * lonlat - {<OpenLayers.LonLat>}
+     *
+     * Returns:
+     * {<OpenLayers.Pixel>} An OpenLayers.Pixel which is the passed-in
+     * OpenLayers.LonLat, translated into view port pixels by map lib
+     * If map lib is not loaded or not centered, returns null
      */
      */
-    minSize: new OpenLayers.Size(105, 10),
+    getViewPortPxFromLonLat: function (lonlat) {
+        var viewPortPx = null;
+        if ( (this.mapObject != null) && 
+             (this.getMapObjectCenter() != null) ) {
+
+            var moLonLat = this.getMapObjectLonLatFromOLLonLat(lonlat);
+            var moPixel = this.getMapObjectPixelFromMapObjectLonLat(moLonLat);
+        
+            viewPortPx = this.getOLPixelFromMapObjectPixel(moPixel);
+        }
+        return viewPortPx;
+    },
+
+  /********************************************************/
+  /*                                                      */
+  /*               Translation Functions                  */
+  /*                                                      */
+  /*   The following functions translate Map Object and   */
+  /*            OL formats for Pixel, LonLat              */
+  /*                                                      */
+  /********************************************************/
+
+  //
+  // TRANSLATION: MapObject LatLng <-> OpenLayers.LonLat
+  //
 
     /**
 
     /**
-     * APIProperty: maxSize
-     * {<OpenLayers.Size>}
+     * Method: getOLLonLatFromMapObjectLonLat
+     * Get an OL style map location from a 3rd party style map location
+     *
+     * Parameters
+     * moLonLat - {Object}
+     * 
+     * Returns:
+     * {<OpenLayers.LonLat>} An OpenLayers.LonLat, translated from the passed in 
+     *          MapObject LonLat
+     *          Returns null if null value is passed in
      */
      */
-    maxSize: new OpenLayers.Size(1200, 660),
+    getOLLonLatFromMapObjectLonLat: function(moLonLat) {
+        var olLonLat = null;
+        if (moLonLat != null) {
+            var lon = this.getLongitudeFromMapObjectLonLat(moLonLat);
+            var lat = this.getLatitudeFromMapObjectLonLat(moLonLat);
+            olLonLat = new OpenLayers.LonLat(lon, lat);
+        }
+        return olLonLat;
+    },
 
 
-    /** 
-     * Constructor: OpenLayers.Popup.FramedCloud
+    /**
+     * Method: getMapObjectLonLatFromOLLonLat
+     * Get a 3rd party map location from an OL map location.
+     *
+     * Parameters:
+     * olLonLat - {<OpenLayers.LonLat>}
      * 
      * 
+     * Returns:
+     * {Object} A MapObject LonLat, translated from the passed in 
+     *          OpenLayers.LonLat
+     *          Returns null if null value is passed in
+     */
+    getMapObjectLonLatFromOLLonLat: function(olLonLat) {
+        var moLatLng = null;
+        if (olLonLat != null) {
+            moLatLng = this.getMapObjectLonLatFromLonLat(olLonLat.lon,
+                                                         olLonLat.lat);
+        }
+        return moLatLng;
+    },
+
+
+  //
+  // TRANSLATION: MapObject Pixel <-> OpenLayers.Pixel
+  //
+
+    /**
+     * Method: getOLPixelFromMapObjectPixel
+     * Get an OL pixel location from a 3rd party pixel location.
+     *
      * Parameters:
      * Parameters:
-     * id - {String}
-     * lonlat - {<OpenLayers.LonLat>}
-     * contentSize - {<OpenLayers.Size>}
-     * contentHTML - {String}
-     * anchor - {Object} Object to which we'll anchor the popup. Must expose 
-     *     a 'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>) 
-     *     (Note that this is generally an <OpenLayers.Icon>).
-     * closeBox - {Boolean}
-     * closeBoxCallback - {Function} Function to be called on closeBox click.
+     * moPixel - {Object}
+     * 
+     * Returns:
+     * {<OpenLayers.Pixel>} An OpenLayers.Pixel, translated from the passed in 
+     *          MapObject Pixel
+     *          Returns null if null value is passed in
      */
      */
-    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 
-                        closeBoxCallback) {
+    getOLPixelFromMapObjectPixel: function(moPixel) {
+        var olPixel = null;
+        if (moPixel != null) {
+            var x = this.getXFromMapObjectPixel(moPixel);
+            var y = this.getYFromMapObjectPixel(moPixel);
+            olPixel = new OpenLayers.Pixel(x, y);
+        }
+        return olPixel;
+    },
 
 
-        this.imageSrc = OpenLayers.Util.getImageLocation('cloud-popup-relative.png');
-        OpenLayers.Popup.Framed.prototype.initialize.apply(this, arguments);
-        this.contentDiv.className = this.contentDisplayClass;
+    /**
+     * Method: getMapObjectPixelFromOLPixel
+     * Get a 3rd party pixel location from an OL pixel location
+     *
+     * Parameters:
+     * olPixel - {<OpenLayers.Pixel>}
+     * 
+     * Returns:
+     * {Object} A MapObject Pixel, translated from the passed in 
+     *          OpenLayers.Pixel
+     *          Returns null if null value is passed in
+     */
+    getMapObjectPixelFromOLPixel: function(olPixel) {
+        var moPixel = null;
+        if (olPixel != null) {
+            moPixel = this.getMapObjectPixelFromXY(olPixel.x, olPixel.y);
+        }
+        return moPixel;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Popup.FramedCloud"
+    CLASS_NAME: "OpenLayers.Layer.EventPane"
 });
 /* ======================================================================
 });
 /* ======================================================================
-    OpenLayers/Rule.js
+    OpenLayers/Layer/FixedZoomLevels.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
-
 /**
 /**
- * @requires OpenLayers/BaseTypes/Class.js
- * @requires OpenLayers/Util.js
- * @requires OpenLayers/Style.js
+ * @requires OpenLayers/Layer.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Rule
- * This class represents an SLD Rule, as being used for rule-based SLD styling.
+ * Class: OpenLayers.Layer.FixedZoomLevels
+ *   Some Layers will already have established zoom levels (like google 
+ *    or ve). Instead of trying to determine them and populate a resolutions[]
+ *    Array with those values, we will hijack the resolution functionality
+ *    here.
+ * 
+ *   When you subclass FixedZoomLevels: 
+ * 
+ *   The initResolutions() call gets nullified, meaning no resolutions[] array 
+ *    is set up. Which would be a big problem getResolution() in Layer, since 
+ *    it merely takes map.zoom and indexes into resolutions[]... but....
+ * 
+ *   The getResolution() call is also overridden. Instead of using the 
+ *    resolutions[] array, we simply calculate the current resolution based
+ *    on the current extent and the current map size. But how will we be able
+ *    to calculate the current extent without knowing the resolution...?
+ *  
+ *   The getExtent() function is also overridden. Instead of calculating extent
+ *    based on the center point and the current resolution, we instead 
+ *    calculate the extent by getting the lonlats at the top-left and 
+ *    bottom-right by using the getLonLatFromViewPortPx() translation function,
+ *    taken from the pixel locations (0,0) and the size of the map. But how 
+ *    will we be able to do lonlat-px translation without resolution....?
+ * 
+ *   The getZoomForResolution() method is overridden. Instead of indexing into
+ *    the resolutions[] array, we call OpenLayers.Layer.getExent(), passing in
+ *    the desired resolution. With this extent, we then call getZoomForExtent() 
+ * 
+ * 
+ *   Whenever you implement a layer using OpenLayers.Layer.FixedZoomLevels, 
+ *    it is your responsibility to provide the following three functions:
+ * 
+ *   - getLonLatFromViewPortPx
+ *   - getViewPortPxFromLonLat
+ *   - getZoomForExtent
+ * 
+ *  ...those three functions should generally be provided by any reasonable 
+ *  API that you might be working from.
+ *
  */
  */
-OpenLayers.Rule = OpenLayers.Class({
-    
-    /**
-     * Property: id
-     * {String} A unique id for this session.
-     */
-    id: null,
-    
-    /**
-     * APIProperty: name
-     * {String} name of this rule
-     */
-    name: null,
+OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class({
+      
+  /********************************************************/
+  /*                                                      */
+  /*                 Baselayer Functions                  */
+  /*                                                      */
+  /*    The following functions must all be implemented   */
+  /*                  by all base layers                  */
+  /*                                                      */
+  /********************************************************/
     
     /**
     
     /**
-     * Property: title
-     * {String} Title of this rule (set if included in SLD)
+     * Constructor: OpenLayers.Layer.FixedZoomLevels
+     * Create a new fixed zoom levels layer.
      */
      */
-    title: null,
+    initialize: function() {
+        //this class is only just to add the following functions... 
+        // nothing to actually do here... but it is probably a good
+        // idea to have layers that use these functions call this 
+        // inititalize() anyways, in case at some point we decide we 
+        // do want to put some functionality or state in here. 
+    },
     
     /**
     
     /**
-     * Property: description
-     * {String} Description of this rule (set if abstract is included in SLD)
+     * Method: initResolutions
+     * Populate the resolutions array
      */
      */
-    description: null,
+    initResolutions: function() {
 
 
-    /**
-     * Property: context
-     * {Object} An optional object with properties that the rule should be
-     * evaluated against. If no context is specified, feature.attributes will
-     * be used.
-     */
-    context: null,
-    
-    /**
-     * Property: filter
-     * {<OpenLayers.Filter>} Optional filter for the rule.
-     */
-    filter: null,
+        var props = ['minZoomLevel', 'maxZoomLevel', 'numZoomLevels'];
+          
+        for(var i=0, len=props.length; i<len; i++) {
+            var property = props[i];
+            this[property] = (this.options[property] != null)  
+                                     ? this.options[property] 
+                                     : this.map[property];
+        }
 
 
-    /**
-     * Property: elseFilter
-     * {Boolean} Determines whether this rule is only to be applied only if
-     * no other rules match (ElseFilter according to the SLD specification). 
-     * Default is false.  For instances of OpenLayers.Rule, if elseFilter is
-     * false, the rule will always apply.  For subclasses, the else property is 
-     * ignored.
-     */
-    elseFilter: false,
-    
-    /**
-     * Property: symbolizer
-     * {Object} Symbolizer or hash of symbolizers for this rule. If hash of
-     * symbolizers, keys are one or more of ["Point", "Line", "Polygon"]. The
-     * latter if useful if it is required to style e.g. vertices of a line
-     * with a point symbolizer. Note, however, that this is not implemented
-     * yet in OpenLayers, but it is the way how symbolizers are defined in
-     * SLD.
-     */
-    symbolizer: null,
-    
-    /**
-     * Property: symbolizers
-     * {Array} Collection of symbolizers associated with this rule.  If 
-     *     provided at construction, the symbolizers array has precedence
-     *     over the deprecated symbolizer property.  Note that multiple 
-     *     symbolizers are not currently supported by the vector renderers.
-     *     Rules with multiple symbolizers are currently only useful for
-     *     maintaining elements in an SLD document.
-     */
-    symbolizers: null,
+        if ( (this.minZoomLevel == null) ||
+             (this.minZoomLevel < this.MIN_ZOOM_LEVEL) ){
+            this.minZoomLevel = this.MIN_ZOOM_LEVEL;
+        }        
+
+        //
+        // At this point, we know what the minimum desired zoom level is, and
+        //  we must calculate the total number of zoom levels. 
+        //  
+        //  Because we allow for the setting of either the 'numZoomLevels'
+        //   or the 'maxZoomLevel' properties... on either the layer or the  
+        //   map, we have to define some rules to see which we take into
+        //   account first in this calculation. 
+        //
+        // The following is the precedence list for these properties:
+        // 
+        // (1) numZoomLevels set on layer
+        // (2) maxZoomLevel set on layer
+        // (3) numZoomLevels set on map
+        // (4) maxZoomLevel set on map*
+        // (5) none of the above*
+        //
+        // *Note that options (4) and (5) are only possible if the user 
+        //  _explicitly_ sets the 'numZoomLevels' property on the map to 
+        //  null, since it is set by default to 16. 
+        //
+
+        //
+        // Note to future: In 3.0, I think we should remove the default 
+        // value of 16 for map.numZoomLevels. Rather, I think that value 
+        // should be set as a default on the Layer.WMS class. If someone
+        // creates a 3rd party layer and does not specify any 'minZoomLevel', 
+        // 'maxZoomLevel', or 'numZoomLevels', and has not explicitly 
+        // specified any of those on the map object either.. then I think
+        // it is fair to say that s/he wants all the zoom levels available.
+        // 
+        // By making map.numZoomLevels *null* by default, that will be the 
+        // case. As it is, I don't feel comfortable changing that right now
+        // as it would be a glaring API change and actually would probably
+        // break many peoples' codes. 
+        //
+
+        //the number of zoom levels we'd like to have.
+        var desiredZoomLevels;
+
+        //this is the maximum number of zoom levels the layer will allow, 
+        // given the specified starting minimum zoom level.
+        var limitZoomLevels = this.MAX_ZOOM_LEVEL - this.minZoomLevel + 1;
+
+        if ( ((this.options.numZoomLevels == null) && 
+              (this.options.maxZoomLevel != null)) // (2)
+              ||
+             ((this.numZoomLevels == null) &&
+              (this.maxZoomLevel != null)) // (4)
+           ) {
+            //calculate based on specified maxZoomLevel (on layer or map)
+            desiredZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
+        } else {
+            //calculate based on specified numZoomLevels (on layer or map)
+            // this covers cases (1) and (3)
+            desiredZoomLevels = this.numZoomLevels;
+        }
+
+        if (desiredZoomLevels != null) {
+            //Now that we know what we would *like* the number of zoom levels
+            // to be, based on layer or map options, we have to make sure that
+            // it does not conflict with the actual limit, as specified by 
+            // the constants on the layer itself (and calculated into the
+            // 'limitZoomLevels' variable). 
+            this.numZoomLevels = Math.min(desiredZoomLevels, limitZoomLevels);
+        } else {
+            // case (5) -- neither 'numZoomLevels' not 'maxZoomLevel' was 
+            // set on either the layer or the map. So we just use the 
+            // maximum limit as calculated by the layer's constants.
+            this.numZoomLevels = limitZoomLevels;
+        }
+
+        //now that the 'numZoomLevels' is appropriately, safely set, 
+        // we go back and re-calculate the 'maxZoomLevel'.
+        this.maxZoomLevel = this.minZoomLevel + this.numZoomLevels - 1;
+
+        if (this.RESOLUTIONS != null) {
+            var resolutionsIndex = 0;
+            this.resolutions = [];
+            for(var i= this.minZoomLevel; i <= this.maxZoomLevel; i++) {
+                this.resolutions[resolutionsIndex++] = this.RESOLUTIONS[i];            
+            }
+            this.maxResolution = this.resolutions[0];
+            this.minResolution = this.resolutions[this.resolutions.length - 1];
+        }       
+    },
     
     /**
     
     /**
-     * APIProperty: minScaleDenominator
-     * {Number} or {String} minimum scale at which to draw the feature.
-     * In the case of a String, this can be a combination of text and
-     * propertyNames in the form "literal ${propertyName}"
+     * APIMethod: getResolution
+     * Get the current map resolution
+     * 
+     * Returns:
+     * {Float} Map units per Pixel
      */
      */
-    minScaleDenominator: null,
+    getResolution: function() {
+
+        if (this.resolutions != null) {
+            return OpenLayers.Layer.prototype.getResolution.apply(this, arguments);
+        } else {
+            var resolution = null;
+            
+            var viewSize = this.map.getSize();
+            var extent = this.getExtent();
+            
+            if ((viewSize != null) && (extent != null)) {
+                resolution = Math.max( extent.getWidth()  / viewSize.w,
+                                       extent.getHeight() / viewSize.h );
+            }
+            return resolution;
+        }
+     },
 
     /**
 
     /**
-     * APIProperty: maxScaleDenominator
-     * {Number} or {String} maximum scale at which to draw the feature.
-     * In the case of a String, this can be a combination of text and
-     * propertyNames in the form "literal ${propertyName}"
-     */
-    maxScaleDenominator: null,
-    
-    /** 
-     * Constructor: OpenLayers.Rule
-     * Creates a Rule.
-     *
-     * Parameters:
-     * options - {Object} An optional object with properties to set on the
-     *           rule
+     * APIMethod: getExtent
+     * Calculates using px-> lonlat translation functions on tl and br 
+     *     corners of viewport
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Rule>}
+     * {<OpenLayers.Bounds>} A Bounds object which represents the lon/lat 
+     *                       bounds of the current viewPort.
      */
      */
-    initialize: function(options) {
-        this.symbolizer = {};
-        OpenLayers.Util.extend(this, options);
-        if (this.symbolizers) {
-            delete this.symbolizer;
+    getExtent: function () {
+        var size = this.map.getSize();
+        var tl = this.getLonLatFromViewPortPx({
+            x: 0, y: 0
+        });
+        var br = this.getLonLatFromViewPortPx({
+            x: size.w, y: size.h
+        });
+        
+        if ((tl != null) && (br != null)) {
+            return new OpenLayers.Bounds(tl.lon, br.lat, br.lon, tl.lat);
+        } else {
+            return null;
         }
         }
-        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
     },
 
     },
 
-    /** 
-     * APIMethod: destroy
-     * nullify references to prevent circular references and memory leaks
-     */
-    destroy: function() {
-        for (var i in this.symbolizer) {
-            this.symbolizer[i] = null;
-        }
-        this.symbolizer = null;
-        delete this.symbolizers;
-    },
-    
     /**
     /**
-     * APIMethod: evaluate
-     * evaluates this rule for a specific feature
-     * 
+     * Method: getZoomForResolution
+     * Get the zoom level for a given resolution
+     *
      * Parameters:
      * Parameters:
-     * feature - {<OpenLayers.Feature>} feature to apply the rule to.
-     * 
+     * resolution - {Float}
+     *
      * Returns:
      * Returns:
-     * {Boolean} true if the rule applies, false if it does not.
-     * This rule is the default rule and always returns true.
+     * {Integer} A suitable zoom level for the specified resolution.
+     *           If no baselayer is set, returns null.
      */
      */
-    evaluate: function(feature) {
-        var context = this.getContext(feature);
-        var applies = true;
-
-        if (this.minScaleDenominator || this.maxScaleDenominator) {
-            var scale = feature.layer.map.getScale();
-        }
-        
-        // check if within minScale/maxScale bounds
-        if (this.minScaleDenominator) {
-            applies = scale >= OpenLayers.Style.createLiteral(
-                    this.minScaleDenominator, context);
-        }
-        if (applies && this.maxScaleDenominator) {
-            applies = scale < OpenLayers.Style.createLiteral(
-                    this.maxScaleDenominator, context);
-        }
-        
-        // check if optional filter applies
-        if(applies && this.filter) {
-            // feature id filters get the feature, others get the context
-            if(this.filter.CLASS_NAME == "OpenLayers.Filter.FeatureId") {
-                applies = this.filter.evaluate(feature);
-            } else {
-                applies = this.filter.evaluate(context);
-            }
+    getZoomForResolution: function(resolution) {
+      
+        if (this.resolutions != null) {
+            return OpenLayers.Layer.prototype.getZoomForResolution.apply(this, arguments);
+        } else {
+            var extent = OpenLayers.Layer.prototype.getExtent.apply(this, []);
+            return this.getZoomForExtent(extent);
         }
         }
-
-        return applies;
     },
     },
+
+
+
+    
+    /********************************************************/
+    /*                                                      */
+    /*             Translation Functions                    */
+    /*                                                      */
+    /*    The following functions translate GMaps and OL    */ 
+    /*     formats for Pixel, LonLat, Bounds, and Zoom      */
+    /*                                                      */
+    /********************************************************/
     
     
+    
+    //
+    // TRANSLATION: MapObject Zoom <-> OpenLayers Zoom
+    //
+  
     /**
     /**
-     * Method: getContext
-     * Gets the context for evaluating this rule
+     * Method: getOLZoomFromMapObjectZoom
+     * Get the OL zoom index from the map object zoom level
+     *
+     * Parameters:
+     * moZoom - {Integer}
      * 
      * 
-     * Paramters:
-     * feature - {<OpenLayers.Feature>} feature to take the context from if
-     *           none is specified.
+     * Returns:
+     * {Integer} An OpenLayers Zoom level, translated from the passed in zoom
+     *           Returns null if null value is passed in
      */
      */
-    getContext: function(feature) {
-        var context = this.context;
-        if (!context) {
-            context = feature.attributes || feature.data;
-        }
-        if (typeof this.context == "function") {
-            context = this.context(feature);
+    getOLZoomFromMapObjectZoom: function(moZoom) {
+        var zoom = null;
+        if (moZoom != null) {
+            zoom = moZoom - this.minZoomLevel;
+            if (this.map.baseLayer !== this) {
+                zoom = this.map.baseLayer.getZoomForResolution(
+                    this.getResolutionForZoom(zoom)
+                );
+            }
         }
         }
-        return context;
+        return zoom;
     },
     
     /**
     },
     
     /**
-     * APIMethod: clone
-     * Clones this rule.
+     * Method: getMapObjectZoomFromOLZoom
+     * Get the map object zoom level from the OL zoom level
+     *
+     * Parameters:
+     * olZoom - {Integer}
      * 
      * Returns:
      * 
      * Returns:
-     * {<OpenLayers.Rule>} Clone of this rule.
+     * {Integer} A MapObject level, translated from the passed in olZoom
+     *           Returns null if null value is passed in
      */
      */
-    clone: function() {
-        var options = OpenLayers.Util.extend({}, this);
-        if (this.symbolizers) {
-            // clone symbolizers
-            var len = this.symbolizers.length;
-            options.symbolizers = new Array(len);
-            for (var i=0; i<len; ++i) {
-                options.symbolizers[i] = this.symbolizers[i].clone();
-            }
-        } else {
-            // clone symbolizer
-            options.symbolizer = {};
-            var value, type;
-            for(var key in this.symbolizer) {
-                value = this.symbolizer[key];
-                type = typeof value;
-                if(type === "object") {
-                    options.symbolizer[key] = OpenLayers.Util.extend({}, value);
-                } else if(type === "string") {
-                    options.symbolizer[key] = value;
-                }
+    getMapObjectZoomFromOLZoom: function(olZoom) {
+        var zoom = null; 
+        if (olZoom != null) {
+            zoom = olZoom + this.minZoomLevel;
+            if (this.map.baseLayer !== this) {
+                zoom = this.getZoomForResolution(
+                    this.map.baseLayer.getResolutionForZoom(zoom)
+                );
             }
         }
             }
         }
-        // clone filter
-        options.filter = this.filter && this.filter.clone();
-        // clone context
-        options.context = this.context && OpenLayers.Util.extend({}, this.context);
-        return new OpenLayers.Rule(options);
+        return zoom;
     },
     },
-        
-    CLASS_NAME: "OpenLayers.Rule"
+
+    CLASS_NAME: "OpenLayers.Layer.FixedZoomLevels"
 });
 });
+
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Handler/Pinch.js
+    OpenLayers/Layer/Google.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
+
 /**
 /**
- * @requires OpenLayers/Handler.js
+ * @requires OpenLayers/Layer/SphericalMercator.js
+ * @requires OpenLayers/Layer/EventPane.js
+ * @requires OpenLayers/Layer/FixedZoomLevels.js
+ * @requires OpenLayers/Lang.js
  */
 
 /**
  */
 
 /**
- * Class: OpenLayers.Handler.Pinch
- * The pinch handler is used to deal with sequences of browser events related
- *     to pinch gestures. The handler is used by controls that want to know
- *     when a pinch sequence begins, when a pinch is happening, and when it has
- *     finished.
- *
- * Controls that use the pinch handler typically construct it with callbacks
- *     for 'start', 'move', and 'done'.  Callbacks for these keys are
- *     called when the pinch begins, with each change, and when the pinch is
- *     done.
+ * Class: OpenLayers.Layer.Google
  *
  *
- * Create a new pinch handler with the <OpenLayers.Handler.Pinch> constructor.
+ * Provides a wrapper for Google's Maps API
+ * Normally the Terms of Use for this API do not allow wrapping, but Google
+ * have provided written consent to OpenLayers for this - see email in
+ * http://osgeo-org.1560.n6.nabble.com/Google-Maps-API-Terms-of-Use-changes-tp4910013p4911981.html
  *
  * Inherits from:
  *
  * Inherits from:
- *  - <OpenLayers.Handler>
+ *  - <OpenLayers.Layer.SphericalMercator>
+ *  - <OpenLayers.Layer.EventPane>
+ *  - <OpenLayers.Layer.FixedZoomLevels>
  */
  */
-OpenLayers.Handler.Pinch = OpenLayers.Class(OpenLayers.Handler, {
+OpenLayers.Layer.Google = OpenLayers.Class(
+    OpenLayers.Layer.EventPane,
+    OpenLayers.Layer.FixedZoomLevels, {
 
     /**
 
     /**
-     * Property: started
-     * {Boolean} When a touchstart event is received, we want to record it,
-     *     but not set 'pinching' until the touchmove get started after
-     *     starting.
+     * Constant: MIN_ZOOM_LEVEL
+     * {Integer} 0
      */
      */
-    started: false,
+    MIN_ZOOM_LEVEL: 0,
 
     /**
 
     /**
-     * Property: stopDown
-     * {Boolean} Stop propagation of touchstart events from getting to
-     *     listeners on the same element. Default is false.
+     * Constant: MAX_ZOOM_LEVEL
+     * {Integer} 21
      */
      */
-    stopDown: false,
+    MAX_ZOOM_LEVEL: 21,
 
     /**
 
     /**
-     * Property: pinching
-     * {Boolean}
+     * Constant: RESOLUTIONS
+     * {Array(Float)} Hardcode these resolutions so that they are more closely
+     *                tied with the standard wms projection
      */
      */
-    pinching: false,
+    RESOLUTIONS: [
+        1.40625,
+        0.703125,
+        0.3515625,
+        0.17578125,
+        0.087890625,
+        0.0439453125,
+        0.02197265625,
+        0.010986328125,
+        0.0054931640625,
+        0.00274658203125,
+        0.001373291015625,
+        0.0006866455078125,
+        0.00034332275390625,
+        0.000171661376953125,
+        0.0000858306884765625,
+        0.00004291534423828125,
+        0.00002145767211914062,
+        0.00001072883605957031,
+        0.00000536441802978515,
+        0.00000268220901489257,
+        0.0000013411045074462891,
+        0.00000067055225372314453
+    ],
 
     /**
 
     /**
-     * Property: last
-     * {Object} Object that store informations related to pinch last touch.
+     * APIProperty: type
+     * {GMapType}
      */
      */
-    last: null,
+    type: null,
 
     /**
 
     /**
-     * Property: start
-     * {Object} Object that store informations related to pinch touchstart.
+     * APIProperty: wrapDateLine
+     * {Boolean} Allow user to pan forever east/west.  Default is true.
+     *     Setting this to false only restricts panning if
+     *     <sphericalMercator> is true.
      */
      */
-    start: null,
+    wrapDateLine: true,
 
     /**
 
     /**
-     * Constructor: OpenLayers.Handler.Pinch
-     * Returns OpenLayers.Handler.Pinch
-     *
-     * Parameters:
-     * control - {<OpenLayers.Control>} The control that is making use of
-     *     this handler.  If a handler is being used without a control, the
-     *     handlers setMap method must be overridden to deal properly with
-     *     the map.
-     * callbacks - {Object} An object containing functions to be called when
-     *     the pinch operation start, change, or is finished. The callbacks
-     *     should expect to receive an object argument, which contains
-     *     information about scale, distance, and position of touch points.
-     * options - {Object}
+     * APIProperty: sphericalMercator
+     * {Boolean} Should the map act as a mercator-projected map? This will
+     *     cause all interactions with the map to be in the actual map
+     *     projection, which allows support for vector drawing, overlaying
+     *     other maps, etc.
      */
      */
+    sphericalMercator: false,
 
     /**
 
     /**
-     * Method: touchstart
-     * Handle touchstart events
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * APIProperty: useTiltImages
+     * {Boolean} Should Google use 45° (tilt) imagery when available or
+     *     should it stick to the 0° overhead view? While tilt images look
+     *     impressive, the changed viewing angle can cause the misalignment
+     *     of overlay layers.
      */
      */
-    touchstart: function(evt) {
-        var propagate = true;
-        this.pinching = false;
-        if (OpenLayers.Event.isMultiTouch(evt)) {
-            this.started = true;
-            this.last = this.start = {
-                distance: this.getDistance(evt.touches),
-                delta: 0,
-                scale: 1
-            };
-            this.callback("start", [evt, this.start]);
-            propagate = !this.stopDown;
-        } else if (this.started) {
-            // Some webkit versions send fake single-touch events during
-            // multitouch, which cause the drag handler to trigger
-            return false;
-        } else {
-            this.started = false;
-            this.start = null;
-            this.last = null;
-        }
-        // prevent document dragging
-        OpenLayers.Event.preventDefault(evt);
-        return propagate;
-    },
+    useTiltImages: false,
 
     /**
 
     /**
-     * Method: touchmove
-     * Handle touchmove events
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * Property: version
+     * {Number} The version of the Google Maps API
      */
      */
-    touchmove: function(evt) {
-        if (this.started && OpenLayers.Event.isMultiTouch(evt)) {
-            this.pinching = true;
-            var current = this.getPinchData(evt);
-            this.callback("move", [evt, current]);
-            this.last = current;
-            // prevent document dragging
-            OpenLayers.Event.stop(evt);
-        } else if (this.started) {
-            // Some webkit versions send fake single-touch events during
-            // multitouch, which cause the drag handler to trigger
-            return false;
-        }
-        return true;
-    },
+    version: null,
 
     /**
 
     /**
-     * Method: touchend
-     * Handle touchend events
+     * Constructor: OpenLayers.Layer.Google
      *
      * Parameters:
      *
      * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Boolean} Let the event propagate.
+     * name - {String} A name for the layer.
+     * options - {Object} An optional object whose properties will be set
+     *     on the layer.
      */
      */
-    touchend: function(evt) {
-        if (this.started && !OpenLayers.Event.isMultiTouch(evt)) {
-            this.started = false;
-            this.pinching = false;
-            this.callback("done", [evt, this.start, this.last]);
-            this.start = null;
-            this.last = null;
-            return false;
+    initialize: function(name, options) {
+        options = options || {};
+        options.version = "3";
+        var mixin = OpenLayers.Layer.Google["v" +
+            options.version.replace(/\./g, "_")];
+        if (mixin) {
+            OpenLayers.Util.applyDefaults(options, mixin);
+        } else {
+            throw "Unsupported Google Maps API version: " + options.version;
         }
         }
-        return true;
-    },
 
 
-    /**
-     * Method: activate
-     * Activate the handler.
-     *
-     * Returns:
-     * {Boolean} The handler was successfully activated.
-     */
-    activate: function() {
-        var activated = false;
-        if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
-            this.pinching = false;
-            activated = true;
+        OpenLayers.Util.applyDefaults(options, mixin.DEFAULTS);
+        if (options.maxExtent) {
+            options.maxExtent = options.maxExtent.clone();
         }
         }
-        return activated;
-    },
 
 
-    /**
-     * Method: deactivate
-     * Deactivate the handler.
-     *
-     * Returns:
-     * {Boolean} The handler was successfully deactivated.
-     */
-    deactivate: function() {
-        var deactivated = false;
-        if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
-            this.started = false;
-            this.pinching = false;
-            this.start = null;
-            this.last = null;
-            deactivated = true;
+        OpenLayers.Layer.EventPane.prototype.initialize.apply(this,
+            [name, options]);
+        OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
+            [name, options]);
+
+        if (this.sphericalMercator) {
+            OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
+            this.initMercatorParameters();
         }
         }
-        return deactivated;
     },
 
     /**
     },
 
     /**
-     * Method: getDistance
-     * Get the distance in pixels between two touches.
-     *
-     * Parameters:
-     * touches - {Array(Object)}
+     * Method: clone
+     * Create a clone of this layer
      *
      * Returns:
      *
      * Returns:
-     * {Number} The distance in pixels.
+     * {<OpenLayers.Layer.Google>} An exact clone of this layer
      */
      */
-    getDistance: function(touches) {
-        var t0 = touches[0];
-        var t1 = touches[1];
-        return Math.sqrt(
-            Math.pow(t0.olClientX - t1.olClientX, 2) +
-            Math.pow(t0.olClientY - t1.olClientY, 2)
+    clone: function() {
+        /**
+         * This method isn't intended to be called by a subclass and it
+         * doesn't call the same method on the superclass.  We don't call
+         * the super's clone because we don't want properties that are set
+         * on this layer after initialize (i.e. this.mapObject etc.).
+         */
+        return new OpenLayers.Layer.Google(
+            this.name, this.getOptions()
         );
     },
 
         );
     },
 
-
-    /**
-     * Method: getPinchData
-     * Get informations about the pinch event.
-     *
-     * Parameters:
-     * evt - {Event}
-     *
-     * Returns:
-     * {Object} Object that contains data about the current pinch.
-     */
-    getPinchData: function(evt) {
-        var distance = this.getDistance(evt.touches);
-        var scale = distance / this.start.distance;
-        return {
-            distance: distance,
-            delta: this.last.distance - distance,
-            scale: scale
-        };
-    },
-
-    CLASS_NAME: "OpenLayers.Handler.Pinch"
-});
-
-/* ======================================================================
-    OpenLayers/Lang/en.js
-   ====================================================================== */
-
-/**
- * @requires OpenLayers/Lang.js
- */
-
-/**
- * Namespace: OpenLayers.Lang["en"]
- * Dictionary for English.  Keys for entries are used in calls to
- *     <OpenLayers.Lang.translate>.  Entry bodies are normal strings or
- *     strings formatted for use with <OpenLayers.String.format> calls.
- */
-OpenLayers.Lang.en = {
-
-    'unhandledRequest': "Unhandled request return ${statusText}",
-
-    'Permalink': "Permalink",
-
-    'Overlays': "Overlays",
-
-    'Base Layer': "Base Layer",
-
-    'noFID': "Can't update a feature for which there is no FID.",
-
-    'browserNotSupported':
-        "Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",
-
-    // console message
-    'minZoomLevelError':
-        "The minZoomLevel property is only intended for use " +
-        "with the FixedZoomLevels-descendent layers. That this " +
-        "wfs layer checks for minZoomLevel is a relic of the" +
-        "past. We cannot, however, remove it without possibly " +
-        "breaking OL based applications that may depend on it." +
-        " Therefore we are deprecating it -- the minZoomLevel " +
-        "check below will be removed at 3.0. Please instead " +
-        "use min/max resolution setting as described here: " +
-        "http://trac.openlayers.org/wiki/SettingZoomLevels",
-
-    'commitSuccess': "WFS Transaction: SUCCESS ${response}",
-
-    'commitFailed': "WFS Transaction: FAILED ${response}",
-
-    'googleWarning':
-        "The Google Layer was unable to load correctly.<br><br>" +
-        "To get rid of this message, select a new BaseLayer " +
-        "in the layer switcher in the upper-right corner.<br><br>" +
-        "Most likely, this is because the Google Maps library " +
-        "script was either not included, or does not contain the " +
-        "correct API key for your site.<br><br>" +
-        "Developers: For help getting this working correctly, " +
-        "<a href='http://trac.openlayers.org/wiki/Google' " +
-        "target='_blank'>click here</a>",
-
-    'getLayerWarning':
-        "The ${layerType} Layer was unable to load correctly.<br><br>" +
-        "To get rid of this message, select a new BaseLayer " +
-        "in the layer switcher in the upper-right corner.<br><br>" +
-        "Most likely, this is because the ${layerLib} library " +
-        "script was not correctly included.<br><br>" +
-        "Developers: For help getting this working correctly, " +
-        "<a href='http://trac.openlayers.org/wiki/${layerLib}' " +
-        "target='_blank'>click here</a>",
-
-    'Scale = 1 : ${scaleDenom}': "Scale = 1 : ${scaleDenom}",
-    
-    //labels for the graticule control
-    'W': 'W',
-    'E': 'E',
-    'N': 'N',
-    'S': 'S',
-    'Graticule': 'Graticule',
-
-    // console message
-    'reprojectDeprecated':
-        "You are using the 'reproject' option " +
-        "on the ${layerName} layer. This option is deprecated: " +
-        "its use was designed to support displaying data over commercial " + 
-        "basemaps, but that functionality should now be achieved by using " +
-        "Spherical Mercator support. More information is available from " +
-        "http://trac.openlayers.org/wiki/SphericalMercator.",
-
-    // console message
-    'methodDeprecated':
-        "This method has been deprecated and will be removed in 3.0. " +
-        "Please use ${newMethod} instead.",
-
-    // **** end ****
-    'end': ''
-    
-};
-/* ======================================================================
-    OpenLayers/Control/PinchZoom.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Handler/Pinch.js
- */
-
-/**
- * Class: OpenLayers.Control.PinchZoom
- *
- * Inherits:
- *  - <OpenLayers.Control>
- */
-OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
-
-    /** 
-     * Property: type
-     * {OpenLayers.Control.TYPES}
-     */
-    type: OpenLayers.Control.TYPE_TOOL,
-
-    /**
-     * Property: pinchOrigin
-     * {Object} Cached object representing the pinch start (in pixels).
-     */
-    pinchOrigin: null,    
-    
-    /**
-     * Property: currentCenter
-     * {Object} Cached object representing the latest pinch center (in pixels).
-     */
-    currentCenter: null,    
-
-    /**
-     * APIProperty: autoActivate
-     * {Boolean} Activate the control when it is added to a map.  Default is
-     *     true.
-     */
-    autoActivate: true,
-
-    /**
-     * APIProperty: preserveCenter
-     * {Boolean} Set this to true if you don't want the map center to change
-     *     while pinching. For example you may want to set preserveCenter to
-     *     true when the user location is being watched and you want to preserve
-     *     the user location at the center of the map even if he zooms in or
-     *     out using pinch. This property's value can be changed any time on an
-     *     existing instance. Default is false.
-     */
-    preserveCenter: false,
-    
-    /**
-     * APIProperty: handlerOptions
-     * {Object} Used to set non-default properties on the pinch handler
-     */
-
     /**
     /**
-     * Constructor: OpenLayers.Control.PinchZoom
-     * Create a control for zooming with pinch gestures.  This works on devices
-     *     with multi-touch support.
+     * APIMethod: setVisibility
+     * Set the visibility flag for the layer and hide/show & redraw
+     *     accordingly. Fire event unless otherwise specified
+     *
+     * Note that visibility is no longer simply whether or not the layer's
+     *     style.display is set to "block". Now we store a 'visibility' state
+     *     property on the layer class, this allows us to remember whether or
+     *     not we *desire* for a layer to be visible. In the case where the
+     *     map's resolution is out of the layer's range, this desire may be
+     *     subverted.
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *                    the control
+     * visible - {Boolean} Display the layer (if in range)
      */
      */
-    initialize: function(options) {
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
-        this.handler = new OpenLayers.Handler.Pinch(this, {
-            start: this.pinchStart,
-            move: this.pinchMove,
-            done: this.pinchDone
-        }, this.handlerOptions);
+    setVisibility: function(visible) {
+        // sharing a map container, opacity has to be set per layer
+        var opacity = this.opacity == null ? 1 : this.opacity;
+        OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this, arguments);
+        this.setOpacity(opacity);
     },
     },
-    
+
     /**
     /**
-     * Method: pinchStart
+     * APIMethod: display
+     * Hide or show the Layer
      *
      * Parameters:
      *
      * Parameters:
-     * evt - {Event}
-     * pinchData - {Object} pinch data object related to the current touchmove
-     *     of the pinch gesture. This give us the current scale of the pinch.
+     * visible - {Boolean}
      */
      */
-    pinchStart: function(evt, pinchData) {
-        var xy = (this.preserveCenter) ?
-            this.map.getPixelFromLonLat(this.map.getCenter()) : evt.xy;
-        this.pinchOrigin = xy;
-        this.currentCenter = xy;
+    display: function(visible) {
+        if (!this._dragging) {
+            this.setGMapVisibility(visible);
+        }
+        OpenLayers.Layer.EventPane.prototype.display.apply(this, arguments);
     },
     },
-    
+
     /**
     /**
-     * Method: pinchMove
+     * Method: moveTo
      *
      * Parameters:
      *
      * Parameters:
-     * evt - {Event}
-     * pinchData - {Object} pinch data object related to the current touchmove
-     *     of the pinch gesture. This give us the current scale of the pinch.
+     * bounds - {<OpenLayers.Bounds>}
+     * zoomChanged - {Boolean} Tells when zoom has changed, as layers have to
+     *     do some init work in that case.
+     * dragging - {Boolean}
      */
      */
-    pinchMove: function(evt, pinchData) {
-        var scale = pinchData.scale;
-        var containerOrigin = this.map.layerContainerOriginPx;
-        var pinchOrigin = this.pinchOrigin;
-        var current = (this.preserveCenter) ?
-            this.map.getPixelFromLonLat(this.map.getCenter()) : evt.xy;
-
-        var dx = Math.round((containerOrigin.x + current.x - pinchOrigin.x) + (scale - 1) * (containerOrigin.x - pinchOrigin.x));
-        var dy = Math.round((containerOrigin.y + current.y - pinchOrigin.y) + (scale - 1) * (containerOrigin.y - pinchOrigin.y));
-
-        this.map.applyTransform(dx, dy, scale);
-        this.currentCenter = current;
+    moveTo: function(bounds, zoomChanged, dragging) {
+        this._dragging = dragging;
+        OpenLayers.Layer.EventPane.prototype.moveTo.apply(this, arguments);
+        delete this._dragging;
     },
 
     /**
     },
 
     /**
-     * Method: pinchDone
+     * APIMethod: setOpacity
+     * Sets the opacity for the entire layer (all images)
      *
      * Parameters:
      *
      * Parameters:
-     * evt - {Event}
-     * start - {Object} pinch data object related to the touchstart event that
-     *     started the pinch gesture.
-     * last - {Object} pinch data object related to the last touchmove event
-     *     of the pinch gesture. This give us the final scale of the pinch.
+     * opacity - {Float}
      */
      */
-    pinchDone: function(evt, start, last) {
-        this.map.applyTransform();
-        var zoom = this.map.getZoomForResolution(this.map.getResolution() / last.scale, true);
-        if (zoom !== this.map.getZoom() || !this.currentCenter.equals(this.pinchOrigin)) {
-            var resolution = this.map.getResolutionForZoom(zoom);
-
-            var location = this.map.getLonLatFromPixel(this.pinchOrigin);
-            var zoomPixel = this.currentCenter;        
-            var size = this.map.getSize();
-
-            location.lon += resolution * ((size.w / 2) - zoomPixel.x);
-            location.lat -= resolution * ((size.h / 2) - zoomPixel.y);
-
-            // Force a reflow before calling setCenter. This is to work
-            // around an issue occuring in iOS.
-            //
-            // See https://github.com/openlayers/openlayers/pull/351.
-            //
-            // Without a reflow setting the layer container div's top left
-            // style properties to "0px" - as done in Map.moveTo when zoom
-            // is changed - won't actually correctly reposition the layer
-            // container div.
-            //
-            // Also, we need to use a statement that the Google Closure
-            // compiler won't optimize away.
-            this.map.div.clientWidth = this.map.div.clientWidth;
-
-            this.map.setCenter(location, zoom);
+    setOpacity: function(opacity) {
+        if (opacity !== this.opacity) {
+            if (this.map != null) {
+                this.map.events.triggerEvent("changelayer", {
+                    layer: this,
+                    property: "opacity"
+                });
+            }
+            this.opacity = opacity;
+        }
+        // Though this layer's opacity may not change, we're sharing a container
+        // and need to update the opacity for the entire container.
+        if (this.getVisibility()) {
+            var container = this.getMapContainer();
+            OpenLayers.Util.modifyDOMElement(
+                container, null, null, null, null, null, null, opacity
+            );
         }
     },
 
         }
     },
 
-    CLASS_NAME: "OpenLayers.Control.PinchZoom"
-
-});
-/* ======================================================================
-    OpenLayers/Control/TouchNavigation.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Control/DragPan.js
- * @requires OpenLayers/Control/PinchZoom.js
- * @requires OpenLayers/Handler/Click.js
- */
-
-/**
- * Class: OpenLayers.Control.TouchNavigation
- * The navigation control handles map browsing with touch events (dragging,
- *     double-tapping, tap with two fingers, and pinch zoom).  Create a new 
- *     control with the <OpenLayers.Control.TouchNavigation> constructor.
- *
- * If you’re only targeting touch enabled devices with your mapping application,
- *     you can create a map with only a TouchNavigation control. The 
- *     <OpenLayers.Control.Navigation> control is mobile ready by default, but 
- *     you can generate a smaller build of the library by only including this
- *     touch navigation control if you aren't concerned about mouse interaction.
- *
- * Inherits:
- *  - <OpenLayers.Control>
- */
-OpenLayers.Control.TouchNavigation = OpenLayers.Class(OpenLayers.Control, {
-
     /**
     /**
-     * Property: dragPan
-     * {<OpenLayers.Control.DragPan>}
+     * APIMethod: destroy
+     * Clean up this layer.
      */
      */
-    dragPan: null,
+    destroy: function() {
+        /**
+         * We have to override this method because the event pane destroy
+         * deletes the mapObject reference before removing this layer from
+         * the map.
+         */
+        if (this.map) {
+            this.setGMapVisibility(false);
+            var cache = OpenLayers.Layer.Google.cache[this.map.id];
+            if (cache && cache.count <= 1) {
+                this.removeGMapElements();
+            }
+        }
+        OpenLayers.Layer.EventPane.prototype.destroy.apply(this, arguments);
+    },
 
     /**
 
     /**
-     * APIProperty: dragPanOptions
-     * {Object} Options passed to the DragPan control.
+     * Method: removeGMapElements
+     * Remove all elements added to the dom.  This should only be called if
+     * this is the last of the Google layers for the given map.
      */
      */
-    dragPanOptions: null,
+    removeGMapElements: function() {
+        var cache = OpenLayers.Layer.Google.cache[this.map.id];
+        if (cache) {
+            // remove shared elements from dom
+            var container = this.mapObject && this.getMapContainer();
+            if (container && container.parentNode) {
+                container.parentNode.removeChild(container);
+            }
+            var termsOfUse = cache.termsOfUse;
+            if (termsOfUse && termsOfUse.parentNode) {
+                termsOfUse.parentNode.removeChild(termsOfUse);
+            }
+            var poweredBy = cache.poweredBy;
+            if (poweredBy && poweredBy.parentNode) {
+                poweredBy.parentNode.removeChild(poweredBy);
+            }
+            if (this.mapObject && window.google && google.maps &&
+                    google.maps.event && google.maps.event.clearListeners) {
+                google.maps.event.clearListeners(this.mapObject, 'tilesloaded');
+            }
+        }
+    },
 
     /**
 
     /**
-     * Property: pinchZoom
-     * {<OpenLayers.Control.PinchZoom>}
+     * APIMethod: removeMap
+     * On being removed from the map, also remove termsOfUse and poweredBy divs
+     *
+     * Parameters:
+     * map - {<OpenLayers.Map>}
      */
      */
-    pinchZoom: null,
+    removeMap: function(map) {
+        // hide layer before removing
+        if (this.visibility && this.mapObject) {
+            this.setGMapVisibility(false);
+        }
+        // check to see if last Google layer in this map
+        var cache = OpenLayers.Layer.Google.cache[map.id];
+        if (cache) {
+            if (cache.count <= 1) {
+                this.removeGMapElements();
+                delete OpenLayers.Layer.Google.cache[map.id];
+            } else {
+                // decrement the layer count
+                --cache.count;
+            }
+        }
+        // remove references to gmap elements
+        delete this.termsOfUse;
+        delete this.poweredBy;
+        delete this.mapObject;
+        delete this.dragObject;
+        OpenLayers.Layer.EventPane.prototype.removeMap.apply(this, arguments);
+    },
 
 
-    /**
-     * APIProperty: pinchZoomOptions
-     * {Object} Options passed to the PinchZoom control.
-     */
-    pinchZoomOptions: null,
+  //
+  // TRANSLATION: MapObject Bounds <-> OpenLayers.Bounds
+  //
 
     /**
 
     /**
-     * APIProperty: clickHandlerOptions
-     * {Object} Options passed to the Click handler.
+     * APIMethod: getOLBoundsFromMapObjectBounds
+     *
+     * Parameters:
+     * moBounds - {Object}
+     *
+     * Returns:
+     * {<OpenLayers.Bounds>} An <OpenLayers.Bounds>, translated from the
+     *                       passed-in MapObject Bounds.
+     *                       Returns null if null value is passed in.
      */
      */
-    clickHandlerOptions: null,
+    getOLBoundsFromMapObjectBounds: function(moBounds) {
+        var olBounds = null;
+        if (moBounds != null) {
+            var sw = moBounds.getSouthWest();
+            var ne = moBounds.getNorthEast();
+            if (this.sphericalMercator) {
+                sw = this.forwardMercator(sw.lng(), sw.lat());
+                ne = this.forwardMercator(ne.lng(), ne.lat());
+            } else {
+                sw = new OpenLayers.LonLat(sw.lng(), sw.lat());
+                ne = new OpenLayers.LonLat(ne.lng(), ne.lat());
+            }
+            olBounds = new OpenLayers.Bounds(sw.lon,
+                                             sw.lat,
+                                             ne.lon,
+                                             ne.lat );
+        }
+        return olBounds;
+    },
 
     /**
 
     /**
-     * APIProperty: documentDrag
-     * {Boolean} Allow panning of the map by dragging outside map viewport.
-     *     Default is false.
+     * APIMethod: getWarningHTML
+     *
+     * Returns:
+     * {String} String with information on why layer is broken, how to get
+     *          it working.
      */
      */
-    documentDrag: false,
+    getWarningHTML:function() {
+        return OpenLayers.i18n("googleWarning");
+    },
 
 
-    /**
-     * APIProperty: autoActivate
-     * {Boolean} Activate the control when it is added to a map.  Default is
-     *     true.
-     */
-    autoActivate: true,
+
+    /************************************
+     *                                  *
+     *   MapObject Interface Controls   *
+     *                                  *
+     ************************************/
+
+
+  // Get&Set Center, Zoom
 
     /**
 
     /**
-     * Constructor: OpenLayers.Control.TouchNavigation
-     * Create a new navigation control
+     * APIMethod: getMapObjectCenter
      *
      *
-     * Parameters:
-     * options - {Object} An optional object whose properties will be set on
-     *                    the control
+     * Returns:
+     * {Object} The mapObject's current center in Map Object format
      */
      */
-    initialize: function(options) {
-        this.handlers = {};
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
+    getMapObjectCenter: function() {
+        return this.mapObject.getCenter();
     },
 
     /**
     },
 
     /**
-     * Method: destroy
-     * The destroy method is used to perform any clean up before the control
-     * is dereferenced.  Typically this is where event listeners are removed
-     * to prevent memory leaks.
+     * APIMethod: getMapObjectZoom
+     *
+     * Returns:
+     * {Integer} The mapObject's current zoom, in Map Object format
      */
      */
-    destroy: function() {
-        this.deactivate();
-        if(this.dragPan) {
-            this.dragPan.destroy();
-        }
-        this.dragPan = null;
-        if (this.pinchZoom) {
-            this.pinchZoom.destroy();
-            delete this.pinchZoom;
-        }
-        OpenLayers.Control.prototype.destroy.apply(this,arguments);
+    getMapObjectZoom: function() {
+        return this.mapObject.getZoom();
     },
 
     },
 
-    /**
-     * Method: activate
-     */
-    activate: function() {
-        if(OpenLayers.Control.prototype.activate.apply(this,arguments)) {
-            this.dragPan.activate();
-            this.handlers.click.activate();
-            this.pinchZoom.activate();
-            return true;
-        }
-        return false;
-    },
+
+    /************************************
+     *                                  *
+     *       MapObject Primitives       *
+     *                                  *
+     ************************************/
+
+
+  // LonLat
 
     /**
 
     /**
-     * Method: deactivate
+     * APIMethod: getLongitudeFromMapObjectLonLat
+     *
+     * Parameters:
+     * moLonLat - {Object} MapObject LonLat format
+     *
+     * Returns:
+     * {Float} Longitude of the given MapObject LonLat
      */
      */
-    deactivate: function() {
-        if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)) {
-            this.dragPan.deactivate();
-            this.handlers.click.deactivate();
-            this.pinchZoom.deactivate();
-            return true;
-        }
-        return false;
+    getLongitudeFromMapObjectLonLat: function(moLonLat) {
+        return this.sphericalMercator ?
+          this.forwardMercator(moLonLat.lng(), moLonLat.lat()).lon :
+          moLonLat.lng();
     },
     },
-    
+
     /**
     /**
-     * Method: draw
+     * APIMethod: getLatitudeFromMapObjectLonLat
+     *
+     * Parameters:
+     * moLonLat - {Object} MapObject LonLat format
+     *
+     * Returns:
+     * {Float} Latitude of the given MapObject LonLat
      */
      */
-    draw: function() {
-        var clickCallbacks = {
-            click: this.defaultClick,
-            dblclick: this.defaultDblClick
-        };
-        var clickOptions = OpenLayers.Util.extend({
-            "double": true,
-            stopDouble: true,
-            pixelTolerance: 2
-        }, this.clickHandlerOptions);
-        this.handlers.click = new OpenLayers.Handler.Click(
-            this, clickCallbacks, clickOptions
-        );
-        this.dragPan = new OpenLayers.Control.DragPan(
-            OpenLayers.Util.extend({
-                map: this.map,
-                documentDrag: this.documentDrag
-            }, this.dragPanOptions)
-        );
-        this.dragPan.draw();
-        this.pinchZoom = new OpenLayers.Control.PinchZoom(
-            OpenLayers.Util.extend({map: this.map}, this.pinchZoomOptions)
-        );
+    getLatitudeFromMapObjectLonLat: function(moLonLat) {
+        var lat = this.sphericalMercator ?
+          this.forwardMercator(moLonLat.lng(), moLonLat.lat()).lat :
+          moLonLat.lat();
+        return lat;
     },
 
     },
 
+  // Pixel
+
     /**
     /**
-     * Method: defaultClick
+     * APIMethod: getXFromMapObjectPixel
      *
      * Parameters:
      *
      * Parameters:
-     * evt - {Event}
+     * moPixel - {Object} MapObject Pixel format
+     *
+     * Returns:
+     * {Integer} X value of the MapObject Pixel
      */
      */
-    defaultClick: function (evt) {
-        if(evt.lastTouches && evt.lastTouches.length == 2) {
-            this.map.zoomOut();
-        }
+    getXFromMapObjectPixel: function(moPixel) {
+        return moPixel.x;
     },
 
     /**
     },
 
     /**
-     * Method: defaultDblClick
+     * APIMethod: getYFromMapObjectPixel
      *
      * Parameters:
      *
      * Parameters:
-     * evt - {Event}
+     * moPixel - {Object} MapObject Pixel format
+     *
+     * Returns:
+     * {Integer} Y value of the MapObject Pixel
      */
      */
-    defaultDblClick: function (evt) {
-        this.map.zoomTo(this.map.zoom + 1, evt.xy);
+    getYFromMapObjectPixel: function(moPixel) {
+        return moPixel.y;
     },
 
     },
 
-    CLASS_NAME: "OpenLayers.Control.TouchNavigation"
+    CLASS_NAME: "OpenLayers.Layer.Google"
 });
 });
+
+/**
+ * Property: OpenLayers.Layer.Google.cache
+ * {Object} Cache for elements that should only be created once per map.
+ */
+OpenLayers.Layer.Google.cache = {};
 /* ======================================================================
 /* ======================================================================
-    OpenLayers/Renderer/VML.js
+    OpenLayers/Layer/Google/v3.js
    ====================================================================== */
 
    ====================================================================== */
 
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
  * full list of contributors). Published under the 2-clause BSD license.
  * See license.txt in the OpenLayers distribution or repository for the
  * full text of the license. */
 
+
 /**
 /**
- * @requires OpenLayers/Renderer/Elements.js
+ * @requires OpenLayers/Layer/Google.js
+ */
+
+/**
+ * Constant: OpenLayers.Layer.Google.v3
+ *
+ * Mixin providing functionality specific to the Google Maps API v3.
+ *
+ * To use this layer, you must include the GMaps v3 API in your html. To match
+ * Google's zoom animation better with OpenLayers animated zooming, configure
+ * your map with a zoomDuration of 10:
+ *
+ * (code)
+ * new OpenLayers.Map('map', {zoomDuration: 10});
+ * (end)
+ *
+ * Note that this layer configures the google.maps.map object with the
+ * "disableDefaultUI" option set to true. Using UI controls that the Google
+ * Maps API provides is not supported by the OpenLayers API.
  */
  */
+OpenLayers.Layer.Google.v3 = {
+
+    /**
+     * Constant: DEFAULTS
+     * {Object} It is not recommended to change the properties set here. Note
+     * that Google.v3 layers only work when sphericalMercator is set to true.
+     *
+     * (code)
+     * {
+     *     sphericalMercator: true,
+     *     projection: "EPSG:900913"
+     * }
+     * (end)
+     */
+    DEFAULTS: {
+        sphericalMercator: true,
+        projection: "EPSG:900913"
+    },
+
+    /**
+     * APIProperty: animationEnabled
+     * {Boolean} If set to true, the transition between zoom levels will be
+     *     animated (if supported by the GMaps API for the device used). Set to
+     *     false to match the zooming experience of other layer types. Default
+     *     is true. Note that the GMaps API does not give us control over zoom
+     *     animation, so if set to false, when zooming, this will make the
+     *     layer temporarily invisible, wait until GMaps reports the map being
+     *     idle, and make it visible again. The result will be a blank layer
+     *     for a few moments while zooming.
+     */
+    animationEnabled: true,
+
+    /**
+     * Method: loadMapObject
+     * Load the GMap and register appropriate event listeners.
+     */
+    loadMapObject: function() {
+        if (!this.type) {
+            this.type = google.maps.MapTypeId.ROADMAP;
+        }
+        var mapObject;
+        var cache = OpenLayers.Layer.Google.cache[this.map.id];
+        if (cache) {
+            // there are already Google layers added to this map
+            mapObject = cache.mapObject;
+            // increment the layer count
+            ++cache.count;
+        } else {
+            // this is the first Google layer for this map
+            // create GMap
+            var center = this.map.getCenter();
+            var container = document.createElement('div');
+            container.className = "olForeignContainer";
+            container.style.width = '100%';
+            container.style.height = '100%';
+            mapObject = new google.maps.Map(container, {
+                center: center ?
+                    new google.maps.LatLng(center.lat, center.lon) :
+                    new google.maps.LatLng(0, 0),
+                zoom: this.map.getZoom() || 0,
+                mapTypeId: this.type,
+                disableDefaultUI: true,
+                keyboardShortcuts: false,
+                draggable: false,
+                disableDoubleClickZoom: true,
+                scrollwheel: false,
+                streetViewControl: false,
+                tilt: (this.useTiltImages ? 45: 0)
+            });
+            var googleControl = document.createElement('div');
+            googleControl.style.width = '100%';
+            googleControl.style.height = '100%';
+            mapObject.controls[google.maps.ControlPosition.TOP_LEFT].push(googleControl);
 
 
-/**
- * Class: OpenLayers.Renderer.VML
- * Render vector features in browsers with VML capability.  Construct a new
- * VML renderer with the <OpenLayers.Renderer.VML> constructor.
- * 
- * Note that for all calculations in this class, we use (num | 0) to truncate a 
- * float value to an integer. This is done because it seems that VML doesn't 
- * support float values.
- *
- * Inherits from:
- *  - <OpenLayers.Renderer.Elements>
- */
-OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
+            // cache elements for use by any other google layers added to
+            // this same map
+            cache = {
+                googleControl: googleControl,
+                mapObject: mapObject,
+                count: 1
+            };
+            OpenLayers.Layer.Google.cache[this.map.id] = cache;
+        }
+        this.mapObject = mapObject;
+        this.setGMapVisibility(this.visibility);
+    },
 
     /**
 
     /**
-     * Property: xmlns
-     * {String} XML Namespace URN
-     */
-    xmlns: "urn:schemas-microsoft-com:vml",
-    
-    /**
-     * Property: symbolCache
-     * {DOMElement} node holding symbols. This hash is keyed by symbol name,
-     *     and each value is a hash with a "path" and an "extent" property.
+     * APIMethod: onMapResize
      */
      */
-    symbolCache: {},
+    onMapResize: function() {
+        if (this.visibility) {
+            google.maps.event.trigger(this.mapObject, "resize");
+        }
+    },
 
     /**
 
     /**
-     * Property: offset
-     * {Object} Hash with "x" and "y" properties
-     */
-    offset: null,
-    
-    /**
-     * Constructor: OpenLayers.Renderer.VML
-     * Create a new VML renderer.
+     * Method: setGMapVisibility
+     * Display the GMap container and associated elements.
      *
      * Parameters:
      *
      * Parameters:
-     * containerID - {String} The id for the element that contains the renderer
+     * visible - {Boolean} Display the GMap elements.
      */
      */
-    initialize: function(containerID) {
-        if (!this.supported()) { 
-            return; 
-        }
-        if (!document.namespaces.olv) {
-            document.namespaces.add("olv", this.xmlns);
-            var style = document.createStyleSheet();
-            var shapes = ['shape','rect', 'oval', 'fill', 'stroke', 'imagedata', 'group','textbox']; 
-            for (var i = 0, len = shapes.length; i < len; i++) {
-
-                style.addRule('olv\\:' + shapes[i], "behavior: url(#default#VML); " +
-                              "position: absolute; display: inline-block;");
-            }                  
+    setGMapVisibility: function(visible) {
+        var cache = OpenLayers.Layer.Google.cache[this.map.id];
+        var map = this.map;
+        if (cache) {
+            var type = this.type;
+            var layers = map.layers;
+            var layer;
+            for (var i=layers.length-1; i>=0; --i) {
+                layer = layers[i];
+                if (layer instanceof OpenLayers.Layer.Google &&
+                            layer.visibility === true && layer.inRange === true) {
+                    type = layer.type;
+                    visible = true;
+                    break;
+                }
+            }
+            var container = this.mapObject.getDiv();
+            if (visible === true) {
+                if (container.parentNode !== map.div) {
+                    if (!cache.rendered) {
+                        container.style.visibility = 'hidden';
+                        var me = this;
+                        google.maps.event.addListenerOnce(this.mapObject, 'tilesloaded', function() {
+                            cache.rendered = true;
+                            container.style.visibility = '';
+                            me.setGMapVisibility(true);
+                            me.moveTo(me.map.getCenter());
+                            cache.googleControl.appendChild(map.viewPortDiv);
+                            me.setGMapVisibility(me.visible);
+                        });
+                    } else {
+                        cache.googleControl.appendChild(map.viewPortDiv);
+                    }
+                    map.div.appendChild(container);
+                    google.maps.event.trigger(this.mapObject, 'resize');
+                }
+                this.mapObject.setMapTypeId(type);
+            } else if (cache.googleControl.hasChildNodes()) {
+                map.div.appendChild(map.viewPortDiv);
+                if (map.div.contains(container)) {
+                    map.div.removeChild(container);
+                }
+            }
         }
         }
-        
-        OpenLayers.Renderer.Elements.prototype.initialize.apply(this, 
-                                                                arguments);
     },
 
     /**
     },
 
     /**
-     * APIMethod: supported
-     * Determine whether a browser supports this renderer.
+     * Method: getMapContainer
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} The browser supports the VML renderer
+     * {DOMElement} the GMap container's div
      */
      */
-    supported: function() {
-        return !!(document.namespaces);
-    },    
+    getMapContainer: function() {
+        return this.mapObject.getDiv();
+    },
+
+  //
+  // TRANSLATION: MapObject Bounds <-> OpenLayers.Bounds
+  //
 
     /**
 
     /**
-     * Method: setExtent
-     * Set the renderer's extent
+     * APIMethod: getMapObjectBoundsFromOLBounds
      *
      * Parameters:
      *
      * Parameters:
-     * extent - {<OpenLayers.Bounds>}
-     * resolutionChanged - {Boolean}
-     * 
+     * olBounds - {<OpenLayers.Bounds>}
+     *
      * Returns:
      * Returns:
-     * {Boolean} true to notify the layer that the new extent does not exceed
-     *     the coordinate range, and the features will not need to be redrawn.
+     * {Object} A MapObject Bounds, translated from olBounds
+     *          Returns null if null value is passed in
      */
      */
-    setExtent: function(extent, resolutionChanged) {
-        var coordSysUnchanged = OpenLayers.Renderer.Elements.prototype.setExtent.apply(this, arguments);
-        var resolution = this.getResolution();
-    
-        var left = (extent.left/resolution) | 0;
-        var top = (extent.top/resolution - this.size.h) | 0;
-        if (resolutionChanged || !this.offset) {
-            this.offset = {x: left, y: top};
-            left = 0;
-            top = 0;
-        } else {
-            left = left - this.offset.x;
-            top = top - this.offset.y;
+    getMapObjectBoundsFromOLBounds: function(olBounds) {
+        var moBounds = null;
+        if (olBounds != null) {
+            var sw = this.sphericalMercator ?
+              this.inverseMercator(olBounds.bottom, olBounds.left) :
+              new OpenLayers.LonLat(olBounds.bottom, olBounds.left);
+            var ne = this.sphericalMercator ?
+              this.inverseMercator(olBounds.top, olBounds.right) :
+              new OpenLayers.LonLat(olBounds.top, olBounds.right);
+            moBounds = new google.maps.LatLngBounds(
+                new google.maps.LatLng(sw.lat, sw.lon),
+                new google.maps.LatLng(ne.lat, ne.lon)
+            );
         }
         }
+        return moBounds;
+    },
 
 
-        
-        var org = (left - this.xOffset) + " " + top;
-        this.root.coordorigin = org;
-        var roots = [this.root, this.vectorRoot, this.textRoot];
-        var root;
-        for(var i=0, len=roots.length; i<len; ++i) {
-            root = roots[i];
 
 
-            var size = this.size.w + " " + this.size.h;
-            root.coordsize = size;
-            
-        }
-        // flip the VML display Y axis upside down so it 
-        // matches the display Y axis of the map
-        this.root.style.flip = "y";
-        
-        return coordSysUnchanged;
-    },
+    /************************************
+     *                                  *
+     *   MapObject Interface Controls   *
+     *                                  *
+     ************************************/
 
 
 
 
-    /**
-     * Method: setSize
-     * Set the size of the drawing surface
-     *
-     * Parameters:
-     * size - {<OpenLayers.Size>} the size of the drawing surface
-     */
-    setSize: function(size) {
-        OpenLayers.Renderer.prototype.setSize.apply(this, arguments);
-        
-        // setting width and height on all roots to avoid flicker which we
-        // would get with 100% width and height on child roots
-        var roots = [
-            this.rendererRoot,
-            this.root,
-            this.vectorRoot,
-            this.textRoot
-        ];
-        var w = this.size.w + "px";
-        var h = this.size.h + "px";
-        var root;
-        for(var i=0, len=roots.length; i<len; ++i) {
-            root = roots[i];
-            root.style.width = w;
-            root.style.height = h;
-        }
-    },
+  // LonLat - Pixel Translation
 
     /**
 
     /**
-     * Method: getNodeType
-     * Get the node type for a geometry and style
+     * APIMethod: getMapObjectLonLatFromMapObjectPixel
      *
      * Parameters:
      *
      * Parameters:
-     * geometry - {<OpenLayers.Geometry>}
-     * style - {Object}
+     * moPixel - {Object} MapObject Pixel format
      *
      * Returns:
      *
      * Returns:
-     * {String} The corresponding node type for the specified geometry
+     * {Object} MapObject LonLat translated from MapObject Pixel
      */
      */
-    getNodeType: function(geometry, style) {
-        var nodeType = null;
-        switch (geometry.CLASS_NAME) {
-            case "OpenLayers.Geometry.Point":
-                if (style.externalGraphic) {
-                    nodeType = "olv:rect";
-                } else if (this.isComplexSymbol(style.graphicName)) {
-                    nodeType = "olv:shape";
-                } else {
-                    nodeType = "olv:oval";
-                }
-                break;
-            case "OpenLayers.Geometry.Rectangle":
-                nodeType = "olv:rect";
-                break;
-            case "OpenLayers.Geometry.LineString":
-            case "OpenLayers.Geometry.LinearRing":
-            case "OpenLayers.Geometry.Polygon":
-            case "OpenLayers.Geometry.Curve":
-                nodeType = "olv:shape";
-                break;
-            default:
-                break;
+    getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
+        var size = this.map.getSize();
+        var lon = this.getLongitudeFromMapObjectLonLat(this.mapObject.center);
+        var lat = this.getLatitudeFromMapObjectLonLat(this.mapObject.center);
+        var res = this.map.getResolution();
+
+        var delta_x = moPixel.x - (size.w / 2);
+        var delta_y = moPixel.y - (size.h / 2);
+
+        var lonlat = new OpenLayers.LonLat(
+            lon + delta_x * res,
+            lat - delta_y * res
+        );
+
+        if (this.wrapDateLine) {
+            lonlat = lonlat.wrapDateLine(this.maxExtent);
         }
         }
-        return nodeType;
+        return this.getMapObjectLonLatFromLonLat(lonlat.lon, lonlat.lat);
     },
 
     /**
     },
 
     /**
-     * Method: setStyle
-     * Use to set all the style attributes to a VML node.
+     * APIMethod: getMapObjectPixelFromMapObjectLonLat
      *
      * Parameters:
      *
      * Parameters:
-     * node - {DOMElement} An VML element to decorate
-     * style - {Object}
-     * options - {Object} Currently supported options include 
-     *                              'isFilled' {Boolean} and
-     *                              'isStroked' {Boolean}
-     * geometry - {<OpenLayers.Geometry>}
+     * moLonLat - {Object} MapObject LonLat format
+     *
+     * Returns:
+     * {Object} MapObject Pixel transtlated from MapObject LonLat
      */
      */
-    setStyle: function(node, style, options, geometry) {
-        style = style  || node._style;
-        options = options || node._options;
-        var fillColor = style.fillColor;
-
-        var title = style.title || style.graphicTitle;
-        if (title) {
-            node.title = title;
-        } 
-
-        if (node._geometryClass === "OpenLayers.Geometry.Point") {
-            if (style.externalGraphic) {
-                options.isFilled = true;
-                var width = style.graphicWidth || style.graphicHeight;
-                var height = style.graphicHeight || style.graphicWidth;
-                width = width ? width : style.pointRadius*2;
-                height = height ? height : style.pointRadius*2;
-
-                var resolution = this.getResolution();
-                var xOffset = (style.graphicXOffset != undefined) ?
-                    style.graphicXOffset : -(0.5 * width);
-                var yOffset = (style.graphicYOffset != undefined) ?
-                    style.graphicYOffset : -(0.5 * height);
-                
-                node.style.left = ((((geometry.x - this.featureDx)/resolution - this.offset.x)+xOffset) | 0) + "px";
-                node.style.top = (((geometry.y/resolution - this.offset.y)-(yOffset+height)) | 0) + "px";
-                node.style.width = width + "px";
-                node.style.height = height + "px";
-                node.style.flip = "y";
-                
-                // modify fillColor and options for stroke styling below
-                fillColor = "none";
-                options.isStroked = false;
-            } else if (this.isComplexSymbol(style.graphicName)) {
-                var cache = this.importSymbol(style.graphicName);
-                node.path = cache.path;
-                node.coordorigin = cache.left + "," + cache.bottom;
-                var size = cache.size;
-                node.coordsize = size + "," + size;        
-                this.drawCircle(node, geometry, style.pointRadius);
-                node.style.flip = "y";
-            } else {
-                this.drawCircle(node, geometry, style.pointRadius);
-            }
-        }
-
-        // fill 
-        if (options.isFilled) { 
-            node.fillcolor = fillColor; 
-        } else { 
-            node.filled = "false"; 
-        }
-        var fills = node.getElementsByTagName("fill");
-        var fill = (fills.length == 0) ? null : fills[0];
-        if (!options.isFilled) {
-            if (fill) {
-                node.removeChild(fill);
-            }
-        } else {
-            if (!fill) {
-                fill = this.createNode('olv:fill', node.id + "_fill");
-            }
-            fill.opacity = style.fillOpacity;
-
-            if (node._geometryClass === "OpenLayers.Geometry.Point" &&
-                    style.externalGraphic) {
-
-                // override fillOpacity
-                if (style.graphicOpacity) {
-                    fill.opacity = style.graphicOpacity;
-                }
-                
-                fill.src = style.externalGraphic;
-                fill.type = "frame";
-                
-                if (!(style.graphicWidth && style.graphicHeight)) {
-                  fill.aspect = "atmost";
-                }                
-            }
-            if (fill.parentNode != node) {
-                node.appendChild(fill);
-            }
-        }
-
-        // additional rendering for rotated graphics or symbols
-        var rotation = style.rotation;
-        if ((rotation !== undefined || node._rotation !== undefined)) {
-            node._rotation = rotation;
-            if (style.externalGraphic) {
-                this.graphicRotate(node, xOffset, yOffset, style);
-                // make the fill fully transparent, because we now have
-                // the graphic as imagedata element. We cannot just remove
-                // the fill, because this is part of the hack described
-                // in graphicRotate
-                fill.opacity = 0;
-            } else if(node._geometryClass === "OpenLayers.Geometry.Point") {
-                node.style.rotation = rotation || 0;
-            }
-        }
-
-        // stroke 
-        var strokes = node.getElementsByTagName("stroke");
-        var stroke = (strokes.length == 0) ? null : strokes[0];
-        if (!options.isStroked) {
-            node.stroked = false;
-            if (stroke) {
-                stroke.on = false;
-            }
-        } else {
-            if (!stroke) {
-                stroke = this.createNode('olv:stroke', node.id + "_stroke");
-                node.appendChild(stroke);
-            }
-            stroke.on = true;
-            stroke.color = style.strokeColor; 
-            stroke.weight = style.strokeWidth + "px"; 
-            stroke.opacity = style.strokeOpacity;
-            stroke.endcap = style.strokeLinecap == 'butt' ? 'flat' :
-                (style.strokeLinecap || 'round');
-            if (style.strokeDashstyle) {
-                stroke.dashstyle = this.dashStyle(style);
-            }
-        }
-        
-        if (style.cursor != "inherit" && style.cursor != null) {
-            node.style.cursor = style.cursor;
-        }
-        return node;
+    getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
+        var lon = this.getLongitudeFromMapObjectLonLat(moLonLat);
+        var lat = this.getLatitudeFromMapObjectLonLat(moLonLat);
+        var res = this.map.getResolution();
+        var extent = this.map.getExtent();
+        return this.getMapObjectPixelFromXY((1/res * (lon - extent.left)),
+                                            (1/res * (extent.top - lat)));
     },
 
     },
 
+
     /**
     /**
-     * Method: graphicRotate
-     * If a point is to be styled with externalGraphic and rotation, VML fills
-     * cannot be used to display the graphic, because rotation of graphic
-     * fills is not supported by the VML implementation of Internet Explorer.
-     * This method creates a olv:imagedata element inside the VML node,
-     * DXImageTransform.Matrix and BasicImage filters for rotation and
-     * opacity, and a 3-step hack to remove rendering artefacts from the
-     * graphic and preserve the ability of graphics to trigger events.
-     * Finally, OpenLayers methods are used to determine the correct
-     * insertion point of the rotated image, because DXImageTransform.Matrix
-     * does the rotation without the ability to specify a rotation center
-     * point.
-     * 
+     * APIMethod: setMapObjectCenter
+     * Set the mapObject to the specified center and zoom
+     *
      * Parameters:
      * Parameters:
-     * node    - {DOMElement}
-     * xOffset - {Number} rotation center relative to image, x coordinate
-     * yOffset - {Number} rotation center relative to image, y coordinate
-     * style   - {Object}
+     * center - {Object} MapObject LonLat format
+     * zoom - {int} MapObject zoom format
      */
      */
-    graphicRotate: function(node, xOffset, yOffset, style) {
-        var style = style || node._style;
-        var rotation = style.rotation || 0;
-        
-        var aspectRatio, size;
-        if (!(style.graphicWidth && style.graphicHeight)) {
-            // load the image to determine its size
-            var img = new Image();
-            img.onreadystatechange = OpenLayers.Function.bind(function() {
-                if(img.readyState == "complete" ||
-                        img.readyState == "interactive") {
-                    aspectRatio = img.width / img.height;
-                    size = Math.max(style.pointRadius * 2, 
-                        style.graphicWidth || 0,
-                        style.graphicHeight || 0);
-                    xOffset = xOffset * aspectRatio;
-                    style.graphicWidth = size * aspectRatio;
-                    style.graphicHeight = size;
-                    this.graphicRotate(node, xOffset, yOffset, style);
+    setMapObjectCenter: function(center, zoom) {
+        if (this.animationEnabled === false && zoom != this.mapObject.zoom) {
+            var mapContainer = this.getMapContainer();
+            google.maps.event.addListenerOnce(
+                this.mapObject,
+                "idle",
+                function() {
+                    mapContainer.style.visibility = "";
                 }
                 }
-            }, this);
-            img.src = style.externalGraphic;
-            
-            // will be called again by the onreadystate handler
-            return;
-        } else {
-            size = Math.max(style.graphicWidth, style.graphicHeight);
-            aspectRatio = style.graphicWidth / style.graphicHeight;
-        }
-        
-        var width = Math.round(style.graphicWidth || size * aspectRatio);
-        var height = Math.round(style.graphicHeight || size);
-        node.style.width = width + "px";
-        node.style.height = height + "px";
-        
-        // Three steps are required to remove artefacts for images with
-        // transparent backgrounds (resulting from using DXImageTransform
-        // filters on svg objects), while preserving awareness for browser
-        // events on images:
-        // - Use the fill as usual (like for unrotated images) to handle
-        //   events
-        // - specify an imagedata element with the same src as the fill
-        // - style the imagedata element with an AlphaImageLoader filter
-        //   with empty src
-        var image = document.getElementById(node.id + "_image");
-        if (!image) {
-            image = this.createNode("olv:imagedata", node.id + "_image");
-            node.appendChild(image);
-        }
-        image.style.width = width + "px";
-        image.style.height = height + "px";
-        image.src = style.externalGraphic;
-        image.style.filter =
-            "progid:DXImageTransform.Microsoft.AlphaImageLoader(" + 
-            "src='', sizingMethod='scale')";
-
-        var rot = rotation * Math.PI / 180;
-        var sintheta = Math.sin(rot);
-        var costheta = Math.cos(rot);
-
-        // do the rotation on the image
-        var filter =
-            "progid:DXImageTransform.Microsoft.Matrix(M11=" + costheta +
-            ",M12=" + (-sintheta) + ",M21=" + sintheta + ",M22=" + costheta +
-            ",SizingMethod='auto expand')\n";
-
-        // set the opacity (needed for the imagedata)
-        var opacity = style.graphicOpacity || style.fillOpacity;
-        if (opacity && opacity != 1) {
-            filter += 
-                "progid:DXImageTransform.Microsoft.BasicImage(opacity=" + 
-                opacity+")\n";
+            );
+            mapContainer.style.visibility = "hidden";
         }
         }
-        node.style.filter = filter;
+        this.mapObject.setOptions({
+            center: center,
+            zoom: zoom
+        });
+    },
 
 
-        // do the rotation again on a box, so we know the insertion point
-        var centerPoint = new OpenLayers.Geometry.Point(-xOffset, -yOffset);
-        var imgBox = new OpenLayers.Bounds(0, 0, width, height).toGeometry();
-        imgBox.rotate(style.rotation, centerPoint);
-        var imgBounds = imgBox.getBounds();
 
 
-        node.style.left = Math.round(
-            parseInt(node.style.left) + imgBounds.left) + "px";
-        node.style.top = Math.round(
-            parseInt(node.style.top) - imgBounds.bottom) + "px";
+  // Bounds
+
+    /**
+     * APIMethod: getMapObjectZoomFromMapObjectBounds
+     *
+     * Parameters:
+     * moBounds - {Object} MapObject Bounds format
+     *
+     * Returns:
+     * {Object} MapObject Zoom for specified MapObject Bounds
+     */
+    getMapObjectZoomFromMapObjectBounds: function(moBounds) {
+        return this.mapObject.getBoundsZoomLevel(moBounds);
     },
 
     },
 
+    /************************************
+     *                                  *
+     *       MapObject Primitives       *
+     *                                  *
+     ************************************/
+
+
+  // LonLat
+
     /**
     /**
-     * Method: postDraw
-     * Does some node postprocessing to work around browser issues:
-     * - Some versions of Internet Explorer seem to be unable to set fillcolor
-     *   and strokecolor to "none" correctly before the fill node is appended
-     *   to a visible vml node. This method takes care of that and sets
-     *   fillcolor and strokecolor again if needed.
-     * - In some cases, a node won't become visible after being drawn. Setting
-     *   style.visibility to "visible" works around that.
-     * 
+     * APIMethod: getMapObjectLonLatFromLonLat
+     *
      * Parameters:
      * Parameters:
-     * node - {DOMElement}
+     * lon - {Float}
+     * lat - {Float}
+     *
+     * Returns:
+     * {Object} MapObject LonLat built from lon and lat params
      */
      */
-    postDraw: function(node) {
-        node.style.visibility = "visible";
-        var fillColor = node._style.fillColor;
-        var strokeColor = node._style.strokeColor;
-        if (fillColor == "none" &&
-                node.fillcolor != fillColor) {
-            node.fillcolor = fillColor;
-        }
-        if (strokeColor == "none" &&
-                node.strokecolor != strokeColor) {
-            node.strokecolor = strokeColor;
+    getMapObjectLonLatFromLonLat: function(lon, lat) {
+        var gLatLng;
+        if(this.sphericalMercator) {
+            var lonlat = this.inverseMercator(lon, lat);
+            gLatLng = new google.maps.LatLng(lonlat.lat, lonlat.lon);
+        } else {
+            gLatLng = new google.maps.LatLng(lat, lon);
         }
         }
+        return gLatLng;
     },
 
     },
 
+  // Pixel
 
     /**
 
     /**
-     * Method: setNodeDimension
-     * Get the geometry's bounds, convert it to our vml coordinate system, 
-     * then set the node's position, size, and local coordinate system.
-     *   
+     * APIMethod: getMapObjectPixelFromXY
+     *
      * Parameters:
      * Parameters:
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
+     * x - {Integer}
+     * y - {Integer}
+     *
+     * Returns:
+     * {Object} MapObject Pixel from x and y parameters
      */
      */
-    setNodeDimension: function(node, geometry) {
+    getMapObjectPixelFromXY: function(x, y) {
+        return new google.maps.Point(x, y);
+    }
 
 
-        var bbox = geometry.getBounds();
-        if(bbox) {
-            var resolution = this.getResolution();
-        
-            var scaledBox = 
-                new OpenLayers.Bounds(((bbox.left - this.featureDx)/resolution - this.offset.x) | 0,
-                                      (bbox.bottom/resolution - this.offset.y) | 0,
-                                      ((bbox.right - this.featureDx)/resolution - this.offset.x) | 0,
-                                      (bbox.top/resolution - this.offset.y) | 0);
-            
-            // Set the internal coordinate system to draw the path
-            node.style.left = scaledBox.left + "px";
-            node.style.top = scaledBox.top + "px";
-            node.style.width = scaledBox.getWidth() + "px";
-            node.style.height = scaledBox.getHeight() + "px";
+};
+/* ======================================================================
+    OpenLayers/Strategy.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/BaseTypes/Class.js
+ */
+
+/**
+ * Class: OpenLayers.Strategy
+ * Abstract vector layer strategy class.  Not to be instantiated directly.  Use
+ *     one of the strategy subclasses instead.
+ */
+OpenLayers.Strategy = OpenLayers.Class({
     
     
-            node.coordorigin = scaledBox.left + " " + scaledBox.top;
-            node.coordsize = scaledBox.getWidth()+ " " + scaledBox.getHeight();
-        }
-    },
+    /**
+     * Property: layer
+     * {<OpenLayers.Layer.Vector>} The layer this strategy belongs to.
+     */
+    layer: null,
     
     
+    /**
+     * Property: options
+     * {Object} Any options sent to the constructor.
+     */
+    options: null,
+
     /** 
     /** 
-     * Method: dashStyle
-     * 
+     * Property: active 
+     * {Boolean} The control is active.
+     */
+    active: null,
+
+    /**
+     * Property: autoActivate
+     * {Boolean} The creator of the strategy can set autoActivate to false
+     *      to fully control when the protocol is activated and deactivated.
+     *      Defaults to true.
+     */
+    autoActivate: true,
+
+    /**
+     * Property: autoDestroy
+     * {Boolean} The creator of the strategy can set autoDestroy to false
+     *      to fully control when the strategy is destroyed. Defaults to
+     *      true.
+     */
+    autoDestroy: true,
+
+    /**
+     * Constructor: OpenLayers.Strategy
+     * Abstract class for vector strategies.  Create instances of a subclass.
+     *
      * Parameters:
      * Parameters:
-     * style - {Object}
-     * 
-     * Returns:
-     * {String} A VML compliant 'stroke-dasharray' value
+     * options - {Object} Optional object whose properties will be set on the
+     *     instance.
      */
      */
-    dashStyle: function(style) {
-        var dash = style.strokeDashstyle;
-        switch (dash) {
-            case 'solid':
-            case 'dot':
-            case 'dash':
-            case 'dashdot':
-            case 'longdash':
-            case 'longdashdot':
-                return dash;
-            default:
-                // very basic guessing of dash style patterns
-                var parts = dash.split(/[ ,]/);
-                if (parts.length == 2) {
-                    if (1*parts[0] >= 2*parts[1]) {
-                        return "longdash";
-                    }
-                    return (parts[0] == 1 || parts[1] == 1) ? "dot" : "dash";
-                } else if (parts.length == 4) {
-                    return (1*parts[0] >= 2*parts[1]) ? "longdashdot" :
-                        "dashdot";
-                }
-                return "solid";
-        }
+    initialize: function(options) {
+        OpenLayers.Util.extend(this, options);
+        this.options = options;
+        // set the active property here, so that user cannot override it
+        this.active = false;
+    },
+    
+    /**
+     * APIMethod: destroy
+     * Clean up the strategy.
+     */
+    destroy: function() {
+        this.deactivate();
+        this.layer = null;
+        this.options = null;
     },
 
     /**
     },
 
     /**
-     * Method: createNode
-     * Create a new node
+     * Method: setLayer
+     * Called to set the <layer> property.
      *
      * Parameters:
      *
      * Parameters:
-     * type - {String} Kind of node to draw
-     * id - {String} Id for node
+     * layer - {<OpenLayers.Layer.Vector>}
+     */
+    setLayer: function(layer) {
+        this.layer = layer;
+    },
+    
+    /**
+     * Method: activate
+     * Activate the strategy.  Register any listeners, do appropriate setup.
      *
      * Returns:
      *
      * Returns:
-     * {DOMElement} A new node of the given type and id
+     * {Boolean} True if the strategy was successfully activated or false if
+     *      the strategy was already active.
      */
      */
-    createNode: function(type, id) {
-        var node = document.createElement(type);
-        if (id) {
-            node.id = id;
+    activate: function() {
+        if (!this.active) {
+            this.active = true;
+            return true;
         }
         }
-        
-        // IE hack to make elements unselectable, to prevent 'blue flash'
-        // while dragging vectors; #1410
-        node.unselectable = 'on';
-        node.onselectstart = OpenLayers.Function.False;
-        
-        return node;    
+        return false;
     },
     
     /**
     },
     
     /**
-     * Method: nodeTypeCompare
-     * Determine whether a node is of a given type
-     *
-     * Parameters:
-     * node - {DOMElement} An VML element
-     * type - {String} Kind of node
+     * Method: deactivate
+     * Deactivate the strategy.  Unregister any listeners, do appropriate
+     *     tear-down.
      *
      * Returns:
      *
      * Returns:
-     * {Boolean} Whether or not the specified node is of the specified type
+     * {Boolean} True if the strategy was successfully deactivated or false if
+     *      the strategy was already inactive.
      */
      */
-    nodeTypeCompare: function(node, type) {
-
-        //split type
-        var subType = type;
-        var splitIndex = subType.indexOf(":");
-        if (splitIndex != -1) {
-            subType = subType.substr(splitIndex+1);
+    deactivate: function() {
+        if (this.active) {
+            this.active = false;
+            return true;
         }
         }
+        return false;
+    },
+   
+    CLASS_NAME: "OpenLayers.Strategy" 
+});
+/* ======================================================================
+    OpenLayers/Strategy/Filter.js
+   ====================================================================== */
 
 
-        //split nodeName
-        var nodeName = node.nodeName;
-        splitIndex = nodeName.indexOf(":");
-        if (splitIndex != -1) {
-            nodeName = nodeName.substr(splitIndex+1);
-        }
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
 
 
-        return (subType == nodeName);
-    },
+/**
+ * @requires OpenLayers/Strategy.js
+ * @requires OpenLayers/Filter.js
+ */
 
 
+/**
+ * Class: OpenLayers.Strategy.Filter
+ * Strategy for limiting features that get added to a layer by 
+ *     evaluating a filter.  The strategy maintains a cache of
+ *     all features until removeFeatures is called on the layer.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Strategy>
+ */
+OpenLayers.Strategy.Filter = OpenLayers.Class(OpenLayers.Strategy, {
+    
     /**
     /**
-     * Method: createRenderRoot
-     * Create the renderer root
+     * APIProperty: filter
+     * {<OpenLayers.Filter>}  Filter for limiting features sent to the layer.
+     *     Use the <setFilter> method to update this filter after construction.
+     */
+    filter: null,
+    
+    /**
+     * Property: cache
+     * {Array(<OpenLayers.Feature.Vector>)} List of currently cached
+     *     features.
+     */
+    cache: null,
+    
+    /**
+     * Property: caching
+     * {Boolean} The filter is currently caching features.
+     */
+    caching: false,
+    
+    /**
+     * Constructor: OpenLayers.Strategy.Filter
+     * Create a new filter strategy.
+     *
+     * Parameters:
+     * options - {Object} Optional object whose properties will be set on the
+     *     instance.
+     */
+
+    /**
+     * APIMethod: activate
+     * Activate the strategy.  Register any listeners, do appropriate setup.
+     *     By default, this strategy automatically activates itself when a layer
+     *     is added to a map.
      *
      * Returns:
      *
      * Returns:
-     * {DOMElement} The specific render engine's root element
+     * {Boolean} True if the strategy was successfully activated or false if
+     *      the strategy was already active.
      */
      */
-    createRenderRoot: function() {
-        return this.nodeFactory(this.container.id + "_vmlRoot", "div");
+    activate: function() {
+        var activated = OpenLayers.Strategy.prototype.activate.apply(this, arguments);
+        if (activated) {
+            this.cache = [];
+            this.layer.events.on({
+                "beforefeaturesadded": this.handleAdd,
+                "beforefeaturesremoved": this.handleRemove,
+                scope: this
+            });
+        }
+        return activated;
     },
     },
-
+    
     /**
     /**
-     * Method: createRoot
-     * Create the main root element
-     * 
-     * Parameters:
-     * suffix - {String} suffix to append to the id
+     * APIMethod: deactivate
+     * Deactivate the strategy.  Clear the feature cache.
      *
      * Returns:
      *
      * Returns:
-     * {DOMElement}
+     * {Boolean} True if the strategy was successfully deactivated or false if
+     *      the strategy was already inactive.
      */
      */
-    createRoot: function(suffix) {
-        return this.nodeFactory(this.container.id + suffix, "olv:group");
+    deactivate: function() {
+        this.cache = null;
+        if (this.layer && this.layer.events) {
+            this.layer.events.un({
+                "beforefeaturesadded": this.handleAdd,
+                "beforefeaturesremoved": this.handleRemove,
+                scope: this
+            });            
+        }
+        return OpenLayers.Strategy.prototype.deactivate.apply(this, arguments);
     },
     
     },
     
-    /**************************************
-     *                                    *
-     *     GEOMETRY DRAWING FUNCTIONS     *
-     *                                    *
-     **************************************/
+    /**
+     * Method: handleAdd
+     */
+    handleAdd: function(event) {
+        if (!this.caching && this.filter) {
+            var features = event.features;
+            event.features = [];
+            var feature;
+            for (var i=0, ii=features.length; i<ii; ++i) {
+                feature = features[i];
+                if (this.filter.evaluate(feature)) {
+                    event.features.push(feature);
+                } else {
+                    this.cache.push(feature);
+                }
+            }
+        }
+    },
     
     /**
     
     /**
-     * Method: drawPoint
-     * Render a point
-     * 
-     * Parameters:
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * 
-     * Returns:
-     * {DOMElement} or false if the point could not be drawn
+     * Method: handleRemove
      */
      */
-    drawPoint: function(node, geometry) {
-        return this.drawCircle(node, geometry, 1);
+    handleRemove: function(event) {
+        if (!this.caching) {
+            this.cache = [];
+        }
     },
 
     },
 
-    /**
-     * Method: drawCircle
-     * Render a circle.
-     * Size and Center a circle given geometry (x,y center) and radius
-     * 
+    /** 
+     * APIMethod: setFilter
+     * Update the filter for this strategy.  This will re-evaluate
+     *     any features on the layer and in the cache.  Only features
+     *     for which filter.evalute(feature) returns true will be
+     *     added to the layer.  Others will be cached by the strategy.
+     *
      * Parameters:
      * Parameters:
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * radius - {float}
-     * 
-     * Returns:
-     * {DOMElement} or false if the circle could not ne drawn
+     * filter - {<OpenLayers.Filter>} A filter for evaluating features.
      */
      */
-    drawCircle: function(node, geometry, radius) {
-        if(!isNaN(geometry.x)&& !isNaN(geometry.y)) {
-            var resolution = this.getResolution();
-
-            node.style.left = ((((geometry.x - this.featureDx) /resolution - this.offset.x) | 0) - radius) + "px";
-            node.style.top = (((geometry.y /resolution - this.offset.y) | 0) - radius) + "px";
-    
-            var diameter = radius * 2;
-            
-            node.style.width = diameter + "px";
-            node.style.height = diameter + "px";
-            return node;
+    setFilter: function(filter) {
+        this.filter = filter;
+        var previousCache = this.cache;
+        this.cache = [];
+        // look through layer for features to remove from layer
+        this.handleAdd({features: this.layer.features});
+        // cache now contains features to remove from layer
+        if (this.cache.length > 0) {
+            this.caching = true;
+            this.layer.removeFeatures(this.cache.slice());
+            this.caching = false;
+        }
+        // now look through previous cache for features to add to layer
+        if (previousCache.length > 0) {
+            var event = {features: previousCache};
+            this.handleAdd(event);
+            if (event.features.length > 0) {
+                // event has features to add to layer
+                this.caching = true;
+                this.layer.addFeatures(event.features);
+                this.caching = false;
+            }
         }
         }
-        return false;
     },
 
     },
 
+    CLASS_NAME: "OpenLayers.Strategy.Filter"
+
+});
+/* ======================================================================
+    OpenLayers/Strategy/BBOX.js
+   ====================================================================== */
+
+/* Copyright (c) 2006-2015 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Strategy.js
+ * @requires OpenLayers/Filter/Spatial.js
+ */
+
+/**
+ * Class: OpenLayers.Strategy.BBOX
+ * A simple strategy that reads new features when the viewport invalidates
+ *     some bounds.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Strategy>
+ */
+OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
+    
+    /**
+     * Property: bounds
+     * {<OpenLayers.Bounds>} The current data bounds (in the same projection
+     *     as the layer - not always the same projection as the map).
+     */
+    bounds: null,
+    
+    /** 
+     * Property: resolution 
+     * {Float} The current data resolution. 
+     */ 
+    resolution: null, 
+           
+    /**
+     * APIProperty: ratio
+     * {Float} The ratio of the data bounds to the viewport bounds (in each
+     *     dimension).  Default is 2.
+     */
+    ratio: 2,
 
 
+    /** 
+     * Property: resFactor 
+     * {Float} Optional factor used to determine when previously requested 
+     *     features are invalid.  If set, the resFactor will be compared to the
+     *     resolution of the previous request to the current map resolution.
+     *     If resFactor > (old / new) and 1/resFactor < (old / new).  If you
+     *     set a resFactor of 1, data will be requested every time the
+     *     resolution changes.  If you set a resFactor of 3, data will be
+     *     requested if the old resolution is 3 times the new, or if the new is
+     *     3 times the old.  If the old bounds do not contain the new bounds
+     *     new data will always be requested (with or without considering
+     *     resFactor). 
+     */ 
+    resFactor: null, 
+    
     /**
     /**
-     * Method: drawLineString
-     * Render a linestring.
-     * 
-     * Parameters:
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * 
-     * Returns:
-     * {DOMElement}
+     * Property: response
+     * {<OpenLayers.Protocol.Response>} The protocol response object returned
+     *      by the layer protocol.
      */
      */
-    drawLineString: function(node, geometry) {
-        return this.drawLine(node, geometry, false);
-    },
+    response: null,
 
     /**
 
     /**
-     * Method: drawLinearRing
-     * Render a linearring
-     * 
+     * Constructor: OpenLayers.Strategy.BBOX
+     * Create a new BBOX strategy.
+     *
      * Parameters:
      * Parameters:
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * 
-     * Returns:
-     * {DOMElement}
+     * options - {Object} Optional object whose properties will be set on the
+     *     instance.
      */
      */
-    drawLinearRing: function(node, geometry) {
-        return this.drawLine(node, geometry, true);
-    },
-
+    
     /**
     /**
-     * Method: DrawLine
-     * Render a line.
-     * 
-     * Parameters:
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * closeLine - {Boolean} Close the line? (make it a ring?)
+     * Method: activate
+     * Set up strategy with regard to reading new batches of remote data.
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement}
+     * {Boolean} The strategy was successfully activated.
      */
      */
-    drawLine: function(node, geometry, closeLine) {
-
-        this.setNodeDimension(node, geometry);
-
-        var resolution = this.getResolution();
-        var numComponents = geometry.components.length;
-        var parts = new Array(numComponents);
-
-        var comp, x, y;
-        for (var i = 0; i < numComponents; i++) {
-            comp = geometry.components[i];
-            x = ((comp.x - this.featureDx)/resolution - this.offset.x) | 0;
-            y = (comp.y/resolution - this.offset.y) | 0;
-            parts[i] = " " + x + "," + y + " l ";
+    activate: function() {
+        var activated = OpenLayers.Strategy.prototype.activate.call(this);
+        if(activated) {
+            this.layer.events.on({
+                "moveend": this.update,
+                "refresh": this.update,
+                "visibilitychanged": this.update,
+                scope: this
+            });
+            this.update();
         }
         }
-        var end = (closeLine) ? " x e" : " e";
-        node.path = "m" + parts.join("") + end;
-        return node;
+        return activated;
     },
     },
-
+    
     /**
     /**
-     * Method: drawPolygon
-     * Render a polygon
-     * 
-     * Parameters:
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
+     * Method: deactivate
+     * Tear down strategy with regard to reading new batches of remote data.
      * 
      * Returns:
      * 
      * Returns:
-     * {DOMElement}
+     * {Boolean} The strategy was successfully deactivated.
      */
      */
-    drawPolygon: function(node, geometry) {
-        this.setNodeDimension(node, geometry);
-
-        var resolution = this.getResolution();
-    
-        var path = [];
-        var j, jj, points, area, first, second, i, ii, comp, pathComp, x, y;
-        for (j=0, jj=geometry.components.length; j<jj; j++) {
-            path.push("m");
-            points = geometry.components[j].components;
-            // we only close paths of interior rings with area
-            area = (j === 0);
-            first = null;
-            second = null;
-            for (i=0, ii=points.length; i<ii; i++) {
-                comp = points[i];
-                x = ((comp.x - this.featureDx) / resolution - this.offset.x) | 0;
-                y = (comp.y / resolution - this.offset.y) | 0;
-                pathComp = " " + x + "," + y;
-                path.push(pathComp);
-                if (i==0) {
-                    path.push(" l");
-                }
-                if (!area) {
-                    // IE improperly renders sub-paths that have no area.
-                    // Instead of checking the area of every ring, we confirm
-                    // the ring has at least three distinct points.  This does
-                    // not catch all non-zero area cases, but it greatly improves
-                    // interior ring digitizing and is a minor performance hit
-                    // when rendering rings with many points.
-                    if (!first) {
-                        first = pathComp;
-                    } else if (first != pathComp) {
-                        if (!second) {
-                            second = pathComp;
-                        } else if (second != pathComp) {
-                            // stop looking
-                            area = true;
-                        }
-                    }
-                }
-            }
-            path.push(area ? " x " : " ");
+    deactivate: function() {
+        var deactivated = OpenLayers.Strategy.prototype.deactivate.call(this);
+        if(deactivated) {
+            this.layer.events.un({
+                "moveend": this.update,
+                "refresh": this.update,
+                "visibilitychanged": this.update,
+                scope: this
+            });
         }
         }
-        path.push("e");
-        node.path = path.join("");
-        return node;
+        return deactivated;
     },
 
     /**
     },
 
     /**
-     * Method: drawRectangle
-     * Render a rectangle
-     * 
+     * Method: update
+     * Callback function called on "moveend" or "refresh" layer events.
+     *
      * Parameters:
      * Parameters:
-     * node - {DOMElement}
-     * geometry - {<OpenLayers.Geometry>}
-     * 
-     * Returns:
-     * {DOMElement}
+     * options - {Object} Optional object whose properties will determine
+     *     the behaviour of this Strategy
+     *
+     * Valid options include:
+     * force - {Boolean} if true, new data must be unconditionally read.
+     * noAbort - {Boolean} if true, do not abort previous requests.
      */
      */
-    drawRectangle: function(node, geometry) {
-        var resolution = this.getResolution();
-    
-        node.style.left = (((geometry.x - this.featureDx)/resolution - this.offset.x) | 0) + "px";
-        node.style.top = ((geometry.y/resolution - this.offset.y) | 0) + "px";
-        node.style.width = ((geometry.width/resolution) | 0) + "px";
-        node.style.height = ((geometry.height/resolution) | 0) + "px";
-        
-        return node;
+    update: function(options) {
+        var mapBounds = this.getMapBounds();
+        if (mapBounds !== null && ((options && options.force) ||
+          (this.layer.visibility && this.layer.calculateInRange() && this.invalidBounds(mapBounds)))) {
+            this.calculateBounds(mapBounds);
+            this.resolution = this.layer.map.getResolution(); 
+            this.triggerRead(options);
+        }
     },
     
     /**
     },
     
     /**
-     * Method: drawText
-     * This method is only called by the renderer itself.
-     * 
-     * Parameters: 
-     * featureId - {String}
-     * style -
-     * location - {<OpenLayers.Geometry.Point>}
+     * Method: getMapBounds
+     * Get the map bounds expressed in the same projection as this layer.
+     *
+     * Returns:
+     * {<OpenLayers.Bounds>} Map bounds in the projection of the layer.
      */
      */
-    drawText: function(featureId, style, location) {
-        var label = this.nodeFactory(featureId + this.LABEL_ID_SUFFIX, "olv:rect");
-        var textbox = this.nodeFactory(featureId + this.LABEL_ID_SUFFIX + "_textbox", "olv:textbox");
-        
-        var resolution = this.getResolution();
-        label.style.left = (((location.x - this.featureDx)/resolution - this.offset.x) | 0) + "px";
-        label.style.top = ((location.y/resolution - this.offset.y) | 0) + "px";
-        label.style.flip = "y";
-
-        textbox.innerText = style.label;
-
-        if (style.cursor != "inherit" && style.cursor != null) {
-            textbox.style.cursor = style.cursor;
-        }
-        if (style.fontColor) {
-            textbox.style.color = style.fontColor;
-        }
-        if (style.fontOpacity) {
-            textbox.style.filter = 'alpha(opacity=' + (style.fontOpacity * 100) + ')';
-        }
-        if (style.fontFamily) {
-            textbox.style.fontFamily = style.fontFamily;
-        }
-        if (style.fontSize) {
-            textbox.style.fontSize = style.fontSize;
-        }
-        if (style.fontWeight) {
-            textbox.style.fontWeight = style.fontWeight;
-        }
-        if (style.fontStyle) {
-            textbox.style.fontStyle = style.fontStyle;
+    getMapBounds: function() {
+        if (this.layer.map === null) {
+            return null;
         }
         }
-        if(style.labelSelect === true) {
-            label._featureId = featureId;
-            textbox._featureId = featureId;
-            textbox._geometry = location;
-            textbox._geometryClass = location.CLASS_NAME;
+        var bounds = this.layer.map.getExtent();
+        if (bounds && this.layer.projection && !this.layer.projection.equals(
+                this.layer.map.getProjectionObject())) {
+            bounds = bounds.clone().transform(
+                this.layer.map.getProjectionObject(), this.layer.projection
+            );
         }
         }
-        textbox.style.whiteSpace = "nowrap";
-        // fun with IE: IE7 in standards compliant mode does not display any
-        // text with a left inset of 0. So we set this to 1px and subtract one
-        // pixel later when we set label.style.left
-        textbox.inset = "1px,0px,0px,0px";
+        return bounds;
+    },
 
 
-        if(!label.parentNode) {
-            label.appendChild(textbox);
-            this.textRoot.appendChild(label);
+    /**
+     * Method: invalidBounds
+     * Determine whether the previously requested set of features is invalid. 
+     *     This occurs when the new map bounds do not contain the previously 
+     *     requested bounds.  In addition, if <resFactor> is set, it will be 
+     *     considered.
+     *
+     * Parameters:
+     * mapBounds - {<OpenLayers.Bounds>} the current map extent, will be
+     *      retrieved from the map object if not provided
+     *
+     * Returns:
+     * {Boolean} 
+     */
+    invalidBounds: function(mapBounds) {
+        if(!mapBounds) {
+            mapBounds = this.getMapBounds();
         }
         }
-
-        var align = style.labelAlign || "cm";
-        if (align.length == 1) {
-            align += "m";
+        var invalid = !this.bounds || !this.bounds.containsBounds(mapBounds);
+        if(!invalid && this.resFactor) {
+            var ratio = this.resolution / this.layer.map.getResolution();
+            invalid = (ratio >= this.resFactor || ratio <= (1 / this.resFactor));
         }
         }
-        var xshift = textbox.clientWidth *
-            (OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]);
-        var yshift = textbox.clientHeight *
-            (OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]);
-        label.style.left = parseInt(label.style.left)-xshift-1+"px";
-        label.style.top = parseInt(label.style.top)+yshift+"px";
-        
+        return invalid;
     },
     },
-    
     /**
     /**
-     * Method: moveRoot
-     * moves this renderer's root to a different renderer.
-     * 
+     * Method: calculateBounds
+     *
      * Parameters:
      * Parameters:
-     * renderer - {<OpenLayers.Renderer>} target renderer for the moved root
-     * root - {DOMElement} optional root node. To be used when this renderer
-     *     holds roots from multiple layers to tell this method which one to
-     *     detach
-     * 
-     * Returns:
-     * {Boolean} true if successful, false otherwise
+     * mapBounds - {<OpenLayers.Bounds>} the current map extent, will be
+     *      retrieved from the map object if not provided
      */
      */
-    moveRoot: function(renderer) {
-        var layer = this.map.getLayer(renderer.container.id);
-        if(layer instanceof OpenLayers.Layer.Vector.RootContainer) {
-            layer = this.map.getLayer(this.container.id);
+    calculateBounds: function(mapBounds) {
+        if(!mapBounds) {
+            mapBounds = this.getMapBounds();
         }
         }
-        layer && layer.renderer.clear();
-        OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this, arguments);
-        layer && layer.redraw();
+        var center = mapBounds.getCenterLonLat();
+        var dataWidth = mapBounds.getWidth() * this.ratio;
+        var dataHeight = mapBounds.getHeight() * this.ratio;
+        this.bounds = new OpenLayers.Bounds(
+            center.lon - (dataWidth / 2),
+            center.lat - (dataHeight / 2),
+            center.lon + (dataWidth / 2),
+            center.lat + (dataHeight / 2)
+        );
     },
     
     /**
     },
     
     /**
-     * Method: importSymbol
-     * add a new symbol definition from the rendererer's symbol hash
-     * 
+     * Method: triggerRead
+     *
      * Parameters:
      * Parameters:
-     * graphicName - {String} name of the symbol to import
-     * 
+     * options - {Object} Additional options for the protocol's read method 
+     *     (optional)
+     *
      * Returns:
      * Returns:
-     * {Object} - hash of {DOMElement} "symbol" and {Number} "size"
-     */      
-    importSymbol: function (graphicName)  {
-        var id = this.container.id + "-" + graphicName;
-        
-        // check if symbol already exists in the cache
-        var cache = this.symbolCache[id];
-        if (cache) {
-            return cache;
-        }
-        
-        var symbol = OpenLayers.Renderer.symbol[graphicName];
-        if (!symbol) {
-            throw new Error(graphicName + ' is not a valid symbol name');
-        }
-
-        var symbolExtent = new OpenLayers.Bounds(
-                                    Number.MAX_VALUE, Number.MAX_VALUE, 0, 0);
-        
-        var pathitems = ["m"];
-        for (var i=0; i<symbol.length; i=i+2) {
-            var x = symbol[i];
-            var y = symbol[i+1];
-            symbolExtent.left = Math.min(symbolExtent.left, x);
-            symbolExtent.bottom = Math.min(symbolExtent.bottom, y);
-            symbolExtent.right = Math.max(symbolExtent.right, x);
-            symbolExtent.top = Math.max(symbolExtent.top, y);
-
-            pathitems.push(x);
-            pathitems.push(y);
-            if (i == 0) {
-                pathitems.push("l");
-            }
-        }
-        pathitems.push("x e");
-        var path = pathitems.join(" ");
-
-        var diff = (symbolExtent.getWidth() - symbolExtent.getHeight()) / 2;
-        if(diff > 0) {
-            symbolExtent.bottom = symbolExtent.bottom - diff;
-            symbolExtent.top = symbolExtent.top + diff;
-        } else {
-            symbolExtent.left = symbolExtent.left + diff;
-            symbolExtent.right = symbolExtent.right - diff;
+     * {<OpenLayers.Protocol.Response>} The protocol response object
+     *      returned by the layer protocol.
+     */
+    triggerRead: function(options) {
+        if (this.response && !(options && options.noAbort === true)) {
+            this.layer.protocol.abort(this.response);
+            this.layer.events.triggerEvent("loadend");
         }
         }
-        
-        cache = {
-            path: path,
-            size: symbolExtent.getWidth(), // equals getHeight() now
-            left: symbolExtent.left,
-            bottom: symbolExtent.bottom
-        };
-        this.symbolCache[id] = cache;
-        
-        return cache;
+        var evt = {filter: this.createFilter()};
+        this.layer.events.triggerEvent("loadstart", evt);
+        this.response = this.layer.protocol.read(
+            OpenLayers.Util.applyDefaults({
+                filter: evt.filter,
+                callback: this.merge,
+                scope: this
+        }, options));
     },
     },
-    
-    CLASS_NAME: "OpenLayers.Renderer.VML"
-});
-
-/**
- * Constant: OpenLayers.Renderer.VML.LABEL_SHIFT
- * {Object}
- */
-OpenLayers.Renderer.VML.LABEL_SHIFT = {
-    "l": 0,
-    "c": .5,
-    "r": 1,
-    "t": 0,
-    "m": .5,
-    "b": 1
-};
-/* ======================================================================
-    OpenLayers/Protocol/WFS/v1_0_0.js
-   ====================================================================== */
-
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the 2-clause BSD license.
- * See license.txt in the OpenLayers distribution or repository for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Protocol/WFS/v1.js
- * @requires OpenLayers/Format/WFST/v1_0_0.js
- */
-
-/**
- * Class: OpenLayers.Protocol.WFS.v1_0_0
- * A WFS v1.0.0 protocol for vector layers.  Create a new instance with the
- *     <OpenLayers.Protocol.WFS.v1_0_0> constructor.
- *
- * Inherits from:
- *  - <OpenLayers.Protocol.WFS.v1>
- */
-OpenLayers.Protocol.WFS.v1_0_0 = OpenLayers.Class(OpenLayers.Protocol.WFS.v1, {
-    
     /**
     /**
-     * Property: version
-     * {String} WFS version number.
+     * Method: createFilter
+     * Creates a spatial BBOX filter. If the layer that this strategy belongs
+     * to has a filter property, this filter will be combined with the BBOX 
+     * filter.
+     * 
+     * Returns
+     * {<OpenLayers.Filter>} The filter object.
      */
      */
-    version: "1.0.0",
-    
+    createFilter: function() {
+        var filter = new OpenLayers.Filter.Spatial({
+            type: OpenLayers.Filter.Spatial.BBOX,
+            value: this.bounds,
+            projection: this.layer.projection
+        });
+        if (this.layer.filter) {
+            filter = new OpenLayers.Filter.Logical({
+                type: OpenLayers.Filter.Logical.AND,
+                filters: [this.layer.filter, filter]
+            });
+        }
+        return filter;
+    },
+   
     /**
     /**
-     * Constructor: OpenLayers.Protocol.WFS.v1_0_0
-     * A class for giving layers WFS v1.0.0 protocol.
+     * Method: merge
+     * Given a list of features, determine which ones to add to the layer.
+     *     If the layer projection differs from the map projection, features
+     *     will be transformed from the layer projection to the map projection.
      *
      * Parameters:
      *
      * Parameters:
-     * options - {Object} Optional object whose properties will be set on the
-     *     instance.
-     *
-     * Valid options properties:
-     * featureType - {String} Local (without prefix) feature typeName (required).
-     * featureNS - {String} Feature namespace (optional).
-     * featurePrefix - {String} Feature namespace alias (optional - only used
-     *     if featureNS is provided).  Default is 'feature'.
-     * geometryName - {String} Name of geometry attribute.  Default is 'the_geom'.
+     * resp - {<OpenLayers.Protocol.Response>} The response object passed
+     *      by the protocol.
      */
      */
+    merge: function(resp) {
+        this.layer.destroyFeatures();
+        if (resp.success()) {
+            var features = resp.features;
+            if(features && features.length > 0) {
+                var remote = this.layer.projection;
+                var local = this.layer.map.getProjectionObject();
+                if(remote && local && !local.equals(remote)) {
+                    var geom;
+                    for(var i=0, len=features.length; i<len; ++i) {
+                        geom = features[i].geometry;
+                        if(geom) {
+                            geom.transform(remote, local);
+                        }
+                    }
+                }
+                this.layer.addFeatures(features);
+            }
+        } else {
+            this.bounds = null;
+        }
+        this.response = null;
+        this.layer.events.triggerEvent("loadend", {response: resp});
+    },
    
    
-    CLASS_NAME: "OpenLayers.Protocol.WFS.v1_0_0
+    CLASS_NAME: "OpenLayers.Strategy.BBOX
 });
 });
index 5450a407b0be7dfd03be689e34e2aa5657c500a5..d07a5cc408da583935440d1e935f95e231e1b0bd 100644 (file)
@@ -2,14 +2,14 @@
 
   OpenLayers.js -- OpenLayers Map Viewer Library
 
 
   OpenLayers.js -- OpenLayers Map Viewer Library
 
-  Copyright (c) 2006-2013 by OpenLayers Contributors
+  Copyright (c) 2006-2015 by OpenLayers Contributors
   Published under the 2-clause BSD license.
   Published under the 2-clause BSD license.
-  See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors.
+  See https://raw.githubusercontent.com/openlayers/ol2/master/license.txt for the full text of the license, and https://raw.githubusercontent.com/openlayers/ol2/master/authors.txt for full list of contributors.
 
   Includes compressed code under the following licenses:
 
   (For uncompressed versions of the code used, please see the
 
   Includes compressed code under the following licenses:
 
   (For uncompressed versions of the code used, please see the
-  OpenLayers Github repository: <https://github.com/openlayers/openlayers>)
+  OpenLayers Github repository: <https://github.com/openlayers/ol2>)
 
 */
 
 
 */
 
  * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is
  * Copyright (c) 2006, Yahoo! Inc.
  * All rights reserved.
  * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is
  * Copyright (c) 2006, Yahoo! Inc.
  * All rights reserved.
- * 
+ *
  * Redistribution and use of this software in source and binary forms, with or
  * without modification, are permitted provided that the following conditions
  * are met:
  * Redistribution and use of this software in source and binary forms, with or
  * without modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright notice,
  *   this list of conditions and the following disclaimer.
  * * Redistributions of source code must retain the above copyright notice,
  *   this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright notice,
  *   this list of conditions and the following disclaimer in the documentation
  *   and/or other materials provided with the distribution.
  * * Redistributions in binary form must reproduce the above copyright notice,
  *   this list of conditions and the following disclaimer in the documentation
  *   and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of Yahoo! Inc. nor the names of its contributors may be
  *   used to endorse or promote products derived from this software without
  *   specific prior written permission of Yahoo! Inc.
  * * Neither the name of Yahoo! Inc. nor the names of its contributors may be
  *   used to endorse or promote products derived from this software without
  *   specific prior written permission of Yahoo! Inc.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
  * POSSIBILITY OF SUCH DAMAGE.
  */
-var OpenLayers={VERSION_NUMBER:"Release 2.13.1",singleFile:!0,_getScriptLocation:function(){for(var a=/(^|(.*?\/))(OpenLayers[^\/]*?\.js)(\?|$)/,b=document.getElementsByTagName("script"),c,d="",e=0,f=b.length;e<f;e++)if(c=b[e].getAttribute("src"))if(c=c.match(a)){d=c[1];break}return function(){return d}}(),ImgPath:""};OpenLayers.String={startsWith:function(a,b){return 0==a.indexOf(b)},contains:function(a,b){return-1!=a.indexOf(b)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(a){a=a.split("-");for(var b=a[0],c=1,d=a.length;c<d;c++)var e=a[c],b=b+(e.charAt(0).toUpperCase()+e.substring(1));return b},format:function(a,b,c){b||(b=window);return a.replace(OpenLayers.String.tokenRegEx,function(a,e){for(var f,g=e.split(/\.+/),h=0;h<g.length;h++){0==h&&(f=b);if(void 0===f)break;
+var OpenLayers={VERSION_NUMBER:"Release 2.14 dev",singleFile:!0,_getScriptLocation:function(){for(var a=/(^|(.*?\/))(OpenLayers[^\/]*?\.js)(\?|$)/,b=document.getElementsByTagName("script"),c,d="",e=0,f=b.length;e<f;e++)if(c=b[e].getAttribute("src"))if(c=c.match(a)){d=c[1];break}return function(){return d}}(),ImgPath:""};OpenLayers.Class=function(){var a=arguments.length,b=arguments[0],c=arguments[a-1],d="function"==typeof c.initialize?c.initialize:function(){b.prototype.initialize.apply(this,arguments)};1<a?(a=[d,b].concat(Array.prototype.slice.call(arguments).slice(1,a-1),c),OpenLayers.inherit.apply(null,a)):d.prototype=c;return d};
+OpenLayers.inherit=function(a,b){var c=function(){};c.prototype=b.prototype;a.prototype=new c;var d,e,c=2;for(d=arguments.length;c<d;c++)e=arguments[c],"function"===typeof e&&(e=e.prototype),OpenLayers.Util.extend(a.prototype,e)};OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.extend=function(a,b){a=a||{};if(b){for(var c in b){var d=b[c];void 0!==d&&(a[c]=d)}!("function"==typeof window.Event&&b instanceof window.Event)&&(b.hasOwnProperty&&b.hasOwnProperty("toString"))&&(a.toString=b.toString)}return a};OpenLayers.String={startsWith:function(a,b){return 0==a.indexOf(b)},contains:function(a,b){return-1!=a.indexOf(b)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(a){a=a.split("-");for(var b=a[0],c=1,d=a.length;c<d;c++)var e=a[c],b=b+(e.charAt(0).toUpperCase()+e.substring(1));return b},format:function(a,b,c){b||(b=window);return a.replace(OpenLayers.String.tokenRegEx,function(a,e){for(var f,g=e.split(/\.+/),h=0;h<g.length;h++){0==h&&(f=b);if(void 0===f)break;
 f=f[g[h]]}"function"==typeof f&&(f=c?f.apply(null,c):f());return"undefined"==typeof f?"undefined":f})},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(a){return OpenLayers.String.numberRegEx.test(a)},numericIf:function(a,b){var c=a;!0===b&&(null!=a&&a.replace)&&(a=a.replace(/^\s*|\s*$/g,""));return OpenLayers.String.isNumeric(a)?parseFloat(a):c}};
 OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(a,b){var c=0;0<b&&(c=parseFloat(a.toPrecision(b)));return c},format:function(a,b,c,d){b="undefined"!=typeof b?b:0;c="undefined"!=typeof c?c:OpenLayers.Number.thousandsSeparator;d="undefined"!=typeof d?d:OpenLayers.Number.decimalSeparator;null!=b&&(a=parseFloat(a.toFixed(b)));var e=a.toString().split(".");1==e.length&&null==b&&(b=0);a=e[0];if(c)for(var f=/(-?[0-9]+)([0-9]{3})/;f.test(a);)a=a.replace(f,"$1"+c+"$2");
 f=f[g[h]]}"function"==typeof f&&(f=c?f.apply(null,c):f());return"undefined"==typeof f?"undefined":f})},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(a){return OpenLayers.String.numberRegEx.test(a)},numericIf:function(a,b){var c=a;!0===b&&(null!=a&&a.replace)&&(a=a.replace(/^\s*|\s*$/g,""));return OpenLayers.String.isNumeric(a)?parseFloat(a):c}};
 OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(a,b){var c=0;0<b&&(c=parseFloat(a.toPrecision(b)));return c},format:function(a,b,c,d){b="undefined"!=typeof b?b:0;c="undefined"!=typeof c?c:OpenLayers.Number.thousandsSeparator;d="undefined"!=typeof d?d:OpenLayers.Number.decimalSeparator;null!=b&&(a=parseFloat(a.toFixed(b)));var e=a.toString().split(".");1==e.length&&null==b&&(b=0);a=e[0];if(c)for(var f=/(-?[0-9]+)([0-9]{3})/;f.test(a);)a=a.replace(f,"$1"+c+"$2");
-0==b?b=a:(c=1<e.length?e[1]:"0",null!=b&&(c+=Array(b-c.length+1).join("0")),b=a+d+c);return b},zeroPad:function(a,b,c){for(a=a.toString(c||10);a.length<b;)a="0"+a;return a}};
-OpenLayers.Function={bind:function(a,b){var c=Array.prototype.slice.apply(arguments,[2]);return function(){var d=c.concat(Array.prototype.slice.apply(arguments,[0]));return a.apply(b,d)}},bindAsEventListener:function(a,b){return function(c){return a.call(b,c||window.event)}},False:function(){return!1},True:function(){return!0},Void:function(){}};
-OpenLayers.Array={filter:function(a,b,c){var d=[];if(Array.prototype.filter)d=a.filter(b,c);else{var e=a.length;if("function"!=typeof b)throw new TypeError;for(var f=0;f<e;f++)if(f in a){var g=a[f];b.call(c,g,f,a)&&d.push(g)}}return d}};OpenLayers.Class=function(){var a=arguments.length,b=arguments[0],c=arguments[a-1],d="function"==typeof c.initialize?c.initialize:function(){b.prototype.initialize.apply(this,arguments)};1<a?(a=[d,b].concat(Array.prototype.slice.call(arguments).slice(1,a-1),c),OpenLayers.inherit.apply(null,a)):d.prototype=c;return d};
-OpenLayers.inherit=function(a,b){var c=function(){};c.prototype=b.prototype;a.prototype=new c;var d,e,c=2;for(d=arguments.length;c<d;c++)e=arguments[c],"function"===typeof e&&(e=e.prototype),OpenLayers.Util.extend(a.prototype,e)};OpenLayers.Util=OpenLayers.Util||{};OpenLayers.Util.extend=function(a,b){a=a||{};if(b){for(var c in b){var d=b[c];void 0!==d&&(a[c]=d)}!("function"==typeof window.Event&&b instanceof window.Event)&&(b.hasOwnProperty&&b.hasOwnProperty("toString"))&&(a.toString=b.toString)}return a};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(a,b,c,d){OpenLayers.Util.isArray(a)&&(d=a[3],c=a[2],b=a[1],a=a[0]);null!=a&&(this.left=OpenLayers.Util.toFloat(a));null!=b&&(this.bottom=OpenLayers.Util.toFloat(b));null!=c&&(this.right=OpenLayers.Util.toFloat(c));null!=d&&(this.top=OpenLayers.Util.toFloat(d))},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(a){var b=!1;null!=
+0==b?b=a:(c=1<e.length?e[1]:"0",null!=b&&(c+=Array(b-c.length+1).join("0")),b=a+d+c);return b},zeroPad:function(a,b,c){for(a=a.toString(c||10);a.length<b;)a="0"+a;return a}};OpenLayers.Function={bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}},bindAsEventListener:function(a,b){return function(c){return a.call(b,c||window.event)}},False:function(){return!1},True:function(){return!0},Void:function(){}};
+OpenLayers.Array={filter:function(a,b,c){var d=[];if(Array.prototype.filter)d=a.filter(b,c);else{var e=a.length;if("function"!=typeof b)throw new TypeError;for(var f=0;f<e;f++)if(f in a){var g=a[f];b.call(c,g,f,a)&&d.push(g)}}return d}};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(a,b,c,d){OpenLayers.Util.isArray(a)&&(d=a[3],c=a[2],b=a[1],a=a[0]);null!=a&&(this.left=OpenLayers.Util.toFloat(a));null!=b&&(this.bottom=OpenLayers.Util.toFloat(b));null!=c&&(this.right=OpenLayers.Util.toFloat(c));null!=d&&(this.top=OpenLayers.Util.toFloat(d))},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(a){var b=!1;null!=
 a&&(b=this.left==a.left&&this.right==a.right&&this.top==a.top&&this.bottom==a.bottom);return b},toString:function(){return[this.left,this.bottom,this.right,this.top].join()},toArray:function(a){return!0===a?[this.bottom,this.left,this.top,this.right]:[this.left,this.bottom,this.right,this.top]},toBBOX:function(a,b){null==a&&(a=6);var c=Math.pow(10,a),d=Math.round(this.left*c)/c,e=Math.round(this.bottom*c)/c,f=Math.round(this.right*c)/c,c=Math.round(this.top*c)/c;return!0===b?e+","+d+","+c+","+f:d+
 ","+e+","+f+","+c},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return this.right-this.left},getHeight:function(){return this.top-this.bottom},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},
 getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){this.centerLonLat||(this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2));return this.centerLonLat},scale:function(a,b){null==b&&(b=this.getCenterLonLat());var c,d;"OpenLayers.LonLat"==b.CLASS_NAME?(c=b.lon,d=b.lat):(c=b.x,d=b.y);return new OpenLayers.Bounds((this.left-c)*a+c,(this.bottom-d)*a+d,(this.right-c)*a+c,(this.top-d)*a+
 a&&(b=this.left==a.left&&this.right==a.right&&this.top==a.top&&this.bottom==a.bottom);return b},toString:function(){return[this.left,this.bottom,this.right,this.top].join()},toArray:function(a){return!0===a?[this.bottom,this.left,this.top,this.right]:[this.left,this.bottom,this.right,this.top]},toBBOX:function(a,b){null==a&&(a=6);var c=Math.pow(10,a),d=Math.round(this.left*c)/c,e=Math.round(this.bottom*c)/c,f=Math.round(this.right*c)/c,c=Math.round(this.top*c)/c;return!0===b?e+","+d+","+c+","+f:d+
 ","+e+","+f+","+c},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return this.right-this.left},getHeight:function(){return this.top-this.bottom},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},
 getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){this.centerLonLat||(this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2));return this.centerLonLat},scale:function(a,b){null==b&&(b=this.getCenterLonLat());var c,d;"OpenLayers.LonLat"==b.CLASS_NAME?(c=b.lon,d=b.lat):(c=b.x,d=b.y);return new OpenLayers.Bounds((this.left-c)*a+c,(this.bottom-d)*a+d,(this.right-c)*a+c,(this.top-d)*a+
@@ -92,10 +91,10 @@ OpenLayers.Util.getParameterString=function(a){var b=[],c;for(c in a){var d=a[c]
 OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||OpenLayers._getScriptLocation()+"img/"};OpenLayers.Util.getImageLocation=function(a){return OpenLayers.Util.getImagesLocation()+a};OpenLayers.Util.Try=function(){for(var a=null,b=0,c=arguments.length;b<c;b++){var d=arguments[b];try{a=d();break}catch(e){}}return a};
 OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;b||(b=a.textContent);b||(b=a.firstChild.nodeValue)},function(){b=a.textContent});return b};OpenLayers.Util.mouseLeft=function(a,b){for(var c=a.relatedTarget?a.relatedTarget:a.toElement;c!=b&&null!=c;)c=c.parentNode;return c!=b};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(a,b){null==b&&(b=OpenLayers.Util.DEFAULT_PRECISION);"number"!==typeof a&&(a=parseFloat(a));return 0===b?a:parseFloat(a.toPrecision(b))};
 OpenLayers.Util.rad=function(a){return a*Math.PI/180};OpenLayers.Util.deg=function(a){return 180*a/Math.PI};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};
 OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||OpenLayers._getScriptLocation()+"img/"};OpenLayers.Util.getImageLocation=function(a){return OpenLayers.Util.getImagesLocation()+a};OpenLayers.Util.Try=function(){for(var a=null,b=0,c=arguments.length;b<c;b++){var d=arguments[b];try{a=d();break}catch(e){}}return a};
 OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;b||(b=a.textContent);b||(b=a.firstChild.nodeValue)},function(){b=a.textContent});return b};OpenLayers.Util.mouseLeft=function(a,b){for(var c=a.relatedTarget?a.relatedTarget:a.toElement;c!=b&&null!=c;)c=c.parentNode;return c!=b};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(a,b){null==b&&(b=OpenLayers.Util.DEFAULT_PRECISION);"number"!==typeof a&&(a=parseFloat(a));return 0===b?a:parseFloat(a.toPrecision(b))};
 OpenLayers.Util.rad=function(a){return a*Math.PI/180};OpenLayers.Util.deg=function(a){return 180*a/Math.PI};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};
-OpenLayers.Util.distVincenty=function(a,b){for(var c=OpenLayers.Util.VincentyConstants,d=c.a,e=c.b,c=c.f,f=OpenLayers.Util.rad(b.lon-a.lon),g=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(a.lat))),h=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(b.lat))),k=Math.sin(g),g=Math.cos(g),l=Math.sin(h),h=Math.cos(h),m=f,r=2*Math.PI,p=20;1E-12<Math.abs(m-r)&&0<--p;){var n=Math.sin(m),q=Math.cos(m),s=Math.sqrt(h*n*h*n+(g*l-k*h*q)*(g*l-k*h*q));if(0==s)return 0;var q=k*l+g*h*q,t=Math.atan2(s,q),u=Math.asin(g*h*
-n/s),v=Math.cos(u)*Math.cos(u),n=q-2*k*l/v,w=c/16*v*(4+c*(4-3*v)),r=m,m=f+(1-w)*c*Math.sin(u)*(t+w*s*(n+w*q*(-1+2*n*n)))}if(0==p)return NaN;d=v*(d*d-e*e)/(e*e);c=d/1024*(256+d*(-128+d*(74-47*d)));return(e*(1+d/16384*(4096+d*(-768+d*(320-175*d))))*(t-c*s*(n+c/4*(q*(-1+2*n*n)-c/6*n*(-3+4*s*s)*(-3+4*n*n))))).toFixed(3)/1E3};
-OpenLayers.Util.destinationVincenty=function(a,b,c){var d=OpenLayers.Util,e=d.VincentyConstants,f=e.a,g=e.b,h=e.f,e=a.lon;a=a.lat;var k=d.rad(b);b=Math.sin(k);k=Math.cos(k);a=(1-h)*Math.tan(d.rad(a));var l=1/Math.sqrt(1+a*a),m=a*l,r=Math.atan2(a,k);a=l*b;for(var p=1-a*a,f=p*(f*f-g*g)/(g*g),n=1+f/16384*(4096+f*(-768+f*(320-175*f))),q=f/1024*(256+f*(-128+f*(74-47*f))),f=c/(g*n),s=2*Math.PI;1E-12<Math.abs(f-s);)var t=Math.cos(2*r+f),u=Math.sin(f),v=Math.cos(f),w=q*u*(t+q/4*(v*(-1+2*t*t)-q/6*t*(-3+4*
-u*u)*(-3+4*t*t))),s=f,f=c/(g*n)+w;c=m*u-l*v*k;g=Math.atan2(m*v+l*u*k,(1-h)*Math.sqrt(a*a+c*c));b=Math.atan2(u*b,l*v-m*u*k);k=h/16*p*(4+h*(4-3*p));t=b-(1-k)*h*a*(f+k*u*(t+k*v*(-1+2*t*t)));Math.atan2(a,-c);return new OpenLayers.LonLat(e+d.deg(t),d.deg(g))};
+OpenLayers.Util.distVincenty=function(a,b){for(var c=OpenLayers.Util.VincentyConstants,d=c.a,e=c.b,c=c.f,f=OpenLayers.Util.rad(b.lon-a.lon),g=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(a.lat))),h=Math.atan((1-c)*Math.tan(OpenLayers.Util.rad(b.lat))),k=Math.sin(g),g=Math.cos(g),l=Math.sin(h),h=Math.cos(h),m=f,r=2*Math.PI,q=20;1E-12<Math.abs(m-r)&&0<--q;){var n=Math.sin(m),p=Math.cos(m),s=Math.sqrt(h*n*h*n+(g*l-k*h*p)*(g*l-k*h*p));if(0==s)return 0;var p=k*l+g*h*p,t=Math.atan2(s,p),u=Math.asin(g*h*
+n/s),v=Math.cos(u)*Math.cos(u),n=p-2*k*l/v,w=c/16*v*(4+c*(4-3*v)),r=m,m=f+(1-w)*c*Math.sin(u)*(t+w*s*(n+w*p*(-1+2*n*n)))}if(0==q)return NaN;d=v*(d*d-e*e)/(e*e);c=d/1024*(256+d*(-128+d*(74-47*d)));return(e*(1+d/16384*(4096+d*(-768+d*(320-175*d))))*(t-c*s*(n+c/4*(p*(-1+2*n*n)-c/6*n*(-3+4*s*s)*(-3+4*n*n))))).toFixed(3)/1E3};
+OpenLayers.Util.destinationVincenty=function(a,b,c){var d=OpenLayers.Util,e=d.VincentyConstants,f=e.a,g=e.b,h=e.f,e=a.lon;a=a.lat;var k=d.rad(b);b=Math.sin(k);k=Math.cos(k);a=(1-h)*Math.tan(d.rad(a));var l=1/Math.sqrt(1+a*a),m=a*l,r=Math.atan2(a,k);a=l*b;for(var q=1-a*a,f=q*(f*f-g*g)/(g*g),n=1+f/16384*(4096+f*(-768+f*(320-175*f))),p=f/1024*(256+f*(-128+f*(74-47*f))),f=c/(g*n),s=2*Math.PI;1E-12<Math.abs(f-s);)var t=Math.cos(2*r+f),u=Math.sin(f),v=Math.cos(f),w=p*u*(t+p/4*(v*(-1+2*t*t)-p/6*t*(-3+4*
+u*u)*(-3+4*t*t))),s=f,f=c/(g*n)+w;c=m*u-l*v*k;g=Math.atan2(m*v+l*u*k,(1-h)*Math.sqrt(a*a+c*c));b=Math.atan2(u*b,l*v-m*u*k);k=h/16*q*(4+h*(4-3*q));t=b-(1-k)*h*a*(f+k*u*(t+k*v*(-1+2*t*t)));Math.atan2(a,-c);return new OpenLayers.LonLat(e+d.deg(t),d.deg(g))};
 OpenLayers.Util.getParameters=function(a,b){b=b||{};a=null===a||void 0===a?window.location.href:a;var c="";if(OpenLayers.String.contains(a,"?"))var d=a.indexOf("?")+1,c=OpenLayers.String.contains(a,"#")?a.indexOf("#"):a.length,c=a.substring(d,c);for(var d={},c=c.split(/[&;]/),e=0,f=c.length;e<f;++e){var g=c[e].split("=");if(g[0]){var h=g[0];try{h=decodeURIComponent(h)}catch(k){h=unescape(h)}g=(g[1]||"").replace(/\+/g," ");try{g=decodeURIComponent(g)}catch(l){g=unescape(g)}!1!==b.splitArgs&&(g=g.split(","));
 1==g.length&&(g=g[0]);d[h]=g}}return d};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){a=null==a?"id_":a.replace(OpenLayers.Util.dotless,"_");OpenLayers.Util.lastSeqID+=1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.37,km:39370,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;
 OpenLayers.METERS_PER_INCH=0.0254000508001016;
 OpenLayers.Util.getParameters=function(a,b){b=b||{};a=null===a||void 0===a?window.location.href:a;var c="";if(OpenLayers.String.contains(a,"?"))var d=a.indexOf("?")+1,c=OpenLayers.String.contains(a,"#")?a.indexOf("#"):a.length,c=a.substring(d,c);for(var d={},c=c.split(/[&;]/),e=0,f=c.length;e<f;++e){var g=c[e].split("=");if(g[0]){var h=g[0];try{h=decodeURIComponent(h)}catch(k){h=unescape(h)}g=(g[1]||"").replace(/\+/g," ");try{g=decodeURIComponent(g)}catch(l){g=unescape(g)}!1!==b.splitArgs&&(g=g.split(","));
 1==g.length&&(g=g[0]);d[h]=g}}return d};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(a){a=null==a?"id_":a.replace(OpenLayers.Util.dotless,"_");OpenLayers.Util.lastSeqID+=1;return a+OpenLayers.Util.lastSeqID};OpenLayers.INCHES_PER_UNIT={inches:1,ft:12,mi:63360,m:39.37,km:39370,dd:4374754,yd:36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT.degrees=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT.nmi=1852*OpenLayers.INCHES_PER_UNIT.m;
 OpenLayers.METERS_PER_INCH=0.0254000508001016;
@@ -120,44 +119,47 @@ OpenLayers.Util.getRenderedDimensions=function(a,b,c){var d,e,f=document.createE
 d||(d=parseInt(b.scrollWidth),f.style.width=d+"px");e||(e=parseInt(b.scrollHeight));f.removeChild(b);k?(k.removeChild(f),g.removeChild(k)):g.removeChild(f);return new OpenLayers.Size(d,e)};
 OpenLayers.Util.getScrollbarWidth=function(){var a=OpenLayers.Util._scrollbarWidth;if(null==a){var b=null,c=null,b=a=0,b=document.createElement("div");b.style.position="absolute";b.style.top="-1000px";b.style.left="-1000px";b.style.width="100px";b.style.height="50px";b.style.overflow="hidden";c=document.createElement("div");c.style.width="100%";c.style.height="200px";b.appendChild(c);document.body.appendChild(b);a=c.offsetWidth;b.style.overflow="scroll";b=c.offsetWidth;document.body.removeChild(document.body.lastChild);
 OpenLayers.Util._scrollbarWidth=a-b;a=OpenLayers.Util._scrollbarWidth}return a};
 d||(d=parseInt(b.scrollWidth),f.style.width=d+"px");e||(e=parseInt(b.scrollHeight));f.removeChild(b);k?(k.removeChild(f),g.removeChild(k)):g.removeChild(f);return new OpenLayers.Size(d,e)};
 OpenLayers.Util.getScrollbarWidth=function(){var a=OpenLayers.Util._scrollbarWidth;if(null==a){var b=null,c=null,b=a=0,b=document.createElement("div");b.style.position="absolute";b.style.top="-1000px";b.style.left="-1000px";b.style.width="100px";b.style.height="50px";b.style.overflow="hidden";c=document.createElement("div");c.style.width="100%";c.style.height="200px";b.appendChild(c);document.body.appendChild(b);a=c.offsetWidth;b.style.overflow="scroll";b=c.offsetWidth;document.body.removeChild(document.body.lastChild);
 OpenLayers.Util._scrollbarWidth=a-b;a=OpenLayers.Util._scrollbarWidth}return a};
-OpenLayers.Util.getFormattedLonLat=function(a,b,c){c||(c="dms");a=(a+540)%360-180;var d=Math.abs(a),e=Math.floor(d),f=d=(d-e)/(1/60),d=Math.floor(d),f=Math.round(10*((f-d)/(1/60))),f=f/10;60<=f&&(f-=60,d+=1,60<=d&&(d-=60,e+=1));10>e&&(e="0"+e);e+="\u00b0";0<=c.indexOf("dm")&&(10>d&&(d="0"+d),e+=d+"'",0<=c.indexOf("dms")&&(10>f&&(f="0"+f),e+=f+'"'));return e="lon"==b?e+(0>a?OpenLayers.i18n("W"):OpenLayers.i18n("E")):e+(0>a?OpenLayers.i18n("S"):OpenLayers.i18n("N"))};OpenLayers.Event={observers:!1,KEY_SPACE:32,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isSingleTouch:function(a){return a.touches&&1==a.touches.length},isMultiTouch:function(a){return a.touches&&1<a.touches.length},isLeftClick:function(a){return a.which&&1==a.which||a.button&&1==a.button},isRightClick:function(a){return a.which&&3==a.which||a.button&&2==a.button},stop:function(a,
-b){b||OpenLayers.Event.preventDefault(a);a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},preventDefault:function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},findElement:function(a,b){for(var c=OpenLayers.Event.element(a);c.parentNode&&(!c.tagName||c.tagName.toUpperCase()!=b.toUpperCase());)c=c.parentNode;return c},observe:function(a,b,c,d){a=OpenLayers.Util.getElement(a);d=d||!1;if("keypress"==b&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.attachEvent))b="keydown";
-this.observers||(this.observers={});if(!a._eventCacheID){var e="eventCacheID_";a.id&&(e=a.id+"_"+e);a._eventCacheID=OpenLayers.Util.createUniqueID(e)}e=a._eventCacheID;this.observers[e]||(this.observers[e]=[]);this.observers[e].push({element:a,name:b,observer:c,useCapture:d});a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},stopObservingElement:function(a){a=OpenLayers.Util.getElement(a)._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[a])},
-_removeElementObservers:function(a){if(a)for(var b=a.length-1;0<=b;b--){var c=a[b];OpenLayers.Event.stopObserving.apply(this,[c.element,c.name,c.observer,c.useCapture])}},stopObserving:function(a,b,c,d){d=d||!1;a=OpenLayers.Util.getElement(a);var e=a._eventCacheID;if("keypress"==b&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.detachEvent))b="keydown";var f=!1,g=OpenLayers.Event.observers[e];if(g)for(var h=0;!f&&h<g.length;){var k=g[h];if(k.name==b&&k.observer==c&&k.useCapture==d){g.splice(h,
-1);0==g.length&&delete OpenLayers.Event.observers[e];f=!0;break}h++}f&&(a.removeEventListener?a.removeEventListener(b,c,d):a&&a.detachEvent&&a.detachEvent("on"+b,c));return f},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var a in OpenLayers.Event.observers)OpenLayers.Event._removeElementObservers.apply(this,[OpenLayers.Event.observers[a]]);OpenLayers.Event.observers=!1}},CLASS_NAME:"OpenLayers.Event"};
-OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,!1);
-OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:"mouseover mouseout mousedown mouseup mousemove click dblclick rightclick dblrightclick resize focus blur touchstart touchmove touchend keydown".split(" "),listeners:null,object:null,element:null,eventHandler:null,fallThrough:null,includeXY:!1,extensions:null,extensionCount:null,clearMouseListener:null,initialize:function(a,b,c,d,e){OpenLayers.Util.extend(this,e);this.object=a;this.fallThrough=d;this.listeners={};this.extensions={};this.extensionCount=
-{};this._msTouches=[];null!=b&&this.attachToElement(b)},destroy:function(){for(var a in this.extensions)"boolean"!==typeof this.extensions[a]&&this.extensions[a].destroy();this.extensions=null;this.element&&(OpenLayers.Event.stopObservingElement(this.element),this.element.hasScrollEvent&&OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener));this.eventHandler=this.fallThrough=this.object=this.listeners=this.element=null},addEventType:function(a){},attachToElement:function(a){this.element?
-OpenLayers.Event.stopObservingElement(this.element):(this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this),this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this));this.element=a;for(var b=!!window.navigator.msMaxTouchPoints,c,d=0,e=this.BROWSER_EVENTS.length;d<e;d++)c=this.BROWSER_EVENTS[d],OpenLayers.Event.observe(a,c,this.eventHandler),b&&0===c.indexOf("touch")&&this.addMsTouchListener(a,c,this.eventHandler);OpenLayers.Event.observe(a,"dragstart",
-OpenLayers.Event.stop)},on:function(a){for(var b in a)"scope"!=b&&a.hasOwnProperty(b)&&this.register(b,a.scope,a[b])},register:function(a,b,c,d){a in OpenLayers.Events&&!this.extensions[a]&&(this.extensions[a]=new OpenLayers.Events[a](this));if(null!=c){null==b&&(b=this.object);var e=this.listeners[a];e||(e=[],this.listeners[a]=e,this.extensionCount[a]=0);b={obj:b,func:c};d?(e.splice(this.extensionCount[a],0,b),"object"===typeof d&&d.extension&&this.extensionCount[a]++):e.push(b)}},registerPriority:function(a,
-b,c){this.register(a,b,c,!0)},un:function(a){for(var b in a)"scope"!=b&&a.hasOwnProperty(b)&&this.unregister(b,a.scope,a[b])},unregister:function(a,b,c){null==b&&(b=this.object);a=this.listeners[a];if(null!=a)for(var d=0,e=a.length;d<e;d++)if(a[d].obj==b&&a[d].func==c){a.splice(d,1);break}},remove:function(a){null!=this.listeners[a]&&(this.listeners[a]=[])},triggerEvent:function(a,b){var c=this.listeners[a];if(c&&0!=c.length){null==b&&(b={});b.object=this.object;b.element=this.element;b.type||(b.type=
-a);for(var c=c.slice(),d,e=0,f=c.length;e<f&&!(d=c[e],d=d.func.apply(d.obj,[b]),void 0!=d&&!1==d);e++);this.fallThrough||OpenLayers.Event.stop(b,!0);return d}},handleBrowserEvent:function(a){var b=a.type,c=this.listeners[b];if(c&&0!=c.length){if((c=a.touches)&&c[0]){for(var d=0,e=0,f=c.length,g,h=0;h<f;++h)g=this.getTouchClientXY(c[h]),d+=g.clientX,e+=g.clientY;a.clientX=d/f;a.clientY=e/f}this.includeXY&&(a.xy=this.getMousePosition(a));this.triggerEvent(b,a)}},getTouchClientXY:function(a){var b=window.olMockWin||
-window,c=b.pageXOffset,b=b.pageYOffset,d=a.clientX,e=a.clientY;if(0===a.pageY&&Math.floor(e)>Math.floor(a.pageY)||0===a.pageX&&Math.floor(d)>Math.floor(a.pageX))d-=c,e-=b;else if(e<a.pageY-b||d<a.pageX-c)d=a.pageX-c,e=a.pageY-b;a.olClientX=d;a.olClientY=e;return{clientX:d,clientY:e}},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=null},getMousePosition:function(a){this.includeXY?this.element.hasScrollEvent||(OpenLayers.Event.observe(window,"scroll",
-this.clearMouseListener),this.element.hasScrollEvent=!0):this.clearMouseCache();if(!this.element.scrolls){var b=OpenLayers.Util.getViewportElement();this.element.scrolls=[window.pageXOffset||b.scrollLeft,window.pageYOffset||b.scrollTop]}this.element.lefttop||(this.element.lefttop=[document.documentElement.clientLeft||0,document.documentElement.clientTop||0]);this.element.offsets||(this.element.offsets=OpenLayers.Util.pagePosition(this.element));return new OpenLayers.Pixel(a.clientX+this.element.scrolls[0]-
-this.element.offsets[0]-this.element.lefttop[0],a.clientY+this.element.scrolls[1]-this.element.offsets[1]-this.element.lefttop[1])},addMsTouchListener:function(a,b,c){function d(a){c(OpenLayers.Util.applyDefaults({stopPropagation:function(){for(var a=e.length-1;0<=a;--a)e[a].stopPropagation()},preventDefault:function(){for(var a=e.length-1;0<=a;--a)e[a].preventDefault()},type:b},a))}var e=this._msTouches;switch(b){case "touchstart":return this.addMsTouchListenerStart(a,b,d);case "touchend":return this.addMsTouchListenerEnd(a,
-b,d);case "touchmove":return this.addMsTouchListenerMove(a,b,d);default:throw"Unknown touch event type";}},addMsTouchListenerStart:function(a,b,c){var d=this._msTouches;OpenLayers.Event.observe(a,"MSPointerDown",function(a){for(var b=!1,g=0,h=d.length;g<h;++g)if(d[g].pointerId==a.pointerId){b=!0;break}b||d.push(a);a.touches=d.slice();c(a)});OpenLayers.Event.observe(a,"MSPointerUp",function(a){for(var b=0,c=d.length;b<c;++b)if(d[b].pointerId==a.pointerId){d.splice(b,1);break}})},addMsTouchListenerMove:function(a,
-b,c){var d=this._msTouches;OpenLayers.Event.observe(a,"MSPointerMove",function(a){if(!(a.pointerType==a.MSPOINTER_TYPE_MOUSE&&0==a.buttons)&&!(1==d.length&&d[0].pageX==a.pageX&&d[0].pageY==a.pageY)){for(var b=0,g=d.length;b<g;++b)if(d[b].pointerId==a.pointerId){d[b]=a;break}a.touches=d.slice();c(a)}})},addMsTouchListenerEnd:function(a,b,c){var d=this._msTouches;OpenLayers.Event.observe(a,"MSPointerUp",function(a){for(var b=0,g=d.length;b<g;++b)if(d[b].pointerId==a.pointerId){d.splice(b,1);break}a.touches=
-d.slice();c(a)})},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Events.buttonclick=OpenLayers.Class({target:null,events:"mousedown mouseup click dblclick touchstart touchmove touchend keydown".split(" "),startRegEx:/^mousedown|touchstart$/,cancelRegEx:/^touchmove$/,completeRegEx:/^mouseup|touchend$/,initialize:function(a){this.target=a;for(a=this.events.length-1;0<=a;--a)this.target.register(this.events[a],this,this.buttonClick,{extension:!0})},destroy:function(){for(var a=this.events.length-1;0<=a;--a)this.target.unregister(this.events[a],this,this.buttonClick);
-delete this.target},getPressedButton:function(a){var b=3,c;do{if(OpenLayers.Element.hasClass(a,"olButton")){c=a;break}a=a.parentNode}while(0<--b&&a);return c},ignore:function(a){var b=3,c=!1;do{if("a"===a.nodeName.toLowerCase()){c=!0;break}a=a.parentNode}while(0<--b&&a);return c},buttonClick:function(a){var b=!0,c=OpenLayers.Event.element(a);if(c&&(OpenLayers.Event.isLeftClick(a)||!~a.type.indexOf("mouse")))if(c=this.getPressedButton(c)){if("keydown"===a.type)switch(a.keyCode){case OpenLayers.Event.KEY_RETURN:case OpenLayers.Event.KEY_SPACE:this.target.triggerEvent("buttonclick",
-{buttonElement:c}),OpenLayers.Event.stop(a),b=!1}else if(this.startEvt){if(this.completeRegEx.test(a.type)){var b=OpenLayers.Util.pagePosition(c),d=OpenLayers.Util.getViewportElement(),e=window.pageYOffset||d.scrollTop;b[0]-=window.pageXOffset||d.scrollLeft;b[1]-=e;this.target.triggerEvent("buttonclick",{buttonElement:c,buttonXY:{x:this.startEvt.clientX-b[0],y:this.startEvt.clientY-b[1]}})}this.cancelRegEx.test(a.type)&&delete this.startEvt;OpenLayers.Event.stop(a);b=!1}this.startRegEx.test(a.type)&&
-(this.startEvt=a,OpenLayers.Event.stop(a),b=!1)}else b=!this.ignore(OpenLayers.Event.element(a)),delete this.startEvt;return b}});OpenLayers.Util=OpenLayers.Util||{};
-OpenLayers.Util.vendorPrefix=function(){function a(a){return!a?null:a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()}).replace(/^ms-/,"-ms-")}function b(a,b){if(void 0===g[b]){var c,e=0,f=d.length,p="undefined"!==typeof a.cssText;for(g[b]=null;e<f;e++)if((c=d[e])?(p||(c=c.toLowerCase()),c=c+b.charAt(0).toUpperCase()+b.slice(1)):c=b,void 0!==a[c]){g[b]=c;break}}return g[b]}function c(a){return b(e,a)}var d=["","O","ms","Moz","Webkit"],e=document.createElement("div").style,f={},g={};return{css:function(b){if(void 0===
+OpenLayers.Util.getFormattedLonLat=function(a,b,c){c||(c="dms");a=(a+540)%360-180;var d=Math.abs(a),e=Math.floor(d),f=d=(d-e)/(1/60),d=Math.floor(d),f=Math.round(10*((f-d)/(1/60))),f=f/10;60<=f&&(f-=60,d+=1,60<=d&&(d-=60,e+=1));10>e&&(e="0"+e);e+="\u00b0";0<=c.indexOf("dm")&&(10>d&&(d="0"+d),e+=d+"'",0<=c.indexOf("dms")&&(10>f&&(f="0"+f),e+=f+'"'));return e="lon"==b?e+(0>a?OpenLayers.i18n("W"):OpenLayers.i18n("E")):e+(0>a?OpenLayers.i18n("S"):OpenLayers.i18n("N"))};
+OpenLayers.Util.getConstructor=function(a){var b=a.split(".");a="OpenLayers"===b[0]?OpenLayers:window[b[0]];for(var c=1,d=b.length;c<d;++c)a=a[b[c]];return a};OpenLayers.Event={observers:!1,KEY_SPACE:32,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isSingleTouch:function(a){return a.touches&&1==a.touches.length},isMultiTouch:function(a){return a.touches&&1<a.touches.length},isTouchEvent:function(a){return 0===(""+a.type).indexOf("touch")||"pointerType"in a&&(a.pointerType===a.MSPOINTER_TYPE_TOUCH||"touch"===a.pointerType)},isLeftClick:function(a){return a.which&&
+1==a.which||a.button&&1==a.button},isRightClick:function(a){return a.which&&3==a.which||a.button&&2==a.button},stop:function(a,b){b||OpenLayers.Event.preventDefault(a);a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},preventDefault:function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},findElement:function(a,b){for(var c=OpenLayers.Event.element(a);c.parentNode&&(!c.tagName||c.tagName.toUpperCase()!=b.toUpperCase());)c=c.parentNode;return c},observe:function(a,b,c,d){a=OpenLayers.Util.getElement(a);
+d=d||!1;if("keypress"==b&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.attachEvent))b="keydown";this.observers||(this.observers={});if(!a._eventCacheID){var e="eventCacheID_";a.id&&(e=a.id+"_"+e);a._eventCacheID=OpenLayers.Util.createUniqueID(e)}e=a._eventCacheID;this.observers[e]||(this.observers[e]=[]);this.observers[e].push({element:a,name:b,observer:c,useCapture:d});a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},stopObservingElement:function(a){a=
+OpenLayers.Util.getElement(a)._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[a])},_removeElementObservers:function(a){if(a)for(var b=a.length-1;0<=b;b--){var c=a[b];OpenLayers.Event.stopObserving.apply(this,[c.element,c.name,c.observer,c.useCapture])}},stopObserving:function(a,b,c,d){d=d||!1;a=OpenLayers.Util.getElement(a);var e=a._eventCacheID;if("keypress"==b&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||a.detachEvent))b="keydown";var f=!1,g=OpenLayers.Event.observers[e];
+if(g)for(var h=0;!f&&h<g.length;){var k=g[h];if(k.name==b&&k.observer==c&&k.useCapture==d){g.splice(h,1);0==g.length&&delete OpenLayers.Event.observers[e];f=!0;break}h++}f&&(a.removeEventListener?a.removeEventListener(b,c,d):a&&a.detachEvent&&a.detachEvent("on"+b,c));return f},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var a in OpenLayers.Event.observers)OpenLayers.Event._removeElementObservers.apply(this,[OpenLayers.Event.observers[a]]);OpenLayers.Event.observers=
+!1}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,!1);
+OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:"mouseover mouseout mousedown mouseup mousemove click dblclick rightclick dblrightclick resize focus blur touchstart touchmove touchend keydown".split(" "),TOUCH_MODEL_POINTER:"pointer",TOUCH_MODEL_MSPOINTER:"MSPointer",TOUCH_MODEL_TOUCH:"touch",listeners:null,object:null,element:null,eventHandler:null,fallThrough:null,includeXY:!1,extensions:null,extensionCount:null,clearMouseListener:null,initialize:function(a,b,c,d,e){OpenLayers.Util.extend(this,
+e);this.object=a;this.fallThrough=d;this.listeners={};this.extensions={};this.extensionCount={};this._pointerTouches=[];null!=b&&this.attachToElement(b)},destroy:function(){for(var a in this.extensions)"boolean"!==typeof this.extensions[a]&&this.extensions[a].destroy();this.extensions=null;this.element&&(OpenLayers.Event.stopObservingElement(this.element),this.element.hasScrollEvent&&OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener));this.eventHandler=this.fallThrough=this.object=
+this.listeners=this.element=null},addEventType:function(a){},attachToElement:function(a){this.element?OpenLayers.Event.stopObservingElement(this.element):(this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this),this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this));this.element=a;for(var b=this.getTouchModel(),c,d=0,e=this.BROWSER_EVENTS.length;d<e;d++)c=this.BROWSER_EVENTS[d],OpenLayers.Event.observe(a,c,this.eventHandler),(b===this.TOUCH_MODEL_POINTER||
+b===this.TOUCH_MODEL_MSPOINTER)&&0===c.indexOf("touch")&&this.addPointerTouchListener(a,c,this.eventHandler);OpenLayers.Event.observe(a,"dragstart",OpenLayers.Event.stop)},on:function(a){for(var b in a)"scope"!=b&&a.hasOwnProperty(b)&&this.register(b,a.scope,a[b])},register:function(a,b,c,d){a in OpenLayers.Events&&!this.extensions[a]&&(this.extensions[a]=new OpenLayers.Events[a](this));if(null!=c){null==b&&(b=this.object);var e=this.listeners[a];e||(e=[],this.listeners[a]=e,this.extensionCount[a]=
+0);b={obj:b,func:c};d?(e.splice(this.extensionCount[a],0,b),"object"===typeof d&&d.extension&&this.extensionCount[a]++):e.push(b)}},registerPriority:function(a,b,c){this.register(a,b,c,!0)},un:function(a){for(var b in a)"scope"!=b&&a.hasOwnProperty(b)&&this.unregister(b,a.scope,a[b])},unregister:function(a,b,c){null==b&&(b=this.object);a=this.listeners[a];if(null!=a)for(var d=0,e=a.length;d<e;d++)if(a[d].obj==b&&a[d].func==c){a.splice(d,1);break}},remove:function(a){null!=this.listeners[a]&&(this.listeners[a]=
+[])},triggerEvent:function(a,b){var c=this.listeners[a];if(c&&0!=c.length){null==b&&(b={});b.object=this.object;b.element=this.element;b.type||(b.type=a);for(var c=c.slice(),d,e=0,f=c.length;e<f&&!(d=c[e],d=d.func.apply(d.obj,[b]),void 0!=d&&!1==d);e++);this.fallThrough||OpenLayers.Event.stop(b,!0);return d}},handleBrowserEvent:function(a){var b=a.type,c=this.listeners[b];if(c&&0!=c.length){if((c=a.touches)&&c[0]){for(var d=0,e=0,f=c.length,g,h=0;h<f;++h)g=this.getTouchClientXY(c[h]),d+=g.clientX,
+e+=g.clientY;a.clientX=d/f;a.clientY=e/f}this.includeXY&&(a.xy=this.getMousePosition(a));this.triggerEvent(b,a)}},getTouchClientXY:function(a){var b=window.olMockWin||window,c=b.pageXOffset,b=b.pageYOffset,d=a.clientX,e=a.clientY;if(0===a.pageY&&Math.floor(e)>Math.floor(a.pageY)||0===a.pageX&&Math.floor(d)>Math.floor(a.pageX))d-=c,e-=b;else if(e<a.pageY-b||d<a.pageX-c)d=a.pageX-c,e=a.pageY-b;a.olClientX=d;a.olClientY=e;return{clientX:d,clientY:e}},clearMouseCache:function(){this.element.scrolls=null;
+this.element.lefttop=null;this.element.offsets=null},getMousePosition:function(a){this.includeXY?this.element.hasScrollEvent||(OpenLayers.Event.observe(window,"scroll",this.clearMouseListener),this.element.hasScrollEvent=!0):this.clearMouseCache();if(!this.element.scrolls){var b=OpenLayers.Util.getViewportElement();this.element.scrolls=[window.pageXOffset||b.scrollLeft,window.pageYOffset||b.scrollTop]}this.element.lefttop||(this.element.lefttop=[document.documentElement.clientLeft||0,document.documentElement.clientTop||
+0]);this.element.offsets||(this.element.offsets=OpenLayers.Util.pagePosition(this.element));return new OpenLayers.Pixel(a.clientX+this.element.scrolls[0]-this.element.offsets[0]-this.element.lefttop[0],a.clientY+this.element.scrolls[1]-this.element.offsets[1]-this.element.lefttop[1])},getTouchModel:function(){"_TOUCH_MODEL"in OpenLayers.Events||(OpenLayers.Events._TOUCH_MODEL=window.PointerEvent&&"pointer"||window.MSPointerEvent&&"MSPointer"||"ontouchdown"in document&&"touch"||null);return OpenLayers.Events._TOUCH_MODEL},
+addPointerTouchListener:function(a,b,c){function d(a){c(OpenLayers.Util.applyDefaults({stopPropagation:function(){for(var a=e.length-1;0<=a;--a)e[a].stopPropagation()},preventDefault:function(){for(var a=e.length-1;0<=a;--a)e[a].preventDefault()},type:b},a))}var e=this._pointerTouches;switch(b){case "touchstart":return this.addPointerTouchListenerStart(a,b,d);case "touchend":return this.addPointerTouchListenerEnd(a,b,d);case "touchmove":return this.addPointerTouchListenerMove(a,b,d);default:throw"Unknown touch event type";
+}},addPointerTouchListenerStart:function(a,b,c){var d=this._pointerTouches;OpenLayers.Event.observe(a,this.getTouchModel()===this.TOUCH_MODEL_MSPOINTER?"MSPointerDown":"pointerdown",function(a){if(OpenLayers.Event.isTouchEvent(a)){for(var b=!1,g=0,h=d.length;g<h;++g)if(d[g].pointerId==a.pointerId){b=!0;break}b||d.push(a);a.touches=d.slice();c(a)}});OpenLayers.Event.observe(a,this.getTouchModel()===this.TOUCH_MODEL_MSPOINTER?"MSPointerOut":"pointerout",function(a){if(OpenLayers.Event.isTouchEvent(a))for(var b=
+0,c=d.length;b<c;++b)if(d[b].pointerId==a.pointerId){0!=this.clientWidth&&0!=this.clientHeight&&(Math.ceil(a.clientX)>=this.clientWidth||Math.ceil(a.clientY)>=this.clientHeight)&&d.splice(b,1);break}})},addPointerTouchListenerMove:function(a,b,c){var d=this._pointerTouches;OpenLayers.Event.observe(a,this.getTouchModel()===this.TOUCH_MODEL_MSPOINTER?"MSPointerMove":"pointermove",function(a){if(OpenLayers.Event.isTouchEvent(a)&&!(1==d.length&&d[0].pageX==a.pageX&&d[0].pageY==a.pageY)){for(var b=0,g=
+d.length;b<g;++b)if(d[b].pointerId==a.pointerId){d[b]=a;break}a.touches=d.slice();c(a)}})},addPointerTouchListenerEnd:function(a,b,c){var d=this._pointerTouches;OpenLayers.Event.observe(a,this.getTouchModel()===this.TOUCH_MODEL_MSPOINTER?"MSPointerUp":"pointerup",function(a){if(OpenLayers.Event.isTouchEvent(a)){for(var b=0,g=d.length;b<g;++b)if(d[b].pointerId==a.pointerId){d.splice(b,1);break}a.touches=d.slice();c(a)}})},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,c,d){this.url=a;this.size=b||{w:20,h:20};this.offset=c||{x:-(this.size.w/2),y:-(this.size.h/2)};this.calculateOffset=d;a=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(a)},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML="";this.imageDiv=null},clone:function(){return new OpenLayers.Icon(this.url,
+this.size,this.offset,this.calculateOffset)},setSize:function(a){null!=a&&(this.size=a);this.draw()},setUrl:function(a){null!=a&&(this.url=a);this.draw()},draw:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(a);return this.imageDiv},erase:function(){null!=this.imageDiv&&null!=this.imageDiv.parentNode&&OpenLayers.Element.remove(this.imageDiv)},setOpacity:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,null,null,
+null,null,null,a)},moveTo:function(a){null!=a&&(this.px=a);null!=this.imageDiv&&(null==this.px?this.display(!1):(this.calculateOffset&&(this.offset=this.calculateOffset(this.size)),OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,{x:this.px.x+this.offset.x,y:this.px.y+this.offset.y})))},display:function(a){this.imageDiv.style.display=a?"":"none"},isDrawn:function(){return this.imageDiv&&this.imageDiv.parentNode&&11!=this.imageDiv.parentNode.nodeType},CLASS_NAME:"OpenLayers.Icon"});OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(a,b){this.lonlat=a;var c=b?b:OpenLayers.Marker.defaultIcon();null==this.icon?this.icon=c:(this.icon.url=c.url,this.icon.size=c.size,this.icon.offset=c.offset,this.icon.calculateOffset=c.calculateOffset);this.events=new OpenLayers.Events(this,this.icon.imageDiv)},destroy:function(){this.erase();this.map=null;this.events.destroy();this.events=null;null!=this.icon&&(this.icon.destroy(),this.icon=null)},
+draw:function(a){return this.icon.draw(a)},erase:function(){null!=this.icon&&this.icon.erase()},moveTo:function(a){null!=a&&null!=this.icon&&this.icon.moveTo(a);this.lonlat=this.map.getLonLatFromLayerPx(a)},isDrawn:function(){return this.icon&&this.icon.isDrawn()},onScreen:function(){var a=!1;this.map&&(a=this.map.getExtent().containsLonLat(this.lonlat));return a},inflate:function(a){this.icon&&this.icon.setSize({w:this.icon.size.w*a,h:this.icon.size.h*a})},setOpacity:function(a){this.icon.setOpacity(a)},
+setUrl:function(a){this.icon.setUrl(a)},display:function(a){this.icon.display(a)},CLASS_NAME:"OpenLayers.Marker"});OpenLayers.Marker.defaultIcon=function(){return new OpenLayers.Icon(OpenLayers.Util.getImageLocation("marker.png"),{w:21,h:25},{x:-10.5,y:-25})};OpenLayers.Util=OpenLayers.Util||{};
+OpenLayers.Util.vendorPrefix=function(){function a(a){return!a?null:a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()}).replace(/^ms-/,"-ms-")}function b(a,b){if(void 0===g[b]){var c,e=0,f=d.length,q="undefined"!==typeof a.cssText;for(g[b]=null;e<f;e++)if((c=d[e])?(q||(c=c.toLowerCase()),c=c+b.charAt(0).toUpperCase()+b.slice(1)):c=b,void 0!==a[c]){g[b]=c;break}}return g[b]}function c(a){return b(e,a)}var d=["","O","ms","Moz","Webkit"],e=document.createElement("div").style,f={},g={};return{css:function(b){if(void 0===
 f[b]){var d=b.replace(/(-[\s\S])/g,function(a){return a.charAt(1).toUpperCase()}),d=c(d);f[b]=a(d)}return f[b]},js:b,style:c,cssCache:f,jsCache:g}}();OpenLayers.Animation=function(a){var b=OpenLayers.Util.vendorPrefix.js(a,"requestAnimationFrame"),c=!!b,d=function(){var c=a[b]||function(b,c){a.setTimeout(b,16)};return function(b,d){c.apply(a,[b,d])}}(),e=0,f={};return{isNative:c,requestFrame:d,start:function(a,b,c){b=0<b?b:Number.POSITIVE_INFINITY;var l=++e,m=+new Date;f[l]=function(){f[l]&&+new Date-m<=b?(a(),f[l]&&d(f[l],c)):delete f[l]};d(f[l],c);return l},stop:function(a){delete f[a]}}}(window);OpenLayers.Tween=OpenLayers.Class({easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,minFrameRate:null,startTime:null,animationId:null,playing:!1,initialize:function(a){this.easing=a?a:OpenLayers.Easing.Expo.easeOut},start:function(a,b,c,d){this.playing=!0;this.begin=a;this.finish=b;this.duration=c;this.callbacks=d.callbacks;this.minFrameRate=d.minFrameRate||30;this.time=0;this.startTime=(new Date).getTime();OpenLayers.Animation.stop(this.animationId);this.animationId=null;
 this.callbacks&&this.callbacks.start&&this.callbacks.start.call(this,this.begin);this.animationId=OpenLayers.Animation.start(OpenLayers.Function.bind(this.play,this))},stop:function(){this.playing&&(this.callbacks&&this.callbacks.done&&this.callbacks.done.call(this,this.finish),OpenLayers.Animation.stop(this.animationId),this.animationId=null,this.playing=!1)},play:function(){var a={},b;for(b in this.begin){var c=this.begin[b],d=this.finish[b];if(null==c||null==d||isNaN(c)||isNaN(d))throw new TypeError("invalid value for Tween");
 a[b]=this.easing.apply(this,[this.time,c,d-c,this.duration])}this.time++;this.callbacks&&this.callbacks.eachStep&&((new Date).getTime()-this.startTime)/this.time<=1E3/this.minFrameRate&&this.callbacks.eachStep.call(this,a);this.time>this.duration&&this.stop()},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(a,b,c,d){return c*a/d+b},easeOut:function(a,b,c,d){return c*a/d+b},easeInOut:function(a,b,c,d){return c*a/d+b},CLASS_NAME:"OpenLayers.Easing.Linear"};
 OpenLayers.Easing.Expo={easeIn:function(a,b,c,d){return 0==a?b:c*Math.pow(2,10*(a/d-1))+b},easeOut:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOut:function(a,b,c,d){return 0==a?b:a==d?b+c:1>(a/=d/2)?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},CLASS_NAME:"OpenLayers.Easing.Expo"};
 OpenLayers.Easing.Quad={easeIn:function(a,b,c,d){return c*(a/=d)*a+b},easeOut:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOut:function(a,b,c,d){return 1>(a/=d/2)?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.projCode=a;"object"==typeof Proj4js&&(this.proj=new Proj4js.Proj(a))},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){var b=!1;a&&(a instanceof OpenLayers.Projection||(a=new OpenLayers.Projection(a)),"object"==
 typeof Proj4js&&this.proj.defData&&a.proj.defData?b=this.proj.defData.replace(this.titleRegEx,"")==a.proj.defData.replace(this.titleRegEx,""):a.getCode&&(b=this.getCode(),a=a.getCode(),b=b==a||!!OpenLayers.Projection.transforms[b]&&OpenLayers.Projection.transforms[b][a]===OpenLayers.Projection.nullTransform));return b},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};
 f[b]){var d=b.replace(/(-[\s\S])/g,function(a){return a.charAt(1).toUpperCase()}),d=c(d);f[b]=a(d)}return f[b]},js:b,style:c,cssCache:f,jsCache:g}}();OpenLayers.Animation=function(a){var b=OpenLayers.Util.vendorPrefix.js(a,"requestAnimationFrame"),c=!!b,d=function(){var c=a[b]||function(b,c){a.setTimeout(b,16)};return function(b,d){c.apply(a,[b,d])}}(),e=0,f={};return{isNative:c,requestFrame:d,start:function(a,b,c){b=0<b?b:Number.POSITIVE_INFINITY;var l=++e,m=+new Date;f[l]=function(){f[l]&&+new Date-m<=b?(a(),f[l]&&d(f[l],c)):delete f[l]};d(f[l],c);return l},stop:function(a){delete f[a]}}}(window);OpenLayers.Tween=OpenLayers.Class({easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,minFrameRate:null,startTime:null,animationId:null,playing:!1,initialize:function(a){this.easing=a?a:OpenLayers.Easing.Expo.easeOut},start:function(a,b,c,d){this.playing=!0;this.begin=a;this.finish=b;this.duration=c;this.callbacks=d.callbacks;this.minFrameRate=d.minFrameRate||30;this.time=0;this.startTime=(new Date).getTime();OpenLayers.Animation.stop(this.animationId);this.animationId=null;
 this.callbacks&&this.callbacks.start&&this.callbacks.start.call(this,this.begin);this.animationId=OpenLayers.Animation.start(OpenLayers.Function.bind(this.play,this))},stop:function(){this.playing&&(this.callbacks&&this.callbacks.done&&this.callbacks.done.call(this,this.finish),OpenLayers.Animation.stop(this.animationId),this.animationId=null,this.playing=!1)},play:function(){var a={},b;for(b in this.begin){var c=this.begin[b],d=this.finish[b];if(null==c||null==d||isNaN(c)||isNaN(d))throw new TypeError("invalid value for Tween");
 a[b]=this.easing.apply(this,[this.time,c,d-c,this.duration])}this.time++;this.callbacks&&this.callbacks.eachStep&&((new Date).getTime()-this.startTime)/this.time<=1E3/this.minFrameRate&&this.callbacks.eachStep.call(this,a);this.time>this.duration&&this.stop()},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(a,b,c,d){return c*a/d+b},easeOut:function(a,b,c,d){return c*a/d+b},easeInOut:function(a,b,c,d){return c*a/d+b},CLASS_NAME:"OpenLayers.Easing.Linear"};
 OpenLayers.Easing.Expo={easeIn:function(a,b,c,d){return 0==a?b:c*Math.pow(2,10*(a/d-1))+b},easeOut:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOut:function(a,b,c,d){return 0==a?b:a==d?b+c:1>(a/=d/2)?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},CLASS_NAME:"OpenLayers.Easing.Expo"};
 OpenLayers.Easing.Quad={easeIn:function(a,b,c,d){return c*(a/=d)*a+b},easeOut:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOut:function(a,b,c,d){return 1>(a/=d/2)?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.projCode=a;"object"==typeof Proj4js&&(this.proj=new Proj4js.Proj(a))},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){var b=!1;a&&(a instanceof OpenLayers.Projection||(a=new OpenLayers.Projection(a)),"object"==
 typeof Proj4js&&this.proj.defData&&a.proj.defData?b=this.proj.defData.replace(this.titleRegEx,"")==a.proj.defData.replace(this.titleRegEx,""):a.getCode&&(b=this.getCode(),a=a.getCode(),b=b==a||!!OpenLayers.Projection.transforms[b]&&OpenLayers.Projection.transforms[b][a]===OpenLayers.Projection.nullTransform));return b},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};
-OpenLayers.Projection.defaults={"EPSG:4326":{units:"degrees",maxExtent:[-180,-90,180,90],yx:!0},"CRS:84":{units:"degrees",maxExtent:[-180,-90,180,90]},"EPSG:900913":{units:"m",maxExtent:[-2.003750834E7,-2.003750834E7,2.003750834E7,2.003750834E7]}};
+OpenLayers.Projection.defaults={"EPSG:4326":{units:"degrees",maxExtent:[-180,-90,180,90],worldExtent:[-180,-90,180,90],yx:!0},"CRS:84":{units:"degrees",maxExtent:[-180,-90,180,90],worldExtent:[-180,-90,180,90]},"EPSG:900913":{units:"m",maxExtent:[-2.003750834E7,-2.003750834E7,2.003750834E7,2.003750834E7],worldExtent:[-180,-89,180,89]}};
 OpenLayers.Projection.addTransform=function(a,b,c){if(c===OpenLayers.Projection.nullTransform){var d=OpenLayers.Projection.defaults[a];d&&!OpenLayers.Projection.defaults[b]&&(OpenLayers.Projection.defaults[b]=d)}OpenLayers.Projection.transforms[a]||(OpenLayers.Projection.transforms[a]={});OpenLayers.Projection.transforms[a][b]=c};
 OpenLayers.Projection.transform=function(a,b,c){if(b&&c)if(b instanceof OpenLayers.Projection||(b=new OpenLayers.Projection(b)),c instanceof OpenLayers.Projection||(c=new OpenLayers.Projection(c)),b.proj&&c.proj)a=Proj4js.transform(b.proj,c.proj,a);else{b=b.getCode();c=c.getCode();var d=OpenLayers.Projection.transforms;if(d[b]&&d[b][c])d[b][c](a)}return a};OpenLayers.Projection.nullTransform=function(a){return a};
 OpenLayers.Projection.addTransform=function(a,b,c){if(c===OpenLayers.Projection.nullTransform){var d=OpenLayers.Projection.defaults[a];d&&!OpenLayers.Projection.defaults[b]&&(OpenLayers.Projection.defaults[b]=d)}OpenLayers.Projection.transforms[a]||(OpenLayers.Projection.transforms[a]={});OpenLayers.Projection.transforms[a][b]=c};
 OpenLayers.Projection.transform=function(a,b,c){if(b&&c)if(b instanceof OpenLayers.Projection||(b=new OpenLayers.Projection(b)),c instanceof OpenLayers.Projection||(c=new OpenLayers.Projection(c)),b.proj&&c.proj)a=Proj4js.transform(b.proj,c.proj,a);else{b=b.getCode();c=c.getCode();var d=OpenLayers.Projection.transforms;if(d[b]&&d[b][c])d[b][c](a)}return a};OpenLayers.Projection.nullTransform=function(a){return a};
-(function(){function a(a){a.x=180*a.x/d;a.y=180/Math.PI*(2*Math.atan(Math.exp(a.y/d*Math.PI))-Math.PI/2);return a}function b(a){a.x=a.x*d/180;var b=Math.log(Math.tan((90+a.y)*Math.PI/360))/Math.PI*d;a.y=Math.max(-2.003750834E7,Math.min(b,2.003750834E7));return a}function c(c,d){var e=OpenLayers.Projection.addTransform,f=OpenLayers.Projection.nullTransform,g,p,n,q,s;g=0;for(p=d.length;g<p;++g){n=d[g];e(c,n,b);e(n,c,a);for(s=g+1;s<p;++s)q=d[s],e(n,q,f),e(q,n,f)}}var d=2.003750834E7,e=["EPSG:900913",
-"EPSG:3857","EPSG:102113","EPSG:102100"],f=["CRS:84","urn:ogc:def:crs:EPSG:6.6:4326","EPSG:4326"],g;for(g=e.length-1;0<=g;--g)c(e[g],f);for(g=f.length-1;0<=g;--g)c(f[g],e)})();OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1E3},id:null,fractionalZoom:!1,events:null,allOverlays:!1,div:null,dragging:!1,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,options:null,tileSize:null,projection:"EPSG:4326",units:null,resolutions:null,maxResolution:null,minResolution:null,maxScale:null,minScale:null,
-maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:!1,autoUpdateSize:!0,eventListeners:null,panTween:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,zoomTween:null,zoomMethod:OpenLayers.Easing.Quad.easeOut,zoomDuration:20,paddingForPopups:null,layerContainerOriginPx:null,minPx:null,maxPx:null,initialize:function(a,b){1===arguments.length&&"object"===typeof a&&(a=(b=a)&&b.div);this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,
-OpenLayers.Map.TILE_HEIGHT);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";this.options=OpenLayers.Util.extend({},b);OpenLayers.Util.extend(this,b);OpenLayers.Util.applyDefaults(this,OpenLayers.Projection.defaults[this.projection instanceof OpenLayers.Projection?this.projection.projCode:this.projection]);this.maxExtent&&!(this.maxExtent instanceof OpenLayers.Bounds)&&(this.maxExtent=new OpenLayers.Bounds(this.maxExtent));
-this.minExtent&&!(this.minExtent instanceof OpenLayers.Bounds)&&(this.minExtent=new OpenLayers.Bounds(this.minExtent));this.restrictedExtent&&!(this.restrictedExtent instanceof OpenLayers.Bounds)&&(this.restrictedExtent=new OpenLayers.Bounds(this.restrictedExtent));this.center&&!(this.center instanceof OpenLayers.LonLat)&&(this.center=new OpenLayers.LonLat(this.center));this.layers=[];this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(a);this.div||(this.div=
-document.createElement("div"),this.div.style.height="1px",this.div.style.width="1px");OpenLayers.Element.addClass(this.div,"olMap");var c=this.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(c,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);this.events=new OpenLayers.Events(this,this.viewPortDiv,null,this.fallThrough,{includeXY:!0});
-OpenLayers.TileManager&&null!==this.tileManager&&(this.tileManager instanceof OpenLayers.TileManager||(this.tileManager=new OpenLayers.TileManager(this.tileManager)),this.tileManager.addMap(this));c=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(c);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-1;this.layerContainerOriginPx={x:0,y:0};this.applyTransform();this.viewPortDiv.appendChild(this.layerContainerDiv);this.updateSize();if(this.eventListeners instanceof
+(function(){function a(a){a.x=180*a.x/d;a.y=180/Math.PI*(2*Math.atan(Math.exp(a.y/d*Math.PI))-Math.PI/2);return a}function b(a){a.x=a.x*d/180;var b=Math.log(Math.tan((90+a.y)*Math.PI/360))/Math.PI*d;a.y=Math.max(-2.003750834E7,Math.min(b,2.003750834E7));return a}function c(c,d){var e=OpenLayers.Projection.addTransform,f=OpenLayers.Projection.nullTransform,g,q,n,p,s;g=0;for(q=d.length;g<q;++g){n=d[g];e(c,n,b);e(n,c,a);for(s=g+1;s<q;++s)p=d[s],e(n,p,f),e(p,n,f)}}var d=2.003750834E7,e=["EPSG:900913",
+"EPSG:3857","EPSG:102113","EPSG:102100","OSGEO:41001"],f=["CRS:84","urn:ogc:def:crs:EPSG:6.6:4326","EPSG:4326"],g;for(g=e.length-1;0<=g;--g)c(e[g],f);for(g=f.length-1;0<=g;--g)c(f[g],e)})();OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1E3},id:null,fractionalZoom:!1,events:null,allOverlays:!1,div:null,dragging:!1,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,options:null,tileSize:null,projection:"EPSG:4326",units:null,resolutions:null,maxResolution:null,minResolution:null,maxScale:null,minScale:null,
+maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:!1,autoUpdateSize:!0,eventListeners:null,panTween:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,zoomTween:null,zoomMethod:OpenLayers.Easing.Quad.easeOut,zoomDuration:20,paddingForPopups:null,layerContainerOriginPx:null,minPx:null,maxPx:null,initialize:function(a,b){var c=OpenLayers.Util.isElement(a);1===arguments.length&&("object"===typeof a&&!c)&&(a=(b=a)&&b.div);this.tileSize=
+new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css";this.options=OpenLayers.Util.extend({},b);OpenLayers.Util.extend(this,b);OpenLayers.Util.applyDefaults(this,OpenLayers.Projection.defaults[this.projection instanceof OpenLayers.Projection?this.projection.projCode:this.projection]);this.maxExtent&&!(this.maxExtent instanceof OpenLayers.Bounds)&&(this.maxExtent=
+new OpenLayers.Bounds(this.maxExtent));this.minExtent&&!(this.minExtent instanceof OpenLayers.Bounds)&&(this.minExtent=new OpenLayers.Bounds(this.minExtent));this.restrictedExtent&&!(this.restrictedExtent instanceof OpenLayers.Bounds)&&(this.restrictedExtent=new OpenLayers.Bounds(this.restrictedExtent));this.center&&!(this.center instanceof OpenLayers.LonLat)&&(this.center=new OpenLayers.LonLat(this.center));this.layers=[];this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(a);
+this.div||(this.div=document.createElement("div"),this.div.style.height="1px",this.div.style.width="1px");OpenLayers.Element.addClass(this.div,"olMap");c=this.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(c,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);this.events=new OpenLayers.Events(this,this.viewPortDiv,null,this.fallThrough,
+{includeXY:!0});OpenLayers.TileManager&&null!==this.tileManager&&(this.tileManager instanceof OpenLayers.TileManager||(this.tileManager=new OpenLayers.TileManager(this.tileManager)),this.tileManager.addMap(this));c=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(c);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-1;this.layerContainerOriginPx={x:0,y:0};this.applyTransform();this.viewPortDiv.appendChild(this.layerContainerDiv);this.updateSize();if(this.eventListeners instanceof
 Object)this.events.on(this.eventListeners);!0===this.autoUpdateSize&&(this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this),OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy));if(this.theme){for(var c=!0,d=document.getElementsByTagName("link"),e=0,f=d.length;e<f;++e)if(OpenLayers.Util.isEquivalentUrl(d.item(e).href,this.theme)){c=!1;break}c&&(c=document.createElement("link"),c.setAttribute("rel","stylesheet"),c.setAttribute("type","text/css"),c.setAttribute("href",this.theme),
 document.getElementsByTagName("head")[0].appendChild(c))}null==this.controls&&(this.controls=[],null!=OpenLayers.Control&&(OpenLayers.Control.Navigation?this.controls.push(new OpenLayers.Control.Navigation):OpenLayers.Control.TouchNavigation&&this.controls.push(new OpenLayers.Control.TouchNavigation),OpenLayers.Control.Zoom?this.controls.push(new OpenLayers.Control.Zoom):OpenLayers.Control.PanZoom&&this.controls.push(new OpenLayers.Control.PanZoom),OpenLayers.Control.ArgParser&&this.controls.push(new OpenLayers.Control.ArgParser),
 OpenLayers.Control.Attribution&&this.controls.push(new OpenLayers.Control.Attribution)));e=0;for(f=this.controls.length;e<f;e++)this.addControlToMap(this.controls[e]);this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy);b&&b.layers&&(delete this.center,delete this.zoom,this.addLayers(b.layers),b.center&&!this.getCenter()&&this.setCenter(b.center,b.zoom));this.panMethod&&(this.panTween=new OpenLayers.Tween(this.panMethod));
 Object)this.events.on(this.eventListeners);!0===this.autoUpdateSize&&(this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this),OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy));if(this.theme){for(var c=!0,d=document.getElementsByTagName("link"),e=0,f=d.length;e<f;++e)if(OpenLayers.Util.isEquivalentUrl(d.item(e).href,this.theme)){c=!1;break}c&&(c=document.createElement("link"),c.setAttribute("rel","stylesheet"),c.setAttribute("type","text/css"),c.setAttribute("href",this.theme),
 document.getElementsByTagName("head")[0].appendChild(c))}null==this.controls&&(this.controls=[],null!=OpenLayers.Control&&(OpenLayers.Control.Navigation?this.controls.push(new OpenLayers.Control.Navigation):OpenLayers.Control.TouchNavigation&&this.controls.push(new OpenLayers.Control.TouchNavigation),OpenLayers.Control.Zoom?this.controls.push(new OpenLayers.Control.Zoom):OpenLayers.Control.PanZoom&&this.controls.push(new OpenLayers.Control.PanZoom),OpenLayers.Control.ArgParser&&this.controls.push(new OpenLayers.Control.ArgParser),
 OpenLayers.Control.Attribution&&this.controls.push(new OpenLayers.Control.Attribution)));e=0;for(f=this.controls.length;e<f;e++)this.addControlToMap(this.controls[e]);this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,"unload",this.unloadDestroy);b&&b.layers&&(delete this.center,delete this.zoom,this.addLayers(b.layers),b.center&&!this.getCenter()&&this.setCenter(b.center,b.zoom));this.panMethod&&(this.panTween=new OpenLayers.Tween(this.panMethod));
@@ -169,82 +171,35 @@ a)},getLayer:function(a){for(var b=null,c=0,d=this.layers.length;c<d;c++){var e=
 (a.isBaseLayer=!1);a.div.className="olLayerDiv";a.div.style.overflow="";this.setLayerZIndex(a,this.layers.length);a.isFixed?this.viewPortDiv.appendChild(a.div):this.layerContainerDiv.appendChild(a.div);this.layers.push(a);a.setMap(this);a.isBaseLayer||this.allOverlays&&!this.baseLayer?null==this.baseLayer?this.setBaseLayer(a):a.setVisibility(!1):a.redraw();this.events.triggerEvent("addlayer",{layer:a});a.events.triggerEvent("added",{map:this,layer:a});a.afterAdd();return!0},addLayers:function(a){for(var b=
 0,c=a.length;b<c;b++)this.addLayer(a[b])},removeLayer:function(a,b){if(!1!==this.events.triggerEvent("preremovelayer",{layer:a})){null==b&&(b=!0);a.isFixed?this.viewPortDiv.removeChild(a.div):this.layerContainerDiv.removeChild(a.div);OpenLayers.Util.removeItem(this.layers,a);a.removeMap(this);a.map=null;if(this.baseLayer==a&&(this.baseLayer=null,b))for(var c=0,d=this.layers.length;c<d;c++){var e=this.layers[c];if(e.isBaseLayer||this.allOverlays){this.setBaseLayer(e);break}}this.resetLayersZIndex();
 this.events.triggerEvent("removelayer",{layer:a});a.events.triggerEvent("removed",{map:this,layer:a})}},getNumLayers:function(){return this.layers.length},getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(a,b){var c=this.getLayerIndex(a);0>b?b=0:b>this.layers.length&&(b=this.layers.length);if(c!=b){this.layers.splice(c,1);this.layers.splice(b,0,a);for(var c=0,d=this.layers.length;c<d;c++)this.setLayerZIndex(this.layers[c],c);this.events.triggerEvent("changelayer",
 (a.isBaseLayer=!1);a.div.className="olLayerDiv";a.div.style.overflow="";this.setLayerZIndex(a,this.layers.length);a.isFixed?this.viewPortDiv.appendChild(a.div):this.layerContainerDiv.appendChild(a.div);this.layers.push(a);a.setMap(this);a.isBaseLayer||this.allOverlays&&!this.baseLayer?null==this.baseLayer?this.setBaseLayer(a):a.setVisibility(!1):a.redraw();this.events.triggerEvent("addlayer",{layer:a});a.events.triggerEvent("added",{map:this,layer:a});a.afterAdd();return!0},addLayers:function(a){for(var b=
 0,c=a.length;b<c;b++)this.addLayer(a[b])},removeLayer:function(a,b){if(!1!==this.events.triggerEvent("preremovelayer",{layer:a})){null==b&&(b=!0);a.isFixed?this.viewPortDiv.removeChild(a.div):this.layerContainerDiv.removeChild(a.div);OpenLayers.Util.removeItem(this.layers,a);a.removeMap(this);a.map=null;if(this.baseLayer==a&&(this.baseLayer=null,b))for(var c=0,d=this.layers.length;c<d;c++){var e=this.layers[c];if(e.isBaseLayer||this.allOverlays){this.setBaseLayer(e);break}}this.resetLayersZIndex();
 this.events.triggerEvent("removelayer",{layer:a});a.events.triggerEvent("removed",{map:this,layer:a})}},getNumLayers:function(){return this.layers.length},getLayerIndex:function(a){return OpenLayers.Util.indexOf(this.layers,a)},setLayerIndex:function(a,b){var c=this.getLayerIndex(a);0>b?b=0:b>this.layers.length&&(b=this.layers.length);if(c!=b){this.layers.splice(c,1);this.layers.splice(b,0,a);for(var c=0,d=this.layers.length;c<d;c++)this.setLayerZIndex(this.layers[c],c);this.events.triggerEvent("changelayer",
-{layer:a,property:"order"});this.allOverlays&&(0===b?this.setBaseLayer(a):this.baseLayer!==this.layers[0]&&this.setBaseLayer(this.layers[0]))}},raiseLayer:function(a,b){var c=this.getLayerIndex(a)+b;this.setLayerIndex(a,c)},setBaseLayer:function(a){if(a!=this.baseLayer&&-1!=OpenLayers.Util.indexOf(this.layers,a)){var b=this.getCachedCenter(),c=OpenLayers.Util.getResolutionFromScale(this.getScale(),a.units);null!=this.baseLayer&&!this.allOverlays&&this.baseLayer.setVisibility(!1);this.baseLayer=a;
-if(!this.allOverlays||this.baseLayer.visibility)this.baseLayer.setVisibility(!0),!1===this.baseLayer.inRange&&this.baseLayer.redraw();null!=b&&(a=this.getZoomForResolution(c||this.resolution,!0),this.setCenter(b,a,!1,!0));this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}},addControl:function(a,b){this.controls.push(a);this.addControlToMap(a,b)},addControls:function(a,b){for(var c=1===arguments.length?[]:b,d=0,e=a.length;d<e;d++)this.addControl(a[d],c[d]?c[d]:null)},addControlToMap:function(a,
-b){a.outsideViewport=null!=a.div;this.displayProjection&&!a.displayProjection&&(a.displayProjection=this.displayProjection);a.setMap(this);var c=a.draw(b);c&&!a.outsideViewport&&(c.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length,this.viewPortDiv.appendChild(c));a.autoActivate&&a.activate()},getControl:function(a){for(var b=null,c=0,d=this.controls.length;c<d;c++){var e=this.controls[c];if(e.id==a){b=e;break}}return b},removeControl:function(a){a&&a==this.getControl(a.id)&&(a.div&&a.div.parentNode==
-this.viewPortDiv&&this.viewPortDiv.removeChild(a.div),OpenLayers.Util.removeItem(this.controls,a))},addPopup:function(a,b){if(b)for(var c=this.popups.length-1;0<=c;--c)this.removePopup(this.popups[c]);a.map=this;this.popups.push(a);if(c=a.draw())c.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length,this.layerContainerDiv.appendChild(c)},removePopup:function(a){OpenLayers.Util.removeItem(this.popups,a);if(a.div)try{this.layerContainerDiv.removeChild(a.div)}catch(b){}a.map=null},getSize:function(){var a=
-null;null!=this.size&&(a=this.size.clone());return a},updateSize:function(){var a=this.getCurrentSize();if(a&&!isNaN(a.h)&&!isNaN(a.w)){this.events.clearMouseCache();var b=this.getSize();null==b&&(this.size=b=a);if(!a.equals(b)){this.size=a;a=0;for(b=this.layers.length;a<b;a++)this.layers[a].onMapResize();a=this.getCachedCenter();null!=this.baseLayer&&null!=a&&(b=this.getZoom(),this.zoom=null,this.setCenter(a,b))}}this.events.triggerEvent("updatesize")},getCurrentSize:function(){var a=new OpenLayers.Size(this.div.clientWidth,
-this.div.clientHeight);if(0==a.w&&0==a.h||isNaN(a.w)&&isNaN(a.h))a.w=this.div.offsetWidth,a.h=this.div.offsetHeight;if(0==a.w&&0==a.h||isNaN(a.w)&&isNaN(a.h))a.w=parseInt(this.div.style.width),a.h=parseInt(this.div.style.height);return a},calculateBounds:function(a,b){var c=null;null==a&&(a=this.getCachedCenter());null==b&&(b=this.getResolution());if(null!=a&&null!=b)var c=this.size.w*b/2,d=this.size.h*b/2,c=new OpenLayers.Bounds(a.lon-c,a.lat-d,a.lon+c,a.lat+d);return c},getCenter:function(){var a=
-null,b=this.getCachedCenter();b&&(a=b.clone());return a},getCachedCenter:function(){!this.center&&this.size&&(this.center=this.getLonLatFromViewPortPx({x:this.size.w/2,y:this.size.h/2}));return this.center},getZoom:function(){return this.zoom},pan:function(a,b,c){c=OpenLayers.Util.applyDefaults(c,{animate:!0,dragging:!1});if(c.dragging)(0!=a||0!=b)&&this.moveByPx(a,b);else{var d=this.getViewPortPxFromLonLat(this.getCachedCenter());a=d.add(a,b);if(this.dragging||!a.equals(d))d=this.getLonLatFromViewPortPx(a),
-c.animate?this.panTo(d):(this.moveTo(d),this.dragging&&(this.dragging=!1,this.events.triggerEvent("moveend")))}},panTo:function(a){if(this.panTween&&this.getExtent().scale(this.panRatio).containsLonLat(a)){var b=this.getCachedCenter();if(!a.equals(b)){var b=this.getPixelFromLonLat(b),c=this.getPixelFromLonLat(a),d=0,e=0;this.panTween.start({x:0,y:0},{x:c.x-b.x,y:c.y-b.y},this.panDuration,{callbacks:{eachStep:OpenLayers.Function.bind(function(a){this.moveByPx(a.x-d,a.y-e);d=Math.round(a.x);e=Math.round(a.y)},
-this),done:OpenLayers.Function.bind(function(b){this.moveTo(a);this.dragging=!1;this.events.triggerEvent("moveend")},this)}})}}else this.setCenter(a)},setCenter:function(a,b,c,d){this.panTween&&this.panTween.stop();this.zoomTween&&this.zoomTween.stop();this.moveTo(a,b,{dragging:c,forceZoomChange:d})},moveByPx:function(a,b){var c=this.size.w/2,d=this.size.h/2,e=c+a,f=d+b,g=this.baseLayer.wrapDateLine,h=0,k=0;this.restrictedExtent&&(h=c,k=d,g=!1);a=g||e<=this.maxPx.x-h&&e>=this.minPx.x+h?Math.round(a):
-0;b=f<=this.maxPx.y-k&&f>=this.minPx.y+k?Math.round(b):0;if(a||b){this.dragging||(this.dragging=!0,this.events.triggerEvent("movestart"));this.center=null;a&&(this.layerContainerOriginPx.x-=a,this.minPx.x-=a,this.maxPx.x-=a);b&&(this.layerContainerOriginPx.y-=b,this.minPx.y-=b,this.maxPx.y-=b);this.applyTransform();d=0;for(e=this.layers.length;d<e;++d)if(c=this.layers[d],c.visibility&&(c===this.baseLayer||c.inRange))c.moveByPx(a,b),c.events.triggerEvent("move");this.events.triggerEvent("move")}},
-adjustZoom:function(a){if(this.baseLayer&&this.baseLayer.wrapDateLine){var b=this.baseLayer.resolutions,c=this.getMaxExtent().getWidth()/this.size.w;if(this.getResolutionForZoom(a)>c)if(this.fractionalZoom)a=this.getZoomForResolution(c);else for(var d=a|0,e=b.length;d<e;++d)if(b[d]<=c){a=d;break}}return a},getMinZoom:function(){return this.adjustZoom(0)},moveTo:function(a,b,c){null!=a&&!(a instanceof OpenLayers.LonLat)&&(a=new OpenLayers.LonLat(a));c||(c={});null!=b&&(b=parseFloat(b),this.fractionalZoom||
-(b=Math.round(b)));var d=b;b=this.adjustZoom(b);b!==d&&(a=this.getCenter());var d=c.dragging||this.dragging,e=c.forceZoomChange;!this.getCachedCenter()&&!this.isValidLonLat(a)&&(a=this.maxExtent.getCenterLonLat(),this.center=a.clone());if(null!=this.restrictedExtent){null==a&&(a=this.center);null==b&&(b=this.getZoom());var f=this.getResolutionForZoom(b),f=this.calculateBounds(a,f);if(!this.restrictedExtent.containsBounds(f)){var g=this.restrictedExtent.getCenterLonLat();f.getWidth()>this.restrictedExtent.getWidth()?
-a=new OpenLayers.LonLat(g.lon,a.lat):f.left<this.restrictedExtent.left?a=a.add(this.restrictedExtent.left-f.left,0):f.right>this.restrictedExtent.right&&(a=a.add(this.restrictedExtent.right-f.right,0));f.getHeight()>this.restrictedExtent.getHeight()?a=new OpenLayers.LonLat(a.lon,g.lat):f.bottom<this.restrictedExtent.bottom?a=a.add(0,this.restrictedExtent.bottom-f.bottom):f.top>this.restrictedExtent.top&&(a=a.add(0,this.restrictedExtent.top-f.top))}}e=e||this.isValidZoomLevel(b)&&b!=this.getZoom();
-f=this.isValidLonLat(a)&&!a.equals(this.center);if(e||f||d){d||this.events.triggerEvent("movestart",{zoomChanged:e});f&&(!e&&this.center&&this.centerLayerContainer(a),this.center=a.clone());a=e?this.getResolutionForZoom(b):this.getResolution();if(e||null==this.layerContainerOrigin){this.layerContainerOrigin=this.getCachedCenter();this.layerContainerOriginPx.x=0;this.layerContainerOriginPx.y=0;this.applyTransform();var f=this.getMaxExtent({restricted:!0}),h=f.getCenterLonLat(),g=this.center.lon-h.lon,
-h=h.lat-this.center.lat,k=Math.round(f.getWidth()/a),l=Math.round(f.getHeight()/a);this.minPx={x:(this.size.w-k)/2-g/a,y:(this.size.h-l)/2-h/a};this.maxPx={x:this.minPx.x+Math.round(f.getWidth()/a),y:this.minPx.y+Math.round(f.getHeight()/a)}}e&&(this.zoom=b,this.resolution=a);a=this.getExtent();this.baseLayer.visibility&&(this.baseLayer.moveTo(a,e,c.dragging),c.dragging||this.baseLayer.events.triggerEvent("moveend",{zoomChanged:e}));a=this.baseLayer.getExtent();for(b=this.layers.length-1;0<=b;--b)f=
-this.layers[b],f!==this.baseLayer&&!f.isBaseLayer&&(g=f.calculateInRange(),f.inRange!=g&&((f.inRange=g)||f.display(!1),this.events.triggerEvent("changelayer",{layer:f,property:"visibility"})),g&&f.visibility&&(f.moveTo(a,e,c.dragging),c.dragging||f.events.triggerEvent("moveend",{zoomChanged:e})));this.events.triggerEvent("move");d||this.events.triggerEvent("moveend");if(e){b=0;for(c=this.popups.length;b<c;b++)this.popups[b].updatePosition();this.events.triggerEvent("zoomend")}}},centerLayerContainer:function(a){var b=
-this.getViewPortPxFromLonLat(this.layerContainerOrigin),c=this.getViewPortPxFromLonLat(a);if(null!=b&&null!=c){var d=this.layerContainerOriginPx.x;a=this.layerContainerOriginPx.y;var e=Math.round(b.x-c.x),b=Math.round(b.y-c.y);this.applyTransform(this.layerContainerOriginPx.x=e,this.layerContainerOriginPx.y=b);d-=e;a-=b;this.minPx.x-=d;this.maxPx.x-=d;this.minPx.y-=a;this.maxPx.y-=a}},isValidZoomLevel:function(a){return null!=a&&0<=a&&a<this.getNumZoomLevels()},isValidLonLat:function(a){var b=!1;
-null!=a&&(b=this.getMaxExtent(),b=b.containsLonLat(a,{worldBounds:this.baseLayer.wrapDateLine&&b}));return b},getProjection:function(){var a=this.getProjectionObject();return a?a.getCode():null},getProjectionObject:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.projection);return a},getMaxResolution:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.maxResolution);return a},getMaxExtent:function(a){var b=null;a&&a.restricted&&this.restrictedExtent?b=this.restrictedExtent:
-null!=this.baseLayer&&(b=this.baseLayer.maxExtent);return b},getNumZoomLevels:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.numZoomLevels);return a},getExtent:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.getExtent());return a},getResolution:function(){var a=null;null!=this.baseLayer?a=this.baseLayer.getResolution():!0===this.allOverlays&&0<this.layers.length&&(a=this.layers[0].getResolution());return a},getUnits:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.units);
-return a},getScale:function(){var a=null;null!=this.baseLayer&&(a=this.getResolution(),a=OpenLayers.Util.getScaleFromResolution(a,this.baseLayer.units));return a},getZoomForExtent:function(a,b){var c=null;null!=this.baseLayer&&(c=this.baseLayer.getZoomForExtent(a,b));return c},getResolutionForZoom:function(a){var b=null;this.baseLayer&&(b=this.baseLayer.getResolutionForZoom(a));return b},getZoomForResolution:function(a,b){var c=null;null!=this.baseLayer&&(c=this.baseLayer.getZoomForResolution(a,b));
-return c},zoomTo:function(a,b){var c=this;if(c.isValidZoomLevel(a))if(c.baseLayer.wrapDateLine&&(a=c.adjustZoom(a)),c.zoomTween){var d=c.getResolution(),e=c.getResolutionForZoom(a),f={scale:1},d={scale:d/e};c.zoomTween.playing&&c.zoomTween.duration<3*c.zoomDuration?c.zoomTween.finish={scale:c.zoomTween.finish.scale*d.scale}:(b||(e=c.getSize(),b={x:e.w/2,y:e.h/2}),c.zoomTween.start(f,d,c.zoomDuration,{minFrameRate:50,callbacks:{eachStep:function(a){var d=c.layerContainerOriginPx;a=a.scale;c.applyTransform(d.x+
-((a-1)*(d.x-b.x)|0),d.y+((a-1)*(d.y-b.y)|0),a)},done:function(a){c.applyTransform();a=c.getResolution()/a.scale;var d=c.getZoomForResolution(a,!0);c.moveTo(c.getZoomTargetCenter(b,a),d,!0)}}}))}else f=b?c.getZoomTargetCenter(b,c.getResolutionForZoom(a)):null,c.setCenter(f,a)},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(a,b){a instanceof OpenLayers.Bounds||(a=new OpenLayers.Bounds(a));var c=a.getCenterLonLat();if(this.baseLayer.wrapDateLine){c=
-this.getMaxExtent();for(a=a.clone();a.right<a.left;)a.right+=c.getWidth();c=a.getCenterLonLat().wrapDateLine(c)}this.setCenter(c,this.getZoomForExtent(a,b))},zoomToMaxExtent:function(a){a=this.getMaxExtent({restricted:a?a.restricted:!0});this.zoomToExtent(a)},zoomToScale:function(a,b){var c=OpenLayers.Util.getResolutionFromScale(a,this.baseLayer.units),d=this.size.w*c/2,c=this.size.h*c/2,e=this.getCachedCenter(),d=new OpenLayers.Bounds(e.lon-d,e.lat-c,e.lon+d,e.lat+c);this.zoomToExtent(d,b)},getLonLatFromViewPortPx:function(a){var b=
-null;null!=this.baseLayer&&(b=this.baseLayer.getLonLatFromViewPortPx(a));return b},getViewPortPxFromLonLat:function(a){var b=null;null!=this.baseLayer&&(b=this.baseLayer.getViewPortPxFromLonLat(a));return b},getZoomTargetCenter:function(a,b){var c=null,d=this.getSize(),e=d.w/2-a.x,d=a.y-d.h/2,f=this.getLonLatFromPixel(a);f&&(c=new OpenLayers.LonLat(f.lon+e*b,f.lat+d*b));return c},getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(a){a=this.getViewPortPxFromLonLat(a);
-a.x=Math.round(a.x);a.y=Math.round(a.y);return a},getGeodesicPixelSize:function(a){var b=a?this.getLonLatFromPixel(a):this.getCachedCenter()||new OpenLayers.LonLat(0,0),c=this.getResolution();a=b.add(-c/2,0);var d=b.add(c/2,0),e=b.add(0,-c/2),b=b.add(0,c/2),c=new OpenLayers.Projection("EPSG:4326"),f=this.getProjectionObject()||c;f.equals(c)||(a.transform(f,c),d.transform(f,c),e.transform(f,c),b.transform(f,c));return new OpenLayers.Size(OpenLayers.Util.distVincenty(a,d),OpenLayers.Util.distVincenty(e,
-b))},getViewPortPxFromLayerPx:function(a){var b=null;null!=a&&(b=a.add(this.layerContainerOriginPx.x,this.layerContainerOriginPx.y));return b},getLayerPxFromViewPortPx:function(a){var b=null;if(null!=a&&(b=a.add(-this.layerContainerOriginPx.x,-this.layerContainerOriginPx.y),isNaN(b.x)||isNaN(b.y)))b=null;return b},getLonLatFromLayerPx:function(a){a=this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(a){a=this.getPixelFromLonLat(a);return this.getLayerPxFromViewPortPx(a)},
-applyTransform:function(a,b,c){c=c||1;var d=this.layerContainerOriginPx,e=1!==c;a=a||d.x;b=b||d.y;var f=this.layerContainerDiv.style,g=this.applyTransform.transform,h=this.applyTransform.template;if(void 0===g&&(g=OpenLayers.Util.vendorPrefix.style("transform"),this.applyTransform.transform=g)){var k=OpenLayers.Element.getStyle(this.viewPortDiv,OpenLayers.Util.vendorPrefix.css("transform"));if(!k||"none"!==k)h=["translate3d(",",0) ","scale3d(",",1)"],f[g]=[h[0],"0,0",h[1]].join("");if(!h||!~f[g].indexOf(h[0]))h=
-["translate(",") ","scale(",")"];this.applyTransform.template=h}null!==g&&("translate3d("===h[0]||!0===e)?(!0===e&&"translate("===h[0]&&(a-=d.x,b-=d.y,f.left=d.x+"px",f.top=d.y+"px"),f[g]=[h[0],a,"px,",b,"px",h[1],h[2],c,",",c,h[3]].join("")):(f.left=a+"px",f.top=b+"px",null!==g&&(f[g]=""))},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:1,alwaysInRange:null,RESOLUTION_PROPERTIES:"scales resolutions maxScale minScale maxResolution minResolution numZoomLevels maxZoomLevel".split(" "),events:null,map:null,isBaseLayer:!1,alpha:!1,displayInLayerSwitcher:!0,visibility:!0,attribution:null,inRange:!1,imageSize:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,
-numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:!1,wrapDateLine:!1,metadata:null,initialize:function(a,b){this.metadata={};b=OpenLayers.Util.extend({},b);null!=this.alwaysInRange&&(b.alwaysInRange=this.alwaysInRange);this.addOptions(b);this.name=a;if(null==this.id&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"),this.div=OpenLayers.Util.createDiv(this.id),this.div.style.width="100%",this.div.style.height="100%",this.div.dir="ltr",this.events=new OpenLayers.Events(this,
-this.div),this.eventListeners instanceof Object))this.events.on(this.eventListeners)},destroy:function(a){null==a&&(a=!0);null!=this.map&&this.map.removeLayer(this,a);this.options=this.div=this.name=this.map=this.projection=null;this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy());this.events=this.eventListeners=null},clone:function(a){null==a&&(a=new OpenLayers.Layer(this.name,this.getOptions()));OpenLayers.Util.applyDefaults(a,this);a.map=null;return a},
-getOptions:function(){var a={},b;for(b in this.options)a[b]=this[b];return a},setName:function(a){a!=this.name&&(this.name=a,null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"name"}))},addOptions:function(a,b){null==this.options&&(this.options={});a&&("string"==typeof a.projection&&(a.projection=new OpenLayers.Projection(a.projection)),a.projection&&OpenLayers.Util.applyDefaults(a,OpenLayers.Projection.defaults[a.projection.getCode()]),a.maxExtent&&!(a.maxExtent instanceof
-OpenLayers.Bounds)&&(a.maxExtent=new OpenLayers.Bounds(a.maxExtent)),a.minExtent&&!(a.minExtent instanceof OpenLayers.Bounds)&&(a.minExtent=new OpenLayers.Bounds(a.minExtent)));OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a);this.projection&&this.projection.getUnits()&&(this.units=this.projection.getUnits());if(this.map){var c=this.map.getResolution(),d=this.RESOLUTION_PROPERTIES.concat(["projection","units","minExtent","maxExtent"]),e;for(e in a)if(a.hasOwnProperty(e)&&0<=OpenLayers.Util.indexOf(d,
-e)){this.initResolutions();b&&this.map.baseLayer===this&&(this.map.setCenter(this.map.getCenter(),this.map.getZoomForResolution(c),!1,!0),this.map.events.triggerEvent("changebaselayer",{layer:this}));break}}},onMapResize:function(){},redraw:function(){var a=!1;if(this.map){this.inRange=this.calculateInRange();var b=this.getExtent();b&&(this.inRange&&this.visibility)&&(this.moveTo(b,!0,!1),this.events.triggerEvent("moveend",{zoomChanged:!0}),a=!0)}return a},moveTo:function(a,b,c){a=this.visibility;
-this.isBaseLayer||(a=a&&this.inRange);this.display(a)},moveByPx:function(a,b){},setMap:function(a){null==this.map&&(this.map=a,this.maxExtent=this.maxExtent||this.map.maxExtent,this.minExtent=this.minExtent||this.map.minExtent,this.projection=this.projection||this.map.projection,"string"==typeof this.projection&&(this.projection=new OpenLayers.Projection(this.projection)),this.units=this.projection.getUnits()||this.units||this.map.units,this.initResolutions(),this.isBaseLayer||(this.inRange=this.calculateInRange(),
-this.div.style.display=this.visibility&&this.inRange?"":"none"),this.setTileSize())},afterAdd:function(){},removeMap:function(a){},getImageSize:function(a){return this.imageSize||this.tileSize},setTileSize:function(a){this.tileSize=a=a?a:this.tileSize?this.tileSize:this.map.getTileSize();this.gutter&&(this.imageSize=new OpenLayers.Size(a.w+2*this.gutter,a.h+2*this.gutter))},getVisibility:function(){return this.visibility},setVisibility:function(a){a!=this.visibility&&(this.visibility=a,this.display(a),
-this.redraw(),null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"}),this.events.triggerEvent("visibilitychanged"))},display:function(a){a!=("none"!=this.div.style.display)&&(this.div.style.display=a&&this.calculateInRange()?"block":"none")},calculateInRange:function(){var a=!1;this.alwaysInRange?a=!0:this.map&&(a=this.map.getResolution(),a=a>=this.minResolution&&a<=this.maxResolution);return a},setIsBaseLayer:function(a){a!=this.isBaseLayer&&(this.isBaseLayer=
-a,null!=this.map&&this.map.events.triggerEvent("changebaselayer",{layer:this}))},initResolutions:function(){var a,b,c,d={},e=!0;a=0;for(b=this.RESOLUTION_PROPERTIES.length;a<b;a++)c=this.RESOLUTION_PROPERTIES[a],d[c]=this.options[c],e&&this.options[c]&&(e=!1);null==this.options.alwaysInRange&&(this.alwaysInRange=e);null==d.resolutions&&(d.resolutions=this.resolutionsFromScales(d.scales));null==d.resolutions&&(d.resolutions=this.calculateResolutions(d));if(null==d.resolutions){a=0;for(b=this.RESOLUTION_PROPERTIES.length;a<
-b;a++)c=this.RESOLUTION_PROPERTIES[a],d[c]=null!=this.options[c]?this.options[c]:this.map[c];null==d.resolutions&&(d.resolutions=this.resolutionsFromScales(d.scales));null==d.resolutions&&(d.resolutions=this.calculateResolutions(d))}var f;this.options.maxResolution&&"auto"!==this.options.maxResolution&&(f=this.options.maxResolution);this.options.minScale&&(f=OpenLayers.Util.getResolutionFromScale(this.options.minScale,this.units));var g;this.options.minResolution&&"auto"!==this.options.minResolution&&
-(g=this.options.minResolution);this.options.maxScale&&(g=OpenLayers.Util.getResolutionFromScale(this.options.maxScale,this.units));d.resolutions&&(d.resolutions.sort(function(a,b){return b-a}),f||(f=d.resolutions[0]),g||(g=d.resolutions[d.resolutions.length-1]));if(this.resolutions=d.resolutions){b=this.resolutions.length;this.scales=Array(b);for(a=0;a<b;a++)this.scales[a]=OpenLayers.Util.getScaleFromResolution(this.resolutions[a],this.units);this.numZoomLevels=b}if(this.minResolution=g)this.maxScale=
-OpenLayers.Util.getScaleFromResolution(g,this.units);if(this.maxResolution=f)this.minScale=OpenLayers.Util.getScaleFromResolution(f,this.units)},resolutionsFromScales:function(a){if(null!=a){var b,c,d;d=a.length;b=Array(d);for(c=0;c<d;c++)b[c]=OpenLayers.Util.getResolutionFromScale(a[c],this.units);return b}},calculateResolutions:function(a){var b,c,d=a.maxResolution;null!=a.minScale?d=OpenLayers.Util.getResolutionFromScale(a.minScale,this.units):"auto"==d&&null!=this.maxExtent&&(b=this.map.getSize(),
-c=this.maxExtent.getWidth()/b.w,b=this.maxExtent.getHeight()/b.h,d=Math.max(c,b));c=a.minResolution;null!=a.maxScale?c=OpenLayers.Util.getResolutionFromScale(a.maxScale,this.units):"auto"==a.minResolution&&null!=this.minExtent&&(b=this.map.getSize(),c=this.minExtent.getWidth()/b.w,b=this.minExtent.getHeight()/b.h,c=Math.max(c,b));"number"!==typeof d&&("number"!==typeof c&&null!=this.maxExtent)&&(d=this.map.getTileSize(),d=Math.max(this.maxExtent.getWidth()/d.w,this.maxExtent.getHeight()/d.h));b=a.maxZoomLevel;
-a=a.numZoomLevels;"number"===typeof c&&"number"===typeof d&&void 0===a?a=Math.floor(Math.log(d/c)/Math.log(2))+1:void 0===a&&null!=b&&(a=b+1);if(!("number"!==typeof a||0>=a||"number"!==typeof d&&"number"!==typeof c)){b=Array(a);var e=2;"number"==typeof c&&"number"==typeof d&&(e=Math.pow(d/c,1/(a-1)));var f;if("number"===typeof d)for(f=0;f<a;f++)b[f]=d/Math.pow(e,f);else for(f=0;f<a;f++)b[a-1-f]=c*Math.pow(e,f);return b}},getResolution:function(){var a=this.map.getZoom();return this.getResolutionForZoom(a)},
-getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(a,b){var c=this.map.getSize(),c=Math.max(a.getWidth()/c.w,a.getHeight()/c.h);return this.getZoomForResolution(c,b)},getDataExtent:function(){},getResolutionForZoom:function(a){a=Math.max(0,Math.min(a,this.resolutions.length-1));if(this.map.fractionalZoom){var b=Math.floor(a),c=Math.ceil(a);a=this.resolutions[b]-(a-b)*(this.resolutions[b]-this.resolutions[c])}else a=this.resolutions[Math.round(a)];return a},getZoomForResolution:function(a,
-b){var c,d;if(this.map.fractionalZoom){var e=0,f=this.resolutions[e],g=this.resolutions[this.resolutions.length-1],h;c=0;for(d=this.resolutions.length;c<d;++c)if(h=this.resolutions[c],h>=a&&(f=h,e=c),h<=a){g=h;break}c=f-g;c=0<c?e+(f-a)/c:e}else{f=Number.POSITIVE_INFINITY;c=0;for(d=this.resolutions.length;c<d;c++)if(b){e=Math.abs(this.resolutions[c]-a);if(e>f)break;f=e}else if(this.resolutions[c]<a)break;c=Math.max(0,c-1)}return c},getLonLatFromViewPortPx:function(a){var b=null,c=this.map;if(null!=
-a&&c.minPx){var b=c.getResolution(),d=c.getMaxExtent({restricted:!0}),b=new OpenLayers.LonLat((a.x-c.minPx.x)*b+d.left,(c.minPx.y-a.y)*b+d.top);this.wrapDateLine&&(b=b.wrapDateLine(this.maxExtent))}return b},getViewPortPxFromLonLat:function(a,b){var c=null;null!=a&&(b=b||this.map.getResolution(),c=this.map.calculateBounds(null,b),c=new OpenLayers.Pixel(1/b*(a.lon-c.left),1/b*(c.top-a.lat)));return c},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;for(var b=this.div.childNodes,c=0,d=b.length;c<
-d;++c){var e=b[c].firstChild||b[c],f=b[c].lastChild;f&&"iframe"===f.nodeName.toLowerCase()&&(e=f.parentNode);OpenLayers.Util.modifyDOMElement(e,null,null,null,null,null,null,a)}null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(a){if(this.gutter){var b=this.gutter*this.map.getResolution();a=new OpenLayers.Bounds(a.left-b,a.bottom-b,a.right+
-b,a.top+b)}this.wrapDateLine&&(b={rightTolerance:this.getResolution(),leftTolerance:this.getResolution()},a=a.wrapDateLine(this.maxExtent,b));return a},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Layer.SphericalMercator={getExtent:function(){var a=null;return a=this.sphericalMercator?this.map.calculateBounds():OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this)},getLonLatFromViewPortPx:function(a){return OpenLayers.Layer.prototype.getLonLatFromViewPortPx.apply(this,arguments)},getViewPortPxFromLonLat:function(a){return OpenLayers.Layer.prototype.getViewPortPxFromLonLat.apply(this,arguments)},initMercatorParameters:function(){this.RESOLUTIONS=[];for(var a=0;a<=this.MAX_ZOOM_LEVEL;++a)this.RESOLUTIONS[a]=
-156543.03390625/Math.pow(2,a);this.units="m";this.projection=this.projection||"EPSG:900913"},forwardMercator:function(){var a=new OpenLayers.Projection("EPSG:4326"),b=new OpenLayers.Projection("EPSG:900913");return function(c,d){var e=OpenLayers.Projection.transform({x:c,y:d},a,b);return new OpenLayers.LonLat(e.x,e.y)}}(),inverseMercator:function(){var a=new OpenLayers.Projection("EPSG:4326"),b=new OpenLayers.Projection("EPSG:900913");return function(c,d){var e=OpenLayers.Projection.transform({x:c,
-y:d},b,a);return new OpenLayers.LonLat(e.x,e.y)}}()};OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:!0,isBaseLayer:!0,isFixed:!0,pane:null,mapObject:null,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);null==this.pane&&(this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane"))},destroy:function(){this.pane=this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=
-parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";"msie"==OpenLayers.BROWSER_NAME&&(this.pane.style.background="url("+OpenLayers.Util.getImageLocation("blank.gif")+")");this.isFixed?this.map.viewPortDiv.appendChild(this.pane):this.map.layerContainerDiv.appendChild(this.pane);this.loadMapObject();null==this.mapObject&&this.loadWarningMessage()},removeMap:function(a){this.pane&&this.pane.parentNode&&this.pane.parentNode.removeChild(this.pane);
-OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var a=this.map.getSize(),b=Math.min(a.w,300),c=Math.min(a.h,200),b=new OpenLayers.Size(b,c),a=(new OpenLayers.Pixel(a.w/2,a.h/2)).add(-b.w/2,-b.h/2),a=OpenLayers.Util.createDiv(this.name+"_warning",a,b,null,null,null,"auto");a.style.padding="7px";a.style.backgroundColor="yellow";a.innerHTML=this.getWarningHTML();this.div.appendChild(a)},getWarningHTML:function(){return""},
-display:function(a){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display},setZIndex:function(a){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1},moveByPx:function(a,b){OpenLayers.Layer.prototype.moveByPx.apply(this,arguments);this.dragPanMapObject?this.dragPanMapObject(a,-b):this.moveTo(this.map.getCachedCenter())},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,
-arguments);if(null!=this.mapObject){var d=this.map.getCenter(),e=this.map.getZoom();if(null!=d){var f=this.getMapObjectCenter(),f=this.getOLLonLatFromMapObjectLonLat(f),g=this.getMapObjectZoom(),g=this.getOLZoomFromMapObjectZoom(g);if(!d.equals(f)||e!=g)!b&&f&&this.dragPanMapObject&&this.smoothDragPan?(e=this.map.getViewPortPxFromLonLat(f),d=this.map.getViewPortPxFromLonLat(d),this.dragPanMapObject(d.x-e.x,e.y-d.y)):(d=this.getMapObjectLonLatFromOLLonLat(d),e=this.getMapObjectZoomFromOLZoom(e),this.setMapObjectCenter(d,
-e,c))}}},getLonLatFromViewPortPx:function(a){var b=null;null!=this.mapObject&&null!=this.getMapObjectCenter()&&(a=this.getMapObjectPixelFromOLPixel(a),a=this.getMapObjectLonLatFromMapObjectPixel(a),b=this.getOLLonLatFromMapObjectLonLat(a));return b},getViewPortPxFromLonLat:function(a){var b=null;null!=this.mapObject&&null!=this.getMapObjectCenter()&&(a=this.getMapObjectLonLatFromOLLonLat(a),a=this.getMapObjectPixelFromMapObjectLonLat(a),b=this.getOLPixelFromMapObjectPixel(a));return b},getOLLonLatFromMapObjectLonLat:function(a){var b=
-null;null!=a&&(b=this.getLongitudeFromMapObjectLonLat(a),a=this.getLatitudeFromMapObjectLonLat(a),b=new OpenLayers.LonLat(b,a));return b},getMapObjectLonLatFromOLLonLat:function(a){var b=null;null!=a&&(b=this.getMapObjectLonLatFromLonLat(a.lon,a.lat));return b},getOLPixelFromMapObjectPixel:function(a){var b=null;null!=a&&(b=this.getXFromMapObjectPixel(a),a=this.getYFromMapObjectPixel(a),b=new OpenLayers.Pixel(b,a));return b},getMapObjectPixelFromOLPixel:function(a){var b=null;null!=a&&(b=this.getMapObjectPixelFromXY(a.x,
-a.y));return b},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){for(var a=["minZoomLevel","maxZoomLevel","numZoomLevels"],b=0,c=a.length;b<c;b++){var d=a[b];this[d]=null!=this.options[d]?this.options[d]:this.map[d]}if(null==this.minZoomLevel||this.minZoomLevel<this.MIN_ZOOM_LEVEL)this.minZoomLevel=this.MIN_ZOOM_LEVEL;a=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;b=null==this.options.numZoomLevels&&null!=this.options.maxZoomLevel||null==this.numZoomLevels&&null!=this.maxZoomLevel?
-this.maxZoomLevel-this.minZoomLevel+1:this.numZoomLevels;this.numZoomLevels=null!=b?Math.min(b,a):a;this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(null!=this.RESOLUTIONS){a=0;this.resolutions=[];for(b=this.minZoomLevel;b<=this.maxZoomLevel;b++)this.resolutions[a++]=this.RESOLUTIONS[b];this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1]}},getResolution:function(){if(null!=this.resolutions)return OpenLayers.Layer.prototype.getResolution.apply(this,
-arguments);var a=null,b=this.map.getSize(),c=this.getExtent();null!=b&&null!=c&&(a=Math.max(c.getWidth()/b.w,c.getHeight()/b.h));return a},getExtent:function(){var a=this.map.getSize(),b=this.getLonLatFromViewPortPx({x:0,y:0}),a=this.getLonLatFromViewPortPx({x:a.w,y:a.h});return null!=b&&null!=a?new OpenLayers.Bounds(b.lon,a.lat,a.lon,b.lat):null},getZoomForResolution:function(a){if(null!=this.resolutions)return OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments);var b=OpenLayers.Layer.prototype.getExtent.apply(this,
-[]);return this.getZoomForExtent(b)},getOLZoomFromMapObjectZoom:function(a){var b=null;null!=a&&(b=a-this.minZoomLevel,this.map.baseLayer!==this&&(b=this.map.baseLayer.getZoomForResolution(this.getResolutionForZoom(b))));return b},getMapObjectZoomFromOLZoom:function(a){var b=null;null!=a&&(b=a+this.minZoomLevel,this.map.baseLayer!==this&&(b=this.getZoomForResolution(this.map.baseLayer.getResolutionForZoom(b))));return b},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});OpenLayers.Layer.Google=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:21,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,6.866455078125E-4,3.4332275390625E-4,1.71661376953125E-4,8.58306884765625E-5,4.291534423828125E-5,2.145767211914062E-5,1.072883605957031E-5,5.36441802978515E-6,2.68220901489257E-6,1.341104507446289E-6,6.705522537231445E-7],
-type:null,wrapDateLine:!0,sphericalMercator:!1,version:null,initialize:function(a,b){b=b||{};b.version||(b.version="function"===typeof GMap2?"2":"3");var c=OpenLayers.Layer.Google["v"+b.version.replace(/\./g,"_")];if(c)OpenLayers.Util.applyDefaults(b,c);else throw"Unsupported Google Maps API version: "+b.version;OpenLayers.Util.applyDefaults(b,c.DEFAULTS);b.maxExtent&&(b.maxExtent=b.maxExtent.clone());OpenLayers.Layer.EventPane.prototype.initialize.apply(this,[a,b]);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
-[a,b]);this.sphericalMercator&&(OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator),this.initMercatorParameters())},clone:function(){return new OpenLayers.Layer.Google(this.name,this.getOptions())},setVisibility:function(a){var b=null==this.opacity?1:this.opacity;OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this,arguments);this.setOpacity(b)},display:function(a){this._dragging||this.setGMapVisibility(a);OpenLayers.Layer.EventPane.prototype.display.apply(this,arguments)},moveTo:function(a,
-b,c){this._dragging=c;OpenLayers.Layer.EventPane.prototype.moveTo.apply(this,arguments);delete this._dragging},setOpacity:function(a){a!==this.opacity&&(null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"}),this.opacity=a);if(this.getVisibility()){var b=this.getMapContainer();OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,a)}},destroy:function(){if(this.map){this.setGMapVisibility(!1);var a=OpenLayers.Layer.Google.cache[this.map.id];a&&1>=a.count&&
-this.removeGMapElements()}OpenLayers.Layer.EventPane.prototype.destroy.apply(this,arguments)},removeGMapElements:function(){var a=OpenLayers.Layer.Google.cache[this.map.id];if(a){var b=this.mapObject&&this.getMapContainer();b&&b.parentNode&&b.parentNode.removeChild(b);(b=a.termsOfUse)&&b.parentNode&&b.parentNode.removeChild(b);(a=a.poweredBy)&&a.parentNode&&a.parentNode.removeChild(a);this.mapObject&&(window.google&&google.maps&&google.maps.event&&google.maps.event.clearListeners)&&google.maps.event.clearListeners(this.mapObject,
-"tilesloaded")}},removeMap:function(a){this.visibility&&this.mapObject&&this.setGMapVisibility(!1);var b=OpenLayers.Layer.Google.cache[a.id];b&&(1>=b.count?(this.removeGMapElements(),delete OpenLayers.Layer.Google.cache[a.id]):--b.count);delete this.termsOfUse;delete this.poweredBy;delete this.mapObject;delete this.dragObject;OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments)},getOLBoundsFromMapObjectBounds:function(a){var b=null;null!=a&&(b=a.getSouthWest(),a=a.getNorthEast(),this.sphericalMercator?
-(b=this.forwardMercator(b.lng(),b.lat()),a=this.forwardMercator(a.lng(),a.lat())):(b=new OpenLayers.LonLat(b.lng(),b.lat()),a=new OpenLayers.LonLat(a.lng(),a.lat())),b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat));return b},getWarningHTML:function(){return OpenLayers.i18n("googleWarning")},getMapObjectCenter:function(){return this.mapObject.getCenter()},getMapObjectZoom:function(){return this.mapObject.getZoom()},getLongitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),
-a.lat()).lon:a.lng()},getLatitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),a.lat()).lat:a.lat()},getXFromMapObjectPixel:function(a){return a.x},getYFromMapObjectPixel:function(a){return a.y},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Google.cache={};
-OpenLayers.Layer.Google.v2={termsOfUse:null,poweredBy:null,dragObject:null,loadMapObject:function(){this.type||(this.type=G_NORMAL_MAP);var a,b,c,d=OpenLayers.Layer.Google.cache[this.map.id];if(d)a=d.mapObject,b=d.termsOfUse,c=d.poweredBy,++d.count;else{var d=this.map.viewPortDiv,e=document.createElement("div");e.id=this.map.id+"_GMap2Container";e.style.position="absolute";e.style.width="100%";e.style.height="100%";d.appendChild(e);try{a=new GMap2(e),b=e.lastChild,d.appendChild(b),b.style.zIndex=
-"1100",b.style.right="",b.style.bottom="",b.className="olLayerGoogleCopyright",c=e.lastChild,d.appendChild(c),c.style.zIndex="1100",c.style.right="",c.style.bottom="",c.className="olLayerGooglePoweredBy gmnoprint"}catch(f){throw f;}OpenLayers.Layer.Google.cache[this.map.id]={mapObject:a,termsOfUse:b,poweredBy:c,count:1}}this.mapObject=a;this.termsOfUse=b;this.poweredBy=c;-1===OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)&&this.mapObject.addMapType(this.type);"function"==typeof a.getDragObject?
-this.dragObject=a.getDragObject():this.dragPanMapObject=null;!1===this.isBaseLayer&&this.setGMapVisibility("none"!==this.div.style.display)},onMapResize:function(){if(this.visibility&&this.mapObject.isLoaded())this.mapObject.checkResize();else{if(!this._resized)var a=this,b=GEvent.addListener(this.mapObject,"load",function(){GEvent.removeListener(b);delete a._resized;a.mapObject.checkResize();a.moveTo(a.map.getCenter(),a.map.getZoom())});this._resized=!0}},setGMapVisibility:function(a){var b=OpenLayers.Layer.Google.cache[this.map.id];
-if(b){var c=this.mapObject.getContainer();!0===a?(this.mapObject.setMapType(this.type),c.style.display="",this.termsOfUse.style.left="",this.termsOfUse.style.display="",this.poweredBy.style.display="",b.displayed=this.id):(b.displayed===this.id&&delete b.displayed,b.displayed||(c.style.display="none",this.termsOfUse.style.display="none",this.termsOfUse.style.left="-9999px",this.poweredBy.style.display="none"))}},getMapContainer:function(){return this.mapObject.getContainer()},getMapObjectBoundsFromOLBounds:function(a){var b=
-null;null!=a&&(b=this.sphericalMercator?this.inverseMercator(a.bottom,a.left):new OpenLayers.LonLat(a.bottom,a.left),a=this.sphericalMercator?this.inverseMercator(a.top,a.right):new OpenLayers.LonLat(a.top,a.right),b=new GLatLngBounds(new GLatLng(b.lat,b.lon),new GLatLng(a.lat,a.lon)));return b},setMapObjectCenter:function(a,b){this.mapObject.setCenter(a,b)},dragPanMapObject:function(a,b){this.dragObject.moveBy(new GSize(-a,b))},getMapObjectLonLatFromMapObjectPixel:function(a){return this.mapObject.fromContainerPixelToLatLng(a)},
-getMapObjectPixelFromMapObjectLonLat:function(a){return this.mapObject.fromLatLngToContainerPixel(a)},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getMapObjectLonLatFromLonLat:function(a,b){var c;this.sphericalMercator?(c=this.inverseMercator(a,b),c=new GLatLng(c.lat,c.lon)):c=new GLatLng(b,a);return c},getMapObjectPixelFromXY:function(a,b){return new GPoint(a,b)}};OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:!1,displayClass:"",title:"",autoActivate:!1,active:null,handlerOptions:null,handler:null,eventListeners:null,events:null,initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object)this.events.on(this.eventListeners);null==this.id&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+
-"_"))},destroy:function(){this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy(),this.events=null);this.eventListeners=null;this.handler&&(this.handler.destroy(),this.handler=null);if(this.handlers){for(var a in this.handlers)this.handlers.hasOwnProperty(a)&&"function"==typeof this.handlers[a].destroy&&this.handlers[a].destroy();this.handlers=null}this.map&&(this.map.removeControl(this),this.map=null);this.div=null},setMap:function(a){this.map=a;this.handler&&
-this.handler.setMap(a)},draw:function(a){null==this.div&&(this.div=OpenLayers.Util.createDiv(this.id),this.div.className=this.displayClass,this.allowSelection||(this.div.className+=" olControlNoSelect",this.div.setAttribute("unselectable","on",0),this.div.onselectstart=OpenLayers.Function.False),""!=this.title&&(this.div.title=this.title));null!=a&&(this.position=a.clone());this.moveTo(this.position);return this.div},moveTo:function(a){null!=a&&null!=this.div&&(this.div.style.left=a.x+"px",this.div.style.top=
-a.y+"px")},activate:function(){if(this.active)return!1;this.handler&&this.handler.activate();this.active=!0;this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");this.events.triggerEvent("activate");return!0},deactivate:function(){return this.active?(this.handler&&this.handler.deactivate(),this.active=!1,this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("deactivate"),
-!0):!1},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Strategy=OpenLayers.Class({layer:null,options:null,active:null,autoActivate:!0,autoDestroy:!0,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a;this.active=!1},destroy:function(){this.deactivate();this.options=this.layer=null},setLayer:function(a){this.layer=a},activate:function(){return!this.active?this.active=!0:!1},deactivate:function(){return this.active?(this.active=!1,!0):!1},CLASS_NAME:"OpenLayers.Strategy"});OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:null,popup:null,initialize:function(a,b,c){this.layer=a;this.lonlat=b;this.data=null!=c?c:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){null!=this.layer&&null!=this.layer.map&&null!=this.popup&&this.layer.map.removePopup(this.popup);null!=this.layer&&null!=this.marker&&this.layer.removeMarker(this.marker);this.data=this.lonlat=this.id=this.layer=null;null!=this.marker&&
+{layer:a,property:"order"});this.allOverlays&&(0===b?this.setBaseLayer(a):this.baseLayer!==this.layers[0]&&this.setBaseLayer(this.layers[0]))}},raiseLayer:function(a,b){var c=this.getLayerIndex(a)+b;this.setLayerIndex(a,c)},setBaseLayer:function(a){if(a!=this.baseLayer&&-1!=OpenLayers.Util.indexOf(this.layers,a)){var b=this.getCachedCenter(),c=this.getResolution(),d=OpenLayers.Util.getResolutionFromScale(this.getScale(),a.units);null!=this.baseLayer&&!this.allOverlays&&this.baseLayer.setVisibility(!1);
+this.baseLayer=a;if(!this.allOverlays||this.baseLayer.visibility)this.baseLayer.setVisibility(!0),!1===this.baseLayer.inRange&&this.baseLayer.redraw();null!=b&&(a=this.getZoomForResolution(d||this.resolution,!0),this.setCenter(b,a,!1,c!=d));this.events.triggerEvent("changebaselayer",{layer:this.baseLayer})}},addControl:function(a,b){this.controls.push(a);this.addControlToMap(a,b)},addControls:function(a,b){for(var c=1===arguments.length?[]:b,d=0,e=a.length;d<e;d++)this.addControl(a[d],c[d]?c[d]:null)},
+addControlToMap:function(a,b){a.outsideViewport=null!=a.div;this.displayProjection&&!a.displayProjection&&(a.displayProjection=this.displayProjection);a.setMap(this);var c=a.draw(b);c&&!a.outsideViewport&&(c.style.zIndex=this.Z_INDEX_BASE.Control+this.controls.length,this.viewPortDiv.appendChild(c));a.autoActivate&&a.activate()},getControl:function(a){for(var b=null,c=0,d=this.controls.length;c<d;c++){var e=this.controls[c];if(e.id==a){b=e;break}}return b},removeControl:function(a){a&&a==this.getControl(a.id)&&
+(a.div&&a.div.parentNode==this.viewPortDiv&&this.viewPortDiv.removeChild(a.div),OpenLayers.Util.removeItem(this.controls,a))},addPopup:function(a,b){if(b)for(var c=this.popups.length-1;0<=c;--c)this.removePopup(this.popups[c]);a.map=this;this.popups.push(a);if(c=a.draw())c.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length,this.layerContainerDiv.appendChild(c)},removePopup:function(a){OpenLayers.Util.removeItem(this.popups,a);if(a.div)try{this.layerContainerDiv.removeChild(a.div)}catch(b){}a.map=
+null},getSize:function(){var a=null;null!=this.size&&(a=this.size.clone());return a},updateSize:function(){var a=this.getCurrentSize();if(a&&!isNaN(a.h)&&!isNaN(a.w)){this.events.clearMouseCache();var b=this.getSize();null==b&&(this.size=b=a);if(!a.equals(b)){this.size=a;a=0;for(b=this.layers.length;a<b;a++)this.layers[a].onMapResize();a=this.getCachedCenter();null!=this.baseLayer&&null!=a&&(b=this.getZoom(),this.zoom=null,this.setCenter(a,b))}}this.events.triggerEvent("updatesize")},getCurrentSize:function(){var a=
+new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(0==a.w&&0==a.h||isNaN(a.w)&&isNaN(a.h))a.w=this.div.offsetWidth,a.h=this.div.offsetHeight;if(0==a.w&&0==a.h||isNaN(a.w)&&isNaN(a.h))a.w=parseInt(this.div.style.width),a.h=parseInt(this.div.style.height);return a},calculateBounds:function(a,b){var c=null;null==a&&(a=this.getCachedCenter());null==b&&(b=this.getResolution());if(null!=a&&null!=b)var c=this.size.w*b/2,d=this.size.h*b/2,c=new OpenLayers.Bounds(a.lon-c,a.lat-d,a.lon+c,a.lat+
+d);return c},getCenter:function(){var a=null,b=this.getCachedCenter();b&&(a=b.clone());return a},getCachedCenter:function(){!this.center&&this.size&&(this.center=this.getLonLatFromViewPortPx({x:this.size.w/2,y:this.size.h/2}));return this.center},getZoom:function(){return this.zoom},pan:function(a,b,c){c=OpenLayers.Util.applyDefaults(c,{animate:!0,dragging:!1});if(c.dragging)(0!=a||0!=b)&&this.moveByPx(a,b);else{var d=this.getViewPortPxFromLonLat(this.getCachedCenter());a=d.add(a,b);if(this.dragging||
+!a.equals(d))d=this.getLonLatFromViewPortPx(a),c.animate?this.panTo(d):(this.moveTo(d),this.dragging&&(this.dragging=!1,this.events.triggerEvent("moveend")))}},panTo:function(a){if(this.panTween&&this.getExtent().scale(this.panRatio).containsLonLat(a)){var b=this.getCachedCenter();if(!a.equals(b)){var b=this.getPixelFromLonLat(b),c=this.getPixelFromLonLat(a),d=0,e=0;this.panTween.start({x:0,y:0},{x:c.x-b.x,y:c.y-b.y},this.panDuration,{callbacks:{eachStep:OpenLayers.Function.bind(function(a){this.moveByPx(a.x-
+d,a.y-e);d=Math.round(a.x);e=Math.round(a.y)},this),done:OpenLayers.Function.bind(function(b){this.moveTo(a);this.dragging=!1;this.events.triggerEvent("moveend")},this)}})}}else this.setCenter(a)},setCenter:function(a,b,c,d){this.panTween&&this.panTween.stop();this.zoomTween&&this.zoomTween.stop();this.moveTo(a,b,{dragging:c,forceZoomChange:d})},moveByPx:function(a,b){var c=this.size.w/2,d=this.size.h/2,e=c+a,f=d+b,g=this.baseLayer.wrapDateLine,h=0,k=0;this.restrictedExtent&&(h=c,k=d,g=!1);a=g||e<=
+this.maxPx.x-h&&e>=this.minPx.x+h?Math.round(a):0;b=f<=this.maxPx.y-k&&f>=this.minPx.y+k?Math.round(b):0;if(a||b){this.dragging||(this.dragging=!0,this.events.triggerEvent("movestart"));this.center=null;a&&(this.layerContainerOriginPx.x-=a,this.minPx.x-=a,this.maxPx.x-=a);b&&(this.layerContainerOriginPx.y-=b,this.minPx.y-=b,this.maxPx.y-=b);this.applyTransform();d=0;for(e=this.layers.length;d<e;++d)if(c=this.layers[d],c.visibility&&(c===this.baseLayer||c.inRange))c.moveByPx(a,b),c.events.triggerEvent("move");
+this.events.triggerEvent("move")}},adjustZoom:function(a){if(this.baseLayer&&this.baseLayer.wrapDateLine){var b=this.baseLayer.resolutions,c=this.getMaxExtent().getWidth()/this.size.w;if(this.getResolutionForZoom(a)>c)if(this.fractionalZoom)a=this.getZoomForResolution(c);else for(var d=a|0,e=b.length;d<e;++d)if(b[d]<=c){a=d;break}}return a},getMinZoom:function(){return this.adjustZoom(0)},moveTo:function(a,b,c){null!=a&&!(a instanceof OpenLayers.LonLat)&&(a=new OpenLayers.LonLat(a));c||(c={});null!=
+b&&(b=parseFloat(b),this.fractionalZoom||(b=Math.round(b)));var d=b;b=this.adjustZoom(b);b!==d&&(a=this.getCenter());var d=c.dragging||this.dragging,e=c.forceZoomChange;!this.getCachedCenter()&&!this.isValidLonLat(a)&&(a=this.maxExtent.getCenterLonLat(),this.center=a.clone());if(null!=this.restrictedExtent){null==a&&(a=this.center);null==b&&(b=this.getZoom());var f=this.getResolutionForZoom(b),f=this.calculateBounds(a,f);if(!this.restrictedExtent.containsBounds(f)){var g=this.restrictedExtent.getCenterLonLat();
+f.getWidth()>this.restrictedExtent.getWidth()?a=new OpenLayers.LonLat(g.lon,a.lat):f.left<this.restrictedExtent.left?a=a.add(this.restrictedExtent.left-f.left,0):f.right>this.restrictedExtent.right&&(a=a.add(this.restrictedExtent.right-f.right,0));f.getHeight()>this.restrictedExtent.getHeight()?a=new OpenLayers.LonLat(a.lon,g.lat):f.bottom<this.restrictedExtent.bottom?a=a.add(0,this.restrictedExtent.bottom-f.bottom):f.top>this.restrictedExtent.top&&(a=a.add(0,this.restrictedExtent.top-f.top))}}e=
+e||this.isValidZoomLevel(b)&&b!=this.getZoom();f=this.isValidLonLat(a)&&!a.equals(this.center);if(e||f||d){d||this.events.triggerEvent("movestart",{zoomChanged:e});f&&(!e&&this.center&&this.centerLayerContainer(a),this.center=a.clone());a=e?this.getResolutionForZoom(b):this.getResolution();if(e||null==this.layerContainerOrigin){this.layerContainerOrigin=this.getCachedCenter();this.layerContainerOriginPx.x=0;this.layerContainerOriginPx.y=0;this.applyTransform();var f=this.getMaxExtent({restricted:!0}),
+h=f.getCenterLonLat(),g=this.center.lon-h.lon,h=h.lat-this.center.lat,k=Math.round(f.getWidth()/a),l=Math.round(f.getHeight()/a);this.minPx={x:(this.size.w-k)/2-g/a,y:(this.size.h-l)/2-h/a};this.maxPx={x:this.minPx.x+Math.round(f.getWidth()/a),y:this.minPx.y+Math.round(f.getHeight()/a)}}e&&(this.zoom=b,this.resolution=a);a=this.getExtent();this.baseLayer.visibility&&(this.baseLayer.moveTo(a,e,c.dragging),c.dragging||this.baseLayer.events.triggerEvent("moveend",{zoomChanged:e}));a=this.baseLayer.getExtent();
+for(b=this.layers.length-1;0<=b;--b)f=this.layers[b],f!==this.baseLayer&&!f.isBaseLayer&&(g=f.calculateInRange(),f.inRange!=g&&((f.inRange=g)||f.display(!1),this.events.triggerEvent("changelayer",{layer:f,property:"visibility"})),g&&f.visibility&&(f.moveTo(a,e,c.dragging),c.dragging||f.events.triggerEvent("moveend",{zoomChanged:e})));this.events.triggerEvent("move");d||this.events.triggerEvent("moveend");if(e){b=0;for(c=this.popups.length;b<c;b++)this.popups[b].updatePosition();this.events.triggerEvent("zoomend")}}},
+centerLayerContainer:function(a){var b=this.getViewPortPxFromLonLat(this.layerContainerOrigin),c=this.getViewPortPxFromLonLat(a);if(null!=b&&null!=c){var d=this.layerContainerOriginPx.x;a=this.layerContainerOriginPx.y;var e=Math.round(b.x-c.x),b=Math.round(b.y-c.y);this.applyTransform(this.layerContainerOriginPx.x=e,this.layerContainerOriginPx.y=b);d-=e;a-=b;this.minPx.x-=d;this.maxPx.x-=d;this.minPx.y-=a;this.maxPx.y-=a}},isValidZoomLevel:function(a){return null!=a&&0<=a&&a<this.getNumZoomLevels()},
+isValidLonLat:function(a){var b=!1;null!=a&&(b=this.getMaxExtent(),b=b.containsLonLat(a,{worldBounds:this.baseLayer.wrapDateLine&&b}));return b},getProjection:function(){var a=this.getProjectionObject();return a?a.getCode():null},getProjectionObject:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.projection);return a},getMaxResolution:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.maxResolution);return a},getMaxExtent:function(a){var b=null;a&&a.restricted&&this.restrictedExtent?
+b=this.restrictedExtent:null!=this.baseLayer&&(b=this.baseLayer.maxExtent);return b},getNumZoomLevels:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.numZoomLevels);return a},getExtent:function(){var a=null;null!=this.baseLayer&&(a=this.baseLayer.getExtent());return a},getResolution:function(){var a=null;null!=this.baseLayer?a=this.baseLayer.getResolution():!0===this.allOverlays&&0<this.layers.length&&(a=this.layers[0].getResolution());return a},getUnits:function(){var a=null;null!=
+this.baseLayer&&(a=this.baseLayer.units);return a},getScale:function(){var a=null;null!=this.baseLayer&&(a=this.getResolution(),a=OpenLayers.Util.getScaleFromResolution(a,this.baseLayer.units));return a},getZoomForExtent:function(a,b){var c=null;null!=this.baseLayer&&(c=this.baseLayer.getZoomForExtent(a,b));return c},getResolutionForZoom:function(a){var b=null;this.baseLayer&&(b=this.baseLayer.getResolutionForZoom(a));return b},getZoomForResolution:function(a,b){var c=null;null!=this.baseLayer&&(c=
+this.baseLayer.getZoomForResolution(a,b));return c},zoomTo:function(a,b){var c=this;if(c.isValidZoomLevel(a)){c.baseLayer.wrapDateLine&&(a=c.adjustZoom(a));var d=b?c.getZoomTargetCenter(b,c.getResolutionForZoom(a)):c.getCenter();d&&c.events.triggerEvent("zoomstart",{center:d,zoom:a});if(c.zoomTween){c.zoomTween.stop();var e=c.getResolution(),f=c.getResolutionForZoom(a),e={scale:e/f};b||(f=c.getSize(),b={x:f.w/2,y:f.h/2});c.zoomTween.start({scale:1},e,c.zoomDuration,{minFrameRate:50,callbacks:{eachStep:function(a){var d=
+c.layerContainerOriginPx;a=a.scale;c.applyTransform(d.x+((a-1)*(d.x-b.x)|0),d.y+((a-1)*(d.y-b.y)|0),a)},done:function(a){c.applyTransform();var e=c.getResolution()/a.scale,f=c.getZoomForResolution(e,!0);a=1===a.scale?d:c.getZoomTargetCenter(b,e);c.moveTo(a,f)}}})}else c.setCenter(d,a)}},zoomIn:function(){this.zoomTween&&this.zoomTween.stop();this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTween&&this.zoomTween.stop();this.zoomTo(this.getZoom()-1)},zoomToExtent:function(a,b){a instanceof
+OpenLayers.Bounds||(a=new OpenLayers.Bounds(a));var c=a.getCenterLonLat();if(this.baseLayer.wrapDateLine){c=this.getMaxExtent();for(a=a.clone();a.right<a.left;)a.right+=c.getWidth();c=a.getCenterLonLat().wrapDateLine(c)}this.setCenter(c,this.getZoomForExtent(a,b))},zoomToMaxExtent:function(a){a=this.getMaxExtent({restricted:a?a.restricted:!0});this.zoomToExtent(a)},zoomToScale:function(a,b){var c=OpenLayers.Util.getResolutionFromScale(a,this.baseLayer.units),d=this.size.w*c/2,c=this.size.h*c/2,e=
+this.getCachedCenter(),d=new OpenLayers.Bounds(e.lon-d,e.lat-c,e.lon+d,e.lat+c);this.zoomToExtent(d,b)},getLonLatFromViewPortPx:function(a){var b=null;null!=this.baseLayer&&(b=this.baseLayer.getLonLatFromViewPortPx(a));return b},getViewPortPxFromLonLat:function(a){var b=null;null!=this.baseLayer&&(b=this.baseLayer.getViewPortPxFromLonLat(a));return b},getZoomTargetCenter:function(a,b){var c=null,d=this.getSize(),e=d.w/2-a.x,d=a.y-d.h/2,f=this.getLonLatFromPixel(a);f&&(c=new OpenLayers.LonLat(f.lon+
+e*b,f.lat+d*b));return c},getLonLatFromPixel:function(a){return this.getLonLatFromViewPortPx(a)},getPixelFromLonLat:function(a){a=this.getViewPortPxFromLonLat(a);a.x=Math.round(a.x);a.y=Math.round(a.y);return a},getGeodesicPixelSize:function(a){var b=a?this.getLonLatFromPixel(a):this.getCachedCenter()||new OpenLayers.LonLat(0,0),c=this.getResolution();a=b.add(-c/2,0);var d=b.add(c/2,0),e=b.add(0,-c/2),b=b.add(0,c/2),c=new OpenLayers.Projection("EPSG:4326"),f=this.getProjectionObject()||c;f.equals(c)||
+(a.transform(f,c),d.transform(f,c),e.transform(f,c),b.transform(f,c));return new OpenLayers.Size(OpenLayers.Util.distVincenty(a,d),OpenLayers.Util.distVincenty(e,b))},getViewPortPxFromLayerPx:function(a){var b=null;null!=a&&(b=a.add(this.layerContainerOriginPx.x,this.layerContainerOriginPx.y));return b},getLayerPxFromViewPortPx:function(a){var b=null;if(null!=a&&(b=a.add(-this.layerContainerOriginPx.x,-this.layerContainerOriginPx.y),isNaN(b.x)||isNaN(b.y)))b=null;return b},getLonLatFromLayerPx:function(a){a=
+this.getViewPortPxFromLayerPx(a);return this.getLonLatFromViewPortPx(a)},getLayerPxFromLonLat:function(a){a=this.getPixelFromLonLat(a);return this.getLayerPxFromViewPortPx(a)},applyTransform:function(a,b,c){c=c||1;var d=this.layerContainerOriginPx,e=1!==c;a=a||d.x;b=b||d.y;var f=this.layerContainerDiv.style,g=this.applyTransform.transform,h=this.applyTransform.template;if(void 0===g&&(g=OpenLayers.Util.vendorPrefix.style("transform"),this.applyTransform.transform=g)){var k=OpenLayers.Element.getStyle(this.viewPortDiv,
+OpenLayers.Util.vendorPrefix.css("transform"));if(!k||"none"!==k)h=["translate3d(",",0) ","scale3d(",",1)"],f[g]=[h[0],"0,0",h[1]].join("");if(!h||!~f[g].indexOf(h[0]))h=["translate(",") ","scale(",")"];this.applyTransform.template=h}null!==g&&("translate3d("===h[0]||!0===e)?(!0===e&&"translate("===h[0]&&(a-=d.x,b-=d.y,f.left=d.x+"px",f.top=d.y+"px"),f[g]=[h[0],a,"px,",b,"px",h[1],h[2],c,",",c,h[3]].join("")):(f.left=a+"px",f.top=b+"px",null!==g&&(f[g]=""))},CLASS_NAME:"OpenLayers.Map"});
+OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:null,popup:null,initialize:function(a,b,c){this.layer=a;this.lonlat=b;this.data=null!=c?c:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){null!=this.layer&&null!=this.layer.map&&null!=this.popup&&this.layer.map.removePopup(this.popup);null!=this.layer&&null!=this.marker&&this.layer.removeMarker(this.marker);this.data=this.lonlat=this.id=this.layer=null;null!=this.marker&&
 (this.destroyMarker(this.marker),this.marker=null);null!=this.popup&&(this.destroyPopup(this.popup),this.popup=null)},onScreen:function(){var a=!1;null!=this.layer&&null!=this.layer.map&&(a=this.layer.map.getExtent().containsLonLat(this.lonlat));return a},createMarker:function(){null!=this.lonlat&&(this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon));return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(a){null!=this.lonlat&&(this.popup||(this.popup=new (this.popupClass?
 this.popupClass:OpenLayers.Popup.Anchored)(this.id+"_popup",this.lonlat,this.data.popupSize,this.data.popupContentHTML,this.marker?this.marker.icon:null,a)),null!=this.data.overflow&&(this.popup.contentDiv.style.overflow=this.data.overflow),this.popup.feature=this);return this.popup},destroyPopup:function(){this.popup&&(this.popup.feature=null,this.popup.destroy(),this.popup=null)},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};
 OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",modified:null,initialize:function(a,b,c){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,b]);this.lonlat=null;this.geometry=a?a:null;this.state=null;this.attributes={};b&&(this.attributes=OpenLayers.Util.extend(this.attributes,b));this.style=c?c:null},destroy:function(){this.layer&&(this.layer.removeFeatures(this),this.layer=
 (this.destroyMarker(this.marker),this.marker=null);null!=this.popup&&(this.destroyPopup(this.popup),this.popup=null)},onScreen:function(){var a=!1;null!=this.layer&&null!=this.layer.map&&(a=this.layer.map.getExtent().containsLonLat(this.lonlat));return a},createMarker:function(){null!=this.lonlat&&(this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon));return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(a){null!=this.lonlat&&(this.popup||(this.popup=new (this.popupClass?
 this.popupClass:OpenLayers.Popup.Anchored)(this.id+"_popup",this.lonlat,this.data.popupSize,this.data.popupContentHTML,this.marker?this.marker.icon:null,a)),null!=this.data.overflow&&(this.popup.contentDiv.style.overflow=this.data.overflow),this.popup.feature=this);return this.popup},destroyPopup:function(){this.popup&&(this.popup.feature=null,this.popup.destroy(),this.popup=null)},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.State={UNKNOWN:"Unknown",INSERT:"Insert",UPDATE:"Update",DELETE:"Delete"};
 OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",modified:null,initialize:function(a,b,c){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,b]);this.lonlat=null;this.geometry=a?a:null;this.state=null;this.attributes={};b&&(this.attributes=OpenLayers.Util.extend(this.attributes,b));this.style=c?c:null},destroy:function(){this.layer&&(this.layer.removeFeatures(this),this.layer=
@@ -261,198 +216,146 @@ this.rules[a]=null;this.defaultStyle=this.rules=null},createSymbolizer:function(
 return this.createLiterals(OpenLayers.Util.extend(b,a),c)},createLiterals:function(a,b){var c=OpenLayers.Util.extend({},b.attributes||b.data);OpenLayers.Util.extend(c,this.context);for(var d in this.propertyStyles)a[d]=OpenLayers.Style.createLiteral(a[d],c,b,d);return a},findPropertyStyles:function(){var a={};this.addPropertyStyles(a,this.defaultStyle);for(var b=this.rules,c,d,e=0,f=b.length;e<f;e++){c=b[e].symbolizer;for(var g in c)if(d=c[g],"object"==typeof d)this.addPropertyStyles(a,d);else{this.addPropertyStyles(a,
 c);break}}return a},addPropertyStyles:function(a,b){var c,d;for(d in b)c=b[d],"string"==typeof c&&c.match(/\$\{\w+\}/)&&(a[d]=!0);return a},addRules:function(a){Array.prototype.push.apply(this.rules,a);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(a){this.defaultStyle=a;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(a){for(var b=OpenLayers.Style.SYMBOLIZER_PREFIXES,c=0,d=b.length;c<d;c++)if(-1!=a.CLASS_NAME.indexOf(b[c]))return b[c]},clone:function(){var a=
 OpenLayers.Util.extend({},this);if(this.rules){a.rules=[];for(var b=0,c=this.rules.length;b<c;++b)a.rules.push(this.rules[b].clone())}a.context=this.context&&OpenLayers.Util.extend({},this.context);b=OpenLayers.Util.extend({},this.defaultStyle);return new OpenLayers.Style(b,a)},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(a,b,c,d){"string"==typeof a&&-1!=a.indexOf("${")&&(a=OpenLayers.String.format(a,b,[c,d]),a=isNaN(a)||!a?a:parseFloat(a));return a};
 return this.createLiterals(OpenLayers.Util.extend(b,a),c)},createLiterals:function(a,b){var c=OpenLayers.Util.extend({},b.attributes||b.data);OpenLayers.Util.extend(c,this.context);for(var d in this.propertyStyles)a[d]=OpenLayers.Style.createLiteral(a[d],c,b,d);return a},findPropertyStyles:function(){var a={};this.addPropertyStyles(a,this.defaultStyle);for(var b=this.rules,c,d,e=0,f=b.length;e<f;e++){c=b[e].symbolizer;for(var g in c)if(d=c[g],"object"==typeof d)this.addPropertyStyles(a,d);else{this.addPropertyStyles(a,
 c);break}}return a},addPropertyStyles:function(a,b){var c,d;for(d in b)c=b[d],"string"==typeof c&&c.match(/\$\{\w+\}/)&&(a[d]=!0);return a},addRules:function(a){Array.prototype.push.apply(this.rules,a);this.propertyStyles=this.findPropertyStyles()},setDefaultStyle:function(a){this.defaultStyle=a;this.propertyStyles=this.findPropertyStyles()},getSymbolizerPrefix:function(a){for(var b=OpenLayers.Style.SYMBOLIZER_PREFIXES,c=0,d=b.length;c<d;c++)if(-1!=a.CLASS_NAME.indexOf(b[c]))return b[c]},clone:function(){var a=
 OpenLayers.Util.extend({},this);if(this.rules){a.rules=[];for(var b=0,c=this.rules.length;b<c;++b)a.rules.push(this.rules[b].clone())}a.context=this.context&&OpenLayers.Util.extend({},this.context);b=OpenLayers.Util.extend({},this.defaultStyle);return new OpenLayers.Style(b,a)},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(a,b,c,d){"string"==typeof a&&-1!=a.indexOf("${")&&(a=OpenLayers.String.format(a,b,[c,d]),a=isNaN(a)||!a?a:parseFloat(a));return a};
-OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text","Raster"];OpenLayers.Filter=OpenLayers.Class({initialize:function(a){OpenLayers.Util.extend(this,a)},destroy:function(){},evaluate:function(a){return!0},clone:function(){return null},toString:function(){return OpenLayers.Format&&OpenLayers.Format.CQL?OpenLayers.Format.CQL.prototype.write(this):Object.prototype.toString.call(this)},CLASS_NAME:"OpenLayers.Filter"});OpenLayers.Strategy.Filter=OpenLayers.Class(OpenLayers.Strategy,{filter:null,cache:null,caching:!1,activate:function(){var a=OpenLayers.Strategy.prototype.activate.apply(this,arguments);a&&(this.cache=[],this.layer.events.on({beforefeaturesadded:this.handleAdd,beforefeaturesremoved:this.handleRemove,scope:this}));return a},deactivate:function(){this.cache=null;this.layer&&this.layer.events&&this.layer.events.un({beforefeaturesadded:this.handleAdd,beforefeaturesremoved:this.handleRemove,scope:this});
-return OpenLayers.Strategy.prototype.deactivate.apply(this,arguments)},handleAdd:function(a){if(!this.caching&&this.filter){var b=a.features;a.features=[];for(var c,d=0,e=b.length;d<e;++d)c=b[d],this.filter.evaluate(c)?a.features.push(c):this.cache.push(c)}},handleRemove:function(a){this.caching||(this.cache=[])},setFilter:function(a){this.filter=a;a=this.cache;this.cache=[];this.handleAdd({features:this.layer.features});0<this.cache.length&&(this.caching=!0,this.layer.removeFeatures(this.cache.slice()),
-this.caching=!1);0<a.length&&(a={features:a},this.handleAdd(a),0<a.features.length&&(this.caching=!0,this.layer.addFeatures(a.features),this.caching=!1))},CLASS_NAME:"OpenLayers.Strategy.Filter"});OpenLayers.Tile=OpenLayers.Class({events:null,eventListeners:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:!1,initialize:function(a,b,c,d,e,f){this.layer=a;this.position=b.clone();this.setBounds(c);this.url=d;e&&(this.size=e.clone());this.id=OpenLayers.Util.createUniqueID("Tile_");OpenLayers.Util.extend(this,f);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object)this.events.on(this.eventListeners)},unload:function(){this.isLoading&&(this.isLoading=
-!1,this.events.triggerEvent("unload"))},destroy:function(){this.position=this.size=this.bounds=this.layer=null;this.eventListeners&&this.events.un(this.eventListeners);this.events.destroy();this.events=this.eventListeners=null},draw:function(a){a||this.clear();var b=this.shouldDraw();b&&(!a&&!1===this.events.triggerEvent("beforedraw"))&&(b=null);return b},shouldDraw:function(){var a=!1,b=this.layer.maxExtent;if(b){var c=this.layer.map,c=c.baseLayer.wrapDateLine&&c.getMaxExtent();this.bounds.intersectsBounds(b,
-{inclusive:!1,worldBounds:c})&&(a=!0)}return a||this.layer.displayOutsideMaxExtent},setBounds:function(a){a=a.clone();if(this.layer.map.baseLayer.wrapDateLine){var b=this.layer.map.getMaxExtent(),c=this.layer.map.getResolution();a=a.wrapDateLine(b,{leftTolerance:c,rightTolerance:c})}this.bounds=a},moveTo:function(a,b,c){null==c&&(c=!0);this.setBounds(a);this.position=b.clone();c&&this.draw()},clear:function(a){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,imageReloadAttempts:null,layerAlphaHack:null,asyncRequestId:null,maxGetUrlLength:null,canvasContext:null,crossOriginKeyword:null,initialize:function(a,b,c,d,e,f){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=d;this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();if(null!=this.maxGetUrlLength||this.layer.gutter||this.layerAlphaHack)this.frame=document.createElement("div"),this.frame.style.position=
-"absolute",this.frame.style.overflow="hidden";null!=this.maxGetUrlLength&&OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame)},destroy:function(){this.imgDiv&&(this.clear(),this.frame=this.imgDiv=null);this.asyncRequestId=null;OpenLayers.Tile.prototype.destroy.apply(this,arguments)},draw:function(){var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);a?(this.layer!=this.layer.map.baseLayer&&this.layer.reproject&&(this.bounds=this.getBoundsFromBaseLayer(this.position)),this.isLoading?this._loadEvent=
-"reload":(this.isLoading=!0,this._loadEvent="loadstart"),this.renderTile(),this.positionTile()):!1===a&&this.unload();return a},renderTile:function(){if(this.layer.async){var a=this.asyncRequestId=(this.asyncRequestId||0)+1;this.layer.getURLasync(this.bounds,function(b){a==this.asyncRequestId&&(this.url=b,this.initImage())},this)}else this.url=this.layer.getURL(this.bounds),this.initImage()},positionTile:function(){var a=this.getTile().style,b=this.frame?this.size:this.layer.getImageSize(this.bounds),
-c=1;this.layer instanceof OpenLayers.Layer.Grid&&(c=this.layer.getServerResolution()/this.layer.map.getResolution());a.left=this.position.x+"px";a.top=this.position.y+"px";a.width=Math.round(c*b.w)+"px";a.height=Math.round(c*b.h)+"px"},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);var a=this.imgDiv;if(a){var b=this.getTile();b.parentNode===this.layer.div&&this.layer.div.removeChild(b);this.setImgSrc();!0===this.layerAlphaHack&&(a.style.filter="");OpenLayers.Element.removeClass(a,
-"olImageLoadError")}this.canvasContext=null},getImage:function(){if(!this.imgDiv){this.imgDiv=OpenLayers.Tile.Image.IMAGE.cloneNode(!1);var a=this.imgDiv.style;if(this.frame){var b=0,c=0;this.layer.gutter&&(b=100*(this.layer.gutter/this.layer.tileSize.w),c=100*(this.layer.gutter/this.layer.tileSize.h));a.left=-b+"%";a.top=-c+"%";a.width=2*b+100+"%";a.height=2*c+100+"%"}a.visibility="hidden";a.opacity=0;1>this.layer.opacity&&(a.filter="alpha(opacity="+100*this.layer.opacity+")");a.position="absolute";
-this.layerAlphaHack&&(a.paddingTop=a.height,a.height="0",a.width="100%");this.frame&&this.frame.appendChild(this.imgDiv)}return this.imgDiv},setImage:function(a){this.imgDiv=a},initImage:function(){if(!this.url&&!this.imgDiv)this.isLoading=!1;else{this.events.triggerEvent("beforeload");this.layer.div.appendChild(this.getTile());this.events.triggerEvent(this._loadEvent);var a=this.getImage(),b=a.getAttribute("src")||"";this.url&&OpenLayers.Util.isEquivalentUrl(b,this.url)?this._loadTimeout=window.setTimeout(OpenLayers.Function.bind(this.onImageLoad,
-this),0):(this.stopLoading(),this.crossOriginKeyword&&a.removeAttribute("crossorigin"),OpenLayers.Event.observe(a,"load",OpenLayers.Function.bind(this.onImageLoad,this)),OpenLayers.Event.observe(a,"error",OpenLayers.Function.bind(this.onImageError,this)),this.imageReloadAttempts=0,this.setImgSrc(this.url))}},setImgSrc:function(a){var b=this.imgDiv;a?(b.style.visibility="hidden",b.style.opacity=0,this.crossOriginKeyword&&("data:"!==a.substr(0,5)?b.setAttribute("crossorigin",this.crossOriginKeyword):
-b.removeAttribute("crossorigin")),b.src=a):(this.stopLoading(),this.imgDiv=null,b.parentNode&&b.parentNode.removeChild(b))},getTile:function(){return this.frame?this.frame:this.getImage()},createBackBuffer:function(){if(this.imgDiv&&!this.isLoading){var a;this.frame?(a=this.frame.cloneNode(!1),a.appendChild(this.imgDiv)):a=this.imgDiv;this.imgDiv=null;return a}},onImageLoad:function(){var a=this.imgDiv;this.stopLoading();a.style.visibility="inherit";a.style.opacity=this.layer.opacity;this.isLoading=
-!1;this.canvasContext=null;this.events.triggerEvent("loadend");!0===this.layerAlphaHack&&(a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a.src+"', sizingMethod='scale')")},onImageError:function(){var a=this.imgDiv;null!=a.src&&(this.imageReloadAttempts++,this.imageReloadAttempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS?this.setImgSrc(this.layer.getURL(this.bounds)):(OpenLayers.Element.addClass(a,"olImageLoadError"),this.events.triggerEvent("loaderror"),this.onImageLoad()))},stopLoading:function(){OpenLayers.Event.stopObservingElement(this.imgDiv);
-window.clearTimeout(this._loadTimeout);delete this._loadTimeout},getCanvasContext:function(){if(OpenLayers.CANVAS_SUPPORTED&&this.imgDiv&&!this.isLoading){if(!this.canvasContext){var a=document.createElement("canvas");a.width=this.size.w;a.height=this.size.h;this.canvasContext=a.getContext("2d");this.canvasContext.drawImage(this.imgDiv,0,0)}return this.canvasContext}},CLASS_NAME:"OpenLayers.Tile.Image"});
-OpenLayers.Tile.Image.IMAGE=function(){var a=new Image;a.className="olTileImage";a.galleryImg="no";return a}();OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!0,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(a,b,c,d,e){this.url=b;this.maxExtent=this.extent=c;this.size=d;OpenLayers.Layer.prototype.initialize.apply(this,[a,e]);this.aspectRatio=this.extent.getHeight()/this.size.h/(this.extent.getWidth()/this.size.w)},destroy:function(){this.tile&&(this.removeTileMonitoringHooks(this.tile),this.tile.destroy(),this.tile=null);OpenLayers.Layer.prototype.destroy.apply(this,
-arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.getOptions()));return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setMap:function(a){null==this.options.maxResolution&&(this.options.maxResolution=this.aspectRatio*this.extent.getWidth()/this.size.w);OpenLayers.Layer.prototype.setMap.apply(this,arguments)},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var d=null==this.tile;if(b||d){this.setTileSize();
-var e=this.map.getLayerPxFromLonLat({lon:this.extent.left,lat:this.extent.top});d?(this.tile=new OpenLayers.Tile.Image(this,e,this.extent,null,this.tileSize),this.addTileMonitoringHooks(this.tile)):(this.tile.size=this.tileSize.clone(),this.tile.position=e.clone());this.tile.draw()}},setTileSize:function(){var a=this.extent.getWidth()/this.map.getResolution(),b=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(a,b)},addTileMonitoringHooks:function(a){a.onLoadStart=
-function(){this.events.triggerEvent("loadstart")};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.events.triggerEvent("loadend")};a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},setUrl:function(a){this.url=a;this.tile.draw()},getURL:function(a){return this.url},CLASS_NAME:"OpenLayers.Layer.Image"});OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.bounds=this.id=null},clone:function(){return new OpenLayers.Geometry},setBounds:function(a){a&&(this.bounds=a.clone())},clearBounds:function(){this.bounds=null;this.parent&&this.parent.clearBounds()},extendBounds:function(a){this.getBounds()?this.bounds.extend(a):this.setBounds(a)},getBounds:function(){null==this.bounds&&this.calculateBounds();
+OpenLayers.Style.SYMBOLIZER_PREFIXES=["Point","Line","Polygon","Text","Raster"];OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:!1,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(a){this.symbolizer={};OpenLayers.Util.extend(this,a);this.symbolizers&&delete this.symbolizer;this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a in this.symbolizer)this.symbolizer[a]=null;this.symbolizer=null;delete this.symbolizers},evaluate:function(a){var b=
+this.getContext(a),c=!0;if(this.minScaleDenominator||this.maxScaleDenominator)var d=a.layer.map.getScale();this.minScaleDenominator&&(c=d>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b));c&&this.maxScaleDenominator&&(c=d<OpenLayers.Style.createLiteral(this.maxScaleDenominator,b));c&&this.filter&&(c="OpenLayers.Filter.FeatureId"==this.filter.CLASS_NAME?this.filter.evaluate(a):this.filter.evaluate(b));return c},getContext:function(a){var b=this.context;b||(b=a.attributes||a.data);"function"==
+typeof this.context&&(b=this.context(a));return b},clone:function(){var a=OpenLayers.Util.extend({},this);if(this.symbolizers){var b=this.symbolizers.length;a.symbolizers=Array(b);for(var c=0;c<b;++c)a.symbolizers[c]=this.symbolizers[c].clone()}else{a.symbolizer={};for(var d in this.symbolizer)b=this.symbolizer[d],c=typeof b,"object"===c?a.symbolizer[d]=OpenLayers.Util.extend({},b):"string"===c&&(a.symbolizer[d]=b)}a.filter=this.filter&&this.filter.clone();a.context=this.context&&OpenLayers.Util.extend({},
+this.context);return new OpenLayers.Rule(a)},CLASS_NAME:"OpenLayers.Rule"});OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:!0,initialize:function(a,b){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style.select),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style.temporary),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(a instanceof OpenLayers.Style)this.styles["default"]=a,this.styles.select=a,this.styles.temporary=a,this.styles["delete"]=
+a;else if("object"==typeof a)for(var c in a)if(a[c]instanceof OpenLayers.Style)this.styles[c]=a[c];else if("object"==typeof a[c])this.styles[c]=new OpenLayers.Style(a[c]);else{this.styles["default"]=new OpenLayers.Style(a);this.styles.select=new OpenLayers.Style(a);this.styles.temporary=new OpenLayers.Style(a);this.styles["delete"]=new OpenLayers.Style(a);break}OpenLayers.Util.extend(this,b)},destroy:function(){for(var a in this.styles)this.styles[a].destroy();this.styles=null},createSymbolizer:function(a,
+b){a||(a=new OpenLayers.Feature.Vector);this.styles[b]||(b="default");a.renderIntent=b;var c={};this.extendDefault&&"default"!=b&&(c=this.styles["default"].createSymbolizer(a));return OpenLayers.Util.extend(c,this.styles[b].createSymbolizer(a))},addUniqueValueRules:function(a,b,c,d){var e=[],f;for(f in c)e.push(new OpenLayers.Rule({symbolizer:c[f],context:d,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:b,value:f})}));this.styles[a].addRules(e)},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.ProxyHost="";OpenLayers.Request||(OpenLayers.Request={});
+OpenLayers.Util.extend(OpenLayers.Request,{DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:!0,user:void 0,password:void 0,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},URL_SPLIT_REGEX:/([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,events:new OpenLayers.Events(this),makeSameOrigin:function(a,b){var c=0!==a.indexOf("http"),d=!c&&a.match(this.URL_SPLIT_REGEX);if(d){var e=window.location,c=d[1]==e.protocol&&d[3]==
+e.hostname,d=d[4],e=e.port;if(80!=d&&""!=d||"80"!=e&&""!=e)c=c&&d==e}c||b&&(a="function"==typeof b?b(a):b+encodeURIComponent(a));return a},issue:function(a){var b=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});a=a||{};a.headers=a.headers||{};a=OpenLayers.Util.applyDefaults(a,b);a.headers=OpenLayers.Util.applyDefaults(a.headers,b.headers);var b=!1,c;for(c in a.headers)a.headers.hasOwnProperty(c)&&"x-requested-with"===c.toLowerCase()&&(b=!0);!1===b&&(a.headers["X-Requested-With"]=
+"XMLHttpRequest");var d=new OpenLayers.Request.XMLHttpRequest,e=OpenLayers.Util.urlAppend(a.url,OpenLayers.Util.getParameterString(a.params||{})),e=OpenLayers.Request.makeSameOrigin(e,a.proxy);d.open(a.method,e,a.async,a.user,a.password);for(var f in a.headers)d.setRequestHeader(f,a.headers[f]);var g=this.events,h=this;d.onreadystatechange=function(){d.readyState==OpenLayers.Request.XMLHttpRequest.DONE&&!1!==g.triggerEvent("complete",{request:d,config:a,requestUrl:e})&&h.runCallbacks({request:d,config:a,
+requestUrl:e})};!1===a.async?d.send(a.data):window.setTimeout(function(){0!==d.readyState&&d.send(a.data)},0);return d},runCallbacks:function(a){var b=a.request,c=a.config,d=c.scope?OpenLayers.Function.bind(c.callback,c.scope):c.callback,e;c.success&&(e=c.scope?OpenLayers.Function.bind(c.success,c.scope):c.success);var f;c.failure&&(f=c.scope?OpenLayers.Function.bind(c.failure,c.scope):c.failure);"file:"==OpenLayers.Util.createUrlObject(c.url).protocol&&b.responseText&&(b.status=200);d(b);if(!b.status||
+200<=b.status&&300>b.status)this.events.triggerEvent("success",a),e&&e(b);if(b.status&&(200>b.status||300<=b.status))this.events.triggerEvent("failure",a),f&&f(b)},GET:function(a){a=OpenLayers.Util.extend(a,{method:"GET"});return OpenLayers.Request.issue(a)},POST:function(a){a=OpenLayers.Util.extend(a,{method:"POST"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");return OpenLayers.Request.issue(a)},PUT:function(a){a=
+OpenLayers.Util.extend(a,{method:"PUT"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");return OpenLayers.Request.issue(a)},DELETE:function(a){a=OpenLayers.Util.extend(a,{method:"DELETE"});return OpenLayers.Request.issue(a)},HEAD:function(a){a=OpenLayers.Util.extend(a,{method:"HEAD"});return OpenLayers.Request.issue(a)},OPTIONS:function(a){a=OpenLayers.Util.extend(a,{method:"OPTIONS"});return OpenLayers.Request.issue(a)}});(function(){function a(){this._object=f&&!k?new f:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[]}function b(){return new a}function c(a){b.onreadystatechange&&b.onreadystatechange.apply(a);a.dispatchEvent({type:"readystatechange",bubbles:!1,cancelable:!1,timeStamp:new Date+0})}function d(a){try{a.responseText=a._object.responseText}catch(b){}try{var c;var d=a._object,e=d.responseXML,f=d.responseText;h&&(f&&e&&!e.documentElement&&d.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/))&&
+(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.validateOnParse=!1,e.loadXML(f));c=e&&(h&&0!=e.parseError||!e.documentElement||e.documentElement&&"parsererror"==e.documentElement.tagName)?null:e;a.responseXML=c}catch(g){}try{a.status=a._object.status}catch(k){}try{a.statusText=a._object.statusText}catch(u){}}function e(a){a._object.onreadystatechange=new window.Function}var f=window.XMLHttpRequest,g=!!window.controllers,h=window.document.all&&!window.opera,k=h&&window.navigator.userAgent.match(/MSIE 7.0/);
+b.prototype=a.prototype;g&&f.wrapped&&(b.wrapped=f.wrapped);b.UNSENT=0;b.OPENED=1;b.HEADERS_RECEIVED=2;b.LOADING=3;b.DONE=4;b.prototype.readyState=b.UNSENT;b.prototype.responseText="";b.prototype.responseXML=null;b.prototype.status=0;b.prototype.statusText="";b.prototype.priority="NORMAL";b.prototype.onreadystatechange=null;b.onreadystatechange=null;b.onopen=null;b.onsend=null;b.onabort=null;b.prototype.open=function(a,f,k,q,n){delete this._headers;3>arguments.length&&(k=!0);this._async=k;var p=this,
+s=this.readyState,t;h&&k&&(t=function(){s!=b.DONE&&(e(p),p.abort())},window.attachEvent("onunload",t));b.onopen&&b.onopen.apply(this,arguments);4<arguments.length?this._object.open(a,f,k,q,n):3<arguments.length?this._object.open(a,f,k,q):this._object.open(a,f,k);this.readyState=b.OPENED;c(this);this._object.onreadystatechange=function(){if(!g||k)p.readyState=p._object.readyState,d(p),p._aborted?p.readyState=b.UNSENT:(p.readyState==b.DONE&&(delete p._data,e(p),h&&k&&window.detachEvent("onunload",t)),
+s!=p.readyState&&c(p),s=p.readyState)}};b.prototype.send=function(a){b.onsend&&b.onsend.apply(this,arguments);arguments.length||(a=null);a&&a.nodeType&&(a=window.XMLSerializer?(new window.XMLSerializer).serializeToString(a):a.xml,this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml"));this._data=a;a:if(this._object.send(this._data),g&&!this._async){this.readyState=b.OPENED;for(d(this);this.readyState<b.DONE;)if(this.readyState++,c(this),this._aborted)break a}};
+b.prototype.abort=function(){b.onabort&&b.onabort.apply(this,arguments);this.readyState>b.UNSENT&&(this._aborted=!0);this._object.abort();e(this);this.readyState=b.UNSENT;delete this._data};b.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};b.prototype.getResponseHeader=function(a){return this._object.getResponseHeader(a)};b.prototype.setRequestHeader=function(a,b){this._headers||(this._headers={});this._headers[a]=b;return this._object.setRequestHeader(a,b)};
+b.prototype.addEventListener=function(a,b,c){for(var d=0,e;e=this._listeners[d];d++)if(e[0]==a&&e[1]==b&&e[2]==c)return;this._listeners.push([a,b,c])};b.prototype.removeEventListener=function(a,b,c){for(var d=0,e;(e=this._listeners[d])&&!(e[0]==a&&e[1]==b&&e[2]==c);d++);e&&this._listeners.splice(d,1)};b.prototype.dispatchEvent=function(a){a={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){},
+initEvent:function(){}};"readystatechange"==a.type&&this.onreadystatechange&&(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[a]);for(var b=0,c;c=this._listeners[b];b++)c[0]==a.type&&!c[2]&&(c[1].handleEvent||c[1]).apply(this,[a])};b.prototype.toString=function(){return"[object XMLHttpRequest]"};b.toString=function(){return"[XMLHttpRequest]"};window.Function.prototype.apply||(window.Function.prototype.apply=function(a,b){b||(b=[]);a.__func=this;a.__func(b[0],b[1],b[2],b[3],
+b[4]);delete a.__func});OpenLayers.Request||(OpenLayers.Request={});OpenLayers.Request.XMLHttpRequest=b})();OpenLayers.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:!0,defaultFilter:null,initialize:function(a){a=a||{};OpenLayers.Util.extend(this,a);this.options=a},mergeWithDefaultFilter:function(a){return a&&this.defaultFilter?new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.defaultFilter,a]}):a||this.defaultFilter||void 0},destroy:function(){this.format=this.options=null},read:function(a){a=a||{};a.filter=this.mergeWithDefaultFilter(a.filter)},create:function(){},
+update:function(){},"delete":function(){},commit:function(){},abort:function(a){},createCallback:function(a,b,c){return OpenLayers.Function.bind(function(){a.apply(this,[b,c])},this)},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:!0,features:null,data:null,reqFeatures:null,priv:null,error:null,initialize:function(a){OpenLayers.Util.extend(this,a)},success:function(){return 0<this.code},CLASS_NAME:"OpenLayers.Protocol.Response"});
+OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;OpenLayers.Protocol.WFS=function(a){a=OpenLayers.Util.applyDefaults(a,OpenLayers.Protocol.WFS.DEFAULTS);var b=OpenLayers.Protocol.WFS["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported WFS version: "+a.version;return new b(a)};
+OpenLayers.Protocol.WFS.fromWMSLayer=function(a,b){var c,d;c=a.params.LAYERS;c=(OpenLayers.Util.isArray(c)?c[0]:c).split(":");1<c.length&&(d=c[0]);c=c.pop();d={url:a.url,featureType:c,featurePrefix:d,srsName:a.projection&&a.projection.getCode()||a.map&&a.map.getProjectionObject().getCode(),version:"1.1.0"};return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(b,d))};OpenLayers.Protocol.WFS.DEFAULTS={version:"1.0.0"};OpenLayers.Protocol.WFS.v1=OpenLayers.Class(OpenLayers.Protocol,{version:null,srsName:"EPSG:4326",featureType:null,featureNS:null,geometryName:"the_geom",schema:null,featurePrefix:"feature",formatOptions:null,readFormat:null,readOptions:null,initialize:function(a){OpenLayers.Protocol.prototype.initialize.apply(this,[a]);a.format||(this.format=OpenLayers.Format.WFST(OpenLayers.Util.extend({version:this.version,featureType:this.featureType,featureNS:this.featureNS,featurePrefix:this.featurePrefix,geometryName:this.geometryName,
+srsName:this.srsName,schema:this.schema},this.formatOptions)));!a.geometryName&&1<parseFloat(this.format.version)&&this.setGeometryName(null)},destroy:function(){this.options&&!this.options.format&&this.format.destroy();this.format=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(a){OpenLayers.Protocol.prototype.read.apply(this,arguments);a=OpenLayers.Util.extend({},a);OpenLayers.Util.applyDefaults(a,this.options||{});var b=new OpenLayers.Protocol.Response({requestType:"read"}),
+c=OpenLayers.Format.XML.prototype.write.apply(this.format,[this.format.writeNode("wfs:GetFeature",a)]);b.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleRead,b,a),params:a.params,headers:a.headers,data:c});return b},setFeatureType:function(a){this.featureType=a;this.format.featureType=a},setGeometryName:function(a){this.geometryName=a;this.format.geometryName=a},handleRead:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);if(b.callback){var c=
+a.priv;200<=c.status&&300>c.status?(c=this.parseResponse(c,b.readOptions))&&!1!==c.success?(b.readOptions&&"object"==b.readOptions.output?OpenLayers.Util.extend(a,c):a.features=c,a.code=OpenLayers.Protocol.Response.SUCCESS):(a.code=OpenLayers.Protocol.Response.FAILURE,a.error=c):a.code=OpenLayers.Protocol.Response.FAILURE;b.callback.call(b.scope,a)}},parseResponse:function(a,b){var c=a.responseXML;if(!c||!c.documentElement)c=a.responseText;if(!c||0>=c.length)return null;c=null!==this.readFormat?this.readFormat.read(c):
+this.format.read(c,b);if(!this.featureNS){var d=this.readFormat||this.format;this.featureNS=d.featureNS;d.autoConfig=!1;this.geometryName||this.setGeometryName(d.geometryName)}return c},commit:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);var c=new OpenLayers.Protocol.Response({requestType:"commit",reqFeatures:a});c.priv=OpenLayers.Request.POST({url:b.url,headers:b.headers,data:this.format.write(a,b),callback:this.createCallback(this.handleCommit,c,b)});
+return c},handleCommit:function(a,b){if(b.callback){var c=a.priv,d=c.responseXML;if(!d||!d.documentElement)d=c.responseText;c=this.format.read(d)||{};a.insertIds=c.insertIds||[];c.success?a.code=OpenLayers.Protocol.Response.SUCCESS:(a.code=OpenLayers.Protocol.Response.FAILURE,a.error=c);b.callback.call(b.scope,a)}},filterDelete:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);new OpenLayers.Protocol.Response({requestType:"commit"});var c=this.format.createElementNSPlus("wfs:Transaction",
+{attributes:{service:"WFS",version:this.version}}),d=this.format.createElementNSPlus("wfs:Delete",{attributes:{typeName:(b.featureNS?this.featurePrefix+":":"")+b.featureType}});b.featureNS&&d.setAttribute("xmlns:"+this.featurePrefix,b.featureNS);var e=this.format.writeNode("ogc:Filter",a);d.appendChild(e);c.appendChild(d);c=OpenLayers.Format.XML.prototype.write.apply(this.format,[c]);return OpenLayers.Request.POST({url:this.url,callback:b.callback||function(){},data:c})},abort:function(a){a&&a.priv.abort()},
+CLASS_NAME:"OpenLayers.Protocol.WFS.v1"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:!1,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){},read:function(a){throw Error("Read not implemented.");},write:function(a){throw Error("Write not implemented.");},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(a){OpenLayers.Format.XML.supportActiveX&&(this.xmldom=new ActiveXObject("Microsoft.XMLDOM"));OpenLayers.Format.prototype.initialize.apply(this,[a]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var b in this.namespaces)this.namespaceAlias[this.namespaces[b]]=b},destroy:function(){this.xmldom=null;
+OpenLayers.Format.prototype.destroy.apply(this,arguments)},setNamespace:function(a,b){this.namespaces[a]=b;this.namespaceAlias[b]=a},read:function(a){var b=a.indexOf("<");0<b&&(a=a.substring(b));b=OpenLayers.Util.Try(OpenLayers.Function.bind(function(){var b;b=OpenLayers.Format.XML.supportActiveX&&!this.xmldom?new ActiveXObject("Microsoft.XMLDOM"):this.xmldom;b.loadXML(a);return b},this),function(){return(new DOMParser).parseFromString(a,"text/xml")},function(){var b=new XMLHttpRequest;b.open("GET",
+"data:text/xml;charset=utf-8,"+encodeURIComponent(a),!1);b.overrideMimeType&&b.overrideMimeType("text/xml");b.send(null);return b.responseXML});this.keepData&&(this.data=b);return b},write:function(a){if(this.xmldom)a=a.xml;else{var b=new XMLSerializer;if(1==a.nodeType){var c=document.implementation.createDocument("","",null);c.importNode&&(a=c.importNode(a,!0));c.appendChild(a);a=b.serializeToString(c)}else a=b.serializeToString(a)}return a},createElementNS:function(a,b){return this.xmldom?"string"==
+typeof a?this.xmldom.createNode(1,b,a):this.xmldom.createNode(1,b,""):document.createElementNS(a,b)},createDocumentFragment:function(){return this.xmldom?this.xmldom.createDocumentFragment():document.createDocumentFragment()},createTextNode:function(a){"string"!==typeof a&&(a=String(a));return this.xmldom?this.xmldom.createTextNode(a):document.createTextNode(a)},getElementsByTagNameNS:function(a,b,c){var d=[];if(a.getElementsByTagNameNS)d=a.getElementsByTagNameNS(b,c);else{a=a.getElementsByTagName("*");
+for(var e,f,g=0,h=a.length;g<h;++g)if(e=a[g],f=e.prefix?e.prefix+":"+c:c,"*"==c||f==e.nodeName)("*"==b||b==e.namespaceURI)&&d.push(e)}return d},getAttributeNodeNS:function(a,b,c){var d=null;if(a.getAttributeNodeNS)d=a.getAttributeNodeNS(b,c);else{a=a.attributes;for(var e,f,g=0,h=a.length;g<h;++g)if(e=a[g],e.namespaceURI==b&&(f=e.prefix?e.prefix+":"+c:c,f==e.nodeName)){d=e;break}}return d},getAttributeNS:function(a,b,c){var d="";if(a.getAttributeNS)d=a.getAttributeNS(b,c)||"";else if(a=this.getAttributeNodeNS(a,
+b,c))d=a.nodeValue;return d},getChildValue:function(a,b){var c=b||"";if(a)for(var d=a.firstChild;d;d=d.nextSibling)switch(d.nodeType){case 3:case 4:c+=d.nodeValue}return c},isSimpleContent:function(a){var b=!0;for(a=a.firstChild;a;a=a.nextSibling)if(1===a.nodeType){b=!1;break}return b},contentType:function(a){var b=!1,c=!1,d=OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;for(a=a.firstChild;a;a=a.nextSibling){switch(a.nodeType){case 1:c=!0;break;case 8:break;default:b=!0}if(c&&b)break}if(c&&b)d=OpenLayers.Format.XML.CONTENT_TYPE.MIXED;
+else{if(c)return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;if(b)return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE}return d},hasAttributeNS:function(a,b,c){var d=!1;return d=a.hasAttributeNS?a.hasAttributeNS(b,c):!!this.getAttributeNodeNS(a,b,c)},setAttributeNS:function(a,b,c,d){if(a.setAttributeNS)a.setAttributeNS(b,c,d);else if(this.xmldom)b?(b=a.ownerDocument.createNode(2,c,b),b.nodeValue=d,a.setAttributeNode(b)):a.setAttribute(c,d);else throw"setAttributeNS not implemented";},createElementNSPlus:function(a,
+b){b=b||{};var c=b.uri||this.namespaces[b.prefix];c||(c=a.indexOf(":"),c=this.namespaces[a.substring(0,c)]);c||(c=this.namespaces[this.defaultPrefix]);c=this.createElementNS(c,a);b.attributes&&this.setAttributes(c,b.attributes);var d=b.value;null!=d&&c.appendChild(this.createTextNode(d));return c},setAttributes:function(a,b){var c,d,e;for(e in b)null!=b[e]&&b[e].toString&&(c=b[e].toString(),d=this.namespaces[e.substring(0,e.indexOf(":"))]||null,this.setAttributeNS(a,d,e,c))},getFirstElementChild:function(a){if(a.firstElementChild)return a.firstElementChild;
+for(a=a.firstChild;1!=a.nodeType&&(a=a.nextSibling););return a},readNode:function(a,b){b||(b={});var c=this.readers[a.namespaceURI?this.namespaceAlias[a.namespaceURI]:this.defaultPrefix];if(c){var d=a.localName||a.nodeName.split(":").pop();(c=c[d]||c["*"])&&c.apply(this,[a,b])}return b},readChildNodes:function(a,b){b||(b={});for(var c=a.childNodes,d,e=0,f=c.length;e<f;++e)d=c[e],1==d.nodeType&&this.readNode(d,b);return b},writeNode:function(a,b,c){var d,e=a.indexOf(":");0<e?(d=a.substring(0,e),a=
+a.substring(e+1)):d=c?this.namespaceAlias[c.namespaceURI]:this.defaultPrefix;b=this.writers[d][a].apply(this,[b]);c&&c.appendChild(b);return b},getChildEl:function(a,b,c){return a&&this.getThisOrNextEl(a.firstChild,b,c)},getNextEl:function(a,b,c){return a&&this.getThisOrNextEl(a.nextSibling,b,c)},getThisOrNextEl:function(a,b,c){a:for(;a;a=a.nextSibling)switch(a.nodeType){case 1:if((!b||b===(a.localName||a.nodeName.split(":").pop()))&&(!c||c===a.namespaceURI))break a;a=null;break a;case 3:if(/^\s*$/.test(a.nodeValue))break;
+case 4:case 6:case 12:case 10:case 11:a=null;break a}return a||null},lookupNamespaceURI:function(a,b){var c=null;if(a)if(a.lookupNamespaceURI)c=a.lookupNamespaceURI(b);else a:switch(a.nodeType){case 1:if(null!==a.namespaceURI&&a.prefix===b){c=a.namespaceURI;break a}if(c=a.attributes.length)for(var d,e=0;e<c;++e)if(d=a.attributes[e],"xmlns"===d.prefix&&d.name==="xmlns:"+b){c=d.value||null;break a}else if("xmlns"===d.name&&null===b){c=d.value||null;break a}c=this.lookupNamespaceURI(a.parentNode,b);
+break a;case 2:c=this.lookupNamespaceURI(a.ownerElement,b);break a;case 9:c=this.lookupNamespaceURI(a.documentElement,b);break a;case 6:case 12:case 10:case 11:break a;default:c=this.lookupNamespaceURI(a.parentNode,b)}return c},getXMLDoc:function(){!OpenLayers.Format.XML.document&&!this.xmldom&&(document.implementation&&document.implementation.createDocument?OpenLayers.Format.XML.document=document.implementation.createDocument("","",null):!this.xmldom&&OpenLayers.Format.XML.supportActiveX&&(this.xmldom=
+new ActiveXObject("Microsoft.XMLDOM")));return OpenLayers.Format.XML.document||this.xmldom},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Format.XML.CONTENT_TYPE={EMPTY:0,SIMPLE:1,COMPLEX:2,MIXED:3};OpenLayers.Format.XML.lookupNamespaceURI=OpenLayers.Function.bind(OpenLayers.Format.XML.prototype.lookupNamespaceURI,OpenLayers.Format.XML.prototype);OpenLayers.Format.XML.document=null;
+OpenLayers.Format.XML.supportActiveX=function(){return Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window}();OpenLayers.Format.WFST=function(a){a=OpenLayers.Util.applyDefaults(a,OpenLayers.Format.WFST.DEFAULTS);var b=OpenLayers.Format.WFST["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported WFST version: "+a.version;return new b(a)};OpenLayers.Format.WFST.DEFAULTS={version:"1.0.0"};OpenLayers.Filter=OpenLayers.Class({initialize:function(a){OpenLayers.Util.extend(this,a)},destroy:function(){},evaluate:function(a){return!0},clone:function(){return null},toString:function(){return OpenLayers.Format&&OpenLayers.Format.CQL?OpenLayers.Format.CQL.prototype.write(this):Object.prototype.toString.call(this)},CLASS_NAME:"OpenLayers.Filter"});OpenLayers.Filter.Spatial=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,distance:null,distanceUnits:null,evaluate:function(a){var b=!1;switch(this.type){case OpenLayers.Filter.Spatial.BBOX:case OpenLayers.Filter.Spatial.INTERSECTS:if(a.geometry){var c=this.value;"OpenLayers.Bounds"==this.value.CLASS_NAME&&(c=this.value.toGeometry());a.geometry.intersects(c)&&(b=!0)}break;default:throw Error("evaluate is not implemented for this filter type.");}return b},clone:function(){var a=
+OpenLayers.Util.applyDefaults({value:this.value&&this.value.clone&&this.value.clone()},this);return new OpenLayers.Filter.Spatial(a)},CLASS_NAME:"OpenLayers.Filter.Spatial"});OpenLayers.Filter.Spatial.BBOX="BBOX";OpenLayers.Filter.Spatial.INTERSECTS="INTERSECTS";OpenLayers.Filter.Spatial.DWITHIN="DWITHIN";OpenLayers.Filter.Spatial.WITHIN="WITHIN";OpenLayers.Filter.Spatial.CONTAINS="CONTAINS";OpenLayers.Filter.FeatureId=OpenLayers.Class(OpenLayers.Filter,{fids:null,type:"FID",initialize:function(a){this.fids=[];OpenLayers.Filter.prototype.initialize.apply(this,[a])},evaluate:function(a){for(var b=0,c=this.fids.length;b<c;b++)if((a.fid||a.id)==this.fids[b])return!0;return!1},clone:function(){var a=new OpenLayers.Filter.FeatureId;OpenLayers.Util.extend(a,this);a.fids=this.fids.slice();return a},CLASS_NAME:"OpenLayers.Filter.FeatureId"});OpenLayers.Format.WFST.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs",gml:"http://www.opengis.net/gml",ogc:"http://www.opengis.net/ogc",ows:"http://www.opengis.net/ows",xmlns:"http://www.w3.org/2000/xmlns/"},defaultPrefix:"wfs",version:null,schemaLocations:null,srsName:null,extractAttributes:!0,xy:!0,stateName:null,initialize:function(a){this.stateName={};this.stateName[OpenLayers.State.INSERT]=
+"wfs:Insert";this.stateName[OpenLayers.State.UPDATE]="wfs:Update";this.stateName[OpenLayers.State.DELETE]="wfs:Delete";OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},getSrsName:function(a,b){var c=b&&b.srsName;c||(c=a&&a.layer?a.layer.projection.getCode():this.srsName);return c},read:function(a,b){b=b||{};OpenLayers.Util.applyDefaults(b,{output:"features"});"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var c={};a&&
+this.readNode(a,c,!0);c.features&&"features"===b.output&&(c=c.features);return c},readers:{wfs:{FeatureCollection:function(a,b){b.features=[];this.readChildNodes(a,b)}}},write:function(a,b){var c=this.writeNode("wfs:Transaction",{features:a,options:b}),d=this.schemaLocationAttr();d&&this.setAttributeNS(c,this.namespaces.xsi,"xsi:schemaLocation",d);return OpenLayers.Format.XML.prototype.write.apply(this,[c])},writers:{wfs:{GetFeature:function(a){var b=this.createElementNSPlus("wfs:GetFeature",{attributes:{service:"WFS",
+version:this.version,handle:a&&a.handle,outputFormat:a&&a.outputFormat,maxFeatures:a&&a.maxFeatures,viewParams:a&&a.viewParams,"xsi:schemaLocation":this.schemaLocationAttr(a)}});if("string"==typeof this.featureType)this.writeNode("Query",a,b);else for(var c=0,d=this.featureType.length;c<d;c++)a.featureType=this.featureType[c],this.writeNode("Query",a,b);return b},Transaction:function(a){a=a||{};var b=a.options||{},c=this.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version,
+handle:b.handle}}),d,e=a.features;if(e){!0===b.multi&&OpenLayers.Util.extend(this.geometryTypes,{"OpenLayers.Geometry.Point":"MultiPoint","OpenLayers.Geometry.LineString":!0===this.multiCurve?"MultiCurve":"MultiLineString","OpenLayers.Geometry.Polygon":!0===this.multiSurface?"MultiSurface":"MultiPolygon"});var f,g;a=0;for(d=e.length;a<d;++a)g=e[a],(f=this.stateName[g.state])&&this.writeNode(f,{feature:g,options:b},c);!0===b.multi&&this.setGeometryTypes()}if(b.nativeElements){a=0;for(d=b.nativeElements.length;a<
+d;++a)this.writeNode("wfs:Native",b.nativeElements[a],c)}return c},Native:function(a){return this.createElementNSPlus("wfs:Native",{attributes:{vendorId:a.vendorId,safeToIgnore:a.safeToIgnore},value:a.value})},Insert:function(a){var b=a.feature;a=a.options;a=this.createElementNSPlus("wfs:Insert",{attributes:{handle:a&&a.handle}});this.srsName=this.getSrsName(b);this.writeNode("feature:_typeName",b,a);return a},Update:function(a){var b=a.feature;a=a.options;a=this.createElementNSPlus("wfs:Update",
+{attributes:{handle:a&&a.handle,typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});this.featureNS&&this.setAttributeNS(a,this.namespaces.xmlns,"xmlns:"+this.featurePrefix,this.featureNS);var c=b.modified;if(null!==this.geometryName&&(!c||void 0!==c.geometry))this.srsName=this.getSrsName(b),this.writeNode("Property",{name:this.geometryName,value:b.geometry},a);for(var d in b.attributes)void 0!==b.attributes[d]&&(!c||!c.attributes||c.attributes&&d in c.attributes)&&this.writeNode("Property",
+{name:d,value:b.attributes[d]},a);this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[b.fid]}),a);return a},Property:function(a){var b=this.createElementNSPlus("wfs:Property");this.writeNode("Name",a.name,b);null!==a.value&&this.writeNode("Value",a.value,b);return b},Name:function(a){return this.createElementNSPlus("wfs:Name",{value:a})},Value:function(a){var b;a instanceof OpenLayers.Geometry?(b=this.createElementNSPlus("wfs:Value"),a=this.writeNode("feature:_geometry",a).firstChild,
+b.appendChild(a)):b=this.createElementNSPlus("wfs:Value",{value:a});return b},Delete:function(a){var b=a.feature;a=a.options;a=this.createElementNSPlus("wfs:Delete",{attributes:{handle:a&&a.handle,typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});this.featureNS&&this.setAttributeNS(a,this.namespaces.xmlns,"xmlns:"+this.featurePrefix,this.featureNS);this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[b.fid]}),a);return a}}},schemaLocationAttr:function(a){a=OpenLayers.Util.extend({featurePrefix:this.featurePrefix,
+schema:this.schema},a);var b=OpenLayers.Util.extend({},this.schemaLocations);a.schema&&(b[a.featurePrefix]=a.schema);a=[];var c,d;for(d in b)(c=this.namespaces[d])&&a.push(c+" "+b[d]);return a.join(" ")||void 0},setFilterProperty:function(a){if(a.filters)for(var b=0,c=a.filters.length;b<c;++b)OpenLayers.Format.WFST.v1.prototype.setFilterProperty.call(this,a.filters[b]);else a instanceof OpenLayers.Filter.Spatial&&!a.property&&(a.property=this.geometryName)},CLASS_NAME:"OpenLayers.Format.WFST.v1"});OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.bounds=this.id=null},clone:function(){return new OpenLayers.Geometry},setBounds:function(a){a&&(this.bounds=a.clone())},clearBounds:function(){this.bounds=null;this.parent&&this.parent.clearBounds()},extendBounds:function(a){this.getBounds()?this.bounds.extend(a):this.setBounds(a)},getBounds:function(){null==this.bounds&&this.calculateBounds();
 return this.bounds},calculateBounds:function(){},distanceTo:function(a,b){},getVertices:function(a){},atPoint:function(a,b,c){var d=!1;null!=this.getBounds()&&null!=a&&(b=null!=b?b:0,c=null!=c?c:0,d=(new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-c,this.bounds.right+b,this.bounds.top+c)).containsLonLat(a));return d},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format&&OpenLayers.Format.WKT?OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this)):
 Object.prototype.toString.call(this)},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(a){var b;if(OpenLayers.Format&&OpenLayers.Format.WKT){var c=OpenLayers.Geometry.fromWKT.format;c||(c=new OpenLayers.Format.WKT,OpenLayers.Geometry.fromWKT.format=c);a=c.read(a);if(a instanceof OpenLayers.Feature.Vector)b=a.geometry;else if(OpenLayers.Util.isArray(a)){b=a.length;for(var c=Array(b),d=0;d<b;++d)c[d]=a[d].geometry;b=new OpenLayers.Geometry.Collection(c)}}return b};
 OpenLayers.Geometry.segmentsIntersect=function(a,b,c){var d=c&&c.point;c=c&&c.tolerance;var e=!1,f=a.x1-b.x1,g=a.y1-b.y1,h=a.x2-a.x1,k=a.y2-a.y1,l=b.y2-b.y1,m=b.x2-b.x1,r=l*h-m*k,l=m*g-l*f,g=h*g-k*f;0==r?0==l&&0==g&&(e=!0):(f=l/r,r=g/r,0<=f&&(1>=f&&0<=r&&1>=r)&&(d?(h=a.x1+f*h,r=a.y1+f*k,e=new OpenLayers.Geometry.Point(h,r)):e=!0));if(c)if(e){if(d){a=[a,b];b=0;a:for(;2>b;++b){f=a[b];for(k=1;3>k;++k)if(h=f["x"+k],r=f["y"+k],d=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(r-e.y,2)),d<c){e.x=h;e.y=r;break a}}}}else{a=
 [a,b];b=0;a:for(;2>b;++b){h=a[b];r=a[(b+1)%2];for(k=1;3>k;++k)if(f={x:h["x"+k],y:h["y"+k]},g=OpenLayers.Geometry.distanceToSegment(f,r),g.distance<c){e=d?new OpenLayers.Geometry.Point(f.x,f.y):!0;break a}}}return e};OpenLayers.Geometry.distanceToSegment=function(a,b){var c=OpenLayers.Geometry.distanceSquaredToSegment(a,b);c.distance=Math.sqrt(c.distance);return c};
 return this.bounds},calculateBounds:function(){},distanceTo:function(a,b){},getVertices:function(a){},atPoint:function(a,b,c){var d=!1;null!=this.getBounds()&&null!=a&&(b=null!=b?b:0,c=null!=c?c:0,d=(new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-c,this.bounds.right+b,this.bounds.top+c)).containsLonLat(a));return d},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format&&OpenLayers.Format.WKT?OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this)):
 Object.prototype.toString.call(this)},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(a){var b;if(OpenLayers.Format&&OpenLayers.Format.WKT){var c=OpenLayers.Geometry.fromWKT.format;c||(c=new OpenLayers.Format.WKT,OpenLayers.Geometry.fromWKT.format=c);a=c.read(a);if(a instanceof OpenLayers.Feature.Vector)b=a.geometry;else if(OpenLayers.Util.isArray(a)){b=a.length;for(var c=Array(b),d=0;d<b;++d)c[d]=a[d].geometry;b=new OpenLayers.Geometry.Collection(c)}}return b};
 OpenLayers.Geometry.segmentsIntersect=function(a,b,c){var d=c&&c.point;c=c&&c.tolerance;var e=!1,f=a.x1-b.x1,g=a.y1-b.y1,h=a.x2-a.x1,k=a.y2-a.y1,l=b.y2-b.y1,m=b.x2-b.x1,r=l*h-m*k,l=m*g-l*f,g=h*g-k*f;0==r?0==l&&0==g&&(e=!0):(f=l/r,r=g/r,0<=f&&(1>=f&&0<=r&&1>=r)&&(d?(h=a.x1+f*h,r=a.y1+f*k,e=new OpenLayers.Geometry.Point(h,r)):e=!0));if(c)if(e){if(d){a=[a,b];b=0;a:for(;2>b;++b){f=a[b];for(k=1;3>k;++k)if(h=f["x"+k],r=f["y"+k],d=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(r-e.y,2)),d<c){e.x=h;e.y=r;break a}}}}else{a=
 [a,b];b=0;a:for(;2>b;++b){h=a[b];r=a[(b+1)%2];for(k=1;3>k;++k)if(f={x:h["x"+k],y:h["y"+k]},g=OpenLayers.Geometry.distanceToSegment(f,r),g.distance<c){e=d?new OpenLayers.Geometry.Point(f.x,f.y):!0;break a}}}return e};OpenLayers.Geometry.distanceToSegment=function(a,b){var c=OpenLayers.Geometry.distanceSquaredToSegment(a,b);c.distance=Math.sqrt(c.distance);return c};
-OpenLayers.Geometry.distanceSquaredToSegment=function(a,b){var c=a.x,d=a.y,e=b.x1,f=b.y1,g=b.x2,h=b.y2,k=g-e,l=h-f,m=(k*(c-e)+l*(d-f))/(Math.pow(k,2)+Math.pow(l,2));0>=m||(1<=m?(e=g,f=h):(e+=m*k,f+=m*l));return{distance:Math.pow(e-c,2)+Math.pow(f-d,2),x:e,y:f,along:m}};OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];null!=a&&this.addComponents(a)},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){for(var a=eval("new "+this.CLASS_NAME+"()"),b=0,c=this.components.length;b<c;b++)a.addComponent(this.components[b].clone());
+OpenLayers.Geometry.distanceSquaredToSegment=function(a,b){var c=a.x,d=a.y,e=b.x1,f=b.y1,g=b.x2,h=b.y2,k=g-e,l=h-f,m=0==k&&0==l?0:(k*(c-e)+l*(d-f))/(Math.pow(k,2)+Math.pow(l,2));0>=m||(1<=m?(e=g,f=h):(e+=m*k,f+=m*l));return{distance:Math.pow(e-c,2)+Math.pow(f-d,2),x:e,y:f,along:m}};OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){null==a&&(a=new OpenLayers.Geometry.Point(this.x,this.y));OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(a,b){var c=!(b&&!1===b.edge)&&b&&b.details,d,e,f,g,h;a instanceof
+OpenLayers.Geometry.Point?(e=this.x,f=this.y,g=a.x,h=a.y,d=Math.sqrt(Math.pow(e-g,2)+Math.pow(f-h,2)),d=!c?d:{x0:e,y0:f,x1:g,y1:h,distance:d}):(d=a.distanceTo(this,b),c&&(d={x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0,distance:d.distance}));return d},equals:function(a){var b=!1;null!=a&&(b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y));return b},toShortString:function(){return this.x+", "+this.y},move:function(a,b){this.x+=a;this.y+=b;this.clearBounds()},rotate:function(a,b){a*=
+Math.PI/180;var c=this.distanceTo(b),d=a+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+c*Math.cos(d);this.y=b.y+c*Math.sin(d);this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(a,b,c){this.x=b.x+a*(void 0==c?1:c)*(this.x-b.x);this.y=b.y+a*(this.y-b.y);this.clearBounds();return this},intersects:function(a){var b=!1;return b="OpenLayers.Geometry.Point"==a.CLASS_NAME?this.equals(a):a.intersects(this)},transform:function(a,b){a&&b&&(OpenLayers.Projection.transform(this,
+a,b),this.bounds=null);return this},getVertices:function(a){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];null!=a&&this.addComponents(a)},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){for(var a=new (OpenLayers.Util.getConstructor(this.CLASS_NAME)),b=0,c=this.components.length;b<c;b++)a.addComponent(this.components[b].clone());
 OpenLayers.Util.applyDefaults(a,this);return a},getComponentsString:function(){for(var a=[],b=0,c=this.components.length;b<c;b++)a.push(this.components[b].toShortString());return a.join(",")},calculateBounds:function(){this.bounds=null;var a=new OpenLayers.Bounds,b=this.components;if(b)for(var c=0,d=b.length;c<d;c++)a.extend(b[c].getBounds());null!=a.left&&(null!=a.bottom&&null!=a.right&&null!=a.top)&&this.setBounds(a)},addComponents:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0,c=a.length;b<
 c;b++)this.addComponent(a[b])},addComponent:function(a,b){var c=!1;if(a&&(null==this.componentTypes||-1<OpenLayers.Util.indexOf(this.componentTypes,a.CLASS_NAME))){if(null!=b&&b<this.components.length){var c=this.components.slice(0,b),d=this.components.slice(b,this.components.length);c.push(a);this.components=c.concat(d)}else this.components.push(a);a.parent=this;this.clearBounds();c=!0}return c},removeComponents:function(a){var b=!1;OpenLayers.Util.isArray(a)||(a=[a]);for(var c=a.length-1;0<=c;--c)b=
 this.removeComponent(a[c])||b;return b},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds();return!0},getLength:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getLength();return a},getArea:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getArea();return a},getGeodesicArea:function(a){for(var b=0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicArea(a);return b},getCentroid:function(a){if(!a)return this.components.length&&
 this.components[0].getCentroid();a=this.components.length;if(!a)return!1;for(var b=[],c=[],d=0,e=Number.MAX_VALUE,f,g=0;g<a;++g){f=this.components[g];var h=f.getArea();f=f.getCentroid(!0);!isNaN(h)&&(!isNaN(f.x)&&!isNaN(f.y))&&(b.push(h),d+=h,e=h<e&&0<h?h:e,c.push(f))}a=b.length;if(0===d){for(g=0;g<a;++g)b[g]=1;d=b.length}else{for(g=0;g<a;++g)b[g]/=e;d/=e}for(var k=e=0,g=0;g<a;++g)f=c[g],h=b[g],e+=f.x*h,k+=f.y*h;return new OpenLayers.Geometry.Point(e/d,k/d)},getGeodesicLength:function(a){for(var b=
 0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicLength(a);return b},move:function(a,b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0;d<this.components.length;++d)this.components[d].resize(a,b,c);return this},distanceTo:function(a,b){for(var c=!(b&&!1===b.edge)&&b&&b.details,d,e,f,g=Number.POSITIVE_INFINITY,h=0,k=this.components.length;h<
 k&&!(d=this.components[h].distanceTo(a,b),f=c?d.distance:d,f<g&&(g=f,e=d,0==g));++h);return e},equals:function(a){var b=!0;if(!a||!a.CLASS_NAME||this.CLASS_NAME!=a.CLASS_NAME)b=!1;else if(!OpenLayers.Util.isArray(a.components)||a.components.length!=this.components.length)b=!1;else for(var c=0,d=this.components.length;c<d;++c)if(!this.components[c].equals(a.components[c])){b=!1;break}return b},transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].transform(a,
 OpenLayers.Util.applyDefaults(a,this);return a},getComponentsString:function(){for(var a=[],b=0,c=this.components.length;b<c;b++)a.push(this.components[b].toShortString());return a.join(",")},calculateBounds:function(){this.bounds=null;var a=new OpenLayers.Bounds,b=this.components;if(b)for(var c=0,d=b.length;c<d;c++)a.extend(b[c].getBounds());null!=a.left&&(null!=a.bottom&&null!=a.right&&null!=a.top)&&this.setBounds(a)},addComponents:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0,c=a.length;b<
 c;b++)this.addComponent(a[b])},addComponent:function(a,b){var c=!1;if(a&&(null==this.componentTypes||-1<OpenLayers.Util.indexOf(this.componentTypes,a.CLASS_NAME))){if(null!=b&&b<this.components.length){var c=this.components.slice(0,b),d=this.components.slice(b,this.components.length);c.push(a);this.components=c.concat(d)}else this.components.push(a);a.parent=this;this.clearBounds();c=!0}return c},removeComponents:function(a){var b=!1;OpenLayers.Util.isArray(a)||(a=[a]);for(var c=a.length-1;0<=c;--c)b=
 this.removeComponent(a[c])||b;return b},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds();return!0},getLength:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getLength();return a},getArea:function(){for(var a=0,b=0,c=this.components.length;b<c;b++)a+=this.components[b].getArea();return a},getGeodesicArea:function(a){for(var b=0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicArea(a);return b},getCentroid:function(a){if(!a)return this.components.length&&
 this.components[0].getCentroid();a=this.components.length;if(!a)return!1;for(var b=[],c=[],d=0,e=Number.MAX_VALUE,f,g=0;g<a;++g){f=this.components[g];var h=f.getArea();f=f.getCentroid(!0);!isNaN(h)&&(!isNaN(f.x)&&!isNaN(f.y))&&(b.push(h),d+=h,e=h<e&&0<h?h:e,c.push(f))}a=b.length;if(0===d){for(g=0;g<a;++g)b[g]=1;d=b.length}else{for(g=0;g<a;++g)b[g]/=e;d/=e}for(var k=e=0,g=0;g<a;++g)f=c[g],h=b[g],e+=f.x*h,k+=f.y*h;return new OpenLayers.Geometry.Point(e/d,k/d)},getGeodesicLength:function(a){for(var b=
 0,c=0,d=this.components.length;c<d;c++)b+=this.components[c].getGeodesicLength(a);return b},move:function(a,b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0;d<this.components.length;++d)this.components[d].resize(a,b,c);return this},distanceTo:function(a,b){for(var c=!(b&&!1===b.edge)&&b&&b.details,d,e,f,g=Number.POSITIVE_INFINITY,h=0,k=this.components.length;h<
 k&&!(d=this.components[h].distanceTo(a,b),f=c?d.distance:d,f<g&&(g=f,e=d,0==g));++h);return e},equals:function(a){var b=!0;if(!a||!a.CLASS_NAME||this.CLASS_NAME!=a.CLASS_NAME)b=!1;else if(!OpenLayers.Util.isArray(a.components)||a.components.length!=this.components.length)b=!1;else for(var c=0,d=this.components.length;c<d;++c)if(!this.components[c].equals(a.components[c])){b=!1;break}return b},transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d;c++)this.components[c].transform(a,
-b);this.bounds=null}return this},intersects:function(a){for(var b=!1,c=0,d=this.components.length;c<d&&!(b=a.intersects(this.components[c]));++c);return b},getVertices:function(a){for(var b=[],c=0,d=this.components.length;c<d;++c)Array.prototype.push.apply(b,this.components[c].getVertices(a));return b},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){null==a&&(a=new OpenLayers.Geometry.Point(this.x,this.y));OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(a,b){var c=!(b&&!1===b.edge)&&b&&b.details,d,e,f,g,h;a instanceof
-OpenLayers.Geometry.Point?(e=this.x,f=this.y,g=a.x,h=a.y,d=Math.sqrt(Math.pow(e-g,2)+Math.pow(f-h,2)),d=!c?d:{x0:e,y0:f,x1:g,y1:h,distance:d}):(d=a.distanceTo(this,b),c&&(d={x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0,distance:d.distance}));return d},equals:function(a){var b=!1;null!=a&&(b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y));return b},toShortString:function(){return this.x+", "+this.y},move:function(a,b){this.x+=a;this.y+=b;this.clearBounds()},rotate:function(a,b){a*=
-Math.PI/180;var c=this.distanceTo(b),d=a+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+c*Math.cos(d);this.y=b.y+c*Math.sin(d);this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(a,b,c){this.x=b.x+a*(void 0==c?1:c)*(this.x-b.x);this.y=b.y+a*(this.y-b.y);this.clearBounds();return this},intersects:function(a){var b=!1;return b="OpenLayers.Geometry.Point"==a.CLASS_NAME?this.equals(a):a.intersects(this)},transform:function(a,b){a&&b&&(OpenLayers.Projection.transform(this,
-a,b),this.bounds=null);return this},getVertices:function(a){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],addPoint:function(a,b){this.addComponent(a,b)},removePoint:function(a){this.removeComponent(a)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],getLength:function(){var a=0;if(this.components&&1<this.components.length)for(var b=1,c=this.components.length;b<c;b++)a+=this.components[b-1].distanceTo(this.components[b]);return a},getGeodesicLength:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||(b=this.clone().transform(a,c))}a=0;if(b.components&&1<b.components.length)for(var d,e=1,f=b.components.length;e<
+b);this.bounds=null}return this},intersects:function(a){for(var b=!1,c=0,d=this.components.length;c<d&&!(b=a.intersects(this.components[c]));++c);return b},getVertices:function(a){for(var b=[],c=0,d=this.components.length;c<d;++c)Array.prototype.push.apply(b,this.components[c].getVertices(a));return b},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],addPoint:function(a,b){this.addComponent(a,b)},removePoint:function(a){this.removeComponent(a)},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],getLength:function(){var a=0;if(this.components&&1<this.components.length)for(var b=1,c=this.components.length;b<c;b++)a+=this.components[b-1].distanceTo(this.components[b]);return a},getGeodesicLength:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||(b=this.clone().transform(a,c))}a=0;if(b.components&&1<b.components.length)for(var d,e=1,f=b.components.length;e<
 f;e++)c=b.components[e-1],d=b.components[e],a+=OpenLayers.Util.distVincenty({lon:c.x,lat:c.y},{lon:d.x,lat:d.y});return 1E3*a},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{removeComponent:function(a){var b=this.components&&2<this.components.length;b&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);return b},intersects:function(a){var b=!1,c=a.CLASS_NAME;if("OpenLayers.Geometry.LineString"==c||"OpenLayers.Geometry.LinearRing"==c||"OpenLayers.Geometry.Point"==c){var d=this.getSortedSegments();a="OpenLayers.Geometry.Point"==c?[{x1:a.x,y1:a.y,x2:a.x,y2:a.y}]:a.getSortedSegments();
 f;e++)c=b.components[e-1],d=b.components[e],a+=OpenLayers.Util.distVincenty({lon:c.x,lat:c.y},{lon:d.x,lat:d.y});return 1E3*a},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{removeComponent:function(a){var b=this.components&&2<this.components.length;b&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);return b},intersects:function(a){var b=!1,c=a.CLASS_NAME;if("OpenLayers.Geometry.LineString"==c||"OpenLayers.Geometry.LinearRing"==c||"OpenLayers.Geometry.Point"==c){var d=this.getSortedSegments();a="OpenLayers.Geometry.Point"==c?[{x1:a.x,y1:a.y,x2:a.x,y2:a.y}]:a.getSortedSegments();
-var e,f,g,h,k,l,m,r=0,p=d.length;a:for(;r<p;++r){c=d[r];e=c.x1;f=c.x2;g=c.y1;h=c.y2;var n=0,q=a.length;for(;n<q;++n){k=a[n];if(k.x1>f)break;if(!(k.x2<e)&&(l=k.y1,m=k.y2,!(Math.min(l,m)>Math.max(g,h))&&!(Math.max(l,m)<Math.min(g,h))&&OpenLayers.Geometry.segmentsIntersect(c,k))){b=!0;break a}}}}else b=a.intersects(this);return b},getSortedSegments:function(){for(var a=this.components.length-1,b=Array(a),c,d,e=0;e<a;++e)c=this.components[e],d=this.components[e+1],b[e]=c.x<d.x?{x1:c.x,y1:c.y,x2:d.x,y2:d.y}:
-{x1:d.x,y1:d.y,x2:c.x,y2:c.y};return b.sort(function(a,b){return a.x1-b.x1})},splitWithSegment:function(a,b){for(var c=!(b&&!1===b.edge),d=b&&b.tolerance,e=[],f=this.getVertices(),g=[],h=[],k=!1,l,m,r,p={point:!0,tolerance:d},n=null,q=0,s=f.length-2;q<=s;++q)if(d=f[q],g.push(d.clone()),l=f[q+1],m={x1:d.x,y1:d.y,x2:l.x,y2:l.y},m=OpenLayers.Geometry.segmentsIntersect(a,m,p),m instanceof OpenLayers.Geometry.Point&&((r=m.x===a.x1&&m.y===a.y1||m.x===a.x2&&m.y===a.y2||m.equals(d)||m.equals(l)?!0:!1)||c))m.equals(h[h.length-
-1])||h.push(m.clone()),!(0===q&&m.equals(d))&&!m.equals(l)&&(k=!0,m.equals(d)||g.push(m),e.push(new OpenLayers.Geometry.LineString(g)),g=[m.clone()]);k&&(g.push(l.clone()),e.push(new OpenLayers.Geometry.LineString(g)));if(0<h.length)var t=a.x1<a.x2?1:-1,u=a.y1<a.y2?1:-1,n={lines:e,points:h.sort(function(a,b){return t*a.x-t*b.x||u*a.y-u*b.y})};return n},split:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h;if(a instanceof OpenLayers.Geometry.LineString){var k=this.getVertices(),l,m,r,p,n,q=[];g=[];
-for(var s=0,t=k.length-2;s<=t;++s){l=k[s];m=k[s+1];r={x1:l.x,y1:l.y,x2:m.x,y2:m.y};h=h||[a];d&&q.push(l.clone());for(var u=0;u<h.length;++u)if(p=h[u].splitWithSegment(r,b))if(n=p.lines,0<n.length&&(n.unshift(u,1),Array.prototype.splice.apply(h,n),u+=n.length-2),d)for(var v=0,w=p.points.length;v<w;++v)n=p.points[v],n.equals(l)||(q.push(n),g.push(new OpenLayers.Geometry.LineString(q)),q=n.equals(m)?[]:[n.clone()])}d&&(0<g.length&&0<q.length)&&(q.push(m.clone()),g.push(new OpenLayers.Geometry.LineString(q)))}else c=
-a.splitWith(this,b);h&&1<h.length?f=!0:h=[];g&&1<g.length?e=!0:g=[];if(f||e)c=d?[g,h]:h;return c},splitWith:function(a,b){return a.split(this,b)},getVertices:function(a){return!0===a?[this.components[0],this.components[this.components.length-1]]:!1===a?this.components.slice(1,this.components.length-1):this.components.slice()},distanceTo:function(a,b){var c=!(b&&!1===b.edge)&&b&&b.details,d,e={},f=Number.POSITIVE_INFINITY;if(a instanceof OpenLayers.Geometry.Point){for(var g=this.getSortedSegments(),
-h=a.x,k=a.y,l,m=0,r=g.length;m<r;++m)if(l=g[m],d=OpenLayers.Geometry.distanceToSegment(a,l),d.distance<f){if(f=d.distance,e=d,0===f)break}else if(l.x2>h&&(k>l.y1&&k<l.y2||k<l.y1&&k>l.y2))break;e=c?{distance:e.distance,x0:e.x,y0:e.y,x1:h,y1:k}:e.distance}else if(a instanceof OpenLayers.Geometry.LineString){var g=this.getSortedSegments(),h=a.getSortedSegments(),p,n,q=h.length,s={point:!0},m=0,r=g.length;a:for(;m<r;++m){k=g[m];l=k.x1;n=k.y1;for(var t=0;t<q;++t)if(d=h[t],p=OpenLayers.Geometry.segmentsIntersect(k,
-d,s)){f=0;e={distance:0,x0:p.x,y0:p.y,x1:p.x,y1:p.y};break a}else d=OpenLayers.Geometry.distanceToSegment({x:l,y:n},d),d.distance<f&&(f=d.distance,e={distance:f,x0:l,y0:n,x1:d.x,y1:d.y})}c||(e=e.distance);0!==f&&k&&(d=a.distanceTo(new OpenLayers.Geometry.Point(k.x2,k.y2),b),m=c?d.distance:d,m<f&&(e=c?{distance:f,x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0}:m))}else e=a.distanceTo(this,b),c&&(e={distance:e.distance,x0:e.x1,y0:e.y1,x1:e.x0,y1:e.y0});return e},simplify:function(a){if(this&&null!==this){var b=this.getVertices();
-if(3>b.length)return this;var c=function(a,b,d,k){for(var l=0,m=0,r=b,p;r<d;r++){p=a[b];var n=a[d],q=a[r],q=Math.abs(0.5*(p.x*n.y+n.x*q.y+q.x*p.y-n.x*p.y-q.x*n.y-p.x*q.y));p=Math.sqrt(Math.pow(p.x-n.x,2)+Math.pow(p.y-n.y,2));p=2*(q/p);p>l&&(l=p,m=r)}l>k&&m!=b&&(e.push(m),c(a,b,m,k),c(a,m,d,k))},d=b.length-1,e=[];e.push(0);for(e.push(d);b[0].equals(b[d]);)d--,e.push(d);c(b,0,d,a);a=[];e.sort(function(a,b){return a-b});for(d=0;d<e.length;d++)a.push(b[e[d]]);return new OpenLayers.Geometry.LineString(a)}return this},
-CLASS_NAME:"OpenLayers.Geometry.LineString"});OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],addComponent:function(a,b){var c=!1,d=this.components.pop();if(null!=b||!a.equals(d))c=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]);return c},removeComponent:function(a){var b=this.components&&3<this.components.length;b&&(this.components.pop(),OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,
+var e,f,g,h,k,l,m,r=0,q=d.length;a:for(;r<q;++r){c=d[r];e=c.x1;f=c.x2;g=c.y1;h=c.y2;var n=0,p=a.length;for(;n<p;++n){k=a[n];if(k.x1>f)break;if(!(k.x2<e)&&(l=k.y1,m=k.y2,!(Math.min(l,m)>Math.max(g,h))&&!(Math.max(l,m)<Math.min(g,h))&&OpenLayers.Geometry.segmentsIntersect(c,k))){b=!0;break a}}}}else b=a.intersects(this);return b},getSortedSegments:function(){for(var a=this.components.length-1,b=Array(a),c,d,e=0;e<a;++e)c=this.components[e],d=this.components[e+1],b[e]=c.x<d.x?{x1:c.x,y1:c.y,x2:d.x,y2:d.y}:
+{x1:d.x,y1:d.y,x2:c.x,y2:c.y};return b.sort(function(a,b){return a.x1-b.x1})},splitWithSegment:function(a,b){for(var c=!(b&&!1===b.edge),d=b&&b.tolerance,e=[],f=this.getVertices(),g=[],h=[],k=!1,l,m,r,q={point:!0,tolerance:d},n=null,p=0,s=f.length-2;p<=s;++p)if(d=f[p],g.push(d.clone()),l=f[p+1],m={x1:d.x,y1:d.y,x2:l.x,y2:l.y},m=OpenLayers.Geometry.segmentsIntersect(a,m,q),m instanceof OpenLayers.Geometry.Point&&((r=m.x===a.x1&&m.y===a.y1||m.x===a.x2&&m.y===a.y2||m.equals(d)||m.equals(l)?!0:!1)||c))m.equals(h[h.length-
+1])||h.push(m.clone()),!(0===p&&m.equals(d))&&!m.equals(l)&&(k=!0,m.equals(d)||g.push(m),e.push(new OpenLayers.Geometry.LineString(g)),g=[m.clone()]);k&&(g.push(l.clone()),e.push(new OpenLayers.Geometry.LineString(g)));if(0<h.length)var t=a.x1<a.x2?1:-1,u=a.y1<a.y2?1:-1,n={lines:e,points:h.sort(function(a,b){return t*a.x-t*b.x||u*a.y-u*b.y})};return n},split:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h;if(a instanceof OpenLayers.Geometry.LineString){var k=this.getVertices(),l,m,r,q,n,p=[];g=[];
+for(var s=0,t=k.length-2;s<=t;++s){l=k[s];m=k[s+1];r={x1:l.x,y1:l.y,x2:m.x,y2:m.y};h=h||[a];d&&p.push(l.clone());for(var u=0;u<h.length;++u)if(q=h[u].splitWithSegment(r,b))if(n=q.lines,0<n.length&&(n.unshift(u,1),Array.prototype.splice.apply(h,n),u+=n.length-2),d)for(var v=0,w=q.points.length;v<w;++v)n=q.points[v],n.equals(l)||(p.push(n),g.push(new OpenLayers.Geometry.LineString(p)),p=n.equals(m)?[]:[n.clone()])}d&&(0<g.length&&0<p.length)&&(p.push(m.clone()),g.push(new OpenLayers.Geometry.LineString(p)))}else c=
+a.splitWith(this,b);h&&1<h.length?f=!0:h=[];g&&1<g.length?e=!0:g=[];if(f||e)c=d?[g,h]:h;return c},splitWith:function(a,b){return a.split(this,b)},getVertices:function(a){return!0===a?[this.components[0],this.components[this.components.length-1]]:!1===a?this.components.slice(1,this.components.length-1):this.components.slice()},distanceTo:function(a,b){var c=!(b&&!1===b.edge)&&b&&b.details,d,e={},f=Number.POSITIVE_INFINITY;if(a instanceof OpenLayers.Geometry.Point)for(var g=this.getSortedSegments(),
+h=a.x,k=a.y,l,m=0,r=g.length;m<r&&!(l=g[m],d=OpenLayers.Geometry.distanceToSegment(a,l),d.distance<f&&(f=d.distance,e=c?{distance:f,x0:d.x,y0:d.y,x1:h,y1:k,index:m,indexDistance:(new OpenLayers.Geometry.Point(l.x1,l.y1)).distanceTo(a)}:f,0===f));++m);else if(a instanceof OpenLayers.Geometry.LineString){var g=this.getSortedSegments(),h=a.getSortedSegments(),q,n,p=h.length,s={point:!0},m=0,r=g.length;a:for(;m<r;++m){k=g[m];l=k.x1;n=k.y1;for(var t=0;t<p;++t)if(d=h[t],q=OpenLayers.Geometry.segmentsIntersect(k,
+d,s)){f=0;e={distance:0,x0:q.x,y0:q.y,x1:q.x,y1:q.y};break a}else d=OpenLayers.Geometry.distanceToSegment({x:l,y:n},d),d.distance<f&&(f=d.distance,e={distance:f,x0:l,y0:n,x1:d.x,y1:d.y})}c||(e=e.distance);0!==f&&k&&(d=a.distanceTo(new OpenLayers.Geometry.Point(k.x2,k.y2),b),m=c?d.distance:d,m<f&&(e=c?{distance:f,x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0}:m))}else e=a.distanceTo(this,b),c&&(e={distance:e.distance,x0:e.x1,y0:e.y1,x1:e.x0,y1:e.y0});return e},simplify:function(a){if(this&&null!==this){var b=this.getVertices();
+if(3>b.length)return this;var c=function(a,b,d,k){for(var l=0,m=0,r=b,q;r<d;r++){q=a[b];var n=a[d],p=a[r],p=Math.abs(0.5*(q.x*n.y+n.x*p.y+p.x*q.y-n.x*q.y-p.x*n.y-q.x*p.y));q=Math.sqrt(Math.pow(q.x-n.x,2)+Math.pow(q.y-n.y,2));q=2*(p/q);q>l&&(l=q,m=r)}l>k&&m!=b&&(e.push(m),c(a,b,m,k),c(a,m,d,k))},d=b.length-1,e=[];e.push(0);for(e.push(d);b[0].equals(b[d]);)d--,e.push(d);c(b,0,d,a);a=[];e.sort(function(a,b){return a-b});for(d=0;d<e.length;d++)a.push(b[e[d]]);return new OpenLayers.Geometry.LineString(a)}return this},
+CLASS_NAME:"OpenLayers.Geometry.LineString"});
+OpenLayers.Geometry.LineString.geodesic=function(a,b,c){for(var d=[],e=a(0),f=a(1),g=b(e),h=b(f),k=[f,e],l=[h,g],m=[1,0],r={},q=1E5,n,p,s,t,u;0<--q&&0<m.length;)s=m.pop(),e=k.pop(),g=l.pop(),f=s.toString(),f in r||(d.push(g),r[f]=!0),t=m.pop(),f=k.pop(),h=l.pop(),u=(s+t)/2,n=a(u),p=b(n),OpenLayers.Geometry.distanceSquaredToSegment(p,{x1:g.x,y1:g.y,x2:h.x,y2:h.y}).distance<c?(d.push(h),f=t.toString(),r[f]=!0):(m.push(t,u,u,s),l.push(h,p,p,g),k.push(f,n,n,e));return new OpenLayers.Geometry.LineString(d)};
+OpenLayers.Geometry.LineString.geodesicMeridian=function(a,b,c,d,e){var f=new OpenLayers.Projection("EPSG:4326");return OpenLayers.Geometry.LineString.geodesic(function(d){return new OpenLayers.Geometry.Point(a,b+(c-b)*d)},function(a){return a.transform(f,d)},e)};
+OpenLayers.Geometry.LineString.geodesicParallel=function(a,b,c,d,e){var f=new OpenLayers.Projection("EPSG:4326");return OpenLayers.Geometry.LineString.geodesic(function(d){return new OpenLayers.Geometry.Point(b+(c-b)*d,a)},function(a){return a.transform(f,d)},e)};OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],split:function(a,b){for(var c=null,d=b&&b.mutual,e,f,g,h,k=[],l=[a],m=0,r=this.components.length;m<r;++m){f=this.components[m];g=!1;for(var q=0;q<l.length;++q)if(e=f.split(l[q],b)){if(d){g=e[0];for(var n=0,p=g.length;n<p;++n)0===n&&k.length?k[k.length-1].addComponent(g[n]):k.push(new OpenLayers.Geometry.MultiLineString([g[n]]));g=!0;e=e[1]}if(e.length){e.unshift(q,
+1);Array.prototype.splice.apply(l,e);break}}g||(k.length?k[k.length-1].addComponent(f.clone()):k=[new OpenLayers.Geometry.MultiLineString(f.clone())])}k&&1<k.length?g=!0:k=[];l&&1<l.length?h=!0:l=[];if(g||h)c=d?[k,l]:l;return c},splitWith:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h,k,l;if(a instanceof OpenLayers.Geometry.LineString){l=[];k=[a];for(var m=0,r=this.components.length;m<r;++m){g=!1;f=this.components[m];for(var q=0;q<k.length;++q)if(e=k[q].split(f,b)){d&&(g=e[0],g.length&&(g.unshift(q,
+1),Array.prototype.splice.apply(k,g),q+=g.length-2),e=e[1],0===e.length&&(e=[f.clone()]));g=0;for(var n=e.length;g<n;++g)0===g&&l.length?l[l.length-1].addComponent(e[g]):l.push(new OpenLayers.Geometry.MultiLineString([e[g]]));g=!0}g||(l.length?l[l.length-1].addComponent(f.clone()):l=[new OpenLayers.Geometry.MultiLineString([f.clone()])])}}else c=a.split(this);k&&1<k.length?h=!0:k=[];l&&1<l.length?g=!0:l=[];if(h||g)c=d?[k,l]:l;return c},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],addComponent:function(a,b){var c=!1,d=this.components.pop();if(null!=b||!a.equals(d))c=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]);return c},removeComponent:function(a){var b=this.components&&3<this.components.length;b&&(this.components.pop(),OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,
 arguments),OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]));return b},move:function(a,b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d-1;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0,e=this.components.length;d<e-1;++d)this.components[d].resize(a,b,c);return this},transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].transform(a,
 b);this.bounds=null}return this},getCentroid:function(){if(this.components){var a=this.components.length;if(0<a&&2>=a)return this.components[0].clone();if(2<a){var b=0,c=0,d=this.components[0].x,e=this.components[0].y,f=-1*this.getArea();if(0!=f){for(var g=0;g<a-1;g++)var h=this.components[g],k=this.components[g+1],b=b+(h.x+k.x-2*d)*((h.x-d)*(k.y-e)-(k.x-d)*(h.y-e)),c=c+(h.y+k.y-2*e)*((h.x-d)*(k.y-e)-(k.x-d)*(h.y-e));b=d+b/(6*f);a=e+c/(6*f)}else{for(g=0;g<a-1;g++)b+=this.components[g].x,c+=this.components[g].y;
 b/=a-1;a=c/(a-1)}return new OpenLayers.Geometry.Point(b,a)}return null}},getArea:function(){var a=0;if(this.components&&2<this.components.length){for(var b=a=0,c=this.components.length;b<c-1;b++)var d=this.components[b],e=this.components[b+1],a=a+(d.x+e.x)*(e.y-d.y);a=-a/2}return a},getGeodesicArea:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||(b=this.clone().transform(a,c))}a=0;c=b.components&&b.components.length;if(2<c){for(var d,e,f=0;f<c-1;f++)d=b.components[f],
 arguments),OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[this.components[0]]));return b},move:function(a,b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].move(a,b)},rotate:function(a,b){for(var c=0,d=this.components.length;c<d-1;++c)this.components[c].rotate(a,b)},resize:function(a,b,c){for(var d=0,e=this.components.length;d<e-1;++d)this.components[d].resize(a,b,c);return this},transform:function(a,b){if(a&&b){for(var c=0,d=this.components.length;c<d-1;c++)this.components[c].transform(a,
 b);this.bounds=null}return this},getCentroid:function(){if(this.components){var a=this.components.length;if(0<a&&2>=a)return this.components[0].clone();if(2<a){var b=0,c=0,d=this.components[0].x,e=this.components[0].y,f=-1*this.getArea();if(0!=f){for(var g=0;g<a-1;g++)var h=this.components[g],k=this.components[g+1],b=b+(h.x+k.x-2*d)*((h.x-d)*(k.y-e)-(k.x-d)*(h.y-e)),c=c+(h.y+k.y-2*e)*((h.x-d)*(k.y-e)-(k.x-d)*(h.y-e));b=d+b/(6*f);a=e+c/(6*f)}else{for(g=0;g<a-1;g++)b+=this.components[g].x,c+=this.components[g].y;
 b/=a-1;a=c/(a-1)}return new OpenLayers.Geometry.Point(b,a)}return null}},getArea:function(){var a=0;if(this.components&&2<this.components.length){for(var b=a=0,c=this.components.length;b<c-1;b++)var d=this.components[b],e=this.components[b+1],a=a+(d.x+e.x)*(e.y-d.y);a=-a/2}return a},getGeodesicArea:function(a){var b=this;if(a){var c=new OpenLayers.Projection("EPSG:4326");c.equals(a)||(b=this.clone().transform(a,c))}a=0;c=b.components&&b.components.length;if(2<c){for(var d,e,f=0;f<c-1;f++)d=b.components[f],
-e=b.components[f+1],a+=OpenLayers.Util.rad(e.x-d.x)*(2+Math.sin(OpenLayers.Util.rad(d.y))+Math.sin(OpenLayers.Util.rad(e.y)));a=40680631590769*a/2}return a},containsPoint:function(a){var b=OpenLayers.Number.limitSigDigs,c=b(a.x,14);a=b(a.y,14);for(var d=this.components.length-1,e,f,g,h,k,l=0,m=0;m<d;++m)if(e=this.components[m],g=b(e.x,14),e=b(e.y,14),f=this.components[m+1],h=b(f.x,14),f=b(f.y,14),e==f){if(a==e&&(g<=h&&c>=g&&c<=h||g>=h&&c<=g&&c>=h)){l=-1;break}}else{k=b((a-f)*((h-g)/(f-e))+h,14);if(k==
-c&&(e<f&&a>=e&&a<=f||e>f&&a<=e&&a>=f)){l=-1;break}k<=c||g!=h&&(k<Math.min(g,h)||k>Math.max(g,h))||(e<f&&a>=e&&a<f||e>f&&a<e&&a>=f)&&++l}return-1==l?1:!!(l&1)},intersects:function(a){var b=!1;if("OpenLayers.Geometry.Point"==a.CLASS_NAME)b=this.containsPoint(a);else if("OpenLayers.Geometry.LineString"==a.CLASS_NAME)b=a.intersects(this);else if("OpenLayers.Geometry.LinearRing"==a.CLASS_NAME)b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[a]);else for(var c=0,d=a.components.length;c<
-d&&!(b=a.components[c].intersects(this));++c);return b},getVertices:function(a){return!0===a?[]:this.components.slice(0,this.components.length-1)},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:!1,initialize:function(a,b,c,d){OpenLayers.Layer.prototype.initialize.apply(this,[a,d]);this.url=b;this.params||(this.params=OpenLayers.Util.extend({},c))},destroy:function(){this.params=this.url=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions()));
-return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setUrl:function(a){this.url=a},mergeNewParams:function(a){this.params=OpenLayers.Util.extend(this.params,a);a=this.redraw();null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"params"});return a},redraw:function(a){return a?this.mergeNewParams({_olSalt:Math.random()}):OpenLayers.Layer.prototype.redraw.apply(this,[])},selectUrl:function(a,b){for(var c=1,d=0,e=a.length;d<e;d++)c*=a.charCodeAt(d)*this.URL_HASH_FACTOR,
-c-=Math.floor(c);return b[Math.floor(c*b.length)]},getFullRequestString:function(a,b){var c=b||this.url,d=OpenLayers.Util.extend({},this.params),d=OpenLayers.Util.extend(d,a),e=OpenLayers.Util.getParameterString(d);OpenLayers.Util.isArray(c)&&(c=this.selectUrl(e,c));var e=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(c)),f;for(f in d)f.toUpperCase()in e&&delete d[f];e=OpenLayers.Util.getParameterString(d);return OpenLayers.Util.urlAppend(c,e)},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,tileOriginCorner:"bl",tileOrigin:null,tileOptions:null,tileClass:OpenLayers.Tile.Image,grid:null,singleTile:!1,ratio:1.5,buffer:0,transitionEffect:"resize",numLoadingTiles:0,serverResolutions:null,loading:!1,backBuffer:null,gridResolution:null,backBufferResolution:null,backBufferLonLat:null,backBufferTimerId:null,removeBackBufferDelay:null,className:null,gridLayout:null,rowSign:null,transitionendEvents:["transitionend",
-"webkitTransitionEnd","otransitionend","oTransitionEnd"],initialize:function(a,b,c,d){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.grid=[];this._removeBackBuffer=OpenLayers.Function.bind(this.removeBackBuffer,this);this.initProperties();this.rowSign="t"===this.tileOriginCorner.substr(0,1)?1:-1},initProperties:function(){void 0===this.options.removeBackBufferDelay&&(this.removeBackBufferDelay=this.singleTile?0:2500);void 0===this.options.className&&(this.className=this.singleTile?
-"olLayerGridSingleTile":"olLayerGrid")},setMap:function(a){OpenLayers.Layer.HTTPRequest.prototype.setMap.call(this,a);OpenLayers.Element.addClass(this.div,this.className)},removeMap:function(a){this.removeBackBuffer()},destroy:function(){this.removeBackBuffer();this.clearGrid();this.tileSize=this.grid=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var a=0,b=this.grid.length;a<b;a++)for(var c=this.grid[a],d=0,e=c.length;d<e;d++)this.destroyTile(c[d]);
-this.grid=[];this.gridLayout=this.gridResolution=null}},addOptions:function(a,b){var c=void 0!==a.singleTile&&a.singleTile!==this.singleTile;OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this,arguments);this.map&&c&&(this.initProperties(),this.clearGrid(),this.tileSize=this.options.tileSize,this.setTileSize(),this.moveTo(null,!0))},clone:function(a){null==a&&(a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions()));a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,
-[a]);null!=this.tileSize&&(a.tileSize=this.tileSize.clone());a.grid=[];a.gridResolution=null;a.backBuffer=null;a.backBufferTimerId=null;a.loading=!1;a.numLoadingTiles=0;return a},moveTo:function(a,b,c){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);a=a||this.map.getExtent();if(null!=a){var d=!this.grid.length||b,e=this.getTilesBounds(),f=this.map.getResolution();this.getServerResolution(f);if(this.singleTile){if(d||!c&&!e.containsBounds(a))b&&"resize"!==this.transitionEffect&&
-this.removeBackBuffer(),(!b||"resize"===this.transitionEffect)&&this.applyBackBuffer(f),this.initSingleTile(a)}else(d=d||!e.intersectsBounds(a,{worldBounds:this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent()}))?(b&&("resize"===this.transitionEffect||this.gridResolution===f)&&this.applyBackBuffer(f),this.initGriddedTiles(a)):this.moveGriddedTiles()}},getTileData:function(a){var b=null,c=a.lon,d=a.lat,e=this.grid.length;if(this.map&&e){var f=this.map.getResolution();a=this.tileSize.w;var g=this.tileSize.h,
-h=this.grid[0][0].bounds,k=h.left,h=h.top;if(c<k&&this.map.baseLayer.wrapDateLine)var l=this.map.getMaxExtent().getWidth(),m=Math.ceil((k-c)/l),c=c+l*m;c=(c-k)/(f*a);d=(h-d)/(f*g);f=Math.floor(c);k=Math.floor(d);0<=k&&k<e&&(e=this.grid[k][f])&&(b={tile:e,i:Math.floor((c-f)*a),j:Math.floor((d-k)*g)})}return b},destroyTile:function(a){this.removeTileMonitoringHooks(a);a.destroy()},getServerResolution:function(a){var b=Number.POSITIVE_INFINITY;a=a||this.map.getResolution();if(this.serverResolutions&&
--1===OpenLayers.Util.indexOf(this.serverResolutions,a)){var c,d,e,f;for(c=this.serverResolutions.length-1;0<=c;c--){e=this.serverResolutions[c];d=Math.abs(e-a);if(d>b)break;b=d;f=e}a=f}return a},getServerZoom:function(){var a=this.getServerResolution();return this.serverResolutions?OpenLayers.Util.indexOf(this.serverResolutions,a):this.map.getZoomForResolution(a)+(this.zoomOffset||0)},applyBackBuffer:function(a){null!==this.backBufferTimerId&&this.removeBackBuffer();var b=this.backBuffer;if(!b){b=
-this.createBackBuffer();if(!b)return;a===this.gridResolution?this.div.insertBefore(b,this.div.firstChild):this.map.baseLayer.div.parentNode.insertBefore(b,this.map.baseLayer.div);this.backBuffer=b;var c=this.grid[0][0].bounds;this.backBufferLonLat={lon:c.left,lat:c.top};this.backBufferResolution=this.gridResolution}for(var c=this.backBufferResolution/a,d=b.childNodes,e,f=d.length-1;0<=f;--f)e=d[f],e.style.top=(c*e._i*e._h|0)+"px",e.style.left=(c*e._j*e._w|0)+"px",e.style.width=Math.round(c*e._w)+
-"px",e.style.height=Math.round(c*e._h)+"px";a=this.getViewPortPxFromLonLat(this.backBufferLonLat,a);c=this.map.layerContainerOriginPx.y;b.style.left=Math.round(a.x-this.map.layerContainerOriginPx.x)+"px";b.style.top=Math.round(a.y-c)+"px"},createBackBuffer:function(){var a;if(0<this.grid.length){a=document.createElement("div");a.id=this.div.id+"_bb";a.className="olBackBuffer";a.style.position="absolute";var b=this.map;a.style.zIndex="resize"===this.transitionEffect?this.getZIndex()-1:b.Z_INDEX_BASE.BaseLayer-
-(b.getNumLayers()-b.getLayerIndex(this));for(var b=0,c=this.grid.length;b<c;b++)for(var d=0,e=this.grid[b].length;d<e;d++){var f=this.grid[b][d],g=this.grid[b][d].createBackBuffer();g&&(g._i=b,g._j=d,g._w=f.size.w,g._h=f.size.h,g.id=f.id+"_bb",a.appendChild(g))}}return a},removeBackBuffer:function(){if(this._transitionElement){for(var a=this.transitionendEvents.length-1;0<=a;--a)OpenLayers.Event.stopObserving(this._transitionElement,this.transitionendEvents[a],this._removeBackBuffer);delete this._transitionElement}this.backBuffer&&
-(this.backBuffer.parentNode&&this.backBuffer.parentNode.removeChild(this.backBuffer),this.backBufferResolution=this.backBuffer=null,null!==this.backBufferTimerId&&(window.clearTimeout(this.backBufferTimerId),this.backBufferTimerId=null))},moveByPx:function(a,b){this.singleTile||this.moveGriddedTiles()},setTileSize:function(a){this.singleTile&&(a=this.map.getSize(),a.h=parseInt(a.h*this.ratio,10),a.w=parseInt(a.w*this.ratio,10));OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getTilesBounds:function(){var a=
-null,b=this.grid.length;if(b)var a=this.grid[b-1][0].bounds,b=this.grid[0].length*a.getWidth(),c=this.grid.length*a.getHeight(),a=new OpenLayers.Bounds(a.left,a.bottom,a.left+b,a.bottom+c);return a},initSingleTile:function(a){this.events.triggerEvent("retile");var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio;a=a.getHeight()*this.ratio;b=new OpenLayers.Bounds(b.lon-c/2,b.lat-a/2,b.lon+c/2,b.lat+a/2);c=this.map.getLayerPxFromLonLat({lon:b.left,lat:b.top});this.grid.length||(this.grid[0]=[]);(a=this.grid[0][0])?
-a.moveTo(b,c):(a=this.addTile(b,c),this.addTileMonitoringHooks(a),a.draw(),this.grid[0][0]=a);this.removeExcessTiles(1,1);this.gridResolution=this.getServerResolution()},calculateGridLayout:function(a,b,c){var d=c*this.tileSize.w;c*=this.tileSize.h;var e=Math.floor((a.left-b.lon)/d)-this.buffer,f=this.rowSign;a=Math[~f?"floor":"ceil"](f*(b.lat-a.top+c)/c)-this.buffer*f;return{tilelon:d,tilelat:c,startcol:e,startrow:a}},getTileOrigin:function(){var a=this.tileOrigin;if(!a)var a=this.getMaxExtent(),
-b={tl:["left","top"],tr:["right","top"],bl:["left","bottom"],br:["right","bottom"]}[this.tileOriginCorner],a=new OpenLayers.LonLat(a[b[0]],a[b[1]]);return a},getTileBoundsForGridIndex:function(a,b){var c=this.getTileOrigin(),d=this.gridLayout,e=d.tilelon,f=d.tilelat,g=d.startcol,d=d.startrow,h=this.rowSign;return new OpenLayers.Bounds(c.lon+(g+b)*e,c.lat-(d+a*h)*f*h,c.lon+(g+b+1)*e,c.lat-(d+(a-1)*h)*f*h)},initGriddedTiles:function(a){this.events.triggerEvent("retile");var b=this.map.getSize(),c=this.getTileOrigin(),
-d=this.map.getResolution(),e=this.getServerResolution(),f=d/e,d=this.tileSize.w/f,f=this.tileSize.h/f,g=Math.ceil(b.h/f)+2*this.buffer+1,b=Math.ceil(b.w/d)+2*this.buffer+1;this.gridLayout=e=this.calculateGridLayout(a,c,e);var c=e.tilelon,h=e.tilelat,e=this.map.layerContainerOriginPx.x,k=this.map.layerContainerOriginPx.y,l=this.getTileBoundsForGridIndex(0,0),m=this.map.getViewPortPxFromLonLat(new OpenLayers.LonLat(l.left,l.top));m.x=Math.round(m.x)-e;m.y=Math.round(m.y)-k;var e=[],k=this.map.getCenter(),
-r=0;do{var p=this.grid[r];p||(p=[],this.grid.push(p));var n=0;do{var l=this.getTileBoundsForGridIndex(r,n),q=m.clone();q.x+=n*Math.round(d);q.y+=r*Math.round(f);var s=p[n];s?s.moveTo(l,q,!1):(s=this.addTile(l,q),this.addTileMonitoringHooks(s),p.push(s));q=l.getCenterLonLat();e.push({tile:s,distance:Math.pow(q.lon-k.lon,2)+Math.pow(q.lat-k.lat,2)});n+=1}while(l.right<=a.right+c*this.buffer||n<b);r+=1}while(l.bottom>=a.bottom-h*this.buffer||r<g);this.removeExcessTiles(r,n);this.gridResolution=d=this.getServerResolution();
-e.sort(function(a,b){return a.distance-b.distance});a=0;for(d=e.length;a<d;++a)e[a].tile.draw()},getMaxExtent:function(){return this.maxExtent},addTile:function(a,b){var c=new this.tileClass(this,b,a,null,this.tileSize,this.tileOptions);this.events.triggerEvent("addtile",{tile:c});return c},addTileMonitoringHooks:function(a){a.onLoadStart=function(){!1===this.loading&&(this.loading=!0,this.events.triggerEvent("loadstart"));this.events.triggerEvent("tileloadstart",{tile:a});this.numLoadingTiles++;
-!this.singleTile&&(this.backBuffer&&this.gridResolution===this.backBufferResolution)&&OpenLayers.Element.addClass(a.getTile(),"olTileReplacing")};a.onLoadEnd=function(b){this.numLoadingTiles--;b="unload"===b.type;this.events.triggerEvent("tileloaded",{tile:a,aborted:b});if(!this.singleTile&&!b&&this.backBuffer&&this.gridResolution===this.backBufferResolution){var c=a.getTile();if("none"===OpenLayers.Element.getStyle(c,"display")){var d=document.getElementById(a.id+"_bb");d&&d.parentNode.removeChild(d)}OpenLayers.Element.removeClass(c,
-"olTileReplacing")}if(0===this.numLoadingTiles){if(this.backBuffer)if(0===this.backBuffer.childNodes.length)this.removeBackBuffer();else{this._transitionElement=b?this.div.lastChild:a.imgDiv;b=this.transitionendEvents;for(c=b.length-1;0<=c;--c)OpenLayers.Event.observe(this._transitionElement,b[c],this._removeBackBuffer);this.backBufferTimerId=window.setTimeout(this._removeBackBuffer,this.removeBackBufferDelay)}this.loading=!1;this.events.triggerEvent("loadend")}};a.onLoadError=function(){this.events.triggerEvent("tileerror",
-{tile:a})};a.events.on({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,loaderror:a.onLoadError,scope:this})},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,loaderror:a.onLoadError,scope:this})},moveGriddedTiles:function(){for(var a=this.buffer+1;;){var b=this.grid[0][0],c=b.position.x+this.map.layerContainerOriginPx.x,b=b.position.y+this.map.layerContainerOriginPx.y,d=this.getServerResolution()/this.map.getResolution(),
-d={w:Math.round(this.tileSize.w*d),h:Math.round(this.tileSize.h*d)};if(c>-d.w*(a-1))this.shiftColumn(!0,d);else if(c<-d.w*a)this.shiftColumn(!1,d);else if(b>-d.h*(a-1))this.shiftRow(!0,d);else if(b<-d.h*a)this.shiftRow(!1,d);else break}},shiftRow:function(a,b){var c=this.grid,d=a?0:c.length-1,e=a?-1:1;this.gridLayout.startrow+=e*this.rowSign;for(var f=c[d],g=c[a?"pop":"shift"](),h=0,k=g.length;h<k;h++){var l=g[h],m=f[h].position.clone();m.y+=b.h*e;l.moveTo(this.getTileBoundsForGridIndex(d,h),m)}c[a?
-"unshift":"push"](g)},shiftColumn:function(a,b){var c=this.grid,d=a?0:c[0].length-1,e=a?-1:1;this.gridLayout.startcol+=e;for(var f=0,g=c.length;f<g;f++){var h=c[f],k=h[d].position.clone(),l=h[a?"pop":"shift"]();k.x+=b.w*e;l.moveTo(this.getTileBoundsForGridIndex(f,d),k);h[a?"unshift":"push"](l)}},removeExcessTiles:function(a,b){for(var c,d;this.grid.length>a;){var e=this.grid.pop();c=0;for(d=e.length;c<d;c++){var f=e[c];this.destroyTile(f)}}c=0;for(d=this.grid.length;c<d;c++)for(;this.grid[c].length>
-b;)e=this.grid[c],f=e.pop(),this.destroyTile(f)},onMapResize:function(){this.singleTile&&(this.clearGrid(),this.setTileSize())},getTileBounds:function(a){var b=this.maxExtent,c=this.getResolution(),d=c*this.tileSize.w,c=c*this.tileSize.h,e=this.getLonLatFromViewPortPx(a);a=b.left+d*Math.floor((e.lon-b.left)/d);b=b.bottom+c*Math.floor((e.lat-b.bottom)/c);return new OpenLayers.Bounds(a,b,a+d,b+c)},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,sphericalMercator:!1,zoomOffset:0,serverResolutions:null,initialize:function(a,b,c){if(c&&c.sphericalMercator||this.sphericalMercator)c=OpenLayers.Util.extend({projection:"EPSG:900913",numZoomLevels:19},c);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a||this.name,b||this.url,{},c])},clone:function(a){null==a&&(a=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,
-[a])},getURL:function(a){a=this.getXYZ(a);var b=this.url;OpenLayers.Util.isArray(b)&&(b=this.selectUrl(""+a.x+a.y+a.z,b));return OpenLayers.String.format(b,a)},getXYZ:function(a){var b=this.getServerResolution(),c=Math.round((a.left-this.maxExtent.left)/(b*this.tileSize.w));a=Math.round((this.maxExtent.top-a.top)/(b*this.tileSize.h));b=this.getServerZoom();if(this.wrapDateLine)var d=Math.pow(2,b),c=(c%d+d)%d;return{x:c,y:a,z:b}},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,
-arguments);this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom))},CLASS_NAME:"OpenLayers.Layer.XYZ"});OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",url:["http://a.tile.openstreetmap.org/${z}/${x}/${y}.png","http://b.tile.openstreetmap.org/${z}/${x}/${y}.png","http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"],attribution:"&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors",sphericalMercator:!0,wrapDateLine:!0,tileOptions:null,initialize:function(a,b,c){OpenLayers.Layer.XYZ.prototype.initialize.apply(this,arguments);this.tileOptions=
-OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options&&this.options.tileOptions)},clone:function(a){null==a&&(a=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:!1,size:null,resolution:null,map:null,featureDx:0,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a);OpenLayers.Util.extend(this,b)},destroy:function(){this.map=this.resolution=this.size=this.extent=this.container=null},supported:function(){return!1},setExtent:function(a,b){this.extent=a.clone();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var c=a.getWidth()/this.map.getExtent().getWidth();
-a=a.scale(1/c);this.extent=a.wrapDateLine(this.map.getMaxExtent()).scale(c)}b&&(this.resolution=null);return!0},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){return this.resolution=this.resolution||this.map.getResolution()},drawFeature:function(a,b){null==b&&(b=a.style);if(a.geometry){var c=a.geometry.getBounds();if(c){var d;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(d=this.map.getMaxExtent());c.intersectsBounds(this.extent,{worldBounds:d})?this.calculateFeatureDx(c,
-d):b={display:"none"};c=this.drawGeometry(a.geometry,b,a.id);if("none"!=b.display&&b.label&&!1!==c){d=a.geometry.getCentroid();if(b.labelXOffset||b.labelYOffset){var e=isNaN(b.labelXOffset)?0:b.labelXOffset,f=isNaN(b.labelYOffset)?0:b.labelYOffset,g=this.getResolution();d.move(e*g,f*g)}this.drawText(a.id,b,d)}else this.removeText(a.id);return c}}},calculateFeatureDx:function(a,b){this.featureDx=0;if(b){var c=b.getWidth();this.featureDx=Math.round(((a.left+a.right)/2-(this.extent.left+this.extent.right)/
-2)/c)*c}},drawGeometry:function(a,b,c){},drawText:function(a,b,c){},removeText:function(a){},clear:function(){},getFeatureIdFromEvent:function(a){},eraseFeatures:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0,c=a.length;b<c;++b){var d=a[b];this.eraseGeometry(d.geometry,d.id);this.removeText(d.id)}},eraseGeometry:function(a,b){},moveRoot:function(a){},getRenderLayerId:function(){return this.container.id},applyDefaultSymbolizer:function(a){var b=OpenLayers.Util.extend({},OpenLayers.Renderer.defaultSymbolizer);
-!1===a.stroke&&(delete b.strokeWidth,delete b.strokeColor);!1===a.fill&&delete b.fillColor;OpenLayers.Util.extend(b,a);return b},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Renderer.defaultSymbolizer={fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1,pointRadius:0,labelAlign:"cm"};
-OpenLayers.Renderer.symbol={star:[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],cross:[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],x:[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],square:[0,0,0,1,1,1,1,0,0,0],triangle:[0,10,10,10,5,0,0,10]};OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{hitDetection:!0,hitOverflow:0,canvas:null,features:null,pendingRedraw:!1,cachedSymbolBounds:{},initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.hitDetection&&(this.hitCanvas=document.createElement("canvas"),this.hitContext=this.hitCanvas.getContext("2d"))},
-setExtent:function(){OpenLayers.Renderer.prototype.setExtent.apply(this,arguments);return!1},eraseGeometry:function(a,b){this.eraseFeatures(this.features[b][0])},supported:function(){return OpenLayers.CANVAS_SUPPORTED},setSize:function(a){this.size=a.clone();var b=this.root;b.style.width=a.w+"px";b.style.height=a.h+"px";b.width=a.w;b.height=a.h;this.resolution=null;this.hitDetection&&(b=this.hitCanvas,b.style.width=a.w+"px",b.style.height=a.h+"px",b.width=a.w,b.height=a.h)},drawFeature:function(a,
-b){var c;if(a.geometry){b=this.applyDefaultSymbolizer(b||a.style);c=a.geometry.getBounds();var d;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(d=this.map.getMaxExtent());d=c&&c.intersectsBounds(this.extent,{worldBounds:d});(c="none"!==b.display&&!!c&&d)?this.features[a.id]=[a,b]:delete this.features[a.id];this.pendingRedraw=!0}this.pendingRedraw&&!this.locked&&(this.redraw(),this.pendingRedraw=!1);return c},drawGeometry:function(a,b,c){var d=a.CLASS_NAME;if("OpenLayers.Geometry.Collection"==
-d||"OpenLayers.Geometry.MultiPoint"==d||"OpenLayers.Geometry.MultiLineString"==d||"OpenLayers.Geometry.MultiPolygon"==d)for(d=0;d<a.components.length;d++)this.drawGeometry(a.components[d],b,c);else switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":this.drawPoint(a,b,c);break;case "OpenLayers.Geometry.LineString":this.drawLineString(a,b,c);break;case "OpenLayers.Geometry.LinearRing":this.drawLinearRing(a,b,c);break;case "OpenLayers.Geometry.Polygon":this.drawPolygon(a,b,c)}},drawExternalGraphic:function(a,
-b,c){var d=new Image,e=b.title||b.graphicTitle;e&&(d.title=e);var f=b.graphicWidth||b.graphicHeight,g=b.graphicHeight||b.graphicWidth,f=f?f:2*b.pointRadius,g=g?g:2*b.pointRadius,h=void 0!=b.graphicXOffset?b.graphicXOffset:-(0.5*f),k=void 0!=b.graphicYOffset?b.graphicYOffset:-(0.5*g),l=b.graphicOpacity||b.fillOpacity;d.onload=OpenLayers.Function.bind(function(){if(this.features[c]){var b=this.getLocalXY(a),e=b[0],b=b[1];if(!isNaN(e)&&!isNaN(b)){var e=e+h|0,b=b+k|0,p=this.canvas;p.globalAlpha=l;var n=
-OpenLayers.Renderer.Canvas.drawImageScaleFactor||(OpenLayers.Renderer.Canvas.drawImageScaleFactor=/android 2.1/.test(navigator.userAgent.toLowerCase())?320/window.screen.width:1);p.drawImage(d,e*n,b*n,f*n,g*n);this.hitDetection&&(this.setHitContextStyle("fill",c),this.hitContext.fillRect(e,b,f,g))}}},this);d.src=b.externalGraphic},drawNamedSymbol:function(a,b,c){var d,e,f,g;f=Math.PI/180;var h=OpenLayers.Renderer.symbol[b.graphicName];if(!h)throw Error(b.graphicName+" is not a valid symbol name");
-if(h.length&&!(2>h.length)&&(a=this.getLocalXY(a),e=a[0],g=a[1],!isNaN(e)&&!isNaN(g))){this.canvas.lineCap="round";this.canvas.lineJoin="round";this.hitDetection&&(this.hitContext.lineCap="round",this.hitContext.lineJoin="round");if(b.graphicName in this.cachedSymbolBounds)d=this.cachedSymbolBounds[b.graphicName];else{d=new OpenLayers.Bounds;for(a=0;a<h.length;a+=2)d.extend(new OpenLayers.LonLat(h[a],h[a+1]));this.cachedSymbolBounds[b.graphicName]=d}this.canvas.save();this.hitDetection&&this.hitContext.save();
-this.canvas.translate(e,g);this.hitDetection&&this.hitContext.translate(e,g);a=f*b.rotation;isNaN(a)||(this.canvas.rotate(a),this.hitDetection&&this.hitContext.rotate(a));f=2*b.pointRadius/Math.max(d.getWidth(),d.getHeight());this.canvas.scale(f,f);this.hitDetection&&this.hitContext.scale(f,f);a=d.getCenterLonLat().lon;d=d.getCenterLonLat().lat;this.canvas.translate(-a,-d);this.hitDetection&&this.hitContext.translate(-a,-d);g=b.strokeWidth;b.strokeWidth=g/f;if(!1!==b.fill){this.setCanvasStyle("fill",
-b);this.canvas.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.canvas.moveTo(d,e),this.canvas.lineTo(d,e);this.canvas.closePath();this.canvas.fill();if(this.hitDetection){this.setHitContextStyle("fill",c,b);this.hitContext.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.canvas.moveTo(d,e),this.hitContext.lineTo(d,e);this.hitContext.closePath();this.hitContext.fill()}}if(!1!==b.stroke){this.setCanvasStyle("stroke",b);this.canvas.beginPath();for(a=0;a<h.length;a+=2)d=h[a],
-e=h[a+1],0==a&&this.canvas.moveTo(d,e),this.canvas.lineTo(d,e);this.canvas.closePath();this.canvas.stroke();if(this.hitDetection){this.setHitContextStyle("stroke",c,b,f);this.hitContext.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.hitContext.moveTo(d,e),this.hitContext.lineTo(d,e);this.hitContext.closePath();this.hitContext.stroke()}}b.strokeWidth=g;this.canvas.restore();this.hitDetection&&this.hitContext.restore();this.setCanvasStyle("reset")}},setCanvasStyle:function(a,b){"fill"===
-a?(this.canvas.globalAlpha=b.fillOpacity,this.canvas.fillStyle=b.fillColor):"stroke"===a?(this.canvas.globalAlpha=b.strokeOpacity,this.canvas.strokeStyle=b.strokeColor,this.canvas.lineWidth=b.strokeWidth):(this.canvas.globalAlpha=0,this.canvas.lineWidth=1)},featureIdToHex:function(a){a=Number(a.split("_").pop())+1;16777216<=a&&(this.hitOverflow=a-16777215,a=a%16777216+1);a="000000"+a.toString(16);var b=a.length;return a="#"+a.substring(b-6,b)},setHitContextStyle:function(a,b,c,d){b=this.featureIdToHex(b);
-"fill"==a?(this.hitContext.globalAlpha=1,this.hitContext.fillStyle=b):"stroke"==a?(this.hitContext.globalAlpha=1,this.hitContext.strokeStyle=b,"undefined"===typeof d?this.hitContext.lineWidth=c.strokeWidth+2:isNaN(d)||(this.hitContext.lineWidth=c.strokeWidth+2/d)):(this.hitContext.globalAlpha=0,this.hitContext.lineWidth=1)},drawPoint:function(a,b,c){if(!1!==b.graphic)if(b.externalGraphic)this.drawExternalGraphic(a,b,c);else if(b.graphicName&&"circle"!=b.graphicName)this.drawNamedSymbol(a,b,c);else{var d=
-this.getLocalXY(a);a=d[0];d=d[1];if(!isNaN(a)&&!isNaN(d)){var e=2*Math.PI,f=b.pointRadius;!1!==b.fill&&(this.setCanvasStyle("fill",b),this.canvas.beginPath(),this.canvas.arc(a,d,f,0,e,!0),this.canvas.fill(),this.hitDetection&&(this.setHitContextStyle("fill",c,b),this.hitContext.beginPath(),this.hitContext.arc(a,d,f,0,e,!0),this.hitContext.fill()));!1!==b.stroke&&(this.setCanvasStyle("stroke",b),this.canvas.beginPath(),this.canvas.arc(a,d,f,0,e,!0),this.canvas.stroke(),this.hitDetection&&(this.setHitContextStyle("stroke",
-c,b),this.hitContext.beginPath(),this.hitContext.arc(a,d,f,0,e,!0),this.hitContext.stroke()),this.setCanvasStyle("reset"))}}},drawLineString:function(a,b,c){b=OpenLayers.Util.applyDefaults({fill:!1},b);this.drawLinearRing(a,b,c)},drawLinearRing:function(a,b,c){!1!==b.fill&&(this.setCanvasStyle("fill",b),this.renderPath(this.canvas,a,b,c,"fill"),this.hitDetection&&(this.setHitContextStyle("fill",c,b),this.renderPath(this.hitContext,a,b,c,"fill")));!1!==b.stroke&&(this.setCanvasStyle("stroke",b),this.renderPath(this.canvas,
-a,b,c,"stroke"),this.hitDetection&&(this.setHitContextStyle("stroke",c,b),this.renderPath(this.hitContext,a,b,c,"stroke")));this.setCanvasStyle("reset")},renderPath:function(a,b,c,d,e){b=b.components;c=b.length;a.beginPath();d=this.getLocalXY(b[0]);var f=d[1];if(!isNaN(d[0])&&!isNaN(f)){a.moveTo(d[0],d[1]);for(d=1;d<c;++d)f=this.getLocalXY(b[d]),a.lineTo(f[0],f[1]);"fill"===e?a.fill():a.stroke()}},drawPolygon:function(a,b,c){a=a.components;var d=a.length;this.drawLinearRing(a[0],b,c);for(var e=1;e<
-d;++e)this.canvas.globalCompositeOperation="destination-out",this.hitDetection&&(this.hitContext.globalCompositeOperation="destination-out"),this.drawLinearRing(a[e],OpenLayers.Util.applyDefaults({stroke:!1,fillOpacity:1},b),c),this.canvas.globalCompositeOperation="source-over",this.hitDetection&&(this.hitContext.globalCompositeOperation="source-over"),this.drawLinearRing(a[e],OpenLayers.Util.applyDefaults({fill:!1},b),c)},drawText:function(a,b){var c=this.getLocalXY(a);this.setCanvasStyle("reset");
-this.canvas.fillStyle=b.fontColor;this.canvas.globalAlpha=b.fontOpacity||1;var d=[b.fontStyle?b.fontStyle:"normal","normal",b.fontWeight?b.fontWeight:"normal",b.fontSize?b.fontSize:"1em",b.fontFamily?b.fontFamily:"sans-serif"].join(" "),e=b.label.split("\n"),f=e.length;if(this.canvas.fillText){this.canvas.font=d;this.canvas.textAlign=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[0]]||"center";this.canvas.textBaseline=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[1]]||"middle";var g=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[1]];
-null==g&&(g=-0.5);d=this.canvas.measureText("Mg").height||this.canvas.measureText("xx").width;c[1]+=d*g*(f-1);for(g=0;g<f;g++)b.labelOutlineWidth&&(this.canvas.save(),this.canvas.globalAlpha=b.labelOutlineOpacity||b.fontOpacity||1,this.canvas.strokeStyle=b.labelOutlineColor,this.canvas.lineWidth=b.labelOutlineWidth,this.canvas.strokeText(e[g],c[0],c[1]+d*g+1),this.canvas.restore()),this.canvas.fillText(e[g],c[0],c[1]+d*g)}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=d;var h=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[0]];
-null==h&&(h=-0.5);g=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[1]];null==g&&(g=-0.5);d=this.canvas.mozMeasureText("xx");c[1]+=d*(1+g*f);for(g=0;g<f;g++){var k=c[0]+h*this.canvas.mozMeasureText(e[g]),l=c[1]+g*d;this.canvas.translate(k,l);this.canvas.mozDrawText(e[g]);this.canvas.translate(-k,-l)}}this.setCanvasStyle("reset")},getLocalXY:function(a){var b=this.getResolution(),c=this.extent;return[(a.x-this.featureDx)/b+-c.left/b,c.top/b-a.y/b]},clear:function(){var a=this.root.height,b=this.root.width;
-this.canvas.clearRect(0,0,b,a);this.features={};this.hitDetection&&this.hitContext.clearRect(0,0,b,a)},getFeatureIdFromEvent:function(a){var b;if(this.hitDetection&&"none"!==this.root.style.display&&!this.map.dragging&&(a=a.xy,a=this.hitContext.getImageData(a.x|0,a.y|0,1,1).data,255===a[3]&&(a=a[2]+256*(a[1]+256*a[0])))){a="OpenLayers_Feature_Vector_"+(a-1+this.hitOverflow);try{b=this.features[a][0]}catch(c){}}return b},eraseFeatures:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0;b<a.length;++b)delete this.features[a[b].id];
-this.redraw()},redraw:function(){if(!this.locked){var a=this.root.height,b=this.root.width;this.canvas.clearRect(0,0,b,a);this.hitDetection&&this.hitContext.clearRect(0,0,b,a);var a=[],c,d,e=this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent(),f;for(f in this.features)this.features.hasOwnProperty(f)&&(b=this.features[f][0],c=b.geometry,this.calculateFeatureDx(c.getBounds(),e),d=this.features[f][1],this.drawGeometry(c,d,b.id),d.label&&a.push([b,d]));b=0;for(c=a.length;b<c;++b)f=
-a[b],this.drawText(f[0].geometry.getCentroid(),f[1])}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right",t:"top",b:"bottom"};OpenLayers.Renderer.Canvas.LABEL_FACTOR={l:0,r:-1,t:0,b:-1};OpenLayers.Renderer.Canvas.drawImageScaleFactor=null;OpenLayers.Layer.Bing=OpenLayers.Class(OpenLayers.Layer.XYZ,{key:null,serverResolutions:[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,0.5971642833948135,0.29858214169740677,0.14929107084870338,0.07464553542435169],attributionTemplate:'<span class="olBingAttribution ${type}"><div><a target="_blank" href="http://www.bing.com/maps/"><img src="${logo}" /></a></div>${copyrights}<a style="white-space: nowrap" target="_blank" href="http://www.microsoft.com/maps/product/terms.html">Terms of Use</a></span>',
-metadata:null,protocolRegex:/^http:/i,type:"Road",culture:"en-US",metadataParams:null,tileOptions:null,protocol:~window.location.href.indexOf("http")?"":"http:",initialize:function(a){a=OpenLayers.Util.applyDefaults({sphericalMercator:!0},a);OpenLayers.Layer.XYZ.prototype.initialize.apply(this,[a.name||"Bing "+(a.type||this.type),null,a]);this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options.tileOptions);this.loadMetadata()},loadMetadata:function(){this._callbackId=
-"_callback_"+this.id.replace(/\./g,"_");window[this._callbackId]=OpenLayers.Function.bind(OpenLayers.Layer.Bing.processMetadata,this);var a=OpenLayers.Util.applyDefaults({key:this.key,jsonp:this._callbackId,include:"ImageryProviders"},this.metadataParams),a=this.protocol+"//dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.type+"?"+OpenLayers.Util.getParameterString(a),b=document.createElement("script");b.type="text/javascript";b.src=a;b.id=this._callbackId;document.getElementsByTagName("head")[0].appendChild(b)},
-initLayer:function(){var a=this.metadata.resourceSets[0].resources[0],b=a.imageUrl.replace("{quadkey}","${quadkey}"),b=b.replace("{culture}",this.culture),b=b.replace(this.protocolRegex,this.protocol);this.url=[];for(var c=0;c<a.imageUrlSubdomains.length;++c)this.url.push(b.replace("{subdomain}",a.imageUrlSubdomains[c]));this.addOptions({maxResolution:Math.min(this.serverResolutions[a.zoomMin],this.maxResolution||Number.POSITIVE_INFINITY),numZoomLevels:Math.min(a.zoomMax+1-a.zoomMin,this.numZoomLevels)},
-!0);this.isBaseLayer||this.redraw();this.updateAttribution()},getURL:function(a){if(this.url){var b=this.getXYZ(a);a=b.x;for(var c=b.y,b=b.z,d=[],e=b;0<e;--e){var f="0",g=1<<e-1;0!=(a&g)&&f++;0!=(c&g)&&(f++,f++);d.push(f)}d=d.join("");a=this.selectUrl(""+a+c+b,this.url);return OpenLayers.String.format(a,{quadkey:d})}},updateAttribution:function(){var a=this.metadata;if(a.resourceSets&&this.map&&this.map.center){var b=a.resourceSets[0].resources[0],c=this.map.getExtent().transform(this.map.getProjectionObject(),
-new OpenLayers.Projection("EPSG:4326")),d=b.imageryProviders||[],e=OpenLayers.Util.indexOf(this.serverResolutions,this.getServerResolution()),b="",f,g,h,k,l,m,r;g=0;for(h=d.length;g<h;++g){f=d[g];k=0;for(l=f.coverageAreas.length;k<l;++k)r=f.coverageAreas[k],m=OpenLayers.Bounds.fromArray(r.bbox,!0),c.intersectsBounds(m)&&(e<=r.zoomMax&&e>=r.zoomMin)&&(b+=f.attribution+" ")}a=a.brandLogoUri.replace(this.protocolRegex,this.protocol);this.attribution=OpenLayers.String.format(this.attributionTemplate,
-{type:this.type.toLowerCase(),logo:a,copyrights:b});this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"attribution"})}},setMap:function(){OpenLayers.Layer.XYZ.prototype.setMap.apply(this,arguments);this.map.events.register("moveend",this,this.updateAttribution)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Bing(this.options));return a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},destroy:function(){this.map&&this.map.events.unregister("moveend",this,this.updateAttribution);
-OpenLayers.Layer.XYZ.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.Bing"});OpenLayers.Layer.Bing.processMetadata=function(a){this.metadata=a;this.initLayer();a=document.getElementById(this._callbackId);a.parentNode.removeChild(a);window[this._callbackId]=void 0;delete this._callbackId};OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:!1,evt:null,touch:!1,initialize:function(a,b,c){OpenLayers.Util.extend(this,c);this.control=a;this.callbacks=b;(a=this.map||a.map)&&this.setMap(a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){return null==this.keyMask?!0:((a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?OpenLayers.Handler.MOD_ALT:
-0)|(a.metaKey?OpenLayers.Handler.MOD_META:0))==this.keyMask},activate:function(){if(this.active)return!1;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.register(a[b],this[a[b]]);return this.active=!0},deactivate:function(){if(!this.active)return!1;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.unregister(a[b],this[a[b]]);this.active=this.touch=!1;return!0},startTouch:function(){if(!this.touch){this.touch=!0;
-for(var a="mousedown mouseup mousemove click dblclick mouseout".split(" "),b=0,c=a.length;b<c;b++)this[a[b]]&&this.unregister(a[b],this[a[b]])}},callback:function(a,b){a&&this.callbacks[a]&&this.callbacks[a].apply(this.control,b)},register:function(a,b){this.map.events.registerPriority(a,this,b);this.map.events.registerPriority(a,this,this.setEvent)},unregister:function(a,b){this.map.events.unregister(a,this,b);this.map.events.unregister(a,this,this.setEvent)},setEvent:function(a){this.evt=a;return!0},
-destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Handler.MOD_META=8;OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,interval:0,maxDelta:Number.POSITIVE_INFINITY,delta:0,cumulative:!0,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this)},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null},onWheelEvent:function(a){if(this.map&&this.checkModifiers(a)){for(var b=
-!1,c=!1,d=!1,e=OpenLayers.Event.element(a);null!=e&&!d&&!b;){if(!b)try{var f,b=(f=e.currentStyle?e.currentStyle.overflow:document.defaultView.getComputedStyle(e,null).getPropertyValue("overflow"))&&"auto"==f||"scroll"==f}catch(g){}if(!c&&(c=OpenLayers.Element.hasClass(e,"olScrollable"),!c))for(var d=0,h=this.map.layers.length;d<h;d++){var k=this.map.layers[d];if(e==k.div||e==k.pane){c=!0;break}}d=e==this.map.div;e=e.parentNode}if(!b&&d){if(c)if(b=0,a.wheelDelta?(b=a.wheelDelta,0===b%160&&(b*=0.75),
-b/=120):a.detail&&(b=-(a.detail/Math.abs(a.detail))),this.delta+=b,window.clearTimeout(this._timeoutId),this.interval&&Math.abs(this.delta)<this.maxDelta){var l=OpenLayers.Util.extend({},a);this._timeoutId=window.setTimeout(OpenLayers.Function.bind(function(){this.wheelZoom(l)},this),this.interval)}else this.wheelZoom(a);OpenLayers.Event.stop(a)}}},wheelZoom:function(a){var b=this.delta;this.delta=0;b&&(a.xy=this.map.events.getMousePosition(a),0>b?this.callback("down",[a,this.cumulative?Math.max(-this.maxDelta,
-b):-1]):this.callback("up",[a,this.cumulative?Math.min(this.maxDelta,b):1]))},activate:function(a){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",b);OpenLayers.Event.observe(window,"mousewheel",b);OpenLayers.Event.observe(document,"mousewheel",b);return!0}return!1},deactivate:function(a){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.stopObserving(window,
-"DOMMouseScroll",b);OpenLayers.Event.stopObserving(window,"mousewheel",b);OpenLayers.Event.stopObserving(document,"mousewheel",b);return!0}return!1},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],split:function(a,b){for(var c=null,d=b&&b.mutual,e,f,g,h,k=[],l=[a],m=0,r=this.components.length;m<r;++m){f=this.components[m];g=!1;for(var p=0;p<l.length;++p)if(e=f.split(l[p],b)){if(d){g=e[0];for(var n=0,q=g.length;n<q;++n)0===n&&k.length?k[k.length-1].addComponent(g[n]):k.push(new OpenLayers.Geometry.MultiLineString([g[n]]));g=!0;e=e[1]}if(e.length){e.unshift(p,
-1);Array.prototype.splice.apply(l,e);break}}g||(k.length?k[k.length-1].addComponent(f.clone()):k=[new OpenLayers.Geometry.MultiLineString(f.clone())])}k&&1<k.length?g=!0:k=[];l&&1<l.length?h=!0:l=[];if(g||h)c=d?[k,l]:l;return c},splitWith:function(a,b){var c=null,d=b&&b.mutual,e,f,g,h,k,l;if(a instanceof OpenLayers.Geometry.LineString){l=[];k=[a];for(var m=0,r=this.components.length;m<r;++m){g=!1;f=this.components[m];for(var p=0;p<k.length;++p)if(e=k[p].split(f,b)){d&&(g=e[0],g.length&&(g.unshift(p,
-1),Array.prototype.splice.apply(k,g),p+=g.length-2),e=e[1],0===e.length&&(e=[f.clone()]));g=0;for(var n=e.length;g<n;++g)0===g&&l.length?l[l.length-1].addComponent(e[g]):l.push(new OpenLayers.Geometry.MultiLineString([e[g]]));g=!0}g||(l.length?l[l.length-1].addComponent(f.clone()):l=[new OpenLayers.Geometry.MultiLineString([f.clone()])])}}else c=a.split(this);k&&1<k.length?h=!0:k=[];l&&1<l.length?g=!0:l=[];if(h||g)c=d?[k,l]:l;return c},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:!1,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){},read:function(a){throw Error("Read not implemented.");},write:function(a){throw Error("Write not implemented.");},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(a){window.ActiveXObject&&(this.xmldom=new ActiveXObject("Microsoft.XMLDOM"));OpenLayers.Format.prototype.initialize.apply(this,[a]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var b in this.namespaces)this.namespaceAlias[this.namespaces[b]]=b},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this,
-arguments)},setNamespace:function(a,b){this.namespaces[a]=b;this.namespaceAlias[b]=a},read:function(a){var b=a.indexOf("<");0<b&&(a=a.substring(b));b=OpenLayers.Util.Try(OpenLayers.Function.bind(function(){var b;b=window.ActiveXObject&&!this.xmldom?new ActiveXObject("Microsoft.XMLDOM"):this.xmldom;b.loadXML(a);return b},this),function(){return(new DOMParser).parseFromString(a,"text/xml")},function(){var b=new XMLHttpRequest;b.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(a),!1);b.overrideMimeType&&
-b.overrideMimeType("text/xml");b.send(null);return b.responseXML});this.keepData&&(this.data=b);return b},write:function(a){if(this.xmldom)a=a.xml;else{var b=new XMLSerializer;if(1==a.nodeType){var c=document.implementation.createDocument("","",null);c.importNode&&(a=c.importNode(a,!0));c.appendChild(a);a=b.serializeToString(c)}else a=b.serializeToString(a)}return a},createElementNS:function(a,b){return this.xmldom?"string"==typeof a?this.xmldom.createNode(1,b,a):this.xmldom.createNode(1,b,""):document.createElementNS(a,
-b)},createDocumentFragment:function(){return this.xmldom?this.xmldom.createDocumentFragment():document.createDocumentFragment()},createTextNode:function(a){"string"!==typeof a&&(a=String(a));return this.xmldom?this.xmldom.createTextNode(a):document.createTextNode(a)},getElementsByTagNameNS:function(a,b,c){var d=[];if(a.getElementsByTagNameNS)d=a.getElementsByTagNameNS(b,c);else{a=a.getElementsByTagName("*");for(var e,f,g=0,h=a.length;g<h;++g)if(e=a[g],f=e.prefix?e.prefix+":"+c:c,"*"==c||f==e.nodeName)("*"==
-b||b==e.namespaceURI)&&d.push(e)}return d},getAttributeNodeNS:function(a,b,c){var d=null;if(a.getAttributeNodeNS)d=a.getAttributeNodeNS(b,c);else{a=a.attributes;for(var e,f,g=0,h=a.length;g<h;++g)if(e=a[g],e.namespaceURI==b&&(f=e.prefix?e.prefix+":"+c:c,f==e.nodeName)){d=e;break}}return d},getAttributeNS:function(a,b,c){var d="";if(a.getAttributeNS)d=a.getAttributeNS(b,c)||"";else if(a=this.getAttributeNodeNS(a,b,c))d=a.nodeValue;return d},getChildValue:function(a,b){var c=b||"";if(a)for(var d=a.firstChild;d;d=
-d.nextSibling)switch(d.nodeType){case 3:case 4:c+=d.nodeValue}return c},isSimpleContent:function(a){var b=!0;for(a=a.firstChild;a;a=a.nextSibling)if(1===a.nodeType){b=!1;break}return b},contentType:function(a){var b=!1,c=!1,d=OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;for(a=a.firstChild;a;a=a.nextSibling){switch(a.nodeType){case 1:c=!0;break;case 8:break;default:b=!0}if(c&&b)break}if(c&&b)d=OpenLayers.Format.XML.CONTENT_TYPE.MIXED;else{if(c)return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;if(b)return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE}return d},
-hasAttributeNS:function(a,b,c){var d=!1;return d=a.hasAttributeNS?a.hasAttributeNS(b,c):!!this.getAttributeNodeNS(a,b,c)},setAttributeNS:function(a,b,c,d){if(a.setAttributeNS)a.setAttributeNS(b,c,d);else if(this.xmldom)b?(b=a.ownerDocument.createNode(2,c,b),b.nodeValue=d,a.setAttributeNode(b)):a.setAttribute(c,d);else throw"setAttributeNS not implemented";},createElementNSPlus:function(a,b){b=b||{};var c=b.uri||this.namespaces[b.prefix];c||(c=a.indexOf(":"),c=this.namespaces[a.substring(0,c)]);c||
-(c=this.namespaces[this.defaultPrefix]);c=this.createElementNS(c,a);b.attributes&&this.setAttributes(c,b.attributes);var d=b.value;null!=d&&c.appendChild(this.createTextNode(d));return c},setAttributes:function(a,b){var c,d,e;for(e in b)null!=b[e]&&b[e].toString&&(c=b[e].toString(),d=this.namespaces[e.substring(0,e.indexOf(":"))]||null,this.setAttributeNS(a,d,e,c))},readNode:function(a,b){b||(b={});var c=this.readers[a.namespaceURI?this.namespaceAlias[a.namespaceURI]:this.defaultPrefix];if(c){var d=
-a.localName||a.nodeName.split(":").pop();(c=c[d]||c["*"])&&c.apply(this,[a,b])}return b},readChildNodes:function(a,b){b||(b={});for(var c=a.childNodes,d,e=0,f=c.length;e<f;++e)d=c[e],1==d.nodeType&&this.readNode(d,b);return b},writeNode:function(a,b,c){var d,e=a.indexOf(":");0<e?(d=a.substring(0,e),a=a.substring(e+1)):d=c?this.namespaceAlias[c.namespaceURI]:this.defaultPrefix;b=this.writers[d][a].apply(this,[b]);c&&c.appendChild(b);return b},getChildEl:function(a,b,c){return a&&this.getThisOrNextEl(a.firstChild,
-b,c)},getNextEl:function(a,b,c){return a&&this.getThisOrNextEl(a.nextSibling,b,c)},getThisOrNextEl:function(a,b,c){a:for(;a;a=a.nextSibling)switch(a.nodeType){case 1:if((!b||b===(a.localName||a.nodeName.split(":").pop()))&&(!c||c===a.namespaceURI))break a;a=null;break a;case 3:if(/^\s*$/.test(a.nodeValue))break;case 4:case 6:case 12:case 10:case 11:a=null;break a}return a||null},lookupNamespaceURI:function(a,b){var c=null;if(a)if(a.lookupNamespaceURI)c=a.lookupNamespaceURI(b);else a:switch(a.nodeType){case 1:if(null!==
-a.namespaceURI&&a.prefix===b){c=a.namespaceURI;break a}if(c=a.attributes.length)for(var d,e=0;e<c;++e)if(d=a.attributes[e],"xmlns"===d.prefix&&d.name==="xmlns:"+b){c=d.value||null;break a}else if("xmlns"===d.name&&null===b){c=d.value||null;break a}c=this.lookupNamespaceURI(a.parentNode,b);break a;case 2:c=this.lookupNamespaceURI(a.ownerElement,b);break a;case 9:c=this.lookupNamespaceURI(a.documentElement,b);break a;case 6:case 12:case 10:case 11:break a;default:c=this.lookupNamespaceURI(a.parentNode,
-b)}return c},getXMLDoc:function(){!OpenLayers.Format.XML.document&&!this.xmldom&&(document.implementation&&document.implementation.createDocument?OpenLayers.Format.XML.document=document.implementation.createDocument("","",null):!this.xmldom&&window.ActiveXObject&&(this.xmldom=new ActiveXObject("Microsoft.XMLDOM")));return OpenLayers.Format.XML.document||this.xmldom},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Format.XML.CONTENT_TYPE={EMPTY:0,SIMPLE:1,COMPLEX:2,MIXED:3};
-OpenLayers.Format.XML.lookupNamespaceURI=OpenLayers.Function.bind(OpenLayers.Format.XML.prototype.lookupNamespaceURI,OpenLayers.Format.XML.prototype);OpenLayers.Format.XML.document=null;OpenLayers.Format.OGCExceptionReport=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},defaultPrefix:"ogc",read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var b={exceptionReport:null};a.documentElement&&(this.readChildNodes(a,b),null===b.exceptionReport&&(b=(new OpenLayers.Format.OWSCommon).read(a)));return b},readers:{ogc:{ServiceExceptionReport:function(a,
-b){b.exceptionReport={exceptions:[]};this.readChildNodes(a,b.exceptionReport)},ServiceException:function(a,b){var c={code:a.getAttribute("code"),locator:a.getAttribute("locator"),text:this.getChildValue(a)};b.exceptions.push(c)}}},CLASS_NAME:"OpenLayers.Format.OGCExceptionReport"});OpenLayers.Format.XML.VersionedOGC=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:null,version:null,profile:null,allowFallback:!1,name:null,stringifyOutput:!1,parser:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);a=this.CLASS_NAME;this.name=a.substring(a.lastIndexOf(".")+1)},getVersion:function(a,b){var c;a?(c=this.version,c||(c=a.getAttribute("version"),c||(c=this.defaultVersion))):c=b&&b.version||this.version||this.defaultVersion;return c},getParser:function(a){a=
-a||this.defaultVersion;var b=this.profile?"_"+this.profile:"";if(!this.parser||this.parser.VERSION!=a){var c=OpenLayers.Format[this.name]["v"+a.replace(/\./g,"_")+b];if(!c&&(""!==b&&this.allowFallback&&(b="",c=OpenLayers.Format[this.name]["v"+a.replace(/\./g,"_")]),!c))throw"Can't find a "+this.name+" parser for version "+a+b;this.parser=new c(this.options)}return this.parser},write:function(a,b){var c=this.getVersion(null,b);this.parser=this.getParser(c);c=this.parser.write(a,b);return!1===this.stringifyOutput?
-c:OpenLayers.Format.XML.prototype.write.apply(this,[c])},read:function(a,b){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var c=this.getVersion(a.documentElement);this.parser=this.getParser(c);var d=this.parser.read(a,b),e=this.parser.errorProperty||null;null!==e&&void 0===d[e]&&(e=new OpenLayers.Format.OGCExceptionReport,d.error=e.read(a));d.version=c;return d},CLASS_NAME:"OpenLayers.Format.XML.VersionedOGC"});OpenLayers.Filter.FeatureId=OpenLayers.Class(OpenLayers.Filter,{fids:null,type:"FID",initialize:function(a){this.fids=[];OpenLayers.Filter.prototype.initialize.apply(this,[a])},evaluate:function(a){for(var b=0,c=this.fids.length;b<c;b++)if((a.fid||a.id)==this.fids[b])return!0;return!1},clone:function(){var a=new OpenLayers.Filter.FeatureId;OpenLayers.Util.extend(a,this);a.fids=this.fids.slice();return a},CLASS_NAME:"OpenLayers.Filter.FeatureId"});OpenLayers.Filter.Logical=OpenLayers.Class(OpenLayers.Filter,{filters:null,type:null,initialize:function(a){this.filters=[];OpenLayers.Filter.prototype.initialize.apply(this,[a])},destroy:function(){this.filters=null;OpenLayers.Filter.prototype.destroy.apply(this)},evaluate:function(a){var b,c;switch(this.type){case OpenLayers.Filter.Logical.AND:b=0;for(c=this.filters.length;b<c;b++)if(!1==this.filters[b].evaluate(a))return!1;return!0;case OpenLayers.Filter.Logical.OR:b=0;for(c=this.filters.length;b<
-c;b++)if(!0==this.filters[b].evaluate(a))return!0;return!1;case OpenLayers.Filter.Logical.NOT:return!this.filters[0].evaluate(a)}},clone:function(){for(var a=[],b=0,c=this.filters.length;b<c;++b)a.push(this.filters[b].clone());return new OpenLayers.Filter.Logical({type:this.type,filters:a})},CLASS_NAME:"OpenLayers.Filter.Logical"});OpenLayers.Filter.Logical.AND="&&";OpenLayers.Filter.Logical.OR="||";OpenLayers.Filter.Logical.NOT="!";OpenLayers.Filter.Comparison=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,matchCase:!0,lowerBoundary:null,upperBoundary:null,initialize:function(a){OpenLayers.Filter.prototype.initialize.apply(this,[a]);this.type===OpenLayers.Filter.Comparison.LIKE&&void 0===a.matchCase&&(this.matchCase=null)},evaluate:function(a){a instanceof OpenLayers.Feature.Vector&&(a=a.attributes);var b=!1;a=a[this.property];switch(this.type){case OpenLayers.Filter.Comparison.EQUAL_TO:b=this.value;
-b=!this.matchCase&&"string"==typeof a&&"string"==typeof b?a.toUpperCase()==b.toUpperCase():a==b;break;case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:b=this.value;b=!this.matchCase&&"string"==typeof a&&"string"==typeof b?a.toUpperCase()!=b.toUpperCase():a!=b;break;case OpenLayers.Filter.Comparison.LESS_THAN:b=a<this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN:b=a>this.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:b=a<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:b=
-a>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:b=a>=this.lowerBoundary&&a<=this.upperBoundary;break;case OpenLayers.Filter.Comparison.LIKE:b=RegExp(this.value,"gi").test(a);break;case OpenLayers.Filter.Comparison.IS_NULL:b=null===a}return b},value2regex:function(a,b,c){if("."==a)throw Error("'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison");a=a?a:"*";b=b?b:".";this.value=this.value.replace(RegExp("\\"+(c?c:"!")+"(.|$)","g"),"\\$1");this.value=this.value.replace(RegExp("\\"+
-b,"g"),".");this.value=this.value.replace(RegExp("\\"+a,"g"),".*");this.value=this.value.replace(RegExp("\\\\.\\*","g"),"\\"+a);return this.value=this.value.replace(RegExp("\\\\\\.","g"),"\\"+b)},regex2value:function(){var a=this.value,a=a.replace(/!/g,"!!"),a=a.replace(/(\\)?\\\./g,function(a,c){return c?a:"!."}),a=a.replace(/(\\)?\\\*/g,function(a,c){return c?a:"!*"}),a=a.replace(/\\\\/g,"\\");return a=a.replace(/\.\*/g,"*")},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison,
-this)},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";OpenLayers.Filter.Comparison.IS_NULL="NULL";OpenLayers.Format.Filter=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",CLASS_NAME:"OpenLayers.Format.Filter"});OpenLayers.Format.WFST=function(a){a=OpenLayers.Util.applyDefaults(a,OpenLayers.Format.WFST.DEFAULTS);var b=OpenLayers.Format.WFST["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported WFST version: "+a.version;return new b(a)};OpenLayers.Format.WFST.DEFAULTS={version:"1.0.0"};OpenLayers.Filter.Spatial=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,distance:null,distanceUnits:null,evaluate:function(a){var b=!1;switch(this.type){case OpenLayers.Filter.Spatial.BBOX:case OpenLayers.Filter.Spatial.INTERSECTS:if(a.geometry){var c=this.value;"OpenLayers.Bounds"==this.value.CLASS_NAME&&(c=this.value.toGeometry());a.geometry.intersects(c)&&(b=!0)}break;default:throw Error("evaluate is not implemented for this filter type.");}return b},clone:function(){var a=
-OpenLayers.Util.applyDefaults({value:this.value&&this.value.clone&&this.value.clone()},this);return new OpenLayers.Filter.Spatial(a)},CLASS_NAME:"OpenLayers.Filter.Spatial"});OpenLayers.Filter.Spatial.BBOX="BBOX";OpenLayers.Filter.Spatial.INTERSECTS="INTERSECTS";OpenLayers.Filter.Spatial.DWITHIN="DWITHIN";OpenLayers.Filter.Spatial.WITHIN="WITHIN";OpenLayers.Filter.Spatial.CONTAINS="CONTAINS";OpenLayers.Format.WFST.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs",gml:"http://www.opengis.net/gml",ogc:"http://www.opengis.net/ogc",ows:"http://www.opengis.net/ows"},defaultPrefix:"wfs",version:null,schemaLocations:null,srsName:null,extractAttributes:!0,xy:!0,stateName:null,initialize:function(a){this.stateName={};this.stateName[OpenLayers.State.INSERT]="wfs:Insert";this.stateName[OpenLayers.State.UPDATE]=
-"wfs:Update";this.stateName[OpenLayers.State.DELETE]="wfs:Delete";OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},getSrsName:function(a,b){var c=b&&b.srsName;c||(c=a&&a.layer?a.layer.projection.getCode():this.srsName);return c},read:function(a,b){b=b||{};OpenLayers.Util.applyDefaults(b,{output:"features"});"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var c={};a&&this.readNode(a,c,!0);c.features&&"features"===b.output&&
-(c=c.features);return c},readers:{wfs:{FeatureCollection:function(a,b){b.features=[];this.readChildNodes(a,b)}}},write:function(a,b){var c=this.writeNode("wfs:Transaction",{features:a,options:b}),d=this.schemaLocationAttr();d&&this.setAttributeNS(c,this.namespaces.xsi,"xsi:schemaLocation",d);return OpenLayers.Format.XML.prototype.write.apply(this,[c])},writers:{wfs:{GetFeature:function(a){var b=this.createElementNSPlus("wfs:GetFeature",{attributes:{service:"WFS",version:this.version,handle:a&&a.handle,
-outputFormat:a&&a.outputFormat,maxFeatures:a&&a.maxFeatures,"xsi:schemaLocation":this.schemaLocationAttr(a)}});if("string"==typeof this.featureType)this.writeNode("Query",a,b);else for(var c=0,d=this.featureType.length;c<d;c++)a.featureType=this.featureType[c],this.writeNode("Query",a,b);return b},Transaction:function(a){a=a||{};var b=a.options||{},c=this.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version,handle:b.handle}}),d,e=a.features;if(e){!0===b.multi&&OpenLayers.Util.extend(this.geometryTypes,
-{"OpenLayers.Geometry.Point":"MultiPoint","OpenLayers.Geometry.LineString":!0===this.multiCurve?"MultiCurve":"MultiLineString","OpenLayers.Geometry.Polygon":!0===this.multiSurface?"MultiSurface":"MultiPolygon"});var f,g;a=0;for(d=e.length;a<d;++a)g=e[a],(f=this.stateName[g.state])&&this.writeNode(f,{feature:g,options:b},c);!0===b.multi&&this.setGeometryTypes()}if(b.nativeElements){a=0;for(d=b.nativeElements.length;a<d;++a)this.writeNode("wfs:Native",b.nativeElements[a],c)}return c},Native:function(a){return this.createElementNSPlus("wfs:Native",
-{attributes:{vendorId:a.vendorId,safeToIgnore:a.safeToIgnore},value:a.value})},Insert:function(a){var b=a.feature;a=a.options;a=this.createElementNSPlus("wfs:Insert",{attributes:{handle:a&&a.handle}});this.srsName=this.getSrsName(b);this.writeNode("feature:_typeName",b,a);return a},Update:function(a){var b=a.feature;a=a.options;a=this.createElementNSPlus("wfs:Update",{attributes:{handle:a&&a.handle,typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});this.featureNS&&a.setAttribute("xmlns:"+
-this.featurePrefix,this.featureNS);var c=b.modified;if(null!==this.geometryName&&(!c||void 0!==c.geometry))this.srsName=this.getSrsName(b),this.writeNode("Property",{name:this.geometryName,value:b.geometry},a);for(var d in b.attributes)void 0!==b.attributes[d]&&(!c||!c.attributes||c.attributes&&void 0!==c.attributes[d])&&this.writeNode("Property",{name:d,value:b.attributes[d]},a);this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[b.fid]}),a);return a},Property:function(a){var b=this.createElementNSPlus("wfs:Property");
-this.writeNode("Name",a.name,b);null!==a.value&&this.writeNode("Value",a.value,b);return b},Name:function(a){return this.createElementNSPlus("wfs:Name",{value:a})},Value:function(a){var b;a instanceof OpenLayers.Geometry?(b=this.createElementNSPlus("wfs:Value"),a=this.writeNode("feature:_geometry",a).firstChild,b.appendChild(a)):b=this.createElementNSPlus("wfs:Value",{value:a});return b},Delete:function(a){var b=a.feature;a=a.options;a=this.createElementNSPlus("wfs:Delete",{attributes:{handle:a&&
-a.handle,typeName:(this.featureNS?this.featurePrefix+":":"")+this.featureType}});this.featureNS&&a.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[b.fid]}),a);return a}}},schemaLocationAttr:function(a){a=OpenLayers.Util.extend({featurePrefix:this.featurePrefix,schema:this.schema},a);var b=OpenLayers.Util.extend({},this.schemaLocations);a.schema&&(b[a.featurePrefix]=a.schema);a=[];var c,d;for(d in b)(c=this.namespaces[d])&&
-a.push(c+" "+b[d]);return a.join(" ")||void 0},setFilterProperty:function(a){if(a.filters)for(var b=0,c=a.filters.length;b<c;++b)OpenLayers.Format.WFST.v1.prototype.setFilterProperty.call(this,a.filters[b]);else a instanceof OpenLayers.Filter.Spatial&&!a.property&&(a.property=this.geometryName)},CLASS_NAME:"OpenLayers.Format.WFST.v1"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],getArea:function(){var a=0;if(this.components&&0<this.components.length)for(var a=a+Math.abs(this.components[0].getArea()),b=1,c=this.components.length;b<c;b++)a-=Math.abs(this.components[b].getArea());return a},getGeodesicArea:function(a){var b=0;if(this.components&&0<this.components.length)for(var b=b+Math.abs(this.components[0].getGeodesicArea(a)),c=1,d=this.components.length;c<
+e=b.components[f+1],a+=OpenLayers.Util.rad(e.x-d.x)*(2+Math.sin(OpenLayers.Util.rad(d.y))+Math.sin(OpenLayers.Util.rad(e.y)));a=a*OpenLayers.Util.VincentyConstants.a*OpenLayers.Util.VincentyConstants.a/2}return a},containsPoint:function(a){var b=OpenLayers.Number.limitSigDigs,c=b(a.x,14);a=b(a.y,14);for(var d=this.components.length-1,e,f,g,h,k,l=0,m=0;m<d;++m)if(e=this.components[m],g=b(e.x,14),e=b(e.y,14),f=this.components[m+1],h=b(f.x,14),f=b(f.y,14),e==f){if(a==e&&(g<=h&&c>=g&&c<=h||g>=h&&c<=g&&
+c>=h)){l=-1;break}}else{k=b((a-f)*((h-g)/(f-e))+h,14);if(k==c&&(e<f&&a>=e&&a<=f||e>f&&a<=e&&a>=f)){l=-1;break}k<=c||g!=h&&(k<Math.min(g,h)||k>Math.max(g,h))||(e<f&&a>=e&&a<f||e>f&&a<e&&a>=f)&&++l}return-1==l?1:!!(l&1)},intersects:function(a){var b=!1;if("OpenLayers.Geometry.Point"==a.CLASS_NAME)b=this.containsPoint(a);else if("OpenLayers.Geometry.LineString"==a.CLASS_NAME)b=a.intersects(this);else if("OpenLayers.Geometry.LinearRing"==a.CLASS_NAME)b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,
+[a]);else for(var c=0,d=a.components.length;c<d&&!(b=a.components[c].intersects(this));++c);return b},getVertices:function(a){return!0===a?[]:this.components.slice(0,this.components.length-1)},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],getArea:function(){var a=0;if(this.components&&0<this.components.length)for(var a=a+Math.abs(this.components[0].getArea()),b=1,c=this.components.length;b<c;b++)a-=Math.abs(this.components[b].getArea());return a},getGeodesicArea:function(a){var b=0;if(this.components&&0<this.components.length)for(var b=b+Math.abs(this.components[0].getGeodesicArea(a)),c=1,d=this.components.length;c<
 d;c++)b-=Math.abs(this.components[c].getGeodesicArea(a));return b},containsPoint:function(a){var b=this.components.length,c=!1;if(0<b&&(c=this.components[0].containsPoint(a),1!==c&&c&&1<b))for(var d,e=1;e<b;++e)if(d=this.components[e].containsPoint(a)){c=1===d?1:!1;break}return c},intersects:function(a){var b=!1,c,d;if("OpenLayers.Geometry.Point"==a.CLASS_NAME)b=this.containsPoint(a);else if("OpenLayers.Geometry.LineString"==a.CLASS_NAME||"OpenLayers.Geometry.LinearRing"==a.CLASS_NAME){c=0;for(d=
 this.components.length;c<d&&!(b=a.intersects(this.components[c]));++c);if(!b){c=0;for(d=a.components.length;c<d&&!(b=this.containsPoint(a.components[c]));++c);}}else{c=0;for(d=a.components.length;c<d&&!(b=this.intersects(a.components[c]));++c);}if(!b&&"OpenLayers.Geometry.Polygon"==a.CLASS_NAME){var e=this.components[0];c=0;for(d=e.components.length;c<d&&!(b=a.containsPoint(e.components[c]));++c);}return b},distanceTo:function(a,b){return b&&!1===b.edge&&this.intersects(a)?0:OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,
 [a,b])},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(a,b,c,d){var e=Math.PI*(1/c-0.5);d&&(e+=d/180*Math.PI);for(var f,g=[],h=0;h<c;++h)f=e+2*h*Math.PI/c,d=a.x+b*Math.cos(f),f=a.y+b*Math.sin(f),g.push(new OpenLayers.Geometry.Point(d,f));a=new OpenLayers.Geometry.LinearRing(g);return new OpenLayers.Geometry.Polygon([a])};OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});OpenLayers.Format.GML=OpenLayers.Class(OpenLayers.Format.XML,{featureNS:"http://mapserver.gis.umn.edu/mapserver",featurePrefix:"feature",featureName:"featureMember",layerName:"features",geometryName:"geometry",collectionName:"FeatureCollection",gmlns:"http://www.opengis.net/gml",extractAttributes:!0,xy:!0,initialize:function(a){this.regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g};OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){"string"==
 typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a=this.getElementsByTagNameNS(a.documentElement,this.gmlns,this.featureName);for(var b=[],c=0;c<a.length;c++){var d=this.parseFeature(a[c]);d&&b.push(d)}return b},parseFeature:function(a){for(var b="MultiPolygon Polygon MultiLineString LineString MultiPoint Point Envelope".split(" "),c,d,e,f=0;f<b.length;++f)if(c=b[f],d=this.getElementsByTagNameNS(a,this.gmlns,c),0<d.length){if(e=this.parseGeometry[c.toLowerCase()])e=e.apply(this,
 [d[0]]),this.internalProjection&&this.externalProjection&&e.transform(this.externalProjection,this.internalProjection);else throw new TypeError("Unsupported geometry type: "+c);break}var g;c=this.getElementsByTagNameNS(a,this.gmlns,"Box");for(f=0;f<c.length;++f)b=c[f],d=this.parseGeometry.box.apply(this,[b]),b=b.parentNode,"boundedBy"===(b.localName||b.nodeName.split(":").pop())?g=d:e=d.toGeometry();var h;this.extractAttributes&&(h=this.parseAttributes(a));h=new OpenLayers.Feature.Vector(e,h);h.bounds=
 d;c++)b-=Math.abs(this.components[c].getGeodesicArea(a));return b},containsPoint:function(a){var b=this.components.length,c=!1;if(0<b&&(c=this.components[0].containsPoint(a),1!==c&&c&&1<b))for(var d,e=1;e<b;++e)if(d=this.components[e].containsPoint(a)){c=1===d?1:!1;break}return c},intersects:function(a){var b=!1,c,d;if("OpenLayers.Geometry.Point"==a.CLASS_NAME)b=this.containsPoint(a);else if("OpenLayers.Geometry.LineString"==a.CLASS_NAME||"OpenLayers.Geometry.LinearRing"==a.CLASS_NAME){c=0;for(d=
 this.components.length;c<d&&!(b=a.intersects(this.components[c]));++c);if(!b){c=0;for(d=a.components.length;c<d&&!(b=this.containsPoint(a.components[c]));++c);}}else{c=0;for(d=a.components.length;c<d&&!(b=this.intersects(a.components[c]));++c);}if(!b&&"OpenLayers.Geometry.Polygon"==a.CLASS_NAME){var e=this.components[0];c=0;for(d=e.components.length;c<d&&!(b=a.containsPoint(e.components[c]));++c);}return b},distanceTo:function(a,b){return b&&!1===b.edge&&this.intersects(a)?0:OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,
 [a,b])},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(a,b,c,d){var e=Math.PI*(1/c-0.5);d&&(e+=d/180*Math.PI);for(var f,g=[],h=0;h<c;++h)f=e+2*h*Math.PI/c,d=a.x+b*Math.cos(f),f=a.y+b*Math.sin(f),g.push(new OpenLayers.Geometry.Point(d,f));a=new OpenLayers.Geometry.LinearRing(g);return new OpenLayers.Geometry.Polygon([a])};OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});OpenLayers.Format.GML=OpenLayers.Class(OpenLayers.Format.XML,{featureNS:"http://mapserver.gis.umn.edu/mapserver",featurePrefix:"feature",featureName:"featureMember",layerName:"features",geometryName:"geometry",collectionName:"FeatureCollection",gmlns:"http://www.opengis.net/gml",extractAttributes:!0,xy:!0,initialize:function(a){this.regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g};OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){"string"==
 typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a=this.getElementsByTagNameNS(a.documentElement,this.gmlns,this.featureName);for(var b=[],c=0;c<a.length;c++){var d=this.parseFeature(a[c]);d&&b.push(d)}return b},parseFeature:function(a){for(var b="MultiPolygon Polygon MultiLineString LineString MultiPoint Point Envelope".split(" "),c,d,e,f=0;f<b.length;++f)if(c=b[f],d=this.getElementsByTagNameNS(a,this.gmlns,c),0<d.length){if(e=this.parseGeometry[c.toLowerCase()])e=e.apply(this,
 [d[0]]),this.internalProjection&&this.externalProjection&&e.transform(this.externalProjection,this.internalProjection);else throw new TypeError("Unsupported geometry type: "+c);break}var g;c=this.getElementsByTagNameNS(a,this.gmlns,"Box");for(f=0;f<c.length;++f)b=c[f],d=this.parseGeometry.box.apply(this,[b]),b=b.parentNode,"boundedBy"===(b.localName||b.nodeName.split(":").pop())?g=d:e=d.toGeometry();var h;this.extractAttributes&&(h=this.parseAttributes(a));h=new OpenLayers.Feature.Vector(e,h);h.bounds=
-g;h.gml={featureType:a.firstChild.nodeName.split(":")[1],featureNS:a.firstChild.namespaceURI,featureNSPrefix:a.firstChild.prefix};a=a.firstChild;for(var k;a&&!(1==a.nodeType&&(k=a.getAttribute("fid")||a.getAttribute("id")));)a=a.nextSibling;h.fid=k;return h},parseGeometry:{point:function(a){var b,c;c=[];b=this.getElementsByTagNameNS(a,this.gmlns,"pos");0<b.length&&(c=b[0].firstChild.nodeValue,c=c.replace(this.regExes.trimSpace,""),c=c.split(this.regExes.splitSpace));0==c.length&&(b=this.getElementsByTagNameNS(a,
-this.gmlns,"coordinates"),0<b.length&&(c=b[0].firstChild.nodeValue,c=c.replace(this.regExes.removeSpace,""),c=c.split(",")));0==c.length&&(b=this.getElementsByTagNameNS(a,this.gmlns,"coord"),0<b.length&&(a=this.getElementsByTagNameNS(b[0],this.gmlns,"X"),b=this.getElementsByTagNameNS(b[0],this.gmlns,"Y"),0<a.length&&0<b.length&&(c=[a[0].firstChild.nodeValue,b[0].firstChild.nodeValue])));2==c.length&&(c[2]=null);return this.xy?new OpenLayers.Geometry.Point(c[0],c[1],c[2]):new OpenLayers.Geometry.Point(c[1],
-c[0],c[2])},multipoint:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"Point");var b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.point.apply(this,[a[d]]))&&b.push(c);return new OpenLayers.Geometry.MultiPoint(b)},linestring:function(a,b){var c,d;d=[];var e=[];c=this.getElementsByTagNameNS(a,this.gmlns,"posList");if(0<c.length){d=this.getChildValue(c[0]);d=d.replace(this.regExes.trimSpace,"");d=d.split(this.regExes.splitSpace);var f=parseInt(c[0].getAttribute("dimension")),
-g,h,k;for(c=0;c<d.length/f;++c)g=c*f,h=d[g],k=d[g+1],g=2==f?null:d[g+2],this.xy?e.push(new OpenLayers.Geometry.Point(h,k,g)):e.push(new OpenLayers.Geometry.Point(k,h,g))}if(0==d.length&&(c=this.getElementsByTagNameNS(a,this.gmlns,"coordinates"),0<c.length)){d=this.getChildValue(c[0]);d=d.replace(this.regExes.trimSpace,"");d=d.replace(this.regExes.trimComma,",");f=d.split(this.regExes.splitSpace);for(c=0;c<f.length;++c)d=f[c].split(","),2==d.length&&(d[2]=null),this.xy?e.push(new OpenLayers.Geometry.Point(d[0],
-d[1],d[2])):e.push(new OpenLayers.Geometry.Point(d[1],d[0],d[2]))}d=null;0!=e.length&&(d=b?new OpenLayers.Geometry.LinearRing(e):new OpenLayers.Geometry.LineString(e));return d},multilinestring:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"LineString");var b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.linestring.apply(this,[a[d]]))&&b.push(c);return new OpenLayers.Geometry.MultiLineString(b)},polygon:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"LinearRing");
-var b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.linestring.apply(this,[a[d],!0]))&&b.push(c);return new OpenLayers.Geometry.Polygon(b)},multipolygon:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"Polygon");var b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.polygon.apply(this,[a[d]]))&&b.push(c);return new OpenLayers.Geometry.MultiPolygon(b)},envelope:function(a){var b=[],c,d,e=this.getElementsByTagNameNS(a,this.gmlns,"lowerCorner");if(0<e.length){c=
-[];0<e.length&&(c=e[0].firstChild.nodeValue,c=c.replace(this.regExes.trimSpace,""),c=c.split(this.regExes.splitSpace));2==c.length&&(c[2]=null);var f=this.xy?new OpenLayers.Geometry.Point(c[0],c[1],c[2]):new OpenLayers.Geometry.Point(c[1],c[0],c[2])}a=this.getElementsByTagNameNS(a,this.gmlns,"upperCorner");if(0<a.length){c=[];0<a.length&&(c=a[0].firstChild.nodeValue,c=c.replace(this.regExes.trimSpace,""),c=c.split(this.regExes.splitSpace));2==c.length&&(c[2]=null);var g=this.xy?new OpenLayers.Geometry.Point(c[0],
-c[1],c[2]):new OpenLayers.Geometry.Point(c[1],c[0],c[2])}f&&g&&(b.push(new OpenLayers.Geometry.Point(f.x,f.y)),b.push(new OpenLayers.Geometry.Point(g.x,f.y)),b.push(new OpenLayers.Geometry.Point(g.x,g.y)),b.push(new OpenLayers.Geometry.Point(f.x,g.y)),b.push(new OpenLayers.Geometry.Point(f.x,f.y)),b=new OpenLayers.Geometry.LinearRing(b),d=new OpenLayers.Geometry.Polygon([b]));return d},box:function(a){var b=this.getElementsByTagNameNS(a,this.gmlns,"coordinates"),c=a=null;0<b.length&&(b=b[0].firstChild.nodeValue,
-b=b.split(" "),2==b.length&&(a=b[0].split(","),c=b[1].split(",")));if(null!==a&&null!==c)return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(c[0]),parseFloat(c[1]))}},parseAttributes:function(a){var b={};a=a.firstChild;for(var c,d,e;a;){if(1==a.nodeType){a=a.childNodes;for(c=0;c<a.length;++c)if(d=a[c],1==d.nodeType)if(e=d.childNodes,1==e.length){if(e=e[0],3==e.nodeType||4==e.nodeType)d=d.prefix?d.nodeName.split(":")[1]:d.nodeName,e=e.nodeValue.replace(this.regExes.trimSpace,
-""),b[d]=e}else b[d.nodeName.split(":").pop()]=null;break}a=a.nextSibling}return b},write:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=this.createElementNS("http://www.opengis.net/wfs","wfs:"+this.collectionName),c=0;c<a.length;c++)b.appendChild(this.createFeatureXML(a[c]));return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFeatureXML:function(a){var b=this.buildGeometryNode(a.geometry),c=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.geometryName);c.appendChild(b);
-var b=this.createElementNS(this.gmlns,"gml:"+this.featureName),d=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.layerName);d.setAttribute("fid",a.fid||a.id);d.appendChild(c);for(var e in a.attributes){var c=this.createTextNode(a.attributes[e]),f=e.substring(e.lastIndexOf(":")+1),f=this.createElementNS(this.featureNS,this.featurePrefix+":"+f);f.appendChild(c);d.appendChild(f)}b.appendChild(d);return b},buildGeometryNode:function(a){this.externalProjection&&this.internalProjection&&
-(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));var b=a.CLASS_NAME,b=b.substring(b.lastIndexOf(".")+1);return this.buildGeometry[b.toLowerCase()].apply(this,[a])},buildGeometry:{point:function(a){var b=this.createElementNS(this.gmlns,"gml:Point");b.appendChild(this.buildCoordinatesNode(a));return b},multipoint:function(a){var b=this.createElementNS(this.gmlns,"gml:MultiPoint");a=a.components;for(var c,d,e=0;e<a.length;e++)c=this.createElementNS(this.gmlns,"gml:pointMember"),
-d=this.buildGeometry.point.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},linestring:function(a){var b=this.createElementNS(this.gmlns,"gml:LineString");b.appendChild(this.buildCoordinatesNode(a));return b},multilinestring:function(a){var b=this.createElementNS(this.gmlns,"gml:MultiLineString");a=a.components;for(var c,d,e=0;e<a.length;++e)c=this.createElementNS(this.gmlns,"gml:lineStringMember"),d=this.buildGeometry.linestring.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);
-return b},linearring:function(a){var b=this.createElementNS(this.gmlns,"gml:LinearRing");b.appendChild(this.buildCoordinatesNode(a));return b},polygon:function(a){var b=this.createElementNS(this.gmlns,"gml:Polygon");a=a.components;for(var c,d,e=0;e<a.length;++e)c=0==e?"outerBoundaryIs":"innerBoundaryIs",c=this.createElementNS(this.gmlns,"gml:"+c),d=this.buildGeometry.linearring.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},multipolygon:function(a){var b=this.createElementNS(this.gmlns,
+g;g=this.getFirstElementChild(a);h.gml={featureType:g.nodeName.split(":")[1],featureNS:g.namespaceURI,featureNSPrefix:g.prefix};h.type=h.gml.featureType;a=a.firstChild;for(var k;a&&!(1==a.nodeType&&(k=a.getAttribute("fid")||a.getAttribute("id")));)a=a.nextSibling;h.fid=k;return h},parseGeometry:{point:function(a){var b,c;c=[];b=this.getElementsByTagNameNS(a,this.gmlns,"pos");0<b.length&&(c=b[0].firstChild.nodeValue,c=c.replace(this.regExes.trimSpace,""),c=c.split(this.regExes.splitSpace));0==c.length&&
+(b=this.getElementsByTagNameNS(a,this.gmlns,"coordinates"),0<b.length&&(c=b[0].firstChild.nodeValue,c=c.replace(this.regExes.removeSpace,""),c=c.split(",")));0==c.length&&(b=this.getElementsByTagNameNS(a,this.gmlns,"coord"),0<b.length&&(a=this.getElementsByTagNameNS(b[0],this.gmlns,"X"),b=this.getElementsByTagNameNS(b[0],this.gmlns,"Y"),0<a.length&&0<b.length&&(c=[a[0].firstChild.nodeValue,b[0].firstChild.nodeValue])));2==c.length&&(c[2]=null);return this.xy?new OpenLayers.Geometry.Point(c[0],c[1],
+c[2]):new OpenLayers.Geometry.Point(c[1],c[0],c[2])},multipoint:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"Point");var b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.point.apply(this,[a[d]]))&&b.push(c);return new OpenLayers.Geometry.MultiPoint(b)},linestring:function(a,b){var c,d;d=[];var e=[];c=this.getElementsByTagNameNS(a,this.gmlns,"posList");if(0<c.length){d=this.getChildValue(c[0]);d=d.replace(this.regExes.trimSpace,"");d=d.split(this.regExes.splitSpace);
+var f=parseInt(c[0].getAttribute("dimension")),g,h,k;for(c=0;c<d.length/f;++c)g=c*f,h=d[g],k=d[g+1],g=2==f?null:d[g+2],this.xy?e.push(new OpenLayers.Geometry.Point(h,k,g)):e.push(new OpenLayers.Geometry.Point(k,h,g))}if(0==d.length&&(c=this.getElementsByTagNameNS(a,this.gmlns,"coordinates"),0<c.length)){d=this.getChildValue(c[0]);d=d.replace(this.regExes.trimSpace,"");d=d.replace(this.regExes.trimComma,",");f=d.split(this.regExes.splitSpace);for(c=0;c<f.length;++c)d=f[c].split(","),2==d.length&&(d[2]=
+null),this.xy?e.push(new OpenLayers.Geometry.Point(d[0],d[1],d[2])):e.push(new OpenLayers.Geometry.Point(d[1],d[0],d[2]))}d=null;0!=e.length&&(d=b?new OpenLayers.Geometry.LinearRing(e):new OpenLayers.Geometry.LineString(e));return d},multilinestring:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"LineString");var b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.linestring.apply(this,[a[d]]))&&b.push(c);return new OpenLayers.Geometry.MultiLineString(b)},polygon:function(a){a=
+this.getElementsByTagNameNS(a,this.gmlns,"LinearRing");var b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.linestring.apply(this,[a[d],!0]))&&b.push(c);return new OpenLayers.Geometry.Polygon(b)},multipolygon:function(a){a=this.getElementsByTagNameNS(a,this.gmlns,"Polygon");var b=[];if(0<a.length)for(var c,d=0;d<a.length;++d)(c=this.parseGeometry.polygon.apply(this,[a[d]]))&&b.push(c);return new OpenLayers.Geometry.MultiPolygon(b)},envelope:function(a){var b=[],c,d,e=this.getElementsByTagNameNS(a,
+this.gmlns,"lowerCorner");if(0<e.length){c=[];0<e.length&&(c=e[0].firstChild.nodeValue,c=c.replace(this.regExes.trimSpace,""),c=c.split(this.regExes.splitSpace));2==c.length&&(c[2]=null);var f=this.xy?new OpenLayers.Geometry.Point(c[0],c[1],c[2]):new OpenLayers.Geometry.Point(c[1],c[0],c[2])}a=this.getElementsByTagNameNS(a,this.gmlns,"upperCorner");if(0<a.length){c=[];0<a.length&&(c=a[0].firstChild.nodeValue,c=c.replace(this.regExes.trimSpace,""),c=c.split(this.regExes.splitSpace));2==c.length&&(c[2]=
+null);var g=this.xy?new OpenLayers.Geometry.Point(c[0],c[1],c[2]):new OpenLayers.Geometry.Point(c[1],c[0],c[2])}f&&g&&(b.push(new OpenLayers.Geometry.Point(f.x,f.y)),b.push(new OpenLayers.Geometry.Point(g.x,f.y)),b.push(new OpenLayers.Geometry.Point(g.x,g.y)),b.push(new OpenLayers.Geometry.Point(f.x,g.y)),b.push(new OpenLayers.Geometry.Point(f.x,f.y)),b=new OpenLayers.Geometry.LinearRing(b),d=new OpenLayers.Geometry.Polygon([b]));return d},box:function(a){var b=this.getElementsByTagNameNS(a,this.gmlns,
+"coordinates"),c=a=null;0<b.length&&(b=b[0].firstChild.nodeValue,b=b.split(" "),2==b.length&&(a=b[0].split(","),c=b[1].split(",")));if(null!==a&&null!==c)return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(c[0]),parseFloat(c[1]))}},parseAttributes:function(a){var b={};a=a.firstChild;for(var c,d,e;a;){if(1==a.nodeType){a=a.childNodes;for(c=0;c<a.length;++c)if(d=a[c],1==d.nodeType)if(e=d.childNodes,1==e.length){if(e=e[0],3==e.nodeType||4==e.nodeType)d=d.prefix?d.nodeName.split(":")[1]:
+d.nodeName,e=e.nodeValue.replace(this.regExes.trimSpace,""),b[d]=e}else b[d.nodeName.split(":").pop()]=null;break}a=a.nextSibling}return b},write:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=this.createElementNS("http://www.opengis.net/wfs","wfs:"+this.collectionName),c=0;c<a.length;c++)b.appendChild(this.createFeatureXML(a[c]));return OpenLayers.Format.XML.prototype.write.apply(this,[b])},createFeatureXML:function(a){var b=this.buildGeometryNode(a.geometry),c=this.createElementNS(this.featureNS,
+this.featurePrefix+":"+this.geometryName);c.appendChild(b);var b=this.createElementNS(this.gmlns,"gml:"+this.featureName),d=this.createElementNS(this.featureNS,this.featurePrefix+":"+this.layerName);d.setAttribute("fid",a.fid||a.id);d.appendChild(c);for(var e in a.attributes){var c=this.createTextNode(a.attributes[e]),f=e.substring(e.lastIndexOf(":")+1),f=this.createElementNS(this.featureNS,this.featurePrefix+":"+f);f.appendChild(c);d.appendChild(f)}b.appendChild(d);return b},buildGeometryNode:function(a){this.externalProjection&&
+this.internalProjection&&(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));var b=a.CLASS_NAME,b=b.substring(b.lastIndexOf(".")+1);return this.buildGeometry[b.toLowerCase()].apply(this,[a])},buildGeometry:{point:function(a){var b=this.createElementNS(this.gmlns,"gml:Point");b.appendChild(this.buildCoordinatesNode(a));return b},multipoint:function(a){var b=this.createElementNS(this.gmlns,"gml:MultiPoint");a=a.components;for(var c,d,e=0;e<a.length;e++)c=this.createElementNS(this.gmlns,
+"gml:pointMember"),d=this.buildGeometry.point.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},linestring:function(a){var b=this.createElementNS(this.gmlns,"gml:LineString");b.appendChild(this.buildCoordinatesNode(a));return b},multilinestring:function(a){var b=this.createElementNS(this.gmlns,"gml:MultiLineString");a=a.components;for(var c,d,e=0;e<a.length;++e)c=this.createElementNS(this.gmlns,"gml:lineStringMember"),d=this.buildGeometry.linestring.apply(this,[a[e]]),c.appendChild(d),
+b.appendChild(c);return b},linearring:function(a){var b=this.createElementNS(this.gmlns,"gml:LinearRing");b.appendChild(this.buildCoordinatesNode(a));return b},polygon:function(a){var b=this.createElementNS(this.gmlns,"gml:Polygon");a=a.components;for(var c,d,e=0;e<a.length;++e)c=0==e?"outerBoundaryIs":"innerBoundaryIs",c=this.createElementNS(this.gmlns,"gml:"+c),d=this.buildGeometry.linearring.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},multipolygon:function(a){var b=this.createElementNS(this.gmlns,
 "gml:MultiPolygon");a=a.components;for(var c,d,e=0;e<a.length;++e)c=this.createElementNS(this.gmlns,"gml:polygonMember"),d=this.buildGeometry.polygon.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},bounds:function(a){var b=this.createElementNS(this.gmlns,"gml:Box");b.appendChild(this.buildCoordinatesNode(a));return b}},buildCoordinatesNode:function(a){var b=this.createElementNS(this.gmlns,"gml:coordinates");b.setAttribute("decimal",".");b.setAttribute("cs",",");b.setAttribute("ts",
 " ");var c=[];if(a instanceof OpenLayers.Bounds)c.push(a.left+","+a.bottom),c.push(a.right+","+a.top);else{a=a.components?a.components:[a];for(var d=0;d<a.length;d++)c.push(a[d].x+","+a[d].y)}c=this.createTextNode(c.join(" "));b.appendChild(c);return b},CLASS_NAME:"OpenLayers.Format.GML"});OpenLayers.Format.GML||(OpenLayers.Format.GML={});
 "gml:MultiPolygon");a=a.components;for(var c,d,e=0;e<a.length;++e)c=this.createElementNS(this.gmlns,"gml:polygonMember"),d=this.buildGeometry.polygon.apply(this,[a[e]]),c.appendChild(d),b.appendChild(c);return b},bounds:function(a){var b=this.createElementNS(this.gmlns,"gml:Box");b.appendChild(this.buildCoordinatesNode(a));return b}},buildCoordinatesNode:function(a){var b=this.createElementNS(this.gmlns,"gml:coordinates");b.setAttribute("decimal",".");b.setAttribute("cs",",");b.setAttribute("ts",
 " ");var c=[];if(a instanceof OpenLayers.Bounds)c.push(a.left+","+a.bottom),c.push(a.right+","+a.top);else{a=a.components?a.components:[a];for(var d=0;d<a.length;d++)c.push(a[d].x+","+a[d].y)}c=this.createTextNode(c.join(" "));b.appendChild(c);return b},CLASS_NAME:"OpenLayers.Format.GML"});OpenLayers.Format.GML||(OpenLayers.Format.GML={});
-OpenLayers.Format.GML.Base=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs"},defaultPrefix:"gml",schemaLocation:null,featureType:null,featureNS:null,geometryName:"geometry",extractAttributes:!0,srsName:null,xy:!0,geometryTypes:null,singleFeatureType:null,regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g,featureMember:/^(.*:)?featureMembers?$/},
-initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.setGeometryTypes();a&&a.featureNS&&this.setNamespace("feature",a.featureNS);this.singleFeatureType=!a||"string"===typeof a.featureType},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b=[];this.readNode(a,{features:b},!0);if(0==b.length){var c=this.getElementsByTagNameNS(a,this.namespaces.gml,"featureMember");if(c.length){a=
-0;for(var d=c.length;a<d;++a)this.readNode(c[a],{features:b},!0)}else c=this.getElementsByTagNameNS(a,this.namespaces.gml,"featureMembers"),c.length&&this.readNode(c[0],{features:b},!0)}return b},readNode:function(a,b,c){!0===c&&!0===this.autoConfig&&(this.featureType=null,delete this.namespaceAlias[this.featureNS],delete this.namespaces.feature,this.featureNS=null);!this.featureNS&&(!(a.prefix in this.namespaces)&&a.parentNode.namespaceURI==this.namespaces.gml&&this.regExes.featureMember.test(a.parentNode.nodeName))&&
-(this.featureType=a.nodeName.split(":").pop(),this.setNamespace("feature",a.namespaceURI),this.featureNS=a.namespaceURI,this.autoConfig=!0);return OpenLayers.Format.XML.prototype.readNode.apply(this,[a,b])},readers:{gml:{_inherit:function(a,b,c){},featureMember:function(a,b){this.readChildNodes(a,b)},featureMembers:function(a,b){this.readChildNodes(a,b)},name:function(a,b){b.name=this.getChildValue(a)},boundedBy:function(a,b){var c={};this.readChildNodes(a,c);c.components&&0<c.components.length&&
-(b.bounds=c.components[0])},Point:function(a,b){var c={points:[]};this.readChildNodes(a,c);b.components||(b.components=[]);b.components.push(c.points[0])},coordinates:function(a,b){for(var c=this.getChildValue(a).replace(this.regExes.trimSpace,""),c=c.replace(this.regExes.trimComma,","),c=c.split(this.regExes.splitSpace),d,e=c.length,f=Array(e),g=0;g<e;++g)d=c[g].split(","),f[g]=this.xy?new OpenLayers.Geometry.Point(d[0],d[1],d[2]):new OpenLayers.Geometry.Point(d[1],d[0],d[2]);b.points=f},coord:function(a,
-b){var c={};this.readChildNodes(a,c);b.points||(b.points=[]);b.points.push(new OpenLayers.Geometry.Point(c.x,c.y,c.z))},X:function(a,b){b.x=this.getChildValue(a)},Y:function(a,b){b.y=this.getChildValue(a)},Z:function(a,b){b.z=this.getChildValue(a)},MultiPoint:function(a,b){var c={components:[]};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.MultiPoint(c.components)]},pointMember:function(a,b){this.readChildNodes(a,b)},LineString:function(a,
-b){var c={};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components||(b.components=[]);b.components.push(new OpenLayers.Geometry.LineString(c.points))},MultiLineString:function(a,b){var c={components:[]};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.MultiLineString(c.components)]},lineStringMember:function(a,b){this.readChildNodes(a,b)},Polygon:function(a,b){var c={outer:null,inner:[]};this.readers.gml._inherit.apply(this,
-[a,c,b]);this.readChildNodes(a,c);c.inner.unshift(c.outer);b.components||(b.components=[]);b.components.push(new OpenLayers.Geometry.Polygon(c.inner))},LinearRing:function(a,b){var c={};this.readers.gml._inherit.apply(this,[a,c]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.LinearRing(c.points)]},MultiPolygon:function(a,b){var c={components:[]};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.MultiPolygon(c.components)]},
+OpenLayers.Format.GML.Base=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs"},defaultPrefix:"gml",schemaLocation:null,featureType:null,featureNS:null,featurePrefix:"feature",geometryName:"geometry",extractAttributes:!0,srsName:null,xy:!0,geometryTypes:null,singleFeatureType:null,regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,
+trimComma:/\s*,\s*/g,featureMember:/^(.*:)?featureMembers?$/},initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);this.setGeometryTypes();a&&a.featureNS&&this.setNamespace(this.featurePrefix,a.featureNS);this.singleFeatureType=!a||"string"===typeof a.featureType},read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b=[];this.readNode(a,{features:b},!0);if(0==b.length){var c=this.getElementsByTagNameNS(a,
+this.namespaces.gml,"featureMember");if(c.length){a=0;for(var d=c.length;a<d;++a)this.readNode(c[a],{features:b},!0)}else c=this.getElementsByTagNameNS(a,this.namespaces.gml,"featureMembers"),c.length&&this.readNode(c[0],{features:b},!0)}return b},readNode:function(a,b,c){!0===c&&!0===this.autoConfig&&(this.featureType=null,delete this.namespaceAlias[this.featureNS],delete this.namespaces.feature,this.featureNS=null);!this.featureNS&&(!(a.prefix in this.namespaces)&&a.parentNode.namespaceURI==this.namespaces.gml&&
+this.regExes.featureMember.test(a.parentNode.nodeName))&&(this.featureType=a.nodeName.split(":").pop(),this.setNamespace("feature",a.namespaceURI),this.featureNS=a.namespaceURI,this.autoConfig=!0);return OpenLayers.Format.XML.prototype.readNode.apply(this,[a,b])},readers:{gml:{_inherit:function(a,b,c){},featureMember:function(a,b){this.readChildNodes(a,b)},featureMembers:function(a,b){this.readChildNodes(a,b)},name:function(a,b){b.name=this.getChildValue(a)},boundedBy:function(a,b){var c={};this.readChildNodes(a,
+c);c.components&&0<c.components.length&&(b.bounds=c.components[0])},Point:function(a,b){var c={points:[]};this.readChildNodes(a,c);b.components||(b.components=[]);b.components.push(c.points[0])},coordinates:function(a,b){for(var c=this.getChildValue(a).replace(this.regExes.trimSpace,""),c=c.replace(this.regExes.trimComma,","),c=c.split(this.regExes.splitSpace),d,e=c.length,f=Array(e),g=0;g<e;++g)d=c[g].split(","),f[g]=this.xy?new OpenLayers.Geometry.Point(d[0],d[1],d[2]):new OpenLayers.Geometry.Point(d[1],
+d[0],d[2]);b.points=f},coord:function(a,b){var c={};this.readChildNodes(a,c);b.points||(b.points=[]);b.points.push(new OpenLayers.Geometry.Point(c.x,c.y,c.z))},X:function(a,b){b.x=this.getChildValue(a)},Y:function(a,b){b.y=this.getChildValue(a)},Z:function(a,b){b.z=this.getChildValue(a)},MultiPoint:function(a,b){var c={components:[]};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.MultiPoint(c.components)]},pointMember:function(a,b){this.readChildNodes(a,
+b)},LineString:function(a,b){var c={};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components||(b.components=[]);b.components.push(new OpenLayers.Geometry.LineString(c.points))},MultiLineString:function(a,b){var c={components:[]};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.MultiLineString(c.components)]},lineStringMember:function(a,b){this.readChildNodes(a,b)},Polygon:function(a,b){var c={outer:null,inner:[]};
+this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);c.inner.unshift(c.outer);b.components||(b.components=[]);b.components.push(new OpenLayers.Geometry.Polygon(c.inner))},LinearRing:function(a,b){var c={};this.readers.gml._inherit.apply(this,[a,c]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.LinearRing(c.points)]},MultiPolygon:function(a,b){var c={components:[]};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.MultiPolygon(c.components)]},
 polygonMember:function(a,b){this.readChildNodes(a,b)},GeometryCollection:function(a,b){var c={components:[]};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.Collection(c.components)]},geometryMember:function(a,b){this.readChildNodes(a,b)}},feature:{"*":function(a,b){var c,d=a.localName||a.nodeName.split(":").pop();b.features?!this.singleFeatureType&&-1!==OpenLayers.Util.indexOf(this.featureType,d)?c="_typeName":d===this.featureType&&(c=
 "_typeName"):0==a.childNodes.length||1==a.childNodes.length&&3==a.firstChild.nodeType?this.extractAttributes&&(c="_attribute"):c="_geometry";c&&this.readers.feature[c].apply(this,[a,b])},_typeName:function(a,b){var c={components:[],attributes:{}};this.readChildNodes(a,c);c.name&&(c.attributes.name=c.name);var d=new OpenLayers.Feature.Vector(c.components[0],c.attributes);this.singleFeatureType||(d.type=a.nodeName.split(":").pop(),d.namespace=a.namespaceURI);var e=a.getAttribute("fid")||this.getAttributeNS(a,
 this.namespaces.gml,"id");e&&(d.fid=e);this.internalProjection&&(this.externalProjection&&d.geometry)&&d.geometry.transform(this.externalProjection,this.internalProjection);c.bounds&&(d.bounds=c.bounds);b.features.push(d)},_geometry:function(a,b){this.geometryName||(this.geometryName=a.nodeName.split(":").pop());this.readChildNodes(a,b)},_attribute:function(a,b){var c=a.localName||a.nodeName.split(":").pop(),d=this.getChildValue(a);b.attributes[c]=d}},wfs:{FeatureCollection:function(a,b){this.readChildNodes(a,
 b)}}},write:function(a){var b;b=OpenLayers.Util.isArray(a)?"featureMembers":"featureMember";a=this.writeNode("gml:"+b,a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:{featureMember:function(a){var b=this.createElementNSPlus("gml:featureMember");this.writeNode("feature:_typeName",a,b);return b},MultiPoint:function(a){var b=this.createElementNSPlus("gml:MultiPoint");a=a.components||[a];
 for(var c=0,d=a.length;c<d;++c)this.writeNode("pointMember",a[c],b);return b},pointMember:function(a){var b=this.createElementNSPlus("gml:pointMember");this.writeNode("Point",a,b);return b},MultiLineString:function(a){var b=this.createElementNSPlus("gml:MultiLineString");a=a.components||[a];for(var c=0,d=a.length;c<d;++c)this.writeNode("lineStringMember",a[c],b);return b},lineStringMember:function(a){var b=this.createElementNSPlus("gml:lineStringMember");this.writeNode("LineString",a,b);return b},
 MultiPolygon:function(a){var b=this.createElementNSPlus("gml:MultiPolygon");a=a.components||[a];for(var c=0,d=a.length;c<d;++c)this.writeNode("polygonMember",a[c],b);return b},polygonMember:function(a){var b=this.createElementNSPlus("gml:polygonMember");this.writeNode("Polygon",a,b);return b},GeometryCollection:function(a){for(var b=this.createElementNSPlus("gml:GeometryCollection"),c=0,d=a.components.length;c<d;++c)this.writeNode("geometryMember",a.components[c],b);return b},geometryMember:function(a){var b=
 polygonMember:function(a,b){this.readChildNodes(a,b)},GeometryCollection:function(a,b){var c={components:[]};this.readers.gml._inherit.apply(this,[a,c,b]);this.readChildNodes(a,c);b.components=[new OpenLayers.Geometry.Collection(c.components)]},geometryMember:function(a,b){this.readChildNodes(a,b)}},feature:{"*":function(a,b){var c,d=a.localName||a.nodeName.split(":").pop();b.features?!this.singleFeatureType&&-1!==OpenLayers.Util.indexOf(this.featureType,d)?c="_typeName":d===this.featureType&&(c=
 "_typeName"):0==a.childNodes.length||1==a.childNodes.length&&3==a.firstChild.nodeType?this.extractAttributes&&(c="_attribute"):c="_geometry";c&&this.readers.feature[c].apply(this,[a,b])},_typeName:function(a,b){var c={components:[],attributes:{}};this.readChildNodes(a,c);c.name&&(c.attributes.name=c.name);var d=new OpenLayers.Feature.Vector(c.components[0],c.attributes);this.singleFeatureType||(d.type=a.nodeName.split(":").pop(),d.namespace=a.namespaceURI);var e=a.getAttribute("fid")||this.getAttributeNS(a,
 this.namespaces.gml,"id");e&&(d.fid=e);this.internalProjection&&(this.externalProjection&&d.geometry)&&d.geometry.transform(this.externalProjection,this.internalProjection);c.bounds&&(d.bounds=c.bounds);b.features.push(d)},_geometry:function(a,b){this.geometryName||(this.geometryName=a.nodeName.split(":").pop());this.readChildNodes(a,b)},_attribute:function(a,b){var c=a.localName||a.nodeName.split(":").pop(),d=this.getChildValue(a);b.attributes[c]=d}},wfs:{FeatureCollection:function(a,b){this.readChildNodes(a,
 b)}}},write:function(a){var b;b=OpenLayers.Util.isArray(a)?"featureMembers":"featureMember";a=this.writeNode("gml:"+b,a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:{featureMember:function(a){var b=this.createElementNSPlus("gml:featureMember");this.writeNode("feature:_typeName",a,b);return b},MultiPoint:function(a){var b=this.createElementNSPlus("gml:MultiPoint");a=a.components||[a];
 for(var c=0,d=a.length;c<d;++c)this.writeNode("pointMember",a[c],b);return b},pointMember:function(a){var b=this.createElementNSPlus("gml:pointMember");this.writeNode("Point",a,b);return b},MultiLineString:function(a){var b=this.createElementNSPlus("gml:MultiLineString");a=a.components||[a];for(var c=0,d=a.length;c<d;++c)this.writeNode("lineStringMember",a[c],b);return b},lineStringMember:function(a){var b=this.createElementNSPlus("gml:lineStringMember");this.writeNode("LineString",a,b);return b},
 MultiPolygon:function(a){var b=this.createElementNSPlus("gml:MultiPolygon");a=a.components||[a];for(var c=0,d=a.length;c<d;++c)this.writeNode("polygonMember",a[c],b);return b},polygonMember:function(a){var b=this.createElementNSPlus("gml:polygonMember");this.writeNode("Polygon",a,b);return b},GeometryCollection:function(a){for(var b=this.createElementNSPlus("gml:GeometryCollection"),c=0,d=a.components.length;c<d;++c)this.writeNode("geometryMember",a.components[c],b);return b},geometryMember:function(a){var b=
-this.createElementNSPlus("gml:geometryMember");a=this.writeNode("feature:_geometry",a);b.appendChild(a.firstChild);return b}},feature:{_typeName:function(a){var b=this.createElementNSPlus("feature:"+this.featureType,{attributes:{fid:a.fid}});a.geometry&&this.writeNode("feature:_geometry",a.geometry,b);for(var c in a.attributes){var d=a.attributes[c];null!=d&&this.writeNode("feature:_attribute",{name:c,value:d},b)}return b},_geometry:function(a){this.externalProjection&&this.internalProjection&&(a=
-a.clone().transform(this.internalProjection,this.externalProjection));var b=this.createElementNSPlus("feature:"+this.geometryName);a=this.writeNode("gml:"+this.geometryTypes[a.CLASS_NAME],a,b);this.srsName&&a.setAttribute("srsName",this.srsName);return b},_attribute:function(a){return this.createElementNSPlus("feature:"+a.name,{value:a.value})}},wfs:{FeatureCollection:function(a){for(var b=this.createElementNSPlus("wfs:FeatureCollection"),c=0,d=a.length;c<d;++c)this.writeNode("gml:featureMember",
+this.createElementNSPlus("gml:geometryMember");a=this.writeNode("feature:_geometry",a);b.appendChild(a.firstChild);return b}},feature:{_typeName:function(a){var b=this.createElementNSPlus(this.featurePrefix+":"+this.featureType,{attributes:{fid:a.fid}});a.geometry&&this.writeNode("feature:_geometry",a.geometry,b);for(var c in a.attributes){var d=a.attributes[c];null!=d&&this.writeNode("feature:_attribute",{name:c,value:d},b)}return b},_geometry:function(a){this.externalProjection&&this.internalProjection&&
+(a=a.clone().transform(this.internalProjection,this.externalProjection));var b=this.createElementNSPlus(this.featurePrefix+":"+this.geometryName);a=this.writeNode("gml:"+this.geometryTypes[a.CLASS_NAME],a,b);this.srsName&&a.setAttribute("srsName",this.srsName);return b},_attribute:function(a){return this.createElementNSPlus(this.featurePrefix+":"+a.name,{value:a.value})}},wfs:{FeatureCollection:function(a){for(var b=this.createElementNSPlus("wfs:FeatureCollection"),c=0,d=a.length;c<d;++c)this.writeNode("gml:featureMember",
 a[c],b);return b}}},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":"LineString","OpenLayers.Geometry.MultiLineString":"MultiLineString","OpenLayers.Geometry.Polygon":"Polygon","OpenLayers.Geometry.MultiPolygon":"MultiPolygon","OpenLayers.Geometry.Collection":"GeometryCollection"}},CLASS_NAME:"OpenLayers.Format.GML.Base"});OpenLayers.Format.GML.v2=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",initialize:function(a){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[a])},readers:{gml:OpenLayers.Util.applyDefaults({outerBoundaryIs:function(a,b){var c={};this.readChildNodes(a,c);b.outer=c.components[0]},innerBoundaryIs:function(a,b){var c={};this.readChildNodes(a,c);b.inner.push(c.components[0])},Box:function(a,b){var c=
 {};this.readChildNodes(a,c);b.components||(b.components=[]);var d=c.points[0],c=c.points[1];b.components.push(new OpenLayers.Bounds(d.x,d.y,c.x,c.y))}},OpenLayers.Format.GML.Base.prototype.readers.gml),feature:OpenLayers.Format.GML.Base.prototype.readers.feature,wfs:OpenLayers.Format.GML.Base.prototype.readers.wfs},write:function(a){var b;b=OpenLayers.Util.isArray(a)?"wfs:FeatureCollection":"gml:featureMember";a=this.writeNode(b,a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);
 return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:OpenLayers.Util.applyDefaults({Point:function(a){var b=this.createElementNSPlus("gml:Point");this.writeNode("coordinates",[a],b);return b},coordinates:function(a){for(var b=a.length,c=Array(b),d,e=0;e<b;++e)d=a[e],c[e]=this.xy?d.x+","+d.y:d.y+","+d.x,void 0!=d.z&&(c[e]+=","+d.z);return this.createElementNSPlus("gml:coordinates",{attributes:{decimal:".",cs:",",ts:" "},value:1==b?c[0]:c.join(" ")})},LineString:function(a){var b=
 this.createElementNSPlus("gml:LineString");this.writeNode("coordinates",a.components,b);return b},Polygon:function(a){var b=this.createElementNSPlus("gml:Polygon");this.writeNode("outerBoundaryIs",a.components[0],b);for(var c=1;c<a.components.length;++c)this.writeNode("innerBoundaryIs",a.components[c],b);return b},outerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:outerBoundaryIs");this.writeNode("LinearRing",a,b);return b},innerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:innerBoundaryIs");
 this.writeNode("LinearRing",a,b);return b},LinearRing:function(a){var b=this.createElementNSPlus("gml:LinearRing");this.writeNode("coordinates",a.components,b);return b},Box:function(a){var b=this.createElementNSPlus("gml:Box");this.writeNode("coordinates",[{x:a.left,y:a.bottom},{x:a.right,y:a.top}],b);this.srsName&&b.setAttribute("srsName",this.srsName);return b}},OpenLayers.Format.GML.Base.prototype.writers.gml),feature:OpenLayers.Format.GML.Base.prototype.writers.feature,wfs:OpenLayers.Format.GML.Base.prototype.writers.wfs},
 a[c],b);return b}}},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":"LineString","OpenLayers.Geometry.MultiLineString":"MultiLineString","OpenLayers.Geometry.Polygon":"Polygon","OpenLayers.Geometry.MultiPolygon":"MultiPolygon","OpenLayers.Geometry.Collection":"GeometryCollection"}},CLASS_NAME:"OpenLayers.Format.GML.Base"});OpenLayers.Format.GML.v2=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",initialize:function(a){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[a])},readers:{gml:OpenLayers.Util.applyDefaults({outerBoundaryIs:function(a,b){var c={};this.readChildNodes(a,c);b.outer=c.components[0]},innerBoundaryIs:function(a,b){var c={};this.readChildNodes(a,c);b.inner.push(c.components[0])},Box:function(a,b){var c=
 {};this.readChildNodes(a,c);b.components||(b.components=[]);var d=c.points[0],c=c.points[1];b.components.push(new OpenLayers.Bounds(d.x,d.y,c.x,c.y))}},OpenLayers.Format.GML.Base.prototype.readers.gml),feature:OpenLayers.Format.GML.Base.prototype.readers.feature,wfs:OpenLayers.Format.GML.Base.prototype.readers.wfs},write:function(a){var b;b=OpenLayers.Util.isArray(a)?"wfs:FeatureCollection":"gml:featureMember";a=this.writeNode(b,a);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);
 return OpenLayers.Format.XML.prototype.write.apply(this,[a])},writers:{gml:OpenLayers.Util.applyDefaults({Point:function(a){var b=this.createElementNSPlus("gml:Point");this.writeNode("coordinates",[a],b);return b},coordinates:function(a){for(var b=a.length,c=Array(b),d,e=0;e<b;++e)d=a[e],c[e]=this.xy?d.x+","+d.y:d.y+","+d.x,void 0!=d.z&&(c[e]+=","+d.z);return this.createElementNSPlus("gml:coordinates",{attributes:{decimal:".",cs:",",ts:" "},value:1==b?c[0]:c.join(" ")})},LineString:function(a){var b=
 this.createElementNSPlus("gml:LineString");this.writeNode("coordinates",a.components,b);return b},Polygon:function(a){var b=this.createElementNSPlus("gml:Polygon");this.writeNode("outerBoundaryIs",a.components[0],b);for(var c=1;c<a.components.length;++c)this.writeNode("innerBoundaryIs",a.components[c],b);return b},outerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:outerBoundaryIs");this.writeNode("LinearRing",a,b);return b},innerBoundaryIs:function(a){var b=this.createElementNSPlus("gml:innerBoundaryIs");
 this.writeNode("LinearRing",a,b);return b},LinearRing:function(a){var b=this.createElementNSPlus("gml:LinearRing");this.writeNode("coordinates",a.components,b);return b},Box:function(a){var b=this.createElementNSPlus("gml:Box");this.writeNode("coordinates",[{x:a.left,y:a.bottom},{x:a.right,y:a.top}],b);this.srsName&&b.setAttribute("srsName",this.srsName);return b}},OpenLayers.Format.GML.Base.prototype.writers.gml),feature:OpenLayers.Format.GML.Base.prototype.writers.feature,wfs:OpenLayers.Format.GML.Base.prototype.writers.wfs},
-CLASS_NAME:"OpenLayers.Format.GML.v2"});OpenLayers.Filter.Function=OpenLayers.Class(OpenLayers.Filter,{name:null,params:null,CLASS_NAME:"OpenLayers.Filter.Function"});OpenLayers.Date={dateRegEx:/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,toISOString:function(){return"toISOString"in Date.prototype?function(a){return a.toISOString()}:function(a){return isNaN(a.getTime())?"Invalid Date":a.getUTCFullYear()+"-"+OpenLayers.Number.zeroPad(a.getUTCMonth()+1,2)+"-"+OpenLayers.Number.zeroPad(a.getUTCDate(),2)+"T"+OpenLayers.Number.zeroPad(a.getUTCHours(),2)+":"+OpenLayers.Number.zeroPad(a.getUTCMinutes(),
+CLASS_NAME:"OpenLayers.Format.GML.v2"});OpenLayers.Format.OGCExceptionReport=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},defaultPrefix:"ogc",read:function(a){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var b={exceptionReport:null};a.documentElement&&(this.readChildNodes(a,b),null===b.exceptionReport&&(b=(new OpenLayers.Format.OWSCommon).read(a)));return b},readers:{ogc:{ServiceExceptionReport:function(a,
+b){b.exceptionReport={exceptions:[]};this.readChildNodes(a,b.exceptionReport)},ServiceException:function(a,b){var c={code:a.getAttribute("code"),locator:a.getAttribute("locator"),text:this.getChildValue(a)};b.exceptions.push(c)}}},CLASS_NAME:"OpenLayers.Format.OGCExceptionReport"});OpenLayers.Format.XML.VersionedOGC=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:null,version:null,profile:null,allowFallback:!1,name:null,stringifyOutput:!1,parser:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a]);a=this.CLASS_NAME;this.name=a.substring(a.lastIndexOf(".")+1)},getVersion:function(a,b){var c;a?(c=this.version,c||(c=a.getAttribute("version"),c||(c=this.defaultVersion))):c=b&&b.version||this.version||this.defaultVersion;return c},getParser:function(a){a=
+a||this.defaultVersion;var b=this.profile?"_"+this.profile:"";if(!this.parser||this.parser.VERSION!=a){var c=OpenLayers.Format[this.name]["v"+a.replace(/\./g,"_")+b];if(!c&&(""!==b&&this.allowFallback&&(b="",c=OpenLayers.Format[this.name]["v"+a.replace(/\./g,"_")]),!c))throw"Can't find a "+this.name+" parser for version "+a+b;this.parser=new c(this.options)}return this.parser},write:function(a,b){var c=this.getVersion(null,b);this.parser=this.getParser(c);c=this.parser.write(a,b);return!1===this.stringifyOutput?
+c:OpenLayers.Format.XML.prototype.write.apply(this,[c])},read:function(a,b){"string"==typeof a&&(a=OpenLayers.Format.XML.prototype.read.apply(this,[a]));var c=this.getVersion(a.documentElement);this.parser=this.getParser(c);var d=this.parser.read(a,b),e=this.parser.errorProperty||null;null!==e&&void 0===d[e]&&(e=new OpenLayers.Format.OGCExceptionReport,d.error=e.read(a));d.version=c;d.requestType=this.name;return d},CLASS_NAME:"OpenLayers.Format.XML.VersionedOGC"});OpenLayers.Filter.Logical=OpenLayers.Class(OpenLayers.Filter,{filters:null,type:null,initialize:function(a){this.filters=[];OpenLayers.Filter.prototype.initialize.apply(this,[a])},destroy:function(){this.filters=null;OpenLayers.Filter.prototype.destroy.apply(this)},evaluate:function(a){var b,c;switch(this.type){case OpenLayers.Filter.Logical.AND:b=0;for(c=this.filters.length;b<c;b++)if(!1==this.filters[b].evaluate(a))return!1;return!0;case OpenLayers.Filter.Logical.OR:b=0;for(c=this.filters.length;b<
+c;b++)if(!0==this.filters[b].evaluate(a))return!0;return!1;case OpenLayers.Filter.Logical.NOT:return!this.filters[0].evaluate(a)}},clone:function(){for(var a=[],b=0,c=this.filters.length;b<c;++b)a.push(this.filters[b].clone());return new OpenLayers.Filter.Logical({type:this.type,filters:a})},CLASS_NAME:"OpenLayers.Filter.Logical"});OpenLayers.Filter.Logical.AND="&&";OpenLayers.Filter.Logical.OR="||";OpenLayers.Filter.Logical.NOT="!";OpenLayers.Filter.Comparison=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,matchCase:!0,lowerBoundary:null,upperBoundary:null,initialize:function(a){OpenLayers.Filter.prototype.initialize.apply(this,[a]);this.type===OpenLayers.Filter.Comparison.LIKE&&void 0===a.matchCase&&(this.matchCase=null)},evaluate:function(a){a instanceof OpenLayers.Feature.Vector&&(a=a.attributes);var b=!1;a=a[this.property];if(void 0===a)return!1;switch(this.type){case OpenLayers.Filter.Comparison.EQUAL_TO:b=
+this.value;b=!this.matchCase&&"string"==typeof a&&"string"==typeof b?a.toUpperCase()==b.toUpperCase():a==b;break;case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:b=this.value;b=!this.matchCase&&"string"==typeof a&&"string"==typeof b?a.toUpperCase()!=b.toUpperCase():a!=b;break;case OpenLayers.Filter.Comparison.LESS_THAN:b=a<this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN:b=a>this.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:b=a<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:b=
+a>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:b=a>=this.lowerBoundary&&a<=this.upperBoundary;break;case OpenLayers.Filter.Comparison.LIKE:b=RegExp(this.value,"gi").test(a);break;case OpenLayers.Filter.Comparison.IS_NULL:b=null===a}return b},value2regex:function(a,b,c){if("."==a)throw Error("'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison");a=a?a:"*";b=b?b:".";this.value=this.value.replace(RegExp("\\"+(c?c:"!")+"(.|$)","g"),"\\$1");this.value=this.value.replace(RegExp("\\"+
+b,"g"),".");this.value=this.value.replace(RegExp("\\"+a,"g"),".*");this.value=this.value.replace(RegExp("\\\\.\\*","g"),"\\"+a);return this.value=this.value.replace(RegExp("\\\\\\.","g"),"\\"+b)},regex2value:function(){var a=this.value,a=a.replace(/!/g,"!!"),a=a.replace(/(\\)?\\\./g,function(a,c){return c?a:"!."}),a=a.replace(/(\\)?\\\*/g,function(a,c){return c?a:"!*"}),a=a.replace(/\\\\/g,"\\");return a=a.replace(/\.\*/g,"*")},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison,
+this)},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";OpenLayers.Filter.Comparison.IS_NULL="NULL";OpenLayers.Format.Filter=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",CLASS_NAME:"OpenLayers.Format.Filter"});OpenLayers.Filter.Function=OpenLayers.Class(OpenLayers.Filter,{name:null,params:null,CLASS_NAME:"OpenLayers.Filter.Function"});OpenLayers.Date={dateRegEx:/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,toISOString:function(){return"toISOString"in Date.prototype?function(a){return a.toISOString()}:function(a){return isNaN(a.getTime())?"Invalid Date":a.getUTCFullYear()+"-"+OpenLayers.Number.zeroPad(a.getUTCMonth()+1,2)+"-"+OpenLayers.Number.zeroPad(a.getUTCDate(),2)+"T"+OpenLayers.Number.zeroPad(a.getUTCHours(),2)+":"+OpenLayers.Number.zeroPad(a.getUTCMinutes(),
 2)+":"+OpenLayers.Number.zeroPad(a.getUTCSeconds(),2)+"."+OpenLayers.Number.zeroPad(a.getUTCMilliseconds(),3)+"Z"}}(),parse:function(a){var b;if((a=a.match(this.dateRegEx))&&(a[1]||a[7])){b=parseInt(a[1],10)||0;var c=parseInt(a[2],10)-1||0,d=parseInt(a[3],10)||1;b=new Date(Date.UTC(b,c,d));if(c=a[7]){var d=parseInt(a[4],10),e=parseInt(a[5],10),f=parseFloat(a[6]),g=f|0,f=Math.round(1E3*(f-g));b.setUTCHours(d,e,g,f);"Z"!==c&&(c=parseInt(c,10),a=parseInt(a[8],10)||0,b=new Date(b.getTime()+-1E3*(60*60*
 c+60*a)))}}else b=new Date("invalid");return b}};OpenLayers.Format.Filter.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"ogc",schemaLocation:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){var b={};this.readers.ogc.Filter.apply(this,[a,b]);return b.filter},readers:{ogc:{_expression:function(a){for(var b="",c=a.firstChild;c;c=
 c.nextSibling)switch(c.nodeType){case 1:a=this.readNode(c);a.property?b+="${"+a.property+"}":void 0!==a.value&&(b+=a.value);break;case 3:case 4:b+=c.nodeValue}return b},Filter:function(a,b){var c={fids:[],filters:[]};this.readChildNodes(a,c);0<c.fids.length?b.filter=new OpenLayers.Filter.FeatureId({fids:c.fids}):0<c.filters.length&&(b.filter=c.filters[0])},FeatureId:function(a,b){var c=a.getAttribute("fid");c&&b.fids.push(c)},And:function(a,b){var c=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND});
 2)+":"+OpenLayers.Number.zeroPad(a.getUTCSeconds(),2)+"."+OpenLayers.Number.zeroPad(a.getUTCMilliseconds(),3)+"Z"}}(),parse:function(a){var b;if((a=a.match(this.dateRegEx))&&(a[1]||a[7])){b=parseInt(a[1],10)||0;var c=parseInt(a[2],10)-1||0,d=parseInt(a[3],10)||1;b=new Date(Date.UTC(b,c,d));if(c=a[7]){var d=parseInt(a[4],10),e=parseInt(a[5],10),f=parseFloat(a[6]),g=f|0,f=Math.round(1E3*(f-g));b.setUTCHours(d,e,g,f);"Z"!==c&&(c=parseInt(c,10),a=parseInt(a[8],10)||0,b=new Date(b.getTime()+-1E3*(60*60*
 c+60*a)))}}else b=new Date("invalid");return b}};OpenLayers.Format.Filter.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"ogc",schemaLocation:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){var b={};this.readers.ogc.Filter.apply(this,[a,b]);return b.filter},readers:{ogc:{_expression:function(a){for(var b="",c=a.firstChild;c;c=
 c.nextSibling)switch(c.nodeType){case 1:a=this.readNode(c);a.property?b+="${"+a.property+"}":void 0!==a.value&&(b+=a.value);break;case 3:case 4:b+=c.nodeValue}return b},Filter:function(a,b){var c={fids:[],filters:[]};this.readChildNodes(a,c);0<c.fids.length?b.filter=new OpenLayers.Filter.FeatureId({fids:c.fids}):0<c.filters.length&&(b.filter=c.filters[0])},FeatureId:function(a,b){var c=a.getAttribute("fid");c&&b.fids.push(c)},And:function(a,b){var c=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND});
@@ -473,41 +376,94 @@ feature:OpenLayers.Format.GML.v2.prototype.readers.feature},writers:{ogc:OpenLay
 {attributes:{wildCard:"*",singleChar:".",escape:"!"}});this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.regex2value(),b);return b},BBOX:function(a){var b=this.createElementNSPlus("ogc:BBOX");a.property&&this.writeNode("PropertyName",a,b);var c=this.writeNode("gml:Box",a.value,b);a.projection&&c.setAttribute("srsName",a.projection);return b}},OpenLayers.Format.Filter.v1.prototype.writers.ogc),gml:OpenLayers.Format.GML.v2.prototype.writers.gml,feature:OpenLayers.Format.GML.v2.prototype.writers.feature},
 writeSpatial:function(a,b){var c=this.createElementNSPlus("ogc:"+b);this.writeNode("PropertyName",a,c);if(a.value instanceof OpenLayers.Filter.Function)this.writeNode("Function",a.value,c);else{var d;d=a.value instanceof OpenLayers.Geometry?this.writeNode("feature:_geometry",a.value).firstChild:this.writeNode("gml:Box",a.value);a.projection&&d.setAttribute("srsName",a.projection);c.appendChild(d)}return c},CLASS_NAME:"OpenLayers.Format.Filter.v1_0_0"});OpenLayers.Format.WFST.v1_0_0=OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0,OpenLayers.Format.WFST.v1,{version:"1.0.0",srsNameInQuery:!1,schemaLocations:{wfs:"http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"},initialize:function(a){OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this,[a]);OpenLayers.Format.WFST.v1.prototype.initialize.apply(this,[a])},readNode:function(a,b,c){return OpenLayers.Format.GML.v2.prototype.readNode.apply(this,arguments)},readers:{wfs:OpenLayers.Util.applyDefaults({WFS_TransactionResponse:function(a,
 b){b.insertIds=[];b.success=!1;this.readChildNodes(a,b)},InsertResult:function(a,b){var c={fids:[]};this.readChildNodes(a,c);b.insertIds=b.insertIds.concat(c.fids)},TransactionResult:function(a,b){this.readChildNodes(a,b)},Status:function(a,b){this.readChildNodes(a,b)},SUCCESS:function(a,b){b.success=!0}},OpenLayers.Format.WFST.v1.prototype.readers.wfs),gml:OpenLayers.Format.GML.v2.prototype.readers.gml,feature:OpenLayers.Format.GML.v2.prototype.readers.feature,ogc:OpenLayers.Format.Filter.v1_0_0.prototype.readers.ogc},
 {attributes:{wildCard:"*",singleChar:".",escape:"!"}});this.writeNode("PropertyName",a,b);this.writeNode("Literal",a.regex2value(),b);return b},BBOX:function(a){var b=this.createElementNSPlus("ogc:BBOX");a.property&&this.writeNode("PropertyName",a,b);var c=this.writeNode("gml:Box",a.value,b);a.projection&&c.setAttribute("srsName",a.projection);return b}},OpenLayers.Format.Filter.v1.prototype.writers.ogc),gml:OpenLayers.Format.GML.v2.prototype.writers.gml,feature:OpenLayers.Format.GML.v2.prototype.writers.feature},
 writeSpatial:function(a,b){var c=this.createElementNSPlus("ogc:"+b);this.writeNode("PropertyName",a,c);if(a.value instanceof OpenLayers.Filter.Function)this.writeNode("Function",a.value,c);else{var d;d=a.value instanceof OpenLayers.Geometry?this.writeNode("feature:_geometry",a.value).firstChild:this.writeNode("gml:Box",a.value);a.projection&&d.setAttribute("srsName",a.projection);c.appendChild(d)}return c},CLASS_NAME:"OpenLayers.Format.Filter.v1_0_0"});OpenLayers.Format.WFST.v1_0_0=OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0,OpenLayers.Format.WFST.v1,{version:"1.0.0",srsNameInQuery:!1,schemaLocations:{wfs:"http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"},initialize:function(a){OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this,[a]);OpenLayers.Format.WFST.v1.prototype.initialize.apply(this,[a])},readNode:function(a,b,c){return OpenLayers.Format.GML.v2.prototype.readNode.apply(this,arguments)},readers:{wfs:OpenLayers.Util.applyDefaults({WFS_TransactionResponse:function(a,
 b){b.insertIds=[];b.success=!1;this.readChildNodes(a,b)},InsertResult:function(a,b){var c={fids:[]};this.readChildNodes(a,c);b.insertIds=b.insertIds.concat(c.fids)},TransactionResult:function(a,b){this.readChildNodes(a,b)},Status:function(a,b){this.readChildNodes(a,b)},SUCCESS:function(a,b){b.success=!0}},OpenLayers.Format.WFST.v1.prototype.readers.wfs),gml:OpenLayers.Format.GML.v2.prototype.readers.gml,feature:OpenLayers.Format.GML.v2.prototype.readers.feature,ogc:OpenLayers.Format.Filter.v1_0_0.prototype.readers.ogc},
-writers:{wfs:OpenLayers.Util.applyDefaults({Query:function(a){a=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName,srsNameInQuery:this.srsNameInQuery},a);var b=a.featurePrefix,c=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(b?b+":":"")+a.featureType}});a.srsNameInQuery&&a.srsName&&c.setAttribute("srsName",a.srsName);a.featureNS&&c.setAttribute("xmlns:"+b,a.featureNS);if(a.propertyNames)for(var b=0,d=a.propertyNames.length;b<
-d;b++)this.writeNode("ogc:PropertyName",{property:a.propertyNames[b]},c);a.filter&&(this.setFilterProperty(a.filter),this.writeNode("ogc:Filter",a.filter,c));return c}},OpenLayers.Format.WFST.v1.prototype.writers.wfs),gml:OpenLayers.Format.GML.v2.prototype.writers.gml,feature:OpenLayers.Format.GML.v2.prototype.writers.feature,ogc:OpenLayers.Format.Filter.v1_0_0.prototype.writers.ogc},CLASS_NAME:"OpenLayers.Format.WFST.v1_0_0"});OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(a){this.compare=a?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.clear()},insert:function(a){this.exists(a)&&this.remove(a);var b=a.id;this.determineZIndex(a);for(var c=-1,d=this.order.length,e;1<d-c;)e=parseInt((c+d)/2),0<this.compare(this,a,OpenLayers.Util.getElement(this.order[e]))?c=e:d=e;this.order.splice(d,
-0,b);this.indices[b]=this.getZIndex(a);return this.getNextElement(d)},remove:function(a){a=a.id;var b=OpenLayers.Util.indexOf(this.order,a);0<=b&&(this.order.splice(b,1),delete this.indices[a],this.maxZIndex=0<this.order.length?this.indices[this.order[this.order.length-1]]:0)},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return null!=this.indices[a.id]},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=a._style.graphicZIndex;
-null==b?(b=this.maxZIndex,a._style.graphicZIndex=b):b>this.maxZIndex&&(this.maxZIndex=b)},getNextElement:function(a){a+=1;if(a<this.order.length){var b=OpenLayers.Util.getElement(this.order[a]);void 0==b&&(b=this.getNextElement(a));return b}return null},CLASS_NAME:"OpenLayers.ElementsIndexer"});
-OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(a,b,c){b=a.getZIndex(b);var d=0;c&&(a=a.getZIndex(c),d=b-a);return d},Z_ORDER_DRAWING_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);c&&0==a&&(a=1);return a},Z_ORDER_Y_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);c&&0===a&&(b=c._boundsBottom-b._boundsBottom,a=0===b?1:b);return a}};
-OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,xOffset:0,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",LABEL_OUTLINE_SUFFIX:"_outline",initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);
-this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(b&&(b.zIndexing||b.yOrdering))this.indexer=new OpenLayers.ElementsIndexer(b.yOrdering)},destroy:function(){this.clear();this.xmlns=this.root=this.rendererRoot=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments)},clear:function(){var a,b=this.vectorRoot;if(b)for(;a=b.firstChild;)b.removeChild(a);if(b=this.textRoot)for(;a=b.firstChild;)b.removeChild(a);this.indexer&&
-this.indexer.clear()},setExtent:function(a,b){var c=OpenLayers.Renderer.prototype.setExtent.apply(this,arguments),d=this.getResolution();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var e,f=a.getWidth()/this.map.getExtent().getWidth();a=a.scale(1/f);f=this.map.getMaxExtent();f.right>a.left&&f.right<a.right?e=!0:f.left>a.left&&f.left<a.right&&(e=!1);if(e!==this.rightOfDateLine||b)c=!1,this.xOffset=!0===e?f.getWidth()/d:0;this.rightOfDateLine=e}return c},getNodeType:function(a,b){},drawGeometry:function(a,
-b,c){var d=a.CLASS_NAME,e=!0;if("OpenLayers.Geometry.Collection"==d||"OpenLayers.Geometry.MultiPoint"==d||"OpenLayers.Geometry.MultiLineString"==d||"OpenLayers.Geometry.MultiPolygon"==d){for(var d=0,f=a.components.length;d<f;d++)e=this.drawGeometry(a.components[d],b,c)&&e;return e}d=e=!1;"none"!=b.display&&(b.backgroundGraphic?this.redrawBackgroundNode(a.id,a,b,c):d=!0,e=this.redrawNode(a.id,a,b,c));if(!1==e&&(b=document.getElementById(a.id)))b._style.backgroundGraphic&&(d=!0),b.parentNode.removeChild(b);
-d&&(b=document.getElementById(a.id+this.BACKGROUND_ID_SUFFIX))&&b.parentNode.removeChild(b);return e},redrawNode:function(a,b,c,d){c=this.applyDefaultSymbolizer(c);a=this.nodeFactory(a,this.getNodeType(b,c));a._featureId=d;a._boundsBottom=b.getBounds().bottom;a._geometryClass=b.CLASS_NAME;a._style=c;b=this.drawGeometryNode(a,b,c);if(!1===b)return!1;a=b.node;this.indexer?(c=this.indexer.insert(a))?this.vectorRoot.insertBefore(a,c):this.vectorRoot.appendChild(a):a.parentNode!==this.vectorRoot&&this.vectorRoot.appendChild(a);
-this.postDraw(a);return b.complete},redrawBackgroundNode:function(a,b,c,d){c=OpenLayers.Util.extend({},c);c.externalGraphic=c.backgroundGraphic;c.graphicXOffset=c.backgroundXOffset;c.graphicYOffset=c.backgroundYOffset;c.graphicZIndex=c.backgroundGraphicZIndex;c.graphicWidth=c.backgroundWidth||c.graphicWidth;c.graphicHeight=c.backgroundHeight||c.graphicHeight;c.backgroundGraphic=null;c.backgroundXOffset=null;c.backgroundYOffset=null;c.backgroundGraphicZIndex=null;return this.redrawNode(a+this.BACKGROUND_ID_SUFFIX,
-b,c,null)},drawGeometryNode:function(a,b,c){c=c||a._style;var d={isFilled:void 0===c.fill?!0:c.fill,isStroked:void 0===c.stroke?!!c.strokeWidth:c.stroke},e;switch(b.CLASS_NAME){case "OpenLayers.Geometry.Point":!1===c.graphic&&(d.isFilled=!1,d.isStroked=!1);e=this.drawPoint(a,b);break;case "OpenLayers.Geometry.LineString":d.isFilled=!1;e=this.drawLineString(a,b);break;case "OpenLayers.Geometry.LinearRing":e=this.drawLinearRing(a,b);break;case "OpenLayers.Geometry.Polygon":e=this.drawPolygon(a,b);break;
-case "OpenLayers.Geometry.Rectangle":e=this.drawRectangle(a,b)}a._options=d;return!1!=e?{node:this.setStyle(a,c,d,b),complete:e}:!1},postDraw:function(a){},drawPoint:function(a,b){},drawLineString:function(a,b){},drawLinearRing:function(a,b){},drawPolygon:function(a,b){},drawRectangle:function(a,b){},drawCircle:function(a,b){},removeText:function(a){var b=document.getElementById(a+this.LABEL_ID_SUFFIX);b&&this.textRoot.removeChild(b);(a=document.getElementById(a+this.LABEL_OUTLINE_SUFFIX))&&this.textRoot.removeChild(a)},
-getFeatureIdFromEvent:function(a){var b=a.target,c=b&&b.correspondingUseElement;return(c?c:b||a.srcElement)._featureId},eraseGeometry:function(a,b){if("OpenLayers.Geometry.MultiPoint"==a.CLASS_NAME||"OpenLayers.Geometry.MultiLineString"==a.CLASS_NAME||"OpenLayers.Geometry.MultiPolygon"==a.CLASS_NAME||"OpenLayers.Geometry.Collection"==a.CLASS_NAME)for(var c=0,d=a.components.length;c<d;c++)this.eraseGeometry(a.components[c],b);else if((c=OpenLayers.Util.getElement(a.id))&&c.parentNode)c.geometry&&(c.geometry.destroy(),
-c.geometry=null),c.parentNode.removeChild(c),this.indexer&&this.indexer.remove(c),c._style.backgroundGraphic&&(c=OpenLayers.Util.getElement(a.id+this.BACKGROUND_ID_SUFFIX))&&c.parentNode&&c.parentNode.removeChild(c)},nodeFactory:function(a,b){var c=OpenLayers.Util.getElement(a);c?this.nodeTypeCompare(c,b)||(c.parentNode.removeChild(c),c=this.nodeFactory(a,b)):c=this.createNode(b,a);return c},nodeTypeCompare:function(a,b){},createNode:function(a,b){},moveRoot:function(a){var b=this.root;a.root.parentNode==
-this.rendererRoot&&(b=a.root);b.parentNode.removeChild(b);a.rendererRoot.appendChild(b)},getRenderLayerId:function(){return this.root.parentNode.parentNode.id},isComplexSymbol:function(a){return"circle"!=a&&!!a},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Control.Zoom=OpenLayers.Class(OpenLayers.Control,{zoomInText:"+",zoomInId:"olZoomInLink",zoomOutText:"\u2212",zoomOutId:"olZoomOutLink",draw:function(){var a=OpenLayers.Control.prototype.draw.apply(this),b=this.getOrCreateLinks(a),c=b.zoomIn,b=b.zoomOut,d=this.map.events;b.parentNode!==a&&(d=this.events,d.attachToElement(b.parentNode));d.register("buttonclick",this,this.onZoomClick);this.zoomInLink=c;this.zoomOutLink=b;return a},getOrCreateLinks:function(a){var b=document.getElementById(this.zoomInId),
+writers:{wfs:OpenLayers.Util.applyDefaults({Query:function(a){a=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName,srsNameInQuery:this.srsNameInQuery},a);var b=a.featurePrefix,c=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(a.featureNS?b+":":"")+a.featureType}});a.srsNameInQuery&&a.srsName&&c.setAttribute("srsName",a.srsName);a.featureNS&&this.setAttributeNS(c,this.namespaces.xmlns,"xmlns:"+b,a.featureNS);
+if(a.propertyNames)for(var b=0,d=a.propertyNames.length;b<d;b++)this.writeNode("ogc:PropertyName",{property:a.propertyNames[b]},c);a.filter&&(this.setFilterProperty(a.filter),this.writeNode("ogc:Filter",a.filter,c));return c}},OpenLayers.Format.WFST.v1.prototype.writers.wfs),gml:OpenLayers.Format.GML.v2.prototype.writers.gml,feature:OpenLayers.Format.GML.v2.prototype.writers.feature,ogc:OpenLayers.Format.Filter.v1_0_0.prototype.writers.ogc},CLASS_NAME:"OpenLayers.Format.WFST.v1_0_0"});OpenLayers.Protocol.WFS.v1_0_0=OpenLayers.Class(OpenLayers.Protocol.WFS.v1,{version:"1.0.0",CLASS_NAME:"OpenLayers.Protocol.WFS.v1_0_0"});OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:!1,displayClass:"",title:"",autoActivate:!1,active:null,handlerOptions:null,handler:null,eventListeners:null,events:null,initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object)this.events.on(this.eventListeners);null==this.id&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+
+"_"))},destroy:function(){this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy(),this.events=null);this.eventListeners=null;this.handler&&(this.handler.destroy(),this.handler=null);if(this.handlers){for(var a in this.handlers)this.handlers.hasOwnProperty(a)&&"function"==typeof this.handlers[a].destroy&&this.handlers[a].destroy();this.handlers=null}this.map&&(this.map.removeControl(this),this.map=null);this.div=null},setMap:function(a){this.map=a;this.handler&&
+this.handler.setMap(a)},draw:function(a){null==this.div&&(this.div=OpenLayers.Util.createDiv(this.id),this.div.className=this.displayClass,this.allowSelection||(this.div.className+=" olControlNoSelect",this.div.setAttribute("unselectable","on",0),this.div.onselectstart=OpenLayers.Function.False),""!=this.title&&(this.div.title=this.title));null!=a&&(this.position=a.clone());this.moveTo(this.position);return this.div},moveTo:function(a){null!=a&&null!=this.div&&(this.div.style.left=a.x+"px",this.div.style.top=
+a.y+"px")},activate:function(){if(this.active)return!1;this.handler&&this.handler.activate();this.active=!0;this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");this.events.triggerEvent("activate");return!0},deactivate:function(){return this.active?(this.handler&&this.handler.deactivate(),this.active=!1,this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("deactivate"),
+!0):!1},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:!1,evt:null,touch:!1,initialize:function(a,b,c){OpenLayers.Util.extend(this,c);this.control=a;this.callbacks=b;(a=this.map||a.map)&&this.setMap(a);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){return null==this.keyMask?!0:((a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?OpenLayers.Handler.MOD_ALT:
+0)|(a.metaKey?OpenLayers.Handler.MOD_META:0))==this.keyMask},activate:function(){if(this.active)return!1;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.register(a[b],this[a[b]]);return this.active=!0},deactivate:function(){if(!this.active)return!1;for(var a=OpenLayers.Events.prototype.BROWSER_EVENTS,b=0,c=a.length;b<c;b++)this[a[b]]&&this.unregister(a[b],this[a[b]]);this.active=this.touch=!1;return!0},startTouch:function(){if(!this.touch){this.touch=!0;
+for(var a="mousedown mouseup mousemove click dblclick mouseout".split(" "),b=0,c=a.length;b<c;b++)this[a[b]]&&this.unregister(a[b],this[a[b]])}},callback:function(a,b){a&&this.callbacks[a]&&this.callbacks[a].apply(this.control,b)},register:function(a,b){this.map.events.registerPriority(a,this,b);this.map.events.registerPriority(a,this,this.setEvent)},unregister:function(a,b){this.map.events.unregister(a,this,b);this.map.events.unregister(a,this,this.setEvent)},setEvent:function(a){this.evt=a;return!0},
+destroy:function(){this.deactivate();this.control=this.map=null},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Handler.MOD_META=8;OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!0,dragging:!1,last:null,start:null,lastMoveEvt:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:!1,documentEvents:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(!0===this.documentDrag){var d=this;this._docMove=function(a){d.mousemove({xy:{x:a.clientX,y:a.clientY},element:document})};this._docUp=function(a){d.mouseup({xy:{x:a.clientX,y:a.clientY}})}}},
+dragstart:function(a){var b=!0;this.dragging=!1;this.checkModifiers(a)&&this._pointerId==a.pointerId&&(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))?(this.started=!0,this.last=this.start=a.xy,OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown"),this.down(a),this.callback("down",[a.xy]),OpenLayers.Event.preventDefault(a),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart?document.onselectstart:OpenLayers.Function.True),document.onselectstart=OpenLayers.Function.False,
+b=!this.stopDown):(delete this._pointerId,this.started=!1,this.last=this.start=null);return b},dragmove:function(a){this.lastMoveEvt=a;if(this.started&&this._pointerId==a.pointerId&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y))!0===this.documentDrag&&this.documentEvents&&(a.element===document?(this.adjustXY(a),this.setEvent(a)):this.removeDocumentEvents()),0<this.interval&&(this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)),this.dragging=!0,
+this.move(a),this.callback("move",[a.xy]),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart,document.onselectstart=OpenLayers.Function.False),this.last=a.xy;return!0},dragend:function(a){if(this.started&&this._pointerId==a.pointerId){!0===this.documentDrag&&this.documentEvents&&(this.adjustXY(a),this.removeDocumentEvents());var b=this.start!=this.last;this.dragging=this.started=!1;delete this._pointerId;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(a);
+this.callback("up",[a.xy]);b&&this.callback("done",[a.xy]);document.onselectstart=this.oldOnselectstart}return!0},down:function(a){},move:function(a){},up:function(a){},out:function(a){},mousedown:function(a){return this.dragstart(a)},touchstart:function(a){this.startTouch();"_pointerId"in this||(this._pointerId=a.pointerId);return this.dragstart(a)},mousemove:function(a){return this.dragmove(a)},touchmove:function(a){return this.dragmove(a)},removeTimeout:function(){this.timeoutId=null;this.dragging&&
+this.mousemove(this.lastMoveEvt)},mouseup:function(a){return this.dragend(a)},touchend:function(a){a.xy=this.last;return this.dragend(a)},mouseout:function(a){if(this.started&&OpenLayers.Util.mouseLeft(a,this.map.viewPortDiv))if(!0===this.documentDrag)this.addDocumentEvents();else{var b=this.start!=this.last;this.dragging=this.started=!1;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(a);this.callback("out",[]);b&&this.callback("done",[a.xy]);document.onselectstart&&(document.onselectstart=
+this.oldOnselectstart)}return!0},click:function(a){return this.start==this.last},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.dragging=!1,a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.dragging=this.started=!1,this.last=this.start=null,a=!0,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown"));return a},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.viewPortDiv);
+a.xy.x-=b[0];a.xy.y-=b[1]},addDocumentEvents:function(){OpenLayers.Element.addClass(document.body,"olDragDown");this.documentEvents=!0;OpenLayers.Event.observe(document,"mousemove",this._docMove);OpenLayers.Event.observe(document,"mouseup",this._docUp)},removeDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents=!1;OpenLayers.Event.stopObserving(document,"mousemove",this._docMove);OpenLayers.Event.stopObserving(document,"mouseup",this._docUp)},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxOffsets:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.dragHandler=new OpenLayers.Handler.Drag(this,{down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox},{keyMask:this.keyMask})},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.dragHandler&&(this.dragHandler.destroy(),this.dragHandler=
+null)},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);this.dragHandler&&this.dragHandler.setMap(a)},startBox:function(a){this.callback("start",[]);this.zoomBox=OpenLayers.Util.createDiv("zoomBox",{x:-9999,y:-9999});this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(a){var b=this.dragHandler.start.x,
+c=this.dragHandler.start.y,d=Math.abs(b-a.x),e=Math.abs(c-a.y),f=this.getBoxOffsets();this.zoomBox.style.width=d+f.width+1+"px";this.zoomBox.style.height=e+f.height+1+"px";this.zoomBox.style.left=(a.x<b?b-d-f.left:b-f.left)+"px";this.zoomBox.style.top=(a.y<c?c-e-f.top:c-f.top)+"px"},endBox:function(a){var b;if(5<Math.abs(this.dragHandler.start.x-a.x)||5<Math.abs(this.dragHandler.start.y-a.y)){var c=this.dragHandler.start;b=Math.min(c.y,a.y);var d=Math.max(c.y,a.y),e=Math.min(c.x,a.x);a=Math.max(c.x,
+a.x);b=new OpenLayers.Bounds(e,d,a,b)}else b=this.dragHandler.start.clone();this.removeBox();this.callback("done",[b])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.boxOffsets=this.zoomBox=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){return OpenLayers.Handler.prototype.activate.apply(this,arguments)?(this.dragHandler.activate(),!0):!1},deactivate:function(){return OpenLayers.Handler.prototype.deactivate.apply(this,arguments)?
+(this.dragHandler.deactivate()&&this.zoomBox&&this.removeBox(),!0):!1},getBoxOffsets:function(){if(!this.boxOffsets){var a=document.createElement("div");a.style.position="absolute";a.style.border="1px solid black";a.style.width="3px";document.body.appendChild(a);var b=3==a.clientWidth;document.body.removeChild(a);var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width")),c=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width")),d=parseInt(OpenLayers.Element.getStyle(this.zoomBox,
+"border-top-width")),e=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"));this.boxOffsets={left:a,right:c,top:d,bottom:e,width:!1===b?a+c:0,height:!1===b?d+e:0}}return this.boxOffsets},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:!1,keyMask:null,alwaysZoom:!1,zoomOnClick:!0,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask})},zoomBox:function(a){if(a instanceof OpenLayers.Bounds){var b,c=a.getCenterPixel();if(this.out){b=Math.min(this.map.size.h/(a.bottom-a.top),this.map.size.w/(a.right-a.left));var d=this.map.getExtent(),e=this.map.getLonLatFromPixel(c),f=e.lon-d.getWidth()/
+2*b;a=e.lon+d.getWidth()/2*b;var g=e.lat-d.getHeight()/2*b;b=e.lat+d.getHeight()/2*b;b=new OpenLayers.Bounds(f,g,a,b)}else f=this.map.getLonLatFromPixel({x:a.left,y:a.bottom}),a=this.map.getLonLatFromPixel({x:a.right,y:a.top}),b=new OpenLayers.Bounds(f.lon,f.lat,a.lon,a.lat);f=this.map.getZoom();g=this.map.getSize();a=g.w/2;g=g.h/2;b=this.map.getZoomForExtent(b);d=this.map.getResolution();e=this.map.getResolutionForZoom(b);d==e?this.map.setCenter(this.map.getLonLatFromPixel(c)):this.map.zoomTo(b,
+{x:(d*c.x-e*a)/(d-e),y:(d*c.y-e*g)/(d-e)});f==this.map.getZoom()&&!0==this.alwaysZoom&&this.map.zoomTo(f+(this.out?-1:1))}else this.zoomOnClick&&(this.out?this.map.zoomTo(this.map.getZoom()-1,a):this.map.zoomTo(this.map.getZoom()+1,a))},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:!1,interval:0,documentDrag:!1,kinetic:null,enableKinetic:!0,kineticInterval:10,draw:function(){if(this.enableKinetic&&OpenLayers.Kinetic){var a={interval:this.kineticInterval};"object"===typeof this.enableKinetic&&(a=OpenLayers.Util.extend(a,this.enableKinetic));this.kinetic=new OpenLayers.Kinetic(a)}this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone,down:this.panMapStart},
+{interval:this.interval,documentDrag:this.documentDrag})},panMapStart:function(){this.kinetic&&this.kinetic.begin()},panMap:function(a){this.kinetic&&this.kinetic.update(a);this.panned=!0;this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:!0,animate:!1})},panMapDone:function(a){if(this.panned){var b=null;this.kinetic&&(b=this.kinetic.end(a));this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:!!b,animate:!1});if(b){var c=this;this.kinetic.move(b,function(a,b,
+f){c.map.pan(a,b,{dragging:!f,animate:!1})})}this.panned=!1}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,interval:0,maxDelta:Number.POSITIVE_INFINITY,delta:0,cumulative:!0,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this)},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null},onWheelEvent:function(a){if(this.map&&this.checkModifiers(a)){for(var b=
+!1,c=!1,d=!1,e=OpenLayers.Event.element(a);null!=e&&!d&&!b;){if(!b)try{var f,b=(f=e.currentStyle?e.currentStyle.overflow:document.defaultView.getComputedStyle(e,null).getPropertyValue("overflow"))&&"auto"==f||"scroll"==f}catch(g){}if(!c&&(c=OpenLayers.Element.hasClass(e,"olScrollable"),!c))for(var d=0,h=this.map.layers.length;d<h;d++){var k=this.map.layers[d];if(e==k.div||e==k.pane){c=!0;break}}d=e==this.map.div;e=e.parentNode}if(!b&&d){if(c)if(b=0,a.wheelDelta?(b=a.wheelDelta,0===b%160&&(b*=0.75),
+b/=120):a.detail&&(b=-(a.detail/Math.abs(a.detail))),this.delta+=b,window.clearTimeout(this._timeoutId),this.interval&&Math.abs(this.delta)<this.maxDelta){var l=OpenLayers.Util.extend({},a);this._timeoutId=window.setTimeout(OpenLayers.Function.bind(function(){this.wheelZoom(l)},this),this.interval)}else this.wheelZoom(a);OpenLayers.Event.stop(a)}}},wheelZoom:function(a){var b=this.delta;this.delta=0;b&&(a.xy=this.map.events.getMousePosition(a),0>b?this.callback("down",[a,this.cumulative?Math.max(-this.maxDelta,
+b):-1]):this.callback("up",[a,this.cumulative?Math.min(this.maxDelta,b):1]))},activate:function(a){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",b);OpenLayers.Event.observe(window,"mousewheel",b);OpenLayers.Event.observe(document,"mousewheel",b);return!0}return!1},deactivate:function(a){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.stopObserving(window,
+"DOMMouseScroll",b);OpenLayers.Event.stopObserving(window,"mousewheel",b);OpenLayers.Event.stopObserving(document,"mousewheel",b);return!0}return!1},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:!0,"double":!1,pixelTolerance:0,dblclickTolerance:13,stopSingle:!1,stopDouble:!1,timerId:null,down:null,last:null,first:null,rightclickTimerId:null,touchstart:function(a){this.startTouch();this.down=this.getEventInfo(a);this.last=this.getEventInfo(a);return!0},touchmove:function(a){this.last=this.getEventInfo(a);return!0},touchend:function(a){this.down&&(a.xy=this.last.xy,a.lastTouches=this.last.touches,this.handleSingle(a),
+this.down=null);return!0},mousedown:function(a){this.down=this.getEventInfo(a);this.last=this.getEventInfo(a);return!0},mouseup:function(a){var b=!0;this.checkModifiers(a)&&(this.control.handleRightClicks&&OpenLayers.Event.isRightClick(a))&&(b=this.rightclick(a));return b},rightclick:function(a){if(this.passesTolerance(a)){if(null!=this.rightclickTimerId)return this.clearTimer(),this.callback("dblrightclick",[a]),!this.stopDouble;a=this["double"]?OpenLayers.Util.extend({},a):this.callback("rightclick",
+[a]);a=OpenLayers.Function.bind(this.delayedRightCall,this,a);this.rightclickTimerId=window.setTimeout(a,this.delay)}return!this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null;a&&this.callback("rightclick",[a])},click:function(a){this.last||(this.last=this.getEventInfo(a));this.handleSingle(a);return!this.stopSingle},dblclick:function(a){this.handleDouble(a);return!this.stopDouble},handleDouble:function(a){this.passesDblclickTolerance(a)&&(this["double"]&&this.callback("dblclick",
+[a]),this.clearTimer())},handleSingle:function(a){this.passesTolerance(a)&&(null!=this.timerId?(this.last.touches&&1===this.last.touches.length&&(this["double"]&&OpenLayers.Event.preventDefault(a),this.handleDouble(a)),(!this.last.touches||2!==this.last.touches.length)&&this.clearTimer()):(this.first=this.getEventInfo(a),a=this.single?OpenLayers.Util.extend({},a):null,this.queuePotentialClick(a)))},queuePotentialClick:function(a){this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,
+this,a),this.delay)},passesTolerance:function(a){var b=!0;if(null!=this.pixelTolerance&&this.down&&this.down.xy&&(b=this.pixelTolerance>=this.down.xy.distanceTo(a.xy))&&this.touch&&this.down.touches.length===this.last.touches.length){a=0;for(var c=this.down.touches.length;a<c;++a)if(this.getTouchDistance(this.down.touches[a],this.last.touches[a])>this.pixelTolerance){b=!1;break}}return b},getTouchDistance:function(a,b){return Math.sqrt(Math.pow(a.clientX-b.clientX,2)+Math.pow(a.clientY-b.clientY,
+2))},passesDblclickTolerance:function(a){a=!0;this.down&&this.first&&(a=this.down.xy.distanceTo(this.first.xy)<=this.dblclickTolerance);return a},clearTimer:function(){null!=this.timerId&&(window.clearTimeout(this.timerId),this.timerId=null);null!=this.rightclickTimerId&&(window.clearTimeout(this.rightclickTimerId),this.rightclickTimerId=null)},delayedCall:function(a){this.timerId=null;a&&this.callback("click",[a])},getEventInfo:function(a){var b;if(a.touches){var c=a.touches.length;b=Array(c);for(var d,
+e=0;e<c;e++)d=a.touches[e],b[e]={clientX:d.olClientX,clientY:d.olClientY}}return{xy:a.xy,touches:b}},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.clearTimer(),this.last=this.first=this.down=null,a=!0);return a},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,documentDrag:!1,zoomBox:null,zoomBoxEnabled:!0,zoomWheelEnabled:!0,mouseWheelOptions:null,handleRightClicks:!1,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,autoActivate:!0,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();this.dragPan&&this.dragPan.destroy();this.dragPan=null;
+this.zoomBox&&this.zoomBox.destroy();this.zoomBox=null;this.pinchZoom&&this.pinchZoom.destroy();this.pinchZoom=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){this.dragPan.activate();this.zoomWheelEnabled&&this.handlers.wheel.activate();this.handlers.click.activate();this.zoomBoxEnabled&&this.zoomBox.activate();this.pinchZoom&&this.pinchZoom.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.pinchZoom&&this.pinchZoom.deactivate();
+this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},draw:function(){this.handleRightClicks&&(this.map.viewPortDiv.oncontextmenu=OpenLayers.Function.False);this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.defaultClick,dblclick:this.defaultDblClick,dblrightclick:this.defaultDblRightClick},{"double":!0,stopDouble:!0});this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,
+documentDrag:this.documentDrag},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown},OpenLayers.Util.extend(this.map.fractionalZoom?{}:{cumulative:!1,interval:50,maxDelta:6},this.mouseWheelOptions));OpenLayers.Control.PinchZoom&&(this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},
+this.pinchZoomOptions)))},defaultClick:function(a){a.lastTouches&&2==a.lastTouches.length&&this.map.zoomOut()},defaultDblClick:function(a){this.map.zoomTo(this.map.zoom+1,a.xy)},defaultDblRightClick:function(a){this.map.zoomTo(this.map.zoom-1,a.xy)},wheelChange:function(a,b){this.map.fractionalZoom||(b=Math.round(b));var c=this.map.getZoom(),d;d=Math.max(c+b,0);d=Math.min(d,this.map.getNumZoomLevels());d!==c&&this.map.zoomTo(d,a.xy)},wheelUp:function(a,b){this.wheelChange(a,b||1)},wheelDown:function(a,
+b){this.wheelChange(a,b||-1)},disableZoomBox:function(){this.zoomBoxEnabled=!1;this.zoomBox.deactivate()},enableZoomBox:function(){this.zoomBoxEnabled=!0;this.active&&this.zoomBox.activate()},disableZoomWheel:function(){this.zoomWheelEnabled=!1;this.handlers.wheel.deactivate()},enableZoomWheel:function(){this.zoomWheelEnabled=!0;this.active&&this.handlers.wheel.activate()},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.Events.buttonclick=OpenLayers.Class({target:null,events:"mousedown mouseup click dblclick touchstart touchmove touchend keydown".split(" "),startRegEx:/^mousedown|touchstart$/,cancelRegEx:/^touchmove$/,completeRegEx:/^mouseup|touchend$/,isDeviceTouchCapable:"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,initialize:function(a){this.target=a;for(a=this.events.length-1;0<=a;--a)this.target.register(this.events[a],this,this.buttonClick,{extension:!0})},
+destroy:function(){for(var a=this.events.length-1;0<=a;--a)this.target.unregister(this.events[a],this,this.buttonClick);delete this.target},getPressedButton:function(a){var b=3,c;do{if(OpenLayers.Element.hasClass(a,"olButton")){c=a;break}a=a.parentNode}while(0<--b&&a);return c},ignore:function(a){var b=3,c=!1;do{if("a"===a.nodeName.toLowerCase()){c=!0;break}a=a.parentNode}while(0<--b&&a);return c},buttonClick:function(a){var b=!0,c=OpenLayers.Event.element(a);if(c&&(OpenLayers.Event.isLeftClick(a)&&
+!this.isDeviceTouchCapable||!~a.type.indexOf("mouse")))if(c=this.getPressedButton(c)){if("keydown"===a.type)switch(a.keyCode){case OpenLayers.Event.KEY_RETURN:case OpenLayers.Event.KEY_SPACE:this.target.triggerEvent("buttonclick",{buttonElement:c}),OpenLayers.Event.stop(a),b=!1}else if(this.startEvt){if(this.completeRegEx.test(a.type)){var b=OpenLayers.Util.pagePosition(c),d=OpenLayers.Util.getViewportElement(),e=window.pageYOffset||d.scrollTop;b[0]-=window.pageXOffset||d.scrollLeft;b[1]-=e;this.target.triggerEvent("buttonclick",
+{buttonElement:c,buttonXY:{x:this.startEvt.clientX-b[0],y:this.startEvt.clientY-b[1]}})}this.cancelRegEx.test(a.type)&&a.touches&&(this.startEvt.touches&&4<(4<Math.abs(a.touches[0].olClientX-this.startEvt.touches[0].olClientX)||Math.abs(a.touches[0].olClientY-this.startEvt.touches[0].olClientY)))&&delete this.startEvt;OpenLayers.Event.stop(a);b=!1}this.startRegEx.test(a.type)&&(this.startEvt=a,OpenLayers.Event.stop(a),b=!1)}else b=!this.ignore(OpenLayers.Event.element(a)),delete this.startEvt;return b}});OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,buttons:null,position:null,initialize:function(a){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map&&!this.outsideViewport&&this.map.events.unregister("buttonclick",this,this.onButtonClick);this.removeButtons();this.position=this.buttons=null;OpenLayers.Control.prototype.destroy.apply(this,
+arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);var b;this.outsideViewport?(this.events.attachToElement(this.div),b=this):b=this.map;b.events.register("buttonclick",this,this.onButtonClick)},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments);a=this.position;this.buttons=[];var b={w:18,h:18},c=new OpenLayers.Pixel(a.x+b.w/2,a.y);this._addButton("panup","north-mini.png",c,b);a.y=c.y+b.h;this._addButton("panleft","west-mini.png",a,b);this._addButton("panright",
+"east-mini.png",a.add(b.w,0),b);this._addButton("pandown","south-mini.png",c.add(0,2*b.h),b);this._addButton("zoomin","zoom-plus-mini.png",c.add(0,3*b.h+5),b);this._addButton("zoomworld","zoom-world-mini.png",c.add(0,4*b.h+5),b);this._addButton("zoomout","zoom-minus-mini.png",c.add(0,5*b.h+5),b);return this.div},_addButton:function(a,b,c,d){b=OpenLayers.Util.getImageLocation(b);c=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+a,c,d,b,"absolute");c.style.cursor="pointer";this.div.appendChild(c);c.action=
+a;c.className="olButton";this.buttons.push(c);return c},_removeButton:function(a){this.div.removeChild(a);OpenLayers.Util.removeItem(this.buttons,a)},removeButtons:function(){for(var a=this.buttons.length-1;0<=a;--a)this._removeButton(this.buttons[a])},onButtonClick:function(a){switch(a.buttonElement.action){case "panup":this.map.pan(0,-this.getSlideFactor("h"));break;case "pandown":this.map.pan(0,this.getSlideFactor("h"));break;case "panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case "panright":this.map.pan(this.getSlideFactor("w"),
+0);break;case "zoomin":this.map.zoomIn();break;case "zoomout":this.map.zoomOut();break;case "zoomworld":this.map.zoomToMaxExtent()}},getSlideFactor:function(a){return this.slideRatio?this.map.getSize()[a]*this.slideRatio:this.slideFactor},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Handler.Pinch=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!1,pinching:!1,last:null,start:null,touchstart:function(a){var b=!0;this.pinching=!1;if(OpenLayers.Event.isMultiTouch(a))this.started=!0,this.last=this.start={distance:this.getDistance(a.touches),delta:0,scale:1},this.callback("start",[a,this.start]),b=!this.stopDown;else{if(this.started)return!1;this.started=!1;this.last=this.start=null}OpenLayers.Event.preventDefault(a);return b},touchmove:function(a){if(this.started&&
+OpenLayers.Event.isMultiTouch(a)){this.pinching=!0;var b=this.getPinchData(a);this.callback("move",[a,b]);this.last=b;OpenLayers.Event.stop(a)}else if(this.started)return!1;return!0},touchend:function(a){return this.started&&!OpenLayers.Event.isMultiTouch(a)?(this.pinching=this.started=!1,this.callback("done",[a,this.start,this.last]),this.last=this.start=null,!1):!0},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.pinching=!1,a=!0);return a},deactivate:function(){var a=
+!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.pinching=this.started=!1,this.last=this.start=null,a=!0);return a},getDistance:function(a){var b=a[0];a=a[1];return Math.sqrt(Math.pow(b.olClientX-a.olClientX,2)+Math.pow(b.olClientY-a.olClientY,2))},getPinchData:function(a){a=this.getDistance(a.touches);return{distance:a,delta:this.last.distance-a,scale:a/this.start.distance}},CLASS_NAME:"OpenLayers.Handler.Pinch"});OpenLayers.Control.PinchZoom=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,pinchOrigin:null,currentCenter:null,autoActivate:!0,preserveCenter:!1,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Pinch(this,{start:this.pinchStart,move:this.pinchMove,done:this.pinchDone},this.handlerOptions)},pinchStart:function(a,b){var c=this.preserveCenter?this.map.getPixelFromLonLat(this.map.getCenter()):a.xy;this.currentCenter=
+this.pinchOrigin=c},pinchMove:function(a,b){var c=b.scale,d=this.map.layerContainerOriginPx,e=this.pinchOrigin,f=this.preserveCenter?this.map.getPixelFromLonLat(this.map.getCenter()):a.xy,g=Math.round(d.x+f.x-e.x+(c-1)*(d.x-e.x)),d=Math.round(d.y+f.y-e.y+(c-1)*(d.y-e.y));this.map.applyTransform(g,d,c);this.currentCenter=f},pinchDone:function(a,b,c){this.map.applyTransform();a=this.map.getZoomForResolution(this.map.getResolution()/c.scale,!0);if(a!==this.map.getZoom()||!this.currentCenter.equals(this.pinchOrigin)){b=
+this.map.getResolutionForZoom(a);c=this.map.getLonLatFromPixel(this.pinchOrigin);var d=this.currentCenter,e=this.map.getSize();c.lon+=b*(e.w/2-d.x);c.lat-=b*(e.h/2-d.y);this.map.div.clientWidth=this.map.div.clientWidth;this.map.setCenter(c,a)}},CLASS_NAME:"OpenLayers.Control.PinchZoom"});OpenLayers.Control.TouchNavigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,clickHandlerOptions:null,documentDrag:!1,autoActivate:!0,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();this.dragPan&&this.dragPan.destroy();this.dragPan=null;this.pinchZoom&&(this.pinchZoom.destroy(),delete this.pinchZoom);OpenLayers.Control.prototype.destroy.apply(this,
+arguments)},activate:function(){return OpenLayers.Control.prototype.activate.apply(this,arguments)?(this.dragPan.activate(),this.handlers.click.activate(),this.pinchZoom.activate(),!0):!1},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments)?(this.dragPan.deactivate(),this.handlers.click.deactivate(),this.pinchZoom.deactivate(),!0):!1},draw:function(){var a={click:this.defaultClick,dblclick:this.defaultDblClick},b=OpenLayers.Util.extend({"double":!0,stopDouble:!0,
+pixelTolerance:2},this.clickHandlerOptions);this.handlers.click=new OpenLayers.Handler.Click(this,a,b);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions));this.dragPan.draw();this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},this.pinchZoomOptions))},defaultClick:function(a){a.lastTouches&&2==a.lastTouches.length&&this.map.zoomOut()},defaultDblClick:function(a){this.map.zoomTo(this.map.zoom+
+1,a.xy)},CLASS_NAME:"OpenLayers.Control.TouchNavigation"});OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",template:"${layers}",layerTemplate:'<a href="${href}" target="_blank">${title}</a>',destroy:function(){this.map.events.un({removelayer:this.updateAttribution,addlayer:this.updateAttribution,changelayer:this.updateAttribution,changebaselayer:this.updateAttribution,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({changebaselayer:this.updateAttribution,
+changelayer:this.updateAttribution,addlayer:this.updateAttribution,removelayer:this.updateAttribution,scope:this});this.updateAttribution();return this.div},updateAttribution:function(){var a=[],b;if(this.map&&this.map.layers){for(var c=0,d=this.map.layers.length;c<d;c++)b=this.map.layers[c],b.attribution&&b.getVisibility()&&(b="object"==typeof b.attribution?OpenLayers.String.format(this.layerTemplate,b.attribution):b.attribution,-1===OpenLayers.Util.indexOf(a,b)&&a.push(b));this.div.innerHTML=OpenLayers.String.format(this.template,
+{layers:a.join(this.separator)})}},CLASS_NAME:"OpenLayers.Control.Attribution"});OpenLayers.Control.Zoom=OpenLayers.Class(OpenLayers.Control,{zoomInText:"+",zoomInId:"olZoomInLink",zoomOutText:"\u2212",zoomOutId:"olZoomOutLink",draw:function(){var a=OpenLayers.Control.prototype.draw.apply(this),b=this.getOrCreateLinks(a),c=b.zoomIn,b=b.zoomOut,d=this.map.events;b.parentNode!==a&&(d=this.events,d.attachToElement(b.parentNode));d.register("buttonclick",this,this.onZoomClick);this.zoomInLink=c;this.zoomOutLink=b;return a},getOrCreateLinks:function(a){var b=document.getElementById(this.zoomInId),
 c=document.getElementById(this.zoomOutId);b||(b=document.createElement("a"),b.href="#zoomIn",b.appendChild(document.createTextNode(this.zoomInText)),b.className="olControlZoomIn",a.appendChild(b));OpenLayers.Element.addClass(b,"olButton");c||(c=document.createElement("a"),c.href="#zoomOut",c.appendChild(document.createTextNode(this.zoomOutText)),c.className="olControlZoomOut",a.appendChild(c));OpenLayers.Element.addClass(c,"olButton");return{zoomIn:b,zoomOut:c}},onZoomClick:function(a){a=a.buttonElement;
 c=document.getElementById(this.zoomOutId);b||(b=document.createElement("a"),b.href="#zoomIn",b.appendChild(document.createTextNode(this.zoomInText)),b.className="olControlZoomIn",a.appendChild(b));OpenLayers.Element.addClass(b,"olButton");c||(c=document.createElement("a"),c.href="#zoomOut",c.appendChild(document.createTextNode(this.zoomOutText)),c.className="olControlZoomOut",a.appendChild(c));OpenLayers.Element.addClass(c,"olButton");return{zoomIn:b,zoomOut:c}},onZoomClick:function(a){a=a.buttonElement;
-a===this.zoomInLink?this.map.zoomIn():a===this.zoomOutLink&&this.map.zoomOut()},destroy:function(){this.map&&this.map.events.unregister("buttonclick",this,this.onZoomClick);delete this.zoomInLink;delete this.zoomOutLink;OpenLayers.Control.prototype.destroy.apply(this)},CLASS_NAME:"OpenLayers.Control.Zoom"});OpenLayers.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:!0,defaultFilter:null,initialize:function(a){a=a||{};OpenLayers.Util.extend(this,a);this.options=a},mergeWithDefaultFilter:function(a){return a&&this.defaultFilter?new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.defaultFilter,a]}):a||this.defaultFilter||void 0},destroy:function(){this.format=this.options=null},read:function(a){a=a||{};a.filter=this.mergeWithDefaultFilter(a.filter)},create:function(){},
-update:function(){},"delete":function(){},commit:function(){},abort:function(a){},createCallback:function(a,b,c){return OpenLayers.Function.bind(function(){a.apply(this,[b,c])},this)},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:!0,features:null,data:null,reqFeatures:null,priv:null,error:null,initialize:function(a){OpenLayers.Util.extend(this,a)},success:function(){return 0<this.code},CLASS_NAME:"OpenLayers.Protocol.Response"});
-OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;OpenLayers.Protocol.WFS=function(a){a=OpenLayers.Util.applyDefaults(a,OpenLayers.Protocol.WFS.DEFAULTS);var b=OpenLayers.Protocol.WFS["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported WFS version: "+a.version;return new b(a)};
-OpenLayers.Protocol.WFS.fromWMSLayer=function(a,b){var c,d;c=a.params.LAYERS;c=(OpenLayers.Util.isArray(c)?c[0]:c).split(":");1<c.length&&(d=c[0]);c=c.pop();d={url:a.url,featureType:c,featurePrefix:d,srsName:a.projection&&a.projection.getCode()||a.map&&a.map.getProjectionObject().getCode(),version:"1.1.0"};return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(b,d))};OpenLayers.Protocol.WFS.DEFAULTS={version:"1.0.0"};OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,markers:null,drawn:!1,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[]},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;a=0;for(var b=this.markers.length;a<b;a++)this.markers[a].setOpacity(this.opacity)}},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,
-arguments);if(b||!this.drawn){for(var d=0,e=this.markers.length;d<e;d++)this.drawMarker(this.markers[d]);this.drawn=!0}},addMarker:function(a){this.markers.push(a);1>this.opacity&&a.setOpacity(this.opacity);this.map&&this.map.getExtent()&&(a.map=this.map,this.drawMarker(a))},removeMarker:function(a){this.markers&&this.markers.length&&(OpenLayers.Util.removeItem(this.markers,a),a.erase())},clearMarkers:function(){if(null!=this.markers)for(;0<this.markers.length;)this.removeMarker(this.markers[0])},
-drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);null==b?a.display(!1):a.isDrawn()?a.icon&&a.icon.moveTo(b):(a=a.draw(b),this.div.appendChild(a))},getDataExtent:function(){var a=null;if(this.markers&&0<this.markers.length)for(var a=new OpenLayers.Bounds,b=0,c=this.markers.length;b<c;b++)a.extend(this.markers[b].lonlat);return a},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Strategy.BBOX=OpenLayers.Class(OpenLayers.Strategy,{bounds:null,resolution:null,ratio:2,resFactor:null,response:null,activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);a&&(this.layer.events.on({moveend:this.update,refresh:this.update,visibilitychanged:this.update,scope:this}),this.update());return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);a&&this.layer.events.un({moveend:this.update,refresh:this.update,visibilitychanged:this.update,
-scope:this});return a},update:function(a){var b=this.getMapBounds();if(null!==b&&(a&&a.force||this.layer.visibility&&this.layer.calculateInRange()&&this.invalidBounds(b)))this.calculateBounds(b),this.resolution=this.layer.map.getResolution(),this.triggerRead(a)},getMapBounds:function(){if(null===this.layer.map)return null;var a=this.layer.map.getExtent();a&&!this.layer.projection.equals(this.layer.map.getProjectionObject())&&(a=a.clone().transform(this.layer.map.getProjectionObject(),this.layer.projection));
-return a},invalidBounds:function(a){a||(a=this.getMapBounds());a=!this.bounds||!this.bounds.containsBounds(a);!a&&this.resFactor&&(a=this.resolution/this.layer.map.getResolution(),a=a>=this.resFactor||a<=1/this.resFactor);return a},calculateBounds:function(a){a||(a=this.getMapBounds());var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio;a=a.getHeight()*this.ratio;this.bounds=new OpenLayers.Bounds(b.lon-c/2,b.lat-a/2,b.lon+c/2,b.lat+a/2)},triggerRead:function(a){this.response&&!(a&&!0===a.noAbort)&&
-(this.layer.protocol.abort(this.response),this.layer.events.triggerEvent("loadend"));var b={filter:this.createFilter()};this.layer.events.triggerEvent("loadstart",b);this.response=this.layer.protocol.read(OpenLayers.Util.applyDefaults({filter:b.filter,callback:this.merge,scope:this},a))},createFilter:function(){var a=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,value:this.bounds,projection:this.layer.projection});this.layer.filter&&(a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,
-filters:[this.layer.filter,a]}));return a},merge:function(a){this.layer.destroyFeatures();if(a.success()){var b=a.features;if(b&&0<b.length){var c=this.layer.projection,d=this.layer.map.getProjectionObject();if(!d.equals(c))for(var e,f=0,g=b.length;f<g;++f)(e=b[f].geometry)&&e.transform(c,d);this.layer.addFeatures(b)}}else this.bounds=null;this.response=null;this.layer.events.triggerEvent("loadend",{response:a})},CLASS_NAME:"OpenLayers.Strategy.BBOX"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{"in":"click",out:"clickout"},mousemove:{"in":"over",out:"out"},dblclick:{"in":"dblclick",out:null},mousedown:{"in":null,out:null},mouseup:{"in":null,out:null},touchstart:{"in":"click",out:"clickout"}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:!0,stopDown:!0,stopUp:!1,initialize:function(a,b,c,d){OpenLayers.Handler.prototype.initialize.apply(this,[a,c,d]);this.layer=
+a===this.zoomInLink?this.map.zoomIn():a===this.zoomOutLink&&this.map.zoomOut()},destroy:function(){this.map&&this.map.events.unregister("buttonclick",this,this.onZoomClick);delete this.zoomInLink;delete this.zoomOutLink;OpenLayers.Control.prototype.destroy.apply(this)},CLASS_NAME:"OpenLayers.Control.Zoom"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{"in":"click",out:"clickout"},mousemove:{"in":"over",out:"out"},dblclick:{"in":"dblclick",out:null},mousedown:{"in":null,out:null},mouseup:{"in":null,out:null},touchstart:{"in":"click",out:"clickout"}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:!0,stopDown:!0,stopUp:!1,initialize:function(a,b,c,d){OpenLayers.Handler.prototype.initialize.apply(this,[a,c,d]);this.layer=
 b},touchstart:function(a){this.startTouch();return OpenLayers.Event.isMultiTouch(a)?!0:this.mousedown(a)},touchmove:function(a){OpenLayers.Event.preventDefault(a)},mousedown:function(a){if(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))this.down=a.xy;return this.handle(a)?!this.stopDown:!0},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:!0},click:function(a){return this.handle(a)?!this.stopClick:!0},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out)return!0;
 this.handle(a);return!0},dblclick:function(a){return!this.handle(a)},geometryTypeMatches:function(a){return null==this.geometryTypes||-1<OpenLayers.Util.indexOf(this.geometryTypes,a.geometry.CLASS_NAME)},handle:function(a){this.feature&&!this.feature.layer&&(this.feature=null);var b=a.type,c=!1,d=!!this.feature,e="click"==b||"dblclick"==b||"touchstart"==b;if((this.feature=this.layer.getFeatureFromEvent(a))&&!this.feature.layer)this.feature=null;this.lastFeature&&!this.lastFeature.layer&&(this.lastFeature=
 null);this.feature?("touchstart"===b&&OpenLayers.Event.preventDefault(a),a=this.feature!=this.lastFeature,this.geometryTypeMatches(this.feature)?(d&&a?(this.lastFeature&&this.triggerCallback(b,"out",[this.lastFeature]),this.triggerCallback(b,"in",[this.feature])):(!d||e)&&this.triggerCallback(b,"in",[this.feature]),this.lastFeature=this.feature,c=!0):(this.lastFeature&&(d&&a||e)&&this.triggerCallback(b,"out",[this.lastFeature]),this.feature=null)):this.lastFeature&&(d||e)&&this.triggerCallback(b,
 "out",[this.lastFeature]);return c},triggerCallback:function(a,b,c){if(b=this.EVENTMAP[a][b])"click"==a&&this.up&&this.down?(Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2))<=this.clickTolerance&&this.callback(b,c),this.up=this.down=null):this.callback(b,c)},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.moveLayerToTop(),this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),
 a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.moveLayerBack(),this.up=this.down=this.lastFeature=this.feature=null,this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),a=!0);return a},handleMapEvents:function(a){("removelayer"==a.type||"order"==a.property)&&this.moveLayerToTop()},moveLayerToTop:function(){var a=Math.max(this.map.Z_INDEX_BASE.Feature-1,this.layer.getZIndex())+1;this.layer.setZIndex(a)},
 b},touchstart:function(a){this.startTouch();return OpenLayers.Event.isMultiTouch(a)?!0:this.mousedown(a)},touchmove:function(a){OpenLayers.Event.preventDefault(a)},mousedown:function(a){if(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))this.down=a.xy;return this.handle(a)?!this.stopDown:!0},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:!0},click:function(a){return this.handle(a)?!this.stopClick:!0},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out)return!0;
 this.handle(a);return!0},dblclick:function(a){return!this.handle(a)},geometryTypeMatches:function(a){return null==this.geometryTypes||-1<OpenLayers.Util.indexOf(this.geometryTypes,a.geometry.CLASS_NAME)},handle:function(a){this.feature&&!this.feature.layer&&(this.feature=null);var b=a.type,c=!1,d=!!this.feature,e="click"==b||"dblclick"==b||"touchstart"==b;if((this.feature=this.layer.getFeatureFromEvent(a))&&!this.feature.layer)this.feature=null;this.lastFeature&&!this.lastFeature.layer&&(this.lastFeature=
 null);this.feature?("touchstart"===b&&OpenLayers.Event.preventDefault(a),a=this.feature!=this.lastFeature,this.geometryTypeMatches(this.feature)?(d&&a?(this.lastFeature&&this.triggerCallback(b,"out",[this.lastFeature]),this.triggerCallback(b,"in",[this.feature])):(!d||e)&&this.triggerCallback(b,"in",[this.feature]),this.lastFeature=this.feature,c=!0):(this.lastFeature&&(d&&a||e)&&this.triggerCallback(b,"out",[this.lastFeature]),this.feature=null)):this.lastFeature&&(d||e)&&this.triggerCallback(b,
 "out",[this.lastFeature]);return c},triggerCallback:function(a,b,c){if(b=this.EVENTMAP[a][b])"click"==a&&this.up&&this.down?(Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2))<=this.clickTolerance&&this.callback(b,c),this.up=this.down=null):this.callback(b,c)},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.moveLayerToTop(),this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),
 a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.moveLayerBack(),this.up=this.down=this.lastFeature=this.feature=null,this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),a=!0);return a},handleMapEvents:function(a){("removelayer"==a.type||"order"==a.property)&&this.moveLayerToTop()},moveLayerToTop:function(){var a=Math.max(this.map.Z_INDEX_BASE.Feature-1,this.layer.getZIndex())+1;this.layer.setZIndex(a)},
-moveLayerBack:function(){var a=this.layer.getZIndex()-1;a>=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(a):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:!0,initialize:function(a,b){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style.select),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style.temporary),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(a instanceof OpenLayers.Style)this.styles["default"]=a,this.styles.select=a,this.styles.temporary=a,this.styles["delete"]=
-a;else if("object"==typeof a)for(var c in a)if(a[c]instanceof OpenLayers.Style)this.styles[c]=a[c];else if("object"==typeof a[c])this.styles[c]=new OpenLayers.Style(a[c]);else{this.styles["default"]=new OpenLayers.Style(a);this.styles.select=new OpenLayers.Style(a);this.styles.temporary=new OpenLayers.Style(a);this.styles["delete"]=new OpenLayers.Style(a);break}OpenLayers.Util.extend(this,b)},destroy:function(){for(var a in this.styles)this.styles[a].destroy();this.styles=null},createSymbolizer:function(a,
-b){a||(a=new OpenLayers.Feature.Vector);this.styles[b]||(b="default");a.renderIntent=b;var c={};this.extendDefault&&"default"!=b&&(c=this.styles["default"].createSymbolizer(a));return OpenLayers.Util.extend(c,this.styles[b].createSymbolizer(a))},addUniqueValueRules:function(a,b,c,d){var e=[],f;for(f in c)e.push(new OpenLayers.Rule({symbolizer:c[f],context:d,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:b,value:f})}));this.styles[a].addRules(e)},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,isFixed:!1,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:!0,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:!1,ratio:1,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);(!this.renderer||!this.renderer.supported())&&this.assignRenderer();if(!this.renderer||
+moveLayerBack:function(){var a=this.layer.getZIndex()-1;a>=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(a):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:1,alwaysInRange:null,RESOLUTION_PROPERTIES:"scales resolutions maxScale minScale maxResolution minResolution numZoomLevels maxZoomLevel".split(" "),events:null,map:null,isBaseLayer:!1,alpha:!1,displayInLayerSwitcher:!0,visibility:!0,attribution:null,inRange:!1,imageSize:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,
+numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:!1,wrapDateLine:!1,metadata:null,initialize:function(a,b){this.metadata={};b=OpenLayers.Util.extend({},b);null!=this.alwaysInRange&&(b.alwaysInRange=this.alwaysInRange);this.addOptions(b);this.name=a;if(null==this.id&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"),this.div=OpenLayers.Util.createDiv(this.id),this.div.style.width="100%",this.div.style.height="100%",this.div.dir="ltr",this.events=new OpenLayers.Events(this,
+this.div),this.eventListeners instanceof Object))this.events.on(this.eventListeners)},destroy:function(a){null==a&&(a=!0);null!=this.map&&this.map.removeLayer(this,a);this.options=this.div=this.name=this.map=this.projection=null;this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy());this.events=this.eventListeners=null},clone:function(a){null==a&&(a=new OpenLayers.Layer(this.name,this.getOptions()));OpenLayers.Util.applyDefaults(a,this);a.map=null;return a},
+getOptions:function(){var a={},b;for(b in this.options)a[b]=this[b];return a},setName:function(a){a!=this.name&&(this.name=a,null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"name"}))},addOptions:function(a,b){null==this.options&&(this.options={});a&&("string"==typeof a.projection&&(a.projection=new OpenLayers.Projection(a.projection)),a.projection&&OpenLayers.Util.applyDefaults(a,OpenLayers.Projection.defaults[a.projection.getCode()]),a.maxExtent&&!(a.maxExtent instanceof
+OpenLayers.Bounds)&&(a.maxExtent=new OpenLayers.Bounds(a.maxExtent)),a.minExtent&&!(a.minExtent instanceof OpenLayers.Bounds)&&(a.minExtent=new OpenLayers.Bounds(a.minExtent)));OpenLayers.Util.extend(this.options,a);OpenLayers.Util.extend(this,a);this.projection&&this.projection.getUnits()&&(this.units=this.projection.getUnits());if(this.map){var c=this.map.getResolution(),d=this.RESOLUTION_PROPERTIES.concat(["projection","units","minExtent","maxExtent"]),e;for(e in a)if(a.hasOwnProperty(e)&&0<=OpenLayers.Util.indexOf(d,
+e)){this.initResolutions();b&&this.map.baseLayer===this&&(this.map.setCenter(this.map.getCenter(),this.map.getZoomForResolution(c),!1,!0),this.map.events.triggerEvent("changebaselayer",{layer:this}));break}}},onMapResize:function(){},redraw:function(){var a=!1;if(this.map){this.inRange=this.calculateInRange();var b=this.getExtent();b&&(this.inRange&&this.visibility)&&(this.moveTo(b,!0,!1),this.events.triggerEvent("moveend",{zoomChanged:!0}),a=!0)}return a},moveTo:function(a,b,c){a=this.visibility;
+this.isBaseLayer||(a=a&&this.inRange);this.display(a)},moveByPx:function(a,b){},setMap:function(a){null==this.map&&(this.map=a,this.maxExtent=this.maxExtent||this.map.maxExtent,this.minExtent=this.minExtent||this.map.minExtent,this.projection=this.projection||this.map.projection,"string"==typeof this.projection&&(this.projection=new OpenLayers.Projection(this.projection)),this.projection&&this.projection.getUnits()?this.units=this.projection.getUnits():this.units=this.units||this.map.units,this.initResolutions(),
+this.isBaseLayer||(this.inRange=this.calculateInRange(),this.div.style.display=this.visibility&&this.inRange?"":"none"),this.setTileSize())},afterAdd:function(){},removeMap:function(a){},getImageSize:function(a){return this.imageSize||this.tileSize},setTileSize:function(a){this.tileSize=a=a?a:this.tileSize?this.tileSize:this.map.getTileSize();this.gutter&&(this.imageSize=new OpenLayers.Size(a.w+2*this.gutter,a.h+2*this.gutter))},getVisibility:function(){return this.visibility},setVisibility:function(a){a!=
+this.visibility&&(this.visibility=a,this.display(a),this.redraw(),null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"}),this.events.triggerEvent("visibilitychanged"))},display:function(a){a!=("none"!=this.div.style.display)&&(this.div.style.display=a&&this.calculateInRange()?"block":"none")},calculateInRange:function(){var a=!1;this.alwaysInRange?a=!0:this.map&&(a=this.map.getResolution(),a=a>=this.minResolution&&a<=this.maxResolution);return a},setIsBaseLayer:function(a){a!=
+this.isBaseLayer&&(this.isBaseLayer=a,null!=this.map&&this.map.events.triggerEvent("changebaselayer",{layer:this}))},initResolutions:function(){var a,b,c,d={},e=!0;a=0;for(b=this.RESOLUTION_PROPERTIES.length;a<b;a++)c=this.RESOLUTION_PROPERTIES[a],d[c]=this.options[c],e&&this.options[c]&&(e=!1);null==this.options.alwaysInRange&&(this.alwaysInRange=e);null==d.resolutions&&(d.resolutions=this.resolutionsFromScales(d.scales));null==d.resolutions&&(d.resolutions=this.calculateResolutions(d));if(null==
+d.resolutions){a=0;for(b=this.RESOLUTION_PROPERTIES.length;a<b;a++)c=this.RESOLUTION_PROPERTIES[a],d[c]=null!=this.options[c]?this.options[c]:this.map[c];null==d.resolutions&&(d.resolutions=this.resolutionsFromScales(d.scales));null==d.resolutions&&(d.resolutions=this.calculateResolutions(d))}var f;this.options.maxResolution&&"auto"!==this.options.maxResolution&&(f=this.options.maxResolution);this.options.minScale&&(f=OpenLayers.Util.getResolutionFromScale(this.options.minScale,this.units));var g;
+this.options.minResolution&&"auto"!==this.options.minResolution&&(g=this.options.minResolution);this.options.maxScale&&(g=OpenLayers.Util.getResolutionFromScale(this.options.maxScale,this.units));d.resolutions&&(d.resolutions.sort(function(a,b){return b-a}),f||(f=d.resolutions[0]),g||(g=d.resolutions[d.resolutions.length-1]));if(this.resolutions=d.resolutions){b=this.resolutions.length;this.scales=Array(b);for(a=0;a<b;a++)this.scales[a]=OpenLayers.Util.getScaleFromResolution(this.resolutions[a],this.units);
+this.numZoomLevels=b}if(this.minResolution=g)this.maxScale=OpenLayers.Util.getScaleFromResolution(g,this.units);if(this.maxResolution=f)this.minScale=OpenLayers.Util.getScaleFromResolution(f,this.units)},resolutionsFromScales:function(a){if(null!=a){var b,c,d;d=a.length;b=Array(d);for(c=0;c<d;c++)b[c]=OpenLayers.Util.getResolutionFromScale(a[c],this.units);return b}},calculateResolutions:function(a){var b,c,d=a.maxResolution;null!=a.minScale?d=OpenLayers.Util.getResolutionFromScale(a.minScale,this.units):
+"auto"==d&&null!=this.maxExtent&&(b=this.map.getSize(),c=this.maxExtent.getWidth()/b.w,b=this.maxExtent.getHeight()/b.h,d=Math.max(c,b));c=a.minResolution;null!=a.maxScale?c=OpenLayers.Util.getResolutionFromScale(a.maxScale,this.units):"auto"==a.minResolution&&null!=this.minExtent&&(b=this.map.getSize(),c=this.minExtent.getWidth()/b.w,b=this.minExtent.getHeight()/b.h,c=Math.max(c,b));"number"!==typeof d&&("number"!==typeof c&&null!=this.maxExtent)&&(d=this.map.getTileSize(),d=Math.max(this.maxExtent.getWidth()/
+d.w,this.maxExtent.getHeight()/d.h));b=a.maxZoomLevel;a=a.numZoomLevels;"number"===typeof c&&"number"===typeof d&&void 0===a?a=Math.floor(Math.log(d/c)/Math.log(2))+1:void 0===a&&null!=b&&(a=b+1);if(!("number"!==typeof a||0>=a||"number"!==typeof d&&"number"!==typeof c)){b=Array(a);var e=2;"number"==typeof c&&"number"==typeof d&&(e=Math.pow(d/c,1/(a-1)));var f;if("number"===typeof d)for(f=0;f<a;f++)b[f]=d/Math.pow(e,f);else for(f=0;f<a;f++)b[a-1-f]=c*Math.pow(e,f);return b}},getResolution:function(){var a=
+this.map.getZoom();return this.getResolutionForZoom(a)},getExtent:function(){return this.map.calculateBounds()},getZoomForExtent:function(a,b){var c=this.map.getSize(),c=Math.max(a.getWidth()/c.w,a.getHeight()/c.h);return this.getZoomForResolution(c,b)},getDataExtent:function(){},getResolutionForZoom:function(a){a=Math.max(0,Math.min(a,this.resolutions.length-1));if(this.map.fractionalZoom){var b=Math.floor(a),c=Math.ceil(a);a=this.resolutions[b]-(a-b)*(this.resolutions[b]-this.resolutions[c])}else a=
+this.resolutions[Math.round(a)];return a},getZoomForResolution:function(a,b){var c,d;if(this.map.fractionalZoom){var e=0,f=this.resolutions[e],g=this.resolutions[this.resolutions.length-1],h;c=0;for(d=this.resolutions.length;c<d;++c)if(h=this.resolutions[c],h>=a&&(f=h,e=c),h<=a){g=h;break}c=f-g;c=0<c?e+(f-a)/c:e}else{f=Number.POSITIVE_INFINITY;c=0;for(d=this.resolutions.length;c<d;c++)if(b){e=Math.abs(this.resolutions[c]-a);if(e>f)break;f=e}else if(this.resolutions[c]<a)break;c=Math.max(0,c-1)}return c},
+getLonLatFromViewPortPx:function(a){var b=null,c=this.map;if(null!=a&&c.minPx){var b=c.getResolution(),d=c.getMaxExtent({restricted:!0}),b=new OpenLayers.LonLat((a.x-c.minPx.x)*b+d.left,(c.minPx.y-a.y)*b+d.top);this.wrapDateLine&&(b=b.wrapDateLine(this.maxExtent))}return b},getViewPortPxFromLonLat:function(a,b){var c=null;null!=a&&(b=b||this.map.getResolution(),c=this.map.calculateBounds(null,b),c=new OpenLayers.Pixel(1/b*(a.lon-c.left),1/b*(c.top-a.lat)));return c},setOpacity:function(a){if(a!=this.opacity){this.opacity=
+a;for(var b=this.div.childNodes,c=0,d=b.length;c<d;++c){var e=b[c].firstChild||b[c],f=b[c].lastChild;f&&"iframe"===f.nodeName.toLowerCase()&&(e=f.parentNode);OpenLayers.Util.modifyDOMElement(e,null,null,null,null,null,null,a)}null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"})}},getZIndex:function(){return this.div.style.zIndex},setZIndex:function(a){this.div.style.zIndex=a},adjustBounds:function(a){if(this.gutter){var b=this.gutter*this.map.getResolution();
+a=new OpenLayers.Bounds(a.left-b,a.bottom-b,a.right+b,a.top+b)}this.wrapDateLine&&(b={rightTolerance:this.getResolution(),leftTolerance:this.getResolution()},a=a.wrapDateLine(this.maxExtent,b));return a},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:!1,size:null,resolution:null,map:null,featureDx:0,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a);OpenLayers.Util.extend(this,b)},destroy:function(){this.map=this.resolution=this.size=this.extent=this.container=null},supported:function(){return!1},setExtent:function(a,b){this.extent=a.clone();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var c=a.getWidth()/this.map.getExtent().getWidth();
+a=a.scale(1/c);this.extent=a.wrapDateLine(this.map.getMaxExtent()).scale(c)}b&&(this.resolution=null);return!0},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){return this.resolution=this.resolution||this.map.getResolution()},drawFeature:function(a,b){null==b&&(b=a.style);if(a.geometry){var c=a.geometry.getBounds();if(c){var d;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(d=this.map.getMaxExtent());c.intersectsBounds(this.extent,{worldBounds:d})?this.calculateFeatureDx(c,
+d):b={display:"none"};c=this.drawGeometry(a.geometry,b,a.id);if("none"!=b.display&&b.label&&!1!==c){d=a.geometry.getCentroid();if(b.labelXOffset||b.labelYOffset){var e=isNaN(b.labelXOffset)?0:b.labelXOffset,f=isNaN(b.labelYOffset)?0:b.labelYOffset,g=this.getResolution();d.move(e*g,f*g)}this.drawText(a.id,b,d)}else this.removeText(a.id);return c}}},calculateFeatureDx:function(a,b){this.featureDx=0;if(b){var c=b.getWidth();this.featureDx=Math.round(((a.left+a.right)/2-(this.extent.left+this.extent.right)/
+2)/c)*c}},drawGeometry:function(a,b,c){},drawText:function(a,b,c){},removeText:function(a){},clear:function(){},getFeatureIdFromEvent:function(a){},eraseFeatures:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0,c=a.length;b<c;++b){var d=a[b];this.eraseGeometry(d.geometry,d.id);this.removeText(d.id)}},eraseGeometry:function(a,b){},moveRoot:function(a){},getRenderLayerId:function(){return this.container.id},applyDefaultSymbolizer:function(a){var b=OpenLayers.Util.extend({},OpenLayers.Renderer.defaultSymbolizer);
+!1===a.stroke&&(delete b.strokeWidth,delete b.strokeColor);!1===a.fill&&delete b.fillColor;OpenLayers.Util.extend(b,a);return b},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Renderer.defaultSymbolizer={fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1,pointRadius:0,labelAlign:"cm"};
+OpenLayers.Renderer.symbol={star:[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],cross:[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],x:[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],square:[0,0,0,1,1,1,1,0,0,0],triangle:[0,10,10,10,5,0,0,10]};OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,isFixed:!1,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:!0,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:!1,ratio:1,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);(!this.renderer||!this.renderer.supported())&&this.assignRenderer();if(!this.renderer||
 !this.renderer.supported())this.renderer=null,this.displayError();this.styleMap||(this.styleMap=new OpenLayers.StyleMap);this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies)for(var c=0,d=this.strategies.length;c<d;c++)this.strategies[c].setLayer(this)},destroy:function(){if(this.strategies){var a,b,c;b=0;for(c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoDestroy&&a.destroy();this.strategies=null}this.protocol&&(this.protocol.autoDestroy&&this.protocol.destroy(),
 this.protocol=null);this.destroyFeatures();this.unrenderedFeatures=this.selectedFeatures=this.features=null;this.renderer&&this.renderer.destroy();this.drawn=this.geometryType=this.renderer=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Vector(this.name,this.getOptions()));a=OpenLayers.Layer.prototype.clone.apply(this,[a]);for(var b=this.features,c=b.length,d=Array(c),e=0;e<c;++e)d[e]=b[e].clone();a.features=d;return a},refresh:function(a){this.calculateInRange()&&
 this.visibility&&this.events.triggerEvent("refresh",a)},assignRenderer:function(){for(var a=0,b=this.renderers.length;a<b;a++){var c=this.renderers[a];if((c="function"==typeof c?c:OpenLayers.Renderer[c])&&c.prototype.supported()){this.renderer=new c(this.div,this.rendererOptions);break}}},displayError:function(){this.reportError&&OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,
 !this.renderer.supported())this.renderer=null,this.displayError();this.styleMap||(this.styleMap=new OpenLayers.StyleMap);this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies)for(var c=0,d=this.strategies.length;c<d;c++)this.strategies[c].setLayer(this)},destroy:function(){if(this.strategies){var a,b,c;b=0;for(c=this.strategies.length;b<c;b++)a=this.strategies[b],a.autoDestroy&&a.destroy();this.strategies=null}this.protocol&&(this.protocol.autoDestroy&&this.protocol.destroy(),
 this.protocol=null);this.destroyFeatures();this.unrenderedFeatures=this.selectedFeatures=this.features=null;this.renderer&&this.renderer.destroy();this.drawn=this.geometryType=this.renderer=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Vector(this.name,this.getOptions()));a=OpenLayers.Layer.prototype.clone.apply(this,[a]);for(var b=this.features,c=b.length,d=Array(c),e=0;e<c;++e)d[e]=b[e].clone();a.features=d;return a},refresh:function(a){this.calculateInRange()&&
 this.visibility&&this.events.triggerEvent("refresh",a)},assignRenderer:function(){for(var a=0,b=this.renderers.length;a<b;a++){var c=this.renderers[a];if((c="function"==typeof c?c:OpenLayers.Renderer[c])&&c.prototype.supported()){this.renderer=new c(this.div,this.rendererOptions);break}}},displayError:function(){this.reportError&&OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{renderers:this.renderers.join("\n")}))},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,
@@ -533,64 +489,30 @@ a.layer;this.hover&&(this.highlightOnly?this.highlight(a):-1==OpenLayers.Util.in
 this.onBeforeSelect.call(this.scope,a),c=a.layer;!1!==b&&(b=c.events.triggerEvent("beforefeatureselected",{feature:a}),!1!==b&&(c.selectedFeatures.push(a),this.highlight(a),this.handlers.feature.lastFeature||(this.handlers.feature.lastFeature=c.selectedFeatures[0]),c.events.triggerEvent("featureselected",{feature:a}),this.onSelect.call(this.scope,a)))},unselect:function(a){var b=a.layer;this.unhighlight(a);OpenLayers.Util.removeItem(b.selectedFeatures,a);b.events.triggerEvent("featureunselected",
 {feature:a});this.onUnselect.call(this.scope,a)},selectBox:function(a){if(a instanceof OpenLayers.Bounds){var b=this.map.getLonLatFromPixel({x:a.left,y:a.bottom});a=this.map.getLonLatFromPixel({x:a.right,y:a.top});b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat);this.multipleSelect()||this.unselectAll();a=this.multiple;this.multiple=!0;var c=this.layers||[this.layer];this.events.triggerEvent("boxselectionstart",{layers:c});for(var d,e=0;e<c.length;++e){d=c[e];for(var f=0,g=d.features.length;f<g;++f){var h=
 d.features[f];h.getVisibility()&&(null==this.geometryTypes||-1<OpenLayers.Util.indexOf(this.geometryTypes,h.geometry.CLASS_NAME))&&b.toGeometry().intersects(h.geometry)&&-1==OpenLayers.Util.indexOf(d.selectedFeatures,h)&&this.select(h)}}this.multiple=a;this.events.triggerEvent("boxselectionend",{layers:c})}},setMap:function(a){this.handlers.feature.setMap(a);this.box&&this.handlers.box.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},setLayer:function(a){var b=this.active;this.unselectAll();
 this.onBeforeSelect.call(this.scope,a),c=a.layer;!1!==b&&(b=c.events.triggerEvent("beforefeatureselected",{feature:a}),!1!==b&&(c.selectedFeatures.push(a),this.highlight(a),this.handlers.feature.lastFeature||(this.handlers.feature.lastFeature=c.selectedFeatures[0]),c.events.triggerEvent("featureselected",{feature:a}),this.onSelect.call(this.scope,a)))},unselect:function(a){var b=a.layer;this.unhighlight(a);OpenLayers.Util.removeItem(b.selectedFeatures,a);b.events.triggerEvent("featureunselected",
 {feature:a});this.onUnselect.call(this.scope,a)},selectBox:function(a){if(a instanceof OpenLayers.Bounds){var b=this.map.getLonLatFromPixel({x:a.left,y:a.bottom});a=this.map.getLonLatFromPixel({x:a.right,y:a.top});b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat);this.multipleSelect()||this.unselectAll();a=this.multiple;this.multiple=!0;var c=this.layers||[this.layer];this.events.triggerEvent("boxselectionstart",{layers:c});for(var d,e=0;e<c.length;++e){d=c[e];for(var f=0,g=d.features.length;f<g;++f){var h=
 d.features[f];h.getVisibility()&&(null==this.geometryTypes||-1<OpenLayers.Util.indexOf(this.geometryTypes,h.geometry.CLASS_NAME))&&b.toGeometry().intersects(h.geometry)&&-1==OpenLayers.Util.indexOf(d.selectedFeatures,h)&&this.select(h)}}this.multiple=a;this.events.triggerEvent("boxselectionend",{layers:c})}},setMap:function(a){this.handlers.feature.setMap(a);this.box&&this.handlers.box.setMap(a);OpenLayers.Control.prototype.setMap.apply(this,arguments)},setLayer:function(a){var b=this.active;this.unselectAll();
-this.deactivate();this.layers&&(this.layer.destroy(),this.layers=null);this.initLayer(a);this.handlers.feature.layer=this.layer;b&&this.activate()},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",template:"${layers}",destroy:function(){this.map.events.un({removelayer:this.updateAttribution,addlayer:this.updateAttribution,changelayer:this.updateAttribution,changebaselayer:this.updateAttribution,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({changebaselayer:this.updateAttribution,changelayer:this.updateAttribution,
-addlayer:this.updateAttribution,removelayer:this.updateAttribution,scope:this});this.updateAttribution();return this.div},updateAttribution:function(){var a=[];if(this.map&&this.map.layers){for(var b=0,c=this.map.layers.length;b<c;b++){var d=this.map.layers[b];d.attribution&&d.getVisibility()&&-1===OpenLayers.Util.indexOf(a,d.attribution)&&a.push(d.attribution)}this.div.innerHTML=OpenLayers.String.format(this.template,{layers:a.join(this.separator)})}},CLASS_NAME:"OpenLayers.Control.Attribution"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!0,dragging:!1,last:null,start:null,lastMoveEvt:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:!1,documentEvents:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(!0===this.documentDrag){var d=this;this._docMove=function(a){d.mousemove({xy:{x:a.clientX,y:a.clientY},element:document})};this._docUp=function(a){d.mouseup({xy:{x:a.clientX,y:a.clientY}})}}},
-dragstart:function(a){var b=!0;this.dragging=!1;this.checkModifiers(a)&&(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))?(this.started=!0,this.last=this.start=a.xy,OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown"),this.down(a),this.callback("down",[a.xy]),OpenLayers.Event.preventDefault(a),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart?document.onselectstart:OpenLayers.Function.True),document.onselectstart=OpenLayers.Function.False,b=!this.stopDown):
-(this.started=!1,this.last=this.start=null);return b},dragmove:function(a){this.lastMoveEvt=a;if(this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y))!0===this.documentDrag&&this.documentEvents&&(a.element===document?(this.adjustXY(a),this.setEvent(a)):this.removeDocumentEvents()),0<this.interval&&(this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)),this.dragging=!0,this.move(a),this.callback("move",[a.xy]),this.oldOnselectstart||(this.oldOnselectstart=
-document.onselectstart,document.onselectstart=OpenLayers.Function.False),this.last=a.xy;return!0},dragend:function(a){if(this.started){!0===this.documentDrag&&this.documentEvents&&(this.adjustXY(a),this.removeDocumentEvents());var b=this.start!=this.last;this.dragging=this.started=!1;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(a);this.callback("up",[a.xy]);b&&this.callback("done",[a.xy]);document.onselectstart=this.oldOnselectstart}return!0},down:function(a){},move:function(a){},
-up:function(a){},out:function(a){},mousedown:function(a){return this.dragstart(a)},touchstart:function(a){this.startTouch();return this.dragstart(a)},mousemove:function(a){return this.dragmove(a)},touchmove:function(a){return this.dragmove(a)},removeTimeout:function(){this.timeoutId=null;this.dragging&&this.mousemove(this.lastMoveEvt)},mouseup:function(a){return this.dragend(a)},touchend:function(a){a.xy=this.last;return this.dragend(a)},mouseout:function(a){if(this.started&&OpenLayers.Util.mouseLeft(a,
-this.map.viewPortDiv))if(!0===this.documentDrag)this.addDocumentEvents();else{var b=this.start!=this.last;this.dragging=this.started=!1;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(a);this.callback("out",[]);b&&this.callback("done",[a.xy]);document.onselectstart&&(document.onselectstart=this.oldOnselectstart)}return!0},click:function(a){return this.start==this.last},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.dragging=
-!1,a=!0);return a},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.dragging=this.started=!1,this.last=this.start=null,a=!0,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown"));return a},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.viewPortDiv);a.xy.x-=b[0];a.xy.y-=b[1]},addDocumentEvents:function(){OpenLayers.Element.addClass(document.body,"olDragDown");this.documentEvents=!0;OpenLayers.Event.observe(document,"mousemove",
-this._docMove);OpenLayers.Event.observe(document,"mouseup",this._docUp)},removeDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents=!1;OpenLayers.Event.stopObserving(document,"mousemove",this._docMove);OpenLayers.Event.stopObserving(document,"mouseup",this._docUp)},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxOffsets:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.dragHandler=new OpenLayers.Handler.Drag(this,{down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox},{keyMask:this.keyMask})},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.dragHandler&&(this.dragHandler.destroy(),this.dragHandler=
-null)},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);this.dragHandler&&this.dragHandler.setMap(a)},startBox:function(a){this.callback("start",[]);this.zoomBox=OpenLayers.Util.createDiv("zoomBox",{x:-9999,y:-9999});this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(a){var b=this.dragHandler.start.x,
-c=this.dragHandler.start.y,d=Math.abs(b-a.x),e=Math.abs(c-a.y),f=this.getBoxOffsets();this.zoomBox.style.width=d+f.width+1+"px";this.zoomBox.style.height=e+f.height+1+"px";this.zoomBox.style.left=(a.x<b?b-d-f.left:b-f.left)+"px";this.zoomBox.style.top=(a.y<c?c-e-f.top:c-f.top)+"px"},endBox:function(a){var b;if(5<Math.abs(this.dragHandler.start.x-a.x)||5<Math.abs(this.dragHandler.start.y-a.y)){var c=this.dragHandler.start;b=Math.min(c.y,a.y);var d=Math.max(c.y,a.y),e=Math.min(c.x,a.x);a=Math.max(c.x,
-a.x);b=new OpenLayers.Bounds(e,d,a,b)}else b=this.dragHandler.start.clone();this.removeBox();this.callback("done",[b])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.boxOffsets=this.zoomBox=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){return OpenLayers.Handler.prototype.activate.apply(this,arguments)?(this.dragHandler.activate(),!0):!1},deactivate:function(){return OpenLayers.Handler.prototype.deactivate.apply(this,arguments)?
-(this.dragHandler.deactivate()&&this.zoomBox&&this.removeBox(),!0):!1},getBoxOffsets:function(){if(!this.boxOffsets){var a=document.createElement("div");a.style.position="absolute";a.style.border="1px solid black";a.style.width="3px";document.body.appendChild(a);var b=3==a.clientWidth;document.body.removeChild(a);var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width")),c=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width")),d=parseInt(OpenLayers.Element.getStyle(this.zoomBox,
-"border-top-width")),e=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"));this.boxOffsets={left:a,right:c,top:d,bottom:e,width:!1===b?a+c:0,height:!1===b?d+e:0}}return this.boxOffsets},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:!1,keyMask:null,alwaysZoom:!1,zoomOnClick:!0,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask})},zoomBox:function(a){if(a instanceof OpenLayers.Bounds){var b,c=a.getCenterPixel();if(this.out){b=Math.min(this.map.size.h/(a.bottom-a.top),this.map.size.w/(a.right-a.left));var d=this.map.getExtent(),e=this.map.getLonLatFromPixel(c),f=e.lon-d.getWidth()/
-2*b;a=e.lon+d.getWidth()/2*b;var g=e.lat-d.getHeight()/2*b;b=e.lat+d.getHeight()/2*b;b=new OpenLayers.Bounds(f,g,a,b)}else f=this.map.getLonLatFromPixel({x:a.left,y:a.bottom}),a=this.map.getLonLatFromPixel({x:a.right,y:a.top}),b=new OpenLayers.Bounds(f.lon,f.lat,a.lon,a.lat);f=this.map.getZoom();g=this.map.getSize();a=g.w/2;g=g.h/2;b=this.map.getZoomForExtent(b);d=this.map.getResolution();e=this.map.getResolutionForZoom(b);d==e?this.map.setCenter(this.map.getLonLatFromPixel(c)):this.map.zoomTo(b,
-{x:(d*c.x-e*a)/(d-e),y:(d*c.y-e*g)/(d-e)});f==this.map.getZoom()&&!0==this.alwaysZoom&&this.map.zoomTo(f+(this.out?-1:1))}else this.zoomOnClick&&(this.out?this.map.zoomTo(this.map.getZoom()-1,a):this.map.zoomTo(this.map.getZoom()+1,a))},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:!1,interval:0,documentDrag:!1,kinetic:null,enableKinetic:!0,kineticInterval:10,draw:function(){if(this.enableKinetic&&OpenLayers.Kinetic){var a={interval:this.kineticInterval};"object"===typeof this.enableKinetic&&(a=OpenLayers.Util.extend(a,this.enableKinetic));this.kinetic=new OpenLayers.Kinetic(a)}this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone,down:this.panMapStart},
-{interval:this.interval,documentDrag:this.documentDrag})},panMapStart:function(){this.kinetic&&this.kinetic.begin()},panMap:function(a){this.kinetic&&this.kinetic.update(a);this.panned=!0;this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:!0,animate:!1})},panMapDone:function(a){if(this.panned){var b=null;this.kinetic&&(b=this.kinetic.end(a));this.map.pan(this.handler.last.x-a.x,this.handler.last.y-a.y,{dragging:!!b,animate:!1});if(b){var c=this;this.kinetic.move(b,function(a,b,
-f){c.map.pan(a,b,{dragging:!f,animate:!1})})}this.panned=!1}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:!0,"double":!1,pixelTolerance:0,dblclickTolerance:13,stopSingle:!1,stopDouble:!1,timerId:null,down:null,last:null,first:null,rightclickTimerId:null,touchstart:function(a){this.startTouch();this.down=this.getEventInfo(a);this.last=this.getEventInfo(a);return!0},touchmove:function(a){this.last=this.getEventInfo(a);return!0},touchend:function(a){this.down&&(a.xy=this.last.xy,a.lastTouches=this.last.touches,this.handleSingle(a),
-this.down=null);return!0},mousedown:function(a){this.down=this.getEventInfo(a);this.last=this.getEventInfo(a);return!0},mouseup:function(a){var b=!0;this.checkModifiers(a)&&(this.control.handleRightClicks&&OpenLayers.Event.isRightClick(a))&&(b=this.rightclick(a));return b},rightclick:function(a){if(this.passesTolerance(a)){if(null!=this.rightclickTimerId)return this.clearTimer(),this.callback("dblrightclick",[a]),!this.stopDouble;a=this["double"]?OpenLayers.Util.extend({},a):this.callback("rightclick",
-[a]);a=OpenLayers.Function.bind(this.delayedRightCall,this,a);this.rightclickTimerId=window.setTimeout(a,this.delay)}return!this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null;a&&this.callback("rightclick",[a])},click:function(a){this.last||(this.last=this.getEventInfo(a));this.handleSingle(a);return!this.stopSingle},dblclick:function(a){this.handleDouble(a);return!this.stopDouble},handleDouble:function(a){this.passesDblclickTolerance(a)&&(this["double"]&&this.callback("dblclick",
-[a]),this.clearTimer())},handleSingle:function(a){this.passesTolerance(a)&&(null!=this.timerId?(this.last.touches&&1===this.last.touches.length&&(this["double"]&&OpenLayers.Event.preventDefault(a),this.handleDouble(a)),(!this.last.touches||2!==this.last.touches.length)&&this.clearTimer()):(this.first=this.getEventInfo(a),a=this.single?OpenLayers.Util.extend({},a):null,this.queuePotentialClick(a)))},queuePotentialClick:function(a){this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,
-this,a),this.delay)},passesTolerance:function(a){var b=!0;if(null!=this.pixelTolerance&&this.down&&this.down.xy&&(b=this.pixelTolerance>=this.down.xy.distanceTo(a.xy))&&this.touch&&this.down.touches.length===this.last.touches.length){a=0;for(var c=this.down.touches.length;a<c;++a)if(this.getTouchDistance(this.down.touches[a],this.last.touches[a])>this.pixelTolerance){b=!1;break}}return b},getTouchDistance:function(a,b){return Math.sqrt(Math.pow(a.clientX-b.clientX,2)+Math.pow(a.clientY-b.clientY,
-2))},passesDblclickTolerance:function(a){a=!0;this.down&&this.first&&(a=this.down.xy.distanceTo(this.first.xy)<=this.dblclickTolerance);return a},clearTimer:function(){null!=this.timerId&&(window.clearTimeout(this.timerId),this.timerId=null);null!=this.rightclickTimerId&&(window.clearTimeout(this.rightclickTimerId),this.rightclickTimerId=null)},delayedCall:function(a){this.timerId=null;a&&this.callback("click",[a])},getEventInfo:function(a){var b;if(a.touches){var c=a.touches.length;b=Array(c);for(var d,
-e=0;e<c;e++)d=a.touches[e],b[e]={clientX:d.olClientX,clientY:d.olClientY}}return{xy:a.xy,touches:b}},deactivate:function(){var a=!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.clearTimer(),this.last=this.first=this.down=null,a=!0);return a},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,documentDrag:!1,zoomBox:null,zoomBoxEnabled:!0,zoomWheelEnabled:!0,mouseWheelOptions:null,handleRightClicks:!1,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,autoActivate:!0,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();this.dragPan&&this.dragPan.destroy();this.dragPan=null;
-this.zoomBox&&this.zoomBox.destroy();this.zoomBox=null;this.pinchZoom&&this.pinchZoom.destroy();this.pinchZoom=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){this.dragPan.activate();this.zoomWheelEnabled&&this.handlers.wheel.activate();this.handlers.click.activate();this.zoomBoxEnabled&&this.zoomBox.activate();this.pinchZoom&&this.pinchZoom.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.pinchZoom&&this.pinchZoom.deactivate();
-this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},draw:function(){this.handleRightClicks&&(this.map.viewPortDiv.oncontextmenu=OpenLayers.Function.False);this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.defaultClick,dblclick:this.defaultDblClick,dblrightclick:this.defaultDblRightClick},{"double":!0,stopDouble:!0});this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,
-documentDrag:this.documentDrag},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown},OpenLayers.Util.extend(this.map.fractionalZoom?{}:{cumulative:!1,interval:50,maxDelta:6},this.mouseWheelOptions));OpenLayers.Control.PinchZoom&&(this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},
-this.pinchZoomOptions)))},defaultClick:function(a){a.lastTouches&&2==a.lastTouches.length&&this.map.zoomOut()},defaultDblClick:function(a){this.map.zoomTo(this.map.zoom+1,a.xy)},defaultDblRightClick:function(a){this.map.zoomTo(this.map.zoom-1,a.xy)},wheelChange:function(a,b){this.map.fractionalZoom||(b=Math.round(b));var c=this.map.getZoom(),d;d=Math.max(c+b,0);d=Math.min(d,this.map.getNumZoomLevels());d!==c&&this.map.zoomTo(d,a.xy)},wheelUp:function(a,b){this.wheelChange(a,b||1)},wheelDown:function(a,
-b){this.wheelChange(a,b||-1)},disableZoomBox:function(){this.zoomBoxEnabled=!1;this.zoomBox.deactivate()},enableZoomBox:function(){this.zoomBoxEnabled=!0;this.active&&this.zoomBox.activate()},disableZoomWheel:function(){this.zoomWheelEnabled=!1;this.handlers.wheel.deactivate()},enableZoomWheel:function(){this.zoomWheelEnabled=!0;this.active&&this.handlers.wheel.activate()},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15E3,translationParameters:null,symbolMetrics:null,initialize:function(a){this.supported()&&(OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments),this.translationParameters={x:0,y:0},this.symbolMetrics={})},supported:function(){return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG",
-"1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))},inValidRange:function(a,b,c){a+=c?0:this.translationParameters.x;b+=c?0:this.translationParameters.y;return a>=-this.MAX_PIXEL&&a<=this.MAX_PIXEL&&b>=-this.MAX_PIXEL&&b<=this.MAX_PIXEL},setExtent:function(a,b){var c=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),d=this.getResolution(),e=-a.left/d,d=a.top/d;if(b)return this.left=e,this.top=d,this.rendererRoot.setAttributeNS(null,
-"viewBox","0 0 "+this.size.w+" "+this.size.h),this.translate(this.xOffset,0),!0;(e=this.translate(e-this.left+this.xOffset,d-this.top))||this.setExtent(a,!0);return c&&e},translate:function(a,b){if(this.inValidRange(a,b,!0)){var c="";if(a||b)c="translate("+a+","+b+")";this.root.setAttributeNS(null,"transform",c);this.translationParameters={x:a,y:b};return!0}return!1},setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);
-this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":c=b.externalGraphic?"image":this.isComplexSymbol(b.graphicName)?"svg":"circle";break;case "OpenLayers.Geometry.Rectangle":c="rect";break;case "OpenLayers.Geometry.LineString":c="polyline";break;case "OpenLayers.Geometry.LinearRing":c="polygon";break;case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":c="path"}return c},setStyle:function(a,
-b,c){b=b||a._style;c=c||a._options;var d=b.title||b.graphicTitle;if(d){a.setAttributeNS(null,"title",d);var e=a.getElementsByTagName("title");0<e.length?e[0].firstChild.textContent=d:(e=this.nodeFactory(null,"title"),e.textContent=d,a.appendChild(e))}var e=parseFloat(a.getAttributeNS(null,"r")),d=1,f;if("OpenLayers.Geometry.Point"==a._geometryClass&&e){a.style.visibility="";if(!1===b.graphic)a.style.visibility="hidden";else if(b.externalGraphic){f=this.getPosition(a);b.graphicWidth&&b.graphicHeight&&
-a.setAttributeNS(null,"preserveAspectRatio","none");var e=b.graphicWidth||b.graphicHeight,g=b.graphicHeight||b.graphicWidth,e=e?e:2*b.pointRadius,g=g?g:2*b.pointRadius,h=void 0!=b.graphicYOffset?b.graphicYOffset:-(0.5*g),k=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,"x",(f.x+(void 0!=b.graphicXOffset?b.graphicXOffset:-(0.5*e))).toFixed());a.setAttributeNS(null,"y",(f.y+h).toFixed());a.setAttributeNS(null,"width",e);a.setAttributeNS(null,"height",g);a.setAttributeNS(this.xlinkns,"xlink:href",
-b.externalGraphic);a.setAttributeNS(null,"style","opacity: "+k);a.onclick=OpenLayers.Event.preventDefault}else if(this.isComplexSymbol(b.graphicName)){var e=3*b.pointRadius,g=2*e,l=this.importSymbol(b.graphicName);f=this.getPosition(a);d=3*this.symbolMetrics[l.id][0]/g;h=a.parentNode;k=a.nextSibling;h&&h.removeChild(a);a.firstChild&&a.removeChild(a.firstChild);a.appendChild(l.firstChild.cloneNode(!0));a.setAttributeNS(null,"viewBox",l.getAttributeNS(null,"viewBox"));a.setAttributeNS(null,"width",
-g);a.setAttributeNS(null,"height",g);a.setAttributeNS(null,"x",f.x-e);a.setAttributeNS(null,"y",f.y-e);k?h.insertBefore(a,k):h&&h.appendChild(a)}else a.setAttributeNS(null,"r",b.pointRadius);e=b.rotation;if((void 0!==e||void 0!==a._rotation)&&f)a._rotation=e,e|=0,"svg"!==a.nodeName?a.setAttributeNS(null,"transform","rotate("+e+" "+f.x+" "+f.y+")"):(f=this.symbolMetrics[l.id],a.firstChild.setAttributeNS(null,"transform","rotate("+e+" "+f[1]+" "+f[2]+")"))}c.isFilled?(a.setAttributeNS(null,"fill",b.fillColor),
-a.setAttributeNS(null,"fill-opacity",b.fillOpacity)):a.setAttributeNS(null,"fill","none");c.isStroked?(a.setAttributeNS(null,"stroke",b.strokeColor),a.setAttributeNS(null,"stroke-opacity",b.strokeOpacity),a.setAttributeNS(null,"stroke-width",b.strokeWidth*d),a.setAttributeNS(null,"stroke-linecap",b.strokeLinecap||"round"),a.setAttributeNS(null,"stroke-linejoin","round"),b.strokeDashstyle&&a.setAttributeNS(null,"stroke-dasharray",this.dashStyle(b,d))):a.setAttributeNS(null,"stroke","none");b.pointerEvents&&
-a.setAttributeNS(null,"pointer-events",b.pointerEvents);null!=b.cursor&&a.setAttributeNS(null,"cursor",b.cursor);return a},dashStyle:function(a,b){var c=a.strokeWidth*b,d=a.strokeDashstyle;switch(d){case "solid":return"none";case "dot":return[1,4*c].join();case "dash":return[4*c,4*c].join();case "dashdot":return[4*c,4*c,1,4*c].join();case "longdash":return[8*c,4*c].join();case "longdashdot":return[8*c,4*c,1,4*c].join();default:return OpenLayers.String.trim(d).replace(/\s+/g,",")}},createNode:function(a,
-b){var c=document.createElementNS(this.xmlns,a);b&&c.setAttributeNS(null,"id",b);return c},nodeTypeCompare:function(a,b){return b==a.nodeName},createRenderRoot:function(){var a=this.nodeFactory(this.container.id+"_svgRoot","svg");a.style.display="block";return a},createRoot:function(a){return this.nodeFactory(this.container.id+a,"g")},createDefs:function(){var a=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(a);return a},drawPoint:function(a,b){return this.drawCircle(a,
-b,1)},drawCircle:function(a,b,c){var d=this.getResolution(),e=(b.x-this.featureDx)/d+this.left;b=this.top-b.y/d;return this.inValidRange(e,b)?(a.setAttributeNS(null,"cx",e),a.setAttributeNS(null,"cy",b),a.setAttributeNS(null,"r",c),a):!1},drawLineString:function(a,b){var c=this.getComponentsString(b.components);return c.path?(a.setAttributeNS(null,"points",c.path),c.complete?a:null):!1},drawLinearRing:function(a,b){var c=this.getComponentsString(b.components);return c.path?(a.setAttributeNS(null,
-"points",c.path),c.complete?a:null):!1},drawPolygon:function(a,b){for(var c="",d=!0,e=!0,f,g,h=0,k=b.components.length;h<k;h++)c+=" M",f=this.getComponentsString(b.components[h].components," "),(g=f.path)?(c+=" "+g,e=f.complete&&e):d=!1;return d?(a.setAttributeNS(null,"d",c+" z"),a.setAttributeNS(null,"fill-rule","evenodd"),e?a:null):!1},drawRectangle:function(a,b){var c=this.getResolution(),d=(b.x-this.featureDx)/c+this.left,e=this.top-b.y/c;return this.inValidRange(d,e)?(a.setAttributeNS(null,"x",
-d),a.setAttributeNS(null,"y",e),a.setAttributeNS(null,"width",b.width/c),a.setAttributeNS(null,"height",b.height/c),a):!1},drawText:function(a,b,c){var d=!!b.labelOutlineWidth;if(d){var e=OpenLayers.Util.extend({},b);e.fontColor=e.labelOutlineColor;e.fontStrokeColor=e.labelOutlineColor;e.fontStrokeWidth=b.labelOutlineWidth;b.labelOutlineOpacity&&(e.fontOpacity=b.labelOutlineOpacity);delete e.labelOutlineWidth;this.drawText(a,e,c)}var f=this.getResolution(),e=(c.x-this.featureDx)/f+this.left,g=c.y/
-f-this.top,d=d?this.LABEL_OUTLINE_SUFFIX:this.LABEL_ID_SUFFIX,f=this.nodeFactory(a+d,"text");f.setAttributeNS(null,"x",e);f.setAttributeNS(null,"y",-g);b.fontColor&&f.setAttributeNS(null,"fill",b.fontColor);b.fontStrokeColor&&f.setAttributeNS(null,"stroke",b.fontStrokeColor);b.fontStrokeWidth&&f.setAttributeNS(null,"stroke-width",b.fontStrokeWidth);b.fontOpacity&&f.setAttributeNS(null,"opacity",b.fontOpacity);b.fontFamily&&f.setAttributeNS(null,"font-family",b.fontFamily);b.fontSize&&f.setAttributeNS(null,
-"font-size",b.fontSize);b.fontWeight&&f.setAttributeNS(null,"font-weight",b.fontWeight);b.fontStyle&&f.setAttributeNS(null,"font-style",b.fontStyle);!0===b.labelSelect?(f.setAttributeNS(null,"pointer-events","visible"),f._featureId=a):f.setAttributeNS(null,"pointer-events","none");g=b.labelAlign||OpenLayers.Renderer.defaultSymbolizer.labelAlign;f.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[g[0]]||"middle");!0===OpenLayers.IS_GECKO&&f.setAttributeNS(null,"dominant-baseline",
-OpenLayers.Renderer.SVG.LABEL_ALIGN[g[1]]||"central");for(var h=b.label.split("\n"),k=h.length;f.childNodes.length>k;)f.removeChild(f.lastChild);for(var l=0;l<k;l++){var m=this.nodeFactory(a+d+"_tspan_"+l,"tspan");!0===b.labelSelect&&(m._featureId=a,m._geometry=c,m._geometryClass=c.CLASS_NAME);!1===OpenLayers.IS_GECKO&&m.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[g[1]]||"-35%");m.setAttribute("x",e);if(0==l){var r=OpenLayers.Renderer.SVG.LABEL_VFACTOR[g[1]];null==r&&
-(r=-0.5);m.setAttribute("dy",r*(k-1)+"em")}else m.setAttribute("dy","1em");m.textContent=""===h[l]?" ":h[l];m.parentNode||f.appendChild(m)}f.parentNode||this.textRoot.appendChild(f)},getComponentsString:function(a,b){for(var c=[],d=!0,e=a.length,f=[],g,h=0;h<e;h++)g=a[h],c.push(g),(g=this.getShortString(g))?f.push(g):(0<h&&this.getShortString(a[h-1])&&f.push(this.clipLine(a[h],a[h-1])),h<e-1&&this.getShortString(a[h+1])&&f.push(this.clipLine(a[h],a[h+1])),d=!1);return{path:f.join(b||","),complete:d}},
-clipLine:function(a,b){if(b.equals(a))return"";var c=this.getResolution(),d=this.MAX_PIXEL-this.translationParameters.x,e=this.MAX_PIXEL-this.translationParameters.y,f=(b.x-this.featureDx)/c+this.left,g=this.top-b.y/c,h=(a.x-this.featureDx)/c+this.left,c=this.top-a.y/c,k;if(h<-d||h>d)k=(c-g)/(h-f),h=0>h?-d:d,c=g+(h-f)*k;if(c<-e||c>e)k=(h-f)/(c-g),c=0>c?-e:e,h=f+(c-g)*k;return h+","+c},getShortString:function(a){var b=this.getResolution(),c=(a.x-this.featureDx)/b+this.left;a=this.top-a.y/b;return this.inValidRange(c,
-a)?c+","+a:!1},getPosition:function(a){return{x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))}},importSymbol:function(a){this.defs||(this.defs=this.createDefs());var b=this.container.id+"-"+a,c=document.getElementById(b);if(null!=c)return c;var d=OpenLayers.Renderer.symbol[a];if(!d)throw Error(a+" is not a valid symbol name");a=this.nodeFactory(b,"symbol");var e=this.nodeFactory(null,"polygon");a.appendChild(e);for(var c=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,
-0,0),f=[],g,h,k=0;k<d.length;k+=2)g=d[k],h=d[k+1],c.left=Math.min(c.left,g),c.bottom=Math.min(c.bottom,h),c.right=Math.max(c.right,g),c.top=Math.max(c.top,h),f.push(g,",",h);e.setAttributeNS(null,"points",f.join(" "));d=c.getWidth();e=c.getHeight();a.setAttributeNS(null,"viewBox",[c.left-d,c.bottom-e,3*d,3*e].join(" "));this.symbolMetrics[b]=[Math.max(d,e),c.getCenterLonLat().lon,c.getCenterLonLat().lat];this.defs.appendChild(a);return a},getFeatureIdFromEvent:function(a){var b=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,
-arguments);b||(b=a.target,b=b.parentNode&&b!=this.rendererRoot?b.parentNode._featureId:void 0);return b},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={l:"start",r:"end",b:"bottom",t:"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={t:"-70%",b:"0"};OpenLayers.Renderer.SVG.LABEL_VFACTOR={t:0,b:-1};OpenLayers.Renderer.SVG.preventDefault=function(a){OpenLayers.Event.preventDefault(a)};OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,buttons:null,position:null,initialize:function(a){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map&&this.map.events.unregister("buttonclick",this,this.onButtonClick);this.removeButtons();this.position=this.buttons=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},
-setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("buttonclick",this,this.onButtonClick)},draw:function(a){OpenLayers.Control.prototype.draw.apply(this,arguments);a=this.position;this.buttons=[];var b={w:18,h:18},c=new OpenLayers.Pixel(a.x+b.w/2,a.y);this._addButton("panup","north-mini.png",c,b);a.y=c.y+b.h;this._addButton("panleft","west-mini.png",a,b);this._addButton("panright","east-mini.png",a.add(b.w,0),b);this._addButton("pandown","south-mini.png",
-c.add(0,2*b.h),b);this._addButton("zoomin","zoom-plus-mini.png",c.add(0,3*b.h+5),b);this._addButton("zoomworld","zoom-world-mini.png",c.add(0,4*b.h+5),b);this._addButton("zoomout","zoom-minus-mini.png",c.add(0,5*b.h+5),b);return this.div},_addButton:function(a,b,c,d){b=OpenLayers.Util.getImageLocation(b);c=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+a,c,d,b,"absolute");c.style.cursor="pointer";this.div.appendChild(c);c.action=a;c.className="olButton";this.buttons.push(c);return c},_removeButton:function(a){this.div.removeChild(a);
-OpenLayers.Util.removeItem(this.buttons,a)},removeButtons:function(){for(var a=this.buttons.length-1;0<=a;--a)this._removeButton(this.buttons[a])},onButtonClick:function(a){switch(a.buttonElement.action){case "panup":this.map.pan(0,-this.getSlideFactor("h"));break;case "pandown":this.map.pan(0,this.getSlideFactor("h"));break;case "panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case "panright":this.map.pan(this.getSlideFactor("w"),0);break;case "zoomin":this.map.zoomIn();break;case "zoomout":this.map.zoomOut();
-break;case "zoomworld":this.map.zoomToMaxExtent()}},getSlideFactor:function(a){return this.slideRatio?this.map.getSize()[a]*this.slideRatio:this.slideFactor},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(a,b,c,d){this.url=a;this.size=b||{w:20,h:20};this.offset=c||{x:-(this.size.w/2),y:-(this.size.h/2)};this.calculateOffset=d;a=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(a)},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML="";this.imageDiv=null},clone:function(){return new OpenLayers.Icon(this.url,
-this.size,this.offset,this.calculateOffset)},setSize:function(a){null!=a&&(this.size=a);this.draw()},setUrl:function(a){null!=a&&(this.url=a);this.draw()},draw:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(a);return this.imageDiv},erase:function(){null!=this.imageDiv&&null!=this.imageDiv.parentNode&&OpenLayers.Element.remove(this.imageDiv)},setOpacity:function(a){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,null,null,
-null,null,null,a)},moveTo:function(a){null!=a&&(this.px=a);null!=this.imageDiv&&(null==this.px?this.display(!1):(this.calculateOffset&&(this.offset=this.calculateOffset(this.size)),OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,{x:this.px.x+this.offset.x,y:this.px.y+this.offset.y})))},display:function(a){this.imageDiv.style.display=a?"":"none"},isDrawn:function(){return this.imageDiv&&this.imageDiv.parentNode&&11!=this.imageDiv.parentNode.nodeType},CLASS_NAME:"OpenLayers.Icon"});OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(a,b){this.lonlat=a;var c=b?b:OpenLayers.Marker.defaultIcon();null==this.icon?this.icon=c:(this.icon.url=c.url,this.icon.size=c.size,this.icon.offset=c.offset,this.icon.calculateOffset=c.calculateOffset);this.events=new OpenLayers.Events(this,this.icon.imageDiv)},destroy:function(){this.erase();this.map=null;this.events.destroy();this.events=null;null!=this.icon&&(this.icon.destroy(),this.icon=null)},
-draw:function(a){return this.icon.draw(a)},erase:function(){null!=this.icon&&this.icon.erase()},moveTo:function(a){null!=a&&null!=this.icon&&this.icon.moveTo(a);this.lonlat=this.map.getLonLatFromLayerPx(a)},isDrawn:function(){return this.icon&&this.icon.isDrawn()},onScreen:function(){var a=!1;this.map&&(a=this.map.getExtent().containsLonLat(this.lonlat));return a},inflate:function(a){this.icon&&this.icon.setSize({w:this.icon.size.w*a,h:this.icon.size.h*a})},setOpacity:function(a){this.icon.setOpacity(a)},
-setUrl:function(a){this.icon.setUrl(a)},display:function(a){this.icon.display(a)},CLASS_NAME:"OpenLayers.Marker"});OpenLayers.Marker.defaultIcon=function(){return new OpenLayers.Icon(OpenLayers.Util.getImageLocation("marker.png"),{w:21,h:25},{x:-10.5,y:-25})};OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:!1,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:!1,fixPadding:function(){"number"==typeof this.padding&&(this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding))},panMapIfOutOfView:!1,
+this.deactivate();this.layers&&(this.layer.destroy(),this.layers=null);this.initLayer(a);this.handlers.feature.layer=this.layer;b&&this.activate()},addLayer:function(a){var b=this.active;this.deactivate();null==this.layers?null!=this.layer?(this.layers=[this.layer],this.layers.push(a)):this.layers=[a]:this.layers.push(a);this.initLayer(this.layers);this.handlers.feature.layer=this.layer;b&&this.activate()},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Format.JSON=OpenLayers.Class(OpenLayers.Format,{indent:"    ",space:" ",newline:"\n",level:0,pretty:!1,nativeJSON:function(){return!(!window.JSON||!("function"==typeof JSON.parse&&"function"==typeof JSON.stringify))}(),read:function(a,b){var c;if(this.nativeJSON)c=JSON.parse(a,b);else try{if(/^[\],:{}\s]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))&&(c=eval("("+a+")"),"function"===
+typeof b)){var d=function(a,c){if(c&&"object"===typeof c)for(var e in c)c.hasOwnProperty(e)&&(c[e]=d(e,c[e]));return b(a,c)};c=d("",c)}}catch(e){}this.keepData&&(this.data=c);return c},write:function(a,b){this.pretty=!!b;var c=null,d=typeof a;if(this.serialize[d])try{c=!this.pretty&&this.nativeJSON?JSON.stringify(a):this.serialize[d].apply(this,[a])}catch(e){OpenLayers.Console.error("Trouble serializing: "+e)}return c},writeIndent:function(){var a=[];if(this.pretty)for(var b=0;b<this.level;++b)a.push(this.indent);
+return a.join("")},writeNewline:function(){return this.pretty?this.newline:""},writeSpace:function(){return this.pretty?this.space:""},serialize:{object:function(a){if(null==a)return"null";if(a.constructor==Date)return this.serialize.date.apply(this,[a]);if(a.constructor==Array)return this.serialize.array.apply(this,[a]);var b=["{"];this.level+=1;var c,d,e,f=!1;for(c in a)a.hasOwnProperty(c)&&(d=OpenLayers.Format.JSON.prototype.write.apply(this,[c,this.pretty]),e=OpenLayers.Format.JSON.prototype.write.apply(this,
+[a[c],this.pretty]),null!=d&&null!=e&&(f&&b.push(","),b.push(this.writeNewline(),this.writeIndent(),d,":",this.writeSpace(),e),f=!0));this.level-=1;b.push(this.writeNewline(),this.writeIndent(),"}");return b.join("")},array:function(a){var b,c=["["];this.level+=1;for(var d=0,e=a.length;d<e;++d)b=OpenLayers.Format.JSON.prototype.write.apply(this,[a[d],this.pretty]),null!=b&&(0<d&&c.push(","),c.push(this.writeNewline(),this.writeIndent(),b));this.level-=1;c.push(this.writeNewline(),this.writeIndent(),
+"]");return c.join("")},string:function(a){var b={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return/["\\\x00-\x1f]/.test(a)?'"'+a.replace(/([\x00-\x1f\\"])/g,function(a,d){var e=b[d];if(e)return e;e=d.charCodeAt();return"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16)})+'"':'"'+a+'"'},number:function(a){return isFinite(a)?String(a):"null"},"boolean":function(a){return String(a)},date:function(a){function b(a){return 10>a?"0"+a:a}return'"'+a.getFullYear()+
+"-"+b(a.getMonth()+1)+"-"+b(a.getDate())+"T"+b(a.getHours())+":"+b(a.getMinutes())+":"+b(a.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Format.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{ignoreExtraDims:!1,read:function(a,b,c){b=b?b:"FeatureCollection";var d=null,e=null;if(e="string"==typeof a?OpenLayers.Format.JSON.prototype.read.apply(this,[a,c]):a)if("string"!=typeof e.type)OpenLayers.Console.error("Bad GeoJSON - no type: "+a);else{if(this.isValidType(e,b))switch(b){case "Geometry":try{d=this.parseGeometry(e)}catch(f){OpenLayers.Console.error(f)}break;case "Feature":try{d=this.parseFeature(e),d.type="Feature"}catch(g){OpenLayers.Console.error(g)}break;
+case "FeatureCollection":switch(d=[],e.type){case "Feature":try{d.push(this.parseFeature(e))}catch(h){d=null,OpenLayers.Console.error(h)}break;case "FeatureCollection":a=0;for(b=e.features.length;a<b;++a)try{d.push(this.parseFeature(e.features[a]))}catch(k){d=null,OpenLayers.Console.error(k)}break;default:try{var l=this.parseGeometry(e);d.push(new OpenLayers.Feature.Vector(l))}catch(m){d=null,OpenLayers.Console.error(m)}}}}else OpenLayers.Console.error("Bad JSON: "+a);return d},isValidType:function(a,
+b){var c=!1;switch(b){case "Geometry":-1==OpenLayers.Util.indexOf("Point MultiPoint LineString MultiLineString Polygon MultiPolygon Box GeometryCollection".split(" "),a.type)?OpenLayers.Console.error("Unsupported geometry type: "+a.type):c=!0;break;case "FeatureCollection":c=!0;break;default:a.type==b?c=!0:OpenLayers.Console.error("Cannot convert types from "+a.type+" to "+b)}return c},parseFeature:function(a){var b,c,d;c=a.properties?a.properties:{};d=a.geometry&&a.geometry.bbox||a.bbox;try{b=this.parseGeometry(a.geometry)}catch(e){throw e;
+}b=new OpenLayers.Feature.Vector(b,c);d&&(b.bounds=OpenLayers.Bounds.fromArray(d));a.id&&(b.fid=a.id);return b},parseGeometry:function(a){if(null==a)return null;var b,c=!1;if("GeometryCollection"==a.type){if(!OpenLayers.Util.isArray(a.geometries))throw"GeometryCollection must have geometries array: "+a;b=a.geometries.length;for(var c=Array(b),d=0;d<b;++d)c[d]=this.parseGeometry.apply(this,[a.geometries[d]]);b=new OpenLayers.Geometry.Collection(c);c=!0}else{if(!OpenLayers.Util.isArray(a.coordinates))throw"Geometry must have coordinates array: "+
+a;if(!this.parseCoords[a.type.toLowerCase()])throw"Unsupported geometry type: "+a.type;try{b=this.parseCoords[a.type.toLowerCase()].apply(this,[a.coordinates])}catch(e){throw e;}}this.internalProjection&&(this.externalProjection&&!c)&&b.transform(this.externalProjection,this.internalProjection);return b},parseCoords:{point:function(a){if(!1==this.ignoreExtraDims&&2!=a.length)throw"Only 2D points are supported: "+a;return new OpenLayers.Geometry.Point(a[0],a[1])},multipoint:function(a){for(var b=[],
+c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.point.apply(this,[a[d]])}catch(f){throw f;}b.push(c)}return new OpenLayers.Geometry.MultiPoint(b)},linestring:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.point.apply(this,[a[d]])}catch(f){throw f;}b.push(c)}return new OpenLayers.Geometry.LineString(b)},multilinestring:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.linestring.apply(this,[a[d]])}catch(f){throw f;}b.push(c)}return new OpenLayers.Geometry.MultiLineString(b)},
+polygon:function(a){for(var b=[],c,d,e=0,f=a.length;e<f;++e){try{d=this.parseCoords.linestring.apply(this,[a[e]])}catch(g){throw g;}c=new OpenLayers.Geometry.LinearRing(d.components);b.push(c)}return new OpenLayers.Geometry.Polygon(b)},multipolygon:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.polygon.apply(this,[a[d]])}catch(f){throw f;}b.push(c)}return new OpenLayers.Geometry.MultiPolygon(b)},box:function(a){if(2!=a.length)throw"GeoJSON box coordinates must have 2 elements";
+return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(a[0][0],a[0][1]),new OpenLayers.Geometry.Point(a[1][0],a[0][1]),new OpenLayers.Geometry.Point(a[1][0],a[1][1]),new OpenLayers.Geometry.Point(a[0][0],a[1][1]),new OpenLayers.Geometry.Point(a[0][0],a[0][1])])])}},write:function(a,b){var c={type:null};if(OpenLayers.Util.isArray(a)){c.type="FeatureCollection";var d=a.length;c.features=Array(d);for(var e=0;e<d;++e){var f=a[e];if(!f instanceof OpenLayers.Feature.Vector)throw"FeatureCollection only supports collections of features: "+
+f;c.features[e]=this.extract.feature.apply(this,[f])}}else 0==a.CLASS_NAME.indexOf("OpenLayers.Geometry")?c=this.extract.geometry.apply(this,[a]):a instanceof OpenLayers.Feature.Vector&&(c=this.extract.feature.apply(this,[a]),a.layer&&a.layer.projection&&(c.crs=this.createCRSObject(a)));return OpenLayers.Format.JSON.prototype.write.apply(this,[c,b])},createCRSObject:function(a){a=a.layer.projection.toString();var b={};a.match(/epsg:/i)&&(a=parseInt(a.substring(a.indexOf(":")+1)),b=4326==a?{type:"name",
+properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}}:{type:"name",properties:{name:"EPSG:"+a}});return b},extract:{feature:function(a){var b=this.extract.geometry.apply(this,[a.geometry]),b={type:"Feature",properties:a.attributes,geometry:b};null!=a.fid&&(b.id=a.fid);return b},geometry:function(a){if(null==a)return null;this.internalProjection&&this.externalProjection&&(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));var b=a.CLASS_NAME.split(".")[2];a=this.extract[b.toLowerCase()].apply(this,
+[a]);return"Collection"==b?{type:"GeometryCollection",geometries:a}:{type:b,coordinates:a}},point:function(a){return[a.x,a.y]},multipoint:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.point.apply(this,[a.components[c]]));return b},linestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.point.apply(this,[a.components[c]]));return b},multilinestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.linestring.apply(this,
+[a.components[c]]));return b},polygon:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.linestring.apply(this,[a.components[c]]));return b},multipolygon:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.polygon.apply(this,[a.components[c]]));return b},collection:function(a){for(var b=a.components.length,c=Array(b),d=0;d<b;++d)c[d]=this.extract.geometry.apply(this,[a.components[d]]);return c}},CLASS_NAME:"OpenLayers.Format.GeoJSON"});OpenLayers.Lang.de=OpenLayers.Util.applyDefaults({unhandledRequest:"Unbehandelte Anfrager\u00fcckmeldung ${statusText}",Permalink:"Permalink",Overlays:"Overlays","Base Layer":"Grundkarte",noFID:"Ein Feature, f\u00fcr das keine FID existiert, kann nicht aktualisiert werden.",browserNotSupported:"Ihr Browser unterst\u00fctzt keine Vektordarstellung. Aktuell unterst\u00fctzte Renderer:\n${renderers}",minZoomLevelError:"Die <code>minZoomLevel</code>-Eigenschaft ist nur f\u00fcr die Verwendung mit <code>FixedZoomLevels</code>-untergeordneten Layers vorgesehen. Das dieser <tt>wfs</tt>-Layer die <code>minZoomLevel</code>-Eigenschaft \u00fcberpr\u00fcft ist ein Relikt der Vergangenheit. Wir k\u00f6nnen diese \u00dcberpr\u00fcfung nicht entfernen, ohne das OL basierende Applikationen nicht mehr funktionieren. Daher markieren wir es als veraltet - die <code>minZoomLevel</code>-\u00dcberpr\u00fcfung wird in Version 3.0 entfernt werden. Bitte verwenden Sie stattdessen die Min-/Max-L\u00f6sung, wie sie unter http://trac.openlayers.org/wiki/SettingZoomLevels beschrieben ist.",
+commitSuccess:"WFS-Transaktion: Erfolgreich ${response}",commitFailed:"WFS-Transaktion: Fehlgeschlagen ${response}",googleWarning:"Der Google-Layer konnte nicht korrekt geladen werden.<br><br>Um diese Meldung nicht mehr zu erhalten, w\u00e4hlen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.<br><br>Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der Google-Maps-Bibliothek nicht eingebunden wurde oder keinen g\u00fcltigen API-Schl\u00fcssel f\u00fcr Ihre URL enth\u00e4lt.<br><br>Entwickler: Besuche <a href='http://trac.openlayers.org/wiki/Google' target='_blank'>das Wiki</a> f\u00fcr Hilfe zum korrekten Einbinden des Google-Layers",
+getLayerWarning:"Der ${layerType}-Layer konnte nicht korrekt geladen werden.<br><br>Um diese Meldung nicht mehr zu erhalten, w\u00e4hlen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.<br><br>Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der '${layerLib}'-Bibliothek nicht eingebunden wurde.<br><br>Entwickler: Besuche <a href='http://trac.openlayers.org/wiki/${layerLib}' target='_blank'>das Wiki</a> f\u00fcr Hilfe zum korrekten Einbinden von Layern",
+"Scale = 1 : ${scaleDenom}":"Ma\u00dfstab = 1 : ${scaleDenom}",W:"W",E:"O",N:"N",S:"S",reprojectDeprecated:"Sie verwenden die \u201eReproject\u201c-Option des Layers ${layerName}. Diese Option ist veraltet: Sie wurde entwickelt um die Anzeige von Daten auf kommerziellen Basiskarten zu unterst\u00fctzen, aber diese Funktion sollte jetzt durch Unterst\u00fctzung der \u201eSpherical Mercator\u201c erreicht werden. Weitere Informationen sind unter http://trac.openlayers.org/wiki/SphericalMercator verf\u00fcgbar.",
+methodDeprecated:"Die Methode ist veraltet und wird in 3.0 entfernt. Bitte verwende stattdessen ${newMethod}."});OpenLayers.Lang.en={unhandledRequest:"Unhandled request return ${statusText}",Permalink:"Permalink",Overlays:"Overlays","Base Layer":"Base Layer",noFID:"Can't update a feature for which there is no FID.",browserNotSupported:"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",minZoomLevelError:"The minZoomLevel property is only intended for use with the FixedZoomLevels-descendent layers. That this wfs layer checks for minZoomLevel is a relic of thepast. We cannot, however, remove it without possibly breaking OL based applications that may depend on it. Therefore we are deprecating it -- the minZoomLevel check below will be removed at 3.0. Please instead use min/max resolution setting as described here: http://trac.openlayers.org/wiki/SettingZoomLevels",
+commitSuccess:"WFS Transaction: SUCCESS ${response}",commitFailed:"WFS Transaction: FAILED ${response}",googleWarning:"The Google Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the Google Maps library script was either not included, or does not contain the correct API key for your site.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/Google' target='_blank'>click here</a>",
+getLayerWarning:"The ${layerType} Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the ${layerLib} library script was not correctly included.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/${layerLib}' target='_blank'>click here</a>","Scale = 1 : ${scaleDenom}":"Scale = 1 : ${scaleDenom}",W:"W",E:"E",N:"N",S:"S",Graticule:"Graticule",
+reprojectDeprecated:"You are using the 'reproject' option on the ${layerName} layer. This option is deprecated: its use was designed to support displaying data over commercial basemaps, but that functionality should now be achieved by using Spherical Mercator support. More information is available from http://trac.openlayers.org/wiki/SphericalMercator.",methodDeprecated:"This method has been deprecated and will be removed in 3.0. Please use ${newMethod} instead.",end:""};OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:!1,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:!1,fixPadding:function(){"number"==typeof this.padding&&(this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding))},panMapIfOutOfView:!1,
 keepInMap:!1,closeOnMove:!1,map:null,initialize:function(a,b,c,d,e,f){null==a&&(a=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"));this.id=a;this.lonlat=b;this.contentSize=null!=c?c:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);null!=d&&(this.contentHTML=d);this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=this.displayClass;
 this.groupDiv=OpenLayers.Util.createDiv(this.id+"_GroupDiv",null,null,null,"relative",null,"hidden");a=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(a,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);e&&this.addCloseBox(f);this.registerEvents()},destroy:function(){this.border=this.opacity=this.backgroundColor=this.contentHTML=this.size=this.lonlat=this.id=
 null;this.closeOnMove&&this.map&&this.map.events.unregister("movestart",this,this.hide);this.events.destroy();this.events=null;this.closeDiv&&(OpenLayers.Event.stopObservingElement(this.closeDiv),this.groupDiv.removeChild(this.closeDiv));this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;null!=this.map&&this.map.removePopup(this);this.panMapIfOutOfView=this.padding=this.maxSize=this.minSize=this.autoSize=this.div=this.map=null},draw:function(a){null==a&&null!=this.lonlat&&null!=
 keepInMap:!1,closeOnMove:!1,map:null,initialize:function(a,b,c,d,e,f){null==a&&(a=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"));this.id=a;this.lonlat=b;this.contentSize=null!=c?c:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);null!=d&&(this.contentHTML=d);this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=this.displayClass;
 this.groupDiv=OpenLayers.Util.createDiv(this.id+"_GroupDiv",null,null,null,"relative",null,"hidden");a=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(a,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);e&&this.addCloseBox(f);this.registerEvents()},destroy:function(){this.border=this.opacity=this.backgroundColor=this.contentHTML=this.size=this.lonlat=this.id=
 null;this.closeOnMove&&this.map&&this.map.events.unregister("movestart",this,this.hide);this.events.destroy();this.events=null;this.closeDiv&&(OpenLayers.Event.stopObservingElement(this.closeDiv),this.groupDiv.removeChild(this.closeDiv));this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;null!=this.map&&this.map.removePopup(this);this.panMapIfOutOfView=this.padding=this.maxSize=this.minSize=this.autoSize=this.div=this.map=null},draw:function(a){null==a&&null!=this.lonlat&&null!=
@@ -615,73 +537,70 @@ return OpenLayers.Bounds.oppositeQuadrant(a)},updateRelativePosition:function(){
 arguments)},setBackgroundColor:function(a){},setBorder:function(){},setOpacity:function(a){},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.updateBlocks()},updateRelativePosition:function(){this.padding=this.positionBlocks[this.relativePosition].padding;if(this.closeDiv){var a=this.getContentDivPadding();this.closeDiv.style.right=a.right+this.padding.right+"px";this.closeDiv.style.top=a.top+this.padding.top+"px"}this.updateBlocks()},calculateNewPx:function(a){var b=
 OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(this,arguments);return b=b.offset(this.positionBlocks[this.relativePosition].offset)},createBlocks:function(){this.blocks=[];var a=null,b;for(b in this.positionBlocks){a=b;break}a=this.positionBlocks[a];for(b=0;b<a.blocks.length;b++){var c={};this.blocks.push(c);c.div=OpenLayers.Util.createDiv(this.id+"_FrameDecorationDiv_"+b,null,null,null,"absolute",null,"hidden",null);c.image=(this.isAlphaImage?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage)(this.id+
 "_FrameDecorationImg_"+b,null,this.imageSize,this.imageSrc,"absolute",null,null,null);c.div.appendChild(c.image);this.groupDiv.appendChild(c.div)}},updateBlocks:function(){this.blocks||this.createBlocks();if(this.size&&this.relativePosition){for(var a=this.positionBlocks[this.relativePosition],b=0;b<a.blocks.length;b++){var c=a.blocks[b],d=this.blocks[b],e=c.anchor.left,f=c.anchor.bottom,g=c.anchor.right,h=c.anchor.top,k=isNaN(c.size.w)?this.size.w-(g+e):c.size.w,l=isNaN(c.size.h)?this.size.h-(f+
 arguments)},setBackgroundColor:function(a){},setBorder:function(){},setOpacity:function(a){},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.updateBlocks()},updateRelativePosition:function(){this.padding=this.positionBlocks[this.relativePosition].padding;if(this.closeDiv){var a=this.getContentDivPadding();this.closeDiv.style.right=a.right+this.padding.right+"px";this.closeDiv.style.top=a.top+this.padding.top+"px"}this.updateBlocks()},calculateNewPx:function(a){var b=
 OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(this,arguments);return b=b.offset(this.positionBlocks[this.relativePosition].offset)},createBlocks:function(){this.blocks=[];var a=null,b;for(b in this.positionBlocks){a=b;break}a=this.positionBlocks[a];for(b=0;b<a.blocks.length;b++){var c={};this.blocks.push(c);c.div=OpenLayers.Util.createDiv(this.id+"_FrameDecorationDiv_"+b,null,null,null,"absolute",null,"hidden",null);c.image=(this.isAlphaImage?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage)(this.id+
 "_FrameDecorationImg_"+b,null,this.imageSize,this.imageSrc,"absolute",null,null,null);c.div.appendChild(c.image);this.groupDiv.appendChild(c.div)}},updateBlocks:function(){this.blocks||this.createBlocks();if(this.size&&this.relativePosition){for(var a=this.positionBlocks[this.relativePosition],b=0;b<a.blocks.length;b++){var c=a.blocks[b],d=this.blocks[b],e=c.anchor.left,f=c.anchor.bottom,g=c.anchor.right,h=c.anchor.top,k=isNaN(c.size.w)?this.size.w-(g+e):c.size.w,l=isNaN(c.size.h)?this.size.h-(f+
-h):c.size.h;d.div.style.width=(0>k?0:k)+"px";d.div.style.height=(0>l?0:l)+"px";d.div.style.left=null!=e?e+"px":"";d.div.style.bottom=null!=f?f+"px":"";d.div.style.right=null!=g?g+"px":"";d.div.style.top=null!=h?h+"px":"";d.image.style.left=c.position.x+"px";d.image.style.top=c.position.y+"px"}this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px"}},CLASS_NAME:"OpenLayers.Popup.Framed"});OpenLayers.Format.JSON=OpenLayers.Class(OpenLayers.Format,{indent:"    ",space:" ",newline:"\n",level:0,pretty:!1,nativeJSON:function(){return!(!window.JSON||!("function"==typeof JSON.parse&&"function"==typeof JSON.stringify))}(),read:function(a,b){var c;if(this.nativeJSON)c=JSON.parse(a,b);else try{if(/^[\],:{}\s]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))&&(c=eval("("+a+")"),"function"===
-typeof b)){var d=function(a,c){if(c&&"object"===typeof c)for(var e in c)c.hasOwnProperty(e)&&(c[e]=d(e,c[e]));return b(a,c)};c=d("",c)}}catch(e){}this.keepData&&(this.data=c);return c},write:function(a,b){this.pretty=!!b;var c=null,d=typeof a;if(this.serialize[d])try{c=!this.pretty&&this.nativeJSON?JSON.stringify(a):this.serialize[d].apply(this,[a])}catch(e){OpenLayers.Console.error("Trouble serializing: "+e)}return c},writeIndent:function(){var a=[];if(this.pretty)for(var b=0;b<this.level;++b)a.push(this.indent);
-return a.join("")},writeNewline:function(){return this.pretty?this.newline:""},writeSpace:function(){return this.pretty?this.space:""},serialize:{object:function(a){if(null==a)return"null";if(a.constructor==Date)return this.serialize.date.apply(this,[a]);if(a.constructor==Array)return this.serialize.array.apply(this,[a]);var b=["{"];this.level+=1;var c,d,e,f=!1;for(c in a)a.hasOwnProperty(c)&&(d=OpenLayers.Format.JSON.prototype.write.apply(this,[c,this.pretty]),e=OpenLayers.Format.JSON.prototype.write.apply(this,
-[a[c],this.pretty]),null!=d&&null!=e&&(f&&b.push(","),b.push(this.writeNewline(),this.writeIndent(),d,":",this.writeSpace(),e),f=!0));this.level-=1;b.push(this.writeNewline(),this.writeIndent(),"}");return b.join("")},array:function(a){var b,c=["["];this.level+=1;for(var d=0,e=a.length;d<e;++d)b=OpenLayers.Format.JSON.prototype.write.apply(this,[a[d],this.pretty]),null!=b&&(0<d&&c.push(","),c.push(this.writeNewline(),this.writeIndent(),b));this.level-=1;c.push(this.writeNewline(),this.writeIndent(),
-"]");return c.join("")},string:function(a){var b={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return/["\\\x00-\x1f]/.test(a)?'"'+a.replace(/([\x00-\x1f\\"])/g,function(a,d){var e=b[d];if(e)return e;e=d.charCodeAt();return"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16)})+'"':'"'+a+'"'},number:function(a){return isFinite(a)?String(a):"null"},"boolean":function(a){return String(a)},date:function(a){function b(a){return 10>a?"0"+a:a}return'"'+a.getFullYear()+
-"-"+b(a.getMonth()+1)+"-"+b(a.getDate())+"T"+b(a.getHours())+":"+b(a.getMinutes())+":"+b(a.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Format.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{ignoreExtraDims:!1,read:function(a,b,c){b=b?b:"FeatureCollection";var d=null,e=null;if(e="string"==typeof a?OpenLayers.Format.JSON.prototype.read.apply(this,[a,c]):a)if("string"!=typeof e.type)OpenLayers.Console.error("Bad GeoJSON - no type: "+a);else{if(this.isValidType(e,b))switch(b){case "Geometry":try{d=this.parseGeometry(e)}catch(f){OpenLayers.Console.error(f)}break;case "Feature":try{d=this.parseFeature(e),d.type="Feature"}catch(g){OpenLayers.Console.error(g)}break;
-case "FeatureCollection":switch(d=[],e.type){case "Feature":try{d.push(this.parseFeature(e))}catch(h){d=null,OpenLayers.Console.error(h)}break;case "FeatureCollection":a=0;for(b=e.features.length;a<b;++a)try{d.push(this.parseFeature(e.features[a]))}catch(k){d=null,OpenLayers.Console.error(k)}break;default:try{var l=this.parseGeometry(e);d.push(new OpenLayers.Feature.Vector(l))}catch(m){d=null,OpenLayers.Console.error(m)}}}}else OpenLayers.Console.error("Bad JSON: "+a);return d},isValidType:function(a,
-b){var c=!1;switch(b){case "Geometry":-1==OpenLayers.Util.indexOf("Point MultiPoint LineString MultiLineString Polygon MultiPolygon Box GeometryCollection".split(" "),a.type)?OpenLayers.Console.error("Unsupported geometry type: "+a.type):c=!0;break;case "FeatureCollection":c=!0;break;default:a.type==b?c=!0:OpenLayers.Console.error("Cannot convert types from "+a.type+" to "+b)}return c},parseFeature:function(a){var b,c,d;c=a.properties?a.properties:{};d=a.geometry&&a.geometry.bbox||a.bbox;try{b=this.parseGeometry(a.geometry)}catch(e){throw e;
-}b=new OpenLayers.Feature.Vector(b,c);d&&(b.bounds=OpenLayers.Bounds.fromArray(d));a.id&&(b.fid=a.id);return b},parseGeometry:function(a){if(null==a)return null;var b,c=!1;if("GeometryCollection"==a.type){if(!OpenLayers.Util.isArray(a.geometries))throw"GeometryCollection must have geometries array: "+a;b=a.geometries.length;for(var c=Array(b),d=0;d<b;++d)c[d]=this.parseGeometry.apply(this,[a.geometries[d]]);b=new OpenLayers.Geometry.Collection(c);c=!0}else{if(!OpenLayers.Util.isArray(a.coordinates))throw"Geometry must have coordinates array: "+
-a;if(!this.parseCoords[a.type.toLowerCase()])throw"Unsupported geometry type: "+a.type;try{b=this.parseCoords[a.type.toLowerCase()].apply(this,[a.coordinates])}catch(e){throw e;}}this.internalProjection&&(this.externalProjection&&!c)&&b.transform(this.externalProjection,this.internalProjection);return b},parseCoords:{point:function(a){if(!1==this.ignoreExtraDims&&2!=a.length)throw"Only 2D points are supported: "+a;return new OpenLayers.Geometry.Point(a[0],a[1])},multipoint:function(a){for(var b=[],
-c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.point.apply(this,[a[d]])}catch(f){throw f;}b.push(c)}return new OpenLayers.Geometry.MultiPoint(b)},linestring:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.point.apply(this,[a[d]])}catch(f){throw f;}b.push(c)}return new OpenLayers.Geometry.LineString(b)},multilinestring:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.linestring.apply(this,[a[d]])}catch(f){throw f;}b.push(c)}return new OpenLayers.Geometry.MultiLineString(b)},
-polygon:function(a){for(var b=[],c,d,e=0,f=a.length;e<f;++e){try{d=this.parseCoords.linestring.apply(this,[a[e]])}catch(g){throw g;}c=new OpenLayers.Geometry.LinearRing(d.components);b.push(c)}return new OpenLayers.Geometry.Polygon(b)},multipolygon:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;++d){try{c=this.parseCoords.polygon.apply(this,[a[d]])}catch(f){throw f;}b.push(c)}return new OpenLayers.Geometry.MultiPolygon(b)},box:function(a){if(2!=a.length)throw"GeoJSON box coordinates must have 2 elements";
-return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(a[0][0],a[0][1]),new OpenLayers.Geometry.Point(a[1][0],a[0][1]),new OpenLayers.Geometry.Point(a[1][0],a[1][1]),new OpenLayers.Geometry.Point(a[0][0],a[1][1]),new OpenLayers.Geometry.Point(a[0][0],a[0][1])])])}},write:function(a,b){var c={type:null};if(OpenLayers.Util.isArray(a)){c.type="FeatureCollection";var d=a.length;c.features=Array(d);for(var e=0;e<d;++e){var f=a[e];if(!f instanceof OpenLayers.Feature.Vector)throw"FeatureCollection only supports collections of features: "+
-f;c.features[e]=this.extract.feature.apply(this,[f])}}else 0==a.CLASS_NAME.indexOf("OpenLayers.Geometry")?c=this.extract.geometry.apply(this,[a]):a instanceof OpenLayers.Feature.Vector&&(c=this.extract.feature.apply(this,[a]),a.layer&&a.layer.projection&&(c.crs=this.createCRSObject(a)));return OpenLayers.Format.JSON.prototype.write.apply(this,[c,b])},createCRSObject:function(a){a=a.layer.projection.toString();var b={};a.match(/epsg:/i)&&(a=parseInt(a.substring(a.indexOf(":")+1)),b=4326==a?{type:"name",
-properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}}:{type:"name",properties:{name:"EPSG:"+a}});return b},extract:{feature:function(a){var b=this.extract.geometry.apply(this,[a.geometry]),b={type:"Feature",properties:a.attributes,geometry:b};null!=a.fid&&(b.id=a.fid);return b},geometry:function(a){if(null==a)return null;this.internalProjection&&this.externalProjection&&(a=a.clone(),a.transform(this.internalProjection,this.externalProjection));var b=a.CLASS_NAME.split(".")[2];a=this.extract[b.toLowerCase()].apply(this,
-[a]);return"Collection"==b?{type:"GeometryCollection",geometries:a}:{type:b,coordinates:a}},point:function(a){return[a.x,a.y]},multipoint:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.point.apply(this,[a.components[c]]));return b},linestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.point.apply(this,[a.components[c]]));return b},multilinestring:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.linestring.apply(this,
-[a.components[c]]));return b},polygon:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.linestring.apply(this,[a.components[c]]));return b},multipolygon:function(a){for(var b=[],c=0,d=a.components.length;c<d;++c)b.push(this.extract.polygon.apply(this,[a.components[c]]));return b},collection:function(a){for(var b=a.components.length,c=Array(b),d=0;d<b;++d)c[d]=this.extract.geometry.apply(this,[a.components[d]]);return c}},CLASS_NAME:"OpenLayers.Format.GeoJSON"});OpenLayers.Protocol.WFS.v1=OpenLayers.Class(OpenLayers.Protocol,{version:null,srsName:"EPSG:4326",featureType:null,featureNS:null,geometryName:"the_geom",schema:null,featurePrefix:"feature",formatOptions:null,readFormat:null,readOptions:null,initialize:function(a){OpenLayers.Protocol.prototype.initialize.apply(this,[a]);a.format||(this.format=OpenLayers.Format.WFST(OpenLayers.Util.extend({version:this.version,featureType:this.featureType,featureNS:this.featureNS,featurePrefix:this.featurePrefix,geometryName:this.geometryName,
-srsName:this.srsName,schema:this.schema},this.formatOptions)));!a.geometryName&&1<parseFloat(this.format.version)&&this.setGeometryName(null)},destroy:function(){this.options&&!this.options.format&&this.format.destroy();this.format=null;OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(a){OpenLayers.Protocol.prototype.read.apply(this,arguments);a=OpenLayers.Util.extend({},a);OpenLayers.Util.applyDefaults(a,this.options||{});var b=new OpenLayers.Protocol.Response({requestType:"read"}),
-c=OpenLayers.Format.XML.prototype.write.apply(this.format,[this.format.writeNode("wfs:GetFeature",a)]);b.priv=OpenLayers.Request.POST({url:a.url,callback:this.createCallback(this.handleRead,b,a),params:a.params,headers:a.headers,data:c});return b},setFeatureType:function(a){this.featureType=a;this.format.featureType=a},setGeometryName:function(a){this.geometryName=a;this.format.geometryName=a},handleRead:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);if(b.callback){var c=
-a.priv;200<=c.status&&300>c.status?(c=this.parseResponse(c,b.readOptions))&&!1!==c.success?(b.readOptions&&"object"==b.readOptions.output?OpenLayers.Util.extend(a,c):a.features=c,a.code=OpenLayers.Protocol.Response.SUCCESS):(a.code=OpenLayers.Protocol.Response.FAILURE,a.error=c):a.code=OpenLayers.Protocol.Response.FAILURE;b.callback.call(b.scope,a)}},parseResponse:function(a,b){var c=a.responseXML;if(!c||!c.documentElement)c=a.responseText;if(!c||0>=c.length)return null;c=null!==this.readFormat?this.readFormat.read(c):
-this.format.read(c,b);if(!this.featureNS){var d=this.readFormat||this.format;this.featureNS=d.featureNS;d.autoConfig=!1;this.geometryName||this.setGeometryName(d.geometryName)}return c},commit:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);var c=new OpenLayers.Protocol.Response({requestType:"commit",reqFeatures:a});c.priv=OpenLayers.Request.POST({url:b.url,headers:b.headers,data:this.format.write(a,b),callback:this.createCallback(this.handleCommit,c,b)});
-return c},handleCommit:function(a,b){if(b.callback){var c=a.priv,d=c.responseXML;if(!d||!d.documentElement)d=c.responseText;c=this.format.read(d)||{};a.insertIds=c.insertIds||[];c.success?a.code=OpenLayers.Protocol.Response.SUCCESS:(a.code=OpenLayers.Protocol.Response.FAILURE,a.error=c);b.callback.call(b.scope,a)}},filterDelete:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);new OpenLayers.Protocol.Response({requestType:"commit"});var c=this.format.createElementNSPlus("wfs:Transaction",
-{attributes:{service:"WFS",version:this.version}}),d=this.format.createElementNSPlus("wfs:Delete",{attributes:{typeName:(b.featureNS?this.featurePrefix+":":"")+b.featureType}});b.featureNS&&d.setAttribute("xmlns:"+this.featurePrefix,b.featureNS);var e=this.format.writeNode("ogc:Filter",a);d.appendChild(e);c.appendChild(d);c=OpenLayers.Format.XML.prototype.write.apply(this.format,[c]);return OpenLayers.Request.POST({url:this.url,callback:b.callback||function(){},data:c})},abort:function(a){a&&a.priv.abort()},
-CLASS_NAME:"OpenLayers.Protocol.WFS.v1"});OpenLayers.Layer.Google.v3={DEFAULTS:{sphericalMercator:!0,projection:"EPSG:900913"},animationEnabled:!0,loadMapObject:function(){this.type||(this.type=google.maps.MapTypeId.ROADMAP);var a,b=OpenLayers.Layer.Google.cache[this.map.id];b?(a=b.mapObject,++b.count):(a=this.map.getCenter(),b=document.createElement("div"),b.className="olForeignContainer",b.style.width="100%",b.style.height="100%",a=new google.maps.Map(b,{center:a?new google.maps.LatLng(a.lat,a.lon):new google.maps.LatLng(0,0),zoom:this.map.getZoom()||
-0,mapTypeId:this.type,disableDefaultUI:!0,keyboardShortcuts:!1,draggable:!1,disableDoubleClickZoom:!0,scrollwheel:!1,streetViewControl:!1}),b=document.createElement("div"),b.style.width="100%",b.style.height="100%",a.controls[google.maps.ControlPosition.TOP_LEFT].push(b),b={googleControl:b,mapObject:a,count:1},OpenLayers.Layer.Google.cache[this.map.id]=b);this.mapObject=a;this.setGMapVisibility(this.visibility)},onMapResize:function(){this.visibility&&google.maps.event.trigger(this.mapObject,"resize")},
-setGMapVisibility:function(a){var b=OpenLayers.Layer.Google.cache[this.map.id],c=this.map;if(b){for(var d=this.type,e=c.layers,f,g=e.length-1;0<=g;--g)if(f=e[g],f instanceof OpenLayers.Layer.Google&&!0===f.visibility&&!0===f.inRange){d=f.type;a=!0;break}e=this.mapObject.getDiv();if(!0===a){if(e.parentNode!==c.div)if(b.rendered)c.div.appendChild(e),b.googleControl.appendChild(c.viewPortDiv),google.maps.event.trigger(this.mapObject,"resize");else{var h=this;google.maps.event.addListenerOnce(this.mapObject,
-"tilesloaded",function(){b.rendered=!0;h.setGMapVisibility(h.getVisibility());h.moveTo(h.map.getCenter())})}this.mapObject.setMapTypeId(d)}else b.googleControl.hasChildNodes()&&(c.div.appendChild(c.viewPortDiv),c.div.removeChild(e))}},getMapContainer:function(){return this.mapObject.getDiv()},getMapObjectBoundsFromOLBounds:function(a){var b=null;null!=a&&(b=this.sphericalMercator?this.inverseMercator(a.bottom,a.left):new OpenLayers.LonLat(a.bottom,a.left),a=this.sphericalMercator?this.inverseMercator(a.top,
-a.right):new OpenLayers.LonLat(a.top,a.right),b=new google.maps.LatLngBounds(new google.maps.LatLng(b.lat,b.lon),new google.maps.LatLng(a.lat,a.lon)));return b},getMapObjectLonLatFromMapObjectPixel:function(a){var b=this.map.getSize(),c=this.getLongitudeFromMapObjectLonLat(this.mapObject.center),d=this.getLatitudeFromMapObjectLonLat(this.mapObject.center),e=this.map.getResolution();a=new OpenLayers.LonLat(c+(a.x-b.w/2)*e,d-(a.y-b.h/2)*e);this.wrapDateLine&&(a=a.wrapDateLine(this.maxExtent));return this.getMapObjectLonLatFromLonLat(a.lon,
-a.lat)},getMapObjectPixelFromMapObjectLonLat:function(a){var b=this.getLongitudeFromMapObjectLonLat(a);a=this.getLatitudeFromMapObjectLonLat(a);var c=this.map.getResolution(),d=this.map.getExtent();return this.getMapObjectPixelFromXY(1/c*(b-d.left),1/c*(d.top-a))},setMapObjectCenter:function(a,b){if(!1===this.animationEnabled&&b!=this.mapObject.zoom){var c=this.getMapContainer();google.maps.event.addListenerOnce(this.mapObject,"idle",function(){c.style.visibility=""});c.style.visibility="hidden"}this.mapObject.setOptions({center:a,
-zoom:b})},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getMapObjectLonLatFromLonLat:function(a,b){var c;this.sphericalMercator?(c=this.inverseMercator(a,b),c=new google.maps.LatLng(c.lat,c.lon)):c=new google.maps.LatLng(b,a);return c},getMapObjectPixelFromXY:function(a,b){return new google.maps.Point(a,b)}};OpenLayers.ProxyHost="";OpenLayers.Request||(OpenLayers.Request={});
-OpenLayers.Util.extend(OpenLayers.Request,{DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:!0,user:void 0,password:void 0,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},URL_SPLIT_REGEX:/([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,events:new OpenLayers.Events(this),makeSameOrigin:function(a,b){var c=0!==a.indexOf("http"),d=!c&&a.match(this.URL_SPLIT_REGEX);if(d){var e=window.location,c=d[1]==e.protocol&&d[3]==
-e.hostname,d=d[4],e=e.port;if(80!=d&&""!=d||"80"!=e&&""!=e)c=c&&d==e}c||b&&(a="function"==typeof b?b(a):b+encodeURIComponent(a));return a},issue:function(a){var b=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});a=a||{};a.headers=a.headers||{};a=OpenLayers.Util.applyDefaults(a,b);a.headers=OpenLayers.Util.applyDefaults(a.headers,b.headers);var b=!1,c;for(c in a.headers)a.headers.hasOwnProperty(c)&&"x-requested-with"===c.toLowerCase()&&(b=!0);!1===b&&(a.headers["X-Requested-With"]=
-"XMLHttpRequest");var d=new OpenLayers.Request.XMLHttpRequest,e=OpenLayers.Util.urlAppend(a.url,OpenLayers.Util.getParameterString(a.params||{})),e=OpenLayers.Request.makeSameOrigin(e,a.proxy);d.open(a.method,e,a.async,a.user,a.password);for(var f in a.headers)d.setRequestHeader(f,a.headers[f]);var g=this.events,h=this;d.onreadystatechange=function(){d.readyState==OpenLayers.Request.XMLHttpRequest.DONE&&!1!==g.triggerEvent("complete",{request:d,config:a,requestUrl:e})&&h.runCallbacks({request:d,config:a,
-requestUrl:e})};!1===a.async?d.send(a.data):window.setTimeout(function(){0!==d.readyState&&d.send(a.data)},0);return d},runCallbacks:function(a){var b=a.request,c=a.config,d=c.scope?OpenLayers.Function.bind(c.callback,c.scope):c.callback,e;c.success&&(e=c.scope?OpenLayers.Function.bind(c.success,c.scope):c.success);var f;c.failure&&(f=c.scope?OpenLayers.Function.bind(c.failure,c.scope):c.failure);"file:"==OpenLayers.Util.createUrlObject(c.url).protocol&&b.responseText&&(b.status=200);d(b);if(!b.status||
-200<=b.status&&300>b.status)this.events.triggerEvent("success",a),e&&e(b);if(b.status&&(200>b.status||300<=b.status))this.events.triggerEvent("failure",a),f&&f(b)},GET:function(a){a=OpenLayers.Util.extend(a,{method:"GET"});return OpenLayers.Request.issue(a)},POST:function(a){a=OpenLayers.Util.extend(a,{method:"POST"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");return OpenLayers.Request.issue(a)},PUT:function(a){a=
-OpenLayers.Util.extend(a,{method:"PUT"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");return OpenLayers.Request.issue(a)},DELETE:function(a){a=OpenLayers.Util.extend(a,{method:"DELETE"});return OpenLayers.Request.issue(a)},HEAD:function(a){a=OpenLayers.Util.extend(a,{method:"HEAD"});return OpenLayers.Request.issue(a)},OPTIONS:function(a){a=OpenLayers.Util.extend(a,{method:"OPTIONS"});return OpenLayers.Request.issue(a)}});(function(){function a(){this._object=f&&!k?new f:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[]}function b(){return new a}function c(a){b.onreadystatechange&&b.onreadystatechange.apply(a);a.dispatchEvent({type:"readystatechange",bubbles:!1,cancelable:!1,timeStamp:new Date+0})}function d(a){try{a.responseText=a._object.responseText}catch(b){}try{var c;var d=a._object,e=d.responseXML,f=d.responseText;h&&(f&&e&&!e.documentElement&&d.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/))&&
-(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.validateOnParse=!1,e.loadXML(f));c=e&&(h&&0!=e.parseError||!e.documentElement||e.documentElement&&"parsererror"==e.documentElement.tagName)?null:e;a.responseXML=c}catch(g){}try{a.status=a._object.status}catch(k){}try{a.statusText=a._object.statusText}catch(u){}}function e(a){a._object.onreadystatechange=new window.Function}var f=window.XMLHttpRequest,g=!!window.controllers,h=window.document.all&&!window.opera,k=h&&window.navigator.userAgent.match(/MSIE 7.0/);
-b.prototype=a.prototype;g&&f.wrapped&&(b.wrapped=f.wrapped);b.UNSENT=0;b.OPENED=1;b.HEADERS_RECEIVED=2;b.LOADING=3;b.DONE=4;b.prototype.readyState=b.UNSENT;b.prototype.responseText="";b.prototype.responseXML=null;b.prototype.status=0;b.prototype.statusText="";b.prototype.priority="NORMAL";b.prototype.onreadystatechange=null;b.onreadystatechange=null;b.onopen=null;b.onsend=null;b.onabort=null;b.prototype.open=function(a,f,k,p,n){delete this._headers;3>arguments.length&&(k=!0);this._async=k;var q=this,
-s=this.readyState,t;h&&k&&(t=function(){s!=b.DONE&&(e(q),q.abort())},window.attachEvent("onunload",t));b.onopen&&b.onopen.apply(this,arguments);4<arguments.length?this._object.open(a,f,k,p,n):3<arguments.length?this._object.open(a,f,k,p):this._object.open(a,f,k);this.readyState=b.OPENED;c(this);this._object.onreadystatechange=function(){if(!g||k)q.readyState=q._object.readyState,d(q),q._aborted?q.readyState=b.UNSENT:(q.readyState==b.DONE&&(delete q._data,e(q),h&&k&&window.detachEvent("onunload",t)),
-s!=q.readyState&&c(q),s=q.readyState)}};b.prototype.send=function(a){b.onsend&&b.onsend.apply(this,arguments);arguments.length||(a=null);a&&a.nodeType&&(a=window.XMLSerializer?(new window.XMLSerializer).serializeToString(a):a.xml,this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml"));this._data=a;a:if(this._object.send(this._data),g&&!this._async){this.readyState=b.OPENED;for(d(this);this.readyState<b.DONE;)if(this.readyState++,c(this),this._aborted)break a}};
-b.prototype.abort=function(){b.onabort&&b.onabort.apply(this,arguments);this.readyState>b.UNSENT&&(this._aborted=!0);this._object.abort();e(this);this.readyState=b.UNSENT;delete this._data};b.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};b.prototype.getResponseHeader=function(a){return this._object.getResponseHeader(a)};b.prototype.setRequestHeader=function(a,b){this._headers||(this._headers={});this._headers[a]=b;return this._object.setRequestHeader(a,b)};
-b.prototype.addEventListener=function(a,b,c){for(var d=0,e;e=this._listeners[d];d++)if(e[0]==a&&e[1]==b&&e[2]==c)return;this._listeners.push([a,b,c])};b.prototype.removeEventListener=function(a,b,c){for(var d=0,e;(e=this._listeners[d])&&!(e[0]==a&&e[1]==b&&e[2]==c);d++);e&&this._listeners.splice(d,1)};b.prototype.dispatchEvent=function(a){a={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){},
-initEvent:function(){}};"readystatechange"==a.type&&this.onreadystatechange&&(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[a]);for(var b=0,c;c=this._listeners[b];b++)c[0]==a.type&&!c[2]&&(c[1].handleEvent||c[1]).apply(this,[a])};b.prototype.toString=function(){return"[object XMLHttpRequest]"};b.toString=function(){return"[XMLHttpRequest]"};window.Function.prototype.apply||(window.Function.prototype.apply=function(a,b){b||(b=[]);a.__func=this;a.__func(b[0],b[1],b[2],b[3],
-b[4]);delete a.__func});OpenLayers.Request||(OpenLayers.Request={});OpenLayers.Request.XMLHttpRequest=b})();OpenLayers.Lang.de=OpenLayers.Util.applyDefaults({unhandledRequest:"Unbehandelte Anfrager\u00fcckmeldung ${statusText}",Permalink:"Permalink",Overlays:"Overlays","Base Layer":"Grundkarte",noFID:"Ein Feature, f\u00fcr das keine FID existiert, kann nicht aktualisiert werden.",browserNotSupported:"Ihr Browser unterst\u00fctzt keine Vektordarstellung. Aktuell unterst\u00fctzte Renderer:\n${renderers}",minZoomLevelError:"Die <code>minZoomLevel</code>-Eigenschaft ist nur f\u00fcr die Verwendung mit <code>FixedZoomLevels</code>-untergeordneten Layers vorgesehen. Das dieser <tt>wfs</tt>-Layer die <code>minZoomLevel</code>-Eigenschaft \u00fcberpr\u00fcft ist ein Relikt der Vergangenheit. Wir k\u00f6nnen diese \u00dcberpr\u00fcfung nicht entfernen, ohne das OL basierende Applikationen nicht mehr funktionieren. Daher markieren wir es als veraltet - die <code>minZoomLevel</code>-\u00dcberpr\u00fcfung wird in Version 3.0 entfernt werden. Bitte verwenden Sie stattdessen die Min-/Max-L\u00f6sung, wie sie unter http://trac.openlayers.org/wiki/SettingZoomLevels beschrieben ist.",
-commitSuccess:"WFS-Transaktion: Erfolgreich ${response}",commitFailed:"WFS-Transaktion: Fehlgeschlagen ${response}",googleWarning:"Der Google-Layer konnte nicht korrekt geladen werden.<br><br>Um diese Meldung nicht mehr zu erhalten, w\u00e4hlen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.<br><br>Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der Google-Maps-Bibliothek nicht eingebunden wurde oder keinen g\u00fcltigen API-Schl\u00fcssel f\u00fcr Ihre URL enth\u00e4lt.<br><br>Entwickler: Besuche <a href='http://trac.openlayers.org/wiki/Google' target='_blank'>das Wiki</a> f\u00fcr Hilfe zum korrekten Einbinden des Google-Layers",
-getLayerWarning:"Der ${layerType}-Layer konnte nicht korrekt geladen werden.<br><br>Um diese Meldung nicht mehr zu erhalten, w\u00e4hlen Sie einen anderen Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.<br><br>Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der '${layerLib}'-Bibliothek nicht eingebunden wurde.<br><br>Entwickler: Besuche <a href='http://trac.openlayers.org/wiki/${layerLib}' target='_blank'>das Wiki</a> f\u00fcr Hilfe zum korrekten Einbinden von Layern",
-"Scale = 1 : ${scaleDenom}":"Ma\u00dfstab = 1 : ${scaleDenom}",W:"W",E:"O",N:"N",S:"S",reprojectDeprecated:"Sie verwenden die \u201eReproject\u201c-Option des Layers ${layerName}. Diese Option ist veraltet: Sie wurde entwickelt um die Anzeige von Daten auf kommerziellen Basiskarten zu unterst\u00fctzen, aber diese Funktion sollte jetzt durch Unterst\u00fctzung der \u201eSpherical Mercator\u201c erreicht werden. Weitere Informationen sind unter http://trac.openlayers.org/wiki/SphericalMercator verf\u00fcgbar.",
-methodDeprecated:"Die Methode ist veraltet und wird in 3.0 entfernt. Bitte verwende stattdessen ${newMethod}."});OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:!0,panMapIfOutOfView:!0,imageSize:new OpenLayers.Size(1276,736),isAlphaImage:!1,fixedRelativePosition:!1,positionBlocks:{tl:{offset:new OpenLayers.Pixel(44,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,
+h):c.size.h;d.div.style.width=(0>k?0:k)+"px";d.div.style.height=(0>l?0:l)+"px";d.div.style.left=null!=e?e+"px":"";d.div.style.bottom=null!=f?f+"px":"";d.div.style.right=null!=g?g+"px":"";d.div.style.top=null!=h?h+"px":"";d.image.style.left=c.position.x+"px";d.image.style.top=c.position.y+"px"}this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px"}},CLASS_NAME:"OpenLayers.Popup.Framed"});OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:!0,panMapIfOutOfView:!0,imageSize:new OpenLayers.Size(1276,736),isAlphaImage:!1,fixedRelativePosition:!1,positionBlocks:{tl:{offset:new OpenLayers.Pixel(44,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,
 50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,18),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-632)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-688)}]},tr:{offset:new OpenLayers.Pixel(-45,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto",
 "auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,19),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-631)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(0,
 0,null,null),position:new OpenLayers.Pixel(-215,-687)}]},bl:{offset:new OpenLayers.Pixel(45,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,
 21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},br:{offset:new OpenLayers.Pixel(-44,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238,
 0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(105,10),maxSize:new OpenLayers.Size(1200,660),initialize:function(a,b,c,d,e,f,g){this.imageSrc=OpenLayers.Util.getImageLocation("cloud-popup-relative.png");
 50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,18),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-632)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-688)}]},tr:{offset:new OpenLayers.Pixel(-45,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto",
 "auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,19),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-631)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(0,
 0,null,null),position:new OpenLayers.Pixel(-215,-687)}]},bl:{offset:new OpenLayers.Pixel(45,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,
 21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},br:{offset:new OpenLayers.Pixel(-44,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238,
 0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(105,10),maxSize:new OpenLayers.Size(1200,660),initialize:function(a,b,c,d,e,f,g){this.imageSrc=OpenLayers.Util.getImageLocation("cloud-popup-relative.png");
-OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);this.contentDiv.className=this.contentDisplayClass},CLASS_NAME:"OpenLayers.Popup.FramedCloud"});OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:!1,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(a){this.symbolizer={};OpenLayers.Util.extend(this,a);this.symbolizers&&delete this.symbolizer;this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a in this.symbolizer)this.symbolizer[a]=null;this.symbolizer=null;delete this.symbolizers},evaluate:function(a){var b=
-this.getContext(a),c=!0;if(this.minScaleDenominator||this.maxScaleDenominator)var d=a.layer.map.getScale();this.minScaleDenominator&&(c=d>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b));c&&this.maxScaleDenominator&&(c=d<OpenLayers.Style.createLiteral(this.maxScaleDenominator,b));c&&this.filter&&(c="OpenLayers.Filter.FeatureId"==this.filter.CLASS_NAME?this.filter.evaluate(a):this.filter.evaluate(b));return c},getContext:function(a){var b=this.context;b||(b=a.attributes||a.data);"function"==
-typeof this.context&&(b=this.context(a));return b},clone:function(){var a=OpenLayers.Util.extend({},this);if(this.symbolizers){var b=this.symbolizers.length;a.symbolizers=Array(b);for(var c=0;c<b;++c)a.symbolizers[c]=this.symbolizers[c].clone()}else{a.symbolizer={};for(var d in this.symbolizer)b=this.symbolizer[d],c=typeof b,"object"===c?a.symbolizer[d]=OpenLayers.Util.extend({},b):"string"===c&&(a.symbolizer[d]=b)}a.filter=this.filter&&this.filter.clone();a.context=this.context&&OpenLayers.Util.extend({},
-this.context);return new OpenLayers.Rule(a)},CLASS_NAME:"OpenLayers.Rule"});OpenLayers.Handler.Pinch=OpenLayers.Class(OpenLayers.Handler,{started:!1,stopDown:!1,pinching:!1,last:null,start:null,touchstart:function(a){var b=!0;this.pinching=!1;if(OpenLayers.Event.isMultiTouch(a))this.started=!0,this.last=this.start={distance:this.getDistance(a.touches),delta:0,scale:1},this.callback("start",[a,this.start]),b=!this.stopDown;else{if(this.started)return!1;this.started=!1;this.last=this.start=null}OpenLayers.Event.preventDefault(a);return b},touchmove:function(a){if(this.started&&
-OpenLayers.Event.isMultiTouch(a)){this.pinching=!0;var b=this.getPinchData(a);this.callback("move",[a,b]);this.last=b;OpenLayers.Event.stop(a)}else if(this.started)return!1;return!0},touchend:function(a){return this.started&&!OpenLayers.Event.isMultiTouch(a)?(this.pinching=this.started=!1,this.callback("done",[a,this.start,this.last]),this.last=this.start=null,!1):!0},activate:function(){var a=!1;OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.pinching=!1,a=!0);return a},deactivate:function(){var a=
-!1;OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.pinching=this.started=!1,this.last=this.start=null,a=!0);return a},getDistance:function(a){var b=a[0];a=a[1];return Math.sqrt(Math.pow(b.olClientX-a.olClientX,2)+Math.pow(b.olClientY-a.olClientY,2))},getPinchData:function(a){a=this.getDistance(a.touches);return{distance:a,delta:this.last.distance-a,scale:a/this.start.distance}},CLASS_NAME:"OpenLayers.Handler.Pinch"});OpenLayers.Lang.en={unhandledRequest:"Unhandled request return ${statusText}",Permalink:"Permalink",Overlays:"Overlays","Base Layer":"Base Layer",noFID:"Can't update a feature for which there is no FID.",browserNotSupported:"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",minZoomLevelError:"The minZoomLevel property is only intended for use with the FixedZoomLevels-descendent layers. That this wfs layer checks for minZoomLevel is a relic of thepast. We cannot, however, remove it without possibly breaking OL based applications that may depend on it. Therefore we are deprecating it -- the minZoomLevel check below will be removed at 3.0. Please instead use min/max resolution setting as described here: http://trac.openlayers.org/wiki/SettingZoomLevels",
-commitSuccess:"WFS Transaction: SUCCESS ${response}",commitFailed:"WFS Transaction: FAILED ${response}",googleWarning:"The Google Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the Google Maps library script was either not included, or does not contain the correct API key for your site.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/Google' target='_blank'>click here</a>",
-getLayerWarning:"The ${layerType} Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the ${layerLib} library script was not correctly included.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/${layerLib}' target='_blank'>click here</a>","Scale = 1 : ${scaleDenom}":"Scale = 1 : ${scaleDenom}",W:"W",E:"E",N:"N",S:"S",Graticule:"Graticule",
-reprojectDeprecated:"You are using the 'reproject' option on the ${layerName} layer. This option is deprecated: its use was designed to support displaying data over commercial basemaps, but that functionality should now be achieved by using Spherical Mercator support. More information is available from http://trac.openlayers.org/wiki/SphericalMercator.",methodDeprecated:"This method has been deprecated and will be removed in 3.0. Please use ${newMethod} instead.",end:""};OpenLayers.Control.PinchZoom=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,pinchOrigin:null,currentCenter:null,autoActivate:!0,preserveCenter:!1,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.handler=new OpenLayers.Handler.Pinch(this,{start:this.pinchStart,move:this.pinchMove,done:this.pinchDone},this.handlerOptions)},pinchStart:function(a,b){var c=this.preserveCenter?this.map.getPixelFromLonLat(this.map.getCenter()):a.xy;this.currentCenter=
-this.pinchOrigin=c},pinchMove:function(a,b){var c=b.scale,d=this.map.layerContainerOriginPx,e=this.pinchOrigin,f=this.preserveCenter?this.map.getPixelFromLonLat(this.map.getCenter()):a.xy,g=Math.round(d.x+f.x-e.x+(c-1)*(d.x-e.x)),d=Math.round(d.y+f.y-e.y+(c-1)*(d.y-e.y));this.map.applyTransform(g,d,c);this.currentCenter=f},pinchDone:function(a,b,c){this.map.applyTransform();a=this.map.getZoomForResolution(this.map.getResolution()/c.scale,!0);if(a!==this.map.getZoom()||!this.currentCenter.equals(this.pinchOrigin)){b=
-this.map.getResolutionForZoom(a);c=this.map.getLonLatFromPixel(this.pinchOrigin);var d=this.currentCenter,e=this.map.getSize();c.lon+=b*(e.w/2-d.x);c.lat-=b*(e.h/2-d.y);this.map.div.clientWidth=this.map.div.clientWidth;this.map.setCenter(c,a)}},CLASS_NAME:"OpenLayers.Control.PinchZoom"});OpenLayers.Control.TouchNavigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,clickHandlerOptions:null,documentDrag:!1,autoActivate:!0,initialize:function(a){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate();this.dragPan&&this.dragPan.destroy();this.dragPan=null;this.pinchZoom&&(this.pinchZoom.destroy(),delete this.pinchZoom);OpenLayers.Control.prototype.destroy.apply(this,
-arguments)},activate:function(){return OpenLayers.Control.prototype.activate.apply(this,arguments)?(this.dragPan.activate(),this.handlers.click.activate(),this.pinchZoom.activate(),!0):!1},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments)?(this.dragPan.deactivate(),this.handlers.click.deactivate(),this.pinchZoom.deactivate(),!0):!1},draw:function(){var a={click:this.defaultClick,dblclick:this.defaultDblClick},b=OpenLayers.Util.extend({"double":!0,stopDouble:!0,
-pixelTolerance:2},this.clickHandlerOptions);this.handlers.click=new OpenLayers.Handler.Click(this,a,b);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions));this.dragPan.draw();this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},this.pinchZoomOptions))},defaultClick:function(a){a.lastTouches&&2==a.lastTouches.length&&this.map.zoomOut()},defaultDblClick:function(a){this.map.zoomTo(this.map.zoom+
-1,a.xy)},CLASS_NAME:"OpenLayers.Control.TouchNavigation"});OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(a){if(this.supported()){if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);for(var b=document.createStyleSheet(),c="shape rect oval fill stroke imagedata group textbox".split(" "),d=0,e=c.length;d<e;d++)b.addRule("olv\\:"+c[d],"behavior: url(#default#VML); position: absolute; display: inline-block;")}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,
+OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);this.contentDiv.className=this.contentDisplayClass},CLASS_NAME:"OpenLayers.Popup.FramedCloud"});OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{hitDetection:!0,hitOverflow:0,canvas:null,features:null,pendingRedraw:!1,cachedSymbolBounds:{},initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this._clearRectId=OpenLayers.Util.createUniqueID();this.features={};this.hitDetection&&(this.hitCanvas=document.createElement("canvas"),
+this.hitContext=this.hitCanvas.getContext("2d"))},setExtent:function(){OpenLayers.Renderer.prototype.setExtent.apply(this,arguments);return!1},eraseGeometry:function(a,b){this.eraseFeatures(this.features[b][0])},supported:function(){return OpenLayers.CANVAS_SUPPORTED},setSize:function(a){this.size=a.clone();var b=this.root;b.style.width=a.w+"px";b.style.height=a.h+"px";b.width=a.w;b.height=a.h;this.resolution=null;this.hitDetection&&(b=this.hitCanvas,b.style.width=a.w+"px",b.style.height=a.h+"px",
+b.width=a.w,b.height=a.h)},drawFeature:function(a,b){var c;if(a.geometry){b=this.applyDefaultSymbolizer(b||a.style);c=a.geometry.getBounds();var d;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(d=this.map.getMaxExtent());d=c&&c.intersectsBounds(this.extent,{worldBounds:d});(c="none"!==b.display&&!!c&&d)?this.features[a.id]=[a,b]:delete this.features[a.id];this.pendingRedraw=!0}this.pendingRedraw&&!this.locked&&(this.redraw(),this.pendingRedraw=!1);return c},drawGeometry:function(a,b,c){var d=
+a.CLASS_NAME;if("OpenLayers.Geometry.Collection"==d||"OpenLayers.Geometry.MultiPoint"==d||"OpenLayers.Geometry.MultiLineString"==d||"OpenLayers.Geometry.MultiPolygon"==d)for(var d=this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent(),e=0;e<a.components.length;e++)this.calculateFeatureDx(a.components[e].getBounds(),d),this.drawGeometry(a.components[e],b,c);else switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":this.drawPoint(a,b,c);break;case "OpenLayers.Geometry.LineString":this.drawLineString(a,
+b,c);break;case "OpenLayers.Geometry.LinearRing":this.drawLinearRing(a,b,c);break;case "OpenLayers.Geometry.Polygon":this.drawPolygon(a,b,c)}},drawExternalGraphic:function(a,b,c){var d=new Image,e=b.title||b.graphicTitle;e&&(d.title=e);var f=b.graphicWidth||b.graphicHeight,g=b.graphicHeight||b.graphicWidth,f=f?f:2*b.pointRadius,g=g?g:2*b.pointRadius,h=void 0!=b.graphicXOffset?b.graphicXOffset:-(0.5*f),k=void 0!=b.graphicYOffset?b.graphicYOffset:-(0.5*g),l=this._clearRectId,m=b.graphicOpacity||b.fillOpacity;
+d.onload=OpenLayers.Function.bind(function(){if(this.features[c]&&l===this._clearRectId){var b=this.getLocalXY(a),e=b[0],b=b[1];if(!isNaN(e)&&!isNaN(b)){var e=e+h|0,b=b+k|0,n=this.canvas;n.globalAlpha=m;var p=OpenLayers.Renderer.Canvas.drawImageScaleFactor||(OpenLayers.Renderer.Canvas.drawImageScaleFactor=/android 2.1/.test(navigator.userAgent.toLowerCase())?320/window.screen.width:1);n.drawImage(d,e*p,b*p,f*p,g*p);this.hitDetection&&(this.setHitContextStyle("fill",c),this.hitContext.fillRect(e,b,
+f,g))}}},this);d.src=b.externalGraphic;d.complete&&(d.onload(),d.onload=null)},drawNamedSymbol:function(a,b,c){var d,e,f,g;f=Math.PI/180;var h=OpenLayers.Renderer.symbol[b.graphicName];if(!h)throw Error(b.graphicName+" is not a valid symbol name");if(h.length&&!(2>h.length)&&(a=this.getLocalXY(a),e=a[0],g=a[1],!isNaN(e)&&!isNaN(g))){this.canvas.lineCap="round";this.canvas.lineJoin="round";this.hitDetection&&(this.hitContext.lineCap="round",this.hitContext.lineJoin="round");if(b.graphicName in this.cachedSymbolBounds)d=
+this.cachedSymbolBounds[b.graphicName];else{d=new OpenLayers.Bounds;for(a=0;a<h.length;a+=2)d.extend(new OpenLayers.LonLat(h[a],h[a+1]));this.cachedSymbolBounds[b.graphicName]=d}this.canvas.save();this.hitDetection&&this.hitContext.save();this.canvas.translate(e,g);this.hitDetection&&this.hitContext.translate(e,g);a=f*b.rotation;isNaN(a)||(this.canvas.rotate(a),this.hitDetection&&this.hitContext.rotate(a));f=2*b.pointRadius/Math.max(d.getWidth(),d.getHeight());this.canvas.scale(f,f);this.hitDetection&&
+this.hitContext.scale(f,f);a=d.getCenterLonLat().lon;d=d.getCenterLonLat().lat;this.canvas.translate(-a,-d);this.hitDetection&&this.hitContext.translate(-a,-d);g=b.strokeWidth;b.strokeWidth=g/f;if(!1!==b.fill){this.setCanvasStyle("fill",b);this.canvas.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.canvas.moveTo(d,e),this.canvas.lineTo(d,e);this.canvas.closePath();this.canvas.fill();if(this.hitDetection){this.setHitContextStyle("fill",c,b);this.hitContext.beginPath();for(a=0;a<h.length;a+=
+2)d=h[a],e=h[a+1],0==a&&this.canvas.moveTo(d,e),this.hitContext.lineTo(d,e);this.hitContext.closePath();this.hitContext.fill()}}if(!1!==b.stroke){this.setCanvasStyle("stroke",b);this.canvas.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.canvas.moveTo(d,e),this.canvas.lineTo(d,e);this.canvas.closePath();this.canvas.stroke();if(this.hitDetection){this.setHitContextStyle("stroke",c,b,f);this.hitContext.beginPath();for(a=0;a<h.length;a+=2)d=h[a],e=h[a+1],0==a&&this.hitContext.moveTo(d,
+e),this.hitContext.lineTo(d,e);this.hitContext.closePath();this.hitContext.stroke()}}b.strokeWidth=g;this.canvas.restore();this.hitDetection&&this.hitContext.restore();this.setCanvasStyle("reset")}},setCanvasStyle:function(a,b){"fill"===a?(this.canvas.globalAlpha=b.fillOpacity,this.canvas.fillStyle=b.fillColor):"stroke"===a?(this.canvas.globalAlpha=b.strokeOpacity,this.canvas.strokeStyle=b.strokeColor,this.canvas.lineWidth=b.strokeWidth):(this.canvas.globalAlpha=0,this.canvas.lineWidth=1)},featureIdToHex:function(a){a=
+Number(a.split("_").pop())+1;16777216<=a&&(this.hitOverflow=a-16777215,a=a%16777216+1);a="000000"+a.toString(16);var b=a.length;return a="#"+a.substring(b-6,b)},setHitContextStyle:function(a,b,c,d){b=this.featureIdToHex(b);"fill"==a?(this.hitContext.globalAlpha=1,this.hitContext.fillStyle=b):"stroke"==a?(this.hitContext.globalAlpha=1,this.hitContext.strokeStyle=b,"undefined"===typeof d?this.hitContext.lineWidth=c.strokeWidth+2:isNaN(d)||(this.hitContext.lineWidth=c.strokeWidth+2/d)):(this.hitContext.globalAlpha=
+0,this.hitContext.lineWidth=1)},drawPoint:function(a,b,c){if(!1!==b.graphic)if(b.externalGraphic)this.drawExternalGraphic(a,b,c);else if(b.graphicName&&"circle"!=b.graphicName)this.drawNamedSymbol(a,b,c);else{var d=this.getLocalXY(a);a=d[0];d=d[1];if(!isNaN(a)&&!isNaN(d)){var e=2*Math.PI,f=b.pointRadius;!1!==b.fill&&(this.setCanvasStyle("fill",b),this.canvas.beginPath(),this.canvas.arc(a,d,f,0,e,!0),this.canvas.fill(),this.hitDetection&&(this.setHitContextStyle("fill",c,b),this.hitContext.beginPath(),
+this.hitContext.arc(a,d,f,0,e,!0),this.hitContext.fill()));!1!==b.stroke&&(this.setCanvasStyle("stroke",b),this.canvas.beginPath(),this.canvas.arc(a,d,f,0,e,!0),this.canvas.stroke(),this.hitDetection&&(this.setHitContextStyle("stroke",c,b),this.hitContext.beginPath(),this.hitContext.arc(a,d,f,0,e,!0),this.hitContext.stroke()),this.setCanvasStyle("reset"))}}},drawLineString:function(a,b,c){b=OpenLayers.Util.applyDefaults({fill:!1},b);this.drawLinearRing(a,b,c)},drawLinearRing:function(a,b,c){!1!==
+b.fill&&(this.setCanvasStyle("fill",b),this.renderPath(this.canvas,a,b,c,"fill"),this.hitDetection&&(this.setHitContextStyle("fill",c,b),this.renderPath(this.hitContext,a,b,c,"fill")));!1!==b.stroke&&(this.setCanvasStyle("stroke",b),this.renderPath(this.canvas,a,b,c,"stroke"),this.hitDetection&&(this.setHitContextStyle("stroke",c,b),this.renderPath(this.hitContext,a,b,c,"stroke")));this.setCanvasStyle("reset")},renderPath:function(a,b,c,d,e){b=b.components;c=b.length;a.beginPath();d=this.getLocalXY(b[0]);
+var f=d[1];if(!isNaN(d[0])&&!isNaN(f)){a.moveTo(d[0],d[1]);for(d=1;d<c;++d)f=this.getLocalXY(b[d]),a.lineTo(f[0],f[1]);"fill"===e?a.fill():a.stroke()}},drawPolygon:function(a,b,c){a=a.components;var d=a.length;this.drawLinearRing(a[0],b,c);for(var e=1;e<d;++e)this.canvas.globalCompositeOperation="destination-out",this.hitDetection&&(this.hitContext.globalCompositeOperation="destination-out"),this.drawLinearRing(a[e],OpenLayers.Util.applyDefaults({stroke:!1,fillOpacity:1},b),c),this.canvas.globalCompositeOperation=
+"source-over",this.hitDetection&&(this.hitContext.globalCompositeOperation="source-over"),this.drawLinearRing(a[e],OpenLayers.Util.applyDefaults({fill:!1},b),c)},drawText:function(a,b){var c=this.getLocalXY(a);this.setCanvasStyle("reset");this.canvas.fillStyle=b.fontColor;this.canvas.globalAlpha=b.fontOpacity||1;var d=[b.fontStyle?b.fontStyle:"normal","normal",b.fontWeight?b.fontWeight:"normal",b.fontSize?b.fontSize:"1em",b.fontFamily?b.fontFamily:"sans-serif"].join(" "),e=b.label.split("\n"),f=e.length;
+if(this.canvas.fillText){this.canvas.font=d;this.canvas.textAlign=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[0]]||"center";this.canvas.textBaseline=OpenLayers.Renderer.Canvas.LABEL_ALIGN[b.labelAlign[1]]||"middle";var g=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[1]];null==g&&(g=-0.5);d=this.canvas.measureText("Mg").height||this.canvas.measureText("xx").width;c[1]+=d*g*(f-1);for(g=0;g<f;g++)b.labelOutlineWidth&&(this.canvas.save(),this.canvas.globalAlpha=b.labelOutlineOpacity||b.fontOpacity||
+1,this.canvas.strokeStyle=b.labelOutlineColor,this.canvas.lineWidth=b.labelOutlineWidth,this.canvas.strokeText(e[g],c[0],c[1]+d*g+1),this.canvas.restore()),this.canvas.fillText(e[g],c[0],c[1]+d*g)}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=d;var h=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[0]];null==h&&(h=-0.5);g=OpenLayers.Renderer.Canvas.LABEL_FACTOR[b.labelAlign[1]];null==g&&(g=-0.5);d=this.canvas.mozMeasureText("xx");c[1]+=d*(1+g*f);for(g=0;g<f;g++){var k=c[0]+h*this.canvas.mozMeasureText(e[g]),
+l=c[1]+g*d;this.canvas.translate(k,l);this.canvas.mozDrawText(e[g]);this.canvas.translate(-k,-l)}}this.setCanvasStyle("reset")},getLocalXY:function(a){var b=this.getResolution(),c=this.extent;return[(a.x-this.featureDx)/b+-c.left/b,c.top/b-a.y/b]},clear:function(){this.clearCanvas();this.features={}},clearCanvas:function(){var a=this.root.height,b=this.root.width;this.canvas.clearRect(0,0,b,a);this._clearRectId=OpenLayers.Util.createUniqueID();this.hitDetection&&this.hitContext.clearRect(0,0,b,a)},
+getFeatureIdFromEvent:function(a){var b;if(this.hitDetection&&"none"!==this.root.style.display&&!this.map.dragging&&(a=a.xy,a=this.hitContext.getImageData(a.x|0,a.y|0,1,1).data,255===a[3]&&(a=a[2]+256*(a[1]+256*a[0])))){a="OpenLayers_Feature_Vector_"+(a-1+this.hitOverflow);try{b=this.features[a][0]}catch(c){}}return b},eraseFeatures:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0;b<a.length;++b)delete this.features[a[b].id];this.redraw()},redraw:function(){if(!this.locked){this.clearCanvas();
+var a=[],b,c,d,e=this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent(),f;for(f in this.features)this.features.hasOwnProperty(f)&&(b=this.features[f][0],c=b.geometry,this.calculateFeatureDx(c.getBounds(),e),d=this.features[f][1],this.drawGeometry(c,d,b.id),d.label&&a.push([b,d]));c=0;for(d=a.length;c<d;++c)b=a[c],this.drawText(b[0].geometry.getCentroid(),b[1])}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={l:"left",r:"right",t:"top",b:"bottom"};
+OpenLayers.Renderer.Canvas.LABEL_FACTOR={l:0,r:-1,t:0,b:-1};OpenLayers.Renderer.Canvas.drawImageScaleFactor=null;OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(a){this.compare=a?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.clear()},insert:function(a){this.exists(a)&&this.remove(a);var b=a.id;this.determineZIndex(a);for(var c=-1,d=this.order.length,e;1<d-c;)e=parseInt((c+d)/2),0<this.compare(this,a,OpenLayers.Util.getElement(this.order[e]))?c=e:d=e;this.order.splice(d,
+0,b);this.indices[b]=this.getZIndex(a);return this.getNextElement(d)},remove:function(a){a=a.id;var b=OpenLayers.Util.indexOf(this.order,a);0<=b&&(this.order.splice(b,1),delete this.indices[a],this.maxZIndex=0<this.order.length?this.indices[this.order[this.order.length-1]]:0)},clear:function(){this.order=[];this.indices={};this.maxZIndex=0},exists:function(a){return null!=this.indices[a.id]},getZIndex:function(a){return a._style.graphicZIndex},determineZIndex:function(a){var b=a._style.graphicZIndex;
+null==b?(b=this.maxZIndex,a._style.graphicZIndex=b):b>this.maxZIndex&&(this.maxZIndex=b)},getNextElement:function(a){a+=1;for(var b=void 0;a<this.order.length&&void 0==b;a++)b=OpenLayers.Util.getElement(this.order[a]);return b||null},CLASS_NAME:"OpenLayers.ElementsIndexer"});
+OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(a,b,c){b=a.getZIndex(b);var d=0;c&&(a=a.getZIndex(c),d=b-a);return d},Z_ORDER_DRAWING_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);c&&0==a&&(a=1);return a},Z_ORDER_Y_ORDER:function(a,b,c){a=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(a,b,c);c&&0===a&&(b=c._boundsBottom-b._boundsBottom,a=0===b?1:b);return a}};
+OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,xOffset:0,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",LABEL_OUTLINE_SUFFIX:"_outline",initialize:function(a,b){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);
+this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(b&&(b.zIndexing||b.yOrdering))this.indexer=new OpenLayers.ElementsIndexer(b.yOrdering)},destroy:function(){this.clear();this.xmlns=this.root=this.rendererRoot=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments)},clear:function(){var a,b=this.vectorRoot;if(b)for(;a=b.firstChild;)b.removeChild(a);if(b=this.textRoot)for(;a=b.firstChild;)b.removeChild(a);this.indexer&&
+this.indexer.clear()},setExtent:function(a,b){var c=OpenLayers.Renderer.prototype.setExtent.apply(this,arguments),d=this.getResolution();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var e,f=a.getWidth()/this.map.getExtent().getWidth();a=a.scale(1/f);f=this.map.getMaxExtent();f.right>a.left&&f.right<a.right?e=!0:f.left>a.left&&f.left<a.right&&(e=!1);if(e!==this.rightOfDateLine||b)c=!1,this.xOffset=!0===e?f.getWidth()/d:0;this.rightOfDateLine=e}return c},getNodeType:function(a,b){},drawGeometry:function(a,
+b,c){var d=a.CLASS_NAME,e=!0;if("OpenLayers.Geometry.Collection"==d||"OpenLayers.Geometry.MultiPoint"==d||"OpenLayers.Geometry.MultiLineString"==d||"OpenLayers.Geometry.MultiPolygon"==d){for(var d=0,f=a.components.length;d<f;d++)e=this.drawGeometry(a.components[d],b,c)&&e;return e}d=e=!1;"none"!=b.display&&(b.backgroundGraphic?this.redrawBackgroundNode(a.id,a,b,c):d=!0,e=this.redrawNode(a.id,a,b,c));if(!1==e&&(b=document.getElementById(a.id)))b._style.backgroundGraphic&&(d=!0),b.parentNode.removeChild(b);
+d&&(b=document.getElementById(a.id+this.BACKGROUND_ID_SUFFIX))&&b.parentNode.removeChild(b);return e},redrawNode:function(a,b,c,d){c=this.applyDefaultSymbolizer(c);a=this.nodeFactory(a,this.getNodeType(b,c));a._featureId=d;a._boundsBottom=b.getBounds().bottom;a._geometryClass=b.CLASS_NAME;a._style=c;b=this.drawGeometryNode(a,b,c);if(!1===b)return!1;a=b.node;this.indexer?(c=this.indexer.insert(a))?this.vectorRoot.insertBefore(a,c):this.vectorRoot.appendChild(a):a.parentNode!==this.vectorRoot&&this.vectorRoot.appendChild(a);
+this.postDraw(a);return b.complete},redrawBackgroundNode:function(a,b,c,d){c=OpenLayers.Util.extend({},c);c.externalGraphic=c.backgroundGraphic;c.graphicXOffset=c.backgroundXOffset;c.graphicYOffset=c.backgroundYOffset;c.graphicZIndex=c.backgroundGraphicZIndex;c.graphicWidth=c.backgroundWidth||c.graphicWidth;c.graphicHeight=c.backgroundHeight||c.graphicHeight;c.backgroundGraphic=null;c.backgroundXOffset=null;c.backgroundYOffset=null;c.backgroundGraphicZIndex=null;return this.redrawNode(a+this.BACKGROUND_ID_SUFFIX,
+b,c,null)},drawGeometryNode:function(a,b,c){c=c||a._style;var d={isFilled:void 0===c.fill?!0:c.fill,isStroked:void 0===c.stroke?!!c.strokeWidth:c.stroke},e;switch(b.CLASS_NAME){case "OpenLayers.Geometry.Point":!1===c.graphic&&(d.isFilled=!1,d.isStroked=!1);e=this.drawPoint(a,b);break;case "OpenLayers.Geometry.LineString":d.isFilled=!1;e=this.drawLineString(a,b);break;case "OpenLayers.Geometry.LinearRing":e=this.drawLinearRing(a,b);break;case "OpenLayers.Geometry.Polygon":e=this.drawPolygon(a,b);break;
+case "OpenLayers.Geometry.Rectangle":e=this.drawRectangle(a,b)}a._options=d;return!1!=e?{node:this.setStyle(a,c,d,b),complete:e}:!1},postDraw:function(a){},drawPoint:function(a,b){},drawLineString:function(a,b){},drawLinearRing:function(a,b){},drawPolygon:function(a,b){},drawRectangle:function(a,b){},drawCircle:function(a,b){},removeText:function(a){var b=document.getElementById(a+this.LABEL_ID_SUFFIX);b&&this.textRoot.removeChild(b);(a=document.getElementById(a+this.LABEL_OUTLINE_SUFFIX))&&this.textRoot.removeChild(a)},
+getFeatureIdFromEvent:function(a){var b=a.target,c=b&&b.correspondingUseElement;return(c?c:b||a.srcElement)._featureId},eraseGeometry:function(a,b){if("OpenLayers.Geometry.MultiPoint"==a.CLASS_NAME||"OpenLayers.Geometry.MultiLineString"==a.CLASS_NAME||"OpenLayers.Geometry.MultiPolygon"==a.CLASS_NAME||"OpenLayers.Geometry.Collection"==a.CLASS_NAME)for(var c=0,d=a.components.length;c<d;c++)this.eraseGeometry(a.components[c],b);else if((c=OpenLayers.Util.getElement(a.id))&&c.parentNode)c.geometry&&(c.geometry.destroy(),
+c.geometry=null),c.parentNode.removeChild(c),this.indexer&&this.indexer.remove(c),c._style.backgroundGraphic&&(c=OpenLayers.Util.getElement(a.id+this.BACKGROUND_ID_SUFFIX))&&c.parentNode&&c.parentNode.removeChild(c)},nodeFactory:function(a,b){var c=OpenLayers.Util.getElement(a);c?this.nodeTypeCompare(c,b)||(c.parentNode.removeChild(c),c=this.nodeFactory(a,b)):c=this.createNode(b,a);return c},nodeTypeCompare:function(a,b){},createNode:function(a,b){},moveRoot:function(a){var b=this.root;a.root.parentNode==
+this.rendererRoot&&(b=a.root);b.parentNode.removeChild(b);a.rendererRoot.appendChild(b)},getRenderLayerId:function(){return this.root.parentNode.parentNode.id},isComplexSymbol:function(a){return"circle"!=a&&!!a},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15E3,translationParameters:null,symbolMetrics:null,initialize:function(a){this.supported()&&(OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments),this.translationParameters={x:0,y:0},this.symbolMetrics={})},supported:function(){return document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG",
+"1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))},inValidRange:function(a,b,c){a+=c?0:this.translationParameters.x;b+=c?0:this.translationParameters.y;return a>=-this.MAX_PIXEL&&a<=this.MAX_PIXEL&&b>=-this.MAX_PIXEL&&b<=this.MAX_PIXEL},setExtent:function(a,b){var c=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),d=this.getResolution(),e=-a.left/d,d=a.top/d;if(b)return this.left=e,this.top=d,this.rendererRoot.setAttributeNS(null,
+"viewBox","0 0 "+this.size.w+" "+this.size.h),this.translate(this.xOffset,0),!0;(e=this.translate(e-this.left+this.xOffset,d-this.top))||this.setExtent(a,!0);return c&&e},translate:function(a,b){if(this.inValidRange(a,b,!0)){var c="";if(a||b)c="translate("+a+","+b+")";this.root.setAttributeNS(null,"transform",c);this.translationParameters={x:a,y:b};return!0}return!1},setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);
+this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":c=b.externalGraphic?"image":this.isComplexSymbol(b.graphicName)?"svg":"circle";break;case "OpenLayers.Geometry.Rectangle":c="rect";break;case "OpenLayers.Geometry.LineString":c="polyline";break;case "OpenLayers.Geometry.LinearRing":c="polygon";break;case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":c="path"}return c},setStyle:function(a,
+b,c){b=b||a._style;c=c||a._options;var d=b.title||b.graphicTitle;if(d){a.setAttributeNS(null,"title",d);var e=a.getElementsByTagName("title");0<e.length?e[0].firstChild.textContent=d:(e=this.nodeFactory(null,"title"),e.textContent=d,a.appendChild(e))}var e=parseFloat(a.getAttributeNS(null,"r")),d=1,f;if("OpenLayers.Geometry.Point"==a._geometryClass&&e){a.style.visibility="";if(!1===b.graphic)a.style.visibility="hidden";else if(b.externalGraphic){f=this.getPosition(a);b.graphicWidth&&b.graphicHeight&&
+a.setAttributeNS(null,"preserveAspectRatio","none");var e=b.graphicWidth||b.graphicHeight,g=b.graphicHeight||b.graphicWidth,e=e?e:2*b.pointRadius,g=g?g:2*b.pointRadius,h=void 0!=b.graphicYOffset?b.graphicYOffset:-(0.5*g),k=b.graphicOpacity||b.fillOpacity;a.setAttributeNS(null,"x",(f.x+(void 0!=b.graphicXOffset?b.graphicXOffset:-(0.5*e))).toFixed());a.setAttributeNS(null,"y",(f.y+h).toFixed());a.setAttributeNS(null,"width",e);a.setAttributeNS(null,"height",g);a.setAttributeNS(this.xlinkns,"xlink:href",
+b.externalGraphic);a.setAttributeNS(null,"style","opacity: "+k);a.onclick=OpenLayers.Event.preventDefault}else if(this.isComplexSymbol(b.graphicName)){var e=3*b.pointRadius,g=2*e,l=this.importSymbol(b.graphicName);f=this.getPosition(a);d=3*this.symbolMetrics[l.id][0]/g;h=a.parentNode;k=a.nextSibling;h&&h.removeChild(a);a.firstChild&&a.removeChild(a.firstChild);a.appendChild(l.firstChild.cloneNode(!0));a.setAttributeNS(null,"viewBox",l.getAttributeNS(null,"viewBox"));a.setAttributeNS(null,"width",
+g);a.setAttributeNS(null,"height",g);a.setAttributeNS(null,"x",f.x-e);a.setAttributeNS(null,"y",f.y-e);k?h.insertBefore(a,k):h&&h.appendChild(a)}else a.setAttributeNS(null,"r",b.pointRadius);e=b.rotation;if((void 0!==e||void 0!==a._rotation)&&f)a._rotation=e,e|=0,"svg"!==a.nodeName?a.setAttributeNS(null,"transform","rotate("+e+" "+f.x+" "+f.y+")"):(f=this.symbolMetrics[l.id],a.firstChild.setAttributeNS(null,"transform","rotate("+e+" "+f[1]+" "+f[2]+")"))}c.isFilled?(a.setAttributeNS(null,"fill",b.fillColor),
+a.setAttributeNS(null,"fill-opacity",b.fillOpacity)):a.setAttributeNS(null,"fill","none");c.isStroked?(a.setAttributeNS(null,"stroke",b.strokeColor),a.setAttributeNS(null,"stroke-opacity",b.strokeOpacity),a.setAttributeNS(null,"stroke-width",b.strokeWidth*d),a.setAttributeNS(null,"stroke-linecap",b.strokeLinecap||"round"),a.setAttributeNS(null,"stroke-linejoin","round"),b.strokeDashstyle&&a.setAttributeNS(null,"stroke-dasharray",this.dashStyle(b,d))):a.setAttributeNS(null,"stroke","none");b.pointerEvents&&
+a.setAttributeNS(null,"pointer-events",b.pointerEvents);null!=b.cursor&&a.setAttributeNS(null,"cursor",b.cursor);return a},dashStyle:function(a,b){var c=a.strokeWidth*b,d=a.strokeDashstyle;switch(d){case "solid":return"none";case "dot":return[1,4*c].join();case "dash":return[4*c,4*c].join();case "dashdot":return[4*c,4*c,1,4*c].join();case "longdash":return[8*c,4*c].join();case "longdashdot":return[8*c,4*c,1,4*c].join();default:return OpenLayers.String.trim(d).replace(/\s+/g,",")}},createNode:function(a,
+b){var c=document.createElementNS(this.xmlns,a);b&&c.setAttributeNS(null,"id",b);return c},nodeTypeCompare:function(a,b){return b==a.nodeName},createRenderRoot:function(){var a=this.nodeFactory(this.container.id+"_svgRoot","svg");a.style.display="block";return a},createRoot:function(a){return this.nodeFactory(this.container.id+a,"g")},createDefs:function(){var a=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(a);return a},drawPoint:function(a,b){return this.drawCircle(a,
+b,1)},drawCircle:function(a,b,c){var d=this.getResolution(),e=(b.x-this.featureDx)/d+this.left;b=this.top-b.y/d;return this.inValidRange(e,b)?(a.setAttributeNS(null,"cx",e),a.setAttributeNS(null,"cy",b),a.setAttributeNS(null,"r",c),a):!1},drawLineString:function(a,b){var c=this.getComponentsString(b.components);return c.path?(a.setAttributeNS(null,"points",c.path),c.complete?a:null):!1},drawLinearRing:function(a,b){var c=this.getComponentsString(b.components);return c.path?(a.setAttributeNS(null,
+"points",c.path),c.complete?a:null):!1},drawPolygon:function(a,b){for(var c="",d=!0,e=!0,f,g,h=0,k=b.components.length;h<k;h++)c+=" M",f=this.getComponentsString(b.components[h].components," "),(g=f.path)?(c+=" "+g,e=f.complete&&e):d=!1;return d?(a.setAttributeNS(null,"d",c+" z"),a.setAttributeNS(null,"fill-rule","evenodd"),e?a:null):!1},drawRectangle:function(a,b){var c=this.getResolution(),d=(b.x-this.featureDx)/c+this.left,e=this.top-b.y/c;return this.inValidRange(d,e)?(a.setAttributeNS(null,"x",
+d),a.setAttributeNS(null,"y",e),a.setAttributeNS(null,"width",b.width/c),a.setAttributeNS(null,"height",b.height/c),a):!1},drawText:function(a,b,c){var d=!!b.labelOutlineWidth;if(d){var e=OpenLayers.Util.extend({},b);e.fontColor=e.labelOutlineColor;e.fontStrokeColor=e.labelOutlineColor;e.fontStrokeWidth=b.labelOutlineWidth;b.labelOutlineOpacity&&(e.fontOpacity=b.labelOutlineOpacity);delete e.labelOutlineWidth;this.drawText(a,e,c)}var f=this.getResolution(),e=(c.x-this.featureDx)/f+this.left,g=c.y/
+f-this.top,d=d?this.LABEL_OUTLINE_SUFFIX:this.LABEL_ID_SUFFIX,f=this.nodeFactory(a+d,"text");f.setAttributeNS(null,"x",e);f.setAttributeNS(null,"y",-g);b.fontColor&&f.setAttributeNS(null,"fill",b.fontColor);b.fontStrokeColor&&f.setAttributeNS(null,"stroke",b.fontStrokeColor);b.fontStrokeWidth&&f.setAttributeNS(null,"stroke-width",b.fontStrokeWidth);b.fontOpacity&&f.setAttributeNS(null,"opacity",b.fontOpacity);b.fontFamily&&f.setAttributeNS(null,"font-family",b.fontFamily);b.fontSize&&f.setAttributeNS(null,
+"font-size",b.fontSize);b.fontWeight&&f.setAttributeNS(null,"font-weight",b.fontWeight);b.fontStyle&&f.setAttributeNS(null,"font-style",b.fontStyle);!0===b.labelSelect?(f.setAttributeNS(null,"pointer-events","visible"),f._featureId=a):f.setAttributeNS(null,"pointer-events","none");g=b.labelAlign||OpenLayers.Renderer.defaultSymbolizer.labelAlign;f.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[g[0]]||"middle");!0===OpenLayers.IS_GECKO&&f.setAttributeNS(null,"dominant-baseline",
+OpenLayers.Renderer.SVG.LABEL_ALIGN[g[1]]||"central");for(var h=b.label.split("\n"),k=h.length;f.childNodes.length>k;)f.removeChild(f.lastChild);for(var l=0;l<k;l++){var m=this.nodeFactory(a+d+"_tspan_"+l,"tspan");!0===b.labelSelect&&(m._featureId=a,m._geometry=c,m._geometryClass=c.CLASS_NAME);!1===OpenLayers.IS_GECKO&&m.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[g[1]]||"-35%");m.setAttribute("x",e);if(0==l){var r=OpenLayers.Renderer.SVG.LABEL_VFACTOR[g[1]];null==r&&
+(r=-0.5);m.setAttribute("dy",r*(k-1)+"em")}else m.setAttribute("dy","1em");m.textContent=""===h[l]?" ":h[l];m.parentNode||f.appendChild(m)}f.parentNode||this.textRoot.appendChild(f)},getComponentsString:function(a,b){for(var c=[],d=!0,e=a.length,f=[],g,h=0;h<e;h++)g=a[h],c.push(g),(g=this.getShortString(g))?f.push(g):(0<h&&this.getShortString(a[h-1])&&f.push(this.clipLine(a[h],a[h-1])),h<e-1&&this.getShortString(a[h+1])&&f.push(this.clipLine(a[h],a[h+1])),d=!1);return{path:f.join(b||","),complete:d}},
+clipLine:function(a,b){if(b.equals(a))return"";var c=this.getResolution(),d=this.MAX_PIXEL-this.translationParameters.x,e=this.MAX_PIXEL-this.translationParameters.y,f=(b.x-this.featureDx)/c+this.left,g=this.top-b.y/c,h=(a.x-this.featureDx)/c+this.left,c=this.top-a.y/c,k;if(h<-d||h>d)k=(c-g)/(h-f),h=0>h?-d:d,c=g+(h-f)*k;if(c<-e||c>e)k=(h-f)/(c-g),c=0>c?-e:e,h=f+(c-g)*k;return h+","+c},getShortString:function(a){var b=this.getResolution(),c=(a.x-this.featureDx)/b+this.left;a=this.top-a.y/b;return this.inValidRange(c,
+a)?c+","+a:!1},getPosition:function(a){return{x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))}},importSymbol:function(a){this.defs||(this.defs=this.createDefs());var b=this.container.id+"-"+a,c=document.getElementById(b);if(null!=c)return c;var d=OpenLayers.Renderer.symbol[a];if(!d)throw Error(a+" is not a valid symbol name");a=this.nodeFactory(b,"symbol");var e=this.nodeFactory(null,"polygon");a.appendChild(e);for(var c=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,
+0,0),f=[],g,h,k=0;k<d.length;k+=2)g=d[k],h=d[k+1],c.left=Math.min(c.left,g),c.bottom=Math.min(c.bottom,h),c.right=Math.max(c.right,g),c.top=Math.max(c.top,h),f.push(g,",",h);e.setAttributeNS(null,"points",f.join(" "));d=c.getWidth();e=c.getHeight();a.setAttributeNS(null,"viewBox",[c.left-d,c.bottom-e,3*d,3*e].join(" "));this.symbolMetrics[b]=[Math.max(d,e),c.getCenterLonLat().lon,c.getCenterLonLat().lat];this.defs.appendChild(a);return a},getFeatureIdFromEvent:function(a){var b=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,
+arguments);b||(b=a.target,b=b.parentNode&&b!=this.rendererRoot?b.parentNode._featureId:void 0);return b},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={l:"start",r:"end",b:"bottom",t:"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={t:"-70%",b:"0"};OpenLayers.Renderer.SVG.LABEL_VFACTOR={t:0,b:-1};OpenLayers.Renderer.SVG.preventDefault=function(a){OpenLayers.Event.preventDefault(a)};OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(a){if(this.supported()){if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);for(var b=document.createStyleSheet(),c="shape rect oval fill stroke imagedata group textbox".split(" "),d=0,e=c.length;d<e;d++)b.addRule("olv\\:"+c[d],"behavior: url(#default#VML); position: absolute; display: inline-block;")}OpenLayers.Renderer.Elements.prototype.initialize.apply(this,
 arguments)}},supported:function(){return!!document.namespaces},setExtent:function(a,b){var c=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),d=this.getResolution(),e=a.left/d|0,d=a.top/d-this.size.h|0;b||!this.offset?(this.offset={x:e,y:d},d=e=0):(e-=this.offset.x,d-=this.offset.y);this.root.coordorigin=e-this.xOffset+" "+d;for(var e=[this.root,this.vectorRoot,this.textRoot],f=0,g=e.length;f<g;++f)d=e[f],d.coordsize=this.size.w+" "+this.size.h;this.root.style.flip="y";return c},
 setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);for(var b=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot],c=this.size.w+"px",d=this.size.h+"px",e,f=0,g=b.length;f<g;++f)e=b[f],e.style.width=c,e.style.height=d},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":c=b.externalGraphic?"olv:rect":this.isComplexSymbol(b.graphicName)?"olv:shape":"olv:oval";break;case "OpenLayers.Geometry.Rectangle":c="olv:rect";break;case "OpenLayers.Geometry.LineString":case "OpenLayers.Geometry.LinearRing":case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":c=
 "olv:shape"}return c},setStyle:function(a,b,c,d){b=b||a._style;c=c||a._options;var e=b.fillColor,f=b.title||b.graphicTitle;f&&(a.title=f);if("OpenLayers.Geometry.Point"===a._geometryClass)if(b.externalGraphic){c.isFilled=!0;var e=b.graphicWidth||b.graphicHeight,f=b.graphicHeight||b.graphicWidth,e=e?e:2*b.pointRadius,f=f?f:2*b.pointRadius,g=this.getResolution(),h=void 0!=b.graphicXOffset?b.graphicXOffset:-(0.5*e),k=void 0!=b.graphicYOffset?b.graphicYOffset:-(0.5*f);a.style.left=((d.x-this.featureDx)/
 arguments)}},supported:function(){return!!document.namespaces},setExtent:function(a,b){var c=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),d=this.getResolution(),e=a.left/d|0,d=a.top/d-this.size.h|0;b||!this.offset?(this.offset={x:e,y:d},d=e=0):(e-=this.offset.x,d-=this.offset.y);this.root.coordorigin=e-this.xOffset+" "+d;for(var e=[this.root,this.vectorRoot,this.textRoot],f=0,g=e.length;f<g;++f)d=e[f],d.coordsize=this.size.w+" "+this.size.h;this.root.style.flip="y";return c},
 setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);for(var b=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot],c=this.size.w+"px",d=this.size.h+"px",e,f=0,g=b.length;f<g;++f)e=b[f],e.style.width=c,e.style.height=d},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":c=b.externalGraphic?"olv:rect":this.isComplexSymbol(b.graphicName)?"olv:shape":"olv:oval";break;case "OpenLayers.Geometry.Rectangle":c="olv:rect";break;case "OpenLayers.Geometry.LineString":case "OpenLayers.Geometry.LinearRing":case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":c=
 "olv:shape"}return c},setStyle:function(a,b,c,d){b=b||a._style;c=c||a._options;var e=b.fillColor,f=b.title||b.graphicTitle;f&&(a.title=f);if("OpenLayers.Geometry.Point"===a._geometryClass)if(b.externalGraphic){c.isFilled=!0;var e=b.graphicWidth||b.graphicHeight,f=b.graphicHeight||b.graphicWidth,e=e?e:2*b.pointRadius,f=f?f:2*b.pointRadius,g=this.getResolution(),h=void 0!=b.graphicXOffset?b.graphicXOffset:-(0.5*e),k=void 0!=b.graphicYOffset?b.graphicYOffset:-(0.5*f);a.style.left=((d.x-this.featureDx)/
@@ -695,9 +614,95 @@ g*f),l=Math.round(d.graphicHeight||g);a.style.width=k+"px";a.style.height=l+"px"
 a.strokeDashstyle;switch(a){case "solid":case "dot":case "dash":case "dashdot":case "longdash":case "longdashdot":return a;default:return a=a.split(/[ ,]/),2==a.length?1*a[0]>=2*a[1]?"longdash":1==a[0]||1==a[1]?"dot":"dash":4==a.length?1*a[0]>=2*a[1]?"longdashdot":"dashdot":"solid"}},createNode:function(a,b){var c=document.createElement(a);b&&(c.id=b);c.unselectable="on";c.onselectstart=OpenLayers.Function.False;return c},nodeTypeCompare:function(a,b){var c=b,d=c.indexOf(":");-1!=d&&(c=c.substr(d+
 1));var e=a.nodeName,d=e.indexOf(":");-1!=d&&(e=e.substr(d+1));return c==e},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"olv:group")},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(a,b,c){if(!isNaN(b.x)&&!isNaN(b.y)){var d=this.getResolution();a.style.left=((b.x-this.featureDx)/d-this.offset.x|0)-c+"px";a.style.top=(b.y/d-this.offset.y|0)-c+"px";b=2*c;a.style.width=
 b+"px";a.style.height=b+"px";return a}return!1},drawLineString:function(a,b){return this.drawLine(a,b,!1)},drawLinearRing:function(a,b){return this.drawLine(a,b,!0)},drawLine:function(a,b,c){this.setNodeDimension(a,b);for(var d=this.getResolution(),e=b.components.length,f=Array(e),g,h,k=0;k<e;k++)g=b.components[k],h=(g.x-this.featureDx)/d-this.offset.x|0,g=g.y/d-this.offset.y|0,f[k]=" "+h+","+g+" l ";a.path="m"+f.join("")+(c?" x e":" e");return a},drawPolygon:function(a,b){this.setNodeDimension(a,
 a.strokeDashstyle;switch(a){case "solid":case "dot":case "dash":case "dashdot":case "longdash":case "longdashdot":return a;default:return a=a.split(/[ ,]/),2==a.length?1*a[0]>=2*a[1]?"longdash":1==a[0]||1==a[1]?"dot":"dash":4==a.length?1*a[0]>=2*a[1]?"longdashdot":"dashdot":"solid"}},createNode:function(a,b){var c=document.createElement(a);b&&(c.id=b);c.unselectable="on";c.onselectstart=OpenLayers.Function.False;return c},nodeTypeCompare:function(a,b){var c=b,d=c.indexOf(":");-1!=d&&(c=c.substr(d+
 1));var e=a.nodeName,d=e.indexOf(":");-1!=d&&(e=e.substr(d+1));return c==e},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div")},createRoot:function(a){return this.nodeFactory(this.container.id+a,"olv:group")},drawPoint:function(a,b){return this.drawCircle(a,b,1)},drawCircle:function(a,b,c){if(!isNaN(b.x)&&!isNaN(b.y)){var d=this.getResolution();a.style.left=((b.x-this.featureDx)/d-this.offset.x|0)-c+"px";a.style.top=(b.y/d-this.offset.y|0)-c+"px";b=2*c;a.style.width=
 b+"px";a.style.height=b+"px";return a}return!1},drawLineString:function(a,b){return this.drawLine(a,b,!1)},drawLinearRing:function(a,b){return this.drawLine(a,b,!0)},drawLine:function(a,b,c){this.setNodeDimension(a,b);for(var d=this.getResolution(),e=b.components.length,f=Array(e),g,h,k=0;k<e;k++)g=b.components[k],h=(g.x-this.featureDx)/d-this.offset.x|0,g=g.y/d-this.offset.y|0,f[k]=" "+h+","+g+" l ";a.path="m"+f.join("")+(c?" x e":" e");return a},drawPolygon:function(a,b){this.setNodeDimension(a,
-b);var c=this.getResolution(),d=[],e,f,g,h,k,l,m,r,p,n;e=0;for(f=b.components.length;e<f;e++){d.push("m");g=b.components[e].components;h=0===e;l=k=null;m=0;for(r=g.length;m<r;m++)p=g[m],n=(p.x-this.featureDx)/c-this.offset.x|0,p=p.y/c-this.offset.y|0,n=" "+n+","+p,d.push(n),0==m&&d.push(" l"),h||(k?k!=n&&(l?l!=n&&(h=!0):l=n):k=n);d.push(h?" x ":" ")}d.push("e");a.path=d.join("");return a},drawRectangle:function(a,b){var c=this.getResolution();a.style.left=((b.x-this.featureDx)/c-this.offset.x|0)+
+b);var c=this.getResolution(),d=[],e,f,g,h,k,l,m,r,q,n;e=0;for(f=b.components.length;e<f;e++){d.push("m");g=b.components[e].components;h=0===e;l=k=null;m=0;for(r=g.length;m<r;m++)q=g[m],n=(q.x-this.featureDx)/c-this.offset.x|0,q=q.y/c-this.offset.y|0,n=" "+n+","+q,d.push(n),0==m&&d.push(" l"),h||(k?k!=n&&(l?l!=n&&(h=!0):l=n):k=n);d.push(h?" x ":" ")}d.push("e");a.path=d.join("");return a},drawRectangle:function(a,b){var c=this.getResolution();a.style.left=((b.x-this.featureDx)/c-this.offset.x|0)+
 "px";a.style.top=(b.y/c-this.offset.y|0)+"px";a.style.width=(b.width/c|0)+"px";a.style.height=(b.height/c|0)+"px";return a},drawText:function(a,b,c){var d=this.nodeFactory(a+this.LABEL_ID_SUFFIX,"olv:rect"),e=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox"),f=this.getResolution();d.style.left=((c.x-this.featureDx)/f-this.offset.x|0)+"px";d.style.top=(c.y/f-this.offset.y|0)+"px";d.style.flip="y";e.innerText=b.label;"inherit"!=b.cursor&&null!=b.cursor&&(e.style.cursor=b.cursor);b.fontColor&&
 (e.style.color=b.fontColor);b.fontOpacity&&(e.style.filter="alpha(opacity="+100*b.fontOpacity+")");b.fontFamily&&(e.style.fontFamily=b.fontFamily);b.fontSize&&(e.style.fontSize=b.fontSize);b.fontWeight&&(e.style.fontWeight=b.fontWeight);b.fontStyle&&(e.style.fontStyle=b.fontStyle);!0===b.labelSelect&&(d._featureId=a,e._featureId=a,e._geometry=c,e._geometryClass=c.CLASS_NAME);e.style.whiteSpace="nowrap";e.inset="1px,0px,0px,0px";d.parentNode||(d.appendChild(e),this.textRoot.appendChild(d));b=b.labelAlign||
 "cm";1==b.length&&(b+="m");a=e.clientWidth*OpenLayers.Renderer.VML.LABEL_SHIFT[b.substr(0,1)];e=e.clientHeight*OpenLayers.Renderer.VML.LABEL_SHIFT[b.substr(1,1)];d.style.left=parseInt(d.style.left)-a-1+"px";d.style.top=parseInt(d.style.top)+e+"px"},moveRoot:function(a){var b=this.map.getLayer(a.container.id);b instanceof OpenLayers.Layer.Vector.RootContainer&&(b=this.map.getLayer(this.container.id));b&&b.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);b&&b.redraw()},
 importSymbol:function(a){var b=this.container.id+"-"+a,c=this.symbolCache[b];if(c)return c;c=OpenLayers.Renderer.symbol[a];if(!c)throw Error(a+" is not a valid symbol name");a=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);for(var d=["m"],e=0;e<c.length;e+=2){var f=c[e],g=c[e+1];a.left=Math.min(a.left,f);a.bottom=Math.min(a.bottom,g);a.right=Math.max(a.right,f);a.top=Math.max(a.top,g);d.push(f);d.push(g);0==e&&d.push("l")}d.push("x e");c=d.join(" ");d=(a.getWidth()-a.getHeight())/2;
 "px";a.style.top=(b.y/c-this.offset.y|0)+"px";a.style.width=(b.width/c|0)+"px";a.style.height=(b.height/c|0)+"px";return a},drawText:function(a,b,c){var d=this.nodeFactory(a+this.LABEL_ID_SUFFIX,"olv:rect"),e=this.nodeFactory(a+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox"),f=this.getResolution();d.style.left=((c.x-this.featureDx)/f-this.offset.x|0)+"px";d.style.top=(c.y/f-this.offset.y|0)+"px";d.style.flip="y";e.innerText=b.label;"inherit"!=b.cursor&&null!=b.cursor&&(e.style.cursor=b.cursor);b.fontColor&&
 (e.style.color=b.fontColor);b.fontOpacity&&(e.style.filter="alpha(opacity="+100*b.fontOpacity+")");b.fontFamily&&(e.style.fontFamily=b.fontFamily);b.fontSize&&(e.style.fontSize=b.fontSize);b.fontWeight&&(e.style.fontWeight=b.fontWeight);b.fontStyle&&(e.style.fontStyle=b.fontStyle);!0===b.labelSelect&&(d._featureId=a,e._featureId=a,e._geometry=c,e._geometryClass=c.CLASS_NAME);e.style.whiteSpace="nowrap";e.inset="1px,0px,0px,0px";d.parentNode||(d.appendChild(e),this.textRoot.appendChild(d));b=b.labelAlign||
 "cm";1==b.length&&(b+="m");a=e.clientWidth*OpenLayers.Renderer.VML.LABEL_SHIFT[b.substr(0,1)];e=e.clientHeight*OpenLayers.Renderer.VML.LABEL_SHIFT[b.substr(1,1)];d.style.left=parseInt(d.style.left)-a-1+"px";d.style.top=parseInt(d.style.top)+e+"px"},moveRoot:function(a){var b=this.map.getLayer(a.container.id);b instanceof OpenLayers.Layer.Vector.RootContainer&&(b=this.map.getLayer(this.container.id));b&&b.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);b&&b.redraw()},
 importSymbol:function(a){var b=this.container.id+"-"+a,c=this.symbolCache[b];if(c)return c;c=OpenLayers.Renderer.symbol[a];if(!c)throw Error(a+" is not a valid symbol name");a=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);for(var d=["m"],e=0;e<c.length;e+=2){var f=c[e],g=c[e+1];a.left=Math.min(a.left,f);a.bottom=Math.min(a.bottom,g);a.right=Math.max(a.right,f);a.top=Math.max(a.top,g);d.push(f);d.push(g);0==e&&d.push("l")}d.push("x e");c=d.join(" ");d=(a.getWidth()-a.getHeight())/2;
-0<d?(a.bottom-=d,a.top+=d):(a.left+=d,a.right-=d);c={path:c,size:a.getWidth(),left:a.left,bottom:a.bottom};return this.symbolCache[b]=c},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={l:0,c:0.5,r:1,t:0,m:0.5,b:1};OpenLayers.Protocol.WFS.v1_0_0=OpenLayers.Class(OpenLayers.Protocol.WFS.v1,{version:"1.0.0",CLASS_NAME:"OpenLayers.Protocol.WFS.v1_0_0"});
+0<d?(a.bottom-=d,a.top+=d):(a.left+=d,a.right-=d);c={path:c,size:a.getWidth(),left:a.left,bottom:a.bottom};return this.symbolCache[b]=c},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={l:0,c:0.5,r:1,t:0,m:0.5,b:1};OpenLayers.Tile=OpenLayers.Class({events:null,eventListeners:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:!1,initialize:function(a,b,c,d,e,f){this.layer=a;this.position=b.clone();this.setBounds(c);this.url=d;e&&(this.size=e.clone());this.id=OpenLayers.Util.createUniqueID("Tile_");OpenLayers.Util.extend(this,f);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object)this.events.on(this.eventListeners)},unload:function(){this.isLoading&&(this.isLoading=
+!1,this.events.triggerEvent("unload"))},destroy:function(){this.position=this.size=this.bounds=this.layer=null;this.eventListeners&&this.events.un(this.eventListeners);this.events.destroy();this.events=this.eventListeners=null},draw:function(a){a||this.clear();var b=this.shouldDraw();b&&(!a&&!1===this.events.triggerEvent("beforedraw"))&&(b=null);return b},shouldDraw:function(){var a=!1,b=this.layer.maxExtent;if(b){var c=this.layer.map,c=c.baseLayer.wrapDateLine&&c.getMaxExtent();this.bounds.intersectsBounds(b,
+{inclusive:!1,worldBounds:c})&&(a=!0)}return a||this.layer.displayOutsideMaxExtent},setBounds:function(a){a=a.clone();if(this.layer.map.baseLayer.wrapDateLine){var b=this.layer.map.getMaxExtent(),c=this.layer.map.getResolution();a=a.wrapDateLine(b,{leftTolerance:c,rightTolerance:c})}this.bounds=a},moveTo:function(a,b,c){null==c&&(c=!0);this.setBounds(a);this.position=b.clone();c&&this.draw()},clear:function(a){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,imageReloadAttempts:null,layerAlphaHack:null,asyncRequestId:null,maxGetUrlLength:null,canvasContext:null,crossOriginKeyword:null,initialize:function(a,b,c,d,e,f){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=d;this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();if(null!=this.maxGetUrlLength||this.layer.gutter||this.layerAlphaHack)this.frame=document.createElement("div"),this.frame.style.position=
+"absolute",this.frame.style.overflow="hidden";null!=this.maxGetUrlLength&&OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame)},destroy:function(){this.imgDiv&&(this.clear(),this.frame=this.imgDiv=null);this.asyncRequestId=null;OpenLayers.Tile.prototype.destroy.apply(this,arguments)},draw:function(){var a=OpenLayers.Tile.prototype.draw.apply(this,arguments);a?(this.layer!=this.layer.map.baseLayer&&this.layer.reproject&&(this.bounds=this.getBoundsFromBaseLayer(this.position)),this.isLoading?this._loadEvent=
+"reload":(this.isLoading=!0,this._loadEvent="loadstart"),this.renderTile(),this.positionTile()):!1===a&&this.unload();return a},renderTile:function(){if(this.layer.async){var a=this.asyncRequestId=(this.asyncRequestId||0)+1;this.layer.getURLasync(this.bounds,function(b){a==this.asyncRequestId&&(this.url=b,this.initImage())},this)}else this.url=this.layer.getURL(this.bounds),this.initImage()},positionTile:function(){var a=this.getTile().style,b=this.frame?this.size:this.layer.getImageSize(this.bounds),
+c=1;this.layer instanceof OpenLayers.Layer.Grid&&(c=this.layer.getServerResolution()/this.layer.map.getResolution());a.left=this.position.x+"px";a.top=this.position.y+"px";a.width=Math.round(c*b.w)+"px";a.height=Math.round(c*b.h)+"px"},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);var a=this.imgDiv;if(a){var b=this.getTile();b.parentNode===this.layer.div&&this.layer.div.removeChild(b);this.setImgSrc();!0===this.layerAlphaHack&&(a.style.filter="");OpenLayers.Element.removeClass(a,
+"olImageLoadError")}this.canvasContext=null},getImage:function(){if(!this.imgDiv){this.imgDiv=OpenLayers.Tile.Image.IMAGE.cloneNode(!1);var a=this.imgDiv.style;if(this.frame){var b=0,c=0;this.layer.gutter&&(b=100*(this.layer.gutter/this.layer.tileSize.w),c=100*(this.layer.gutter/this.layer.tileSize.h));a.left=-b+"%";a.top=-c+"%";a.width=2*b+100+"%";a.height=2*c+100+"%"}a.visibility="hidden";a.opacity=0;1>this.layer.opacity&&(a.filter="alpha(opacity="+100*this.layer.opacity+")");a.position="absolute";
+this.layerAlphaHack&&(a.paddingTop=a.height,a.height="0",a.width="100%");this.frame&&this.frame.appendChild(this.imgDiv)}return this.imgDiv},setImage:function(a){this.imgDiv=a},initImage:function(){if(!this.url&&!this.imgDiv)this.isLoading=!1;else{this.events.triggerEvent("beforeload");this.layer.div.appendChild(this.getTile());this.events.triggerEvent(this._loadEvent);var a=this.getImage(),b=a.getAttribute("src")||"";this.url&&OpenLayers.Util.isEquivalentUrl(b,this.url)?this._loadTimeout=window.setTimeout(OpenLayers.Function.bind(this.onImageLoad,
+this),0):(this.stopLoading(),this.crossOriginKeyword&&a.removeAttribute("crossorigin"),OpenLayers.Event.observe(a,"load",OpenLayers.Function.bind(this.onImageLoad,this)),OpenLayers.Event.observe(a,"error",OpenLayers.Function.bind(this.onImageError,this)),this.imageReloadAttempts=0,this.setImgSrc(this.url))}},setImgSrc:function(a){var b=this.imgDiv;a?(b.style.visibility="hidden",b.style.opacity=0,this.crossOriginKeyword&&("data:"!==a.substr(0,5)?b.setAttribute("crossorigin",this.crossOriginKeyword):
+b.removeAttribute("crossorigin")),b.src=a):(this.stopLoading(),this.imgDiv=null,b.parentNode&&b.parentNode.removeChild(b))},getTile:function(){return this.frame?this.frame:this.getImage()},createBackBuffer:function(){if(this.imgDiv&&!this.isLoading){var a;this.frame?(a=this.frame.cloneNode(!1),a.appendChild(this.imgDiv)):a=this.imgDiv;this.imgDiv=null;return a}},onImageLoad:function(){var a=this.imgDiv;this.stopLoading();a.style.visibility="inherit";a.style.opacity=this.layer.opacity;this.isLoading=
+!1;this.canvasContext=null;this.events.triggerEvent("loadend");!0===this.layerAlphaHack&&(a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a.src+"', sizingMethod='scale')")},onImageError:function(){var a=this.imgDiv;null!=a.src&&(this.imageReloadAttempts++,this.imageReloadAttempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS?this.setImgSrc(this.layer.getURL(this.bounds)):(OpenLayers.Element.addClass(a,"olImageLoadError"),this.events.triggerEvent("loaderror"),this.onImageLoad()))},stopLoading:function(){OpenLayers.Event.stopObservingElement(this.imgDiv);
+window.clearTimeout(this._loadTimeout);delete this._loadTimeout},getCanvasContext:function(){if(OpenLayers.CANVAS_SUPPORTED&&this.imgDiv&&!this.isLoading){if(!this.canvasContext){var a=document.createElement("canvas");a.width=this.size.w;a.height=this.size.h;this.canvasContext=a.getContext("2d");this.canvasContext.drawImage(this.imgDiv,0,0)}return this.canvasContext}},CLASS_NAME:"OpenLayers.Tile.Image"});
+OpenLayers.Tile.Image.IMAGE=function(){var a=new Image;a.className="olTileImage";a.galleryImg="no";return a}();OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!0,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(a,b,c,d,e){this.url=b;this.maxExtent=this.extent=c;this.size=d;OpenLayers.Layer.prototype.initialize.apply(this,[a,e]);this.aspectRatio=this.extent.getHeight()/this.size.h/(this.extent.getWidth()/this.size.w)},destroy:function(){this.tile&&(this.removeTileMonitoringHooks(this.tile),this.tile.destroy(),this.tile=null);OpenLayers.Layer.prototype.destroy.apply(this,
+arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.getOptions()));return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setMap:function(a){null==this.options.maxResolution&&(this.options.maxResolution=this.aspectRatio*this.extent.getWidth()/this.size.w);OpenLayers.Layer.prototype.setMap.apply(this,arguments)},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var d=null==this.tile;if(b||d){this.setTileSize();
+var e=this.map.getLayerPxFromLonLat({lon:this.extent.left,lat:this.extent.top});d?(this.tile=new OpenLayers.Tile.Image(this,e,this.extent,null,this.tileSize),this.addTileMonitoringHooks(this.tile)):(this.tile.size=this.tileSize.clone(),this.tile.position=e.clone());this.tile.draw()}},setTileSize:function(){var a=this.extent.getWidth()/this.map.getResolution(),b=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(a,b)},addTileMonitoringHooks:function(a){a.onLoadStart=
+function(){this.events.triggerEvent("loadstart")};a.events.register("loadstart",this,a.onLoadStart);a.onLoadEnd=function(){this.events.triggerEvent("loadend")};a.events.register("loadend",this,a.onLoadEnd);a.events.register("unload",this,a.onLoadEnd)},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,scope:this})},setUrl:function(a){this.url=a;this.tile.draw()},getURL:function(a){return this.url},CLASS_NAME:"OpenLayers.Layer.Image"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:!1,initialize:function(a,b,c,d){OpenLayers.Layer.prototype.initialize.apply(this,[a,d]);this.url=b;this.params||(this.params=OpenLayers.Util.extend({},c))},destroy:function(){this.params=this.url=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){null==a&&(a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions()));
+return a=OpenLayers.Layer.prototype.clone.apply(this,[a])},setUrl:function(a){this.url=a},mergeNewParams:function(a){this.params=OpenLayers.Util.extend(this.params,a);a=this.redraw();null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"params"});return a},redraw:function(a){return a?(this.events.triggerEvent("refresh"),this.mergeNewParams({_olSalt:Math.random()})):OpenLayers.Layer.prototype.redraw.apply(this,[])},selectUrl:function(a,b){for(var c=1,d=0,e=a.length;d<e;d++)c*=
+a.charCodeAt(d)*this.URL_HASH_FACTOR,c-=Math.floor(c);return b[Math.floor(c*b.length)]},getFullRequestString:function(a,b){var c=b||this.url,d=OpenLayers.Util.extend({},this.params),d=OpenLayers.Util.extend(d,a),e=OpenLayers.Util.getParameterString(d);OpenLayers.Util.isArray(c)&&(c=this.selectUrl(e,c));var e=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(c)),f;for(f in d)f.toUpperCase()in e&&delete d[f];e=OpenLayers.Util.getParameterString(d);return OpenLayers.Util.urlAppend(c,e)},
+CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,tileOriginCorner:"bl",tileOrigin:null,tileOptions:null,tileClass:OpenLayers.Tile.Image,grid:null,singleTile:!1,ratio:1.5,buffer:0,transitionEffect:"resize",numLoadingTiles:0,serverResolutions:null,loading:!1,backBuffer:null,gridResolution:null,backBufferResolution:null,backBufferLonLat:null,backBufferTimerId:null,removeBackBufferDelay:null,className:null,gridLayout:null,rowSign:null,transitionendEvents:["transitionend",
+"webkitTransitionEnd","otransitionend","oTransitionEnd"],initialize:function(a,b,c,d){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.grid=[];this._removeBackBuffer=OpenLayers.Function.bind(this.removeBackBuffer,this);this.initProperties();this.rowSign="t"===this.tileOriginCorner.substr(0,1)?1:-1},initProperties:function(){void 0===this.options.removeBackBufferDelay&&(this.removeBackBufferDelay=this.singleTile?0:2500);void 0===this.options.className&&(this.className=this.singleTile?
+"olLayerGridSingleTile":"olLayerGrid")},setMap:function(a){OpenLayers.Layer.HTTPRequest.prototype.setMap.call(this,a);OpenLayers.Element.addClass(this.div,this.className)},removeMap:function(a){this.removeBackBuffer()},destroy:function(){this.removeBackBuffer();this.clearGrid();this.tileSize=this.grid=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var a=0,b=this.grid.length;a<b;a++)for(var c=this.grid[a],d=0,e=c.length;d<e;d++)this.destroyTile(c[d]);
+this.grid=[];this.gridLayout=this.gridResolution=null}},addOptions:function(a,b){var c=void 0!==a.singleTile&&a.singleTile!==this.singleTile;OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this,arguments);this.map&&c&&(this.initProperties(),this.clearGrid(),this.tileSize=this.options.tileSize,this.setTileSize(),this.visibility&&this.moveTo(null,!0))},clone:function(a){null==a&&(a=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions()));a=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,
+[a]);null!=this.tileSize&&(a.tileSize=this.tileSize.clone());a.grid=[];a.gridResolution=null;a.backBuffer=null;a.backBufferTimerId=null;a.loading=!1;a.numLoadingTiles=0;return a},moveTo:function(a,b,c){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);a=a||this.map.getExtent();if(null!=a){var d=!this.grid.length||b,e=this.getTilesBounds(),f=this.map.getResolution();this.getServerResolution(f);if(this.singleTile){if(d||!c&&!e.containsBounds(a))b&&"resize"!==this.transitionEffect&&
+this.removeBackBuffer(),(!b||"resize"===this.transitionEffect)&&this.applyBackBuffer(f),this.initSingleTile(a)}else(d=d||!e.intersectsBounds(a,{worldBounds:this.map.baseLayer.wrapDateLine&&this.map.getMaxExtent()}))?(b&&("resize"===this.transitionEffect||this.gridResolution===f)&&this.applyBackBuffer(f),this.initGriddedTiles(a)):this.moveGriddedTiles()}},getTileData:function(a){var b=null,c=a.lon,d=a.lat,e=this.grid.length;if(this.map&&e){var f=this.map.getResolution();a=this.tileSize.w;var g=this.tileSize.h,
+h=this.grid[0][0].bounds,k=h.left,h=h.top;if(c<k&&this.map.baseLayer.wrapDateLine)var l=this.map.getMaxExtent().getWidth(),m=Math.ceil((k-c)/l),c=c+l*m;c=(c-k)/(f*a);d=(h-d)/(f*g);f=Math.floor(c);k=Math.floor(d);0<=k&&k<e&&(e=this.grid[k][f])&&(b={tile:e,i:Math.floor((c-f)*a),j:Math.floor((d-k)*g)})}return b},destroyTile:function(a){this.removeTileMonitoringHooks(a);a.destroy()},getServerResolution:function(a){var b=Number.POSITIVE_INFINITY;a=a||this.map.getResolution();if(this.serverResolutions&&
+-1===OpenLayers.Util.indexOf(this.serverResolutions,a)){var c,d,e,f;for(c=this.serverResolutions.length-1;0<=c;c--){e=this.serverResolutions[c];d=Math.abs(e-a);if(d>b)break;b=d;f=e}a=f}return a},getServerZoom:function(){var a=this.getServerResolution();return this.serverResolutions?OpenLayers.Util.indexOf(this.serverResolutions,a):this.map.getZoomForResolution(a)+(this.zoomOffset||0)},applyBackBuffer:function(a){null!==this.backBufferTimerId&&this.removeBackBuffer();var b=this.backBuffer;if(!b){b=
+this.createBackBuffer();if(!b)return;a===this.gridResolution?this.div.insertBefore(b,this.div.firstChild):this.map.baseLayer.div.parentNode.insertBefore(b,this.map.baseLayer.div);this.backBuffer=b;var c=this.grid[0][0].bounds;this.backBufferLonLat={lon:c.left,lat:c.top};this.backBufferResolution=this.gridResolution}for(var c=this.backBufferResolution/a,d=b.childNodes,e,f=d.length-1;0<=f;--f)e=d[f],e.style.top=(c*e._i*b._th|0)+"px",e.style.left=(c*e._j*b._tw|0)+"px",e.style.width=Math.round(c*e._w)+
+"px",e.style.height=Math.round(c*e._h)+"px";a=this.getViewPortPxFromLonLat(this.backBufferLonLat,a);c=this.map.layerContainerOriginPx.y;b.style.left=Math.round(a.x-this.map.layerContainerOriginPx.x)+"px";b.style.top=Math.round(a.y-c)+"px"},createBackBuffer:function(){var a;if(0<this.grid.length){a=document.createElement("div");a.id=this.div.id+"_bb";a.className="olBackBuffer";a.style.position="absolute";var b=this.map;a.style.zIndex="resize"===this.transitionEffect?this.getZIndex()-1:b.Z_INDEX_BASE.BaseLayer-
+(b.getNumLayers()-b.getLayerIndex(this));for(var b=0,c=this.grid.length;b<c;b++)for(var d=0,e=this.grid[b].length;d<e;d++){var f=this.grid[b][d],g=this.grid[b][d].createBackBuffer();g&&(g._i=b,g._j=d,g._w=this.singleTile?this.getImageSize(f.bounds).w:f.size.w,g._h=f.size.h,g.id=f.id+"_bb",a.appendChild(g))}a._tw=this.tileSize.w;a._th=this.tileSize.h}return a},removeBackBuffer:function(){if(this._transitionElement){for(var a=this.transitionendEvents.length-1;0<=a;--a)OpenLayers.Event.stopObserving(this._transitionElement,
+this.transitionendEvents[a],this._removeBackBuffer);delete this._transitionElement}this.backBuffer&&(this.backBuffer.parentNode&&this.backBuffer.parentNode.removeChild(this.backBuffer),this.backBufferResolution=this.backBuffer=null,null!==this.backBufferTimerId&&(window.clearTimeout(this.backBufferTimerId),this.backBufferTimerId=null))},moveByPx:function(a,b){this.singleTile||this.moveGriddedTiles()},setTileSize:function(a){this.singleTile&&(a=this.map.getSize(),a.h=parseInt(a.h*this.ratio,10),a.w=
+parseInt(a.w*this.ratio,10));OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[a])},getTilesBounds:function(){var a=null,b=this.grid.length;if(b)var a=this.grid[b-1][0].bounds,b=this.grid[0].length*a.getWidth(),c=this.grid.length*a.getHeight(),a=new OpenLayers.Bounds(a.left,a.bottom,a.left+b,a.bottom+c);return a},initSingleTile:function(a){this.events.triggerEvent("retile");var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio;a=a.getHeight()*this.ratio;b=new OpenLayers.Bounds(b.lon-c/
+2,b.lat-a/2,b.lon+c/2,b.lat+a/2);this.gridResolution=this.getServerResolution();if((c=this.maxExtent)&&(!this.displayOutsideMaxExtent||this.map.baseLayer.wrapDateLine&&this.maxExtent.equals(this.map.getMaxExtent())))b.left=Math.max(b.left,c.left),b.right=Math.min(b.right,c.right);c=this.map.getLayerPxFromLonLat({lon:b.left,lat:b.top});this.grid.length||(this.grid[0]=[]);(a=this.grid[0][0])?a.moveTo(b,c):(a=this.addTile(b,c),this.addTileMonitoringHooks(a),a.draw(),this.grid[0][0]=a);this.removeExcessTiles(1,
+1)},calculateGridLayout:function(a,b,c){var d=c*this.tileSize.w;c*=this.tileSize.h;var e=Math.floor((a.left-b.lon)/d)-this.buffer,f=this.rowSign;a=Math[~f?"floor":"ceil"](f*(b.lat-a.top+c)/c)-this.buffer*f;return{tilelon:d,tilelat:c,startcol:e,startrow:a}},getImageSize:function(a){var b=OpenLayers.Layer.HTTPRequest.prototype.getImageSize.apply(this,arguments);this.singleTile&&(b=new OpenLayers.Size(Math.round(a.getWidth()/this.gridResolution),b.h));return b},getTileOrigin:function(){var a=this.tileOrigin;
+if(!a)var a=this.getMaxExtent(),b={tl:["left","top"],tr:["right","top"],bl:["left","bottom"],br:["right","bottom"]}[this.tileOriginCorner],a=new OpenLayers.LonLat(a[b[0]],a[b[1]]);return a},getTileBoundsForGridIndex:function(a,b){var c=this.getTileOrigin(),d=this.gridLayout,e=d.tilelon,f=d.tilelat,g=d.startcol,d=d.startrow,h=this.rowSign;return new OpenLayers.Bounds(c.lon+(g+b)*e,c.lat-(d+a*h)*f*h,c.lon+(g+b+1)*e,c.lat-(d+(a-1)*h)*f*h)},initGriddedTiles:function(a){this.events.triggerEvent("retile");
+var b=this.map.getSize(),c=this.getTileOrigin(),d=this.map.getResolution(),e=this.getServerResolution(),f=d/e,d=this.tileSize.w/f,f=this.tileSize.h/f,g=Math.ceil(b.h/f)+2*this.buffer+1,b=Math.ceil(b.w/d)+2*this.buffer+1;this.gridLayout=e=this.calculateGridLayout(a,c,e);var c=e.tilelon,h=e.tilelat,e=this.map.layerContainerOriginPx.x,k=this.map.layerContainerOriginPx.y,l=this.getTileBoundsForGridIndex(0,0),m=this.map.getViewPortPxFromLonLat(new OpenLayers.LonLat(l.left,l.top));m.x=Math.round(m.x)-e;
+m.y=Math.round(m.y)-k;var e=[],k=this.map.getCenter(),r=0;do{var q=this.grid[r];q||(q=[],this.grid.push(q));var n=0;do{var l=this.getTileBoundsForGridIndex(r,n),p=m.clone();p.x+=n*Math.round(d);p.y+=r*Math.round(f);var s=q[n];s?s.moveTo(l,p,!1):(s=this.addTile(l,p),this.addTileMonitoringHooks(s),q.push(s));p=l.getCenterLonLat();e.push({tile:s,distance:Math.pow(p.lon-k.lon,2)+Math.pow(p.lat-k.lat,2)});n+=1}while(l.right<=a.right+c*this.buffer||n<b);r+=1}while(l.bottom>=a.bottom-h*this.buffer||r<g);
+this.removeExcessTiles(r,n);this.gridResolution=d=this.getServerResolution();e.sort(function(a,b){return a.distance-b.distance});a=0;for(d=e.length;a<d;++a)e[a].tile.draw()},getMaxExtent:function(){return this.maxExtent},addTile:function(a,b){var c=new this.tileClass(this,b,a,null,this.tileSize,this.tileOptions);this.events.triggerEvent("addtile",{tile:c});return c},addTileMonitoringHooks:function(a){a.onLoadStart=function(){!1===this.loading&&(this.loading=!0,this.events.triggerEvent("loadstart"));
+this.events.triggerEvent("tileloadstart",{tile:a});this.numLoadingTiles++;!this.singleTile&&(this.backBuffer&&this.gridResolution===this.backBufferResolution)&&OpenLayers.Element.addClass(a.getTile(),"olTileReplacing")};a.onLoadEnd=function(b){this.numLoadingTiles--;b="unload"===b.type;this.events.triggerEvent("tileloaded",{tile:a,aborted:b});if(!this.singleTile&&!b&&this.backBuffer&&this.gridResolution===this.backBufferResolution){var c=a.getTile();if("none"===OpenLayers.Element.getStyle(c,"display")){var d=
+document.getElementById(a.id+"_bb");d&&d.parentNode.removeChild(d)}OpenLayers.Element.removeClass(c,"olTileReplacing")}if(0===this.numLoadingTiles){if(this.backBuffer)if(0===this.backBuffer.childNodes.length)this.removeBackBuffer();else{this._transitionElement=b?this.div.lastChild:a.imgDiv;b=this.transitionendEvents;for(c=b.length-1;0<=c;--c)OpenLayers.Event.observe(this._transitionElement,b[c],this._removeBackBuffer);this.backBufferTimerId=window.setTimeout(this._removeBackBuffer,this.removeBackBufferDelay)}this.loading=
+!1;this.events.triggerEvent("loadend")}};a.onLoadError=function(){this.events.triggerEvent("tileerror",{tile:a})};a.events.on({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,loaderror:a.onLoadError,scope:this})},removeTileMonitoringHooks:function(a){a.unload();a.events.un({loadstart:a.onLoadStart,loadend:a.onLoadEnd,unload:a.onLoadEnd,loaderror:a.onLoadError,scope:this})},moveGriddedTiles:function(){for(var a=this.buffer+1;;){var b=this.grid[0][0],c=b.position.x+this.map.layerContainerOriginPx.x,
+b=b.position.y+this.map.layerContainerOriginPx.y,d=this.getServerResolution()/this.map.getResolution(),d={w:Math.round(this.tileSize.w*d),h:Math.round(this.tileSize.h*d)};if(c>-d.w*(a-1))this.shiftColumn(!0,d);else if(c<-d.w*a)this.shiftColumn(!1,d);else if(b>-d.h*(a-1))this.shiftRow(!0,d);else if(b<-d.h*a)this.shiftRow(!1,d);else break}},shiftRow:function(a,b){var c=this.grid,d=a?0:c.length-1,e=a?-1:1;this.gridLayout.startrow+=e*this.rowSign;for(var f=c[d],g=c[a?"pop":"shift"](),h=0,k=g.length;h<
+k;h++){var l=g[h],m=f[h].position.clone();m.y+=b.h*e;l.moveTo(this.getTileBoundsForGridIndex(d,h),m)}c[a?"unshift":"push"](g)},shiftColumn:function(a,b){var c=this.grid,d=a?0:c[0].length-1,e=a?-1:1;this.gridLayout.startcol+=e;for(var f=0,g=c.length;f<g;f++){var h=c[f],k=h[d].position.clone(),l=h[a?"pop":"shift"]();k.x+=b.w*e;l.moveTo(this.getTileBoundsForGridIndex(f,d),k);h[a?"unshift":"push"](l)}},removeExcessTiles:function(a,b){for(var c,d;this.grid.length>a;){var e=this.grid.pop();c=0;for(d=e.length;c<
+d;c++){var f=e[c];this.destroyTile(f)}}c=0;for(d=this.grid.length;c<d;c++)for(;this.grid[c].length>b;)e=this.grid[c],f=e.pop(),this.destroyTile(f)},onMapResize:function(){this.singleTile&&(this.clearGrid(),this.setTileSize())},getTileBounds:function(a){var b=this.maxExtent,c=this.getResolution(),d=c*this.tileSize.w,c=c*this.tileSize.h,e=this.getLonLatFromViewPortPx(a);a=b.left+d*Math.floor((e.lon-b.left)/d);b=b.bottom+c*Math.floor((e.lat-b.bottom)/c);return new OpenLayers.Bounds(a,b,a+d,b+c)},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,sphericalMercator:!1,zoomOffset:0,serverResolutions:null,initialize:function(a,b,c){if(c&&c.sphericalMercator||this.sphericalMercator)c=OpenLayers.Util.extend({projection:"EPSG:900913",numZoomLevels:this.serverResolutions?this.serverResolutions.length:19},c);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a||this.name,b||this.url,{},c])},clone:function(a){null==a&&(a=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions()));
+return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){a=this.getXYZ(a);var b=this.url;OpenLayers.Util.isArray(b)&&(b=this.selectUrl(""+a.x+a.y+a.z,b));return OpenLayers.String.format(b,a)},getXYZ:function(a){var b=this.getServerResolution(),c=Math.round((a.left-this.tileOrigin.lon)/(b*this.tileSize.w));a=Math.round((this.tileOrigin.lat-a.top)/(b*this.tileSize.h));b=this.getServerZoom();if(this.wrapDateLine)var d=Math.pow(2,b),c=(c%d+d)%d;return{x:c,y:a,z:b}},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,
+arguments);this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.top))},CLASS_NAME:"OpenLayers.Layer.XYZ"});OpenLayers.Layer.Bing=OpenLayers.Class(OpenLayers.Layer.XYZ,{key:null,serverResolutions:[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,0.5971642833948135,0.29858214169740677,0.14929107084870338,0.07464553542435169,0.03732276771218,
+0.01866138385609],attributionTemplate:'<span class="olBingAttribution ${type}"><div><a target="_blank" href="http://www.bing.com/maps/"><img src="${logo}" /></a></div>${copyrights}<a style="white-space: nowrap" target="_blank" href="http://www.microsoft.com/maps/product/terms.html">Terms of Use</a></span>',metadata:null,protocolRegex:/^http:/i,type:"Road",culture:"en-US",metadataParams:null,tileOptions:null,protocol:~window.location.href.indexOf("http")?"":"http:",initialize:function(a){a=OpenLayers.Util.applyDefaults({sphericalMercator:!0},
+a);OpenLayers.Layer.XYZ.prototype.initialize.apply(this,[a.name||"Bing "+(a.type||this.type),null,a]);this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options.tileOptions);this.loadMetadata()},loadMetadata:function(){this._callbackId="_callback_"+this.id.replace(/\./g,"_");window[this._callbackId]=OpenLayers.Function.bind(OpenLayers.Layer.Bing.processMetadata,this);var a=OpenLayers.Util.applyDefaults({key:this.key,jsonp:this._callbackId,include:"ImageryProviders"},this.metadataParams),
+a=this.protocol+"//dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.type+"?"+OpenLayers.Util.getParameterString(a),b=document.createElement("script");b.type="text/javascript";b.src=a;b.id=this._callbackId;document.getElementsByTagName("head")[0].appendChild(b)},initLayer:function(){var a=this.metadata.resourceSets[0].resources[0],b=a.imageUrl.replace("{quadkey}","${quadkey}"),b=b.replace("{culture}",this.culture),b=b.replace(this.protocolRegex,this.protocol);this.url=[];for(var c=0;c<a.imageUrlSubdomains.length;++c)this.url.push(b.replace("{subdomain}",
+a.imageUrlSubdomains[c]));this.addOptions({maxResolution:Math.min(this.serverResolutions[a.zoomMin],this.maxResolution||Number.POSITIVE_INFINITY),numZoomLevels:Math.min(a.zoomMax+1-a.zoomMin,this.numZoomLevels)},!0);this.isBaseLayer||this.redraw();this.updateAttribution()},getURL:function(a){if(this.url){var b=this.getXYZ(a);a=b.x;for(var c=b.y,b=b.z,d=[],e=b;0<e;--e){var f="0",g=1<<e-1;0!=(a&g)&&f++;0!=(c&g)&&(f++,f++);d.push(f)}d=d.join("");a=this.selectUrl(""+a+c+b,this.url);return OpenLayers.String.format(a,
+{quadkey:d})}},updateAttribution:function(){var a=this.metadata;if(a.resourceSets&&this.map&&this.map.center){var b=a.resourceSets[0].resources[0],c=this.map.getExtent().transform(this.map.getProjectionObject(),new OpenLayers.Projection("EPSG:4326")),d=b.imageryProviders||[],e=OpenLayers.Util.indexOf(this.serverResolutions,this.getServerResolution()),b="",f,g,h,k,l,m,r;g=0;for(h=d.length;g<h;++g){f=d[g];k=0;for(l=f.coverageAreas.length;k<l;++k)r=f.coverageAreas[k],m=OpenLayers.Bounds.fromArray(r.bbox,
+!0),c.intersectsBounds(m)&&(e<=r.zoomMax&&e>=r.zoomMin)&&(b+=f.attribution+" ")}a=a.brandLogoUri.replace(this.protocolRegex,this.protocol);this.attribution=OpenLayers.String.format(this.attributionTemplate,{type:this.type.toLowerCase(),logo:a,copyrights:b});this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"attribution"})}},setMap:function(){OpenLayers.Layer.XYZ.prototype.setMap.apply(this,arguments);this.map.events.register("moveend",this,this.updateAttribution)},clone:function(a){null==
+a&&(a=new OpenLayers.Layer.Bing(this.options));return a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},destroy:function(){this.map&&this.map.events.unregister("moveend",this,this.updateAttribution);OpenLayers.Layer.XYZ.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.Bing"});OpenLayers.Layer.Bing.processMetadata=function(a){this.metadata=a;this.initLayer();a=document.getElementById(this._callbackId);a.parentNode.removeChild(a);window[this._callbackId]=void 0;delete this._callbackId};OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,markers:null,drawn:!1,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[]},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setOpacity:function(a){if(a!=this.opacity){this.opacity=a;a=0;for(var b=this.markers.length;a<b;a++)this.markers[a].setOpacity(this.opacity)}},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,
+arguments);if(b||!this.drawn){for(var d=0,e=this.markers.length;d<e;d++)this.drawMarker(this.markers[d]);this.drawn=!0}},addMarker:function(a){this.markers.push(a);1>this.opacity&&a.setOpacity(this.opacity);this.map&&this.map.getExtent()&&(a.map=this.map,this.drawMarker(a))},removeMarker:function(a){this.markers&&this.markers.length&&(OpenLayers.Util.removeItem(this.markers,a),a.erase())},clearMarkers:function(){if(null!=this.markers)for(;0<this.markers.length;)this.removeMarker(this.markers[0])},
+drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);null==b?a.display(!1):a.isDrawn()?a.icon&&a.icon.moveTo(b):(a=a.draw(b),this.div.appendChild(a))},getDataExtent:function(){var a=null;if(this.markers&&0<this.markers.length)for(var a=new OpenLayers.Bounds,b=0,c=this.markers.length;b<c;b++)a.extend(this.markers[b].lonlat);return a},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",url:["//a.tile.openstreetmap.org/${z}/${x}/${y}.png","//b.tile.openstreetmap.org/${z}/${x}/${y}.png","//c.tile.openstreetmap.org/${z}/${x}/${y}.png"],attribution:"&copy; <a href='//www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors",sphericalMercator:!0,wrapDateLine:!0,tileOptions:null,initialize:function(a,b,c){OpenLayers.Layer.XYZ.prototype.initialize.apply(this,arguments);this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},
+this.options&&this.options.tileOptions)},clone:function(a){null==a&&(a=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Layer.SphericalMercator={getExtent:function(){var a=null;return a=this.sphericalMercator?this.map.calculateBounds():OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this)},getLonLatFromViewPortPx:function(a){return OpenLayers.Layer.prototype.getLonLatFromViewPortPx.apply(this,arguments)},getViewPortPxFromLonLat:function(a){return OpenLayers.Layer.prototype.getViewPortPxFromLonLat.apply(this,arguments)},initMercatorParameters:function(){this.RESOLUTIONS=[];for(var a=0;a<=this.MAX_ZOOM_LEVEL;++a)this.RESOLUTIONS[a]=
+156543.03390625/Math.pow(2,a);this.units="m";this.projection=this.projection||"EPSG:900913"},forwardMercator:function(){var a=new OpenLayers.Projection("EPSG:4326"),b=new OpenLayers.Projection("EPSG:900913");return function(c,d){var e=OpenLayers.Projection.transform({x:c,y:d},a,b);return new OpenLayers.LonLat(e.x,e.y)}}(),inverseMercator:function(){var a=new OpenLayers.Projection("EPSG:4326"),b=new OpenLayers.Projection("EPSG:900913");return function(c,d){var e=OpenLayers.Projection.transform({x:c,
+y:d},b,a);return new OpenLayers.LonLat(e.x,e.y)}}()};OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:!0,isBaseLayer:!0,isFixed:!0,pane:null,mapObject:null,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);null==this.pane&&(this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane"))},destroy:function(){this.pane=this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setMap:function(a){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=
+parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";"msie"==OpenLayers.BROWSER_NAME&&(this.pane.style.background="url("+OpenLayers.Util.getImageLocation("blank.gif")+")");this.isFixed?this.map.viewPortDiv.appendChild(this.pane):this.map.layerContainerDiv.appendChild(this.pane);this.loadMapObject();null==this.mapObject&&this.loadWarningMessage();this.map.events.register("zoomstart",this,this.onZoomStart)},removeMap:function(a){this.map.events.unregister("zoomstart",
+this,this.onZoomStart);this.pane&&this.pane.parentNode&&this.pane.parentNode.removeChild(this.pane);OpenLayers.Layer.prototype.removeMap.apply(this,arguments)},onZoomStart:function(a){if(null!=this.mapObject){var b=this.getMapObjectLonLatFromOLLonLat(a.center);a=this.getMapObjectZoomFromOLZoom(a.zoom);this.setMapObjectCenter(b,a,!1)}},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var a=this.map.getSize(),b=Math.min(a.w,300),c=Math.min(a.h,200),b=new OpenLayers.Size(b,c),
+a=(new OpenLayers.Pixel(a.w/2,a.h/2)).add(-b.w/2,-b.h/2),a=OpenLayers.Util.createDiv(this.name+"_warning",a,b,null,null,null,"auto");a.style.padding="7px";a.style.backgroundColor="yellow";a.innerHTML=this.getWarningHTML();this.div.appendChild(a)},getWarningHTML:function(){return""},display:function(a){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display},setZIndex:function(a){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=
+parseInt(this.div.style.zIndex)+1},moveByPx:function(a,b){OpenLayers.Layer.prototype.moveByPx.apply(this,arguments);this.dragPanMapObject?this.dragPanMapObject(a,-b):this.moveTo(this.map.getCachedCenter())},moveTo:function(a,b,c){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(null!=this.mapObject){var d=this.map.getCenter(),e=this.map.getZoom();if(null!=d){var f=this.getMapObjectCenter(),f=this.getOLLonLatFromMapObjectLonLat(f),g=this.getMapObjectZoom(),g=this.getOLZoomFromMapObjectZoom(g);
+if(!d.equals(f)||e!=g)!b&&f&&this.dragPanMapObject&&this.smoothDragPan?(e=this.map.getViewPortPxFromLonLat(f),d=this.map.getViewPortPxFromLonLat(d),this.dragPanMapObject(d.x-e.x,e.y-d.y)):(d=this.getMapObjectLonLatFromOLLonLat(d),e=this.getMapObjectZoomFromOLZoom(e),this.setMapObjectCenter(d,e,c))}}},getLonLatFromViewPortPx:function(a){var b=null;null!=this.mapObject&&null!=this.getMapObjectCenter()&&(a=this.getMapObjectPixelFromOLPixel(a),a=this.getMapObjectLonLatFromMapObjectPixel(a),b=this.getOLLonLatFromMapObjectLonLat(a));
+return b},getViewPortPxFromLonLat:function(a){var b=null;null!=this.mapObject&&null!=this.getMapObjectCenter()&&(a=this.getMapObjectLonLatFromOLLonLat(a),a=this.getMapObjectPixelFromMapObjectLonLat(a),b=this.getOLPixelFromMapObjectPixel(a));return b},getOLLonLatFromMapObjectLonLat:function(a){var b=null;null!=a&&(b=this.getLongitudeFromMapObjectLonLat(a),a=this.getLatitudeFromMapObjectLonLat(a),b=new OpenLayers.LonLat(b,a));return b},getMapObjectLonLatFromOLLonLat:function(a){var b=null;null!=a&&
+(b=this.getMapObjectLonLatFromLonLat(a.lon,a.lat));return b},getOLPixelFromMapObjectPixel:function(a){var b=null;null!=a&&(b=this.getXFromMapObjectPixel(a),a=this.getYFromMapObjectPixel(a),b=new OpenLayers.Pixel(b,a));return b},getMapObjectPixelFromOLPixel:function(a){var b=null;null!=a&&(b=this.getMapObjectPixelFromXY(a.x,a.y));return b},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){for(var a=["minZoomLevel","maxZoomLevel","numZoomLevels"],b=0,c=a.length;b<c;b++){var d=a[b];this[d]=null!=this.options[d]?this.options[d]:this.map[d]}if(null==this.minZoomLevel||this.minZoomLevel<this.MIN_ZOOM_LEVEL)this.minZoomLevel=this.MIN_ZOOM_LEVEL;a=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;b=null==this.options.numZoomLevels&&null!=this.options.maxZoomLevel||null==this.numZoomLevels&&null!=this.maxZoomLevel?
+this.maxZoomLevel-this.minZoomLevel+1:this.numZoomLevels;this.numZoomLevels=null!=b?Math.min(b,a):a;this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(null!=this.RESOLUTIONS){a=0;this.resolutions=[];for(b=this.minZoomLevel;b<=this.maxZoomLevel;b++)this.resolutions[a++]=this.RESOLUTIONS[b];this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1]}},getResolution:function(){if(null!=this.resolutions)return OpenLayers.Layer.prototype.getResolution.apply(this,
+arguments);var a=null,b=this.map.getSize(),c=this.getExtent();null!=b&&null!=c&&(a=Math.max(c.getWidth()/b.w,c.getHeight()/b.h));return a},getExtent:function(){var a=this.map.getSize(),b=this.getLonLatFromViewPortPx({x:0,y:0}),a=this.getLonLatFromViewPortPx({x:a.w,y:a.h});return null!=b&&null!=a?new OpenLayers.Bounds(b.lon,a.lat,a.lon,b.lat):null},getZoomForResolution:function(a){if(null!=this.resolutions)return OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments);var b=OpenLayers.Layer.prototype.getExtent.apply(this,
+[]);return this.getZoomForExtent(b)},getOLZoomFromMapObjectZoom:function(a){var b=null;null!=a&&(b=a-this.minZoomLevel,this.map.baseLayer!==this&&(b=this.map.baseLayer.getZoomForResolution(this.getResolutionForZoom(b))));return b},getMapObjectZoomFromOLZoom:function(a){var b=null;null!=a&&(b=a+this.minZoomLevel,this.map.baseLayer!==this&&(b=this.getZoomForResolution(this.map.baseLayer.getResolutionForZoom(b))));return b},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});OpenLayers.Layer.Google=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:21,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,6.866455078125E-4,3.4332275390625E-4,1.71661376953125E-4,8.58306884765625E-5,4.291534423828125E-5,2.145767211914062E-5,1.072883605957031E-5,5.36441802978515E-6,2.68220901489257E-6,1.341104507446289E-6,6.705522537231445E-7],
+type:null,wrapDateLine:!0,sphericalMercator:!1,useTiltImages:!1,version:null,initialize:function(a,b){b=b||{};b.version="3";var c=OpenLayers.Layer.Google["v"+b.version.replace(/\./g,"_")];if(c)OpenLayers.Util.applyDefaults(b,c);else throw"Unsupported Google Maps API version: "+b.version;OpenLayers.Util.applyDefaults(b,c.DEFAULTS);b.maxExtent&&(b.maxExtent=b.maxExtent.clone());OpenLayers.Layer.EventPane.prototype.initialize.apply(this,[a,b]);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
+[a,b]);this.sphericalMercator&&(OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator),this.initMercatorParameters())},clone:function(){return new OpenLayers.Layer.Google(this.name,this.getOptions())},setVisibility:function(a){var b=null==this.opacity?1:this.opacity;OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this,arguments);this.setOpacity(b)},display:function(a){this._dragging||this.setGMapVisibility(a);OpenLayers.Layer.EventPane.prototype.display.apply(this,arguments)},moveTo:function(a,
+b,c){this._dragging=c;OpenLayers.Layer.EventPane.prototype.moveTo.apply(this,arguments);delete this._dragging},setOpacity:function(a){a!==this.opacity&&(null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"}),this.opacity=a);if(this.getVisibility()){var b=this.getMapContainer();OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,a)}},destroy:function(){if(this.map){this.setGMapVisibility(!1);var a=OpenLayers.Layer.Google.cache[this.map.id];a&&1>=a.count&&
+this.removeGMapElements()}OpenLayers.Layer.EventPane.prototype.destroy.apply(this,arguments)},removeGMapElements:function(){var a=OpenLayers.Layer.Google.cache[this.map.id];if(a){var b=this.mapObject&&this.getMapContainer();b&&b.parentNode&&b.parentNode.removeChild(b);(b=a.termsOfUse)&&b.parentNode&&b.parentNode.removeChild(b);(a=a.poweredBy)&&a.parentNode&&a.parentNode.removeChild(a);this.mapObject&&(window.google&&google.maps&&google.maps.event&&google.maps.event.clearListeners)&&google.maps.event.clearListeners(this.mapObject,
+"tilesloaded")}},removeMap:function(a){this.visibility&&this.mapObject&&this.setGMapVisibility(!1);var b=OpenLayers.Layer.Google.cache[a.id];b&&(1>=b.count?(this.removeGMapElements(),delete OpenLayers.Layer.Google.cache[a.id]):--b.count);delete this.termsOfUse;delete this.poweredBy;delete this.mapObject;delete this.dragObject;OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments)},getOLBoundsFromMapObjectBounds:function(a){var b=null;null!=a&&(b=a.getSouthWest(),a=a.getNorthEast(),this.sphericalMercator?
+(b=this.forwardMercator(b.lng(),b.lat()),a=this.forwardMercator(a.lng(),a.lat())):(b=new OpenLayers.LonLat(b.lng(),b.lat()),a=new OpenLayers.LonLat(a.lng(),a.lat())),b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat));return b},getWarningHTML:function(){return OpenLayers.i18n("googleWarning")},getMapObjectCenter:function(){return this.mapObject.getCenter()},getMapObjectZoom:function(){return this.mapObject.getZoom()},getLongitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),
+a.lat()).lon:a.lng()},getLatitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),a.lat()).lat:a.lat()},getXFromMapObjectPixel:function(a){return a.x},getYFromMapObjectPixel:function(a){return a.y},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Google.cache={};OpenLayers.Layer.Google.v3={DEFAULTS:{sphericalMercator:!0,projection:"EPSG:900913"},animationEnabled:!0,loadMapObject:function(){this.type||(this.type=google.maps.MapTypeId.ROADMAP);var a,b=OpenLayers.Layer.Google.cache[this.map.id];b?(a=b.mapObject,++b.count):(a=this.map.getCenter(),b=document.createElement("div"),b.className="olForeignContainer",b.style.width="100%",b.style.height="100%",a=new google.maps.Map(b,{center:a?new google.maps.LatLng(a.lat,a.lon):new google.maps.LatLng(0,0),zoom:this.map.getZoom()||
+0,mapTypeId:this.type,disableDefaultUI:!0,keyboardShortcuts:!1,draggable:!1,disableDoubleClickZoom:!0,scrollwheel:!1,streetViewControl:!1,tilt:this.useTiltImages?45:0}),b=document.createElement("div"),b.style.width="100%",b.style.height="100%",a.controls[google.maps.ControlPosition.TOP_LEFT].push(b),b={googleControl:b,mapObject:a,count:1},OpenLayers.Layer.Google.cache[this.map.id]=b);this.mapObject=a;this.setGMapVisibility(this.visibility)},onMapResize:function(){this.visibility&&google.maps.event.trigger(this.mapObject,
+"resize")},setGMapVisibility:function(a){var b=OpenLayers.Layer.Google.cache[this.map.id],c=this.map;if(b){for(var d=this.type,e=c.layers,f,g=e.length-1;0<=g;--g)if(f=e[g],f instanceof OpenLayers.Layer.Google&&!0===f.visibility&&!0===f.inRange){d=f.type;a=!0;break}var h=this.mapObject.getDiv();if(!0===a){if(h.parentNode!==c.div){if(b.rendered)b.googleControl.appendChild(c.viewPortDiv);else{h.style.visibility="hidden";var k=this;google.maps.event.addListenerOnce(this.mapObject,"tilesloaded",function(){b.rendered=
+!0;h.style.visibility="";k.setGMapVisibility(!0);k.moveTo(k.map.getCenter());b.googleControl.appendChild(c.viewPortDiv);k.setGMapVisibility(k.visible)})}c.div.appendChild(h);google.maps.event.trigger(this.mapObject,"resize")}this.mapObject.setMapTypeId(d)}else b.googleControl.hasChildNodes()&&(c.div.appendChild(c.viewPortDiv),c.div.contains(h)&&c.div.removeChild(h))}},getMapContainer:function(){return this.mapObject.getDiv()},getMapObjectBoundsFromOLBounds:function(a){var b=null;null!=a&&(b=this.sphericalMercator?
+this.inverseMercator(a.bottom,a.left):new OpenLayers.LonLat(a.bottom,a.left),a=this.sphericalMercator?this.inverseMercator(a.top,a.right):new OpenLayers.LonLat(a.top,a.right),b=new google.maps.LatLngBounds(new google.maps.LatLng(b.lat,b.lon),new google.maps.LatLng(a.lat,a.lon)));return b},getMapObjectLonLatFromMapObjectPixel:function(a){var b=this.map.getSize(),c=this.getLongitudeFromMapObjectLonLat(this.mapObject.center),d=this.getLatitudeFromMapObjectLonLat(this.mapObject.center),e=this.map.getResolution();
+a=new OpenLayers.LonLat(c+(a.x-b.w/2)*e,d-(a.y-b.h/2)*e);this.wrapDateLine&&(a=a.wrapDateLine(this.maxExtent));return this.getMapObjectLonLatFromLonLat(a.lon,a.lat)},getMapObjectPixelFromMapObjectLonLat:function(a){var b=this.getLongitudeFromMapObjectLonLat(a);a=this.getLatitudeFromMapObjectLonLat(a);var c=this.map.getResolution(),d=this.map.getExtent();return this.getMapObjectPixelFromXY(1/c*(b-d.left),1/c*(d.top-a))},setMapObjectCenter:function(a,b){if(!1===this.animationEnabled&&b!=this.mapObject.zoom){var c=
+this.getMapContainer();google.maps.event.addListenerOnce(this.mapObject,"idle",function(){c.style.visibility=""});c.style.visibility="hidden"}this.mapObject.setOptions({center:a,zoom:b})},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getMapObjectLonLatFromLonLat:function(a,b){var c;this.sphericalMercator?(c=this.inverseMercator(a,b),c=new google.maps.LatLng(c.lat,c.lon)):c=new google.maps.LatLng(b,a);return c},getMapObjectPixelFromXY:function(a,b){return new google.maps.Point(a,
+b)}};OpenLayers.Strategy=OpenLayers.Class({layer:null,options:null,active:null,autoActivate:!0,autoDestroy:!0,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a;this.active=!1},destroy:function(){this.deactivate();this.options=this.layer=null},setLayer:function(a){this.layer=a},activate:function(){return!this.active?this.active=!0:!1},deactivate:function(){return this.active?(this.active=!1,!0):!1},CLASS_NAME:"OpenLayers.Strategy"});OpenLayers.Strategy.Filter=OpenLayers.Class(OpenLayers.Strategy,{filter:null,cache:null,caching:!1,activate:function(){var a=OpenLayers.Strategy.prototype.activate.apply(this,arguments);a&&(this.cache=[],this.layer.events.on({beforefeaturesadded:this.handleAdd,beforefeaturesremoved:this.handleRemove,scope:this}));return a},deactivate:function(){this.cache=null;this.layer&&this.layer.events&&this.layer.events.un({beforefeaturesadded:this.handleAdd,beforefeaturesremoved:this.handleRemove,scope:this});
+return OpenLayers.Strategy.prototype.deactivate.apply(this,arguments)},handleAdd:function(a){if(!this.caching&&this.filter){var b=a.features;a.features=[];for(var c,d=0,e=b.length;d<e;++d)c=b[d],this.filter.evaluate(c)?a.features.push(c):this.cache.push(c)}},handleRemove:function(a){this.caching||(this.cache=[])},setFilter:function(a){this.filter=a;a=this.cache;this.cache=[];this.handleAdd({features:this.layer.features});0<this.cache.length&&(this.caching=!0,this.layer.removeFeatures(this.cache.slice()),
+this.caching=!1);0<a.length&&(a={features:a},this.handleAdd(a),0<a.features.length&&(this.caching=!0,this.layer.addFeatures(a.features),this.caching=!1))},CLASS_NAME:"OpenLayers.Strategy.Filter"});OpenLayers.Strategy.BBOX=OpenLayers.Class(OpenLayers.Strategy,{bounds:null,resolution:null,ratio:2,resFactor:null,response:null,activate:function(){var a=OpenLayers.Strategy.prototype.activate.call(this);a&&(this.layer.events.on({moveend:this.update,refresh:this.update,visibilitychanged:this.update,scope:this}),this.update());return a},deactivate:function(){var a=OpenLayers.Strategy.prototype.deactivate.call(this);a&&this.layer.events.un({moveend:this.update,refresh:this.update,visibilitychanged:this.update,
+scope:this});return a},update:function(a){var b=this.getMapBounds();if(null!==b&&(a&&a.force||this.layer.visibility&&this.layer.calculateInRange()&&this.invalidBounds(b)))this.calculateBounds(b),this.resolution=this.layer.map.getResolution(),this.triggerRead(a)},getMapBounds:function(){if(null===this.layer.map)return null;var a=this.layer.map.getExtent();a&&(this.layer.projection&&!this.layer.projection.equals(this.layer.map.getProjectionObject()))&&(a=a.clone().transform(this.layer.map.getProjectionObject(),
+this.layer.projection));return a},invalidBounds:function(a){a||(a=this.getMapBounds());a=!this.bounds||!this.bounds.containsBounds(a);!a&&this.resFactor&&(a=this.resolution/this.layer.map.getResolution(),a=a>=this.resFactor||a<=1/this.resFactor);return a},calculateBounds:function(a){a||(a=this.getMapBounds());var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio;a=a.getHeight()*this.ratio;this.bounds=new OpenLayers.Bounds(b.lon-c/2,b.lat-a/2,b.lon+c/2,b.lat+a/2)},triggerRead:function(a){this.response&&
+!(a&&!0===a.noAbort)&&(this.layer.protocol.abort(this.response),this.layer.events.triggerEvent("loadend"));var b={filter:this.createFilter()};this.layer.events.triggerEvent("loadstart",b);this.response=this.layer.protocol.read(OpenLayers.Util.applyDefaults({filter:b.filter,callback:this.merge,scope:this},a))},createFilter:function(){var a=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,value:this.bounds,projection:this.layer.projection});this.layer.filter&&(a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,
+filters:[this.layer.filter,a]}));return a},merge:function(a){this.layer.destroyFeatures();if(a.success()){var b=a.features;if(b&&0<b.length){var c=this.layer.projection,d=this.layer.map.getProjectionObject();if(c&&d&&!d.equals(c))for(var e,f=0,g=b.length;f<g;++f)(e=b[f].geometry)&&e.transform(c,d);this.layer.addFeatures(b)}}else this.bounds=null;this.response=null;this.layer.events.triggerEvent("loadend",{response:a})},CLASS_NAME:"OpenLayers.Strategy.BBOX"});