	var pluckDiscoNugget = function(){
		return {
			renderDiscoNugget : function (discoveredContent, discoType, widgetTitle, conclusionString) {
				var htmlContent = "";
				htmlContent += "" +
					"<div class=\"pluckHomeDiscoSuperContainer\">" +
						"<div class=\"pluckHomeDiscoMainContainer\">" +
							"<div class=\"pluckHomeDiscoHeaderContainer\">" +
								"<div class=\"pluckHomeDiscoHeaderLeft\">Recent Ruby Discussions</div>" +
								"<div class=\"pluckHomeDiscoHeaderElementSeparator\"></div>" +
								"<div class=\"pluckHomeDiscoHeaderMiddle\"></div>" +
								"<div class=\"pluckHomeDiscoHeaderElementSeparator\"></div>" +
								"<div class=\"pluckHomeDiscoHeaderRight\"></div>" +
								"<div class=\"pluckHomeDiscoHeaderElementSeparator\"></div>" +
							"</div>" +
							"<div class=\"pluckHomeDiscoHeaderSeparator\"></div>" +
							"<div class=\"pluckHomeDiscoBodyContainer\">";
							for (i=0; i<discoveredContent.length; i++) {
								var sTitle = discoveredContent[i].DiscussionTitle;
								var sUrl = discoveredContent[i].DiscussionUrl;
								var sImageUrl = discoveredContent[i].LiteUser.ImageUrl;
								var sGroupKey = discoveredContent[i].AssociatedCommunityGroupKey;
								if ((sGroupKey != null) && (sGroupKey != "null") && (sGroupKey != "") && (sGroupKey != "undefined")) {
									//If the group key exists then we need to change the URL - dumb disco broken.
									//If there are query string params lets pass them along and hope they are right otherwise direct to the groups home page.
									if ((sUrl.indexOf('?') > 0) && (discoveredContent[i].ForumDiscussionKey != null) && (discoveredContent[i].ForumDiscussionKey != ""))
										sUrl = lciGblSiteUrl + groupsPage + "?slPage=showDiscussionPost&slGroupKey=" + sGroupKey.Key + "&slForumPostKey=" + discoveredContent[i].ForumDiscussionKey.Key + "&onPage=1&gotoPostKey=undefined";
									else 
										sUrl = lciGblSiteUrl + groupsPage + "?slGroupKey=" + sGroupKey.Key;
								}
								var titleLen = 70;
								var descLen = 150;
								if (sTitle.length > titleLen) sTitle = sTitle.substring(0, titleLen) + "...";
								var sDesc = discoveredContent[i].DiscussionBody;
								if ((sDesc != null) && (sDesc != "")) sDesc = PluckCommon.HandleSearchResponse_Clean(sDesc);
								else sDesc = "";
								if (sDesc.length > descLen) sDesc = sDesc.substring(0, descLen) + "...";
								var sDate = discoveredContent[i].LastPostDate;
								if (sDate != null) sDate = (sDate.split(' '))[0];
								else sDate = "";
								var sDateText = "updated on ";
								var sAuthor = discoveredContent[i].LastPostBy.DisplayName;
								var sAuthorUrl = discoveredContent[i].LastPostBy.PersonaUrl;
								var activityCount = parseInt(discoveredContent[i].PostCount);
								var recommendCount = null;
								var personCount = null;
								var altFlag = "";
								if ((i+2)%2) altFlag = "Alt";
								htmlContent += "" +
								"<div class=\"pluckHomeDiscoBlock" + altFlag + "\">" +
									"<div class=\"pluckHomeDiscoImageCont\">" +
										"<div class=\"pluckHomeDiscoImgShadow\">" +
											"<a href=\"\" border=\"0\"><img src=\"" + sImageUrl + "\" border=\"0\" /></a>" +
										"</div>" +
									"</div>" +
									"<div class=\"pluckHomeDiscoImageSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoTitle\"><a href=\"" + sUrl + "\">" + sTitle + "</a></div>" +
									"<div class=\"pluckHomeDiscoTitleSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoDiscussions\"><img class=\"discoMinis\" src=\"/mystyle/community/images/discussion.png\" border=\"0\"/></div>" +
									"<div class=\"pluckHomeDiscoDiscussionsSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoDiscussionsText\">&nbsp;(" + activityCount + ")</div>" +
									"<div class=\"pluckHomeDiscoDiscussionsTextSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoRecommended\"><img class=\"discoMinis\" src=\"/mystyle/community/images/heart.png\" border=\"0\"/></div>" +
									"<div class=\"pluckHomeDiscoRecommendedSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoRecommendedText\">&nbsp;(" + recommendCount + ")</div>" +
									"<div class=\"pluckHomeDiscoRecommendedTextSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoPeople\"><img class=\"discoMinis\" src=\"/mystyle/community/images/person_icon.png\" border=\"0\"/></div>" +
									"<div class=\"pluckHomeDiscoPeopleSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoPeopleText\">&nbsp;(" + personCount + ")</div>" +
									"<div class=\"pluckHomeDiscoPeopleTextSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoDesc\"><span class=\"pluckHomeDiscoDescText\">" + sDesc + "</span>";
									if (sDesc.length == descLen + 3) 
									htmlContent += "<span class=\"pluckHomeDiscoReadMore\"><a href=\"" + sUrl + "\" class=\"pluckHomeDiscoSmLink\">more</a></span></div>";
									htmlContent += "" +
									"<div class=\"pluckHomeDiscoDescSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoDate\">Last Post on " + sDate + "</div>" +
									"<div class=\"pluckHomeDiscoDateSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoAuthor\">&nbsp;by <a href=\"" + sAuthorUrl + "\" class=\"pluckHomeDiscoSmLink\">" + sAuthor + "</a></div>" +
									"<div class=\"pluckHomeDiscoAuthorSeparator\"></div>" +
								"</div>" +
								"<div class=\"pluckHomeDiscoBlockSeparator\"></div>";
							}
				htmlContent += "" +
							"</div>" +
							"<div class=\"pluckHomeDiscoBodySeparator\"></div>" +
							"<div class=\"pluckHomeDiscoFooterContainer\">" +
								"<div class=\"pluckHomeDiscoFooterLeft\"></div>" +
								"<div class=\"pluckHomeDiscoFooterElementSeparator\"></div>" +
								"<div class=\"pluckHomeDiscoFooterMiddle\"></div>" +
								"<div class=\"pluckHomeDiscoFooterElementSeparator\"></div>" +
								"<div class=\"pluckHomeDiscoFooterRight\"></div>" +
								"<div class=\"pluckHomeDiscoFooterElementSeparator\"></div>" +
							"</div>" +
							"<div class=\"pluckHomeDiscoFooterSeparator\"></div>" +
						"</div>" +
					"</div>";
				return htmlContent;
			},
			renderGroupsDiscoNugget : function (discoveredContent, discoType, widgetTitle, conclusionString) {
				var htmlContent = "";
				htmlContent += "" +
					"<div class=\"pluckHomeDiscoSuperContainer\">" +
						"<div class=\"pluckHomeDiscoMainContainer\">" +
							"<div class=\"pluckHomeDiscoHeaderContainer\">" +
								"<div class=\"pluckHomeDiscoHeaderLeft\">" + widgetTitle + "</div>" +
								"<div class=\"pluckHomeDiscoHeaderElementSeparator\"></div>" +
								"<div class=\"pluckHomeDiscoHeaderMiddle\"></div>" +
								"<div class=\"pluckHomeDiscoHeaderElementSeparator\"></div>" +
								"<div class=\"pluckHomeDiscoHeaderRight\"></div>" +
								"<div class=\"pluckHomeDiscoHeaderElementSeparator\"></div>" +
							"</div>" +
							"<div class=\"pluckHomeDiscoHeaderSeparator\"></div>" +
							"<div class=\"pluckHomeDiscoBodyContainer\">";
							for (i=0; i<discoveredContent.length; i++) {
								var sTitle = discoveredContent[i].Title;
								var sUrl = discoveredContent[i].PageUrl;
								var sImageUrl = discoveredContent[i].AvatarImageUrl;
								var sGroupKey = discoveredContent[i].CommunityGroupKey;
								if ((!sUrl) || (sUrl == "undefined") || (sUrl == "") || (sUrl == null)) {
									if ((sGroupKey != "") && (sGroupKey != null) && (sGroupKey != "null") && (sGroupKey != "undefined"))
										sUrl = lciGblSiteUrl + groupsPage + "?slGroupKey=" + sGroupKey.Key;
									else 
										sUrl = lciGblSiteUrl + groupsPage;
								}
								var titleLen = 70;
								var descLen = 150;
								if (sTitle.length > titleLen) sTitle = sTitle.substring(0, titleLen) + "...";
								var sDesc = discoveredContent[i].Description;
								if ((sDesc != null) && (sDesc != "")) sDesc = PluckCommon.HandleSearchResponse_Clean(sDesc);
								else sDesc = "";
								if (sDesc.length > descLen) sDesc = sDesc.substring(0, descLen) + "...";
								var sDate = discoveredContent[i].CreatedDate;
								if (sDate != null) sDate = (sDate.split(' '))[0];
								else sDate = "";
								var sDateText = "created on ";
								var sAuthor = "";
								var sAuthorUrl = "";
								var activityCount = (parseInt(discoveredContent[i].CommunityGroupStats.BlogPostCount) + parseInt(discoveredContent[i].CommunityGroupStats.ForumDiscussionCount));
								var recommendCount = discoveredContent[i].NumberOfRecommendations;
								var personCount = discoveredContent[i].CommunityGroupStats.MemberCount;
								htmlContent += "" +
								"<div class=\"pluckHomeDiscoBlock\">" +
									"<div class=\"pluckHomeDiscoImageCont\">" +
										"<div class=\"pluckHomeDiscoImgShadow\">" +
											"<a href=\"\" border=\"0\"><img src=\"" + sImageUrl + "\" border=\"0\" /></a>" +
										"</div>" +
									"</div>" +
									"<div class=\"pluckHomeDiscoImageSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoTitle\"><a href=\"" + sUrl + "\">" + sTitle + "</a></div>" +
									"<div class=\"pluckHomeDiscoTitleSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoDiscussions\"><img class=\"discoMinis\" src=\"/mystyle/community/images/discussion.png\" border=\"0\"/></div>" +
									"<div class=\"pluckHomeDiscoDiscussionsSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoDiscussionsText\">&nbsp;(" + activityCount + ")</div>" +
									"<div class=\"pluckHomeDiscoDiscussionsTextSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoRecommended\"><img class=\"discoMinis\" src=\"/mystyle/community/images/heart.png\" border=\"0\"/></div>" +
									"<div class=\"pluckHomeDiscoRecommendedSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoRecommendedText\">&nbsp;(" + recommendCount + ")</div>" +
									"<div class=\"pluckHomeDiscoRecommendedTextSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoPeople\"><img class=\"discoMinis\" src=\"/mystyle/community/images/person_icon.png\" border=\"0\"/></div>" +
									"<div class=\"pluckHomeDiscoPeopleSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoPeopleText\">&nbsp;(" + personCount + ")</div>" +
									"<div class=\"pluckHomeDiscoPeopleTextSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoDesc\"><span class=\"pluckHomeDiscoDescText\">" + sDesc + "</span>";
									if (sDesc.length == descLen + 3) 
									htmlContent += "<span class=\"pluckHomeDiscoReadMore\"><a href=\"" + sUrl + "\" class=\"pluckHomeDiscoSmLink\">more</a></span></div>";
									htmlContent += "" +
									"<div class=\"pluckHomeDiscoDescSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoDate\">Modified on " + sDate + "</div>" +
									"<div class=\"pluckHomeDiscoDateSeparator\"></div>" +
									"<div class=\"pluckHomeDiscoAuthor\">&nbsp;</div>" +
									"<div class=\"pluckHomeDiscoAuthorSeparator\"></div>" +
								"</div>" +
								"<div class=\"pluckHomeDiscoBlockSeparator\"></div>";
							}
				htmlContent += "" +
							"</div>" +
							"<div class=\"pluckHomeDiscoBodySeparator\"></div>" +
							"<div class=\"pluckHomeDiscoFooterContainer\">" +
								"<div class=\"pluckHomeDiscoFooterLeft\"></div>" +
								"<div class=\"pluckHomeDiscoFooterElementSeparator\"></div>" +
								"<div class=\"pluckHomeDiscoFooterMiddle\"></div>" +
								"<div class=\"pluckHomeDiscoFooterElementSeparator\"></div>" +
								"<div class=\"pluckHomeDiscoFooterRight\"></div>" +
								"<div class=\"pluckHomeDiscoFooterElementSeparator\"></div>" +
							"</div>" +
							"<div class=\"pluckHomeDiscoFooterSeparator\"></div>" +
						"</div>" +
					"</div>";
				return htmlContent;
			}
		}; //End of NameSpace Return Object
	}(); //End of NameSpace - Self Invoke.

			//Lets start by creating a namespace so we don't collide with other javascript on page.
		var PluckCommon = function(){
			return {
				isDefined : function(variable){
				//Checks if a dom element is defined
					return (!(!( variable||false )))
				},
				querySt : function(ji){ 
				//Gets a query string parameter
					qs = window.location.search.substring(1);
					gy = qs.split("&");
					for (i=0;i<gy.length;i++) {
						ft = gy[i].split("=");
						if (ft[0] == ji) {
							return ft[1];
						}
					}
				},
				trimIt : function(str) {
				//Missing Javascript trim function
					var	str = str.replace(/^\s\s*/, ''),
						ws = /\s/,
						i = str.length;
					while (ws.test(str.charAt(--i)));
					return str.slice(0, i + 1);
				},
				talkToServer : function(request, callback) {
					// Make a single request of the DAAPI
					var requestBatch = new RequestBatch();
					requestBatch.AddToRequest(request);
					requestBatch.BeginRequest(serverUrl, callback);
					//console.dir(requestBatch);
				},
				gUser : null,	//user object to hold the currently logged in user
				HandleSearchResponse_Clean : function(inputString, stripLtGt) {
					stripLtGt = stripLtGt || true;
					var removeHTMLTags = function(strInputCode,stripLtGt){
									/* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com
									Created by: Robert Nyman | http://robertnyman.com/ 
									Modifed by: B. Erik Noble */
									if (stripLtGt) {strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){return (p1 == "lt")? "<" : ">";});} //This line is optional, it replaces escaped brackets with real ones, i.e. &lt; is replaced with < and &gt; is replaced with >

									var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, " "); //Optional: Change space to empty string but then you might get words crammed together
									return strTagStrippedText;
					}

					var clean = "";
					if(inputString.length>0){
									var clean = removeHTMLTags(inputString, stripLtGt);
									//Matt Mitchell's code
									//clean = clean.replace(/</g,"&lt;");
									//clean = clean.replace(/>/g,"&gt;");
									clean = clean.replace(/\u2019/g,"&#8217;");
									clean = clean.replace(/\u201C/g,"&#8220;");
									clean = clean.replace(/\u201D/g,"&#8221;");
									clean = clean.replace(/\r\n/g,"\n");
									//clean = clean.replace(/\n/g,"<br />\n");
					}
					return clean;
				}
		   }; //End of NameSpace Return Object
		}(); //End of NameSpace - Self Invoke.

				var gSiteLifeMore = function(){
			return {
				aBlogPosts : new Array(),
				DiscoveryCall : function(numRecs, activity, contentType, callback, divId, numDays, sCategory, sSection, sParents){
					var i = 0;
					if(!numDays) numDays = 15;
					if(numDays == "") numDays = 15;
					if(!sSection) sSection = "All";
					if(sSection == "") sSection = "All";
					if(!sCategory) sCategory = "All";
					if(sCategory == "") sCategory = "All";
					var searchSections  = new Array();
					var allSections = sSection.split(',');
					for (i=0; i<allSections.length; i++) {
						searchSections[i] = new Section(PluckCommon.trimIt(allSections[i]));
					}
					var searchCategories = new  Array();
					var allCategories = sCategory.split(',');
					for (i=0; i<allCategories.length; i++) {
						searchCategories[i] = new Category(PluckCommon.trimIt(allCategories[i]));
					}
					var activityDisco = new Activity(activity);
					var contentTypeDisco = new ContentType(contentType);
					var limitToContributorsDisco = new Array();
					var parentKeys = new Array();
					if ((sParents != null) && (sParents != "")) { 
						var allParents = sParents.split(',');
						for (i=0; i<allParents.length; i++) {
							parentKeys[i] = new ForumCategoryKey(PluckCommon.trimIt(allParents[i]));
						}
					}
					var request = new DiscoverContentAction(searchSections, searchCategories, limitToContributorsDisco, activityDisco,  contentTypeDisco, numDays, numRecs, false, parentKeys);
					PluckCommon.talkToServer(request, callback);
					document.write("<div id=\"" + divId + "\" class=\"pluckDAAPIWidget\"></div>");
				},
				GetForums : function(catKey, numPerPage, onPage, callback, divId){
					if(!numPerPage) numPerPage = 10;
					if(!onPage) onPage = 1;
					var request = new ForumsPage(new ForumCategoryKey(catKey),numPerPage, onPage, "TimeStampDescending");
					PluckCommon.talkToServer(request, callback);
					document.write("<div id=\"" + divId + "\" class=\"pluckForums\"></div>");
				},
				GetDiscussions : function(forumKey, numPerPage, onPage, callback, divId){
					if(!numPerPage) numPerPage = 1;
					if(!onPage) onPage = 1;
					var request = new ForumDiscussionsPage(new ForumKey(forumKey), numPerPage, onPage, "TimeStampDescending");

					PluckCommon.talkToServer(request, callback);
					//document.write("<span id=\"" + divId + "\" class=\"pluckNumDiscussions\"></span>");
				},
				customDiscoCallBack : function(responseBatch) {
					//Forward it on with the id of the DIV above
					//Note: If you have more than one discover call on the page you will want to make a new function here 
					//for each and make sure the second param matches the one you pass in for the DiscoveryCall
					gSiteLifeMore.customCallBack(responseBatch, "pluckDiscoNugget");
				},
				customDiscoRecentGroupCallBack : function(responseBatch) {
					//Forward it on with the id of the DIV above
					gSiteLifeMore.customCallBack(responseBatch, "pluckDiscoRecentGroupNugget");
				},
				customDiscoActiveGroupCallBack : function(responseBatch) {
					//Forward it on with the id of the DIV above
					gSiteLifeMore.customCallBack(responseBatch, "pluckDiscoActiveGroupNugget");
				},
				customCallBackBlogPostLg : function(responseBatch) {
					//Forward it on with the id of the DIV above
					gSiteLifeMore.customCallBackBlogPostFunc(responseBatch, "pluckBlogWidget");
				},
				customCallBackBlogLg : function(responseBatch) {
					//Forward it on with the id of the DIV above
					gSiteLifeMore.customCallBackBlog(responseBatch, "pluckBlogWidget");
				},
				customCallBackForumsList : function(responseBatch) {
					gSiteLifeMore.customCallBackForums(responseBatch, "pluckRubyForums");
				},
				customCallBackForum1 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions1");
				},
				customCallBackForum2 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions2");
				},
				customCallBackForum3 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions3");
				},
				customCallBackForum4 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions4");
				},
				customCallBackForum5 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions5");
				},
				customCallBackForum6 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions6");
				},
				customCallBackForum7 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions7");
				},
				customCallBackForum8 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions8");
				},
				customCallBackForum9 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions9");
				},
				customCallBackForum10 : function(responseBatch) {
					gSiteLifeMore.customCallBackDiscussions(responseBatch, "pluckForumDiscussions10");
				},
				customCallBack : function(responseBatch, discoType) {
					//console.dir(responseBatch);
					if (responseBatch.Responses.length == 0) {
						//Error I think
						gSiteLifeMore.displayMessages(responseBatch);
						return;
					}
					//Show Blog Post
					for (var i = 0; i < responseBatch.Responses.length; i++) {
						var response = responseBatch.Responses[i];
						gSiteLifeMore.dispatchResponse(response, discoType);
					}
				},
				customCallBackDiscussions : function(responseBatch, discoType) {
					//console.dir(responseBatch);
					if (responseBatch.Responses.length == 0) {
						//Error I think
						gSiteLifeMore.displayMessages(responseBatch);
						return;
					}
					//Show Blog Post
					for (var i = 0; i < responseBatch.Responses.length; i++) {
						var response = responseBatch.Responses[i];
						gSiteLifeMore.dispatchDiscussionResponse(response, discoType);
					}
				},
				customCallBackForums : function(responseBatch, discoType) {
					//console.dir(responseBatch);
					if (responseBatch.Responses.length == 0) {
						//Error I think
						gSiteLifeMore.displayMessages(responseBatch);
						return;
					}
					//Show Blog Post
					for (var i = 0; i < responseBatch.Responses.length; i++) {
						var response = responseBatch.Responses[i];
						if (response.ForumsPage != null) {
							var forums = response.ForumsPage.Forums;
							if (forums != null) {
								//  display loop
								var i = 0;
								for (i=0; i < forums.length; i++) {
									gSiteLifeMore.dispatchForumResponse(forums[i], discoType, "pluckForumDiscussions" + (i+1));
									gSiteLifeMore.GetDiscussions(forums[i].ForumKey.Key,1,1,eval('gSiteLifeMore.customCallBackForum' + (i+1)),"pluckForumDiscussions" + (i+1));
								}
							}
						} 
					}
				},
				customCallBackBlogPostFunc : function(responseBatch, discoType) {
					//console.dir(responseBatch);
					if (responseBatch.Responses.length == 0) {
						//Error I think
						gSiteLifeMore.displayMessages(responseBatch);
						return;
					}
					//Show Blog Post
					for (var i = 0; i < responseBatch.Responses.length; i++) {
						var response = responseBatch.Responses[i];
						if (response.DiscoverContentAction != null) {
							discoveredContent = response.DiscoverContentAction.DiscoveredContent;
							discoveryHTML =  "";
							if (discoveredContent != null) {
								var requestBatch = new RequestBatch();
								//  display loop
								var i = 0;
								for (i=0; i < discoveredContent.length; i++) {
									gSiteLifeMore.aBlogPosts[i] = discoveredContent[i];
									gSiteLifeMore.aBlogPosts[i].Activity = response.DiscoverContentAction.Activity.Name;
									gSiteLifeMore.aBlogPosts[i].NumDiscos = response.DiscoverContentAction.MaximumNumberOfDiscoveries;
									requestBatch.AddToRequest(new BlogKey(discoveredContent[i].BlogKey.Key));
								}
								requestBatch.BeginRequest(serverUrl, gSiteLifeMore.customCallBackBlogLg);
							}
						} 
					}
				},
				customCallBackBlog : function(responseBatch, discoType) {
					//console.dir(responseBatch);
					if (responseBatch.Responses.length == 0) {
						//Error I think
						gSiteLifeMore.displayMessages(responseBatch);
						return;
					}
					//Show Blogs
					if (discoType == "pluckBlogWidget") {
						if (gSiteLifeMore.aBlogPosts != null) {
							for (var i = 0; i < responseBatch.Responses.length; i++) {
								var response = responseBatch.Responses[i];
								if (response.Blog != null) {
									for (j = 0; j < gSiteLifeMore.aBlogPosts.length; j++) {
										if (gSiteLifeMore.aBlogPosts[j].BlogKey.Key == response.Blog.BlogKey.Key) {
											gSiteLifeMore.aBlogPosts[j].Blog = response.Blog;
										}
									}
								} 
							}
							gSiteLifeMore.dispatchBlogs(discoType);
						}
					} 
				},
				dispatchResponse : function(response, discoType) {
					// decides what action to take based on what's in the response
					if (response.DiscoverContentAction != null) {
						discoveredContent =  response.DiscoverContentAction.DiscoveredContent;
						var discoveryHTML =  "";
						var widgetTitle = "";
						var conclusionText = "";
						if (discoveredContent != null) {
							if (discoType == "pluckDiscoNugget") {
								discoveryHTML += pluckDiscoNugget.renderDiscoNugget(discoveredContent, discoType, widgetTitle, conclusionText);
							} else if (discoType == "pluckDiscoRecentGroupNugget") {
								discoveryHTML += pluckDiscoNugget.renderGroupsDiscoNugget(discoveredContent, discoType, "Recent Groups", conclusionText);
							} else if (discoType == "pluckDiscoActiveGroupNugget") {
								discoveryHTML += pluckDiscoNugget.renderGroupsDiscoNugget(discoveredContent, discoType, "Most Active Groups", conclusionText);
							}
							//If you had mor ethan one discovery on this page - you can add a else if here to check for a different discoType (which is the div id)
						}
						if (PluckCommon.isDefined(document.getElementById(discoType))) {
							document.getElementById(discoType).innerHTML =  discoveryHTML;
						}
					}
				}, 
				dispatchDiscussionResponse : function(response, discoType) {
					// decides what action to take based on what's in the response
					if (response.ForumDiscussionsPage != null) {
						var numOfDiscussions =  response.ForumDiscussionsPage.NumberOfDiscussions;
						if (PluckCommon.isDefined(document.getElementById(discoType))) {
							document.getElementById(discoType).innerHTML = "(" + numOfDiscussions + " discussions)";
						}
					}
				}, 
				dispatchForumResponse : function(forumObj, discoType, forumDiv) {
					// decides what action to take based on what's in the response
					var htmlContent = "<a href=\"" + forumObj.ForumUrl + "\">" + forumObj.Title + "</a>";
					htmlContent += "<span id=\"" + forumDiv + "\" class=\"pluckNumDiscussions\"></span><br />";
					htmlContent += "<div class=\"pluckForumDescription\">" + forumObj.Description + "</div><br />";
					
					if (PluckCommon.isDefined(document.getElementById(discoType))) {
						document.getElementById(discoType).innerHTML += htmlContent;
					}
				}, 
				dispatchBlogs : function(discoType) {
					var widgetTitle = "";
					var conclusionText = "";
					var discoveryHTML = "";
					if (discoType == "pluckBlogWidget") {
						discoveryHTML += gSiteLifeMore.renderBlogDiscoWidget(gSiteLifeMore.aBlogPosts, discoType, widgetTitle, conclusionText, sActivity);
					}
						
					if (PluckCommon.isDefined(document.getElementById(discoType))) {
						document.getElementById(discoType).innerHTML =  discoveryHTML;
					}
				}, 
				displayMessages : function(responseBatch) {
					// Display all messages contained in a ResponseBatch.
					var message = '';
					for (var i = 0; i < responseBatch.Messages.length; i++) {
						message += '<p>' + responseBatch.Messages[i].Message + '</p>';
					}
					if(message){ 
						if (PluckCommon.isDefined(console)) {
							console.debug (message);
						}
						//Display Error Message???
						//document.getElementById('Messages').innerHTML = message;
					}
				},
				HandleSearchResponse_Clean : function(inputString, stripLtGt) {
					stripLtGt = stripLtGt || true;
					var removeHTMLTags = function(strInputCode,stripLtGt){
									/* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com
									Created by: Robert Nyman | http://robertnyman.com/ 
									Modifed by: B. Erik Noble */
									if (stripLtGt) {strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){return (p1 == "lt")? "<" : ">";});} //This line is optional, it replaces escaped brackets with real ones, i.e. &lt; is replaced with < and &gt; is replaced with >

									var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, " "); //Optional: Change space to empty string but then you might get words crammed together
									return strTagStrippedText;
					}

					var clean = "";
					if(inputString.length>0){
									var clean = removeHTMLTags(inputString, stripLtGt);
									//Matt Mitchell's code
									//clean = clean.replace(/</g,"&lt;");
									//clean = clean.replace(/>/g,"&gt;");
									clean = clean.replace(/\u2019/g,"&#8217;");
									clean = clean.replace(/\u201C/g,"&#8220;");
									clean = clean.replace(/\u201D/g,"&#8221;");
									clean = clean.replace(/\r\n/g,"\n");
									//clean = clean.replace(/\n/g,"<br />\n");
					}
					return clean;
				}
		   }; //End of NameSpace Return Object
		}(); //End of NameSpace - Self Invoke.

