/*-----------------------------------------------------------------------
mousewheel JavaScript file

version: 	4.1
author:		sebastian kupke
email:		sebastian.kupke@baral-geohaus.de
website:	http://www.baral.de
-----------------------------------------------------------------------*/

/* =namespace mousewheel
-----------------------------------------------------------------------*/
ws.c.mousewheel = {
	
	active: 0,
	
	handle: function(e, delta) {
	
		$('#m_objects_div').empty();
		
		// Zoomout (in Opera Zoomin)
		var width = $('#map_image').width();
		var height = $('#map_image').height();
		
		var proportion = width / height;
		
		if ((!$.browser.opera && delta < 0) || ($.browser.opera && delta > 0)) {
			// Zoom in
			width -= 60;
			height = width / proportion;
		} else {
			// Zoom out
			width += 160;
			height = width / proportion;
		}
		
		var divWidth = $('#map_div').width();
		var divHeight = $('#map_div').height();
		
		var diffWidth = (divWidth - width) / 2;
		var diffHeight = (divHeight - height) / 2;
		
		$('#map_image').css({
			width: width + 'px',
			height: height + 'px',
			left: diffWidth + 'px',
			top: diffHeight + 'px'
		});
		
		$('#map_image img').css({
			width: width + 'px',
			height: height + 'px'
		});
		
		ws.c.mousewheel.getMap();
	},
	
	getMap: function() {
		ws.c.mousewheel.active++;
		setTimeout('ws.c.mousewheel.getMapGo(' + ws.c.mousewheel.active + ')',500);
	},
	
	getMapGo: function(curCount) {
		if (curCount == ws.c.mousewheel.active) {
			// revert active
			ws.c.mousewheel.active = 0;
			
			// calculate new scale
			ws.map.scale = (ws.map.scale * $('#map_div').width()) / $('#map_image').width();
			
			ws.map.load();
		}
	}
};

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 








