function getParameter(curAttr){
	var myReturn = "";
	switch (curAttr[0]){
		case "N":
			if (curAttr[1] == "0") break;
		case "A":
		case "An":
		case "Ns":
		case "Ntk":
		case "Dn":
		case "Ntt":
		case "D":
			myReturn = curAttr[0] + "=" + curAttr[1];
			break;
	}
	return myReturn;
}
function urlOnLoad(){
	setupIntShow();
	var hideShow = document.getElementById("hide_show");
	var intInfo = document.getElementById("internalInfo");
	if (intShow == "true"){
		if (hideShow){
			hideShow.innerHTML = "hide";
			hideShow.style.color = "#000000";
			intInfo.style.padding = "3px";
		}
	}else{
		if (hideShow){
			hideShow.innerHTML = "show";
			hideShow.style.color = "#FFFFFF";
			intInfo.style.padding = "0px";
		}
	}
	showURL();
}
function setupIntShow(){
	if (getCookie("intShow") != null){
		intShow = getCookie("intShow");
	}
}
function toggleInteralURL(){
	setupIntShow();
	var hideShow = document.getElementById("hide_show");
	var intInfo = document.getElementById("internalInfo");
	if (intShow == "true"){
		intShow = "false";
		if (hideShow){
			hideShow.innerHTML = "show";
			hideShow.style.color = "#FFFFFF";
			intInfo.style.padding = "0px";
			setCookie("intShow","false",null);
		}
	}else{
		intShow = "true";
		if (hideShow){
			hideShow.innerHTML = "hide";
			hideShow.style.color = "#000000";
			intInfo.style.padding = "3px";
			setCookie("intShow","true",null);
		}
	}
	showURL();
}
function showURL(){
	if (ip){
		if (((ip.indexOf("172.16") == 0) || (ip.indexOf("192.168") == 0) || (ip == "127.0.0.1") || (ip == "209.136.112.131") || (ip == "216.0.60.131")) && (window.location.pathname.match(/\/shopping\//) == null) && (window.location.pathname.match(/\/product\//) == null) && (window.location.pathname.match(/\/shop\//) == null)){
			var intInfo = document.getElementById("internalInfo");
			var toggleInt = document.getElementById("toggleInt");
			if (intInfo){
				var displayURL = "true";
				
				var protocol = window.location.protocol;
				var host = window.location.host;
				var path = window.location.pathname;
				var parameters = window.location.search;
				
				if (host == "oreb" || host == "vignette" || host == "lifeway.com") host = "www.lifeway.com";
				
				//alert("protocol: '" + protocol + "'\nhost: '" + host + "'\npath: '" + path + "'\nparameters: '" + parameters + "'");
				
				if (parameters.length > 0) parameters = parameters.substr(1);

				while (path.indexOf("%") >= 0){
					path = unescape(path);
				}
				var url = "";
				if (path.indexOf("pc_") >= 0 && path.indexOf("_mainpage") >= 0){
					//alert("inside checkout");
					displayURL = "false";
				}else if (path.indexOf("/search/results/") >= 0){
					//alert("inside search results pages");
					page = "search/results";
					url = protocol + "//" + host + "/" + page + "/?" + unescape(parameters);
				}else{
					//alert("inside content pages");
					var menu = 0;
					var article = 0;
					var event = 0;

					if (path.indexOf("/") == 0){
						path = path.substr(1);
					}
					//alert("removed first slash: '" + path + "' len: " + path.length + " path.slice(path.length - 1) = " + path.slice(path.length - 1));
					if (path.slice(path.length - 1) == "/"){
						path = path.slice(0,path.length - 1);
					}
					if (path.indexOf("/") > 0){
						var file = path.split("/");
						file = file[file.length - 1];
						if (file.length > 0){
							file = file.split(",");
							var attr = file[file.length - 2];
							attr = attr.split("&");
							for (var x = 0; x < attr.length; x++){
								var curAttr = attr[x].split("=");
								if (curAttr[0] == "M" || curAttr[0] == "m"){
									menu = curAttr[1];
								}
								if (curAttr[0] == "A" || curAttr[0] == "a"){
									article = curAttr[1];
								}
								if (curAttr[0] == "E" || curAttr[0] == "e"){
									event = curAttr[1];
								}
							}
						}
					}
					if (event > 0) {
						path = "/event/?id=" + event;
					}else if (article > 0){
						path = "/article/?id=" + article;
					}else if (menu > 0){
						path = "/menu/?id=" + menu;
					}else{
						path = "/lwc"
					}
					url = protocol + "//" + host + path;
				}
				if (displayURL == "true"){
					if (masterShow == "true"){
						intInfo.style.display = "";
						intInfo.innerHTML = "This info is only visible to internal viewers of LifeWay.com<br />Use this link to promote this page:  <strong>$url</strong><br /><a href=\"$url\" target=\"_blank\">test this link</a>";
						toggleInt.style.display = "";
					}else{
						intInfo.style.display = "none";
						intInfo.innerHTML = "";
						toggleInt.style.display = "none";
					}
					if (intShow == "true"){
						intInfo.style.display = "";
						intInfo.innerHTML = "This info is only visible to internal viewers of LifeWay.com<br />Use this link to promote this page:  <strong>$url</strong><br /><a href=\"$url\" target=\"_blank\">test this link</a>";
					}else{
						intInfo.style.display = "none";
						intInfo.innerHTML = "";
					}
					intInfo.innerHTML = intInfo.innerHTML.replace(/\$url/gi,url);
				}
			}
		}
	}
}