/* Feed retriever */
liltype.FeedGetter = function (url, obj, method)
{
	if (obj && url)
	{
		this.url = url;
		this.obj = obj;
		this.method = method ? method : "callback";
	}
}
new liltype.FeedGetter();
liltype.FeedGetter.feeds = [];
liltype.FeedGetter.prototype = 
{
	"url": "",
	"entries": 3,
	"onLoad": function(result)
	{
		this.obj[this.method](result);
	},
	"get": function(format)
	{
		var feed, obj = this;
		feed = new google.feeds.Feed(this.url);
		feed.setResultFormat(format ? format : google.feeds.Feed.JSON_FORMAT);
		feed.setNumEntries(this.entries);
		feed.load(function(result) { obj.onLoad(result); });
		liltype.FeedGetter.feeds.push(feed);
	}
};

liltype.execDep =
/* Dependent execution */
{
	"handlerWrappers": [],
	"flags": [],
	"add": function(flags, h, m)
	{
		var i, c, f;
		var w =
		{
			"handler": h,
			"method": m ? m : "exec",
			"complete": false,
			"flags": []
		}
		for (i = 0, c = flags.length; i < c; i++)
		{
			f = flags[i];
			if (!this.flags[f])
			{
				this.flags[f] =
				{
					"name": f,
					"complete": false
				};
			}
			w.flags.push(this.flags[f]);
		}
		this.handlerWrappers.push(w);
	},
	"exec": function(f)
	{
		var flag, i, c, hw, ii, cc, exec;
		if (flag = this.flags[f])
		{
			flag.complete = true;
		}
		for (i = 0, c = this.handlerWrappers.length; i < c; i++)
		{
			hw = this.handlerWrappers[i];
			if (!hw.complete)
			{
				exec = true;
				for (ii = 0, cc = hw.flags.length; ii < cc; ii++)
				{
					if (!hw.flags[ii].complete)
					{
						exec = false;
						break;
					}
				}
				if (exec && !hw.complete)
				{
					hw.complete = true;
					hw.handler[hw.method]();
				}
			}
		}
	}
};

abilitypath =
{
	"areaLandingSlideshowTimeout": 5000,
	"areaLandingSlideshowTimeoutId": null,
	"ssoSeed": null,
	"homeLinx": [],
	
	/*
		START: Utilities
	*/
	"truncator": function(str, pos, append)
	{
		var len;
		
		str = str.replace(/<[^>]+>/g, " ");
		str = str.replace(/\&nbsp;/g, " ");
		
		len = str.length;

		if (pos >= len)
		{
			return str;
		}
		pos--;
		len--;
		
		while ((pos < len) &&
		       !str.substr(pos, 1).match(/\s/))
		{
			pos++;
		}
		
		if (pos < len)
		{
			return str.substr(0, pos)+append;
		}
		else
		{
			return str.substr(0, len + 1);
		}
	},
	/*
		END: Utilities
	*/


	
	/*
		START: Call out boxes - hide/show handlers
	*/
		"showMoreCallOutB": function()
		{
			jQuery("div.more_articles", liltype.parentClass(jQuery(this), "call_out_b")).removeClass("hidden");
			return false;
		},
		
		"hideMoreCallOutB": function()
		{
			jQuery("div.more_articles", liltype.parentClass(jQuery(this), "call_out_b")).addClass("hidden");
			return false;
		},
		
		"showMoreCallOutC": function()
		{
			jQuery("div.more_articles", liltype.parentClass(jQuery(this), "call_out_c")).removeClass("hidden");
			return false;
		},
		
		"hideMoreCallOutC": function()
		{
			jQuery("div.more_articles", liltype.parentClass(jQuery(this), "call_out_c")).addClass("hidden");
			return false;
		},
	/*
		END: Call out boxes - hide/show handlers
	*/
	
	/*
		START: AJAX Feed handlers
	*/
		"onCallOutRSS": function(result)
		{
			var i, c, html = "", entry;
			c =
				result.feed.entries.length < 4 ?
				result.feed.entries.length : 
				4;

			if (!c)
			{
				liltype.parentClass(this.jqTgt, "call_out_a").addClass("hidden");
				return;
			}

			for (i = 0; i < c; i++)
			{
				entry = result.feed.entries[i];
				html +=
				(
					'<div class="li">'+
						'<a href="'+entry.link+'" target="'+(this.aTgt ? "_self" : "_blank")+'">'+entry.title+'<'+'/a>'+
					'<'+'/div>'
				);
			}
			this.jqTgt.html(html).removeClass("hidden");
		},
		
		"regCallOutRSS": function(selector)
		{
			var jq = jQuery(selector);
			abilitypath.googleAJAXFeed.reg
			(
				{
					"url": jQuery("span", jq).eq(0).html().replace(/\&amp;/g, "&"),
					"callback": abilitypath.onCallOutRSS,
					"jqTgt": jq,
					"aTgt": selector.match(/discuss/),
					"selector": selector
				}
			);
		},
	/*
		END: AJAX Feed handlers
	*/


	/*
		START: Left Navigation
	*/
		"leftNav": function(selector)
		{
			var i, c, jq = jQuery(selector+" a"), jqs, href,
			    locTgt = window.location.pathname.replace(/^([^\?]+)\??.*$/, "$1").toLowerCase(), locSrc;

			for (i = 0, c = jq.length; i < c; i++)
			{
				if (jq.eq(i).attr("href").replace(/^[^:]+:\/\/[^\/]+\//, "/").toLowerCase() == locTgt)
				{
					jq.eq(i).addClass("on_page");
					break;
				}
			}
			
			jqs = jQuery(selector+" div.linksetSubMenu-2");
			locTgt = locTgt.replace(/\/[^\/]+$/, "/");
			for (i = 0, c = jqs.length; i < c; i++)
			{
				jq = jqs.eq(i);
				href = jQuery("a", jq).eq(0).attr("href").replace(/^[^:]+:\/\/[^\/]+\//, "/").toLowerCase();
				href = href.replace(/\/[^\/]+$/, "/");
				if (href == locTgt)
				{
					jq.css("display", "block");
					return;
				}
			}
			
		},
	/*
		END: Left Navigation
	*/

	/*
		START: Top nav flyouts
	*/
		"topFlyout": function(selector)
		{
			jQuery(selector+" li.lev1").mouseover
			(
				function()
				{
					var jq = jQuery(this);
					if (jq.hasClass("lev1"))
					{
						jQuery("ul", jq).eq(0).attr("style", "");
					}
					jq.addClass("over");
				}
			).mouseout
			(
				function()
				{
					var jq = jQuery(this);
					jq.removeClass("over");
				}
			);
		},
	/*
		END: Top nav flyouts
	*/	

	/*
		START: Useful links login state
	*/
		"usefulLinksCount": 0,
		"dashImg": null,
		"usefulLinks": function(selector)
		{
			var iframe, name, textSizers, i, c, a, finalPass;

			if (!this.ssoSeed)
			{
				this.ssoSeed = Math.round(Math.random() * 100000000)
				iframe = document.createElement("IFRAME");
				iframe.id = "ap_crm_cookie";
				iframe.name = "ap_crm_cookie";
				iframe.src = "http://crm.abilitypath.org/site/PageServer?pagename=util_set_sso_cookie&sso_seed="+this.ssoSeed;
				iframe.width = 0;
				iframe.height = 0;
				iframe.scrolling = "no";
				iframe.frameBorder = 0;
				iframe.marginwidth = 0;
				iframe.marginheight = 0;
				iframe.hspace = 0;
				iframe.vspace = 0;
				document.getElementById("ap_crm_cookie_outer").appendChild(iframe);
				setTimeout(function() { abilitypath.usefulLinks(selector); }, 25);
				
				/* Fix the iframe behind the text size flyout */
				textSizers = jQuery(selector+" div.fw_header_text_size");
				for (i = 0, c = textSizers.length; i < c; i++)
				{
					a = jQuery("a", textSizers.eq(i)).eq(0);
					iframe = document.createElement("IFRAME");
					iframe.name = "text_sizer_iframe"+i;
					iframe.id = iframe.name;
					iframe.src = "http://www.abilitypath.org/blank.html";
					iframe.width = 0;
					iframe.height = 0;
					iframe.scrolling = "no";
					iframe.frameBorder = 0;
					iframe.marginwidth = 0;
					iframe.marginheight = 0;
					iframe.hspace = 0;
					iframe.vspace = 0;
					a.get(0).parentNode.insertBefore(iframe, a.get(0).nextSibling);					
				}
			}
			else
			{
				abilitypath.cookieSess.init();
				name = null;

				if ((name = abilitypath.cookieSess.get("CONSNAME")).length)
				{
					jQuery(selector+" .member_name").html(name.substr(0, 1).toUpperCase()+name.substr(1));
					jQuery(selector+" div.anonymous").css("display", "none").addClass("hidden");
					jQuery(selector+" div.member").css("display", "block").removeClass("hidden");
				}
				else
				{
					jQuery(selector+" div.anonymous").css("display", "block").removeClass("hidden");
					jQuery(selector+" div.member").css("display", "none").addClass("hidden");
				}

				if (abilitypath.cookieSess.get("SSOSEED") != this.ssoSeed)
				{
					setTimeout(function() { abilitypath.usefulLinks(selector); }, 25);
				}
				else
				{
					if (name && (window.location.pathname.match(/^\/index\.html/) || window.location.pathname.match(/^\/$/)))
					{
						window.location = "http://www.abilitypath.org/members-home.html";
					}
					liltype.execDep.exec("foundLoginStatus");
				}
			}
			
			if (!this.dashImg && !window.location.host.match(/community/i))
			{
				setTimeout(function() { abilitypath.profileLink(selector); }, 25);
			}
		},
		"profileLink": function(selector)
		{
			//Not used
		},
	/*
		END: Useful links login state
	*/	


	/*
		START: Call out box B
	*/
		"callOutBoxesB": function(containerJQ)
		{
			var i, c, jqcs, jqc, m, n, ii, cc, articleCount;
			containerJQ = containerJQ ? containerJQ : document;
			if ((jqcs = jQuery("div.call_out_b", containerJQ)).length)
			{
				for (i = 0, c = jqcs.length; i < c; i++)
				{
					jqc = jqcs.eq(i);
					
					n = 3;
					if (m = jqc.get(0).className.match(/(^|\s)n_([0-9]+)(\s|$)/))
					{
						n = Number(m[2]);
					}
		
					/* Link the continue... link */
					jqs = jQuery("div.article_one div.headline a", jqc);
					jQuery("div.article_one a", jqc).attr("href", jqs.attr("href"));
					
					/* Hide early entries on 2-n and n+ */
					jQuery("div.article_two_thru_n div.article", jqc).eq(0).addClass("hidden");
					for (ii = 0, cc = n + 1; ii < cc; ii++)
					{
						jQuery("div.more_articles div.article", jqc).eq(ii).addClass("hidden");
					}
		
					if (jQuery("div.article_one a", jqc).length)
					/* There are more than 1 articles */
					{
						if (jQuery("div.article_two_thru_n div.article", jqc).length == 1)
						/* Hide two thru n if only one article */
						{
							jQuery("div.article_one", jqc).css("padding", "0px").css("width", "100%");
							jQuery("div.article_two_thru_n", jqc).addClass("hidden");
							jQuery("div.more_articles_link", jqc).addClass("hidden");
						}
						else if (jQuery("div.more_articles div.article", jqc).length < (n + 2))
						/* Hide more_articles_link thru end if only n + 1 article */
						{
							jQuery("div.more_articles_link", jqc).addClass("hidden");
						}
						else
						{
							jQuery("div.more_articles_link a", jqc).click(abilitypath.showMoreCallOutB);
							jQuery("div.hide_articles_link a", jqc).click(abilitypath.hideMoreCallOutB);
						}
		
						/* Show the entire box */
						liltype.parentClass(jqc, "box_rc_a").css("display", "block");
					}
					else
					{
						liltype.parentClass(jqc, "box_rc_a").css("display", "none");
					}
		
					jQuery("div.article_two_thru_n div.article", jqc).eq(1).addClass("first");
					jQuery("div.more_articles div.article", jqc).eq(n + 1).addClass("first");
				}
			}
		},
	/*
		END: Call out box B
	*/

	/*
		START: Call out box C
	*/	
		"callOutBoxesC": function(containerJQ)
		{
			var i, c, jqcs, jqc, m, n, ii, cc, tags, tag, html;
			containerJQ = containerJQ ? containerJQ : document;
			if ((jqcs = jQuery("div.call_out_c", containerJQ)).length)
			{
				for (i = 0, c = jqcs.length; i < c; i++)
				{
					jqc = jqcs.eq(i);
					
					n = 5;
					if (m = jqc.get(0).className.match(/(^|\s)n_([0-9]+)(\s|$)/))
					{
						n = Number(m[2]);
					}
		
					/* Hide early entries on n */
					for (ii = 0, cc = n; ii < cc; ii++)
					{
						jQuery("div.more_articles div.article", jqc).eq(ii).addClass("hidden").css("display", "none");
					}
					
					if (!jQuery("div.article", jqc).length)
					{
						liltype.parentClass(jqc, "box_rc_a").addClass("hidden");
					}
					else if (jQuery("div.more_articles div.article", jqc).length > (n + 1))
					{
						jQuery("div.more_articles_link a", jqc).click(abilitypath.showMoreCallOutC);
						jQuery("div.hide_articles_link a", jqc).click(abilitypath.hideMoreCallOutC);
					}
					else
					{
						jQuery("div.more_articles_link", jqc).addClass("hidden");
					}
				}
				
				jqcs = jQuery("div.call_out_c div.article", containerJQ);
				for (i = 0, c = jqcs.length; i < c; i++)
				{
					jqc = jqcs.eq(i);
					tags = jQuery("div.article_data div.tags a", jqc);
					html = "";
					for (ii = 0, cc = tags.length; ii < cc; ii++)
					{
						tag = tags.eq(ii);
						html += ', <a href="'+tag.attr("href")+'">'+tag.html()+'</a>';
					}
					jQuery("div.col_right div.tags", jqc).html("Tags: "+html.substr(2));
				}
			}
		},
	/*
		END: Call out box C
	*/	

	/*
		START: Change text size
	*/
		"changeTextSize": function(size)
		{
			this.cookieSess.set("TEXTSIZE", size);
			jQuery("div#contentDiv").removeClass("normal").removeClass("big").removeClass("bigger").addClass(size);
			return false;
		},
		"initChangeTextSize": function()
		{
			var textSize;
			jQuery("div.fw_header_text_size").mouseover
			(
				function()
				{
					var
						li = jQuery(this).addClass("over"),
						div = jQuery("div.text_flyout", li);
					jQuery("iframe", li)
						.css("height", div.get(0).offsetHeight+"px")
						.css("width", div.get(0).offsetWidth+"px");
				}
			).mouseout
			(
				function()
				{
					jQuery(this).removeClass("over");
				}
			);
			if (textSize = this.cookieSess.get("TEXTSIZE"))
			{
				this.changeTextSize(textSize);
			}
		},
	/*
		END: Change text size
	*/


	/*
		START: Expert index page
	*/
		"expertIndexPage": function()
		{
			var i, ii, c, cc, jqs = jQuery("div#expert_listing_box div.expert"), jq, n, img, hid;
			for (i = 0, c = jqs.length; i < c; i++)
			{
				jq = jqs.eq(i);
				hid = jQuery("div.hidden", jq);

				if (jQuery("div.blogs a", hid).length)
				{
					jQuery("div.expert_links span.blog", jq).css("display", "inline");
				}

				if (jQuery("div.expert_advice a", hid).length)
				{
					jQuery("div.expert_links span.expert_advice", jq).css("display", "inline");
				}

				img = jQuery("img", (n = jQuery("a.photo", jq)));
				n.html("").append(img);
			}
		},
	/*
		END: Expert index page
	*/

	/*
		START: Blog landing page
	*/
		"blogLandingPage": function()
		{
			var i, c, jqcs, jqc, m, n, ii, cc, tags, tag, html, containerJQ, name;
			containerJQ = jQuery("div#blog_landing_container");
			if ((jqcs = jQuery("div.call_out_c", containerJQ)).length)
			{
				jqcs = jQuery("div.call_out_c div.article", containerJQ);
				for (i = 0, c = jqcs.length; i < c; i++)
				{
					jqc = jqcs.eq(i);

					// Author
					name = jQuery("div.article_data div.expert div.title span", jqc).eq(0).html()
					if (name && name.length)
					{
						jQuery("div.col_right div.author", jqc).eq(0).html("By: "+name);
					}
					else
					{
						jQuery("div.col_right div.author", jqc).eq(0).html("By: "+jQuery("div.article_data div.author span", jqc).eq(0).html());
					}


					// Blog Title
					name = jQuery("div.article_data div.expert div.blog_name span", jqc).eq(0).html()
					if (name && name.length)
					{
						jQuery("div.col_right .blog_name a", jqc).eq(0).html(name).attr("href", jQuery("div.article_data div.expert div.blog_url span", jqc).eq(0).html());
					}
					else
					{
						jQuery("div.col_right .blog_name_wrapper", jqc).addClass("hidden");
						jQuery("div.col_right .w_blogname", jqc).addClass("hidden");
						jQuery("div.col_right .wo_blogname", jqc).removeClass("hidden");
					}


					// Tags
					tags = jQuery("div.article_data div.tags a", jqc);
					html = "";
					for (ii = 0, cc = tags.length; ii < cc; ii++)
					{
						tag = tags.eq(ii);
						html += ', <a href="'+tag.attr("href")+'">'+tag.html()+'</a>';
					}
					jQuery("div.col_right div.tags", jqc).html("Tags: "+html.substr(2));

					// More link
					jQuery("div.col_right div.read_more a", jqc).eq(0).attr
					(
						"href", jQuery("div.col_right div.header a", jqc).eq(0).attr("href")
					);

					//Body
					n = jQuery("div.body span", jqc).eq(0);
					n.html(this.truncator(n.html(), 256, "...")).parent().removeClass("hidden");
				}
			}
		},
	/*
		END: Blog landing page
	*/

	/*
		START: Add anchor to login/console box
	*/
		"articleCommentA": function()
		{
			var n;
			if ((n = jQuery("#divComment div.tp_loginpanel")).length)
			{
				n.before('<a name="tp_loginpanel"></a>');
				jQuery("div.share_jump_link a").attr("href", "#tp_loginpanel");
			}
			else
			{
				setTimeout(function() { abilitypath.articleCommentA(); }, 250);
			}
		}
	/*
		START: Add anchor to login/console box
	*/
};

abilitypath.cookieSess = new liltype.cookieUtil("SESS", "APSC", 0);
abilitypath.cookieSess.keys["NEXTURL"] = "a";
abilitypath.cookieSess.keys["CONSID"] = "b";
abilitypath.cookieSess.keys["CONSNAME"] = "c";
abilitypath.cookieSess.keys["TEXTSIZE"] = "d";
abilitypath.cookieSess.keys["SSOSEED"] = "e";


/*
	START: Google AJAX Feed API
*/
	abilitypath.googleAJAXFeed =
	{
		"apiKey": "ABQIAAAAMUv_hkQw6qTzB0P53XRGsBShx-5Ogdfw1xDwPfNzaWQ93M0XRhRc7DKr9ThUp7zfMqMOqt-26QcTBw",
		"inited": false,
		"execd": false,
		"feeds": [],
		"feedInd": 0,
		"init": function()
		{
			if (!this.inited)
			{
				document.write
				(
					'<script type="text/javascript" src="http://www.google.com/jsapi?key='+this.apiKey+'"><'+'/script>'
				);
				this.inited = true;
			}
		},
		"reg": function(obj)
		/*
			obj =
			{
				"url": "http://feed.file/url.xml",
				"callback": function(result) { called when result is returned }
			};
		*/
		{
			this.feeds.push(obj);
		},
		"load": function(result)
		{
			var obj;
			if (this.feedInd < this.feeds.length)
			{
				if (obj = this.feeds[this.feedInd])
				{
					obj.callback(result);
				}
				this.feeds[this.feedInd++] = null;
				this.exec();
			}
		},
		"loadW": function(result)
		{
			return abilitypath.googleAJAXFeed.load(result);
		},
		"exec": function()
		{
			var feed, obj;
			if (!window.google || !window.google.feeds || !window.google.feeds.Feed)
			{
				return;
			}

			if (this.feedInd < this.feeds.length)
			{
				if (obj = this.feeds[this.feedInd])
				{
					feed = new google.feeds.Feed(obj.url);
					feed.load(this.loadW);
				}
				else
				{
					this.feedInd++;
					this.exec();
				}
			}
		}
	}
/*
	END: Google AJAX Feed API
*/


abilitypath.articleDetail = function(selector)
{
	var jqc = jQuery(selector),
			jqd = jQuery("div.article_data", jqc),
			v, img, html, nodes, jqt, jqs, i, c;

	if ((v = jQuery("div.postit_type span", jqd).eq(0).html()) != "none")
	/* Show post-it as needed */
	{
		jqc.addClass("article_postit");
		img = jQuery("div.postit_box img", jqc);
		img.attr("src", img.attr("src").replace(new RegExp("/[^/]+(\\.[^\\.]+)$"), "/"+v+"$1"));
		img.parent().css("display", "block").css("top", (jQuery("div.box_head").get(0).offsetHeight - 20)+"px");
	}

	if ((v = jQuery("div.spanish_version_url span", jqd).eq(0).html()).length)
	/* Show in spanish as needed */
	{
		jQuery("div.feature_bar a.en_espanol", jqc).css("display", "inline").attr("href", v);
	}

	if ((jQuery("div.expertname span", jqc).eq(0).html()).length)
	/* If expert... */
	{
		jQuery("div.byline", jqc).css("display", "none");
	}
	else
	/* else, show author... */
	{
		jQuery("div.expertname", jqc).css("display", "none");
	}
	
	/* Show send to friend / print page */
	jQuery("div.feature_bar a.printer_friendly", jqc).attr("href", jQuery("div.printer_friendly a", jqd).eq(0).attr("href"));
	jQuery("div.feature_bar a.send_to_friend", jqc).attr("href", jQuery("div.send_to_friend a", jqd).eq(0).attr("href"));

	if ((jqs = jQuery("div.tag_list a", jqd)).length)
	{
		jqt = jQuery("div.article_header div.tags span", jqc).eq(0).html("");
		for (i = 0, c = jqs.length; i < c; i++)
		{
			if (i)
			{
				jqt.append(", ");
			}
			jqt.append(jqs.eq(i));
		}
	}
	
	jQuery(document).ready(function() { abilitypath.googleAJAXFeed.exec(); } );
}


abilitypath.expertDetailPage = function(contrib)
{
	var i, c, jqs, jq, jqc, m, more;
	var classNames =[]
	abilitypath.callOutBoxesB();
	var header = jQuery("div.expert_header");
	var content = jQuery("div.expert_content");
	
	jqs = jQuery("div.box_rc_a", content);
	for (i = 0, c = jqs.length; i < c; i++)
	{
		jq = jqs.eq(i);
		if (m = jq.attr("class").match(/(^|\s)(blog|expert_advice|q_and_a)(\s|$)/))
		{
			classNames[m[2]] = jq;
		}
	}

	if (!classNames["blog"] && !classNames["q_and_a"] && !classNames["expert_advice"])
	{
		jQuery("div.expert_more", header).css("display", "none");
	}
	else
	{
		more = [true, true, true];

		if (!classNames["blog"] || (classNames["blog"].css("display").toLowerCase() == "none"))
		{
			more[0] = false;
		}		

		if (!classNames["q_and_a"] || (classNames["q_and_a"].css("display").toLowerCase() == "none"))
		{
			more[1] = false;
		}

		if (!classNames["expert_advice"] || (classNames["expert_advice"].css("display").toLowerCase() == "none"))
		{
			more[2] = false;
		}


		m = jQuery("div.expert_more", header);
		if (more[0])
		/* There is a blog */
		{
			if (!more[1] && !more[2])
			/* No QA or Advice */
			{
				jQuery("a.blog", m).next().css("display", "none");
				jQuery("a.q_and_a", m).css("display", "none").next().css("display", "none");
				jQuery("a.expert_advice", m).css("display", "none");
			}
			else if (more[1] && !more[2])
			/* QA but no Advice */
			{
				jQuery("a.q_and_a", m).next().css("display", "none");
				jQuery("a.expert_advice", m).css("display", "none");
			}
			else if (!more[1] && more[2])
			/* no QA but Advice */
			{
				jQuery("a.q_and_a", m).css("display", "none").next().css("display", "none");
			}
		}
		else
		{
			jQuery("a.blog", m).css("display", "none").next().css("display", "none");
			if (more[1] && more[2])
			/* QA and Advice */
			{
				/* Do nothing */
			}
			else if (more[1] && !more[2])
			/* QA but no Advice */
			{
				jQuery("a.q_and_a", m).next().css("display", "none");
				jQuery("a.expert_advice", m).css("display", "none");
			}
			else if (!more[1] && more[2])
			/* no QA but Advice */
			{
				jQuery("a.q_and_a", m).css("display", "none").next().css("display", "none");
			}
			else
			{
				jQuery("a.q_and_a", m).css("display", "none").next().css("display", "none");
				jQuery("a.expert_advice", m).css("display", "none");
			}
		}
	}

	/* Hide photo column if not photo */
	if (!jQuery("img", (jq = jQuery("div.expert_image", header))).length)
	{
		jq.css("display", "none").next().addClass("nophoto");
	}

	/* If blog, show link */
	if ((m = jQuery("div.expert_data div.blog_url span", header).html()).length)
	{
		jQuery("a", jQuery("div.visit_blog", content).removeClass("hidden")).href(m);
	}
}

abilitypath.areaLandingPageSlideshow = function(dir)
{
	var slide, newSlide, jqc = jQuery("div#area_landing_slideshow"), jq;
	if (dir || !jqc.hasClass("paused"))
	{
		slide = jQuery("div.slides a.visible", jqc).removeClass("visible").fadeOut("slow");
		if (!dir || (dir == "next"))
		{
			if (!(newSlide = slide.next()).length)
			{
				newSlide = jQuery("div.slides a", jqc).eq(0);
			}
		}
		else
		{
			if (!(newSlide = slide.prev()).length)
			{
				jq = jQuery("div.slides a", jqc);
				newSlide = jq.eq(jq.length - 1);
			}
		}
		newSlide.addClass("visible").fadeIn("slow");

		if (abilitypath.areaLandingSlideshowTimeoutId)
		{
			clearTimeout(abilitypath.areaLandingSlideshowTimeoutId);
		}
		abilitypath.areaLandingSlideshowTimeoutId =
			setTimeout(function () { abilitypath.areaLandingPageSlideshow() }, abilitypath.areaLandingSlideshowTimeout);
	}
}

abilitypath.areaLandingPage = function()
{
	var jqc = jQuery("div#area_landing_container"), slides;
	abilitypath.callOutBoxesB(jqc);
	abilitypath.callOutBoxesC(jqc);
	abilitypath.googleAJAXFeed.exec();

	jQuery("div.call_out_c div.article", jqc).eq(0).addClass("first");
	
	if ((jqc = jQuery("div#area_landing_slideshow")).length)
	{
		slides = jQuery("div.slides a", jqc);
		slides.eq(0).css("display", "block").addClass("visible");
		if (slides.length > 1)
		{
			jQuery("a.prev", jqc).click
			(
				function ()
				{
					abilitypath.areaLandingPageSlideshow("prev");
					return false;
				}
			);
			jQuery("a.pause", jqc).click
			(
				function ()
				{
					jQuery("div#area_landing_slideshow").addClass("paused");
					return false;
				}
			);
			jQuery("a.next", jqc).click
			(
				function ()
				{
					abilitypath.areaLandingPageSlideshow("next");
					return false;
				}
			);
			setTimeout(function () { abilitypath.areaLandingPageSlideshow() }, abilitypath.areaLandingSlideshowTimeout);
		}
		else
		{
			jQuery("div.slide_ctl").addClass("hidden");
			jQuery("div.slide_ctl_bg").addClass("hidden");
		}
	}

	if ((jqc = jQuery("div#area_landing_video")).length)
	{
		if ((jQuery("div.video_embed span", jqc).html().match(/^\s*$/)) ||
		    (jQuery("div.video_embed SPAN", jqc).html().match(/^\s*$/)))
		{
			jqc.css("display", "none");
		}
		else
		{
			jQuery("div.video_title a", jqc).attr("href", jQuery("div.video_url span", jqc).html());
		}
	}
}

abilitypath.areaLandingPageEsp = function()
{
}

abilitypath.espArticlePage = function()
{
	var jqcs = jQuery("#area_landing_container div.article_box"), jqc, jq, i, c, tag;
	for (i = 0, c = jqcs.length; i < c; i++)
	{
		jqc = jqcs.eq(i);
		tag = jQuery("div.area_dat .title a", jqc).attr("href").replace(/^.+\/([^\/]+)\/$/, "$1");
		jQuery("div.head_content", jqc).prepend('<a name="'+tag+'"><'+'/a>');
		if (!jQuery("div.li", jqc).length)
		{
			jqc.css("display", "none");
		}
	}
}

jQuery(document).ready
(
	function()
	{
		var jqcs, jqc, jqs, jqt,
				i, c, html, n, m, ii, cc,
				over, out, click, first, xtra;
		/*
			START: Save GET NEXTURL if exists
		*/
			if (m = window.location.search.toLowerCase().match(/(\?|\&)nexturl=([^\&]*)(\&|$)/))
			{
				abilitypath.cookieSess.set("NEXTURL", decodeURIComponent(m[2]));
			}
		/*
			END: Save GET NEXTURL if exists
		*/
			
		
		/* 
			START: Fix call out box items
		*/
			/*
				START: Call out box A
			*/
				if ((jqcs = jQuery("div.call_out_a div.ul div.li")).length)
				{
					for (i = 0, c = jqcs.length; i < c; i++)
					{
						jqc = jqcs.eq(i);
						if ((jqs = jQuery("span", jqc)).length)
						{
							jqs.css("display", "none");
							jqt = jQuery("a", jqc);
							xtra = jqs.eq(1).html();
							html = jqt.eq(0).html()+(xtra ? " "+xtra : "");
							jqc.append(jqt.html(html));
						}
					}
				}
				
				/* Remove call out boxes with no items */
				if ((jqcs = jQuery("div.call_out_a")).length)
				{
					for (i = 0, c = jqcs.length; i < c; i++)
					{
						if ((!jQuery("div.li", jqcs.eq(i)).length) &&
						    !(jqc = jqcs.eq(i)).hasClass("rss_feed"))
						{
							jqcs.eq(i).css("display", "none");
						}
					}
				}
			/*
				END: Call out box A
			*/
		/* 
			END: Fix call out box items
		*/
			
		
		/* 
			START: Fix type A buttons
		*/
			if ((jqcs = jQuery("div.button_a, div.button_b")).length)
			{
				click = function ()
				{
					window.location = jQuery("a", this).eq(0).attr("href");
				}
				over = function ()
				{
					jQuery(this).addClass("over");
				}
				out = function ()
				{
					jQuery(this).removeClass("over");
				}

				for (i = 0, c = jqcs.length; i < c; i++)
				{
					jqcs.eq(i).click(click).mouseover(over).mouseout(out);
				}
			}
		/* 
			END: Fix type A buttons
		*/
			
		
		/* 
			START: Fix z-index of relatively placed elements
		*/
			if (window.location.hostname.match(/^community\./i))
			{
				jqcs = jQuery("div#abilitypath_fw_header *, div#abilitypath_fw_footer *", document);
			}
			else
			{
				jqcs = jQuery("*", document);
			}
			
			var zIndex = 500;
			for (i = 0, c = jqcs.length; i < c; i++)
			{
				jqs = jqcs.eq(i);
				if ((jqs.css("position") == "relative") && ((jqs.css("z-index") == "auto") || (jqs.css("z-index") == "0") || !jqs.css("z-index")))
				{
					jqs.css("z-index", zIndex--);
				}
			}
		/*
			START: Fix z-index of relatively placed elements
		*/
		
		/* 
			START: Set up text change links
		*/
			abilitypath.initChangeTextSize();
		/* 
			END: Set up text change links
		*/		
		
		/* 
			START: Index "home" pointing links
		*/
			for (i = 0, c = document.links.length; i < c; i++)
			{
				n = document.links[i];
				if (n.href && n.href.match(/^([^:]+:\/\/(www)?.abilitypath.org\/|[^:]+:\/\/(www)?.abilitypath.org\/index\.[^\.]+|\/|\/index\.[^\.]+)$/i))
				{
					abilitypath.homeLinx.push(n);
				}
			}
			liltype.execDep.exec("indexedHomeLinx");
		/* 
			END: Index "home" pointing links
		*/		


		/* 
			START: Make reg submit button centered
		*/
			if ((n = jQuery("input#ACTION_SUBMIT_SURVEY_RESPONSE")).length)
			{
				n.parent().addClass("reg_form_submit")
			}
		/* 
			END: Make reg submit button centered
		*/

		/*
			START: Hack convio mystery styles
		*/
			jQuery("#contentDiv").css("margin", "0px");
			jQuery("p").css("font-family", "arial, helvetica, sans-serif");
		/*
			END: Hack convio mystery styles
		*/

		/*
			START: Hack the port remote comment style override + add anchor to login/comment panel
		*/
			if ((n = jQuery("html head link[href='http://community.abilitypath.org/custom/theport/remotemgrstyle.css']")).length)
			{
				jQuery("html head").prepend(n);
				//jQuery("#dhtmlwindowholder").css("display", "none");
				jQuery("img[src='http://community.abilitypath.org/apis/services/PingPixel.ashx']").css("display", "none");
				abilitypath.articleCommentA();
			}
		/*
			END: Hack the port remote comment style override
		*/


		/*
			START: Fix home links
		*/
			if (liltype.getCookie("hbli") == "t")
			{
				for (i = 0, c = abilitypath.homeLinx.length; i < c; i++)
				{
					abilitypath.homeLinx[i].href = "http://www.abilitypath.org/members-home.html";
				}
			}
		/*
			END: Fix home links
		*/


		/*
			START: Make logout link remove logout cookie
		*/
			jQuery("a[href='http://community.abilitypath.org/editor/app/logout.aspx']").click
			(
				function()
				{
					liltype.setCookie({"cookieKey": "hbli", "expryInDays": 90, "path": "/", "domain": "abilitypath.org"}, "f");
					return true;
				}
			);
		/*
			END: Make logout link remove logout cookie
		*/
	}
);


liltype.execDep.add
(
	["indexedHomeLinx", "foundLoginStatus"],
	{
		"exec": function()
		{
			var i, c;
			if (abilitypath.cookieSess.get("CONSNAME").length)
			{
				liltype.setCookie({"cookieKey": "hbli", "expryInDays": 90, "path": "/", "domain": "abilitypath.org"}, "t");
				for (i = 0, c = abilitypath.homeLinx.length; i < c; i++)
				{
					abilitypath.homeLinx[i].href = "http://www.abilitypath.org/members-home.html";
				}
			}
		}
	}
);

jQuery(document).ready
(
	function()
	{
		var cookieLogStat = "hbli", cookieCount = "apic", count, f, script;

		/*
		if (liltype.getCookie("apitc") != "t")
		{
			return;
		}
		*/

		if (!window.location.hostname.match(/^(www\.)?abilitypath\.org$/) ||
				window.location.pathname.match(/^\/blank.html/))
		{
			return;
		}
		
		if (liltype.getCookie(cookieLogStat) == "t")
		{
			return;
		}
		
		count = new Number(liltype.getCookie(cookieCount));
		count = isNaN(count) ? 0 : count;

		if (count == 2)
		{
			script = document.createElement("script");
			script.setAttribute("type", "text/javascript");
			script.setAttribute("src", "/js/interstitial.js ");
			document.getElementsByTagName("head")[0].appendChild(script);

			f = function()
			{
				if (liltype.Interstitial && liltype.Interstitial.prototype && liltype.Interstitial.prototype.onClose)
				{
					new liltype.Interstitial
					(
						{
							"title": "Sign up now",
							"url": "http://www.abilitypath.org/etc/interstitial-oct-2009/sign-up-now.html",
							"width": "719",
							"height": "369"
						},
						{
							"GB_ROOT_DIR": "http://www.abilitypath.org/etc/greybox/"
						}
					);
				}
				else
				{
					setTimeout(function() { f(); }, 50);
				}
			};
			f();
		}	

		if (count < 3)
		{
			liltype.setCookie({"cookieKey": cookieCount, "path": "/", "expryInDays": 90}, ""+(count + 1));
		}
	}
);
