// JavaScript Document
<!--
var time = 3000;
var numofitems = 7;

//menu constructor
function menu(allitems,thisitem,startstate){ 
  callname= "gl"+thisitem;
  divname="subglobal"+thisitem;  
  this.numberofmenuitems = 7;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

//menu methods
function ehandler(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
    var shutdiv =eval( "menuitem"+i+".thediv");
    shutdiv.style.visibility="hidden";
  }
  theobj.thediv.style.visibility="visible";
}
				
function closesubnav(event){
  if ((event.clientY <48)||(event.clientY > 107)){
    for (var i=1; i<= numofitems; i++){
      var shutdiv =eval('menuitem'+i+'.thediv');
      shutdiv.style.visibility='hidden';
    }
  }
}

function toggleSection(cSecName){
	cSecName = 'DIV'+cSecName;
	var oElem = document.getElementById(cSecName);	
	//oElem.style.display = (oElem.style.display == 'none') ? '' : 'none'; 
	if(oElem.style.display == 'none'){
		oElem.style.display = '';
		writeCookie(cSecName,'open',12);
	}else{
		oElem.style.display = 'none';
		delete_cookie(cSecName);
	}
}

function toggleSection2(cSecName){
	var oElem = document.getElementById(cSecName);	
	oElem.style.display = (oElem.style.display == 'none') ? '' : 'none'; 
	oElem.style.visibility = (oElem.style.visibility == 'hidden') ? 'visible' : 'hidden'; 
}
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function initPage(){
	var oSecArray = new Array('basics','ministries','extras');
	for(var i=0; i<oSecArray.length; i++){
		var cVal = readCookie(oSecArray[i]);
		if(cVal!='' && cVal!=null) toggleSection(oSecArray[i]);
	}
	MM_reloadPage(true);
	return false;
}

function ywcMessage(){
	if(confirm('You will be prompted to enter security information, Please type in the following when prompted.\nUser Name = shiloh\nPassword = baptist')){
		window.open('http://www.mccree.com/shiloh_baptist_church/');
		//location.href = 'http://www.mccree.com/shiloh_baptist_church/'
	}
}

// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

function delete_cookie (cookie_name)
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}

// -->
