var currentCountryLink=false;

function closeCountryBlock(){
	currentCountryLink.className='';
	currentCountryLink=false;
	document.getElementById('countryBlock').className='hidden';
}

function createCountryBlock(region){
	var htmlTextLinks='<strong class="colRed">'+regions[region]['name']+'</strong><div class="colBlue">';
	for (i=0; i<regions[region]['countries'].length; i++){
		htmlTextLinks+='<a href="http://'+regions[region]['countries'][i]['url']+'">'+regions[region]['countries'][i]['name']+'</a>, ';
	}
	htmlTextLinks=htmlTextLinks.substring(-2,htmlTextLinks.length-2);
	htmlTextLinks+='</div>';
	document.getElementById('travelMapText').innerHTML=htmlTextLinks;
	document.getElementById('countryBlock').className='';
	
}

function regionOnClick(countryLink,region){
	if(!currentCountryLink){
		createCountryBlock(region);
		countryLink.className='active';
		currentCountryLink=countryLink;
	}
	else if(currentCountryLink==countryLink)
	{	
		closeCountryBlock();
	}
	else
	{
		currentCountryLink.className='';
		currentCountryLink=countryLink;
		createCountryBlock(region);
		countryLink.className='active';
	}
}