
function changeCounty(input_id, selected_county, selected_city) {  
	if(input_id == 0)
		input_id = '';
	
	if($F('ModSearchRegion'+input_id) == '' || $F('ModSearchRegion'+input_id) == 'Greater London')
		$('county_label'+input_id).innerHTML = 'Location';                        
	else	
		$('county_label'+input_id).innerHTML = 'County';                        
		
	counties = new Array;
	switch($F('ModSearchRegion'+input_id)) {
		//case '':					counties = new Array("Aldwych", "Baker Street", "Barbican", "Battersea", "Bayswater", "Belgravia", "Belsize Park", "Bloomsbury", "Camden", "Central London", "Chelsea", "Chiswick", "Covent Garden", "Earls Court", "Edgware Road", "Euston", "Fulham", "Gloucester Road", "Hackney", "Hammersmith", "Hampstead", "Holborn", "Islington", "Kensington", "Kensington Olympia", "Kings Cross", "Knightsbridge", "Ladbroke Grove", "Lancaster Gate", "Liverpool Street", "Maida Vale","Marble Arch", "Marylebone", "Mayfair", "Notting Hill", "Oxford Street", "Paddington", "Pimlico", "Queensway", "Regents Park", "South Kensington", "St Johns Wood", "Streatham", "Swiss Cottage", "The City", "Victoria", "Wandsworth", "West End", "Westminster", "Wimbledon"); break    
		case '':					counties = new Array(); break    
		case 'Greater London':		counties = new Array("Aldwych", "Baker Street", "Barbican", "Battersea", "Bayswater", "Belgravia", "Belsize Park", "Bloomsbury", "Camden", "Central London", "Chelsea", "Chiswick", "Covent Garden", "Earls Court", "Edgware Road", "Euston", "Fulham", "Gloucester Road", "Hackney", "Hammersmith", "Hampstead", "Holborn", "Islington", "Kensington", "Kensington Olympia", "Kings Cross", "Knightsbridge", "Ladbroke Grove", "Lancaster Gate", "Liverpool Street", "Maida Vale","Marble Arch", "Marylebone", "Mayfair", "Notting Hill", "Oxford Street", "Paddington", "Pimlico", "Queensway", "Regents Park", "South Kensington", "St Johns Wood", "Streatham", "Swiss Cottage", "The City", "Victoria", "Wandsworth", "West End", "Westminster", "Wimbledon"); break    
		case 'South West England':	counties = new Array("Cornwall", "Devon", "Dorset", "Gloucestershire", "Somerset", "Wiltshire"); break
		case 'South East England':	counties = new Array("Berkshire", "Buckinghamshire", "Sussex", "Hampshire", "Kent", "Oxfordshire", "Surrey"); break
		case 'West Midlands':		counties = new Array("Shropshire", "Staffordshire", "Warwickshire", "Worcestershire"); break
		case 'East Midlands':		counties = new Array("Derbyshire", "Leicestershire", "Lincolnshire",  "Northamptonshire", "Nottinghamshire"); break
		case 'East of England':		counties = new Array("Bedfordshire", "Cambridgeshire", "Essex", "Hertfordshire", "Norfolk", "Suffolk"); break
		case 'Yorkshire':			counties = new Array("North Riding", "East Riding", "West Riding"); break
		case 'North West England':	counties = new Array("Cheshire", "Cumberland", "Lancashire"); break
		case 'North East England':	counties = new Array("Durham", "Northumberland", "Kent"); break
		case 'Scotland':			counties = new Array("Aberdeenshire", "Angus", "Argyll & Bute", "Clackmannhire", "Dumfries & Galloway", "East Ayrshire", "East Dunbartonshire", "East Lothian", "East Renfrewshire", "Falkirk", "FIFE", "Greater Dundee", "Greater Edinburgh", "Greater Glasgow", "Greater Stirling", "Highlands", "Inverclyde", "Midlothian", "Moray", "North Ayrshire", "North Lanarkshire", "Orkney", "Perth & Kinross", "Renfrewshire", "Scottish Borders", "Shetland", "South Ayrshire", "South Lanarkshire", "West Dunbartonshire", "West Lothian", "Western Isles"); break
	}

	counties.unshift('');
	
	select_county_tag = $('ModSearchCounty'+input_id);
	select_county_tag.options.length = counties.length;  
	for (i = 0; i < counties.length; i++) { 
		select_county_tag.options[i] = new Option(counties[i], counties[i]);  
		if(selected_county == counties[i]) {  
			select_county_tag.options[i].selected = true;
		}
	}  
	
	changeCity(input_id, selected_city);
}


function changeCity(input_id, selected_city) {   
	if(input_id == 0)
		input_id = '';
    
	var cities = new Array;
	if($F('ModSearchRegion'+input_id) == '' || $F('ModSearchRegion'+input_id) == 'Greater London')	cities = new Array("London");    

	switch($F('ModSearchCounty'+input_id)) {
		
		// South West England
		case 'Cornwall':		cities = new Array("Bodmin", "Truro", "Camborne", "Redruth", "St. Austell", "Falmouth", "Penzance", "Newquay"); break    
		case 'Devon':			cities = new Array("Exeter", "Plymouth", "Torquay", "Paignton", "Barnstaple", "Tiverton", "Newton Abbot", "Tavistock"); break    
		case 'Dorset':			cities = new Array("Dorchester", "Poole", "Weymouth", "Sherborne", "Wimborne Minster", "Shaftesbury"); break    
		case 'Gloucestershire':	cities = new Array("Durham", "Sunderland", "Stockton-on-Tees", "Darlington", "Hartlepool", "Gateshead", "Washington"); break    
		case 'Somerset':		cities = new Array("Taunton", "Bath", "Weston-super-Mare", "Yeovil", "Bridgwater", "Wells", "Glastonbury"); break    
		case 'Wiltshire':		cities = new Array("Trowbridge", "Salisbury", "Swindon", "Chippenham", "Devizes", "Marlborough", "Warminster"); break    
		
		// South East England
		case 'Berkshire':		cities = new Array("Reading", "Bracknell", "Maidenhead", "Newbury", "Windsor", "Wokingham", "Abingdon"); break    
		case 'Buckinghamshire':	cities = new Array("Aylesbury", "Milton Keynes", "Slough", "Buckingham", "igh Wycombe"); break    
		case 'Sussex':			cities = new Array("Chichester", "Brighton", "Worthing", "Crawley", "Hastings", "Eastbourne", "Bognor Regis", "Horsham"); break    
		case 'Hampshire':		cities = new Array("Winchester", "Southampton", "Portsmouth", "Bournemouth", "Basingstoke", "Newport"); break    
		case 'Kent':			cities = new Array("Maidstone", "Canterbury", "Bromley", "Rochester", "Margate", "Folkestone", "Dover", "Greenwich"); break    
		case 'Oxfordshire':		cities = new Array("Oxford", "Banbury", "Witney", "Bicester", "Henley-on-Thames", "Carterton", "Thame"); break    
		case 'Surrey':			cities = new Array("Guildford", "Croydon", "Woking", "Sutton", "Kingston-on-Thames", "Wandsworth", "Wimbledon", "Brixton"); break    
		
		//West Midlands
		case 'Shropshire':		cities = new Array("Shrewsbury", "Telford", "Oswestry", "Bridgnorth", "Whitchurch", "Market Drayton", "Ludlow"); break    
		case 'Staffordshire':	cities = new Array("Stafford", "Stoke-on-Trent", "Wolverhampton", "Walsall", "Cannock", "Lichfield"); break    
		case 'Warwickshire':	cities = new Array("Warwick", "Birmingham", "Coventry", "Nuneaton", "Rugby", "Solihull", "Stratford-upon-Avon"); break    
		case 'Worcestershire':	cities = new Array("Worcester", "Dudley", "Kidderminster", "Stourbridge", "Halesowen", "Malvern", "Evesham"); break    
		
		//East Midlands
		case 'Derbyshire':		cities = new Array("Derby", "Chesterfield", "Ilkeston", "Swadlincote", "Buxton", "Matlock", "Ashbourne"); break    
		case 'Leicestershire':	cities = new Array("Leicester", "Loughborough", "Hinckley", "Melton Mowbray", "Coalville", "Lutterworth"); break    
		case 'Lincolnshire':	cities = new Array("Lincoln", "Grimsby", "Scunthorpe", "Boston", "Grantham", "Stamford", "Skegness", "Louth"); break    
		case 'Northamptonshire':cities = new Array("Northampton", "Peterborough", "Corby", "Kettering", "Wellingborough"); break    
		case 'Nottinghamshire':	cities = new Array("Nottingham", "Mansfield", "Worksop", "Newark", "Retford", "Southwell"); break   
		
		// East of England 
		case 'Bedfordshire':	cities = new Array("Bedford", "Luton", "Dunstable", "Leighton Buzzard", "Biggleswade", "Sandy"); break    
		case 'Cambridgeshire':	cities = new Array("Cambridge", "Wisbech", "Ely", "March", "Whittlesey", "Chatteris", "Linton"); break    
		case 'Essex':			cities = new Array("Chelmsford", "Basildon", "Romford", "Southend", "Colcheter", "Harlow", "Brentwood", "West Ham"); break    
		case 'Hertfordshire':	cities = new Array("Hertford", "Watford, St. Albans", "Hemel Hempstead", "Stevenage", "Hatfield"); break    
		case 'Norfolk':			cities = new Array("Norwich", "Great Yarmouth", "King's Lynn", "Dereham", "Cromer", "Hunstanton"); break    
		case 'Suffolk':			cities = new Array("Ipswich", "Bury St. Edmunds", "Lowestoft", "Felixstowe", "Sudbury", "Haverhill", "Bungay"); break    
		
		//Yorkshire
		case 'North Riding':	cities = new Array("Northallerton", "Middlesbrough", "Scarborough", "Whitby"); break    
		case 'East Riding':		cities = new Array("Beverley", "Hull", "Bridlington", "Driffield", "Hornsea", "Filey"); break    
		case 'West Riding':		cities = new Array("Wakefield", "Leeds", "Sheffield", "Bradford", "Halifax", "Harrogate"); break    
		case 'York':			cities = new Array("York (within the Walls)"); break    
		
		// North West England
		case 'Cheshire':		cities = new Array("Chester", "Stockport", "Birkenhead", "Wallasey", "Runcorn", "Macclesfield", "Crewe"); break    
		case 'Cumberland':		cities = new Array("Carlisle", "Whitehaven", "Workington", "Penrith", "Keswick", "Brampton"); break    
		case 'Lancashire':		cities = new Array("Lancaster", "Liverpool", "Manchester", "Preston", "Bolton", "Warrington", "Barrow-in-Furness"); break    
		
		// North East England
		case 'Durham':			cities = new Array("Durham", "Sunderland", "Stockton-on-Tees", "Darlington", "Hartlepool", "Gateshead", "Washington"); break    
		case 'Northumberland':	cities = new Array("Alnwick", "Newcastle-upon-Tyne", "Morpeth", "Hexham", "Berwick-upon-Tweed"); break    
		case 'Kent':			cities = new Array("Tunbridge Wells"); break    
		
		// Scotland
		case "Aberdeenshire": 		 cities = new Array("Aberdeen", "Aboyne", "Ballater", "Banchory", "Banff", "Braemar", "Dinnet", "Dyce", "Fraserburgh", "Insh", "Inverurie", "Kintore", "Peterhead", "Portsoy" );break 
		case "Angus":				 cities = new Array("Aberlemno", "Arbroath", "Carnoustie", "Edzell", "Forfar", "Glamis", "Kirriemuir", "Monifieth", "Montrose", "Rosemount" );break 
		case "Argyll & Bute":        cities = new Array("Aldochlay", "Arden", "Ardfern", "Arinagour", "Barcaldine", "Campbeltown", "Cardross", "Colon Island", "Connel", "Craignure", "Dalmally", "Dunoon", "Fishnish", "Glenegedale", "Glenforsa", "Inveraray", "Inverbeg", "Isle of Arran", "Isle of Bute", "Isle of Mull", "Kensaleyre", "Kilchrenan", "Kilmelfort", "Kilmore", "Kyleakin", "Lochgilphead", "Luss", "Oban", "Port Appin", "Rhu", "Rothe", "Salen", "Tarbet", "Taynuilt", "Tiree Island"); break 
		case "Clackmannhire":        cities = new Array("Dollar");break 
		case "Dumfries & Galloway":  cities = new Array("Cairnryan", "Dalbeattie", "Douglas", "Dumfries", "Gretna Green", "Kirkcudbright", "Lockerbie", "Moffat", "New Abbey", "Newton Stewart", "Stranraer");break 
		case "East Ayrshire":        cities = new Array("Kilmarnock");break 
		case "East Dunbartonshire":  cities = new Array("Kirkintilloch");break 
		case "East Lothian":         cities = new Array("Bolton", "Dunbar", "Gifford", "Haddington", "Musselburgh");break 
		case "East Renfrewshire":    cities = new Array("Other");break 
		case "Falkirk":              cities = new Array("Airth", "kirk", "Grangemouth");break 
		case "FIFE":                 cities = new Array("Aberdour", "Auchtermuchty", "Burntisland", "Dunfermline", "Elie", "Falkland", "Freuchie", "Glenrothes", "Inverkeithing", "Kincraig", "Kirkcaldy", "Lundin Links", "Newburgh", "North Queensferry", "St. Andrews", "Tayport", "West Wemyss");break 
		case "Greater Dundee":       cities = new Array("Dundee");break 
		case "Greater Edinburgh":    cities = new Array("Edinburgh", "Portobello");break 
		case "Greater Glasgow":      cities = new Array("Bearsden", "Bellshill", "Bothwell", "Clydebank Coatbridge", "Glasgow", "Milngavie", "Stepps");break 
		case "Greater Stirling":     cities = new Array("Callander", "Drymen", "Dunblane", "Stirling");break 
		case "Highlands":            cities = new Array("Ardgay", "Aultbea", "Aviemore", "Badachro", "Badluarach", "Ballachulish", "Broadford", "Clashnessie", "Cromarty", "Dalwhinnie", "Dornie", "Dornoch", "Dunvegan", "Elphin", "Fort Augustus", "Fort William", "Gairloch", "Glencoe", "Inverness", "John o' Groats", "Kingussie", "Kinlochleven", "Kyle of Lochalsh", "Kylesku", "Laide", "Lochinver", "Luib", "Mellon Udrigle ", "Melvaig", "Naast", "Nairn", "Newtonmore", "Onich", "Poolewe", "Portree", "Slattadale", "Sligachan", "Strath", "Strathpeffer", "Tain", "Talladale", "Thurso", "Torridon", "Uig", "Ullapool", "Wick");break 
		case "Inverclyde":           cities = new Array("Gourock",  "Greenock");break 
		case "Midlothian":           cities = new Array("Easter Howgate", "Lasswade", "Penicuik");break 
		case "Moray":                cities = new Array("Aberlour", "Elgin", "Forres", "Tomintoul");break 
		case "North Ayrshire":       cities = new Array("Brodick", "Irvine", "Kilwinning", "Largs");break 
		case "North Lanarkshire":    cities = new Array("Moodiesburn", "Motherwell", "Wishaw");break 
		case "Orkney":               cities = new Array("Eday",  "Flotta Island",  "Hollandstoun",  "Kirkwall",  "Papa Westray",  "Sanday Island",  "Stron",  "Westray");break 
		case "Perth & Kinross":      cities = new Array("Aberfeldy", "Auchterarder", "Balquhidder", "Blairgowrie", "Crieff", "Dunkeld", "Glenfarg", "Kenmore", "Kinross", "Perth", "Pitlochry", "Powmill");break 
		case "Renfrewshire":         cities = new Array("Kilbarchan", "Paisley",  "Renfrew");break 
		case "Scottish Borders":     cities = new Array("Eyemouth", "Galashi", "Hawick", "Jedburgh", "Ko", "Melrose", "Peebles", "Selkirk", "St. Abbs", "West Linton");break 
		case "Shetland":             cities = new Array("Ham", "Houbie", "Lerwick", "Out Skerries", "Papa Stour", "Scatsta", "Stonybreck", "Sumburgh", "Whal");break 
		case "South Ayrshire":       cities = new Array("Ayr", "Ballantrae", "Dalrymple", "Kirkmichael", "Prestwick", "Troon", "Turnberry");break 
		case "South Lanarkshire":    cities = new Array("East Kilbride", "Hamilton,  Rosebank,  Strathaven");break 
		case "West Dunbartonshire":  cities = new Array("Balloch",  "Clydebank",  "Dumbarton");break 
		case "West Lothian":         cities = new Array("Bathgate", "Linlithgow",  "Livingston",  "Whitburn");break 
		case "Western Isles":        cities = new Array("Balivanich", "Barra", "Great Bernera", "Harris", "Leverburgh", "Lewis", "Stornoway", "Tarbert");break 
		
		case "":        cities = new Array();break 
	}

	cities.unshift('');
	
	select_city_tag = $('ModSearchCity'+input_id);
	select_city_tag.options.length = cities.length;  
	for (i = 0; i < cities.length; i++) { 
		select_city_tag.options[i] = new Option(cities[i], cities[i]);
		if(selected_city == cities[i]) {  
			select_city_tag.options[i].selected = true;
		}
	} 
}

