try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Trees){MF.Trees={};}MF.Trees.TreePublisher=JsonML.BST([""," ",["div",{"class":"add-panel add-tree js-add-panel"}," ",["h3","Import Family Tree"]," ",["p","Import a Family Tree from Ancestry.com"]," ",["p",{"class":"submit"},["a",{href:function(){return MF.Trees.PublisherUrl;},"class":"positive slideshowPanelReturn"},"Get started"]," or ",["a",{href:"#","class":"slideshowPanelReturn",onclick:function(){return MF.Publisher.Module.reset;}},["strong","cancel"]]],"\n"],"\n"]);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Trees){MF.Trees={};}MF.Trees.List=JsonML.BST(["div",{"class":"js-treeList"}," ",["div",{"class":"page-title"}," ",["h2",function(){return JsonFx.Lang.get("Global,FamilyTrees");}]," "]," ",["div",{"class":"backlinks"}," ",["a",{href:function(){return MF.Trees.AcomUrl;},target:"_blank"},function(){return JsonFx.Lang.get("Global,AncestryCom");}]," "]," ",["p"," ",function(){return JsonFx.Lang.get("Global,ImportTreeFromAncestry");}," ",["a",{href:function(){return MF.Trees.AcomUrl;},target:"_blank"},function(){return JsonFx.Lang.get("Global,VisitAncestry");}]," ",function(){return JsonFx.Lang.get("Global,ImportTreeFromAncestry2");}," "]," ",["div",{"class":"admin","jbst:visible":function(){return this.data.canAddContent;}}," ",["p",{"class":"add"}," ",["a",{href:"#",onclick:"MF.Trees.List.showAuthentication();return false;"},function(){return JsonFx.Lang.get("Global,ImportTreeAction");}]," "]," "]," ",["div",{"class":"trees-empty","jbst:visible":function(){return this.data.items.length===0;}}," ",["a",{title:"start one with Ancestry.com",href:function(){return MF.Trees.AcomUrl;},target:"_blank"},"Start one with Ancestry.com"]," "]," ",["table",{"class":"data filestable treetable",cellspacing:"0",cellpadding:"0","jbst:visible":function(){return this.data.items.length>0;}}," ",["thead"," ",["tr"," ",["th",{"class":"title",width:"40%"},function(){return JsonFx.Lang.get("Global,TreeName");}]," ",["th",{"class":"title",width:"40%"},"Added by"]," ",["th",{"class":"title",width:"40%"},"Date added"]," "]," "]," ",["tbody"," ",function(){return JsonML.BST(MF.Trees.Item).dataBind(this.data.items,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.Trees.List.getMFTrees),this.index,this.count);}," "]);(function(){this.getAComTrees=function(){return function(){var A=$(this).parents("form");var B=MF.Forms.getFormData(A);if(!B.userName){MF.Message.showError(A,"Please enter your Username.",MF.Message.Scope.Inline);return false;}if(!B.password){MF.Message.showError(A,"Please enter your Password.",MF.Message.Scope.Inline);return false;}MF.Trees.Service.authenticate(B.userName,B.password,{onSuccess:function(C){MF.Dialog.remove(A.parents(".TB_window"),$(".TB_window,.TB_overlay,.TB_HideSelect"));var D;if(C.length>0){D=MF.Dialogs.ListSelect.bind({items:C,selected:{},callback:MF.Trees.List.importTrees});}else{D=MF.Trees.EmptyAComTreeList.bind({});}if(D){document.body.appendChild(D);}},onFailure:function(E,C,D){if(D.data.Type==="UnauthorizedAccessException"){MF.Message.showError(A.children(".js-userName"),"Username or Password incorrect. Please visit Ancestry.com if you've forgotten your credentials.",MF.Message.Scope.Inline,5000);MF.Forms.reset(A[0]);$("#username").focus();}else{MF.Message.showError(A.children(".js-userName"),"Ancestry.com appears to be down at the moment.  Please try again later.",MF.Message.Scope.Inline,5000);}}});};};this.showAuthentication=function(){var A;A=MF.Trees.AuthenticationDialog.bind({elem:this,message:"Are you sure you want to remove this tree from the group?",callback:MF.Trees.List.authenticate});if(A){document.body.appendChild(A);if(JsonFx.userAgent.ie<7){document.body.scrollIntoView(true);}}};this.importTrees=function(A){MF.Trees.Service.importTree(A,{onSuccess:function(B){$(".js-treeList").replaceWith(MF.Trees.List.bind(B));}});};this.getMFTrees=function(B,A){MF.Trees.Service.getTrees(B,A,{onSuccess:function(C){$(".js-treeList").replaceWith(MF.Trees.List.bind(C));}});};}).call(MF.Trees.List);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Trees){MF.Trees={};}MF.Trees.Item=JsonML.BST(["tr",{"class":function(){return this.pickClass(this.index);}}," ",["td",{"class":"title"}," ",["a",{href:function(){return this.data.treeUrl;}},function(){return this.data.name;}]," ",["a",{"class":"negative",href:"#Remove",onclick:function(){return this.removeTreeClosure(this.data.id);},"jbst:visible":function(){return this.data.canDelete;}},"Delete tree"]," "]," ",["td",{"class":"title"}," ",["a",{href:function(){return this.data.addedByUrl;}},function(){return this.data.addedBy;}]," "]," ",["td",{"class":"title"}," ",function(){return this.data.createdDate.toRelative(MF.ShortDateFormat);}," "]," "]);(function(){this.pickClass=function(A){if(A%2==0){return"odd";}};this.removeTree=function(C,A,D){var B=$(A).parents("modal");MF.Forms.disableSubmit(B);MF.Trees.Service.removeTree(C,{onSuccess:function(E){$(this).parents("tr").hide("slow",function(){$(this).remove();});if(D){D();}$(".js-treeList").replaceWith(MF.Trees.List.bind(E));},onComplete:function(){MF.Forms.enableSubmit(B);}});};this.removeTreeClosure=function(A){return function(){var B;B=MF.Dialogs.ConfirmDeleteDialog.bind({id:A,elem:this,message:"Are you sure you want to remove this tree from the group?",callback:MF.Trees.Item.removeTree,ok:"Remove",cancel:"Don't remove",title:"Remove tree"});if(B){document.body.appendChild(B);if(JsonFx.userAgent.ie<7){document.body.scrollIntoView(true);}}return false;};};}).call(MF.Trees.Item);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Trees){MF.Trees={};}MF.Trees.Service=new JsonFx.IO.Service("/Features/Ancestry/Trees/TreesService.jrpc");MF.Trees.Service.getTrees=function(start,count,opt){this.invoke("getTrees",[start,count],opt);};MF.Trees.Service.removeTree=function(treeId,opt){this.invoke("removeTree",[treeId],opt);};MF.Trees.Service.authenticate=function(username,password,opt){this.invoke("authenticate",[username,password],opt);};MF.Trees.Service.importTree=function(trees,opt){this.invoke("importTree",[trees],opt);};}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Trees){MF.Trees={};}MF.Trees.EmptyAComTreeList=JsonML.BST(function(){return JsonML.BST(MF.Dialog).dataBind({height:260,width:330,modal:false,data:this.data},this.index,this.count,{$:[""," ",["div",{"class":"album-select-form tree-list"}," ",["h2","No Trees Available"]," ",["p"," We're sorry, there are no family trees under that Ancestry.com account. You should ",["a",{href:function(){return MF.Trees.AcomUrl;},target:"_blank"},"visit Ancestry.com today"]," to create one. When you're done you can come back to your family group and import it. "]," ",["p",{"class":"submit"}," ",["a",{"class":"positive",href:function(){return MF.Trees.AcomUrl;},target:"_blank"},"Go to Ancestry.com"]," or ",["a",{href:"#cancel",onclick:function(){return MF.Dialog.remove;}},"Cancel"]," "]," "],"\n"]});});}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Trees){MF.Trees={};}MF.Trees.AuthenticationDialog=JsonML.BST(function(){return JsonML.BST(MF.Dialog).dataBind({height:260,width:330,modal:false,data:this.data},this.index,this.count,{$:[""," ",["div",{"class":"box signin tree-list js-authContainer"}," ",["h2",{"class":"ancestry"},"Ancestry.com Account"]," ",["p","Please enter your Ancestry.com account information to begin importing your Family Tree."]," ",["form",{"class":"js-EnableKeys",onsubmit:"return false;"}," ",["div",{"class":"js-userName"}," ",["label",{"class":"js-error","for":"usern"},"Username:"]," ",["input",{id:"username",type:"text",tabindex:"2",name:"userName","class":"active"}]," "]," ",["label",{"class":"password","for":"pass"},"Password:"]," ",["input",{id:"password",type:"password",tabindex:"2",name:"password","class":"active"}]," ",["p",{"class":"submit"}," ",["input",{"class":"positive js-EnterKeyTarget",type:"submit",value:"Begin Import",tabindex:"4",onclick:function(){return MF.Trees.List.getAComTrees();}}]," or ",["a",{href:"#cancel",onclick:function(){return MF.Dialog.remove;}}," ",["strong","Cancel"]," "]," "]," "]," "],"\n"]});});}catch(ex){}