I want to be able to change the "Nearby Accounts" that will pop up when you click on the button "Show Nearby Accounts" to be a different color than the account that you are originally looking at. Is this possible?
<apex:page showHeader="false" standardStylesheets="false" cache="false" doctype="html-5.0" controller="NearbyAccountsController">
<html>
<head>
<title>Nearby Accounts</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
<!-- jQuery + jQuery Mobile files -->
<apex:includeScript value="{!URLFOR($Resource.jquery, 'jquery-1.9.1.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery, 'jquery.mobile-1.4.0.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.jquery, 'jquery.mobile-1.4.0.min.css')}" />
<!-- Google Maps -->
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=true"></script>
<style>
body, html {
height: 100%;
width: 100%;
}
#nearbyAccountsPage, .ui-content, #map_canvas {
width: 100%;
height: 100%;
padding: 0;
}
</style>
<script>
var map;
var lat = {!account.Geolocation__Latitude__s};
var lng = {!account.Geolocation__Longitude__s};
var accountName = "{!account.Name}";
var accountbillingstreet = "{!account.billingstreet}";
var accountbillingcity = "{!account.billingcity}";
var accountbillingstate = "{!account.billingstate}";
var accountbillingpostalcode = "{!account.billingpostalcode}";
$(document).on('pageshow', '#nearbyAccountsPage', function() {
initGmap();
});
function initGmap() {
var latlng = new google.maps.LatLng(lat, lng);
var mapOptions = {
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoom: 13,
// The following options are added to optimize for mobile screens.
mapTypeControl: false,
streetViewControl: false,
scaleControl: false,
rotateControl: false,
panControl: false,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL,
position: google.maps.ControlPosition.LEFT_TOP
}
};
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
createMarkerAndInfoWindow(accountName, latlng);
}
function createMarkerAndInfoWindow(accountName, latlng) {
var marker = new google.maps.Marker({
position: latlng,
title: accountName,
map: map,
});
var infoWindow = new google.maps.InfoWindow({
content: '<b>' + accountName + '<b>'
});
google.maps.event.addListener(marker, 'click', function() {
infoWindow.open(map, marker);
});
}
function getNearbyAccounts() {
NearbyAccountsController.getNearbyAccounts(lat, lng, function (result, event) {
if (event.status) {
for (i = 0; i < result.length; i++) {
var acctName = result[i].Name;
var acctBillingStreet = result[i].BillingStreet;
var acctBillingCity = result[i].BillingCity;
var acctBillingState = result[i].BillingState;
var acctBillingPostalCode = result[i].BillingPostalCode;
var acctLatlng = new google.maps.LatLng(result[i].Geolocation__Latitude__s, result[i].Geolocation__Longitude__s);
createMarkerAndInfoWindow(acctName + '<br>' + acctBillingStreet + '<br>' + acctBillingCity + ', ' + acctBillingState + ' ' + acctBillingPostalCode, acctLatlng);
}
}
});
}
</script>
</head>
<body>
<div data-role="page" id="nearbyAccountsPage">
<div data-role="header" data-position="fixed">
<h1>{!account.name}</h1>
<a href="#" data-role="button" class="ui-btn-right" onclick="getNearbyAccounts();">Show Nearby</a>
</div>
<div data-role="content">
<div id="map_canvas"></div>
</div>
</div>
</body>
</html>
</apex:page>
Here is what it looks like now when you click on "Show Accounts." The red dot with the balloon that says United Hospital I want to be red, but all of the accounts surrounding it I want to be a different color.