for( var h = 1; h < slotceiling; h++ ) { eval( 'var timer' + h + '=false' ); } var timerleft = false; function setPopup(slot, tall, high) { eval( "timer" + slot + "=setTimeout(\"showPopup(" + slot + ","+tall+","+high+")\",150);"); } function showPopup( slot, tall, high ){ // hide any other currently visible popups if( lastpopup ) { cancelTimer(lastpopup); hidePopup(lastpopup); } lastpopup = slot; // show current var ref = jQuery("#popup" + slot); var box = jQuery("#box" + slot); ref.html(getPopup(slot)); var vOffset, hOffset, hDisplace; if(tall + high < 0) vOffset = 0; else { vOffset = tall + high + pedborderwidth; var vDisplace = box.position().top + high + pedborderwidth + ref.height() - jQuery('#outer').height() + 20; //20 is for the scrollbar if(vDisplace > 0) vOffset -= vDisplace; } hDisplace = box.position().left + ref.width() - jQuery('#outer').width(); if(hDisplace > 0) { if(vDisplace > 0) { ref.offset({left: box.offset().left - ref.width() - pedborderwidth}); if(box.position().top < vOffset) vOffset = box.position().top; } else ref.offset({left: box.offset().left - hDisplace}); } else { if(vDisplace > 0) { hDisplace = box.position().left + box.width() + ref.width() - jQuery('#outer').width(); if(hDisplace > 0) ref.offset({left: box.offset().left - ref.width() - pedborderwidth}); else ref.offset({left: box.offset().left + box.width() + (2 * pedborderwidth)}); if(box.position().top < vOffset) vOffset = box.position().top; } } ref.css('top',vOffset); ref.css('z-index',8); ref.css('visibility','visible'); } function hidePopup(slot) { var ref = jQuery("#popup" + slot); if (ref.length) { ref.css('visibility','hidden'); } eval("timer" + slot + "=false;"); } function showBackPopup() { if( lastpopup ) { cancelTimer(lastpopup); hidePopup(lastpopup); } lastpopup = ''; var ref = jQuery("#popupleft"); ref.html(getBackPopup()); if ( ref.css('visibility') != "show" && ref.css('visibility') != "visible" ) { ref.css('z-index',8); ref.css('visibility','visible'); } } function setTimer(slot) { eval( "timer" + slot + "=setTimeout(\"hidePopup('" + slot + "')\",popuptimer);"); } function cancelTimer(slot) { eval( "clearTimeout(timer" + slot + ");" ); eval( "timer" + slot + "=false;" ); } function setFirstPerson(newperson) { if(newperson != firstperson) { firstperson = newperson; if( !tngprint ) { var params = 'personID=' + newperson + '&tree=' + tree + '&parentset=' + parentset + '&generations=' + generations; jQuery("#stdpedlnk").attr('href',pedigree_url + params + '&display=standard'); jQuery("#compedlnk").attr('href',pedigree_url + params + '&display=compact'); jQuery("#boxpedlnk").attr('href',pedigree_url + params + '&display=box'); jQuery("#textlnk").attr('href',pedigreetext_url + params); jQuery("#ahnlnk").attr('href',ahnentafel_url + params); jQuery("#extralnk").attr('href',extrastree_url + params + '&showall=1'); } } } function fetchData(famParams,newgens) { var loading = jQuery("#loading"); loading.show(); var strParams = "generations=" + newgens + "&tree=" + tree + '&display=' + display + famParams; var loader1 = new net.ContentLoader(pedjsonfile,FillChart,null,"POST",strParams); } function getNewChart(personID,newgens,newparentset) { setFirstPerson(personID); fetchData('&personID=' + personID + '&parentset=' + newparentset, newgens ); } function getNewFamilies(famParams,newgens,gender) { //set first person var nextfamily = people[firstperson].famc; if( gender == "F" ) setFirstPerson(families[nextfamily].wife); else setFirstPerson(families[nextfamily].husband); if( famParams ) fetchData(famParams,newgens); else DisplayChart(); } function goBack(backperson) { setFirstPerson( backperson ); DisplayChart(); } function addNewPeople(incoming) { var vars = eval('('+incoming+')'); if(vars.people) { for(var i=0; i < vars.people.length; i++) { //var p = new Person(vars.people[i]); var p = vars.people[i]; var pID = vars.people[i].personID; people[pID] = p; } } if(vars.families) { for(var i=0; i < vars.families.length; i++){ var family = vars.families[i]; var famID = vars.families[i].famID; families[famID] = family; } } } function getGenderIcon(gender) { var genderstr, icon = ""; var valign = display == "compact" ? -2 : -1; if(gender) { if(gender == "M") genderstr = "male"; else if(gender == "F") genderstr = "female"; if(genderstr) icon = " "; } return icon; } function FillChart() { addNewPeople(this.req.responseText); var loading = jQuery("#loading"); DisplayChart(); loading.hide(); } function DisplayChart() { toplinks = ""; botlinks = ""; endslotctr = 0; endslots = new Array(); var slot = 1; FillSlot(slot,firstperson,0); var offpage; var leftarrow = jQuery('#leftarrow'); if(people[firstperson].backperson) { leftarrow.html('' + leftarrowimg + ''); leftarrow.css('visibility','visible'); } else { var gotkids = 0; var activeperson = people[firstperson]; var spFamID; if( activeperson.spfams) { for( var i = 0; i < activeperson.spfams.length; i++ ) { spFamID = activeperson.spfams[i].spFamID; if( families[spFamID].children ) { gotkids = 1; break; } } } if( gotkids ) { leftarrow.html('' + leftarrowimg + ''); leftarrow.css('visibility','visible'); } else { leftarrow.html(''); leftarrow.css('visibility','hidden'); } } topparams = getParams( toplinks ); botparams = getParams( botlinks ); for( var i = 0; i < endslots.length; i++ ) { offpage = jQuery('#offpage'+endslots[i]); offpage.css('visibility','visible'); } } function FillSlot(slot,currperson,lastperson) { var currentBox = document.getElementById('box'+slot); var content = ""; var slotperson, husband, wife; if( people[currperson] ) slotperson = people[currperson]; else { slotperson = new Object; slotperson.famc = -1; slotperson.personID = 0; } slots[slot] = slotperson; var dnarrow = jQuery('#downarrow'+slot); var popup = jQuery('#popup'+slot); var popupcontent = ""; var shadow, border, icons = ""; if( slotperson.personID ) { //save primary marriage if( lastperson ) slotperson.famID = people[lastperson].famc; else slotperson.famID = ""; if( hideempty ) { currentBox.style.visibility = 'visible'; toggleLines(slot,slotperson.famc,'visible'); } if( slotperson.photosrc && slotperson.photosrc != "-1" ) { content = ''; if( slotperson.photolink && slotperson.photolink != "-1" ) content = '' + content + ''; content = '
' + slotabbr + ' | ' + slotevent1 + ' | ||
' + slotabbr + ' | ' + slotevent2 + ' | ||
' + count + ' | '; popupcontent += '' + spouselink + ' | ||
' + txt_children + ': | |||
' + kidlink + ' | '; popupcontent += '' + kidlink + spchild.name + ' |