Index: lib/OpenLayers/Map.js
===================================================================
--- lib/OpenLayers/Map.js	(revisión: 10354)
+++ lib/OpenLayers/Map.js	(copia de trabajo)
@@ -77,6 +77,10 @@
      *  - *clearmarkers* triggered after markers have been cleared
      *  - *mouseover* triggered after mouseover the map
      *  - *mouseout* triggered after mouseout the map
+     *  - *mapmouseover* triggered after mouseover the map except for 
+     *         div using <getListenersAsOutMap> event listeners.
+     *  - *mapmouseout* triggered after mouseout the map and mouseover 
+     *         in div using <getListenersAsOutMap> event listeners.
      *  - *mousemove* triggered after mousemove the map
      *  - *dragstart* Does not work.  Register for movestart instead.
      *  - *drag* Does not work.  Register for move instead.
@@ -88,9 +92,45 @@
         "move", "moveend", "zoomend", "popupopen", "popupclose",
         "addmarker", "removemarker", "clearmarkers", "mouseover",
         "mouseout", "mousemove", "dragstart", "drag", "dragend",
-        "changebaselayer"],
+        "changebaselayer", "mapmouseover", "mapmouseout"],
 
     /**
+     * Property: outMapMouseIsOver
+     * {Boolean} For manage "mapmouseover" & "mapmouseout" events, true when 
+     *     mouse is over the map, is read only. See <startEventsOutMap> method.
+     */
+    outMapMouseIsOver: false,
+
+    /**
+     * Property: outMapMouseIsAsOutMap
+     * {Boolean} For manage "mapmouseover" & "mapmouseout" events, true when 
+     *     mouse is over a div as outMap, is read only. See 
+     *     <startEventsOutMap> method.
+     */
+    outMapMouseIsAsOutMap: false, 
+
+    /**
+     * Property: outMapEventsTimeout
+     * {Number} Timeout id of trigger for manage "mapmouseover" & "mapmouseout"
+     *     events.
+     */
+    outMapEventsTimeout: null,
+
+    /**
+     * Property: eventListenersOutMap
+     * {Object} For manage "mapmouseover" & "mapmouseout", this object is used 
+     *     by map.events.on and map.events.un methods. See the 
+     *     <startEventsOutMap> method.
+     */
+    eventListenersOutMap: null,            
+
+    /**
+     * Property: eventsOutMapLaunched
+     * {Boolean} It is true after calling the method <startEventsOutMap>.
+     */
+    eventsOutMapLaunched: false,
+
+    /**
      * Property: id
      * {String} Unique identifier for the map
      */
@@ -683,6 +723,16 @@
         }
         this.viewPortDiv = null;
 
+        if (this.eventsOutMapLaunched) { 
+            this.outMapEventsTimeoutClear();
+            if (this.eventListenersOutMap) {
+                this.events.un(this.eventListenersOutMap);
+                this.eventListenersOutMap = null;            
+            }
+            this.eventsOutMapLaunched = false;
+            this.outMapMouseIsOver = false;
+            this.outMapMouseIsAsOutMap = false;
+        }
         if(this.eventListeners) {
             this.events.un(this.eventListeners);
             this.eventListeners = null;
@@ -2373,6 +2423,106 @@
        return this.getLayerPxFromViewPortPx(px);         
     },
 
+  /********************************************************/
+  /*                                                      */
+  /*             Management outMap events                 */
+  /*                                                      */
+  /********************************************************/
+
+    /**
+     * Method: startEventsOutMap
+     * Start works for trigger events "mapmouseover" and "mapmouseout".
+     *
+     * This events are similar that "mouseover" and "mouseout" with the 
+     *     following differences:
+     *  - "mouseout" immediately followed by "mouseover" are ignored (less that 
+     *     100 milliseconds between mouseout and mouseover) this is for  
+     *     trigger efficiency.
+     *  - Allows to select a div into the map to generate the events as an 
+     *     out map div, see <getListenersAsOutMap> function.
+     *
+     * Events are not managed until this method is called. 
+     */
+    startEventsOutMap: function() {
+        if (this.eventsOutMapLaunched) { return; }
+        this.eventListenersOutMap ={
+            mouseover: function(evt) {
+                this.outMapEventsTimeoutClear();
+                if (this.outMapMouseIsOver) { return; }
+                if (this.outMapMouseIsAsOutMap) { return; }                
+                this.outMapMouseIsOver = true;
+                this.events.triggerEvent("mapmouseover");                
+            },
+            mouseout: function(evt) {
+                if (!this.outMapEventsTimeout) {
+                    this.outMapEventsTimeout = window.setTimeout(
+                        OpenLayers.Function.bind(function() {
+                            this.outMapEventsTimeout = null;
+                            if (!this.outMapMouseIsOver) { return; }
+                            this.outMapMouseIsOver = false;
+                            this.events.triggerEvent("mapmouseout");                                                        
+                        }, this),
+                        100
+                    );                    
+                }
+            },               
+            scope: this
+        };
+        this.events.on(this.eventListenersOutMap);
+        this.eventsOutMapLaunched = true;
+    },
+    
+    /**
+     * Function: getListenersAsOutMap
+     * Returns returns eventListeners object for register events that let a div
+     *     as outMap.
+     *
+     * Example usage:
+     * To set as outMap the div on a control.
+     * (code)
+     * var control = new OpenLayers.Control.Xxxxxxxx();                
+     * map.addControl(control);    
+     * var newDivEvents = new OpenLayers.Events(control, control.div, null, 
+     *     true); // If do not want to alter the behavior of mouseover in 
+     *            //    map.events is necessary set fallThrough parameter 
+     *            //    to true.
+     * newDivEvents.on(control.map.getListenersAsOutMap()); // set to outMap 
+     * (end)
+     *
+     * Returns:
+     * {Object} For use in <OpenLayers.Events.on> and <OpenLayers.Events.un> 
+     *     methods.
+     */
+    getListenersAsOutMap: function() {          
+        return {
+            mouseover: function(evt) {
+                this.outMapMouseIsAsOutMap = true;
+                this.outMapEventsTimeoutClear();
+                if (!this.outMapMouseIsOver) { return; }
+                this.outMapMouseIsOver = false;
+                this.events.triggerEvent("mapmouseout");            
+                //OpenLayers.Event.stop(evt, false);
+                return true;
+            },
+            mouseout: function() {             
+                this.outMapMouseIsAsOutMap = false;
+            },
+            scope: this
+        }; 
+    },
+    
+    /**
+     * Method: outMapEventsTimeoutClear
+     * To clean the timeout created by the event in <eventListenersOutMap> 
+     *     property.
+     */
+    outMapEventsTimeoutClear: function() { 
+        if(this.outMapEventsTimeout) {
+            window.clearTimeout(this.outMapEventsTimeout);
+            this.outMapEventsTimeout = null;
+        }
+    },
+    
     CLASS_NAME: "OpenLayers.Map"
 });
 
Index: examples/outmap-events.html
===================================================================
--- examples/outmap-events.html	(revisión: 0)
+++ examples/outmap-events.html	(revisión: 0)
@@ -0,0 +1,138 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>Example of how use outMap events</title>
+
+        <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+        <link rel="stylesheet" href="style.css" type="text/css" />
+        <script src="../lib/OpenLayers.js" type="text/javascript"></script>
+        <style type="text/css">
+            .outLog {
+                width:510px; 
+                height:80px; 
+                border:#aaa solid 1px; 
+                overflow-x:hidden;
+                overflow-y:auto;
+            }
+        </style>
+        <script type="text/javascript">
+            var map;
+            function init(){
+            // EventListeners in map as an example of use of outMap events.
+                map = new OpenLayers.Map('map', {
+                    eventListeners:{                 
+                        mouseover: function(){
+                            document.getElementById('log1').innerHTML += 
+                                '<span style="color:red">*</span>';
+                            document.getElementById('mouseState').innerHTML = 
+                                '<span style="color:red">The mouse is <b>over</b> the map</span>';
+                        },
+                        mouseout: function(){
+                            document.getElementById('log1').innerHTML += 
+                                '<span style="color:#aaa">. </span>';
+                            document.getElementById('mouseState').innerHTML =  
+                                '<span style="color:#aaa">The mouse is <b>outside</b> the map</span>';
+                        },
+                        mapmouseover: function(){
+                            document.getElementById('log2').innerHTML += 
+                                '<span style="color:red">*</span>';
+                            document.getElementById('outmapState').innerHTML = 
+                                '<span style="color:red">The mouse is <b>over</b> the map</span>';
+                        },
+                        mapmouseout: function(){
+                            document.getElementById('log2').innerHTML += 
+                                '<span style="color:#aaa">. </span>';
+                            document.getElementById('outmapState').innerHTML =  
+                                '<span style="color:#aaa">The mouse is <b>outside</b> the map</span>';
+                        }                        
+                    }
+                });
+                map.startEventsOutMap(); // To start the management of outMap events
+                var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+                        "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
+                map.addLayer(wms);
+                
+            // Create OverviewMap as outMap
+                var overviewCtl = new OpenLayers.Control.OverviewMap();                
+                map.addControl(overviewCtl);   
+                var overviewCtlEvents = new OpenLayers.Events(
+                    overviewCtl, overviewCtl.div, null, 
+                    true); // If do not want to alter the behavior of mouseover in 
+                           //    map.events is necessary set fallThrough parameter 
+                           //    to true.
+                overviewCtlEvents.on(map.getListenersAsOutMap()); // set to outMap               
+            
+            // Show the map
+                map.zoomToExtent(new OpenLayers.Bounds(-3.92, 41.34, 4.87, 45));
+                
+            // Create a popup as outMap   
+                var popup = new OpenLayers.Popup(null, 
+                    new OpenLayers.LonLat(-3,45),
+                    new OpenLayers.Size(140,60),
+                    '<span style="font-size:10px">Move mouse on popup and' + 
+                        ' see &quot;State of outMap events&quot;</span>',                    
+                    false
+                );
+                map.addPopup(popup); 
+                popup.events.on(map.getListenersAsOutMap()); // set to outMap
+            }           
+        </script>
+    </head>
+
+    <body onload="init()">
+        <h1 id="title">Example of use of outMap events: &quot;mapmouseover&quot; 
+            &amp; &quot;mapmouseout&quot;</h1>
+        <p id="shortdesc">
+            Events: &quot;mapmouseover&quot; &amp; &quot;mapmouseout&quot; 
+            allows some div on the map they behave as if they were outside. 
+            And has a more efficient trigger that &quot;mouseover&quot; &amp; 
+            &quot;mouseout&quot;.</p>        
+        <div id="map" class="smallmap" style="border:0px; float:left"></div>
+        <div class="smallmap" style="border:0px; float:left; margin-left:5px" >
+            <h2>See efficient trigger of "mapmouse..." events  </h2>
+            log1: 
+                <a href="#" 
+                style ="float:right" onclick="
+                    document.getElementById('log1').innerHTML = '';
+                    document.getElementById('log2').innerHTML = '';
+                    return false;" >Clear logs</a>
+                <span style="color:red">&quot;mouseover&quot; 
+                    &amp; &quot;mouseout&quot; events.</span><br />(try to move 
+                    mouse over <b>PanZoom</b>) 
+                <div id="log1" class="outLog"></div>
+            log2: <span style="color:blue">&quot;mapmouseover&quot; 
+                &amp; &quot;mapmouseout&quot; events.</span>
+                <div id="log2" class="outLog"></div>
+        </div>
+        <div id="docs">
+            <div style="clear:both;">State of mouse events: 
+                <span id="mouseState">(for put mouse state)</span></div>            
+            <div style="clear:both;">State of outMap events: 
+                <span id="outmapState">(for put outMap state)</span></div>
+            <div style="clear:both; margin-left:1.5em; float:left; width:40em">
+                <h2><strong>Features of outMap events:</strong></h2>
+                <ul>            
+                    <li>Allows some div on the map that they behave as if they 
+                        were outside (see <b>popup</b> and <b>overview map</b> 
+                        in this example)</li>
+                    <li>More efficient trigger that &quot;mouseover&quot; &amp; 
+                        &quot;mouseout&quot; (see differences between log1 and 
+                        log2)</li>
+                </ul>
+                <h2><strong>Description of events:</strong></h2>
+                <ul>            
+                    <li><strong>mapmouseover</strong>: triggered after 
+                        mouseover the map except for div using 
+                        getListenersAsOutMap() eventListeners.</li>
+                    <li><strong>mapmouseout</strong>: triggered after mouseout 
+                        the map and mouseover div using getListenersAsOutMap() 
+                        eventListeners.</li>
+                    <li>It is necessary to start events outMap managing with 
+                        <strong>map.startEventsOutMap</strong> method.</li>
+                    <li><strong>map.getListenersAsOutMap()</strong> function 
+                        eventListeners object for register events that let a 
+                        div as outMap.</li>
+                </ul>            
+            </div>    
+        </div>
+    </body>
+</html>
