<?php

	$sPage  = "indi_ascend_tree";

	require("admin/§lib_inc.php");

	$INDIVIDU=isset($_REQUEST["INDIVIDU"])?$_REQUEST["INDIVIDU"] : 0; 
	$FAMILY=isset($_REQUEST["FAMILY"])?$_REQUEST["FAMILY"] : -1; 

	if($bSessionOk==false)
	{
		$sReqCont="and contemporary=1";
	}
	else
	{
		$sReqCont="";
	}

	if($FAMILY!=-1)
	{
		$sReqFam="and id_family=$FAMILY";
	}
	else
	{
		$sReqFam="";
	}

	$result_ind = mysql_query( "select * from oxg_individuals where id_individual='$INDIVIDU' $sReqFam");
	$row_ind = mysql_fetch_array($result_ind);
	$sex = $row_ind['sex'];

	$result_patro = mysql_query( "select * from oxg_patronyms where id_patronym='$row_ind[id_patronym]'");
	$row_patro = mysql_fetch_array($result_patro);

	$sTitle = $row_ind['first_name']." ".$row_patro['libelle'];

	require("§menu.php");

class color_picker{

	var $name;

	var $first_option;


	var $kolor_arr = array(

		", no color",

		"c0c0c0, ",
 
		"4c4c4c, ",
 
		"ccccff, ",

		"9966cc, ",

		"ccffff, ",

		"00cccc, ",

		"008000, ",

		"0099ff, ",

		"0066cc, ",

		"0000ff, ",

		"ffff66, ",

		"ffcc99, ",

		"eb613d, ",

		"ff3366, ",

		"ff0000, ",

		"4c1900, ",

		"000000, "
,
		"FFFFFF, "
				);



function color_picker($name = "my_color", $firts_option = "select color...")
	{

		$this->name = $name;

		$this->first_option
 = $firts_option;

	}




function print_select()
	{

		echo "<select name=\"".$this->name."\">\n";

			//echo "<option value=\"".$name."\" style=\"background-color:".$this->first_option."\">".$this->first_option."</option>\n";

echo "<option value=\"".$this->first_option."\" style=\"background-color:".$this->first_option."\"></option>\n";
		for($i=0;$i<count($this->kolor_arr);$i++){

			$wiersz = explode(",",$this->kolor_arr[$i]);

			$value = $wiersz[0];

			$color = $wiersz[1];
			echo "<option value=\"".$value."\" style=\"background-color:".$value."\">".$color."</option>\n";

		}

		echo "</SELECT>\n\n";

	}


}





	$color2 = @$_GET['color2'];
	$color1 = @$_GET['color1'];
	$ttprenom = @$_GET['ttprenom'];
	$affichage = @$_GET['affichage'];
	$gen = @$_GET['gen'];
	$ind = @$_GET['INDIVIDU'];
	$fam = @$_GET['FAMILY'];

	if ($affichage=="") {$affichage = "2";}
	if ($ttprenom=="") {$ttprenom = "2";}
	if ($gen=="") { $gen = "4"; }


echo "<div id=panel>";
echo "<form action=\"\" method=get>";
echo "<input type=hidden name=INDIVIDU value=\"$ind\">";
echo "<input type=hidden name=FAMILY value=\"$fam\">";
//if ($color1=="") {$color1="white";}
//if ($color2=="") {$color2="white";}
echo "<input type=hidden name=color1 value=\"$color1\">";
echo "<input type=hidden name=color2 value=\"$color2\">";
echo "<center>";
echo "<table border=1><tr>";
echo "<td>".decode_lng_text('TREE_COL')." ".decode_lng_text('STATS_SEXE_M')."/".decode_lng_text('STATS_SEXE_F')." :<BR>";
$kolor_picker = new color_picker("color1", $color1);


$kolor_picker->print_select();



$kolor_picker = new color_picker("color2", $color2);


$kolor_picker->print_select();


echo "<td>".decode_lng_text('TREE_NBGEN')." : ";
if ($gen==3) {echo "<select name=gen><OPTION value='3'>3</OPTION><OPTION value='4'>4</OPTION><OPTION value='5'>5</OPTION><OPTION value='6'>6</OPTION><OPTION value='7'>7</OPTION></select></td>";}
if ($gen==4) {echo "<select name=gen><OPTION value='4'>4</OPTION><OPTION value='3'>3</OPTION><OPTION value='5'>5</OPTION><OPTION value='6'>6</OPTION><OPTION value='7'>7</OPTION></select></td>";}
if ($gen==5) {echo "<select name=gen><OPTION value='5'>5</OPTION><OPTION value='3'>3</OPTION><OPTION value='4'>4</OPTION><OPTION value='6'>6</OPTION><OPTION value='7'>7</OPTION></select></td>";}
if ($gen==6) {echo "<select name=gen><OPTION value='6'>6</OPTION><OPTION value='3'>3</OPTION><OPTION value='4'>4</OPTION><OPTION value='5'>5</OPTION><OPTION value='7'>7</OPTION></select></td>";}
if ($gen==7) {echo "<select name=gen><OPTION value='7'>7</OPTION><OPTION value='3'>3</OPTION><OPTION value='4'>4</OPTION><OPTION value='5'>5</OPTION><OPTION value='6'>6</OPTION></select></td>";}

echo "<td>".decode_lng_text('TREE_AFI')." : ";
if ($affichage==1) {echo "<select name=affichage><OPTION value='1'>".decode_lng_text('TREE_AFF1')."</OPTION><OPTION value='2'>".decode_lng_text('TREE_AFF2')."</OPTION><OPTION value='3'>".decode_lng_text('TREE_AFF3')."</OPTION></select>";}
if ($affichage==2) {echo "<select name=affichage><OPTION value='2'>".decode_lng_text('TREE_AFF2')."</OPTION><OPTION value='1'>".decode_lng_text('TREE_AFF1')."</OPTION><OPTION value='3'>".decode_lng_text('TREE_AFF3')."</OPTION></select>";}
if ($affichage==3) {echo "<select name=affichage><OPTION value='3'>".decode_lng_text('TREE_AFF3')."</OPTION><OPTION value='1'>".decode_lng_text('TREE_AFF1')."</OPTION><OPTION value='2'>".decode_lng_text('TREE_AFF2')."</OPTION></select>";}
echo "<BR>";
//echo "Affichage prénoms : ";
if ($ttprenom==1) {echo "<select align=right name=ttprenom><OPTION value='1'>".decode_lng_text('TREE_AFF4')."</OPTION><OPTION value='2'>".decode_lng_text('TREE_AFF5')."</OPTION></select></td>";}
if ($ttprenom==2) {echo "<select align=right name=ttprenom><OPTION value='2'>".decode_lng_text('TREE_AFF5')."</OPTION><OPTION value='1'>".decode_lng_text('TREE_AFF4')."</OPTION></select></td>";}
echo "<td><input type=submit value=".decode_lng_text('PRIVATE_ENTER')."></td>";
echo "</tr></table></form>";
echo "</center>";
echo "</div>";


echo "<div id=children>";
nb_Children($INDIVIDU,$FAMILY, $gen, $affichage, $color1, $color2);
echo "</div>";


function affiche_lien_individu2($id_affichage, $id_family, $id_individual, $bAffichePatronyme=true, $bAfficheDate=false, $ttprenom)
{
	global	$bSosa, $bSessionOk;

	if($id_individual=="-1" or $id_individual=="")
	{
		return "?";
	}
	if($id_family!=-1)
	{
		$sReqFam="and id_family=$id_family";
	}
	else
	{
		$sReqFam="";
	}
	
	$sInd="";
	
	$sReq  = "select first_name, libelle ";
	if($bSosa==true)
	{
		$sReq  .= ", sosa ";
	}
	if($bAfficheDate==true && $bSessionOk==false)
	{
		$sReq .= ", date_naissance, date_deces, id_ville_naissance, id_ville_deces, lieu_naissance, lieu_deces ";
	}
	$sReq .= " from oxg_individuals, oxg_patronyms ";
	$sReq .= "where id_individual='$id_individual' ";
	$sReq .= "and oxg_individuals.id_patronym=oxg_patronyms.id_patronym ";
	$sReq .= $sReqFam;

	$result = mysql_query( $sReq ) or mysql_die();
	if($row = mysql_fetch_array($result));
	{
		if ($id_individual=="-1")
		{
			$sInd.="";
		}
		else
		{
			$sInd.="<A HREF='§detail_individu.php?INDIVIDU=$id_individual&FAMILY=$id_family'>";
		}
		if($row['first_name']=="")
		{
			$sInd.="?";
		}
		else
		{
			$firstname = $row['first_name'];
			if ($ttprenom==2)
			{
				$firstname = explode(" ",$firstname);
				$firstname = $firstname[0];
			}
			$sInd.=$firstname;
		}
		if($bAffichePatronyme==true)
		{
			$sInd.=" $row[libelle]";
		}
		$sInd.="</A>";
		if($bSosa==true && $row['sosa']!='-1')
		{
			$sInd=$sInd." <strong><font color=red>$row[sosa]</font></strong>";
		}
		
		if($bSessionOk==false && $bAfficheDate==true && ($row['date_naissance']!="" || $row['date_deces']!=""))
		{
			if ($id_affichage==2)
			{
				$sInd.="<BR>";
				if($row['date_naissance']!="")
				{
					$newdate = decode_date2($row['date_naissance']);
					$sInd.="( ".$newdate;
				}
				else
				{
					$sInd.="( ?";
				}
				if($row['date_deces']!="")
				{
					$sInd.=" - ";
					$newdate = decode_date2($row['date_deces']);
					$sInd.=$newdate;
				}
				else
				{
					if (substr($row['date_naissance'],-4)<1910)
					{
						$sInd.=" - ?";
					}
				}
				$sInd.=" )";
			}
			if ($id_affichage==3)
			{
				$sInd.="<BR>";
				if($row['date_naissance']!="")
				{
					$newdate = decode_date2($row['date_naissance']);
					if ($row['id_ville_naissance']=="0")
					{
						$ville = $row['lieu_naissance'];
						$ville = explode(",",$ville);
						$ville = $ville[0];
					}
					else	
					{
						$result_ville = mysql_query( "select libelle from oxg_cities where id_city='$row[id_ville_naissance]'" );
						$row_ville = mysql_fetch_array($result_ville);
						$ville = $row_ville['libelle'];
					}
					$sInd.="° ".$newdate." - ".$ville."<BR>";
				}
				else
				{
					$sInd.="° ?<BR>";
				}
				if($row['date_deces']!="")
				{
					$sInd.="+ ";
					$newdate = decode_date2($row['date_deces']);
					if ($row['id_ville_deces']=="0")
					{
						$ville = $row['lieu_deces'];
						$ville = explode(",",$ville);
						$ville = $ville[0];
					}
					else
					{
						$result_ville = mysql_query( "select libelle from oxg_cities where id_city='$row[id_ville_deces]'" );
						$row_ville = mysql_fetch_array($result_ville);
						$ville = $row_ville['libelle'];
					}
					$sInd.=$newdate." - ".$ville."<BR>";
				}
				else
				{
					if (substr($row['date_naissance'],-4)<1910)
					{
						$sInd.="+ ?";
					}
				}
				//$sInd.=")";
			}
		}
	}
	return $sInd;
}

function affiche_lien_arbre2($id_family, $id_individual, $gen, $affichage, $color1, $color2)
{
	global $sql_query;

	if($id_individual=="-1" or $id_individual=="")
	{
		return "";
	}

	if($id_family!=-1)
	{
		$sReqFam="and id_family=$id_family";
	}
	else
	{
		$sReqFam="";
	}

	$sql_query  = "select id_father, id_mother from oxg_individuals where id_individual=$id_individual $sReqFam";
	$result = mysql_query( $sql_query ) or mysql_die();
	$sLink="";
	if($row = mysql_fetch_array($result))
	{
		if($row['id_father']!=-1 || $row['id_mother']!=-1)
		{
			$sLink ="<A HREF='§arbre_individu.php?INDIVIDU=$id_individual&FAMILY=$id_family&gen=$gen&affichage=$affichage&color1=$color1&color2=$color2'><IMG SRC='tree2.png' ALT=\"";
			$sLink.=decode_lng_text("DETAIL_IND_ARBRE");
			$sLink.="\"></A>";
		}
	}
	return $sLink;
}


function decode_date2($sDate)
{
	//list($day, $month, $year, $year2) = split(' ', $sDate);
	$day = "";
	$month = "";
	$year = "";
	$year2 = "";
	$tab = explode(" ", $sDate);
	if (count($tab)>0) { $day = $tab[0]; }
	if (count($tab)>1) { $month = $tab[1]; }
	if (count($tab)>2) { $year = $tab[2]; }
	if (count($tab)==4) { $year2 = $tab[3]; }
	
	if ($year=="" & $month!="" & $day!="avant" & $day!="après") {$year=$month;$month=$day;$day="";}
	if($month=="janvier") {$month="01";}
	if($month=="février") {$month="02";}
	if($month=="mars") {$month="03";}
	if($month=="avril") {$month="04";}
	if($month=="mai") {$month="05";}
	if($month=="juin") {$month="06";}
	if($month=="juillet") {$month="07";}
	if($month=="août") {$month="08";}
	if($month=="septembre") {$month="09";}
	if($month=="octobre") {$month="10";}
	if($month=="novembre") {$month="11";}
	if($month=="décembre") {$month="12";}

	if ($day=="") {return "?/$month/$year";} else
	if ($day=="autour") {return "$day $month $year";} else
	if ($day=="entre") {return "$day $month et $year2";} else
	if ($day=="avant") {if ($year=="") {return "$day $month";} else {return "$day $month/$year";} } else
	if ($day=="après") {if ($year=="") {return "$day $month";} else {return "$day $month/$year";} } else
	if ($month=="") {return "$day";} else
	{if (intval($day)<10) {$day="0".$day;}
	return "$day/$month/$year";}
}

?>
<style type="text/css">
	table.t1 {border:0px;width=100%}

	td.c1	{border-top:2px;width=3%}
	td.c1	{border-right:0px;}
	td.c1	{border-left:0px;}
	td.c1	{border-bottom:0px;}
	
	td.c2	{border-top:0px;width=3%}
	td.c2	{border-right:2px groove black;}
	td.c2	{border-left:0px solid black;}
	td.c2	{border-bottom:2px groove black;}
	
	td.c3	{border-top:0px;width=3%}
	td.c3	{border-right:0px dasshed black;}
	td.c3	{border-left:2px groove black;}
	td.c3	{border-bottom:2px groove black;}
	
	td.c4	{border-top:0px;width=3%}
	td.c4	{border-right: 1px groove black;}
	td.c4	{border-left: 0px solid black;}
	td.c4	{border-bottom: 0px groove black;}
	
	td.c5	{border-top:0px;width=3%}
	td.c5	{border-right:0px dasshed black;}
	td.c5	{border-left:1px groove black;}
	td.c5	{border-bottom:0px groove black;}
	
	td.c6	{border-top:0px;width=3%}
	td.c6	{border-right:0px;}
	td.c6	{border-left:0px;}
	td.c6	{border-bottom:2px groove black;}

	td.c9	{border-top:1px groove black;width=3%}
	td.c9	{border-right:2px groove black;}
	td.c9	{border-left:2px groove black;}
	td.c9	{border-bottom:1px groove black;}

</style>
<?php
//	set_time_limit(0);
	
	flush();

//*****************************************************
//calcul des parents
	$result_ind = mysql_query( "select * from oxg_individuals where id_individual='$INDIVIDU' $sReqFam");
	$row_ind = mysql_fetch_array($result_ind);
	$id_father=$row_ind['id_father'];
	$id_mother=$row_ind['id_mother'];

//affichage des parents
		$sFather= affiche_lien_arbre2($FAMILY, $id_father, $gen, $affichage, $color1, $color2)." ";
		$sFather.= affiche_lien_individu2($affichage, $FAMILY, $id_father,1,1,$ttprenom);
		$sMother= affiche_lien_arbre2($FAMILY, $id_mother, $gen, $affichage, $color1, $color2)." ";
		$sMother.= affiche_lien_individu2($affichage, $FAMILY, $id_mother,1,1,$ttprenom);
//*****************************************************

//*****************************************************
//présence du père
	if($id_father!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_father' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_father1=$row_par['id_father'];
			$id_mother1=$row_par['id_mother'];
		}
	}
	else
	{
		$id_father1=-1;
		$id_mother1=-1;
	}
//présence de la mère
	if($id_mother!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_mother' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_father2=$row_par['id_father'];
			$id_mother2=$row_par['id_mother'];
		}
	}
	else
	{
		$id_father2=-1;
		$id_mother2=-1;
	}

//affichage des parents_1
		$sFather1= affiche_lien_arbre2($FAMILY, $id_father1, $gen, $affichage, $color1, $color2)." ";;
		$sFather1.= affiche_lien_individu2($affichage, $FAMILY, $id_father1,1,1,$ttprenom);
		$sMother1= affiche_lien_arbre2($FAMILY, $id_mother1, $gen, $affichage, $color1, $color2)." ";
		$sMother1.= affiche_lien_individu2($affichage, $FAMILY, $id_mother1,1,1,$ttprenom);
//affichage des parents_2
		$sFather2= affiche_lien_arbre2($FAMILY, $id_father2, $gen, $affichage, $color1, $color2)." ";
		$sFather2.= affiche_lien_individu2($affichage, $FAMILY, $id_father2,1,1,$ttprenom);
		$sMother2= affiche_lien_arbre2($FAMILY, $id_mother2, $gen, $affichage, $color1, $color2)." ";
		$sMother2.= affiche_lien_individu2($affichage, $FAMILY, $id_mother2,1,1,$ttprenom);
//*****************************************************



if ($gen>3) {
//*****************************************************
//présence du père_1
	if($id_father1!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_father1' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gfather11=$row_par['id_father'];
			$id_gmother11=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gfather11=-1;
		$id_gmother11=-1;
	}
//présence de la mère_1
	if($id_mother1!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_mother1' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gfather12=$row_par['id_father'];
			$id_gmother12=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gfather12=-1;
		$id_gmother12=-1;
	}
//présence du père_2
	if($id_father2!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_father2' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gfather21=$row_par['id_father'];
			$id_gmother21=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gfather21=-1;
		$id_gmother21=-1;
	}
//présence de la mère_2
	if($id_mother2!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_mother2' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gfather22=$row_par['id_father'];
			$id_gmother22=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gfather22=-1;
		$id_gmother22=-1;
	}

//affichage des grand-parents_11
		$sGFather11=affiche_lien_arbre2($FAMILY, $id_gfather11, $gen, $affichage, $color1, $color2)." ";
		$sGFather11.=affiche_lien_individu2($affichage, $FAMILY, $id_gfather11,1,1,$ttprenom);
		$sGMother11=affiche_lien_arbre2($FAMILY, $id_gmother11, $gen, $affichage, $color1, $color2)." ";
		$sGMother11.=affiche_lien_individu2($affichage, $FAMILY, $id_gmother11,1,1,$ttprenom);
		$sGFather12=affiche_lien_arbre2($FAMILY, $id_gfather12, $gen, $affichage, $color1, $color2)." ";
		$sGFather12.=affiche_lien_individu2($affichage, $FAMILY, $id_gfather12,1,1,$ttprenom);
		$sGMother12=affiche_lien_arbre2($FAMILY, $id_gmother12, $gen, $affichage, $color1, $color2)." ";
		$sGMother12.=affiche_lien_individu2($affichage, $FAMILY, $id_gmother12,1,1,$ttprenom);
//affichage des grand-parents_22
		$sGFather21=affiche_lien_arbre2($FAMILY, $id_gfather21, $gen, $affichage, $color1, $color2)." ";
		$sGFather21.=affiche_lien_individu2($affichage, $FAMILY, $id_gfather21,1,1,$ttprenom);
		$sGMother21=affiche_lien_arbre2($FAMILY, $id_gmother21, $gen, $affichage, $color1, $color2)." ";
		$sGMother21.=affiche_lien_individu2($affichage, $FAMILY, $id_gmother21,1,1,$ttprenom);
		$sGFather22=affiche_lien_arbre2($FAMILY, $id_gfather22, $gen, $affichage, $color1, $color2)." ";
		$sGFather22.=affiche_lien_individu2($affichage, $FAMILY, $id_gfather22,1,1,$ttprenom);
		$sGMother22=affiche_lien_arbre2($FAMILY, $id_gmother22, $gen, $affichage, $color1, $color2)." ";
		$sGMother22.=affiche_lien_individu2($affichage, $FAMILY, $id_gmother22,1,1,$ttprenom);
//*****************************************************
		}



if ($gen>4) {
//*****************************************************
//présence grand-parents paternels_1
	if($id_gfather11!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gfather11' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_ggfather111=$row_par['id_father'];
			$id_ggmother111=$row_par['id_mother'];
		}
	}
	else
	{
		$id_ggfather111=-1;
		$id_ggmother111=-1;
	}
	if($id_gmother11!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gmother11' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_ggfather112=$row_par['id_father'];
			$id_ggmother112=$row_par['id_mother'];
		}
	}
	else
	{
		$id_ggfather112=-1;
		$id_ggmother112=-1;
	}
//présence grand-parents maternels_1
	if($id_gfather12!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gfather12' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_ggfather121=$row_par['id_father'];
			$id_ggmother121=$row_par['id_mother'];
		}
	}
	else
	{
		$id_ggfather121=-1;
		$id_ggmother121=-1;
	}
	if($id_gmother12!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gmother12' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_ggfather122=$row_par['id_father'];
			$id_ggmother122=$row_par['id_mother'];
		}
	}
	else
	{
		$id_ggfather122=-1;
		$id_ggmother122=-1;
	}
//présence grand-parents paternels_2
	if($id_gfather21!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gfather21' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_ggfather211=$row_par['id_father'];
			$id_ggmother211=$row_par['id_mother'];
		}
	}
	else
	{
		$id_ggfather211=-1;
		$id_ggmother211=-1;
	}
	if($id_gmother21!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gmother21' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_ggfather212=$row_par['id_father'];
			$id_ggmother212=$row_par['id_mother'];
		}
	}
	else
	{
		$id_ggfather212=-1;
		$id_ggmother212=-1;
	}
//présence grand-parents maternels_2
	if($id_gfather22!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gfather22' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_ggfather221=$row_par['id_father'];
			$id_ggmother221=$row_par['id_mother'];
		}
	}
	else
	{
		$id_ggfather221=-1;
		$id_ggmother221=-1;
	}
	if($id_gmother22!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gmother22' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_ggfather222=$row_par['id_father'];
			$id_ggmother222=$row_par['id_mother'];
		}
	}
	else
	{
		$id_ggfather222=-1;
		$id_ggmother222=-1;
	}

//affichage des arrières grand-parents paternels_111
		$sGGFather111=affiche_lien_arbre2($FAMILY, $id_ggfather111, $gen, $affichage, $color1, $color2)." ";
		$sGGFather111.=affiche_lien_individu2($affichage, $FAMILY, $id_ggfather111,1,1,$ttprenom);
		$sGGMother111=affiche_lien_arbre2($FAMILY, $id_ggmother111, $gen, $affichage, $color1, $color2)." ";
		$sGGMother111.=affiche_lien_individu2($affichage, $FAMILY, $id_ggmother111,1,1,$ttprenom);
		$sGGFather112=affiche_lien_arbre2($FAMILY, $id_ggfather112, $gen, $affichage, $color1, $color2)." ";
		$sGGFather112.=affiche_lien_individu2($affichage, $FAMILY, $id_ggfather112,1,1,$ttprenom);
		$sGGMother112=affiche_lien_arbre2($FAMILY, $id_ggmother112, $gen, $affichage, $color1, $color2)." ";
		$sGGMother112.=affiche_lien_individu2($affichage, $FAMILY, $id_ggmother112,1,1,$ttprenom);
//affichage des arrières grand-parents paternels_111
		$sGGFather121=affiche_lien_arbre2($FAMILY, $id_ggfather121, $gen, $affichage, $color1, $color2)." ";
		$sGGFather121.=affiche_lien_individu2($affichage, $FAMILY, $id_ggfather121,1,1,$ttprenom);
		$sGGMother121=affiche_lien_arbre2($FAMILY, $id_ggmother121, $gen, $affichage, $color1, $color2)." ";
		$sGGMother121.=affiche_lien_individu2($affichage, $FAMILY, $id_ggmother121,1,1,$ttprenom);
		$sGGFather122=affiche_lien_arbre2($FAMILY, $id_ggfather122, $gen, $affichage, $color1, $color2)." ";
		$sGGFather122.=affiche_lien_individu2($affichage, $FAMILY, $id_ggfather122,1,1,$ttprenom);
		$sGGMother122=affiche_lien_arbre2($FAMILY, $id_ggmother122, $gen, $affichage, $color1, $color2)." ";
		$sGGMother122.=affiche_lien_individu2($affichage, $FAMILY, $id_ggmother122,1,1,$ttprenom);
//affichage des arrières grand-parents paternels_222
		$sGGFather211=affiche_lien_arbre2($FAMILY, $id_ggfather211, $gen, $affichage, $color1, $color2)." ";
		$sGGFather211.=affiche_lien_individu2($affichage, $FAMILY, $id_ggfather211,1,1,$ttprenom);
		$sGGMother211=affiche_lien_arbre2($FAMILY, $id_ggmother211, $gen, $affichage, $color1, $color2)." ";
		$sGGMother211.=affiche_lien_individu2($affichage, $FAMILY, $id_ggmother211,1,1,$ttprenom);
		$sGGFather212=affiche_lien_arbre2($FAMILY, $id_ggfather212, $gen, $affichage, $color1, $color2)." ";
		$sGGFather212.=affiche_lien_individu2($affichage, $FAMILY, $id_ggfather212,1,1,$ttprenom);
		$sGGMother212=affiche_lien_arbre2($FAMILY, $id_ggmother212, $gen, $affichage, $color1, $color2)." ";
		$sGGMother212.=affiche_lien_individu2($affichage, $FAMILY, $id_ggmother212,1,1,$ttprenom);
//affichage des arrières grand-parents paternels_222
		$sGGFather221=affiche_lien_arbre2($FAMILY, $id_ggfather221, $gen, $affichage, $color1, $color2)." ";
		$sGGFather221.=affiche_lien_individu2($affichage, $FAMILY, $id_ggfather221,1,1,$ttprenom);
		$sGGMother221=affiche_lien_arbre2($FAMILY, $id_ggmother221, $gen, $affichage, $color1, $color2)." ";
		$sGGMother221.=affiche_lien_individu2($affichage, $FAMILY, $id_ggmother221,1,1,$ttprenom);
		$sGGFather222=affiche_lien_arbre2($FAMILY, $id_ggfather222, $gen, $affichage, $color1, $color2)." ";
		$sGGFather222.=affiche_lien_individu2($affichage, $FAMILY, $id_ggfather222,1,1,$ttprenom);
		$sGGMother222=affiche_lien_arbre2($FAMILY, $id_ggmother222, $gen, $affichage, $color1, $color2)." ";
		$sGGMother222.=affiche_lien_individu2($affichage, $FAMILY, $id_ggmother222,1,1,$ttprenom);
//*****************************************************
		}



if ($gen>5) {
//*****************************************************
//présence arrière grand-parents paternels_1111
	if($id_ggfather111!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggfather111' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather1111=$row_par['id_father'];
			$id_gggmother1111=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather1111=-1;
		$id_gggmother1111=-1;
	}
	if($id_ggmother111!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggmother111' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather1112=$row_par['id_father'];
			$id_gggmother1112=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather1112=-1;
		$id_gggmother1112=-1;
	}
//présence arrière grand-parents maternels_1111
	if($id_ggfather112!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggfather112' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather1121=$row_par['id_father'];
			$id_gggmother1121=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather1121=-1;
		$id_gggmother1121=-1;
	}
	if($id_ggmother112!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggmother112' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather1122=$row_par['id_father'];
			$id_gggmother1122=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather1122=-1;
		$id_gggmother1122=-1;
	}
//présence arrière grand-parents paternels_1111
	if($id_ggfather121!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggfather121' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather1211=$row_par['id_father'];
			$id_gggmother1211=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather1211=-1;
		$id_gggmother1211=-1;
	}
	if($id_ggmother121!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggmother121' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather1212=$row_par['id_father'];
			$id_gggmother1212=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather1212=-1;
		$id_gggmother1212=-1;
	}
//présence arrière grand-parents maternels_1111
	if($id_ggfather122!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggfather122' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather1221=$row_par['id_father'];
			$id_gggmother1221=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather1221=-1;
		$id_gggmother1221=-1;
	}
	if($id_ggmother122!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggmother122' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather1222=$row_par['id_father'];
			$id_gggmother1222=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather1222=-1;
		$id_gggmother1222=-1;
	}
//présence arrière grand-parents paternels_2111
	if($id_ggfather211!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggfather211' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather2111=$row_par['id_father'];
			$id_gggmother2111=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather2111=-1;
		$id_gggmother2111=-1;
	}
	if($id_ggmother211!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggmother211' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather2112=$row_par['id_father'];
			$id_gggmother2112=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather2112=-1;
		$id_gggmother2112=-1;
	}
//présence arrière grand-parents maternels_2111
	if($id_ggfather212!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggfather212' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather2121=$row_par['id_father'];
			$id_gggmother2121=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather2121=-1;
		$id_gggmother2121=-1;
	}
	if($id_ggmother212!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggmother212' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather2122=$row_par['id_father'];
			$id_gggmother2122=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather2122=-1;
		$id_gggmother2122=-1;
	}
//présence arrière grand-parents paternels_2111
	if($id_ggfather221!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggfather221' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather2211=$row_par['id_father'];
			$id_gggmother2211=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather2211=-1;
		$id_gggmother2211=-1;
	}
	if($id_ggmother221!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggmother221' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather2212=$row_par['id_father'];
			$id_gggmother2212=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather2212=-1;
		$id_gggmother2212=-1;
	}
//présence arrière grand-parents maternels_2111
	if($id_ggfather222!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggfather222' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather2221=$row_par['id_father'];
			$id_gggmother2221=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather2221=-1;
		$id_gggmother2221=-1;
	}
	if($id_ggmother222!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_ggmother222' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather2222=$row_par['id_father'];
			$id_gggmother2222=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather2222=-1;
		$id_gggmother2222=-1;
	}
//affichage des arrières arrières grand-parents paternels_1111
		$sGGGFather1111=affiche_lien_arbre2($FAMILY, $id_gggfather1111, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather1111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather1111,1,1,$ttprenom);
		$sGGGMother1111=affiche_lien_arbre2($FAMILY, $id_gggmother1111, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother1111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother1111,1,1,$ttprenom);
		$sGGGFather1112=affiche_lien_arbre2($FAMILY, $id_gggfather1112, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather1112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather1112,1,1,$ttprenom);
		$sGGGMother1112=affiche_lien_arbre2($FAMILY, $id_gggmother1112, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother1112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother1112,1,1,$ttprenom);
		$sGGGFather1121=affiche_lien_arbre2($FAMILY, $id_gggfather1121, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather1121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather1121,1,1,$ttprenom);
		$sGGGMother1121=affiche_lien_arbre2($FAMILY, $id_gggmother1121, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother1121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother1121,1,1,$ttprenom);
		$sGGGFather1122=affiche_lien_arbre2($FAMILY, $id_gggfather1122, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather1122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather1122,1,1,$ttprenom);
		$sGGGMother1122=affiche_lien_arbre2($FAMILY, $id_gggmother1122, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother1122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother1122,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_1222
		$sGGGFather1211=affiche_lien_arbre2($FAMILY, $id_gggfather1211, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather1211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather1211,1,1,$ttprenom);
		$sGGGMother1211=affiche_lien_arbre2($FAMILY, $id_gggmother1211, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother1211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother1211,1,1,$ttprenom);
		$sGGGFather1212=affiche_lien_arbre2($FAMILY, $id_gggfather1212, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather1212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather1212,1,1,$ttprenom);
		$sGGGMother1212=affiche_lien_arbre2($FAMILY, $id_gggmother1212, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother1212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother1212,1,1,$ttprenom);
		$sGGGFather1221=affiche_lien_arbre2($FAMILY, $id_gggfather1221, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather1221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather1221,1,1,$ttprenom);
		$sGGGMother1221=affiche_lien_arbre2($FAMILY, $id_gggmother1221, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother1221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother1221,1,1,$ttprenom);
		$sGGGFather1222=affiche_lien_arbre2($FAMILY, $id_gggfather1222, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather1222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather1222,1,1,$ttprenom);
		$sGGGMother1222=affiche_lien_arbre2($FAMILY, $id_gggmother1222, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother1222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother1222,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_2111
		$sGGGFather2111=affiche_lien_arbre2($FAMILY, $id_gggfather2111, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather2111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather2111,1,1,$ttprenom);
		$sGGGMother2111=affiche_lien_arbre2($FAMILY, $id_gggmother2111, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother2111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother2111,1,1,$ttprenom);
		$sGGGFather2112=affiche_lien_arbre2($FAMILY, $id_gggfather2112, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather2112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather2112,1,1,$ttprenom);
		$sGGGMother2112=affiche_lien_arbre2($FAMILY, $id_gggmother2112, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother2112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother2112,1,1,$ttprenom);
		$sGGGFather2121=affiche_lien_arbre2($FAMILY, $id_gggfather2121, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather2121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather2121,1,1,$ttprenom);
		$sGGGMother2121=affiche_lien_arbre2($FAMILY, $id_gggmother2121, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother2121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother2121,1,1,$ttprenom);
		$sGGGFather2122=affiche_lien_arbre2($FAMILY, $id_gggfather2122, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather2122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather2122,1,1,$ttprenom);
		$sGGGMother2122=affiche_lien_arbre2($FAMILY, $id_gggmother2122, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother2122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother2122,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_2222
		$sGGGFather2211=affiche_lien_arbre2($FAMILY, $id_gggfather2211, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather2211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather2211,1,1,$ttprenom);
		$sGGGMother2211=affiche_lien_arbre2($FAMILY, $id_gggmother2211, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother2211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother2211,1,1,$ttprenom);
		$sGGGFather2212=affiche_lien_arbre2($FAMILY, $id_gggfather2212, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather2212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather2212,1,1,$ttprenom);
		$sGGGMother2212=affiche_lien_arbre2($FAMILY, $id_gggmother2212, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother2212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother2212,1,1,$ttprenom);
		$sGGGFather2221=affiche_lien_arbre2($FAMILY, $id_gggfather2221, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather2221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather2221,1,1,$ttprenom);
		$sGGGMother2221=affiche_lien_arbre2($FAMILY, $id_gggmother2221, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother2221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother2221,1,1,$ttprenom);
		$sGGGFather2222=affiche_lien_arbre2($FAMILY, $id_gggfather2222, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather2222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather2222,1,1,$ttprenom);
		$sGGGMother2222=affiche_lien_arbre2($FAMILY, $id_gggmother2222, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother2222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother2222,1,1,$ttprenom);
//*****************************************************
		}


if ($gen>6) {
//présence arrière grand-parents maternels_11111
if($id_gggfather1111!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather1111' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather11111=$row_par['id_father'];
			$id_gggmother11111=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather11111=-1;
		$id_gggmother11111=-1;
	}
	if($id_gggmother1111!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother1111' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather11112=$row_par['id_father'];
			$id_gggmother11112=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather11112=-1;
		$id_gggmother11112=-1;
	}
if($id_gggfather1112!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather1112' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather11121=$row_par['id_father'];
			$id_gggmother11121=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather11121=-1;
		$id_gggmother11121=-1;
	}
	if($id_gggmother1112!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother1112' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather11122=$row_par['id_father'];
			$id_gggmother11122=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather11122=-1;
		$id_gggmother11122=-1;
	}
if($id_gggfather1121!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather1121' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather11211=$row_par['id_father'];
			$id_gggmother11211=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather11211=-1;
		$id_gggmother11211=-1;
	}
	if($id_gggmother1121!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother1121' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather11212=$row_par['id_father'];
			$id_gggmother11212=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather11212=-1;
		$id_gggmother11212=-1;
	}
if($id_gggfather1122!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather1122' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather11221=$row_par['id_father'];
			$id_gggmother11221=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather11221=-1;
		$id_gggmother11221=-1;
	}
	if($id_gggmother1122!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother1122' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather11222=$row_par['id_father'];
			$id_gggmother11222=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather11222=-1;
		$id_gggmother11222=-1;
	}
if($id_gggfather1211!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather1211' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather12111=$row_par['id_father'];
			$id_gggmother12111=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather12111=-1;
		$id_gggmother12111=-1;
	}
	if($id_gggmother1211!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother1211' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather12112=$row_par['id_father'];
			$id_gggmother12112=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather12112=-1;
		$id_gggmother12112=-1;
	}
if($id_gggfather1212!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather1212' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather12121=$row_par['id_father'];
			$id_gggmother12121=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather12121=-1;
		$id_gggmother12121=-1;
	}
	if($id_gggmother1212!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother1212' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather12122=$row_par['id_father'];
			$id_gggmother12122=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather12122=-1;
		$id_gggmother12122=-1;
	}
if($id_gggfather1221!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather1221' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather12211=$row_par['id_father'];
			$id_gggmother12211=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather12211=-1;
		$id_gggmother12211=-1;
	}
	if($id_gggmother1221!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother1221' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather12212=$row_par['id_father'];
			$id_gggmother12212=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather12212=-1;
		$id_gggmother12212=-1;
	}
if($id_gggfather1222!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather1222' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather12221=$row_par['id_father'];
			$id_gggmother12221=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather12221=-1;
		$id_gggmother12221=-1;
	}
	if($id_gggmother1222!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother1222' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather12222=$row_par['id_father'];
			$id_gggmother12222=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather12222=-1;
		$id_gggmother12222=-1;
	}
//présence arrière grand-parents maternels_11112
if($id_gggfather2111!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather2111' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather21111=$row_par['id_father'];
			$id_gggmother21111=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather21111=-1;
		$id_gggmother21111=-1;
	}
	if($id_gggmother2111!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother2111' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather21112=$row_par['id_father'];
			$id_gggmother21112=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather21112=-1;
		$id_gggmother21112=-1;
	}
if($id_gggfather2112!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather2112' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather21121=$row_par['id_father'];
			$id_gggmother21121=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather21121=-1;
		$id_gggmother21121=-1;
	}
	if($id_gggmother2112!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother2112' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather21122=$row_par['id_father'];
			$id_gggmother21122=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather21122=-1;
		$id_gggmother21122=-1;
	}
if($id_gggfather2121!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather2121' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather21211=$row_par['id_father'];
			$id_gggmother21211=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather21211=-1;
		$id_gggmother21211=-1;
	}
	if($id_gggmother2121!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother2121' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather21212=$row_par['id_father'];
			$id_gggmother21212=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather21212=-1;
		$id_gggmother21212=-1;
	}
if($id_gggfather2122!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather2122' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather21221=$row_par['id_father'];
			$id_gggmother21221=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather21221=-1;
		$id_gggmother21221=-1;
	}
	if($id_gggmother2122!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother2122' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather21222=$row_par['id_father'];
			$id_gggmother21222=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather21222=-1;
		$id_gggmother21222=-1;
	}
if($id_gggfather2211!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather2211' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather22111=$row_par['id_father'];
			$id_gggmother22111=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather22111=-1;
		$id_gggmother22111=-1;
	}
	if($id_gggmother2211!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother2211' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather22112=$row_par['id_father'];
			$id_gggmother22112=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather22112=-1;
		$id_gggmother22112=-1;
	}
if($id_gggfather2212!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather2212' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather22121=$row_par['id_father'];
			$id_gggmother22121=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather22121=-1;
		$id_gggmother22121=-1;
	}
	if($id_gggmother2212!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother2212' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather22122=$row_par['id_father'];
			$id_gggmother22122=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather22122=-1;
		$id_gggmother22122=-1;
	}
if($id_gggfather2221!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather2221' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather22211=$row_par['id_father'];
			$id_gggmother22211=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather22211=-1;
		$id_gggmother22211=-1;
	}
	if($id_gggmother2221!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother2221' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather22212=$row_par['id_father'];
			$id_gggmother22212=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather22212=-1;
		$id_gggmother22212=-1;
	}
if($id_gggfather2222!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggfather2222' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather22221=$row_par['id_father'];
			$id_gggmother22221=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather22221=-1;
		$id_gggmother22221=-1;
	}
	if($id_gggmother2222!=-1)
	{
		$result_par = mysql_query( "select id_father, id_mother from oxg_individuals where id_individual='$id_gggmother2222' $sReqCont $sReqFam");
		if($row_par = mysql_fetch_array($result_par))
		{
			$id_gggfather22222=$row_par['id_father'];
			$id_gggmother22222=$row_par['id_mother'];
		}
	}
	else
	{
		$id_gggfather22222=-1;
		$id_gggmother22222=-1;
	}
//affichage des arrières arrières grand-parents paternels_11111
		$sGGGFather11111=affiche_lien_arbre2($FAMILY, $id_gggfather11111, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather11111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather11111,1,1,$ttprenom);
		$sGGGMother11111=affiche_lien_arbre2($FAMILY, $id_gggmother11111, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother11111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother11111,1,1,$ttprenom);
		$sGGGFather11121=affiche_lien_arbre2($FAMILY, $id_gggfather11121, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather11121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather11121,1,1,$ttprenom);
		$sGGGMother11121=affiche_lien_arbre2($FAMILY, $id_gggmother11121, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother11121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother11121,1,1,$ttprenom);
		$sGGGFather11211=affiche_lien_arbre2($FAMILY, $id_gggfather11211, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather11211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather11211,1,1,$ttprenom);
		$sGGGMother11211=affiche_lien_arbre2($FAMILY, $id_gggmother11211, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother11211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother11211,1,1,$ttprenom);
		$sGGGFather11221=affiche_lien_arbre2($FAMILY, $id_gggfather11221, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather11221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather11221,1,1,$ttprenom);
		$sGGGMother11221=affiche_lien_arbre2($FAMILY, $id_gggmother11221, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother11221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother11221,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_12221
		$sGGGFather12111=affiche_lien_arbre2($FAMILY, $id_gggfather12111, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather12111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather12111,1,1,$ttprenom);
		$sGGGMother12111=affiche_lien_arbre2($FAMILY, $id_gggmother12111, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother12111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother12111,1,1,$ttprenom);
		$sGGGFather12121=affiche_lien_arbre2($FAMILY, $id_gggfather12121, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather12121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather12121,1,1,$ttprenom);
		$sGGGMother12121=affiche_lien_arbre2($FAMILY, $id_gggmother12121, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother12121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother12121,1,1,$ttprenom);
		$sGGGFather12211=affiche_lien_arbre2($FAMILY, $id_gggfather12211, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather12211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather12211,1,1,$ttprenom);
		$sGGGMother12211=affiche_lien_arbre2($FAMILY, $id_gggmother12211, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother12211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother12211,1,1,$ttprenom);
		$sGGGFather12221=affiche_lien_arbre2($FAMILY, $id_gggfather12221, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather12221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather12221,1,1,$ttprenom);
		$sGGGMother12221=affiche_lien_arbre2($FAMILY, $id_gggmother12221, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother12221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother12221,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_21111
		$sGGGFather21111=affiche_lien_arbre2($FAMILY, $id_gggfather21111, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather21111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather21111,1,1,$ttprenom);
		$sGGGMother21111=affiche_lien_arbre2($FAMILY, $id_gggmother21111, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother21111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother21111,1,1,$ttprenom);
		$sGGGFather21121=affiche_lien_arbre2($FAMILY, $id_gggfather21121, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather21121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather21121,1,1,$ttprenom);
		$sGGGMother21121=affiche_lien_arbre2($FAMILY, $id_gggmother21121, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother21121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother21121,1,1,$ttprenom);
		$sGGGFather21211=affiche_lien_arbre2($FAMILY, $id_gggfather21211, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather21211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather21211,1,1,$ttprenom);
		$sGGGMother21211=affiche_lien_arbre2($FAMILY, $id_gggmother21211, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother21211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother21211,1,1,$ttprenom);
		$sGGGFather21221=affiche_lien_arbre2($FAMILY, $id_gggfather21221, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather21221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather21221,1,1,$ttprenom);
		$sGGGMother21221=affiche_lien_arbre2($FAMILY, $id_gggmother21221, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother21221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother21221,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_22221
		$sGGGFather22111=affiche_lien_arbre2($FAMILY, $id_gggfather22111, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather22111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather22111,1,1,$ttprenom);
		$sGGGMother22111=affiche_lien_arbre2($FAMILY, $id_gggmother22111, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother22111.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother22111,1,1,$ttprenom);
		$sGGGFather22121=affiche_lien_arbre2($FAMILY, $id_gggfather22121, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather22121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather22121,1,1,$ttprenom);
		$sGGGMother22121=affiche_lien_arbre2($FAMILY, $id_gggmother22121, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother22121.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother22121,1,1,$ttprenom);
		$sGGGFather22211=affiche_lien_arbre2($FAMILY, $id_gggfather22211, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather22211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather22211,1,1,$ttprenom);
		$sGGGMother22211=affiche_lien_arbre2($FAMILY, $id_gggmother22211, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother22211.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother22211,1,1,$ttprenom);
		$sGGGFather22221=affiche_lien_arbre2($FAMILY, $id_gggfather22221, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather22221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather22221,1,1,$ttprenom);
		$sGGGMother22221=affiche_lien_arbre2($FAMILY, $id_gggmother22221, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother22221.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother22221,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_11112
		$sGGGFather11112=affiche_lien_arbre2($FAMILY, $id_gggfather11112, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather11112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather11112,1,1,$ttprenom);
		$sGGGMother11112=affiche_lien_arbre2($FAMILY, $id_gggmother11112, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother11112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother11112,1,1,$ttprenom);
		$sGGGFather11122=affiche_lien_arbre2($FAMILY, $id_gggfather11122, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather11122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather11122,1,1,$ttprenom);
		$sGGGMother11122=affiche_lien_arbre2($FAMILY, $id_gggmother11122, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother11122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother11122,1,1,$ttprenom);
		$sGGGFather11212=affiche_lien_arbre2($FAMILY, $id_gggfather11212, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather11212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather11212,1,1,$ttprenom);
		$sGGGMother11212=affiche_lien_arbre2($FAMILY, $id_gggmother11212, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother11212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother11212,1,1,$ttprenom);
		$sGGGFather11222=affiche_lien_arbre2($FAMILY, $id_gggfather11222, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather11222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather11222,1,1,$ttprenom);
		$sGGGMother11222=affiche_lien_arbre2($FAMILY, $id_gggmother11222, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother11222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother11222,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_12222
		$sGGGFather12112=affiche_lien_arbre2($FAMILY, $id_gggfather12112, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather12112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather12112,1,1,$ttprenom);
		$sGGGMother12112=affiche_lien_arbre2($FAMILY, $id_gggmother12112, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother12112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother12112,1,1,$ttprenom);
		$sGGGFather12122=affiche_lien_arbre2($FAMILY, $id_gggfather12122, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather12122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather12122,1,1,$ttprenom);
		$sGGGMother12122=affiche_lien_arbre2($FAMILY, $id_gggmother12122, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother12122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother12122,1,1,$ttprenom);
		$sGGGFather12212=affiche_lien_arbre2($FAMILY, $id_gggfather12212, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather12212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather12212,1,1,$ttprenom);
		$sGGGMother12212=affiche_lien_arbre2($FAMILY, $id_gggmother12212, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother12212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother12212,1,1,$ttprenom);
		$sGGGFather12222=affiche_lien_arbre2($FAMILY, $id_gggfather12222, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather12222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather12222,1,1,$ttprenom);
		$sGGGMother12222=affiche_lien_arbre2($FAMILY, $id_gggmother12222, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother12222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother12222,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_21112
		$sGGGFather21112=affiche_lien_arbre2($FAMILY, $id_gggfather21112, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather21112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather21112,1,1,$ttprenom);
		$sGGGMother21112=affiche_lien_arbre2($FAMILY, $id_gggmother21112, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother21112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother21112,1,1,$ttprenom);
		$sGGGFather21122=affiche_lien_arbre2($FAMILY, $id_gggfather21122, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather21122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather21122,1,1,$ttprenom);
		$sGGGMother21122=affiche_lien_arbre2($FAMILY, $id_gggmother21122, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother21122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother21122,1,1,$ttprenom);
		$sGGGFather21212=affiche_lien_arbre2($FAMILY, $id_gggfather21212, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather21212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather21212,1,1,$ttprenom);
		$sGGGMother21212=affiche_lien_arbre2($FAMILY, $id_gggmother21212, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother21212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother21212,1,1,$ttprenom);
		$sGGGFather21222=affiche_lien_arbre2($FAMILY, $id_gggfather21222, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather21222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather21222,1,1,$ttprenom);
		$sGGGMother21222=affiche_lien_arbre2($FAMILY, $id_gggmother21222, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother21222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother21222,1,1,$ttprenom);
//affichage des arrières arrières grand-parents paternels_22222
		$sGGGFather22112=affiche_lien_arbre2($FAMILY, $id_gggfather22112, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather22112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather22112,1,1,$ttprenom);
		$sGGGMother22112=affiche_lien_arbre2($FAMILY, $id_gggmother22112, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother22112.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother22112,1,1,$ttprenom);
		$sGGGFather22122=affiche_lien_arbre2($FAMILY, $id_gggfather22122, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather22122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather22122,1,1,$ttprenom);
		$sGGGMother22122=affiche_lien_arbre2($FAMILY, $id_gggmother22122, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother22122.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother22122,1,1,$ttprenom);
		$sGGGFather22212=affiche_lien_arbre2($FAMILY, $id_gggfather22212, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather22212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather22212,1,1,$ttprenom);
		$sGGGMother22212=affiche_lien_arbre2($FAMILY, $id_gggmother22212, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother22212.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother22212,1,1,$ttprenom);
		$sGGGFather22222=affiche_lien_arbre2($FAMILY, $id_gggfather22222, $gen, $affichage, $color1, $color2)." ";
		$sGGGFather22222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggfather22222,1,1,$ttprenom);
		$sGGGMother22222=affiche_lien_arbre2($FAMILY, $id_gggmother22222, $gen, $affichage, $color1, $color2)." ";
		$sGGGMother22222.=affiche_lien_individu2($affichage, $FAMILY, $id_gggmother22222,1,1,$ttprenom);
//*****************************************************
		}


//*****************************************************
//affichage arbre ascendant

echo "<table cellspacing=0>";

$color0="bgcolor=c0c0c0";  //gris
if ($color1!="") {$color1="bgcolor=".$color1;}
if ($color2!="") {$color2="bgcolor=".$color2;}
if ($sex=="0") {$color0=$color1;}
if ($sex=="1") {$color0=$color2;}

if ($gen>6) { echo "<tr><td></td><td></td><td></td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather11111</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td></td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather1111</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother11111</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGFather111</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather11112</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother1111</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother11112</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGFather11</td></tr>";}
if ($gen==4) { echo "<tr><td></td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGFather11</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather11121</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather1112</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother11121</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGMother111</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather11122</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother1112</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother11122</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td $color1 width=25% class=c9 align=left>$sFather1</td></tr>";}
if ($gen<5) { echo "<tr><td></td><td></td><td $color1 width=25% class=c9 align=left>$sFather1</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather11211</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather1121</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother11211</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGFather112</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather11212</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother1121</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother11212</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGMother11</td></tr>";}
if ($gen==4) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGMother11</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather11221</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather1122</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother11221</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGMother112</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather11222</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother1122</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother11222</td></tr>";}
if ($gen>4) { echo "<tr><td $color1 width=25% class=c9 align=left>$sFather</td><td class=c1 width=12%>&nbsp;</td></tr>";}
if ($gen<5) { echo "<tr><td></td><td $color1 width=25% class=c9 align=left>$sFather</td><td class=c1 width=12%>&nbsp;</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather12111</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather1211</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother12111</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGFather121</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather12112</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother1211</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother12112</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGFather12</td></tr>";}
if ($gen==4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGFather12</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather12121</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather1212</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother12121</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGMother121</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather12122</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother1212</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother12122</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sMother1</td></tr>";}
if ($gen<5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sMother1</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather12211</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather1221</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother12211</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGFather122</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather12212</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother1221</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother12212</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGMother12</td></tr>";}
if ($gen==4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGMother12</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather12221</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather1222</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother12221</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGMother122</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather12222</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother1222</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother12222</td></tr>";}

	$query_ = "select count(*) as SOMME from oxg_individuals where id_father=$INDIVIDU $sReqFam or id_mother=$INDIVIDU $sReqFam";
	$result_ = mysql_query($query_) or mysql_die();
	$row_ = mysql_fetch_array($result_);
	$sLink = "";
	if ($row_['SOMME'] != 0)
	{
	$sLink ="<A HREF='§desc_individu.php?INDIVIDU=$INDIVIDU&FAMILY=$FAMILY'><IMG SRC='list2.png' ALT='Voir liste de descendance'></a>"." ";	
	}
	echo "<tr><TD $color0 align='left' class=c9>".$sLink.affiche_lien_individu2($affichage, $FAMILY, $INDIVIDU,1,1,$ttprenom);

if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather21111</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather2111</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother21111</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGFather211</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather21112</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother2111</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother21112</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGFather21</td></tr>";}
if ($gen==4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGFather21</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather21121</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather2112</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother21121</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGMother211</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather21122</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother2112</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother21122</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sFather2</td></tr>";}
if ($gen<5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sFather2</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather21211</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather2121</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother21211</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGFather212</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather21212</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother2121</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother21212</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGMother21</td></tr>";}
if ($gen==4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGMother21</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather21221</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather2122</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother21221</td></tr>";}
if ($gen>4) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGMother212</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather21222</td></tr>";}
if ($gen>5) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother2122</td></tr>";}
if ($gen>6) { echo "<tr><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother21222</td></tr>";}
if ($gen>4) { echo "<tr><td $color2 width=25% class=c9 align=left>$sMother</td><td class=c5 width=12%>&nbsp;</td></tr>";}
if ($gen<5) { echo "<tr><td></td><td $color2 width=25% class=c9 align=left>$sMother</td><td class=c5 width=12%>&nbsp;</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather22111</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather2211</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother22111</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGFather221</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather22112</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother2211</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother22112</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGFather22</td></tr>";}
if ($gen==4) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGFather22</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather22121</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather2212</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother22121</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGMother221</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather22122</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother2212</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother22122</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td $color2 width=25% class=c9 align=left>$sMother2</td></tr>";}
if ($gen<5) { echo "<tr><td></td><td></td><td $color2 width=25% class=c9 align=left>$sMother2</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather22211</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather2221</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother22211</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGFather222</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather22212</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother2221</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother22212</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGMother22</td></tr>";}
if ($gen==4) { echo "<tr><td></td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGMother22</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td></td><td $color1 width=25% class=c9 align=left>$sGGGFather22221</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather2222</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td class=c5 width=12%>&nbsp;</td><td $color2 width=25% class=c9 align=left>$sGGGMother22221</td></tr>";}
if ($gen>4) { echo "<tr><td></td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGMother222</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td></td><td></td><td class=c5 width=12%>&nbsp;</td><td $color1 width=25% class=c9 align=left>$sGGGFather22222</td></tr>";}
if ($gen>5) { echo "<tr><td></td><td></td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother2222</td></tr>";}
if ($gen>6) { echo "<tr><td></td><td></td><td></td><td></td><td></td><td $color2 width=25% class=c9 align=left>$sGGGMother22222</td></tr>";}


	echo "</TD></tr></table>";


function nb_Children ($parent, $fam, $gen, $affichage, $color1, $color2)
{
	if($fam!=-1)
	{
		$sReqFam="and id_family=$fam";
	}
	else
	{
		$sReqFam="";
	}
	global $bSessionOk;
	
	echo "<span>";
	$nb_enfants=0;
	$old_conjoint="";
	$sql_query = "select oxg_individuals.id_individual as id_ind, oxg_individuals.first_name, sex, oxg_patronyms.libelle, id_father, id_mother from oxg_individuals, oxg_patronyms where (id_father=$parent or id_mother=$parent) and oxg_patronyms.id_patronym=oxg_individuals.id_patronym $sReqFam order by id_father, id_mother";
	if($bSessionOk==false)
	{
		$sql_query.= ", right(date_naissance,4)";
	}
	$result_ind = mysql_query( $sql_query ) or mysql_die();
	while($row_ind = mysql_fetch_array($result_ind))
	{
		if($parent!=$row_ind['id_father'])
		{
			$id_conjoint=$row_ind['id_father'];
		}
		if($parent!=$row_ind['id_mother'])
		{
			$id_conjoint=$row_ind['id_mother'];
		}
		if($old_conjoint!=$id_conjoint)
		{
			if($nb_enfants!=0)
			{
				echo "</dl>";
			}
			echo "<dt><b>".decode_lng_text('DETAIL_IND_CHILD')." ".decode_lng_text('DETAIL_IND_WITH')." ";
			echo affiche_lien_individu($fam,$id_conjoint,true,true);
			echo "</b></dt>";
			$old_conjoint=$id_conjoint;
		}
		if ($row_ind['sex']==1) { $flag="female.png"; }
		if ($row_ind['sex']==0) { $flag="male.png"; }
		echo "<dd>".affiche_lien_arbre2($fam, $row_ind['id_ind'], $gen, $affichage, $color1, $color2);
		echo " ";
		echo "<IMG SRC=$flag> ".affiche_lien_individu($fam, $row_ind['id_ind'], true, true)." </dd>";
		$nb_enfants++;
	}
	if($nb_enfants!=0)
	{
		echo "</dl></dl>";
	}
echo "</span>";
}


echo "<div id=footer>";
	affiche_pied_page(true);
echo "</div>";

?>
