" +
"
" + photo.photo_title + "<\/strong><\/a>
" +
"
Posted by " +
photo.owner_name + "<\/a>
<\/div>" +
"<\/div>";
marker.html = html;
GEvent.addListener(marker, "click", function() {
me.panoLayer.map.openInfoWindow(marker.getLatLng(), marker.html, {noCloseOnClick: true});
});
return marker;
}
function PanoramioLayer(map, opt_opts) {
var me = this;
me.map = map;
me.ids = {};
me.mgr = new MarkerManager(map, {maxZoom: 19});
var icon = new GIcon();
icon.image = "http://www.panoramio.com/img/panoramio-marker.png";
icon.shadow = "";
icon.iconSize = new GSize(24, 24);
icon.shadowSize = new GSize(22, 22);
icon.iconAnchor = new GPoint(9, 9);
icon.infoWindowAnchor = new GPoint(9, 0);
me.markerIcon = icon;
me.enabled = false;
GEvent.addListener(map, "moveend", function() {
if (me.enabled) {
var bounds = map.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
me.load(me, {maxy: northEast.lat(), miny: southWest.lat(), maxx: northEast.lng(), minx: southWest.lng()});
}
});
}
PanoramioLayer.prototype.enable = function() {
this.enabled = true;
GEvent.trigger(map, "moveend");
}
PanoramioLayer.prototype.disable = function() {
this.enabled = false;
this.mgr.clearMarkers();
this.ids = {};
}
PanoramioLayer.prototype.getEnabled = function() {
return this.enabled;
}
PanoramioLayer.prototype.load = function(panoLayer, userOptions) {
var options = {
order: "popularity",
set: "public",
from: "0",
to: "10",
minx: "-180",
miny: "-90",
maxx: "180",
maxy: "90",
size: "small"
};
for (optionName in userOptions) {
if (userOptions.hasOwnProperty(optionName)) {
options[optionName] = userOptions[optionName];
}
}
var url = "http://www.panoramio.com/map/get_panoramas.php?";
var uniqueID = "";
for (optionName in options) {
if (options.hasOwnProperty(optionName)) {
var optionVal = "" + options[optionName] + "";
url += optionName + "=" + optionVal + "&";
uniqueID += optionVal.replace(/[^\w]+/g,"");
}
}
var callbackName = "PanoramioLayerCallback.loader" + uniqueID; //ask dion
eval(callbackName + " = function(json) { var pa = new PanoramioLayerCallback(json, panoLayer);}");
var script = document.createElement('script');
script.setAttribute('src', url + 'callback=' + callbackName);
script.setAttribute('id', 'jsonScript');
script.setAttribute('type', 'text/javascript');
document.documentElement.firstChild.appendChild(script);
}