// JavaScript Document

<!-- hide this script from non-javascript-enabled browsers
 
if (document.images) {
 
 AboutOn = new Image(77,28);
 MinistriesOn = new Image(76,28);
 PrayerOn = new Image(113,28);
 OutreachOn = new Image(69,28);
 EventsOn = new Image(54,28);
 AudioOn = new Image(46,28);
   
 AboutOn.src = "/common/images/about_over.gif";
 MinistriesOn.src = "/common/images/ministries_over.gif";
 PrayerOn.src = "/common/images/prayer_over.gif";
 OutreachOn.src = "/common/images/outreach_over.gif";
 EventsOn.src = "/common/images/events_over.gif";
 AudioOn.src = "/common/images/audio_over.gif";
 
 
 AboutOff = new Image(77,28);
 MinistriesOff = new Image(76,28);
 PrayerOff = new Image(113,28);
 OutreachOff = new Image(69,28);
 EventsOff = new Image(54,28);
 AudioOff = new Image(46,28);

 
 AboutOff.src = "/common/images/about_btn.gif";
 MinistriesOff.src = "/common/images/ministries_btn.gif";
 PrayerOff.src = "/common/images/prayer_btn.gif";
 OutreachOff.src = "/common/images/outreach_btn.gif";
 EventsOff.src = "/common/images/events_btn.gif";
 AudioOff.src = "/common/images/audio_btn.gif";
}
 
function swap(id,name){
  if (document.images) {
 document.images[id].src=eval(name+".src");
   }
}
 
// stop hiding -->


<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->

<!--

  function show(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=16; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}

function insertContent(id) {
	var ele = document.getElementById('mainContentContainer');
	var kids = ele.childNodes;
	for (i = 0; i < kids.length; i++) {
	if (i==id) {document.getElementById('childElement' +id).style.display='block';}
	else
	{
	 document.getElementById('childElement' +i).style.display='none';
	}
  }
}
	
function pageRequest(serverPage, objId) {
var xmlhttp = false;

//check to see what browser is being used
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
//alert("Internet Explorer.");
} catch (e) {
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		//alert("Internet Explorer.");
	} catch (e) {
		xmlhttp = false;
	}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	xmlhttp = new XMLHttpRequest();
	//alert("Using a non-Microsoft Browser.");
}

	var obj = document.getElementById('childElement' +objId);
	
	//Set parent element & get child nodes
	var ele = document.getElementById('mainContent');
	var kids = ele.childNodes;
	//figure out which element to display & elements to hide
	for (var i=1; i < kids.length; i++) {
	if (i==objId) {document.getElementById('childElement' +i).style.display='block';}
	else
	{
		document.getElementById('childElement' +i).style.display='none';
	}
  }
	//xmlhttp.open("GET", serverPage, true);
	xmlhttp.open("GET", serverPage, true);
    
	xmlhttp.onreadystatechange = function() {
		document.getElementById('childElement' +objId).innerHTML = xmlhttp.responseText;
	}
	xmlhttp.send(null);
}

//-->

<!--

var pagePrint

if (document.images) 
{
	collapsed = new Image(10,10); collapsed.src = "/sitemanager/lib/images/collapsed.gif";
	expanded = new Image(10,10); expanded.src = "/sitemanager/lib/images/expanded.gif";
}

// initialize global var for new window object
//   so it can be accessed by all functions on the page 

	var newWind;

// set flag to help out with special handling for window closing //

	var isIE3 = (navigator.appVersion.indexOf("MSIE 3") != -1) ? true : false;

function openWindow(fileUrl,winWidth,winHeight){

	// close subwindow, including ugly workaround for IE3 //

	if (isIE3) {

	// if window is already open, nothing appears to happen //
	//   but if not, the subwindow flashes momentarily (yech!) //
	   
		newWind = window.open("","subwindow",'HEIGHT=' + winWidth + ',WIDTH=' + winHeight);
        }
        if (newWind && !newWind.closed) {
                newWind.close();
        }

	// make the new window and put some stuff in it //
	
	newWind=window.open(fileUrl,"subwindow",'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + winWidth + ',height=' + winHeight);
}

function enlargeImage(image,winWidth,winHeight){

	fileUrl="/common/php/enlarge_image.php?IMG=" + image;
	
	openWindow(fileUrl,winWidth,winHeight);
}

function printThis(docURL){
	
	URL='/common/php/pageprint.php?' + docURL;
	openWindow(URL,'640','480');
	
}

function mailThis(docURL){
	
	URL='/common/php/email_site.php?' + docURL;
	openWindow(URL,'640','480');

}

// This next little bit of code tests whether the user accepts cookies.
function checkCookie() {
	var acceptsCookies = false;
	if(document.cookie == '') {
	    document.cookie = 'acceptsCookies=yes'; // Try to set a cookie.
	    if(document.cookie.indexOf('acceptsCookies=yes') != -1) {
		acceptsCookies = true;
		//setCookie("acceptsCookies","true","","/","",""); 
		var cookiesEnabled=true;
	    }// If it succeeds, set variable
	} else { // there was already a cookie
	  acceptsCookies = true;
	}
	return(acceptsCookies);
}

function setCookie(name,value,expires,path,domain,secure) {
    if (cookiesEnabled) { // Don't waste your time if the browser doesn't accept cookies.
	
	    document.cookie = name + "=" +escape(value) +
    	    ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        	( (path) ? ";path=" + path : "") + 
        	( (domain) ? ";domain=" + domain : "") +
        	( (secure) ? ";secure" : "");
    }
}

function readCookie(name) {
    if(document.cookie == '') { // there's no cookie, so go no further
	return false; 
    } else { // there is a cookie
	var firstChar, lastChar;
	var theBigCookie = document.cookie;
	firstChar = theBigCookie.indexOf(name);	// find the start of 'name'
	var NN2Hack = firstChar + name.length;
	if((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=')) { // if you found the cookie
	    firstChar += name.length + 1; // skip 'name' and '='
	    lastChar = theBigCookie.indexOf(';', firstChar); // Find the end of the value string (i.e. the next ';').
	    if(lastChar == -1) lastChar = theBigCookie.length;
	    return unescape(theBigCookie.substring(firstChar, lastChar));
	} else { // If there was no cookie of that name, return false.
	    return false;
	}
    }	
} // readCookie

function killCookie(name, path, domain) {
  var theValue = readCookie(name); // We need the value to kill the cookie
  if(theValue) {
      document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:''); // set an already-expired cookie
  }
} // killCookie

function expandAll()
{
	var allDivs = document.getElementsByTagName('div');
	for(var i = 0; i < allDivs.length; i++)
	{
		var divId = allDivs[i].getAttribute('id');
		if(divId)
		{
			var thisDiv  = document.getElementById(divId);
			if(thisDiv.className == "collapsed")
			{
				thisDiv.className = "expanded";
		    	var imgId='img' + divId;
		    	if (document.images) {
					document.images[imgId].src=collapsed.src;
			  	}
			}
		}
	}
}

function collapseAll()
{
	var allDivs = document.getElementsByTagName('div');
	for(var i = 0; i < allDivs.length; i++)
	{
		var divId = allDivs[i].getAttribute('id');
		if(divId)
		{
			var thisDiv  = document.getElementById(divId);
			if(thisDiv.className == "expanded")
			{
				thisDiv.className = "collapsed";
		    	var imgId='img' + divId;
		    	if (document.images) {
					document.images[imgId].src=expanded.src;
			  	}
			}
		}
	}
}

function showHide(layerId)
{
	var theLayer = document.getElementById(layerId);
	var imgId='img' + layerId;
	if(theLayer.style.display != null)
	{
		if(theLayer.className == "collapsed")
		{
			theLayer.className = "expanded";
	    	if (document.images) {
				document.images[imgId].src=collapsed.src;
		  	}
			return;
		}
		if(theLayer.className == "expanded")
		{
			theLayer.className = "collapsed";
	    	if (document.images) {
				document.images[imgId].src=expanded.src;
		  	}
			return;
		}
	}
}

function checkFlash() { //v4.0
  var plgIn='Shockwave Flash';
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=false; }
  return ok;
}

var cookiesEnabled=checkCookie();

//-->