/**
* Provides suggestions for state names (USA).
* @class
* @scope public
*/
function StateSuggestions() {
this.states = ["Bricker Hall","Vivian Hall","Agricultural Administration Building","209 W. 18th Avenue","Science and Engineering Library","Mathematics Tower","Dairy Loose Housing Barn","Electroscience Laboratory","Biological Sciences Greenhouses","Arps Hall","Ornamental Plant Germplasm Center","Jennings Hall","Knowlton Hall","Campbell Hall","Longaberger Alumni House","Dairy Research Barn","Postle Hall","Derby Hall","Caldwell Laboratory","Haskett Hall","Faculty Club","Women's Field House","Denney Hall","Aviation Building","Hagerty Hall","Hamilton Hall","Hayes Hall","Fechko Alumnae Scholarship House","Lazenby Hall","Hughes Hall","Journalism Building","Mershon Center","Pennsylvania Ave (1478)","Drinko Hall","Thompson Library, William Oxley Memorial ","Younkin Success Center","McPherson Chemical Lab","Mendenhall Laboratory","Mershon Auditorium","Converse Hall","Edison Joining Technology Center","Fry Hall","Orton Hall","Page Hall","Cockins Hall","Parker Food Science and Technology","Smith Laboratory","Plumb Hall","Pomerene Hall","McCracken Power Plant","Physics Research Building","Central Classroom Building","Research Center","Johnston Laboratory","St. John Arena","Central Service Building","Maintenance Building","OSU Electric Substation","Sisson Hall","Schottenstein Center","Ohio Stadium","Parking Garage: Northwest","Stillman Hall","Enarson Hall","French Field House","Townshend Hall","Parking Garage: Tuttle Park Place","Doan Hall","Ramseyer Hall","Nicklaus Museum","Jesse Owens Memorial Stadium","2470 North Star Rd","Baker Hall (East & West)","Stradley Hall","Bradley Hall","Canfield Hall","Siebert Hall","Mack Hall","Oxley Hall","Paterson Hall","Park Hall","Kennedy Commons","Sullivant Hall","Watts Hall","Buckeye Field","Smith Hall","Boyd Laboratory","Means Hall","Biomedical Research Tower","Davis Heart and Lung Research Inst","1314 Kinnear Rd.","Power House","Aronoff Laboratory","General Biology Annex","Veterinary Medicine Academic Building","Van De Graaff Laboratory","Cryogenic Laboratory","Steeb Hall","Psychology Building","Koffolt Laboratories","Bolz Hall","Newman & Wolfrom Lab of Chemistry","Scott Laboratory","Hopkins Hall","Evans Laboratory","Fontana Laboratories","Poultry Breeding House 3","Poultry Brooding House 2","Radiation Dosimetry Calibration Facility","Animal Science Building","Wiseman Hall","Reactor Building","Parking Garage: Lane Avenue
Under construction. Completion Winter 2010.","Student Academic Services Building
Under construction. Completion Winter 2010.","Ohio Union","Parking Garage: Ohio Union South","Tzagournis Medical Research Facility","Harding Hospital","Parking Garage: Hospitals","Dodd Hall","Parking Garage: Cannon Dr. North and South","Animal House","Starling Loving Hall","Waterman Laboratory Headquarters","Goss Laboratory","Blackburn House","Haverfield House","Royer Student Activities Center","Barrett House","Halloran House","Norton House","Mathematics Building","Scott House","Drackett Tower","Morrison Tower","North Commons","33 W. 11th Ave","Houck House","Research Foundation Building","Mirror Lake","University Plaza Hotel","The Oval","Campus Gateway Barnes & Noble","Chadwick Arboretum","Adventure Recreation Center","2000-2002 Kenny Rd.","2006 Kenny Rd.","Sandefur Wetland Pavilion","Recreation Field Support/Utility Building","Recreation Service Building","Heifer Barn","Heffner Wetland Research & Education Building","930 Kinnear Rd.","Davis Baseball Stadium","Ice Rink","1900 Kenny Rd.","650 Ackerman Rd","660 Ackerman","600-640,670,680 Ackerman Road","Physical Activities & Education Services (PAES)","RPAC - Recreation & Physical Activity Center","McCorkle Aquatic Pavilion","Fisher Hall","Gerlach Graduate Programs Bldg","Schoenbaum Hall","Mason Hall","Pfahl Executive Education Building","Blackwell Inn at Fisher College","Coffey Road Sports Center","Hale Hall","Neilwood Gables","Archer House","Nosker House","Service Building Annex","Satellite Communications Facility","Macquigg Laboratory","Riffe Building","Jones Graduate Tower","Taylor Tower","Raney Commons","Woody Hayes Athletic Center","Lincoln Tower","Morrill Tower","Parks Hall","Hitchcock Hall","Newton Hall","Biological Sciences Building","Graves Hall","Parking Garage B: Arps","Dreese Laboratories","Baker Systems Engineering","Meiling Hall","Galbreath Equine Center","Fawcett Center","Parking Garage: Neil Avenue","Parking Garage: Ohio Union North","Laundry Building","Printing Facility","Cunz Hall","Wilce Student Health Center","Howlett Hall","Drake Performance and Event Center","Howlett Greenhouses","Agricultural Engineering Building","Veterinary Hospital","Cramblett Hall (Hospital Clinic)","Prior Health Sciences Library","McCampbell Hall","Atwell Hall","Bevis Hall","Rightmire Hall","Pressey Hall","Scott Hall","Mount Hall","Bloch Cancer Survivors Plaza","Dairy Calf Barn","Main Dairy Barn","Dulles Hall","Independence Hall","University Hall","Kottman Hall","Jesse Owens Recreation Center North","Jesse Owens Recreation Center South","Jesse Owens West Tennis Center","Library Book Depository","Parking Garage: 11th Avenue","Ross Heart Hospital","Rhodes Hall-University Hospital","Weigel Hall","395 W. 12th Ave.","Northwood-High Building","Sherman Studio Art Center","Parking Garage: 9th Avenue","Blankenship Hall","Bulk Chemical Warehouse","Comprehensive Cancer Center","Kinnear Road Center-Building A","Kinnear Road Center-Building B","Kinnear Road Center-Building C","Kinnear Road Center-Building D","Kinnear Road Center-Building E","Magnetic Resonance Imaging Facility","Celeste Laboratory of Chemistry","James Cancer Hospital & Solove Research Institute","1100 Kinnear Rd","1224 Kinnear Rd","1212-1218 Kinnear Rd","Telecommunications Network Center","Community Extension Center","Stores and Receiving Building","Davis Medical Research Center","Rothenbuhler Honey Bee Research Lab","Child Care Center","Wexner Center for the Arts","Parking Garage: 12th Avenue","Biotechnology Support Facility","1275 Kinnear Rd","Buckeye Village Community Center","Buckeye Village Student Housing Unit A
(represents Units B-HH, building numbers 803-832)","Buckeye Village Student Housing Administration Building","Buckeye Village Student Housing Recreation Hall","OSU Family Practice on South High","Neil Building","Scholars House West","Scholars House East","Worthington Building","141 E 15th Ave.","Moody-Hall Neighborhood Policing Center","Gateway Building C","Hanley Alumnae Scholarship House","Parking Garage: Gateway","Pomerene Alumnae Scholarship House","Parking Garage: 9th Avenue East
Under construction. Completion Autumn 2009","Institute for Behavioral Medicine Research","Morehouse Medical Plaza-Pavilion","Morehouse Medical Plaza-Tower","Morehouse Medical Plaza-Concourse","Parking Garage: Morehouse Medical Plaza","Browning Amphitheater","Lane Avenue Residence Hall","Parking Garage: West Lane","Fisher Commons","University Development","52 W. 11th Ave","265 W 11th Ave","105 W Lane Ave","121 W Lane Ave","115 W Lane Ave","127 W Lane Ave","1836 High St.","960 Kinnear Rd","1165 Kinnear Rd.","Schoenbaum Family Center","Center of Science and Industry (COSI)","Athletics Training Center (golf)","1929 Kenny Rd.","State of Ohio Computer Center (N)","1315 Kinnear Rd","Agronomy Field Greenhouse","Kuhn Honors & Scholars House","807 Kinnear Rd","760 Kinnear Rd.","45 W 11th Ave","German House","770 Kinnear Rd (L)","Riverwatch Tower","Science Village","2941 Kenny Rd. #110","Turfgrass Foundation Research & Education Facility","Dodridge St. (250 W)","Campus Shop Building","1991 Kenny Rd.","Urban Arts Space","Agronomy Turf Research Building","Evans Hall"];
this.states_abbrev = ["BK","VH","AA","EA","SE","","","","","AP","","JE","KN","CM","","","PH","DB","CL","HK","","WO","DE","AV","HH","HM","HA","","LZ","HU","JR","MN","PN","DI","LI","YN","MP","ML","MM","CV","ED","FR","OR","PA","CH","FS","SM","PL","PO","","PY","CC","RC","","SJ","","","","SI","","ST","","SH","EN","FF","TO","","DN","RA","NK","JO","","","","","","","","OX","","","","SU","WA","","","BL","MS","BT","HR","","","AL","GB","","VG","","","PS","KL","BO","","SO","HC","EL","FL","","","","AS","WI","","","","OU","","","","","DO","","","SL","","GL","","","RY","","","","MA","","","","","","","","","","","","","AR","","","","","","","HW","","","IR","KE","","","AK","PE","RP","MK","FI","GE","SB","MH","PF","","","HL","","","","","","MQ","RF","","TT","","WD","LT","MT","PK","HI","NH","BI","GR","","DL","BE","ME","","CT","","","","","CZ","WS","HT","DR","HG","AE","VE","","HS","MC","AH","BH","RH","PR","SC","MO","","","","DU","IH","UH","KH","NR","SR","WR","","","RO","RD","WG","","NO","SA","","","","","","","","","","","CE","JA","KI","KR","","","CX","","DV","","","WX","","","","","","","","","","","","","","","","","","","","BR","","","","","","","","","","","","","","","","","","","","","","","","MB","","HN","KA","","","","","","","","","","","","","",""];
this.states_num = ["1","2","3","4","5","7","8","9","10","11","12","14","17","18","22","23","24","25","26","27","28","29","30","36","37","38","39","40","41","42","46","47","48","49","50","52","53","54","55","56","57","59","60","61","63","64","65","66","67","69","70","72","73","74","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","94","95","96","97","98","99","100","102","103","104","105","106","107","108","109","110","111","112","113","126","130","131","132","136","137","140","141","144","145","146","147","148","149","150","151","153","154","155","156","157","158","159","160","161","162","163","165","170","171","172","174","176","179","180","181","182","183","184","185","186","187","188","189","190","192","193","194","200","200602","200603","200605","200606","200607","211","213","214","215","217","218","221","222","227","228","229","232","241","242","243","245","246","247","249","250","251","252","253","254","255","259","260","261","262","263","264","265","266","267","268","269","270","271","272","273","274","275","276","277","278","279","280","281","282","284","287","288","289","290","293","294","295","296","297","298","299","300","302","303","306","307","308","309","310","311","315","316","317","337","338","339","340","347","348","349","350","352","353","354","355","356","357","358","359","360","362","363","364","365","366","367","368","369","371","372","373","374","378","379","380","381","382","384","385","386","387","394","395","800","801","833","834","839","846","847","848","849","855","861","863","864","866","869","875","878","880","881","882","883","888","891","892","896","898","902","909","913","915","916","917","926","931","932","933","934","936","943","949","951","952","959","962","963","964","965","966","969","974","981","983","985","987","988","991","992","995"];
}
/**
* Request suggestions for the given autosuggest control.
* @scope protected
* @param oAutoSuggestControl The autosuggest control to provide suggestions for.
*/
StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
bTypeAhead /*:boolean*/) {
var aSuggestions = [];
var sTextboxValue = oAutoSuggestControl.textbox.value;
// always a string
// var theval = typeof(sTextboxValue);
//alert(theval + " is the val");
if (sTextboxValue.length > 0){
this.building_array = this.states;
// regexp match: if number user number array
if(sTextboxValue.search(/[0-9]+/) != -1) {
//alert("ima number!");
this.building_array = this.states_num;
var searchtype = "number";
} else if(sTextboxValue.length < 3) {// two letters, use abrev and name arrays
this.building_array = this.states_abbrev;
var searchtype = "abrev";
} else { // use name array
this.building_array = this.states;
var searchtype = "word";
}
//convert value in textbox to lowercase
var sTextboxValueLC = sTextboxValue.toLowerCase();
//search for matching states
for (var i=0; i < this.building_array.length; i++) {
//convert state name to lowercase
var sStateLC = this.building_array[i].toLowerCase();
//compare the lowercase versions for case-insensitive comparison
if (sStateLC.indexOf(sTextboxValueLC) == 0) {
// format result based on search type
if (searchtype == "number") {
var thesuggestion = this.building_array[i].substring(sTextboxValue.length);
if(this.states_abbrev[i] != ""){
var stateAbr = " (" + this.states_abbrev[i] + ")";
}else{
var stateAbr = "";
}
var thesuggestion = thesuggestion + "- " + this.states[i] + stateAbr;
} else if (searchtype == "abrev") {
var thesuggestion = this.building_array[i].substring(sTextboxValue.length);
var thesuggestion = thesuggestion.toLowerCase();
var thesuggestion = thesuggestion + "- " + this.states[i] + " (#" + this.states_num[i] + ")";
} else {
var thesuggestion = this.building_array[i].substring(sTextboxValue.length);
if(this.states_abbrev[i] != ""){
var stateAbr = " (" + this.states_abbrev[i] + ")";
}else{
var stateAbr = "";
}
var thesuggestion = thesuggestion + stateAbr + " (#" + this.states_num[i] + ")";
}
//add a suggestion using what's already in the textbox to begin it
aSuggestions.push(sTextboxValue + thesuggestion);
}
}
}
//provide suggestions to the control
oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead);
};