
function makeCountryPicker() {
	
	var objDivCountries = document.getElementById( 'country_picker' );	
	var busyHTML = '<div class="busy-indicator">&nbsp;</div>';
	objDivCountries.innerHTML = busyHTML;
	// trigger the json call to get the actual specialties and methods
	callDynamicScript( 'niks', site_root_path + 'libs/country_picker.php');
	// prompt("cp", site_root_path + 'libs/smad_json.php?lev_id=' + lev_id + '&selected=' + selected);
}

function composeHTML_Country( arrInput ) {
	output_html = '<table width="100%" cellspacing="0" cellpadding="0" border="0">';

	for (var i = 0; i < arrInput.length; i++ ) { 
			output_html += '<tr><td>';
			output_html += '<a href="javascript:selectCountry(\'' + arrInput[i][0] + '\', \'filter\')">' + arrInput[i][1] + '</a>';
			output_html += '</td></tr>';
		}
		output_html += '</table>';
	
	return output_html;
}

function fillCountryPicker( country_array ) {
	var objDivCountries = document.getElementById('country_picker');	
	showElement('country_picker');
	objDivCountries.innerHTML = composeHTML_Country(country_array);	
}


function showElement(element){
	handle = document.getElementById(element);
	handle.style.visibility = 'visible';
	handle.style.display = 'block';
}

function hideElement(element){
	handle = document.getElementById(element);
	handle.style.visibility = 'hidden';
	handle.style.display = 'none';
}

function selectCountry(country, form_name) {
	
//	setCountryCookie(country); 
	document.forms[form_name].country.value=country;
	document.forms[form_name].submit();
	
}