var gmap = $("#gmap");
if (gmap.is('div')) {
handleGMap = function () {
var gps = { Zoom: 20, Latitude: 0, Longitude: 0 };
$.each(site.gdata, function (i, e) { gps.Latitude += e.gps.Latitude; gps.Longitude += e.gps.Longitude; gps.Zoom = gps.Zoom > e.gps.Zoom ? e.gps.Zoom : gps.Zoom; });
gps.Latitude /= (site.gdata.length || 1);
gps.Longitude /= (site.gdata.length || 1);
var myLatlng = new google.maps.LatLng(gps.Latitude, gps.Longitude);
var myOptions = {
zoom: site.gdata.length > 1 ? 7 : gps.Zoom,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(gmap.get(0), myOptions);
$.each(site.gdata, function (i, e) {
var infowindow = new google.maps.InfoWindow({
content: e.html
});
var marker = new google.maps.Marker({
position: new google.maps.LatLng(e.gps.Latitude, e.gps.Longitude),
map: map,
//icon: e.icon,
title: e.title
});
google.maps.event.addListener(marker, 'click', function () { infowindow.open(map, marker); });
});
};
$.getScript("http://maps.google.com/maps/api/js?sensor=false&callback=handleGMap®ion=IE");
}