// settings
	emailURL = "/ct/email.html?title=%%title%%&url=%%url%%";
	printURL = "/ct/article_print.html?id=%%id%%";
	similarURL = "/ct/search.html?similar=%%url%%";

// channel load
//	function channelLoad()
//	{
		// TEMP - find 'related' section and apply style
//		var anchorArray = document.getElementsByTagName("a");
//		for (var i = 0; i < anchorArray.length; i++)
//		{
//			if (anchorArray[i].href.indexOf("#related") >= 0)
//			{
//				anchorArray[i].id = "relatedLink";
//				break;
//			}
//		}
//	}

// dropdown menus
	// NEWS menu
	menu["channel_news"] = new Array();
	menu["channel_news"][0] = '<a href="/ct/features/news/weblog/">Weblog</a>';
	menu["channel_news"][1] = '<a href="/ct/features/news/northamerica/unitedstates/">U.S.</a>';
	menu["channel_news"][2] = '<a href="/ct/features/news/africa/">Africa</a>';
	menu["channel_news"][3] = '<a href="/ct/features/news/asia/">Asia</a>';
	menu["channel_news"][4] = '<a href="/ct/features/news/centralamerica/">Central America</a>';
	menu["channel_news"][5] = '<a href="/ct/features/news/europe/">Europe</a>';
	menu["channel_news"][6] = '<a href="/ct/features/news/northamerica/">North America</a>';
	menu["channel_news"][7] = '<a href="/ct/features/news/oceania/">Oceania</a>';
	menu["channel_news"][8] = '<a href="/ct/features/news/southamerica/">South America</a>';
	menu["channel_news"][9] = '<a href="/ct/features/news/">All News</a>';
	
	// OPINION menu
	menu["channel_opinion"] = new Array();
	menu["channel_opinion"][0] = '<a href="/ct/features/opinion/editorials/">Editorials</a>';
	menu["channel_opinion"][1] = '<a href="/ct/features/opinion/columns/">Columns</a>';
	menu["channel_opinion"][2] = '<a href="/ct/features/opinion/speakingout/">Speaking Out</a>';
	menu["channel_opinion"][3] = '<a href="/ct/features/opinion/">All Opinion</a>';
	
	// BLOGS menu
	menu["channel_blogs"] = new Array();
	menu["channel_blogs"][0] = '<a href="http://blog.christianitytoday.com/ctliveblog/">CT Liveblog</a>';
	menu["channel_blogs"][1] = '<a href="http://blog.christianitytoday.com/ctpolitics/">CT Politics Blog</a>';
	menu["channel_blogs"][2] = '<a href="/ct/podcast/">CT Podcast</a>';
	menu["channel_blogs"][4] = '<a href="http://blog.christianitytoday.com/ctmovies/">CT Movies Blog</a>';
	menu["channel_blogs"][5] = '<a href="http://blog.christianitytoday.com/images/">Imago Fidei</a>';
	menu["channel_blogs"][6] = '<a href="http://blog.christianitytoday.com/women/">Women</a>';
	menu["channel_blogs"][7] = '<a href="/ct/feeds/">All RSS Feeds</a>';

	// REVIEWS menu
	menu["channel_reviews"] = new Array();
	menu["channel_reviews"][0] = '<a href="/ct/special/books.html">Books</a>';
	menu["channel_reviews"][1] = '<a href="/ct/movies/">Movies &amp; TV</a>';
	menu["channel_reviews"][2] = '<a href="/ct/music/">Music</a>';
	menu["channel_reviews"][3] = '<a href="/ct/features/reviews/othermedia/">Other Media</a>';
	
	// INDEX menu
	menu["channel_index"] = new Array();
	menu["channel_index"][0] = '<a href="/ct/features/index/hotissues/">Hot Issues</a>';
	menu["channel_index"][1] = '<a href="/ct/features/index/faithandthought/">Faith &amp; Thought</a>';
	menu["channel_index"][2] = '<a href="/ct/features/index/churchesandministry/">Churches &amp; Ministry</a>';
	menu["channel_index"][3] = '<a href="/ct/features/index/cultureandtechnology/">Culture &amp; Technology</a>';
	
	// ARCHIVES menu
	menu["channel_archives"] = new Array();
	menu["channel_archives"][0] = '<a href="/ct/archives/printissues.html">Browse by Print Issue</a>';
	// menu["channel_archives"][1] = '<a href="/ct/archives/">Browse by Posted Date</a>';
	
	// CONTACT US menu
	menu["channel_contact"] = new Array();
	menu["channel_contact"][0] = '<a href="/ct/help/contactus.html">Send Letter to the Editor</a>';
	menu["channel_contact"][1] = '<a href="/ct/help/contactus.html">Report a Problem</a>';
	menu["channel_contact"][2] = '<a href="https://w1.buysub.com/servlet/CSGateway?cds_mag_code=TDY">Subscription Service</a>';
	menu["channel_contact"][3] = '<a href="/ct/help/guidelines.html">Writers&#39; Guidelines</a>';
	menu["channel_contact"][4] = '<a href="/ct/help/info.html#permission">Reprint Permission</a>';
	menu["channel_contact"][5] = '<a href="/ct/help/info.html">About Christianity Today</a>';
	menu["channel_contact"][6] = '<a href="/ct/help/privacy.html">Privacy Policy</a>';

// rating functions
	function toggleEdit(currItem, editItem)	{
		if (document.getElementById) {	
			my_div = document.getElementById(currItem).style;
			my_div.display = (my_div.display == "none") ? "inline" : "none";	
			my_div = document.getElementById(editItem).style;
			my_div.display = (my_div.display == "inline") ? "none" : "inline";	
			return false;
		}
		else {				
			return true;
		}
	}
	
	function returnStar(hidestar, showstars, starimg, theRating, theForm)	{
		if (document.getElementById) {	
			my_vote = document.getElementById(hidestar).style;
			my_result = document.getElementById(showstars).style;
			my_img = document.getElementById(starimg);
			my_vote.display = (my_vote.display == "none") ? "inline" : "none";	
			my_result.display = (my_result.display == "inline") ? "none" : "inline";				
			
			switch(theRating) {
				case "1":
					my_img.src = "/ct/img/stars-1.gif";
					theForm.rating.value = '20';
					break;
				case "2":
					my_img.src = "/ct/img/stars-2.gif";
					theForm.rating.value = '40';
					break;
				case "3":
					my_img.src = "/ct/img/stars-3.gif";
					theForm.rating.value = '60';
					break;
				case "4":
					my_img.src = "/ct/img/stars-4.gif";
					theForm.rating.value = '80';
					break;
				case "5":
					my_img.src = "/ct/img/stars-5.gif";
					theForm.rating.value = '100';
					break;
				default:
					my_img.src = "/ct/img/stars-0.gif";
					theForm.rating.value = '0';
					break;
				}
			return false;
		}
		else {				
			return true;
		}
	}
	

	function validateDelete(theName){
		msg = confirm("Are you sure you want to delete the comment from " + theName + "?");
		if (msg==true) {
			return true;
		}
		return false;
	}	

	function validateUserDelete(){
		msg = confirm("Are you sure you want to delete your comment?");
		if (msg==true) {
			return true;
		}
		return false;
	}		
	
	function checkStarRate(theForm){
		if (theForm.rating.value == '0') {
			alert("Please select a Star Rating")
			return false;
		}
		return true;
	}

	var form_submitted = false;	
	
	function submitRateForm(theForm) {
		if (checkStarRate(theForm)) {
			if (form_submitted) {
				alert ("Your form has already been submitted. Please wait...");
				return false;
			} else {
				form_submitted = true;
				return true;
			}	
			return true;	
		} else {
			return false;
		}		
	}

// limit characters in a text area
	//
	// Usage:
	// <span id="limitText"><strong>1000</strong> characters remaining</span>
	// <textarea name="#" id="#" onkeyup="charCount(this,1000)" />
	//
	// Note: change limit of characters as needed
	//
	
	function charCount(what, maxCount) {
		var str = new String(what.value);
		var len = str.length;
		var limitSpan = document.getElementById("limitText");
		
		len = maxCount - len;
		
		if (document.getElementById) {	
			if (len < 0) {
				what.value = what.value.substring(0, maxCount);
			} else if (len > 1) {
				limitSpan.innerHTML = "<strong>" + len + "</strong> characters remaining";
			} else {
				limitSpan.innerHTML = "<strong>" + len + "</strong> character remaining";
			}
		}
	}
		
	function validateMessageBox() {
		var my_textarea = document.getElementById("message");
		if (my_textarea && my_textarea.value.length > 1000) {
			alert("Please limit your response to 1000 characters maximum.");
			return false;
		} else {
			return true;
		}
	}

	function stripURL(urlinput) { 
		urlString = new String(urlinput.value)
		strip_start = urlString.lastIndexOf('/');
		strip_end = urlString.length;
		strip_string = (urlString.substring(strip_start+1, strip_end)); 
		urlString ='http://christianitytoday.com/ct/comments/admin?url='+strip_string ;
		return(urlString);
		
	}
	
	function clearFilters()
		{
			var elements = document.getElementsByTagName("input");
			for (var i = 0; i < elements.length; i++)
			{
				if (elements[i].type == "checkbox" && elements[i].attributes.filter)
				{
					elements[i].checked = false;
				}
				if (elements[i].type == "radio" && elements[i].attributes.filter)
				{
					elements[i].checked = false;
				}
			}
			var element = document.getElementById("toneAny");
			if (element) element.checked = true;
		}
	
	function selectAll()
		{
			var elements = document.getElementsByTagName("input");
			for (var i = 0; i < elements.length; i++)
			{
				if (elements[i].type == "checkbox" && elements[i].attributes.filter)
				{
					elements[i].checked = true;
				}
				
			}
			var element = document.getElementById("toneAny");
			if (element) element.checked = true;
		}