%doctype;
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <!-- $Id: anclist.txt,v 5.4 2007/01/19 01:53:16 ddr Exp $ -->
  <!-- Copyright (c) 1998-2007 INRIA -->
  <!-- Modified mickroue(a)yahoo.fr 20130107 templ=templm -->
  <title>%nn;
    %first_name; %surname;
    %if;(evar.t = "E" and evar.opt = "csv") - CSV - 
    %elseif;(evar.t = "E" and evar.opt = "fam") - [*family/families]0 - 
    %elseif;(evar.t = "E" and evar.opt = "place") - [*list eclair]0 - [places] 
    %elseif;(evar.t = "E" and evar.opt = "surn") - [*list eclair]0 - [surname/surnames]1 / [places] 
    %elseif;(evar.t = "E" and evar.opt = "aad") - [*age at death] ([M/F]0, [M/F]1) 
    %elseif;(evar.t = "E" and evar.opt = "afm") - [*age] ([father/mother]0, [father/mother]1) 
    %elseif;(evar.t = "F") - [*surnames branch] - 
    %else; - [*ancestors] - 
    %end;
  </title>
  <meta name="robots" content="none"%/>
  <meta name="format-detection" content="telephone=no"%/>
  <meta http-equiv="Content-Type" content="text/html; charset=%charset;"%/>
  <meta http-equiv="Content-Style-Type" content="text/css"%/>
  <link rel="shortcut icon" href="%image_prefix;/favicon_gwd.png"%/>
  %include.css;
  %base_header;
</head>
%(<!-- Begin define --> %)
%let;birth_symbol;%if;(bvar.birth_symbol != "")%bvar.birth_symbol;%else;&deg;%end;%in;
%let;death_symbol;%if;(bvar.death_symbol != "")%bvar.death_symbol;%else;&dagger;%end;%in;
%let;marriage_symbol;&amp;%in;
%let;ref_index;%index;%in;
%let;ref_sex;%if(is_male)[him/her]0%elseif;(is_female)[him/her]1%else;0%end;%in;
%let;max_event;%if;(bvar.latest_event = "")100%else;%bvar.latest_event;%end;%in;

%define;tothegen(xx)
  [*to the %s generation:::xx]%nn;
%end;

%define;togen(xx)
  %if;(xx = 1)[*specify::generation/generations]0%nn;
  %elseif;(xx = 2)[*to the parents]%nn;
  %elseif;(xx = 3)[*to the grandparents]%nn;
  %elseif;(xx = 4)[*to the great-grandparents]%nn;
  %else;
    %apply;tothegen%with;
      %apply;nth([nth (generation)], xx)
    %end;
  %end;
%end;

%define;gen()
  <p>
    %if;(evar.only != "on")
      %apply;togen(evar.v)
    %else;
      [*generation/generations]0 %evar.v;
    %end;
  </p>
%end;

%define;ancestors_by_list(xx, nnn)
  %if;(xx.has_parents and nnn > 1)
    <ul>
    <li style="list-style-type:square"><a href="%prefix;
    %xx.father.access;">%xx.father;</a>%xx.father.title;%xx.father.dates;%nl;
    %apply;ancestors_by_list("xx.father", nnn - 1)</li>
    <li style="list-style-type:circle"><a href="%prefix;
    %xx.mother.access;">%xx.mother;</a>%xx.mother.title;%xx.mother.dates;%nl;
    %apply;ancestors_by_list("xx.mother", nnn - 1)</li>
    </ul>
  %end;
%end;

%define;ancestors_horizontally(pp, xx, ss1, ss2, ss3)
  %if;(xx > 0)
    %if;(pp.has_parents)
      %apply;ancestors_horizontally(
        "pp.father", xx - 1, "ss1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
        "ss1&nbsp;+--&nbsp;", "ss1&nbsp;|&nbsp;&nbsp;&nbsp;")
    %end;
    <tt>ss2</tt><a href="%prefix;%pp.access;">%pp;</a>%pp.title;%pp.dates;<br%/>
    %if;(pp.has_parents)
      %apply;ancestors_horizontally(
        "pp.mother", xx - 1, "ss3&nbsp;|&nbsp;&nbsp;&nbsp;",
        "ss3&nbsp;+--&nbsp;", "ss3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
    %end;
  %end;
%end;

%define;csv_line2()
          ;%family_cnt;
          ;%marriage_date.prec;
          ;%marriage_date.year;
          ;%marriage_date.month;
          ;%marriage_date.day;
          ;%marriage_place;
          ;%spouse.first_name;
          ;%spouse.surname;
          ;%spouse.first_name_key_val;
          ;%spouse.surname_key_val;
          ;%spouse.occ;
%end;

%define;csv_line1(yy)
          ;%index;
          ;%family.index;
          ;%first_name_key_val;
          ;%surname_key_val;
          ;%occ;
          ;%if;(sosa_in_list != "")%sosa_in_list;%end;
          ;%ancestor.anc_sosa;
          ;yy.%child_cnt;
          ;%sex;
          ;%consanguinity;
          ;%first_name;
          ;%surname;
          ;%birth_date.prec;
          ;%birth_date.year;
          ;%birth_date.month;
          ;%birth_date.day;
          ;%birth_place;
          ;%death_date.prec;
          ;%death_date.year;
          ;%death_date.month;
          ;%death_date.day;
          ;%death_place;
          ;%father.first_name;
          ;%father.surname;
          ;%father_age_at_birth;
          ;%mother.first_name;
          ;%mother.surname;
          ;%mother_age_at_birth;
          %nn;
%end;

%define;csv_line3(xx,yy,zz)
          ;%xx.index;
          ;%family.index;
          ;%xx.first_name_key_val;
          ;%xx.surname_key_val;
          ;%xx.occ;
          ;%if;(sosa_in_list != "")%sosa_in_list;%end;
          ;%ancestor.anc_sosa;
          ;yy.%child_cnt;xzz%nn;
          ;%xx.sex;
          ;%consanguinity;
          ;%xx.first_name;
          ;%xx.surname;
          ;%birth_date.prec;
          ;%birth_date.year;
          ;%birth_date.month;
          ;%birth_date.day;
          ;%xx.birth_place;
          ;%death_date.prec;
          ;%death_date.year;
          ;%death_date.month;
          ;%death_date.day;
          ;%xx.death_place;
          ;%xx.father.first_name;
          ;%xx.father.surname;
          ;%nn;
          ;%xx.mother.first_name;
          ;%xx.mother.surname;
          ;%nn;
          ;%family_cnt;
          ;%marriage_date.prec;
          ;%marriage_date.year;
          ;%marriage_date.month;
          ;%marriage_date.day;
          ;%marriage_place;
          ;%first_name;
          ;%surname;
          ;%first_name_key_val;
          ;%surname_key_val;
          ;%occ;
          %nn;
%end;

%define;csv_line(yy,zz)
  %foreach;child;
    %if;(child.has_families)
      %foreach;child.family;
        %incr_count;%count;
        %apply;csv_line1("yy.zz")
        %apply;csv_line2()
        <br%/>
        %if;(spouse.sosa_in_list = "")
          %incr_count;%count;
          %apply;csv_line3("spouse","yy.zz",family_cnt)<br%/>
        %end;
        %if;(evar.cousins="on" and child.has_families and child.sosa_in_list = "")
          %apply;csv_line("yy.zz",child_cnt)
        %end;
      %end;
    %else;
    %incr_count;%count;
    %apply;csv_line1("yy.zz")%nn;
     ;;;<br%/>
    %end;
  %end;
%end;

%define;ld_somebody1(bbb,ddd,xx,yy,lexa,lexb,sss,ttt)
  %let;relationship;
    %if;("lexb" != "")
      %apply;a_of_b%with;
        %if(xx.is_male)[lexa]0%elseif;(xx.is_female)[lexa]1%else;[lexa]2%end;
      %and;
        %if(sss = 0)[lexb]0%elseif;(sss = 1)[lexb]1%else;[lexb]2%end;
      %end;
    %else;
      %if;(xx.is_male)[lexa]0%elseif;(xx.is_female)[lexa]1%else;[lexa]2%end;
    %end;
  %in;
  %apply;add_in_sorted_list%with;
    %if;(xx.yy_date.year != "")
      %xx.yy_date.year;%nn;
      %if;(xx.yy_date.month = "")00%elseif;(xx.yy_date.month < 10)0%end;%xx.yy_date.month;%nn;
      %if;(xx.yy_date.day = "")00%elseif;(xx.yy_date.day < 10)0%end;%xx.yy_date.day;%nn;
    %else;
      99999999%xx.yy_date.year;%nn;
    %end;
  %and;
    %if;(xx.yy_date.year >=  bbb)
      %expr(xx.yy_date.year - bbb)%nn;
    %elseif;(bbb > xx.yy_date.year)
      -%expr(bbb - xx.yy_date.year)%nn;
    %end;
  %and;
    %if;("yy" = "birth")1%else;3%end;%(sorted : birth = 1 marriage = 2 death = 3%)%nn;
  %and;
    %xx.on_yy_date;
  %and;
    %xx.yy_place;
  %and;
    ttt%nn;
  %and;
    %if;(cancel_links or xx.is_restricted)
      %xx;%nn;
    %else;
      %if;(browsing_with_sosa_ref)
        <a href="%prefix;m=RLM;et=S;spouse=on;image=%evar.image;;%nn;
          i1=%sosa_ref.index;;%nn;
          i2=%xx.index;;t2=%relationship;;%nn;
          i3=%ref_index;;t3=%ref_sex;;%nn;
          i4=%sosa_ref.index;;t4=sosa_1">%xx;</a>%nn;
      %else;
        <a href="%prefix;em=R;ei=%xx.index;;spouse=on;et=S;image=%evar.image;;i=%ref_index;">%xx;</a>%nn;
      %end;
    %end;
  %and;
    %relationship;
    %if;("yy" = "death" and xx.computable_death_age)
      <span class="nobr xs">%sp;%death_symbol;%xx.death_age;</span>
    %end;
    %if;("yy" = "birth" and xx.computable_age)
      <span class="nobr xs">%sp;%birth_symbol;%xx.age;</span>
    %end;
  %and;
    %xx.occupation;
  %and;
    %xx.index;
  %and;
    %if;(xx.yy_date.year < bbb)
      ld_before%nn;
    %elseif;(xx.yy_date.year > ddd)
      ld_after%nn;
    %elseif;(xx.yy_date.year >= 0)
      ld_yy%xx.sex;%nn;
    %else;
      ld_no_date%nn;
    %end;
  %and;
    %xx.has_sosa;
  %and;
    %if;("lexa" = "him/her")
      ld_him_her%nn;
    %end;
  %and;
    border_family_%xx.has_families; border_sex_%xx.sex;
  %and;
    %if;("yy" = "birth" and "xx" != "spouse" and "xx" != "parent")
      %if;("xx" != "ancestor" or xx.anc_sosa.v % 2 = 0)
        %xx.index;
      %end;
    %end;
  %end;
%end;

%define;ld_marriage(bbb,ddd,xx,lexa,lexb,sss)
  %let;relationship;
    %if;("lexb" != "")
      %apply;a_of_b%with;
        %if(xx.is_male)[lexa]0%elseif;(xx.is_female)[lexa]1%else;[lexa]2%end;
      %and;
        %if(sss = 0)[lexb]0%elseif;(sss = 1)[lexb]1%else;[lexb]2%end;
      %end;
    %else;
      %if;(xx.is_male)[lexa]0%elseif;(xx.is_female)[lexa]1%else;[lexa]2%end;
    %end;
  %in;
  %apply;add_in_sorted_list%with;
    %if;(marriage_date.year != "")
      %marriage_date.year;%nn;
      %if;(marriage_date.day = "")00%elseif;(marriage_date.month < 10)0%end;%marriage_date.month;%nn;
      %if;(marriage_date.day = "")00%elseif;(marriage_date.day < 10)0%end;%marriage_date.day;%nn;
    %else;
      99999999%marriage_date.year;%nn;
    %end;
  %and;
    %if;(marriage_date.year >=  bbb)
      %expr(marriage_date.year - bbb)%nn;
    %elseif;(bbb > marriage_date.year)
      -%expr(bbb - marriage_date.year)%nn;
    %end;
  %and;
    2%nn;%(sorted : birth = 1 marriage = 2 death = 3%)
  %and;
    %on_marriage_date;
  %and;
    %marriage_place;
  %and;
    &amp;%nn;
  %and;
    %if;(cancel_links or xx.is_restricted)
      %xx;<br%/> &amp; %spouse;%nn;
    %else;
      %if;(browsing_with_sosa_ref)
        <a href="%prefix;m=RLM;et=S;spouse=on;image=%evar.image;;%nn;
          i1=%sosa_ref.index;;%nn;
          i2=%xx.index;;t2=%relationship;;%nn;
          i3=%ref_index;;t3=%ref_sex;;%nn;
          i4=%sosa_ref.index;;t4=sosa_1">%xx;</a>%nn;
      %else;
        <a href="%prefix;em=R;ei=%xx.index;;spouse=on;et=S;image=%evar.image;;i=%ref_index;">%xx;</a>
      %end;
       &amp; %spouse;%nn;
    %end;
  %and;
    %relationship;
  %and;
    %xx.occupation;%nn;
  %and;
    %xx.index;
  %and;
    %if;(marriage_date.year < bbb)
      ld_before%nn;
    %elseif;(marriage_date.year > ddd)
      ld_after%nn;
    %elseif;(marriage_date.year >= 0)
      ld_marriage%nn;
    %else;
      ld_no_date%nn;
    %end;
  %and;
    %xx.has_sosa;
  %and;
    %if;("lexa" = "him/her")
      ld_him_her%nn;
    %end;
  %and;
    border_family_%xx.has_families; border_sex_%xx.sex;
  %and;
  %end;
%end;

%define;ld_somebody(bbb,ddd,xx,lexa,lexb,sss)
  %apply;ld_somebody1(bbb,ddd,"xx","birth","lexa","lexb","sss",birth_symbol)
  %if;(xx.is_dead)
    %apply;ld_somebody1(bbb,ddd,"xx","death","lexa","lexb","sss",death_symbol)
  %end;
%end;

%define;ld_cousin(bbb,ddd,curlev,maxlev,lexa,lexb,sss)
  %if;(nb_children > 0)
    %foreach;child;
      %if;(child.sosa_in_list = "" and child.index != a_i and child.index != b_i and child.index != c_i)
        %apply;ld_somebody(bbb,ddd,"child","lexa","lexb","sss")
        %if;(child.has_families)
          %foreach;child.family;
            %apply;ld_marriage(bbb,ddd,"child","lexa","lexb","sss")
            %if;(curlev = 0)
              %apply;ld_somebody(bbb,ddd,"spouse","the spouse","an uncle/an aunt",sex)
              %apply;ld_cousin(bbb,ddd,curlev+1,maxlev,"a cousin","","")
            %elseif;(curlev = 1)
              %apply;ld_cousin(bbb,ddd,curlev+1,maxlev,"a son/a daughter/a child","a cousin",sex)
            %elseif;(curlev = 2)
              %apply;ld_cousin(bbb,ddd,curlev+1,maxlev,"a grandson/a granddaughter/a grandchild","a cousin","sss")
            %elseif;(curlev = 3)
              %apply;ld_cousin(bbb,ddd,curlev+1,maxlev,"a great-grandson/a great-granddaughter/a great-grandchild","a cousin","sss")
            %elseif;(curlev = 4)
              %apply;ld_cousin(bbb,ddd,curlev+1,maxlev,"a great-grandson/a great-granddaughter/a great-grandchild","a cousin","sss")
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;
%end;

%define;ld_2nd_cousin(bbb,ddd,curlev,maxlev,lexa,lexb,sss)
  %if;(nb_children > 0)
    %foreach;child;
      %if;(child.sosa_in_list = "" and child.index != a_i and child.index != b_i and child.index != c_i 
           and child.index != d_i and child.index != e_i and child.index != f_i and child.index != g_i)
        %apply;ld_somebody(bbb,ddd,"child","lexa","lexb","sss")
        %if;(child.has_families)
          %foreach;child.family;
            %apply;ld_marriage(bbb,ddd,"child","lexa","lexb","sss")
            %if;(curlev = 0)
              %apply;ld_somebody(bbb,ddd,"spouse","the spouse","a great-uncle/a great-aunt",sex)
              %apply;ld_2nd_cousin(bbb,ddd,curlev+1,maxlev,"a cousin","the father/the mother/a parent","")
            %elseif;(curlev = 1)
              %apply;ld_2nd_cousin(bbb,ddd,curlev+1,maxlev,"a 2nd cousin","",sex)
            %elseif;(curlev = 2)
              %apply;ld_2nd_cousin(bbb,ddd,curlev+1,maxlev,"a son/a daughter/a child","a 2nd cousin",sex)
            %elseif;(curlev = 3)
              %apply;ld_2nd_cousin(bbb,ddd,curlev+1,maxlev,"a grandson/a granddaughter/a grandchild","a 2nd cousin","sss")
            %elseif;(curlev = 4)
              %apply;ld_2nd_cousin(bbb,ddd,curlev+1,maxlev,"a great-grandson/a great-granddaughter/a great-grandchild","a 2nd cousin","sss")
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;
%end;

%define;ld_children(bbb,ddd,curlev,maxlev,lexa,lexb,sss)
  %if;(nb_children > 0)
    %foreach;child;
      %apply;ld_somebody(bbb,ddd,"child","lexa","","")
      %if;(child.has_families)
        %foreach;child.family;
          %apply;ld_marriage(bbb,ddd,"child","lexa","","")
          %if;(curlev = 0 and maxlev > 2)
            %apply;ld_somebody(bbb,ddd,"spouse","a son-in-law/a daughter-in-law","","")
            %apply;ld_children(bbb,ddd,curlev+1,maxlev,"a grandson/a granddaughter/a grandchild","",sex)
          %elseif;(curlev = 1 and maxlev > 3)
            %apply;ld_somebody(bbb,ddd,"spouse","the spouse","a grandson/a granddaughter/a grandchild",sex)
            %apply;ld_children(bbb,ddd,curlev+1,maxlev,"a great-grandson/a great-granddaughter/a great-grandchild","","")
          %end;
        %end;
      %end;
    %end;
  %end;
%end;

%define;ld_nephew(bbb,ddd,curlev,maxlev,lexa)
  %if;(nb_children > 0)
    %foreach;child;
      %if;(child.index != a_i)
        %apply;ld_somebody(bbb,ddd,"child","lexa","","")
        %if;(child.has_families)
          %foreach;child.family;
            %apply;ld_marriage(bbb,ddd,"child","lexa","","")
            %if;(curlev = 0)
              %if;("lexa" = "a half-brother/a half-sister/a half-sibling")
                %let;test;[the spouse]%in;
                %apply;ld_somebody(bbb,ddd,"spouse","the spouse","lexa",sex)
              %else;
                %apply;ld_somebody(bbb,ddd,"spouse","a brother-in-law/a sister-in-law","","")
              %end;
              %apply;ld_nephew(bbb,ddd,curlev+1,maxlev,"a nephew/a niece")
            %elseif;(curlev = 1 and maxlev > 2)
              %apply;ld_nephew(bbb,ddd,curlev+1,maxlev,"a great-nephew/a great-niece")
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;
%end;

%define;ld(bbb,ddd)
  %let;maxlev;
    %apply;min(evar.v, max_anc_level, 4)
  %in;
  %empty_sorted_list;
  %foreach;ancestor_level(maxlev)
    %foreach;ancestor;
      %if;(level=1)
        %apply;ld_somebody(bbb,ddd,"ancestor","him/her","","")
        %foreach;ancestor.family;
          %apply;ld_marriage(bbb,ddd,"ancestor","him/her","","")
          %apply;ld_somebody(bbb,ddd,"spouse","the spouse","","")
          %if;(spouse.has_parents and evar.v != 1)
            %foreach;spouse.parent;
              %apply;ld_somebody(bbb,ddd,"parent","the father-in-law/the mother-in-law","","")
            %end;
          %end;
          %apply;ld_children(bbb,ddd,0,maxlev,"a son/a daughter/a child","","")
        %end;
      %elseif;(level=2)
        %let;a_i;%index;%in;
        %apply;ld_somebody(bbb,ddd,"ancestor","the father/the mother/a parent","","")
        %if;(evar.cousins = "on")
          %foreach;ancestor.family;
            %if;(ancestor.is_male and spouse.index = ancestor.spouse.index)
              %apply;ld_marriage(bbb,ddd,"ancestor","the parents","","")
            %elseif;(ancestor.nb_families > 1 and spouse.index != ancestor.spouse.index)
              %apply;ld_marriage(bbb,ddd,"ancestor","the father/the mother/a parent","","")
              %apply;ld_nephew(bbb,ddd,0,maxlev,"a half-brother/a half-sister/a half-sibling")
            %else;
              %apply;ld_nephew(bbb,ddd,0,maxlev,"a brother/a sister/a sibling")
            %end;
          %end;
        %end;
      %elseif;(level=3)
        %let;a_i;%index;%in;
        %let;b_i;%father.index;%in;
        %let;c_i;%mother.index;%in;
        %apply;ld_somebody(bbb,ddd,"ancestor","a grandfather/a grandmother/a grandparent","","")
        %if;(evar.cousins = "on")
          %foreach;ancestor.family;
            %apply;ld_cousin(bbb,ddd,0,maxlev,"an uncle/an aunt","","")
          %end;
        %end;
      %elseif;(level=4)
        %let;a_i;%index;%in;
        %let;b_i;%father.index;%in;
        %let;c_i;%mother.index;%in;
        %let;d_i;%father.father.index;%in;
        %let;e_i;%father.mother.index;%in;
        %let;f_i;%mother.father.index;%in;
        %let;g_i;%mother.mother.index;%in;
        %apply;ld_somebody(bbb,ddd,"ancestor","a great-grandfather/a great-grandmother/a great-grandparent","","")
        %if;(evar.cousins = "on")
          %foreach;ancestor.family;
            %apply;ld_2nd_cousin(bbb,ddd,0,maxlev,"a great-uncle/a great-aunt","","")
          %end;
        %end;
      %end;
    %end;
  %end;
%end;

%define;url(z1,z2)
  %apply;lazy_print("z1=z2;")
  %foreach;env_binding;
    %if;(env.key="z1")%lazy_force;%else;%env.key;=%env.val;;%end;
  %end;
  %if;(not lazy_printed)
    z1=z2;
  %end;
%end;

%define;stat_month(xx)
  %reset_count;
  %empty_sorted_list;
  %foreach;ancestor_level(evar.v)
    %if;(level > 1 and (evar.only != "on" or level = evar.v))
      %foreach;ancestor;
        %if;(ancestor.same = "")
          %let;l_month;%ancestor.xx_date.month;%in;
          %if;(l_month > 0)
            %incr_count;
            %apply;add_in_sorted_list(ancestor.sex,l_month,count)
          %end;
        %end;
      %end;
    %end;
  %end;
  %let;max_width;360%in;
  %let;l_size;%expr(36 / ((120 + count) /12 / 10))%in;
  <div class="stat_month bcbg1">
    <table class="title" width="100%%"><tr>
      <td>[*year/month/day]1</td>
      <td align="center">
        [*xx]
        (<span style="color:#4682B4;"/>[M/F]0</span>,
         <span style="color:#FF69B4;"/>[M/F]1</span>)</td>
      <td align="right"><em>%count; [date/dates]1</em></td>
    </tr></table>
    <div class="col">
      [(month)]0<br%/>[(month)]1<br%/>[(month)]2<br%/>[(month)]3<br%/>
      [(month)]4<br%/>[(month)]5<br%/>[(month)]6<br%/>[(month)]7<br%/>
      [(month)]8<br%/>[(month)]9<br%/>[(month)]10<br%/>[(month)]11
    </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="m%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="m%item.1;%item.2;" style="border-left:solid %l_width;px #FF69B4;">%count;</span>
            %reset_count;
          %end;
        %end;
      %end;
    </div>
  </div>
%end;

%define;color(xx)
  %apply;nth%with;
    /333333/993333/339933/333399/999999/339999/993399/999933/AAAAAA/FFAAAA/AAFFAA/AAAAFF/FFFFFF/AAFFFF/FFAAFF/FFFFAA%and;
    xx%end;
%end;

%define;stat_calendar()
%( table calendar nb day-month %)
  %reset_count;
  %empty_sorted_list;
  %foreach;ancestor_level(evar.v)
    %if;(level > 1 and (evar.only != "on" or level = evar.v))
      %foreach;ancestor;
        %if;(ancestor.same = "")
          %if;(ancestor.birth_date.day > 0)
            %incr_count;
            %let;mm_dd;%expr(ancestor.birth_date.month+100)_%expr(ancestor.birth_date.day+100)%in;
            %apply;add_in_sorted_list(mm_dd,ancestor.birth_date.month,ancestor.birth_date.day,ancestor.index,birth_symbol)
          %end;
          %if;(ancestor.death_date.day > 0)
            %incr_count
            %let;mm_dd;%expr(ancestor.death_date.month+100)_%expr(ancestor.death_date.day+100)%in;
            %apply;add_in_sorted_list(mm_dd,ancestor.death_date.month,ancestor.death_date.day,ancestor.index,death_symbol)
          %end;
        %end;
      %end;
    %end;
  %end;
  <div class="stat_calendar bcbg1">
    <a class="title" style="color:#EEEEEE;" href="%prefix;m=A;t=E;opt=ars;i=%index;;v=%evar.v;;only=%evar.only;"
         title="Ars">[*calendar/calendars]0</a>
    <div class="row">
      %reset_count;
      %for;i;1;32;
        %incr_count;
        <div>%count;</div>
      %end;
    </div>
    <div class="col">
      [(month)]0<br%/>[(month)]1<br%/>[(month)]2<br%/>[(month)]3<br%/>
      [(month)]4<br%/>[(month)]5<br%/>[(month)]6<br%/>[(month)]7<br%/>
      [(month)]8<br%/>[(month)]9<br%/>[(month)]10<br%/>[(month)]11
    </div><br%/>
    <div class="body">
    %reset_count;
    %foreach;sorted_list_item;
      %if;(prev_item.1 != item.1)
        %reset_count;%incr_count;
        <a href="%prefix;spouse=on;m=RLM;i%count;=%item.4;;t%count;=%item.5;;%nn;
      %end;
      %if;(prev_item.1 = item.1)
        %incr_count;
        i%count;=%item.4;;t%count;=%item.5;;%nn;
      %end;
      %if;(next_item.1 != item.1)
        %let;top;%expr(item.2 * 30 - 30)%in;
        %let;left;%expr(item.3 * 28 - 28)%in;
        %let;colhex;%apply;color(count)%in;
        %incr_count;
        i%count;=%index;;t%count;=%item.3; %apply;nth([(month)],item.2-1);%nn;
        %if;(max_event >= count)
          " style="border:solid 1px #%colhex;; color:#%colhex;;top:%top;px;left:%left;px;">%expr(count - 1)</a>
        %else;
          " style="display:none;"></a>
          <span style="border:solid 1px #%colhex;; color:#%colhex;;top:%top;px;left:%left;px;">%expr(count - 1)</span>
        %end;
      %end;
    %end;
    </div>
  </div>
%end;

%define;option_ars(xx)
  <option value="evar.none"
        %if;("xx"="evar.none")selected="selected"%end;>-</option>
  <option value="ancestor.first_name"
        %if;("xx"="ancestor.first_name")selected="selected"%end;>[first name/first names]0</option>
  <option value="ancestor.surname"
        %if;("xx"="ancestor.surname")selected="selected"%end;>[surname/surnames]0</option>
  <option value="ancestor.occupation"
        %if;("xx"="ancestor.occupation")selected="selected"%end;>[occupation/occupations]0</option>
  <option value="ancestor.dates"
        %if;("xx"="ancestor.dates")selected="selected"%end;>[date/dates]1</option>
  <option value="ancestor.birth_date.year"
        %if;("xx"="ancestor.birth_date.year")selected="selected"%end;>[birth] [year/month/day]0</option>
  <option value="ancestor.birth_place"
        %if;("xx"="ancestor.birth_place")selected="selected"%end;>[birth] [place]</option>
  <option value="ancestor.death_date.year"
        %if;("xx"="ancestor.death_date.year")selected="selected"%end;>[death] [year/month/day]0</option>
  <option value="ancestor.death_place"
        %if;("xx"="ancestor.death_place")selected="selected"%end;>[death] [place]</option>
%end;

%define;ars(m_bt,m_bf,m_dt,m_df,f_bt,f_bf,f_dt,f_df)
  %reset_count;
  %empty_sorted_list;
  %foreach;ancestor_level(evar.v)
    %if;(level > 1 and (evar.only != "on" or level = evar.v))
      %let;lev;%expr(evar.v - level + 1)%in;
      %foreach;ancestor;
        %if;(ancestor.same = "")
          %incr_count;
          %let;aad;
            %if;(ancestor.death_date.year > ancestor.birth_date.year)
              %expr((ancestor.death_date.year - ancestor.birth_date.year)*2)
              %else;0%nn;
            %end;
          %in;
          %if;(ancestor.sex = 0)
            %apply;add_in_sorted_list(
                   level,ancestor.index,ancestor.sex,
                   ancestor.birth_date.day,ancestor.birth_date.month,
                   ancestor.death_date.day,ancestor.death_date.month,
                   "m_bt",m_bf,"m_dt",m_df,aad,lev)
          %else;
            %apply;add_in_sorted_list(
                   level,ancestor.index,ancestor.sex,
                   ancestor.birth_date.day,ancestor.birth_date.month,
                   ancestor.death_date.day,ancestor.death_date.month,
                   "f_bt",f_bf,"f_dt",f_df,aad,lev)
          %end;
        %end;
      %end;
    %end;
  %end;
  <div class="stat_ars bcbg1" style="width:%width;px;height:%height;px;font-family:%ff;;">
    %foreach;sorted_list_item;
      %let;i9;%if;(count > ic)%apply;initial(item.9)%else;%item.9;%end;%in;
      %let;i11;%if;(count > ic)%apply;initial(item.11)%else;%item.11;%end;%in;
      %let;fs1;%expr((item.13 + fs) * fs)%in;
      %let;db;%if;(item.4 = "")%expr((item.2 + 31) % 31 + 1)%else;%item.4;%end;%in;
      %let;dd;%if;(item.6 = "")%expr((item.2 + 31) % 31 + 1)%else;%item.6;%end;%in;
      %let;mb;%if;(item.5 = "")%expr((item.2 + 12) % 12 + 1)%else;%item.5;%end;%in;
      %let;md;%if;(item.7 = "")%expr((item.2 + 12) % 12 + 1)%else;%item.7;%end;%in;
      %let;dbc;%expr(8 * db)%in;
      %let;ddc;%expr(8 * dd)%in;
      %let;mbc;%expr(21 * mb)%in;
      %let;mdc;%expr(21 * md)%in;
      %let;pad;%expr(item.13 * 10)%in;
      %let;aad;%expr(item.12 + green)%in;
      %if;(item.3 = 0)
        <a href="%prefix;spouse=on;m=RLM;image=%evar.image;;i1=%item.2;;t1=*;%rlm2;;%rlm3;"
           style="left:%expr((db * lx) + pad - lx)px;
                  top:%expr((mb * tx) + pad - tx)px;
                  font-size:%fs1;px;z-index:%item.1;;
                  color:rgb(%expr(mdc + red), %aad;, %expr(dbc + blue));">%item.8;%i9;</a>
        <a href="%prefix;spouse=on;m=RLM;image=%evar.image;;i1=%item.2;;t1=*;%rlm2;;%rlm3;"
           style="left:%expr((dd * lx) + pad - lx)px;
                  top:%expr((md * tx) + pad - tx)px;
                  font-size:%fs1;px;z-index:%item.1;;
                  color:rgb(%expr(ddc + red), %aad;, %expr(mbc + blue));">%item.10;%i11;</a>
      %end;
      %if;(item.3 = 1)
        <a href="%prefix;spouse=on;m=RLM;image=%evar.image;;i1=%item.2;;t1=*;%rlm2;;%rlm3;"
           style="left:%expr((db * lx) + pad - lx)px;
                  top:%expr((mb * tx) + pad - tx)px;
                  font-size:%fs1;px;z-index:%item.1;;
                  color:rgb(%expr(dbc + red), %aad;, %expr(mdc + blue));">%item.8;%i9;</a>
        <a href="%prefix;spouse=on;m=RLM;image=%evar.image;;i1=%item.2;;t1=*;%rlm2;;%rlm3;"
           style="left:%expr((dd * lx) + pad - lx)px;
                  top:%expr((md * tx) + pad - tx)px;
                  font-size:%fs1;px;z-index:%item.1;;
                  color:rgb(%expr(mbc + red), %aad;, %expr(ddc + blue));">%item.10;%i11;</a>
      %end;
    %end;
  </div>
  <form id="form_ars" name="form_ars" method="get" action="%action;">
    <p>
      %hidden;
      <input type="hidden" name="m" value="A"%/>
      <input type="hidden" name="t" value="E"%/>
      <input type="hidden" name="opt" value="ars"%/>
      %if;access_by_key;
        <input type="hidden" name="p" value="%first_name_key_val;"%/>
        <input type="hidden" name="n" value="%surname_key_val;"%/>
        %if;(occ != "0")
          <input type="hidden" name="oc" value="%occ;"%/>
        %end;
      %else
        <input type="hidden" name="i" value="%index;"%/>
      %end;
    </p>
    <fieldset>
      <legend><input type="submit" value="Ok"%/></legend>
      <ul><li>
        <label>[*generation/generations]0<input name="v" value="%evar.v;" class="number"%/></label>
      </li><li>
        <label>Initial count<input name="ic" value="%ic;" class="number"%/></label>
      </li><li>
        <label>Font family<input name="ff" value="%ff;"%/></label>
      </li><li>
        <label>Font size<input name="fs" value="%fs;" class="number"%/></label>
      </li><li>
      </li><li>
        <label>Width<input name="width" value="%width;" class="number"%/>px</label>
        <label>Height<input name="height" value="%height;" class="number"%/>px</label>
      </li><li>
        <label style="background-color:red">R<input name="red" value="%red;" class="number"%/></label>
        <label style="background-color:green">G<input name="green" value="%green;" class="number"%/></label>
        <label style="background-color:blue">B<input name="blue" value="%blue;" class="number"%/></label>
      </li><ul>
      <table border>
      <tr>
        <th class="bcbg1" colspan="2">[*M/F]0</th><th class="bcbg1" colspan="2">[*M/F]1</th>
      </tr>
        <th class="bcbg1">[birth]</th>
        <td>
          <label>[text]<input name="mbt" value="m_bt"%/></label>
          <select name="mbf">
            %apply;option_ars(mbf)
          </select>
        </td>
        <th class="bcbg1">[birth]</th>
        <td><label>[text]<input name="fbt" value="f_bt"%/></label>
          <select name="fbf">
            %apply;option_ars(fbf)
          </select>
        </td>
      </tr><tr>
        <th class="bcbg1">[death]</th>
        <td>
          <label> [text]<input name="mdt" value="m_dt"%/></label>
          <select name="mdf">
            %apply;option_ars(mdf)
          </select>
        </td>
        <th class="bcbg1">[death]</th>
        <td><label>[text]<input name="fdt" value="f_dt"%/></label>
          <select name="fdf">
            %apply;option_ars(fdf)
          </select>
        </td>
      </tr></table>
    </fieldset>
  </form>
%end;
%( <!-- Begin define (used in anclist.txt, deslist.txt)--> %)
%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 define (used in anclist.txt, deslist.txt)--> %)
%(<!-- End define --> %)

<body%body_prop; id="anclist">
%message_to_wizard;

<h1>%nn;
  %if;(evar.opt != "csv")
    %apply;a_of_b%with;
      [*ancestors]
    %and;
      %if;(not cancel_links)<a href="%prefix;%access;">%end;
        %if;(public_name != "")%public_name;%else;%first_name;%end;
        %if;(qualifier != "") <em>%qualifier;</em>%end;
        %sp;%surname;
        %if;(alias != "") <em>(%alias;)</em>%end;
      %if;(not cancel_links)</a>%end;
    %end;
      %sp;%dates;<br%/>
  %end;
  %if;(evar.t = "E" and evar.opt = "csv")
    %elseif;(evar.t = "E" and evar.opt = "fam") - [*family/families]0 - 
    %elseif;(evar.t = "E" and evar.opt = "place") - [*list eclair]0 - [places] 
    %elseif;(evar.t = "E" and evar.opt = "surn") - [*list eclair]0 - [surname/surnames]1 / [places] 
    %elseif;(evar.t = "F") - [*surnames branch] - 
    %else;
  %end;
</h1>
%if;(cancel_links or evar.opt = "csv")
%else;
  <div class="menu2">
    <a style="text-decoration:line-through;" href="%prefix_base;%apply;url("cgl","on")"
       title="[cancel GeneWeb links]">@</a>
    %if;has_referer;
      <a href="%referer;" title="[back]">&lt;&lt;</a>
    %end;
      <a href="%prefix;" title="[visualize/show/hide/summary]3">^^</a>
  </div>
%end;
%if;(evar.t = "E" and evar.opt = "fam")
  %(family life dates %)
  %if;(is_dead and death_date.year > 0)
    %apply;ld(birth_date.year,death_date.year)
  %else;
    %apply;ld(birth_date.year,9999)
  %end;
  <table summary="family life dates" class="ld_table">
  <colgroup>
    <col width="35"%/>
    <col width="10"%/>
    <col width="300"%/>
    <col width="30"%/>
    <col width="300"%/>
    <col width="300"%/>
    <col width="300"%/>
  </colgroup>
  <thead>
    <tr>
      <th>[years old]</th>
      <th>[date/dates]0</th>
      <th>[place]</th>
      <th><abbr title="[birth] [marriage/marriages]0 [death]">%birth_symbol;&amp;%death_symbol;</abbr></th>
      <th>[person/persons]0</th>
      <th>[relationship]0</th>
      <th>[occupation/occupations]0</th>
    </tr>
  </thead>
  <tbody>
    %reset_count;
    %foreach;sorted_list_item;
      %if;(prev_item.4 = item.4 and prev_item.6 = item.6 and prev_item.10 = item.10)
      %else;
        <tr %if;(item.13 != "")class="%item.13;"%end;>
          <td>%item.2;</td>
          <td>%item.4;</td>
          <td>%item.5;</td>
          <td class="%item.11;">%item.6;</td>
          <td><div %if;(item.12 = "1")class="border_sosa"%end;>%item.7;</div></td>
          <td><div class="%item.14;">%item.8;</div></td>
          <td>%item.9;</td>
        </tr>
        %if;(item.3 = 1)
          %incr_count;
        %end;
      %end;
    %end;
    <tr><td colspan="7">[*total] : %count; [[person/persons]1@(c)]%sp;
      %reset_count;
      <a href="%prefix;m=RLM;et=S;spouse=on;%nn;
      %foreach;sorted_list_item;
        %if;(item.15 != "")
          %incr_count;
          i%count;=%item.15;;%nn;
          %incr_count;
          i%count;=%index;;%nn;
        %end;
       %end;
       %incr_count;
       i%count;=%index;;t%count;=*;">[*tree]</a>
    </td></tr>
  </tbody>
  </table>
%elseif;(wizard and evar.t = "E" and evar.opt = "csv")
  %( csv display full %)
  <p>
  [number]%nn;
  ;index%nn;
  ;index_family%nn;
  ;first_name_key_val%nn;
  ;surname_key_val%nn;
  ;occ%nn;
  ;[Sosa]%nn;
  ;[Sosa]_[father/mother]0%nn;
  ;[child/children]0_[number]%nn;
  ;[sex]%nn;
  ;[consanguinity]%nn;
  ;[first name/first names]0%nn;
  ;[surname/surnames]0%nn;
  ;[birth]_[precision]%nn;
  ;[birth]_[year/month/day]0%nn;
  ;[birth]_[year/month/day]1%nn;
  ;[birth]_[year/month/day]2%nn;
  ;[birth]_[place]%nn;
  ;[death]_[precision]%nn;
  ;[death]_[year/month/day]0%nn;
  ;[death]_[year/month/day]1%nn;
  ;[death]_[year/month/day]2%nn;
  ;[death]_[place]%nn;
  ;[father/mother]0_[first name/first names]0%nn;
  ;[father/mother]0_[surname/surnames]0%nn;
  ;[father/mother]0_[age]%nn;
  ;[father/mother]1_[first name/first names]0%nn;
  ;[father/mother]1_[surname/surnames]0%nn;
  ;[father/mother]1_[age]%nn;
  ;[family/families]0_[number]%nn;
  ;[marriage/marriages]0_[precision]%nn;
  ;[marriage/marriages]0_[year/month/day]0%nn;
  ;[marriage/marriages]0_[year/month/day]1%nn;
  ;[marriage/marriages]0_[year/month/day]2%nn;
  ;[marriage/marriages]0_[place]%nn;
  ;[marriage/marriages]0_[first name/first names]0%nn;
  ;[marriage/marriages]0_[surname/surnames]0%nn;
  ;[marriage/marriages]0_first_name_key_val%nn;
  ;[marriage/marriages]0_surname_key_val%nn;
  ;[marriage/marriages]0_occ%nn;
  <br%/>
  %reset_count;
  %foreach;ancestor_level(evar.v)
    %if;(level != 1 and evar.only != "on" or level = evar.v)
      %foreach;ancestor;
        %if;(ancestor.same = "" and ancestor.is_male)
          %foreach;ancestor.family;
            %apply;csv_line("","")
          %end;
        %elseif;(ancestor.same = "" and ancestor.is_female and ancestor.nb_families > 1)
          %foreach;ancestor.family;
            %if;(spouse.index != ancestor.spouse.index)
              %apply;csv_line("","")
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;
  </p>
%elseif;(evar.t = "E" and evar.opt = "place")
  %( list eclair opt = place %)
  %apply;gen()
  %empty_sorted_list;
  %reset_count;
  %foreach;ancestor_level(evar.v)
    %if;(level > 1 and (evar.only != "on" or level = evar.v))
      %foreach;ancestor;
        %if;(ancestor.same = "")
          %if;(ancestor.has_birth_place)
            %apply;add_in_sorted_list(ancestor.birth_place,ancestor.birth_date.year,ancestor.index,ancestor.anc_sosa)
          %elseif;(ancestor.has_baptism_place)
            %apply;add_in_sorted_list(ancestor.baptism_place,ancestor.baptism_date.year,ancestor.index,ancestor.anc_sosa)
          %end;
          %if;(ancestor.has_death_place)
            %apply;add_in_sorted_list(ancestor.death_place,ancestor.death_date.year,ancestor.index,ancestor.anc_sosa)
          %elseif;(ancestor.has_burial_place)
            %apply;add_in_sorted_list(ancestor.burial_place,ancestor.burial_date.year,ancestor.index,ancestor.anc_sosa)
          %end;
          %foreach;ancestor.family;
            %if;(ancestor.spouse.index = spouse.index and marriage_place != "")
              %apply;add_in_sorted_list(marriage_place,marriage_date.year,ancestor.index,ancestor.anc_sosa)
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;
  <p>[place];[date begin];([nb events]);[date end]
  %foreach;sorted_list_item;
    %if;(prev_item.1 != item.1)
      %reset_count;%incr_count;
      <br%/>%item.1;;%item.2;
        ;<a href="%prefix;spouse=on;m=RLM;%nn;
            i%count;=%item.3;;t%count;=%item.4;;%nn;
    %end;
    %if;(prev_item.1 = item.1)
      %incr_count;
      i%count;=%item.3;;t%count;=%item.4;;%nn;
    %end;
    %if;(next_item.1 != item.1)
      %incr_count;
      i%count;=%index;;t%count;=%item.1;
      %if;(max_event >= count)">(%expr(count - 1))</a>;%item.2;
      %else;" style="display:none;"></a><em>(%expr(count - 1))</em>;%item.2;
      %end;
    %end;
  %end;
  </p>
%elseif;(evar.t = "E" and evar.opt = "surn")
  %( list eclair opt = surn %)
  %apply;gen()
  %empty_sorted_list;
  %reset_count;
  %foreach;ancestor_level(evar.v)
    %if;(level > 1 and (evar.only != "on" or level = evar.v))
      %foreach;ancestor;
        %if;(ancestor.same = "")
          %if;(ancestor.has_birth_place)
            %apply;add_in_sorted_list%with;
              %ancestor.surname; -- %ancestor.birth_place;%and;
              %ancestor.birth_date.year;%and;
              %ancestor.index;%and;
              %ancestor.anc_sosa%end;
          %elseif;(ancestor.has_baptism_place)
            %apply;add_in_sorted_list%with;
              %ancestor.surname; -- %ancestor.baptism_place;%and;
              %ancestor.baptism_date.year;%and;
              %ancestor.index;%and;
              %ancestor.anc_sosa%end;
          %end;
          %if;(ancestor.has_death_place)
            %apply;add_in_sorted_list%with;
              %ancestor.surname; -- %ancestor.death_place;%and;
              %ancestor.death_date.year;%and;
              %ancestor.index;%and;
              %ancestor.anc_sosa%end;
          %elseif;(ancestor.has_burial_place)
            %apply;add_in_sorted_list%with;
              %ancestor.surname; -- %ancestor.burial_place;%and;
              %ancestor.burial_date.year;%and;
              %ancestor.index;%and;
              %ancestor.anc_sosa%end;
          %end;
          %foreach;ancestor.family;
            %if;(ancestor.spouse.index = spouse.index and marriage_place != "")
              %apply;add_in_sorted_list%with;
                %ancestor.surname; -- %marriage_place;%and;
                %marriage_date.year;%and;
                %ancestor.index;%and;
                %ancestor.anc_sosa%end;
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;
  <p>[surname/surnames]0 -- [place];[date begin];([nb events]);[date end]
  %foreach;sorted_list_item;
    %if;(prev_item.1 != item.1)
      %reset_count;%incr_count;
      <br%/>%item.1;;%item.2;
        ;<a href="%prefix;spouse=on;m=RLM;%nn;
            i%count;=%item.3;;t%count;=%item.4;;%nn;
    %end;
    %if;(prev_item.1 = item.1)
        %incr_count;
        i%count;=%item.3;;t%count;=%item.4;;%nn;
    %end;
    %if;(next_item.1 != item.1)
      %incr_count;
      i%count;=%index;;t%count;=%item.1;
      %if;(max_event >= count)">(%expr(count - 1))</a>;%item.2;
      %else;" style="display:none;"></a><em>(%expr(count - 1))</em>;%item.2;
      %end;
    %end;
  %end;
  </p>
%elseif;(evar.t = "E" and evar.opt = "aad")
  %( age_at_death by generation opt = aad %)
  %apply;gen()
  %reset_count;
  %empty_sorted_list;
  %foreach;ancestor_level(evar.v)
    %if;(level > 1 and (evar.only != "on" or level = evar.v))
      %foreach;ancestor;
        %if;(ancestor.same = "")
          %let;l_aby;%ancestor.birth_date.year;%in;
          %let;l_ady;%ancestor.death_date.year;%in;
          %if;(ancestor.computable_death_age and l_ady > l_aby)
            %incr_count;
            %let;l_age;%expr((l_ady - l_aby)/10)%in;
            %apply;add_in_sorted_list(ancestor.sex,l_age,ancestor.index)
          %end;
        %end;
      %end;
    %end;
  %end;
  %let;max_width;360%in;
  %let;l_size;%expr(36 / ((60 + count) / 6 / 10))%in;
  <div class="stat_age1 bcbg1">
    <table class="title" width="100%%"><tr>
    <td>[*age]</td>
    <td align="center">[*age at death]
      (<span style="color:#4682B4;"/>[M/F]0</span>,
       <span style="color:#FF69B4;"/>[M/F]1</span>)</td>
    <td align="right"><em>%count; [date/dates]1</em></td>
    </tr></table>
    %apply;stat_age1()
  </div>
  <div class="stat_age2 bcbg1">
    <table class="title" width="100%%"><tr>
      <td>[*generation/generations]0</td>
      <td align="center">[*age at death]
          (<span style="color:#4682B4;"/>[M/F]0</span>,
           <span style="color:#FF69B4;"/>[M/F]1</span>)</td>
      <td align="right">[*date of birth]</td>
    </tr></table>
    %foreach;ancestor_level(evar.v)
      %empty_sorted_list;
      %reset_count;
      %if;(level > 1 and (evar.only != "on" or level = evar.v))
        %foreach;ancestor;
          %if;(ancestor.same = "")
            %let;l_aby;%ancestor.birth_date.year;%in;
            %let;l_ady;%ancestor.death_date.year;%in;
            %if;(ancestor.computable_death_age and l_ady >= l_aby)
              %incr_count;
              %let;l_age;%expr(l_ady - l_aby)%in;
              %apply;add_in_sorted_list(l_aby,l_age,ancestor.sex,ancestor.index)
            %end;
          %end;
        %end;
        %apply;stat_age2()
      %end;
    %end;
  </div>
%elseif;(evar.t = "E" and evar.opt = "afm")
  %( age father mother by generation opt = afm %)
  %apply;gen()
  %reset_count;
  %empty_sorted_list;
  %foreach;ancestor_level(evar.v)
    %if;(level > 1 and (evar.only != "on" or level = evar.v))
      %foreach;ancestor;
        %if;(ancestor.same = "")
          %let;l_aby;%ancestor.birth_date.year;%in;
          %let;l_fby;%ancestor.father.birth_date.year;%in;
          %let;l_mby;%ancestor.mother.birth_date.year;%in;
          %if;(l_aby >= l_fby)
            %incr_count;
            %let;l_age;%expr((l_aby - l_fby)/10)%in;
            %apply;add_in_sorted_list(0,l_age,ancestor.father.index,count)
          %end;
          %if;(l_aby >= l_mby)
            %incr_count;
            %let;l_age;%expr((l_aby - l_mby)/10)%in;
            %apply;add_in_sorted_list(1,l_age,ancestor.mother.index,count)
          %end;
        %end;
      %end;
    %end;
  %end;
  %let;max_width;360%in;
  %let;l_size;%expr(36 / ((40 + count) / 4 / 10))%in;
  <div class="stat_age1 bcbg1">
    <table class="title" width="100%%"><tr>
    <td>[*age]</td>
    <td align="center">[*age]
      (<span style="color:#4682B4;"/>[father/mother]0</span>,
       <span style="color:#FF69B4;"/>[father/mother]1</span>)</td>
    <td align="right"><em>%count; [date/dates]1</em></td>
    </tr></table>
    %apply;stat_age1()
  </div>
  <div class="stat_age2 bcbg1">
    <table class="title" width="100%%"><tr>
      <td>[*generation/generations]0</td>
      <td align="center">[*age]
          (<span style="color:#4682B4;"/>[father/mother]0</span>,
           <span style="color:#FF69B4;"/>[father/mother]1</span>)</td>
      <td align="right">[*date of birth]</td>
    </tr></table>
    %foreach;ancestor_level(evar.v)
      %empty_sorted_list;
      %reset_count;
      %if;(level > 1 and (evar.only != "on" or level = evar.v))
        %foreach;ancestor;
          %if;(ancestor.same = "")
            %let;l_aby;%ancestor.birth_date.year;%in;
            %let;l_fby;%ancestor.father.birth_date.year;%in;
            %let;l_mby;%ancestor.mother.birth_date.year;%in;
            %if;(l_aby >= l_fby)
              %incr_count;
              %let;l_age;%expr(l_aby - l_fby)%in;
              %apply;add_in_sorted_list(l_aby,l_age,0,ancestor.index,count)
            %end;
            %if;(l_aby >= l_mby)
              %incr_count;
              %let;l_age;%expr(l_aby - l_mby)%in;
              %apply;add_in_sorted_list(l_aby,l_age,1,ancestor.index,count)
            %end;
          %end;
        %end;
        %apply;stat_age2()
      %end;
    %end;
  </div>
%elseif;(evar.t = "E" and evar.opt = "bmdm")
  %( birth month death month opt = bmdm %)
    <table class="stat_bmdm">
      <tr><td colspan="2">
        %apply;gen()
      </td></tr>
      <tr><td>
        %apply;stat_month("birth")
      </td><td>
        %apply;stat_month("death")
      </td></tr>
      <tr><td colspan="2">
        %apply;stat_calendar()
      </td></tr>
    </table>
%elseif;(evar.t ="E" and evar.opt = "ars")
  %( ars table day month generation %)
  %( rlm link 2     %) %let;rlm2;i2=%index;;t2=0%in;
  %( rlm link 3     %) %let;rlm3;%if;(browsing_with_sosa_ref)i3=%sosa_ref.index;;t3=sosa_1%end;%in;
  %( font family    %) %let;ff;%if;(evar.ff != "")%evar.ff;%else;arial%end;%in;
  %( initial count  %) %let;ic;%if;(evar.ic >= 0)%evar.ic;%else;400%end;%in;
  %(   font size    %) %let;fs;%if;(evar.fs >= 0)%evar.fs;%else;3%end;%in;
  %(   width        %) %let;width;%if;(evar.width >= 0)%evar.width;%else;2048%end;%in;
  %(   height       %) %let;height;%if;(evar.height >= 0)%evar.height;%else;1536%end;%in;
  %(   left x       %) %let;lx;%expr(width / 35)%in;
  %(   top x        %) %let;tx;%expr(height / 13)%in;
  %(   red          %) %let;red;%if;(evar.red >= 0)%evar.red;%else;10%end;%in;
  %(   green        %) %let;green;%if;(evar.green >= 0)%evar.green;%else;10%end;%in;
  %(   blue         %) %let;blue;%if;(evar.blue >= 0)%evar.blue;%else;10%end;%in;
  %(male birth text %) %let;mbt;%if;(evar.mbt != "")%evar.mbt;%else;%end;%in;
  %(male birth field%) %let;mbf;%if;(evar.mbf != "")%evar.mbf;%else;ancestor.first_name%end;%in;
  %(male death text %) %let;mdt;%if;(evar.mdt != "")%evar.mdt;%else;%end;%in;
  %(male death field%) %let;mdf;%if;(evar.mdf != "")%evar.mdf;%else;ancestor.occupation%end;%in;
  %(female birth text %) %let;fbt;%if;(evar.fbt != "")%evar.fbt;%else;%end;%in;
  %(female birth field%) %let;fbf;%if;(evar.fbf != "")%evar.fbf;%else;ancestor.surname%end;%in;
  %(female death text %) %let;fdt;%if;(evar.fdt != "")%evar.fdt;%else;%end;%in;
  %(female death field%) %let;fdf;%if;(evar.fdf != "")%evar.fdf;%else;ancestor.dates%end;%in;
  %apply;ars(mbt,mbf,mdt,mdf,fbt,fbf,fdt,fdf)
%elseif;(evar.t = "E")
  %( list opt = ? %)
  <ul>
    %if;(wizard)<li><a href="%prefix;m=A;t=E;opt=csv;i=%index;;v=%evar.v;;only=%evar.only;;cousins=%evar.cousins;">CSV</a></li>%end;
    <li><a href="%prefix;m=A;t=E;opt=fam;i=%index;;v=%evar.v;;only=%evar.only;;cousins=%evar.cousins;">[*family/families]0</a></li>
    <li><a href="%prefix;m=A;t=E;opt=place;i=%index;;v=%evar.v;;only=%evar.only;">[*list eclair]0 - [places]</a></li>
    <li><a href="%prefix;m=A;t=E;opt=surn;i=%index;;v=%evar.v;;only=%evar.only;">[*list eclair]0 - [surname/surnames]1 / [places]</a></li>
    <li><a href="%prefix;m=A;t=E;opt=aad;i=%index;;v=%evar.v;;only=%evar.only;">
        [*age at death] ([M/F]0, [M/F]1)</a></li>
    <li><a href="%prefix;m=A;t=E;opt=afm;i=%index;;v=%evar.v;;only=%evar.only;">
        [*age] ([father/mother]0, [father/mother]1)</a></li>
    <li><a href="%prefix;m=A;t=E;opt=bmdm;i=%index;;v=%evar.v;;only=%evar.only;">
        [*birth], [death] ([M/F]0, [M/F]1) / [year/month/day]1</a></li>
  </ul>
%elseif;(evar.t = "L")
  %( by list %)
  %let;xx;
    %if;(bvar.max_anc_level = "")%apply;min(evar.v, max_anc_level, 7)
    %else;%apply;min(evar.v, max_anc_level, bvar.max_anc_level)%end;
  %in;
  <p>
  %apply;togen(xx).
  </p>
  %apply;ancestors_by_list("self", xx)
%elseif;(evar.t = "H")
  %( horizontally %)
  %let;xx;
    %if;(bvar.max_anc_level = "")%apply;min(evar.v, max_anc_level, 7)
    %else;%apply;min(evar.v, max_anc_level, bvar.max_anc_level)%end;
  %in;
  <p>
  %apply;togen(xx).
  </p>
  <table><tr><td style="white-space:nowrap">
  %apply;ancestors_horizontally(
    "self", xx, "&nbsp;&nbsp;&nbsp;", "--&nbsp;", "&nbsp;&nbsp;&nbsp;")
  </tr></tr></table>
%elseif;(evar.t = "F")
  %( surnames branch %)
  %apply;togen(evar.v).
  <ul>
  %foreach;ancestor_surname(evar.v)
    <li>%nn;
    %if;(evar.cgl != "on")<a href="%prefix;m=DAG;%ancestor.sosa_access;">%nn;
    %ancestor.surname_end;%ancestor.surname_begin;</a>%nn;
    %else;%ancestor.surname_end;%ancestor.surname_begin;%end;
    %if;(ancestor.nb_times > 1) (%ancestor.nb_times;)%end;
    ; %ancestor.place;
    ; %ancestor.date_begin.year;-%ancestor.date_end.year;</li>
  %end;
  </ul>
%end;
%if;(evar.opt != "csv")
  %base_trailer;
  %copyright;
%end;
</body>
</html>
