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_NORMAL_MAP]
};
map = new GMap2(document.getElementById("svmap_canvas"), mapOptions);
var mapControl = new GMapTypeControl();
map.addControl(mapControl);
map.addControl(new GSmallMapControl());
map.disableDoubleClickZoom();
map.enableScrollWheelZoom();
bounds = new GLatLngBounds;
map.setCenter(new GLatLng(53.225768435790194,-6.5863037109375), 9);
var marker7 = new GIcon();
marker7.image = "http://jordanscentra.ie/components/com_svmap/markers/orange.png";
marker7.iconSize = new GSize(12,20);
marker7.iconAnchor = new GPoint(6,20);
marker7.infoWindowAnchor = new GPoint(6,10);
businesses = [[1,marker7,"Caragh Jordan’s Centra ",53.23718051760242,-6.729050874710083,'
Caragh Jordan’s Centra
| Address: | Caragh Village, Co. Kildare |
| Phone: | 045 866587 |
| Fax: | 045 883679 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 07:00 - 22:00 07:00 - 22:00 07:00 - 22:00 07:00 - 22:00 07:00 - 22:00 08:00 - 22:00 08:00 - 22:00 |
',"/index.php?option=com_svmap&layout=business&business=1&name=caragh-jordans-centra-&Itemid=88","Ireland"],[2,marker7,"Castletymon Jordan’s Centra",53.295144375877726,-6.341385841369629,'Castletymon Jordan’s Centra
| Address: | Castletymon, Tallaght, Dublin 24 |
| Phone: | 01 462 0442 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 06:30 - 22:30 06:30 - 22:30 06:30 - 22:30 06:30 - 22:30 06:30 - 22:30 07:30 - 22:30 07:30 - 22:30 |
',"/index.php?option=com_svmap&layout=business&business=2&name=castletymon-jordans-centra&Itemid=88","Ireland"],[3,marker7,"Springifield ",53.28715358976069,-6.382584571838379,'Springifield
| Address: | Unit 7, Springfield Shopping Centre, Alderwood Avenue, Tallaght, Dublin 24 |
| Phone: | 01 451 1243 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 08:00 - 22:30 |
',"/index.php?option=com_svmap&layout=business&business=3&name=springifield-&Itemid=88","Ireland"],[4,marker7,"Tower Road ",53.32049207860258,-6.3946545124053955,'Tower Road
| Address: | Tower Road, Clondalkin, Dublin 22 |
| Phone: | 01 467 0019 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 07:00 - 22:30 07:00 - 22:30 07:00 - 22:30 07:00 - 22:30 07:30 - 22:30 08:00 - 22:30 08:00 - 22:30 |
',"/index.php?option=com_svmap&layout=business&business=4&name=tower-road-&Itemid=88","Ireland"],[5,marker7,"Ninth Lough ",53.32637490120058,-6.395072937011719,'Ninth Lough
| Address: | Elm Field Court, Ninth Lock Road, Clondalkin, Dublin 24 |
| Phone: | 01 413 6168 |
| Fax: | 01 413 6169 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 06:30 - 22:30 06:30 - 22:30 06:30 - 22:30 06:30 - 22:30 06:30 - 22:30 07:30 - 22:30 08:30 - 22:30 |
',"/index.php?option=com_svmap&layout=business&business=5&name=ninth-lough-&Itemid=88","Ireland"],[6,marker7,"Killinarden ",53.2772367804723,-6.379730701446533,'Killinarden
| Address: | Kilinarden Shopping Centre, Tallaght, Dublin 24 |
| Phone: | 01 420 3686 |
| Fax: | 01 420 3670 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 07:00 - 22:30 07:00 - 22:30 07:00 - 22:30 07:30 - 22:30 07:00 - 22:30 08:00 - 22:30 08:00 - 22:30 |
',"/index.php?option=com_svmap&layout=business&business=6&name=killinarden-&Itemid=88","Ireland"],[7,marker7,"Rathcoole ",53.2823430059031,-6.463801860809326,'Rathcoole
| Address: | Main Street, Rathcoole, Co. Dublin |
| Phone: | 01 458 9109 |
| Fax: | 01 458 8427 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 08:00 - 22:30 |
',"/index.php?option=com_svmap&layout=business&business=7&name=rathcoole-&Itemid=88","Ireland"],[8,marker7,"Blessington ",53.17007730003042,-6.533496379852295,'Blessington
| Address: | Main Street, Blessington, Co. Wicklow |
| Phone: | 045 865727 |
| Fax: | 045 865727 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 07:00 - 22:30 07:00 - 22:30 07:00 - 22:30 07:00 - 22:30 07:00 - 22:30 07:00 - 22:30 08:00 - 22:30 |
',"/index.php?option=com_svmap&layout=business&business=8&name=blessington-&Itemid=88","Ireland"],[9,marker7,"Curragh Grange ",53.16799028862894,-6.800134778022766,'Curragh Grange
| Address: | Curragh Grange, Newbridge, Co. Kildare |
| Phone: | 045 443500 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 07:30 - 22:30 08:00 - 22:30 |
',"/index.php?option=com_svmap&layout=business&business=9&name=curragh-grange-&Itemid=88","Ireland"],[10,marker7,"Johnstown ",53.235996583298935,-6.624328717589378,'Johnstown
| Address: | Address Main Street, Johnstown, Co. Kildare |
| Phone: | 045 882775 |
| Fax: | 045 882775 |
| Opening Hours | |
Monday Tuesday Wednesday Thursday Friday Saturday Sunday | 07:00 - 22:00 07:00 - 22:00 07:00 - 22:00 07:00 - 22:00 07:00 - 22:00 08:00 - 22:00 08:00 - 22:00 |
',"/index.php?option=com_svmap&layout=business&business=10&name=johnstown-&Itemid=88","Ireland"]];
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];
info = ''+info+'
';
marker.bindInfoWindowHtml(info);
map.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 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 = "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);
}