<!-- hide jscript from old browsers 
/****** set the search phrase and reload when the user makes a selection **********/
function update()
{
	var sel, book;
	thisForm = self.document.mainForm;
	sel=document.mainForm.myBooks.selectedIndex;
	thisForm.tbSelectedIndex.value = sel;
	book=thisForm.myBooks.options[sel].value;
	thisForm.tbSelectedBook.value = book;
	thisForm.searchPhrase.value = book;
}

/****** this object holds all of the key data **********/
function Link(name, url)
{
	this.name = name;
	this.title = new Array();
	this.url = new Array();
}
/**************************************************************/
var names      = new Array ();
var temp       = new Array ();
var temp2 		= new Array ();
var link       = new Link ();
var final_list = new Array ();
/******** array declaration... it holds all of the data for the menus ****/
var menu = new Array (
	"Old Testament*Gen|Genesis#" +
	"Exodus|Exodus#" +
	"Leviticus|Leviticus#" +
	"Numbers|Numbers#" +
	"Deuteronomy|Deuteronomy#" +
	"Joshua|Joshua#" +
	"Judges|Judges#" +
	"Ruth|Ruth#" +
	"1 Samuel|1 Samuel#" +
	"2 Samuel|2 Samuel#" +
	"1 Kings|1 Kings#" +
	"2 Kings|2 Kings#" +
	"1 Chronicles|1 Chronicles#" +
	"2 Chronicles|2 Chronicles#" +
	"Ezra|Ezra#" +
	"Nehemiah|Nehemiah#" +
	"Esther|Esther#" +
	"Job|Job#" +
	"Psalm|Psalms#" +
	"Proverb|Proverbs#" +
	"Ecclesiastes|Ecclesiastes#" +
	"Song of Solomon|Song of Solomon#" +
	"Isaiah|Isaiah#" +
	"Jeremiah|Jeremiah#" +
	"Lamentations|Lamentations#" +
	"Ezekiel|Ezekiel#" +
	"Daniel|Daniel#" +
	"Hosea|Hosea#" +
	"Joel|Joel#" +
	"Amos|Amos#" +
	"Obadiah|Obadiah#" +
	"Jonah|Jonah#" +
	"Micah|Micah#" +
	"Nahum|Nahum#" +
	"Habakkuk|Habakkuk#" +
	"Zephaniah|Zephaniah#" +
	"Haggai|Haggai#" +
	"Zechariah|Zechariah#" +
	"Malachi|Malachi",
	"New Testament*Matthew|Matthew#" +
	"Mark|Mark#" +
	"Luke|Luke#" +
	"John|John#" +
	"Acts|Acts#" +
	"Roman|Romans#" +
	"1 Corinthians|1 Corinthians#" +
	"2 Corinthians|2 Corinthians#" +
	"Galatians|Galatians#" +
	"Ephesians|Ephesians#" +
	"Philippians|Philippians#" +
	"Colossians|Colossians#" +
	"1 Thessalonians|1 Thessalonians#" +
	"2 Thessalonians|2 Thessalonians#" +
	"1 Timothy|1 Timothy#" +
	"2 Timothy|2 Timothy#" +
	"Titus|Titus#" +
	"Philemon|Philemon#" +
	"Hebrews|Hebrews#" +
	"James|James#" +
	"1 Peter|1 Peter#" +
	"2 Peter|2 Peter#" +
	"1 John|1 John#" +
	"2 John|2 John#" +
	"3 John|3 John#" +
	"Jude|Jude#" +
	"Revelation|Revelation#" +
	"Joseph Smith Translation|Joseph Smith Translation (JST)",
	"Book of Mormon*1 Nephi|1 Nephi#" +
	"2 Nephi|2 Nephi#" +
	"Jacob|Jacob#" +
	"Enos|Enos#" +
	"Jarom|Jarom#" +
	"Omni|Omni#" +
	"Words of Mormon|Words of Mormon#" +
	"Mosiah|Mosiah#" +
	"Alma|Alma#" +
	"Helaman|Helaman#" +
	"3 Nephi|3 Nephi#" +
	"4 Nephi|4 Nephi#" +
	"Mormon|Mormon#" +
	"Ether|Ether#" +
	"Moroni|Moroni",
	"Doctrine and Covenants*Doctrine and Covenants|Doctrine and Covenants#"+
	"Doctrine and Covenants|Doctrine and Covenants",
	"Pearl of Great Price*Moses|Moses#" +
	"Abraham|Abraham#" +
	//"JST Matthew|Joseph Smith Translation - Matthew#" +
	"History|Joseph Smith - History#" +
	"Article|Articles of Faith"
);
/*****************************************************************/
function stringSplit ( string, delimiter ) {
	if ( string == null || string == "" ) {
		return null ;
		} else if ( string.split != null ) {
		return string.split ( delimiter ) ;
		} else {
		var ar = new Array() ;
		var i = 0 ;
		var start = 0 ;
		while( start >= 0 && start < string.length ) {
			var end = string.indexOf ( delimiter, start ) ;
			if( end >= 0 ) {
				ar[i++] = string.substring ( start, end ) ;
				start = end+1 ;
				} else {
				ar[i++] = string.substring ( start, string.length ) ;
				start = -1 ;
			}
		}
		return ar ;
	}
}
/**************************************************************/
function updateMenus ( what ) {
	var n = what.selectedIndex;
	what.form.tbSelectedSWIndex.value=n;
	var sel = what.options[n].text;
	what.form.tbSelectedSW.value=sel;
	// alert(n + ", " + "(" + what.options[0].text.toString() + ")");

	what.form.myBooks.length = final_list[n].title.length;
	for (var x = 0; x < what.form.myBooks.length; x++)
	{
		what.form.myBooks.options[x].text = final_list[n].title[x];
		what.form.myBooks.options[x].value = final_list[n].url[x];
	}
	
	what.form.myBooks.selectedIndex = 0;
	what.form.tbSelectedIndex.value = 0;
	what.form.tbSelectedBook.value = what.form.myBooks.options[0].value;
}
/**************************************************************/
function give_names () {
	document.mainForm.main.length = names.length;
	document.mainForm.myBooks.length = final_list[0].title.length;

	for ( var i=0; i<names.length; i++ ) {
		document.mainForm.main.options[i].text = final_list[i].name;
		document.mainForm.main.options[i].value = final_list[i].name;
	}

	document.mainForm.main.selectedIndex = document.mainForm.tbSelectedSWIndex.value;

	for (var x=0; x<final_list[document.mainForm.tbSelectedSWIndex.value].url.length; x++) {
		document.mainForm.myBooks.options[x].text = final_list[document.mainForm.tbSelectedSWIndex.value].title[x];
		document.mainForm.myBooks.options[x].value = final_list[document.mainForm.tbSelectedSWIndex.value].url[x];
	}

	sel = document.mainForm.tbSelectedIndex.value;
	document.mainForm.myBooks.selectedIndex = sel;

	document.mainForm.myBooks.length=final_list[document.mainForm.tbSelectedSWIndex.value].url.length
	document.mainForm.tbSelectedBook.value = document.mainForm.myBooks.options[sel].value;
}
/**************************************************************/
function createMenus () {
	for ( var i=0; i<menu.length; i++ )
	{
		names[i] = stringSplit (menu[i], '*' );
		link = new Link(names[i][0]);
		temp[i] = stringSplit(names[i][1], '#');
		final_list[i] = link;
		for (var x=0; x<temp[i].length; x++)
		{
			temp2[x]  = stringSplit( temp[i][x], '|' );
			final_list[i].url[x] = temp2[x][0];
			final_list[i].title[x] = temp2[x][1];
		}
	}
	give_names();
}

/**************************************************************/
// end jscript hiding -->
