if (isJsEnabled()) {
	addLoadEvent(initDonationInfo);
}

function initDonationInfo() {
	var selector = $('country-selector'), subm = $('country-selector-submit');
	addClass(subm, 'hidden');
	selector.onchange = function() { selectCountry(selector); return false; };
}

function selectCountry(selector) {
	// get selected country
	var country = selector.options[selector.options.selectedIndex].value;
	
	// the selector shouldn't stay focussed
	window.focus();		// because the latter doesn't work in IE
	selector.blur();	// because the former doesn't work in Mozilla
	
	// if the selected item is not a country, reset
	if (country == 'none') {
		selector.options[0].defaultSelected = true;
		for (i = 1; i < selector.length; i++) {
			selector.options[i].defaultSelected = false;
		}
		selector.form.reset();
	}
	
	// show selected country, hide others
	var divs = document.getElementsByTagName("div");
	for (var i = 0; i < divs.length; i++) {
		if (hasClass(divs[i], 'country-info')) {
			if (divs[i].id == country) {
				removeClass(divs[i], 'hidden');
			} else {
				addClass(divs[i], 'hidden');
			}
		}
	}
}
