/* ---------- jQuery Listeners ---------- */

// note: the listener for this function must be declared inline so the state id can be substituted properly


/* ---------- Functions ---------- */

/*
 * Configures state-specific options in the CSR panel to improve the user experience for the given state.
 */
function initCsrState(stateId) {
	var form = document.getElementById('csrSearchForm');

	// select this element in the 'country' (note: multi-purpose) drop-down
	for (var i = 0; i < form.country.options.length; i++) {
		var thisOption = form.country.options[i];

		if (thisOption.value == ('state=' + stateId)) {
			// note: this drop-down packs a discriminator in the metadata to distinguish it from country/region/etc
			form.country.selectedIndex = i;
			break;
		}
	}

/* cannot auto-select elements on any other tab, since the DOM for those is not loaded until that tab is selected

	disableOthers(2); // CSR-provided method, enables the 'state' drop-down in the Location tab

	// select this element in the 'state' drop-down
	for (var i = 0; i < form.state.options.length; i++) {
		var thisOption = form.state.options[i];

		if (thisOption.value == stateId) {
			form.state.selectedIndex = i;
			break;
		}
	}

*/

} // end initCsrState

