<html><head>
<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=2.0&appid=rlerdorf"></script>
<style type="text/css">
#mapContainer {
height: 600px;
width: 800px;
}
</style>
<title>GeoCoding DHTML API Example</title>
</head><body>
<form action="/php/ymap/dgeo4.php" method="GET">
<input type="text" size="80" name="location" />
</form>
<?php
include './geo.inc';
if(!empty($_REQUEST['location'])) {
$a = yahoo_geo($_REQUEST['location']);
echo "[ {$a['Latitude']}, {$a['Longitude']} ] {$a['precision']}-level coordinate accuracy<br />\n";
$mtitle = '';
if(!empty($a['Address'])) {
echo $a['Address'].', ';
$mtitle = $a['Address'];
}
if(!empty($a['City'])) {
echo $a['City'].', ';
if(!$mtitle) $mtitle = $a['City'];
}
if(!empty($a['State'])) echo $a['State'].' ';
if(!empty($a['Zip'])) echo $a['Zip'].' ';
if(!empty($a['Country'])) echo $a['Country'].' ';
$info = str_replace("\n",'',nl2br(print_r($a,true)));
}
?>
<div id="mapContainer"></div>
<script type="text/javascript">
function onSmartWinEvent() {
var words = "<?php echo "$mtitle<br />$info"?>";
marker.openSmartWindow(words);
}
var latlon = new YGeoPoint(<?php echo $a['Latitude']?>, <?php echo $a['Longitude']?>);
var mymap = new YMap(document.getElementById('mapContainer'));
var marker = new YMarker(latlon);
marker.addLabel("<b>A</b>");
YEvent.Capture(marker, EventsList.MouseClick, onSmartWinEvent);
mymap.addOverlay(marker);
mymap.addPanControl();
mymap.addZoomLong();
mymap.drawZoomAndCenter(latlon, 3);
</script>
<a href="http://developer.yahoo.net/about"> <img src="http://us.dev1.yimg.com/us.yimg.com/i/us/nt/bdg/websrv_120_1.gif" border="0"></a>
<a href="/php/ymap/dgeo4.phps">[Source Code]</a>
</body></html>