",anchor: new Microsoft.Maps.Point(12,12),roundClickableArea: true, visible: true});pin.metadata = data[i];Microsoft.Maps.Events.addHandler(pin, 'click', clickInfobox);Microsoft.Maps.Events.addHandler(pin, 'mouseover', mouseOverPricebox);Microsoft.Maps.Events.addHandler(pin, 'mouseover', function (e) {e.target.setOptions({icon: "",anchor: new Microsoft.Maps.Point(15,15),});}); Microsoft.Maps.Events.addHandler(pin, 'mouseout', mouseOutPricebox);Microsoft.Maps.Events.addHandler(pin, 'mouseout', function (e) {e.target.setOptions({icon: "",anchor: new Microsoft.Maps.Point(12,12),});}); pins[i] = pin; } return pins;}function createClusteredPin(cluster) {var minRadius = 10;var outlineWidth = 6;var clusterSize = cluster.containedPushpins.length;var radius = Math.log(clusterSize) / Math.log(10) * 5 + minRadius;var fillColor = 'rgba(255, 40, 40, 0.5)';if (clusterSize < 25) {fillColor = 'rgba(20, 180, 20, 0.5)'; } else if (clusterSize < 125) {fillColor = 'rgba(255, 210, 40, 0.5)';} else if (clusterSize < 625) {fillColor = 'rgba(255, 165, 0, 0.5)';}var svg = [''];cluster.setOptions({icon: svg.join(''),anchor: new Microsoft.Maps.Point(radius, radius),textOffset: new Microsoft.Maps.Point(0, radius - 8) }); Microsoft.Maps.Events.addHandler(cluster, 'click', clickCluster); } function clickCluster(cluster) {if (cluster.target.containedPushpins) {var pushpins = [];for (var i = 0, len = cluster.target.containedPushpins.length; i < len; i++) {pushpins.push(cluster.target.containedPushpins[i].getLocation());}map.setView({ bounds: Microsoft.Maps.LocationRect.fromLocations(pushpins),padding: 100});}} function mouseOverPricebox(pin) {if (pin.target.metadata.Url) {$.ajax({url: "/ajax/pricebox",data: {"Url": pin.target.metadata.Url,"Arrival": "17-09-2024","Departure": "","Nights": "","MaxPersons": "","ArrivalFrom": "","ArrivalUntil": "","PriceFrom": "","PriceUntil": "" },type: 'GET',success: function(response) {priceBox.setOptions({maxHeight: 23,zIndex: 1,showCloseButton: false,showPointer: false,location: pin.target.getLocation(),description: response,offset: new Microsoft.Maps.Point(5, 5),visible: true}); }}); } } function mouseOutPricebox(){ priceBox.setOptions({visible: false}); } function clickInfobox(pin) {if (pin.target.metadata.Url) {$.ajax({url: "/ajax/infobox",data: {"Url": pin.target.metadata.Url,"Arrival": "17-09-2024","Departure": "","Nights": "","MaxPersons": "","ArrivalFrom": "","ArrivalUntil": "","PriceFrom": "","PriceUntil": ""},type: 'GET',success: function(response) {infoBox.setOptions({zIndex: 99,maxHeight: 496,maxWidth: 240,showCloseButton: false,showPointer: false,location: pin.target.getLocation(),description: response,visible: true});}}); } } function closeInfobox(infoBox){var isCloseAction = infoBox.originalEvent.target.id === "close-infobox";if (isCloseAction){infoBox.target.setOptions({visible: false}); }}