
arrEnglandCounty = ['Bedfordshire', 'Berkshire', 'Buckinghamshire', 'Cambridgeshire', 'Channel Islands', 'Cheshire', 'Cornwall', 'Cumberland', 'Derbyshire', 'Devon', 'Dorset', 'Durham', 'Essex', 'Gloucestershire', 'Hampshire', 'Herefordshire', 'Hertfordshire', 'Huntingdonshire', 'Kent', 'Lancashire', 'Leicestershire', 'Lincolnshire', 'London', 'Middlesex', 'Norfolk', 'Northamptonshire', 'Northumberland', 'Nottinghamshire', 'Oxfordshire', 'Rutland', 'Shropshire', 'Somerset', 'Staffordshire', 'Suffolk', 'Surrey', 'Sussex', 'Warwickshire', 'Westmoorland', 'Wiltshire', 'Worcestershire', 'Yorkshire'];
arrWalesCounty = ['Blaenau Gwent','Bridgend','Caerphilly','Cardiff','Carmarthenshire','Ceredigion','Conwy','Denbighshire','Flintshire','Gwynedd','Isle of Anglesey','Merthyr Tydfil','Monmouthshire','Neath Port Talbot','Newport','Pembrokeshire','Powys','Rhondda Cynon Taff','Swansea','Torfaen','Vale of Glamorgan','Wrexham'];
arrScotlandCounty = ['Caithness','Sutherland','Ross-shire','Cromartyshire','Inverness-shire','Nairnshire','Morayshire','Banffshire','Aberdeenshire','Kincardineshire','Angus','Perthshire','Argyll','Bute','Ayrshire','Renfrewshire','Dunbartonshire','Stirlingshire','Clackmannanshire','Kinross-shire','Fife','West Lothian','Mid Lothian','East Lothian','Berwickshire','Roxburghshire','Dumfriesshire','Kirkcudbrightshire','Wigtownshire','Lanarkshire','Selkirkshire','Peeblesshire','Shetland Islands','Orkney Islands'];
arrIrelandCounty = ['Dublin','Wicklow','Wexford','Carlow','Kildare','Meath','Louth','Monaghan','Cavan','Longford','Westmeath','Offaly','Laois','Kilkenny','Waterford','Cork','Kerry','Limerick','Tipperary','Clare','Galway','Mayo','Roscommon','Sligo','Leitrim','Donegal'];
arrNIrelandCounty = ['Fermanagh','Tyrone','Londonderry','Antrim','Down','Armagh'];

function countryChange(newCountry) {

	var arr;
	var objCounty = document.getElementById('county');
	objCounty.length = 0;

	if (arguments[1]) 
		AddOption(objCounty, '', String(arguments[1]), true);
	else
		AddOption(objCounty, '', 'All Counties', true);

		
	switch (newCountry) {
	case 'england':
		arr = arrEnglandCounty;
		break;
	case 'wales':
		arr = arrWalesCounty;
		break;
	case 'scotland':
		arr = arrScotlandCounty;
		break;
	case 'ireland':
		arr = arrIrelandCounty;
		break;
	case 'n.ireland':
		arr = arrNIrelandCounty;
		break;
	default:
		//all countries selected
		return;
	}
	
	for (var i=0; i<arr.length; i++) AddOption(objCounty, arr[i], arr[i], false);

}
function AddOption(ListBox, OptionValue, OptionText, OptionIsSelected) {
	ListBox.options[ListBox.options.length] = new Option(OptionText, OptionValue);
	if(OptionIsSelected) {
		ListBox.options[ListBox.options.length-1].selected = true;
		ListBox.options[ListBox.options.length-1].defaultSelected = true;
	}
}