// bibletext.js
// by Malcolm Lyon
//
// JavaScript used to display popup bible texts in articles and in the daily devotion component

function biblePopupCreate()
{
	var pobj = document.createElement('div');
	pobj.setAttribute('id', 'popup');
	pobj.setAttribute('class', 'dd_bibletext');
	pobj.setAttribute('onclick', 'biblePopupHide();');
	pobj.setAttribute('style', 'top:0px; left:0px; visibility:hidden;');
	document.getElementById('wrap').appendChild(pobj);
	return;
}

function biblePopupHide()
{
	document.getElementById("popup").style.visibility = "hidden";
	return;
}

function biblePopupShow(e,text,ref)
{
	// Check that the popup div exists - if not, create it
	if (!document.getElementById('popup')) biblePopupCreate();

	var pobj = document.getElementById('popup');
	if (!e) var e = window.event;
	pobj.style.left = (e.clientX - 200) + 'px';
	pobj.style.top = (e.clientY - 20) + 'px';
	pobj.innerHTML = "<p style='color:gray; font-weight:bold;'>"+ref+"</p>"+text;
	pobj.style.visibility = "visible";
	return;
}

