var icons = []; icons[1] = new GIcon(); icons[1].iconSize = new GSize(32, 32); // set icon dimensions icons[1].iconAnchor = new GPoint(16, 30); // set icon anchor point icons[1].infoWindowAnchor = new GPoint(16, 30); // set anchor point of info window icons[1].image = "/UserFiles/Image/icons/1.png"; // set icon source icons[2] = new GIcon(); icons[2].iconSize = new GSize(32, 32); // set icon dimensions icons[2].iconAnchor = new GPoint(16, 30); // set icon anchor point icons[2].infoWindowAnchor = new GPoint(16, 30); // set anchor point of info window icons[2].image = "/UserFiles/Image/icons/2.png"; // set icon source function getGeocode(){ $.getJSON('/json.geo.php', {county:county}, function(json){ $(json).each(function(idx){ var latlon = [this.lat,this.lon]; $(el).jmap('addCourse', {pointLatLng:latlon, info:this, idx:idx}); }); }); } $(document).ready(function(){ $('#backtomap').click(function(){ $('#flashmap').css({height:'608px', width:'500px'}); $('#mapcontainer').hide(); $('#countylist').html(' '); }); }); function ukmap_DoFSCommand(command,county){ var mapopts = { mapZoom: 9, mapShowjMapIcon: false, mapType: 'map', mapEnableType: true } var _icon = new GIcon(); // create _icon.iconSize = new GSize(32, 32); // set icon dimensions _icon.iconAnchor = new GPoint(16, 30); // set icon anchor point _icon.infoWindowAnchor = new GPoint(16, 30); // set anchor point of info window _icon.image = "/images/map_flag.png"; // set icon source var params = !isNaN(county * 1) ? {id:county} : {county:county}; var geocoder = new GClientGeocoder; var bounds = new GLatLngBounds(); $.getJSON('/json.geo.php', params, function(json){ geocoder.getLatLng(json.geocode, function(point){ $.extend(mapopts, {mapCenter: [point.y,point.x]}); //$('#flashmap').hide(); $('#flashmap').css({height:'0',width:'0'}); $('#mapcontainer').show(); $('#countymap').jmap('init', mapopts, function(el, options){ // get markers $.getJSON('/json.county.php', {id:json.id}, function(json){ var markers = []; var listHTML = ''; $(json).each(function(idx){ var that = this; var latlon = [this.lat,this.lon]; //$(el).jmap('addCourse', {pointLatLng:latlon, info:this, idx:idx}); var latlng = new GLatLng(this.lat,this.lon); bounds.extend(latlng); var marker = new GMarker(latlng, {title:this.title, icon:icons[this.type_id]}); // create new marker object using marker options GEvent.addListener(marker, "click", function() { // add event listener to marker to detect clicking var info = '
'; info += '' + that.title + '
Click for more details
'; info += 'Tel: ' + that.telephone + '
'; $.jmap.GMap2.openInfoWindowHtml(latlng, info); // open info window using innerhtml of div }); markers.push(marker); // create list under map listHTML += '' + that.title + '
'; }); var mapctr = bounds.getCenter(); $('#countylist').html(listHTML); $('#countymap').jmap('addCluster', {markers:markers}); $('#countymap').jmap('MoveTo', { 'mapCenter': [mapctr.y,mapctr.x], 'mapZoom': $('#countymap')[0].jmap.getBoundsZoomLevel(bounds) }); $('#countymap')[0].jmap.setZoom($('#countymap')[0].jmap.getBoundsZoomLevel(bounds)); }); var listHTML = ''; $.getJSON('/json.countyfeatured.php', {id:json.id}, function(json){ $(json).each(function(idx){ var that = this; listHTML += '
'; listHTML += ''; listHTML += '' + that.title + ''; listHTML += ''; listHTML += '
'; listHTML += '
'; listHTML += '

'; listHTML += '' + that.title + ''; listHTML += that.overview; listHTML += '

'; listHTML += '
'; }); $('#rightbar').html(listHTML); }); }); }); }); }