function selectCountry(countryId, countryName, tldsString) { 
	var mps = document.getElementById('flashCountrySelect').options;
	var tlds = new Array();
	tlds[0] = tldsString;
	if (tldsString.indexOf(",") > 0) {
		tlds = tldsString.split(",");
	}
	for (i = 0; i < mps.length; i++) {
		if ((countryId != "" && mps[i].value == countryId) || (mps[i].text == countryName)) {
			for (t = 0; t < tlds.length; t++) {
				if (document.getElementById('flashMapSelection').innerHTML.indexOf('"' + tlds[t] + '"') < 0) {
					//document.getElementById('flashMapSelection').innerHTML += ' <input value="' + tlds[t] + '" checked="true" name="domains_from_map" type="checkbox" onchange="updateSelectedTLDS(this.value, this.checked);"><a href="#" style="text-decoration: none;" onmouseover="showPopDiv(\'Country: ' + countryName + '\',\'#FF9900\')" onmouseout="mouse_move_out()">' + tlds[t] + '</a> ';
					document.getElementById('flashMapSelection').innerHTML += ' <input value="' + tlds[t] + 
						'" checked="true" name="domains_from_map" type="checkbox" ' + 
						'onchange="updateSelectedTLDS(this.value, this.checked);"><a href="#" style="text-decoration: none;" ' + 
						'onmouseover="showPopDiv(\'Country: ' + countryName + '\',\'#FF9900\')" onmouseout="mouse_move_out()">' + 
						tlds[t] + '</a> ';
					document.getElementById("map_hidden_domains").value += "|" + tlds[t];
				}
			}
			mps[i].selected = true;
			break;
		}
	}
}

function updateSelectedTLDS(tld, checked) {
	//var _html = document.getElementById('flashMapSelection').innerHTML;
	var _value = document.getElementById("map_hidden_domains").value;
	if (!checked) {
		//_html = _html.replace('value="' + tld + '" checked="true"', 'value="' + tld + '"');
		_value = _value.replace("|" + tld, "");
	} else {
		//_html = _html.replace('value="' + tld + '"', 'value="' + tld + '" checked="true"');
		_value += "|" + tld;
	}
	//document.getElementById('flashMapSelection').innerHTML = _html;
	document.getElementById("map_hidden_domains").value = _value;
}

function validateFlashMap() {
	if (document.getElementById("map_hidden_domains").value == "") {
		alert('Please select at least one country tld');
		return false;
	} else {
		document.getElementById("map_form_domain_check").submit();
	}
}

function zoomToCountry(selected) {
	if (selected.indexOf("location") < 0) {
		flashMapProxy.call('zoomTo', selected);
	} else {
		selected = selected.replace("location-", "");
		flashMapProxy.call('zoomPoint', selected);
	}
}



