document.write('');
var oldDiv = null;
var div = null;
var aeOL=[];function addEvent(o,n,f,l){var a='addEventListener',h='on'+n,b='',s='';if(o[a]&&!l)return o[a](n,f,false);o._c|=0;if(o[h]){b='_f'+o._c++;o[b]=o[h]}s='_f'+o._c++;o[s]=f;o[h]=function(e){e=e||window.event;var r=true;if(b)r=o[b]&&o[b](e)!=false&&r;r=o[s]&&o[s](e)!=false&&r;return r};aeOL[aeOL.length]={o:o,h:h}};
var map = null;
var geocoder = null;
var bounds = null;
var oTimer = null;
var aBounds = new Array();
var aContent = new Array();
var size = null;
var totalBounds = 0;
var totalBoundsAdded = 0;
var totalBoundsAddedSuccessfully = 0;
var icon;
var boundsRemaining = 0;
function initMap()
{
if (GBrowserIsCompatible())
{
oldDiv = document.getElementById('divMap');
div = oldDiv.cloneNode(false);
div.style.visibility = 'hidden';
oldDiv.style.overflow = 'hidden';
oldDiv.appendChild(div);
var mapOptions = {mapTypes:new Array(G_NORMAL_MAP, G_HYBRID_MAP)};
map = new GMap2(div, mapOptions);
size = map.getSize();
bounds = new GLatLngBounds();
geocoder = new GClientGeocoder();
//map.enableScrollWheelZoom();
map.enableContinuousZoom();
// Initialise Map
map.setCenter(new GLatLng(0, 0), 0);
icon = new GIcon();
icon.image = '/images/pin_wine.png';
icon.iconSize = new GSize(27, 27);
icon.iconAnchor = new GPoint(13, 27);
icon.infoWindowAnchor = new GPoint(13, 27);
icon = G_DEFAULT_ICON;
}
else
{
if (document.getElementById('spanProgress'))
document.getElementById('spanProgress').innerHTML = 'Your browser isn\'t compatible with Google Maps.';
}
}
var queue = new Array();
function queueAddress(address, customerName, description, customerId, latitude, longitude)
{
queue[queue.length] = new Array(address, customerName, description, customerId, latitude, longitude);
totalBounds ++;
}
var tQueue;
var itemsProcessing = 0;
function checkQueue()
{
tQueue = window.setInterval('if (queue.length == 0) {window.clearInterval(tQueue)} else if (totalBounds - (queue.length + totalBoundsAdded) < 20) {addAddress(queue[0][0], queue[0][1], queue[0][2], queue[0][3], queue[0][4], queue[0][5]); queue.splice(0, 1);}', 10);
}
function addAddress(address, customerName, description, customerId, latitude, longitude, noIncrement)
{
if (geocoder)
{
if (latitude != null && longitude != null)
{
addMarker(new GLatLng(latitude, longitude), address, customerName, description, customerId);
}
else
{
geocoder.getLatLng
(
address,
function (point)
{
if (!point)
{
geocoder.getLocations
(
address,
function (placemark)
{
if (placemark)
{
if (placemark.Status.code == G_GEO_SUCCESS)
addAddress(placemark.name, customerName, description, customerId, latitude, longitude, true);
else
{
totalBoundsAdded ++;
if (document.getElementById('spanProgress'))
document.getElementById('spanProgress').innerHTML = parseInt(((totalBoundsAdded > totalBounds ? totalBounds : totalBoundsAdded) / totalBounds) * 100) + '% Completed';
}
}
else
{
totalBoundsAdded ++;
if (document.getElementById('spanProgress'))
document.getElementById('spanProgress').innerHTML = parseInt(((totalBoundsAdded > totalBounds ? totalBounds : totalBoundsAdded) / totalBounds) * 100) + '% Completed';
}
}
)
}
else
{
ScriptLoader.LoadFile('/mapping/addGeographics.asp?CustomerID=' + customerId + '&Latitude=' + point.lat() + '&Longitude=' + point.lng());
addMarker(point, address, customerName, description, customerId, latitude, longitude);
}
}
);
}
}
}
function addMarker(point, address, customerName, description, customerId)
{
var markerOptions = {title:new String(customerName), icon:icon};
var marker = new GMarker(point, markerOptions);
var content = '';
content += '
';
content += '
' + customerName + '';
content += '
';
content += '
' + description + '
';
content += '
' + address + '
';
content += '
';
content += ' Show Operator Details';
content += ' Zoom In';
content += '
';
content += '
';
var infoWindowOptions = {maxWidth:new Number(size.width * 0.67)};
marker.bindInfoWindowHtml(content, infoWindowOptions);
map.addOverlay(marker);
// Extend bounds to include this point
bounds.extend(point);
totalBoundsAdded ++;
totalBoundsAddedSuccessfully ++;
if (document.getElementById('spanProgress'))
document.getElementById('spanProgress').innerHTML = parseInt(((totalBoundsAdded > totalBounds ? totalBounds : totalBoundsAdded) / totalBounds) * 100) + '% Completed';
}
function zoomTo(x, y)
{
map.setZoom(14);
}
function setZoom()
{
if (totalBounds > 0 && totalBoundsAddedSuccessfully == 0)
{
if (document.getElementById('spanProgress'))
document.getElementById('spanProgress').innerHTML = 'The specified location(s) could not be found.';
if (document.getElementById('imgProgress'))
document.getElementById('imgProgress').style.display = 'none';
}
else
{
var size = map.getSize();
var zoomLevel = map.getBoundsZoomLevel(bounds);
if (zoomLevel > 15)
zoomLevel = 15;
var center = bounds.getCenter();
map.setCenter(center, zoomLevel);
if (size.height > 270)
map.addControl(new GLargeMapControl());
else if (size.height > 100)
map.addControl(new GSmallMapControl());
if (size.height > 270)
map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10, 10)));
if (size.height > 270)
map.addControl(new GOverviewMapControl());
map.savePosition();
oldDiv.parentNode.replaceChild(div, oldDiv);
div.style.visibility = 'visible';
}
}
function drawPins()
{
initMap();
queueAddress('Brisbane Ranges National Park Victoria Australia VIC 3340 Australia', 'Brisbane Ranges', 'Brisbane Ranges National Park (7,718ha) offers excellent opportunities for pleasant bushwalks, picnics, scenic drives, wildflow', 33299, -37.850429, 144.2211029);
queueAddress('Caves Rd, Buchan VIC 3000 Australia', 'Buchan Caves', 'Near the township of Buchan, lies a honeycomb of caves full of spectacular limestone formations. Buchan Caves were formed by un', 33300, -37.473824, 148.144839);
queueAddress('Offshore Ocean Grove VIC 3000 Australia', 'ex-HMAS Canberra Reserve', '<p>The site has been established specifically for diving. Snorkelling is also permitted. Access to the site is limited to tho', 47098, 40.2120575, -74.0065258);
queueAddress('Lake Eildon National Park VIC 3714 Australia', 'Lake Eildon National Park', 'Lake Eildon National Park offers a variety of settings to explore; from open bush in the North, to dense vegetation in the Sout', 33307, -37.1294444, 145.8688889);
queueAddress('Offshore Ocean Grove Vict 3000 Australia', 'Licensed Tour Operator \'ex-HMAS Canberra Reserve\' ', ' <p>The site has been established specifically for diving. Snorkelling is also permitted. Access to the site is limited to th', 48867, 40.2120575, -74.0065258);
queueAddress('Alexander Road, Warrandyte VIC 3106 Australia', 'Longridge', 'Aptly named, the long ridge through this park offers spectacular and breathtaking views of the Yarra River and surrounds. Easte', 33308, -37.740037, 145.185144);
queueAddress('Mt Buffalo National Park, Mt Buffalo VIC 3740 Australia', 'Mt Buffalo National Park', 'First reserved in 1898, the 31,000 hectare park contains vegetation and fauna adapted to extremes of weather, as a result of it', 33311, -36.7213736, 146.786149);
queueAddress('5 Gordons Road, South Morang VIC 3752, Australia VIC 3752 Australia', 'Plenty Gorge', 'Set on the Plenty River, the site has a feeling of remoteness, although it is just 20 kilometres North of Melbourne. Nioka Bush', 33312, -37.6381692, 145.100814);
queueAddress('Woods Point Road, Reefton VIC 3799 Australia', 'Upper Yarra Reservoir', 'Up in the peaceful high country, 24 km east of Warburton, lies the popular Upper Yarra Reservoir Park - the upper most point of', 34900, -37.674143, 145.852287);
checkQueue();
oTimer = window.setInterval('if (totalBoundsAdded >= totalBounds) {setZoom(); window.clearInterval(oTimer)}', 10);
};
document.write('');
addEvent (window, 'load', new Function('drawPins()'));
addEvent (window, 'unload', new Function('GUnload()'));