/*
	Javascrip code written by PSLWeb.co.uk for the Small Pilgrim Places Network (www.smallpilgrimplaces.org)
	Copyright ©2008 PSLWeb.co.uk - All Rights Rerserved.
*/
/*
	Function:    corporateChanged
	Inputs:      none
	Called From: Select element (onchange method)
	Description: Submits the form (get results for this Corp).
*/
function corporateChanged() {
	var corporateSelect = document.getElementById('pid');
	if (corporateSelect.value != "") { // Only submit the form if we've selected a Corp
		var searchForm = document.getElementById('searchForm');
		searchForm.submit();
	}
}

/*
	Function:    countryChanged
	Inputs:      none
	Called From: Select element (onchange method)
	Description: Returns the form to fetch new Database data (Country/State/Region/User).
*/
function countryChanged() {
	var searchForm = document.getElementById('searchForm');
	var countrySelect = document.getElementById('cid');
	var newCountry = countrySelect.options[countrySelect.selectedIndex].value;
	document.getElementById('fetch').value = newCountry;
	searchForm.action = "search.php"; // Change form destination
	searchForm.method = "post"; // change form method
	searchForm.submit();
}