try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.ContentCopy){MF.ContentCopy={};}MF.ContentCopy.Service=new JsonFx.IO.Service("/Features/ContentCopy/ContentCopyService.jrpc");MF.ContentCopy.Service.getSites=function(start,count,opt){this.invoke("getSites",[start,count],opt);};MF.ContentCopy.Service.copyContent=function(contentID,siteIDs,opt){this.invoke("copyContent",[contentID,siteIDs],opt);};MF.ContentCopy.Service.copyActivity=function(activityID,siteIDs,opt){this.invoke("copyActivity",[activityID,siteIDs],opt);};MF.ContentCopy.Service.copyBlogPost=function(blogId,siteIDs,opt){this.invoke("copyBlogPost",[blogId,siteIDs],opt);};}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.ContentCopy){MF.ContentCopy={};}MF.ContentCopy.SitePickerList=JsonML.BST(["div",{"class":"members choose js-SiteCopy js-ColumnMessage"}," ",["h2","Choose family group"]," ",["div",{"class":"box"}," ",["div",{"class":"contacts large"}," ",function(){return JsonML.BST([""," ",["div",{"class":function(){return MF.ContentCopy.SitePickerList.getCss(this.data.id,this.data.isExpired,this.index);},onclick:function(){return MF.ContentCopy.SitePickerList.toggle(this.data.id,this.data.isExpired);}}," ",["img",{src:function(){return this.data.avatar;}}]," ",["p",["span",{"class":"name"},function(){return this.data.name;}," ",["img",{"jbst:visible":function(){return this.data.isExpired;},src:"/Images/expiredsite.gif"}]," "]]," "]," "]).dataBind(this.data.sites,this.index,this.count);}," "]," ",function(){return JsonML.BST(MF.Paging.Pager).dataBind(MF.Paging.Pager.buildData(this.data.start,this.data.count,this.data.total,MF.ContentCopy.SitePickerList.load),this.index,this.count);}," "]," ",["p",{"class":"submit"}," ",["a",{href:"#done",onclick:function(){return MF.ContentCopy.SitePickerDialog.save;},"class":"positive"},"Done"]," or ",["a",{href:"#cancel",onclick:function(){return MF.ContentCopy.SitePickerDialog.cancel;}},"cancel"]," "]," "]);(function(){this.load=function(B,A){MF.ContentCopy.Service.getSites(B,A,{onSuccess:function(C){$(".js-SiteCopy").replaceWith(MF.ContentCopy.SitePickerList.bind(C));}});};this.toggle=function(A,B){if(B){return false;}return function(){var C=$(this);if(C.hasClass("selected")){C.removeClass("selected");MF.ContentCopy.SitePickerDialog.removeSite(A);}else{C.addClass("selected");MF.ContentCopy.SitePickerDialog.addSite(A);}return false;};};this.getCss=function(C,A,D){var B="contact clearfix";if(D%2===0){B+=" first";}if(A){B+=" expired";}if(MF.ContentCopy.SitePickerDialog.isSelected(C)){B+=" selected";}return B;};}).call(MF.ContentCopy.SitePickerList);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.ContentCopy){MF.ContentCopy={};}MF.ContentCopy.SitePickerDialog=JsonML.BST(function(){return JsonML.BST(MF.Dialog).dataBind({width:460,modal:true},this.index,this.count,{$:[""," ",["div",{"class":"js-SiteCopy"}," ",["h2",{style:"text-align:center"},"Loading\u2026"]," "]," "]});});(function(){this.CopyTypes={activity:"activity",blog:"blog",content:"content"};var A=8,D,C,B;this.show=function(F,G){var E=MF.ContentCopy.SitePickerDialog.bind();if(E&&F){if(F){C=F;B=!!(G)?G:MF.ContentCopy.SitePickerDialog.CopyTypes.content;}else{throw new Error("SitePickerDialog.show: bad ContentID value.");}D=[];document.body.appendChild(E);if(JsonFx.userAgent.ie<7){document.body.scrollIntoView(true);}MF.ContentCopy.SitePickerList.load(0,A);}return false;};this.addSite=function(E){D.push(E);};this.removeSite=function(E){for(var F=D.length-1;F>=0;F--){if(D[F]===E){D.splice(F,1);}}};this.isSelected=function(E){for(var F=D.length-1;F>=0;F--){if(D[F]===E){return true;}}return false;};this.save=function(){if(!D||!D.length){MF.Dialog.remove();return false;}var E;switch(B){case MF.ContentCopy.SitePickerDialog.CopyTypes.activity:E="copyActivity";break;case MF.ContentCopy.SitePickerDialog.CopyTypes.blog:E="copyBlogPost";break;case MF.ContentCopy.SitePickerDialog.CopyTypes.content:default:E="copyContent";break;}function G(H){MF.Message.showError(F,"An error occurred while copying. Please try again or try a different group.",MF.Message.Scope.Column,30000);}var F=this;MF.ContentCopy.Service[E](C,D,{onSuccess:function(H){if(!H){G(H);return;}MF.Message.showInfo(null,"Successfully copied.",MF.Message.Scope.Column,30000);MF.Dialog.remove();},onFailure:G});return false;};this.cancel=function(){MF.Dialog.remove();C=activityID=D=null;return false;};}).call(MF.ContentCopy.SitePickerDialog);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.ContentCopy){MF.ContentCopy={};}MF.ContentCopy.Rotate=JsonML.BST(["div",{"jbst:visible":function(){return this.canRotate(this.data);},style:"display:none"}," ",["iframe",{id:"CreateImageFrame",name:"CreateImageFrame"}]," ",["form",{method:"post",action:function(){return this.data.saveUrl;},target:"CreateImageFrame","class":"js-CreateImageForm"}," ",["input",{type:"hidden",name:"Transforms",value:function(){return this.data.transforms;},defaultValue:function(){return this.data.transforms;}}]," "]," "]);(function(){var I,B,D,H,J=false;var E=[0,0,0,2,2,1,1,3,3];var C=[1,6,3,8];function G(K,L){H=D=null;MF.Message.showInfo(null,"Rotation successfully saved.",MF.Message.Scope.Column,10000);$(".js-SaveRotate").hide();}function F(K,L,M){MF.Message.showError(null,"Rotation failed. Please try again.",MF.Message.Scope.Column);}function A(){J=false;MF.Loading.hide();}this.canRotate=function(K){if(!K.rotateUrl){return false;}switch(K.type){case"Image":return true;default:return false;}};this.rotate=function(L,K){return function(){if(J){return false;}var M=($("img.js-ImagePreview").length>0)?$("img.js-ImagePreview"):$("img.item-main");if(!M.length){return false;}MF.Message.clear(null,MF.Message.Scope.Column);if(!H){H=M.attr("src");D=B;}B=(C.length+B+K)%C.length;if(B!==D){MF.Loading.show(50);M[0].onload=function(){MF.Loading.hide();this.onload=null;};M.attr("src",String.format(L,C[B]||0)).removeAttr("height").removeAttr("width");}else{M.attr("src",H).removeAttr("height").removeAttr("width");}$(".js-SaveRotate").toggle(B!==D);return false;};};this.jsonp=function(K){var N=K&&K.result;if(!N||(!N.remasteredID&&!N.originalID)){F(K,null,K&&K.error);return;}var L=N.remasteredAuth||N.originalAuth||null;var M=N.remasteredID||N.originalID||null;if(I&&I>0){MF.Media.Service.saveRotate(I,C[B]||0,M,L,{onSuccess:G,onFailure:F,onComplete:A});}else{if(MF.Blog&&MF.Blog.PhotoPublisher){MF.Blog.PhotoPublisher.setAuthGuid(L);MF.Blog.PhotoPublisher.setDisplayGuid(M);MF.Blog.PhotoPublisher.setOrientation(C[B]||0);G({},{});A();}}};this.saveRotate=function(K,N,L){B=E[L]||0;I=N;var M=K;return function(){if(J){return false;}J=true;MF.Message.clear(null,MF.Message.Scope.Column);MF.Loading.show(100);var O=$("iframe#CreateImageFrame")[0];if(O&&O.contentWindow){O.contentWindow.name=O.name;}var P=$("form.js-CreateImageForm");P.attr("action",String.format(M,C[B]||0));P[0].submit();return false;};};}).call(MF.ContentCopy.Rotate);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.ContentCopy){MF.ContentCopy={};}MF.ContentCopy.ActionLinks=JsonML.BST(["ul",{"class":"item-actions"}," ",["li",{"class":function(){return this.getFavoriteCss(this.data.favorite);},"jbst:visible":function(){return this.data.canComment;}},["a",{"class":"action-link",href:"#favorite",onclick:function(){return this.markFavorite(this.data.id,this.data.favorite,this.data.type);}},function(){return this.getFavoriteText(this.data.favorite);}]]," ",["li",{"class":"action-share","jbst:visible":function(){return this.data.canShare;}},["a",{onclick:function(){return this.showShareDialog(this.data.id);},href:"#share","class":"action-link item-share"},["span","Share this ",function(){return this.getFriendlyName(this.data.type);}]," ",["img",{src:"/Images/serviceIcons/link.png"}]]]," ",["li",{"class":"action-copy","jbst:visible":function(){return this.data.canCopy;}},["a",{onclick:function(){return this.showCopyToDialog(this.data.id);},href:"#copy","class":"action-link"},"Copy to another family group"]]," "]);(function(){this.showShareDialog=function(A){return function(){MF.Share.ShareDialog.showDlg(A);return false;};};this.showCopyToDialog=function(A){return function(){MF.ContentCopy.SitePickerDialog.show(A);return false;};};this.getFriendlyName=function(A){if(A==="Image"){return"photo";}else{if(A==="VoiceDiscussion"){return"voice discussion";}else{return A.toLowerCase();}}};this.getFavoriteText=function(A){if(A){return"You love this";}else{return"Love this";}};this.getFavoriteCss=function(A){if(A){return"action-fave active";}else{return"action-fave";}};this.markFavorite=function(C,B,A){return function(){var D=$(this);MF.Favorite.Service.markFavorite(C,!B,A,{onSuccess:function(E){B=E.isFavorite;D.parents("li").toggleClass("active");$(D).html(MF.ContentCopy.ActionLinks.getFavoriteText(B));$(".js-favoritesList").replaceWith(MF.Favorite.FavoriteList.bind(E.favoritesList));}});return false;};};}).call(MF.ContentCopy.ActionLinks);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.ContentCopy){MF.ContentCopy={};}MF.ContentCopy.AdminLinks=JsonML.BST([""," ",["ul",{"class":"item-actions"}," ",["li",{"class":"action-rotate","jbst:visible":function(){return MF.ContentCopy.Rotate.canRotate(this.data);}}," ",["a",{href:"#rotate-left","class":"action-link item-rotate-left",onclick:function(){return MF.ContentCopy.Rotate.rotate(this.data.rotateUrl,-1);}},"Rotate left"]," ",["a",{href:"#rotate-right","class":"action-link item-rotate-right",onclick:function(){return MF.ContentCopy.Rotate.rotate(this.data.rotateUrl,+1);}},"Rotate right"]," ",["a",{href:"#save-rotate","class":"positive item-rotate-save js-SaveRotate",onclick:function(){return MF.ContentCopy.Rotate.saveRotate(this.data.saveUrl,this.data.id,this.data.orient);},style:"display:none"},["span","Save rotate"]]," "]," ",["li",{"class":"action-download","jbst:visible":function(){return !!this.data.download;}},["a",{href:function(){return this.data.download;},"class":"action-link item-download"},"Download this ",function(){return this.getFriendlyName(this.data.type);}]]," ",["li",{"class":"action-pin","jbst:visible":function(){return this.data.canPin;}},["a",{onclick:function(){return this.pin(this.data.id,this.data.pinned);},href:"#pin","class":"action-link item-pin"},function(){return this.getPinnedText(this.data.pinned);}]]," "]," ",function(){return JsonML.BST(MF.ContentCopy.Rotate).dataBind(this.data,this.index,this.count);}]);(function(){this.getFriendlyName=function(A){if(A==="Image"){return"photo";}else{if(A==="VoiceDiscussion"){return"voice discussion";}else{return A.toLowerCase();}}};this.getPinnedText=function(A){if(A){return"Unpin photo from homepage";}else{return"Pin photo to homepage";}};this.pin=function(B,A){return function(){var C=this;MF.Media.Service.pinContent(B,!A,{onSuccess:function(D){A=D.pinned;$(C).html(MF.ContentCopy.AdminLinks.getPinnedText(A));}});return false;};};}).call(MF.ContentCopy.AdminLinks);}catch(ex){}