<script>
var data = {<?=$data?>};
//configuration
var config = {
debug : false,
map : 'WSM_MapOffice_YMAP',
map_center : [<?=$arResult["MAP_CENTER"]?>],
map_zoom : 30,
auto_zoom_correct: -2,
city_id: <?=$arResult["CALULATED"]["CITY_ID"]?>,
selector_office_block : "selector-office",
ymap_api_error: '<?=GetMessage("WSM_YMAP_ERROR")?>',
ymaps_ready: function(YMap, Collection, data){
//callback, map ready
//for example: add your controls on map
YMap.controls
.add('zoomControl', { right: 5, top: 45 })
.add('typeSelector')
.add('mapTools');
},
create_placemark: function(data){
//callback, create point in collection
//here you can change the option points
var point_data = {
<?if($arParams["MAP_POINT_PRESET_TYPE"] == 'Stretchy'):?>
iconContent: data['name'],
<?endif;?>
balloonContentHeader: data['name'],
balloonContentBody: data['desc'] + '<br/> ' + data['prop'],
balloonContentFooter: data['url']
};
var point_opt = {
preset: '<?=$arParams["MAP_POINT_PRESET"]?>'
};
//please return objects data and options
return {data: point_data, options: point_opt};
},
action_traffic: function(action, traffic_status, controls){
//callback, when the display state changes traffic
//example: change text on controls
for(i in controls) {
if(controls[i].getAttribute("map-action") != "traffic.toggle")
continue;
if(traffic_status)
controls[i].innerHTML = "<?=GetMessage("WSM_HIDE_TRAFFIC")?>";
else
controls[i].innerHTML = "<?=GetMessage("WSM_SHOW_TRAFFIC")?>";
}
},
action_map: function(action, traffic_status, controls){
},
select_city: function(el, city_id, location, zoom, data){
//callback, when city selected
},
select_point: function(index, data){
//callback, when click "show on map"
//for example: scroll to map
BX.scrollToMap('WSM_MapOffice_YMAP');
}
};
var YMapController;
BX.ready(function(){
YMapController = new BX.WSMMapOfficesMap(data, config);
YMapController.ready(function(controller){
//controller.Action('traffic.show');
});
});
</script>