On onRegionClick
, you can already get the country code by using one of the parameters: code
.
So putting it altogether:
jQuery(document).ready(function () {
jQuery('#vmap').vectorMap(
{
map: 'world_en',
backgroundColor: '#555555',
...etc.etc....
onRegionClick: function (element, code, region) {
// here you already got the code
// use it to save it to your cookies
onChangeUrl = '<?php echo Mage::helper('switcher')->getCountryUrl(); ?>';
url = onChangeUrl.replace('%geocode%', code); // --> use code as the country code
setLocation(url);
event.stop();
}
});
});