// Map Functionality // reset markers array markers = new Array(); var map; var marker; var x_offset = 0.0005; // -0.03; var y_offset = 0.005; // 0.13; $(function(){ // Set variables // get the pointer location from the page var loc_string = $("#loc_string").html(); var loc_parts = loc_string.split(","); // Initialise the map function initialize() { // Define the map options var mapOptions = { zoom:6, // 12 scrollwheel: false, center: new google.maps.LatLng(parseFloat(loc_parts[0])+x_offset,parseFloat(loc_parts[1])+y_offset), mapTypeId: "Map" }; // Define the styles var styles = [ { featureType: 'road', elementType: 'all', stylers: [ {hue: '#aaaaaa'}, {saturation: -100}, {lightness: 7}, {visibility: 'on'} ] }, { featureType: 'water', elementType: 'all', stylers: [ {hue: '#a0a0a0'}, {saturation: -100}, {lightness: -17}, {visibility: 'on'} ] }, { featureType: 'poi', elementType: 'labels', stylers: [ {hue: '#000000'}, {saturation: -100}, {lightness: -100}, {visibility: 'off'} ] }, { featureType: 'road', elementType: 'geometry', stylers: [ ] }, { featureType: 'landscape', elementType: 'all', stylers: [ {hue: '#cccccc'}, {saturation: -100}, {lightness: -10}, {visibility: 'on'} ] } ]; // Style the map var styledMapType = new google.maps.StyledMapType(styles, {name: 'Map'}); map = new google.maps.Map(document.getElementById('talk-map-canvas'), mapOptions); map.mapTypes.set('Map', styledMapType); if(loc_string == "53,1.3"){ var myLatlng = new google.maps.LatLng(50.736546, -3.533575); markers[0] = new google.maps.Marker({ position: myLatlng, map: map, title:"Exeter", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 8489, itemURL: 'https://thestudenthousingcompany.com/locations/exeter/estudenthousingcompany.com/locations/exeter/' }); var myLatlng = new google.maps.LatLng(54.050883, -2.801808); markers[1] = new google.maps.Marker({ position: myLatlng, map: map, title:"Lancaster", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 8271, itemURL: 'https://thestudenthousingcompany.com/locations/lancaster/estudenthousingcompany.com/locations/lancaster/' }); var myLatlng = new google.maps.LatLng(52.209603, 0.142720); markers[2] = new google.maps.Marker({ position: myLatlng, map: map, title:"Cambridge", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 7831, itemURL: 'https://thestudenthousingcompany.com/locations/cambridge/estudenthousingcompany.com/locations/cambridge/' }); var myLatlng = new google.maps.LatLng(54.988656, -1.619526); markers[3] = new google.maps.Marker({ position: myLatlng, map: map, title:"Newcastle", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 7208, itemURL: 'https://thestudenthousingcompany.com/locations/newcastle/estudenthousingcompany.com/locations/newcastle/' }); var myLatlng = new google.maps.LatLng(52.959586, -1.155987); markers[4] = new google.maps.Marker({ position: myLatlng, map: map, title:"Nottingham", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 7211, itemURL: 'https://thestudenthousingcompany.com/locations/nottingham/estudenthousingcompany.com/locations/nottingham/' }); var myLatlng = new google.maps.LatLng(50.799033,-1.091310); markers[5] = new google.maps.Marker({ position: myLatlng, map: map, title:"Portsmouth", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 6343, itemURL: 'https://thestudenthousingcompany.com/locations/portsmouth/estudenthousingcompany.com/locations/portsmouth/' }); var myLatlng = new google.maps.LatLng(51.486853, -3.165084); markers[6] = new google.maps.Marker({ position: myLatlng, map: map, title:"Cardiff", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 5227, itemURL: 'https://thestudenthousingcompany.com/locations/cardiff/estudenthousingcompany.com/locations/cardiff/' }); var myLatlng = new google.maps.LatLng(50.909812, -1.404549); markers[7] = new google.maps.Marker({ position: myLatlng, map: map, title:"Southampton", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 4756, itemURL: 'https://thestudenthousingcompany.com/locations/southampton/estudenthousingcompany.com/locations/southampton/' }); var myLatlng = new google.maps.LatLng(53.411108, -2.985549); markers[8] = new google.maps.Marker({ position: myLatlng, map: map, title:"Liverpool", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 2343, itemURL: 'https://thestudenthousingcompany.com/locations/liverpool/estudenthousingcompany.com/locations/liverpool/' }); var myLatlng = new google.maps.LatLng(53.2327,-0.5376); markers[9] = new google.maps.Marker({ position: myLatlng, map: map, title:"Lincoln", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 98, itemURL: 'https://thestudenthousingcompany.com/locations/lincoln/estudenthousingcompany.com/locations/lincoln/' }); var myLatlng = new google.maps.LatLng(55.9531,-3.1889); markers[10] = new google.maps.Marker({ position: myLatlng, map: map, title:"Edinburgh", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 97, itemURL: 'https://thestudenthousingcompany.com/locations/edinburgh/estudenthousingcompany.com/locations/edinburgh/' }); var myLatlng = new google.maps.LatLng(50.7800,-1.8425); markers[11] = new google.maps.Marker({ position: myLatlng, map: map, title:"Bournemouth", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 96, itemURL: 'https://thestudenthousingcompany.com/locations/bournemouth/estudenthousingcompany.com/locations/bournemouth/' }); var myLatlng = new google.maps.LatLng(50.368240,-4.138899); markers[12] = new google.maps.Marker({ position: myLatlng, map: map, title:"Plymouth", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 95, itemURL: 'https://thestudenthousingcompany.com/locations/plymouth/estudenthousingcompany.com/locations/plymouth/' }); var myLatlng = new google.maps.LatLng(51.5072,-0.1275); markers[13] = new google.maps.Marker({ position: myLatlng, map: map, title:"London", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 94, itemURL: 'https://thestudenthousingcompany.com/locations/london/estudenthousingcompany.com/locations/london/' }); var myLatlng = new google.maps.LatLng(52.4831,-1.8936); markers[14] = new google.maps.Marker({ position: myLatlng, map: map, title:"Birmingham", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png", itemID: 64, itemURL: 'https://thestudenthousingcompany.com/locations/birmingham/estudenthousingcompany.com/locations/birmingham/' }); }else{ var myLatlng = new google.maps.LatLng(loc_parts[0],loc_parts[1]); marker = new google.maps.Marker({ position: myLatlng, map: map, title:"The Student Housing Company", icon: "/wp-content/themes/tshc/assets/img/mapMarker01.png" }); map.setZoom(15); } } google.maps.event.addDomListener(window, 'load', initialize); }); $(function(){ /* Drop Down Change */ $("#talk-overlay select").change(function(){ /* Setup */ var selected = null; /* Find Selected Value */ $(this).find("option").each( function(){ if( $(this).attr("selected") == "selected") { selected = $(this); } }); /* Get URL */ if ( selected != null ) { /* Get Link */ var residence_href = selected.val(); /* Check Link */ if ( residence_href ) { /* Redirect */ window.location = residence_href; } } }); });