%( $Id: anclist_nxd.txt mickroue(a)yahoo.fr 20140818 templ=templm %)

%( %import;anclist_deslist_stat_age %)

%( begin $Id: anclist_deslist_stat_age.txt mickroue(a)yahoo.fr 20131203 templ=templm %)

%define;stat_age1()
  <div class="col">
    110<br%/>100<br%/>90<br%/>80<br%/>
    70<br%/>60<br%/>50<br%/>40<br%/>
    30<br%/>20<br%/>10<br%/>0
  </div>
  <div class="body">
    %reset_count;
    %foreach;sorted_list_item;
      %if;(item.1 = 0)
        %incr_count;
        %if;(next_item.2 != item.2)
          %let;l_width0;%expr(count * l_size)%in;
          %let;l_width;%if;(l_width0 > max_width)%max_width;%else;%l_width0;%end;%in;
          <span class="a%item.1;%item.2;" style="border-left:solid %l_width;px #4682B4;">%count;</span>
          %reset_count;
        %end;
      %end;
      %if;(item.1 = 1)
        %incr_count;
        %if;(next_item.2 != item.2)
          %let;l_width0;%expr(count * l_size)%in;
          %let;l_width;%if;(l_width0 > max_width)%max_width;%else;%l_width0;%end;%in;
          <span class="a%item.1;%item.2;" style="border-left:solid %l_width;px #FF69B4;">%count;</span>
          %reset_count;
        %end;
      %end;
    %end;
  </div>
%end;

%define;stat_age2()
  %let;l_height;%expr(40 + (count *2))%in;
  <div class="body bcbg1" style="height:%l_height;px;">
    %reset_count;
    %foreach;sorted_list_item;
      %incr_count;
      %let;l_top;%expr(20 + (count * 2))%in;
      %let;l_left0;%expr(20 + item.2 * 8)%in;
      %let;l_left;%if;(l_left0 > 840)840%else;%l_left0;%end;%in;
      %if;(count = 1)
        <span class="date">%item.1;</span>
        <span class="lev">%level;</span>
      %end;
      %if;(next_item.1 = "")<span class="date" style="top:%l_top;px;">%item.1;</span>%end;
      <a href="%prefix;i=%item.4;" class="link"
         style="color:#%if;(item.3 = 0)4682B4;%else;FF69B4%end;;left:%l_left;px;top:%l_top;px;">%item.2;</a>
    %end;
  </div>
%end;

%( end $Id: anclist_deslist_stat_age.txt mickroue(a)yahoo.fr 20131203 templ=templm %)

%( death date year - spouse death date year tf1 = nxd %)
  %apply;gen()
  <div class="stat_age2 bcbg1">
    <table class="title" width="100%%"><tr>
    <td>[*generation/generations]0</td>
    <td align="center">[*year/month/day]0 [death] - [year/month/day]0 [death] x
        (<span style="color:#4682B4;"/>[M/F]0</span>,
         <span style="color:#FF69B4;"/>[M/F]1</span>)</td>
    <td align="right">[*date of death]</td>
    </tr></table>
    %foreach;ancestor_level(l_v)
      %empty_sorted_list;
      %reset_count;
      %if;(level > 1 and (evar.only != "on" or level = l_v))
        %foreach;ancestor;
          %if;(ancestor.is_male and ancestor.same = "")
            %if;(ancestor.death_date.year != "" and ancestor.death_date.prec = ""
                 and ancestor.spouse.death_date.year != "" and ancestor.spouse.death_date.prec = "")
              %let;a;%ancestor.death_date.year;%in;
              %let;b;%ancestor.spouse.death_date.year;%in;
              %incr_count;
              %if;(a >= b)
                %let;l_age;%expr(a - b)%in;
                %apply;add_in_sorted_list(a,l_age,ancestor.sex,ancestor.index)
              %elseif;(a < b)
                %let;l_age;%expr(b - a)%in;
                %apply;add_in_sorted_list(b,l_age,ancestor.spouse.sex,ancestor.spouse.index)
              %end;
            %end;
          %end;
        %end;
        %apply;stat_age2()
      %end;
    %end;
  </div>
