// JavaScript Document

function updateChapters(fld) {
	
	book = $('#' + fld + '-book')[0].value;
	
	if (book != 0) {
	
		bc = new BibleChapters();
		$('#' + fld + '-chapter').html('<OPTION value="All">-All-</OPTION>' + bc.getChapterOptions(book));
	
	} else {
		
		$('#' + fld + '-chapter').html("");
	}
	
	
}

function BibleChapters() {
   	
		
	//this.aryChapters = [50, 40, 27, 36, 34, 24, 21, 4, 31, 24, 22, 25, 29, 36, 10, 13, 10, 42, 150, 31, 12, 8, 66, 52, 5, 48, 12, 14, 3, 9, 1, 4, 7, 3, 3, 3, 2, 14, 4, 28, 16, 24, 21, 28, 16, 16, 13, 6, 6, 4, 4, 5, 3, 6, 4, 3, 1, 13, 5, 5, 3, 5, 1, 1, 1, 22];

	
	this.aryChapters = new Array();
	
	this.aryChapters['Gen'] = 50;
	this.aryChapters['Ex'] = 40;
	this.aryChapters['Lev'] = 27;
	this.aryChapters['Num'] = 36;
	this.aryChapters['Deut'] = 34;
	this.aryChapters['Josh'] = 24;
	this.aryChapters['Judg'] = 21;
	this.aryChapters['Ruth'] = 4;
	this.aryChapters['1 Sam'] = 31;
	this.aryChapters['2 Sam'] = 24;
	this.aryChapters['1 Kgs'] = 22;
	this.aryChapters['2 Kgs'] = 25;
	this.aryChapters['1 Chron'] = 29;
	this.aryChapters['2 Chron'] = 36;
	this.aryChapters['Ezra'] = 10;
	this.aryChapters['Neh'] = 13;
	this.aryChapters['Esth'] = 10;
	this.aryChapters['Job'] = 42;
	this.aryChapters['Psalm'] = 150;
	this.aryChapters['Prov'] = 31;
	this.aryChapters['Eccles'] = 12;
	this.aryChapters['Song'] = 8;
	this.aryChapters['Isa'] = 66;
	this.aryChapters['Jer'] = 52;
	this.aryChapters['Lam'] = 5;
	this.aryChapters['Ezek'] = 48;
	this.aryChapters['Dan'] = 12;
	this.aryChapters['Hos'] = 14;
	this.aryChapters['Joel'] = 3;
	this.aryChapters['Amos'] = 9;
	this.aryChapters['Obad'] = 1;
	this.aryChapters['Jnh'] = 4;
	this.aryChapters['Micah'] = 7;
	this.aryChapters['Nah'] = 3;
	this.aryChapters['Hab'] = 3;
	this.aryChapters['Zeph'] = 3;
	this.aryChapters['Hag'] = 2;
	this.aryChapters['Zech'] = 14;
	this.aryChapters['Mal'] = 4;	
	
	this.aryChapters['Matt'] = 28;
	this.aryChapters['Mrk'] = 16;
	this.aryChapters['Luke'] = 24;
	this.aryChapters['John'] = 21;
	this.aryChapters['Acts'] = 28;
	this.aryChapters['Rom'] = 16;
	this.aryChapters['1 Cor'] = 16;
	this.aryChapters['2 Cor'] = 13;
	this.aryChapters['Gal'] = 6;
	this.aryChapters['Eph'] = 6;
	this.aryChapters['Phil'] = 4;
	this.aryChapters['Col'] = 4;
	this.aryChapters['1 Thess'] = 5;
	this.aryChapters['2 Thess'] = 3;
	this.aryChapters['1 Tim'] = 6;
	this.aryChapters['2 Tim'] = 4;
	this.aryChapters['Tit'] = 3;
	this.aryChapters['Philem'] = 1;
	this.aryChapters['Heb'] = 13;
	this.aryChapters['James'] = 5;
	this.aryChapters['1 Pet'] = 5;
	this.aryChapters['2 Pet'] = 3;
	this.aryChapters['1 John'] = 5;
	this.aryChapters['2 John'] = 1;
	this.aryChapters['3 John'] = 1;
	this.aryChapters['Jude'] = 1;
	this.aryChapters['Rev'] = 22;
	
	
	this.getChapterOptions = function(book) {
		html = "";
		
		for (i = 0; i < this.aryChapters[book]; i++) {
			html = html + '<OPTION value="' + (i+1) + '">' + (i+1) + '</OPTION>';
		}
		
		return html;
	}
	
	
	
	
	function getChapterList(book) {
		
		var aryChaps = new Array();
		
		for (i = 0; i < this.aryChapters[book]; i++) {
			aryChaps[i+1] = i+1;	
		}
		
		return aryChaps;
		
	}

}


