if($MP==undefined){var $MP=TGN.namespace("TGN.Ancestry.Community.MiniProfile");if("undefined"==typeof _YDom){_YDom=YAHOO.util.Dom}$MP.miniProfile=null;$MP.miniProfileContainer=null;$MP.miniProfileBody=null;$MP.knub=null;$MP.Init=function(){this.isFireFox=false;this.height=280;this.width=370;if(navigator.userAgent.indexOf("Firefox")!=-1){this.isFireFox=true;this.height=260}};$MP.profiles=null;$MP.Profile=function(a,b){this.ucdmid=a;this.miniProfile=b};$MP.miniProfileLoaded=new YAHOO.util.CustomEvent("miniProfileLoaded");$MP.miniProfileClosed=new YAHOO.util.CustomEvent("miniProfileClosed");$MP.currentRequest=null;$MP.currentRequestId;$MP.showMiniProfile=function(e){var a="";var h=0;var g=true;if(undefined!=e.contextType){h=e.contextType}if(undefined!=e.contextValue){a=e.contextValue}if(undefined!=e.showContactModal){g=e.showContactModal}$MP.currentRequestId=e.id;if($MP.miniProfile==null){$MP.miniProfile=new $MP.Init();if($MP.profiles==null){$MP.profiles=new Array()}}YAHOO.util.Event.addListener(document,"click",$MP.close);var c='<div class="un_content" style="background:white;height:50px;padding:25px 30px 25px 100px;"><img src="http://c.mfcreative.com/lib/TGN/Ancestry/Community/i/loading.gif"/></div>';$MP.showPanel(c);for(i=0;i<$MP.profiles.length;i++){if($MP.profiles[i].ucdmid==e.ucdmid){$MP.showPanel($MP.profiles[i].miniProfile,e.id);return}}var d=function(l,k){this.ucdmid=l;this.id=k};var f=$MP.getContextValue(a,"o_ufc");var b=$MP.getContextValue(a,"o_cvc");if(f!=null||b!=null){var j=s_gi(s_account,1);if(f!=null){j.prop20=f}if(b!=null){j.prop21=b}j.tl()}$MP.currentRequest=new TGN.Util.AjaxRequest("POST","/community.ashx","",{success:$MP.success,failure:$MP.failure,scope:new d(e.ucdmid,e.id),timeout:20000},"f=GetMiniProfile&rurl="+escape(window.location)+"&uid="+e.ucdmid+"&ctxT="+h+"&ctxV="+escape(a)+"&showContactModal="+g);$MP.currentRequest.invoke()};$MP.getContextValue=function(a,c){var d=new RegExp("(^|[&])"+c+"=([^&]*)","i");var b=d.exec(a);if(b==null){return null}return unescape(b[2])};$MP.cacheDomain="http://c.mfcreative.com";$MP.userDocDomain="http://userdoc.ancestry.com";$MP.GetUserLink=function(f){var e="";var j="";if(f.ucdmid!=undefined){j=f.ucdmid}var g="";if(f.displayName!=undefined){g=f.displayName}var c="";if(f.id!=undefined){c=f.id}var a="";if(f.photoId!=undefined){a=f.photoId}var k="";if(f.macId!=undefined){k=f.macId}var h=true;if(f.showAvatar!=undefined){h=f.showAvatar}if(f.userDocDomain!=undefined){$MP.userDocDomain=f.userDocDomain}var b="";if(f.contextType!=undefined){b+=",contextType:"+f.contextType}if(f.contextValue!=undefined){b+=",contextValue:'"+f.contextValue+"'"}if(j.length>0&&g.length>0&&c.length>0){var d="{type:'miniprofile',onSuccess:function(config){$MP.showMiniProfile(config);},ucdmid:'"+j+"',id:'"+c+"'"+b+"}";e='<a id="ul_'+c+'" class="uLink" href="javascript:$Anc.load('+d+');">';if(h){if(a.length>0&&k.length>0&&a!="ffffffff-ffff-ffff-ffff-ffffffffffff"){e+='<img height="20" width="15" src="'+$MP.userDocDomain+"/userdocstore/download.ashx?fileid="+a+"&mac="+k+'"/>'}else{e+='<img height="20" width="15" src="'+$MP.cacheDomain+'/lib/TGN/shared/assets/images/usericon_small.gif"/>'}e+="&nbsp;"}e+="<span>"+g+"</span>";e+="</a>"}return e};$MP.showPanel=function(a){if(null==$MP.miniProfileContainer){$MP.loadMiniProfileInDOM()}$MP.miniProfileContainer.style.display="block";$MP.miniProfileBody.innerHTML=a;$MP.SetPosition();$MP.miniProfileLoaded.fire()};$MP.loadMiniProfileInDOM=function(){$MP.miniProfileContainer=document.createElement("div");$MP.miniProfileContainer.id="miniProfile";_YDom.setStyle($MP.miniProfileContainer,"width",$MP.miniProfile.width+"px");_YDom.setStyle($MP.miniProfileContainer,"height","auto");_YDom.setStyle($MP.miniProfileContainer,"position","absolute");var c=document.createElement("div");c.id="mp_knub";$MP.miniProfileContainer.appendChild(c);c=document.createElement("div");c.id="mp_knub_r";$MP.miniProfileContainer.appendChild(c);var b=document.createElement("a");b.id="un_close";_YDom.setAttribute(b,"href","javascript:$MP.captureClick();");var a=document.createElement("img");a.id="close_button";_YDom.setAttribute(a,"src","http://c.mfcreative.com/lib/TGN/Ancestry/Community/i/close.gif");b.appendChild(a);$MP.miniProfileContainer.appendChild(b);$MP.miniProfileBody=document.createElement("div");$MP.miniProfileContainer.appendChild($MP.miniProfileBody);document.body.appendChild($MP.miniProfileContainer)};$MP.success=function(d,b){$MP.currentRequest=null;var a;var c=false;for(a=0;a<$MP.profiles.length;a++){if($MP.profiles[a].ucdmid==b.ucdmid){c=true}}if(!c){$MP.profiles[$MP.profiles.length]=new $MP.Profile(b.ucdmid,d.responseText)}if(b.id==$MP.currentRequestId){$MP.showPanel(d.responseText)}};$MP.failure=function(d,c){$MP.currentRequest=null;if(c.id!=$MP.currentRequestId){return}var a="We're sorry. We were unable to retrieve the requested profile.<br>Please click the close button and try again.";var b='<div class="un_content" style="background:white;padding:25px 10px 25px 10px;">'+a+"</div>";$MP.showPanel(b)};$MP.SetPosition=function(){var b=_YDom.get("ul_"+$MP.currentRequestId);var l=_YDom.getXY(b);var k=_YDom.getViewportHeight();var h=_YDom.getViewportWidth();var a=_YDom.getDocumentScrollTop(document);var e=l[1]-a;var g=k-e;var c=l[0];var f=h-(c+b.clientWidth);var j=20;if(e>g){_YDom.setY($MP.miniProfileContainer,l[1]-($MP.miniProfileContainer.clientHeight-40))}else{_YDom.setY($MP.miniProfileContainer,l[1]-30)}var d=false;if(f>$MP.miniProfile.width){d=true}else{if(c>$MP.miniProfile.width){_YDom.setStyle(_YDom.get("mp_knub"),"display","none");$MP.knub=_YDom.get("mp_knub_r");_YDom.setStyle($MP.knub,"display","block");_YDom.setX($MP.miniProfileContainer,l[0]-($MP.miniProfile.width+j+3));_YDom.setX($MP.knub,_YDom.getX($MP.miniProfileContainer)+$MP.miniProfile.width+3);_YDom.setStyle($MP.knub,"top","20px")}else{d=true}}if(d){_YDom.setStyle(_YDom.get("mp_knub_r"),"display","none");$MP.knub=_YDom.get("mp_knub");_YDom.setStyle($MP.knub,"display","block");_YDom.setX($MP.miniProfileContainer,l[0]+b.offsetWidth+(j-5));_YDom.setX($MP.knub,l[0]+b.offsetWidth)}_YDom.setY($MP.knub,l[1]-5)};$MP.captureClick=function(a){};$MP.close=function(c){var g=navigator.userAgent;var k=_YDom.getXY($MP.miniProfileContainer);var f=k[0];var b=k[0]+$MP.miniProfileContainer.clientWidth;var d=k[1];var a=k[1]+$MP.miniProfileContainer.clientHeight;var j;var h;if($MP.miniProfile.isFireFox){j=c.pageX;h=c.pageY}else{j=c.clientX;h=c.clientY}var e=false;var l;if($MP.miniProfile.isFireFox){l=c.target}else{l=c.srcElement}if(!e){if((h>=a||h<=d)||(j>=b||j<=f)||l.id=="close_button"||l.className=="contactLink"){$MP.miniProfileContainer.style.display="none";YAHOO.util.Event.removeListener(document,"click",$MP.close);$MP.miniProfileClosed.fire();if(null!=$MP.currentRequest){$MP.currentRequest.abort(false)}}}};$MP.hideContainer=function(){$MP.miniProfileContainer.style.display="none"};$MP.flushProfile=function(c){try{if($MP.profiles!=null){var a;var b;for(a=0;a<$MP.profiles.length;a++){b=$MP.profiles[a];if(b.ucdmid==c){b.ucdmid="";b.miniProfile=""}}}}catch(d){}};$MP.onBlockUser=new YAHOO.util.CustomEvent("onBlockUser");$MP.onUnBlockUser=new YAHOO.util.CustomEvent("onBlockUser");$MP.blockUser=function(d){var c;if(d.block){c="BlockUser"}else{c="UnBlockUser"}var a={block:d.block,blockLinkContainerId:d.blockLinkContainerId,contactLinkContainerId:d.contactLinkContainerId};var b=new TGN.Util.AjaxRequest("GET","/community.ashx","f="+c+"&bId="+d.bid+"&bcId="+d.blockLinkContainerId+"&ccId="+d.contactLinkContainerId+"&view="+d.view+"&uid="+d.ucdmid,{success:$MP.BlockUser_Success,failure:$MP.fail,scope:a},"");b.invoke()};$MP.BlockUser_Success=function(o,scope){var json;try{json=eval("("+o.responseText+")");if(json.success){var otherText="";if(json.otherText!=undefined){otherText=json.otherText+" "}_YDom.get(scope.blockLinkContainerId).innerHTML=otherText+'<a href="'+json.linkUrl+'">'+json.linkText+"</a>";if(json.hideContactLink){_YDom.setStyle(scope.contactLinkContainerId,"display","none")}else{_YDom.setStyle(scope.contactLinkContainerId,"display","block")}$MP.flushProfile(json.blockedId);if(scope.block){$MP.onBlockUser.fire({})}else{$MP.onUnBlockUser.fire({})}}}catch(e){alert(e)}};$MP.Callback_BlockUser={success:$MP.BlockUser_Success,failure:$MP.fail}};