try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.Service=new JsonFx.IO.Service("/Features/Activities/Services/ActivityService.jrpc");MF.Activities.Service.postComment=function(parentId,message,contentType,opt){this.invoke("postComment",[parentId,message,contentType],opt);};MF.Activities.Service.getComments=function(parentId,start,count,opt){this.invoke("getComments",[parentId,start,count],opt);};MF.Activities.Service.markFavorite=function(contentId,isFavorite,contentType,opt){this.invoke("markFavorite",[contentId,isFavorite,contentType],opt);};MF.Activities.Service.getActivityList=function(start,count,opt){this.invoke("getActivityList",[start,count],opt);};MF.Activities.Service.getFullDiscussion=function(discussionID,opt){this.invoke("getFullDiscussion",[discussionID],opt);};}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.List=JsonML.BST(["div",{"class":"js-activityList"}," ",function(){return JsonML.BST(MF.Activities.Item).dataBind(this.data.activities,this.index,this.count);}," ",["div",{"class":function(){return"home-empty"+(this.data.canAdd?"":" nopermission");},"jbst:visible":function(){return this.data.total===0&&this.data.enabled;}}]," ",function(){return JsonML.BST(MF.Paging.Pager).dataBind(MF.Paging.Pager.buildData(this.data.start,this.data.count,this.data.total,this.go),this.index,this.count);}," "]);(function(){this.prependedCommentCount={};this.modifiedCommentList={};this.appendedCommentCount=2;this.increments=10;this.go=function(B,A){JsonFx.History.save({start:B,count:A});};this.history=function(A){MF.Activities.Service.getActivityList(A.start,A.count,{onSuccess:function(B){B=MF.Activities.List.bind(B);$("div.js-activityList").replaceWith(B);document.body.scrollIntoView(true);}});};this.display=function(A){if(A&&A.visible){$("div.home-empty").hide();A=$(MF.Activities.Item.bind(A)).unwrapFragment();A.hide().prependTo("div.js-activityList").show("slow");}};this.canComment=function(B,C,A){return(B===0&&C!=="CreatedFamilyTree"&&!((C==="UploadedImage"||C==="UploadedVideo"||C==="UploadedFile"||C==="UploadedMedia")&&A>1))&&C!=="JoinedSite"&&C!=="CreatedBlogEntry"&&MF.user.canComment;};}).call(MF.Activities.List);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.Item=JsonML.BST([""," ",function(){MF.Activities.List.prependedCommentCount[this.data.itemId]=2;MF.Activities.List.modifiedCommentList[this.data.itemId]=false;}," ",function(){return JsonML.BST(MF.Activities.Date).dataBind({activityDate:this.data.activityDate},this.index,this.count);}," ",["div",{"class":function(){return this.pickCssClass(this.data.activityType,this.data.targetType)+" activity unique-class-1 js-activity";},id:function(){return"activity_"+this.data.itemId;}}," ",function(){return JsonML.BST(this.loadActivityTitle).dataBind(this.data,this.index,this.count);}," ",function(){return JsonML.BST(MF.Activities.Thumbnails).dataBind({previews:this.data.previews},this.index,this.count);}," ",function(){return JsonML.BST(MF.Activities.Excerpt).dataBind(this.data.excerpt,this.index,this.count);}," ",function(){return JsonML.BST(MF.Activities.ActionLinks).dataBind({isExcerptTruncated:this.data.excerpt.truncated,commentLovesCount:this.data.commentCount+this.data.favoritesList.list.length,activityType:this.data.activityType,itemCount:this.data.itemCount,itemId:this.data.itemId,favorite:this.data.favorite,activityUrl:this.data.activityUrl,targetType:this.data.targetType},this.index,this.count);}," ",function(){return JsonML.BST(MF.Activities.FavoritesList).dataBind({favoritesList:this.data.favoritesList,activityUrl:this.data.activityUrl,itemId:this.data.itemId,favorite:this.data.favorite,hasCommentsOrFavorites:(this.data.commentCount+this.data.favoritesList.list.length)>0},this.index,this.count);}," ",["div",{"class":"js-comments"}," ",function(){return JsonML.BST(MF.Activities.Comments).dataBind(this.data.comments,this.index,this.count);}," "]," ",function(){return JsonML.BST(MF.Activities.CommentFormMarker).dataBind({itemId:this.data.itemId,contentType:this.data.targetType,hasCommentsFavorites:(this.data.commentCount+this.data.favoritesList.list.length)>0},this.index,this.count);}," "]]);(function(){this.pickCssClass=function(B,A){if(B!=="CreatedComment"){switch(B){case"CreatedAlbum":return"album";case"CreatedDiscussion":return"discuss";case"CreatedEvent":return"event";case"UploadedFile":return"file";case"UploadedImage":return"photo";case"UploadedVideo":return"video";case"JoinedSite":return"joined";case"CreatedStory":return"slideshow";case"CreatedFamilyTree":return"tree";case"CreatedExternalLink":return"link";case"CreatedBlogEntry":return"blog";default:return"";}}else{switch(A){case"Album":return"album";case"Discussion":return"discuss";case"CalendarEvent":return"event";case"File":return"file";case"Image":return"photo";case"Slideshow":return"slideshow";case"Video":return"video";case"VoiceDiscussion":return"voice";case"FamilyTree":return"tree";case"ExternalLink":return"link";default:return"";}}};this.loadActivityTitle=function(){if(this.data.destID>0&&this.data.destID!==this.data.itemId){return MF.Activities.ModifiedAlbumTitle;}if(this.data.activityType==="CreatedBlogEntry"){return MF.Activities.BlogPostTitle;}if(this.data.activityType==="CreatedComment"){return MF.Activities.CommentTitle;}return MF.Activities.ContentTitle;};this.hideOr=function(C,B){var A=$("#activity_"+B);if(A.children(".js-actions").length<2){A.children(".js-or").remove();}};this.markFavorite=function(C,B,A,D){if(MF.user.canComment){return function(){var E=$(this);MF.Activities.Service.markFavorite(C,!B,A,{onSuccess:function(F){var G=$("#activity_"+C);B=F.isFavorite;G.children(".js-comment-action, .js-or").hide("fast",function(){$(this).remove();G.children(".js-comment-closed").removeClass("comment-closed");});G.children(".js-favoritesList").replaceWith(MF.Activities.FavoritesList.bind({favoritesList:F.list,activityUrl:D,itemId:C,favorite:B,hasCommentsOrFavorites:true}));}});return false;};}else{return false;}};}).call(MF.Activities.Item);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.Thumbnails=JsonML.BST(["ul",{"class":"thumbnail","jbst:visible":function(){return(this.data.previews.length>0);}}," ",function(){return JsonML.BST([""," ",["li",{"class":function(){return MF.Activities.Thumbnails.pickCssClass(this.data.contentType);}}," ",["div",{"class":"vidcontain"}," ",["a",{href:function(){return this.data.contentURL;}}," ",["img",{src:function(){return this.data.photoURL;},width:"64",height:"64"}]," ",["span",{"class":"overlay"},"\u00A0"]," "]," "]," "]," "]).dataBind(this.data.previews,this.index,this.count);}," "]);(function(){this.pickCssClass=function(A){if(A==="Video"||A==="Slideshow"){return"videothumb";}};}).call(MF.Activities.Thumbnails);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.Comments=JsonML.BST([""," ",["div",{"class":"activity-comment"}," ",["a",{href:function(){return this.data.AuthorURL;}}," ",["img",{src:function(){return this.data.AvatarURL;},width:"32",height:"32"}]," "]," ",["div",{"class":"comment-group"}," ",["p",{"class":"comment-author"}," ",["a",{href:function(){return this.data.AuthorURL;}}," ",function(){return this.data.AuthorName;}," "]," ",["span",{"class":"comment-meta"}," ",function(){return this.data.Date.toRelative(MF.ShortDateFormat);}," "]," "]," ",function(){return JsonML.BST(this.data.isVoice?MF.Voice.Player:null).dataBind(this.data.voice,this.index,this.count);}," ",["p",{"class":"comment-content"},function(){return JsonML.raw(this.data.Excerpt);}]," "]," "]," ",["div",{"class":"activity-comment collapsed js-showmore seemore","jbst:visible":function(){return this.showShowMoreLink(this.count,this.index,this.data.parentId,this.data.totalCount);}}," ",["p"," ",["a",{"class":"show-hide",href:"#",onclick:function(){return this.getAllComments(this.data.totalCount,this.data.parentId);}},"See more comments"]," "]," "]]);(function(){this.getAllComments=function(A,B){return function(){var C=$(this);var D=Math.min(MF.Activities.List.increments,A-MF.Activities.Comments.getPresentedCommentCount(B));MF.Activities.Service.getComments(B,MF.Activities.List.prependedCommentCount[B],D,{onSuccess:function(F){MF.Activities.List.prependedCommentCount[B]+=F.length;MF.Activities.List.modifiedCommentList[B]=true;var G=MF.Activities.Comments.bind(F);var E=$(C).parents(".js-showmore");if(G){E.before(G);if(A<=MF.Activities.Comments.getPresentedCommentCount(B)){E.remove();}}}});return false;};};this.showShowMoreLink=function(A,D,B,C){return(!MF.Activities.Comments.IsCommentListModified(B)&&D===1)&&(C>MF.Activities.Comments.getPresentedCommentCount(B));};this.getPresentedCommentCount=function(A){return MF.Activities.List.prependedCommentCount[A]+MF.Activities.List.appendedCommentCount;};this.IsCommentListModified=function(A){return MF.Activities.List.modifiedCommentList[A];};}).call(MF.Activities.Comments);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.CommentForm=JsonML.BST(["div",{"class":"activity-comment js-activity-comment","jbst:visible":function(){return MF.user.canComment;}}," ",["img",{height:"32",width:"32",src:function(){return MF.Activities.Item.currentAvatar;}}]," ",["div",{"class":"comment-group js-comment-group"}," ",["div",{"class":"comment-form js-comment-form"}," ",["form",{method:"post",action:"#","class":"js-form"}," ",["textarea",{"class":"autogrow js-comment active js-expand",name:"comment",style:"overflow:hidden;display:block"}]," ",["p",{"class":"submit"}," ",["a",{"class":"positive",onclick:function(){return this.submitComment(this.data.contentType,this.data.itemId);}}," ",function(){return JsonFx.Lang.get("Global,PostComment");}," "]," "]," "]," "]," "]," "]);(function(){this.submitComment=function(A,B){return function(){var C=this.form;var D=MF.Forms.getFormData(C);if(!!D.comment){MF.Activities.Service.postComment(B,D.comment,A,{onSuccess:function(E){E=MF.Activities.Comments.bind(E);$("#activity_"+B+" div.js-comments").append(jQuery(E));$(C).parents(".js-activity-comment").replaceWith(MF.Activities.CommentFormMarker.bind({itemId:B,hasCommentsFavorites:true,contentType:A}));}});}};};}).call(MF.Activities.CommentForm);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.CommentFormMarker=JsonML.BST(["div",{"class":function(){return this.pickCssClass(this.data.hasCommentsFavorites);},"jbst:visible":function(){return MF.user.canComment;}}," ",["img",{height:"32",width:"32",src:function(){return MF.Activities.Item.currentAvatar;}}]," ",["div",{"class":"comment-group js-comment-group"}," ",["p",{"class":"comment-add js-comment-form"}," ",["input",{"class":"comment-new edit-toggle",type:"text",value:function(){return JsonFx.Lang.get("Global,PostAComment");},onclick:function(){return this.switchCommentForm(this.data.itemId,this.data.contentType);}}]," "]," "]," "]);(function(){this.switchCommentForm=function(B,A){return function(){var C=$("#activity_"+B);C.find(".js-activity-comment").replaceWith(MF.Activities.CommentForm.bind({contentType:A,itemId:B}));C.find(".js-comment").autogrow({lineHeight:16}).focus();MF.Activities.Item.hideOr(this,B);return false;};};this.pickCssClass=function(A){var B="activity-comment js-activity-comment";if(A){return B;}else{return B+" comment-closed js-comment-closed";}};}).call(MF.Activities.CommentFormMarker);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.Excerpt=JsonML.BST(["p",{"class":"excerpt js-except","jbst:visible":function(){return !!this.data.excerptText;}}," ",function(){return JsonML.raw(this.data.excerptText);}," "]);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.CommentTitle=JsonML.BST(["p",{"class":"description"}," ",function(){return JsonFx.Lang.get("Global,CommentedLabel");}," ",["a",{href:function(){return this.data.targetUserUrl;}},function(){return this.data.targetUser;},"'s"]," ",["a",{href:function(){return this.data.activityUrl;},"jbst:visible":function(){return !this.data.urlText;}}," ",function(){return this.data.description;}," "]," ",["span",{"jbst:visible":function(){return !!this.data.urlText;}}," ",function(){return this.data.description;}," "]," ",["a",{href:function(){return this.data.activityUrl;},"jbst:visible":function(){return !!this.data.urlText;}},function(){return this.data.urlText;}]," "]);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.ContentTitle=JsonML.BST(["p",{"class":"description"}," ",["a",{href:function(){return this.data.userUrl;}}," ",function(){return this.data.user;}," "]," ",function(){return this.data.description;}," ",["a",{href:function(){return this.data.activityUrl;}}," ",function(){return this.data.urlText;}," "]," "]);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.ModifiedAlbumTitle=JsonML.BST(["p",{"class":"description"}," ",["a",{href:function(){return this.data.userUrl;}}," ",function(){return this.data.user;}," "]," ",function(){return this.data.description;}," ",function(){return this.data.urlText;}," ",function(){return JsonFx.Lang.get("Global,ModifiedAlbumLabel");}," ",["a",{href:function(){return this.data.activityUrl;}}," ",function(){return this.data.destTitle;}," "]," "]);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.BlogPostTitle=JsonML.BST(["p",{"class":"description"}," ",["a",{href:function(){return this.data.userUrl;}}," ",function(){return this.data.user;}," "]," ",function(){return this.data.description;}," ",["a",{href:function(){return this.data.activityUrl;}}," ",function(){return this.data.urlText;}," "]," "]);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.FavoritesList=JsonML.BST(["div",{"class":"js-favoritesList"}," ",["div",{"class":"activity-comment faved","jbst:visible":function(){return this.data.hasCommentsOrFavorites;}}," ",["div",{"class":"comment-group"}," ",["p"," ",function(){return JsonML.BST(MF.Activities.FavoritesLink).dataBind({itemId:this.data.itemId,activityUrl:this.data.activityUrl,favorite:this.data.favorite,favoriteCount:this.data.favoritesList.list.length},this.index,this.count);}," ",function(){return JsonML.BST(MF.Activities.FavoritesItem).dataBind(this.data.favoritesList.list,this.index,this.count);}," ",["a",{href:function(){return this.data.activityUrl;},"jbst:visible":function(){return this.data.favoritesList.unshownCount>0;}}," & ",function(){return this.data.favoritesList.unshownCount;}," more "]," "]," "]," "]," "]);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.FavoritesItem=JsonML.BST(["a",{href:function(){return this.data.profileUrl;}}," ",["img",{height:"32",width:"32",src:function(){return this.data.avatar;},alt:function(){return this.data.displayName;},title:function(){return this.data.displayName;}}]," "]);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.FavoritesLink=JsonML.BST(["span",{"class":function(){return this.getFavoriteCss(this.data.favorite,this.data.favoriteCount);},onclick:function(){return MF.Activities.Item.markFavorite(this.data.itemId,this.data.favorite,this.data.targetType,this.data.activityUrl);}}," ",function(){return this.getFavoriteText(this.data.favorite);}," "]);(function(){this.getFavoriteText=function(A){if(A){return"You love this";}else{return"Love this";}};this.getFavoriteCss=function(A){if(A){return"js-comment-fave comment-fave faved";}else{if(MF.user.canComment){return"js-comment-fave comment-fave";}else{return"js-comment-fave comment-fave limt";}}};}).call(MF.Activities.FavoritesLink);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.Date=JsonML.BST(["p",{"class":"activityDate","jbst:visible":function(){return MF.Activities.Date.showDate(this.data.activityDate.toRelative(MF.ShortDateFormat));}}," ",["span",function(){return this.data.activityDate.toRelative(MF.ShortDateFormat);}]," "]);(function(){this.showDate=function(B){if(!this.currentDate){this.currentDate="";}var A=(this.currentDate!==B);this.currentDate=B;return A;};}).call(MF.Activities.Date);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Activities){MF.Activities={};}MF.Activities.ActionLinks=JsonML.BST([""," ",["p",{"class":"action js-action","jbst:visible":function(){return this.data.isExcerptTruncated;}}," ",["a",{"class":"show-hide",href:"#",onclick:function(){return this.getFullDiscussionClosure(this.data.itemId);}},"Read More"]," "]," ",["p",{"class":"js-or action","jbst:visible":function(){return this.showOr(this.data);}}," ",function(){return JsonFx.Lang.get("Global,Or");}," "]," ",["p",{"class":"action js-action js-comment-action","jbst:visible":function(){return MF.Activities.List.canComment(this.data.commentLovesCount,this.data.activityType,this.data.itemCount);}}," ",["a",{"class":"show-hide",href:"#",onclick:function(){return this.switchCommentForm(this.data.itemId,this.data.targetType);}},"Comment"]," \u2022 ",["a",{href:"#loves",onclick:function(){return MF.Activities.Item.markFavorite(this.data.itemId,this.data.favorite,this.data.targetType,this.data.activityUrl);}},"Love this"]," "]]);(function(){this.showOr=function(A){return A.isExcerptTruncated&&MF.Activities.List.canComment(A.commentLovesCount,A.activityType,A.itemCount);};this.switchCommentForm=function(B,A){return function(){var C=$("#activity_"+B);$(this).parents(".js-action").hide();C.find(".js-activity-comment").replaceWith(MF.Activities.CommentForm.bind({contentType:A,itemId:B}));C.find(".js-comment").autogrow({lineHeight:16}).focus();C.find(".js-favoritesList").replaceWith(MF.Activities.FavoritesList.bind({favoritesList:{list:[],unshownCount:0},activityUrl:"",itemId:B,favorite:false,hasCommentsOrFavorites:true}));MF.Activities.Item.hideOr(this,B);return false;};};this.getFullDiscussionClosure=function(A){return function(){var B=this;MF.Activities.Service.getFullDiscussion(A,{onSuccess:function(C){$("#activity_"+A).children("p.js-except").replaceWith(MF.Activities.Excerpt.bind(C));jQuery(B).parents(".js-action").hide();MF.Activities.Item.hideOr(B,A);}});return false;};};}).call(MF.Activities.ActionLinks);}catch(ex){}