function SefarMap( mapAddress, mapContainerID, contentID, useControls, triggerId, hideText ){
	var mapContainer = $( mapContainerID );
	var addressElem = $( contentID );
	var container = $( mapContainer.parentNode );
	var currentHeight = container.getHeight();
	
	if( addressElem ){
		var map = new GMap2( mapContainer );
		var setMap = function( p ){
			if( !p ) return;
			var mapCenter = ( mapAddress.centerLat != 0 && mapAddress.centerLng != 0 ) ? new GLatLng( mapAddress.centerLat, mapAddress.centerLng ) : p;
			map.setCenter( mapCenter, 12 ); // fails, if any parent container's display property is "None"
			map.addMapType( G_PHYSICAL_MAP );
			var marker = new GMarker( p );
			map.addOverlay( marker );
			map.addControl( new GMapTypeControl());
			map.addControl(new GLargeMapControl());
			marker.openInfoWindow( addressElem );
			GEvent.addListener(marker, "click", function(){
				marker.openInfoWindow( addressElem );
			});
			map.checkResize();
			addressElem.style.display = "block";
			if( useControls == true ) map.addControl(new GLargeMapControl());
		}
		
		if( mapAddress.address ){
			var gc = new GClientGeocoder();
			gc.getLatLng( mapAddress, setMap );
		}
		else{
			setMap( new GLatLng( mapAddress.lat, mapAddress.lng ));
		}
	}
	
	toggleMap( container, currentHeight, triggerId, hideText );
	
	return map;
}

function toggleMap( container, currentHeight, trigger, hideText ){
	var text = $(trigger).down(0);
	if( currentHeight < 300 ){
      new Effect.Tween(container, 0, 300, { duration: 0.5 }, function(p){
			container.setStyle({ height: p+"px" });
		});
		if( text ){
			text.update( hideText );
		}
		
	}else{
		new Effect.Tween(container, currentHeight, 0, { duration: 0.5 }, function(p){
			container.setStyle({ height: p+"px" });
		});
		
		if( text ){
			text.update( window.mapShowText );
		}
	}
}
