//
// ChristianityToday.com JavaScript
// Version 1.1
// Copyright © 2006 Christianity Today International
//

// variables
	// user-agent identity
	var version = parseInt(navigator.appVersion);
	var isNS  = (navigator.appName.indexOf('Netscape') >= 0);
	var isNS4 = (isNS && version == 4);
	var isNS5 = (isNS && version > 4);
	var isFF  = (navigator.userAgent.indexOf('Firefox') >= 0);
	var isIE  = !isNS;
	var isIE4 = (isIE && version == 4);
	var isIE5 = (isIE && version > 4);
	var isMac = (navigator.appVersion.indexOf('Macintosh') >= 0);
	var isWin = !isMac;
	var isAOL = (navigator.userAgent.indexOf('AOL') >= 0);

	// Flash detection; minimum: version 4.0
	var flashVersion = 0;
	for (var i = 4; i <= 10; i++)
	{
		if (isIE)
		{
			document.write('<script language="VBScript" type="text/vbscript">\n');
			document.write('On Error Resume Next\n');
			document.write('CreateObject("ShockwaveFlash.ShockwaveFlash." & i)\n');
			document.write('If Err = 0 Then\n');
			document.write('flashVersion = i\n');
			document.write('End If\n');
			document.write('</script>\n');
		}
		else
		{
			var plugin = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin;
			if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf('.') - 1)) >= i)
			{
				flashVersion = i;
			}
		}
	}

	// events
	var clickURL;
	var mouseX = 0;
	var mouseY = 0;
	var pageWidth = 0;
	var pageHeight = 0;
	
	// settings
	var menuDelay = 100;
	var allowFrame = true;
	var menuDivArray = new Array('globalMenu', 'channelMenu');

	// page tools
	var windowArray = new Array();
	var pageURL = (window != top) ? document.referrer : location.href;
	var emailURL = '/utilities/email.html?title=%%title%%&url=%%url%%';
	var printURL = '/utilities/print.html?id=%%id%%';
	var similarURL = '/search.html?similar=%%url%%';
	var contextStyles =
	[
		['intro', 'cite', 'ital-off'],
		['bio', 'cite', 'ital-off']
	];

// Hover Ads
var ctiHovers = {
	// prevents conflicts with system.js
	notSystem: true,
	init: function() {
		var h = this.getSize().y,
			that = this,
			w = this.getSize().x;
		
		this.body = document.getElementsByTagName('body')[0];
		this.closeLink = document.getElementById('closeHoverAd');
		this.hover = document.getElementById('hover');
		this.overlay = document.getElementById('overlay');
		
		this.body.appendChild(this.hover);
		this.hover.style.left = (w/2) - (this.hover.clientWidth/2) + 'px';
		this.hover.style.visibility = 'visible';

		if (this.overlay) {
			this.overlay.style.height = h + 'px';
			this.overlay.style.width = w + 'px';
		}
		
		this.timer = setTimeout(function() {
			that.closeHover();
		}, 15000);
		
		this.attach();
	},
	attach: function() {
		var that = this,
			hoverForm = this.hover.getElementsByTagName('form')[0];
		
		if (hoverForm) {
			hoverForm.onsubmit = function() {
				that.hover.style.left = '-999em';
				setTimeout(function() {
					that.closeHover();
				}, 5000);
			};
		}
		this.hover.onclick = function(event) {
			var event = event || window.event,
				elem = event.target || event.srcElement;
			if (elem.nodeName === 'A' || elem.parentNode.nodeName === 'A') {
				that.closeHover();
			}
		};
		this.hover.onmouseover = function() {
			clearTimeout(that.timer);
		};
		this.closeLink.onfocus = function() {
			clearTimeout(that.timer);
		};
		this.closeLink.onclick = function() {
			that.closeHover();
			return false;
		};
		if (this.overlay) {
			this.overlay.onclick = function() {
				that.closeHover();
			};
		}
	},
	closeHover: function() {
		this.hover.parentNode.removeChild(this.hover);
		if (this.overlay) this.overlay.parentNode.removeChild(this.overlay);
		clearTimeout(this.timer);
	},
	getSize: function() {
		var doc = (!document.compatMode || document.compatMode === 'CSS1Compat') ? document.getElementsByTagName('html')[0] : document.body,
			m = window.ActiveXObject ? 'min': 'max';
		return {x: Math[m](doc.scrollWidth, doc.offsetWidth), y: Math.max(doc.scrollHeight, doc.offsetHeight)};
	}
};

// cookie management
	function readCookie(name)
	{
		var cookieArray = document.cookie.split('; ');
		for (var i = 0; i < cookieArray.length; i++)
		{
			var nameValueArray = cookieArray[i].split('=', 2);
			if (nameValueArray[0] == name) return(nameValueArray[1]);
		}
		return(null);
	}

	function writeCookie(name, value, expires)
	{
		if (expires)
		{
			document.cookie = name + '=' + value + '; expires=' + expires.toUTCString();
		}
		else
		{
			document.cookie = name + '=' + value;
		}
	}
	
// query extraction
	function getQueryVariable(name)
	{
		var query = window.location.search.substring(1);
		var vars = query.split('&');
		for (var i = 0; i < vars.length; i++)
		{
			var pair = vars[i].split('=');
			if (pair[0] == name)
			{
				return pair[1];
			}
		}
		return null;
	}

// event capturing
	if (isNS4)
	{
		window.captureEvents(Event.ONLOAD);
		window.onLoad = pageLoad;
		window.captureEvents(Event.ONUNLOAD);
		window.onUnload = pageUnload;
		document.captureEvents(Event.CLICK);
		document.onClick = mouseClick;
		document.captureEvents(Event.MOUSEMOVE);
		document.onMouseMove = mouseMove;
	}

	if (isNS5)
	{
		window.addEventListener('load', pageLoad, false);
		window.addEventListener('unload', pageUnload, false);
		document.addEventListener('click', mouseClick, false);
		document.addEventListener('mousemove', mouseMove, false);
	}

	if (isIE)
	{
		window.attachEvent('onload', pageLoad);
		window.attachEvent('onunload', pageUnload);
		document.attachEvent('onclick', mouseClick);
		document.attachEvent('onmousemove', mouseMove);
	}

// event handlers
	function pageLoad(evt)
	{
		// frame break
		if (window != top && allowFrame != true) top.location.replace(location.href);

		// create menu divs
		createMenuDivs();

		// display hover
		if (document.getElementById('hover')) ctiHovers.init();

		// set contextual styles
		setContextStyles();

		if (window.channelLoad) channelLoad();
	}

	function pageUnload(evt)
	{
		// close child windows
		for (var i = 0; i < windowArray.length; i++)
		{
			if (typeof windowArray[i] == 'object' && !windowArray[i].closed) windowArray[i].close();
		}

		if (window.channelUnload) channelUnload();
	}

	function mouseOver(evt)
	{
		obj = (evt.target) ? evt.target : evt.srcElement;
		if (obj.over) obj.src = obj.over.src;
		if (obj.tip) showTip(obj);
		if (obj.menu) showMenu(obj, evt);
	}

	function mouseOut(evt)
	{
		obj = (evt.target) ? evt.target : evt.srcElement;
		if (obj.out) obj.src = obj.out.src;
		if (obj.tip) hideTip(obj);
		if (obj.menu) delayHideMenu();
	}

	function mouseClick(evt)
	{
		if (isNS4)
		{
			clickURL = evt.target.href;
		}
		else if (isNS5)
		{
			node = evt.target;
			while (node.tagName != 'A' && node.tagName != 'HTML')
			{
				node = node.parentNode;
			}
			clickURL = node.href;
		}
		else if (isIE)
		{
			element = evt.srcElement;
			while (element.tagName != 'A' && element.tagName != 'HTML')
			{
				element = element.parentElement;
			}
			clickURL = element.href;
		}

		if (clickURL == null) clickURL = '';
	}

	function mouseMove(evt)
	{
		if (isNS)
		{
			mouseX = evt.pageX;
			mouseY = evt.pageY;
			pageWidth = window.innerWidth;
			pageHeight = window.innerHeight;
		}
		else
		{
			mouseX = evt.clientX;
			mouseY = evt.clientY;
			if (document.compatMode && document.compatMode == 'CSS1Compat')
			{
				pageWidth = document.body.parentNode.clientWidth;
				pageHeight = document.body.parentNode.clientHeight;
			}
			else
			{
				pageWidth = document.body.clientWidth;
				pageHeight = document.body.clientHeight;
			}
		}
	}

	function addMouseEvents(obj)
	{
		if (isNS5)
		{
			obj.addEventListener('mouseover', mouseOver, false);
			obj.addEventListener('mouseout', mouseOut, false);
		}
		if (isIE)
		{
			obj.detachEvent('onmouseover', mouseOver);
			obj.attachEvent('onmouseover', mouseOver);
			obj.detachEvent('onmouseout', mouseOut);
			obj.attachEvent('onmouseout', mouseOut);
		}
	}

// mouseovers; incompatible with NS4
	//
	// Usage:
	// <a href="LINK"><img src="IMAGE.EXT" onload="mouseLoad(this);" width="WIDTH" height="HEIGHT" title="ALT" /></a>
	// 
	// Note: mouseover image must be named IMAGE_over.EXT
	//
	function mouseLoad(obj)
	{
		if (isNS4 || obj.out) return;
		
		obj.out = new Image();
		obj.out.src = obj.src;
		obj.over = new Image();
		obj.over.src = obj.src.replace(/.gif$/, '_over.gif').replace(/.jpg$/, '_over.jpg');
		
		addMouseEvents(obj);
	}

// dropdown menu
	//
	// Usage:
	// <img src="IMAGE.EXT" onload="menuLoad(this, 'MENU_NAME', 'WIDTH', 'LEFT|RIGHT');" width="WIDTH" height="HEIGHT" title="ALT" />
	//
	// Note: create menu items in a separate JavaScript file
	//
	
	var menu = new Array();
	var menuTimeout;

	function createMenuDivs()
	{
		if (!isNS4)
		{
			for (var i = 0; i < menuDivArray.length; i++)
			{
				var newDiv = document.createElement('div');
				newDiv.setAttribute('id', menuDivArray[i]);
				newDiv.setAttribute('style', 'display: none; width: 0px;');
				if (isNS5)
				{
					newDiv.addEventListener('mouseover', clearHideMenu, false);
					newDiv.addEventListener('mouseout', delayHideMenu, false);
				}
				if (isIE)
				{
					newDiv.attachEvent('onmouseover', clearHideMenu);
					newDiv.attachEvent('onmouseout', delayHideMenu);
				}
				document.body.appendChild(newDiv);
			}
		}
	}

	function menuLoad(obj, name, width, align)
	{
		if (isNS4 || obj.menu) return;

		obj.menu = menu[name];
		obj.menuName = name;
		obj.menuWidth = width;
		obj.menuAlign = align;
		
		addMouseEvents(obj);
	}
	
	function showMenu(obj, evt)
	{
		var menuObject;
		if (isNS4 || ! obj.menu) return;

		if (window.event)
		{
			event.cancelBubble = true;
		}
		else if (evt.stopPropagation)
		{
			evt.stopPropagation();
		}
		clearHideMenu();

		var menuDiv = 'channelMenu';
		if (obj.menuName.indexOf('global_') == 0)
		{
			menuDiv = 'globalMenu';
		}

		menuObject = document.getElementById ? document.getElementById(menuDiv) : document.all[menuDiv];
		if (menuObject)
		{
			menuObject.innerHTML = obj.menu.join('');

			menuObject.style.width = obj.menuWidth + 'px';
			if (evt.type == 'click' && obj.visibility == hidden || evt.type == 'mouseover')
			{
				menuObject.style.display = 'block';
			}
			else if (evt.type == 'click')
			{
				menuObject.style.display = 'none';
			}
	
			var horizontalOffset;
			var verticalOffset;
			if (obj.menuAlign == 'right')
			{
				horizontalOffset = obj.offsetLeft + obj.offsetWidth;
			}
			else
			{
				horizontalOffset = obj.offsetLeft;
			}
			verticalOffset = obj.offsetTop + obj.offsetHeight;
			var parentElement = obj.offsetParent;
			while (parentElement != null)
			{
				horizontalOffset = horizontalOffset + parentElement.offsetLeft;
				verticalOffset = verticalOffset + parentElement.offsetTop;
				parentElement = parentElement.offsetParent;
			}
			if (obj.menuAlign == 'right')
			{
				menuObject.x = horizontalOffset - obj.menuWidth;
			}
			else
			{
				menuObject.x = horizontalOffset;
			}
			menuObject.y = verticalOffset;
			menuObject.style.left = menuObject.x;
			menuObject.style.top = menuObject.y;
		}
	}

	function delayHideMenu()
	{
		if (isNS4) return;

		menuTimeout = setTimeout('hideMenu()', menuDelay);
	}

	function hideMenu()
	{
		if (isNS4) return;

		var menuObject;

		for (var i = 0; i < menuDivArray.length; i++)
		{
			menuObject = document.getElementById ? document.getElementById(menuDivArray[i]) : document.all[menuDivArray[i]];
			if (typeof menuObject != 'undefined')
			{
				menuObject.style.display = 'none';
			}
		}
	}

	function clearHideMenu()
	{
		if (typeof menuTimeout != 'undefined') clearTimeout(menuTimeout);
	}

	document.onclick = hideMenu;

// help tips
	//
	// Mouseover-style:
	// <a href="javascript:void(0);" onmouseover="showTip('NAME');" onmouseout="hideTip('NAME');">LINK</a>
	// <div id="tip_NAME" class="tip">TIP</div>
	//
	// Click-style:
	// <a href="javascript:showTip('NAME');">LINK</a>
	// <div id="tip_NAME" class="tip">TIP<a href="javascript:hideTip('NAME');">CLOSELINK</a></div>
	//
	function showTip(id)
	{
		id = "tip_" + id;
		var prefix;
		var divWidth = 0;
		if (isIE)
		{
			divWidth = parseInt(document.getElementById(id).currentStyle.width);
		}
		if (isNS5)
		{
			divWidth = parseInt(getComputedStyle(document.getElementById(id), "").getPropertyValue("width"));
		}
		var tipX = ((mouseX + divWidth) > pageWidth) ? (pageWidth - divWidth) : mouseX;
		var tipY = mouseY + 25;
		var tipShow;
		if (isNS4)
		{
			var prefix = "document." + id + ".";
			tipShow = "show";
		}
		else
		{
			var prefix = "document.getElementById('" + id + "').style.";
			tipShow = "visible";
		}
		eval(prefix + "left = " + tipX);
		eval(prefix + "top = " + tipY);
		eval(prefix + "visibility = '" + tipShow + "'");
	}

	function hideTip(id)
	{
		id = "tip_" + id;
		if (isNS4)
		{
			eval("document." + id + ".visibility = 'hide'");
		}
		else
		{
			eval("document.getElementById('" + id + "').style.visibility = 'hidden'");
		}
	}

// page tools
	//
	// email this page
	// Usage:
	// <a href="javascript:emailPage();">LINK</a>
	//
	function emailPage(url)
	{
		if (url != null)
		{
			windowArray[windowArray.length] = window.open(url);
		}
		else
		{			
			thisURL = emailURL.replace('%%title%%', escape(document.title)).replace('%%url%%', escape(pageURL));
			windowArray[windowArray.length] = window.open(thisURL, 'emailWindow', 'width=520,height=350,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0');
		}
	}

	//
	// print this page
	// Usage:
	// <a href="javascript:printPage(ID);">LINK</a>
	//
	function printPage(id)
	{
		windowArray[windowArray.length] = window.open(printURL.replace('%%id%%', id), 'printWindow', 'width=600,height=400,toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1');
	}
	
	//
	// bookmark this page (compatible with IE only)
	// Usage:
	// <a href="javascript:bookmarkPage();">LINK</a>
	//
	function bookmarkPage()
	{
		if (isMac || isAOL)
		{
			alert('Sorry, this feature is not supported by your browser.');
			return;
		}

		if (!isNS)
		{
			window.external.AddFavorite(this.location.href, document.title);
		}
		else
		{
			alert('Click "OK", then type CTRL-D to add this page to your list of bookmarks.');
		}
	}
	
	//
	// set as homepage (compatible with IE only)
	// Usage:
	// <a href="javascript:setHomepage();">LINK</a>
	//
	function setHomepage()
	{
		if (!isIE || isAOL)
		{
			alert('Sorry, this feature is not supported by your browser.');
			return;
		}
	
		document.body.style.behavior = 'url(#default#homePage)';
		document.body.setHomePage(pageURL);
	}

	//
	// find similar pages
	// Usage:
	// <a href="javascript:findSimilar();">LINK</a>
	//
	function findSimilar()
	{
		top.location.href = similarURL.replace('%%url%%', pageURL);
	}

	//
	// adjust font size (incompatible with NS4)
	// Usage:
	// <a href="javascript:fontSize(-1|+1);">LINK</a>
	//
	function fontSize(amt)
	{
		if (isNS4)
		{
			alert('Sorry, this feature is not supported by your browser.');
			return;
		}

		if (amt == 1)
		{
			
		}
		else if (amt == -1)
		{
			
		}
	}

	//
	// toggle highlighting (incompatible with NS4)
	// Usage:
	// <a href="javascript:toggleHighlight();">LINK</a>
	//
	function toggleHighlight()
	{
		if (isNS4)
		{
			alert('Sorry, this feature is not supported by your browser.');
			return;
		}

		var elementList = document.getElementsByTagName('*');
		for (i = 0; i < elementList.length; i++)
		{
			elementList[i].className = (elementList[i].className == 'highlight') ? 'highlight_disabled' : 'highlight';
		}
		writeCookie('highlight', ((readCookie('highlight') != 'false') ? 'false' : 'true'));
	}

// page load routines
	// set contextual styles (incompatible with NS4)
	function setContextStyles()
	{
		if (isNS4) return;

		var elementList = document.getElementsByTagName('*');
		for (i = 0; i < elementList.length; i++)
		{
			for (j = 0; j < contextStyles.length; j++)
			{
				if (elementList[i].className == contextStyles[j][0])
				{
					currentNode = elementList[i].firstChild;
					while (currentNode)
					{
						if (currentNode.className == contextStyles[j][1])
						{
							switch (contextStyles[j][2])
							{
								case 'ital-off':
									currentNode.style.fontStyle = 'normal';
									break;
								case 'ital-on':
									currentNode.style.fontStyle = 'italic';
									break;
								case 'bold-off':
									currentNode.style.fontWeight = 'normal';
									break;
								case 'bold-on':
									currentNode.style.fontWeight = 'bold';
									break;
								default:
									break;
							}
						}
						currentNode = currentNode.nextSibling;
					}
				}
			}
		}
	}

// global dropdown menus
	// CHRISTIANITY TODAY menu
	menu['global_christianitytoday'] = new Array();
	menu['global_christianitytoday'][0] = '<a href="http://www.christianitytoday.com/ct/" target="_parent">Christianity Today</a>';
	menu['global_christianitytoday'][1] = '<a href="http://www.booksandculture.com/" target="_parent">Books &amp; Culture</a>';
	menu['global_christianitytoday'][2] = '<a href="http://www.christianitytoday.com/ch/" target="_parent">Christian History</a>';
	menu['global_christianitytoday'][3] = '<a href="http://blog.christianitytoday.com/ctmovies/" target="_parent">CT Entertainment Blog</a>';
	menu['global_christianitytoday'][4] = '<a href="http://www.ctlibrary.com/" target="_parent">CT Library</a>';
	menu['global_christianitytoday'][5] = '<a href="http://blog.christianitytoday.com/ctliveblog/" target="_parent">CT Liveblog</a>';
	menu['global_christianitytoday'][6] = '<a href="http://blog.christianitytoday.com/ctpolitics/" target="_parent">CT Politics Blog</a>';
	menu['global_christianitytoday'][7] = '<a href="http://blog.christianitytoday.com/women/" target="_parent">Her.meneutics (Women&#39;s) Blog</a>';
	menu['global_christianitytoday'][8] = '<a href="http://www.christianitytoday.com/international/" target="_parent">International Christianity</a>';
	menu['global_christianitytoday'][9] = '<a href="http://www.christianitytoday.com/globalconversation/" target="_parent">The Global Conversation</a>';
	
	// PASTORAL LEADERSHIP menu
	menu['global_pastoralleadership'] = new Array();
	menu['global_pastoralleadership'][0] = '<a href="http://www.christianitytoday.com/le/" target="_parent">Leadership Journal</a>';
	menu['global_pastoralleadership'][1] = '<a href="http://www.catalystleadershipdigital.com/" target="_parent">Catalyst Leadership</a>';
	menu['global_pastoralleadership'][2] = '<a href="http://www.giftedforleadership.com/" target="_parent">Gifted for Leadership</a>';
	menu['global_pastoralleadership'][3] = '<a href="http://www.shapevine.com/" target="_parent">Missional Living</a>';
	menu['global_pastoralleadership'][4] = '<a href="http://www.outofur.com/" target="_parent">Out of Ur Blog</a>';
	menu['global_pastoralleadership'][5] = '<a href="http://www.preachingtoday.com/" target="_parent">Preaching Today</a>';
	menu['global_pastoralleadership'][6] = '<a href="http://media.preachingtoday.com/" target="_parent">Preaching Today Media Store</a>';

	// CHURCH MANAGEMENT menu
	menu['global_churchmanagement'] = new Array();
	menu['global_churchmanagement'][0] = '<a href="http://www.buildingforministry.com/" target="_parent">Building for Ministry</a>';
	menu['global_churchmanagement'][1] = '<a href="http://www.churchlawtoday.com/" target="_parent">Church Law Today</a>';
	menu['global_churchmanagement'][2] = '<a href="http://www.churchlawtoday.com/cltrinfo.php" target="_parent">Church Law &amp; Tax Report</a>';
	menu['global_churchmanagement'][3] = '<a href="http://www.churchlawtoday.com/ctainfo.php" target="_parent">Church Finance Today</a>';
	menu['global_churchmanagement'][4] = '<a href="http://www.churchsafety.com/" target="_parent">Church Safety</a>';
	menu['global_churchmanagement'][5] = '<a href="http://www.christianitytoday.com/yc/" target="_parent">Products &amp; Services</a>';
	menu['global_churchmanagement'][6] = '<a href="http://www.reducingtherisk.com/" target="_parent">Reducing the Risk</a>';
	menu['global_churchmanagement'][7] = '<a href="http://blog.yourchurch.net/" target="_parent">Your Church Blog</a>';
	menu['global_churchmanagement'][8] = '<a href="http://www.christianitytoday.com/yc/" target="_parent">Your Church Magazine</a>';
	menu['global_churchmanagement'][9] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-78230354700659+u6MRfC+index.html" target="_parent">Your Church Resources</a>';

	// LEADER TRAINING menu
	menu['global_leadertraining'] = new Array();
	menu['global_leadertraining'][0] = '<a href="http://www.buildingchurchleaders.com/" target="_parent">Building Church Leaders</a>';
	menu['global_leadertraining'][1] = '<a href="http://www.roundtripmissions.com/" target="_parent">Round Trip Missions</a>';
	menu['global_leadertraining'][2] = '<a href="http://www.smallgroups.com/" target="_parent">Small Groups</a>';
	menu['global_leadertraining'][3] = '<a href="http://www.christianitytoday.com/childrensministry/" target="_parent">Today&#39;s Children&#39;s Ministry</a>';

	// DISCIPLESHIP menu
	menu['global_discipleship'] = new Array();
	menu['global_discipleship'][0] = '<a href="http://www.christianitytoday.com/biblestudies/" target="_parent">Christian Bible Studies</a>';
	menu['global_discipleship'][1] = '<a href="http://www.christiancollegeguide.net/" target="_parent">Christian College Guide</a>';
	menu['global_discipleship'][2] = '<a href="http://www.christianitytoday.com/workplace/" target="_parent">Faith in the Workplace</a>';
	menu['global_discipleship'][3] = '<a href="http://www.giftedforleadership.com/" target="_parent">Gifted for Leadership</a>';
	menu['global_discipleship'][4] = '<a href="http://www.christianitytoday.com/holidays/" target="_parent">Holidays</a>';
	menu['global_discipleship'][5] = '<a href="http://www.christianitytoday.com/iyf/" target="_parent">Ignite Your Faith (Teens)</a>';
	menu['global_discipleship'][6] = '<a href="http://www.kyria.com/" target="_parent">Kyria (Women)</a>';
	menu['global_discipleship'][7] = '<a href="http://kyria.com/topics/marriagefamily/marriage/" target="_parent">Marriage Partnership</a>';
	menu['global_discipleship'][8] = '<a href="http://www.christianitytoday.com/moi/" target="_parent">Men of Integrity</a>';
	menu['global_discipleship'][9] = '<a href="http://www.christianitytoday.com/momsense/" target="_parent">MomSense (Parenting)</a>';
	menu['global_discipleship'][10] = '<a href="http://www.seminarygradschool.com/" target="_parent">Seminary/Grad Guide</a>';
	menu['global_discipleship'][11] = '<a href="http://www.christianitytoday.com/shopping/" target="_parent">Shopping</a>';
	menu['global_discipleship'][12] = '<a href="http://www.kyria.com/" target="_parent">Women (Kyria)</a>';

	// MAGAZINES menu
	menu['global_magazines'] = new Array();
	menu['global_magazines'][0] = '<a href="http://www.christianitytoday.com/ct/" target="_parent">Christianity Today</a>';
	menu['global_magazines'][1] = '<a href="http://www.booksandculture.com/" target="_parent">Books &amp; Culture</a>';
	menu['global_magazines'][2] = '<a href="http://www.catalystleadershipdigital.com/" target="_parent">Catalyst Leadership Digital</a>';
	menu['global_magazines'][3] = '<a href="http://www.christianitytoday.com/lawandtax/" target="_parent">Church Law &amp; Tax Report</a>';
	menu['global_magazines'][4] = '<a href="http://www.churchlawtoday.com/ctainfo.php" target="_parent">Church Finance Today</a>';
	menu['global_magazines'][5] = '<a href="http://www.kyria.com/digital/" target="_parent">Kyria Digital</a>';
	menu['global_magazines'][6] = '<a href="http://www.christianitytoday.com/le/" target="_parent">Leadership</a>';
	menu['global_magazines'][7] = '<a href="http://www.christianitytoday.com/moi/" target="_parent">Men of Integrity</a>';
	menu['global_magazines'][8] = '<a href="http://www.christianitytoday.com/momsense/" target="_parent">MomSense</a>';
	menu['global_magazines'][9] = '<a href="http://www.christianitytoday.com/yc/" target="_parent">Your Church</a>';
	menu['global_magazines'][10] = '<a href="http://www.christianitytoday.com/free/features/magazines.html" target="_parent">Free Trial Offers</a>';
	menu['global_magazines'][11] = '<a href="http://www.christianitytoday.com/myaccount/?page=magazines" target="_parent">Customer Care</a>';
	menu['global_magazines'][12] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';

	// SHOPPING menu
	menu['global_shopping'] = new Array();
	menu['global_shopping'][0] = '<a href="http://store.yahoo.com/cgi-bin/clink?biblestudies+TtWdCB+index.html" class="external">Bible Studies</a>';
	menu['global_shopping'][1] = '<a href="http://www.christianbook.com/bibles/?p=1029826" class="external">Bibles</a>';
	menu['global_shopping'][2] = '<a href="http://www.christianbook.com/html/static/home_page.html?p=1029826" class="external">Books</a>';
	menu['global_shopping'][3] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-15636219134485+LCZtJr+index.html" class="external">Children&#39;s Ministry</a>';
	menu['global_shopping'][4] = '<a href="http://www.christianitytoday.com/yc/" class="external">Church Management</a>';
	menu['global_shopping'][5] = '<a href="http://cticlassifieds.com/" class="external">Classifieds</a>';
	menu['global_shopping'][6] = '<a href="http://www.christianbook.com/dvds/?p=1029826" class="external">DVDs</a>';
	menu['global_shopping'][7] = '<a href="http://www.christianbook.com/gifts/?p=1029826" class="external">Gifts</a>';
	menu['global_shopping'][8] = '<a href="http://www.buildingchurchleaders.com/" class="external">Leader Training</a>';
	menu['global_shopping'][9] = '<a href="http://www.christianbook.com/html/static/music.html?p=1029826" class="external">Music</a>';
	menu['global_shopping'][10] = '<a href="http://www.preachingtoday.com/" class="external">Sermons</a>';
	menu['global_shopping'][11] = '<a href="http://www.smallgroups.com/" class="external">Small Groups</a>';
	menu['global_shopping'][12] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-52795328905550+MaaJVL+index.html" class="external">Women&#39;s Ministry</a>';

	// FREE menu
	menu['global_free'] = new Array();
	menu['global_free'][0] = '<a href="http://www.christianitytoday.com/free/features/magazines.html" target="_parent">Magazines</a>';
	menu['global_free'][1] = '<a href="http://store.yahoo.com/biblestudies/freesamples.html" target="_parent">Bible Studies</a>';
	menu['global_free'][2] = '<a href="http://www.christianitytoday.com/ecards/" target="_parent">E-cards</a>';
	menu['global_free'][3] = '<a href="http://buildingchurchleaders.com/store/freesamples.html" target="_parent">Leader Training</a>';
	menu['global_free'][4] = '<a href="http://www.christianitytoday.com/free/features/newsletters.html" target="_parent">Newsletters</a>';
	menu['global_free'][5] = '<a href="http://www.preachingtoday.com/store/free.html" target="_parent">Preaching Resources</a>';
	menu['global_free'][6] = '<a href="http://www.christianitytoday.com/help/features/rss.html" target="_parent">RSS Feeds</a>';

//GLOBAL MULTI NL SIGNUP TOOL FUNCTIONS

function get_checked_items() {
var c_value = "";
var c_text = "";
var s_email = "";
for (var i=0; i < document.subscribeform.list.length; i++)
   {
   if (document.subscribeform.list[i].checked)
      {
      c_value = c_value + document.subscribeform.list[i].value + " ";
      
	      switch(document.subscribeform.list[i].value) {
					case "booksandculture-html":
	      		c_text = c_text + "Books & Culture (weekly) \n";
	      		break;
					case "bcl":
	      		c_text = c_text + "Building Church Leaders (weekly) \n";
	      		break;
					case "buildingsmallgroups-html":
	      		c_text = c_text + "Building Small Groups (monthly) \n";
	      		break;
					case "biblestudies-html":
	      		c_text = c_text + "Christian Bible Studies (weekly) \n";
	      		break;
					case "history-html":
	      		c_text = c_text + "Christian History & Biography Newsletter (weekly) \n";
	      		break;
					case "ctlibrary-html":
	      		c_text = c_text + "CT Library Newsletter -- ChristianityTodayLibrary.com (semimonthly) \n";
	      		break;
					case "visionproject":
	      		c_text = c_text + "The Christian Vision Project (monthly) \n";
	      		break;
					case "housenews":
	      		c_text = c_text + "Christianity.ca's Virtual House News (weekly) \n";
	      		break;
					case "churchlaughs-html":
	      		c_text = c_text + "Church Laughs (weekly) \n";
	      		break;
					case "churchplaza-html":
	      		c_text = c_text + "Church Plaza Newsletter (monthly) \n";
	      		break;
					case "collegeguide":
	      		c_text = c_text + "College Guide (monthly) \n";
	      		break;
					case "conferences":
	      		c_text = c_text + "Conferences Update (monthly) \n";
	      		break;
					case "connection-html":
	      		c_text = c_text + "The Connection -- HTML (weekly) \n";
	      		break;
					case "connection":
	      		c_text = c_text + "The Connection -- Text-only (weekly) \n";
	      		break;
					case "ctdirect-html":
	      		c_text = c_text + "CTDirect (daily) \n";
	      		break;
					case "ctweekly-html":
	      		c_text = c_text + "CTWeekly \n";
	      		break;
					case "movies-html":
	      		c_text = c_text + "CT at the Movies (weekly) \n";
	      		break;
					case "dnaofrelationships-html":
	      		c_text = c_text + "Smalley Relationship Center Newsletter (weekly) \n";
	      		break;
					case "e-cards-html":
	      		c_text = c_text + "E-Cards (Holiday Reminder) \n";
	      		break;
					case "workplace-html":
	      		c_text = c_text + "Faith in the Workplace Newsletter (biweekly) \n";
	      		break;
					case "faithvisuals":
	      		c_text = c_text + "Faith Visuals Newsletter (monthly) \n";
	      		break;
					case "hottopics":
	      		c_text = c_text + "Hot Topics Newsletter (monthly) \n";
	      		break;
					case "campuslife-html":
	      		c_text = c_text + "Ignite Your Faith Connection (weekly) \n";
	      		break;
					case "ctcourses-html":
	      		c_text = c_text + "Interactive Training Courses \n";
	      		break;
	      	case "womenleaders":
	      		c_text = c_text + "Gifted for Leadership \n";
	      		break;	      		
					case "leadership-html":
	      		c_text = c_text + "Leadership Weekly \n";
	      		break;
					case "marriage-html":
	      		c_text = c_text + "Marriage Connection (biweekly) \n";
	      		break;
					case "men-html":
	      		c_text = c_text + "Men in the Word (weekly) \n";
	      		break;
					case "parenting-html":
	      		c_text = c_text + "MOMSense Newsletter (biweekly) \n";
	      		break;
					case "music-html":
	      		c_text = c_text + "Music Connection (weekly) \n";
	      		break;
					case "outreach-html":
	      		c_text = c_text + "Outreach & Evangelism Newsletter (biweekly) \n";
	      		break;
					case "ptaudio-html":
	      		c_text = c_text + "Preaching Today Audio (monthly) \n";
	      		break;
					case "ptsermons":
	      		c_text = c_text + "Preaching Today Sermons (weekly) \n";
	      		break;
					case "wiu-html":
	      		c_text = c_text + "Preaching Connection (weekly) \n";
	      		break;
					case "singles-html":
	      		c_text = c_text + "The Singles Channel Newsletter (weekly) \n";
	      		break;
					case "childrensministry-html":
	      		c_text = c_text + "Today's Children's Ministry (monthly) \n";
	      		break;
					case "tctoolbox-html":
	      		c_text = c_text + "Today's Christian Toolbox (bimonthly) \n";
	      		break;
					case "todayschristian-html":
	      		c_text = c_text + "Today's Christian Weekly \n";
	      		break;
					case "women-html":
	      		c_text = c_text + "Women's Connection (weekly) \n";
	      		break;
					case "yourchurch-html":
	      		c_text = c_text + "Your Church (biweekly) \n";
	      		break;
					case "churchsafety-html":
	      		c_text = c_text + "Your Church Safety Newsletter (monthly) \n";
	      		break;
	      }
      }
   }
   
   if (c_text != "") {
	   s_email = document.subscribeform.email.value;
	   subscribeform.checkedboxes.value = c_value;
	   c_text = "The email address " + s_email + " has been subscribed to the following Newsletters:\n" + c_text;
	   alert(c_text);
	   return true;
	} else {
		c_text = "Please select at least one Newsletter";
	  alert(c_text);
	  return false;
	}
}
	emailre = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
	
	function check_email(theForm){
		if (emailre.test(theForm.email.value)) {
			return true;
		}				
			alert("Please enter a valid Email address");
			theForm.email.focus();
			theForm.email.select();
			return false;
	}