var EDIT_WIZARD_GET_COMPONENT_API="/FP/API/Profile/getEditProfileComponent.php";var EDIT_WIZARD_COMPONENT_TYPE_BIOGRAPHY=1;var EDIT_WIZARD_COMPONENT_TYPE_ADDRESS=2;var EDIT_WIZARD_COMPONENT_TYPE_EMAIL=3;var EDIT_WIZARD_COMPONENT_TYPE_PHONE=4;var EDIT_WIZARD_COMPONENT_TYPE_FAX=5;var EDIT_WIZARD_COMPONENT_TYPE_WEB=6;var EDIT_WIZARD_COMPONENT_TYPE_WORK=7;var EDIT_WIZARD_COMPONENT_TYPE_EDUCATION=8;var EDIT_WIZARD_COMPONENT_TYPE_CITATION=9;var nonWhiteSpaceRE=/\S/;var itemSampleSnippetIdRE=/__/g;var formFieldValues=null;function saveFormFields(){formFieldValues=getFormFields()}function isFormChanged(){var a=getFormFields();return(a!=formFieldValues)}function getFormFields(){var e=document.getElementById("editProfileForm");if(e){var b=new Array();var a=0;var d=e.getElementsByTagName("input");for(var c=0;c<d.length;c++){var h=d[c];if(h.type=="text"||h.type=="hidden"){b[a++]=h.id;b[a++]=h.value}else{if(h.type=="checkbox"){b[a++]=h.id;b[a++]=h.checked?1:0}else{if(h.type=="radio"){b[a++]=h.id;b[a++]=h.checked?1:0}}}}var f=e.getElementsByTagName("select");for(var c=0;c<f.length;c++){var j=f[c];b[a++]=j.id;b[a++]=j.selectedIndex}var g=e.getElementsByTagName("textarea");for(var c=0;c<g.length;c++){var k=g[c];b[a++]=k.id;b[a++]=k.value}}return b.join(",")}function alertIfFormNotSaved(a){if(isFormChanged()){if(confirm(FORM_CHANGED_TEXT.replace(/<br>/g,"\n"))){document.location.href=a}}else{document.location.href=a}}function joinDynamicComboBoxValues(c,b){var d=c.concat(b);d.sort(compareDynamicComboBoxValues);var e=new Array();for(var a=0;a<d.length;a++){if(d[a].search(nonWhiteSpaceRE)<0){continue}if(a>0&&d[a]==d[a-1]){continue}e[e.length]=d[a]}return e}function compareDynamicComboBoxValues(d,c){return d.localeCompare(c)}function getDynamicComboBoxValues(e,d,c){var a=getAjaxObject();var b=null;if(typeof c!="undefined"){b=c}sendAjaxRequest(a,e,"","","GET",d,b)}function getDynamicComboBoxValuesCallback(b,h,g,e){var d=new Array();b=unescape(b);var f=getXmlDocument(b);if(f!=null){var a=getXmlNodes(f,h);if(a!=null&&typeof a.length!="undefined"){for(var c=0;c<a.length;c++){d[d.length]=getXmlNodeValue(a[c])}if(typeof e!="undefined"){d=joinDynamicComboBoxValues(e,d)}setDynamicComboBoxValues(g,d)}}return d}function addItem(f,b,a,e){var g=document.getElementById(f);if(g){var d=e.replace(itemSampleSnippetIdRE,a);var c=document.createElement("div");c.setAttribute("id",b+a);c.innerHTML=d;g.appendChild(c);return true}else{return false}}function getItemSampleSnippet(c,d){var a=getAjaxObject();var b="s="+currentSiteId;b+="&indID="+currentIndividualId;b+="&type="+c;b+="&index=__";b+="&lang="+displayLang;sendAjaxRequest(a,EDIT_WIZARD_GET_COMPONENT_API,b,"","GET",d)}function removeItem(g,c,h,b){if(typeof h!="undefined"&&h!=null){var d=true;for(var e=g-1;e>=0;e--){var f=document.getElementById(c+e);if(f&&f.style.display!="none"){d=false;break}}if(d){for(var e=g+1;e<b;e++){var f=document.getElementById(c+e);if(f&&f.style.display!="none"){var a=document.getElementById(h+e);if(a){a.style.display="none";break}}}}}var f=document.getElementById(c+g);if(f){f.style.display="none";return true}else{return false}}function saveAndNextClicked(){disableButtons();if(validateForm()){var a=document.getElementById("isSaveAndNext");if(a){a.value=1}document.forms.editProfileForm.submit()}else{enableButtons()}}function saveAndCloseClicked(){disableButtons();if(validateForm()){var a=document.getElementById("isSaveAndNext");if(a){a.value=0}document.forms.editProfileForm.submit()}else{enableButtons()}}function cancelClicked(){disableButtons();document.location.href=backToSiteUrl}function disableButtons(){disableButtonSprite2("saveAndNextBtn");disableButtonSprite2("saveAndCloseBtn");disableButtonSprite2("cancelBtn")}function enableButtons(){restoreButtonSprite2("saveAndNextBtn",true);restoreButtonSprite2("saveAndCloseBtn",true);restoreButtonSprite2("cancelBtn",true)}function genderOnChange(){var c=document.getElementById("genderF");var a=document.getElementById("lastNameLabel");var g=document.getElementById("maidenNameLabel");if(a&&g){if(c&&c.checked){a.style.display="none";g.style.display=""}else{a.style.display="";g.style.display="none"}}var i=document.getElementById("marriedName");var b=document.getElementById("marriedNameLabel");if(i&&b){if(c&&c.checked){i.style.display="";b.style.display=""}else{if(i.value==""&&displayLang!=CODE_GERMAN&&displayLang!=CODE_POLISH){i.style.display="none";b.style.display="none"}}}var f=document.getElementById("maleLiving");var e=document.getElementById("femaleLiving");var d=document.getElementById("maleDecesed");var h=document.getElementById("femaleDecesed");if(f&&e&&d&&h){if(c&&c.checked){f.style.display="none";e.style.display="";d.style.display="none";h.style.display=""}else{f.style.display="";e.style.display="none";d.style.display="";h.style.display="none"}}}function additionalNamesShow(){var a=document.getElementById("additionalNamesLink");var c=document.getElementById("additionalNamesHideLink");var b=document.getElementById("additionalNamesTable");if(a&&c&&b){a.style.display="none";c.style.display="";b.style.display=""}}function additionalNamesHide(){var a=document.getElementById("additionalNamesLink");var c=document.getElementById("additionalNamesHideLink");var b=document.getElementById("additionalNamesTable");if(a&&c&&b){a.style.display="";c.style.display="none";b.style.display="none"}}function christeningInfoShow(){var b=document.getElementById("christeningInfoLink");var c=document.getElementById("christeningInfoHideLink");var a=document.getElementById("christeningInfoTable");if(b&&c&&a){b.style.display="none";c.style.display="";a.style.display=""}}function christeningInfoHide(){var b=document.getElementById("christeningInfoLink");var c=document.getElementById("christeningInfoHideLink");var a=document.getElementById("christeningInfoTable");if(b&&c&&a){b.style.display="";c.style.display="none";a.style.display="none"}}function deathInfoShow(){var a=document.getElementById("deathInfoTable");if(a){a.style.display=""}}function deathInfoHide(){var a=document.getElementById("deathInfoTable");if(a){a.style.display="none"}}var hasPrefixValues=false;function prefixComboBoxOnValueListOpen(){if(hasPrefixValues){return}getDynamicComboBoxValues(prefixesApiUrl,"prefixComboBoxOnValueListOpenCallback")}function prefixComboBoxOnValueListOpenCallback(b,a){getDynamicComboBoxValuesCallback(a,"prefix","prefix",defaultPrefixes);hasPrefixValues=true}var hasSuffixValues=false;function suffixComboBoxOnValueListOpen(){if(hasSuffixValues){return}getDynamicComboBoxValues(suffixesApiUrl,"suffixComboBoxOnValueListOpenCallback")}function suffixComboBoxOnValueListOpenCallback(b,a){getDynamicComboBoxValuesCallback(a,"suffix","suffix",defaultSuffixes);hasSuffixValues=true}var hasBirthPlaceValues=false;function birthPlaceComboBoxOnValueListOpen(){if(hasBirthPlaceValues){return}getDynamicComboBoxValues(birthPlacesApiUrl,"birthPlaceComboBoxOnValueListOpenCallback")}function birthPlaceComboBoxOnValueListOpenCallback(b,a){getDynamicComboBoxValuesCallback(a,"place","birthPlace");hasBirthPlaceValues=true}var hasChristeningPlaceValues=false;function christeningPlaceComboBoxOnValueListOpen(){if(hasChristeningPlaceValues){return}getDynamicComboBoxValues(christeningPlacesApiUrl,"christeningPlaceComboBoxOnValueListOpenCallback")}function christeningPlaceComboBoxOnValueListOpenCallback(b,a){getDynamicComboBoxValuesCallback(a,"christeningPlace","christeningPlace");hasChristeningPlaceValues=true}var hasDeathPlaceValues=false;function deathPlaceComboBoxOnValueListOpen(){if(hasDeathPlaceValues){return}getDynamicComboBoxValues(deathPlacesApiUrl,"deathPlaceComboBoxOnValueListOpenCallback")}function deathPlaceComboBoxOnValueListOpenCallback(b,a){getDynamicComboBoxValuesCallback(a,"place","deathPlace");hasDeathPlaceValues=true}var hasBurialPlaceValues=false;function burialPlaceComboBoxOnValueListOpen(){if(hasBurialPlaceValues){return}getDynamicComboBoxValues(burialPlacesApiUrl,"burialPlaceComboBoxOnValueListOpenCallback")}function burialPlaceComboBoxOnValueListOpenCallback(b,a){getDynamicComboBoxValuesCallback(a,"burialPlace","burialPlace");hasBurialPlaceValues=true}function resetEssentialsErrors(){gdp_resetErrors("birthDate");gdp_resetErrors("christeningDate");gdp_resetErrors("deathDate")}function validateEssentials(){if(!gdp_validate("birthDate")){return false}if(!gdp_validate("christeningDate")){christeningInfoShow();return false}var a=document.getElementById("deceased");if(a&&a.checked){if(!gdp_validate("deathDate")){return false}}return true}function resetRelationshipToParentsErrors(){var a=document.getElementById("numberOfParents");if(a){var b=a.value;if(b>1){for(var c=0;c<b;c++){var d=document.getElementById("relationshipToParentsError"+c);if(d){d.style.display="none"}}}}}function validateRelationshipToParents(){var a=false;var m="";var e=document.getElementById("numberOfParents");if(e){var n=e.value;if(n>1){for(var f=0;f<n-1;f++){for(var d=f+1;d<n;d++){var k=document.getElementById("relationshipToParents"+f);if(k){var l=k.value}var c=document.getElementById("relationshipToParentsError"+f);var h=document.getElementById("relationshipToParents"+d);if(h){var g=h.value}var b=document.getElementById("relationshipToParentsError"+d);if(l==g){if(l==FAMILY_TYPE_BIOLOGICAL){m=DUPLICATE_FAMILY_TYPE_BIOLOGICAL_ERROR_TEXT}else{if(l==FAMILY_TYPE_ADOPTING){m=DUPLICATE_FAMILY_TYPE_ADOPTING_ERROR_TEXT}else{if(l==FAMILY_TYPE_FOSTER){m=DUPLICATE_FAMILY_TYPE_FOSTER_ERROR_TEXT}}}if(c&&b){setObjInnerText(c,m);setObjInnerText(b,m);c.style.display="";b.style.display=""}a=true}}}}}if(a){alert(m);return false}else{return true}}function relationshipWithSpouseOnChange(m){var k=document.getElementById("relationshipWithSpouse"+m);if(k){var a=k.value;var f=document.getElementById("divorceDateLabel"+m);var g=document.getElementById("divorceDatePicker"+m);var e=document.getElementById("separationDateLabel"+m);var j=document.getElementById("separationDatePicker"+m);var c=document.getElementById("engagementDateLabel"+m);var i=document.getElementById("engagementDatePicker"+m);var b=document.getElementById("partnershipDateLabel"+m);var l=document.getElementById("partnershipDatePicker"+m);if(f&&g&&e&&j&&c&&i&&b&&l){f.style.display="none";g.style.display="none";e.style.display="none";j.style.display="none";c.style.display="none";i.style.display="none";b.style.display="none";l.style.display="none";if(a==FAMILY_STATUS_DIVORCED){f.style.display="";g.style.display=""}else{if(a==FAMILY_STATUS_SEPARATED){e.style.display="";j.style.display=""}else{if(a==FAMILY_STATUS_ENGAGED){c.style.display="";i.style.display=""}else{if(a==FAMILY_STATUS_PARTNERS){b.style.display="";l.style.display=""}}}}}var h=document.getElementById("marriageRow"+m);var d=document.getElementById("civilMarriageRow"+m);if(h&&d){if(a==FAMILY_STATUS_MARRIED||a==FAMILY_STATUS_DIVORCED||a==FAMILY_STATUS_SEPARATED){h.style.display="";if(shouldShowCivilMarriageDate[m]){d.style.display=""}}else{h.style.display="none";d.style.display="none"}}}}var marriagePlaceValues=null;var hasMarriagePlaceValues=new Array();function marriagePlaceComboBoxOnValueListOpen(a){if(marriagePlaceValues==null){getDynamicComboBoxValues(marriagePlacesApiUrl,"marriagePlaceComboBoxOnValueListOpenCallback",a);return}if(typeof hasMarriagePlaceValues[a]!="undefined"){return}setDynamicComboBoxValues(a,marriagePlaceValues);hasMarriagePlaceValues[a]=true}function marriagePlaceComboBoxOnValueListOpenCallback(b,a,c){marriagePlaceValues=getDynamicComboBoxValuesCallback(a,"place",c);hasMarriagePlaceValues[c]=true}var civilMarriagePlaceValues=null;var hasCivilMarriagePlaceValues=new Array();function civilMarriagePlaceComboBoxOnValueListOpen(a){if(civilMarriagePlaceValues==null){getDynamicComboBoxValues(civilMarriagePlacesApiUrl,"civilMarriagePlaceComboBoxOnValueListOpenCallback",a);return}if(typeof hasCivilMarriagePlaceValues[a]!="undefined"){return}setDynamicComboBoxValues(a,civilMarriagePlaceValues);hasCivilMarriagePlaceValues[a]=true}function civilMarriagePlaceComboBoxOnValueListOpenCallback(b,a,c){civilMarriagePlaceValues=getDynamicComboBoxValuesCallback(a,"place",c);hasCivilMarriagePlaceValues[c]=true}function resetSpouseErrors(){var c=document.getElementById("numberOfSpouses");if(c){var b=parseInt(c.value);for(var a=0;a<b;a++){gdp_resetErrors("divorceDate"+a);gdp_resetErrors("separationDate"+a);gdp_resetErrors("engagementDate"+a);gdp_resetErrors("partnershipDate"+a);gdp_resetErrors("marriageDate"+a);gdp_resetErrors("civilMarriageDate"+a)}}}function validateSpouses(){var e=document.getElementById("numberOfSpouses");if(e){var d=parseInt(e.value);for(var c=0;c<d;c++){var a=document.getElementById("relationshipWithSpouse"+c);if(a){var b=a.value}if(b==FAMILY_STATUS_DIVORCED){if(!gdp_validate("divorceDate"+c)){return false}}else{if(b==FAMILY_STATUS_SEPARATED){if(!gdp_validate("separationDate"+c)){return false}}else{if(b==FAMILY_STATUS_ENGAGED){if(!gdp_validate("engagementDate"+c)){return false}}else{if(b==FAMILY_STATUS_PARTNERS){if(!gdp_validate("partnershipDate"+c)){return false}}}}}if(b==FAMILY_STATUS_MARRIED||b==FAMILY_STATUS_DIVORCED||b==FAMILY_STATUS_SEPARATED){if(!gdp_validate("marriageDate"+c)){return false}if(!gdp_validate("civilMarriageDate"+c)){return false}}}}return true}var biographyNoteSampleSnippet=null;function addBiographyNote(){if(biographyNoteSampleSnippet==null){getItemSampleSnippet(EDIT_WIZARD_COMPONENT_TYPE_BIOGRAPHY,"getBiographyNoteSampleSnippetCallback");return}var c=document.getElementById("numberOfBiographyNotes");if(c){var a=parseInt(c.value);if(addItem("biographyNotesContainer","biographyNoteDiv",a,biographyNoteSampleSnippet)){var b="biographyText"+a;var d=document.getElementById(b);tinyMCE.addMCEControl(d,b);tinyMCE.execInstanceCommand(b,"mceFocus");numberOfDisplayedBiographyNotes++;c.value=a+1}}}function getBiographyNoteSampleSnippetCallback(b,a){a=unescape(a);biographyNoteSampleSnippet=a;if(biographyNoteSampleSnippet!=null&&biographyNoteSampleSnippet!=""){addBiographyNote()}}function removeBiographyNote(a){resetBiographyNoteFields(a);if(numberOfDisplayedBiographyNotes>1){var c=document.getElementById("numberOfBiographyNotes");if(c){var b=parseInt(c.value);if(removeItem(a,"biographyNoteDiv","biographyNoteSeparator",b)){numberOfDisplayedBiographyNotes--}}}}function resetBiographyNoteFields(a){tinyMCE.selectedInstance=tinyMCE.getInstanceById("biographyText"+a);tinyMCE.setContent(null);tinyMCE.execInstanceCommand("biographyText"+a,"mceFocus")}var hasAddressCountryValues=new Array();function addressCountryComboBoxOnValueListOpen(a){if(typeof hasAddressCountryValues[a]!="undefined"){return}setDynamicComboBoxValues(a,countryValues);hasAddressCountryValues[a]=true}var areUsaStateValuesSorted=false;var hasAddressUsaStateValues=new Array();function addressUsaStateComboBoxOnValueListOpen(a){if(typeof hasAddressUsaStateValues[a]!="undefined"){return}if(!areUsaStateValuesSorted){usaStateValues.sort(compareDynamicComboBoxValues);areUsaStateValuesSorted=true}setDynamicComboBoxValues(a,usaStateValues);hasAddressUsaStateValues[a]=true}var areCanadianProvinceValuesSorted=false;var hasAddressCanadianProvinceValues=new Array();function addressCanadianProvinceComboBoxOnValueListOpen(a){if(typeof hasAddressCanadianProvinceValues[a]!="undefined"){return}if(!areCanadianProvinceValuesSorted){canadianProvinceValues.sort(compareDynamicComboBoxValues);areCanadianProvinceValuesSorted=true}setDynamicComboBoxValues(a,canadianProvinceValues);hasAddressCanadianProvinceValues[a]=true}function onAddressCountryChange(c){var a="addressCountry";var l=c.substr(a.length);var g="addressCountry"+l;var d="addressRegion"+l;var j="addressState"+l;var b="addressProvince"+l;var i="addressStateValueType"+l;var e=document.getElementById(g);var h=document.getElementById(d);var k=document.getElementById(i);if(e&&h&&k){var f=e.value;if(f==UNITED_STATES){h.style.display="none";showDynamicComboBox(j);hideDynamicComboBox(b);k.value="us_state"}else{if(f==CANADA){h.style.display="none";hideDynamicComboBox(j);showDynamicComboBox(b);k.value="canada_province"}else{h.style.display="";hideDynamicComboBox(j);hideDynamicComboBox(b);k.value="general_region"}}}}function addressDateShow(b){var c=document.getElementById("contactAddressDateTable"+b);var a=document.getElementById("contactAddressDateLink"+b);var d=document.getElementById("contactAddressDateHideLink"+b);if(c&&a&&d){c.style.display="";a.style.display="none";d.style.display=""}}function addressDateHide(b){var c=document.getElementById("contactAddressDateTable"+b);var a=document.getElementById("contactAddressDateLink"+b);var d=document.getElementById("contactAddressDateHideLink"+b);if(c&&a&&d){c.style.display="none";a.style.display="";d.style.display="none"}}var addressFactSampleSnippet=null;function addAddressFact(){if(addressFactSampleSnippet==null){getItemSampleSnippet(EDIT_WIZARD_COMPONENT_TYPE_ADDRESS,"getAddressFactSampleSnippetCallback");return}var b=document.getElementById("numberOfAddressFacts");if(b){var c=parseInt(b.value);if(addItem("addressFactsContainer","addressFactDiv",c,addressFactSampleSnippet)){var a=document.getElementById("addressAddressOne"+c);if(a){a.focus()}numberOfDisplayedAddressFacts++;b.value=c+1}}}function getAddressFactSampleSnippetCallback(b,a){a=unescape(a);addressFactSampleSnippet=a;if(addressFactSampleSnippet!=null&&addressFactSampleSnippet!=""){addAddressFact()}}function removeAddressFact(a){resetAddressFactFields(a);if(numberOfDisplayedAddressFacts>1){var b=document.getElementById("numberOfAddressFacts");if(b){var c=parseInt(b.value);if(removeItem(a,"addressFactDiv","addressFactSeparator",c)){numberOfDisplayedAddressFacts--}}}}function resetAddressFactFields(j){var e=document.getElementById("addressAddressOne"+j);if(e){e.value="";e.focus()}var i=document.getElementById("addressAddressTwo"+j);if(i){i.value=""}var d=document.getElementById("addressCity"+j);if(d){d.value=""}var b=document.getElementById("isCurrentAddress"+j);if(b){b.checked=false}var c=document.getElementById("addressCountry"+j);if(c){c.value=""}var f=document.getElementById("addressRegion"+j);if(f){f.value="";f.style.display=""}var h=document.getElementById("addressState"+j);if(h){h.value="";hideDynamicComboBox("addressState"+j)}var g=document.getElementById("addressProvince"+j);if(g){g.value="";hideDynamicComboBox("addressProvince"+j)}var a=document.getElementById("addressZip"+j);if(a){a.value=""}gdp_reset("addressDate"+j,DATE_TYPE_RANGE_FROM_TO)}function resetContactAddressErrors(){var c=document.getElementById("numberOfAddressFacts");if(c){var b=parseInt(c.value);for(var a=0;a<b;a++){gdp_resetErrors("addressDate"+a)}}}function validateContactAddresses(){var c=document.getElementById("numberOfAddressFacts");if(c){var b=parseInt(c.value);for(var a=0;a<b;a++){if(!gdp_validate("addressDate"+a)){addressDateShow(a);return false}}}return true}var emailFactSampleSnippet=null;function addEmailFact(){if(emailFactSampleSnippet==null){getItemSampleSnippet(EDIT_WIZARD_COMPONENT_TYPE_EMAIL,"getEmailFactSampleSnippetCallback");return}var b=document.getElementById("numberOfEmailFacts");if(b){var c=parseInt(b.value);if(addItem("emailFactsContainer","emailFactDiv",c,emailFactSampleSnippet)){var a=document.getElementById("contactEmail"+c);if(a){a.focus()}numberOfDisplayedEmailFacts++;b.value=c+1}}}function getEmailFactSampleSnippetCallback(b,a){a=unescape(a);emailFactSampleSnippet=a;if(emailFactSampleSnippet!=null&&emailFactSampleSnippet!=""){addEmailFact()}}function removeEmailFact(b){resetEmailFactFields(b);if(numberOfDisplayedEmailFacts>1){var a=document.getElementById("numberOfEmailFacts");if(a){var c=parseInt(a.value);if(removeItem(b,"emailFactDiv","emailFactSeparator",c)){numberOfDisplayedEmailFacts--}}}}function resetEmailFactFields(c){var a=document.getElementById("contactEmail"+c);if(a){a.value="";a.focus()}var b=document.getElementById("contactEmailError"+c);if(b){b.style.display="none"}}function resetContactEmailErrors(){var a=document.getElementById("numberOfEmailFacts");if(a){var c=parseInt(a.value);for(var d=0;d<c;d++){var b=document.getElementById("contactEmailError"+d);if(b){b.style.display="none"}}}}function validateContactEmails(){var a=document.getElementById("numberOfEmailFacts");if(a){var d=parseInt(a.value);for(var e=0;e<d;e++){var b=document.getElementById("contactEmail"+e);var c=document.getElementById("contactEmailError"+e);if(b&&b.value!=""&&!isEmail(b.value)&&c){c.style.display="";alert(INVALID_EMAIL_ADDRESS_MESSAGE);b.focus();return false}}}return true}var phoneFactSampleSnippet=null;function addPhoneFact(){if(phoneFactSampleSnippet==null){getItemSampleSnippet(EDIT_WIZARD_COMPONENT_TYPE_PHONE,"getPhoneFactSampleSnippetCallback");return}var b=document.getElementById("numberOfPhoneFacts");if(b){var c=parseInt(b.value);if(addItem("phoneFactsContainer","phoneFactDiv",c,phoneFactSampleSnippet)){var a=document.getElementById("contactPhone"+c);if(a){a.focus()}numberOfDisplayedPhoneFacts++;b.value=c+1}}}function getPhoneFactSampleSnippetCallback(b,a){a=unescape(a);phoneFactSampleSnippet=a;if(phoneFactSampleSnippet!=null&&phoneFactSampleSnippet!=""){addPhoneFact()}}function removePhoneFact(a){resetPhoneFactFields(a);if(numberOfDisplayedPhoneFacts>1){var b=document.getElementById("numberOfPhoneFacts");if(b){var c=parseInt(b.value);if(removeItem(a,"phoneFactDiv","phoneFactSeparator",c)){numberOfDisplayedPhoneFacts--}}}}function resetPhoneFactFields(b){var a=document.getElementById("contactPhone"+b);if(a){a.value="";a.focus()}}var faxFactSampleSnippet=null;function addFaxFact(){if(faxFactSampleSnippet==null){getItemSampleSnippet(EDIT_WIZARD_COMPONENT_TYPE_FAX,"getFaxFactSampleSnippetCallback");return}var b=document.getElementById("numberOfFaxFacts");if(b){var c=parseInt(b.value);if(addItem("faxFactsContainer","faxFactDiv",c,faxFactSampleSnippet)){var a=document.getElementById("contactFax"+c);if(a){a.focus()}numberOfDisplayedFaxFacts++;b.value=c+1}}}function getFaxFactSampleSnippetCallback(b,a){a=unescape(a);faxFactSampleSnippet=a;if(faxFactSampleSnippet!=null&&faxFactSampleSnippet!=""){addFaxFact()}}function removeFaxFact(b){resetFaxFactFields(b);if(numberOfDisplayedFaxFacts>1){var a=document.getElementById("numberOfFaxFacts");if(a){var c=parseInt(a.value);if(removeItem(b,"faxFactDiv","faxFactSeparator",c)){numberOfDisplayedFaxFacts--}}}}function resetFaxFactFields(b){var a=document.getElementById("contactFax"+b);if(a){a.value="";a.focus()}}var areWebValuesSorted=false;var hasWebValues=new Array();function contactWebComboBoxOnValueListOpen(a){if(typeof hasWebValues[a]!="undefined"){return}if(!areWebValuesSorted){webValues.sort(compareDynamicComboBoxValues);areWebValuesSorted=true}setDynamicComboBoxValues(a,webValues);hasWebValues[a]=true}var webFactSampleSnippet=null;function addWebFact(){if(webFactSampleSnippet==null){getItemSampleSnippet(EDIT_WIZARD_COMPONENT_TYPE_WEB,"getWebFactSampleSnippetCallback");return}var b=document.getElementById("numberOfWebFacts");if(b){var c=parseInt(b.value);if(addItem("webFactsContainer","webFactDiv",c,webFactSampleSnippet)){var a=document.getElementById("contactWebType"+c);if(a){a.focus()}numberOfDisplayedWebFacts++;b.value=c+1}}}function getWebFactSampleSnippetCallback(b,a){a=unescape(a);webFactSampleSnippet=a;if(webFactSampleSnippet!=null&&webFactSampleSnippet!=""){addWebFact()}}function removeWebFact(a){resetWebFactFields(a);if(numberOfDisplayedWebFacts>1){var b=document.getElementById("numberOfWebFacts");if(b){var c=parseInt(b.value);if(removeItem(a,"webFactDiv","webFactSeparator",c)){numberOfDisplayedWebFacts--}}}}function resetWebFactFields(c){var a=document.getElementById("contactWebType"+c);if(a){a.value="";a.focus()}var b=document.getElementById("contactWebUsername"+c);if(b){b.value=""}var d=document.getElementById("contactWebAddress"+c);if(d){d.value=""}}var workFactSampleSnippet=null;function addWorkFact(){if(workFactSampleSnippet==null){getItemSampleSnippet(EDIT_WIZARD_COMPONENT_TYPE_WORK,"getWorkFactSampleSnippetCallback");return}var b=document.getElementById("numberOfWorkFacts");if(b){var c=parseInt(b.value);if(addItem("workFactsContainer","workFactDiv",c,workFactSampleSnippet)){var a=document.getElementById("workHeader"+c);if(a){a.focus()}numberOfDisplayedWorkFacts++;b.value=c+1}}}function getWorkFactSampleSnippetCallback(b,a){a=unescape(a);workFactSampleSnippet=a;if(workFactSampleSnippet!=null&&workFactSampleSnippet!=""){addWorkFact()}}function removeWorkFact(a){resetWorkFactFields(a);if(numberOfDisplayedWorkFacts>1){var b=document.getElementById("numberOfWorkFacts");if(b){var c=parseInt(b.value);if(removeItem(a,"workFactDiv","workFactSeparator",c)){numberOfDisplayedWorkFacts--}}}}function resetWorkFactFields(a){var c=document.getElementById("workHeader"+a);if(c){c.value="";c.focus()}var b=document.getElementById("workPlace"+a);if(b){b.value=""}var d=document.getElementById("isCurrentWork"+a);if(d){d.checked=false}gdp_reset("workDate"+a,DATE_TYPE_RANGE_FROM_TO)}function resetWorkFactErrors(){var c=document.getElementById("numberOfWorkFacts");if(c){var b=parseInt(c.value);for(var a=0;a<b;a++){gdp_resetErrors("workDate"+a)}}}function validateWorkFacts(){var c=document.getElementById("numberOfWorkFacts");if(c){var b=parseInt(c.value);for(var a=0;a<b;a++){if(!gdp_validate("workDate"+a)){return false}}}return true}var educationFactSampleSnippet=null;function addEducationFact(){if(educationFactSampleSnippet==null){getItemSampleSnippet(EDIT_WIZARD_COMPONENT_TYPE_EDUCATION,"getEducationFactSampleSnippetCallback");return}var a=document.getElementById("numberOfEducationFacts");if(a){var c=parseInt(a.value);if(addItem("educationFactsContainer","educationFactDiv",c,educationFactSampleSnippet)){var b=document.getElementById("educationHeader"+c);if(b){b.focus()}numberOfDisplayedEducationFacts++;a.value=c+1}}}function getEducationFactSampleSnippetCallback(b,a){a=unescape(a);educationFactSampleSnippet=a;if(educationFactSampleSnippet!=null&&educationFactSampleSnippet!=""){addEducationFact()}}function removeEducationFact(a){resetEducationFactFields(a);if(numberOfDisplayedEducationFacts>1){var b=document.getElementById("numberOfEducationFacts");if(b){var c=parseInt(b.value);if(removeItem(a,"educationFactDiv","educationFactSeparator",c)){numberOfDisplayedEducationFacts--}}}}function resetEducationFactFields(b){var d=document.getElementById("educationHeader"+b);if(d){d.value="";d.focus()}var c=document.getElementById("educationPlace"+b);if(c){c.value=""}var a=document.getElementById("isCurrentEducation"+b);if(a){a.checked=false}gdp_reset("educationDate"+b,DATE_TYPE_RANGE_FROM_TO)}function resetEducationFactErrors(){var a=document.getElementById("numberOfEducationFacts");if(a){var c=parseInt(a.value);for(var b=0;b<c;b++){gdp_resetErrors("educationDate"+b)}}}function validateEducationFacts(){var a=document.getElementById("numberOfEducationFacts");if(a){var c=parseInt(a.value);for(var b=0;b<c;b++){if(!gdp_validate("educationDate"+b)){return false}}}return true}var hasReligionValues=false;function religionComboBoxOnValueListOpen(){if(hasReligionValues){return}getDynamicComboBoxValues(religionsApiUrl,"religionComboBoxOnValueListOpenCallback")}function religionComboBoxOnValueListOpenCallback(b,a){getDynamicComboBoxValuesCallback(a,"religion","religion",defaultReligions);hasReligionValues=true}var citationSampleSnippet=null;function addCitation(){if(citationSampleSnippet==null){getItemSampleSnippet(EDIT_WIZARD_COMPONENT_TYPE_CITATION,"getCitationSampleSnippetCallback");return}var a=document.getElementById("numberOfCitations");if(a){var d=parseInt(a.value);if(addItem("citationsContainer","citationDiv",d,citationSampleSnippet)){var b="citationText"+d;var c=document.getElementById(b);tinyMCE.addMCEControl(c,b);numberOfDisplayedCitations++;a.value=d+1}}}function getCitationSampleSnippetCallback(b,a){a=unescape(a);citationSampleSnippet=a;if(citationSampleSnippet!=null&&citationSampleSnippet!=""){addCitation()}}var forceReloadCanvas=false;var origProfileTitle="";function loadProfileFromCanvas(c,d,b){siteID=c;individualID=d;currentTab=b;originalCurrentTab=currentTab;forceReloadCanvas=false;inCanvas=true;var a=getProfileFullURL.replace("replaceWithIndID",individualID);a=a.replace("replaceWithTabName",currentTab);new Ajax.Request(a,{method:"GET",onComplete:function(e){getProfileFullDone(e)}})}function getProfileFullDone(a){if(!$("masterPageFooter")||!$("editPhotoContent")){return}$("editPhotoContent").show();$("editPhotoContent").update('<div style="width:967px;position:relative">'+a.responseText+"</div>");commentsReset();$("masterPageFooter").show()}function backToTreeClicked(a){if(forceReloadCanvas){top.location.href=a}else{crossBrowserNavigateToHash("");checkProfileAnchor()}}function openLightbox(b,a){photoStrips[b].startLightbox(a)}var currentProfileAnchorSAPage=null;function initializeAjaxTabs(){window.setInterval("checkProfileAnchorSAPage()",300)}function checkProfileAnchorSAPage(){actOnNewProfileAnchorSAPage(window.location.hash)}function actOnNewProfileAnchorSAPage(c){if($("tabsInnerContent")==null){return}if(currentProfileAnchorSAPage!=c){currentProfileAnchorSAPage=c;var a=currentProfileAnchorSAPage;if(a.indexOf("#")==0){a=a.substr(1)}var b="";if(a==""){b=originalCurrentTab}else{b=a}if(b==currentTab){return}currentTab=b;ajaxGetProfileTab(b)}}function ajaxGetProfileTab(b){setActiveInnerTab(b);var a="";if(b=="info"){a=getInfoTabURL.replace("replaceWithIndID",individualID)}else{if(b=="events"){a=getEventsTabURL.replace("replaceWithIndID",individualID)}}if(inCanvas){a+="&inCanvas=1"}if(a!=""){var c=$("tabsInnerContent").getHeight();$("profileTabsPreloader").setStyle({height:c});$("profileTabsPreloader").show();$("tabsInnerContent").hide();new Ajax.Request(a,{method:"GET",onComplete:function(d){getProfileTabDone(d,b)}})}}function getProfileTabDone(a,b){$("tabsInnerContent").update(a.responseText);if(b=="events"){}else{showProfileTabAfterAjax();if(b=="info"){commentsReset()}}}function showProfileTabAfterAjax(){$("profileTabsPreloader").hide();$("tabsInnerContent").show()}function switchProfileTab(a){if(inCanvas){profileViaAjax(individualID,a)}else{crossBrowserNavigateToHash("#"+a);checkProfileAnchorSAPage()}}function updateProfileWindowTitle(c){if(origProfileTitle==""){origProfileTitle=document.title}document.title=c;if(Prototype.Browser.IE){try{var b=document.frames("ajaxIFrame");if(b){b.document.title=c}}catch(a){}}}function resetProfileDocumentTitle(){if(origProfileTitle!=""){document.title=origProfileTitle}}function viewProfileBackClicked(){resetProfileDocumentTitle();individualID=null;hideEditPhotoShowFlash()}function toggleSourceDisplay(a){if($(a)){if($(a).visible()){$(a).hide();$("show"+a).show();$("hide"+a).hide()}else{$(a).show();$("show"+a).hide();$("hide"+a).show()}}}function openZoomPhoto(){var b=[[profilePhotoFullUrl,profileName]];var c=new Lightbox(true);c.setIsUsingSmallFonts(true);var a=document.viewport.getHeight();if(a>640){c.setExtraOffsetTop(Math.floor((a-640)/2))}c.start(null,b,0)}var addressToLocation;var infowindow=null;var eventPlacesSmallMap=null;var eventPlacesLargeMap=null;function translateAddressToLocation(){var c=new google.maps.Geocoder();addressToLocation=new Hash();var d,b=eventPlaces.length;var f=0;var e=0;var h=0;var g=0;for(d=0;d<b;d++){var a=eventPlaces[d].address;if(typeof addressToLocation.get(a)=="undefined"){addressToLocation.set(a,-1);g++}}addressToLocation.each(function(j){var i=j.key;e++;f++;c.geocode({address:i},function(l,m,k){if(k==google.maps.GeocoderStatus.OK){addressToLocation.set(l,m[0].geometry.location);h++}else{}f--;if(f==0&&e==g){showProfileTabAfterAjax();if(h>0){drawMapAndMarkers($("eventsMapCanvas"),false)}else{hideEventsMap()}}}.bind(null,i))})}function hideUndecodableMarker(b){var a=$("markerInTable"+b);if(a){a.up().update("&nbsp;")}}function initializeEventsMap(a){if(a==null){showProfileTabAfterAjax();return}eventPlaces=a;if(!$("eventsMapCanvas")||typeof eventPlaces=="undefined"||eventPlaces.length==0){return}translateAddressToLocation()}function drawMapAndMarkers(h,c){var b=["Birth","Education","Marriage","Address","Occupation","GenericEvent","Death1","Death2","Burial"];var j=new Array();var f;var q=21;var n=34;for(var s=0;s<b.length;s++){var e=b[s];j[e]=new google.maps.MarkerImage(AssetManager.R_IMG("/FP/Assets/Images/Profile/Map/"+e+".png"),new google.maps.Size(q,n),new google.maps.Point(0,0),new google.maps.Point(Math.floor(q/2),n-1))}f=new google.maps.MarkerImage(AssetManager.R_IMG("/FP/Assets/Images/Profile/Map/Shadow.png"),new google.maps.Size(q*2,n),new google.maps.Point(0,0),new google.maps.Point(Math.floor(q/2),n-1));var s,r=eventPlaces.length;var k=new google.maps.LatLngBounds();addressToLocation.each(function(l){var i=l.value;if(i!=-1){k.extend(i)}});var o={zoom:8,center:k.getCenter(),mapTypeId:google.maps.MapTypeId.HYBRID,scrollwheel:(c?true:false)};var u=new google.maps.Map(h,o);if(c){eventPlacesLargeMap=u}else{eventPlacesSmallMap=u}var p=k.toSpan();if(p.lat()>1||p.lng()>1){u.fitBounds(k)}for(s=0;s<r;s++){var d=eventPlaces[s].address;e=eventPlaces[s].icon;var a=addressToLocation.get(d);var m=false;if(typeof a!="undefined"&&a!=-1){try{var g=new google.maps.Marker({map:u,position:a,icon:j[e],shadow:f,title:eventPlaces[s].title.stripTags()});m=true;if(c){eventPlaces[s].markerOnLargeMap=g}else{eventPlaces[s].markerOnSmallMap=g}google.maps.event.addListener(g,"click",function(l,i){openMapCalloutForEvent(l,i)}.bind(null,s,c))}catch(t){}}if(!m){hideUndecodableMarker(s);if(c){eventPlaces[s].markerOnLargeMap=null}else{eventPlaces[s].markerOnSmallMap=null}}}}function hideEventsMap(){var c=$("eventsMapTdContainer");if(c){c.hide()}var b,a=eventPlaces.length;for(b=0;b<a;b++){hideUndecodableMarker(b)}}function openMapCalloutForEvent(e,d){if(typeof eventPlaces=="undefined"||typeof eventPlaces[e]=="undefined"){return}var c=eventPlaces[e];var a=(d?c.markerOnLargeMap:c.markerOnSmallMap);if(a==null){return}var b='<span class="FL_LabelBold">'+c.title+'</span><br><span class="FL_Label">'+c.place;if(c.date!=""){b+="<br>"+c.date}b+="</span>";if(infowindow==null){infowindow=new google.maps.InfoWindow()}infowindow.setContent(b);infowindow.open(d?eventPlacesLargeMap:eventPlacesSmallMap,a)}var mapLightbox=null;function openLargeMap(b){mapLightbox=new Lightbox(true);mapLightbox.setIsUsingSmallFonts(false);mapLightbox.setIsGoogleMap(true);var a=document.viewport.getHeight();var d=document.viewport.getWidth();var c=800;var e=600;if(a<630||d<860){c=640;e=480;mapLightbox.setIsUsingSmallFonts(true)}else{if(a>640){mapLightbox.setExtraOffsetTop(Math.floor((a-640)/2))}}var f=[[AssetManager.R_IMG("/FP/Assets/Images/Profile/spacer"+c+"x"+e+".gif"),b]];mapLightbox.start(null,f,0,function(){mapLightboxOpened(c,e)}.bind(null,c,e))}function mapLightboxOpened(a,b){mapLightbox.LBlightboxImage.up().update('<div id="mapLightboxInner" style="width:'+a+"px;height:"+b+"px;line-height:15px;text-align:"+(languageDirection=="LTR"?"left":"right")+'"></div>');drawMapAndMarkers($("mapLightboxInner"),true)}function openUploadPhotoPopup(){openCenteredPopup2(uploadPhotoURL,416,284,"","scroll:no;","",uploadPhotoTitle,true)}function browserSupportsPreview(){return(typeof FileReader=="function")}function handleUploadFiles(c){if(!browserSupportsPreview()){return}var d=c.files;if(d.length<1){return}var b=d[0];var e=/image.*/;if(!b.type.match(e)){return}var a=new FileReader();a.onloadend=imageReadEnd;a.readAsDataURL(b)}function imageReadEnd(c){var b=document.getElementById("personPhotoPreview");if(b==null){var a=document.getElementById("personPhotoPreviewContainer");b=document.createElement("img");b.id="personPhotoPreview";a.appendChild(b);a.style.display=""}b.src=c.target.result}function uploadClicked(){var b=document.getElementById("imageFile");if(b!=null&&b.value==""){alert(selectPhotoText);restoreButtonSprite2("OKBtn",true);return}var a=document.getElementById("preloader");a.style.display="";var c=document.getElementById("uploadPhotoForm");c.submit()}function profilePhotoUploadedSuccessfully(a){forceReloadCanvas=true;setNewSourceForProfilePhotoImg(a);$("profilePhotoContainer").show();$("profileSilhouetteContainer").hide()}function photoUploadStopped(){var a=document.getElementById("preloader");a.style.display="none";restoreButtonSprite2("OKBtn",true)}function openReplacePhotoPopup(){openCenteredPopup2(replacePhotoURL,460,445,"","scroll:no;","","",true);hideCurrentPopupTitleBar()}function setNewSourceForProfilePhotoImg(a){if($("profilePhotoImg")){$("profilePhotoImg").src=a}profilePhotoFullUrl=a;var b="siteID="+siteID+"&individualID="+individualID;new Ajax.Request("/FP/API/Profile/get-profile-photo.php",{method:"POST",parameters:b,onComplete:function(c){getProfilePhotoDone(c)}})}function getProfilePhotoDone(d){if(d.status!=200||d.responseText=="<error/>"||d.responseXML==null){return}var e="";var c="";var b=d.responseXML.getElementsByTagName("profilePhotoUrl");if(b!=null&&b.length>=1){e=b[0].firstChild.nodeValue}var a=d.responseXML.getElementsByTagName("profilePhotoFullUrl");if(a!=null&&a.length>=1){c=a[0].firstChild.nodeValue}if($("profilePhotoImg")&&e!=""){$("profilePhotoImg").src=e}if(c!=""){profilePhotoFullUrl=c}}function confirmPersonalPhotoDeleteCallback(a){if(a!=MB_YES){return}var b="s="+siteID+"&siteID="+siteID+"&individualID="+individualID;new Ajax.Request("/FP/API/Profile/delete-profile-photo.php",{method:"POST",parameters:b,onComplete:function(c){deleteProfilePhotoDone(c)}})}function deleteProfilePhotoDone(a){var c=false;if(a.responseXML!=null){var b=a.responseXML.getElementsByTagName("ok");if(b!=null&&b.length==1){c=true}}if(c){forceReloadCanvas=true;$("profilePhotoContainer").hide();$("profileSilhouetteContainer").show()}else{}}var gCombinedEventIDToDeleteToDelete=null;function confirmDeleteEventCallback(c){if(c!=MB_YES||gCombinedEventIDToDelete==null){return}var f=gCombinedEventIDToDelete.match(/([0-9]+)([IF])([0-9]+)/);if(f==null){return}var a=f[1];var e=f[2];var d=f[3];gCombinedEventIDToDelete=null;var b="";var g="";if(e=="I"){b="/FP/API/Profile/delete-individual-event.php";g="s="+siteID+"&siteID="+siteID+"&individualID="+a+"&eventID="+d}else{if(e=="F"){b="/FP/API/Profile/delete-family-event.php";g="s="+siteID+"&siteID="+siteID+"&familyID="+a+"&eventID="+d}else{return}}new Ajax.Request(b,{method:"POST",parameters:g,onComplete:function(h){deleteEventFromEventTabDone(a,e,d,h)}})}function deleteEventFromEventTabDone(b,e,c,a){var h=false;if(a.responseXML!=null){var g=a.responseXML.getElementsByTagName("ok");if(g!=null&&g.length==1){h=true}}if(h){var d=b+e+c;var f=$("EventRow"+d);if(f!=null){f.hide()}forceReloadCanvas=true}else{}};
