// Regex the URL to check if user is in Tools Section
var there = new RegExp("http://.*/tools-for-palliative-care-programs\w*");
if (true == there.test(location.href)) {
	if (document.cookie) {
		var aCookie = document.cookie.split("; ");
		Loop1:
		for (var i=0; i < aCookie.length; i++) {
			var aCrumb = aCookie[i].split("=");
			if (('capc_list' == aCrumb[0]) && ('good' == aCrumb[1])) {
				var got_cookie = 'yes';
				//document.write(aCrumb[0] + '=' + aCrumb[1] + '<br/>');
				break Loop1;
			}
		}
	
		if (got_cookie == 'yes') {
			// Cookie verified allow to pass 
		}
		else {



			// Cookie not found. Relocate to signup page.
			location.href="/signup?tool=" + location.href.substr(location.href.indexOf('tools-for-palliative-care-programs')+34);
		}
	}
	else {
		// Cookies disabled. Relocate to signup page.
			location.href="/signup?tool=" + location.href.substr(location.href.indexOf('tools-for-palliative-care-programs')+34);
	}
}
