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

Copyright (C) 2006  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
****************************************************************************************/

include ("../inc/config.inc.php");
?>
<?php require ("../inc/func.inc.php") ?>
<?php require ("../inc/func_date.inc.php") ?>
<?php require ("../inc/func_log.inc.php") ?>
<?php require ("../inc/fic.inc.php") ?>
<?PHP include("../inc/geoip.inc"); ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);
?>
<?php
	$td = strip_tags(trim($_GET['typ']));
	$coderech = strip_tags(trim($_GET['code']));
	$tec_dep = strip_tags(trim($_GET['dep']));
	
	if ($coderech <> "")
	{
		// Récupération des informations techniciens

		$row = lit_enr_tec($coderech);
		extract ($row);

		$tec_datecreaf = formatedate($tec_datecrea);
		$tec_congdf = formatedate($tec_congd);
		$tec_congff = formatedate($tec_congf);
		$tec_dateoutf = formatedate($tec_dateout);

		if ($td == "edit")
			$titre = "MISE A JOUR COMPTE TECHNICIEN";

		if ($td == "del")
			$titre = "SUPPRESSION COMPTE TECHNICIEN";
	}
	else
	{
		if ($td == "add")
		{
			$tec_codeage = (@$HTTP_SESSION_VARS["code_log"]);
			$tec_pays = pays_connect($_SERVER['REMOTE_ADDR']);

			$titre = "CREATION COMPTE TECHNICIEN";
		}
	}
?>

<!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 - ESPACE PRIVE : Fiche Technicien</title>

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

<!-- Feuille de style & Script pour le menu -->
<link href="../inc/menu.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../coolmenus/coolmenus4.js"></script>

<!-- Scripts Javascript pour validation des formulaires -->
<script language="JavaScript" src="../inc/validator.js"></script>

<!-- Scripts Javascript pour affichages -->
<script language="JavaScript" src="../inc/aff.js"></script>

<!-- Définition Javascript pour calendrier popup -->

  <!-- Feuille de Style -->
  <link rel="stylesheet" type="text/css" media="all" href="../jscal/skins/aqua/theme.css" title="Aqua" />

  <!-- Script Javascript Principal -->
  <script type="text/javascript" src="../jscal/calendar.js"></script>

  <!-- Choix du langage -->
  <script type="text/javascript" src="../jscal/lang/calendar-fr.js"></script>

  <!-- the following script defines the Calendar.setup helper function, which makes
       adding a calendar a matter of 1 or 2 lines of code. -->
  <script type="text/javascript" src="../jscal/calendar-setup.js"></script>

<!-- Affichage nouvelle fenêtre pour impression -->
<script type="text/javascript">
	function lanceimp(page)
	{
	  window.open(page,'impression','width='+screen.width+' height='+screen.height);
	}
</script>

<!-- Fin de la définition Javascript pour calendrier popup -->

<div id="patience" style="position:absolute; width:620px; height:50px; z-index:1; left: 50px; top: 120px;">
  <table width="100%"  border="1" cellspacing="0" bordercolor="#FFFF00">
    <tr>
      <td class="titrerubrique1"><div align="center">
        <p>Merci de patienter pendant le chargement des fichiers Villes et Pays</p>
        <p><img src="../img/baratt.gif" width="350" height="11"></p>
      </div></td>
    </tr>
  </table>
</div>

<script language="JavaScript" type="text/JavaScript">
var nava = (document.layers);
var dom = (document.getElementById);
var iex = (document.all);
if (nava) { cach = document.cache }
else if (dom) { cach = document.getElementById("patience").style }
else if (iex) { cach = cache.style }
largeur = screen.width;
cach.left = Math.round((largeur/2)-200);
cach.visibility = "visible";

function cacheOff()
	{
	cach.visibility = "hidden";
	}
window.onload = cacheOff
</script>

</head>

<body>

<?php 
	include_once ("entete.php"); 
?>

<p align="center"> <span class="titrepage"><?PHP echo $titre ?></span></p>

<!-- Formulaire de demande du numéro de département (uniquement si n'existe pas) -->
<?PHP if ($tec_dep == "") { ?>
<form name="dde_dep" id="dde_dep" method="GET" action="tec_maj.php">
<p>
	  <input name="typ" type="hidden" id="typ" value="<?PHP echo $td ?>">
	  <input name="code" type="hidden" id="code" value="<?PHP echo $coderech ?>">
</p>
	<p align="center">Merci de choisir le d&eacute;partement o&ugrave; habite le technicien.</p>
	<table width="100%"  border="0">
<tr>
	<td width="20%" class="tfvNormal" id="f_ouvert"><div align="right">D&eacute;partement</div></td>
	<td>
		<select name="dep" size="1" id="dep">
		<?PHP
		
		// Création de la liste des départements
		
		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rs = mysql_query("SELECT * FROM ".TBDEP." ORDER BY dep_num");
		
		$i=0;
		
		while ($resultat = mysql_fetch_array($rs)) 
		{
			extract($resultat);

			if ($i == 0)
			{
				echo "<option value=\"\" selected>-- Choisissez un département --</option>";
			}
			$chaine_dep = $dep_num." (".$dep_nom.")";
			echo "<option value=\"".$dep_num."\">".$chaine_dep."</option>";
			
			$i++;
		}

		mysql_free_result($rs);
		mysql_close($conn);
		?>
		</select>
          <img src="../img/oblig.gif" width="10" height="11">
	</td>
</tr>
</table>
<p align="center">
	<input type="submit" name="Submit" value="Valider">
</p>
</form>

<script>
// form fields description structure
var a_fields = {
	'dep':{'l':'Code','r':true,'f':'integer','t':'f_dep','mx':3}
},

o_config = {
	'to_disable' : ['submit'],
	'alert' : 1
}

// validator constructor call
var v = new validator('dde_dep', a_fields, o_config);

</script>
<?PHP } ?>
<!-- Fin de formulaire de demande du numéro de département (uniquement si n'existe pas) -->

<!-- Affichage uniquement si numéro de département saisi -->
<?PHP if ($tec_dep <> "") { ?>
<table width="100%"  border="0">
<tr>
	<td width="33%"><strong><em><a href="tec_lst.php?ta=m&cc=">Retour &agrave; la liste</a></em></strong></td>
	<td width="33%" bgcolor="#FF0000"><div align="center"><span class="titrerubrique1">Coordonn&eacute;es</span></div></td>
	<td width="33%"><div align="right">
		<div align="right">
		<?PHP
		if ($td == "edit")
		{
			$urlimp = "tec_maji.php?code=".$coderech;
		?>
			<a href="javascript:;" onclick="lanceimp('<?PHP echo $urlimp; ?>');")><img src="../img/print.gif" title="Imprimer la fiche" width="22" height="22" border="0" align="absmiddle"></a> <a href="javascript:;" onclick="lanceimp('<?PHP echo $urlimp; ?>');")> Imprimer la fiche </a> </div>
		<?PHP } ?>
		</div>
	</td>
</tr>
</table>
<div align="center">
    <span class="annot_gras_it">(<img src="../img/oblig.gif" width="10" height="11"> : Saisie obligatoire)</span>
</div>
<form name="tec_maj" method="post" action="tec_enr.php" onsubmit="return v.exec()">
  <input name="titre" type="hidden" id="titre" value="<?PHP echo $titre ?>">
  <input name="typdde" type="hidden" id="typdde" value="<?PHP echo $td ?>">
  <input name="pass" type="hidden" id="pass" value="<?PHP echo $tec_pass ?>">
  <?PHP if ($td == "add") { ?>
 	<input name="code" type="hidden" id="code" value="<?PHP echo $tec_code ?>">
	<input name="salarie" type="hidden" id="salarie" value="Oui">
  <?PHP } ?>
  <div align="right"></div>
  <div align="center"></div>
  <?PHP if ($td <> "add") {?>
  <table width="100%"  border="0">
    <tr>
	  <td width="20%" class="tfvNormal" id="f_codetec"><div align="right">Code Technicien</div></td>
      <td><input name="code" type="text" id="code" value="<?PHP echo $tec_code ?>" readonly="1"></td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_salarie"><div align="right">Salari&eacute;</div></td>
      <td>
		<?PHP 
		if (($td == "edit") OR ($td == "del"))
		{ 
			if ($tec_out == FALSE)
			{
		?>
		
		    <select name="salarie" size="1" id="salarie">
        	<option value="Oui" selected>Oui</option>
        	<option value="Non">Non</option>
	      	</select> 

		<?PHP
			}
		}
		
		if (($td == "edit") OR ($td == "del"))
		{ 
			if ($tec_out == TRUE)
			{
		?>
		    <input name="salarie" type="text" id="salarie" value="Non" size="3" maxlength="3" style="background : red; color : yellow; font-weight:bold;" readonly="1">
		<?PHP 
			}
		}
		?>
			<span class="annot_std_it">
		<?PHP

		if (($td == "edit") OR ($td == "del"))
		{ 
			if ($tec_out == false)
				echo "  (Embauche le : ".$tec_datecreaf.")";
			else
				echo "  (Embauche le : ".$tec_datecreaf.", départ le : ".$tec_dateoutf.")";
		}
		?>
			</span>
	  </td>
    </tr>
  </table>
  <?PHP }  ?>
  <table width="100%"  border="0">
	<?PHP
	if ($td <> "add")
	{
		if ($tec_out == FALSE)
		{
	?>
    <tr>
      <td width="20%" class="tfvNormal" id="f_conges"><div align="right">Cong&eacute;s </div></td>
      <td colspan="3">
	    <span class="annot_petit_gras">du</span>
	    <input name="dconges" type="text" id="dconges" value="<?PHP echo $tec_congdf; ?>" size="10" maxlength="10" readonly="1">
        <img src="../img/calendar.png" id="f_img_dconges" title="Choisir votre date" width="16" height="16">
		<span class="annot_petit_gras"> au </span>
        <input name="fconges" type="text" id="fconges" value="<?PHP echo $tec_congff; ?>" size="10" maxlength="10" readonly="1">
      <img src="../img/calendar.png" id="f_img_fconges" title="Choisir votre date" width="16" height="16">  
	  <span class="annot_std_it">(Prochains cong&eacute;s ou cong&eacute;s en cours) ... (
	  <a href="javascript:;" onClick="document.tec_maj.dconges.value='';document.tec_maj.fconges.value='';"><img src="../img/raz.gif" width="12" height="12" border="0" align="absmiddle"></a>
      <a href="javascript:;" onclick="document.tec_maj.dconges.value='';document.tec_maj.fconges.value='';")> Annuler)</a></span>
	  </td>
	</tr>
	<?PHP
		}
	}
	?>
    <tr>
		<td width="20%" class="tfvNormal" id="f_agence"><div align="right">Agence</div></td>
		<td width="83%" colspan="3">
		<?PHP
			if (@$HTTP_SESSION_VARS["niv_log"] <> 4)
			{
				if ($tec_out == FALSE) 
				{
				?>
				<select name="agence" size="1" id="agence">
				<?PHP
				
				// Création de la liste des agences
				
				$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
				mysql_select_db(DBNAME);
				$rs = mysql_query("SELECT * FROM ".TBAGE." ORDER BY age_code");
				
				$i=0;
				
				while ($resultat = mysql_fetch_array($rs)) 
				{
					extract($resultat);
					
					if ($i == 0)
					{
						if ($tec_codeage <> "")
							echo "<option value=\"\">-- Choisissez une agence --</option>";
						else
							echo "<option value=\"\" selected>-- Choisissez une agence --</option>";
					}
					
					if ($tec_codeage == $age_code)
					{
						echo '<option value="'.$age_code.'" selected>'.$age_nom." (".$age_code.")".'</option>';
					}
					else
					{
						echo '<option value="'.$age_code.'">'.$age_nom." (".$age_code.")".'</option>';
					}
					
					$i++;
				}
				mysql_free_result($rs);
				mysql_close($conn);
				?>
				</select>
				<img src="../img/oblig.gif" width="10" height="11">
				<?PHP 
				} 
				else  // Technicien licencié = zone non modifiable (affichage seul)
				{
				$row = lit_enr_age($tec_codeage);
				extract ($row);
				?>
					<input name="agence" type="hidden" id="agence" value="<?PHP echo $tec_codeage; ?>" size="10" maxlength="10">
					<input name="nagence" type="text" id="nagence" value="<?PHP echo $age_nom; ?>" size="50" maxlength="50" readonly="1">
				<?PHP
				}
			}
			else
			{
				$row = lit_enr_age($HTTP_SESSION_VARS["code_age"]);
				extract ($row);
				?>
					<input name="agence" type="hidden" id="agence" value="<?PHP echo $HTTP_SESSION_VARS["code_age"]; ?>">
					<input name="nagence" type="text" id="nagence" value="<?PHP echo $age_nom; ?>" size="50" maxlength="50" readonly="1">
				<?PHP
			}
				?>
		</td>
	</tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_civil"><div align="right">Civilit&eacute;</div></td>
      <td width="83%" colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <select name="civil" size="1" id="civil">
		<?PHP
		
		// 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");
		
		$i=0;
		
		while ($resultat = mysql_fetch_array($rs)) 
		{
			extract($resultat);

			if ($i == 0)
			{
				if ($tec_civilite <> "")
					echo "<option value=\"\">-- Choisissez une civilité --</option>";
				else
					echo "<option value=\"\" selected>-- Choisissez une civilité --</option>";
			}

			if ($tec_civilite == $civ_code)
			{
				echo '<option value="'.$civ_code.'" selected>'.$civ_desc.'</option>';
			}
			else
			{
				echo '<option value="'.$civ_code.'">'.$civ_desc.'</option>';
			}

			$i++;
		}
		mysql_free_result($rs);
		mysql_close($conn);
		?>
		</select>
          <img src="../img/oblig.gif" width="10" height="11">
		<?PHP 
		} 
		else  // Licencié = zone non modifiable (affichage seul)
		{
			$row = lit_enr_civ($tec_civilite);
			extract($row);
		?>
		<input name="civil" type="hidden" id="civil" value="<?PHP echo $civ_code ?>" size="5" maxlength="5">
		<input name="civilite" type="text" id="civilite" value="<?PHP echo $civ_desc ?>" size="50" maxlength="50" readonly="1">
		<?PHP 
		} 
		?>
		</td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_prenom"><div align="right">Pr&eacute;nom</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  	<input name="prenom" type="text" id="prenom" value="<?PHP echo $tec_prenom ?>" size="50" maxlength="50">
          <img src="../img/oblig.gif" width="10" height="11">
	  <?PHP
	  }
	  else
	  {
	  ?>
	  	<input name="prenom" type="text" id="prenom" value="<?PHP echo $tec_prenom ?>" size="50" maxlength="50" readonly="1">
	  <?PHP
	  }
	  ?>
	  </td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_nom"><div align="right">Nom</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <input name="nom" type="text" id="nom" value="<?PHP echo $tec_nom ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toUpperCase();">
          <img src="../img/oblig.gif" width="10" height="11">
	  <?PHP
	  }
	  else
	  {
	  ?>
	  	<input name="nom" type="text" id="nom" value="<?PHP echo $tec_nom ?>" size="50" maxlength="50" readonly="1">
	  <?PHP
	  }
	  ?>
	  </td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_adr1"><div align="right">Adresse(1)</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <input name="adr1" type="text" id="adr1" value="<?PHP echo $tec_adr1 ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toUpperCase();">
          <img src="../img/oblig.gif" width="10" height="11">
	  <?PHP
	  }
	  else
	  {
	  ?>
	  	<input name="adr1" type="text" id="adr1" value="<?PHP echo $tec_adr1 ?>" size="50" maxlength="50" readonly="1">
	  <?PHP
	  }
	  ?>
	  </td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_adr2"><div align="right">Adresse(2)</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <input name="adr2" type="text" id="adr2" value="<?PHP echo $tec_adr2 ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toUpperCase();">
	  <?PHP
	  }
	  else
	  {
	  ?>
	  	<input name="adr2" type="text" id="adr2" value="<?PHP echo $tec_adr2 ?>" size="50" maxlength="50" readonly="1">
	  <?PHP
	  }
	  ?>
	  </td>
    </tr>
    <tr>
      <td class="tfvNormal" id="f_dep"><div align="right">D&eacute;partement</div></td>
      <td colspan="3">
	  	<input name="dep" type="text" id="dep" value="<?PHP echo $tec_dep ?>" size="3" maxlength="3" readonly="1">
	  </td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_ville"><div align="right">Ville</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
		<select name="ville" size="1" id="ville">
		<?PHP
		
		// Création de la liste des villes
		
		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$filtre = $tec_dep;
		if (($filtre == "2A") OR ($filtre == "2B"))
			$filtre = "20";
		$rs = mysql_query("SELECT * FROM ".TBVILLES." WHERE `villes_cp` LIKE '".$filtre."%' ORDER BY villes_nom");
		
		$i=0;
		
		while ($resultat = mysql_fetch_array($rs)) 
		{
			extract($resultat);

			if ($i == 0)
			{
				if ($tec_ville <> "")
					echo "<option value=\"\">-- Choisissez une ville --</option>";
				else
					echo "<option value=\"\" selected>-- Choisissez une ville --</option>";
			}

			if ($tec_ville == $villes_insee)
			{
				echo '<option value="'.$villes_insee.'" selected>'.str_majuscules($villes_nom).' ('.$villes_cp.')</option>';
			}
			else
			{
				echo '<option value="'.$villes_insee.'">'.str_majuscules($villes_nom).' ('.$villes_cp.')</option>';
			}

			$i++;
		}
		mysql_free_result($rs);
		mysql_close($conn);
		?>
		</select>
          <img src="../img/oblig.gif" width="10" height="11">
		<?PHP 
		} 
		else  // Licencié = zone non modifiable (affichage seul)
		{
			$ville = Retourneville($tec_ville);
		?>
		<input name="ville" type="hidden" id="ville" value="<?PHP echo $tec_ville ?>" size="6" maxlength="6">
		<input name="ville_nom" type="text" id="ville_nom" value="<?PHP echo $ville ?>" size="40" maxlength="40" readonly="1">
		<?PHP 
		} 
		?>
	  </td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_pays"><div align="right">Pays</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
		<select name="pays" size="1" id="pays">
	<?PHP
		
		// Création de la liste des pays
		
		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rs = mysql_query("SELECT * FROM ".TBPAYS." ORDER BY pays_nom");
		
		$i=0;
		
		while ($resultat = mysql_fetch_array($rs)) 
		{
			extract($resultat);

			if ($i == 0)
			{
				if ($tec_pays <> "")
					echo "<option value=\"\">-- Choisissez un pays --</option>";
				else
					echo "<option value=\"\" selected>-- Choisissez un pays --</option>";
			}

			if ($tec_pays == $pays_nom)
			{
				echo '<option value="'.$pays_nom.'" selected>'.$pays_nom.'</option>';
			}
			else
			{
				echo '<option value="'.$pays_nom.'">'.$pays_nom.'</option>';
			}

			$i++;
		}
		mysql_free_result($rs);
		mysql_close($conn);
		?>
		</select>
	   <img src="../img/oblig.gif" width="10" height="11">
		<?PHP 
		} 
		else  // Licencié = zone non modifiable (affichage seul)
		{
		?>
		<input name="pays" type="text" id="pays" value="<?PHP echo $tec_pays ?>" size="50" maxlength="50" readonly="1">
		<?PHP 
		} 
		?>
	</td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_telf"><div align="right">T&eacute;l&eacute;phone Fixe</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <input name="telf" type="text" id="telf" value="<?PHP echo $tec_telf ?>" size="20" maxlength="20" >
          <img src="../img/oblig.gif" width="10" height="11">
	  <?PHP 
	  } 
	  else  // Licencié = zone non modifiable (affichage seul)
	  {
	  ?>
	  <input name="telf" type="text" id="telf" value="<?PHP echo $tec_telf ?>" size="20" maxlength="20" readonly="1">
	  <?PHP 
	  } 
	?>
	</td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_fax"><div align="right">T&eacute;l&eacute;copieur</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <input name="fax" type="text" id="fax" value="<?PHP echo $tec_fax ?>" size="20" maxlength="20">
	  <?PHP 
	  } 
	  else  // Licencié = zone non modifiable (affichage seul)
	  {
	  ?>
	  <input name="fax" type="text" id="fax" value="<?PHP echo $tec_fax ?>" size="20" maxlength="20" readonly="1">
	  <?PHP 
	  } 
	  ?>
	  </td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_telp"><div align="right">Portable</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <input name="telp" type="text" id="telp" value="<?PHP echo $tec_telp ?>" size="20" maxlength="20">
          <img src="../img/oblig.gif" width="10" height="11">
	  <?PHP 
	  } 
	  else  // Licencié = zone non modifiable (affichage seul)
	  {
	  ?>
	  <input name="telp" type="text" id="telp" value="<?PHP echo $tec_telp ?>" size="20" maxlength="20" readonly="1">
	  <?PHP 
	  } 
	  ?>
	  </td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_email"><div align="right">Email</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <input name="email" type="text" id="email" value="<?PHP echo $tec_email ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toLowerCase();">
		<?PHP if ($td == "edit") { ?>
      	<a href="mailto:<?PHP echo $tec_email ?>"><img src="../img/mail.png" width="22" height="22" title="Envoyer e-mail" border ="0" align="absmiddle"></a>
		<?PHP } ?>
      <img src="../img/oblig.gif" width="10" height="11">
	  <?PHP 
	  } 
	  else  // Licencié = zone non modifiable (affichage seul)
	  {
	  ?>
	  <input name="email" type="text" id="email" value="<?PHP echo $tec_email ?>" size="50" maxlength="50" readonly="1">
		<?PHP if ($td == "edit") { ?>
      	<a href="mailto:<?PHP echo $tec_email ?>"><img src="../img/mail.png" width="22" height="22" title="Envoyer e-mail" border ="0" align="absmiddle"></a>
		<?PHP } ?>
	  <?PHP 
	  } 
	  ?>
	  </td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_mess"><div align="right">Messagerie</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <input name="mess" type="text" id="mess" value="<?PHP echo $tec_mess ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toLowerCase();">
	  <?PHP 
	  } 
	  else  // Licencié = zone non modifiable (affichage seul)
	  {
	  ?>
	  <input name="mess" type="text" id="mess" value="<?PHP echo $tec_mess ?>" size="50" maxlength="50" readonly="1">
	  <?PHP 
	  } 
	  ?>
	  </td>
    </tr>
    <tr>
      <td width="20%" class="tfvNormal" id="f_nota"><div align="right">Notes</div></td>
      <td colspan="3">
	  <?PHP if ($tec_out == FALSE) 
	  {
	  ?>
	  <textarea name="nota" cols="90" rows="5" id="nota"><?PHP echo $tec_nota ?></textarea>
	  <?PHP 
	  } 
	  else  // Licencié = zone non modifiable (affichage seul)
	  {
	  ?>
	  <textarea name="nota" cols="90" rows="5" readonly id="nota"><?PHP echo $tec_nota ?></textarea>
	  <?PHP 
	  } 
	  ?>
	  </td>
    </tr>
  </table>
  <?PHP if ($tec_out == FALSE) 
  {
  ?>
  <p align="center">
    <?PHP if (($td == "edit") or ($td == "add")) { ?>
    <input name="RAZ" type="reset" id="RAZ" value="R&eacute;initialiser">
    <input name="submit" type="submit" id="submit" value="Enregistrer">
    <?PHP } ?>
    <?PHP if ($td == "del") { ?>
    <input name="del" type="submit" id="del" value="Supprimer">
    <input name="annul" type="button" id="annul" value="Annuler" onclick="javascript:; history.back();">
    <?PHP } ?>
  </p>
  <?PHP 
  } 
  ?>
</form>
<?PHP 
if ($td <> "add")
{
	if ($tec_out == FALSE) { ?>
		<script type="text/javascript">
			Calendar.setup({
				inputField     :    "dconges",     // id of the input field
				ifFormat       :    "%d-%m-%Y",      // format of the input field
				button         :    "f_img_dconges",  // trigger for the calendar (button ID)
				align          :    "Ll",           // alignment (defaults to "Bl")
				singleClick    :    true
			});
			Calendar.setup({
				inputField     :    "fconges",     // id of the input field
				ifFormat       :    "%d-%m-%Y",      // format of the input field
				button         :    "f_img_fconges",  // trigger for the calendar (button ID)
				align          :    "Ll",           // alignment (defaults to "Bl")
				singleClick    :    true
			});
		</script>
<?PHP 
	}
}
?>
<p>
<?PHP if ($td == "del") 
{
?>
	<script>
	warndeltec();
	</script>
<?PHP
}
?>
<script>
// form fields description structure
var a_fields = {
	'agence':{'l':'Agence','r':true,'f':'alphanum','t':'f_agence'},
	'civil':{'l':'Civilité','r':true,'f':'alpha','t':'f_civil'},
	'prenom':{'l':'Prénom','r':true,'t':'f_prenom','mx':50},
	'nom':{'l':'Nom','r': true,'t':'f_nom','mx':50},
	'adr1':{'l':'Adresse(1)','r':true,'t':'f_adr1','mx':50},
	'adr2':{'l':'Adresse(2)','r':false,'t':'f_adr2','mx':50},
	'ville':{'l':'Ville','r':true,'t':'f_ville','mx':20},
	'pays':{'l':'Pays','r':true,'t':'f_pays','mx':20},
	'telf':{'l':'Téléphone','r':true,'f':'unsigned','t':'f_telf','mx':20},
	'fax':{'l':'Télécopie','r':false,'f':'unsigned','t':'f_fax'},
	'telp':{'l':'Portable','r':true,'f':'unsigned','t':'f_telp','mx':20},
	'email':{'l':'E-mail','r':true,'f':'email','t':'f_email','mx':50},
	'mess':{'l':'Messagerie','r':false,'f':'email','t':'f_mess','mx':50},
	'nota':{'l':'Nota','r':false,'f':'nota','t':'f_nota'}
},

o_config = {
	'to_disable' : ['submit', 'RAZ'],
	'alert' : 1
}

// validator constructor call
var v = new validator('tec_maj', a_fields, o_config);
</script>

<?PHP if ($td == "add") 
{
?>
	<script type="text/javascript">
	warnnbage(<?PHP echo nb_age_actives(); ?>,"tec");
	</script>
<?PHP
}
?>
<?PHP } ?>

<?php 
	include_once ("pied.php")
?>

