<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 0.9.9

Copyright (C) 2006-2009  Sylvain FATOME
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; 
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program
(in the directory docs); 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.

Contact : galawa@free.fr

Web : http://smitst.homelinux.com
****************************************************************************************/


// Vérification des tentatives de hack
$pos=strpos($_SERVER['PHP_SELF'],"inc.php");
if ($pos===FALSE)
	$ok_inc=TRUE;
else
	$ok_inc=FALSE;
if ($ok_inc==FALSE) header("Location: ../index.php");

include_once("../inc/fic_dloc.inc.php");
include_once("../inc/fic_hum.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_geol.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("geoip.inc.php");
Archivelog(@$_SESSION["code_log"]);

$td = strip_tags(trim(@$_GET['td']));
$coderech = strip_tags(trim(@$_GET['nom']));
$dloc_dep = strip_tags(trim(@$_GET['dep']));

$pbm_dloc=FALSE;

$msg1_err_type=$ajx_nodeppays;
$msg2_err_type=$ajx_novildep;

if ($coderech <> "")
{
	// Récupération des informations dépôt
	$row = lit_enr_dloc($coderech);
	if (is_array($row))
	{
		extract ($row);
		if (($td<>"del") AND ($dloc_ouvert==FALSE))
			$td="view";
	}
	else
		$pbm_dloc=TRUE;
}
else
{
	if ($td == "add")
	{
		$dloc_ouvert = TRUE;
		$dloc_codepays = pays_connect_code($_SERVER['REMOTE_ADDR']);
	}
	else
		$pbm_dloc=TRUE;
}

switch ($td)
{
	case "add" :
		$titre = "CREATION DEPOT";
		break;
	case "edit" :
		$titre = "MISE A JOUR DEPOT";
		break;
	case "del" :
		$titre = "SUPPRESSION DEPOT";
		break;
	case "view" :
		$titre = "VISUALISATION DEPOT";
		break;
	default :
		$pbm_dloc=TRUE;
		break;
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SMI - <?PHP echo $title_esp_prive; ?> : Fiche D&eacute;p&ocirc;t de Location</title>

<!-- Feuille de style pour les affichages courants -->
<link href="../css/smi.css" rel="stylesheet" type="text/css">

<!-- Feuille de style & Script pour le menu -->

<script language="JavaScript" src="../jscript/coolmenus/coolmenus4.js"></script>

<!-- Scripts Javascript pour fenêtres -->
<script language="JavaScript" src="../jscript/fen.js"></script>

<!-- Scripts Javascript pour vérifications des champs -->
<script language="JavaScript" src="../jscript/verif_field.js"></script>

<!-- Scripts Javascript pour contrôle de formulaire -->
<script	type="text/javascript" src="../jscript/vform/vform.js"></script>

<script language="javascript">
<!--
var tab1_champ=new Array(
	"nom:nom ; format:txt ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_code); ?>; lmn:1 ; lmx:50; stok:frmok ; stbad:frmbad",
	"nom:adr1 ; format:txt ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_adr1); ?> ; lmn:1 ; lmx:50; stok:frmok ; stbad:frmbad",
	"nom:adr2 ; format:txt ; req:N ; txt:<?PHP echo html_entity_decode($txt_chp_adr2); ?> ; lmx:50; stok:frmok ; stbad:frmbad",
	"nom:ville ; format:liste ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_ville); ?> ; vmn:1; stok:frmok ; stbad:frmbad",
	"nom:dep ; format:liste ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_dep); ?> ; vmn:1; stok:frmok ; stbad:frmbad",
	"nom:pays ; format:liste ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_pays); ?> ; vmn:1; stok:frmok ; stbad:frmbad",
	"nom:telf ; format:tel ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_telf); ?>; stok:frmok ; stbad:frmbad",
	"nom:fax ; format:tel ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_fax); ?>; stok:frmok ; stbad:frmbad",
	"nom:rcivil ; format:liste ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_civil); ?> responsable d'agence; vmn:1; stok:frmok ; stbad:frmbad",
	"nom:rprenom ; format:txt ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_pnom); ?> responsable d'agence; lmn:1; lmx:50; stok:frmok ; stbad:frmbad",
	"nom:rnom ; format:txt ; req:Y ; txt:Nom responsable d'agence; lmn:1; lmx:50; stok:frmok ; stbad:frmbad",
	"nom:rtelf ; format:tel ; req:Y ; txt:N° tel fixe responsable d'agence; stok:frmok ; stbad:frmbad",
	"nom:email ; format:mail ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_email)." ".html_entity_decode($txt_chp_emailgeneral); ?> ; lmx:50; stok:frmok ; stbad:frmbad",
	"nom:emaild ; format:mail ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_email)." ".html_entity_decode($txt_chp_emaildir); ?> ; lmx:50; stok:frmok ; stbad:frmbad",
	"nom:emails ; format:mail ; req:N ; txt:<?PHP echo html_entity_decode($txt_chp_email)." ".html_entity_decode($txt_chp_emailgstock); ?> ; lmx:50; stok:frmok ; stbad:frmbad");
//-->
</script>

<!-- Scripts Javascript pour alertes -->
<script language="JavaScript" src="../jscript/alertes.js"></script>

<!-- Scripts Javascript divers -->
<script language="JavaScript" src="../jscript/divers.js"></script>

<!-- Scripts Ajax -->
<script type="text/javascript" src="../ajax/util.js"></script>
<script type="text/javascript" src="../ajax/SelectUpdater.js"></script>

<?PHP if ($pbm_dloc==FALSE) { ?>
<script type="text/javascript">
<!--        
function updateVille()
{
	villeUpdater = new SelectUpdater("ville", "<?PHP echo $rep_appli.'/ajax/'; ?>recupville.php?dep=", "attn2", "msg2", "<?PHP echo $msg2_err_type; ?>");
	anciendep = "";
	document.getElementById("dep").onchange = function() {
		var listedep = document.getElementById("dep");
		var dep = listedep.options[listedep.selectedIndex].value;
		var listepays = document.getElementById("pays");
		var codepays = listepays.options[listepays.selectedIndex].value;
		if (dep.length > 0)
		{
			if (dep != anciendep)
			{
				// Faire l'appel Ajax
				var prmget=dep+"_"+codepays;
				villeUpdater.run(prmget);
				anciendep = dep;
			}
		}
		else
		{
			// Remettre la liste a vide et annuler l'appel eventuel
			villeUpdater.reset();
			anciendep = "";
		}
	}
}

function updateDep()
{
	depUpdater = new SelectUpdater("dep", "<?PHP echo $rep_appli.'/ajax/'; ?>recupdep.php?pays=", "attn1", "msg1", "<?PHP echo $msg1_err_type; ?>");
	anciencodepays = "";
	anciendep = "";
	document.getElementById("pays").onchange = function() {
		var listepays = document.getElementById("pays");
		var codepays = listepays.options[listepays.selectedIndex].value;
		if (codepays.length > 0)
		{
			if (codepays != anciencodepays)
			{
				// Faire l'appel Ajax
				depUpdater.run(codepays);
				document.getElementById("ville").value='';
				var txthtml = "<option><?PHP echo $sel_lst_makechx; ?></option>\n";
				document.getElementById("ville").innerHTML=txthtml;
				document.getElementById("attn2").innerHTML = "";
				document.getElementById("msg2").innerHTML = "";
				anciencodepays = codepays;
			}
		}
		else
		{
			// Remettre la liste a vide et annuler l'appel eventuel
			depUpdater.reset();
			var txthtml = "<option><?PHP echo $sel_lst_makechx; ?></option>\n";
			document.getElementById("ville").innerHTML=txthtml;
			document.getElementById("attn2").innerHTML = "";
			document.getElementById("msg2").innerHTML = "";
			anciencodepays = "";
		}
	}
}
//-->
</script>
<?PHP } ?>

</head>


<?PHP if (($td == "del") OR ($td == "view")){ ?>
<body onLoad="metReadonly();">
<?PHP } 

if (($td == "add") OR ($td == "edit")) { ?>
<body onLoad="metFocus();updateDep();updateVille();">
<?PHP 
}
include_once("../inc/entete.inc.php"); 
?>

<p align="center"><span class="titrepage"><?PHP echo $titre ?></span></p>
<!-- Affiché uniquement s'il y a au moins une civilité -->
<?PHP
if ($pbm_dloc==FALSE)
{
if (nb_civ() <> 0)
{
?>
<table width="100%"  border="0">
  <tr>
    <td width="33%">
	<strong><em><a href="dloc_lst.php"><?PHP echo $txt_lnk_ret_liste; ?></a></em></strong>
	</td>
    <td width="33%"align="center" class="annot_petit_it">(<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>"> : <?PHP echo $txt_div_saisoblg; ?>)</td>
    <td width="33%">&nbsp;</td>
  </tr>
</table>

<!-- Formulaire de saisie de la fiche -->
<form name="dloc_maj" id="dloc_maj" method="post" action="dloc_enr.php" onSubmit="javascript:; return (VForm(this,tab1_champ,document.dloc_maj.pays.value,'<?PHP echo $_SESSION["lng"]; ?>'));">
<input name="titre" type="hidden" id="titre" value="<?PHP echo $titre ?>">
<input name="td" type="hidden" id="td" value="<?PHP echo $td ?>">
<?PHP if ($td == "add") { ?>
<input name="ouvert" type="hidden" id="ouvert" value="Oui">
<?PHP } ?>
<input name="codeage" type="hidden" id="codeage" value="<?PHP echo $dloc_codeage ?>">

<!-- Ouverture (avec dates) du dépôt -->
<?PHP 
if (($td == "edit") OR ($td == "del") OR ($td == "view")) 
{
?>
	<table width="100%"  border="0">
	<tr>
		<td width="160" class="rubfrm" id="f_ouvert" align="right">D&eacute;pôt Ouvert</td>
		<td>
			<?PHP 
			if ($dloc_ouvert == 1)
			{
				if ($td<>"view")
				{
					echo "<select name=\"ouvert\" size=\"1\" id=\"ouvert\">";
					echo "<option value=\"Oui\" selected>".$sel_lst_oui."</option>";
					echo "<option value=\"Non\">".$sel_lst_non."</option>";
					echo "</select>";
					
				}
				else
					echo "<input name=\"ouvert\" type=\"text\" id=\"ouvert\" value=\"".$non_oui[$dloc_ouvert]."\" size=\"3\" readonly=\"1\">";

				echo "<span class=\"annot_std_it\">";
				echo "  (Depuis le : ".formatedate($dloc_datecrea).")";
				echo "</span>";
			}
			else
			{
				echo "<input name=\"ouvert\" type=\"text\" id=\"ouvert\" value=\"Non\" size=\"3\" readonly=\"1\">";
				echo "<span class=\"annot_std_it\">";
				echo "  (Ouvert le : ".formatedate($dloc_datecrea).", ferm&eacute; le : ".formatedate($dloc_datec).")";
				echo "</span>";
			}
			?>
		</td>
	</tr>
	</table>
<?PHP
}
?>

<!-- Fiche principale -->
<table width="100%"  border="0">
<tr>
	<td width="160" class="rubfrm" id="f_nom" align="right"><?PHP echo $txt_chp_nom; ?></td>
	<td>
	<?PHP 
	if (@$_SESSION["niv_log"] >= 5)
	{
		if ($td=="add")
		{
	?>
		<input name="nom" type="text" id="nom" value="<?PHP echo htmlspecialchars($dloc_nom) ?>" size="50" onChange="javascript:this.value=this.value.toUpperCase();">
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	<?PHP
		}
		else
		{
	?>
		<input name="nom" type="text" id="nom" value="<?PHP echo htmlspecialchars($dloc_nom) ?>" size="50" readonly="1">
	<?PHP
		}
	}
	else
	{
	?>
		<input name="nom" type="text" id="nom" value="<?PHP echo htmlspecialchars($dloc_nom) ?>" size="50" readonly="1">
	<?PHP
	}
	?>
	</td>
</tr>
<tr>
	<td width="160" class="rubfrm" id="f_adr1" align="right"><?PHP echo $txt_chp_adr1; ?></td>
	<td>
	<?PHP 
	if (@$_SESSION["niv_log"] >= 5)
	{
	?>
		<input name="adr1" type="text" id="adr1" value="<?PHP echo htmlspecialchars($dloc_adr1) ?>" size="50" onChange="javascript:this.value=this.value.toUpperCase();">
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	<?PHP
	}
	else
	{
	?>
		<input name="adr1" type="text" id="adr1" value="<?PHP echo htmlspecialchars($dloc_adr1) ?>" size="50" readonly="1">
	<?PHP
	}
	?>
	</td>
</tr>
<tr>
	<td width="160" class="rubfrm" id="f_adr2" align="right"><?PHP echo $txt_chp_adr2; ?></td>
	<td>
	<?PHP 
	if (@$_SESSION["niv_log"] >= 5)
	{
	?>
		<input name="adr2" type="text" id="adr2" value="<?PHP echo htmlspecialchars($dloc_adr2) ?>" size="50" onChange="javascript:this.value=this.value.toUpperCase();">
	<?PHP
	}
	else
	{
	?>
		<input name="adr2" type="text" id="adr2" value="<?PHP echo htmlspecialchars($dloc_adr2) ?>" size="50" readonly="1">
	<?PHP
	}
	?>
	</td>
</tr>
</tr>
	<tr>
		<td class="rubfrm" id="f_pays" align="right"><?PHP echo $txt_chp_pays; ?></td>
		<td>
		<?PHP
		if ($dloc_ouvert == TRUE)
		{
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
			$rs = mysql_query("SELECT * FROM ".TBPAYS." ORDER BY pays_nom");
		?>			
			<select name="pays" id="pays">
		<?PHP
			echo "<option value=\"\">".$sel_lst_pays."</option>";
	
			// Création de la liste des pays
			
			while ($resultat = mysql_fetch_array($rs)) 
			{
				extract($resultat);
				if ($dloc_codepays == $pays_code)
					echo '<option value="'.$pays_code.'" selected>'.$pays_nom.'</option>';
				else
					echo '<option value="'.$pays_code.'">'.$pays_nom.'</option>';
			}
		?>
			</select>
			<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
		<?PHP
			mysql_free_result($rs);
			mysql_close($conn);
		}
		else
		{
			$pays = Retournepays_open($dloc_codepays,TRUE);
		?>
			<input name="pays" type="hidden" id="pays" value="<?PHP echo $dloc_codepays ?>">
			<input name="pays_nom" type="text" id="pays_nom" value="<?PHP echo $pays ?>" size="50"  readonly="1">
		<?PHP
		}
		?>
		</td>
	</tr>
	<tr>
		<td class="rubfrm" id="f_dep" align="right"><?PHP echo $txt_chp_dep; ?></td>
		<td>
		<?PHP
		if ($dloc_ouvert == TRUE) 
		{
			// Création de la liste des départements
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
			$rech="SELECT * FROM ".TBDEP." WHERE `dep_codepays`='".$dloc_codepays."' ORDER BY dep_code";
			$rs = mysql_query($rech) or die(mysql_error());
		?>
		<select name="dep" size="1" id="dep">
		<?PHP
		echo "<option>".$sel_lst_makechx."</option>";

		if (mysql_num_rows($rs)>0)
		{
			while ($resultat = mysql_fetch_array($rs)) 
			{
				extract($resultat);
				if ($dep_code<>$dep_nom)
					$dep=$dep_code." (".$dep_nom.")";
				else
					$dep=$dep_nom;
				if ($dloc_dep == $dep_code)
					echo "<option value=\"".$dep_code."\" selected>".$dep."</option>";
				else
					echo "<option value=\"".$dep_code."\">".$dep."</option>";
			}
		}
		else
			echo "<option value=\"-1\" selected>".$sel_lst_unknown."</option>";
		?>
		</select>
		 <img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
		 <span id="attn1"></span><span id="msg1" style="background-color:#FF0000; color:#FFFF00; font-weight:bold"><?PHP if ((mysql_num_rows($rs)==0) AND ($td<>"del")) echo htmlspecialchars($msg1_err_type)?></span>
		<?PHP
			mysql_free_result($rs);
			mysql_close($conn);
		}
		else
		{
			$dept=Retournedep_open($dloc_dep,$dloc_codepays,TRUE);
			if ($dloc_dep<>$dept)
				$dep=$dloc_dep." (".$dept.")";
			else
				$dep=$dept;
		?>
			<input name="dep" type="hidden" id="dep" value="<?PHP echo $dloc_dep ?>">
			<input name="dep_nom" type="text" id="dep_nom" value="<?PHP echo $dep ?>" size="40"  readonly="1">
		<?PHP
		}
		?>
		</td>
	</tr>
	<tr>
		<td class="rubfrm" id="f_ville" align="right"><?PHP echo $txt_chp_ville; ?></td>
		<td>
		<?PHP
		if ($dloc_ouvert == TRUE) 
		{
			// Création de la liste des villes
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
	
			$rech="";
			if ($dloc_dep<>"")
			{
				if ($dloc_dep<>"-1")
				{
					$filtre=$dloc_dep;
					if (($filtre == "2A") OR ($filtre == "2B"))
						$filtre = "20";
					$rech = "SELECT * FROM ".TBVILLES." WHERE `villes_dep` = '".str_majuscules($filtre)."' AND `villes_codepays`='".str_majuscules($dloc_codepays)."' ORDER BY villes_nom";
				}
				else
				{
					$rech = "SELECT * FROM ".TBVILLES." WHERE `villes_codepays`='".str_majuscules($dloc_codepays)."' ORDER BY villes_nom";
				}
			}
			if ($rech<>"")
				$rs = mysql_query($rech) or die(mysql_error());
		?>
		<select name="ville" size="1" id="ville">
		<?PHP
		echo "<option>".$sel_lst_makechx."</option>";

		if ($rech<>"")
		{
			if (mysql_num_rows($rs)>0)
			{
				while ($resultat = mysql_fetch_array($rs)) 
				{
					extract($resultat);
					if ($dloc_ville == $villes_id)
						echo '<option value="'.$villes_id.'" selected>'.str_majuscules($villes_nom).' ('.$villes_cp.')</option>';
					else
						echo '<option value="'.$villes_id.'">'.str_majuscules($villes_nom).' ('.$villes_cp.')</option>';
				}
			}
		}
		?>
		</select>
	     <img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
		 <span id="attn2"></span><span id="msg2" style="background-color:#FF0000; color:#FFFF00; font-weight:bold"><?PHP if ($rech<>"") {if ((mysql_num_rows($rs)==0) AND ($td<>"del")) echo htmlspecialchars($msg2_err_type);}?></span>
		<?PHP
			mysql_close($conn);
		}
		else
		{
			$ville = Retourneville_openId($dloc_ville,TRUE);
		?>
			<input name="ville" type="hidden" id="ville" value="<?PHP echo $dloc_ville ?>">
			<input name="ville_nom" type="text" id="ville_nom" value="<?PHP echo $ville ?>" size="40"  readonly="1">
		<?PHP
		}
		?>
		</td>
	</tr>
<tr>
	<td width="160" class="rubfrm" id="f_telf" align="right">
		<?PHP echo $txt_chp_telf; ?><br>
	</div>
	</td>
	<td>
		  <input name="telf" type="text" id="telf" value="<?PHP echo $dloc_telf ?>" size="20" maxlength="20">
		  <img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>"><br>
	</td>
</tr>
<tr>
	<td width="160" class="rubfrm" id="f_fax" align="right">
		<?PHP echo $txt_chp_fax; ?><br>
	</div>
	</td>
	<td>
		<input name="fax" type="text" id="fax" value="<?PHP echo $dloc_fax ?>" size="20" maxlength="20">
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>"><br>
	</td>
</tr>
<tr>
	<td colspan="2">&nbsp;</td>
</tr>
<tr>
	<td colspan="2" class="rubfrm" id="f_web" align="center">Responsable du d&eacute;p&ocirc;t</td>
</tr>
<tr>
	<td class="rubfrm" id="f_rcivil" align="right"><?PHP echo $txt_chp_civil; ?></td>
	<td>
		<select name="rcivil" size="1" id="rcivil">
		<?PHP
		
		echo "<option>".$sel_lst_civil."</option>";

		// Création de la liste des civilités
		
		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rs = mysql_query("SELECT * FROM ".TBCIV." ORDER BY civ_desc");
		
		while ($resultat = mysql_fetch_array($rs)) 
		{
			extract($resultat);
			if ($dloc_resp_civilite == $civ_code)
			{
				echo '<option value="'.$civ_code.'" selected>'.$civ_desc.'</option>';
			}
			else
			{
				echo '<option value="'.$civ_code.'">'.$civ_desc.'</option>';
			}
		}
		mysql_free_result($rs);
		mysql_close($conn);
		?>
		</select>
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	</td>
</tr>
<tr>
	<td class="rubfrm" id="f_rprenom" align="right"><?PHP echo $txt_chp_pnom; ?></td>
	<td>
		<input name="rprenom" type="text" id="rprenom" value="<?PHP echo htmlspecialchars($dloc_resp_prenom) ?>" size="50" onChange="javascript:this.value=ucWords(this.value,true);">
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	</td>
</tr>
<tr>
	<td class="rubfrm" id="f_rnom" align="right"><?PHP echo $txt_chp_nom; ?></td>
	<td>
		<input name="rnom" type="text" id="rnom" value="<?PHP echo htmlspecialchars($dloc_resp_nom )?>" size="50" onChange="javascript:this.value=this.value.toUpperCase();">
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	</td>
</tr>
<tr>
	<td class="rubfrm" id="f_rtelf" align="right">Tel. Fixe </td>
	<td>
		<input name="rtelf" type="text" id="rtelf" value="<?PHP echo $dloc_resp_telf ?>" size="20" maxlength="20">
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	</td>
</tr>
<tr>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
</tr>
<tr>
	<td colspan="2" class="rubfrm" align="center"><?PHP echo $txt_chp_emails; ?></td>
</tr>
<tr>
	<td width="160" class="rubfrm" id="f_email" align="right"><?PHP echo $txt_chp_emailgeneral; ?></td>
	<td>
		<input name="email" type="text" id="email" value="<?PHP echo $dloc_email ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toLowerCase();">
		<?PHP if ($td == "edit") { ?>
			<a href="mailto:<?PHP echo $dloc_email ?>"><img src="../img/mail.png" title="<?PHP echo $alt_envemail; ?>" border ="0" align="absmiddle"></a>
		<?PHP } ?>
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	</td>
</tr>
<tr>
	<td width="160" class="rubfrm" id="f_emaild" align="right"><?PHP echo $txt_chp_emaildir; ?></td>
	<td>
		<input name="emaild" type="text" id="emaild" value="<?PHP echo $dloc_emaild ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toLowerCase();">
		<?PHP if ($td == "edit") { ?>
			<a href="mailto:<?PHP echo $dloc_emaild ?>"><img src="../img/mail.png" title="<?PHP echo $alt_envemail; ?>" border ="0" align="absmiddle"></a>
		<?PHP } ?>
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	</td>
</tr>
<tr>
	<td width="160" class="rubfrm" id="f_emails" align="right">Gestionnaire du stock</td>
	<td>
		<input name="emails" type="text" id="emails" value="<?PHP echo $dloc_emails ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toLowerCase();">
		<?PHP if ($td == "edit") { ?>
			<a href="mailto:<?PHP echo $dloc_emails ?>"><img src="../img/mail.png" title="<?PHP echo $alt_envemail; ?>" border ="0" align="absmiddle"></a>
		<?PHP } ?>
	</td>
</tr>
</table>

<p align="center">
<?PHP if (($td == "add") OR ($td == "edit")) { ?>
	<input name="RAZ" type="reset" class="bton_std" id="RAZ" value="<?PHP echo $but_reinit; ?>">
	<input name="submit" type="submit" class="bton_std" id="submit" value="<?PHP echo $but_enr; ?>">
<?PHP }
if ($td == "del") { ?>
	<input name="del" type="submit" class="bton_std" id="del" value="<?PHP echo $but_del; ?>">
	<input name="annul" type="button" class="bton_std" id="annul" value="<?PHP echo $but_cancel; ?>" onclick="javascript:; history.back();">
<?PHP } ?>
</p>
</form>
<!-- Fin affiché uniquement s'il y a au moins une civilité -->
<?PHP
}
else
{
	if (nb_civ() == 0)
	{
		echo '<p align="center" class="annot_std_it">'.$alert_nociv.'</p>';
		aff_ret_auto("civ_lst.php",2000);
	}
}
}
else
	aff_ret_pbm_auto("index.php",2000);
include_once("pied.php");
?>
