/* various variables used in some page(s) */
	var forumURL="http://www.goodnewsbiblechurch.org/tinc?key=qOQwDWSD&start=-1&reverse=1";
/* used for the intro; flashes letters onto screen */
	function flashSpan(spid) {
		var it = document.getElementById(spid);
		it.style.background="#000000";
		it.style.visibility="visible";
		setTimeout("document.getElementById('" + spid + "').style.color='#ffffff'",50);
		setTimeout("document.getElementById('" + spid + "').style.background='#ffffff'",100);
		setTimeout("document.getElementById('" + spid + "').style.background='transparent'",150);
		setTimeout("document.getElementById('" + spid + "').style.color='#000000'",200);
	}

/* makes the three top menus in gnbc.html disappear; boolean is for frames */
	function killmenus() {
		document.getElementById("menu1").style.visibility='hidden';
		document.getElementById("menu2").style.visibility='hidden';
		document.getElementById("menu3").style.visibility='hidden';
	}

/* scrolling functions for side menu */

	var scrolling=false;

	/*-     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -   */

	function scrollDown() {	
		if(scrolling) {
			document.getElementById('leftLinkCell').scrollTop=document.getElementById('leftLinkCell').scrollTop+2;
			setTimeout("scrollDown()", 1);
		}
	}

	/*-     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -   */

	function scrollUp() {
		if(scrolling) {
			document.getElementById('leftLinkCell').scrollTop=document.getElementById('leftLinkCell').scrollTop-2;
			setTimeout("scrollUp()", 1);
		}
	}

	/*-     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -   */

	function startScroll() {
		scrolling=true;
	}

	function stopScroll() {
		scrolling=false;
	}

	/*-----------------------------------------------------------------------       ------------------------------*/

var bodyScroll;
	function scrollBodyDown() {	
		if(bodyScroll) {
			document.documentElement.scrollTop=document.documentElement.scrollTop+2;
			setTimeout("scrollBodyDown()", 1);
		}
	}

	/*-     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -   */

	function scrollBodyUp() {
		if(bodyScroll) {
			document.documentElement.scrollTop=document.documentElement.scrollTop-2;
			setTimeout("scrollBodyUp()", 1);
		}
	}

	/*-     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -     -   */

	function startBodyScroll() {
		bodyScroll=true;
	}

	function stopBodyScroll() {
		bodyScroll=false;
	}

/* end scroll functions */

/* functions for manipulating side menus */

	var numMenus;
	var numNews;
	var mPosition=-100;
	var prefix;

	function initiateMenus(prefi,lNumb,nNumb) {
		numMenus=lNumb;
		numNews=nNumb;
		prefix=prefi;
	}

	function hideMenus() {
		var mName;
		for(i=1; i<=numMenus; i++) {
			mName=("" + prefix + "" + i + "");
			linkFrame.document.getElementById(mName).style.visibility='hidden';
		}
		for(g=1; g<=numNews; g++) {
			var idnum = (g + 100);
			var nName=("" + prefix + "" + idnum + "");
			linkFrame.document.getElementById(nName).style.visibility='hidden';
		}
	}

	function showMenu(numbe) {
		var mName;
		hideMenus();
		mName=("" + prefix + "" + numbe + "");
		linkFrame.document.getElementById(mName).style.visibility='visible';
	}

	function moveMenuOut() {
		document.getElementById("leftmenuskeleton").style.posLeft=mPosition;
		if(mPosition>-100) {
			mPosition=mPosition-10;
			setTimeout("moveMenuOut()",10);
		}
	}

	function moveMenuIn() {
		document.getElementById("leftmenuskeleton").style.posLeft=mPosition;
		if(mPosition<0) {
			mPosition=mPosition+10;
			setTimeout("moveMenuIn()",10);
		}
	}

	function changeMenu(numbre) {
		moveMenuOut();
		setTimeout("showMenu(" + numbre + ")",300);
		setTimeout("linkFrame.document.body.scrollTop=0",325);
		setTimeout("moveMenuIn()",350);
	}

/* function called by the mainFrame page lika dis: "parent.initiatePage(x)" */
var mie;
var currentPageName;
var currentMenuNumber;
	function setVariables() {
		if(navigator.appName.indexOf("Netscape")!=-1)
			mie=false;
		else
			mie=true;		
	}
	function initiatePage(titler,numb) {
		setVariables();
		currentPageName=titler;
		currentMenuNumber=numb;
		document.title=(titler + " - Good News Bible Church");
		if (!mie) {
			mainFrame.document.body.style.marginLeft=0;
		}
		else {
			killmenus();
		}
		if(numb==60647)
			makeNews();
			else if(numb<1 || (numb>numMenus && numb<(numNews+100)) || numb>(numNews+100)) {
				if(mie)
					moveMenuOut();
				else
					hideMenus();
			}
				else {
					if(numb>=1 && numb<=numMenus)
						showHistory(numb);
					if(mie)
						changeMenu(numb);
					else {
						showMenu(numb);
					}
				}
	}

/* end menu functions */
/* start news ticker functions */

var loopStop = true;
var newsItems;

	function stopNews() {
		loopStop=true;
	}

	/* decides what to do based on number of news menus */
	function makeNews() {
		newsItems=1;
		loopStop=false;
		if(numNews==0) {
			if(mie)
				moveMenuOut();
			else
				hideMenus();
		}
			else if(numNews==1) {
				if(mie)
					changeMenu(101);
				else
					showMenu(101);
			}
				else
					newsLoop();
	}

	/* loops and rotates the menus */
	function newsLoop() {
		if(!loopStop) {
			if(newsItems>numNews)
				newsItems=1;
			var newsNum = newsItems + 100;
			if(mie)
				changeMenu(newsNum);
			else
				showMenu(newsNum);
			newsItems++;
			setTimeout("newsLoop()",8000);
		}
	}	
/* end news functions */
/* history link bar functions */
	var preHist;

	function setHistPre(namee) {
		preHist=namee;
	}

	function showHistory(numb) {
		hideHistories();
		var namer = ("" + preHist + "" + numb + "");
		document.getElementById(namer).style.visibility="visible";
	}

	function hideHistories() {
		for(l=1; l<=numMenus; l++) {
			var namer = ("" + preHist + "" + l + "");
			document.getElementById(namer).style.visibility="hidden";
		}
	}

/* end history functions */

/* miscellaneous tools */

	/* toggles the visibility of an object whose id is the parameter */
		function toggleVisibility(iden) {
			var obje=document.getElementById(iden).style.visibility;
			if(obje=="visible")
				obje="hidden";
			else if(obje="hidden")
				obje="visible";
			else obje="visible";
			document.getElementById(iden).style.visibility=obje;
		}

	/* pops a popup window with title and content as parameters */
		function popit(idate,imessage) {
			var popi = window.open("","_","width=600,height=450,top=50,left=50,resizable,scrollbars");
			popi.document.open("text/html","replace");
			popi.document.write("<html><head><title>" + idate + "</title><link rel='stylesheet' type='text/css' href='gnbc_standard.css' /><style>body \{ background-color:#eecdcd \}</style></head><body class='noMargin'>" + imessage + "</body></html>");
			popi.document.close();
		}

	/* pops a popup window with the parameter as the web doc source */
		function popThis(ilocation) {
			window.open(ilocation,"","width=600,height=450,top=50,left=50,resizable,scrollbars");
		}

/* end miscellaneous tools */