var NUM_BOOKS_BIBLE = 66;

//**********************************************************************
//*    Function: GetVerse                                              *
//* Description: Set the properties of the Book and chapters to look   *
//*              up at Blue Letter Bible.                              *
//*  Parameters: Form - The form on the current page where the objects *
//*                     needed for Blue Letter Bible reside.           *
//*              Book - The name of the selected book in the Bible.    *
//*           Chapter - The chapter of the selected book in the Bible. *
//*        StartVerse - The first verse to return.                     *
//*          EndVerse - The last verse to return.                      *
//*     Returns: A page from the Blue Letter Bible site with the book, *
//*              chapter and verses the user wanted to look up.        *
//**********************************************************************
function GetVerse(Form, Book, Chapter, StartVerse, EndVerse)
{
	Form.Chapter.value = Chapter;
	Form.Start.value = StartVerse;
	Form.End.value = EndVerse;
	for (var i = 0; i < NUM_BOOKS_BIBLE; i++)
	{
		if (Form.Book.options[i].text == Book)
		{
			Form.Book.options[i].selected = true;
			break;
		}
	}
	Form.submit();
}

//**********************************************************************
//*    Function: SetBookProperties                                     *
//* Description: Sets the properties of the selected book.             *
//*  Parameters: Book - The <select> object that lists the books of    *
//*                     the Bible.                                     *
//*              Index - The book number to set properties.            *
//*     Returns: nothing                                               *
//**********************************************************************
function SetBookProperties(Book, Index)
{
	switch (Index)
	{
		case 0:
			Book.options[Index].text = "Genesis";
			Book.options[Index].value = "Gen";
			Book.options[Index].selected = true;
			break;
		case 1:
			Book.options[Index].text = "Exodus"
			Book.options[Index].value = "Exd";
			break;
		case 2:
			Book.options[Index].text = "Leviticus";
			Book.options[Index].value = "Lev";
			break;
		case 3:
			Book.options[Index].text = "Numbers";
			Book.options[Index].value =  "Num";
			break;
		case 4:
			Book.options[Index].text = "Deuteronomy";
			Book.options[Index].value = "Deu";
			break;
		case 5:
			Book.options[Index].text = "Joshua";
			Book.options[Index].value = "Jos";
			break;
		case 6:
		    Book.options[Index].text = "Judges";
			Book.options[Index].value = "Jdg";
			break;
		case 7:
		    Book.options[Index].text = "Ruth";
			Book.options[Index].value = "Rth";
			break;
		case 8:
		    Book.options[Index].text = "1 Samuel";
			Book.options[Index].value = "1Sa";
			break;
		case 9:
		    Book.options[Index].text = "2 Samuel";
			Book.options[Index].value = "2Sa";
			break;
		case 10:
		    Book.options[Index].text = "1 Kings";
			Book.options[Index].value = "1Ki";
			break;
		case 11:
		    Book.options[Index].text = "2 Kings";
			Book.options[Index].value = "2Ki";
			break;
		case 12:
		    Book.options[Index].text = "1 Chronicles";
			Book.options[Index].value = "1Ch";
			break;
		case 13:
		    Book.options[Index].text = "2 Chronicles";
			Book.options[Index].value = "2Ch";
			break;
		case 14:
		    Book.options[Index].text = "Ezra";
			Book.options[Index].value = "Ezr";
			break;
		case 15:
		    Book.options[Index].text = "Nehemiah";
			Book.options[Index].value = "Neh";
			break;
		case 16:
		    Book.options[Index].text = "Esther";
			Book.options[Index].value = "Est";
			break;
		case 17:
		    Book.options[Index].text = "Job";
			Book.options[Index].value = "Job";
			break;
		case 18:
		    Book.options[Index].text = "Psalms";
			Book.options[Index].value = "Psa";
			break;
		case 19:
		    Book.options[Index].text = "Proverbs";
			Book.options[Index].value = "Pro";
			break;
		case 20:
		    Book.options[Index].text = "Ecclesiastes";
			Book.options[Index].value = "Ecc";
			break;
		case 21:
		    Book.options[Index].text = "Song of Solomon";
			Book.options[Index].value = "Sgs";
			break;
		case 22:
		    Book.options[Index].text = "Isaiah";
			Book.options[Index].value = "Isa";
			break;
		case 23:
		    Book.options[Index].text = "Jeremiah";
			Book.options[Index].value = "Jer";
			break;
		case 24:
		    Book.options[Index].text = "Lamentations";
			Book.options[Index].value = "Lam";
			break;
		case 25:
		    Book.options[Index].text = "Ezekiel";
			Book.options[Index].value = "Eze";
			break;
		case 26:
		    Book.options[Index].text = "Daniel";
			Book.options[Index].value = "Dan";
			break;
		case 27:
		    Book.options[Index].text = "Hosea";
			Book.options[Index].value = "Hsa";
			break;
		case 28:
		    Book.options[Index].text = "Joel";
			Book.options[Index].value = "Joe";
			break;
		case 29:
		    Book.options[Index].text = "Amos";
			Book.options[Index].value = "Amo";
			break;
		case 30:
		    Book.options[Index].text = "Obadiah";
			Book.options[Index].value = "Oba";
			break;
		case 31:
		    Book.options[Index].text = "Jonah";
			Book.options[Index].value = "Jon";
			break;
		case 32:
		    Book.options[Index].text = "Micah";
			Book.options[Index].value = "Mic";
			break;
		case 33:
		    Book.options[Index].text = "Nahum";
			Book.options[Index].value = "Nah";
			break;
		case 34:
		    Book.options[Index].text = "Habakkuk";
			Book.options[Index].value = "Hab";
			break;
		case 35:
		    Book.options[Index].text = "Zephaniah";
			Book.options[Index].value = "Zep";
			break;
		case 36:
		    Book.options[Index].text = "Haggai";
			Book.options[Index].value = "Hag";
			break;
		case 37:
		    Book.options[Index].text = "Zechariah";
			Book.options[Index].value = "Zec";
			break;
		case 38:
		    Book.options[Index].text = "Malachi";
			Book.options[Index].value = "Mal";
			break;
		case 39:
		    Book.options[Index].text = "Matthew";
			Book.options[Index].value = "Mat";
			break;
		case 40:
		    Book.options[Index].text = "Mark";
			Book.options[Index].value = "Mar";
			break;
		case 41:
		    Book.options[Index].text = "Luke";
			Book.options[Index].value = "Luk";
			break;
		case 42:
		    Book.options[Index].text = "John";
			Book.options[Index].value = "Jhn";
			break;
		case 43:
		    Book.options[Index].text = "Acts";
			Book.options[Index].value = "Act";
			break;
		case 44:
		    Book.options[Index].text = "Romans";
			Book.options[Index].value = "Rom";
			break;
		case 45:
		    Book.options[Index].text = "1 Corinthians";
			Book.options[Index].value = "1Cr";
			break;
		case 46:
		    Book.options[Index].text = "2 Corinthians";
			Book.options[Index].value = "2Cr";
			break;
		case 47:
		    Book.options[Index].text = "Galatians";
			Book.options[Index].value = "Gal";
			break;
		case 48:
		    Book.options[Index].text = "Ephesians";
			Book.options[Index].value = "Eph";
			break;
		case 49:
		    Book.options[Index].text = "Philippians";
			Book.options[Index].value = "Phl";
			break;
		case 50:
		    Book.options[Index].text = "Colossians";
			Book.options[Index].value = "Col";
			break;
		case 51:
		    Book.options[Index].text = "1 Thessalonians";
			Book.options[Index].value = "1Th";
			break;
		case 52:
		    Book.options[Index].text = "2 Thessalonians";
			Book.options[Index].value = "2Th";
			break;
		case 53:
		    Book.options[Index].text = "1 Timothy";
			Book.options[Index].value = "1Ti";
			break;
		case 54:
		    Book.options[Index].text = "2 Timothy";
			Book.options[Index].value = "2Ti";
			break;
		case 55:
		    Book.options[Index].text = "Titus";
			Book.options[Index].value = "Tts";
			break;
		case 56:
		    Book.options[Index].text = "Philemon";
			Book.options[Index].value = "Phm";
			break;
		case 57:
		    Book.options[Index].text = "Hebrews";
			Book.options[Index].value = "Hbr";
			break;
		case 58:
		    Book.options[Index].text = "James";
			Book.options[Index].value = "Jam";
			break;
		case 59:
		    Book.options[Index].text = "1 Peter";
			Book.options[Index].value = "1Pe";
			break;
		case 60:
		    Book.options[Index].text = "2 Peter";
			Book.options[Index].value = "2Pe";
			break;
		case 61:
		    Book.options[Index].text = "1 John";
			Book.options[Index].value = "1Jo";
			break;
		case 62:
		    Book.options[Index].text = "2 John";
			Book.options[Index].value = "2Jo";
			break;
		case 63:
		    Book.options[Index].text = "3 John";
			Book.options[Index].value = "3Jo";
			break;
		case 64:
		    Book.options[Index].text = "Jude";
			Book.options[Index].value = "Jud";
			break;
		case 65:
		    Book.options[Index].text = "Revelation";
			Book.options[Index].value = "Rev";
			break;
	}
}

//**********************************************************************
//*    Function: SetFields                                             *
//* Description: Set the default properties for the Blue Letter Bible  *
//*              objects.                                              *
//*  Parameters: Form - The form on the current page where the objects *
//*                     needed for Blue Letter Bible reside.           *
//*     ShowAllVerses - True or False whether to return all verses of  *
//*ShowStrongsNumbers - True or False whether to return the            *
//*                     corresponding Strong Concordance numbers.      *
//*     Returns: nothing                                               *
//**********************************************************************
function SetFields(Form, ShowAllVerses, ShowStrongsNumbers)
{
	if (Form.name != "Bible")
	{
		if (ShowStrongsNumbers)
		{
			Form.show_strongs.value = "yes";
		}
		else
		{
			Form.show_strongs.value = "no";
		}
		Form.action = "http://www.blueletterbible.org/cgi-bin/words.pl";
	}
	else
	{
		Form.action = "http://www.blueletterbible.org/cgi-bin/tools/get_verses.pl";
		Form.show_all.checked = ShowAllVerses;
		Form.Chapter.value = 1;
		Form.Start.value = 1;
		Form.End.value = 1;
		Form.show_str.checked = ShowStrongsNumbers;
		Form.Book.length = NUM_BOOKS_BIBLE;
		for (var i = 0; i < NUM_BOOKS_BIBLE; i++)
		{
			SetBookProperties(Form.Book, i);
			if (i == (NUM_BOOKS_BIBLE - 1))
			{
				break;
			}
		}
	}
	
	Form.icon.value = "http://www.elbaptist.org/images/header2.jpg";
	Form.bgcolor.value = "e4f2ff";
	Form.linkcolor.value = "005db6";
	Form.vlinkcolor.value = "005db6";
	Form.textcolor.value = "000000";
	Form.method = "Get";
	
	Form.hr.value = "http://www.elbaptist.org/";
	if (Form.document.URL != null)
	{
		if (Form.document.URL != "")
		{
			Form.hr.value = Form.document.URL;
		}
	}
}