//Provides suggestions for the location box from the list below.
function LocationSuggestions() {
}

LocationSuggestions.prototype.locations=[
"Abbeydorney",
"Abbeyfeale",
"Adare",
"Adfert",
"Aghadoe",
"Annascaul",
"Ardcost",
"Ardfert",
"Asdee",
"Astee",
"Athea",
"Ballingeary",
"Ballinskelligs",
"Ballinskellig",
"Ballintubber",
"Ballybeg",
"Ballybrack",
"Ballybunion",
"Ballybunnion",
"Ballydavid",
"Ballydesmond",
"Ballydonoghue",
"Ballydoyle",
"Ballyduff",
"Ballyferriter",
"Ballyferriter",
"Ballyhar",
"Ballyhea",
"Ballyheigue",
"Ballyheighue",
"Ballykissane",
"Ballylongford",
"Ballymacelligott",
"Ballymac",
"Ballymacquin",
"Ballymullen",
"Ballyroey",
"Ballyseedy",
"Banemore",
"Banna",
"Bansha",
"Banteer",
"Bantry",
"Barraduff",
"Barrow",
"Beale",
"Beaufort",
"Blacksod Bay",
"Blanchardstown",
"Blarney",
"Blaskets",
"Blennerville",
"Blennerville",
"Boherbee",
"Boherbue",
"Bouleenshere",
"Brandon",
"Broadford",
"Brosna",
"Bruree",
"Bunratty",
"Buttevent",
"Caherciveen",
"Cahersiveen",
"Cahirciveen",
"Cahirsiveen",
"Caherdaniel",
"Callinafercy",
"Calinafercy",
"Camp",
"Caragh Lake",
"Carragh Lake",
"Carrantouhill",
"Carrantuohill",
"Carrauntoohill",
"Carriganimmy",
"Cashel",
"Cashel",
"Cashen",
"Castlecountess",
"Castlecove",
"Castlegregory",
"Castleisland",
"Castlemaine",
"Castlemorris",
"Castletownbere",
"Causeway",
"Charlevillle",
"Churchill",
"Cloghane",
"Cobh",
"Collea",
"Cologne (Germany)",
"Cong",
"Coolard",
"Coolea",
"Corca Dhuibhne",
"Croke Park",
"Cromane",
"Crosshaven",
"Curaheen",
"Currow",
"Dartry",
"Derrymore",
"Derrynane",
"Dingle",
"Dingle Peninsula",
"Dooks",
"Dromtarriff",
"Drumcurra",
"Duagh",
"Dublin",
"Dublin Airport",
"Dunmanway",
"Dunquin",
"Dunquinn",
"Enniskeane",
"Faha",
"Farranfore",
"Fenit",
"Feohanagh",
"Fermoy",
"Fermoyle",
"Fethard",
"Finuge",
"Firies",
"Frankfurt (Germany)",
"Galway City",
"Glantane",
"Gleann Na Gealt",
"Glenbeigh",
"Glencar",
"Glenflesk",
"Glin",
"Gortatlea",
"Headley's Bridge",
"Headleys Bridge",
"Hospital",
"Inch",
"Kanturk",
"Kells",
"Kenmare",
"Kerry Head",
"Kerryhead",
"Kilcummin",
"Kileentierna",
"Killeentierna",
"Kilfenora",
"Kilflynn",
"Kilgarvan",
"Killarney",
"Killelton",
"Killinaboy",
"Killmackillogue",
"Killorglin",
"Kilmorna",
"Kilmurry",
"Kinvara",
"Knightstown",
"Knockanish",
"Knockanure",
"Knocknagoshel",
"Knocknagree",
"Knocknalougha",
"Lauragh",
"Letter",
"Limerick City",
"Lisloose",
"Lispole",
"Lisselton",
"Listellick",
"Listowel",
"Listry",
"Lixnaw",
"Lougher",
"Lyreacrompane",
"Lyrecrompane",
"Macroom",
"Maharees",
"Malahide",
"Mallow",
"Mein",
"Midleton",
"Milford",
"Millstreet",
"Milltown",
"Monegay",
"Moyvane",
"Muckross",
"Murreigh",
"New Inn",
"Newcastlewest",
"Newmarket",
"Newquay",
"Newtownshandrum",
"Northern Ireland",
"Paris (France)",
"Portmagee",
"Raemore",
"Rathkeale",
"Rathmore",
"Rathmorell",
"Rattoo",
"Renard",
"Rockchapel",
"Rossbeigh",
"Scartaglen",
"Scartaglin",
"Shannon Airport",
"Shannon",
"Shrone",
"Skellig Rock",
"Slea Head",
"Sneem",
"Spain",
"Springmount",
"Tarbert",
"Templeglantine",
"Templenoe",
"The Spa",
"Thurles",
"Toureenard",
"Tousist",
"Tralee",
"Unknown",
"Unknown Location",
"Valentia",
"Ventry",
"Waterville",
"West Kerry",
"Whiddy Island",
"Kerry",
"Limerick",
"Cork",
"Mayo",
"Dublin",
"Tipperary",
"Clare",
"Galway"
]
;

LocationSuggestions.prototype.locations.sort();

/**
 * Request suggestions for the given autosuggest control. 
 * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
 */
LocationSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
                                                          bTypeAhead /*:boolean*/) {

	var aSuggestions = [];
	if(oAutoSuggestControl.textbox.value.length>0){
		for(var i=0; i<this.locations.length; i++){
			if(this.locations[i].toLowerCase().indexOf(oAutoSuggestControl.textbox.value.toLowerCase()) === 0){
				aSuggestions.push(this.locations[i]);
				if(aSuggestions.length>=10){
					break;
				}
			}
		}
	}

	//provide suggestions to the control
	oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead);        
};