//
// ChristianityToday.com JavaScript
// Version 1.1
// Copyright © 2006 Christianity Today International
//

// variables
	// user-agent identity
	var version = parseInt(navigator.appVersion);
	if (navigator.userAgent.indexOf('MSIE 6') >= 0) version = 6;
	if (navigator.userAgent.indexOf('MSIE 7') >= 0) version = 7;
	if (navigator.userAgent.indexOf('Firefox 2') >= 0) version = 2;
	if (navigator.userAgent.indexOf('Firefox 3') >= 0) version = 3;
	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 = '/services/email/index.html?title=%%title%%&url=%%url%%';
	var printURL = '/print.html?id=%%id%%';
	var similarURL = '/search.html?similar=%%url%%';
	var contextStyles =
	[
		['intro', 'cite', 'ital-off'],
		['bio', 'cite', 'ital-off']
	];

// external functions
/*
	//Quantcast
	var quantcastAcct = 'p-d9T_51iOlHYSY';
	var quantcastCode = '<scr';
	quantcastCode += 'ipt type="text/javascript">';
	quantcastCode += '_qoptions = { qacct:"' + quantcastAcct + '" };';
	quantcastCode += '</scr';
	quantcastCode += 'ipt><scr';
	quantcastCode += 'ipt src="http://edge.quantserve.com/quant.js" type="text/javascript"></scr';
	quantcastCode += 'ipt>';

	// Google Analytics
	var googleCode = '<scr'
	googleCode += 'ipt type="text/javascript">';
	googleCode += 'var gaJsHost = (("https:" == document.location.protocol) ';
	googleCode += '? "https://ssl." : "http://www.");';
	googleCode += 'document.write(unescape("%3Cscript src=\'" ';
	googleCode += '+ gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));';
	googleCode += '</scr';
	googleCode += 'ipt><script type="text/javascript">';
	googleCode += 'try {';
	googleCode += 'var pageTracker = _gat._getTracker("UA-172707-2");';
	googleCode += 'pageTracker._trackPageview();';
	googleCode += '} catch(err) {}';
	googleCode += '</scr';
	googleCode += 'ipt>';

	if (location.host == "ctstaging")
	{
		var webAddress = new Array();
			webAddress[0] = 'com/ct';
			webAddress[1] = 'com/ch';
			webAddress[2] = '/bc';
			webAddress[3] = '/le';
			webAddress[4] = '/men';
			webAddress[5] = '/momsense';
			webAddress[6] = '/mp';
			webAddress[7] = '/tc';
			webAddress[8] = '/tcw';
			webAddress[9] = '/yc';
			webAddress[10] = '/childrensministry';
			webAddress[11] = '/movies';
			webAddress[12] = '/blog';
			webAddress[13] = '/ecards';
			webAddress[14] = '/homeschool';
			
		var analyticsDiv = document.createElement("div");
		for (var i = 0; i < webAddress.length; i++)
		{
			var siteAddress = location.href;
			var siteIndex = siteAddress.indexOf(webAddress[i]);
			if (siteAddress == "http://ctstaging/" || siteIndex != -1)
			{
				analyticsDiv.innerHTML = quantcastCode;
			}
			else
			{
				analyticsDiv.innerHTML = quantcastCode;
			}
		}
	}
*/
	// scripture
	if (location.host == "ctstaging" || location.host.indexOf("christianitytoday.com") >= 0)
	{
		var scriptureScript = document.createElement('script');
		scriptureScript.setAttribute('type', 'text/javascript');
		scriptureScript.setAttribute('language', 'JavaScript');
		scriptureScript.setAttribute('src', '/global/scripture/scripture.js');
		document.getElementsByTagName("head")[0].appendChild(scriptureScript);
	}
	
	// share
//	var shareScript = document.createElement('script');
//	shareScript.setAttribute('type', 'text/javascript');
//	shareScript.setAttribute('language', 'JavaScript');
//	shareScript.setAttribute('src', 'http://w.sharethis.com/widget/?tabs=web%2Cpost%2Cemail&amp;charset=utf-8&amp;services=%2Cdigg%2Cstumbleupon%2Cfacebook%2Cmyspace%2Cdelicious%2Ctechnorati%2Cgoogle_bmarks%2Cyahoo_bmarks%2Cyahoo_myweb%2Cwindows_live%2Creddit%2Cslashdot&amp;style=default&amp;publisher=8bb8a210-f08c-4e61-90a0-7e004d619e99&amp;offsetLeft=0&amp;offsetTop=0&amp;headerbg=%23ECECEC&amp;inactivebg=%23CDCDCD&amp;inactivefg=%23FFFFFF&amp;linkfg=%23888888');
//	document.getElementsByTagName("head")[0].appendChild(shareScript);

	var shareCount = 0;
	function insertShare(shareUrl, shareTitle)
	{
//		if (!shareUrl) shareUrl = location.href;
//		if (!shareTitle) shareTitle = document.title;
//		shareCount++;
//		var shareCode = '<scr';
//		shareCode += 'ipt language="javascript" type="text/javascript">';
//		shareCode += 'var shareObject' + shareCount + ' = SHARETHIS.addEntry({';
//		shareCode += 'title: \'' + shareTitle + '\',';
//		shareCode += 'url: \'' + shareUrl + '\' },';
//		shareCode += '{ button: false });';
//		shareCode += 'document.write(\'<div id="shareDiv' + shareCount + '"><a href="javascript:void(0);"><img src="http://www.christianitytoday.com/global/img/icon_share.gif" width="93" height="16" alt="Share This" title="Share This" /></a></div>\');';
//		shareCode += 'var shareElement' + shareCount + ' = document.getElementById("shareDiv' + shareCount + '");';
//		shareCode += 'shareObject' + shareCount + '.attachButton(shareElement' + shareCount + ');';
//		shareCode += '</scr';
//		shareCode += 'ipt>';
//		document.write(shareCode);
	}

// 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('onmousemove', mouseMove);
		document.attachEvent('onclick', mouseClick);
	}

// event handlers
	function pageLoad(evt)
	{
		// frame break
		if (window != top && allowFrame != true) top.location.replace(location.href);

		// insert Analytics code
		// document.body.appendChild(analyticsDiv);
		
		// create menu divs
		createMenuDivs();

		// display hover
		if (window.showPromo) showPromo();
		
		// 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;
			if (node)
			{
				while (node.tagName != 'A' && node.tagName != 'HTML')
				{
					node = node.parentNode;
				}
				clickURL = node.href;
			}
		}
		else if (isIE)
		{
			element = evt.srcElement;
			if (element)
			{
				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 + document.body.scrollTop;

			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;
			}
		}

		if (tipVisible)
		{
			moveTip();
		}
	}

	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 (menuObject)
			{
				menuObject.style.display = 'none';
			}
		}
	}

	function clearHideMenu()
	{
		if (typeof menuTimeout != 'undefined') clearTimeout(menuTimeout);
	}

	document.onclick = hideMenu;

// help tips
	//
	// Usage:
	// <img src="IMAGE.EXT" onload="tipLoad(this, 'MESSAGE', 'LEFT|RIGHT', WIDTH, OFFSET);" width="WIDTH" height="HEIGHT" title="ALT" />
	// <a href="LINK" onmouseover="showTip(this, 'MESSAGE', 'LEFT|RIGHT', WIDTH, OFFSET);" />
	//		the ALIGN, WIDTH, and OFFSET can be left out and they will be set to default values
	//		if ALIGN is right, the OFFSET should be set to ensure proper positioning
	//
	var tipVisible = false;
	var tipTimeout;

	function tipLoad(obj, message, align, width, offset)
	{
		if (isNS4) return;

		if (!obj.tip)
		{
			obj.tip = message;
			if (align == null)
			{
				align = 'left';
			}
			obj.tipAlign = align;
			if (width == null)
			{
				width = 200;
			}
			obj.tipWidth = width;
			if (offset == null)
			{
				offset = 210;
			}
			obj.tipRightOffset = offset;
			addMouseEvents(obj);
			if (obj.nodeName == "A")
			{
				showTip(obj);
			}
		}
	}

	function showTip(obj)
	{
		if (isNS4) return;

		tipVisible = true;

		var tipDiv = document.getElementById('tip');

		if (!tipDiv)
		{
			tipDiv = document.createElement('div');
			tipDiv.setAttribute('id', 'tip');
			document.body.appendChild(tipDiv);
		}

		if (tipDiv)
		{
			tipDiv.innerHTML = obj.tip;
			tipDiv.setAttribute('tipAlign', obj.tipAlign);
			moveTip();
			tipDiv.style.width = obj.tipWidth + 'px';
			tipDiv.style.visibility = 'visible';
		}
		tipDiv.style.textAlign = 'left';
		clearHideTip();
	}

	function delayHideTip()
	{
		if (isNS4) return;

		tipTimeout = setTimeout('hideTip()', tipDelay);
	}

	function hideTip()
	{
		if (isNS4) return;

		tipVisible = false;

		var tipDiv = document.getElementById('tip');

		if (tipDiv)
		{
			tipDiv.style.visibility = 'hidden';
		}
	}

	function clearHideTip()
	{
		if (typeof tipTimeout != 'undefined') clearTimeout(tipTimeout);
	}

	document.onclick = hideTip;
	
	function moveTip()
	{
		var tipDiv = document.getElementById('tip');
		if (tipDiv)
		{
			if (tipDiv.tipAlign && tipDiv.tipAlign == 'left')
			{
				var tipX = (((mouseX) > pageWidth) ? (pageWidth) : mouseX) + 10;
			}
			else
			{
				var tipX = (((mouseX) > pageWidth) ? (pageWidth) : mouseX) - obj.tipRightOffset;
			}
			var tipY = mouseY + 25;

			if (isNS4)
			{
				tipDiv.left = tipX;
				tipDiv.top = tipY;
			}
			else
			{
				tipDiv.style.left = tipX;
				tipDiv.style.top = tipY;
			}
		}
	}

// 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=450,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=760,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;
					}
				}
			}
		}
	}

// media players
	function insertVideoPlayer(videoFile, playerID, playerWidth, playerHeight)
	{
		var playerFile = "http://www.christianitytoday.com/global/media/videoplayer.swf";
		if (!playerWidth) playerWidth = 320;
		if (!playerHeight) playerHeight = 234;
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + playerWidth + '" height="' + playerHeight + '" id="videoPlayer' + playerID + '">');
		document.write('<param name="movie" value="' + playerFile + '?url=' + videoFile + '" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<param name="menu" value="false">');
		document.write('<param name="bgcolor" value="FFFFFF" />');
		document.write('<param name="allowScriptAccess" value="always" />');
		document.write('<embed src="' + playerFile + '?url=' + videoFile + '" quality="high" wmode="transparent" menu="false" bgcolor="FFFFFF" allowScriptAccess="always" width="' + playerWidth + '" height="' + playerHeight + '" name="videoPlayer' + playerID + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}

	function insertAudioPlayer(audioFile, playerID)
	{
		var playerFile = "http://www.christianitytoday.com/global/media/audioplayer.swf";
		document.write('<object type="application/x-shockwave-flash" data="' + playerFile + '" id=audioplayer"' + playerID + '" height="24" width="290">');
		document.write('<param name="movie" value="' + playerFile + '">');
		document.write('<param name="FlashVars" value="playerID=1&amp;soundFile=' + audioFile + '&amp;noinfo=yes&amp;transparentpagebg=yes&amp;tracker=A3BDFC&amp;loader=82BF73">');
		document.write('<param name="quality" value="high">');
		document.write('<param name="wmode" value="transparent">');
		document.write('<param name="menu" value="false">');
		document.write('</object>');
	}
	
	var AudioPlayer = function()
	{
		var instances = [];
		var activePlayerID;
		var playerURL = "";
		var defaultOptions = {};
		var currentVolume = -1;
		
		function getPlayer(playerID)
		{
			return(document.all ? window[playerID] : document[playerID]);
		}
		
		return {
			setup: function(url, options)
			{
				  playerURL = url;
				  defaultOptions = options;
			 },
	
			getPlayer: function(playerID)
			{
				return(getPlayer(playerID));
			},
			 
			 embed: function(elementID, options)
			 {
				var instanceOptions = {};
				  var key;
				  var so;
				var bgcolor;
				var wmode;
				
				var flashParams = {};
				var flashVars = {};
				var flashAttributes = {};
		
				for (key in defaultOptions)
				{
						instanceOptions[key] = defaultOptions[key];
				  }
				  for (key in options)
				  {
						instanceOptions[key] = options[key];
				  }
				if (instanceOptions.transparentpagebg == "yes")
				{
					flashParams.bgcolor = "#FFFFFF";
					flashParams.wmode = "transparent";
				}
				else
				{
					if (instanceOptions.pagebg)
					{
						flashParams.bgcolor = "#" + instanceOptions.pagebg;
					}
					flashParams.wmode = "opaque";
				}
				flashParams.menu = "false";
				  for (key in instanceOptions)
				  {
					if (key == "pagebg" || key == "width" || key == "transparentpagebg")
					{
						continue;
					}
						flashVars[key] = instanceOptions[key];
				  }
				flashAttributes.name = elementID;
				flashAttributes.style = "outline: none";
				flashVars.playerID = elementID;
				swfobject.embedSWF(playerURL, elementID, instanceOptions.width.toString(), "24", "9", false, flashVars, flashParams, flashAttributes);
				instances.push(elementID);
			 },
			
			syncVolumes: function (playerID, volume)
			{
				currentVolume = volume;
				for (var i = 0; i < instances.length; i++)
				{
					if (instances[i] != playerID)
					{
						getPlayer(instances[i]).setVolume(currentVolume);
					}
				}
			},
			
			activate: function(playerID)
			{
				if (activePlayerID && activePlayerID != playerID)
				{
					getPlayer(activePlayerID).close();
				}
				activePlayerID = playerID;
			},
			
			load: function(playerID, soundFile, titles, artists)
			{
				getPlayer(playerID).load(soundFile, titles, artists);
			},
			
			close: function(playerID)
			{
				getPlayer(playerID).close();
				if (playerID == activePlayerID)
				{
					activePlayerID = null;
				}
			},
			
			open: function(playerID)
			{
				getPlayer(playerID).open();
			},
			
			getVolume: function(playerID)
			{
				return(currentVolume);
			}
		}
	}();

// global dropdown menus
	// CT PLUS menu
	menu['global_ctplus'] = new Array();
	menu['global_ctplus'][0] = '<a href="http://www.christianitytoday.com/ct/" target="_parent">Christianity Today</a>';
	menu['global_ctplus'][1] = '<a href="http://www.christianitytoday.com/bible/" target="_parent">Bible &amp; Reference</a>';
	menu['global_ctplus'][2] = '<a href="http://www.christianitytoday.com/books/" target="_parent">Books &amp; Culture</a>';
	menu['global_ctplus'][3] = '<a href="http://www.christianitytoday.com/history" target="_parent">Christian History &amp; Biography</a>';
	menu['global_ctplus'][4] = '<a href="http://www.christianleadershipalliance.com/" target="_parent">Christian Leadership Alliance</a>';
	menu['global_ctplus'][5] = '<a href="http://www.christianitytoday.com/globalconversation/">Global Conversation</a>';
	menu['global_ctplus'][6] = '<a href="http://ctlibrary.com/" target="_parent">Christianity Today Library</a>';
	menu['global_ctplus'][7] = '<a href="http://www.christianitytoday.com/ct/movies/" target="_parent">Christianity Today Movies</a>';
	menu['global_ctplus'][8] = '<a href="http://www.christianitytoday.com/international/" target="_parent">Global Christianity</a>';
	menu['global_ctplus'][9] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';

	// CHURCH LEADERSHIP menu
	menu['global_churchleadership'] = new Array();
	menu['global_churchleadership'][0] = '<a href="http://www.christianitytoday.com/leaders/" target="_parent">Leadership Journal</a>';
	menu['global_churchleadership'][1] = '<a href="http://www.kyria.com" target="_parent">Kyria.com</a>';
	menu['global_churchleadership'][2] = '<a href="http://www.christianitytoday.com/biblestudies/" target="_parent">Bible Studies</a>';
	menu['global_churchleadership'][3] = '<a href="http://www.christianitytoday.com/bcl/" target="_parent">Building Church Leaders</a>';
	menu['global_churchleadership'][4] = '<a href="http://www.christianitytoday.com/childrensministry/" target="_parent">Children&#39;s Ministry</a>';
	menu['global_churchleadership'][5] = '<a href="http://www.catalystleadershipdigital.com/">Catalyst Leadership</a>';	
	menu['global_churchleadership'][6] = '<a href="http://www.shapevine.com/" target="_parent">Missional Living</a>';
	menu['global_churchleadership'][7] = '<a href="http://www.outofur.com/" target="_parent">Out of Ur Blog</a>';
	menu['global_churchleadership'][8] = '<a href="http://www.christianitytoday.com/outreach/" target="_parent">Leading Outreach</a>';
	menu['global_churchleadership'][9] = '<a href="http://preachingtoday.com/" target="_parent">PreachingToday.com</a>';
	menu['global_churchleadership'][10] = '<a href="http://preachingtodaysermons.com/" target="_parent">Preaching Today Sermons</a>';
	menu['global_churchleadership'][11] = '<a href="http://ctlibrary.com/" target="_parent">Research Library</a>';
	menu['global_churchleadership'][12] = '<a href="http://www.roundtripmissions.com/" target="_parent">Short-Term Missions</a>';
	menu['global_churchleadership'][13] = '<a href="http://www.smallgroups.com/" target="_parent">Small Groups</a>';
	menu['global_churchleadership'][14] = '<a href="http://blog.christianitytoday.com/giftedforleadership/" target="_parent">Women Leaders</a>';

	// CHURCH ADMIN menu
	menu['global_churchadmin'] = new Array();
	menu["global_churchadmin"][0] = '<a href="http://www.buildingforministry.com/" target="_parent">BuildingForMinistry.com</a>';
	menu["global_churchadmin"][1] = '<a href="http://www.churchlawtoday.com" target="_parent">ChurchLawToday.com</a>';
	menu["global_churchadmin"][2] = '<a href="http://www.churchlawtoday.com/cltrinfo.php" target="_parent">Church Law &amp; Tax Report</a>';
	menu["global_churchadmin"][3] = '<a href="http://www.churchlawtoday.com/ctainfo.php" target="_parent">Church Finance Today</a>';
	menu["global_churchadmin"][4] = '<a href="http://www.churchsafety.com/" target="_parent">ChurchSafety.com</a>';
	menu["global_churchadmin"][5] = '<a href="http://www.christianitytoday.com/yc/" target="_parent">Products &amp; Services</a>';
	menu["global_churchadmin"][6] = '<a href="http://www.reducingtherisk.com/" target="_parent">Reducing the Risk</a>';
	menu["global_churchadmin"][7] = '<a href="http://www.christianitytoday.com/yc/" target="_parent">Your Church Magazine</a>';
	menu["global_churchadmin"][8] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-78230354700659+u6MRfC+index.html" target="_parent">Your Church Resources</a>';

	// CULTURE & MEDIA menu
	menu['global_culturemedia'] = new Array();
	menu['global_culturemedia'][0] = '<a href="http://www.christianitytoday.com/books/" target="_parent">Books &amp; Culture</a>';
	menu['global_culturemedia'][1] = '<a href="http://www.christianitytoday.com/globalconversation/">Global Conversation</a>';
	menu['global_culturemedia'][2] = '<a href="http://www.christianitytoday.com/ct/movies/" target="_parent">Movies</a>';
	menu['global_culturemedia'][3] = '<a href="http://www.christianitytoday.com/ct/music/" target="_parent">Music</a>';
	menu['global_culturemedia'][4] = '<a href="http://blog.christianitytoday.com/outofur/" target="_parent">Out of Ur Blog</a>';

	// WOMEN menu
	menu['global_women'] = new Array();
	menu['global_women'][0] = '<a href="http://www.kyria.com" target="_parent">Kyria.com</a>';
	menu['global_women'][1] = '<a href="http://blog.christianitytoday.com/giftedforleadership/" target="_parent">Gifted for Leadership</a>';
	menu['global_women'][2] = '<a href="http://blog.christianitytoday.com/women/" target="_parent">Her.meneutics</a>';
	menu['global_women'][3] = '<a href="http://www.christianitytoday.com/marriage/" target="_parent">Marriage Partnership</a>';
	menu['global_women'][4] = '<a href="http://www.christianitytoday.com/parenting/" target="_parent">MomSense (Parenting)</a>';
	menu['global_women'][5] = '<a href="http://www.christianitytoday.com/singles/" target="_parent">Singles</a>';
	menu['global_women'][6] = '<a href="http://www.christianitytoday.com/todayschristian/" target="_parent">Today&#39;s Christian</a>';

	// LIFE & FAITH menu
	menu['global_lifefaith'] = new Array();
	menu['global_lifefaith'][0] = '<a href="http://www.christianitytoday.com/todayschristian/" target="_parent">Today&#39;s Christian</a>';
	menu['global_lifefaith'][1] = '<a href="http://www.christianitytoday.com/bible/" target="_parent">Bible &amp; Reference</a>';
	menu['global_lifefaith'][2] = '<a href="http://www.christianitytoday.com/biblestudies/" target="_parent">Bible Studies</a>';
	menu['global_lifefaith'][3] = '<a href="http://www.buildingchurchleaders.com/multimedia/cartoons/" target="_parent">Church Laughs</a>';
	menu['global_lifefaith'][4] = '<a href="http://www.christianleadershipalliance.com/" target="_parent">Christian Leadership Alliance</a>';
	menu['global_lifefaith'][5] = '<a href="http://www.christianitytoday.com/workplace/" target="_parent">Faith in the Workplace</a>';
	menu['global_lifefaith'][6] = '<a href="http://www.christianitytoday.com/holidays/" target="_parent">Holidays</a>';
	menu['global_lifefaith'][7] = '<a href="http://www.christianitytoday.com/teens/" target="_parent">Ignite Your Faith (Teens)</a>';
	menu['global_lifefaith'][8] = '<a href="http://www.christianitytoday.com/men/" target="_parent">Men&#39;s Devotional</a>';
	menu['global_lifefaith'][9] = '<a href="http://www.christianitytoday.com/singles/" target="_parent">Singles</a>';
	menu['global_lifefaith'][10] = '<a href="http://www.christianitytoday.com/spiritualhelp/" target="_parent">Spiritual Help</a>';

	// EDUCATION & JOBS menu
	menu['global_education'] = new Array();
	menu['global_education'][0] = '<a href="http://christiancollegeguide.net/" target="_parent">Christian College Guide</a>';
	menu['global_education'][1] = '<a href="http://seminarygradschool.com/" target="_parent">Seminary/Grad Guide</a>';
	menu['global_education'][2] = '<a href="http://cticlassifieds.com/cgi-bin/clink?ctclassifieds+rr7Xjr+index.html" target="_parent">Classifieds</a>';
	menu['global_education'][3] = '<a href="http://www.christianitytoday.com/workplace/" target="_parent">Faith in the Workplace</a>';
	menu['global_education'][4] = '<a href="http://www.christianitytoday.com/homeschool/" target="_parent">Home School Center</a>';
	menu['global_education'][5] = '<a href="http://www.christianitytoday.com/career/" target="_parent">Jobs &amp; Career</a>';

	// MAGAZINES menu
	menu['global_magazines'] = new Array();
	menu['global_magazines'][0] = '<a href="http://www.christianitytoday.com/ct/">Christianity Today</a>';
	menu['global_magazines'][1] = '<a href="http://www.christianitytoday.com/books/">Books &amp; Culture</a>';
	menu['global_magazines'][2] = '<a href="http://www.ctlibrary.com/">Christianity Today Library</a>';
	menu['global_magazines'][3] = '<a href="http://www.christianitytoday.com/lawandtax/">Church Law &amp; Tax Report</a>';
	menu['global_magazines'][4] = '<a href="http://www.churchlawtoday.com/ctainfo.php">Church Treasurer Alert</a>';
	menu['global_magazines'][5] = '<a href="http://www.christianitytoday.com/leaders/">Leadership</a>';
	menu['global_magazines'][6] = '<a href="http://www.christianitytoday.com/men/">Men of Integrity</a>';
	menu['global_magazines'][7] = '<a href="http://www.christianitytoday.com/cbg/">Your Church</a>';
	menu['global_magazines'][8] = '<a href="http://www.christianitytoday.com/free/features/magazines.html">Subscribe</a>';
	menu['global_magazines'][9] = '<a href="http://www.christianitytoday.com/help/features/contact.html#mag">Customer Care</a>';
	menu['global_magazines'][10] = '<a href="http://www.ctiadvertising.com/">Advertise with Us</a>';

	// MORE menu
	menu['global_more'] = new Array();
	menu['global_more'][0] = '<a href="http://www.christianitytoday.com/home/ctplus.html" target="_parent">CT Plus</a>';
	menu['global_more'][1] = '<a href="http://www.christianitytoday.com/home/churchleadership.html" target="_parent">Church Leadership</a>';
	menu['global_more'][2] = '<a href="http://www.christianitytoday.com/home/churchadmin.html" target="_parent">Church Administration</a>';
	menu['global_more'][3] = '<a href="http://www.christianitytoday.com/home/culturemedia.html" target="_parent">Culture &amp; Media</a>';
	menu['global_more'][4] = '<a href="http://www.christianitytoday.com/home/women.html" target="_parent">Women</a>';
	menu['global_more'][5] = '<a href="http://www.christianitytoday.com/home/lifefaith.html" target="_parent">Life &amp; Faith</a>';
	menu['global_more'][6] = '<a href="http://www.christianitytoday.com/home/educationjobs.html" target="_parent">Education &amp; Jobs</a>';
	menu['global_more'][7] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</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://www.PreachingTodayAudio.com/free.html" target="_parent">Audio Sermons</a>';
	menu['global_free'][2] = '<a href="http://store.yahoo.com/biblestudies/freesamples.html" target="_parent">Bible Studies</a>';
	menu['global_free'][3] = '<a href="http://www.christianitytoday.com/ecards/" target="_parent">E-cards</a>';
	menu['global_free'][4] = '<a href="http://buildingchurchleaders.com/store/freesamples.html" target="_parent">Leader Training</a>';
	menu['global_free'][5] = '<a href="http://www.christianitytoday.com/free/features/newsletters.html" target="_parent">Newsletters</a>';
	menu['global_free'][6] = '<a href="http://www.christianitytoday.com/help/features/rss.html" target="_parent">RSS Feeds</a>';
	menu['global_free'][7] = '<a href="http://www.preachingtoday.com/illustrations/search.html?type=keyword&query=&filterid=6198" target="_parent">Sermon Illustrations</a>';
	menu['global_free'][8] = '<a href="http://www.preachingtoday.com/sermons/" target="_parent">Sermons</a>';
	menu['global_free'][9] = '<a href="http://faithvisuals.com/content/freevideo.html" target="_parent">Video Clips</a>';
	menu['global_free'][10] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';

	// CTPLUS SHOPPING menu
	menu['global_shopping_ctplus'] = new Array();
	menu['global_shopping_ctplus'][0] = '<a href="http://store.yahoo.com/cgi-bin/clink?biblestudies+URLhWF+index.html" target="_parent">Bible Studies</a>';
	menu['global_shopping_ctplus'][1] = '<a href="http://www.christianbook.com/html/static/home_page.html?p=1029826" target="_parent">Books</a>';
	menu['global_shopping_ctplus'][2] = '<a href="http://www.christianbook.com/html/static/music.html?p=1029826" target="_parent">Music</a>';
	menu['global_shopping_ctplus'][3] = '<a href="http://www.christianbook.com/html/specialty/1007.html?p=1029826" target="_parent">Video/DVD</a>';
	menu['global_shopping_ctplus'][4] = '<a href="http://store.yahoo.com/cgi-bin/clink?ctclassifieds+WjDUxz+index.html" target="_parent">Classifieds</a>';
	menu['global_shopping_ctplus'][5] = '<a href="http://www.christianitytoday.com/free/features/magazines.html" target="_parent">Magazines</a>';
	menu['global_shopping_ctplus'][6] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-17370374580338+2Pv8j7+index.html" target="_parent">Movie Discussion Guides</a>';
	menu['global_shopping_ctplus'][7] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';

	// CHURCH LEADERSHIP SHOPPING menu
	menu['global_shopping_churchleadership'] = new Array();
	menu['global_shopping_churchleadership'][0] = '<a href="http://store.yahoo.com/cgi-bin/clink?biblestudies+URLhWF+index.html" target="_parent">Bible Studies</a>';
	menu['global_shopping_churchleadership'][1] = '<a href="http://www.reducingtherisk.com/" target="_parent">Child Safety</a>';
	menu['global_shopping_churchleadership'][2] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-15636219134485+efArAM+index.html" target="_parent">Children&#39;s Ministry</a>';
	menu['global_shopping_churchleadership'][3] = '<a href="http://www.christianbook.com/html/static/home_page.html?p=1029826" target="_parent">Books, Music, Video/DVD</a>';
	menu['global_shopping_churchleadership'][4] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-78230354700659+JsnuAB+index.html" target="_parent">Church Law &amp; Tax</a>';
	menu['global_shopping_churchleadership'][5] = '<a href="http://www.christianitytoday.com/cbg" target="_parent">Church Products &amp; Services</a>';
	menu['global_shopping_churchleadership'][6] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-78230354700659+JsnuAB+safety2.html" target="_parent">Church Safety</a>';
	menu['global_shopping_churchleadership'][7] = '<a href="http://store.yahoo.com/cgi-bin/clink?ctclassifieds+WjDUxz+index.html" target="_parent">Classifieds</a>';
	menu['global_shopping_churchleadership'][8] = '<a href="http://faithvisuals.com/" target="_parent">Faith Visuals</a>';
	menu['global_shopping_churchleadership'][9] = '<a href="http://buildingchurchleaders.com/store" target="_parent">Leader Training</a>';
	menu['global_shopping_churchleadership'][10] = '<a href="http://www.christianitytoday.com/free/features/magazines.html" target="_parent">Magazines</a>';
	menu['global_shopping_churchleadership'][11] = '<a href="http://preachingtodaysermons.com/" target="_parent">Sermons</a>';
	menu['global_shopping_churchleadership'][12] = '<a href="http://www.smallgroups.com/store/" target="_parent">Small Groups</a>';
	menu['global_shopping_churchleadership'][13] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';

	// CHURCH ADMIN SHOPPING menu
	menu['global_shopping_churchadmin'] = new Array();
	menu['global_shopping_churchadmin'][0] = '<a href="http://store.yahoo.com/cgi-bin/clink?biblestudies+URLhWF+index.html" target="_parent">Bible Studies</a>';
	menu['global_shopping_churchadmin'][1] = '<a href="http://www.reducingtherisk.com/" target="_parent">Child Safety</a>';
	menu['global_shopping_churchadmin'][2] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-15636219134485+efArAM+index.html" target="_parent">Children&#39;s Ministry</a>';
	menu['global_shopping_churchadmin'][3] = '<a href="http://www.christianbook.com/html/static/home_page.html?p=1029826" target="_parent">Books, Music, Video/DVD</a>';
	menu['global_shopping_churchadmin'][4] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-78230354700659+JsnuAB+index.html" target="_parent">Church Law &amp; Tax</a>';
	menu['global_shopping_churchadmin'][5] = '<a href="http://www.christianitytoday.com/cbg" target="_parent">Church Products &amp; Services</a>';
	menu['global_shopping_churchadmin'][6] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-78230354700659+JsnuAB+safety2.html" target="_parent">Church Safety</a>';
	menu['global_shopping_churchadmin'][7] = '<a href="http://store.yahoo.com/cgi-bin/clink?ctclassifieds+WjDUxz+index.html" target="_parent">Classifieds</a>';
	menu['global_shopping_churchadmin'][8] = '<a href="http://faithvisuals.com/" target="_parent">Faith Visuals</a>';
	menu['global_shopping_churchadmin'][9] = '<a href="http://buildingchurchleaders.com/store/" target="_parent">Leader Training</a>';
	menu['global_shopping_churchadmin'][10] = '<a href="http://www.christianitytoday.com/free/features/magazines.html" target="_parent">Magazines</a>';
	menu['global_shopping_churchadmin'][11] = '<a href="http://preachingtodaysermons.com/" target="_parent">Sermons</a>';
	menu['global_shopping_churchadmin'][12] = '<a href="http://www.smallgroups.com/store/" target="_parent">Small Groups</a>';
	menu['global_shopping_churchadmin'][13] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';

	// CULTURE & MEDIA SHOPPING menu
	menu['global_shopping_culturemedia'] = new Array();
	menu['global_shopping_culturemedia'][0] = '<a href="http://store.yahoo.com/cgi-bin/clink?biblestudies+URLhWF+index.html" target="_parent">Bible Studies</a>';
	menu['global_shopping_culturemedia'][1] = '<a href="http://www.christianbook.com/html/static/home_page.html?p=1029826" target="_parent">Books</a>';
	menu['global_shopping_culturemedia'][2] = '<a href="http://www.christianbook.com/html/static/music.html?p=1029826" target="_parent">Music</a>';
	menu['global_shopping_culturemedia'][3] = '<a href="http://www.christianbook.com/html/specialty/1007.html?p=1029826" target="_parent">Video/DVD</a>';
	menu['global_shopping_culturemedia'][4] = '<a href="http://store.yahoo.com/cgi-bin/clink?ctclassifieds+WjDUxz+index.html" target="_parent">Classifieds</a>';
	menu['global_shopping_culturemedia'][5] = '<a href="http://www.christianitytoday.com/free/features/magazines.html" target="_parent">Magazines</a>';
	menu['global_shopping_culturemedia'][6] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-17370374580338+2Pv8j7+index.html" target="_parent">Movie Discussion Guides</a>';
	menu['global_shopping_culturemedia'][7] = '<a href="http://store.yahoo.com/cgi-bin/clink?biblestudies+URLhWF+debychmu.html" target="_parent">Music Devotions</a>';
	menu['global_shopping_culturemedia'][8] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';

	// WOMEN SHOPPING menu
	menu['global_shopping_women'] = new Array();
	menu['global_shopping_women'][0] = '<a href="http://store.yahoo.com/cgi-bin/clink?biblestudies+URLhWF+index.html" target="_parent">Bible Studies</a>';
	menu['global_shopping_women'][1] = '<a href="http://www.christianbook.com/html/static/home_page.html?p=1029826" target="_parent">Books</a>';
	menu['global_shopping_women'][2] = '<a href="http://www.christianbook.com/html/static/music.html?p=1029826" target="_parent">Music</a>';
	menu['global_shopping_women'][3] = '<a href="http://www.christianbook.com/html/specialty/1007.html?p=1029826" target="_parent">Video/DVD</a>';
	menu['global_shopping_women'][4] = '<a href="http://store.yahoo.com/cgi-bin/clink?ctclassifieds+WjDUxz+index.html" target="_parent">Classifieds</a>';
	menu['global_shopping_women'][5] = '<a href="http://www.christianitytoday.com/free/features/magazines.html" target="_parent">Magazines</a>';
	menu['global_shopping_women'][6] = '<a href="http://store.yahoo.com/cgi-bin/clink?yhst-52795328905550+QNXxhU+index.html" target="_parent">Women&#39;s Downloads</a>';
	menu['global_shopping_women'][7] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';

	// LIFE & FAITH SHOPPING menu
	menu['global_shopping_lifefaith'] = new Array();
	menu['global_shopping_lifefaith'][0] = '<a href="http://store.yahoo.com/cgi-bin/clink?biblestudies+URLhWF+index.html" target="_parent">Bible Studies</a>';
	menu['global_shopping_lifefaith'][1] = '<a href="http://www.christianbook.com/html/specialty/1003.html?p=1029826" target="_parent">Bibles</a>';
	menu['global_shopping_lifefaith'][2] = '<a href="http://www.christianbook.com/html/static/home_page.html?p=1029826" target="_parent">Books</a>';
	menu['global_shopping_lifefaith'][3] = '<a href="http://www.christianbook.com/html/static/music.html?p=1029826" target="_parent">Music</a>';
	menu['global_shopping_lifefaith'][4] = '<a href="http://www.christianbook.com/html/specialty/1007.html?p=1029826" target="_parent">Video/DVD</a>';
	menu['global_shopping_lifefaith'][5] = '<a href="http://store.yahoo.com/cgi-bin/clink?ctclassifieds+WjDUxz+index.html" target="_parent">Classifieds</a>';
	menu['global_shopping_lifefaith'][6] = '<a href="http://www.christianitytoday.com/free/features/magazines.html" target="_parent">Magazines</a>';
	menu['global_shopping_lifefaith'][7] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';

	// EDUCATION SHOPPING menu
	menu['global_shopping_education'] = new Array();
	menu['global_shopping_education'][0] = '<a href="http://www.christianbook.com/html/specialty/6857.html?p=1029826" target="_parent">Academic Books</a>';
	menu['global_shopping_education'][1] = '<a href="http://store.yahoo.com/cgi-bin/clink?ctclassifieds+WjDUxz+index.html" target="_parent">Classifieds</a>';
	menu['global_shopping_education'][2] = '<a href="http://www.christianbook.com/html/specialty/1016.html?p=1029826" target="_parent">Home School Curriculum</a>';
	menu['global_shopping_education'][3] = '<a href="http://www.christianbook.com/Christian/Books/easy_find?Ntk=keywords&Ntt=career+job&action=Search&N=0&Ne=0&event=ESRCN&nav_search=1&cms=1?p=1029826" target="_parent">Job Search Resources</a>';
	menu['global_shopping_education'][4] = '<a href="http://www.christianitytoday.com/free/features/magazines.html" target="_parent">Magazines</a>';
	menu['global_shopping_education'][5] = '<a href="http://www.ctiadvertising.com/" target="_parent">Advertise with Us</a>';


// multi-newsletter subscription 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 "buildingadultministries":
					c_text = c_text + "Building Adult Ministries (bimonthly) \n";
					break;
					case "buildingchurchleaders":
					c_text = c_text + "Building Church Leaders (weekly) \n";
					break;
					case "buildingforministry":
					c_text = c_text + "Building for Ministry (bimonthly) \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 + "Christian News and Research Newsletter -- ChristianityTodayLibrary.com (semimonthly) \n";
					break;
					case "visionproject":
					c_text = c_text + "The Christian Vision Project (monthly) \n";
					break;
					case "churchlaughs-html":
					c_text = c_text + "Church Laughs (weekly) \n";
					break;
					case "churchofficetodayupdate":
					c_text = c_text + "Church Office Today Update (monthly) \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 "smalleyonline":
					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 "womenleaders":
					c_text = c_text + "Gifted for Leadership \n";
					break;
					case "leadership-html":
					c_text = c_text + "Leadership Weekly \n";
					break;
					case "shapevine":
					c_text = c_text + "Shapevine \n";
					break;
					case "outofur":
					c_text = c_text + "Out of Ur \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 + "Leading Outreach 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 "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":
					c_text = c_text + "Your Church Safety Newsletter (monthly) \n";
					break;
					case "encouragingwords":
					c_text = c_text + "Encouraging Words (daily) \n";
					break;
					case "dotcomunity":
					c_text = c_text + "Dot Com&#40unity&#41	 (weekly) \n";
					break;
					case "kyria":
					c_text = c_text + "Kyria	 (weekly) \n";
					break;
				}
			}
		}
	
		if (c_text != "")
		{
			s_email = document.subscribeform.email.value;
			document.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);
		}
	}

	var emailRegex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

	function check_email(theForm)
	{
		if (emailRegex.test(theForm.email.value)) return(true);
		alert("Please enter a valid Email address");
		theForm.email.focus();
		theForm.email.select();
		return(false);
	}



// legacy 'GLOBALJS.TXT' code

// variables
var BASE = 'http://www.christianitytoday.com';
var clickPath;
var PLATFORM = navigator.appVersion.toLowerCase();
var CLIENT = navigator.appName.toLowerCase();
var VERSION = parseInt (navigator.appVersion);

var DOCREF = document.referrer.slice((document.referrer.indexOf('//') + 2), document.referrer.indexOf('.', document.referrer.indexOf('.') + 1));

// alternate stylesheets
if (CLIENT != 'netscape' || VERSION > 4) document.write('<link rel="stylesheet" href="' + BASE + '/global/globalie.css" type="text/css">');
if ((PLATFORM.indexOf('mac') != -1) && ! (CLIENT != 'netscape' && VERSION > 4)) document.write('<link rel="stylesheet" href="' + BASE + '/global/globalmac.css" type="text/css">');

// redirects
function jump(URL)
{
	if (URL == '0') return;
	clickPath = ((URL.indexOf('http://') == -1) && (URL.indexOf('https://') == -1) && (URL.indexOf('javascript:') == -1)) ? BASE + URL : URL;
	top.location = clickPath;
	return(false);
}

// utilities
function email()
{
	document.write('<table cellpadding="0" cellspacing="0" border="0"><tr><td><a href="javascript:emailOpen();"><img src="' + BASE + '/global/images/email.gif" width="20" height="20" border="0" alt="E-mail this page"></a></td><td><a href="javascript:emailOpen();" class="pageutility">E-mail this page</a></td></tr></table>');
}
function printpage()
{
	document.write('<table cellpadding="0" cellspacing="0" border="0"><tr><td><a href="javascript:printOpen();"><img src="' + BASE + '/global/images/printer.gif" width="20" height="20" border="0" alt="Printer version"></a></td><td><a href="javascript:printOpen();" class="pageutility">Printer version</a></td></tr></table>');
}
function bookmark()
{
	if (PLATFORM.indexOf('mac') == -1)
	{
		if (CLIENT != 'netscape')
		{
			var bookmarkLink = 'javascript:window.external.AddFavorite(this.location.href, document.title);';
		}
		else
		{
			var bookmarkLink = 'javascript:alert(\'Click on &quot;OK&quot;, then type CTRL-D to add this page to your list of bookmarks.\');';
		}
		var bookmarkButton = '<table cellpading="0" cellspacing="0" border="0"><tr><td><a href="' + bookmarkLink + '"><img src="' + BASE + '/global/images/bookmark.gif" width="20" height="20" border="0" alt="Bookmark this page"></a></td><td><a href="' + bookmarkLink + '" class="pageutility">Bookmark this page</a></td></tr></table>';
		document.write(bookmarkButton);
	}
}
function homepage()
{
	if (CLIENT != 'netscape')
	{
		document.write('<table cellpadding="0" cellspacing="0" border="0"><tr><td><a href="javascript:void(0);" onclick="this.style.behavior=\'url(#default#homePage)\';this.setHomePage(top.location.href);"><img src="' + BASE + '/global/images/homepage.gif" width="20" height="20" border="0" alt="Make this your home"></a></td><td><a href="javascript:void(0);" onclick="this.style.behavior=\'url(#default#homePage)\';this.setHomePage(top.location.href);" class="pageutility">Make this your home</a></td></tr></table>');
	}
}
function rssfeeds()
{
	document.write('<table cellpadding="0" cellspacing="0" border="0"><tr><td><a href="' + BASE + '/help/features/rss.html"><img src="' + BASE + '/global/images/rss.gif" width="20" height="20" border="0" alt="RSS Feeds"></a></td><td><a href="' + BASE + '/help/features/rss.html" class="pageutility">RSS Feeds</a></td></tr></table>');
}
function pageUtilities()
{
	email();
	bookmark();
	homepage();
	rssfeeds();
	var backLink = this.location.href + '#top';
	var backButton = '<table cellpadding="0" cellspacing="0" border="0"><tr><td><a href="' + backLink + '"><img src="' + BASE + '/global/images/backtotop.gif" width="20" height="20" border="0" alt="Back to top &#133; "></a></td><td><a href="' + backLink + '" class="pageutility">Back to top</a></td></tr></table>';
	document.write(backButton);
}
function navUtilities()
{
	email();
	bookmark();
	printpage();
	rssfeeds();
}
function navUtilitiesIndex()
{
	email();
	bookmark();
	rssfeeds();
	homepage();
}
function emailOpen()
{
	docHREF = (window != top) ? document.referrer : location.href;
	window.open(BASE + '/email/index.html?title=' + escape(document.title) + '&url=' + escape(docHREF), 'emailChild', 'width=536,height=350,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0');
}
function printOpen()
{
	docHREF = (window != top) ? document.referrer : location.href;
	window.open(BASE + '/global/printer.html?' + escape(location.pathname), 'printChild', 'width=760,height=400,toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1');
}

// mouseovers
function DynButton (name, def, ovr)
{
	this.defimg = new Image();
	this.defimg.src = (0 == def.indexOf ('http:')) ?  def : BASE + def;
	this.ovrimg = new Image();
	this.ovrimg.src = (0 == ovr.indexOf ('http:')) ?  ovr : BASE + ovr;
	this.imgname = name;
	this.over = btnOver;
	this.out = btnOut;
}

function btnOver ()
{
	eval ('document.' + this.imgname).src = this.ovrimg.src;
}

function btnOut ()
{
	eval ('document.' + this.imgname).src = this.defimg.src;
}

// Flash detection
var isFlash = 0;
if (navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash'])
{
	var plugin = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin;
	if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf('.') - 1)) >= 4) isFlash = 1;
}
else if (CLIENT != 'netscape' && navigator.userAgent.indexOf('Windows 3.1') == -1)
{
	document.write('<script language="VBScript"\>\n');
	document.write('on error resume next\n');
	document.write('isFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))\n');
	document.write('</script\>\n');
}

// Functions to get, add, delete, and check for classes

function getElementsByClass(theClass) {
	var elementArray = [];
	if (typeof document.all !== 'undefined') {
		elementArray = document.all;
	} else {
		elementArray = document.getElementsByTagName('*');
	}

	var matchedArray = [];
	var pattern = new RegExp('(^| )' + theClass + '( |$)');
	for (var i = 0; i < elementArray.length; i++) {
		if (pattern.test(elementArray[i].className)) {
			matchedArray[matchedArray.length] = elementArray[i];
		}
	}

	return matchedArray;
};

function hasClass(elem, theClass) {
	var pattern = new RegExp('(^| )' + theClass + '( |$)');
	if (pattern.test(target.className)) {
		return true;
	}
	return false;
};

function addClass(elem, theClass) {
	if (hasClass(elem, theClass)) {
		if (target.className === '') {
			target.className = theClass;
		} else {
			target.className += ' ' + theClass;
		}
	}
};

function removeClass(elem, theClass) {
	var pattern = new RegExp('(^| )' + theClass + '( |$)');
	target.className = target.className.replace(pattern, '$1');
	target.className = target.className.replace(/ $/, '');
};
