<?php
	require("admin/§lib_inc.php");
?>
<HTML>
<BODY BGCOLOR=#FFFFFF FGCOLOR=0 background='fond.png'>
<?php
	$FAMILY=isset($_REQUEST["FAMILY"])?$_REQUEST["FAMILY"] : -1; 

//	set_time_limit(0);
	
	flush();

	echo "<CENTER><H1>";	
	display_lng_text("INITIALES_TITLE");
	echo "</H1>";

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

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

	$result = mysql_query( "select COUNT(*) as SOMME from oxg_individuals where 1=1 $sReqCont $sReqFam");
	$row = mysql_fetch_array($result);
	if($row['SOMME']!=0)
	{
		$total=$row['SOMME'];
	}
	
	for($i=65;$i<=90;$i++)
	{
		$c=chr($i);
		$result = mysql_query( "select COUNT(*) as SOMME from oxg_patronyms, oxg_individuals where oxg_patronyms.id_patronym=oxg_individuals.id_patronym $sReqCont and upper(left(oxg_patronyms.libelle_ord,1))='$c' $sReqFam");
		if($row = mysql_fetch_array($result))
		{
			if($row>0)
			{
				echo "<A HREF='§patro.php?INITIALE=$c&FAMILY=$FAMILY'>";
				echo "<B>$c</B></A> (<b>$row[SOMME]</b>";
				$total-=$row['SOMME'];
				echo ")<br>";
				
				flush();
			}
		}
	}
	if($total>0)
	{
		echo "<A HREF='§patro.php?INITIALE=AUTRES&FAMILY=$FAMILY'><B>";
		display_lng_text("PATRO_OTHER");
		echo "</B></A> (<b>$total</b>)";
	}
?>
</CENTER>
<?php
	affiche_pied_page(true);
?>
</BODY>
</HTML>
