function createSelections(myValue, myID, IsUK) {
	this.myValue = myValue;
	this.myID = myID;
	this.IsUK = IsUK;
	this.toString = SelectionToString;
}

function SelectionToString() {
	return this.myValue + ' ID: ' + this.myID + ' UK? ' + this.IsUK;
}

function CreateAllCountries() {
	var AllIdx = 0;
	var UKidx = 0;
	for (var CountryIdx = 1; CountryIdx < Countries.length-1; CountryIdx++) {
		if (Countries[CountryIdx] != null) {
			for (var CountyIdx = 0; CountyIdx < Countries[CountryIdx].length-1; CountyIdx++) {
				Countries[0][AllIdx] = new createSelections(
						Countries[CountryIdx][CountyIdx].myValue, 
						Countries[CountryIdx][CountyIdx].myID,
						Countries[CountryIdx][CountyIdx].IsUK);
				AllIdx += 1;
				if (Countries[CountryIdx][CountyIdx].IsUK) {
					Countries[999][UKidx] = new createSelections(
							Countries[CountryIdx][CountyIdx].myValue, 
							Countries[CountryIdx][CountyIdx].myID,
							Countries[CountryIdx][CountyIdx].IsUK);
					UKidx += 1;
				}
			}
		}
	}
	Countries[0].sort();
	Countries[0][AllIdx] = 0;
	Countries[999].sort();
	Countries[999][UKidx] = 0;
}

function Form_changeCounties(Form, mySelectedCountry, myOnload){
	//try{
		var myCountryIdx = Form.CountryID.selectedIndex;
		var myCountyIdx = Form.CountyID.selectedIndex;
		Form.CountyID.length = 1;
		Form.CountyID.options[0] = new Option('All Counties');
		Form.CountyID.options[0].value = 0;
		for (var i = 0; i < Countries[mySelectedCountry].length-1; i++) {
			Form.CountyID.length += 1;
			Form.CountyID.options[i+1] = new Option( Countries[mySelectedCountry][i].myValue );
			Form.CountyID.options[i+1].value = Countries[mySelectedCountry][i].myID;
		}
		if (myOnload == true){
			Form.CountryID.selectedIndex = myCountryIdx;
			Form.CountyID.selectedIndex = myCountyIdx;
		}
	//}
	//catch(e)
	//{ alert('changeCounties Exception ' + e );  throw e;}
}

function Form_SelectCounty(Form, mySelectedCounty, mySelectedCountry) {
	for (var i = 0; i < Countries[mySelectedCountry].length-1; i++) {
		if (Form.CountyID.options[i+1].value = mySelectedCounty) {
			Form.CountyID.selectedIndex = i+1;
			return;
		}
	}
}

function Form_changeRatings(Form, mySelectedAccomType, myOnload){
	var myAccomTypeIdx = Form.AccomTypeID.selectedIndex
	var myRatingIdx = Form.RatingID.selectedIndex
	if (mySelectedAccomType != 0) {
		Form.RatingID.length = 1;
		Form.RatingID.options[0] = new Option('Rating');
		Form.RatingID.options[0].value = 0;
		for (var i = 0; i < AccomTypes[mySelectedAccomType].length-1; i++) {
			Form.RatingID.length += 1;
			Form.RatingID.options[i+1] = new Option( AccomTypes[mySelectedAccomType][i].myValue );
			Form.RatingID.options[i+1].value = AccomTypes[mySelectedAccomType][i].myID;
		}
		if (myOnload == true){
			Form.AccomTypeID.selectedIndex = myAccomTypeIdx
			Form.RatingID.selectedIndex = myRatingIdx
		}
	}
}