$(document).ready( function() {
//	GLog.write( 'ready' );
	
	var moving = false;
	var expanded = false;
	var moveTimer = undefined;
	
	$('#mapAll').hover( function() {
	//	GLog.write( 'hover over' );
		if( moveTimer ) {
			clearTimeout(moveTimer);
			moveTimer = undefined
		}
		if( moving || expanded ) {
		//	GLog.write( 'dont expand: moving[' + moving + '] expanded[' + expanded + ']' );
			return;
		}
		moveTimer = setTimeout( function() {
			//map.savePosition();
			moving = true;
		//	GLog.write( 'moving: expand' );
			$('#frontleftcell').animate(
				{
					height: "hide", width: "hide", opacity: "hide"
				},
				'slow',
				'linear',
				function() {
					$('#mapAll').animate(
						{
							height: 400
						},
						'slow',
						'linear',
						function() {
							$('#mapLegend').fadeIn( 'normal', function() {
							//	GLog.write( 'test' );
								//map.checkResize();
							//	map.zoomToMarkers();
								//map.returnToSavedPosition();
								moveTimer = undefined;
								moving = false;
								expanded = true;
							} );
						}
					);
				}
			);
		}, 1500 );
	
	}, function() {
	//	GLog.write( 'hover out' );
		
		if( moveTimer ) {
			clearTimeout(moveTimer);
			moveTimer = undefined
		}
		if( moving || !expanded ) {
		//	GLog.write( 'dont collapse: moving[' + moving + '] expanded[' + expanded + ']' );
			return;
		}
		return;
		
	} );
});