Continuación:
Código Javascript
:
Ver originalfunction handleNoGeolocation(errorFlag) {
if (errorFlag == true) {
alert("Geolocation service failed.");
initialLocation = Jaen;
} else {
alert("Posición no encontrada.");
initialLocation = Jaen;
}
map.setCenter(initialLocation);
infowindow.setContent(contentString);
infowindow.setPosition(initialLocation);
infowindow.open(map);
}
var address0 = '<?php echo utf8_encode($row_Recordset1['localidad']); ?><?php echo utf8_encode($row_Recordset1['calle']); ?>';
geocoder.geocode( { 'address': address0}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK)
{
var ContenidoMarcadorAviso0 = '<div class="marcador"><h2><?php echo $row_Recordset1['name'];?></h2><h3><?php echo utf8_encode($row_Recordset1['calle']);?></h3></div><h3><b></b><hr><b>Marca: </b><?php echo $row_Recordset1['marcas']; ?><br /> <b>Modelo: </b><?php echo $row_Recordset1['modelo']; ?><br /> <b>Aparato: </b><?php echo $row_Recordset1['aparatos']; ?></h3>';
var infoventanaaviso0 = new google.maps.InfoWindow({
content: ContenidoMarcadorAviso0
});
marcadorAviso0 = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title:'Aviso'
});
google.maps.event.addListener(marcadorAviso0, 'click', function() {
infoventanaaviso0.open(map,marcadorAviso0);
});
}
else
{
alert('Geocode was not successful for the following reason: ' + status);
}
});
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById("directionsPanel"));
}
function calcRoute() {
var start = initialLocation;
var end = "<?php echo utf8_encode($row_Recordset1['localidad']); ?><?php echo utf8_encode($row_Recordset1['calle']); ?>";
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
$('#itinerario').show();
}
});
}
</script>
</head>
<body onload="initialize();">
<div data-role="page" data-theme="b" id="gmap-3">
<div data-role="content" >
<div class="ui-bar-b ui-corner-all ui-shadow" style="padding:1em;">
<div id="map_canvas" style="height:300px;"></div>
<div>
<a href="#" onclick="calcRoute();" data-role="button">Calcular Ruta</a>
</div><br />
<div id="itinerario" style="display:none">
<center>
ITINERARIO <div id="directionsPanel"></div>
</center>
</div>
<div id="results" style="padding:1.4em">
</div>
</div>
</div>
<div data-role="footer" data-position="fixed" data-fullscreen="false">
<div data-role="navbar">
<ul>
<li><a href="#" onclick="window.close();" data-icon="delete" data-theme="f" data-ajax="false">Cerrar ventana</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>