var map1; var bounds1; var businesses1; var geocodes1; var cntGeocoded1 = 0; var directionsPanel1; var directions1; var focusedBusiness1; function generateMap1() { if (GBrowserIsCompatible() && document.getElementById("svmap_canvas1") != null) { geocoder1 = new GClientGeocoder(); geocoder1.setCache(null); var mapOptions = { mapTypes:[G_NORMAL_MAP] }; map1 = new GMap2(document.getElementById("svmap_canvas1"), mapOptions); var mapControl = new GMapTypeControl(); map1.addControl(mapControl); map1.addControl(new GSmallZoomControl3D()); map1.disableDoubleClickZoom(); map1.disableScrollWheelZoom(); bounds1 = new GLatLngBounds; map1.setCenter(new GLatLng(33.13755119234614,12.65625), 1); var marker40 = new GIcon(); marker40.image = "http://thermalloys.com/components/com_svmap/markers/apartment-3.png"; marker40.iconSize = new GSize(32,37); marker40.iconAnchor = new GPoint(16,37); marker40.infoWindowAnchor = new GPoint(16,18.5); businesses1 = [[9,marker40,"Europe",49.837982453084834,16.875,'

Europe

',"",""] ,[10,marker40,"North America",48.922499263758255,-99.84375,'

North America

',"",""] ,[11,marker40,"South America",-3.513421045640032,-55.546875,'

South America

',"",""] ,[12,marker40,"Africa",20.632784250388028,16.171875,'

Africa

',"",""] ,[13,marker40,"Middle East",34.59704151614417,43.9453125,'

Middle East

',"",""] ,[14,marker40,"Asia",34.047863,100.619655,'

Asia

',"",""] ,[15,marker40,"Oceania",-31.203405,144.580078,'

Oceania

',"",""] ]; addBusinesses1(); } } function setBounds1(bounds) { map1.setZoom(map1.getBoundsZoomLevel(bounds)); map1.setCenter(bounds.getCenter()); } function geocodeBusinesses1() { if (cntGeocoded1 < geocodes1.length) { geocoder1.getLocations(geocodes1[cntGeocoded1][7], addressResolved1); } } function addressResolved1(response) { var delay = 0; if (response.Status.code == 620) { delay = 500; } else { if (response.Status.code == 200) { var address = response.Placemark[0]; geocodes1[cntGeocoded1][3] = address.Point.coordinates[1]; geocodes1[cntGeocoded1][4] = address.Point.coordinates[0]; addBusiness1(geocodes1[cntGeocoded1]); } // Move onto the next address; this skips bad addresses, too. cntGeocoded1 += 1; } window.setTimeout(geocodeBusinesses1, delay); } function addBusinesses1() { for (var i=0; i < businesses1.length; i++) { addBusiness1(businesses1[i]); } } function addBusiness1(business) { var point = new GLatLng(business[3], business[4]); var markerOptions = { icon:business[1], draggable: false, "title":business[2] }; var marker = new GMarker(point, markerOptions); var form = '
Get directions : From here - To here
'; var info = business[5]; info = '
'+info+'
'; marker.bindInfoWindowHtml(info); map1.addOverlay(marker); } function showFormFrom() { document.getElementById('formFrom').style.display = 'block'; document.getElementById('formTo').style.display = 'none'; return false; } function showFormTo() { document.getElementById('formTo').style.display = 'block'; document.getElementById('formFrom').style.display = 'none'; return false; } function findDirections1(from, to) { if (directions1 == null) { directionsPanel1 = document.getElementById('svmap_directions_panel1'); directions1 = new GDirections(map1, directionsPanel1); GEvent.addListener(directions1, "error", directionsError); } else { directions1.clear(); } directions1.load("from: "+from+" to: "+to); } function directionsError(response) { status = response.getStatus(); switch (status.code) { case 602: message = "No corresponding geographic location could be found for the specified address. This may be due to the fact that the address is relatively new, or it may be incorrect."; break; case 603: message = "The route for the given directions query cannot be returned due to legal or contractual reasons."; break; case 604: message = "The directions between the points mentioned in the query could not be computed. This is usually because there is no route available between the two points, or because there is no data for routing in that region."; break; default: message = "The directions between the points mentioned in the query could not be computed."; break; } alert(message); }