
/**
 * Provides suggestions for state names (USA).
 * @class
 * @scope public
 */
function BibleSuggestions() {
    this.suggestions = [
    	// general
    	"abomination",
    	"abraham",
    	"adam",
    	"armor",
    	"baptize",
    	"beast",
    	"behold",
    	"believe",
    	"bless",
    	'"blessed are"',
    	"blind",
    	"blood",
    	"bread",
    	"brethren",
    	"brother",
    	"child",
    	"children",
    	"christ",
    	"commandment",
    	"condemn",
    	"cross",
    	"deceive",
    	"deaf",
    	"death",
    	"devil",
    	"dominion",
    	"dragon",
    	"earth",
    	"enemy",
    	"eve",
    	"everlasting",
    	"evil",
    	"fear",
    	"female",
    	"faith",
    	"father",
    	"fig",
    	"forgive",
    	"forsake",
    	"glory",
    	"god",
    	"good",
    	"gospel",
    	"grace",
    	"heart",
    	"heaven",
    	"hell",
    	"holy",
    	'"holy ghost"',
    	'"holy spirit"',
    	"inherit",
    	"jesus",
    	"judas",
    	"judge",
    	"justified",
    	"king",
    	"kingdom",
    	"law",
    	"lamb",
    	"lion",
    	"lord",
    	"love",
    	"life",
    	"male",
    	"man",
    	"mary",
    	"meek",
    	"mercy",
    	"mind",
    	"minister",
    	"money",
    	"moses",
    	"naked",
    	"neighbour",
    	"noah",
    	"persecute",
    	"pharisees",
    	"pilate",
    	"poor",
    	"power",
    	"praise",
    	"pray",
    	"prayer",
    	"prince",
    	"prophets",
    	"quiet",
    	"repent",
    	"reward",
    	"rich",
    	"righteous",
    	"sabbath",
    	"sake",
    	"sanctified",
    	"sanctuary",
    	"satan",
    	"scribes",
    	"scripture",
    	"selah",
    	"sheep",
    	"shepherd",
    	"sick",
    	"sin",
    	"sing",
    	"son",
    	"soul",
    	"spirit",
    	"stranger",
    	"strength",
    	"suffer",
    	"sword",
    	"tempt",
    	"thief",
    	'"thou shalt"',
    	"tongue",
    	"trust",
    	"truth",
    	"virgin",
    	"womb",
    	"worthy",
    	"wicked",
    	"wise",
    	"wisdom",
    	"work",
    	"wrath",
    	"youth",
    	
    	// books
    	"genesis",
    	"exodus",
    	"leviticus",
    	"numbers",
    	"deuteronomy",
    	"joshua",
    	"judges",
    	"ruth",
    	"1 samuel",
    	"2 samuel",
    	"1 kings",
    	"2 kings",
    	"1 chronicles",
    	"2 chronicles",
    	"ezra",
    	"nehemiah",
    	"esther",
    	"job",
    	"psalms",
    	"proverbs",
    	"ecclesiastes",
    	"song of solomon",
    	"isaiah",
    	"jeremiah",
    	"lamentations",
    	"ezekiel",
    	"daniel",
    	"hosea",
    	"joel",
    	"amos",
    	"obadiah",
    	"jonah",
    	"micah",
    	"nahum",
    	"habakkuk",
    	"zephaniah",
    	"haggai",
    	"zechariah",
    	"malachi",
    	"matthew",
    	"mark",
    	"luke",
    	"john",
    	"acts",
    	"romans",
    	"1 corinthians",
    	"2 corinthians",
    	"galatians",
    	"ephesians",
    	"philippians",
    	"colossians",
    	"1 thessalonians",
    	"2 thessalonians",
    	"1 timothy",
    	"2 timothy",
    	"titus",
    	"philemon",
    	"hebrews",
    	"james",
    	"1 peter",
    	"2 peter",
    	"1 john",
    	"2 john",
    	"3 john",
    	"jude",
    	"revelation"
    ];
}

/**
 * Request suggestions for the given autosuggest control. 
 * @scope protected
 * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
 */
BibleSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/) {
    var aSuggestions = [];
    var sTextboxValue = oAutoSuggestControl.textbox.value;
    sTextboxValue = sTextboxValue.toLowerCase();
    
    if (sTextboxValue.length > 0){
    
        //search for matching suggestions
        for (var i=0; i < this.suggestions.length; i++) { 
            if (this.suggestions[i].indexOf(sTextboxValue) == 0) {
                aSuggestions.push(this.suggestions[i]);
            } 
        }
    }

    //provide suggestions to the control
    oAutoSuggestControl.autosuggest(aSuggestions);
};

// On load, apply the autosuggest to the search box
window.onload = function () {
	var oTextbox = new AutoSuggestControl(document.getElementById("search_box"), new BibleSuggestions());
}
