var map;
var bounds;
var businesses;
var geocodes;
var cntGeocoded = 0;
var directionsPanel;
var directions;
var focusedBusiness;
function generateMap() {
if (GBrowserIsCompatible() && document.getElementById("svmap_canvas") != null) {
geocoder = new GClientGeocoder();
geocoder.setCache(null);
var mapOptions = {
mapTypes:[G_HYBRID_MAP]
};
map = new GMap2(document.getElementById("svmap_canvas"), mapOptions);
var mapControl = new GMapTypeControl();
map.addControl(mapControl);
map.addControl(new GSmallMapControl());
map.enableDoubleClickZoom();
map.enableScrollWheelZoom();
bounds = new GLatLngBounds;
map.setCenter(new GLatLng(7.013667927566642,-4.888916015625), 10);
var marker1 = new GIcon();
marker1.image = "https://sndi.ci/components/com_svmap/markers/blue.png";
marker1.iconSize = new GSize(12,20);
marker1.iconAnchor = new GPoint(6,20);
marker1.infoWindowAnchor = new GPoint(6,10);
var marker3 = new GIcon();
marker3.image = "https://sndi.ci/components/com_svmap/markers/blue.png";
marker3.iconSize = new GSize(12,20);
marker3.iconAnchor = new GPoint(6,20);
marker3.infoWindowAnchor = new GPoint(6,10);
var marker6 = new GIcon();
marker6.image = "https://sndi.ci/components/com_svmap/markers/green.png";
marker6.iconSize = new GSize(12,20);
marker6.iconAnchor = new GPoint(6,20);
marker6.infoWindowAnchor = new GPoint(6,10);
businesses = [[1,marker3,"SNDI Direction Général",5.327226957678523,-4.020368456840515,'
SNDI Direction Général
Abidjan, Plateau
',"/index.php/reseau/business/1.html","Côte d\'\'ivoire Abidjan, Plateau"],[2,marker6,"SNDI Centre II",5.326687491449059,-4.021564722061157,'SNDI Centre II
Abidjan – Plateau, Boulevard Angoulvant
Abidjan
20 21 78 63 / 20 22 26 20
',"/index.php/reseau/business/sndi-centre-ii/2.html","Côte d\'\'ivoire Abidjan Abidjan – Plateau, Boulevard Angoulvant"],[3,marker3,"sndi1",5.225836428448148,-3.754148483276367,'sndi1
Grand Bassam
',"/index.php/reseau/business/sndi1/3.html","Côte d\'ivoire Grand Bassam"],[4,marker3,"sndi2",5.4875447377418825,-4.051423072814941,'sndi2
Anyama
',"/index.php/reseau/business/sndi2/4.html","Côte d\'ivoire Anyama"],[5,marker3,"sndi3",9.452109794175831,-5.634269714355469,'sndi3
korhogo
',"/index.php/reseau/business/sndi3/5.html","Côte d\'ivoire korhogo"],[6,marker3,"sndi4",5.523384617291998,-4.163389205932617,'sndi4
Adiaké
',"/index.php/reseau/business/sndi4/6.html","Côte d\'ivoire Adiaké"],[7,marker3,"sndi5",5.472165820730229,-3.2056045532226562,'sndi5
Aboisso
',"/index.php/reseau/business/sndi5/7.html","Côte d\'ivoire Aboisso"],[8,marker3,"sndi6",5.499334972285823,-3.6633825302124023,'sndi6
alepe
',"/index.php/reseau/business/sndi6/8.html","Côte d\'ivoire alepe"],[9,marker3,"sndi7",6.543494092339949,-7.482719421386719,'sndi7
guiglo
',"/index.php/reseau/business/sndi7/9.html","Côte d\'ivoire guiglo"],[10,marker3,"sndi8",5.927465755070133,-4.221839904785156,'sndi8
Agboville
',"/index.php/reseau/business/sndi8/10.html","Côte d\'ivoire Agboville"],[11,marker3,"sndi9",7.129509692825984,-3.2028579711914062,'sndi9
Agnibilekro
',"/index.php/reseau/business/sndi9/11.html","Côte d\'ivoire Agnibilekro"],[12,marker3,"sndi10",8.027614719245472,-2.7929306030273438,'sndi10
bondoukou
',"/index.php/reseau/business/sndi10/12.html","Côte d\'ivoire bondoukou"],[13,marker3,"sndi11",7.7981635683065225,-3.1656932830810547,'sndi11
Tanda
',"/index.php/reseau/business/sndi11/13.html","Côte d\'ivoire Tanda"],[14,marker3,"sndi12",6.729287243384587,-3.4867429733276367,'sndi12
Abengourou
',"/index.php/reseau/business/sndi12/14.html","Côte d\'ivoire Abengourou"],[15,marker3,"sndi13",6.648750677630533,-4.205188751220703,'sndi13
Bongouanou
',"/index.php/reseau/business/sndi13/15.html","Côte d\'ivoire Bongouanou"],[16,marker3,"sndi14",6.552191715300017,-5.019292831420898,'sndi14
Toumodi
',"/index.php/reseau/business/sndi14/16.html","Côte d\'ivoire Toumodi"],[17,marker3,"sndi15",6.644456,-4.705402,'sndi15
Dimbokro
',"/index.php/reseau/business/sndi15/17.html","Côte d\'ivoire Dimbokro"],[18,marker3,"sndi16",6.827238685051813,-5.289831161499023,'sndi16
Yamoussoukro
',"/index.php/reseau/business/sndi16/18.html","Côte d\'ivoire Yamoussoukro"],[19,marker3,"sndi17",4.76154611141608,-6.637673377990723,'sndi17
San pedro
',"/index.php/reseau/business/sndi17/19.html","Côte d\'ivoire San pedro"],[20,marker1,"sndi18",7.688026301002376,-5.030708312988281,'sndi18
Bouafle
',"/index.php/reseau/business/sndi18/20.html","Côte d\'ivoire Bouafle"],[21,marker3,"sndi19",6.88182030117227,-6.445498466491699,'sndi19
Daloa
',"/index.php/reseau/business/sndi19/21.html","Côte d\'ivoire Daloa"],[22,marker3,"sndi20",6.485037030470665,-6.5880632400512695,'sndi20
ISSIA
',"/index.php/reseau/business/sndi20/22.html","Côte d\'ivoire ISSIA"],[23,marker3,"sndi21",6.375779667175935,-5.4241132736206055,'sndi21
Oume
',"/index.php/reseau/business/sndi21/23.html","Côte d\'ivoire Oume"],[24,marker3,"sndi22",6.618911067982959,-5.9127044677734375,'sndi22
Sinfra
',"/index.php/reseau/business/sndi22/24.html","Côte d\'ivoire Sinfra"],[25,marker3,"sndi23",5.782186693096669,-6.602182388305664,'sndi23
Soubre
',"/index.php/reseau/business/sndi23/25.html","Côte d\'ivoire Soubre"],[26,marker3,"sndi24",5.846911620494379,-5.684051513671875,'sndi24
lakota
',"/index.php/reseau/business/sndi24/26.html","Côte d\'ivoire lakota"]];
addBusinesses();
}
}
function setBounds(bounds) {
map.setZoom(map.getBoundsZoomLevel(bounds));
map.setCenter(bounds.getCenter());
}
function geocodeBusinesses() {
if (cntGeocoded < geocodes.length) {
geocoder.getLocations(geocodes[cntGeocoded][7], addressResolved);
}
}
function addressResolved(response) {
var delay = 0;
if (response.Status.code == 620) {
delay = 500;
} else {
if (response.Status.code == 200) {
var address = response.Placemark[0];
geocodes[cntGeocoded][3] = address.Point.coordinates[1];
geocodes[cntGeocoded][4] = address.Point.coordinates[0];
addBusiness(geocodes[cntGeocoded]);
}
// Move onto the next address; this skips bad addresses, too.
cntGeocoded += 1;
}
window.setTimeout(geocodeBusinesses, delay);
}
function addBusinesses() {
for (var i=0; i < businesses.length; i++) {
addBusiness(businesses[i]);
}
}
function addBusiness(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 = '';
var info = business[5];
var div = document.createElement("div");
div.style.width = "200px";
div.style.height = "400px";
var pano = new GStreetviewPanorama(div);
pano.setLocationAndPOV(point);
GEvent.addListener(pano, "error", function() { marker.bindInfoWindowHtml(info); } );
var tabs = [new GInfoWindowTab('Info', info),new GInfoWindowTab('StreetView', div)];
marker.bindInfoWindowTabsHtml(tabs);
GEvent.addListener(marker, "infowindowopen", function() { pano.show(); });
GEvent.addListener(marker, "infowindowbeforeclose", function() { pano.hide(); });
map.addOverlay(marker);
bounds.extend(point);
setBounds(bounds);
}
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 findDirections(from, to) {
if (directions == null) {
directionsPanel = document.getElementById('svmap_directions_panel');
directions = new GDirections(map, directionsPanel);
GEvent.addListener(directions, "error", directionsError);
} else {
directions.clear();
}
directions.load("from: "+from+" to: "+to);
}
function directionsError(response) {
status = response.getStatus();
switch (status.code) {
case 602:
message = "Aucune localisation géographic n'a pu être trouvé pour cette adresse. Cela peut venir du fait que l'adresse est trop récente, ou incorrecte.";
break;
case 603:
message = "L'itinéraire demandé ne peut être communiqué pour des raisons légales ou contractuelles.";
break;
case 604:
message = "L'itinéraire demandé n'a pas pu être trouvé. Cela peut venir du fait qu'aucun itinéraire n'existe entre ces deux points, ou parcequ'il n'y a pas d'informations de localisation dans cette région.";
break;
default:
message = "L'itinéraire demandé n'a pas pu être trouvé.";
break;
}
alert(message);
}