<?php
	

	// $largeur_utile = 1250;
	// $largeur= $nbgen>=4 ? ceil($largeur_utile/$nbgen) : "'300px'";
	$largeur= "'250px'";


/*	

.box1H {
    background-color: #e5ffff;
}
.box1F {
   background-color: #FFE3FF;
}	

*/

	$colorH = isset($_SESSION['s_colorH']) ? $_SESSION['s_colorH'] : 'e3f9fc';// même valeur par défault que dans la css box1H
	$colorF = isset($_SESSION['s_colorF']) ? $_SESSION['s_colorF'] : 'ffeafa';// même valeur par défault que dans la css box1F


	$colorF =  isset($_GET['colorF']) ? $_GET['colorF'] : $colorF; 
	$colorH =  isset($_GET['colorH']) ? $_GET['colorH'] : $colorH;

	$ttprenom = isset($this->request->data->ttprenom) ? $this->request->data->ttprenom : 2 ;
	$affichage =isset($this->request->data->affichage) ? $this->request->data->affichage : 2 ;
	$nbgen = isset($this->request->data->nbgen) ? $this->request->data->nbgen : 4 ;
	
	echo "<div id='css_arbre' style='display:none; visibility:hidden;'>";
	echo "<style type='text/css'>
			.box1H { background-color: #".$colorH."; }
			.box1F { background-color: #".$colorF."; }
		  </style>";
	echo "</div>";
	
	echo "<div id=panel>";
	echo "<form action='' method='post' >";
	echo "<center>";
	echo "<table border=0><tr>";
	if ($_SESSION['b_connecte'] == true ) {
		echo "<td colspan=2><center>".decode_lng_text('TREE_COL')." ".decode_lng_text('STATS_SEXE_M')."/".decode_lng_text('STATS_SEXE_F')."</br>";
		echo "<input type='hidden' name='colorH' id='colorH' value='$colorH'>";
		echo "<input type='hidden' name='colorF' id='colorF' value='$colorF'>";
		echo "<button style='font-size:10px;' onClick=\"UpdateSaveColorsArbre('".BASE_URL."');\">".decode_lng_text('TREE_SAVE')."</button>&nbsp;";
		echo "<input  style='width:80px; height:20px;' class='jscolor'  data-jscolor=\"{onFineChange:'UpdateArbre(\'H\',this)', mode:'HS', valueElement:null, value:'".$colorH."', closable:true, closeText:'Fermer', width:243, height:150, borderColor:'#FFF', insetColor:'#FFF', backgroundColor:'#ffe5af'}\"  >";  
		echo "&nbsp;&nbsp;&nbsp;";
		echo "<input  style='width:80px; height:20px;' class='jscolor' data-jscolor=\"{ onFineChange:'UpdateArbre(\'F\',this)', mode:'HS', valueElement:null, value:'".$colorF."', closable:true, closeText:'Fermer', width:243, height:150, borderColor:'#FFF', insetColor:'#FFF', backgroundColor:'#ffe5af'}\" >";  
		echo "&nbsp;<button style='font-size:10px;' onClick=\"UpdateArbre('H','e3f9fc');UpdateArbre('H','ffeafa');\">".decode_lng_text('TREE_RESET')."</button>&nbsp;";
		echo "</br><font color='blue'><i>".decode_lng_text('TREE_CHOIX')."</i></font>";
		echo "</td>";
	}
	echo "<td></br>".decode_lng_text('TREE_NBGEN')." : ";
	echo "<select name='nbgen'>";

	for ($i=3;$i<8;$i++) {
		if ($nbgen == $i) { 
				$selected = "selected=selected";
			} 
			else {
				$selected= '';
			}
		echo "<option value='".$i."'".$selected.">".$i."</option>";
	}
	echo "</select>";

	echo "<td></br>".decode_lng_text('TREE_AFI')." : ";
	
	echo "<select name='affichage' value>";
	for ($i=1;$i<4;$i++) {
		if ($affichage == $i) { 
				$selected = "selected=selected";
			} 
			else {
				$selected = '';
			}
		echo "<option value='".$i."'".$selected.">".decode_lng_text('TREE_AFF'.$i)."</option>";
	}
	echo "</select>";
	echo "&nbsp;";
	
	//echo "Affichage prénoms : ";
	echo "<select name='ttprenom'>";
	for ($i=1;$i<3;$i++) {
		if ($ttprenom == $i) { 
				$selected = "selected=selected";
			} 
			else {
				$selected = '';
			}

		echo "<option value='".$i."'".$selected.">".decode_lng_text('TREE_AFF'.($i+3))."</option>";
	}
	echo "</select>";
	
	echo "<td></br><input type=submit value=".decode_lng_text('PRIVATE_ENTER')."></td>";
	echo "</tr></table></form>";
	echo "</center>";
	echo "</div>";

	echo "<div> <img src='".IMAGES."ligne_orange.png' width=100% height='2px'></br></div>";
	
	echo "<center><h1>".$_SESSION['s_Title']."</h1></center></br>";

	echo "<div id=children>";
	echo "<span>";
	
		
	$result=$this->Outils->nb_children($_SESSION['arbre_individu']['id']);
	
//$_SESSION['ind_affiche']=1;
	$nb_enfants=0;
	$old_conjoint="";
//var_dump($_SESSION['t_arbre_children']);
	foreach($_SESSION['t_arbre_children'] as $row_child) { 
		if($old_conjoint!=$row_child['id_conjoint']) {
			if($nb_enfants!=0) {
				echo "</dl>";
			}
			$old_conjoint = $row_child['id_conjoint'];
			echo "<dt><b>".decode_lng_text('DETAIL_IND_CHILD')." ".decode_lng_text('DETAIL_IND_WITH')." ";
			echo $this->Outils->affiche_lien_individu($row_child['id_conjoint'],true,true);
			echo "</b></dt>";
		}

		if ($row_child['sex']==1) { $flag = IMAGES."female.png"; }
		if ($row_child['sex']==0) { $flag = IMAGES."male.png"; }
		echo "<dd>".$this->Outils->affiche_lien_arbre($row_child['id_child']);
		echo " ";
		echo "<img src=".$flag."> ".$this->Outils->affiche_lien_individu($row_child['id_child'],true,true)." </dd>";
		$nb_enfants++;
	}
	if($nb_enfants!=0)
	{
		echo "</dl></dl>";
	}
	echo "</span>";	

	echo "</div>";
			
		
		
	//var_dump($_SESSION['t_parents'] );
		foreach ($_SESSION['t_parents'] as $k=>$id) {
			$gp ="s".$k;
			if (strstr( $k,'Father') == false) { 
				$box = 'box1F';
			}
			else {
				$box = 'box1H';
			}
			
			if (isset($id)) {
				${$gp}  = "<div class='arbre box1 ".$box." w100p'>";
				${$gp} .= $this->Outils->affiche_lien_individu2($affichage, $id, true, true,$ttprenom).'</br>';   //$id_affichage, $id_individual, $bAffichePatronyme=true, $bAfficheDate=false, $ttprenom)
				${$gp} .= $this->Outils->affiche_lien_arbre($id);
				${$gp} .= "</div>";
			}
			else
			{
				${$gp} = "<div class='arbre box1 ".$box." w100p'>?</div>";
			}
		//echo $gp ."= ".${$gp};
		}


	//*****************************************************

	echo "<div id='arbre' >";

	//affichage partie ascendante de l'arbre

	echo "	<table>";

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

	if ($nbgen>6) { echo "<tr><td></td><td></td><td></td><td></td><td></td><td width=".$largeur." align=left>".$sGGGGGFather11111."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td></td><td></td><td></td><td width=".$largeur." align=left>".$sGGGGFather1111."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother11111."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td></td><td></td><td  align=left>".$sGGGFather111."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather11112."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGMother1111."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGMother11112."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td></td><td width=".$largeur." align=left>".$sGGFather11."</td></tr>";}
	if ($nbgen==4) { echo "<tr><td></td ><td></td ><td></td><td></td><td width=".$largeur." align=left>".$sGGFather11."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGFather11121."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGFather1112."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother11121."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGMother111."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather11122."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGMother1112."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGGMother11122."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td width=".$largeur." align=left>".$sGFather1."</td></tr>";}
	if ($nbgen<5) { echo "<tr><td></td><td></td><td width=".$largeur." align=left>".$sGFather1."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGGFather11211."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGFather1121."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother11211."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGFather112."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather11212."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGMother1121."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGMother11212."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td   class=c5></td><td  align=left>".$sGGMother11."</td></tr>";}
	if ($nbgen==4) { echo "<tr><td></td><td></td><td class=c5 ></td><td></td><td width=".$largeur." align=left>".$sGGMother11."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGFather11221."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGFather1122."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother11221."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGMother112."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather11222."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGMother1122."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td  align=left>".$sGGGGGMother11222."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td  align=left>".$sFather."</td><td class=c5 ></td></tr>";}
	if ($nbgen<5) { echo "<tr><td ></td><td  align=left>".$sFather."</td><td></td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td  align=left>".$sGGGGGFather12111."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGFather1211."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother12111."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGFather121."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather12112."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGMother1211."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGMother12112."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGFather12."</td></tr>";}
	if ($nbgen==4) { echo "<tr><td></td><td class=c5 ></td><td class=c5 ></td><td ></td><td  align=left>".$sGGFather12."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGFather12121."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGFather1212."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother12121."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGMother121."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather12122."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGMother1212."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGGMother12122."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td  align=left>".$sGMother1."</td></tr>";}
	if ($nbgen<5) { echo "<tr><td></td><td class=c5 ></td><td  align=left>".$sGMother1."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGGFather12211."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGFather1221."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother12211."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGFather122."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather12212."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGMother1221."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGMother12212."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGMother12."</td></tr>";}
	if ($nbgen==4) { echo "<tr><td></td><td class=c5></td><td></td><td></td><td  align=left>".$sGGMother12."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGFather12221."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGFather1222."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother12221."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGMother122."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather12222."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td  align=left>".$sGGGGMother1222."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td></td><td  align=left>".$sGGGGGMother12222."</td></tr>";}

		$sLink = "";
		if ($sFather != '?' or $sMother != '?')	{
			$sLink ="<a href='".Router::url('individus/desc_individu/'.$_SESSION['arbre_individu']['id'])."'><img src=".IMAGES.'list2.png'." alt='Voir liste de descendance'></a>"." ";	
		}
		echo "<tr><td width=".$largeur." align='left' >";
		if ($_SESSION['arbre_individu']['sexe']==0) { 
			echo "<div class='arbre box1 box1H w100p'>";
		}
		else {
			echo "<div class='arbre box1 box1F w100p'>";
		}
			
		echo $this->Outils->affiche_lien_individu2($affichage, $_SESSION['arbre_individu']['id'], true, true, $ttprenom).'</br>'.$this->Outils->affiche_lien_arbre($_SESSION['arbre_individu']['id'])."</div></td></tr>";

	// affichage de la partie descendante de l'arbre
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td></td><td  align=left>".$sGGGGGFather21111."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td  align=left>".$sGGGGFather2111."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother21111."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGFather211."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGGFather21112."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGMother2111."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGMother21112."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGFather21."</td></tr>";}
	if ($nbgen==4) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td>&nbsp</td><td  align=left>".$sGGFather21."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGFather21121."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGFather2112."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother21121."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGMother211."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather21122."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGMother2112."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGGMother21122."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td  align=left>".$sGFather2."</td></tr>";}
	if ($nbgen<5) { echo "<tr><td></td><td class=c5>&nbsp;</td><td  align=left>".$sGFather2."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGGFather21211."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGFather2121."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother21211."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGFather212."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather21212."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGMother2121."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGMother21212."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGMother21."</td></tr>";}
	if ($nbgen==4) { echo "<tr><td></td><td class=c5>&nbsp;</td><td class=c5 >&nbsp;</td><td ></td><td  align=left>".$sGGMother21."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGFather21221."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather2122."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother21221."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGMother212."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather21222."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGMother2122."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td  align=left>".$sGGGGGMother21222."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td  align=left>".$sMother."</td><td class=c5 >&nbsp;</td></tr>";}
	if ($nbgen<5) { echo "<tr><td></td><td  align=left>".$sMother."</td><td></td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td></td><td  align=left>".$sGGGGGFather22111."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGFather2211."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother22111."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGFather221."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather22112."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGMother2211."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGMother22112."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGFather22."</td></tr>";}
	if ($nbgen==4) { echo "<tr><td></td><td></td><td class=c5>&nbsp;</td><td></td><td  align=left>".$sGGFather22."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGFather22121."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGFather2212."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother22121."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGMother221."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather22122."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGMother2212."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGGMother22122."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td  align=left>".$sGMother2."</td></tr>";}
	if ($nbgen<5) { echo "<tr><td></td><td></td><td  align=left>".$sGMother2."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td></td><td  align=left>".$sGGGGGFather22211."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGFather2221."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother22211."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGFather222."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather22212."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGMother2221."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGMother22212."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td></td><td  align=left>".$sGGMother22."</td></tr>";}
	if ($nbgen==4) { echo "<tr><td></td><td></td><td></td><td></td><td  align=left>".$sGGMother22."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td></td><td  align=left>".$sGGGGGFather22221."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGFather2222."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGMother22221."</td></tr>";}
	if ($nbgen>4) { echo "<tr><td></td><td></td><td></td><td  align=left>".$sGGGMother222."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td></td><td></td><td class=c5 >&nbsp;</td><td  align=left>".$sGGGGGFather22222."</td></tr>";}
	if ($nbgen>5) { echo "<tr><td></td><td></td><td></td><td></td><td  align=left>".$sGGGGMother2222."</td></tr>";}
	if ($nbgen>6) { echo "<tr><td></td><td></td><td></td><td></td><td></td><td  align=left>".$sGGGGGMother22222."</td></tr>";}


	echo "</td></tr></table>";
	echo"</div>";
