
otBookList=['genesis','exodus','leviticus','numbers','deuteronomy','joshua','judges','ruth','1samuel','2samuel','1kings','2kings','1chronicles','2chronicles','ezra','nehemiah','esther','job','psalms','proverbs','ecclesiastes','songofsolomon','isaiah','jeremiah','lamentations','ezekiel','daniel','hosea','joel','amos','obadiah','jonah','micah','nahum','habakkuk','zephaniah','haggai','zechariah','malachi'];
otJewishBookList=['genesis','exodus','leviticus','numbers','deuteronomy','joshua','judges','1samuel','2samuel','1kings','2kings','isaiah','jeremiah','ezekiel','hosea','joel','amos','obadiah','jonah','micah','nahum','habakkuk','zephaniah','haggai','zechariah','malachi','psalms','proverbs','job','songofsolomon','ruth','lamentations','ecclesiastes','esther','daniel','ezra','nehemiah','1chronicles','2chronicles'];
ntBookList=['matthew','mark','luke','john','acts','romans','1corinthians','2corinthians','galatians','ephesians','philippians','colossians','1thessalonians','2thessalonians','1timothy','2timothy','titus','philemon','hebrews','james','1peter','2peter','1john','2john','3john','jude','revelation'];
 
bookData=[];
bookData['genesis']=['Genesis',50];
bookData['exodus']=['Exodus',40];
bookData['leviticus']=['Leviticus',27];
bookData['numbers']=['Numbers',36];
bookData['deuteronomy']=['Deuteronomy',34];
bookData['joshua']=['Joshua',24];
bookData['judges']=['Judges',21];
bookData['ruth']=['Ruth',4];
bookData['1samuel']=['1 Samuel',31];
bookData['2samuel']=['2 Samuel',24];
bookData['1kings']=['1 Kings',22];
bookData['2kings']=['2 Kings',25];
bookData['1chronicles']=['1 Chronicles',29];
bookData['2chronicles']=['2 Chronicles',36];
bookData['ezra']=['Ezra',10];
bookData['nehemiah']=['Nehemiah',13];
bookData['esther']=['Esther',10];
bookData['job']=['Job',42];
bookData['psalms']=['Psalms',150];
bookData['proverbs']=['Proverbs',31];
bookData['ecclesiastes']=['Ecclesiastes',12];
bookData['songofsolomon']=['Song of Solomon',8];
bookData['isaiah']=['Isaiah',66];
bookData['jeremiah']=['Jeremiah',52];
bookData['lamentations']=['Lamentations',5];
bookData['ezekiel']=['Ezekiel',48];
bookData['daniel']=['Daniel',12];
bookData['hosea']=['Hosea',14];
bookData['joel']=['Joel',3];
bookData['amos']=['Amos',9];
bookData['obadiah']=['Obadiah',1];
bookData['jonah']=['Jonah',4];
bookData['micah']=['Micah',7];
bookData['nahum']=['Nahum',3];
bookData['habakkuk']=['Habakkuk',3];
bookData['zephaniah']=['Zephaniah',3];
bookData['haggai']=['Haggai',2];
bookData['zechariah']=['Zechariah',14];
bookData['malachi']=['Malachi',4];
bookData['matthew']=['Matthew',28];
bookData['mark']=['Mark',16];
bookData['luke']=['Luke',24];
bookData['john']=['John',21];
bookData['acts']=['Acts',28];
bookData['romans']=['Romans',16];
bookData['1corinthians']=['1 Corinthians',16];
bookData['2corinthians']=['2 Corinthians',13];
bookData['galatians']=['Galatians',6];
bookData['ephesians']=['Ephesians',6];
bookData['philippians']=['Philippians',4];
bookData['colossians']=['Colossians',4];
bookData['1thessalonians']=['1 Thessalonians',5];
bookData['2thessalonians']=['2 Thessalonians',3];
bookData['1timothy']=['1 Timothy',6];
bookData['2timothy']=['2 Timothy',4];
bookData['titus']=['Titus',3];
bookData['philemon']=['Philemon',1];
bookData['hebrews']=['Hebrews',13];
bookData['james']=['James',5];
bookData['1peter']=['1 Peter',5];
bookData['2peter']=['2 Peter',3];
bookData['1john']=['1 John',5];
bookData['2john']=['2 John',1];
bookData['3john']=['3 John',1];
bookData['jude']=['Jude',1];
bookData['revelation']=['Revelation',22];
 
otStdList=['americanstandardversion','thebibleanewtranslation','thebishopsbible','brentontranslation','coverdalebible','theemphasisedbible','thegenevabible','kingjamesversion1611','kingjamesversion1769','kingjamesversion1850','revisedversion','websterversion','wycliffebible','youngsliteraltranslation'];
otJewishList=['theholyscriptures','theleeserbible'];
ntStdList=['americanstandardversion','thebibleanewtranslation','thebishopsbible','coverdalebible','theemphasisedbible','theemphaticdiaglott','englishtranslationofthebible','etheridgetranslation','thegenevabible','kingjamesversion1611','kingjamesversion1769','kingjamesversion1850','livingoracles','mrwhistonsprimitivenewtestament','murdocktranslation','thenewtestamentanamericantranslation','newtestamentinmodernspeech','americanbibleunionthenewtestament','thenewtestamentrevisedandtranslated','thenewtestamenttranslatedfromtheoriginal','thenewtestamenttranslatedfromthesinaitic','revisedversion','godbeytranslationofthenewtestament','twentiethcenturynewtestament','websterversion','wesleyversion','worsleyversion','wycliffebible','youngsliteraltranslation'];
partialList=['calvinbible','corpusanglosaxongospels','hattonanglosaxongospels','noyestranslation','tyndalebible'];
calvinbible=[];
corpusanglosaxongospels=[];
hattonanglosaxongospels=[];
noyestranslation=[];
tyndalebible=[];
calvinbible['ot']=['joshua','psalms','isaiah','jeremiah','lamentations','ezekiel','daniel','hosea','joel','amos','obadiah','jonah','micah','nahum','habakkuk','zephaniah','haggai','zechariah','malachi'];
calvinbible['nt']=['romans','galatians','ephesians','1timothy','2timothy','titus','philemon','hebrews','james','1peter','2peter','1john','jude'];
corpusanglosaxongospels['ot']=[];
corpusanglosaxongospels['nt']=['matthew','mark','luke','john'];
hattonanglosaxongospels['ot']=[];
hattonanglosaxongospels['nt']=['matthew','mark','luke','john'];
noyestranslation['ot']=['job','psalms','proverbs','ecclesiastes','songofsolomon','isaiah','jeremiah','lamentations','ezekiel','daniel','hosea','joel','amos','obadiah','jonah','micah','nahum','habakkuk','zephaniah','haggai','zechariah','malachi'];
noyestranslation['nt']=['matthew','mark','luke','john','acts','romans','1corinthians','2corinthians','galatians','ephesians','philippians','colossians','1thessalonians','2thessalonians','1timothy','2timothy','titus','philemon','hebrews','james','1peter','2peter','1john','2john','3john','jude','revelation'];
tyndalebible['ot']=['genesis','exodus','leviticus','numbers','deuteronomy','jonah'];
tyndalebible['nt']=['matthew','mark','luke','john','acts','romans','1corinthians','2corinthians','galatians','ephesians','philippians','colossians','1thessalonians','2thessalonians','1timothy','2timothy','titus','philemon','hebrews','james','1peter','2peter','1john','2john','3john','jude','revelation'];
 
// the code here loads up the variables lastVersionName, lastReferenceBook, lastReferenceChapter, scrollVersion, scrollBook, scrollChapter, and referenceVerse from window.name if it exists
if(window.name.substr(0,14)=='lookhigher.net'){
	var chopstring=window.name.substr(15);
	var nextcut=chopstring.indexOf(',');
	lastVersionName=chopstring.substr(0,nextcut);
		chopstring=chopstring.slice(nextcut-(-1));
	nextcut=chopstring.indexOf(',');
	lastReferenceBook=chopstring.substr(0,nextcut);
		chopstring=chopstring.slice(nextcut-(-1));
	nextcut=chopstring.indexOf(',');
	lastReferenceChapter=chopstring.substr(0,nextcut);
		chopstring=chopstring.slice(nextcut-(-1));
	nextcut=chopstring.indexOf(',');
	scrollVersion=chopstring.substr(0,nextcut);
		chopstring=chopstring.slice(nextcut-(-1));
	nextcut=chopstring.indexOf(',');
	scrollBook=chopstring.substr(0,nextcut);
		chopstring=chopstring.slice(nextcut-(-1));
	nextcut=chopstring.indexOf(',');
	scrollChapter=chopstring.substr(0,nextcut);
		chopstring=chopstring.slice(nextcut-(-1));
	nextcut=chopstring.indexOf(',');
	referenceVerse=chopstring.substr(0,nextcut);
	lastSearch=chopstring.slice(nextcut-(-1));
	};
 
// put in stand-in values for last known version, book, and chapter if none is known
if(typeof(lastVersionName)=='undefined'){lastVersionName='americanstandardversion';};
if(typeof(lastReferenceBook)=='undefined'){lastReferenceBook='genesis';};
if(typeof(lastReferenceChapter)=='undefined'){lastReferenceChapter=1;};
 
// use last known values if no current values are given in this document
if(typeof(versionName)=='undefined'){versionName=lastVersionName;};
if(typeof(referenceBook)=='undefined'){referenceBook=lastReferenceBook;};
if(typeof(referenceChapter)=='undefined'){referenceChapter=lastReferenceChapter;};
if(typeof(referenceVerse)=='undefined'){referenceVerse='';};
if(typeof(lastSearch)=='undefined'){lastSearch='';};

function isInArray(lookfor, arrayname){
	for(j=0;j<arrayname.length;j++){
		if(lookfor==arrayname[j]){
			return true;	
			};
		};
	return false;
	}

function fetchAnchor(){
	if(document.getElementById('v1')==null){ return referenceVerse; };
	var scrollNumber=document.getElementById("contentdiv").scrollTop;
	var currentAnchorNumber=0;
	while(anchorsOffsetList[currentAnchorNumber-(-1)]<=scrollNumber){
		currentAnchorNumber++;
		};
	if(anchorsOffsetList[currentAnchorNumber-(-1)]-scrollNumber<scrollNumber-anchorsOffsetList[currentAnchorNumber]){currentAnchorNumber++;};
	if(currentAnchorNumber==0){return '';} else {return 'v'+currentAnchorNumber;}
	}
 
// this function sends the document to a URL reflecting the current book, chapter, and verse (used when the user clicks on a version button)
function getNewUrl(newVersion){
	var notfoundurl=baseURL+"englishbibles/notfound.html";
	var thisanchor=fetchAnchor();
	if(thisanchor!=''){thisanchor='#'+thisanchor;}
	var goodurl=baseURL+'englishbibles/'+newVersion+'/'+referenceBook+'/'+referenceChapter+'.html'+thisanchor;
	if(isInArray(newVersion,partialList)){
		if(isInArray(referenceBook,eval(newVersion)['ot'])||isInArray(referenceBook,eval(newVersion)['nt'])){return goodurl;};
		} else {
		if(isInArray(referenceBook,otBookList)){if(isInArray(newVersion,otStdList)||isInArray(newVersion,otJewishList)){return goodurl;}};
		if(isInArray(referenceBook,ntBookList)){if(isInArray(newVersion,ntStdList)){return goodurl;};};
		} 
	 return notfoundurl+'?'+newVersion;
	}
 
// this function takes this page's info (versionName, referenceBook, referenceChapter, result of fetchAnchor(), scroll points of nav divs) and stores it in window.name
function storePageData(){
	window.name='lookhigher.net,'+versionName+','+referenceBook+','+referenceChapter+','+document.getElementById('navversion').scrollTop+','+document.getElementById('navbook').scrollTop+','+document.getElementById('navchapter').scrollTop+','+fetchAnchor()+','+document.forms[0].elements['q'].value;
	}

// calculate the base URL for the site
function giveBaseURL(){
baseURL='';
var docloc=document.location+' ';
if(docloc.indexOf('englishbibles')!=-1){
	baseURL=docloc.substr(0,docloc.indexOf('englishbibles'));
	} else {
	if(docloc.indexOf('index')!=-1){baseURL=docloc.substr(0,docloc.indexOf('index'));}
	if(docloc.indexOf('error')!=-1){baseURL=docloc.substr(0,docloc.indexOf('error'));}
	}
if(baseURL==''){baseURL='http://lookhigher.net/';}
}
giveBaseURL();

 // this function prints out the HTML for the banner
function printBanner(){
	if(screen.height>975) {
	document.write('<img src="'+baseURL+'englishbibles/images/bannerhistoriclarge.jpg" class="large" alt="Look Higher ! - 200 English Bibles Online" title="">');
	} else {
	document.write('<img src="'+baseURL+'englishbibles/images/bannerhistoricmedium.jpg" class="medium" alt="Look Higher ! - 200 English Bibles Online" title="">');
	};
	}

// this function prints out the search form
function printSearchForm(){
	document.write('<form action="http://lookhigher.net/englishbibles/searchresults.php" method="get" autocomplete="off" onsubmit="storePageData()\; if(document.forms[0].elements[\'q\'].value==\'\'){return false}\;"><table><tr><td class="searchtablecell1"><input type="text" name="q" value="" maxlength="255" size="40"></td><td class="searchtablecell2"><ul><li><a href="#" onclick="document.forms[0].submit();">Search this version</a></li></ul><input type="hidden" name="p" value="1"><input type="hidden" name="v" value=""></td></tr></table></form>');
	document.forms[0].elements['q'].value=lastSearch;
	document.forms[0].elements['v'].value=versionName;
	}

// this function prints out the navigation panel
function printVersions(){
	document.write('<ul><li><a href="#" id="americanstandardversion" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">American Standard Version<br>1901 Philip Schaff</a></li><li><a href="#" id="corpusanglosaxongospels" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">Anglo-Saxon Gospels<br>Corpus Christi Manuscript 140<br>circa 1000 Aelfric</a></li><li><a href="#" id="hattonanglosaxongospels" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">Anglo-Saxon Gospels<br>Hatton Manuscript 38<br>circa 1200 unknown author</a></li><li><a href="#" id="thebibleanewtranslation" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">The Bible A New Translation<br>Darby Version<br>1890 John Darby</a></li><li><a href="#" id="thebishopsbible" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">The Bishops\' Bible<br>1568 Matthew Parker</a></li><li><a href="#" id="brentontranslation" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Brenton Translation<br>1851 Lancelot Brenton</a></li><li><a href="#" id="calvinbible" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Calvin Bible<br>1855 Calvin Translation Society</a></li><li><a href="#" id="coverdalebible" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Coverdale Bible<br>1535 Miles Coverdale</a></li><li><a href="#" id="theemphasisedbible" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">The Emphasised Bible<br>Rotherham Version<br>1902 Joseph Rotherham</a></li><li><a href="#" id="theemphaticdiaglott" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">The Emphatic Diaglott<br>(Interlinear Text)<br>1865 Benjamin Wilson</a></li><li><a href="#" id="englishtranslationofthebible" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">English Translation of the Bible<br>Mace New Testament<br>1729 Daniel Mace</a></li><li><a href="#" id="etheridgetranslation" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Etheridge Translation<br>1849 John Etheridge</a></li><li><a href="#" id="thegenevabible" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">The Geneva Bible<br>1587 William Whittingham</a></li><li><a href="#" id="theholyscriptures" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">The Holy Scriptures<br>JPS Translation<br>1917 Max Margolis</a></li><li><a href="#" id="kingjamesversion1611" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">King James Version<br>Authorized Version<br>1611 Miles Smith</a></li><li><a href="#" id="kingjamesversion1769" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">King James Version<br>Authorized Version<br>1769 Benjamin Blayney</a></li><li><a href="#" id="kingjamesversion1850" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">King James Version<br>Authorized Version<br>1850 Committee</a></li><li><a href="#" id="theleeserbible" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">The Leeser Bible<br>1853 Isaac Leeser</a></li><li><a href="#" id="livingoracles" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Living Oracles<br>1835 George Campbell</a></li><li><a href="#" id="mrwhistonsprimitivenewtestament" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">Mr. Whiston\'s<br>Primitive New Testament<br>1745 William Whiston</a></li><li><a href="#" id="murdocktranslation" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Murdock Translation<br>1851 James Murdock</a></li><li><a href="#" id="thenewtestamentanamericantranslation" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">The New Testament<br>An American Translation<br>1923 Edgar Goodspeed</a></li><li><a href="#" id="newtestamentinmodernspeech" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">New Testament in Modern Speech<br>Weymouth New Testament<br>1912 Richard Weymouth</a></li><li><a href="#" id="americanbibleunionthenewtestament" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">The New Testament of<br>Our Lord and Savior Jesus Christ<br>1865 American Bible Union</a></li><li><a href="#" id="thenewtestamentrevisedandtranslated" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">The New Testament<br>Revised and Translated<br>1904 Adolphus Worrell</a></li><li><a href="#" id="thenewtestamenttranslatedfromtheoriginal" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">The New Testament Translated<br>from the Original Greek<br>1858 Leicester Sawyer</a></li><li><a href="#" id="thenewtestamenttranslatedfromthesinaitic" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">The New Testament Translated<br>from the Sinaitic Manuscript<br>1918 Henry Anderson</a></li><li><a href="#" id="noyestranslation" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Noyes Translation<br>1869 George Noyes</a></li><li><a href="#" id="revisedversion" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">Revised Version<br>English Revised Version<br>1885 Charles Ellicott</a></li><li><a href="#" id="godbeytranslationofthenewtestament" onmouseover="this.href=getNewUrl(this.id)\;" class="v3">Translation of the New Testament<br>from the Original Greek<br>1902 William Godbey</a></li><li><a href="#" id="twentiethcenturynewtestament" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Twentieth Century New Testament<br>1904 Ernest Malan</a></li><li><a href="#" id="tyndalebible" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Tyndale Bible<br>1534 William Tyndale</a></li><li><a href="#" id="websterversion" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Webster Version<br>1833 Noah Webster</a></li><li><a href="#" id="wesleyversion" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Wesley Version<br>1790 John Wesley</a></li><li><a href="#" id="worsleyversion" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Worsley Version<br>1770 John Worsley</a></li><li><a href="#" id="wycliffebible" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Wycliffe Bible<br>1395 John Wycliffe</a></li><li><a href="#" id="youngsliteraltranslation" onmouseover="this.href=getNewUrl(this.id)\;" class="v2">Young\'s Literal Translation<br>1898 Robert Young</a></li></ul>');
	}

// this function prints out the panel with the OT books available in the current version
function printOT(){
	var thishtml='<ul>';
	if(isInArray(versionName,partialList)){
		newarray=eval(versionName).ot;
		for(i=0;i<otBookList.length;i++){
			if(isInArray(otBookList[i],newarray)){
			//print normal button
			thishtml=thishtml+'<li><a href="'+baseURL+'englishbibles/'+versionName+'/'+otBookList[i]+'/1.html" id="b'+otBookList[i]+'">'+bookData[otBookList[i]][0]+'</a></li>';
			} else {
			//print grayed out button
			thishtml=thishtml+'<li><a href="#" id="b'+otBookList[i]+'" class="gray">'+bookData[otBookList[i]][0]+'</a></li>';
			};
			}
		} else { // not partial
		if(isInArray(versionName,otStdList)){
			for(i=0;i<otBookList.length;i++){
				thishtml=thishtml+'<li><a href="'+baseURL+'englishbibles/'+versionName+'/'+otBookList[i]+'/1.html" id="b'+otBookList[i]+'">'+bookData[otBookList[i]][0]+'</a></li>';
				};
			} else {
				if(isInArray(versionName,otJewishList)){
					for(i=0;i<otJewishBookList.length;i++){
					thishtml=thishtml+'<li><a href="'+baseURL+'englishbibles/'+versionName+'/'+otJewishBookList[i]+'/1.html" id="b'+otJewishBookList[i]+'">'+bookData[otJewishBookList[i]][0]+'</a></li>';
					};
				} else {
				for(i=0;i<otBookList.length;i++){
				thishtml=thishtml+'<li><a href="#" id="b'+otBookList[i]+'" class="gray">'+bookData[otBookList[i]][0]+'</a></li>';
				};
				}
			};
		};
	thishtml=thishtml+'</ul>';
	document.write(thishtml);
	}

// this function prints out the panel with the NT books available in the current version
function printNT(){
	var thishtml='<ul>';
	if(isInArray(versionName,partialList)){
		newarray=eval(versionName).nt;
		for(i=0;i<ntBookList.length;i++){
			if(isInArray(ntBookList[i],newarray)){
			//print normal button
			thishtml=thishtml+'<li><a href="'+baseURL+'englishbibles/'+versionName+'/'+ntBookList[i]+'/1.html" id="b'+ntBookList[i]+'">'+bookData[ntBookList[i]][0]+'</a></li>';
			} else {
			//print grayed out button
			thishtml=thishtml+'<li><a href="#" id="b'+ntBookList[i]+'" class="gray">'+bookData[ntBookList[i]][0]+'</a></li>';
			};
			}
		} else {
		if(isInArray(versionName,ntStdList)){
			for(i=0;i<ntBookList.length;i++){
				thishtml=thishtml+'<li><a href="'+baseURL+'englishbibles/'+versionName+'/'+ntBookList[i]+'/1.html" id="b'+ntBookList[i]+'">'+bookData[ntBookList[i]][0]+'</a></li>';
				};
		} else {
		for(i=0;i<ntBookList.length;i++){
				thishtml=thishtml+'<li><a href="#" id="b'+ntBookList[i]+'" class="gray">'+bookData[ntBookList[i]][0]+'</a></li>';
				};	
		};
	};
	for(k=0;k<12;k++){
		thishtml=thishtml+'<li><a href="#" class="blank">&nbsp;</a></li>'; 
		};
	thishtml=thishtml+'</ul>';
	document.write(thishtml);
	}
 
 
// this function prints out the panel with the chapters available in the current book
function printChapters(){
document.write('<ul>');
	if(typeof(sitemap)=='undefined'){
		if(document.getElementById('b'+referenceBook).className!='gray'){
			for(i=1;i<=bookData[referenceBook][1];i++){
				document.write('<li><a href="'+baseURL+'englishbibles/'+versionName+'/'+referenceBook+'/'+i+'.html" id="c'+i+'">'+i+'</a></li>');
				};
			} else {
			for(i=1;i<=bookData[referenceBook][1];i++){
				document.write('<li><a href="#" id="c'+i+'" class="gray">'+i+'</a></li>');
				};
			};
		};
	document.write('</ul>');
	}
	
function getWindowHeight(){
	var winHeight=window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
	return winHeight;
	}

// function that adjusts the height of the divs if the user resizes the window
function doLayout(){
	newheight=getWindowHeight()-48-document.images[0].height;
	if(newheight<325){newheight=325;};
	if(newheight>742){newheight=742;};
	document.getElementById('navversion').style.height=newheight + "px";
	document.getElementById('navbook').style.height=newheight + "px";
	document.getElementById('navchapter').style.height=newheight + "px";
	document.getElementById('contentdiv').style.height=newheight + "px";
	}

function initialize(){
	if(typeof(dontscroll)=="undefined") {
		anchorsOffsetList=[];
		var anchor=1;
		while(document.getElementById('v'+anchor)!=null){anchorsOffsetList[anchor]=document.getElementById('v'+anchor).offsetTop; anchor++;};

		if(typeof(scrollVersion)=='undefined'){scrollVersion=document.getElementById(versionName).offsetTop-2;};
		if(typeof(scrollBook)=='undefined'){scrollBook=document.getElementById('b'+referenceBook).offsetTop-2;};
		if(typeof(scrollChapter)=='undefined'){scrollChapter=document.getElementById('c'+referenceChapter).offsetTop-2;};

		// make sure buttons will be in view, otherwise change the scroll points
		//if(document.getElementById('b'+referenceBook).offsetTop<scrollBook||document.getElementById('b'+referenceBook).offsetTop>scrollBook-(-divheight)){ scrollBook=document.getElementById('b'+referenceBook).offsetTop; }
		//if(document.getElementById('c'+referenceChapter).offsetTop<scrollChapter||document.getElementById('c'+referenceChapter).offsetTop>scrollChapter-(-divheight)){ scrollChapter=document.getElementById('c'+referenceChapter).offsetTop; }

		if(referenceChapter==1&&referenceBook!=lastReferenceBook){scrollChapter=0;}

		document.getElementById(versionName).className+=" selected";
		document.getElementById('b'+referenceBook).className+=" selected";
		document.getElementById('c'+referenceChapter).className+=" selected";

		var offset=document.getElementById('corpusanglosaxongospels').offsetTop;
		offset=document.getElementById('bexodus').offsetTop;

		document.getElementById('navbook').scrollTop=scrollBook;
		document.getElementById('navchapter').scrollTop=scrollChapter;
		document.getElementById('navversion').scrollTop=scrollVersion;
		};
	}

window.onload=initialize;
var windowHeight=getWindowHeight();
var picheight;
if(screen.height>975){ picheight=363;} else {picheight=182;}
divheight=windowHeight-48-picheight;
if(divheight<325){divheight=325;};
if(divheight>742){divheight=742;};
document.write('<style type="text/css">#navversion, #navbook, #navchapter, #contentdiv { height: '+divheight+'px\; }</style>');