
/**
 * Provides suggestions for state names (USA).
 * @class
 * @scope public
 */
function StateSuggestions2() {
    this.states2 = [
"abbeylara",
"abbeyleix",
"achill",
"antrim",
"aran islands",
"ardee",
"ardoyne",
"arklow",
"armagh",
"artane",
"ashbourne",
"ashbourne business centre",
"athboy",
"athenry",
"athlone",
"athoy",
"athy",
"augher",
"aughnacloy",
"bagenalstown",
"bailieborough",
"balbriggan",
"balivor",
"ballaghaderreen",
"ballina",
"ballina,",
"ballinamore",
"ballinasloe",
"ballincollig",
"ballinrobe",
"ballintra",
"ballon",
"ballybay",
"ballybeg",
"ballyboughal",
"ballycastle",
"ballyclare",
"ballycoolin",
"ballygarvan",
"ballyhaunis",
"ballyjamesduff",
"ballymena",
"ballymoney",
"ballymun",
"ballynahinch",
"ballysimon road",
"banagher",
"banbridge",
"bandon",
"bangor",
"bansha",
"bantry",
"bawnboy",
"beara,",
"belfast",
"belmullet",
"belturbet",
"bettystown",
"birr",
"blackrock",
"blanchardstown",
"blessington",
"borris",
"borris in ossory",
"boyle",
"bray",
"bridgend",
"bunclody,",
"bushmills",
"cahir",
"cahirciveen",
"caledon",
"callan",
"carbury",
"carlow",
"carnagh",
"carrick on shannon",
"carrick on suir",
"carrick-on-shannon",
"carrick-on-suir",
"carrickfergus",
"carrickmacross",
"carrickmines",
"carrigaline",
"carrigallen",
"carrigtohill",
"cashel",
"castlebar",
"castleblayney",
"castlecomer",
"castlederg",
"castleknock",
"castlere",
"castlerea",
"castletownbere",
"castlewellan",
"cavan",
"celbirdge",
"celbridge",
"citywest",
"clane",
"clara",
"clare",
"claremorris",
"clogher",
"clonakilty",
"clonee",
"clonmel",
"clonsilla",
"co clare",
"co cork",
"co dublin",
"co kerry",
"co meath",
"co. armagh",
"cobh",
"coleraine",
"cookstown",
"coolgreaney rd",
"cootehill",
"cork",
"counties sligo, leitrim, mayo, donegal, longford,",
"craigavon",
"crumlin",
"d.18",
"dalkey",
"derry city",
"dingle",
"donabate",
"donaghadee",
"donegal",
"donegal town",
"donnybrook",
"douglas",
"downpatrick",
"droadford",
"drogheda",
"dromahair",
"dromcollogher",
"dromore",
"dronmore",
"drumcliffe",
"drumkkeeran",
"dublin",
"dublin 1",
"dublin 10",
"dublin 11",
"dublin 12",
"dublin 13",
"dublin 14",
"dublin 15",
"dublin 16",
"dublin 16.",
"dublin 17",
"dublin 18",
"dublin 2",
"dublin 20",
"dublin 22",
"dublin 24",
"dublin 3",
"dublin 4",
"dublin 5",
"dublin 6",
"dublin 6w",
"dublin 7",
"dublin 8",
"dublin 9",
"dublin12",
"dublin17",
"dublin3",
"dudalk",
"dun laoghaire",
"dunboyne",
"dundalk",
"dungannon",
"dungarvan",
"dunlaoghaire",
"dunlavin",
"dunleer",
"dunmanway",
"dunmore",
"edenderry",
"elphin",
"enfield",
"ennis",
"enniscorthy",
"enniskerry",
"enniskillen",
"fairview",
"fermoy",
"fingal",
"firhouse",
"fivemiletown",
"forkhill",
"forkill",
"foxford",
"galwa",
"galway",
"gilford",
"glaslough",
"glenamaddy",
"glengarriff",
"gorey",
"grangebellew",
"greystones",
"hillsborough",
"holywood",
"jonesborough",
"keel,",
"kells",
"kenmare",
"kerry",
"kilbeggan",
"kilcock",
"kilcoole",
"kilcullen",
"kildare",
"kilkeel",
"kilkelly",
"kilkenny",
"kilkenny city",
"kilkishen",
"killala",
"killaloe",
"killarney",
"killeshandra",
"killiney",
"killorglin",
"killyleagh",
"kilmacthomas",
"kilmaganny",
"kilmallock",
"kilnaleck",
"kilquade",
"kilrush",
"kiltimagh",
"kimmage",
"kingscourt",
"kinsale",
"kinvara",
"knock",
"knocknacarra",
"lahinch",
"larne",
"leixlip",
"letterkenny",
"lifford",
"limavady",
"limerick",
"lisburn",
"lispole",
"listowel",
"londonderry",
"longford",
"longmile road",
"lonondderry",
"loughlinstown",
"loughrea",
"lucan",
"lurgan",
"lusk",
"macroom",
"maghera",
"magherafelt",
"main street",
"malahide",
"mallow",
"manorhamilton",
"markethill",
"maynooth",
"mayo",
"meath",
"midleton",
"millstreet",
"mitchelstown",
"moate",
"monaghan",
"monaghn",
"monasterevin",
"monkstown",
"mountmellick",
"mountrath",
"mountshannon",
"moville",
"moy",
"mullingar",
"naas",
"naul",
"navan",
"nenagh",
"new ross",
"newbawn",
"newbridge",
"newcastle",
"newcastle west",
"newmarket on fergus",
"newport",
"newross",
"newry",
"newtownabbey",
"newtownabby",
"newtownards",
"newtownforbes",
"newtownmountkennedy",
"oldtown",
"omagh",
"paulstwon",
"peterswell",
"phibsborough",
"portadown",
"portarlington",
"portlaois",
"portlaoise",
"portmarnock",
"portrane,",
"portrush",
"portstewart",
"portumna",
"raphoe",
"rath luirc",
"rathcoffey",
"rathcoole",
"rathdrum",
"rathfarnham",
"rathfriland",
"rathmines",
"ratoath",
"redcross",
"redhills",
"richhill",
"ringsend",
"rockcorry p.o",
"rockcorry p.o,",
"roscommon",
"roscrea",
"rosscarbery",
"rush",
"saggart",
"sallins",
"sandycove",
"sandyford",
"santry",
"scarriss",
"shanahoe",
"shankill",
"shannon",
"skerries",
"skibbereen",
"slane",
"sligo",
"smithbro",
"spiddal",
"st. margarets",
"stillorgan",
"strabane",
"straffan",
"swanlinbar",
"swords",
"taghmon",
"tallaght",
"tallow",
"tandagree",
"templeogue",
"test",
"thomastown",
"thurles",
"tinahely",
"tipperary",
"toomebridge",
"tralee",
"trim",
"tuam",
"tubber",
"tullamore",
"tullow",
"virginia",
"walkinstown",
"waterford",
"westort",
"westport",
"wexford",
"whitecross",
"wicklow",
"youghal",
"carlow",
"co carlow",
"co cavan",
"co cork",
"co dublin",
"co galway",
"co leitrim",
"co wicklow",
"co. antrim",
"co. armagh",
"co. carlow",
"co. cavan",
"co. clare",
"co. cork",
"co. derry",
"co. donegal",
"co. down",
"co. dubin",
"co. dublin",
"co. dublin 00",
"co. fermanag",
"co. fermanagh",
"co. galway",
"co. kerry",
"co. kildare",
"co. kilkenny",
"co. laois",
"co. leitrim",
"co. limerick",
"co. londonderry",
"co. longford",
"co. louth",
"co. mayo",
"co. meath",
"co. monaghan",
"co. monoghan",
"co. offaly",
"co. roscommon",
"co. sligo",
"co. tipperary",
"co. tyrone",
"co. waterford",
"co. westmeath",
"co. wexford",
"co. wexford.",
"co. wicklow",
"co.down",
"co.dublin",
"co.waterford",
"dublin",
"dublin 11",
"dublin 12",
"dublin 15",
"dublin 18",
"dublin 3",
"dublin 8",
"dublin 9",
"mayo",
"meath"
    ];
}

/**
 * Request suggestions for the given autosuggest control. 
 * @scope protected
 * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
 */
StateSuggestions2.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
                                                          bTypeAhead /*:boolean*/) {
    var aSuggestions = [];
    var sTextboxValue = oAutoSuggestControl.textbox.value;
    
    if (sTextboxValue.length > 0){
    
        //convert value in textbox to lowercase
        var sTextboxValueLC = sTextboxValue.toLowerCase();

        //search for matching states
        for (var i=0; i < this.states2.length; i++) { 

            //convert state name to lowercase
            var sStateLC = this.states2[i].toLowerCase();
           
            //compare the lowercase versions for case-insensitive comparison
            if (sStateLC.indexOf(sTextboxValueLC) == 0) {

                //add a suggestion using what's already in the textbox to begin it                
                aSuggestions.push(sTextboxValue + this.states2[i].substring(sTextboxValue.length));
            } 
        }
    }

    //provide suggestions to the control
    oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead);
};