//initializes and updates select boxes
function initSelectBoxesLocation(primarySelectBox,primarySelectDefault,secondarySelectBox,secondarySelectDefault){
	// Populate the primary select box
	populateSelectBox(primarySelectBox,iCountry_value,iCountry_id);
	// Set the default value for the primary select box
	var primaryDefaultArray = primarySelectDefault.split(",");
	setSelectBoxDefault(primarySelectBox,primaryDefaultArray);

	// Populate the secondary select box
	var primarySelectedIndex = primarySelectBox.selectedIndex;
	populateSelectBox(secondarySelectBox,iCity_value[primarySelectedIndex],iCity_id[primarySelectedIndex]);
	//Set the default value(s) for the secondary select box
	var secondaryDefaultArray = secondarySelectDefault.split(",");
	setSelectBoxDefault(secondarySelectBox,secondaryDefaultArray);
}

function initSelectBoxesLocation_useURL(primarySelectBox,primarySelectDefault,secondarySelectBox,secondarySelectDefault){
	// Populate the primary select box
	populateSelectBox(primarySelectBox,iCountry_value,iCountry_urlName);
	// Set the default value for the primary select box
	var primaryDefaultArray = primarySelectDefault.split(",");
	
	setSelectBoxDefault(primarySelectBox,primaryDefaultArray);

	// Populate the secondary select box
	var primarySelectedIndex = primarySelectBox.selectedIndex;
	populateSelectBox(secondarySelectBox,iCity_value[primarySelectedIndex],iCity_urlName[primarySelectedIndex]);
	//Set the default value(s) for the secondary select box
	var secondaryDefaultArray = secondarySelectDefault.split(",");
	setSelectBoxDefault(secondarySelectBox,secondaryDefaultArray);
}

// pass a country id in but use values and url as option id and values
function initSelectBoxesLocation_useUrl_fromId(primarySelectBox,primarySelectDefault,secondarySelectBox,secondarySelectDefault){
	// Populate the primary select box
	populateSelectBox(primarySelectBox,iCountry_value,iCountry_urlName);
	// Set the default value for the primary select box
	var primaryDefaultArray = primarySelectDefault.split(",");
	// get the url name from the array using the id passed in - Array.find is a custom global.js function
	setSelectBoxDefault(primarySelectBox,new Array(iCountry_urlName[Array.find(iCountry_id,primaryDefaultArray)]));

	// Populate the secondary select box
	var primarySelectedIndex = primarySelectBox.selectedIndex;
	populateSelectBox(secondarySelectBox,iCity_value[primarySelectedIndex],iCity_id[primarySelectedIndex]);
	//Set the default value(s) for the secondary select box
	var secondaryDefaultArray = secondarySelectDefault.split(",");
	setSelectBoxDefault(secondarySelectBox,secondaryDefaultArray);
}

function updateSelectBoxLocation(secondarySelectBoxObj,primaryIndex){
	populateSelectBox(secondarySelectBoxObj,iCity_value[primaryIndex],iCity_id[primaryIndex]);
}

function updateSelectBoxLocation_useURL(secondarySelectBoxObj,primaryIndex){
	populateSelectBox(secondarySelectBoxObj,iCity_value[primaryIndex],iCity_urlName[primaryIndex]);
}
