If you look at the source for this page you can see I build up the InfoWindow content dynamically from the content of my Fusion Table so you could build your content dynamically from a checkbox just the same.
See function windowControl
() in that code.
Note also that you have to suppress the standard infoWindows if you do what I suggest, see here:
layers[id] = new google.maps.FusionTablesLayer({
map: map,
suppressInfoWindows: true,
query: {
select: 'col2',
from: tableids[id],
},
});
like this
ADDED LATER
Basically, here is the code to create the map and Fusion Table layers and suppress the default window:
map = new google.maps.Map(document.getElementById('googft-mapCanvas'), {
center: new google.maps.LatLng(52.4, -1.3),
zoom: 7,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
// One single re-useable InfoWindow
infoWindow = new google.maps.InfoWindow();
for(id=0;id<tableids.length;id++){
layers[id] = new google.maps.FusionTablesLayer({
map: map,
suppressInfoWindows: true,
query: {
select: 'col2',
from: tableids[id],
},
});
google.maps.event.addListener(layers[id], 'click', function(e) {
windowControl(e, infoWindow, map);
});
}
Then, later on in your code, you actually populate the InfoWindow as it pops up:
// Open the info window at the clicked location
function windowControl(e, infoWindow, map) {
// Extract various columns from Fusion Table
var Ref =e.row['Reference'].value;
var Date=e.row['Date'].value;
var Col =e.row['Collection'].value;
// Now build HTML we want in our InfoWindow
var HTML;
HTML = "<div class='googft-info-window'>";
HTML+= "<strong>Reference</strong>: " + Ref + " ";
HTML+= "<strong>Date</strong>: " + Date + " ";
// AJAX check if image and thumb are available on Skyscan webserver.
// If both present, offer click through to zoomable image.
// If either missing, suggest user contact Skyscan
if(ImageAndThumbOnServer(Col,Ref)==1){
HTML+= "<a target=\"_blank\" href=\"http://www.skyscan.co.uk/cgi-bin/Zoomable.pl?&date=" + Date + "&ref=" + Ref + "&col=" + Col + "\">Click to view image</a>";
} else {
HTML += "Image not yet scanned contact Skyscan";
}
HTML +="</div>";
infoWindow.setOptions({
content: HTML,
position: e.latLng,
pixelOffset: e.pixelOffset
});
infoWindow.open(map);
}