var edit_window_specs="width=620,height=600,left=75,top=50,resizable=1,scrollbars=1",indx_window_specs="width=600,height=600,left=75,top=50,resizable=1,scrollbars=1",news_window_specs="width=620,height=600,left=75,top=50,resizable=1,scrollbars=1",find_window_specs="width=550,height=600,left=75,top=50,resizable=1,scrollbars=1",mesg_window_specs="width=620,height=600,left=75,top=50,resizable=1,scrollbars=1",chan_window_specs="width=600,height=600,left=75,top=50,resizable=1,scrollbars=1",mord_window_specs="width=500,height=600,left=75,top=50,resizable=1,scrollbars=1",assist_window_specs="width=800,height=600,left=75,top=50,resizable=1,scrollbars=1",gmap_window_specs="width=650,height=600,left=75,top=50,resizable=1,scrollbars=1",fam_nav_specs="width=350,height=550,left=25,top=75,resizable=1,scrollbars=1",pastefield,nameElement,remElement,textDirection=jQuery("html").attr("dir");function helpDialog(b,d){jQuery.getJSON("help_text.php?help="+b+"&mod="+d,function(c){modalNotes(c.content,c.title)})}function modalNotes(b,d){jQuery('
').html(b).dialog({modal:!0,width:500,open:function(){var c=this;jQuery(".ui-widget-overlay").on("click",function(){jQuery(c).dialog("close")})}});return !1}function closePopupAndReloadParent(b){parent.opener&&(b?parent.opener.location=b:parent.opener.location.reload());window.close()}function expand_layer(b){jQuery("#"+b+"_img").toggleClass("icon-plus icon-minus");jQuery("#"+b).slideToggle("fast");jQuery("#"+b+"-alt").toggle();return !1}function edit_interface(b,f,d){f=f||edit_window_specs;window.pastefield=d;b="edit_interface.php?"+jQuery.param(b)+"&ged="+WT_GEDCOM;window.open(b,"_blank",f);return !1}function edit_record(b,d){return edit_interface({action:"edit",xref:b,fact_id:d})}function add_fact(b,d){return edit_interface({action:"add",xref:b,fact:d})}function edit_raw(b){return edit_interface({action:"editraw",xref:b})}function edit_note(b){return edit_interface({action:"editnote",xref:b})}function add_record(b,f){var d=jQuery("#"+f).val();if(d){if("OBJE"===d){window.open("addmedia.php?action=showmediaform&linkid="+encodeURIComponent(b)+"&ged="+encodeURIComponent(WT_GEDCOM),"_blank",edit_window_specs)}else{return add_fact(b,d)}}return !1}function reorder_media(b){return edit_interface({action:"reorder_media",xref:b},mord_window_specs)}function add_new_record(b,d){return edit_interface({action:"add",xref:b,fact:d})}function add_child_to_family(b,d){return edit_interface({action:"add_child_to_family",gender:d,xref:b})}function add_child_to_individual(b,d){return edit_interface({action:"add_child_to_individual",gender:d,xref:b})}function add_parent_to_individual(b,d){return edit_interface({action:"add_parent_to_individual",xref:b,gender:d})}function add_spouse_to_family(b,d){return edit_interface({action:"add_spouse_to_family",xref:b,famtag:d})}function add_unlinked_indi(){return edit_interface({action:"add_unlinked_indi"})}function add_spouse_to_individual(b,d){return edit_interface({action:"add_spouse_to_individual",xref:b,famtag:d})}function linkspouse(b,d){return edit_interface({action:"linkspouse",xref:b,famtag:d,famid:"new"})}function add_famc(b){return edit_interface({action:"addfamlink",xref:b})}function edit_name(b,d){return edit_interface({action:"editname",xref:b,fact_id:d})}function add_name(b){return edit_interface({action:"addname",xref:b})}function accept_changes(b){jQuery.post("action.php",{action:"accept-changes",xref:b,ged:WT_GEDCOM,csrf:WT_CSRF_TOKEN},function(){location.reload()});return !1}function reject_changes(b){jQuery.post("action.php",{action:"reject-changes",xref:b,ged:WT_GEDCOM,csrf:WT_CSRF_TOKEN},function(){location.reload()});return !1}function delete_record(b,f,d){confirm(b)&&jQuery.post("action.php",{action:"delete-record",xref:f,ged:"undefined"===typeof d?WT_GEDCOM:d,csrf:WT_CSRF_TOKEN},function(){location.reload()});return !1}function delete_fact(b,f,d){confirm(b)&&jQuery.post("action.php",{action:"delete-fact",xref:f,fact_id:d,ged:WT_GEDCOM,csrf:WT_CSRF_TOKEN},function(){location.reload()});return !1}function unlink_media(b,f,d){confirm(b)&&jQuery.post("action.php",{action:"unlink-media",source:f,target:d,ged:WT_GEDCOM,csrf:WT_CSRF_TOKEN},function(){location.reload()});return !1}function copy_fact(b,d){jQuery.post("action.php",{action:"copy-fact",xref:b,fact_id:d,ged:WT_GEDCOM,csrf:WT_CSRF_TOKEN},function(){location.reload()});return !1}function paste_fact(b,d){jQuery.post("action.php",{action:"paste-fact",xref:b,fact_id:jQuery(d).val(),ged:WT_GEDCOM,csrf:WT_CSRF_TOKEN},function(){location.reload()});return !1}function delete_user(b,d){confirm(b)&&jQuery.post("action.php",{action:"delete-user",user_id:d,csrf:WT_CSRF_TOKEN},function(){location.reload()});return !1}function masquerade(b){jQuery.post("action.php",{action:"masquerade",user_id:b,csrf:WT_CSRF_TOKEN},function(){location.reload()});return !1}function reorder_children(b){return edit_interface({action:"reorder_children",xref:b})}function reorder_families(b){return edit_interface({action:"reorder_fams",xref:b})}function reply(b,d){window.open("message.php?to="+encodeURIComponent(b)+"&subject="+encodeURIComponent(d)+"&ged="+encodeURIComponent(WT_GEDCOM),"_blank",mesg_window_specs);return !1}function delete_message(b){window.open("message.php?action=delete&id="+encodeURIComponent(b)+"&ged="+encodeURIComponent(WT_GEDCOM),"_blank",mesg_window_specs);return !1}function change_family_members(b){return edit_interface({action:"changefamily",xref:b})}function addnewsource(b){return edit_interface({action:"addnewsource",xref:"newsour"},null,b)}function addnewrepository(b){return edit_interface({action:"addnewrepository",xref:"newrepo"},null,b)}function addnewnote(b){return edit_interface({action:"addnewnote",noteid:"newnote"},null,b)}function addnewnote_assisted(b,f,d){return edit_interface({action:"addnewnote_assisted",noteid:"newnote",xref:f,census:d},assist_window_specs,b)}function addmedia_links(b,f,d){pastefield=b;insertRowToTable(f,d);return !1}function valid_date(v){var t="JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC".split(" "),r="MUHAR SAFAR RABIA RABIT JUMAA JUMAT RAJAB SHAAB RAMAD SHAWW DHUAQ DHUAH".split(" "),u="TSH CSH KSL TVT SHV ADR ADS NSN IYR SVN TMZ AAV ELL".split(" "),p="VEND BRUM FRIM NIVO PLUV VENT GERM FLOR PRAI MESS THER FRUC COMP".split(" "),q="FARVA ORDIB KHORD TIR MORDA SHAHR MEHR ABAN AZAR DEY BAHMA ESFAN".split(" "),s=v.value,o=s.split("("),n="";1=u&&12>=p||13=u&&12>=p&&31=u&&31>=p||13=p&&12>=u&&31=p&&31>=q||13=q&&12>=p&&31]([\w ]+)$/,"AFT $1");s=s.replace(/^[<]([\w ]+)$/,"BEF $1");s=s.replace(/^([\w ]+)[-]$/,"FROM $1");s=s.replace(/^[-]([\w ]+)$/,"TO $1");s=s.replace(/^[~]([\w ]+)$/,"ABT $1");s=s.replace(/^[*]([\w ]+)$/,"EST $1");s=s.replace(/^[#]([\w ]+)$/,"CAL $1");s=s.replace(/^([\w ]+) ?- ?([\w ]+)$/,"BET $1 AND $2");s=s.replace(/^([\w ]+) ?~ ?([\w ]+)$/,"FROM $1 TO $2");s=s.replace(/(JANUARY)/,"JAN");s=s.replace(/(FEBRUARY)/,"FEB");s=s.replace(/(MARCH)/,"MAR");s=s.replace(/(APRIL)/,"APR");s=s.replace(/(MAY)/,"MAY");s=s.replace(/(JUNE)/,"JUN");s=s.replace(/(JULY)/,"JUL");s=s.replace(/(AUGUST)/,"AUG");s=s.replace(/(SEPTEMBER)/,"SEP");s=s.replace(/(OCTOBER)/,"OCT");s=s.replace(/(NOVEMBER)/,"NOV");s=s.replace(/(DECEMBER)/,"DEC");s=s.replace(/(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)\.? (\d\d?)[, ]+(\d\d\d\d)/,"$2 $1 $3");s=s.replace(/(^| )(\d [A-Z]{3,5} \d{4})/,"$10$2");n&&(s=s+" ("+n);v.value!==s&&(v.value=s)}var menutimeouts=[];function show_submenu(j,p){var n=document.body.scrollWidth+document.documentElement.scrollLeft,i=document.getElementById(j);if(i&&i.style){for(var n=document.all?document.body.offsetWidth:document.body.scrollWidth+document.documentElement.scrollLeft-55,l=0,m=i.childNodes.length,o=0;ol+5&&(l=k.offsetWidth)}i.offsetWidthn&&(i.style.left=n-i.offsetWidth+"px")}0>i.offsetLeft&&(i.style.left="0px");500b&&(weekStart=b)}function cal_toggleDate(f,h){var g=document.getElementById(f);if(!g){return !1}if("visible"===g.style.visibility){return g.style.visibility="hidden",!1}if("show"===g.style.visibility){return g.style.visibility="hide",!1}var d=document.getElementById(h);if(!d){return !1}d=/((\d+ (JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) )?\d+)/.exec(d.value)?new Date(RegExp.$1):new Date;g.innerHTML=cal_generateSelectorContent(h,f,d);if("hidden"===g.style.visibility){return g.style.visibility="visible",!1}"hide"===g.style.visibility&&(g.style.visibility="show");return !1}function cal_generateSelectorContent(i,n,l){var h,j,k;k=''+('"+('";k+='";k+='";return k+="
';k+='';k+="";j=weekStart;for(h=0;7>h;h++){k+="";for(h=0;7>h;h++){k+="",m=m.getTime()+86400000,m=new Date(m)}k+=""}k+="
",j++,6";var m=new Date(l.getFullYear(),l.getMonth(),1);h=m.getDay();h-=weekStart;m=m.getTime()-86400000*h+43200000;m=new Date(m);for(j=0;6>j;j++){k+="
',k+=m.getDate(),k+="
";k+="
"}function cal_setDateField(f,h,g,d){f=document.getElementById(f);if(!f){return !1}10>d&&(d="0"+d);f.value=d+" "+monthShort[g+1]+" "+h;return !1}function cal_updateCalendar(f,j){var i=document.getElementById(f+"_daySelect");if(!i){return !1}var d=document.getElementById(f+"_monSelect");if(!d){return !1}var h=document.getElementById(f+"_yearInput");if(!h){return !1}d=parseInt(d.options[d.selectedIndex].value,10);i=new Date(h.value,d-1,i.options[i.selectedIndex].value);cal_setDateField(f,i.getFullYear(),i.getMonth(),i.getDate());h=document.getElementById(j);if(!h){return alert("no dateDiv "+j),!1}h.innerHTML=cal_generateSelectorContent(f,j,i);return !1}function cal_dateClicked(f,j,i,d,h){cal_setDateField(f,i,d,h);cal_toggleDate(j,f);return !1}function findWindow(f,h,g,d){d=d||{};d.type=h;d.ged="undefined"===typeof f?WT_GEDCOM:f;window.pastefield=g;window.open("find.php?"+jQuery.param(d),"_blank",find_window_specs);return !1}function findIndi(b,f,d){window.nameElement=f;return findWindow(d,"indi",b)}function findPlace(b,d){return findWindow(d,"place",b)}function findFamily(b,d){return findWindow(d,"fam",b)}function findMedia(b,f,d){return findWindow(d,"media",b,{choose:f||"0all"})}function findSource(b,f,d){window.nameElement=f;return findWindow(d,"source",b)}function findnote(b,f,d){window.nameElement=f;return findWindow(d,"note",b)}function findRepository(b,d){return findWindow(d,"repo",b)}function findSpecialChar(b){return findWindow(void 0,"specialchar",b)}function findFact(b,d){return findWindow(void 0,"fact"+d,document.getElementById(b),{tags:document.getElementById(b).value})}function openerpasteid(b){window.opener.paste_id&&window.opener.paste_id(b);window.close()}function paste_id(b){pastefield.value=b}function pastename(b){nameElement&&(nameElement.innerHTML=b);remElement&&(remElement.style.display="block")}function paste_char(b){document.selection?(pastefield.focus(),document.selection.createRange().text=b):pastefield.selectionStart||0===pastefield.selectionStart?(pastefield.value=pastefield.value.substring(0,pastefield.selectionStart)+b+pastefield.value.substring(pastefield.selectionEnd,pastefield.value.length),pastefield.selectionStart=pastefield.selectionEnd=pastefield.selectionStart+b.length):pastefield.value+=b;"NPFX"!==pastefield.id&&"GIVN"!==pastefield.id&&"SPFX"!==pastefield.id&&"SURN"!==pastefield.id&&"NSFX"!==pastefield.id||updatewholename()}function ilinkitem(b,f,d){d="undefined"===typeof d?WT_GEDCOM:d;window.open("inverselink.php?mediaid="+encodeURIComponent(b)+"&linkto="+encodeURIComponent(f)+"&ged="+encodeURIComponent(d),"_blank",find_window_specs);return !1}function message(b,f,d){window.open("message.php?to="+encodeURIComponent(b)+"&method="+encodeURIComponent(f)+"&url="+encodeURIComponent(d),"_blank",mesg_window_specs);return !1}function persistent_toggle(h,l){var k=document.getElementById(h),d=document.querySelectorAll(l),i=localStorage.getItem(h);if(k){""!==i&&(i="none");k.checked=""===i;for(var j=0;j