Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/11/2008, 09:54
hook69
 
Fecha de Ingreso: junio-2008
Mensajes: 21
Antigüedad: 16 años, 10 meses
Puntos: 0
Respuesta: Ayuda con ASP + JS + Google Map

Aqui esta la segunda parte del codigo.
Gracias


Código:
<%''''''''''''ACABA GENERAR LAS VARIABLES ASP Y ALMACENARLAS EN ARRAYS JAVASCRIPT
			
			processor.transform()
			Response.Write (processor.output)
		
		   Set xsl = Nothing
		   Set template = Nothing
		   
 	
 	   Set xml = Nothing
	   Set xmlhttp = Nothing
        
 	
	%>	
	
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAp0OgPT_W9i4urqiTE4UqNhTq1E0NgXqvizwUvavWEHJh9y-27BRIzVwy9m8JgTQbm9EpBHk56r215A" type="text/javascript"></script>

<script type="text/javascript">
			//google.load("maps", "2");
			var map = null;
			//var puntosCoordenadas = "";
			//var puntosDireccion = "";
			var geocoder = null;
            var tam;
            var i;
            
            //var direccionesNoEncontradas = "";
            //POSICIONO EL MAPA SEGUN LAS VARIABLES QUE LE PASO
			var centro = '<%=(Session("loc") & ", " & Session("PAISINGLES"))%>';
			//alert('<%=(Session("loc") & ", " & Session("PAISINGLES"))%>');

			function initializeAll() {
				initializeMap();
                
				for (var i = 0; i < x ; i += 1) {
				
				if ((vlongitude != "" && vlatitude != "") && (vlongitude != null && vlatitude != null)){
				    //AQUI ES DONDE AÑADO LAS MARCAS
				    anadeMarcadorCoordenadas(vlongitude[i],vlatitude[i],vaddress1[i],vcity[i],vname[i],vhotelId[i],vthumbNailUrl[i],i,vdisplayCurrencyCode[i],vdisplayRoomRate[i],vcountry[i],vpostalCode[i],vshortDescription[i]);
				    
				    }
				    else{
				    anadeMarcadorDireccion();
				    }
				}//FIN FOR
				
				//alert(direccionesNoEncontradas);
			}//FIN DE function initializeAll()
			
			//google.setOnLoadCallback(initializeAll);
			// Call this function when the page has been loaded
			function initializeMap() {
			
			         
			
			
				map = new GMap2(document.getElementById("map"));
				geocoder = new GClientGeocoder(); // para buscar por dirección
				map.addControl(new GSmallMapControl()); // controles para zoom, mover
				map.addControl(new GMapTypeControl()); // controles para mapa, satélite, híbrido
				
				
				
				
				if (centro == "") {
					map.setCenter(new GLatLng(39.926588, -3.164062), 6); // centro del mapa (longitud, latitud, zoom)
				} else {
					geocoder.getLatLng(centro, function(point) {
						if (!point) {
							map.setCenter(new GLatLng(39.926588, -3.164062), 6);
							alert("no tenemos punto");
						} else {
							map.setCenter(point, 12);
							// alert(point);        mostramos las coordenadas
						}
					});
				}
				
				//alert('Recuerde que solo se muestran los anuncios con coordenadas o con una dirección correcta.');
			}//FIN function initializeMap()
			
 			function anadeMarcadorCoordenadas(vlongitude, vlatitude, vaddress1, vcity, vname, vhotelId,vthumbNailUrl,i,vdisplayCurrencyCode,vdisplayRoomRate,vcountry,vpostalCode,vshortDescription) {
                //ESTE ALERT NO LO QUITO PORQUE SINO NO ME AÑADE LAS MARCAS
 				if (i == 0) { alert("www.MIPAGINA.com"); }

 			    //alert(vlongitude + '/' + vlatitude + '/' + vaddress1 + '/' + vcity + '/' + vname + '/' + vhotelId);	
 				var point = new GLatLng(vlatitude ,vlongitude);
 				var marker = new GMarker(point);
 				//var icono = new GIcon(G_DEFAULT_ICON, 'http://www.casaspain.com/idiomas/bandera_francia.gif');
 				//var marker = new GMarker(point, icono);
 				GEvent.addListener(marker, "click", function() {
 				    //AQUI GENERO LAS ETIQUETAS
 					var content = "<div style='width:25em'><font face='Courier new,Courier,monospace' color='#CC6633' size='1'>";
 					content += "<table cellpadding='0' cellspacing='0'><tr><td colspan='2'>";
 					content +='<span style="font-size:24px;font-weight:bold;"><a href="javascript:pulsarboton('+ vhotelId +');">' + vname + '</a><span>';
 					content +="</td></tr><tr><td>";
 					content +='<img src=' + vthumbNailUrl + ' />';
 					content +="</td><td>";
 					content +="<h4>" + vaddress1 + "<br/> " + vcity + ",<br/>"+ vpostalCode + ", " + vcountry + "</h4><h5>Precio final: "+ vdisplayRoomRate + vdisplayCurrencyCode +"</h5>";
 					content +="</td></tr><tr><td colspan='2'>";
                    content +='<h5>'+ String(vshortDescription).substring(0,252); +'</h5>'; // mostramos el precio total
                    content +="</td></tr></table>";
                    content += "</font></div>";
 					marker.openInfoWindowHtml(content);
				});
				map.addOverlay(marker);
				

			}//FIN function anadeMarcadorCoordenadas()
			
			//A TRAVES DE ESTE CODIGO NO LE PASO NADA DE INFORMACION DE MOMENTO
			function anadeMarcadorDireccion() {
			if (i == 0) { alert("WWW.MIPAGINA.com"); }
				if (geocoder) {
					geocoder.getLatLng(vcity + ', ' + vaddress1, function(point) {
						if (!point) {
							geocoder.getLatLng(vcity, function(point) {
								if (!point) {
									//alert(direccion + ', ' + provincia + " no encontrada");
									//direccionesNoEncontradas += direccion + ', ' + provincia;
								} else {
									var marker = new GMarker(point);
									//var icono = new GIcon(G_DEFAULT_ICON, 'http://www.OTRAPAGINA.com/idiomas/bandera_espana.gif');
									//var marker = new GMarker(point, icono);
									map.addOverlay(marker);
									GEvent.addListener(marker, "click", function() {
										var content = "<div style='width:25em'><font face='Courier new,Courier,monospace' color='#CC6633' size='1'>";
 					                    content += "<table cellpadding='0' cellspacing='0'><tr><td colspan='2'>";
 					                    content +='<span style="font-size:24px;font-weight:bold;"><a href="javascript:pulsarboton('+ vhotelId +');">' + vname + '</a><span>';
 					                    content +="</td></tr><tr><td>";
 					                    content +='<img src=' + vthumbNailUrl + ' />';
 					                    content +="</td><td>";
 					                    content +="<h4>" + vaddress1 + "<br/> " + vcity + ",<br/>"+ vpostalCode + ", " + vcountry + "</h4>";
 					                    content +="</td></tr><tr><td colspan='2'>";
                                        content +='<br/><h4>Total de la Estancia: '+ vdisplayRoomRate + vdisplayCurrencyCode +'</h4>'; // mostramos el precio total
                                        content +="</td></tr></table>";
                                        content += "</font></div>";
										marker.openInfoWindowHtml(content);
									});
									map.addOverlay(marker);
								}
							});
						} else {
							var icono = new GIcon(G_DEFAULT_ICON, 'http://www.OTRAPAGINA.com/idiomas/bandera_alemania.gif');
							var marker = new GMarker(point);
							map.addOverlay(marker);
							GEvent.addListener(marker, "click", function() {
								var content = "<div style='width:20em'><font face='Courier New, Courier, monospace' color='#CC6633' size='-1'>";
								//content += marker.getPoint().lat() + " / " + marker.getPoint().lng(); // mostramos las coordenadas
								content += "<h1>" + vname + "</h1>";
								content += "<br />" + vaddress1 + ', ' + vcity;
//								if (URL != '') {
//									content += "<br /><br /><a href='" + URL + "' target='_blank'>" + URL + "</a>";
//								}
								content += "<br /></font></div>";
								marker.openInfoWindowHtml(content);
							});
							map.addOverlay(marker);
						}
					});
				}
			}
			
			
			
			///////// ESTA FUNCION LLAMA AL BOTON CORRESPONDIENTE AL HOTEL SELECCIONADO DESDE EL GOOGLE MAP
			function pulsarboton (boton){
			var pulsa = document.getElementById(boton);
                if (pulsa){
                        pulsa.click();   
                        }
			
			}
		</script>


<%Session.Contents.RemoveAll() %>