function bible_link(s) 
{
	var url = 'http://www.gnpcb.org/esv/mobile/?q='
    document.location.href = (url + s.replace(/ /g, '+'));
}

function writeCookie(name,value,days) 
{
	var date = new Date();
	date.setDate(date.getDate()+days);
	var expires = days ? "; expires="+date.toGMTString() : "";
	document.cookie = name+"="+escape(value)+expires;
}

function readCookie(name) 
{
	var ret;
	var results = document.cookie.match ( '(^|;) ?' + name + '=([^;]*)(;|$)' );

	if ( results )
		ret = unescape(results[2]);

    return ret;
}

var proofs=0;

function setProofs(val) 
{
	proofs = val;
	showProofs(val);
}

function toggleProofs() 
{
	var val = (proofs == 1) ? 0 : 1; 
	setProofs(val);
	writeCookie('ccrc2', val, 10);
}

function showProofs(val) 
{
	var s = (val == 1) ? "inline" : "none";
	var e = document.getElementsByTagName("div");
	for (var i = 0; i < e.length; i++ ) {
		if( e[i].className == "prftxts" || e[i].className == "tbnav") {
			e[i].style.display = s;
		}
	}
	
	e = document.getElementsByTagName("sup");
	for (var i = 0; i < e.length; i++ ) {
		e[i].style.display = s;
	}
}

function doSearch(s) {
	var url = "search.cgi?scope=cur&doc=" + s;
	document.location.href=url;
}

function jumpTo(s) {
	setTimeout("window.location.hash='" + s + "'", 50);
}

function onLoad() 
{
	proofs = readCookie('ccrc2') 
	showProofs( proofs );
}

