var map; var geocoder; function initialize() { map = new GMap2(document.getElementById("map_canvas")); map.addControl(new google.maps.LocalSearch()); var MyControl = new GSmallMapControl(); var MyTypeControl = new GMapTypeControl() map.setCenter(new GLatLng(38.5, -95.93988), 4); map.enableDoubleClickZoom(); map.enableContinuousZoom(); map.addControl(MyControl); map.addControl(MyTypeControl); geocoder = new GClientGeocoder(); disp_pnts(); } // addAddressToMap() is called when the geocoder returns an // answer. It adds a marker to the map with an open info window // showing the nicely formatted version of the address and the country code. function addAddressToMap(response) { // map.clearOverlays(); if (response) { var dops = document.forms[0].q.options; var dist_name = dops[dops.selectedIndex].text; place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); marker = new GMarker(point); map.addOverlay(marker); var address_array=place.address.split(","); var statezip_array=address_array[2].split(" "); var zip=statezip_array[2]; if(!zip) { var statezip_array=address_array[1].split(" "); var zip=statezip_array[2]; } var address_email_phone = document.forms[0].q.value; var address_email_phone_array=address_email_phone.split("!"); var email_phone_array=address_email_phone_array[1].split(","); var email=email_phone_array[0]; var phone=email_phone_array[1]; marker.bindInfoWindowHtml('
' + dist_name + '
'+ place.address + '
'+phone+'
'+email+'
'); // +'Country code: ' + place.AddressDetails.Country.CountryNameCode); marker.openInfoWindowHtml('
' + dist_name + '
'+ place.address + '
'+phone+'
'+email+'
'); // + 'Country code: ' + place.AddressDetails.Country.CountryNameCode); } } // showLocation() is called when you click on the Search button // in the form. It geocodes the address entered into the form // and adds a marker to the map at that location. function showLocation() { var address_email = document.forms[0].q.value; var address_email_array=address_email.split("!"); geocoder.getLocations(address_email_array[0], addAddressToMap); } // findLocation() is used to enter the sample addresses into the form. function findLocation(address) { go_top(); document.forms[0].q.value = address; showLocation(); } function disp_pnts() { } function go_top() { window.location="#top"; }