 /* Copyright (c) 2007-2008 Kincafe.com. All rights reservered. Contact info@kincafe.com to purchase rights to this software */
var __gdStartTime;function Person(id,shortName,fullName,lastName,gender,photoUri,email,phone1,phone1Type,phone2,phone2Type,phone3,phone3Type,z_an,bF,bM,bS,bC,father,mother,spouse,childrenOther,childrenWCS){this.id=id;this.z_aq=false;this.shortName=shortName;this.fullName=fullName;this.lastName=lastName;this.gender=gender;this.photoUri=null;if(photoUri!=null&&photoUri!='public/nophoto.gif'){this.photoUri="/r/pr="+this.id+"/it/"+photoUri;}this.email=email;this.phone1=phone1;this.phone1Type=phone1Type;this.phone2=phone2;this.phone2Type=phone2Type;this.phone3=phone3;this.phone3Type=phone3Type;this.bF=bF;this.bM=bM;this.bS=bS;this.bC=bC;this.editAllowed=z_an;this.father=father;this.mother=mother;this.spouse=spouse;this.childrenWCS=childrenWCS;this.childrenOther=childrenOther;if(this.childrenWCS==null){this.childrenWCS=new Array(0);}if(this.childrenOther==null){this.childrenOther=new Array(0);}this.tagid=0;this.x=0;this.y=0;this.linkedTreeDir="";this.z_bt=null;};Person.prototype.setFocus=function(z_ap){this.z_aq=z_ap;};Person.prototype.setFather=function(z_aV,z_as,z_D){this.father=z_aV;z_aV.addChild(this,z_as,z_D);};Person.prototype.setMother=function(z_aV,z_as,z_D){this.mother=z_aV;z_aV.addChild(this,z_as,z_D);};Person.prototype.setSpouse=function(z_aV){this.spouse=z_aV;};Person.prototype.setSiblingsId=function(ar){this.siblings=ar;};Person.prototype.getChild=function(z_ax){if(this.childrenWCS!=null){for(var i=0;i<this.childrenWCS.length;i++){if(this.childrenWCS[i].id==z_ax){return this.childrenWCS[i];break;}}}if(this.childrenOther!=null){for(var i=0;i<this.childrenOther.length;i++){if(this.childrenOther[i].id==z_ax){return this.childrenOther[i];break;}}}return null;};Person.prototype.addChild=function(z_aw,z_as,z_D){var children;if(z_as){if(this.childrenWCS==null){this.childrenWCS=new Array(1);}children=this.childrenWCS;}else{if(this.childrenOther==null){this.childrenOther=new Array(1);}children=this.childrenOther;}var z_aK=-1;for(var i=0;i<children.length;i++){if(children[i].id==z_aw.id){z_aK=i;break;}}if(z_aK==-1){if(z_D<children.length){z_aK=z_D;}else{z_aK=children.length;}children.splice(z_aK,0,z_aw);}else{children[z_aK]=z_aw;}};Person.prototype.getTotalChildrenCount=function(){var z_aC=this.childrenWCS.length+this.childrenOther.length;if(this.spouse!=null){z_aC+=this.spouse.childrenOther.length;}return z_aC;};Person.prototype.removeChild=function(z_ax){if(this.childrenOther!=null){for(var i=0;i<this.childrenOther.length;i++){if(this.childrenOther[i].id==z_ax){this.childrenOther.splice(i,1);return;}}}if(this.childrenWCS!=null){for(var i=0;i<this.childrenWCS.length;i++){if(this.childrenWCS[i].id==z_ax){this.childrenWCS.splice(i,1);return;}}}};Person.prototype.hasSpouse=function(){return(this.spouse!=null);};z_d=function(id,z_E){if(id){this.init(id,z_E);}YAHOO.util.DragDropMgr.clickTimeThresh=1;};z_d.prototype=new YAHOO.util.DD();z_d.prototype.endDrag=function(e){$(gFamTree.ftContainerDivId).className=$(gFamTree.ftContainerDivId).className.substr(0,$(gFamTree.ftContainerDivId).className.length-' ftDragging'.length);var z_aG=$(gFamTree.ftDivId);var z_e=$(gFamTree.z_g);z_aG.style.left=z_aG.offsetLeft+z_e.offsetLeft;z_aG.style.top=z_aG.offsetTop+z_e.offsetTop;z_e.style.left=0;z_e.style.top=0;if(z_aG.offsetLeft+20>=gFamTree.width-gFamTree.z_Z){z_aG.style.left=gFamTree.width*3/4-gFamTree.z_Z;}else if(z_aG.offsetLeft-20<=0-gFamTree.z_X-gFamTree.z_w){z_aG.style.left=gFamTree.width*1/4-gFamTree.z_X-gFamTree.z_w;}if(z_aG.offsetTop+20>=gFamTree.height-gFamTree.z_aa){z_aG.style.top=gFamTree.height*3/4-gFamTree.z_aa;}else if(z_aG.offsetTop-20<=0-gFamTree.z_Y-gFamTree.z_v){z_aG.style.top=gFamTree.height*1/4-gFamTree.z_Y-gFamTree.z_v;}};z_d.prototype.startDrag=function(x,y){hidePopin("famtreeToolbar");gPopinFrame.hide();$(gFamTree.ftContainerDivId).className+=' ftDragging';};var gFamTree;function generateFamTree(id,height,width,root,view,reqGenCount,treeDepth){gFamTree=new FamTree(id,height,width,root,view,reqGenCount,treeDepth);if(root!=null){YAHOO.util.Event.addListener(window,"load",function(){gFamTree.init();});}};function FamTree(id,height,width,root,view,reqGenCount,treeDepth){this.z_v=18;this.z_w=66;this.z_u=2;this.z_x=33;this.z_z=95;this.z_y=160;this.z_A=75;this.z_am=10;this.root=root;this.view=view;this.zoom=1;this.genCount=reqGenCount;this.treeDepth=treeDepth;this.ftContainerDivId=id;this.ftDivId=id+"_ftDiv";this.z_g="ftVP_"+this.ftDivId;this.z_bw=new Object();this.z_bv=new Array();this.tbContactFldType="EMAIL";this.noToolbar=false;document.write('<div id="ftContainer">');document.write('<div id="'+id+'" class="color3 ftContainer" style="position:relative;width:'+width+'px;height:'+height+'px;overflow:hidden">');document.write('<div id="'+this.z_g+'" style="position:absolute;width:'+width+'px;height:'+height+'px;left:0;top:0">');document.write('<div id="'+this.ftDivId+'" style="position:absolute;width:'+width+'px;height:'+height+'px;left:0;top:0">');document.write('</div>');document.write('</div>');document.write('<div id="ftTopBar" class="ftSideBarHoriz" style="top:0;" onmouseover="z_b(this)" onmouseout="z_a(this)"><input type="button" id="ftTopBar_scrollBtn"  class="ftSBHorizBtn" value="^  scroll up" style="width:'+(width-31)+'px;" onclick="z_i(1)"/></div>');document.write('<div id="ftBottomBar" class="ftSideBarHoriz" style="bottom:0px;" onmouseover="z_b(this)" onmouseout="z_a(this)"><input type="button" id="ftBottomBar_scrollBtn" class="ftSBHorizBtn" value="v  scroll down" style="width:'+(width-31)+'px;" onclick="z_i(-1)"/><span id="treeMessageCanvas" class="reducedFont" style="display:none">Mouse over on a name or photo for more options. Drag to reposition the tree</span></div>');document.write('<div id="ftLeftBar" class="ftSideBarVert" style="left:0px;" onmouseover="z_b(this)" onmouseout="z_a(this)"><input type="button" id="ftLeftBar_scrollBtn"  class="ftSBVertBtn" value="<" style="height:'+(height)+'px;" title="scroll" onclick="z_h(1)"/></div>');document.write('<div id="ftRightBar" class="ftSideBarVert" style="right:0px;" onmouseover="z_b(this)" onmouseout="z_a(this)"><input type="button" id="ftRightBar_scrollBtn" class="ftSBVertBtn" value=">" style="height:'+(height)+'px;" title="scroll" onclick="z_h(-1)"/></div>');document.write('<div id="ftResizeHandle"></div>');document.write('</div>');document.write('</div>');new z_d(this.z_g);gPopinWins["famtreeToolbar"]={win:null,props:{fixedcenter:false,constraintoviewport:false,underlay:"none",close:false,visible:true,draggable:false,iframe:false,modal:false}};var ftTBArImgExt="png";if(YAHOO.widget.Module.prototype.browser=='ie'){ftTBArImgExt="gif";}this.toolbarBody="<div class='ftToolbar'><form id='ftTBForm' style='padding:0;margin:0' onsubmit='z_r();return false;' xaction='/e/e_saveEmail.fam'>"+"<table cellpadding='0' cellspacing='0' border='0'><tr><td rowspan='3' class='ftTBP1'></td><td class='ftTBP2'></td><td rowspan='3' class='ftTBP4'></td></tr><tr><td class='ftTBBody'>"+"<span id='ftTBLine1'><span id='ftTBCtxName'></span><span id='ftTBContactFld'></span></span><br>"+"<span id='ftTBLine2'>"+"<img id='ftIcon_treelink' class='ftToolbarBtn' src='/images/icon_treelink.gif' title='View tree' onmousedown='z_o(this)' onmouseclick='' onmouseover='z_q(this)' onmouseout='z_p(this)' onclick='toolbarHandler(\"TREENAV\")'/>"+"<img id='ftIcon_addprsn' class='ftToolbarBtn' src='/images/icon_addprsn.gif' title='Add family members' onmousedown='z_o(this)' onmouseover='z_q(this)' onmouseout='z_p(this)' onclick='toolbarHandler(\"ADDPRSN\")'/>"+"<img id='ftIcon_profile' class='ftToolbarBtn' src='/images/icon_profile.gif' title='Profile' onmousedown='z_o(this)' onmouseover='z_q(this)' onmouseout='z_p(this)' onclick='toolbarHandler(\"PROFILE\")'/>"+"<img id='ftIcon_prphoto' class='ftToolbarBtn' style='display:none' src='/images/icon_photo.jpg' title='Add Photo' onmousedown='z_o(this)' onmouseover='z_q(this)' onmouseout='z_p(this)' onclick='toolbarHandler(\"PRPHOTO\")'/>"+"<img id='ftIcon_email' class='ftToolbarBtn' src='/images/icon_email.gif' title='Send Email' onmousedown='z_o(this)' onmouseover='z_q(this)' onmouseout='z_p(this)' onclick='toolbarHandler(\"EMAIL\")'/>"+"&nbsp;"+"<img id='ftIcon_album' class='ftToolbarBtn' src='/images/icon_album.gif' title='Albums' onmousedown='z_o(this)' onmouseover='z_q(this)' onmouseout='z_p(this)' onclick='toolbarHandler(\"ALBUM\")'/>"+"<img id='ftIcon_blog' class='ftToolbarBtn' src='/images/icon_blog.gif' title='Stories and Blogs' onmousedown='z_o(this)' onmouseover='z_q(this)' onmouseout='z_p(this)' onclick='toolbarHandler(\"BLOG\")'/>"+"</span>"+"</tr><tr><td class='ftTBP3'><img src='/images/ftTBbubbleP3BtLt."+ftTBArImgExt+"'></td></tr></table>"+"</form></div>";this.z_bs=null;this.z_br=null;this.z_bn=new StringBuffer();this.z_af=new Array();this.z_ae=new Array();this.z_Z=10000;this.z_X=0;this.z_aa=10000;this.z_Y=0;this.height=height;this.width=width;this.setRoot=function(root){this.root=root};this.setView=function(view){this.view=view};this.setTreeDepth=function(treeDepth){this.treeDepth=treeDepth};this.zetZoom=function(zoom){this.zoom=zoom};this.clearTree=function(){this.clearData();};this.clearData=function(){var z_aH=$(this.ftDivId);z_aH.style.left="0";z_aH.style.top="0";z_aH.innerHTML="";this.z_af=new Array();this.z_ae=new Array();this.z_Z=10000;this.z_X=0;this.z_aa=10000;this.z_Y=0;};this.z_L=function(){__gdStartTime=(new Date()).getTime();this.z_bv=new Array();var z_aG=$(this.ftDivId);this.z_bn=new StringBuffer();if(this.view=='ASCENDING'){var z_al=z_aG.offsetHeight-15-(this.z_A-10)-this.z_v;this.z_I(this.root,($(this.ftContainerDivId).offsetWidth-this.z_w)/2,z_al,200,this.treeDepth-1);}else if(this.view=='FAMILY'){this.z_bp(this.root,($(this.ftContainerDivId).offsetWidth-this.z_w)/2,30,this.z_y,"UP");}else{this.z_K(this.root,($(this.ftContainerDivId).offsetWidth-this.z_w)/2,30,this.z_y,"UP");}debug("z_L "+((new Date()).getTime()-__gdStartTime)+"ms\n-------------------------------\n");z_aG.innerHTML+=this.z_bn.toString();this.z_bn=new StringBuffer();this.autoToolbar();};this.autoToolbar=function(){if(($('famTreeDiv')!=null&&$('famTreeDiv').style.visibility!='visible')||(this.noToolbar)){return;}var z_ad=1;var z_B=false;if(this.root.id==userPr){z_B=true;}if(z_ad<=2&&this.root.bF){z_ad++;if(this.root.father!=null&&this.root.father.id==userPr){z_B=true;}}if(z_ad<=2&&this.root.bM){z_ad++;if(this.root.mother!=null&&this.root.mother.id==userPr){z_B=true;}}if(z_ad<=2&&this.root.bS){z_ad++;if(this.root.spouse!=null&&this.root.spouse.id==userPr){z_B=true;}}if(z_ad<=2&&this.root.bC){z_ad+=this.root.childrenWCS.length;if(this.root.childrenWCS!=null&&this.root.childrenWCS.length>0&&this.root.childrenWCS[0].id==userPr){z_B=true;}z_ad+=this.root.childrenOther.length;if(this.root.childrenOther!=null&&this.root.childrenOther.length>0&&this.root.childrenOther[0].id==userPr){z_B=true;}}if(z_ad<=2&&z_B){famTreeShowToolbar(this.root.id,this.root.tagid);}};this.zoomTree=function(z_bi){document.getElementById(this.ftDivId).style.zoom=z_bi;this.zoom=z_bi;};this.changeContactField=function(z_aR){if(z_aR!=this.tbContactFldType){hidePopin("famtreeToolbar");var z_av=$('ftTBContactFldBtns');if(z_av!=null&&z_av.style.display!="none"){z_av.style.display='none';}for(var i=0;i<this.z_bv.length;i++){this.z_bv[i].z_bt=null;}this.tbContactFldType=z_aR;}};this.z_I=function(z_bb,x,y,sprd,level){this.z_J(z_bb,x,y,"UP");if(level>0){var wP=Math.pow(2,level-1)*(60+10);var z_ai=x-(wP/2);var z_aj=x+(wP/2);var z_T=x+this.z_x;var z_U=x+this.z_x;if(z_bb.father!=null){this.z_I(z_bb.father,z_ai,y-(this.z_z+this.z_v),sprd,level-1);z_T=z_ai+this.z_x;this.z_bn.append(this.z_Q(z_ai+this.z_x,y-this.z_z,2,this.z_A));}if(z_bb.mother!=null&&z_bb.mother.gender!='INACTIVE'){this.z_I(z_bb.mother,z_aj,y-(this.z_z+this.z_v),sprd,level-1);z_U=z_aj+this.z_x+2;this.z_bn.append(this.z_Q(z_aj+this.z_x,y-this.z_z,2,this.z_A));}if(z_bb.father!=null||(z_bb.mother!=null&&z_bb.mother.gender!='INACTIVE')){this.z_bn.append(this.z_Q(x+this.z_x,y-(this.z_z-this.z_A),2,(this.z_z-this.z_A)));this.z_bn.append(this.z_M(z_T,y-(this.z_z-this.z_A),z_U-z_T,2));}}};this.z_bp=function(z_bb,x,y,sprd,level){if(z_bb.father!=null&&z_bb.mother!=null){var siblings=new Array();for(var i=0;i<z_bb.siblings.length;i++){var z_aW;if(z_bb.siblings[i]==z_bb.id){z_aW=z_bb;}else{z_aW=z_bb.father.getChild(z_bb.siblings[i]);if(z_aW==null){z_aW=z_bb.mother.getChild(z_bb.siblings[i]);}}if(z_aW!=null){siblings.push(z_aW);z_bb.father.removeChild(z_bb.siblings[i]);z_bb.mother.removeChild(z_bb.siblings[i]);}}if(z_bb.father.spouse!=null){z_bb.father.spouse.setSpouse(z_bb.father);if((z_bb.father.spouse.childrenWCS==null||z_bb.father.spouse.childrenWCS.length==0)&&z_bb.father.childrenWCS!=null){z_bb.father.spouse.childrenWCS=z_bb.father.childrenWCS;}this.z_K(z_bb.father.spouse,x,y,sprd,"UP");}else{this.z_K(z_bb.father,x,y,sprd,"UP");}var z_ak=y+this.z_v+this.z_z;var z_ah=z_bb.father.x+sprd/4-(((siblings.length-1)/2)*sprd/2);var z_bd;var z_be;for(var i=0;i<siblings.length;i++){z_ah=this.z_O(z_ak,z_ah,sprd);if(siblings[i].getTotalChildrenCount()>0){var z_aU=this.z_O(z_ak+this.z_v+this.z_z,z_ah,sprd);if(z_ah!=z_aU){z_ah=z_aU+((siblings[i].getTotalChildrenCount()-1)*(sprd/2))/2;}}this.z_K(siblings[i],z_ah,z_ak,sprd,"DOWN");z_be=z_ah;if(i==0){z_bd=z_ah;}this.z_bn.append(this.z_Q(z_be+this.z_x,y+this.z_v+this.z_A+5,2,z_ak-(y+this.z_v+this.z_A-5)));if(siblings[i].hasSpouse()){z_ah+=sprd;}else{z_ah+=(sprd/2);}}z_ah=(z_be+z_bd)/2+(z_bb.mother.getTotalChildrenCount()*sprd/4);this.z_K(z_bb.mother,this.z_O(y,z_ah,sprd),y,sprd,"UP");this.z_bn.append(this.z_M(z_bd+this.z_x,y+this.z_v+this.z_A+5,z_be-z_bd,2));this.z_bn.append(this.z_Q(z_bb.father.x+this.z_w-10,y+this.z_v,2,this.z_A-12));this.z_bn.append(this.z_Q(z_bb.mother.x+10,y+this.z_v,2,this.z_A-12));this.z_bn.append(this.z_M(z_bb.father.x+this.z_w-10,y+this.z_v+this.z_A-12,z_bb.mother.x+10-(z_bb.father.x+this.z_w-10)+1,2));var z_ay=Math.max(z_bd+this.z_x,z_bb.father.x+this.z_w-10);var z_az=Math.min(z_be+this.z_x,z_bb.mother.x+10);if(z_ay<=z_az){this.z_bn.append(this.z_Q((z_ay+z_az)/2,y+this.z_v+this.z_A-12,2,20));}else{var z_W=((z_bd+this.z_x<(z_bb.father.x+this.z_w+z_bb.mother.x)/2)?((z_bb.father.x+this.z_w+z_bb.mother.x)/2):(z_bb.mother.x+10));this.z_bn.append(this.z_Q(z_W,y+this.z_v+this.z_A-12,2,20));if(z_bb.mother.x+10<z_bd+this.z_x){this.z_bn.append(this.z_M(z_bb.mother.x+10,y+this.z_v+this.z_A+5,z_bd+this.z_x-(z_bb.mother.x+10)+2,2));}else{this.z_bn.append(this.z_M(z_bd+this.z_x,y+this.z_v+this.z_A+5,(z_W)-(z_bd+this.z_x)+2,2));}}}else if(z_bb.father!=null){z_bb.father.addChild(z_bb,z_bb.bM?true:false);this.z_K(z_bb.father,x,y,sprd,level);}else if(z_bb.mother!=null){z_bb.mother.addChild(z_bb,false);this.z_K(z_bb.mother,x,y,sprd,level);}else{this.z_K(z_bb,x,y,sprd,level);}this.z_C(z_bb);if(this.z_Y<this.height/2){var z_aG=$(this.ftDivId);z_aG.style.top=20;}};this.z_C=function(z_bb){if(z_bb.x>=this.width){var z_aG=$(this.ftDivId);z_aG.style.left=this.width-z_bb.x-(this.width/4);}else if(z_bb.x<0){var z_aG=$(this.ftDivId);z_aG.style.left=(this.width/8)-z_bb.x;}else{var z_bk=Math.max(this.z_Z,0);var z_bj=Math.min(this.z_X+this.z_w,this.width);var z_aG=$(this.ftDivId);z_aG.style.left=-1*(z_bk-(this.width-z_bj))/2;}};this.z_K=function(z_bb,x,y,sprd,linkedTreeDir){this.z_J(z_bb,x,y,linkedTreeDir);if(z_bb.hasSpouse()){this.z_J(z_bb.spouse,x+this.z_w+4,y,"UP");this.z_bn.append(this.z_M((x+this.z_w),y+(this.z_v/2)-2,4,4));}if(z_bb.getTotalChildrenCount()>0){var z_ah=0;var z_ak=y+this.z_v+this.z_z;if(z_bb.getTotalChildrenCount()==1){z_ah=x;}else{var z_bh=z_bb.getTotalChildrenCount()+this.getChildSpouseCount(z_bb);z_ah=x-(((z_bh-1)/2)*sprd/2);}if(z_bb.childrenWCS.length>0){z_ah+=this.z_x+2;}z_ah=this.z_O(z_ak,z_ah,sprd);var z_T=z_ah+this.z_x;var z_U=z_ah+this.z_x;var i=0;var z_aD;var z_ao=true;var z_V;while(i<z_bb.getTotalChildrenCount()){if(i==z_bb.childrenOther.length&&z_bb.childrenOther.length!=0){var z_bl=x+this.z_x;if(z_bb.childrenWCS.length>0){z_bl-=this.z_x/3-2;}this.z_bo(z_bb,false,z_bl,z_T,z_U,y,z_T>z_bl?10:0);z_ao=true;}else if(i==z_bb.childrenOther.length+z_bb.childrenWCS.length&&z_bb.childrenWCS.length!=0){var z_bm=0;if(z_T<x+this.z_x||z_U>x+this.z_w+4+this.z_x){z_bm=5;}this.z_bo(z_bb,true,x+this.z_w+2,z_T,z_U,y,z_bm);z_ao=true;}z_V="DOWN";if(i<z_bb.childrenOther.length){z_aD=z_bb.childrenOther[i];if(this.view=='FAMILY'&&((z_bb.gender=='Male'&&z_aD.bM)||(z_bb.gender=='Female'&&z_aD.bF))){z_V="UP";}}else if(i<z_bb.childrenOther.length+z_bb.childrenWCS.length){z_aD=z_bb.childrenWCS[i-z_bb.childrenOther.length];}else{z_aD=z_bb.spouse.childrenOther[i-z_bb.childrenOther.length-z_bb.childrenWCS.length];if(this.view=='FAMILY'&&((z_bb.gender=='Male'&&z_aD.bF)||(z_bb.gender=='Female'&&z_aD.bM))){z_V="UP";}}if(z_aD.getTotalChildrenCount()>0){var z_aU=this.z_O(z_ak+this.z_v+this.z_z,z_ah,sprd);if(z_ah!=z_aU){z_ah=z_aU+((z_aD.getTotalChildrenCount()-1)*(sprd/2))/2;}}z_U=z_ah+this.z_x;this.z_bn.append(this.z_Q(z_U,y+this.z_v+this.z_A,2,z_ak-(y+this.z_v+this.z_A)));if(z_ao){z_T=z_ah+this.z_x;}this.z_K(z_aD,z_ah,z_ak,sprd,z_V);if(z_aD.hasSpouse()){z_ah=z_ah+sprd;}else{z_ah=z_ah+sprd/2;}z_ao=false;i++;}if(z_bb.spouse!=null&&z_bb.spouse.childrenOther.length>0){var z_bl=x+this.z_w+4+this.z_x;if(z_bb.childrenWCS.length>0){z_bl+=(this.z_x/3)-2;}this.z_bo(z_bb,false,z_bl,z_T,z_U,y,0);}else if(z_bb.childrenWCS.length>0){var z_bm=0;if(z_T<x+this.z_x||z_U>x+this.z_w+4+this.z_x){z_bm=5;}this.z_bo(z_bb,true,x+this.z_w+2,z_T,z_U,y,z_bm);}else{this.z_bo(z_bb,false,x+this.z_x,z_T,z_U,y,z_T>x+this.z_x?10:0);}}};this.z_J=function(z_bu,left,top,linkedTreeDir){if(z_bu.gender=='INACTIVE'){return;}this.z_bw[z_bu.id]=z_bu;this.z_bv.push(z_bu);this.z_ac(top,left);z_bu.x=left;z_bu.y=top;z_bu.tagid=this.z_N();this.z_bn.append("<label id='"+z_bu.tagid+"' UNSELECTABLE='on' class='ftLabel"+" ftLabel"+z_bu.gender+(z_bu.z_aq?"Focus":"")+"' style='position:absolute;overflow=hidden;z-index:2;text-align:center;left:"+left+"px;top:"+top+"px;width:"+(this.z_w-this.z_u)+"px;height:"+(this.z_v-this.z_u)+"px;' unselectable='true' oncontextmenu='hidePopin(\"famtreeToolbar\");if (event.preventDefault) event.preventDefault();gPopinFrame.show(\"/dlg/ProfileSummary.fam?pr="+z_bu.id+"\", ("+left+" * gFamTree.zoom), ("+(top+this.z_v)+" * gFamTree.zoom), 200, 375);return false;' ondblclick='javascript:toolbarHandler(\"PROFILE\", "+z_bu.id+")' onmouseover='famTreeDispMessage(true, \""+z_bu.id+"\", \""+z_bu.tagid+"\");' onmouseout='famTreeDispMessage(false)' >"+z_bu.shortName+"</label>");var z_aM=z_bu.photoUri;if(z_bu.photoUri==null){z_aM="/images/spacer.gif";}var z_R=this.z_N();var z_aN="photo_"+z_bu.tagid;this.z_bn.append("<div id='"+z_R+"' style=text-align:center;position:absolute;z-index:2;left:"+left+"px;top:"+(top+this.z_v)+"px;width:"+this.z_w+"px;height:"+(this.z_A-15)+"px;overflow:hidden;border:0.02cm groove black'><img id='"+z_aN+"' width='"+this.z_w+"' src='"+z_aM+"' oncontextmenu='hidePopin(\"famtreeToolbar\");if (event.preventDefault) event.preventDefault();gPopinFrame.show(\"/dlg/ProfileSummary.fam?pr="+z_bu.id+"\", "+0+", "+0+", 200, 375);return false;' ondblclick='javascript:toolbarHandler(\"PROFILE\", "+z_bu.id+")' onmouseover='famTreeDispMessage(true, \""+z_bu.id+"\", \""+z_bu.tagid+"\");' onmouseout='famTreeDispMessage(false)'></div>");if(linkedTreeDir=="DOWN"){if(z_bu.bC&&z_bu.getTotalChildrenCount()==0){this.z_bn.append("<img class='ftTreeLink' style='position:absolute;z-index:2;left:"+(left+(this.z_w/2)-20)+"px;top:"+(top-15)+"px;' src='/images/treelink.gif' onclick='famTreeChangeFocusPerson(\""+z_bu.id+"\", \""+linkedTreeDir+"\")'>");z_bu.linkedTreeDir="DOWN";}}else if(linkedTreeDir=="UP"){if((z_bu.bF&&z_bu.father==null)||(z_bu.bM&&z_bu.mother==null)){this.z_bn.append("<img class='ftTreeLink' style='position:absolute;z-index:2;left:"+(left+(this.z_w/2)-20)+"px;top:"+(top-15)+"px;' src='/images/treelink.gif' onclick='famTreeChangeFocusPerson(\""+z_bu.id+"\", \""+linkedTreeDir+"\")'>");z_bu.linkedTreeDir="UP";}}};this.z_bo=function(z_aO,z_as,z_aY,z_T,z_U,z_ba,z_bm){var z_bf=this.z_am-z_bm;this.z_bn.append(this.z_M(z_T,z_ba+this.z_v+this.z_A,z_U-z_T,2));if(z_aO.gender=='INACTIVE'){return;}var z_bg=z_ba+this.z_v;var z_aZ=10;if(z_as){if(z_aO.photoUri==null&&(z_aO.spouse==null||z_aO.spouse.photoUri==null)){z_bg+=5;}else{z_bg+=this.z_A-12;z_aZ=z_bg-(z_ba+this.z_v);}this.z_bn.append(this.z_M(z_aY-(this.z_x),z_bg,(2*this.z_x)+1,2));this.z_bn.append(this.z_Q(z_aY-(this.z_x),z_bg-z_aZ,2,z_aZ));this.z_bn.append(this.z_Q(z_aY+(this.z_x),z_bg-z_aZ,2,z_aZ));}if(z_aY>=z_T&&z_aY<=z_U){this.z_bn.append(this.z_Q(z_aY,z_bg,2,this.z_A-(z_bg-(z_ba+this.z_v))));}else{this.z_bn.append(this.z_Q(z_aY,z_bg,2,this.z_A-z_bf-(z_bg-(z_ba+this.z_v))));var z_aQ=(z_T+z_U)/2;if(z_aQ<z_aY){this.z_bn.append(this.z_M(z_aQ,z_ba+this.z_v+this.z_A-z_bf,z_aY-z_aQ+2,2));}else{this.z_bn.append(this.z_M(z_aY,z_ba+this.z_v+this.z_A-z_bf,z_aQ-z_aY,2));}this.z_bn.append(this.z_Q((z_T+z_U)/2,z_ba+this.z_v+(this.z_A-z_bf),2,z_bf));}};this.z_M=function(x,y,w,h){if(YAHOO.widget.Module.prototype.browser=='gecko'){w=w+1;}return "<HR id='"+this.z_N()+"' style='position:absolute;margin:0;left:"+x+"px;width:"+w+"px;top:"+y+"px;z-index=0' size="+h+" color=#D1D1D1>";};this.z_Q=function(x,y,w,h){return "<div id='"+this.z_N()+"' style='position:absolute;border: 1px solid #D1D1D1;left:"+x+"px;top:"+y+"px;width:"+(w-2)+"px;height:"+(h-2)+"px;background-color:#D1D1D1;z-index:0;overflow:hidden'></div>";};this.z_ac=function(y,x){if(x<this.z_Z){this.z_Z=x;}if(x>this.z_X){this.z_X=x;}if(y<this.z_aa){this.z_aa=y;}else if(y>this.z_Y){this.z_Y=y;}for(var i=0;i<this.z_af.length;i++){if(this.z_af[i]==y){if(this.z_ae[i]<x){this.z_ae[i]=x;}return;}}this.z_af.push(y);this.z_ae.push(x);};this.z_O=function(y,x,sprd){for(var i=0;i<this.z_af.length;i++){if(this.z_af[i]==y){if(x<=this.z_ae[i]+this.z_w+1){x=this.z_ae[i]+sprd/2+10;}}}return x;};this.getChildSpouseCount=function(z_bb){var z_aC=0;z_aC+=this.z_P(z_bb.childrenWCS);z_aC+=this.z_P(z_bb.childrenOther);if(z_bb.spouse!=null){z_aC+=this.z_P(z_bb.spouse.childrenOther);}return z_aC;};this.z_P=function(z_aP){var z_aC=0;for(var i=0;i<z_aP.length;i++){if(z_aP[i].hasSpouse()){z_aC++;}}return z_aC;};this.z_N=function(){return utils_getUniqueId();};this.init=function(){this.z_L();};this.resetSize=function(z_c,z_f){this.width=z_f;this.height=z_c;$("ftTopBar_scrollBtn").style.width=""+this.width+"px";$("ftBottomBar_scrollBtn").style.width=""+this.width+"px";$("ftRightBar_scrollBtn").style.height=""+this.height+"px";$("ftLeftBar_scrollBtn").style.height=""+this.height+"px";}};function z_i(direction){var z_aG=$(gFamTree.ftDivId);var z_aT=z_aG.offsetTop+(direction*gFamTree.height/4);if(z_aT<=((gFamTree.height/2)-gFamTree.z_Y-gFamTree.z_v)){z_aT=(gFamTree.height/2)-gFamTree.z_Y-gFamTree.z_v;}if(z_aT>=((gFamTree.height/2)-gFamTree.z_aa)){z_aT=(gFamTree.height/2)-gFamTree.z_aa;}z_aG.style.top=z_aT;};function z_h(direction){var z_aG=$(gFamTree.ftDivId);var z_aS=z_aG.offsetLeft+(direction*gFamTree.width/4);if(z_aS<=((gFamTree.width/2)-gFamTree.z_X-gFamTree.z_w)){z_aS=(gFamTree.width/2)-gFamTree.z_X-gFamTree.z_w;}if(z_aS>=((gFamTree.width/2)-gFamTree.z_Z)){z_aS=(gFamTree.width/2)-gFamTree.z_Z;}z_aG.style.left=z_aS;};function famTreeChangeGenCount(newGenCount){if(gFamTree.genCount!=newGenCount){gFamTree.genCount=newGenCount;famTreeChangeView(gFamTree.root.id,gFamTree.view);}};function famTreeChangeView(id,view,z_ag){hidePopin("famtreeToolbar");var url="/ajaxtree.fam?pr="+id+"&vw="+view+"&gen="+gFamTree.genCount;url+="&dummy="+(new Date()).getTime();var opt={onSuccess:function(t){var z_aE=(new Date()).getTime();debug("Data Recieved in "+(z_aE-__gdStartTime)+"mS");gFamTree.clearTree();eval(t.responseText);gFamTree.setRoot(root);gFamTree.setView(view);gFamTree.setTreeDepth(view=='ASCENDING'?treeDepth:1);gFamTree.z_L();if(z_ag){var z_ab=gFamTree.z_bw[z_ag];if(z_ab!=null){gFamTree.z_C(z_ab);}}var viewSelect=$("viewSelect");if(viewSelect!=null){viewChangeNotif(viewSelect,view);}hidePopin("famtreeToolbar");},onFailure:function(t){alert('An error occured. Please try again later.  '+t.status+' -- '+t.statusText);}};__gdStartTime=(new Date()).getTime();new Ajax.Request(url,opt);};function famTreeChangeFocusPerson(id,z_V){var view;if(/DESCENDING$/.test(gFamTree.view)&&z_V=="UP"){view="PARENT_DESCENDING";}else{view=gFamTree.view;}famTreeChangeView(id,view,id);};function toolbarHandler(z_au,z_aA){var targetNodeId;if(z_aA){targetNodeId=z_aA;}else{targetNodeId=gFamTree.z_bs;}z_aB=gFamTree.z_bw[targetNodeId];hidePopin("famtreeToolbar");if(z_au=="TREENAV"){famTreeChangeFocusPerson(z_aB.id,z_aB.linkedTreeDir);}else if(z_au=="ADDPRSN"){var addPrsnURL="/dlg/AddProfile.fam?m=n&case=pr&reltopr="+z_aB.id+"&lname="+z_aB.lastName;showModalPopin("addProfileDlg",425,315,gFamTree.z_br,"Add a relative of "+z_aB.fullName,addPrsnURL);}else if(z_au=="PROFILE"){document.location.href="/profile.fam?pr="+z_aB.id+"&profileSrcUrl=/tree.fam%3Fvw%3D"+gFamTree.view+"%26pr%3D"+gFamTree.root.id;}else if(z_au=="PRPHOTO"){var url="/dlg/PhotoSelection.fam?doSubmit=profile&pr="+z_aB.id;showModalPopin("selPhoto",425,300,gFamTree.z_br,"Select a photo of "+z_aB.fullName,url);}else if(z_au=="EMAIL"){document.location.href="/e/sendemail.fam?pr="+z_aB.id;}else if(z_au=="ALBUM"){document.location.href="/persbooklist.fam?pr="+z_aB.id+"&ct=ALBUM";}else if(z_au=="BLOG"){document.location.href="/persbloglist.fam?pr="+z_aB.id+"&ct=BLOG";}else if(z_au=="INVITE"){document.location.href="/e/sendinvite.fam?m=n&pr="+z_aB.id+"&suggest=true";}};function famTreeDispMessage(z_ar,z_aA,z_br){if(z_ar){$("treeMessageCanvas").style.display="inline";famTreeShowToolbar(z_aA,z_br);}else{$("treeMessageCanvas").style.display="none";}};var z_aJ="enter email";function famTreeShowToolbar(z_aA,z_br){z_s();gFamTree.z_bs=z_aA;gFamTree.z_br=z_br;var z_aB=gFamTree.z_bw[z_aA];var width=204;var ICON_WIDTH=21;if(userPr==''){width-=(2*ICON_WIDTH);}else if(userPr==z_aA){width-=ICON_WIDTH;}if(z_aB.linkedTreeDir==""){width-=ICON_WIDTH;}showCustomPopin("famtreeToolbar",gFamTree.toolbarBody,{x:(getPageOffsetLeft($(z_br))-28)*gFamTree.zoom,y:(getPageOffsetTop($(z_br))-73)*gFamTree.zoom});$("ftTBCtxName").innerHTML=z_aB.fullName;if(z_aB.linkedTreeDir=="" && z_aB.z_aq){$("ftIcon_treelink").style.display="none";}else{$("ftIcon_treelink").style.display="";}if(z_aB.editAllowed&&(z_aB.photoUri==null||z_aB.photoUri==''||z_aB.photoUri=='public/nophoto.gif')){$("ftIcon_prphoto").style.display="";}else{$("ftIcon_prphoto").style.display="none";}if(userPr==''){$("ftIcon_addprsn").style.display="none";$("ftIcon_email").style.display="none";}else{$("ftIcon_addprsn").style.display="";if(userPr==z_aA){$("ftIcon_email").style.display="none";}else{$("ftIcon_email").style.display="";}}var z_bq="";var z_bi=z_k(z_aB);if(z_aB.editAllowed){var z_aF;if(z_bi!=null&&z_bi.length>0){z_aF=z_bi;}else{z_aF=z_j();}if(z_aB.z_bt!=null){z_aF=z_aB.z_bt;}var z_bq="<span id='ftTBContactFldSel'><input type='text' id='ftTBContactFldFld' class='ftTBContactFldFld' size='15' maxsize='100' value='"+z_aF+"'"+"       onkeyup='z_m()' onchange='z_m()' onpaste='z_m()'"+"       oncut='z_m()' onfocus='z_n()'/>"+"<span id='ftTBContactFldSelCtl'>&nbsp;<img src='/images/down.gif'/>&nbsp;</span></span>"+"<span id='ftTBContactFldBtns' style='display:none'><br>"+"<span id='ftTBInvSpan' "+(gFamTree.tbContactFldType!="EMAIL"||userPr==z_aA?" style='visibility:hidden'":"")+">"+"<input type='checkbox' id='ftTBsendInviteCbx' value='false'/> Invite</span>"+"<input type='image' id='ftTBSaveBtn' style='margin-top:5px;margin-left:15px;' src='/images/saveSm.jpg'/>"+"<img style='margin-top:5px;margin-left:15px;cursor:pointer;' src='/images/cancelSm.jpg' onclick='z_l()'/></span>";$("ftTBContactFld").innerHTML=z_bq;z_m();new Dropdown("ftTBContactFldSel",[{text:"Email",value:"EMAIL"},{text:"Mobile",value:"MOBILE"},{text:"Home Phone",value:"HOME"},{text:"Work Phone",value:"WORK"}],0,null,z_t,'famtreeToolbar',true,'ftTBContactFldSelCtl');}else{var z_bq="<input type='text' READONLY id='ftTBContactFldFld' class='ftTBContactFldFld' style='border:0;' size='15' value='"+(z_bi!=null?z_bi:"")+"'/>";$("ftTBContactFld").innerHTML=z_bq;}};function z_k(z_bu){if(gFamTree.tbContactFldType=="EMAIL"){return z_bu.email;}else if(gFamTree.tbContactFldType==z_bu.phone1Type){return z_bu.phone1;}else if(gFamTree.tbContactFldType==z_bu.phone2Type){return z_bu.phone2;}else if(gFamTree.tbContactFldType==z_bu.phone3Type){return z_bu.phone3;}else{return null;}};function z_j(){var msg="enter "+gFamTree.tbContactFldType.toLowerCase();if(gFamTree.tbContactFldType!="EMAIL"){msg+=" number";}return msg;};function z_m(){var newValue=$F("ftTBContactFldFld");var z_aB=gFamTree.z_bw[gFamTree.z_bs];if(newValue!=z_k(z_aB)&&newValue!=z_j()){$('ftTBContactFldBtns').style.display="inline";$('ftTBLine2').style.display="none";if(gFamTree.tbContactFldType=="EMAIL"&&(z_aB.email==null||z_aB.email=="")&&$('ftTBInvSpan').style.visibility!='hidden'){$('ftTBsendInviteCbx').checked=true;}}};function z_s(){var z_av=$('ftTBContactFldBtns');if(z_av!=null&&z_av.style.display!="none"){var z_aB=gFamTree.z_bw[gFamTree.z_bs];z_aB.z_bt=$F("ftTBContactFldFld");}};function z_r(){var newValue=$F("ftTBContactFldFld");var z_aB=gFamTree.z_bw[gFamTree.z_bs];if(newValue!=z_k(z_aB)&&newValue!=z_j()){z_aB.z_bt=newValue;var url="/e/e_saveContactInfo.fam?m=e&pr="+z_aB.id+"&contactType="+gFamTree.tbContactFldType+"&contact="+encodeURIComponent(newValue)+"&_actionId="+(new Date()).getTime();if($('ftTBsendInviteCbx').checked){url+="&sendInvite=true";}var opt={onSuccess:function(t){debug("Data Recieved in "+((new Date()).getTime()-__gdStartTime)+"mS");var z_bc=t.responseText.replace(/\s/g,"");if(z_bc.indexOf("OK-")==0){var z_aI=z_bc.substr(3);z_aB[z_aI]=z_aB.z_bt;if(z_aI!='email'){z_aB[z_aI+"type"]=gFamTree.tbContactFldType;}z_aB.z_bt=null;$('ftTBContactFldBtns').style.display="none";$('ftTBLine2').style.display="inline";}else{alert(t.responseText);}},onFailure:function(t){alert('An error occured. Please try again later.  \nSystem Message:\n'+t.status+' -- '+t.statusText);}};__gdStartTime=(new Date()).getTime();new Ajax.Request(url,opt);}};function z_l(){var z_aB=gFamTree.z_bw[gFamTree.z_bs];z_aB.z_bt=null;var z_aX=z_k(z_aB);$("ftTBContactFldFld").value=((z_aX!=null&&z_aX!="")?z_aX:z_j());$('ftTBContactFldBtns').style.display="none";$('ftTBLine2').style.display="inline";};function z_n(){if($F("ftTBContactFldFld")==z_j()){$("ftTBContactFldFld").value="";}};function z_b(z_at){$(z_at.id+"_scrollBtn").style.display='block';gFamTree.autoToolbar();};function z_a(z_at){$(z_at.id+"_scrollBtn").style.display='none';};function z_q(z_au){z_au.style.padding='2px';z_au.style.border='2px outset';};function z_p(z_au){z_au.style.padding='';z_au.style.borderWidth='';};function z_o(z_au){z_au.style.border='2px inset';};function intrerfaceFamTreeChangeView(id,view){var webpage=document.location.pathname;if(/\/tree.fam$/.test(document.location.pathname)){gPopinFrame.hide();famTreeChangeView(id,view,id);}else{document.location.href="/tree.fam?pr="+id+"&vw="+view;}};function z_t(selIdex,contFld){if(contFld!=""){gFamTree.changeContactField(contFld);}famTreeShowToolbar(gFamTree.z_bs,gFamTree.z_br);};function callbackSelect(dlg,rel,z_aK,id,fullName,shortName,photo,relToOprId){hidePopin("addProfileDlg");if(rel=='FATHER'||rel=='MOTHER'){if(gFamTree.view=="ASCENDING"){famTreeChangeView(gFamTree.root.id,"ASCENDING",id);}else{famTreeChangeView(id,"FAMILY",id);}}else{if(gFamTree.view=="ASCENDING"&&root.id==relToOprId){famTreeChangeView(relToOprId,"FAMILY",id);}else{famTreeChangeView(gFamTree.root.id,gFamTree.view,id);}}if(ftAddPersonListener){ftAddPersonListener(id);}};function callbackSelectPhoto(dlg,photo){var z_aB=gFamTree.z_bw[gFamTree.z_bs];z_aB.photoUri="/r/pr="+z_aB.id+"/it/"+photo;var z_aN="photo_"+z_aB.tagid;$(z_aN).src=z_aB.photoUri;hidePopin("selPhoto");} 
