SpatialAceMap.prototype.onMouseMovePosition = function(evt,element){
    //Update position display
    tmpEvt = new Evt(evt);
        
    this.mousePosition = getPixelPositionFromEvent(tmpEvt,this.mapContainer)

    //Don't do anything if the mouse is outside the map.
    if (this.mousePosition.x<0 || this.mousePosition.x>this.mapWidth || this.mousePosition.y<0 || this.mousePosition.y>this.mapHeight)
    {
        if (this.activeinfoBoxObject)
        {
            if (!this.activeinfoBoxObject.hideObjectInfoTimer && !this.activeinfoBoxObject.infoBoxSelected)
            {
                if (this.activeinfoBoxObject.infoBoxTimeout)
                    this.activeinfoBoxObject.setInfoTimer(this.activeinfoBoxObject.infoBoxTimeout);
                else 
                    this.activeinfoBoxObject.setInfoTimer(1000);
            }
        }
        return;
    }
       
	//Don't return anything if we are above the docking bar
	if (this.mousePosition.y>(this.mapContainer.offsetHeight-this.dockingOffset))
	    return;
	
	var mousePoint = this.getPosition(this.mousePosition.x,this.mousePosition.y);
	
	//Update clickTools
	if (this.clickTool && this.clickTool.update && !isOpera){
        this.clickTool.update(mousePoint);
    }
	
	//Perform collision detection for tooltips & events
	var actionArray = this.view.updateTooltips(mousePoint.x,mousePoint.y);
	
	//Invoke event listener for mouse over and mouse out.
	if (actionArray && actionArray.length>0 ) {
	    for (var i=0; i<actionArray.length; i++) {
	        if (actionArray[i].enter) {
	            for (var j=0;j<this.onMouseOverEventHandlers.length;j++) {
		            this.onMouseOverEventHandlers[j](this,actionArray[i].geoObject);
		        }
            }
		    else {
	            for (var j=0;j<this.onMouseOutEventHandlers.length;j++) {
		            this.onMouseOutEventHandlers[j](this,actionArray[i].geoObject);
		        }
		    }
	    }
	}
	
	//mousePositionBox section
	if (this.config.GUI.mousePositionBox && this.config.GUI.mousePositionBox.active){
	    if (!this.mouseposContainer){
	        this.mouseposContainer = document.createElement("DIV");
	        if (this.config.GUI.mousePositionBox.css)
	            this.mouseposContainer.className=this.config.GUI.mousePositionBox.css;
	        else
	            this.mouseposContainer.className="rwcPositionBox";
	        
	        if (this.config.GUI.mousePositionBox.mode=="standalone")
	            document.body.appendChild(this.mouseposContainer);
	        else
	            this.embedDiv.appendChild(this.mouseposContainer);
	    }
	
	    this.mouseposContainer.innerHTML = mousePoint.x + "<br>" + mousePoint.y;
	}
};

//Patch for ZoomTool
ZoomTool.prototype.endManipulation = function(evt, element) {
    evt = new Evt(evt);
 
    if(document.detachEvent){
        document.body.detachEvent("onselectstart", returnFalse, false);
        document.body.detachEvent("ondrag", returnFalse, false);
    }

    setVisible(this.zoomRect, false);
 
    var currentPoint=getPixelPositionFromEvent(evt,this.saMap.mapContainer);

    var w = currentPoint.x - this.startPoint.x;
    var h = currentPoint.y - this.startPoint.y;
 
    //if we haven't drawn a rectangle, interpret this as a click
    if (Math.abs(w)<2 && Math.abs(h)<2)
    {
        //this.saMap.activateClickTools(currentPoint);
    }
    else
        this.saMap.zoomToRect(getX(this.zoomRect), getY(this.zoomRect),
                        getWidth(this.zoomRect), getHeight(this.zoomRect));

    Evt.removeEventListener(document, "mousemove", this.manipulateFunc, false);
    Evt.removeEventListener(document, "mouseup", this.endManipulationFunc, false);
 
    this.saMap.manipulationActive=false;
 
    evt.consume();
};

//Patch for Scroll
function getPixelPositionFromEvent(evt,htmlElement)
{
    var tVersion = getInternetExplorerVersion();
    if (isFireFox || isMozilla || isIe6)
    {
        return new RWCPoint(evt.x - cumulativeOffsetLeft(htmlElement) + document.body.scrollLeft,evt.y - cumulativeOffsetTop(htmlElement) + document.body.scrollTop);
    }
    else if (tVersion > 6 && tVersion < 8) {
        return new RWCPoint(evt.x - cumulativeOffsetLeft(htmlElement) - document.documentElement.scrollLeft, evt.y - cumulativeOffsetTop(htmlElement) + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) - 10); //document.documentElement.scrollTop
    }
    else if (isIe7)
    {
        return new RWCPoint(evt.x - cumulativeOffsetLeft(htmlElement) - document.documentElement.scrollLeft,evt.y - cumulativeOffsetTop(htmlElement) + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop));//document.documentElement.scrollTop
    }
    else
        return new RWCPoint(evt.x - cumulativeOffsetLeft(htmlElement),evt.y - cumulativeOffsetTop(htmlElement));      
}


function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);
    }
    return rv;
}
