// Bible global variables and functions
//=================================================
// global variable for the bcv present on the palette
var biblebcvshowing="bibleblank";
//=================================================
// global variable indicating whether the palette is open (it starts off closed ... i.e., false)
var bibleisopen=false;
//=================================================
// function to create the top of the table containing the following three columns:
// 1 - space for the Bible palette
// 2 - unique page content
// 3 - and Bible text reference links
function bTableTop()
{
document.write('<div class=bh onclick="bClose()" id="bibleblank"><center>Bible Palette</center><br><ul><li>To display Bible text on this palette, point (no need to click) at any of the green Bible reference links.</li><br><br><li>Optionally, click anywhere on this palette to close it.</li></ol></div>')
document.write('<table align="center" width="100%" border="0" cellspacing="7" cellpadding="0">')
document.write('<tr>')
document.write('<td width="240">&nbsp;</td>')
document.write('<td width="*">&nbsp;</td>')
document.write('<td width="185"><hr noshade size="1"><a href="javascript:bOpen();">Click Here</a> <small>to open the Bible palette if you would like to view the actual text for any of the Bible references, below.</small><hr noshade size="1"></td>')
document.write('</tr>')
}
//=================================================
// function to create an individual Bible text reference link inside the table
function bLink(bcv)
{
document.write('<a href="javascript:void(0);" onmouseover="bDisplay(\'' + bcv + '\');">' + bcv + '</a><br>')
}
// =================================================
// function to open the palette
function bOpen()
{
if (bibleisopen)
	{
	bHide();	 				  // hide the bcv currently showing
	}
bibleisopen=true;					  // indicate the Bible palette is open
biblebcvshowing="bibleblank";		  // indicate the blank palette is to show
bRepos();						  // reposition the bcv on the window
bShow();						  // show the bcv
}
// =================================================
// function to close the palette
function bClose()
{
bHide();		 	 	   		  // hide the bcv currently showing
biblebcvshowing="bibleblank";		  // indicate nothing is showing
bibleisopen=false;					  // indicate the Bible palette is closed
}
// =================================================
// function to display a bcv in the palette
// 1) hide the visible bcv (if one was visible)
// 2) set the name of the bcv to show next
// 3) reposition the new bcv to the screen area
// 4) make the new bcv visible
// upon input, biblebcvshowing contains the bcv currently showing (if any)
function bDisplay(biblebcvrequested)
{
if (bibleisopen)
	{
	bHide();		 				  // hide the bcv currently showing (if any)
	biblebcvshowing=biblebcvrequested;	  // indicate the one is to now show
	bRepos();						  // reposition the bcv on the window
	bShow();						  // show the bcv
	}
}
// =================================================
// sub-function to hide the contents of the palette
function bHide()
{
if (bibleisopen)
	{
		if (navigator.appName == "Netscape")
		{document.getElementById(biblebcvshowing).style.visibility = 'hidden';}
		else
		{document.all[biblebcvshowing].style.visibility = 'hidden';}
	}
}
// =================================================
// sub-function to reposition the bcv to appear within the palette
//		   function for stationary layer originally came from
//		   Randy Bennett (rbennett@thezone.net)
//		   http//home.thezone.net/~rbennett/utility/javahead.htm
function bRepos()
{
if (bibleisopen)
	{
	imgheight=440;  // layer height, in pixels
	if (navigator.appName == "Netscape")
	   {
	   availableY=window.innerHeight;			 // height of window
	   currentY=window.pageYOffset; 	 		 // distance from top of document to top of window
	   document.getElementById(biblebcvshowing).style.top = currentY+((availableY-imgheight)/2);
	   }
	   else
	   {
	   availableY=document.body.clientHeight;	 // height of window
	   currentY=document.body.scrollTop;		 // distance from top of document to top of window
	   document.all[biblebcvshowing].style.top = currentY+((availableY-imgheight)/2);
	   }
	window.setTimeout('bRepos()',100);		 // re-execute after 100 milliseconds
	}
}
// =================================================
// sub-function to make the bcv visible in the palette
function bShow()
{
if (navigator.appName == "Netscape")
	{document.getElementById(biblebcvshowing).style.visibility = 'visible';}
	else
	{document.all[biblebcvshowing].style.visibility = 'visible';}
}
// =================================================
