function ini_mapa_front(){

	// inicializa mapa front
	var centro_mapa_distribuidores = new google.maps.LatLng( 6, -70 );
	var opciones_mapa_distribuidores = {
	
		zoom: 5,
		center: centro_mapa_distribuidores,
		mapTypeId: google.maps.MapTypeId.ROADMAP,
		disableDefaultUI: true,
		navigationControl: true
	}
	
	var mapa_distribuidores = new google.maps.Map( document.getElementById( 'mapa_front' ), opciones_mapa_distribuidores );

	// carga xml ubicaciones
	$.ajax( {
	
		type: 'get',
		url: '/cms/celulas/ubicaciones/ubicaciones.xml',
		dataType: 'xml', 
		success: function( ubicaciones_xml ){
			
			$( ubicaciones_xml ).find( 'ubicacion' ).each( function(){
			
				var lat = $( this ).attr( 'latitud' );
				var lng = $( this ).attr( 'longitud' );

				//info ubicación
				var nombre_ubicacion = $( this ).attr( 'nombre_ubicacion' );
				var ciudad_ubicacion = $( this ).attr( 'ciudad_ubicacion' );
				var descripcion_ubicacion = $( this ).attr( 'descripcion_ubicacion' );
				var direccion_ubicacion = $( this ).attr( 'direccion_ubicacion' );
				
				// crea marcador
				var posicion_marcador = new google.maps.LatLng( lat, lng );
				var icono_marcador = '/front/imagenes/html/icono_mapa_front.png';
				
				var marcador = new google.maps.Marker( {
				
					map : mapa_distribuidores,
					position : posicion_marcador,
					icon: icono_marcador,
					clickable: false
				
				} ); 
			
				// primer click
				google.maps.event.addListener( mapa_distribuidores, 'click', function( event ){
					
					// reset div info
					$( 'div.info_ubicacion' ).empty();
					$( 'div.info_ubicacion' ).css( { 
					
						'width': '0px',
						'padding': 0
						
					} );
					
					// acomoda mapa
					var lat_lng_click_mapa = event.latLng;
					mapa_distribuidores.setOptions( {
					
						zoom: 11,
						center: lat_lng_click_mapa,
						clickable: false
						
					} );
					
					// habilita marcador
					marcador.setOptions( { clickable: true } );
					
					// segundo click
					google.maps.event.addListener( marcador, 'click', function( event ){
					
						var lat_lng_click_marcador = event.latLng;
						mapa_distribuidores.setOptions( {
						
							zoom: 16,
							center: lat_lng_click_marcador,
							clickable: false
							
						} );
						
						/* div info */
						
						// desocupa div info
						$( 'div.info_ubicacion' ).empty();
						
						// alimenta ventana info marcador
						$( 'div.info_ubicacion' ).css( {
						
							'padding' : '10px 20px',
							'opacity' : 0.85
						} );
						
						$( 'div.info_ubicacion' ).append( '<h1>' + nombre_ubicacion + '</h1><h2>' + ciudad_ubicacion + '</h2><h2>' + direccion_ubicacion +  '</h2><p>' + descripcion_ubicacion + '</p>' );
						$( 'div.info_ubicacion' ).animate( {
						
							width : 200
						
						}, 400 );
						
						
					} );

//console.debug( $( this ) );
	
				} );

			} );// each
			
		}// success
		
	} );

} // ini_mapa_front().
