function options_gen(language,target) {

	while (target.options.length > 0)
	{
		target.remove(0);
	}

	if (language == 0)
	{
		target.options[0] = new Option("創世記");
		target.options[0].value = "創世記";
		target.options[1] = new Option("出埃及記");
		target.options[1].value = "出埃及記";
		target.options[2] = new Option("利未記");
		target.options[2].value = "利未記";
		target.options[3] = new Option("民數記");
		target.options[3].value = "民數記";
		target.options[4] = new Option("申命記");
		target.options[4].value = "申命記";
		target.options[5] = new Option("約書亞記");
		target.options[5].value = "約書亞記";
		target.options[6] = new Option("士師記");
		target.options[6].value = "士師記";
		target.options[7] = new Option("路得記");
		target.options[7].value = "路得記";
		target.options[8] = new Option("撒母耳記上");
		target.options[8].value = "撒母耳記上";
		target.options[9] = new Option("撒母耳記下");
		target.options[9].value = "撒母耳記下";
		target.options[10] = new Option("列王紀上");
		target.options[10].value = "列王紀上";
		target.options[11] = new Option("列王紀下");
		target.options[11].value = "列王紀下";
		target.options[12] = new Option("歷代志上");
		target.options[12].value = "歷代志上";
		target.options[13] = new Option("歷代志下");
		target.options[13].value = "歷代志下";
		target.options[14] = new Option("以斯拉記");
		target.options[14].value = "以斯拉記";
		target.options[15] = new Option("尼希米記");
		target.options[15].value = "尼希米記";
		target.options[16] = new Option("以斯帖記");
		target.options[16].value = "以斯帖記";
		target.options[17] = new Option("約伯記");
		target.options[17].value = "約伯記";
		target.options[18] = new Option("詩篇");
		target.options[18].value = "詩篇";
		target.options[19] = new Option("箴言");
		target.options[19].value = "箴言";
		target.options[20] = new Option("傳道書");
		target.options[20].value = "傳道書";
		target.options[21] = new Option("雅歌");
		target.options[21].value = "雅歌";
		target.options[22] = new Option("以賽亞書");
		target.options[22].value = "以賽亞書";
		target.options[23] = new Option("耶利米書");
		target.options[23].value = "耶利米書";
		target.options[24] = new Option("耶利米哀歌");
		target.options[24].value = "耶利米哀歌";
		target.options[25] = new Option("以西結書");
		target.options[25].value = "以西結書";
		target.options[26] = new Option("但以理書");
		target.options[26].value = "但以理書";
		target.options[27] = new Option("何西阿書");
		target.options[27].value = "何西阿書";
		target.options[28] = new Option("約珥書");
		target.options[28].value = "約珥書";
		target.options[29] = new Option("阿摩司書");
		target.options[29].value = "阿摩司書";
		target.options[30] = new Option("俄巴底亞書");
		target.options[30].value = "俄巴底亞書";
		target.options[31] = new Option("約拿書");
		target.options[31].value = "約拿書";
		target.options[32] = new Option("彌迦書");
		target.options[32].value = "彌迦書";
		target.options[33] = new Option("那鴻書");
		target.options[33].value = "那鴻書";
		target.options[34] = new Option("哈巴谷書");
		target.options[34].value = "哈巴谷書";
		target.options[35] = new Option("西番雅書");
		target.options[35].value = "西番雅書";
		target.options[36] = new Option("哈該書");
		target.options[36].value = "哈該書";
		target.options[37] = new Option("撒迦利亞書");
		target.options[37].value = "撒迦利亞書";
		target.options[38] = new Option("瑪拉基書");
		target.options[38].value = "瑪拉基書";
		target.options[39] = new Option("馬太福音");
		target.options[39].value = "馬太福音";
		target.options[40] = new Option("馬可福音");
		target.options[40].value = "馬可福音";
		target.options[41] = new Option("路加福音");
		target.options[41].value = "路加福音";
		target.options[42] = new Option("約翰福音");
		target.options[42].value = "約翰福音";
		target.options[43] = new Option("使徒行傳");
		target.options[43].value = "使徒行傳";
		target.options[44] = new Option("羅馬書");
		target.options[44].value = "羅馬書";
		target.options[45] = new Option("哥林多前書");
		target.options[45].value = "哥林多前書";
		target.options[46] = new Option("哥林多後書");
		target.options[46].value = "哥林多後書";
		target.options[47] = new Option("加拉太書");
		target.options[47].value = "加拉太書";
		target.options[48] = new Option("以弗所書");
		target.options[48].value = "以弗所書";
		target.options[49] = new Option("腓立比書");
		target.options[49].value = "腓立比書";
		target.options[50] = new Option("歌羅西書");
		target.options[50].value = "歌羅西書";
		target.options[51] = new Option("帖撒羅尼迦前書");
		target.options[51].value = "帖撒羅尼迦前書";
		target.options[52] = new Option("帖撒羅尼迦後書");
		target.options[52].value = "帖撒羅尼迦後書";
		target.options[53] = new Option("提摩太前書");
		target.options[53].value = "提摩太前書";
		target.options[54] = new Option("提摩太後書");
		target.options[54].value = "提摩太後書";
		target.options[55] = new Option("提多書");
		target.options[55].value = "提多書";
		target.options[56] = new Option("腓利門書");
		target.options[56].value = "腓利門書";
		target.options[57] = new Option("希伯來書");
		target.options[57].value = "希伯來書";
		target.options[58] = new Option("雅各書");
		target.options[58].value = "雅各書";
		target.options[59] = new Option("彼得前書");
		target.options[59].value = "彼得前書";
		target.options[60] = new Option("彼得後書");
		target.options[60].value = "彼得後書";
		target.options[61] = new Option("約翰一書");
		target.options[61].value = "約翰一書";
		target.options[62] = new Option("約翰二書");
		target.options[62].value = "約翰二書";
		target.options[63] = new Option("約翰三書");
		target.options[63].value = "約翰三書";
		target.options[64] = new Option("猶大書");
		target.options[64].value = "猶大書";
		target.options[65] = new Option("啟示錄");
		target.options[65].value = "啟示錄";
	}
	
	if (language == 1)
	{
		target.options[0] = new Option("创世记");
		target.options[0].value = "创世记";
		target.options[1] = new Option("出埃及记");
		target.options[1].value = "出埃及记";
		target.options[2] = new Option("利未记");
		target.options[2].value = "利未记";
		target.options[3] = new Option("民数记");
		target.options[3].value = "民数记";
		target.options[4] = new Option("申命记");
		target.options[4].value = "申命记";
		target.options[5] = new Option("约书亚记");
		target.options[5].value = "约书亚记";
		target.options[6] = new Option("士师记");
		target.options[6].value = "士师记";
		target.options[7] = new Option("路得记");
		target.options[7].value = "路得记";
		target.options[8] = new Option("撒母耳记上");
		target.options[8].value = "撒母耳记上";
		target.options[9] = new Option("撒母耳记下");
		target.options[9].value = "撒母耳记下";
		target.options[10] = new Option("列王纪上");
		target.options[10].value = "列王纪上";
		target.options[11] = new Option("列王纪下");
		target.options[11].value = "列王纪下";
		target.options[12] = new Option("历代志上");
		target.options[12].value = "历代志上";
		target.options[13] = new Option("历代志下");
		target.options[13].value = "历代志下";
		target.options[14] = new Option("以斯拉记");
		target.options[14].value = "以斯拉记";
		target.options[15] = new Option("尼希米记");
		target.options[15].value = "尼希米记";
		target.options[16] = new Option("以斯帖记");
		target.options[16].value = "以斯帖记";
		target.options[17] = new Option("约伯记");
		target.options[17].value = "约伯记";
		target.options[18] = new Option("诗篇");
		target.options[18].value = "诗篇";
		target.options[19] = new Option("箴言");
		target.options[19].value = "箴言";
		target.options[20] = new Option("传道书");
		target.options[20].value = "传道书";
		target.options[21] = new Option("雅歌");
		target.options[21].value = "雅歌";
		target.options[22] = new Option("以赛亚书");
		target.options[22].value = "以赛亚书";
		target.options[23] = new Option("耶利米书");
		target.options[23].value = "耶利米书";
		target.options[24] = new Option("耶利米哀歌");
		target.options[24].value = "耶利米哀歌";
		target.options[25] = new Option("以西结书");
		target.options[25].value = "以西结书";
		target.options[26] = new Option("但以理书");
		target.options[26].value = "但以理书";
		target.options[27] = new Option("何西阿书");
		target.options[27].value = "何西阿书";
		target.options[28] = new Option("约珥书");
		target.options[28].value = "约珥书";
		target.options[29] = new Option("阿摩司书");
		target.options[29].value = "阿摩司书";
		target.options[30] = new Option("俄巴底亚书");
		target.options[30].value = "俄巴底亚书";
		target.options[31] = new Option("约拿书");
		target.options[31].value = "约拿书";
		target.options[32] = new Option("弥迦书");
		target.options[32].value = "弥迦书";
		target.options[33] = new Option("那鸿书");
		target.options[33].value = "那鸿书";
		target.options[34] = new Option("哈巴谷书");
		target.options[34].value = "哈巴谷书";
		target.options[35] = new Option("西番雅书");
		target.options[35].value = "西番雅书";
		target.options[36] = new Option("哈该书");
		target.options[36].value = "哈该书";
		target.options[37] = new Option("撒迦利亚书");
		target.options[37].value = "撒迦利亚书";
		target.options[38] = new Option("玛拉基书");
		target.options[38].value = "玛拉基书";
		target.options[39] = new Option("马太福音");
		target.options[39].value = "马太福音";
		target.options[40] = new Option("马可福音");
		target.options[40].value = "马可福音";
		target.options[41] = new Option("路加福音");
		target.options[41].value = "路加福音";
		target.options[42] = new Option("约翰福音");
		target.options[42].value = "约翰福音";
		target.options[43] = new Option("使徒行传");
		target.options[43].value = "使徒行传";
		target.options[44] = new Option("罗马书");
		target.options[44].value = "罗马书";
		target.options[45] = new Option("哥林多前书");
		target.options[45].value = "哥林多前书";
		target.options[46] = new Option("哥林多后书");
		target.options[46].value = "哥林多后书";
		target.options[47] = new Option("加拉太书");
		target.options[47].value = "加拉太书";
		target.options[48] = new Option("以弗所书");
		target.options[48].value = "以弗所书";
		target.options[49] = new Option("腓立比书");
		target.options[49].value = "腓立比书";
		target.options[50] = new Option("歌罗西书");
		target.options[50].value = "歌罗西书";
		target.options[51] = new Option("帖撒罗尼迦前书");
		target.options[51].value = "帖撒罗尼迦前书";
		target.options[52] = new Option("帖撒罗尼迦后书");
		target.options[52].value = "帖撒罗尼迦后书";
		target.options[53] = new Option("提摩太前书");
		target.options[53].value = "提摩太前书";
		target.options[54] = new Option("提摩太后书");
		target.options[54].value = "提摩太后书";
		target.options[55] = new Option("提多书");
		target.options[55].value = "提多书";
		target.options[56] = new Option("腓利门书");
		target.options[56].value = "腓利门书";
		target.options[57] = new Option("希伯来书");
		target.options[57].value = "希伯来书";
		target.options[58] = new Option("雅各书");
		target.options[58].value = "雅各书";
		target.options[59] = new Option("彼得前书");
		target.options[59].value = "彼得前书";
		target.options[60] = new Option("彼得后书");
		target.options[60].value = "彼得后书";
		target.options[61] = new Option("约翰一书");
		target.options[61].value = "约翰一书";
		target.options[62] = new Option("约翰二书");
		target.options[62].value = "约翰二书";
		target.options[63] = new Option("约翰三书");
		target.options[63].value = "约翰三书";
		target.options[64] = new Option("犹大书");
		target.options[64].value = "犹大书";
		target.options[65] = new Option("启示录");
		target.options[65].value = "启示录";		
	}
	
	if (language == 2)
	{
		target.options[0] = new Option("Genesis");
		target.options[0].value = "Genesis";
		target.options[1] = new Option("Exodus");
		target.options[1].value = "Exodus";
		target.options[2] = new Option("Leviticus");
		target.options[2].value = "Leviticus";
		target.options[3] = new Option("Numbers");
		target.options[3].value = "Numbers";
		target.options[4] = new Option("Deuteronomy");
		target.options[4].value = "Deuteronomy";
		target.options[5] = new Option("Joshua");
		target.options[5].value = "Joshua";
		target.options[6] = new Option("Judges");
		target.options[6].value = "Judges";
		target.options[7] = new Option("Ruth");
		target.options[7].value = "Ruth";
		target.options[8] = new Option("1 Samuel");
		target.options[8].value = "1 Samuel";
		target.options[9] = new Option("2 Samuel");
		target.options[9].value = "2 Samuel";
		target.options[10] = new Option("1 Kings");
		target.options[10].value = "1 Kings";
		target.options[11] = new Option("2 Kings");
		target.options[11].value = "2 Kings";
		target.options[12] = new Option("1 Chronicles");
		target.options[12].value = "1 Chronicles";
		target.options[13] = new Option("2 Chronicles");
		target.options[13].value = "2 Chronicles";
		target.options[14] = new Option("Ezra");
		target.options[14].value = "Ezra";
		target.options[15] = new Option("Nehemiah");
		target.options[15].value = "Nehemiah";
		target.options[16] = new Option("Esther");
		target.options[16].value = "Esther";
		target.options[17] = new Option("Job");
		target.options[17].value = "Job";
		target.options[18] = new Option("Psalms");
		target.options[18].value = "Psalms";
		target.options[19] = new Option("Proverbs");
		target.options[19].value = "Proverbs";
		target.options[20] = new Option("Ecclesiastes");
		target.options[20].value = "Ecclesiastes";
		target.options[21] = new Option("Song of Songs");
		target.options[21].value = "Song of Songs";
		target.options[22] = new Option("Isaiah");
		target.options[22].value = "Isaiah";
		target.options[23] = new Option("Jeremiah");
		target.options[23].value = "Jeremiah";
		target.options[24] = new Option("Lamentation");
		target.options[24].value = "Lamentation";
		target.options[25] = new Option("Ezekiel");
		target.options[25].value = "Ezekiel";
		target.options[26] = new Option("Daniel");
		target.options[26].value = "Daniel";
		target.options[27] = new Option("Hosea");
		target.options[27].value = "Hosea";
		target.options[28] = new Option("Joel");
		target.options[28].value = "Joel";
		target.options[29] = new Option("Amos");
		target.options[29].value = "Amos";
		target.options[30] = new Option("Obadiah");
		target.options[30].value = "Obadiah";
		target.options[31] = new Option("Jonah");
		target.options[31].value = "Jonah";
		target.options[32] = new Option("Micah");
		target.options[32].value = "Micah";
		target.options[33] = new Option("Nahum");
		target.options[33].value = "Nahum";
		target.options[34] = new Option("Habakkuk");
		target.options[34].value = "Habakkuk";
		target.options[35] = new Option("Zephaniah");
		target.options[35].value = "Zephaniah";
		target.options[36] = new Option("Haggai");
		target.options[36].value = "Haggai";
		target.options[37] = new Option("Zechariah");
		target.options[37].value = "Zechariah";
		target.options[38] = new Option("Malachi");
		target.options[38].value = "Malachi";
		target.options[39] = new Option("Matthew");
		target.options[39].value = "Matthew";
		target.options[40] = new Option("Mark");
		target.options[40].value = "Mark";
		target.options[41] = new Option("Luke");
		target.options[41].value = "Luke";
		target.options[42] = new Option("John");
		target.options[42].value = "John";
		target.options[43] = new Option("Acts");
		target.options[43].value = "Acts";
		target.options[44] = new Option("Romans");
		target.options[44].value = "Romans";
		target.options[45] = new Option("1 Corinthians");
		target.options[45].value = "1 Corinthians";
		target.options[46] = new Option("2 Corinthians");
		target.options[46].value = "2 Corinthians";
		target.options[47] = new Option("Galatians");
		target.options[47].value = "Galatians";
		target.options[48] = new Option("Ephesians");
		target.options[48].value = "Ephesians";
		target.options[49] = new Option("Philippians");
		target.options[49].value = "Philippians";
		target.options[50] = new Option("Colossians");
		target.options[50].value = "Colossians";
		target.options[51] = new Option("1 Thessalonians");
		target.options[51].value = "1 Thessalonians";
		target.options[52] = new Option("2 Thessalonians");
		target.options[52].value = "2 Thessalonians";
		target.options[53] = new Option("1 Timothy");
		target.options[53].value = "1 Timothy";
		target.options[54] = new Option("2 Timothy");
		target.options[54].value = "2 Timothy";
		target.options[55] = new Option("Titus");
		target.options[55].value = "Titus";
		target.options[56] = new Option("Philemon");
		target.options[56].value = "Philemon";
		target.options[57] = new Option("Hebrews");
		target.options[57].value = "Hebrews";
		target.options[58] = new Option("James");
		target.options[58].value = "James";
		target.options[59] = new Option("1 Peter");
		target.options[59].value = "1 Peter";
		target.options[60] = new Option("2 Peter");
		target.options[60].value = "2 Peter";
		target.options[61] = new Option("1 John");
		target.options[61].value = "1 John";
		target.options[62] = new Option("2 John");
		target.options[62].value = "2 John";
		target.options[63] = new Option("3 John");
		target.options[63].value = "3 John";
		target.options[64] = new Option("Jude");
		target.options[64].value = "Jude";
		target.options[65] = new Option("Revelation");
		target.options[65].value = "Revelation";
	}
}

function language_change(language_title,language,f_size_title,f_size,bible_sel,footnote_sel,article_sel,search_title,search,search_sel,search_from,search_start,search_to,search_end,bible1_v,bible2_v,footnote1_v,footnote2_v,article_v,biblebook,chapter,ver,search_v,search_start_v,search_end_v,submit_v) {
	var txt1,txt2,txt3;
	var language=document.getElementById('language');
	
	if ((language.options.length <= 0) || (language.selectedIndex == 0)) {
		language_title.innerHTML="<font color=\"7F0000\"><b>語言選擇</b></font>";
		while (language.options.length > 0)
		{
			language.remove(0);
		}
		language.options[0] = new Option("繁體中文");
		language.options[0].value = "繁體中文";
		language.options[1] = new Option("簡體中文");
		language.options[1].value = "簡體中文";
		language.options[2] = new Option("英文");
		language.options[2].value = "英文";
		
		language.selectedIndex = 0;
		
		txt1 = "<font color=\"#7F6A00\"><b>聖經選擇</b></font><br /><select name=bible1 id=bible1  class=\"bible1\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,submit.value)\"><br />";
		txt1 += "<option value=\"N/A\">N/A</option>";
		txt1 += "<option value=\"和合本（繁體中文）\">和合本（繁體中文）</option>";
		txt1 += "<option value=\"和合本（簡體中文）\">和合本（簡體中文）</option>";
		txt1 += "<option value=\"新漢語譯本．新約全書（繁體中文）\">新漢語譯本．新約全書（繁體中文）</option>";
		txt1 += "<option value=\"新漢語譯本．新約全書（簡體中文）\">新漢語譯本．新約全書（簡體中文）</option>";
		txt1 += "<option value=\"King James Version (KJV)\">King James Version (KJV)</option>";
		txt1 += "</select><br />";
		txt1 += "<select name=bible2 id=bible2  class=\"bible2\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,submit.value)\"><br />";
		txt1 += "<option value=\"N/A\">N/A</option>";
		txt1 += "<option value=\"和合本（繁體中文）\">和合本（繁體中文）</option>";
		txt1 += "<option value=\"和合本（簡體中文）\">和合本（簡體中文）</option>";
		txt1 += "<option value=\"新漢語譯本．新約全書（繁體中文）\">新漢語譯本．新約全書（繁體中文）</option>";
		txt1 += "<option value=\"新漢語譯本．新約全書（簡體中文）\">新漢語譯本．新約全書（簡體中文）</option>";
		txt1 += "<option value=\"King James Version (KJV)\">King James Version (KJV)</option>";
		txt1 += "</select>";
		
		txt2 = "<font color=\"#267F00\"><b>註釋選擇</b></font><br /><select name=footnote1 id=footnote1  class=\"footnote1\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,'D')\"><br />";
		txt2 += "<option value=\"N/A\">N/A</option>";
		txt2 += "<option value=\"新漢語譯本註釋（繁體中文）\">新漢語譯本註釋（繁體中文）</option>";
		txt2 += "<option value=\"新漢語譯本註釋（簡體中文）\">新漢語譯本註釋（簡體中文）</option>";
		txt2 += "<option value=\"聖經姊妹版註釋（繁體中文）\">聖經姊妹版註釋（繁體中文）</option>";
		txt2 += "</select><br />";
		txt2 += "<select name=footnote2 id=footnote2  class=\"footnote2\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,'D')\"><br />";
		txt2 += "<option value=\"N/A\">N/A</option>";
		txt2 += "<option value=\"新漢語譯本註釋（繁體中文）\">新漢語譯本註釋（繁體中文）</option>";
		txt2 += "<option value=\"新漢語譯本註釋（簡體中文）\">新漢語譯本註釋（簡體中文）</option>";
		txt2 += "<option value=\"聖經姊妹版註釋（繁體中文）\">聖經姊妹版註釋（繁體中文）</option>";
		txt2 += "</select>";
		
		txt3 = "<font color=\"#7F3300\"><b>專題文章選擇</b></font><br /><select name=article id=article  class=\"article\" onChange=\"show_article(article.selectedIndex,f_size.selectedIndex)\"><br />";
		txt3 += "<option value=\"N/A\">N/A</option>";
		txt3 += "<option value=\"新漢語譯本．新約全書書卷簡介（繁體中文）\">新漢語譯本．新約書卷簡介（繁體中文）</option>";
		txt3 += "<option value=\"新漢語譯本．新約全書書卷簡介（簡體中文）\">新漢語譯本．新約書卷簡介（簡體中文）</option>";
		txt3 += "</select>";
		
		f_size_title.innerHTML="<b>字型大小</b><br />";
		search_title.innerHTML="<b>經文搜尋</b><br />";
		search_from.innerHTML="（由";
		search_to.innerHTML="至";		
		search_sel.value = "搜尋";
	}

	if (language.selectedIndex == 1) {
		language_title.innerHTML="<font color=\"7F0000\"><b>语言选择</b></font>";
		while (language.options.length > 0)
		{
			language.remove(0);
		}
		language.options[0] = new Option("繁体中文");
		language.options[0].value = "繁体中文";
		language.options[1] = new Option("简体中文");
		language.options[1].value = "简体中文";
		language.options[2] = new Option("英文");
		language.options[2].value = "英文";
		
		language.selectedIndex = 1;
		
		txt1 = "<font color=\"#7F6A00\"><b>圣经选择</b></font><br /><select name=bible1 id=bible1  class=\"bible1\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,submit.value)\"><br />";
		txt1 += "<option value=\"N/A\">N/A</option>";		
		txt1 += "<option value=\"和合本（繁体中文）\">和合本（繁体中文）</option>";
		txt1 += "<option value=\"和合本（简体中文）\">和合本（简体中文）</option>";
		txt1 += "<option value=\"新汉语译本．新约全书（繁体中文）\">新汉语译本．新约全书（繁体中文）</option>";
		txt1 += "<option value=\"新汉语译本．新约全书（简体中文）\">新汉语译本．新约全书（简体中文）</option>";
		txt1 += "<option value=\"King James Version (KJV)\">King James Version (KJV)</option>";
		txt1 += "</select><br />";
		txt1 += "<select name=bible2 id=bible2  class=\"bible2\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,submit.value)\"><br />";
		txt1 += "<option value=\"N/A\">N/A</option>";
		txt1 += "<option value=\"和合本（繁体中文）\">和合本（繁体中文）</option>";
		txt1 += "<option value=\"和合本（简体中文）\">和合本（简体中文）</option>";
		txt1 += "<option value=\"新汉语译本．新约全书（繁体中文）\">新汉语译本．新约全书（繁体中文）</option>";
		txt1 += "<option value=\"新汉语译本．新约全书（简体中文）\">新汉语译本．新约全书（简体中文）</option>";
		txt1 += "<option value=\"King James Version (KJV)\">King James Version (KJV)</option>";
		txt1 += "</select>";
		
		txt2 = "<font color=\"#267F00\"><b>注释选择</b></font><br /><select name=footnote1 id=footnote1  class=\"footnote1\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,'D')\"><br />";
		txt2 += "<option value=\"N/A\">N/A</option>";
		txt2 += "<option value=\"新汉语译本注释（繁体中文）\">新汉语译本注释（繁体中文）</option>";
		txt2 += "<option value=\"新汉语译本注释（简体中文）\">新汉语译本注释（简体中文）</option>";
		txt2 += "<option value=\"圣经姊妹版注释（繁体中文）\">圣经姊妹版注释（繁体中文）</option>";
		txt2 += "</select><br />";
		txt2 += "<select name=footnote2 id=footnote2  class=\"footnote2\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,'D')\"><br />";
		txt2 += "<option value=\"N/A\">N/A</option>";
		txt2 += "<option value=\"新汉语译本注释（繁体中文）\">新汉语译本注释（繁体中文）</option>";
		txt2 += "<option value=\"新汉语译本注释（简体中文）\">新汉语译本注释（简体中文）</option>";
		txt2 += "<option value=\"圣经姊妹版注释（繁体中文）\">圣经姊妹版注释（繁体中文）</option>";
		txt2 += "</select>";
		
		txt3 = "<font color=\"#7F3300\"><b>专题文章选择</b></font><br /><select name=article id=article  class=\"article\" onChange=\"show_article(article.selectedIndex,f_size.selectedIndex)\"><br />";
		txt3 += "<option value=\"N/A\">N/A</option>";
		txt3 += "<option value=\"新汉语译本．新约全书书卷简介（繁体中文）\">新汉语译本新约书卷简介（繁体中文）</option>";
		txt3 += "<option value=\"新汉语译本．新约全书书卷简介（简体中文）\">新汉语译本新约书卷简介（简体中文）</option>";
		txt3 += "</select>";
		
		f_size_title.innerHTML="<b>字型大小</b><br />";
		search_title.innerHTML="<b>经文搜寻</b><br />";
		search_from.innerHTML="（由";
		search_to.innerHTML="至";
		search_sel.value = "搜寻";
	}

	if (language.selectedIndex == 2) {
		language_title.innerHTML="<font color=\"7F0000\"><b>Language Selection</b></font>";
		while (language.options.length > 0)
		{
			language.remove(0);
		}
		language.options[0] = new Option("Traditional Chinese");
		language.options[0].value = "Traditional Chinese";
		language.options[1] = new Option("Simplified Chinese");
		language.options[1].value = "Simplified Chinese";
		language.options[2] = new Option("English");
		language.options[2].value = "English";
		
		language.selectedIndex = 2;
		
		txt1 = "<font color=\"#7F6A00\"><b>Bible Selection</b></font><br /><select name=bible1 id=bible1  class=\"bible1\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,submit.value)\"><br />";
		txt1 += "<option value=\"N/A\">N/A</option>";
		txt1 += "<option value=\"Union Version (Traditional Chinese)\">Union Version (Traditional Chinese)</option>";
		txt1 += "<option value=\"Union Version (Simplified Chinese)\">Union Version (Simplified Chinese)</option>";
		txt1 += "<option value=\"Contemporary Chinese Verison - New Testament　(Trad. Chin.)\">Contemporary Chinese Verison - New Testament　(Trad. Chin.)</option>";
		txt1 += "<option value=\"Contemporary Chinese Verison - New Testament　(Simp. Chin.)\">Contemporary Chinese Verison - New Testament　(Simp. Chin.)</option>";
		txt1 += "<option value=\"King James Version (KJV)\">King James Version (KJV)</option>";
		txt1 += "</select><br />";
		txt1 += "<select name=bible2 id=bible2  class=\"bible2\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,submit.value)\"><br />";
		txt1 += "<option value=\"N/A\">N/A</option>";
		txt1 += "<option value=\"Union Version (Traditional Chinese)\">Union Version (Traditional Chinese)</option>";
		txt1 += "<option value=\"Union Version (Simplified Chinese)\">Union Version (Simplified Chinese)</option>";
		txt1 += "<option value=\"Contemporary Chinese Verison - New Testament　(Trad. Chin.)\">Contemporary Chinese Verison - New Testament　(Trad. Chin.)</option>";
		txt1 += "<option value=\"Contemporary Chinese Verison - New Testament　(Simp. Chin.)\">Contemporary Chinese Verison - New Testament　(Simp. Chin.)</option>";
		txt1 += "<option value=\"King James Version (KJV)\">King James Version (KJV)</option>";
		txt1 += "</select>";
		
		txt2 = "<font color=\"#267F00\"><b>Footnote Selection</b></font><br /><select name=footnote1 id=footnote1  class=\"footnote1\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,'D')\"><br />";
		txt2 += "<option value=\"N/A\">N/A</option>";
		txt2 += "<option value=\"Contemporary Chinese Version Footnote (Trad. Chin.)\">Contemporary Chinese Version Footnote (Trad. Chin.)</option>";
		txt2 += "<option value=\"Contemporary Chinese Version Footnote (Simp. Chin.)\">Contemporary Chinese Version Footnote (Simp. Chin.)</option>";
		txt2 += "<option value=\"Devotional Bible for Women Footnote (Trad. Chin.)\">Devotional Bible for Women Footnote (Trad. Chin.)</option>";
		txt2 += "</select><br />";
		txt2 += "<select name=footnote2 id=footnote2  class=\"footnote2\" onChange=\"redirect(language.selectedIndex,f_size.selectedIndex,bible1.selectedIndex,bible2.selectedIndex,footnote1.selectedIndex,footnote2.selectedIndex,article.selectedIndex,biblebook,chapter,ver,search.value,search_start.selectedIndex,search_end.selectedIndex,'D')\"><br />";
		txt2 += "<option value=\"N/A\">N/A</option>";
		txt2 += "<option value=\"Contemporary Chinese Version Footnote (Trad. Chin.)\">Contemporary Chinese Version Footnote (Trad. Chin.)</option>";
		txt2 += "<option value=\"Contemporary Chinese Version Footnote (Simp. Chin.)\">Contemporary Chinese Version Footnote (Simp. Chin.)</option>";
		txt2 += "<option value=\"Devotional Bible for Women Footnote (Trad. Chin.)\">Devotional Bible for Women Footnote (Trad. Chin.)</option>";
		txt2 += "</select>";
		
		txt3 = "<font color=\"#7F3300\"><b>Article Selection</b></font><br /><select name=article id=article  class=\"article\" onChange=\"show_article(article.selectedIndex,f_size.selectedIndex)\"><br />";
		txt3 += "<option value=\"N/A\">N/A</option>";
		txt3 += "<option value=\"Introduction of Contemporary Chinese Version (Trad. Chin.)\">Introduction of Contemporary Chinese Version (Trad. Chin.)</option>";
		txt3 += "<option value=\"Introduction of Contemporary Chinese Version (Simp. Chin.)\">Introduction of Contemporary Chinese Version (Simp. Chin.)</option>";
		txt3 += "</select>";
		
		f_size_title.innerHTML="<b>Font Size</b><br />";
		search_title.innerHTML="<b>Bible Search</b><br />";
		search_from.innerHTML="（From";
		search_to.innerHTML="to";
		search_sel.value = "Search";
	}
	
	bible_sel.innerHTML=txt1;
	footnote_sel.innerHTML=txt2;
	article_sel.innerHTML=txt3;
	options_gen(language.selectedIndex,search_start);
	options_gen(language.selectedIndex,search_end);
	var bible1=document.getElementById('bible1');
	var bible2=document.getElementById('bible2');
	var footnote1=document.getElementById('footnote1');
	var footnote2=document.getElementById('footnote2');
	var article=document.getElementById('article');
	var article = 0;
	var submit=document.getElementById('submit');
	bible1.selectedIndex = bible1_v;
	bible2.selectedIndex = bible2_v;
	footnote1.selectedIndex = footnote1_v;
	footnote2.selectedIndex = footnote2_v;
	article.selectedIndex = article_v;
	search.text = search_v;
	search_start.selectedIndex = search_start_v;
	search_end.selectedIndex = search_end_v;
	submit.text = submit_v;
	
	window.parent.Bible_Selection.location.href = "bible_sel.php?language="+language.selectedIndex+"&f_size="+f_size.selectedIndex+"&bible1="+bible1.selectedIndex+"&bible2="+bible2.selectedIndex+"&footnote1="+footnote1.selectedIndex+"&footnote2="+footnote2.selectedIndex+"&article="+article.selectedIndex+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search.value+"&search_start="+search_start.selectedIndex+"&search_end="+search_end.selectedIndex+"&submit="+submit.value;
	if ((submit_v != "S") && (submit_v != "D")) {
		window.parent.Footnote.location.href = "footnote.php?language="+language.selectedIndex+"&f_size="+f_size.selectedIndex+"&bible1="+bible1.selectedIndex+"&bible2="+bible2.selectedIndex+"&footnote1="+footnote1.selectedIndex+"&footnote2="+footnote2.selectedIndex+"&article="+article.selectedIndex+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search.value+"&search_start="+search_start.selectedIndex+"&search_end="+search_end.selectedIndex+"&submit="+submit.value+"#"+(parseInt(ver)+1);
	}
}

function redirect(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit) {
	if (search.value=="") {
		search.value="N/A";
	}
	
	if (bible1 == 3) {
		footnote1 = 1;
	}
	
	if (bible2 == 3) {
		footnote2 = 1;
	}
	
	if (bible1 == 4) {
		footnote1 = 2;
	}
	
	if (bible2 == 4) {
		footnote2 = 2;
	}	
	
	if (submit != "D") {
		footnote1 = 0;
		footnote2 = 0;
	}
	
	window.parent.Selection.location.href = "selection-2.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit;
	window.parent.Bible_Selection.location.href = "bible_sel.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit;
	
	if ((bible1 == 0) || (bible2 == 0)) {
		if (bible2 == 0) {
			window.parent.Bible.location.href = "display.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(parseInt(ver)+1);
		} else {
			window.parent.Bible.location.href = "display1.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(parseInt(ver)+1);
		}
	} else {
		window.parent.Bible.location.href = "display2.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(parseInt(ver)+1);
	}
	
	if ((footnote1 == 0 && (bible1 != 3 || bible1 != 4)) || (footnote2 == 0 && (bible2 != 3 || bible2 != 4))) {
		if (footnote2 == 0 && bible2 != 3) {
			window.parent.Footnote.location.href = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(parseInt(ver)+1);	
		} else {
			window.parent.Footnote.location.href = "footnote1.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(parseInt(ver)+1);	
		}
	} else {
		window.parent.Footnote.location.href = "footnote2.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(parseInt(ver)+1);	
	}
}

function search_loc(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit) {
	
	window.parent.Bible_Selection.location.href = "bible_sel.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit;
	
	if ((bible1 == 0) || (bible2 == 0)) {
		if (bible2 == 0) {
			window.parent.Bible.location.href = "display.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&submit="+submit+"#"+(ver+1);
		} else {
			window.parent.Bible.location.href = "display1.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&submit="+submit+"#"+(ver+1);
		}
	} else {
		window.parent.Bible.location.href = "display2.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&submit="+submit+"#"+(ver+1);
	}
}

function footnote_link(biblebook,chapter,ver) {
	var url = 'display.php?language=0&f_size=2&bible1=1&bible2=0&footnote1=-1&footnote2=0&article=0&biblebook='+biblebook+'&chapter='+chapter+'&ver='+ver+'&search=&search_start=0&search_end=65&submit=D#'+(ver+1);
	window.open(url,'','directories=no,height=200,location=no,menubar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,width=500');
}

function ccv_link(f_size,biblebook,chapter,ver) {
	var bible1;	
	
	
	if (biblebook < 38 && biblebook != 0) {
		bible1 = 1;
	} else {
		bible1 = 3;
	}
		
	var url = 'display.php?language=0&f_size='+f_size+'&bible1='+bible1+'&bible2=0&footnote1=0&footnote2=0&article=0&biblebook='+biblebook+'&chapter='+chapter+'&ver='+ver+'&search=&search_start=0&search_end=65&submit=D#'+(ver+1);
	window.open(url,'','directories=no,height=200,location=no,menubar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,width=500');
}

function ccv_footnote(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,num) {
	
	if ((footnote1 == 0 && (bible1 != 3 || bible1 != 4)) || (footnote2 == 0 && (bible2 != 3 || bible2 != 4))) {
		if (footnote2 == 0 && (bible2 != 3 || bible2 != 4)) {
			window.parent.Footnote.location.href = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit=D"+"#"+num;	
		} else {
			window.parent.Footnote.location.href = "footnote1.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit=D"+"#"+num;	
		}
	} else {
		window.parent.parent.Footnote.location.href = "footnote2.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit=D"+"&num="+num;	
	}
}

function ccv_intro(biblebook,f_size) {
	var url = 'ccv/intro_'+biblebook+'.php?f_size='+f_size;
	window.open(url,'','directories=no,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,width=500');
}

function ccv_intro_sc(biblebook,f_size) {
	var url = 'ccv_sc/intro_'+biblebook+'.php?f_size='+f_size;
	window.open(url,'','directories=no,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,width=500');
}


function show_article(article,f_size) {
	if (article == 1) {
		var url = 'ccv/intro_index.php?f_size='+f_size;
		window.open(url,'','directories=no,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,width=500');
	}
	if (article == 2) {
		var url = 'ccv_sc/intro_index.php?f_size='+f_size;
		window.open(url,'','directories=no,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,width=500');
	}
}

function bookmark(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit) {	
	window.parent.Bible_Selection.location.href = "bible_sel.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit=M";
	window.parent.Footnote.location.href = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(ver+1);	
}

function show_bookmark(language,f_size,bible1,bible2,footnote1,footnote2,article,r_bookmark,search,search_start,search_end,submit) {
	if (r_bookmark.selectedIndex != -1) {
		var result = r_bookmark.options[r_bookmark.selectedIndex].value;
		
		var start = result.indexOf(",");
		var end = result.lastIndexOf(",");
		
		var biblebook = result.substring(0,start);
		var chapter = result.substring((start+1),end);
		var ver = result.substring(end+1);		
		
		redirect(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit);
	}
}



function del_bookmark(language,f_size,bible1,bible2,footnote1,footnote2,article,r_bookmark,search,search_start,search_end,submit) {
	
	var r = confirm("Do you confirm to delete the selected bookmark?");
	
	if (r == true) {	
		if (r_bookmark.selectedIndex != -1) {
			var result = r_bookmark.options[r_bookmark.selectedIndex].value;
			
			var start = result.indexOf(",");
			var end = result.lastIndexOf(",");
			
			var biblebook = result.substring(0,start);
			var chapter = result.substring((start+1),end);
			var ver = result.substring(end+1);

		} else {
			submit = "M";
		}
		
		if ((footnote1 == 0) || (footnote2 == 0)) {
			window.parent.Footnote.location.href = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(ver+1);	
		} else {
			window.parent.Footnote.location.href = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(ver+1);	
		}
	}
}

function edit_notes(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit) {
	var notesbox = document.getElementById("notesbox");
	var notes_title = document.getElementById("notes_title");
	var notes = document.getElementById("notes");
	
	window.parent.Bible_Selection.location.href = "bible_sel.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit=LN";
	// window.parent.Selection.location.href = "selection-2.php?language="+language+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit=LN";
	
	if ((submit == "N") || (submit == "LN")) {
		window.parent.Footnote.location.href = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(ver+1);	
	}
	if (submit == "SN") {
		notes_title.value = trim(notes_title.value);
		notes.value = trim(notes.value);
		var r = confirm("Do you confirm to save the notes input?");
		if (r == true) {
			if ((notes_title.value.length == 0) && (notes.value.length == 0)) {
				var submit = "DN";
				window.parent.Footnote.location.href = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(ver+1);	
			} else {
				if (notes.value.length > 3000) {
					alert("The note content is exceed the size limit.");
				} else {
					if ((footnote1 == 0) || (footnote2 == 0)) {
						notesbox.action = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(ver+1);	
					} else {
						notesbox.action = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"#"+(ver+1);	
					}
					notesbox.submit();
				}
			}
		}
	}
}


function shownotes(language,f_size,bible1,bible2,footnote1,footnote2,article,search,search_start,search_end,submit) {
	var r_notes = document.getElementById("noteslist");
	
	if (r_notes.selectedIndex != -1) {
		var result = r_notes.options[r_notes.selectedIndex].value;
		
		var start = result.indexOf(",");
		var end = result.lastIndexOf(",");
		
		var biblebook = result.substring(0,start);
		var chapter = result.substring((start+1),end);
		var ver = result.substring(end+1);		
	
		redirect(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit);
		window.parent.Footnote.location.href = "footnote.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit=N#"+(ver+1);
	}
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function disableEnterKey(e)
{
     var key;     
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox     

     return (key != 13);
}

function clickIE4(){
	if (event.button==2){
		getSelText();
	return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which == 2 || e.which == 3){
			getSelText();
		return false;
		}
	}
}

function rightClick() {	
	if (document.layers){
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS4;
	} else if (document.all&&!document.getElementById){
		document.onmousedown=clickIE4;
	}
	document.oncontextmenu = new Function();
}

function getSelText(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit,a_bible)
{
	var s_row,e_row,s_char,e_char;
	var txt = '';
	if (window.getSelection)
	{
		txt = window.getSelection();
		var temp=txt.getRangeAt(0);
		
		if (temp.startContainer.nodeName == "TD") {
			s_row = temp.startContainer.parentNode.rowIndex;
			s_char = 0;
		} else {
			if (temp.startContainer.nodeName == "TR") {
				s_row = temp.startContainer.rowIndex;
				s_char = 0;
			} else {
				if (temp.startContainer.parentNode.nodeName == "A") {					
					s_row = temp.startContainer.parentNode.parentNode.parentNode.id;
					s_char = 0;
				} else {
					if (temp.startContainer.parentNode.nodeName == "TD") {					
						s_row = temp.startContainer.parentNode.id;
						s_char = temp.startOffset;
					} else {
						if (temp.startContainer.parentNode.parentNode.nodeName == "TD") {					
							s_row = temp.startContainer.parentNode.parentNode.id;
							s_char = temp.startOffset;
						} 
					}
				}
			}
		}
		
		if (temp.endContainer.nodeName == "TD") {
			e_row = temp.endContainer.parentNode.rowIndex;
			e_char = temp.endContainer.childNodes[0].data.length;
		} else {
			if (temp.endContainer.nodeName == "TR") {
				e_row = temp.endContainer.rowIndex;
				e_char = temp.endContainer.childNodes[0].childNodes[0].data.length;
			} else {
				if (temp.endContainer.parentNode.nodeName == "TD") {					
					e_row = temp.endContainer.parentNode.id;
					e_char = temp.endOffset;
				} else {
					if (temp.endContainer.parentNode.parentNode.nodeName == "TD") {					
						e_row = temp.endContainer.parentNode.parentNode.id;
						e_char = temp.endOffset;
					}				
				}				
			}
		}
		// alert(temp.startContainer.parentNode.parentNode.parentNode.nodeName);
		// alert(temp.endContainer.parentNode.nodeName);
		// alert(s_row+","+s_char+","+e_row+","+e_char);
		
		if (txt != "") {
			if ((bible1 == 0) || (bible2 == 0)) {
				if (bible2 == 0) {
					window.parent.Bible.location.href = "display.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"&active_bible="+a_bible+"&start_ver="+s_row+"&start_char="+s_char+"&end_ver="+e_row+"&end_char="+e_char+"#"+(parseInt(ver)+1);
				} else {
					window.parent.Bible.location.href = "display1.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"&active_bible="+a_bible+"&start_ver="+s_row+"&start_char="+s_char+"&end_ver="+e_row+"&end_char="+e_char+"#"+(parseInt(ver)+1);					
				}
			} else {
				window.parent.parent.Bible.location.href = "display2.php?language="+language+"&f_size="+f_size+"&bible1="+bible1+"&bible2="+bible2+"&footnote1="+footnote1+"&footnote2="+footnote2+"&article="+article+"&biblebook="+biblebook+"&chapter="+chapter+"&ver="+ver+"&search="+search+"&search_start="+search_start+"&search_end="+search_end+"&submit="+submit+"&active_bible="+a_bible+"&start_ver="+s_row+"&start_char="+s_char+"&end_ver="+e_row+"&end_char="+e_char+"#"+(parseInt(ver)+1);				
			}		
		}
	}
	
	else return;
}

function highlighters(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit) {
	if ((bible1 == 0) || (bible2 == 0)) {
		if (bible2 == 0) {
			window.parent.Bible.getSelText(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit,bible1);
		} else {
			window.parent.Bible.getSelText(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit,bible2);
		}
	} else {
		window.parent.Bible.Bible1.getSelText(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit,bible1);
		window.parent.Bible.Bible2.getSelText(language,f_size,bible1,bible2,footnote1,footnote2,article,biblebook,chapter,ver,search,search_start,search_end,submit,bible2);
	}
}

function CutToClipboard()
{

   CutTxt = document.selection.createRange();

   CutTxt.execCommand("Cut");

}

function CopyToClipboard()

{

   CopiedTxt = document.selection.createRange();

   CopiedTxt.execCommand("Copy");

}

function PasteFromClipboard()

{

   document.Form1.txtArea.focus();

   PastedText = document.Form1.txtArea.createTextRange();

   PastedText.execCommand("Paste");

} 

function bible_convert(bible_version,source,result) {

	if (bible_version==0) {
		switch (source) {
			case 0:
				result = "創世記";
				return result;
			case 1:
				result = "出埃及記";
				return result;
			case 2:
				result = "利未記";
				return result;
			case 3:
				result = "民數記";
				return result;
			case 4:
				result = "申命記";
				return result;
			case 5:
				result = "約書亞記";
				return result;
			case 6:
				result = "士師記";
				return result;
			case 7:
				result = "路得記";
				return result;
			case 8:
				result = "撒母耳記上";
				return result;
			case 9:
				result = "撒母耳記下";
				return result;
			case 10:
				result = "列王紀上";
				return result;
			case 11:
				result = "列王紀下";
				return result;
			case 12:
				result = "歷代志上";
				return result;
			case 13:
				result = "歷代志下";
				return result;
			case 14:
				result = "以斯拉記";
				return result;
			case 15:
				result = "尼希米記";
				return result;
			case 16:
				result = "以斯帖記";
				return result;
			case 17:
				result = "約伯記";
				return result;
			case 18:
				result = "詩篇";
				return result;
			case 19:
				result = "箴言";
				return result;
			case 20:
				result = "傳道書";
				return result;
			case 21:
				result = "雅歌";
				return result;
			case 22:
				result = "以賽亞書";
				return result;
			case 23:
				result = "耶利米書";
				return result;
			case 24:
				rseult = "耶利米哀歌";
				return result;
			case 25:
				result = "以西結書";
				return result;
			case 26:
				result = "但以理書";
				return result;
			case 27:
				result = "何西阿書";
				return result;
			case 28:
				result = "約珥書";
				return result;
			case 29:
				result = "阿摩司書";
				return result;
			case 30:
				rseult = "俄巴底亞書";
				return result;
			case 31:
				result = "約拿書";
				return result;
			case 32:
				result = "彌迦書";
				return result;
			case 33:
				result = "那鴻書";
				return result;
			case 34:
				result = "哈巴谷書";
				return result;
			case 35:
				result = "西番雅書";
				return result;
			case 36:
				result = "哈該書";
				return result;
			case 37:
				result = "撒迦利亞書";
				return result;
			case 38:
				result = "瑪拉基書";
				return result;
			case 39:
				result = "馬太福音";
				return result;
			case 40:
				result = "馬可福音";
				return result;
			case 41:
				result = "路加福音";
				return result;
			case 42:
				result = "約翰福音";
				return result;
			case 43:
				result = "使徒行傳";
				return result;
			case 44:
				result = "羅馬書";
				return result;
			case 45:
				result = "哥林多前書";
				return result;
			case 46:
				result = "哥林多後書";
				return result;
			case 47:
				result = "加拉太書";
				return result;
			case 48:
				result = "以弗所書";
				return result;
			case 49:
				result = "腓立比書";
				return result;
			case 50:
				result = "歌羅西書";
				return result;
			case 51:
				result = "帖撒羅尼迦前書";
				return result;
			case 52:
				result = "帖撒羅尼迦後書";
				return result;
			case 53:
				result = "提摩太前書";
				return result;
			case 54:
				result = "提摩太後書";
				return result;
			case 55:
				result = "提多書";
				return result;
			case 56:
				result = "腓利門書";
				return result;
			case 57:
				result = "希伯來書";
				return result;
			case 58:
				result = "雅各書";
				return result;
			case 59:
				result = "彼得前書";
				return result;
			case 60:
				result = "彼得後書";
				return result;
			case 61:
				result = "約翰一書";	
				return result;
			case 62:
				result = "約翰二書";
				return result;
			case 63:
				result = "約翰三書";
				return result;
			case 64:
				result = "猶大書";
				return result;
			case 65:
				result = "啟示錄";
				return result;
		}
	}
	else
	{
		switch (source) {
			case 0:
				result = "Genesis";
				return result;
			case 1:
				result = "Exodus";
				return result;
			case 2:
				result = "Leviticus";
				return result;
			case 3:
				result = "Numbers";
				return result;
			case 4:
				result = "Deuteronomy";
				return result;
			case 5:
				result = "Joshua";
				return result;
			case 6:
				rseult = "Judges";
				return result;
			case 7:
				result = "Ruth";
				return result;
			case 8:
				result = "1 Samuel";
				return result;
			case 9:
				result = "2 Samuel";
				return result;
			case 10:
				result = "1 Kings";
				return result;
			case 11:
				result = "2 Kings";
				return result;
			case 12:
				result = "1 Chronicles";
				return result;
			case 13:
				result = "2 Chronicles";
				return result;
			case 14:
				result = "Ezra";
				return result;
			case 15:
				result = "Nehemiah";
				return result;
			case 16:
				result = "Esther";
				return result;
			case 17:
				result = "Job";
				return result;
			case 18:
				result = "Psalms";
				return result;
			case 19:
				result = "Proverbs";
				return result;
			case 20:
				result = "Ecclesiastes";
				return result;
			case 21:
				result = "Song of Songs";
				return result;
			case 22:
				result = "Isaiah";
				return result;
			case 23:
				rseult = "Jeremiah";
				return result;
			case 24:
				result = "Lamentation";
				return result;
			case 25:
				result = "Ezekiel";
				return result;
			case 26:
				result = "Daniel";
				return result;
			case 27:
				result = "Hosea";
				return result;
			case 28:
				result = "Joel";
				return result;
			case 29:
				result = "Amos";
				return result;
			case 30:
				result = "Obadiah";
				return result;
			case 31:
				result = "Jonah";
				return result;
			case 32:
				result = "Micah";
				return result;
			case 33:
				result = "Nahum";
				return result;
			case 34:
				result = "Habakkuk";
				return result;
			case 35:
				result = "Zephaniah";
				return result;
			case 36:
				result = "Haggai";
				return result;
			case 37:
				result = "Zechariah";
				return result;
			case 38:
				result = "Malachi";
				return result;
			case 39:
				result = "Matthew";
				return result;
			case 40:
				result = "Mark";
				return result;
			case 41:
				result = "Luke";
				return result;
			case 42:
				result = "John";
				return result;
			case 43:
				result = "Acts";
				return result;
			case 44:
				result = "Romans";
				return result;
			case 45:
				result = "1 Corinthians";
				return result;
			case 46:
				result = "2 Corinthians";
				return result;
			case 47:
				result = "Galatians";
				return result;
			case 48:
				result = "Ephesians";
				return result;
			case 49:
				result = "Philippians";
				return result;
			case 50:
				result = "Colossians";
				return result;
			case 51:
				result = "1 Thessalonians";
				return result;
			case 52:
				result = "2 Thessalonians";
				return result;
			case 53:
				result = "1 Timothy";
				return result;
			case 54:
				result = "2 Timothy";
				return result;
			case 55:
				result = "Titus";
				return result;
			case 56:
				result = "Philemon";
				return result;
			case 57:
				result = "Hebrews";
				return result;
			case 58:
				result = "James";
				return result;
			case 59:
				result = "1 Peter";
				return result;
			case 60:
				result = "2 Peter";
				return result;
			case 61:
				result = "1 John";
				return result;
			case 62:
				result = "2 John";
				return result;
			case 63:
				result = "3 John";
				return result;
			case 64:
				result = "Jude";
				return result;
			case 65:
				result = "Revelation";
				return result;
		}
	}
}
