/* * Author: Austin Hunt * Website: www.NomadGraphix.com * Edited: May 22, 2014 * Notes: * -------------------------------------------------------------- * Re-engineered most of the map because of poor code design and * impletemented a icon color changing feature. * -------------------------------------------------------------- */ //First, lets add the global variables for our maps script. var map; var markers = new Array(); //Lets create functions to launch our map with it's markers. var createMap = function (options) { map = new google.maps.Map(document.getElementById('map-canvas'),options); } var sendAjaxReq = function (options) { $.ajax(options.url, { success: function(response) { $(".placeholder")(response).slideDown(); checkHeight(); $("#close").click(function(){ $('.missionaries').height($(window).height() - 253); $(".placeholder").slideUp(); $(".placeholder .family-icon").css("margin-top", "15"); }); } }); } var markerClick = function(options) { return function () { var marker = markers[options.markerIndex]; for (var i = 0; i < markers.length; i++) {markers[i].setIcon("images/map/marker.png"); }; marker.setIcon("images/map/marker-active.png"); map.setZoom(6); map.setCenter(marker.getPosition()); //Run Ajax Update setTimeout(function() {sendAjaxReq({url:options.url})},100); } } var createMarker = function(options,markerIndex) { var marker = new google.maps.Marker({ position: new google.maps.LatLng(options.lat,options.lon), map: map, title: options.title, icon: options.icon }); //Add Marker Clicked Listener google.maps.event.addListener(marker, 'click', markerClick({ markerIndex: markerIndex, url: options.title })); //Add Missionary profile clicked listener: $(".marker:eq("+markerIndex+")").click(markerClick({ markerIndex: markerIndex, url: options.title })); return marker; } var createMarkers = function(markerOptions) { for (var i = 0; i < markerOptions.options.length - 1; i++) { markers[i] = createMarker(markerOptions.options[i],i); }; } function initialize() { //First, create the map: createMap({ zoom: 3, center: new google.maps.LatLng(31.6333333, -8) }); //Now, lets set up all of our markers. createMarkers({ options:[ { lat: 16.3276568, lon: 120.82261549999998, title: "/map/entry?entry_id=112", icon: "images/map/marker.png" }, { lat: 37.3546671, lon: -85.33448140000001, title: "/map/entry?entry_id=115", icon: "images/map/marker.png" }, { lat: 34.6968112, lon: -118.05866909999997, title: "/map/entry?entry_id=116", icon: "images/map/marker.png" }, { lat: 14.5604, lon: 120.59390299999995, title: "/map/entry?entry_id=118", icon: "images/map/marker.png" }, { lat: 11.5448729, lon: 104.89216680000004, title: "/map/entry?entry_id=285", icon: "images/map/marker.png" }, { lat: 34.3114982, lon: -89.94425669999998, title: "/map/entry?entry_id=165", icon: "images/map/marker.png" }, { lat: -2.5166667, lon: 32.89999999999998, title: "/map/entry?entry_id=322", icon: "images/map/marker.png" }, { lat: -2.203816, lon: -79.89745299999998, title: "/map/entry?entry_id=119", icon: "images/map/marker.png" }, { lat: 28.069225, lon: -82.74228099999999, title: "/map/entry?entry_id=120", icon: "images/map/marker.png" }, { lat: -13.759029, lon: -172.104629, title: "/map/entry?entry_id=121", icon: "images/map/marker.png" }, { lat: 41.4994954, lon: -81.6954088, title: "/map/entry?entry_id=122", icon: "images/map/marker.png" }, { lat: 35.9606384, lon: -83.92073920000001, title: "/map/entry?entry_id=823", icon: "images/map/marker.png" }, { lat: 36.0372424, lon: -83.99611329999999, title: "/map/entry?entry_id=123", icon: "images/map/marker.png" }, { lat: -17.6241667, lon: 177.45277780000003, title: "/map/entry?entry_id=127", icon: "images/map/marker.png" }, { lat: 21.521757, lon: -77.78116699999998, title: "/map/entry?entry_id=128", icon: "images/map/marker.png" }, { lat: 54.6871555, lon: 25.279651400000034, title: "/map/entry?entry_id=130", icon: "images/map/marker.png" }, { lat: 41.49932, lon: -81.69436050000001, title: "/map/entry?entry_id=816", icon: "images/map/marker.png" }, { lat: 35.2334472, lon: -82.73429190000001, title: "/map/entry?entry_id=131", icon: "images/map/marker.png" }, { lat: 39.3739761, lon: -80.34842170000002, title: "/map/entry?entry_id=132", icon: "images/map/marker.png" }, { lat: 33.325, lon: 44.422000000000025, title: "/map/entry?entry_id=210", icon: "images/map/marker.png" }, { lat: 39.5150576, lon: -84.39827630000002, title: "/map/entry?entry_id=171", icon: "images/map/marker.png" }, { lat: 27.950575, lon: -82.45717760000002, title: "/map/entry?entry_id=182", icon: "images/map/marker.png" }, { lat: 49.76208500000001, lon: 4.726095999999984, title: "/map/entry?entry_id=133", icon: "images/map/marker.png" }, { lat: -23.6859949, lon: -47.021529999999984, title: "/map/entry?entry_id=321", icon: "images/map/marker.png" }, { lat: 32.9167128, lon: -112.6673834, title: "/map/entry?entry_id=806", icon: "images/map/marker.png" }, { lat: 24.7063805, lon: -78.0195387, title: "/map/entry?entry_id=134", icon: "images/map/marker.png" }, { lat: 39.7674578, lon: -94.84668099999999, title: "/map/entry?entry_id=319", icon: "images/map/marker.png" }, { lat: 35.4939587, lon: -85.01245349999999, title: "/map/entry?entry_id=135", icon: "images/map/marker.png" }, { lat: 27.8397466, lon: -82.7912134, title: "/map/entry?entry_id=136", icon: "images/map/marker.png" }, { lat: 37.81724, lon: -96.86225239999999, title: "/map/entry?entry_id=324", icon: "images/map/marker.png" }, { lat: 8.8750898, lon: 98.35265600000002, title: "/map/entry?entry_id=138", icon: "images/map/marker.png" }, { lat: 6.137777799999999, lon: 1.2124999999999772, title: "/map/entry?entry_id=139", icon: "images/map/marker.png" }, { lat: -34.6550642, lon: -58.50788750000004, title: "/map/entry?entry_id=140", icon: "images/map/marker.png" }, { lat: -13.6575, lon: -73.3833333, title: "/map/entry?entry_id=141", icon: "images/map/marker.png" }, { lat: 28.489427, lon: -82.54392100000001, title: "/map/entry?entry_id=142", icon: "images/map/marker.png" }, { lat: 36.3433141, lon: -82.193914, title: "/map/entry?entry_id=286", icon: "images/map/marker.png" }, { lat: 36.204824, lon: 138.252924, title: "/map/entry?entry_id=323", icon: "images/map/marker.png" }, { lat: 47.4736111, lon: -94.88027779999999, title: "/map/entry?entry_id=162", icon: "images/map/marker.png" }, { lat: 27.950575, lon: -82.45717760000002, title: "/map/entry?entry_id=183", icon: "images/map/marker.png" }, { lat: 15.50167, lon: -88.02774, title: "/map/entry?entry_id=144", icon: "images/map/marker.png" }, { lat: -13.63237, lon: 32.64546999999993, title: "/map/entry?entry_id=146", icon: "images/map/marker.png" }, { lat: 18.207899, lon: -71.09961699999996, title: "/map/entry?entry_id=149", icon: "images/map/marker.png" }, { lat: 33.4473361, lon: -84.14686159999996, title: "/map/entry?entry_id=150", icon: "images/map/marker.png" }, { lat: 28.218366, lon: -82.73233299999998, title: "/map/entry?entry_id=151", icon: "images/map/marker.png" }, { lat: 36.3433141, lon: -82.193914, title: "/map/entry?entry_id=152", icon: "images/map/marker.png" }, { lat: 45.80227, lon: 126.53625999999997, title: "/map/entry?entry_id=211", icon: "images/map/marker.png" }, { lat: -12.9730401, lon: -38.50230399999998, title: "/map/entry?entry_id=560", icon: "images/map/marker.png" }, { lat: 16.8, lon: 96.14999999999998, title: "/map/entry?entry_id=153", icon: "images/map/marker.png" }, { lat: 36.3134397, lon: -82.3534727, title: "/map/entry?entry_id=154", icon: "images/map/marker.png" }, { lat: 33.8839926, lon: -84.51437609999999, title: "/map/entry?entry_id=155", icon: "images/map/marker.png" }, { lat: -33.7139247, lon: 25.52073580000001, title: "/map/entry?entry_id=812", icon: "images/map/marker.png" }, { lat: 52.3555177, lon: -1.1743197000000691, title: "/map/entry?entry_id=320", icon: "images/map/marker.png" }, { lat: 37.751853, lon: 128.87605740000004, title: "/map/entry?entry_id=156", icon: "images/map/marker.png" }, { lat: 9.3500888, lon: -11.70682940000006, title: "/map/entry?entry_id=202", icon: "images/map/marker.png" }, { lat: 11.5448729, lon: 104.89216680000004, title: "/map/entry?entry_id=158", icon: "images/map/marker.png" }, { lat: 18.5372349, lon: -72.33848160000002, title: "/map/entry?entry_id=109", icon: "images/map/marker.png" }, { lat: 22.744371, lon: -98.975075, title: "/map/entry?entry_id=159", icon: "images/map/marker.png" }, { lat: 7.539988999999999, lon: -5.547080000000051, title: "/map/entry?entry_id=160", icon: "images/map/marker.png" }, { lat: 39.20198180000001, lon: -84.20981940000001, title: "/map/entry?entry_id=161", icon: "images/map/marker.png" }, { lat: 39.698286, lon: -84.159943, title: "/map/entry?entry_id=275", icon: "images/map/marker.png" }, { lat: 49.40909, lon: 8.53096000000005, title: "/map/entry?entry_id=804", icon: "images/map/marker.png" }, { lat: 17.0984445, lon: -88.94138650000002, title: "/map/entry?entry_id=811", icon: "images/map/marker.png" }, { lat: 14.8319444, lon: 120.5061111, title: "/map/entry?entry_id=187", icon: "images/map/marker.png" }, { lat: 43.0249592, lon: -108.38010359999998, title: "/map/entry?entry_id=166", icon: "images/map/marker.png" }, { lat: 39.2806451, lon: -80.34453409999997, title: "/map/entry?entry_id=167", icon: "images/map/marker.png" }, { lat: 36.34, lon: 43.129999999999995, title: "/map/entry?entry_id=212", icon: "images/map/marker.png" }, { lat: 36.3134397, lon: -82.3534727, title: "/map/entry?entry_id=168", icon: "images/map/marker.png" }, { lat: 34.806166, lon: -106.73335989999998, title: "/map/entry?entry_id=169", icon: "images/map/marker.png" }, { lat: 33.5386523, lon: -112.18598659999998, title: "/map/entry?entry_id=827", icon: "images/map/marker.png" }, { lat: 28.0394654, lon: -81.94980420000001, title: "/map/entry?entry_id=170", icon: "images/map/marker.png" }, { lat: 35.2451342, lon: -81.34119420000002, title: "/map/entry?entry_id=172", icon: "images/map/marker.png" }, { lat: 14.6710132, lon: 120.49778449999996, title: "/map/entry?entry_id=107", icon: "images/map/marker.png" }, { lat: 6.300774, lon: -10.797159999999962, title: "/map/entry?entry_id=203", icon: "images/map/marker.png" }, { lat: 8.122749599999998, lon: 4.24358929999994, title: "/map/entry?entry_id=805", icon: "images/map/marker.png" }, { lat: 16.4054032, lon: 120.59805470000003, title: "/map/entry?entry_id=188", icon: "images/map/marker.png" }, { lat: 47.117411, lon: 20.210285999999996, title: "/map/entry?entry_id=200", icon: "images/map/marker.png" }, { lat: 33.5805955, lon: -112.23737790000001, title: "/map/entry?entry_id=810", icon: "images/map/marker.png" }, { lat: 53.479324, lon: -2.248485100000039, title: "/map/entry?entry_id=201", icon: "images/map/marker.png" }, { lat: 16.6158906, lon: 120.32093729999997, title: "/map/entry?entry_id=189", icon: "images/map/marker.png" }, { lat: 14.6997054, lon: 120.47608530000002, title: "/map/entry?entry_id=190", icon: "images/map/marker.png" }, { lat: -1.2920659, lon: 36.82194619999996, title: "/map/entry?entry_id=808", icon: "images/map/marker.png" }, { lat: 15.870032, lon: 100.99254100000007, title: "/map/entry?entry_id=809", icon: "images/map/marker.png" }, { lat: 42.0245442, lon: -71.1286594, title: "/map/entry?entry_id=173", icon: "images/map/marker.png" }, { lat: -2.2179704, lon: 115.66282999999998, title: "/map/entry?entry_id=807", icon: "images/map/marker.png" }, { lat: 46.7312745, lon: -117.17961579999996, title: "/map/entry?entry_id=174", icon: "images/map/marker.png" }, { lat: 16.6158906, lon: 120.32093729999997, title: "/map/entry?entry_id=191", icon: "images/map/marker.png" }, { lat: 17.1874035, lon: 120.44671760000005, title: "/map/entry?entry_id=193", icon: "images/map/marker.png" }, { lat: 14.8780629, lon: 120.45458009999993, title: "/map/entry?entry_id=278", icon: "images/map/marker.png" }, { lat: 27.8164723, lon: -82.66631689999997, title: "/map/entry?entry_id=284", icon: "images/map/marker.png" }, { lat: 25.4546718, lon: -100.85079100000001, title: "/map/entry?entry_id=176", icon: "images/map/marker.png" }, { lat: 24.806299, lon: 93.94819689999997, title: "/map/entry?entry_id=194", icon: "images/map/marker.png" }, { lat: -23.3044524, lon: -51.16958239999997, title: "/map/entry?entry_id=185", icon: "images/map/marker.png" }, { lat: 48.1671004, lon: -118.9747476, title: "/map/entry?entry_id=175", icon: "images/map/marker.png" }, { lat: 28.1489021, lon: -80.58838550000001, title: "/map/entry?entry_id=177", icon: "images/map/marker.png" }, { lat: 19.4086418, lon: -99.27301460000001, title: "/map/entry?entry_id=178", icon: "images/map/marker.png" }, { lat: 26.5628537, lon: -81.9495331, title: "/map/entry?entry_id=179", icon: "images/map/marker.png" }, { lat: 47.921378, lon: 106.90553999999997, title: "/map/entry?entry_id=196", icon: "images/map/marker.png" }, { lat: 16.0299374, lon: 120.2716719, title: "/map/entry?entry_id=803", icon: "images/map/marker.png" }, { lat: -8.846283, lon: 31.37446, title: "/map/entry?entry_id=204", icon: "images/map/marker.png" }, { lat: -6.211544, lon: 106.84517200000005, title: "/map/entry?entry_id=197", icon: "images/map/marker.png" }, ] }); } //Now, initialize when the map is loaded. google.maps.event.addDomListener(window, 'load', initialize); //UI Stuff: var checkHeight = function() { if (($(".placeholder").height() + 253) > $(window).height()) { var placeholderheight = $(window).height() - 203; $(".placeholder").css("overflow", "scroll"); $(".placeholder").css("height", placeholderheight); $(".family-icon").css("margin-top", "15px"); } } $(document).ready(function(){ $(".select").hover(function(){ var latlongChoice = $(this).attr("title"); var latlongParts = latlongChoice.split(","); var newPos = new google.maps.LatLng(latlongParts[0], latlongParts[1]); map.panTo(newPos); map.setZoom(4); var filter = $(this).text(), count = 0; $(".sort").each(function(){ if ($(this).text().search(new RegExp(filter, "i")) < 0) {$(this).hide();} else { $(this).show(); count++; } }); $(".dropdown li a").click(function(){$(".dropdown").hide();}); $("#dd").hover(function(){$(".dropdown").show();}); }); $("#filter").keyup(function(){ // Retrieve the input field text and reset the count to zero var filter = $(this).val(), count = 0; // Loop through the comment list $(".sort").each(function(){ // If the list item does not contain the text phrase fade it out if ($(this).text().search(new RegExp(filter, "i")) < 0) { $(this).hide(); // Show the list item if the phrase matches and increase the count by 1 } else { $(this).show(); count++; } }); // Update the count var numberItems = count; $("#filter-count").text("Number of Matches = "+count); }); $('.missionaries').height($(window).height() - 253); $("#close").on("click", function(){ $('.missionaries').height($(window).height() - 253); $(".placeholder").slideUp(); $(".placeholder .family-icon").css("margin-top", "15"); }); }); $(window).resize(function() { $('.missionaries').height($(window).height() - 223); }); $(window).trigger('resize'); var map = new google.maps.Map( document.getElementById( 'map-canvas' ), { zoom: 7, center: new google.maps.LatLng( originalLocation[0], originalLocation[1] ), scrollwheel: false });