$D=YAHOO.util.Dom;$=$D.get;if(document.implementation.hasFeature("XPath","3.0")){if(typeof XMLDocument=="undefined"){XMLDocument=Document}XMLDocument.prototype.selectNodes=function(d,e){if(!e){e=this}var b=this.createNSResolver(this.documentElement);var a=this.evaluate(d,e,b,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var f=[];for(var c=0;c<a.snapshotLength;c++){f[c]=a.snapshotItem(c)}return f};XMLDocument.prototype.selectSingleNode=function(b,c){if(!c){c=this}var a=this.selectNodes(b,c);if(a.length>0){return a[0]}else{return null}};Element.prototype.selectNodes=function(a){if(this.ownerDocument.selectNodes){return this.ownerDocument.selectNodes(a,this)}else{throw"For XML Elements Only"}};Element.prototype.selectSingleNode=function(a){if(this.ownerDocument.selectSingleNode){return this.ownerDocument.selectSingleNode(a,this)}else{throw"For XML Elements Only"}}}if(typeof TGN=="undefined"){var TGN={};TGN.Search={};TGN.SearchWidget={};TGN.Search.BrowseDate={}}if(typeof TGN.SearchWidget=="undefined"){TGN.SearchWidget={}}if(typeof TGN.Search=="undefined"){TGN.Search={};TGN.Search.BrowseDate={}}if(typeof TGN.Search.BrowseDate=="undefined"){TGN.Search.BrowseDate={}}if(typeof TGN.Ancestry=="undefined"){TGN.Ancestry={}}if(typeof TGN.Ancestry.Search=="undefined"){TGN.Ancestry.Search={}}if(typeof dbid=="undefined"&&typeof TGN.SResults!="undefined"){if(typeof TGN.SResults.Browse!="undefined"){if(typeof TGN.SResults.Browse.dbid!="undefined"){dbid=TGN.SResults.Browse.dbid}}}if(typeof TGN.I18N=="undefined"){TGN.I18N={}}TGN.I18N.getTrans=function(a){if(TGN.I18N[a]===null||TGN.I18N[a]=="undefined"){return"$"+a}else{return TGN.I18N[a]}};TGN.SearchWidget.AddString=function(a,b){TGN.I18N[a]=b};TGN.SearchWidget.NameChanged=0;TGN.SearchWidget.TreeLoadingPanel=null;TGN.SearchWidget.PersonACHandles={};TGN.SearchWidget.PersonAutoComplete=function(CtrlName,lNameContainer,formFieldArray,guid,cache,tid,tName){this.NameTextBox=CtrlName;this.NameContainer=lNameContainer;var aCDS=new YAHOO.widget.DS_XHR("AjaxBaseHandler.ashx",["ResultSet.Result","Name","YearRange","tid","pid"]);aCDS.scriptQueryAppend="a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PersonAutoComplete|DoCallback&guid="+guid+"&tid="+tid;aCDS.responseType=YAHOO.widget.DS_XHR.TYPE_JSON;aCDS.connTimeout=4000;aCDS.queryMatchSubset=true;this.YUI_AC=new YAHOO.widget.AutoComplete(this.NameTextBox,this.NameContainer,aCDS);this.YUI_AC.animVert=false;this.YUI_AC.minQueryLength=3;this.YUI_AC.maxResultsDisplayed=12;this.YUI_AC.queryDelay=0.5;this.YUI_AC.useShadow=true;this.YUI_AC.useIFrame=true;this.YUI_AC.autoHighlight=false;this.setTid=function(newTid){this.YUI_AC.dataSource.scriptQueryAppend="a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PersonAutoComplete|DoCallback&guid="+guid+"&tid="+newTid;this.YUI_AC.dataSource.flushCache();var nTB=$(this.NameTextBox);if(nTB!=null){this.YUI_AC.sendQuery(nTB.value);nTB.focus()}};this.fnFormatter=function(ResultSet,query){var returnV="<div class='treeName'>";returnV+=ResultSet[0]+"</div><div class='treeYears'>"+ResultSet[1]+"</div>";return returnV};this.YUI_AC.formatResult=this.fnFormatter;var PopulateForm={success:function(o){if(TGN.SearchWidget.TreeLoadingPanel!=null){TGN.SearchWidget.TreeLoadingPanel.destroy();TGN.SearchWidget.TreeLoadingPanel=null}if(TGN.SM.TreeLoadingFader!=null){TGN.SM.TreeLoadingFader.stop()}var theGExactCB=$(o.argument.GlobalExactCB);if(theGExactCB!=null&&theGExactCB.checked){TGN.SM.Clear(o.argument.FormId,"",null,false)}else{TGN.SM.Clear(o.argument.FormId)}var person=eval("("+o.responseText+")");for(FieldName in o.argument.KVPairs){var fId=$(FieldName);if(fId!=null){if(fId.tagName!="SPAN"){fId.value=person[o.argument.KVPairs[FieldName]]}else{if(fId.innerHTML!="undefined"){fId.innerHTML=person[o.argument.KVPairs[FieldName]]}else{if(TGN.SM.GetText(fId)!=null){TGN.SM.SetText(fId,person[o.argument.KVPairs[FieldName]])}}}}}for(FuncName in o.argument.Callbacks){var tCallb=o.argument.Callbacks[FuncName];tCallb.callback(tCallb.domId,person[tCallb.fType],tCallb.args)}TGN.SearchWidget.NameChanged=0;var FMC=TGN.SM.InstContainer[o.argument.FormId.replace("moduleSearchtemplate","search-form")].FMC;if("undefined"!=FMC&&null!=FMC){FMC.Clear();for(ndx in person.familyMembers){FMC.AddRow(person.familyMembers[ndx].relationship,person.familyMembers[ndx].givenName,person.familyMembers[ndx].surname,"","")}}},failure:function(o){if(o.status==500){if(TGN.SearchWidget.TreeLoadingPanel!=null){TGN.SearchWidget.TreeLoadingPanel.setBody("<div class='g_alert'><strong>"+TGN.I18N.getTrans("treeLoadingErrorH")+"</strong><br/>"+TGN.I18N.getTrans("treeLoadingErrorB")+"</div>");setTimeout("TGN.SearchWidget.TreeLoadingPanel.destroy()",5000)}if(TGN.SM.TreeLoadingFader!=null){TGN.SM.TreeLoadingFader.stop()}}},argument:formFieldArray};this.fnItemSelectEvent=function(oSelf,eArr,oData){TGN.SM.RegSubmitCancelled=true;var url="AjaxBaseHandler.ashx?a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PersonAutoComplete|GetPersonCallback&guid=";url+=guid;url+="&tid="+eArr[2][2];url+="&pid="+eArr[2][3];if(eArr[1]!=null){var cEl=eArr[1];while(cEl!=null&&cEl!=document){if(cEl.className.indexOf("search-form")>=0||cEl.className.indexOf("search-refined")>=0){TGN.SM.ShowTreeLoading(cEl.id,cache);break}cEl=cEl.parentNode}}YAHOO.util.Connect.asyncRequest("GET",url,PopulateForm)};this.YUI_AC.itemSelectEvent.subscribe(this.fnItemSelectEvent);this.fnUnmatchedEvent=function(oSelf,sQuery){var gsfn=$(CtrlName+"_gsfn");if(gsfn!==null){gsfn.value=""}var gsln=$(CtrlName+"_gsln");if(gsln!==null){gsln.value=""}};this.YUI_AC.unmatchedItemSelectEvent.subscribe(this.fnUnmatchedEvent)};TGN.SearchWidget.GetTreeList=function(theDiv,guid,tid,personP){var el;var AddTreePicker={success:function(o){var resp=eval("("+o.responseText+")");if(resp!=null){var theSize=0;for(el in resp){theSize+=1}if(theSize>5){theSize=5}var sBox="<select style='width:225px' size='"+theSize+"' ";sBox+="onchange=\"TGN.SearchWidget.SetPrefTree('"+personP+"',this)\" >";for(el in resp){sBox+="<option value='"+resp[el];if(resp[el]==tid){sBox+="' selected >"}else{sBox+="'>"}sBox+=el+"</option>"}sBox=sBox+"</select>";if(sBox!="<select>"){var tCh=$(theDiv);if(tCh!=null){tCh.innerHTML=sBox}}}},failure:function(o){}};YAHOO.util.Connect.asyncRequest("GET","AjaxBaseHandler.ashx?a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PersonAutoComplete|GetAllTrees&guid="+guid,AddTreePicker)};TGN.SearchWidget.SetPrefTree=function(b,a){TGN.SearchWidget.PersonACHandles[b].setTid(a.options[a.selectedIndex].value)};TGN.SearchWidget.PlaceAutoComplete=function(h,c,k,g,n,m,f,a,d,b){if(n==null||n=="undefined"||n==""){n=null}if(d==null||d=="undefined"||d==""){d=null}this.aCDS=new YAHOO.widget.DS_XHR("AjaxBaseHandler.ashx",["ResultSet.Result","PlaceText","Gpid","GpidH","HitC","Level","PHInfo"]);var e="a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PlaceTypeAheadHandler|ProcessRequest&Use302Redirect=1&lcid="+g;if(n!=null){e+="&GetGH=1"}if(d!=null){e+="&GetPI=1"}if(m!="undefined"&&m){e+="&MGpid=1"}if(f!="undefined"&&f!=-1){e+="&dbid="+f}if(a!="undefined"&&a!=0){e+="&eventT="+a}this.aCDS.scriptQueryAppend=e;this.aCDS.responseType=YAHOO.widget.DS_XHR.TYPE_JSON;this.aCDS.connTimeout=4000;this.YUI_AC=new YAHOO.widget.AutoComplete(h,c,this.aCDS);this.YUI_AC.minQueryLength=3;this.YUI_AC.maxResultsDisplayed=15;this.YUI_AC.animVert=false;this.YUI_AC.queryDelay=0.2;this.YUI_AC.useShadow=true;this.YUI_AC.useIFrame=true;this.YUI_AC.autoHighlight=false;this.fnFormatter=function(o,p){var q="";if(typeof o[3]!="undefined"){if(o[3]!="0"){q=" <span class='hitC'>"+o[0]+"  ("+o[3]+")</span><span class='hitCAlt'>";if(o[0].length>18){q+=o[0].substring(0,18)+"..."}else{q+=o[0]}q+=" ("+o[3]+")</span>"}else{q="<span class='zeroH'>"+o[0]+" ("+o[3]+")</span><span class='zeroHAlt'>";if(o[0].length>18){q+=o[0].substring(0,18)+"..."}else{q+=o[0]}q+=" (0)";q+="</span>"}}else{q=o[0]}return q};this.YUI_AC.formatResult=this.fnFormatter;this.fnItemSelectEvent=function(r,o,v){TGN.SM.RegSubmitCancelled=true;var u=$(k);if(u!=null){u.value=o[2][1]}if(d!=null){var p=$(d+"_PInfo");if(o[2].length>5){var q=o[2][4];var s=o[2][5];p.value=q+"-"+s;TGN.SM.LocGpidSet(d,q,s,b)}}if(n!=null){var t=$(n);if(t!=null){t.value=o[2].length>2?o[2][2]:""}}};this.YUI_AC.itemSelectEvent.subscribe(this.fnItemSelectEvent);this.fnUnmatchedEvent=function(p,s){var r=$(k);if(r!==null){r.value=""}if(n!=null){var q=$(n);if(q!==null){q.value=""}}if(d!=null){var o=$(d+"_PInfo");o.value="";TGN.SM.LocGpidRefused(d,b)}};this.YUI_AC.unmatchedItemSelectEvent.subscribe(this.fnUnmatchedEvent)};if(typeof TGN.SM=="undefined"){TGN.SM={}}TGN.SM.Inst=function(d,a,e,f){var c=0;var b=0;this.initShowAdv=f;this.showAdv=f;TGN.SM.InstContainer[d]=this;this.moduleDiv=d;this.clientId=a;this.XCBArray=new Array();this.ToggleAdv=function(u){this.showAdv=!this.showAdv;if(u==null){u=""}var n;var r;var t=$(d);var h=$(this.clientId+"_xcb");if(h!=null&&h.checked){h.checked=!h.checked;this.AdvCBToggle(h)}var k=$(a+"_Name");var q=$(a+"_Name_gsfn");var o=$(a+"_Name_gsln");if(q!=null&&o!=null&&k!=null){if(this.showAdv){k=k.value;if(q.value==""&&o.value==""){if(k!=null){q.value=k.substring(0,k.lastIndexOf(" "));o.value=k.substring(k.lastIndexOf(" ")+1)}}}else{k.value=q.value;if(o.value!=""){k.value+=" "+o.value}}}if(t!=null){if(this.showAdv){t.className=t.className+" advanced"}else{t.className=t.className.replace(" advanced","")}n=t.getElementsByTagName("INPUT");if(this.showAdv){for(p=0,m=n.length;p<m;p++){if(n[p].className.indexOf("SM_regOpt")>-1){r=$(n[p].id+"-x");if(r!==null){var g=n[p].value.match(/\d{4}/);if(g!==null&&g!=""){r.value=g}}}}}else{for(p=0,m=n.length;p<m;p++){if(n[p].className.indexOf("SM_advOpt")>-1){var w=n[p].id.substring(0,n[p].id.length-2);r=$(w);if(r!=null&&r.value==""){r.value=n[p].value}}}}}var v=$(a+"_msAV");if(v!=null){if(this.showAdv){v.value="1"}else{v.value="0"}}if(YAHOO.env.ua.ie>5&&YAHOO.env.ua.ie<7){n=YAHOO.util.Dom.getElementsByClassName("mod open");for(var p=0,m=n.length;p<m;p++){var s=new TGN.SM.AdvElem(n[p]);setTimeout(s.go,1)}}};this.ExactCBToggle=function(h){var g=$(this.clientId+"_xcb");var k=$(a+"_msAV");if(h.checked==true){if(this.p_CheckCB(h,true)){g.checked=h.checked;k.value="2"}else{g.checked=false;k.value="1"}}else{g.checked=false;k.value="1"}};this.p_CheckCB=function(k,p){var h=$(this.clientId+"_xcb");var o=$(this.moduleDiv);if(o!=null){var n=o.getElementsByTagName("INPUT");for(var m=0,g=n.length;m<g;m++){if(n[m].type=="checkbox"){if(n[m]==k||n[m]==h){continue}if(n[m].checked!=p){return false}}}}return true};this.AdvCBToggle=function(h){if(h==null){h=$(this.clientId+"_xcb")}var n=$(this.moduleDiv);if(n!=null){var m=n.getElementsByTagName("INPUT");for(var k=0,g=m.length;k<g;k++){if(h.checked&&m[k].className.indexOf("SM_exactOnlyChoice")>-1){TGN.SM.SetExactOnly(m[k])}else{if(!h.checked&&m[k].className.indexOf("SM_nonExactChoice")>-1){TGN.SM.SetExactOnly(m[k])}else{if(m[k].type=="checkbox"&&(m[k].name.indexOf("_x")+2)==m[k].name.length){m[k].checked=h.checked}else{if(m[k].type=="hidden"&&(m[k].name.indexOf("_x")+2)==m[k].name.length){m[k].value=h.checked?"1":""}else{if(m[k].type=="hidden"&&(m[k].name=="MSAV")){m[k].value=h.checked?"2":"1"}}}}}}}};this.CheckBucket=function(h,n){var m=$(this.clientId+"-catBucketSubmit");var g="";var k=$(this.clientId+"-catBucket-r");if(typeof k!="undefined"&&k.checked){g+="r"}k=$(this.clientId+"-catBucket-s");if(typeof k!="undefined"&&k.checked){g+="s"}k=$(this.clientId+"-catBucket-t");if(typeof k!="undefined"&&k.checked){g+="t"}k=$(this.clientId+"-catBucket-p");if(typeof k!="undefined"&&k.checked){g+="p"}if(g==""){alert(TGN.I18N.getTrans("catBuckErr"));m.value=n;h.checked=true}else{m.value=g}}};TGN.SM.InstContainer=new Array();TGN.SM.InstMgr=function(c,a){var b=TGN.SM.InstContainer[c];if(b==null){b=new TGN.SM.Inst(c,a,"",true)}return b};TGN.SM.AdvElem=function(a){this.go=function(){a.className="mod";a.className="mod open"}};if(typeof TGN.SM.CONFIG=="undefined"){TGN.SM.CONFIG=new Array()}TGN.SM.GetConfig=function(a){return TGN.SM.CONFIG[a]};TGN.SM.SyncExactCB=function(a,c){var b=$(c);if(b!=null){if(a.checked){b.value="1"}else{b.value=""}}};TGN.SM.HideShow=function(c){var b=$(c);var a=b.className.indexOf(" open");if(a>0){b.className=b.className.substring(0,a)}else{b.className=b.className+" open"}};TGN.SM.TogSumCat=function(b){tEl=$(b);if(tEl!=null){var a=tEl.className.indexOf(" closed");if(a>0){tEl.className=tEl.className.substring(0,a)}else{tEl.className=tEl.className+" closed"}}};TGN.SM.showMoreLocation=function(c,a,h){var f=0;var m=0;for(var d=1;d<=c;d++){var k=$(a+d+"_Div");if(k!=null){if(f==0&&k.innerHTML==""){f=d;m=d;h-=(f-1)*2}else{if(k.innerHTML!=""){if(k.style.display=="none"){k.style.display="block";return}m=d}else{break}}}}if((m+1)>c){var g=$("resAddAnother");if(g!=null){g.style.display="none"}}if(f==0){return}k=$(a+f+"_Div");if(k!=null){k.innerHTML+="<style type='text/css'> #"+a+f+"_AutoComplete .yui-ac-content{ z-index:"+h+";} #"+a+f+"_AutoComplete .yui-ac-shadow { z-index:"+(h-1)+"; } #"+a+f+"_AutoComplete { z-index:"+h+" } </style> <input type='hidden' class='clear' id='"+a+f+"_Gpid' name='msrpn"+f+"' value='' /><div class='PlaceBox_CN'><div id='"+a+f+"_AutoComplete'><input type='text' id='"+a+f+"_ftp' name='msrpn"+f+"__ftp' value='' class='field' /><div id='"+a+f+"_ACContainer'></div> </div></div>";k.style.display="block";(function(){this.personWidget=new TGN.SearchWidget.PlaceAutoComplete(a+f+"_ftp",a+f+"_ACContainer",a+f+"_Gpid","1033","")})();if(YAHOO.env.ua.ie>5&&YAHOO.env.ua.ie<=8){var e=$(a+f+"_AutoComplete");if(e!=null){e.style.zIndex=h}var b=YAHOO.util.Dom.getElementsByClassName("yui-ac-content",null,a+f+"_AutoComplete");if(b!=null&&b.length>0){b[0].style.zIndex=h}YAHOO.util.Dom.getElementsByClassName("PlaceBox_CN","div",null,function(o){o.className=o.className+" clear"})}if(typeof TGN.KeyWatcher!="undefined"){var n=$(a+f+"_ftp");if(n!=null){TGN.KeyWatcher.addListener(n)}}}};TGN.SM.popGenderR=function(c,b,a){if(b=="m"){b="f"}else{if(b=="f"){b="m"}}TGN.SM.popGender(c,b,a)};TGN.SM.popGender=function(f,e,c){var a=$(f);if(e=="m"){e="f"}else{if(e=="f"){e="m"}}if(a!=null){for(var d=0,b=a.options.length;d<b;d++){if(a.options[d].value==e){a.selectedIndex=d;if(c[0]!=null){modD=$(c[0]);if(modD!=null){if(modD.innerHTML!="undefined"){modD.innerHTML=a.options[d].text}else{if(TGN.SM.GetText(modD)!=null){TGN.SM.SetText(modD,a.options[d].text)}}}}break}}}};TGN.SM.cFormEl=function(a,c){var b=document.createElement("input");b.setAttribute("type","hidden");b.setAttribute("name",a);b.setAttribute("value",c);return b};TGN.SM.PersonKeyPress=function(a){if(a.keyCode!=13&&a.keyCode!=9&&!(a.keyCode>=37&&a.keyCode<=40)&&!(a.keyCode>=16&&a.keyCode<=19)){TGN.SearchWidget.NameChanged+=1}};TGN.SM.CloseSSO=function(a){if(a||TGN.SM.CloseTimer!=null){var b=$("startsearchoverDD");if(b!=null&&b.className.indexOf("indivHide")==-1){b.className+=" indivHide"}YAHOO.util.Event.removeListener("ssoClose","blur")}};TGN.SM.CloseTimer=null;TGN.SM.CloseSSOM=function(){TGN.SM.CloseTimer=setTimeout(function(){TGN.SM.CloseSSO(false)},3000)};TGN.SM.SSOMOver=function(){if(TGN.SM.CloseTimer!=null){clearTimeout(TGN.SM.CloseTimer);TGN.SM.CloseTimer=null}};TGN.SM.InitSSOLink=function(){var d=$("startsearchoverDD");d.style.position="absolute";d.style.zIndex=50;function c(f){f.className+=" yuimenuitem-selected"}function a(f){f.className=f.className.replace(" yuimenuitem-selected","")}YAHOO.util.Dom.getElementsBy(function(){return true},"li",d,function(f){YAHOO.util.Event.addListener(f,"mouseover",function(){c(f)});YAHOO.util.Event.addListener(f,"mouseout",function(){a(f)})});function b(f){return(function(){if(f.className.indexOf("indivHide")>=0){f.className=f.className.replace(" indivHide","");YAHOO.util.Dom.setX(f,YAHOO.util.Dom.getX("ssoLink")-5);YAHOO.util.Dom.setY(f,YAHOO.util.Dom.getY("ssoLink")+10);var g=$("ssoClose");if(g!=null){g.focus()}YAHOO.util.Event.addListener("ssoClose","blur",function(){TGN.SM.CloseSSO(false)})}})}var e=b(d);YAHOO.util.Event.addListener("ssoLink","click",e)};TGN.SM.ClearedValues=null;TGN.SM.ClearAndSave=function(e){var b=0;if(TGN.SM.ClearedValues==null){TGN.SM.ClearedValues=new Array()}else{TGN.SM.Clear(e,"");return}var a="";var d=$(e);if(d!=null){var c=d.getElementsByTagName("INPUT");for(b=0,l=c.length;b<l;b++){if(c[b].className.indexOf("SMNoClear")>-1){continue}if(c[b].type=="checkbox"){if(c[b].id.indexOf("catBucket")<0){TGN.SM.ClearedValues[c[b].id]=c[b].checked;c[b].checked=false}}else{if(c[b].type=="text"&&c[b].className.indexOf("field")>=0){TGN.SM.ClearedValues[c[b].id]=c[b].value;c[b].value=a}else{if(c[b].type=="hidden"){if(c[b].className.indexOf("clear")>=0){TGN.SM.ClearedValues[c[b].id]=c[b].value;c[b].value=""}}}}}c=d.getElementsByTagName("SELECT");for(b=0,l=c.length;b<l;b++){if(c[b].name=="cp"||c[b].className.indexOf("SMNoClear")!=-1){continue}TGN.SM.ClearedValues[c[b].id]=c[b].selectedIndex;c[b].selectedIndex=0}}};TGN.SM.RestoreClear=function(f){var b=0;var a=0;var e=$(f);if(TGN.SM.ClearedValues==null){return}var d=TGN.SM.ClearedValues;if(e!=null){var c=e.getElementsByTagName("INPUT");for(b=0,a=c.length;b<a;b++){if(c[b].type=="checkbox"&&d[c[b].id]!="undefined"){if(typeof TGN.SM.ClearedValues[c[b].id]!="undefined"){c[b].checked=TGN.SM.ClearedValues[c[b].id]}}else{if(c[b].type=="text"&&d[c[b].id]!="undefined"&&c[b].className.indexOf("field")>=0){if(typeof TGN.SM.ClearedValues[c[b].id]!="undefined"){c[b].value=TGN.SM.ClearedValues[c[b].id]}}else{if(c[b].type=="hidden"&&d[c[b].id]!="undefined"){if(c[b].className.indexOf("clear")>=0){c[b].value=TGN.SM.ClearedValues[c[b].id]}}}}}c=e.getElementsByTagName("SELECT");for(b=0,a=c.length;b<a;b++){if(c[b].name=="cp"||d[c[b].id]!="undefined"){continue}c[b].selectedIndex=TGN.SM.ClearedValues[c[b].id]}}};TGN.SM.Clear=function(h,b,g,c){var d=0;var a=0;if(b==null){b=""}if(c==null){c=true}var f=$(h);if(f!=null){if(g==null||confirm(g)){var e=f.getElementsByTagName("INPUT");for(d=0,a=e.length;d<a;d++){if(e[d].className.indexOf("SMNoClear")>-1){continue}if(e[d].type=="checkbox"&&c){if(e[d].id.indexOf("catBucket")<0){e[d].checked=false}}else{if(e[d].type=="text"&&e[d].className.indexOf("field")>=0){e[d].value=b}else{if(e[d].type=="hidden"){if(e[d].className.indexOf("clear")>=0){e[d].value=""}if(e[d].name=="MSAV"&&e[d].value=="2"){e[d].value="1"}}else{if(e[d].type=="radio"){if(e[d].className.indexOf("SM_nonExactChoice")>=0){TGN.SM.SetExactOnly(e[d])}}}}}}e=f.getElementsByTagName("SELECT");for(d=0,a=e.length;d<a;d++){if(e[d].name=="cp"||e[d].className.indexOf("SMNoClear")!=-1){continue}e[d].selectedIndex=0}}}};TGN.SM.ToggleFloatDD=function(b){var a=document.getElementById(b);if(typeof a!="undefined"){if(a.style.display=="block"){a.style.display="none"}else{a.style.display="block"}}};TGN.SM.FloatDDMouseOutStops={};TGN.SM.MOutFloatDD=function(c,b){if(TGN.SM.FloatDDMouseOutStops[b.id]){return}if(c.type!="mouseout"&&c.type!="mouseover"){return}var a=c.relatedTarget?c.relatedTarget:c.type=="mouseout"?c.toElement:c.fromElement;while(a&&a!=b){a=a.parentNode}if(a==b){return}TGN.SM.CloseFloatDD(b)};TGN.SM.CloseFloatDD=function(a){a.style.display="none"};TGN.SM.ClearExactOnlyCheckBox=function(b){var a=$(b+"_xcb");var c=$(b+"_msAV");if("undefined"!=typeof a&&null!=a){a.checked=false;if(c.value=="2"){c.value="1"}}};TGN.SM.LocFilterSet=function(g,f,h,k,b){var c=document.getElementById(f+"_DDLabel");if(c!=null){var a="pw"+g.value;if(g.value==""){a="pwDefaultSettings";TGN.SM.ClearExactOnlyCheckBox(b)}c.innerHTML=TGN.I18N.getTrans(a)}if(typeof k!="undefined"){var d=document.getElementById(k);if(d!=null){if(g.value=="XO"){d.value="1"}else{d.value=""}}}var e=document.getElementById(f+"_Filter");TGN.SM.CloseFloatDD(e)};TGN.SM.NameFilters={};TGN.SM.NameFilterSet=function(o,n,m,s,k,e,b){var p=(k?"L_":"F_");if(n!=null){TGN.SM.NameFilters[p+"check_"+m+"_"+s]=n}if(o!=null){TGN.SM.NameFilters[p+"selectedRadio_"+m]=o;TGN.SM.NameFilters[p+"radio_"+m+"_"+s]=o}if(o!=null&&s=="defRadio"){for(var q in TGN.SM.NameFilters){if("undefined"!=typeof q&&null!=q&&q.substring(0,2)==p&&q.substring(2,7)=="check"){TGN.SM.NameFilters[q].checked=false}}TGN.SM.ClearExactOnlyCheckBox(e)}if(n!=null){if("undefined"==typeof TGN.SM.NameFilters[p+"selectedRadio_"+m]||TGN.SM.NameFilters[p+"selectedRadio_"+m].id==m+"_defRadio"){var d=$(m+"_XO");d.checked=true;TGN.SM.NameFilters[p+"selectedRadio_"+m]=d}}var f=document.getElementById(m+"_DDLabel");if(f!=null){if("undefined"!=typeof TGN.SM.NameFilters[p+"selectedRadio_"+m]&&TGN.SM.NameFilters[p+"selectedRadio_"+m].id==m+"_XO"){var c=TGN.I18N.getTrans("nwXO");for(q in TGN.SM.NameFilters){if("undefined"!=typeof q&&null!=q&&q.substring(0,2)==p&&q.substring(2,7)=="check"&&TGN.SM.NameFilters[q].checked==true){var r=q.lastIndexOf("_");var a=q.substring(r+1);c+=", "+TGN.I18N.getTrans("nw"+a)}}f.innerHTML=c}else{f.innerHTML=TGN.I18N.getTrans("nwDefaultSettings")}}var h="";if("undefined"!=typeof TGN.SM.NameFilters[p+"selectedRadio_"+m]&&TGN.SM.NameFilters[p+"selectedRadio_"+m].id==m+"_XO"){h="XO";for(q in TGN.SM.NameFilters){if("undefined"!=typeof q&&null!=q&&q.substring(0,2)==p&&q.substring(2,7)=="check"&&TGN.SM.NameFilters[q].checked==true){r=q.lastIndexOf("_");a=q.substring(r+1);if(h=="XO"){h=""}if(h.length>0){h+="_"}h+=a}}}var g=$(m+"_hidden");g.value=h};TGN.SM.SetExactOnly=function(widget){widget.checked=true;try{if(typeof widget.onclick=="function"){widget.onclick.call(widget)}else{eval(widget.onclick)}}catch(e){}};TGN.SM.LocGpidRefused=function(b,a){TGN.SM.LocGpidSet(b,0,null,a)};TGN.SM.LocGpidSet=function(h,e,f,a){var d=null;var c=false;if(typeof a!="undefined"){var b=document.getElementById(a);if(b!=null){if(b.checked){c=true}}}var g;if(c){d=$(h+"_XO_input");if(d!=null){d.checked=true;g=document.getElementById(h+"_DDLabel");if(g!=null){g.innerHTML=TGN.I18N.getTrans("pwXO")}}}else{d=$(h+"_defRadio");if(d!=null){d.checked=true;g=document.getElementById(h+"_DDLabel");if(g!=null){g.innerHTML=TGN.I18N.getTrans("pwDefaultSettings")}}}if(e>7&&f.indexOf("|5027|")==-1&&f.indexOf("|3243|")==-1){TGN.SM.WidgetOn(h+"_PCO")}else{TGN.SM.WidgetOff(h+"_PCO")}if(e>=7&&f.indexOf("|5027|")==-1&&f.indexOf("|3243|")==-1){d=$(h+"_PACO");if(d!=null){d.style.display=""}}else{d=$(h+"_PACO");if(d!=null){d.style.display="none"}}if(e>=5&&f.indexOf("|3257|")==-1&&f.indexOf("|3250|")==-1){d=$(h+"_PAS");if(d!=null){d.style.display=""}}else{d=$(h+"_PAS");if(d!=null){d.style.display="none"}}if(e>5&&f.indexOf("|3257|")==-1&&f.indexOf("|3250|")==-1){d=$(h+"_PS");if(d!=null){d.style.display=""}}else{d=$(h+"_PS");if(d!=null){d.style.display="none"}}d=$(h+"_PC");if(e>3){if(d!=null){d.style.display=""}d=$(h+"_RestrictThis");if(d!=null){d.style.display=""}}else{if(d!=null){d.style.display="none"}d=$(h+"_RestrictThis");if(d!=null){d.style.display="none"}}};TGN.SM.WidgetOn=function(a){radioW=$(a);if(radioW!=null){radioW.style.display=""}};TGN.SM.WidgetOff=function(a){radioW=$(a);if(radioW!=null){radioW.style.display="none"}};TGN.SM.ShowHelp=function(c,b){if(screen){leftPos=screen.width-425}var a=window.open("http://"+c+"/Search/Help/SearchForm.aspx?topic="+b,"stHelp","toolbar=0,location=0,status=0,menubar=0,scrollbars=yes,resizable=1,top=5,left=10,width=600,height=625");if(a){a.focus()}};TGN.SM.TrackTemplate=function(a,e){var d=s_gi(s_account);var c="Simple";if(e){c="Advanced"}var f="unknown";if(typeof TGN!="undefined"&&typeof TGN.Ancestry!="undefined"&&typeof TGN.Ancestry.Search!="undefined"&&typeof TGN.Ancestry.Search.SearchInfo!="undefined"){if(typeof TGN.Ancestry.Search.SearchInfo.pageType!="undefined"){f=TGN.Ancestry.Search.SearchInfo.pageType}}var b="Search:RForm:"+f+":"+c;if(a){b="Search:RForm:"+f+":"+c}s_pageName=b;void (d.t())};TGN.SM.ToggleSearchCat=function(a,b){TGN.SM.HideNewSearch();TGN.SM.ShowNewSearch(a,b,false,true)};TGN.SM.TogSboCB=function(c,e){var b=$("hiddenSbo"+e);b.value=c.checked?"0":"1";var a=$(e+"_TogColPCB");var d=$(e+"_ColPExact");if(a!=null&&d!=null){a.checked=c.checked;if(c.checked){d.value="1"}else{d.value="0"}}};TGN.SM.TogColPriority=function(c,e){var b=$(e+"_ColPExact");var a=document.getElementById("hiddenSbo"+e);var d=document.getElementById("sboCB"+e);if(c.checked){b.value="1";if(a!=null&&d!=null){a.value="0";d.checked=true}}else{b.value="0";if(a!=null&&d!=null){a.value="1";d.checked=false}}};TGN.SM.ColPriorityChanged=function(e,h){var a=$(h+"_TogColDiv");var g=$(h+"_TogColPCB");var d=e.selectedIndex;var b=e.options[d].value;switch(b){case"100":case"101":case"102":var c="HideDiv";if(a.className.indexOf(c)==-1){a.className=a.className+" "+c}break;default:var f=a.className.split(" ");if(f.length>1&&f[1]=="HideDiv"){a.className=f.splice(0,f.length-1).join(" ")}break}};TGN.SM.SubmitFormReturnVoid=function(e,d,a,b,c){TGN.SM.SubmitForm(e,d,a,b,c)};TGN.SM.SubmitFormReturnFalse=function(e,d,a,b,c){TGN.SM.SubmitForm(e,d,a,b,c);return false};TGN.SM.SubmitForm=function(g,f,c,d,e){if(typeof e=="undefined"){var a=$(f);a.focus()}setTimeout("TGN.SM.SubmitFormNow('"+g+"','"+f+"','"+c+"','"+d+"')",1)};TGN.SM.FamilyMemberFieldCheck=function(c){var a=0;var d=5;if(c.substr(a,d)==="mssng"||c.substr(a,d)==="mssns"||c.substr(a,d)==="mscng"||c.substr(a,d)==="mscns"||c.substr(a,d)==="msbng"||c.substr(a,d)==="msbns"){return true}return false};TGN.SM.SubmitFormNow=function(s,n,r,h){var w=0;var u=0;var z=$(n);z.className=z.className+" disabled";var d=$("top_"+n);if(d!=null){d.className=d.className+" disabled"}$(r).innerHTML=TGN.I18N.getTrans("Searching");var B=$("top_"+r);if(B!=null){B.innerHTML=TGN.I18N.getTrans("Searching")}var e=$(s);var g=$(h);var p=false;var x="SM_advOpt";if(g!=null&&(g.value=="1"||g.value=="2")){x="SM_regOpt";p=true}var v=document.createElement("form");v.setAttribute("method","GET");v.setAttribute("action",e.action);alltags=e.getElementsByTagName("INPUT");var A;var f=new Array();var m=new Array();var t=new Array();var y=new Array();var q=0;var c=0;var k=0;var a=0;for(w=0,u=alltags.length;w<u;w++){var o=alltags[w];if(o.className.indexOf(x)>-1||o.name==null||o.value==null||o.name==""||o.value==""||o.style.display=="none"){continue}if(o.type=="checkbox"||o.type=="radio"){if(o.checked){A=TGN.SM.cFormEl(o.name,o.value);A.checked=o.checked;if(TGN.SM.FamilyMemberFieldCheck(o.name)){f[q]=A;q++}else{v.appendChild(A)}}}else{if(o.type=="hidden"){if(!p&&(o.name.indexOf("_x")+2)==o.name.length){if(o.className.indexOf("SM_DND")<=-1){continue}}A=TGN.SM.cFormEl(o.name,o.value);v.appendChild(A)}else{if(!p&&(o.name=="gsfn"||o.name=="gsln")&&TGN.SearchWidget.NameChanged>0){continue}A=TGN.SM.cFormEl(o.name,o.value);if(TGN.SM.FamilyMemberFieldCheck(o.name)){f[q]=A;q++}else{v.appendChild(A)}}}}alltags=e.getElementsByTagName("select");for(w=0,u=alltags.length;w<u;w++){o=alltags[w];if(o.className.indexOf(x)>-1){continue}else{if(o.value!=""){A=TGN.SM.cFormEl(o.name,o.value);v.appendChild(A)}}}for(fmi=0;fmi<f.length;fmi++){A=f[fmi];if(A.name.substr(0,5)==="mssng"||A.name.substr(0,5)==="mssns"){m[c]=A;c++}if(A.name.substr(0,5)==="mscng"||A.name.substr(0,5)==="mscns"){t[k]=A;k++}if(A.name.substr(0,5)==="msbng"||A.name.substr(0,5)==="msbns"){y[a]=A;a++}}for(w=0;w<m.length;w++){A=m[w];v.appendChild(A)}for(w=0;w<t.length;w++){A=t[w];v.appendChild(A)}for(w=0;w<y.length;w++){A=y[w];v.appendChild(A)}document.body.appendChild(v);v.submit();return false};TGN.SM.RegSubmitCancelled=false;TGN.SM.RegSubmit=function(d,a){var e=document.getElementById(d);if(e!=null){var c=function(f){if(typeof f!="undefined"){if(f.keyCode==13&&!TGN.SM.RegSubmitCancelled){a()}TGN.SM.RegSubmitCancelled=false}};for(var b=0;b<e.length;b++){if(e[b].type=="text"){YAHOO.util.Event.addListener(e[b],"keydown",c)}}}};TGN.SM.ShowWaitMessage=function(a){if(typeof TGN.SM.WaitPanel=="undefined"||TGN.SM.WaitPanel==null){var b=document.createElement("div");b.setAttribute("id","waitPanel");document.body.appendChild(b);TGN.SM.WaitPanel=new YAHOO.widget.Panel("waitPanel",{close:false,draggable:false,modal:true,visible:true,width:200,underlay:"none",zIndex:101});TGN.SM.WaitPanel.setBody(a);TGN.SM.WaitPanel.render(document.body)}TGN.SM.PositionAndShow(TGN.SM.WaitPanel)};TGN.SM.TreeLoadingFader=null;TGN.SM.ShowTreeLoading=function(d,a){if(typeof TGN.SM.TreeWaitPanel=="undefined"||TGN.SM.TreeWaitPanel==null){var b=$(d);if(b!=null){TGN.SM.TreeLoadingFader=new YAHOO.util.Anim(d,{opacity:{to:0.1}},3,YAHOO.util.Easing.easeOut);TGN.SM.TreeLoadingFader.onComplete.subscribe(function(){b.style.opacity=1;if(b.style.filter!=null){b.style.filter=""}});TGN.SM.TreeLoadingFader.animate();var c=document.createElement("div");c.setAttribute("id","treeWaitPanel");b.appendChild(c);YAHOO.util.Dom.setXY(c,YAHOO.util.Dom.getXY(b));TGN.SearchWidget.TreeLoadingPanel=new YAHOO.widget.Panel("treeWaitPanel",{constrainttoviewport:true,close:false,underlay:"none",visible:true,draggable:false});TGN.SearchWidget.TreeLoadingPanel.setBody("<img src='"+a+"/css/search/i/Loading32.gif' /><span class='loadingMsg'>"+TGN.I18N.getTrans("loadingMsg")+"</span>");TGN.SearchWidget.TreeLoadingPanel.render()}}};TGN.SM.HideWaitMessage=function(){if(typeof TGN.SM.WaitPanel!="undefined"&&TGN.SM.WaitPanel!=null){TGN.SM.WaitPanel.hide()}};TGN.SM.ShowMore=function(d,b){var c=$(d);var a=$(b);if(c!=null){c.style.display="block"}if(a!=null){a.style.display="none"}};TGN.SM.ShowSearchPanel=function(){TGN.SM.PositionAndShow(TGN.SM.NewSearchPanel);TGN.SM.HideWaitMessage();TGN.SM.FocusFirstInput("newT_search-form")};TGN.SM.PositionAndShow=function(b){var a=$D.getDocumentScrollLeft()+(($D.getViewportWidth()-b.element.offsetWidth)/2);if(a<10){a=10}var c=$D.getDocumentScrollTop()+50;b.cfg.setProperty("zIndex",201);b.cfg.setProperty("x",a);b.cfg.setProperty("y",c);b.show()};TGN.SM.SetACZ=function(e,d){if(YAHOO.env.ua.ie>5&&YAHOO.env.ua.ie<=7){var a=YAHOO.util.Dom.getElementsByClassName("yui-ac","div",e);if(document.styleSheets&&document.styleSheets.length>0){var c=document.styleSheets[0];if(typeof(c.addRule)=="object"){for(var b=0;b<a.length;b++){if(a[b].id!=null&&a[b].id!=""){c.addRule("#"+a[b].id,"z-index:"+d);c.addRule("#"+a[b].id+" .yui-ac-content","z-index:"+d--);c.addRule("#"+a[b].id+" .yui-ac-shadow","z-index:"+d--)}}}}}};TGN.SM.HandleSuccess=function(c){if(typeof TGN.SM.NewSearchPanel=="undefined"||TGN.SM.NewSearchPanel==null){if(c.responseText!="undefined"){var d=document.createElement("div");d.setAttribute("id","newSearch");if(YAHOO.env.ua.ie>5&&YAHOO.env.ua.ie<=7){document.body.appendChild(d);d.innerHTML+=c.responseText}else{d.innerHTML+=c.responseText;document.body.appendChild(d)}TGN.SM.NewSearchPanel=new YAHOO.widget.Panel("newT_search-form",{close:true,draggable:true,modal:true,visible:true,width:450,underlay:"none",effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.1}});TGN.SM.NewSearchPanel.cfg.getProperty("strings").close=" ";if(typeof TGN.KeyWatcher!="undefined"){TGN.KeyWatcher.disable();TGN.KeyWatcher.lockState()}TGN.SM.NewSearchPanel.hideEvent.subscribe(function(){if(typeof TGN.KeyWatcher!="undefined"){TGN.KeyWatcher.unlockState();TGN.KeyWatcher.enable()}});TGN.SM.NewSearchPanel.showEvent.subscribe(function(){if(typeof TGN.KeyWatcher!="undefined"){TGN.KeyWatcher.disable();TGN.KeyWatcher.lockState()}});TGN.SM.NewSearchPanel.element.className+=" modal";var b=$("newT_search-form");b.className=b.className.replace(" yui-panel","");TGN.SM.NewSearchPanel.render(document.body);$("newT_mod-search").innerHTML+="<span class='lnk-cancel'>&nbsp;"+TGN.I18N.getTrans("or")+"&nbsp;<a href='javascript:TGN.SM.HideNewSearch();'>"+TGN.I18N.getTrans("newSearchCancel")+"</a></span>";if(c.argument[0]=="clear"){TGN.SM.Clear("newT_search-form")}TGN.SM.ShowSearchPanel();if(YAHOO.env.ua.ie<=7){var a=function(f,e){return function(){TGN.SM.SetACZ(f,e)}};setTimeout(a(TGN.SM.NewSearchPanel.element,150),1)}}}else{TGN.SM.ShowSearchPanel()}};TGN.SM.HandleFailure=function(a){document.location.href="/"};TGN.SM.ShowNewSearch=function(c,d,f,b){if(typeof d=="undefined"){d=true}if(typeof f=="undefined"){f=false}if(c==null){c=""}if(typeof TGN.SM.NewSAdvT=="undefined"){TGN.SM.NewSAdvT=0}var e=TGN.SM.NewSAdvT;if(d){TGN.SM.NewSAdvT=1}else{TGN.SM.NewSAdvT=2}if(f&&typeof TGN.SM.NewSearchPanel!="undefined"){e=TGN.SM.NewSAdvT+1}if(e!=0&&e!=TGN.SM.NewSAdvT){TGN.SM.NewSearchPanel.destroy();if(TGN.SM.WaitPanel!=null){TGN.SM.WaitPanel.destroy()}TGN.SM.NewSearchPanel=null;TGN.SM.WaitPanel=null}if(typeof TGN.SM.NewSearchPanel=="undefined"||TGN.SM.NewSAdvT!=e||f){if(YAHOO.env.ua.ie>5&&YAHOO.env.ua.ie<=7){TGN.SM.ShowWaitMessage(TGN.I18N.getTrans("Loading"))}var a="clear";if(typeof b!="undefined"&&b){a="keep"}setTimeout("YAHOO.util.Connect.asyncRequest('GET', '/Mercury/Pages/AJAX/DefaultSearchTemplate.aspx"+c.replace(/'/g,"&#39;")+"', {success: TGN.SM.HandleSuccess, argument:['"+a+"'], failure: TGN.SM.HandleFailure})",1)}else{TGN.SM.ShowSearchPanel()}};TGN.SM.HideNewSearch=function(){if(typeof TGN.SM.NewSearchPanel!="undefined"){TGN.SM.NewSearchPanel.hide()}TGN.SM.HideWaitMessage()};TGN.SM.HideRefineSearch=function(){if(typeof TGN.SM.RefineSearchPanel!="undefined"){TGN.SM.RefineSearchPanel.hide()}TGN.SM.HideWaitMessage()};TGN.SM.InitRefineSearch=function(){TGN.SM.RefineSearchPanel=new YAHOO.widget.Panel("refineT_search-form",{close:true,draggable:true,modal:true,visible:false,width:450,underlay:"none"});TGN.SM.RefineSearchPanel.cfg.getProperty("strings").close=" ";TGN.SM.RefineSearchPanel.hideEvent.subscribe(function(){if(typeof TGN.KeyWatcher!="undefined"){TGN.KeyWatcher.unlockState();TGN.KeyWatcher.enable()}});TGN.SM.RefineSearchPanel.showEvent.subscribe(function(){if(typeof TGN.KeyWatcher!="undefined"){TGN.KeyWatcher.disable();TGN.KeyWatcher.lockState()}});TGN.SM.RefineSearchPanel.element.className+=" modal";var a=$("refineT_search-form");a.className=a.className.replace(" yui-panel","");TGN.SM.RefineSearchPanel.render(document.body);$("refineT_mod-search").innerHTML+="<span class='lnk-cancel'>&nbsp;"+TGN.I18N.getTrans("or")+"&nbsp;<a href='javascript:TGN.SM.HideRefineSearch();'>"+TGN.I18N.getTrans("newSearchCancel")+"</a></span>"};TGN.SM.LoadModTemplate=function(d){var e=$("ModTemplateStore");if(e!=null){if(d.responseText!="undefined"){if(YAHOO.env.ua.ie>5&&YAHOO.env.ua.ie<=7){e.innerHTML+=d.responseText}else{var c=document.createElement("div");c.innerHTML+=d.responseText;e.appendChild(c)}if(typeof TGN.KeyWatcher!="undefined"){TGN.KeyWatcher.addListeners()}if(d.argument[0]=="refine"){TGN.SM.InitRefineSearch();TGN.SM.PositionAndShow(TGN.SM.RefineSearchPanel,d.argument[1]+"_search-form");TGN.SM.ShowMore("more_"+d.argument[1],"moreLink_"+d.argument[1])}else{var a=0}if(d.argument[2]==true){TGN.SM.ClearAndSave(d.argument[1]+"_search-form")}if(YAHOO.env.ua.ie==7){var b=function(g,f){return function(){TGN.SM.SetACZ(g,f)}};setTimeout(b(TGN.SM.RefineSearchPanel.element,150),1)}}}};TGN.SM.ShowRefineLock=true;TGN.SM.ShowRefineSearchT=function(a){if(a){TGN.SM.ShowRefineSearchImpl("true")}else{TGN.SM.ShowRefineSearchImpl("false")}};TGN.SM.ShowRefineSearch=function(a,b){var c="false";if(typeof b!="undefined"&&b[1].keyCode==78){c="true"}TGN.SM.ShowRefineSearchImpl(c)};TGN.SM.ShowRefineSearchImpl=function(d,f){if(!TGN.SM.ShowRefineLock){return}else{TGN.SM.ShowRefineLock=false}if(typeof TGN.KeyWatcher!="undefined"){TGN.KeyWatcher.disable()}var b=$("refineT_msAV");var c=false;if(b!=null&&(b.value=="1"||b.value=="2")){c=true}setTimeout(function(){TGN.SM.TrackTemplate(d,c)},10);var a=document.location.search;var e=$("ModTemplateStore");if(e!=null){if(typeof TGN.SM.RefineSearchPanel!="undefined"){TGN.SM.PositionAndShow(TGN.SM.RefineSearchPanel);if(typeof f=="undefined"||f=="true"){TGN.SM.ShowMore("more_refineT","moreLink_refineT")}if(d=="true"){TGN.SM.ClearAndSave("refineT_search-form")}else{TGN.SM.RestoreClear("refineT_search-form")}}else{setTimeout("YAHOO.util.Connect.asyncRequest('GET', '/Mercury/Pages/AJAX/DefaultSearchTemplate.aspx"+a.replace(/'/g,"&#39;")+"&tDomId=refineT', {success: TGN.SM.LoadModTemplate, argument:['refine','refineT',"+d+"], failure: TGN.SM.HandleFailure})",1)}}if(typeof TGN.KeyWatcher!="undefined"){TGN.KeyWatcher.enable()}TGN.SM.ShowRefineLock=true};TGN.SM.getStyle=function(a,b){return null};if(document.body.currentStyle){TGN.SM.getStyle=function(a,b){return a.currentStyle[b]}}else{if(window.getComputedStyle){TGN.SM.getStyle=function(a,b){return document.defaultView.getComputedStyle(a,null).getPropertyValue(b)}}}TGN.SM.FocusFirstInput=function(b){try{var f=$(b).getElementsByTagName("input");var d=null;for(var c=0,a=f.length;c<a;c++){d=f[c].type;if(!f[c].disabled&&!f[c].readOnly&&("text"==d||"password"==d)){if(TGN.SM.isDisplayed(f[c])){var g=$(f[c].id);if(g.value!=null&&g.value==""){setTimeout(function(){if(g.value==""){try{g.focus()}catch(k){}}},1)}break}}}}catch(h){}};TGN.SM.isDisplayed=function(a){var b=a.form;while(a!=b){if(TGN.SM.getStyle(a,"display")=="none"||TGN.SM.getStyle(a,"visibility")=="hidden"){return false}else{a=a.parentNode}}return true};TGN.SM.NameHintShown=false;TGN.SM.NameHintListener=function(f,b,d){if(TGN.SM.NameHintShown){return}if(b.value!=null&&b.value.length>=4){TGN.SM.NameHintShown=true;var a=$(d+"_gSrchTipsName");var c=$(d+"_gSearchTips");if(typeof c!="undefined"&&typeof a!="undefined"){a.style.display="inline";c.style.display="inline"}YAHOO.util.Event.removeListener(b,"keyup",this)}};TGN.SM.NameHintCleared=false;TGN.SM.DateHintListener=function(g,c,f){TGN.SM.NameHintShown=true;var d=null;if(!TGN.SM.NameHintCleared){TGN.SM.NameHintCleared=true;var b=$(f+"_gSrchTipsName");d=$(f+"_gSearchTips");b.style.display="none";d.style.display="none"}if(c.value!=null&&c.value.length>=4){var a=c.value.match(/\d{4}/);if(a!==null&&a!=""){d=$(f+"_gSearchTips");var h=$(f+"_gSrchTipsDate");if(typeof d!="undefined"&&typeof h!="undefined"){if(a>1930){h.style.display="inline";d.style.display="inline"}else{if(a<=1930){h.style.display="none";d.style.display="none"}}}}}};TGN.SM.GetHitReason=function(a){switch(a){case"exact":return" matched exactly.";break;case"wildcard":return" matched a specified wildcard.";break;case"normalized":return" matched because of a normalized name match or a place authority lookup match.";break;case"initial":return" matched because the first letter of a specified name matches this initial.";break;case"soundex":return" matched based on Soundex which matches mispelled names or names that sound similar when pronounced (e.g. Smith, Smyth, and Smythe all sound alike).";break;case"proximity":return" matched because it was close to a date or location specified.";break;case"range":return" matched because it was within a range of dates, numbers, or text strings.";break;case"county":return" matched because the location specified does not correspond exactly but is contained within the same county.";break;case"state":return" matched because the location specified does not correspond exactly but is contained within the same state.";break;case"country":return" matched because the location specified does not correspond exactly but is contained within the same country.";break;default:break}return""};TGN.SM.GetHitShortReason=function(a){switch(a){case"exact":return" matched exactly.";break;case"wildcard":return" matched a wildcard.";break;case"normalized":return" matched a normalized name or place.";break;case"initial":return" matched first letter of a name.";break;case"soundex":return" matched based on Soundex.";break;case"proximity":return" matched by proximity.";break;case"range":return" matched range of dates, numbers, or text strings.";break;case"county":return" matched because location is contained within the same county.";break;case"state":return" matched because location but is contained within the same state.";break;case"country":return" matched because location is contained within the same country.";break;default:break}return""};TGN.SM.HideRecordHits=function(){if(null!=TGN.SM.HitDetailPanel){TGN.SM.HitDetailPanel.hide();TGN.SM.HitDetailPanel.destroy();TGN.SM.HitDetailPanel=null}};TGN.SM.IndivRecCallback={success:function(g){var f=g.responseXML;var d,e;if(f!=undefined){var a=f.selectNodes("/response/record/field");for(var c=0,b=a.length;c<b;c++){d=TGN.SM.GetText(a[c].childNodes[0]);if(d!="DBTitle"&&d!="ImageID"){e=TGN.SM.GetText(a[c].childNodes[1])}}}},failure:function(a){},argument:[]};TGN.SM.ShowRecordHits=function(){var d=document.createElement("div");d.setAttribute("id","HitDetail");document.body.appendChild(d);var o=450;var s='<table  border="0" cellpadding="0" cellspacing="0" class="srchTerms">';var f=document.getElementById("searchDescCategory");if(null!=f){s+="<tr><td>Category:</td><td>"+TGN.SM.GetText(f)+"</td></tr>"}var c=["Name","Birth","Death","FamilyMembers","Migration","MilitaryService","Marriage","Other"];for(j in c){f=document.getElementById("refine_"+c[j]+"_mod");if(undefined!=f){var p=f.getElementsByTagName("strong");var q=f.getElementsByTagName("span");if(q.length>0){var m=TGN.SM.GetText(q[0]);if(m!=null&&m.length>0){s+="<tr><td>"+TGN.SM.GetText(p[0])+"</td><td>"+m+"</td></tr>"}}}}s+="</table>";var n=$D.getAncestorByClassName(this,"record");if(null!=n){var r=$D.getElementsByClassName("srchFoundDB","span",n);if(r.length>0){var b=r[0].parentNode.innerHTML;var e=b.indexOf("showIndiv2(");if(e!=-1){e+=11;var k=b.indexOf(")",e);if(k!=-1){var h=b.slice(e,k).replace(/'/g,"").split(",");var a="/Mercury/Pages/Ajax/IndivRec.aspx?IndivAjax=1&recid="+h[2]+"&db="+h[1]+"&output=xml&Use302Redirect=t";if(h[4]){a+="&noSub=1"}if(h[9]){a+="&NonHover=1"}if(h[5]!=null&&h[6]!=null){a+="&iid="+h[5]+"&rc="+h[6]}if(h[7]!=null){a+="&"+h[7]}var g=YAHOO.util.Connect.asyncRequest("GET",a,TGN.SM.IndivRecCallback,null)}}}s+='<div id="results"><div id="results-main"><table  border="0" cellpadding="0" cellspacing="0" class="s_gsResults">'+n.innerHTML+'</table></div></div><div id="hitIndiv"></div><br />';o=n.offsetWidth+52}s+=TGN.SM.HitReason(this);s+='<br /><a class="closeBtn btn btn-cta" href="javascript:TGN.SM.HideRecordHits()"><span>Close</span></a>';TGN.SM.HitDetailPanel=new YAHOO.widget.Panel("HitDetail",{close:true,draggable:true,modal:true,visible:true,width:o,underlay:"none",effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}});TGN.SM.HitDetailPanel.setHeader("<h3>Why Am I Seeing This Record?</h3>");TGN.SM.HitDetailPanel.setBody(s);TGN.SM.HitDetailPanel.render(document.body);TGN.SM.PositionAndShow(TGN.SM.HitDetailPanel)};TGN.SM.HitReason=function(e){var c="";var f=e.getElementsByTagName("hlt");if(f.length!=0){c="This record is dispayed as a match for your search because the following items matched exactly or were considered similar to the terms you specified:<ul>";for(var d=0,a=f.length;d<a;d++){var b=f[d].attributes;c+='<li>"<strong>'+b.match.nodeValue+'</strong>" was found '+b.count.nodeValue+" times in this record and "+TGN.SM.GetHitReason(b.type.nodeValue)+" Total score: "+b.score.nodeValue+"</li>"}c+="</ul>The overall score calculated for this record was "+e.getAttribute("score")}return c};TGN.SM.HitReasonTip=function(h){var s="";var v=h.getElementsByTagName("hlt");if(v!=null&&v.length>0){var e=[];for(var g=0,f=v.length;g<f;g++){var o=99;switch(v[g].getAttribute("type")){case"exact":o=1;break;case"wildcard":o=2;break;case"normalized":o=3;break;case"initial":o=4;break;case"soundex":o=5;break;case"proximity":o=6;break;case"range":o=7;break;case"county":o=8;break;case"state":o=9;break;case"country":o=10;break;default:o=99;break}v[g].setAttribute("itype",o);e.push(v[g])}e.sort(function(n,m){var c=n.getAttribute("itype");var r=m.getAttribute("itype");if(c==r){return m.getAttribute("score")-n.getAttribute("score")}return c-r});var k="";s+="<ul>";for(var a in e){var q=e[a].attributes;var u=q.type.nodeValue;var d='"<strong>'+q.match.nodeValue+'</strong>"';var p=q.count.nodeValue!=null?1*q.count.nodeValue:0;if(p>1){d+=" ("+p+" occurrences)"}if(k==u){var b=a*1;if(b==e.length-1||u!=e[b+1].getAttribute("type")){s+=" and "+d}else{s+=", "+d}}else{if(a==0){s+="<li>"+d}else{s+=TGN.SM.GetHitShortReason(k)+"</li><li>"+d}k=u}}s+=TGN.SM.GetHitShortReason(k)+"</li></ul><br />Click for detailed reasons."}return s};TGN.SM.HitHighlightInit=function(){var e=YAHOO.util.Dom.getElementsByClassName("record","tr",$("results-main"));var g=0,q=0;var k=new Array();var d=new Array();for(var b in e){var o=e[b].getElementsByTagName("span");for(var t=0,f=o.length;t<f;t++){if(o[t].className.indexOf("stars")>-1){var n=o[t];n.id="star"+q++;n.onclick=TGN.SM.ShowRecordHits;var m=TGN.SM.HitReasonTip(n);if(m.length>0){n.title=m;d.push(n.id)}}if(o[t].className.indexOf("srchMatch")>-1){o[t].id="srchMatch"+g++;var a=TGN.SM.GetText(o[t]);var p=o[t].getAttribute("type");if(p!=null){o[t].title="<strong>"+a+"</strong>"+TGN.SM.GetHitShortReason(p)}k.push(o[t].id)}}}if(k.length!=0){var h=new YAHOO.widget.Tooltip("matchFieldTips",{appendtodocumentbody:true,context:k,width:"300px",autodismissdelay:10000,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.2}});h.element.className+=" alert"}if(d.length!=0){var c=new YAHOO.widget.Tooltip("whyMatchTip",{appendtodocumentbody:true,context:d,width:"300px",autodismissdelay:15000,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.2}});c.element.className+=" alert";c.setHeader("<h5>Why Am I Seeing This Record?</h5>")}};TGN.SM.GetText=function(a){if(a.innerText!=undefined){return a.innerText}if(a.textContent!=undefined){return a.textContent}if(a.innerHtml!=undefined){return a.innerHtml}return null};TGN.SM.SetText=function(b,a){if(b.innerText!=undefined){b.innerText=a}if(b.textContent!=undefined){b.textContent=a}};TGN.Search.BrowseDate.Calendar=function(c,b){var a="";a+='<div id="browse_body"><table width="408" id="calendar"><tr align="center" valign="top">';a+='<td height="30" colspan="7"><nobr><select class="calendar" id="Month" name="Month" onchange="TGN.Search.BrowseDate.changeMonth();">';var e=0;for(im=0;im<availMonths[b].length;im++){if(availMonths[b][im]==c){a+='<option value="'+availMonths[b][im]+'" SELECTED>'+monthNames[availMonths[b][im]-1]+"</option>";e=im}else{a+='<option value="'+availMonths[b][im]+'">'+monthNames[availMonths[b][im]-1]+"</option>"}}a+='</select>&nbsp;&nbsp;<select class="calendar" ID="Year" NAME="Year" onChange="TGN.Search.BrowseDate.changeYear();">';for(iy=0;iy<years.length;iy++){if(years[iy]==b){a+='<option value="'+years[iy]+'" SELECTED>'+years[iy]+"</option>"}else{a+='<option value="'+years[iy]+'">'+years[iy]+"</option>"}}a+="</select></nobr></td></tr>";firstDay=new Date(b,c-1,1);startDay=firstDay.getDay();if(((b%4==0)&&(b%100!=0))||(b%400==0)){browseDateDays[1]=29}else{browseDateDays[1]=28}a+='<tr id="days">';for(i=0;i<7;i++){a+="<td>"+dow[i]+"</td>"}a+='</tr><tr class="week">';var d=0;for(i=0;i<startDay;i++,d++){a+='<td class="blank">&nbsp;</td>'}for(i=1;i<=browseDateDays[c-1];i++,d++){if(availDays[b][e]&(1<<(i-1))){a+="<td><a href=\"javascript:TGN.Search.BrowseDate.submitDay('"+dbid+"',"+i+","+c+","+b+')">'+i+"</a></td>"}else{a+='<td class="blank">'+i+"</td>"}if(d==6&&i!=browseDateDays[c-1]){a+='</tr><tr class="week">';d=-1}}if(d>0){for(i=1;d<7;i++,d++){a+='<td class="blank">&nbsp;</td>'}}a+="</tr></table></div>";return a};TGN.Search.BrowseDate.submitDay=function(d,a,c,b){TGN.Search.BrowseDate.submitFromCalendar(a,c,b);setDictionaryCookie("BROWSES","bm",c,null,null);setDictionaryCookie("BROWSES","by",b,null,null)};TGN.Search.BrowseDate.submitFromCalendar=function(a,c,b){document.location="/Browse/view.aspx?dbid="+dbid+"&path="+b+"."+c+"."+a};TGN.Search.BrowseDate.fnReplaceHtml=function(c,b){var a=YAHOO.util.Dom.get(c);if("undefined"!=typeof a&&null!=a){var d=document.createElement(a.nodeName);d.id=a.id;d.className=a.className;d.innerHTML=b;a.parentNode.replaceChild(d,a)}return d};TGN.Search.BrowseDate.reload=function(d,c){var b=YAHOO.util.Dom.get("CalendarSpot");var a=TGN.Search.BrowseDate.Calendar(d,c);setDictionaryCookie("BROWSES","bm",d,null,null);setDictionaryCookie("BROWSES","by",c,null,null);TGN.Search.BrowseDate.fnReplaceHtml(b,a)};TGN.Search.BrowseDate.changeMonth=function(){var d=$("Month");var c=$("Year");var b=d.options[d.selectedIndex].value;var a=c.options[c.selectedIndex].value;TGN.Search.BrowseDate.reload(b,a);d.focus()};TGN.Search.BrowseDate.changeYear=function(){var e=$("Month");var d=$("Year");var c=e.options[e.selectedIndex].value;var a=d.options[d.selectedIndex].value;var b=false;for(i=0;i<availMonths[a].length;i++){if(c==availMonths[a][i]){b=true;break}}if(!b){c=availMonths[a][0]}TGN.Search.BrowseDate.reload(c,a);d.focus()};TGN.Search.BrowseDate.buildCalendar=function(){var a;var d=null;var e=null;var c=getQueryStringParameter("path");if(null!=c){var b=c.split(".");if(b.length>0&&b[0].length==4){d=b[0];if(b.length>1){e=b[1]}else{e=availMonths[d][0]}}}if(null==e||null==d||null==availMonths[d]){d=getDictionaryCookie("BROWSES","by");e=getDictionaryCookie("BROWSES","bm")}if(null==e||null==d||null==availMonths[d]){d=years[years.length-1];e=availMonths[d][availMonths[d].length-1]}a=TGN.Search.BrowseDate.Calendar(e,d);TGN.Search.BrowseDate.fnReplaceHtml("CalendarSpot",a)};var browseDateDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);TGN.Ancestry.Search.FamilyMemberContainer=function(){this.UniqueID="";this.PageType="Global";this.MaxFather=1;this.MaxMother=1;this.MaxSpouse=10;this.MaxChild=10;this.MaxSibling=10;this.CurrentRow=0;this.NotSetPrefix="msnotset";this.FatherFieldPrefix="msfn";this.MotherFieldPrefix="msmn";this.ChildFieldPrefix="mscn";this.SpouseFieldPrefix="mssn";this.SiblingFieldPrefix="msbn";this.RowIDPrefix="row_";this.SelectOptionIDPrefix="rel_";this.FirstNameIDPrefix="fmfn_";this.LastNameIDPrefix="fmln_";this.FirstNameExactIDPrefix="fmfnx_";this.LastNameExactIDPrefix="fmlnx_";this.FirstNameExactDivPrefix="fmfnxdiv_";this.LastNameExactDivPrefix="fmlnxdiv_";this.HasQueryValues=false;this.AvailableFields={f:{g:false,s:false},m:{g:true,s:true},s:{g:true,s:true},c:{g:true,s:true},b:{g:true,s:true}};this.FamilyMembers="{ }";this.Relationships={ns:0,f:0,m:0,s:0,c:0,b:0};this.Resources={HeadingFamilyMember:"Family Member",HeadingFirstName:"First Name",HeadingLastName:"Last Name",OptionFather:"Father",OptionMother:"Mother",OptionSpouse:"Spouse",OptionSibling:"Sibling",OptionChild:"Child",AddRowText:"Add Row",RemoveRowText:"Remove",ExactOnlyText:"Exact Only",ChooseText:"Choose...",NotAvailableText:"This value is not available in our index"};this.Init=function(a){this.PageType=this.GetSetting("PageType",a);this.MaxFather=this.GetSetting("MaxFather",a);this.MaxMother=this.GetSetting("MaxMother",a);this.MaxSpouse=this.GetSetting("MaxSpouse",a);this.MaxChild=this.GetSetting("MaxChild",a);this.MaxSibling=this.GetSetting("MaxSibling",a);this.Relationships=this.GetSetting("Relationships",a);this.HasQueryValues=this.GetSetting("HasQueryValues",a);this.FamilyMembers=this.GetSetting("FamilyMembers",a);this.AvailableFields=this.GetSetting("AvailableFields",a);this.UniqueID=this.GetSetting("UniqueID",a);this.Resources=this.GetSetting("Resources",a);this.AvailableFields=this.GetSetting("AvailableFields",a);this.Setup(a);this.ParentForm().FMC=this};this.SetMaximums=function(){if(!this.IsRelationshipAllowed("f")){this.MaxFather=0}if(!this.IsRelationshipAllowed("m")){this.MaxMother=0}if(!this.IsRelationshipAllowed("s")){this.MaxSpouse=0}if(!this.IsRelationshipAllowed("c")){this.MaxChild=0}if(!this.IsRelationshipAllowed("b")){this.MaxSibling=0}};this.AdjustSettingsBasedOnPageType=function(){if(this.PageType=="Collection"){this.MaxSpouse=1}};this.Setup=function(a){this.AdjustSettingsBasedOnPageType();this.SetMaximums();if(!this.HasQueryValues){this.AddRow("","","","","")}else{this.PopulateFromQueryString()}this.CheckHideEverything()};this.ParentForm=function(){return TGN.SM.InstContainer[this.UniqueID+"_search-form"]};this.PopulateFromQueryString=function(){for(var a=0;a<this.FamilyMembers.length;a++){this.AddRow(this.FamilyMembers[a].Relationship,this.FamilyMembers[a].FirstName,this.FamilyMembers[a].LastName,this.FamilyMembers[a].FirstNameExact,this.FamilyMembers[a].LastNameExact)}};this.AddRow=function(e,u,q,m,n){if(this.ShouldAbortAddRow(e,u,q)){return}if(null==u||"undefined"==u){u=""}if(null==q||"undefined"==q){q=""}var g=this.GetMainTable();var k=g.getElementsByTagName("tbody").item(0);var a=document.createElement("tr");var h=document.createElement("td");var f=document.createElement("td");var d=document.createElement("td");var c=document.createElement("td");h.innerHTML=this.RenderSelect(e);f.innerHTML=this.RenderFirstName(u,m);d.innerHTML=this.RenderLastName(q,n);c.innerHTML=this.RenderRemove();a.appendChild(h);a.appendChild(f);a.appendChild(d);a.appendChild(c);k.appendChild(a);this.SetID(a,this.RowIDPrefix+this.CurrentRow);a.setAttribute("rowid",this.CurrentRow);var s=this.GetEl(this.SelectOptionIDPrefix+this.CurrentRow);this.OptionChanged(s);if(typeof TGN.KeyWatcher!="undefined"){var r=this.GetControlID(this.CurrentRow,e,"g","");var p=this.GetControlID(this.CurrentRow,e,"s","");var o=this.GetEl(r);var t=this.GetEl(p);TGN.KeyWatcher.addListener(s);TGN.KeyWatcher.addListener(o);TGN.KeyWatcher.addListener(t)}this.CurrentRow++;this.CheckNoMoreRows();var b=this.CountSetRelationships();if(b>3){if(s.options[s.selectedIndex].value!=e){s.selectedIndex=1;this.OptionChanged(s)}}};this.RenderSelect=function(a){var c="";var b=this.SelectOptionIDPrefix+this.CurrentRow;c+='<select oldRel="0" class="ancSelect memRel cmbRel SMNoClear " id="'+this.GetID(b)+'" onchange="TGN.SM.InstMgr(\''+this.UniqueID+"_search-form','"+this.UniqueID+"').FMC.OptionChanged(this)\">";c+='<option sort="0" value="0" '+(a==""?"selected":"")+">"+this.Resources.ChooseText+"</option>";if(this.IsRelationshipAllowed("f")){c+='<option sort="1" value="f" '+(a=="f"?"selected":"")+">"+this.Resources.OptionFather+"</option>"}if(this.IsRelationshipAllowed("m")){c+='<option sort="2" value="m" '+(a=="m"?"selected":"")+">"+this.Resources.OptionMother+"</option>"}if(this.IsRelationshipAllowed("s")){c+='<option sort="3" value="s" '+(a=="s"?"selected":"")+">"+this.Resources.OptionSpouse+"</option>"}if(this.IsRelationshipAllowed("c")){c+='<option sort="4" value="c" '+(a=="c"?"selected":"")+">"+this.Resources.OptionChild+"</option>"}if(this.IsRelationshipAllowed("b")){c+='<option sort="5" value="b" '+(a=="b"?"selected":"")+">"+this.Resources.OptionSibling+"</option>"}c+="</select>";return c};this.RenderFirstName=function(d,f){var g="";var c=this.GetID(this.GetControlIDNew("g",""));var b=this.GetControlIDNew("g","");var k=this.GetID(this.GetControlIDNew("g","_x"));var h=this.GetControlIDNew("g","_x");var e=this.GetID(this.FirstNameExactDivPrefix+this.CurrentRow);var a="javascript:TGN.SM.InstMgr('"+this.UniqueID+"_search-form','"+this.UniqueID+"').ExactCBToggle(this)";if(null==d||"undefined"==d){d=""}if((null==f||undefined==f||"0"==f||""==f)){f=""}else{f='checked="yes"'}if(this.IsMatchAllExactChecked()){f='checked="yes"'}g='<div><input id="'+c+'" name="'+b+'" class="ancText field" type="text" value="'+d.replace(/"/g,"&quot;")+'" /></div><div id="'+e+'"><div class="sf-exact"><label><input id="'+k+'" name="'+h+'" class="ancCheckbox SM_advOpt" type="checkbox" '+f+' tabindex="9999" value="1" onclick="'+a+'" /> '+this.Resources.ExactOnlyText+"</label></div></div>";return g};this.RenderLastName=function(h,e){var f="";var c=this.GetID(this.GetControlIDNew("s",""));var b=this.GetControlIDNew("s","");var k=this.GetID(this.GetControlIDNew("s","_x"));var g=this.GetControlIDNew("s","_x");var d=this.GetID(this.LastNameExactDivPrefix+this.CurrentRow);var a="javascript:TGN.SM.InstMgr('"+this.UniqueID+"_search-form','"+this.UniqueID+"').ExactCBToggle(this)";if(null==h||"undefined"==h){h=""}if((null==e||undefined==e||"0"==e||""==e)){e=""}else{e='checked="yes"'}if(this.IsMatchAllExactChecked()){e='checked="yes"'}f='<div><input id="'+c+'" name="'+b+'" class="ancText field" type="text" value="'+h.replace(/"/g,"&quot;")+'" /></div><div id="'+d+'"><div class="sf-exact"><label><input id="'+k+'" name="'+g+'" class="ancCheckbox SM_advOpt" type="checkbox" '+e+' tabindex="9999" value="1" onclick="'+a+'" /> '+this.Resources.ExactOnlyText+"</label></div></div>";return f};this.RenderRemove=function(){var a="&nbsp;";a='<a href="javascript:;" tabindex="-1" onclick="TGN.SM.InstMgr(\''+this.UniqueID+"_search-form','"+this.UniqueID+"').FMC.RemoveRow(this)\">"+this.Resources.RemoveRowText+"</a>";return a};this.RemoveRow=function(a){var e=this.GetMainTable();var b=a.parentNode.parentNode.rowIndex;var d=this.GetEl(this.SelectOptionIDPrefix+(b-1).toString());var c=d.options[d.selectedIndex].value;e.deleteRow(b);this.Relationships[c]--;this.EnforceRelationships();this.RenumberControls();this.ReDoControlNames();this.CurrentRow--;this.CheckNoMoreRows()};this.Clear=function(){this.Relationships.ns=0;this.Relationships.m=0;this.Relationships.f=0;this.Relationships.s=0;this.Relationships.c=0;this.Relationships.b=0;this.CurrentRow=0;var c=this.GetMainTable();var a=c.rows;for(var b=c.rows.length-1;b>0;b--){c.deleteRow(b)}};this.OptionChanged=function(a){this.SetRelationshipCounts(a);this.EnforceRelationships();this.SetControlIDsRow(a.parentNode.parentNode.getAttribute("rowid"));this.CheckDisableEnabledState(a);this.ReDoControlNames();this.ShowHideAvailableFields(a);this.EnforceCheckboxRules(a)};this.HideExact=function(b,c,a){$(b.replace(this.SelectOptionIDPrefix,this.FirstNameExactDivPrefix)).style.display="none";$(b.replace(this.SelectOptionIDPrefix,this.LastNameExactDivPrefix)).style.display="none";this.GetEl(this.GetControlID(c,a,"g","_x")).style.display="none";this.GetEl(this.GetControlID(c,a,"s","_x")).style.display="none"};this.ShowExact=function(e,a,k){var h=$(e.replace(this.SelectOptionIDPrefix,this.FirstNameExactDivPrefix));var g=$(e.replace(this.SelectOptionIDPrefix,this.LastNameExactDivPrefix));var c=this.GetEl(this.GetControlID(a,k,"g",""));var b=this.GetEl(this.GetControlID(a,k,"s",""));var f=this.GetEl(this.GetControlID(a,k,"g","_x"));var d=this.GetEl(this.GetControlID(a,k,"s","_x"));if(c.readOnly!=true){h.style.display="";f.style.display="";if(this.IsMatchAllExactChecked()){f.checked=true}}else{h.style.display="none";f.style.display="none"}if(b.readOnly!=true){g.style.display="";d.style.display="";if(this.IsMatchAllExactChecked()){d.checked=true}}else{g.style.display="none";d.style.display="none"}};this.EnforceCheckboxRules=function(c){var b=c.parentNode.parentNode.getAttribute("rowid");var a=c.options[c.selectedIndex].value;switch(a){case"m":this.ShowExact(c.id,b,a);break;case"f":this.ShowExact(c.id,b,a);break;case"s":this.ShowExact(c.id,b,a);break;case"c":this.HideExact(c.id,b,a);break;case"b":this.HideExact(c.id,b,a);break;default:this.HideExact(c.id,b,a);break}};this.CheckDisableEnabledState=function(c){var f="";var p="";var m="";var g="";var b=c.options[c.selectedIndex].value;var h=this.GetRelationshipPrefix(b);var d=c.parentNode.parentNode;var a=d.getAttribute("rowid");var q=c.options[c.selectedIndex].value;f=this.GetControlID(a,q,"g","");p=this.GetControlID(a,q,"s","");m=this.GetControlID(a,q,"g","_x");g=this.GetControlID(a,q,"s","_x");var o=this.GetEl(f);var n=this.GetEl(p);var e=this.GetEl(m);var k=this.GetEl(g);if(b=="0"){this.EnableDisableField(o,false);this.EnableDisableField(n,false);e.setAttribute("readonly","true");k.setAttribute("readonly","true")}else{this.EnableDisableField(o,true);this.EnableDisableField(n,true);e.removeAttribute("readonly","true");k.removeAttribute("readonly","true")}};this.ReDoControlNames=function(){var e=this.GetMainTable();var h=e.getElementsByTagName("tr");var c={"0":0,f:0,m:0,s:0,c:0,b:0};for(var g=0;g<(h.length);g++){if(g>0){try{var m=(g-1).toString();var d=h[g];var a=this.GetEl(this.SelectOptionIDPrefix+m);var b=a.options[a.selectedIndex].value;var o=this.GetEl(this.GetRelationshipPrefix(b)+"g"+m);var n=this.GetEl(this.GetRelationshipPrefix(b)+"s"+m);var k=this.GetEl(this.GetRelationshipPrefix(b)+"g"+m+"_x");var p=this.GetEl(this.GetRelationshipPrefix(b)+"s"+m+"_x");o.name=this.GetRelationshipPrefix(b)+"g"+c[b].toString();n.name=this.GetRelationshipPrefix(b)+"s"+c[b].toString();k.name=this.GetRelationshipPrefix(b)+"g"+c[b].toString()+"_x";p.name=this.GetRelationshipPrefix(b)+"s"+c[b].toString()+"_x";c[b]++}catch(f){}}}};this.SetControlIDsRow=function(g,e){var b=this.GetEl(this.SelectOptionIDPrefix+g);var f=b.options[b.selectedIndex].value;var m=b.getAttribute("oldRel");var k="";var h="";var o="";var a="";if(null==e||"undefined"==e){e=g}k=this.GetRelationshipPrefix(m);h=this.GetRelationshipPrefix(f);b.setAttribute("oldRel",f);a=e.toString();if(h==""){return""}o=g.toString();var r=this.GetEl(k+"g"+o);var q=this.GetEl(k+"s"+o);var d=this.GetEl(k+"g"+o+"_x");var s=this.GetEl(k+"s"+o+"_x");var n=this.GetEl(this.FirstNameExactDivPrefix+o);var p=this.GetEl(this.LastNameExactDivPrefix+o);var c=b.parentNode.parentNode;this.SetID(c,this.RowIDPrefix+e.toString());c.setAttribute("rowid",e.toString());this.SetID(b,this.SelectOptionIDPrefix+e.toString());this.SetID(r,h+"g"+a);this.SetID(q,h+"s"+a);this.SetID(d,h+"g"+a+"_x");this.SetID(s,h+"s"+a+"_x");this.SetID(n,this.FirstNameExactDivPrefix+a);this.SetID(p,this.LastNameExactDivPrefix+a);return""};this.RenumberControls=function(){var e=this.GetMainTable();var a=e.getElementsByTagName("tr");for(var c=0;c<(a.length);c++){if(c>0){try{var b=a[c];this.SetControlIDsRow(b.getAttribute("rowid"),c-1)}catch(d){}}}};this.SetRelationshipCounts=function(b){var c=b.options[b.selectedIndex].value;var a=b.getAttribute("oldRel");if(c==a){a="-1"}switch(a){case"0":this.Relationships.ns--;break;case"m":this.Relationships.m--;break;case"f":this.Relationships.f--;break;case"s":this.Relationships.s--;break;case"c":this.Relationships.c--;break;case"b":this.Relationships.b--;break}switch(c){case"0":this.Relationships.ns++;break;case"m":this.Relationships.m++;break;case"f":this.Relationships.f++;break;case"s":this.Relationships.s++;break;case"c":this.Relationships.c++;break;case"b":this.Relationships.b++;break}};this.EnforceRelationships=function(){var b=(this.Relationships.m>=this.MaxMother);var g=(this.Relationships.f>=this.MaxFather);var v=(this.Relationships.s>=this.MaxSpouse);var k=(this.Relationships.c>=this.MaxChild);var n=(this.Relationships.b>=this.MaxSibling);var h=(this.AvailableFields.f.g==false&&this.AvailableFields.f.s==false);var u=(this.AvailableFields.m.g==false&&this.AvailableFields.m.s==false);var s=(this.AvailableFields.s.g==false&&this.AvailableFields.s.s==false);var p=(this.AvailableFields.c.g==false&&this.AvailableFields.c.s==false);var e=(this.AvailableFields.b.g==false&&this.AvailableFields.b.s==false);var r;var d=this.GetMainTable();var f=d.getElementsByTagName("tr");for(var t=0;t<(f.length);t++){if(t>0){var a=f[t];var m=a.getAttribute("rowid");var o=this.GetEl(this.SelectOptionIDPrefix+m);var c=o.options[o.selectedIndex].value;var q=o.selectedIndex;if(g&&c!="f"){this.RemoveSelectOptionByValue(o,"f")}else{if(!this.DoesSelectHaveValue(o,"f")&&!h){r=new Option(this.Resources.OptionFather,"f",false,false);o.options[o.length]=r;this.SortSelect(o)}}if(b&&c!="m"){this.RemoveSelectOptionByValue(o,"m")}else{if(!this.DoesSelectHaveValue(o,"m")&&!u){r=new Option(this.Resources.OptionMother,"m",false,false);o.options[o.length]=r;this.SortSelect(o)}}if(v&&c!="s"){this.RemoveSelectOptionByValue(o,"s")}else{if(!this.DoesSelectHaveValue(o,"s")&&!s){r=new Option(this.Resources.OptionSpouse,"s",false,false);o.options[o.length]=r;this.SortSelect(o)}}if(k&&c!="c"){this.RemoveSelectOptionByValue(o,"c")}else{if(!this.DoesSelectHaveValue(o,"c")&&!p){r=new Option(this.Resources.OptionChild,"c",false,false);o.options[o.length]=r;this.SortSelect(o)}}if(n&&c!="b"){this.RemoveSelectOptionByValue(o,"b")}else{if(!this.DoesSelectHaveValue(o,"b")&&!e){r=new Option(this.Resources.OptionSibling,"b",false,false);o.options[o.length]=r;this.SortSelect(o)}}}}};this.RemoveSelectOptionByValue=function(d,c){for(var a=0;a<d.length;a++){var b=d.options[a];if(b.value==c){d.remove(a)}}};this.SortSelect=function(a){var b=document.createElement("select");b=a;this.SortIndividualOption(b,a,"0");if(this.IsRelationshipAllowed("f")){this.SortIndividualOption(b,a,"f")}if(this.IsRelationshipAllowed("m")){this.SortIndividualOption(b,a,"m")}if(this.IsRelationshipAllowed("s")){this.SortIndividualOption(b,a,"s")}if(this.IsRelationshipAllowed("c")){this.SortIndividualOption(b,a,"c")}if(this.IsRelationshipAllowed("b")){this.SortIndividualOption(b,a,"b")}};this.SortIndividualOption=function(f,b,a){for(var c=0;c<f.length;c++){var d=f.options[c];if(d.value==a){try{b.options[b.length]=d}catch(e){b.appendChild(d)}return}}};this.IsRelationshipAllowed=function(a){if(null==a||"undefined"==a||a==""||a=="0"){return true}if(this.AvailableFields[a].g==true||this.AvailableFields[a].s==true){return true}return false};this.GetRelationshipPrefix=function(a){var b="";switch(a){case"f":b=this.FatherFieldPrefix;break;case"m":b=this.MotherFieldPrefix;break;case"s":b=this.SpouseFieldPrefix;break;case"c":b=this.ChildFieldPrefix;break;case"b":b=this.SiblingFieldPrefix;break;default:b=this.NotSetPrefix;break}return b};this.DoesSelectHaveValue=function(d,b){for(var a=0;a<d.length;a++){var c=d.options[a];if(c.value==b){return true}}return false};this.GetControlIDNew=function(c,b){var d=this.NotSetPrefix;var a=this.CurrentRow;var e=d+c+a+b;return e};this.GetControlID=function(b,a,e,d){var g=this.GetRelationshipPrefix(a);var f=(null==d?"":d);var c=b.toString();var h=g+e+c+f;return h};this.SetName=function(b,a){b.name=a};this.GetID=function(a){return a+"_"+this.UniqueID};this.SetID=function(a,b){a.id=b+"_"+this.UniqueID};this.GetMainID=function(){return"FMC_"+this.UniqueID};this.GetMainTable=function(){return document.getElementById("fmcTable_"+this.UniqueID)};this.GetEl=function(a){return document.getElementById(a+"_"+this.UniqueID)};this.GetSetting=function(b,a){if(null!=a[b]&&"undefined"!=a[b]){return a[b]}else{return this[b]}};this.ShouldAbortAddRow=function(a,d,b){var c=false;switch(a){case"f":if(this.Relationships.f>=this.MaxFather){c=true}break;case"m":if(this.Relationships.m>=this.MaxMother){c=true}break;case"s":if(this.Relationships.s>=this.MaxSpouse){c=true}break;case"c":if(this.Relationships.c>=this.MaxChild){c=true}break;case"b":if(this.Relationships.b>=this.MaxSibling){c=true}break}if(null==d||"undefined"==d){d=""}if(null==b||"undefined"==b){b=""}if(this.MaximumReached()){c=true}if(!this.IsRelationshipAllowed(a)){c=true}return c};this.MaximumReached=function(){if(this.CurrentRow==this.GetMaxAllowedRows()){return true}return false};this.CheckNoMoreRows=function(){var a=this.GetEl("fmcAddLink");if(this.CurrentRow>=this.GetMaxAllowedRows()){a.style.display="none"}else{a.style.display=""}};this.ShowHideAvailableFields=function(d){var g=true;var o=true;var m=d.options[d.selectedIndex].value;var e=d.parentNode.parentNode;var c=e.getAttribute("rowid");switch(m){case"f":if(this.AvailableFields.f.g!=true){g=false}if(this.AvailableFields.f.s!=true){o=false}break;case"m":if(this.AvailableFields.m.g!=true){g=false}if(this.AvailableFields.m.s!=true){o=false}break;case"s":if(this.AvailableFields.s.g!=true){g=false}if(this.AvailableFields.s.s!=true){o=false}break;case"c":if(this.AvailableFields.c.g!=true){g=false}if(this.AvailableFields.c.s!=true){o=false}break;case"b":if(this.AvailableFields.b.g!=true){g=false}if(this.AvailableFields.b.s!=true){o=false}break;case"0":break}var b=this.GetID(this.GetControlID(c,m,"g",""));var n=this.GetID(this.GetControlID(c,m,"s",""));var k=document.getElementById(b);var a=this.GetEl(this.FirstNameExactDivPrefix+c);var f=document.getElementById(n);var h=this.GetEl(this.LastNameExactDivPrefix+c);if(g==false){this.EnableDisableField(k,false);k.setAttribute("title",this.Resources.NotAvailableText);a.style.display="none"}else{k.setAttribute("title","");a.style.display=""}if(o==false){this.EnableDisableField(f,false);f.setAttribute("title",this.Resources.NotAvailableText);h.style.display="none"}else{f.setAttribute("title","");h.style.display=""}};this.IsMatchAllExactChecked=function(){var a=document.getElementById(this.UniqueID+"_xcb");if(a.checked){return true}else{return false}};this.GetMaxAllowedRows=function(){var a=this.MaxFather+this.MaxMother+this.MaxSpouse+this.MaxChild+this.MaxSibling;return a};this.RemoveBlankRows=function(){var g=this.GetMainTable();var b=g.getElementsByTagName("tr");for(var f=0;f<(b.length);f++){if(f>0){var e=b[f];var d=e.getAttribute("rowid");var c=this.GetEl(this.SelectOptionIDPrefix+d);var a=c.options[c.selectedIndex].value;if(a=="0"){this.RemoveRow(e)}}}};this.GetRelNumber=function(a){var b=0;if(null==a||"undefined"==a){a=""}switch(a){case"":case"0":b=this.Relationships.ns;break;case"f":b=this.Relationships.f;break;case"m":b=this.Relationships.m;break;case"s":b=this.Relationships.s;break;case"c":b=this.Relationships.c;break;case"b":b=this.Relationships.b;break}if(b>0){b--}return b};this.EnableDisableField=function(a,b){if(b==false){a.setAttribute("readonly","true");a.readOnly=true;a.className=a.className+" disabled"}else{a.removeAttribute("readonly","true");a.readOnly=false;a.className=a.className.replace(" disabled","")}};this.CheckHideEverything=function(){if(!this.AvailableFields.f.g&&!this.AvailableFields.f.s&&!this.AvailableFields.m.g&&!this.AvailableFields.m.s&&!this.AvailableFields.s.g&&!this.AvailableFields.s.s&&!this.AvailableFields.c.g&&!this.AvailableFields.c.s&&!this.AvailableFields.b.g&&!this.AvailableFields.b.s){var a=this.GetEl("FMC");a.style.display="none"}};this.CountSetRelationships=function(){var a=0;if(!this.AvailableFields.f.g&&!this.AvailableFields.f.s){a++}if(!this.AvailableFields.m.g&&!this.AvailableFields.m.s){a++}if(!this.AvailableFields.s.g&&!this.AvailableFields.s.s){a++}if(!this.AvailableFields.c.g&&!this.AvailableFields.c.s){a++}if(!this.AvailableFields.b.g&&!this.AvailableFields.b.s){a++}return a}};