Location: PHPKode > projects > HuMo-gen > lijst.php
<?php
include ("include/language_date.php");
include ("include/date_place.php");
include('include/person_cls.php');

// *** show person ***
function persoon_weergeven($personDb){
	global $index_list, $plaats, $language, $user;
	global $bot_visit, $db, $humo_option, $uri_pad, $zoekdatabase, $lijst_uitgebreid;
	global $Taalkeuze, $privacy, $dirmark1, $dirmark2, $rtlmarker;
	global $cms;
	global $select_birth, $select_bapt, $select_place, $select_death, $select_buried;
	
	$stamboom=veilig($personDb->pers_tree_prefix);

	if ($index_list=='places'){
		if ($plaats!=$personDb->place_order){ echo "<b>$personDb->place_order</b><br>"; }
		$plaats=$personDb->place_order;
	}

	if ($cms['cms_name']=='Joomla'){
		$start_url='index.php?option=com_humo-gen&amp;task=family&amp;database='.$stamboom.
			'&amp;id='.$personDb->pers_indexnr.'&amp;hoofdpersoon='.$personDb->pers_gedcomnumber;
	}
	elseif ($humo_option["url_rewrite"]=="j"){	// *** url_rewrite ***
		// *** $uri_pad is gemaakt in header.php ***
		$start_url= $uri_pad.'gezin/'.$stamboom.'/'.$personDb->pers_indexnr.'/'.$personDb->pers_gedcomnumber.'/';
	}
	else{
		$start_url= 'gezin.php?database='.$stamboom.'&amp;id='.$personDb->pers_indexnr.'&amp;hoofdpersoon='.$personDb->pers_gedcomnumber;
	}

	// *** Show name ***
	$naam='';
	if (($privacy AND $user['group_filter_name']=='n')
		OR ($user["group_pers_hide_totally_act"]=='j' AND strpos(' '.$personDb->pers_own_code,$user["group_pers_hide_totally"])>0)){
		$naam=$language["privacy"];
	}
	else{
		//Dit deel kan nog verbeterd worden, aantal regels verderop ook nog een pers_prefix weergeven.
		// Mons, van of: van Mons
		if ($user['soortindex']=="j"){
			$naam.=" ".str_replace("_", " ", $personDb->pers_prefix);
		}

		// *** No lastname ***
		if ($personDb->pers_lastname==""){
			//Bij pers_patronymen index GEEN "-" weergeven
			if (!isset($_GET['pers_patronym'])){ $naam="-&nbsp;&nbsp;"; }
		}
		else{
			if ($personDb->pers_lastname=="doodgeboren kind"){
				if ($personDb->pers_sexe=='M'){ $naam=$language["pers_stillborn_boy"]; } 
				if ($personDb->pers_sexe=='F'){ $naam=$language["pers_stillborn_girl"]; }
				if ($personDb->pers_sexe==''){ $naam=$language["pers_stillborn_child"]; }
			}
			else{
				$naam.=$personDb->pers_lastname.", ";
			}
		}

		$naam.=$personDb->pers_firstname;
		if ($personDb->pers_patronym){ $naam.=' '.$personDb->pers_patronym;}

		// Mons, van or: van Mons
		if ($user['soortindex']=="n"){
			if ($personDb->pers_prefix){
				$test=" ".str_replace("_", " ", $personDb->pers_prefix);
				$naam.=rtrim($test);
			}
		}

	}

	// *** Show extra colums before a person in index places ***
	if ($index_list=='places'){

		if ($select_birth=='1'){
			if ($plaats==$personDb->pers_birth_place){
				echo '<span class="place_index place_index_selected">'.$language["lng_birth_short"].'</span>';
			}
			else{
				echo '<span class="place_index">&nbsp;</span>';
			}
		}

		if ($select_bapt=='1'){
			if ($plaats==$personDb->pers_bapt_place){
				echo '<span class="place_index place_index_selected">'.$language["lng_bapt_short"].'</span>';
			}
			else{
				echo '<span class="place_index">&nbsp;</span>';
			}
		}

		if ($select_place=='1'){
			if ($plaats==$personDb->pers_place_index){
				echo '<span class="place_index place_index_selected">'.$language["lng_residence_short"].'</span>';
			}
			else{
				echo '<span class="place_index">&nbsp;</span>';
			}
		}
		
		if ($select_death=='1'){
			if ($plaats==$personDb->pers_death_place){
				echo '<span class="place_index place_index_selected">'.$language["lng_death_short"].'</span>';
			}
			else{
				echo '<span class="place_index">&nbsp;</span>';
			}
		}

		if ($select_buried=='1'){		
			if ($plaats==$personDb->pers_buried_place){
				echo '<span class="place_index place_index_selected">'.$language["lng_buried_short"].'</span>';
			}
			else{
				echo '<span class="place_index">&nbsp;</span>';
			}
		}

		echo '&nbsp;';
	}

	// *** Show person popup menu ***
	$persoon_cls = New persoon_cls;
	$persoon_cls->construct($personDb);
	$persoon_cls->person_popup_menu($personDb);

	// *** Show picture man or wife ***
	if ($personDb->pers_sexe=="M"){
		echo $dirmark1.' <img src="'.$cms['cms_path'].'images/man.gif" alt="man">';
	}
	elseif ($personDb->pers_sexe=="F"){
		echo $dirmark1.' <img src="'.$cms['cms_path'].'images/woman.gif" alt="woman">';
	}
	else {
		echo $dirmark1.' <img src="'.$cms['cms_path'].'images/unknown.gif" alt="unknown">';
	}	

	echo ' <a href="'.$start_url.'">'.$naam.$dirmark2.'</a>';

	$info="";
	if ($personDb->pers_bapt_date OR $personDb->pers_bapt_place){
		$info=', '.$language["pers_baptised"].datumplaats($personDb->pers_bapt_date, $personDb->pers_bapt_place);
	}
	if ($personDb->pers_birth_date OR $personDb->pers_birth_place){
		$info=', '.$language["pers_born"].datumplaats($personDb->pers_birth_date, $personDb->pers_birth_place);
	}

	if ($personDb->pers_death_date OR $personDb->pers_death_place){
		$info=$info.', '.$language["pers_died"].datumplaats($personDb->pers_death_date, $personDb->pers_death_place);
	}
	else{
		if ($personDb->pers_buried_date OR $personDb->pers_buried_place){
			$info=$info.', '.$language["pers_buried"].datumplaats($personDb->pers_buried_date, $personDb->pers_buried_place);
		}
	}
	if (substr($info,0,2)==', '){
	    $sp=""; if($language["dir"]=="rtl") { $sp="&nbsp;"; }
		$info=$sp." (".substr($info,2).") ";
		$info=str_replace(", ", " - ", $info);
	}

	// *** privacy filter
	if ($privacy==1){
		echo $language["privacy"];
	}
	else{
		//echo "<span style='font-size:90%'>".$info.$dirmark1."</span>";
		echo "<span style='font-size:90%'>".$info."&nbsp;".$dirmark1."</span>";
	}

	//*** Show spouse ***
	if ($lijst_uitgebreid==true){
		if ($personDb->pers_sexe=='M'){
			// Hier ook echtgeno(o)t(e) weergeven? $persoon_cls->naam($personDb)
			$gezin=mysql_query("SELECT * FROM ".$stamboom."family WHERE fam_man='".$personDb->pers_gedcomnumber."'",$db);
			@$gezinDb=mysql_fetch_object($gezin);
			if (isset($gezinDb->fam_woman) AND $gezinDb->fam_woman!='0'){
				$ouder2=mysql_query("SELECT * FROM ".$stamboom."person WHERE pers_gedcomnumber= '".$gezinDb->fam_woman."'",$db);
				@$ouder2Db=mysql_fetch_object($ouder2);
				$persoon2_cls = New persoon_cls;

				$relatie_teken=$language["fam_relation_short"];
				if ($gezinDb->fam_marr_date OR $gezinDb->fam_marr_place OR $gezinDb->fam_marr_church_date OR $gezinDb->fam_marr_church_place){
					$relatie_teken=$language["fam_marriage_short"];
				}
				if($gezinDb->fam_div_date OR $gezinDb->fam_div_place){
					$relatie_teken=$language["fam_divorse_short"];
				}
				echo ' <span class="index_partner">'.$relatie_teken.' '.$dirmark1.$persoon2_cls->naam($ouder2Db).$dirmark1.' </span>';
			}
		}
		elseif ($personDb->pers_sexe=='F'){
			// Hier ook echtgeno(o)t(e) weergeven? $persoon_cls->naam($personDb)
			$gezin=mysql_query("SELECT * FROM ".$stamboom."family WHERE fam_woman='".$personDb->pers_gedcomnumber."'",$db);
			@$gezinDb=mysql_fetch_object($gezin);
			if (isset($gezinDb->fam_man) AND $gezinDb->fam_man!='0'){
				$ouder2=mysql_query("SELECT * FROM ".$stamboom."person WHERE pers_gedcomnumber= '".$gezinDb->fam_man."'",$db);
				@$ouder2Db=mysql_fetch_object($ouder2);
				$persoon2_cls = New persoon_cls;

				$relatie_teken=$language["fam_relation_short"];
				if ($gezinDb->fam_marr_date OR $gezinDb->fam_marr_place OR $gezinDb->fam_marr_church_date OR $gezinDb->fam_marr_church_place){
					$relatie_teken=$language["fam_marriage_short"];
				}
				if($gezinDb->fam_div_date OR $gezinDb->fam_div_place){
					$relatie_teken=$language["fam_divorse_short"];
				}
				echo ' <span class="index_partner">'.$relatie_teken.' '.$dirmark1.$persoon2_cls->naam($ouder2Db).$dirmark1.'</span>';
			}
		}
	}
	// *** End spouse ***

	// *** Show name of family tree, if search in multiple family trees is used ***
	if ($zoekdatabase=='allemaal'){
		$treetext_name=database_name($stamboom, $Taalkeuze);		
		echo ' <i><font size=-1>['.$language["index_tree"].': '.$treetext_name.']</font></i>';
	}

	echo "<br>\n";

} // *** end function show person ***

$uitvoer="";
//$kop=$language["main_index"];
$kop="index";
include("header.php");

// *** index ***
$index_list='standard';

// *** Reset search fields if necessary ***
if (isset($_POST['pers_firstname']) OR isset($_GET['pers_lastname']) OR isset($_GET['reset']) ){
	// *** Nieuwe zoekaktie, reset sessie variabelen ***
	unset ($_SESSION["save_zoekdatabase"]);
	unset ($_SESSION["save_pers_firstname"]);
	unset ($_SESSION["save_zoekdeelpers_firstname"]);
	unset ($_SESSION["save_zoekdeelplaatsnaam"]);
	unset ($_SESSION["save_pers_prefix"]);
	unset ($_SESSION["save_pers_lastname"]);
	unset ($_SESSION["save_zoekdeelpers_lastname"]);
	unset ($_SESSION["save_gebplaats"]);
	unset ($_SESSION["save_zoekdeelgebplaats"]);
	unset ($_SESSION["save_ovlplaats"]);
	unset ($_SESSION["save_zoekdeelovlplaats"]);
	unset ($_SESSION["save_gebjaar"]);
	unset ($_SESSION["save_gebjaar_eind"]);
	unset ($_SESSION["save_ovljaar"]);
	unset ($_SESSION["save_ovljaar_eind"]);
	unset ($_SESSION["save_echtpers_firstname"]);
	unset ($_SESSION["save_zoekdeelechtpers_firstname"]);
	unset ($_SESSION["save_echtpers_lastname"]);
	unset ($_SESSION["save_zoekdeelechtpers_lastname"]);
	unset ($_SESSION["save_sexe"]);
	unset ($_SESSION["save_own_code"]);
	unset ($_SESSION["save_zoekdeelown_code"]);
	//unset ($_SESSION["save_quicksearch"]);
	unset ($_SESSION["save_adv_search"]);

	// *** Index places ***
	unset ($_SESSION["save_plaatsnaam"]);

	$index_list='search';
}

if (isset($_POST["index_list"])){ $index_list=veilig($_POST['index_list']);  }
if (isset($_GET["index_list"])){ $index_list=veilig($_GET['index_list']);  }

// *** Extra reset needed for "search in all family trees" ***
if ($index_list!='search'){
	unset ($_SESSION["save_zoekdatabase"]);
}

// *** Search in 1 or more family trees ***
$zoekdatabase='';
if (isset($_POST['zoekdatabase'])){
	$zoekdatabase=veilig($_POST['zoekdatabase']);
	$_SESSION["save_zoekdatabase"]=$zoekdatabase;
}
if (isset($_GET["zoekdatabase"])){
	$zoekdatabase=veilig($_GET['zoekdatabase']);
	$_SESSION["save_zoekdatabase"]=$zoekdatabase;
}

$pers_firstname='';
if (isset($_POST['pers_firstname'])){
	$pers_firstname=$_POST['pers_firstname'];
	//$pers_firstname=htmlentities($_POST['pers_firstname'],ENT_QUOTES,'UTF-8');
	$_SESSION["save_pers_firstname"]=$pers_firstname;
}
$search_partpers_firstname='';
if (isset($_POST['zoekdeelpers_firstname'])){
	$search_partpers_firstname=veilig($_POST['zoekdeelpers_firstname']);
	$_SESSION["save_zoekdeelpers_firstname"]=$search_partpers_firstname;
}

// *** Pre-fix (namenlijst en hoofdmenu veelvoorkomende namen) ***
$pers_prefix='';
if (isset($_GET['pers_prefix'])){
	$pers_prefix=$_GET['pers_prefix'];
	//$pers_prefix=htmlentities($_GET['pers_prefix'],ENT_QUOTES,'UTF-8');
	$_SESSION["save_pers_prefix"]=$pers_prefix;
}

// *** Lastname ***
$pers_lastname='';
if (isset($_POST['pers_lastname'])){
	$pers_lastname=$_POST['pers_lastname'];
	//$pers_lastname=htmlentities($_POST['pers_lastname'],ENT_QUOTES,'UTF-8');
	$_SESSION["save_pers_lastname"]=$pers_lastname;
}
if (isset($_GET["pers_lastname"])){
	$pers_lastname=$_GET['pers_lastname'];
	//$pers_lastname=htmlentities($_GET['pers_lastname'],ENT_QUOTES,'UTF-8');
	$pers_lastname=str_replace("|", "&", $pers_lastname);  //Een & teken niet meegesturen in de GET
	$_SESSION["save_pers_lastname"]=$pers_lastname;
}

$search_partpers_lastname='';
if (isset($_POST['zoekdeelpers_lastname'])){
	$search_partpers_lastname=veilig($_POST['zoekdeelpers_lastname']);
	$_SESSION["save_zoekdeelpers_lastname"]=$search_partpers_lastname;
}
// *** Voor klikken op de achternamenlijst ***
if (isset($_GET['zoekdeelpers_lastname'])){
	$search_partpers_lastname=veilig($_GET['zoekdeelpers_lastname']);
	$_SESSION["save_zoekdeelpers_lastname"]=$search_partpers_lastname;
}

// *** toevoeging Yossi Beck: UITGEBREID ZOEKEN *** //
$gebplaats='';
if (isset($_POST['gebplaats'])){
	$gebplaats=veilig($_POST['gebplaats']);
	$_SESSION["save_gebplaats"]=$gebplaats;
}
$search_partgebplaats='';
if (isset($_POST['zoekdeelgebplaats'])){
	$search_partgebplaats=veilig($_POST['zoekdeelgebplaats']);
	$_SESSION["save_zoekdeelgebplaats"]=$search_partgebplaats;
}

$ovlplaats='';
if (isset($_POST['ovlplaats'])){
	$ovlplaats=veilig($_POST['ovlplaats']);
	$_SESSION["save_ovlplaats"]=$ovlplaats;
}
$search_partovlplaats='';
if (isset($_POST['zoekdeelovlplaats'])){
	$search_partovlplaats=veilig($_POST['zoekdeelovlplaats']);
	$_SESSION["save_zoekdeelovlplaats"]=$search_partovlplaats;
}

$gebjaar='';
if (isset($_POST['gebjaar'])){
	$gebjaar=veilig($_POST['gebjaar']);
	$_SESSION["save_gebjaar"]=$gebjaar;
}
$gebjaar_eind='';
if (isset($_POST['gebjaar_eind'])){
	$gebjaar_eind=veilig($_POST['gebjaar_eind']);
	$_SESSION["save_gebjaar_eind"]=$gebjaar_eind;
}

$ovljaar='';
if (isset($_POST['ovljaar'])){
	$ovljaar=veilig($_POST['ovljaar']);
	$_SESSION["save_ovljaar"]=$ovljaar;
}
$ovljaar_eind='';
if (isset($_POST['ovljaar_eind'])){
	$ovljaar_eind=veilig($_POST['ovljaar_eind']);
	$_SESSION["save_ovljaar_eind"]=$ovljaar_eind;
}

$echtpers_firstname='';
if (isset($_POST['echtpers_firstname'])){
	$echtpers_firstname=$_POST['echtpers_firstname'];
	//$echtpers_firstname=htmlentities($_POST['echtpers_firstname'],ENT_QUOTES,'UTF-8');
	$_SESSION["save_echtpers_firstname"]=$echtpers_firstname;
}

$search_partechtpers_firstname='';
if (isset($_POST['zoekdeelechtpers_firstname'])){
	$search_partechtpers_firstname=veilig($_POST['zoekdeelechtpers_firstname']);
	$_SESSION["save_zoekdeelechtpers_firstname"]=$search_partechtpers_firstname;
}

$echtpers_lastname='';
if (isset($_POST['echtpers_lastname'])){
	$echtpers_lastname=$_POST['echtpers_lastname'];
	//$echtpers_lastname=htmlentities($_POST['echtpers_lastname'],ENT_QUOTES,'UTF-8');	
	$_SESSION["save_echtpers_lastname"]=$echtpers_lastname;
}
$search_partechtpers_lastname='';
if (isset($_POST['zoekdeelechtpers_lastname'])){
	$search_partechtpers_lastname=veilig($_POST['zoekdeelechtpers_lastname']);
	$_SESSION["save_zoekdeelechtpers_lastname"]=$search_partechtpers_lastname;
}

$sexe='';
if (isset($_POST['sexe'])){
	$sexe=veilig($_POST['sexe']);
	$_SESSION["save_sexe"]=$sexe;
}

$own_code='';
if (isset($_POST['own_code'])){
	$own_code=veilig($_POST['own_code']);
	$_SESSION["save_own_code"]=$own_code;
}
$search_partown_code='';
if (isset($_POST['zoekdeelown_code'])){
	$search_partown_code=veilig($_POST['zoekdeelown_code']);
	$_SESSION["save_zoekdeelown_code"]=$search_partown_code;
}

$quicksearch='';
if (isset($_POST['quicksearch'])){
	//$quicksearch=htmlentities($_POST['quicksearch'],ENT_QUOTES,'UTF-8');
	$quicksearch=$_POST['quicksearch'];
	$_SESSION["save_quicksearch"]=$quicksearch;
}

$adv_search=false;
if (isset($_GET['adv_search'])){
	if ($_GET['adv_search']=='1'){ $adv_search=true; }
	$_SESSION["save_adv_search"]=$adv_search;
}
if (isset($_POST['adv_search2'])){
	if ($_POST['adv_search2']=='1'){ $adv_search=true; }
	$_SESSION["save_adv_search"]=$adv_search;
}

// *** For index places ***
$plaatsnaam='';
$select_birth='0'; $select_bapt='0'; $select_place='0'; $select_death='0'; $select_buried='0';
if (isset($_POST['plaatsnaam'])){
	$plaatsnaam=$_POST['plaatsnaam'];
	//$plaatsnaam=htmlentities($_POST['plaatsnaam'],ENT_QUOTES,'UTF-8');
	$_SESSION["save_plaatsnaam"]=$plaatsnaam;

	if (isset($_POST['select_birth'])){	$select_birth='1'; $_SESSION["save_select_birth"]='1'; }
		else{ $_SESSION["save_select_birth"]='0'; }
	if (isset($_POST['select_bapt'])){ $select_bapt='1'; $_SESSION["save_select_bapt"]='1'; }
		else{ $_SESSION["save_select_bapt"]='0'; } 
	if (isset($_POST['select_place'])){ $select_place='1'; $_SESSION["save_select_place"]='1'; }
		else{ $_SESSION["save_select_place"]='0'; } 
	if (isset($_POST['select_death'])){ $select_death='1'; $_SESSION["save_select_death"]='1'; }
		else{ $_SESSION["save_select_death"]='0'; } 
	if (isset($_POST['select_buried'])){ $select_buried='1'; $_SESSION["save_select_buried"]='1'; }
		else{ $_SESSION["save_select_buried"]='0'; } 
}
$search_partplaatsnaam='';
if (isset($_POST['zoekdeelplaatsnaam'])){
	$search_partplaatsnaam=veilig($_POST['zoekdeelplaatsnaam']);
	$_SESSION["save_zoekdeelplaatsnaam"]=$search_partplaatsnaam;
}

// *** Read session for multiple pages ***
if (isset($_GET['item'])){
	if (isset($_SESSION["save_zoekdatabase"])){ $zoekdatabase=$_SESSION["save_zoekdatabase"]; }
	if (isset($_SESSION["save_pers_firstname"])){ $pers_firstname=$_SESSION["save_pers_firstname"]; }
	if (isset($_SESSION["save_zoekdeelpers_firstname"])){
		$search_partpers_firstname=$_SESSION["save_zoekdeelpers_firstname"]; }
	if (isset($_SESSION["save_pers_prefix"])){ $pers_prefix=$_SESSION["save_pers_prefix"]; }
	if (isset($_SESSION["save_pers_lastname"])){ $pers_lastname=$_SESSION["save_pers_lastname"]; }
	if (isset($_SESSION["save_zoekdeelpers_lastname"])){
		$search_partpers_lastname=$_SESSION["save_zoekdeelpers_lastname"]; }
	if (isset($_SESSION["save_gebplaats"])){ $gebplaats=$_SESSION["save_gebplaats"]; }
	if (isset($_SESSION["save_zoekdeelgebplaats"])){
		$search_partgebplaats=$_SESSION["save_zoekdeelgebplaats"]; }
	if (isset($_SESSION["save_ovlplaats"])){ $ovlplaats=$_SESSION["save_ovlplaats"]; }
	if (isset($_SESSION["save_zoekdeelovlplaats"])){
		$search_partovlplaats=$_SESSION["save_zoekdeelovlplaats"]; }
	if (isset($_SESSION["save_gebjaar"])){ $gebjaar=$_SESSION["save_gebjaar"]; }
	if (isset($_SESSION["save_gebjaar_eind"])){ $gebjaar_eind=$_SESSION["save_gebjaar_eind"]; }
	if (isset($_SESSION["save_ovljaar"])){ $ovljaar=$_SESSION["save_ovljaar"]; }
	if (isset($_SESSION["save_ovljaar_eind"])){ $ovljaar_eind=$_SESSION["save_ovljaar_eind"]; }
	if (isset($_SESSION["save_echtpers_firstname"])){ $echtpers_firstname=$_SESSION["save_echtpers_firstname"]; }
	if (isset($_SESSION["save_zoekdeelechtpers_firstname"])){
		$search_partechtpers_firstname=$_SESSION["save_zoekdeelechtpers_firstname"]; }
	if (isset($_SESSION["save_echtpers_lastname"])){ $echtpers_lastname=$_SESSION["save_echtpers_lastname"]; }
	if (isset($_SESSION["save_zoekdeelechtpers_lastname"])){
		$search_partechtpers_lastname=$_SESSION["save_zoekdeelechtpers_lastname"]; }
	if (isset($_SESSION["save_sexe"])){ $sexe=$_SESSION["save_sexe"]; }
	if (isset($_SESSION["save_own_code"])){ $own_code=$_SESSION["save_own_code"]; }
	if (isset($_SESSION["save_zoekdeelown_code"])){ $search_partown_code=$_SESSION["save_zoekdeelown_code"]; }
	if (isset($_SESSION["save_quicksearch"])){ $quicksearch=$_SESSION["save_quicksearch"]; }

	if (isset($_SESSION["save_adv_search"])){ $adv_search=$_SESSION["save_adv_search"]; }
}

// *** Search for places in birth-baptise-died places etc. ***
//if ($index_list=='birthplaces' OR $index_list=='places' OR $index_list=='deathplaces'){
if ($index_list=='places'){
	if (isset($_SESSION["save_plaatsnaam"])){ $plaatsnaam=$_SESSION["save_plaatsnaam"]; }
	if (isset($_SESSION["save_zoekdeelplaatsnaam"])){ $search_partplaatsnaam=$_SESSION["save_zoekdeelplaatsnaam"]; }

	// *** Enable select boxes ***
	if (isset($_GET['reset'])){
		$select_birth='1'; $_SESSION["save_select_birth"]='1';
		$select_bapt='1'; $_SESSION["save_select_bapt"]='1';
		$select_place='1'; $_SESSION["save_select_place"]='1';
		$select_death='1'; $_SESSION["save_select_death"]='1';
		$select_buried='1'; $_SESSION["save_select_buried"]='1';
	}
	else{
		// *** Read and set select boxes for multiple pages ***
		if (isset($_SESSION["save_select_birth"])){ $select_birth=$_SESSION["save_select_birth"]; } 
		if (isset($_SESSION["save_select_bapt"])){ $select_bapt=$_SESSION["save_select_bapt"]; } 
		if (isset($_SESSION["save_select_place"])){ $select_place=$_SESSION["save_select_place"]; } 
		if (isset($_SESSION["save_select_death"])){ $select_death=$_SESSION["save_select_death"]; }
		if (isset($_SESSION["save_select_buried"])){ $select_buried=$_SESSION["save_select_buried"]; } 
	}
}

// *** Search for (part of) first or lastname ***
function naamqry($naam, $search_part){
	$tekst="LIKE '%$naam%'"; // *** Default waarde: "bevat" ***
	if ($search_part=='gelijk'){ $tekst="='$naam'"; }
	if ($search_part=='begint'){ $tekst="LIKE '$naam%'"; }
	return $tekst;
}

// *******************
// *** BUILD QUIRY ***
// *******************
$querie='';

//*** Namen zoeken die voldoen aan ingevulde zoekveld in hoofdmenu ***
//*** Of klikken op meest voorkomende pers_lastname ***
//if ($pers_firstname OR $pers_lastname OR $gebplaats OR $ovlplaats OR $gebjaar OR $ovljaar OR $sexe){
if ($pers_firstname OR $pers_lastname OR $gebplaats OR $ovlplaats OR $gebjaar OR $ovljaar OR ($sexe AND $sexe!='both') OR $own_code){

	// *** Querie opbouwen ***
	$and=" ";  // aangezien ieder veld de eerste kan zijn wordt $and pas AND als er al een veld is gebruikt

	if ($pers_lastname) {
		if ($pers_lastname==$language["pers_unknown_lastname"]){
			$querie.=" pers_lastname=''"; $and=" AND ";
		}
		elseif ($user['soortindex']=="j"){
			$querie.=" CONCAT( REPLACE(pers_prefix,'_',' ') ,pers_lastname) ".
			naamqry($pers_lastname, $search_partpers_lastname); $and=" AND ";
		}
		else {
			$querie.=" pers_lastname ".naamqry($pers_lastname, $search_partpers_lastname); $and=" AND ";
		}
	}
	// *** Voor de namenlijst, personen zonder pers_prefix kunnen zoeken ***
	if ($pers_prefix=='LEEG'){
		$querie.=$and."pers_prefix=''"; $and=" AND ";
	}
	elseif ($pers_prefix){
		$querie.=$and."pers_prefix='".$pers_prefix."'"; $and=" AND ";
	}

	if ($pers_firstname){
		$querie.=$and."pers_firstname ".naamqry($pers_firstname, $search_partpers_firstname); $and=" AND ";
	}

	if ($gebplaats){
		$querie.=$and."pers_birth_place ".naamqry($gebplaats, $search_partgebplaats); $and=" AND ";
	}

	if ($ovlplaats){
		$querie.=$and."pers_death_place ".naamqry($ovlplaats, $search_partovlplaats); $and=" AND ";
	}

	if ($gebjaar AND !$gebjaar_eind){   // maar een jaartal ingevuld: exacte datum
		$querie.=$and."pers_birth_date LIKE '%$gebjaar%'"; $and=" AND ";
	}

	if ($gebjaar AND $gebjaar_eind){     // twee jaartallen ingevuld: periode
		$querie.=$and."RIGHT(pers_birth_date, 4)>='".$gebjaar."' AND RIGHT(pers_birth_date, 4)<='".$gebjaar_eind."'"; $and=" AND ";
	}

	if ($ovljaar AND !$ovljaar_eind){      // maar een jaartal ingevuld: exacte datum
		$querie.=$and."pers_death_date LIKE '%$ovljaar%'"; $and=" AND ";
	}

	if ($ovljaar AND $ovljaar_eind){     // twee jaartallen ingevuld: periode
		$querie.=$and."RIGHT(pers_death_date, 4)>='".$ovljaar."' AND RIGHT(pers_death_date, 4)<='".$ovljaar_eind."'"; $and=" AND ";
	}

	if ($sexe=="M" OR $sexe=="F"){
		$querie.=$and."pers_sexe='".$sexe."'"; $and=" AND ";
	}
	if ($sexe=="Unknown"){
		//$querie.=$and."sexe=''"; $and=" AND ";
		$querie.=$and."(pers_sexe!='M' AND pers_sexe!='F')"; $and=" AND ";
	}

	if ($own_code){
		$querie.=$and."pers_own_code ".naamqry($own_code, $search_partown_code); $and=" AND ";
	}

	// *** Bij zoeken naar echtgenoot querie aanpassen ***
	if($echtpers_firstname OR $echtpers_lastname) {
		$querie.=$and."pers_fams!=''"; $and=" AND ";
	}

	// *** Build SELECT part of query. "allemaal" = Search in ALL family trees ***
	if ($zoekdatabase=='allemaal') {
		$querie_deel=$querie;
		$querie='';
		$teller=0;
		$datasql = mysql_query("SELECT * FROM humo_trees
			WHERE tree_prefix!='LEEG' ORDER BY tree_order",$db);
		while (@$dataDb=mysql_fetch_object($datasql)){

			// *** Check is family tree is showed or hidden for user group ***
			$hide_tree_array=explode(";",$user['group_hide_trees']);
			$hide_tree=false;
			for ($x=0; $x<=count($hide_tree_array)-1; $x++){
				if ($hide_tree_array[$x]==$dataDb->tree_id){ $hide_tree=true; }
			}
			if ($hide_tree==false){	

				$teller++;
				$tree_prefix=$dataDb->tree_prefix;
				// *** EXAMPLE ***
				//$persoon_qry = "(SELECT * FROM humo1_persoon ".$querie.') ';
				//$persoon_qry.= " UNION (SELECT * FROM humo2_persoon ".$querie.')';
				//$persoon_qry.= " UNION (SELECT * FROM humo3_persoon ".$querie.')';
				//$persoon_qry.= " ORDER BY pers_lastname, pers_firstname";
				$union=''; if ($teller>1){ $union=' UNION '; }
				if ($user['soortindex']=="j"){
					$querie.=$union.'(SELECT *, CONCAT(pers_prefix,pers_lastname,pers_firstname) as totaalnaam
					FROM '.$tree_prefix.'person WHERE'.$querie_deel.')';
				}
				else{
					$querie.=$union.'(SELECT * FROM '.$tree_prefix.'person WHERE'.$querie_deel.')';
				}

			}

		}
	}
	else{
		// *** Zoeken in 1 database, begin van querie maken ***
		$querie_select = "SELECT * FROM ".veilig($_SESSION['tree_prefix'])."person WHERE";
		if ($user['soortindex']=="j"){
			$querie_select= "SELECT *, CONCAT(pers_prefix,pers_lastname,pers_firstname) as totaalnaam
			FROM ".veilig($_SESSION['tree_prefix'])."person WHERE";
		}
		$querie=$querie_select.$querie;
	}

	// *** Uitvoer sorteren ***
	if ($user['soortindex']=="j"){
		$querie.=" ORDER BY totaalnaam";
	}
	else {
		$querie.=" ORDER BY pers_lastname, pers_firstname";
	}

}

// *** Menu quicksearch ***
if ($index_list=='quicksearch'){
	$quicksearch=str_replace(" ", "%", $quicksearch);
	$querie_select= "SELECT *, CONCAT(pers_firstname,pers_prefix,pers_lastname) as totaalnaam
	FROM ".veilig($_SESSION['tree_prefix'])."person
	WHERE CONCAT(pers_firstname,REPLACE(pers_prefix,'_',' '),pers_lastname) LIKE '%$quicksearch%'";
	$querie=$querie_select;

	// *** Uitvoer sorteren ***
	if ($user['soortindex']=="j"){
		$querie.=" ORDER BY totaalnaam";
	}
	else {
		$querie.=" ORDER BY pers_lastname, pers_firstname";
	}
}

//*** Places index ***
if ($index_list=='places'){
	// *** EXAMPLE of a UNION querie ***
	//$persoon_qry = "(SELECT * FROM humo1_persoon ".$querie.') ';
	//$persoon_qry.= " UNION (SELECT * FROM humo2_persoon ".$querie.')';
	//$persoon_qry.= " UNION (SELECT * FROM humo3_persoon ".$querie.')';
	//$persoon_qry.= " ORDER BY pers_lastname, pers_firstname";

	$querie='';
	$start=false;

	// *** Search birth place ***
	if ($select_birth=='1'){
		if ($user['soortindex']=="j"){
			$querie = "(SELECT *,
				CONCAT(pers_prefix,pers_lastname,pers_firstname) as totaalnaam,
				pers_birth_place as place_order
			FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		else{
			$querie = "(SELECT *, pers_birth_place as place_order FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		if($plaatsnaam) {
			$querie.= " WHERE pers_birth_place ".naamqry($plaatsnaam,$search_partplaatsnaam);
		}
		else {
			$querie.= " WHERE pers_birth_place LIKE '_%'";
		}
		$querie.=')';
		$start=true;
	}

	// *** Search baptise place ***
	if ($select_bapt=='1'){
		if ($start==true){ $querie.=' UNION '; }
		if ($user['soortindex']=="j"){
			$querie.= "(SELECT *,
				CONCAT(pers_prefix,pers_lastname,pers_firstname) as totaalnaam,
				pers_bapt_place as place_order
			FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		else{
			$querie.= "(SELECT *, pers_bapt_place as place_order FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		if($plaatsnaam) {
			$querie.= " WHERE pers_bapt_place ".naamqry($plaatsnaam,$search_partplaatsnaam);
		}
		else {
			$querie.= " WHERE pers_bapt_place LIKE '_%'";
		}
		$querie.=')';
		$start=true;
	}
	
	// *** Search residence ***
	if ($select_place=='1'){
		if ($start==true){ $querie.=' UNION '; }
		if ($user['soortindex']=="j"){
			$querie.= "(SELECT *,
				CONCAT(pers_prefix,pers_lastname,pers_firstname) as totaalnaam,
				pers_place_index as place_order
			FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		else{
			$querie.= "(SELECT *, pers_place_index as place_order FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		if($plaatsnaam) {
			$querie.= " WHERE pers_place_index ".naamqry($plaatsnaam,$search_partplaatsnaam);
		}
		else {
			$querie .= " WHERE pers_place_index LIKE '_%'";
		}
		$querie.=')';
		$start=true;
	}
	
	// *** Search death place ***
	if ($select_death=='1'){
		if ($start==true){ $querie.=' UNION '; }
		if ($user['soortindex']=="j"){
			$querie.= "(SELECT *,
				CONCAT(pers_prefix,pers_lastname,pers_firstname) as totaalnaam,
				pers_death_place as place_order
			FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		else{
			$querie.= "(SELECT *, pers_death_place as place_order FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		if($plaatsnaam) {
			$querie.= " WHERE pers_death_place ".naamqry($plaatsnaam,$search_partplaatsnaam);
		}
		else {
			$querie.= " WHERE pers_death_place LIKE '_%'";
		}
		$querie.=')';
		$start=true;
	}
	
	// *** Search buried place ***
	if ($select_buried=='1'){
		if ($start==true){ $querie.=' UNION '; }
		if ($user['soortindex']=="j"){
			$querie.= "(SELECT *,
				CONCAT(pers_prefix,pers_lastname,pers_firstname) as totaalnaam,
				pers_buried_place as place_order
			FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		else{
			$querie.= "(SELECT *, pers_buried_place as place_order FROM ".veilig($_SESSION['tree_prefix'])."person";
		}
		if($plaatsnaam) {
			$querie.= " WHERE pers_buried_place ".naamqry($plaatsnaam,$search_partplaatsnaam);
		}
		else {
			$querie.= " WHERE pers_buried_place LIKE '_%'";
		}
		$querie.=')';
		$start=true;
	}
	
	// *** Order by place and name: "Mons, van" or: "van Mons" ***
	if ($user['soortindex']=="j"){
		$querie.=' ORDER BY place_order, totaalnaam';
	}
	else{
		$querie.=' ORDER BY place_order, pers_lastname, pers_firstname';
	}

}

//*** Patroniemen lijst ***
if ($index_list=='patronym'){
	//ALLEEN in pers_patronymen index als er GEEN pers_lastname is!!!
	$querie = "SELECT * FROM ".veilig($_SESSION['tree_prefix'])."person
	WHERE pers_patronym LIKE '_%' AND pers_lastname='' ORDER BY pers_patronym, pers_firstname";
}

// **************************
// *** Generate indexlist ***
// **************************

	// *** Standard index ***
	//if ($querie==''){
	if ($querie=='' OR $index_list=='standard'){
		$querie = "SELECT * FROM ".veilig($_SESSION['tree_prefix'])."person ORDER BY pers_lastname, pers_firstname";
		// Mons, van of: van Mons
		if ($user['soortindex']=="j"){
			$querie= "SELECT *, CONCAT(pers_prefix,pers_lastname,pers_firstname) as totaalnaam
				FROM ".veilig($_SESSION['tree_prefix'])."person ORDER BY totaalnaam";
		}
	}

	include("menu.php");

	//*** Show number of persons and pages *****************************************
	$item=0; if (isset($_GET['item'])){ $item=$_GET['item']; }
	$start=0; if (isset($_GET["start"])){ $start=$_GET["start"]; }
	$aantal_personen=$humo_option['personen_weergeven'];

	// *** Total number of persons ***
	$persoon2=mysql_query($querie,$db);
	$persoon=mysql_query($querie." LIMIT ".veilig($item).",".$aantal_personen,$db);

	if ($index_list=='places'){

		echo '<div class="index_lijst1">';

			//************** search places **************************************
			print ' <form method="post" action="lijst.php" style="display : inline;">';

				echo $language["index_place"].' ';

				$checked=''; if ($select_birth=='1'){$checked='checked';}
				print '<input type="Checkbox" name="select_birth" value="1" '.$checked.'> '.$language["lng_birth_short"].' '.$language["index_place_birth"];

				$checked=''; if ($select_bapt=='1'){$checked='checked';}
				print ' <input type="Checkbox" name="select_bapt" value="1" '.$checked.'> '.$language["lng_bapt_short"].' '.$language["index_place_bapt"];

				$checked=''; if ($select_place=='1'){$checked='checked';}
				print ' <input type="Checkbox" name="select_place" value="1" '.$checked.'> '.$language["lng_residence_short"].' '.$language["index_place_residence"];

				$checked=''; if ($select_death=='1'){$checked='checked';}
				print '<input type="Checkbox" name="select_death" value="1" '.$checked.'> '.$language["lng_death_short"].' '.$language["index_place_death"];

				$checked=''; if ($select_buried=='1'){$checked='checked';}
				print '<input type="Checkbox" name="select_buried" value="1" '.$checked.'> '.$language["lng_buried_short"].' '.$language["index_place_buried"];

			print ' <select name="zoekdeelplaatsnaam">';
			echo '<option value="bevat">'.$language["main_contains"].'</option>';
			$selecteer=''; if ($search_partplaatsnaam=='gelijk'){ $selecteer=' selected'; }
			echo '<option value="gelijk"'.$selecteer.'>'.$language["main_equals"].'</option>';
			$selecteer=''; if ($search_partplaatsnaam=='begint'){ $selecteer=' selected'; }
			echo '<option value="begint"'.$selecteer.'>'.$language["main_starts_with"].'</option>';
			print '</select>';
			print ' <input type="text" name="plaatsnaam" value="'.$plaatsnaam.'" size="17">';
			print ' <input type="hidden" name="index_list" value="'.$index_list.'">';
			print ' <input type="submit" value="'.$language["main_search"].'" name="B1">';
			print ' </form>';
		//***************** end search of places **********************************

		echo '</div>';
	}

	// *** Search fields ***
	if ($index_list=='standard' OR $index_list=='search' OR $index_list=='quicksearch'){

		//	// *** UITGEBREID ZOEKVAK ***
		//	print '<td width="800px">';

				print '<form method="post" action="lijst.php" style="display : inline;">';
				echo '<table align="center" class="humo rand" width="750">';

				echo '<tr>';
				echo '<td align="right" class="geenrand" >'.$language["main_firstname"].':';
				print ' <select size="1" name="zoekdeelpers_firstname">';
				echo '<option value="bevat">'.$language["main_contains"].'</option>';
				$selecteer=''; if ($search_partpers_firstname=='gelijk'){ $selecteer=' selected'; }
				echo '<option value="gelijk"'.$selecteer.'>'.$language["main_equals"].'</option>';
				$selecteer=''; if ($search_partpers_firstname=='begint'){ $selecteer=' selected'; }
				echo '<option value="begint"'.$selecteer.'>'.$language["main_starts_with"].'</option>';
				print '</select>';
				print ' <input type="text" name="pers_firstname" value="'.$pers_firstname.'" size="17"></td>';

				echo '<td align="right" class="geenrand">';
				print $language["main_lastname"].':';
				print ' <select size="1" name="zoekdeelpers_lastname">';
				echo '<option value="bevat">'.$language["main_contains"].'</option>';
				$selecteer=''; if ($search_partpers_lastname=='gelijk'){ $selecteer=' selected'; }
				echo '<option value="gelijk"'.$selecteer.'>'.$language["main_equals"].'</option>';
				$selecteer=''; if ($search_partpers_lastname=='begint'){ $selecteer=' selected'; }
				echo '<option value="begint"'.$selecteer.'>'.$language["main_starts_with"].'</option>';
				print '</select>';
				print ' <input type="text" name="pers_lastname" value="'.$pers_lastname.'" size="17"></td></tr>';

				if ($adv_search==true){

					echo '<tr><td align="right" class="geenrand">';
					print $language["search_adv_birthyear"];
					print '<input type="text" name="gebjaar" value="'.$gebjaar.'" size="4">';
					print '&nbsp;&nbsp;('.$language["search_till"].'&nbsp;';
					print '<input type="text" name="gebjaar_eind" value="'.$gebjaar_eind.'" size="4">&nbsp;)</td>';

					echo '<td align="right" class="geenrand">';
					print $language["search_adv_birthplace"];
					print ' <select size="1" name="zoekdeelgebplaats">';
					echo '<option value="bevat">'.$language["main_contains"].'</option>';
					$selecteer=''; if ($search_partgebplaats=='gelijk'){ $selecteer=' selected'; }
					echo '<option value="gelijk"'.$selecteer.'>'.$language["main_equals"].'</option>';
					$selecteer=''; if ($search_partgebplaats=='begint'){ $selecteer=' selected'; }
					echo '<option value="begint"'.$selecteer.'>'.$language["main_starts_with"].'</option>';
					print '</select>';
					echo ' <input type="text" name="gebplaats" value="'.$gebplaats.'" size="17"></td></tr>';

					echo '<tr><td align="right" class="geenrand">';
					print $language["search_adv_deathyear"];
					echo '<input type="text" name="ovljaar" value="'.$ovljaar.'" size="4">';
					print '&nbsp;&nbsp;('.$language["search_till"].'&nbsp;';
					print '<input type="text" name="ovljaar_eind" value="'.$ovljaar_eind.'" size="4">&nbsp;)</td>';

					echo '<td align="right" class="geenrand">';
					print $language["search_adv_deathplace"];
					print ' <select size="1" name="zoekdeelovlplaats">';
					echo '<option value="bevat">'.$language["main_contains"].'</option>';
					$selecteer=''; if ($search_partovlplaats=='gelijk'){ $selecteer=' selected'; }
					echo '<option value="gelijk"'.$selecteer.'>'.$language["main_equals"].'</option>';
					$selecteer=''; if ($search_partovlplaats=='begint'){ $selecteer=' selected'; }
					echo '<option value="begint"'.$selecteer.'>'.$language["main_starts_with"].'</option>';
					print '</select>';
					echo ' <input type="text" name="ovlplaats" value="'.$ovlplaats.'" size="17"></td></tr>';

					echo '<tr><td align="right" class="geenrand">';
					print $language["search_sexe"];
					$check=''; if ($sexe=='both'){ $check=' checked'; }
					print '<input type="radio" name="sexe" value="both"'.$check.'>'.$language["search_both"].'&nbsp;&nbsp;';
					$check=''; if ($sexe=='M'){ $check=' checked'; }
					print '<input type="radio" name="sexe" value="M"'.$check.'>'.$language["search_man"].'&nbsp;&nbsp;';
					$check=''; if ($sexe=='F'){ $check=' checked'; }
					print '<input type="radio" name="sexe" value="F"'.$check.'>'.$language["search_woman"].'&nbsp;&nbsp;';
					$check=''; if ($sexe=='Unknown'){ $check=' checked'; }
					print '<input type="radio" name="sexe" value="Unknown"'.$check.'>'.$language["search_unknown"];
					echo '</td>';

					echo '<td align="right" class="geenrand">';
					print $language["source_own_code"];
					print ' <select size="1" name="zoekdeelown_code">';
					echo '<option value="bevat">'.$language["main_contains"].'</option>';
					$selecteer=''; if ($search_partown_code=='gelijk'){ $selecteer=' selected'; }
					echo '<option value="gelijk"'.$selecteer.'>'.$language["main_equals"].'</option>';
					$selecteer=''; if ($search_partown_code=='begint'){ $selecteer=' selected'; }
					echo '<option value="begint"'.$selecteer.'>'.$language["main_starts_with"].'</option>';
					print '</select>';
					echo ' <input type="text" name="own_code" value="'.$own_code.'" size="17">';
					echo '</td></tr>';

					echo '<tr><td align="right" class="geenrand">';
					echo $language["search_adv_partner_firstname"];
					print ' <select size="1" name="zoekdeelechtpers_firstname">';
					echo '<option value="bevat">'.$language["main_contains"].'</option>';
					$selecteer=''; if ($search_partechtpers_firstname=='gelijk'){ $selecteer=' selected'; }
					echo '<option value="gelijk"'.$selecteer.'>'.$language["main_equals"].'</option>';
					$selecteer=''; if ($search_partechtpers_firstname=='begint'){ $selecteer=' selected'; }
					echo '<option value="begint"'.$selecteer.'>'.$language["main_starts_with"].'</option>';
					print '</select>';
					echo ' <input type="text" name="echtpers_firstname" value="'.$echtpers_firstname.'" size="17"></td>';

					echo '<td align="right" class="geenrand">';
					echo $language["search_adv_partner_lastname"];
					print ' <select size="1" name="zoekdeelechtpers_lastname">';
					echo '<option value="bevat">'.$language["main_contains"].'</option>';
					$selecteer=''; if ($search_partechtpers_lastname=='gelijk'){ $selecteer=' selected'; }
					echo '<option value="gelijk"'.$selecteer.'>'.$language["main_equals"].'</option>';
					$selecteer=''; if ($search_partechtpers_lastname=='begint'){ $selecteer=' selected'; }
					echo '<option value="begint"'.$selecteer.'>'.$language["main_starts_with"].'</option>';
					print '</select>';
					echo ' <input type="text" name="echtpers_lastname" value="'.$echtpers_lastname.'" size="17"></td></tr>';

				}	// *** End of advanced search fields ***

				// Kijken of er meerdere stambomen in de tabel staan.
				print '<tr><td colspan="2" class="geenrand centreren">';
				$datasql2 = mysql_query("SELECT * FROM humo_trees",$db);
				$num_rows2 = mysql_num_rows($datasql2);
				if ($num_rows2>1){
					$checked=''; if ($zoekdatabase=="geselecteerd"){ $checked='CHECKED'; }

					// if ($adv_search==true){ echo '<br>'; }

					print '<INPUT TYPE="RADIO" NAME="zoekdatabase" value="geselecteerd" '.$checked.'> '.
						$language["main_selected_family_tree"];
					$checked=''; if ($zoekdatabase=="allemaal"){ $checked='CHECKED'; }
					print '<INPUT TYPE="RADIO" NAME="zoekdatabase" value="allemaal" '.$checked.'> '.$language["main_all_family_trees"];
				}

				print '&nbsp;&nbsp; <input type="submit" value="'.$language["main_search"].'" name="B1">';

				if ($adv_search==true){
					print '&nbsp;<a href="lijst.php?adv_search=0">'.$language["search_standard"].'</a>';
					echo '<input type="hidden" name="adv_search2" value="1">';

					//======== HELP POPUP ========================
					echo '<div class="weergave '.$rtlmarker.'sddm" style="display: inline;">';
					echo ' <a href="#"';
					echo ' style="display:inline" ';
					echo 'onmouseover="mopen(event,\'hulpmenu\',10,150)"';
					echo 'onmouseout="mclosetime()">';
					echo '&nbsp;&nbsp;&nbsp;<strong>'.$language["main_help"].'</strong>';
					echo '</a>';
					echo '<div class="sddm_fixed" style="z-index:40; text-align:'.$alignmarker.'; padding:4px; direction:'.$rtlmarker.'" id="hulpmenu" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">';
						echo '<table border="0" width="98%" class="humo rand centreren"><tr>';
						echo '<td width="50">'.$language["search_tip"].'</td>';
						echo '<td>'.$language["search_adv_tip1"].'&nbsp;';
						echo $language["search_adv_tip2"].'</td></tr>';
						echo '<tr><td>'.$language["search_note"].'</td>';
						echo '<td>'.$language["search_adv_note1"];
						echo '<br>&nbsp;&nbsp;'.$language["search_adv_note2"];
						echo '<br>&nbsp;&nbsp;'.$language["search_adv_note3"];
						echo '<br>'.$language["search_adv_note4"];
						echo '</td></tr></table>';
					echo '</div>';
					echo '</div><br>';
					//=================================

				}
				else{
					print '&nbsp;<a href="lijst.php?adv_search=1">'.$language["search_advanced"].'</a><br>';
				}

				print '</td></tr></table></form>';

			//echo '</td></tr>';
			//print '</table>';
	}

	if (@mysql_num_rows($persoon)==0) {
		echo '<div class="centreren">'.$language["main_no_names_found"].'</div>';
	}

	$bladzijderegel=$language["main_page"];

	// "<="
	if ($start>1){
		$start2=$start-20;
		$berekend=($start-2)*$aantal_personen;
		$bladzijderegel.= ' <a href="'.$uri_pad.
		"lijst.php?index_list=".$index_list.
		"&amp;start=".$start2.
		"&amp;item=".$berekend.
		'">&lt;= </a>';
	}
	if ($start<=0){$start=1;}

	// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
	for ($i=$start; $i<=$start+19; $i++) {
		$berekend=($i-1)*$aantal_personen;
		if ($berekend<@mysql_num_rows($persoon2)){
			if ($item==$berekend){
				$bladzijderegel.=  " <b>$i</b>";
			}
			else {
				$bladzijderegel.= ' <a href="'.$uri_pad.
				"lijst.php?index_list=".$index_list.
				"&amp;start=".$start.
				"&amp;item=".$berekend.
				'"> '.$i.'</a>';
			}
		}
	}

	// "=>"
	$berekend=($i-1)*$aantal_personen;
	if ($berekend<@mysql_num_rows($persoon2)){
		$bladzijderegel.= ' <a href="'.$uri_pad.
		"lijst.php?index_list=".$index_list.
		"&amp;start=".$i.
		"&amp;item=".$berekend.
		'"> =&gt;</a>';
	}

	echo '<div class="index_lijst1">';

	// *** Code niet uitvoeren bij zoeken met echtgenoot ***
	if(!$echtpers_firstname AND !$echtpers_lastname) {
		echo @mysql_num_rows($persoon2).$language["main_nr_persons_found"];
	}

	// *** Compacte of uitgebreide weergave ***
	if (isset($_POST['lijst_uitgebreid'])){
		if ($_POST['lijst_uitgebreid']=='0'){
			$_SESSION['save_lijst_uitgebreid']='0';
		}
		else{
			$_SESSION['save_lijst_uitgebreid']='1';
		}
	}
	$lijst_uitgebreid=false;
	if (isset($_SESSION['save_lijst_uitgebreid']) AND $_SESSION['save_lijst_uitgebreid']=='1'){
		$lijst_uitgebreid=true;
	}
	// *** Knop uitgebreid of verkort weergeven ***
	$knopregel= "?item=".$item;
	if (isset($_GET['start'])){
		$knopregel.= "&amp;start=".$_GET['start'];
	}
	else{
		$knopregel.= "&amp;start=1";
	}
	$knopregel.=  "&amp;index_list=".$index_list;
	print ' <form method="POST" action="'.$uri_pad.'lijst.php'.$knopregel.'" style="display : inline;">';

	if ($lijst_uitgebreid==true){
		print '<input type="hidden" name="lijst_uitgebreid" value="0">';
		print '<input type="Submit" name="submit" value="'.$language["main_concise_view"].'">';
	}
	else{
		print '<input type="hidden" name="lijst_uitgebreid" value="1">';
		print '<input type="Submit" name="submit" value="'.$language["main_expanded_view"].'">';
	}
	print '</form>';

	// *** Code niet uitvoeren bij zoeken met echtgenoot ***
	if(!$echtpers_firstname AND !$echtpers_lastname) {
		echo '<br>'.$bladzijderegel;
	}

	//print "</p>\n";

	$dir="";
	if($language["dir"]=="rtl") {
		$dir="rtl"; // loads the proper CSS for rtl display (rtlindex_lijst2):
	}

	echo '<div class="'.$dir.'index_lijst2">';

	//*** Weergeven van personen ******************************************************************
	$privcount=0; //bijhouden hoeveel gevonden personen niet worden weergegeven om privacy redenen (gezocht met geboorte/ovl gegevens)

	$plaats="";

	// *** Zoeken zonder limiet bij zoeken met echtgenoot ***
	if(!$echtpers_firstname AND !$echtpers_lastname) {
		$zoek=$persoon;
	}
	else{
		$zoek=$persoon2;
	}

	while (@$personDb=mysql_fetch_object($zoek)){
		$echtgenoot_gevonden='1';

		// *** Zoeken op naam echtgenote ***
		if($echtpers_firstname OR $echtpers_lastname) {
			$echtgenoot_gevonden='0';
			$persoonfams=explode(";",$personDb->pers_fams);

			// *** Zoek alle personen met relatie gegevens IN dezelfde stamboom als de 1e persoon ***
			$echtquerie = "SELECT * FROM ".veilig($personDb->pers_tree_prefix)."person WHERE";
			if ($user['soortindex']=="j"){
				$echtquerie= "SELECT *, CONCAT(pers_prefix,pers_lastname,pers_firstname) as totaalnaam
					FROM ".veilig($personDb->pers_tree_prefix)."person WHERE";
			}
			$echtquerie.=" pers_id!=$personDb->pers_id AND pers_fams!=''";
			if ($echtpers_lastname) {
				if ($echtpers_lastname==$language["pers_unknown_lastname"]){
					$echtquerie.=" AND pers_lastname=''";
				}
				elseif ($user['soortindex']=="j"){
					$echtquerie.=" AND CONCAT( REPLACE(pers_prefix,'_',' ') ,pers_lastname) ".naamqry($echtpers_lastname, $search_partechtpers_lastname);
				}
				else {
					$echtquerie.=" AND pers_lastname ".naamqry($echtpers_lastname, $search_partechtpers_lastname);
				}
			}
			//if ($pers_prefix){
			//  $echtquerie.=" AND pers_prefix='".$pers_prefix."'";
			//}
			if ($echtpers_firstname){
				$echtquerie.=" AND pers_firstname ".naamqry($echtpers_firstname, $search_partechtpers_firstname);
			}

			$echtstamboom_result=mysql_query($echtquerie,$db);
			while($echtstamboomDb=mysql_fetch_object($echtstamboom_result)){
				//CONTROLEER of de beide personen een relatie hebben
				$echtgenootfams=explode(";",$echtstamboomDb->pers_fams);
				for($echthuw=0;$echthuw<count($echtgenootfams);$echthuw++) {
					for ($huwelijk=0; $huwelijk<count($persoonfams); $huwelijk++){
						if($persoonfams[$huwelijk]==$echtgenootfams[$echthuw]){
							$echtgenoot_gevonden='1'; break;
						}
					}
					if ($echtgenoot_gevonden=='1'){ break; }
				}
				if ($echtgenoot_gevonden=='1'){ break; }
			}

		}  // EINDE zoeken met echtgenoot

		// *** Show search results ***
		if ($echtgenoot_gevonden=='1'){
			// yossi toevoeging
			$persoon_cls = New persoon_cls;
			$persoon_cls->construct($personDb);
			$privacy=$persoon_cls->privacy;
			if($privacy==1) { // dit is een persoon met privacy beperkingen
				if($gebplaats=='' AND $gebjaar=='' AND $ovlplaats=='' AND $ovljaar=='') {
					// er is niet gezocht met geboorte/ovl plaats en/of datum

					// *** Extra privacy filter check for total_filter ***
					if ($user["group_pers_hide_totally_act"]=='j' AND strpos(' '.$personDb->pers_own_code,$user["group_pers_hide_totally"])>0){
						$privcount++;
					}
					else{
							persoon_weergeven($personDb);
					}

				}
				else {
					$privcount++;
					// als het een privacy persoon betreft en er wel is gezocht met geb/ovl gegevens
					//   - geef niets weer:
					// een privacy persoon mag niet worden gezocht met non-privacy gegevens!
				}
			}
			else {
				// dit is geen persoon met privacy

				// *** Extra privacy filter check for total_filter ***
				if ($user["group_pers_hide_totally_act"]=='j' AND strpos(' '.$personDb->pers_own_code,$user["group_pers_hide_totally"])>0){
					$privcount++;
				}
				else{
					persoon_weergeven($personDb);
				}

			}
		}

	}

	if($privcount) { echo "<br>".$privcount.$language["search_not_shown"].".<br>";}

	echo '</div>';

	// *** Code niet uitvoeren bij zoeken met echtgenoot ***
	if(!$echtpers_firstname AND !$echtpers_lastname) {
		echo '<br>'.$bladzijderegel;
	}

	echo '</div>';

//for testing:
//print $querie.'<br>';
//print $querie." LIMIT ".veilig($item).",".$aantal_personen;
//echo '<br>index_list: '.$index_list;

//mysql_close($db); // *** close database connection ***
include("footer.php");
?>
Return current item: HuMo-gen