document.addEventListener('DOMContentLoaded', function (e) {
var activeShape = [], map = document.getElementById('map');
document.addEventListener('click', function (e) {
if (e.target.dataset.action != 'region') return;
var path = map.querySelectorAll('[data-id="' + e.target.dataset.id + '"]');
activeShape.length && activeShape.forEach(function(item) {
item.setAttribute('class', item.getAttribute('class').replace(/\s*\bactive\b/ig, ''));
});
path.length && path.forEach(function(item) {
item.setAttribute('class', item.getAttribute('class') + ' active');
activeShape.push(item);
});
});
});