﻿var latlngMouse;
var boolMouseWheeling;

function Map_MouseMove(latlng){
    latlngMouse=latlng;
}
function Map_MouseWheel(event) {
	if(boolMouseWheeling) {
        return;
	}
	boolMouseWheeling=true;
    
    var markerRect;
    var iconRect;
    var iconRect=new GIcon(iconRect,null,null);
    iconRect.iconSize=new GSize(100,100);
    iconRect.iconAnchor=new GPoint(50,50);

	if(event.cancelable){
		event.preventDefault();
	}
	
	map.closeInfoWindow();
	
	//Zooming in & out
	//===================================================== 
	if((event.detail || -event.wheelDelta)<0){
	    iconRect=new GIcon(iconRect,"imgs/zoomin.png",null);
	    markerRect=new GMarker(latlngMouse,{icon:iconRect});	
	    map.addOverlay(markerRect);
	    
		window.setTimeout(function(){
			map.removeOverlay(markerRect);
			map.zoomIn(latlngMouse,true,true);
			boolMouseWheeling = false;
		},250);
	} 
	else {
	    iconRect=new GIcon(iconRect,"imgs/zoomout.png",null);
	    markerRect=new GMarker(latlngMouse,{icon:iconRect});	
	    map.addOverlay(markerRect);
	    
		window.setTimeout(function(){
			map.removeOverlay(markerRect);
			map.zoomOut(latlngMouse,true);
			boolMouseWheeling = false;
		},250);
	}
	return false; 
}

