//functions that the country/state dropdowns

	var countryReq = getXmlHttpRequestObject();
	var stateReq = getXmlHttpRequestObject();


	//must be called onload
	function populateCountry(country, selectid) {

		var elem = document.getElementById(selectid);
		if (elem) {
			populateSelect('/ajax/getcountrylist.php', '', country, elem, countryReq);
		}

	}




	function populateState(country,state,selectid,textid) {
		var s = document.getElementById(selectid);
		var st = document.getElementById(textid);

		if (!s && st) {
			//in case we passed in a bad selectid, show the text box
			st.style.display = 'block';
		} else {
			populateSelect('/ajax/getstatelist.php', country, state, s, stateReq);


			if ((s != null) && (s.options.length > 0)) {
				//country has states
				if (st) {
					st.value = state; //keep the text version in sync
				}

				if (!state) {
					//there was no state specific to select, so use the first one in the list
					st.value = s.options[0].value;
				}
				st.style.display = 'none';
				s.style.display = 'block';
			} else {

				//no states in country
				st.value = (state) ? state : '';
				st.style.display = 'block';
				s.style.display = 'none';
			}
		}

	}


	//if one of the 2 CAPS associations is turned on, then also display the CAPS chapter selector
	function showhideCAPSChapter() {
		var c1 = document.getElementById('association16').checked;
		var c2 = document.getElementById('association1024').checked;

		var s = document.getElementById('chapter_caps_container');
		//alert(s + ' / ' + c1 + ' / ' + c2);
		if (s) {
			if (c1 || c2) {
				s.style.display = 'block';
			} else {
				s.style.display = 'none';
			}
		}
	}
	
	//if one of the 2 NSAAU associations is turned on, then also display the NSAAU chapter selector
	function showhideNSAAUChapter() {
		var c1 = document.getElementById('association4').checked;
		var c2 = document.getElementById('association65536').checked;

		var s = document.getElementById('chapter_nsaau_container');
		//alert(s + ' / ' + c1 + ' / ' + c2);
		if (s) {
			if (c1 || c2) {
				s.style.display = 'block';
			} else {
				s.style.display = 'none';
			}
		}
	}
	
	//if the NSAUS association is turned on, then also display the NSAUS chapter selector
	function showhideNSAUSChapter() {
		var c1 = document.getElementById('association1').checked;

		var s = document.getElementById('chapter_nsaus_container');
		//alert(s + ' / ' + c1 + ' / ' + c2);
		if (s) {
			if (c1) {
				s.style.display = 'block';
			} else {
				s.style.display = 'none';
			}
		}
	}



	//if the Exclusive box is checked, show the IASB Directory, too (bureaus only)
	function showhideIASBDirectory() {
		c1 = document.getElementById('isexclusive');
		if (!c1)
			return false;

		var c1 = c1.checked;

		var s = document.getElementById('iasbdirectory');
		if (s) {
			if (c1) {
				s.style.display = 'block';
			} else {
				s.style.display = 'none';
			}
		}
	}


