<?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_log.inc.php") ?>
<?php require ("../inc/fic.inc.php") ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);
?>
<?php
	$orig = strip_tags(trim($_GET['ori'])); // Récupération origine ('Public / Privé')
	$dep = strip_tags(trim($_GET['dep'])); // Récupération code département
	
	$ddeok = TRUE;
	$ddeur="";

	// Si origine de la demande est "privée", on récupère le code du département du connecté et les données du demandeur
	if ($orig == "pr")
	{
		switch (@$HTTP_SESSION_VARS["niv_log"])
		{
			//Centre de gestion
			case 5 : $row = lit_enr_cdg();
					 extract($row);
					 
					 $ste = $cge_nom;
					 $adr1 = $cge_adr1;
					 $adr2 = $cge_adr2;
					 $dep = $cge_dep;
					 $ville = $cge_ville;
					 $pays = $cge_pays;
					 $telf = ereg_replace(" ","",$cge_telf);
					 $fax = ereg_replace(" ","",$cge_fax);
					 $email = $cge_emaild;
					 
					 $ddeur="cge";
					
					break;

			//Agence
			case 4 : $row = lit_enr_age(@$HTTP_SESSION_VARS["code_log"]);
					 extract($row);
					 
					 $ste = $age_nom;
					 $adr1 = $age_adr1;
					 $adr2 = $age_adr2;
					 $dep = $age_dep;
					 $ville = $age_ville;
					 $pays = $age_pays;
					 $telf = ereg_replace(" ","",$age_telf);
					 $fax = ereg_replace(" ","",$age_fax);
					 $email = $age_emaild;
					 
					 $ddeur="age";
					
					break;

			//Technicien
			case 3 : $row = lit_enr_tec(@$HTTP_SESSION_VARS["code_log"]);
					 extract($row);
					 
					 $civilite = $tec_civilite;
					 $prenom = $tec_prenom;
					 $nom = $tec_nom;
					 $adr1 = $tec_adr1;
					 $adr2 = $tec_adr2;
					 $dep = $tec_dep;
					 $ville = $tec_ville;
					 $pays = $tec_pays;
					 $telf = ereg_replace(" ","",$tec_telf);
					 $telp = ereg_replace(" ","",$tec_telp);
					 $fax = ereg_replace(" ","",$tec_fax);
					 $email = $tec_email;
					
					 $ddeur="tec";
					
					break;

			//Opérateur
			case 2 : $row = lit_enr_ope(@$HTTP_SESSION_VARS["code_log"]);
					 extract($row);
					 
					 $civilite = $ope_civilite;
					 $prenom = $ope_prenom;
					 $nom = $ope_nom;
					 $adr1 = $ope_adr1;
					 $adr2 = $ope_adr2;
					 $dep = $ope_dep;
					 $ville = $ope_ville;
					 $pays = $ope_pays;
					 $telf = ereg_replace(" ","",$ope_telf);
					 $telp = ereg_replace(" ","",$ope_telfp);
					 $email = $ope_email;
					
					 $ddeur="ope";
					
					break;

			//Client
			case 1 : $row = lit_enr_cli(@$HTTP_SESSION_VARS["code_log"]);
					 extract($row);
					 
					 $ste = $cli_ste;
					 $civilite = $cli_civilite;
					 $prenom = $cli_prenom;
					 $nom = $cli_nom;
					 $adr1 = $cli_adr1;
					 $adr2 = $cli_adr2;
					 $dep = $cli_dep;
					 $ville = $cli_ville;
					 $pays = $cli_pays;
					 $telf = ereg_replace(" ","",$cli_telf);
					 $fax = ereg_replace(" ","",$cli_fax);
					 $telp = ereg_replace(" ","",$cli_telfp);
					 $email = $cli_email;
					
					 $ddeur="cli";
					
					break;
					
			default : $dep="";
					  $ddeok = FALSE;
					break;
		}
	}

	$titre = "MESSAGES & DEMANDES";
?>

<!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 : Demande</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>

<!-- Scripts Javascript pour vérifications -->
<script language="JavaScript" src="../inc/verif.js"></script>


<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>

<!-- Affiché uniquement si demande cohérente -->
<?PHP 
if ($ddeok == TRUE)
{
?>
	
	<!-- Formulaire de demande du numéro de département (uniquement si n'existe pas) -->
	<?PHP if (($dep == "") AND ($orig == "pu")) { ?>
	<form name="dde_dep" id="dde_dep" method="GET" action="dde_maj.php">
    <input name="ori" type="hidden" id="ori" value="<?PHP echo $orig ?>">
		<p align="center">Merci de saisir votre num&eacute;ro de d&eacute;partement. </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_nom");
		
		$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_nom." (".$dep_num.")";
			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) -->

	<!-- Affiché uniquement s'il y a un code département et si la source de la demande est identifiée -->
	<?PHP
	if (($dep <> "") AND (($orig == "pr") OR ($orig == "pu")))
	{
	?>
		<p>&nbsp;</p>
		<form name="dde_maj" method="post" action="dde_enr.php" onsubmit="return v.exec();">
		<input name="titre" type="hidden" id="titre" value="<?PHP echo $titre ?>">
	    <input name="ori" type="hidden" id="ori" value="<?PHP echo $orig ?>">
		
		<!-- Objet -->
		<table width="800"  border="0">
		<tr>
			<td width="160" class="tfvNormal" id="f_obj"><div align="right">Objet</div></td>
			<td>
			<select name="objet" id="objet">
			<option value="" selected>-- Choisissez pourquoi vous expédiez ce message --</option>
			<?PHP
				
				// Création de la liste des type de demandes
				
				$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
				mysql_select_db(DBNAME);
				if (@$HTTP_SESSION_VARS["niv_log"] <> "") // Espace privé
				{
					switch ($ddeur)
					{
						// Si Demandeur = Centre de gestion
						case "cge" :
							$rech = "SELECT * FROM ".TBDDET." WHERE `ddet_cge` = '1' ORDER BY ddet_desc";
							break;

						// Si Demandeur = Agence
						case "age" :
							$rech = "SELECT * FROM ".TBDDET." WHERE `ddet_age` = '1' ORDER BY ddet_desc";
							break;

						// Si Demandeur = Client
						case "cli" :
							$rech = "SELECT * FROM ".TBDDET." WHERE `ddet_cli` = '1' ORDER BY ddet_desc";
							break;

						// Si Demandeur = Opérateur
						case "ope" :
							$rech = "SELECT * FROM ".TBDDET." WHERE `ddet_ope` = '1' ORDER BY ddet_desc";
							break;

						// Si Demandeur = Technicien
						case "tec" :
							$rech = "SELECT * FROM ".TBDDET." WHERE `ddet_tec` = '1' ORDER BY ddet_desc";
							break;
					}
				}
				else
				{
					$rech = "SELECT * FROM ".TBDDET." WHERE `ddet_pub` = '1' ORDER BY ddet_desc";
				}
				$rs = mysql_query($rech);
				
				while ($resultat = mysql_fetch_array($rs)) 
				{
					extract($resultat);
		
					echo '<option value="'.$ddet_code.'">'.$ddet_desc.'</option>';
				}
				mysql_free_result($rs);
				mysql_close($conn);
			?>
			</select>
			<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		</table>
		
		<!-- Destinataire -->
		<table width="800"  border="0">
		<tr>
			<td width="160" class="tfvNormal" id="f_dest"><div align="right">Destinataire</div></td>
			<td>
			<select name="dest" id="dest">
			<option value="" selected>-- Choisissez à qui vous expédiez ce message --</option>
			<?PHP
				
				// Création de la liste des destinataires demandes
				
				$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
				mysql_select_db(DBNAME);
				if (@$HTTP_SESSION_VARS["niv_log"] <> "") // Espace privé
				{
					switch ($ddeur)
					{
						// Si Demandeur = Centre de gestion
						case "cge" :
							$rech = "SELECT * FROM ".TBDDED." WHERE `dded_cge` = '1' ORDER BY dded_desc";
							break;

						// Si Demandeur = Agence
						case "age" :
							$rech = "SELECT * FROM ".TBDDED." WHERE `dded_age` = '1' ORDER BY dded_desc";
							break;

						// Si Demandeur = Client
						case "cli" :
							$rech = "SELECT * FROM ".TBDDED." WHERE `dded_cli` = '1' ORDER BY dded_desc";
							break;

						// Si Demandeur = Opérateur
						case "ope" :
							$rech = "SELECT * FROM ".TBDDED." WHERE `dded_ope` = '1' ORDER BY dded_desc";
							break;

						// Si Demandeur = Technicien
						case "tec" :
							$rech = "SELECT * FROM ".TBDDED." WHERE `dded_tec` = '1' ORDER BY dded_desc";
							break;
					}
				}
				else
				{
					$rech = "SELECT * FROM ".TBDDED." WHERE `dded_pub` = '1' ORDER BY dded_desc";
				}
				$rs = mysql_query($rech);
				
				while ($resultat = mysql_fetch_array($rs)) 
				{
					extract($resultat);
		
					echo '<option value="'.$dded_code.'">'.$dded_desc.'</option>';
				}
				mysql_free_result($rs);
				mysql_close($conn);
			?>
			</select>
			<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		</table>
		<br>

		<!-- Détails expéditeur-->
		<table width="800"  border="0">
		<tr>
			<td class="tfvNormal">
				<div align="center">Vos coordonn&eacute;es </div>
			</td>
		</tr>
		</table>

		<!-- Catégorie -->
		<?
		if (@$HTTP_SESSION_VARS["niv_log"] <> "") // Espace privé
		{
		?>
			<input name="cat" type="hidden" id="cat" value="<?PHP echo str_majuscules($ddeur); ?>">
		<?PHP
		}
		else
		{
		?>
		<table width="800"  border="0">
		<tr>
			<td width="160" class="tfvNormal" id="f_cat"><div align="right">Vous &ecirc;tes</div></td>
			<td>
				<select name="cat" id="cat">
				<option value="" selected>-- Choisissez une catégorie --</option>
				<?PHP
					
					// Création de la liste des catégories de demandeurs (espace privé uniquement)
					
					$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
					mysql_select_db(DBNAME);
					$rech = "SELECT * FROM ".TBDDEC." WHERE `ddec_pub` = '0' ORDER BY ddec_desc";
					$rs = mysql_query($rech);
					
					while ($resultat = mysql_fetch_array($rs)) 
					{
						extract($resultat);
			
						echo '<option value="'.$ddec_code.'">'.$ddec_desc.'</option>';
					}
					mysql_free_result($rs);
					mysql_close($conn);
				?>
				</select>
				<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		</table>
		<?PHP
		}
		?>

	    <!-- Coordonnées -->
		<table width="800"  border="0">
		<tr>
			<td width="160" class="tfvNormal" id="f_ste"><div align="right">Soci&eacute;t&eacute;</div></td>
			<td>
				<input name="ste" type="text" id="ste" value="<?PHP echo $ste ?>" size="50" maxlength="50">
			</td>
		</tr>
		<tr>
			<td width="160" class="tfvNormal" id="f_civilite"><div align="right">Civilit&eacute;</div></td>
			<td>
			<select name="civilite" size="1" id="civilite">
			<?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 ($cli_civilite <> "")
						echo "<option value=\"\">-- Choisissez une civilité --</option>";
					else
						echo "<option value=\"\" selected>-- Choisissez une civilité --</option>";
				}
	
				if ($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">
			</td>
		</tr>
		<tr>
			<td width="160" class="tfvNormal" id="f_prenom"><div align="right">Pr&eacute;nom</div></td>
			<td>
				<input name="prenom" type="text" id="prenom" value="<?PHP echo $prenom ?>" size="50" maxlength="50">
				<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		<tr>
			<td width="160" class="tfvNormal" id="f_nom"><div align="right">Nom</div></td>
			<td>
				<input name="nom" type="text" id="nom" value="<?PHP echo $nom ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toUpperCase();">
				<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		<tr>
			<td width="160" class="tfvNormal" id="f_adr1"><div align="right">Adresse (1) </div></td>
			<td>
				<input name="adr1" type="text" id="adr1" value="<?PHP echo $adr1 ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toUpperCase();">
				<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		<tr>
			<td width="160" class="tfvNormal" id="f_adr2"><div align="right">Adresse (2) </div></td>
			<td>
				<input name="adr2" type="text" id="adr2" value="<?PHP echo $adr2 ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toUpperCase();">
			</td>
		</tr>
		<tr>
			<td width="160" class="tfvNormal" id="f_dep"><div align="right">D&eacute;partement</div></td>
			<td>
				<input name="dep" type="text" id="dep" value="<?PHP echo $dep ?>" size="3" maxlength="3" readonly="1">
				<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		<tr>
			<td width="160" class="tfvNormal" id="f_ville"><div align="right">Ville</div></td>
			<td>
				<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 = $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 ($ville <> "")
							echo "<option value=\"\">-- Choisissez une ville --</option>";
						else
							echo "<option value=\"\" selected>-- Choisissez une ville --</option>";
					}
		
					if ($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">
			</td>
		</tr>
		<tr>
			<td width="160" class="tfvNormal" id="f_pays"><div align="right">Pays</div></td>
			<td>
				<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 ($pays <> "")
							echo "<option value=\"\">-- Choisissez un pays --</option>";
						else
							echo "<option value=\"\" selected>-- Choisissez un pays --</option>";
					}
		
					if ($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">
			</td>
		</tr>
		<tr>
			<td class="tfvNormal" id="f_telf"><div align="right">T&eacute;l&eacute;phone Fixe </div></td>
			<td>
				<input name="telf" type="text" id="telf" value="<?PHP echo $telf ?>" size="20" maxlength="20">
				<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		<tr>
			<td class="tfvNormal" id="f_fax"><div align="right">T&eacute;l&eacute;copieur</div></td>
			<td>
				<input name="fax" type="text" id="fax" value="<?PHP echo $fax ?>" size="20" maxlength="20">
			</td>
		</tr>
		<tr>
			<td class="tfvNormal" id="f_telp"><div align="right">Portable</div></td>
			<td>
				<input name="telp" type="text" id="telp" value="<?PHP echo $telp ?>" size="20" maxlength="20">
			</td>
		</tr>
		<tr>
			<td class="tfvNormal" id="f_email"><div align="right">Email</div></td>
			<td>
				<input name="email" type="text" id="email" value="<?PHP echo $email ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toLowerCase();">
				<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		</table>
		<br>

		<!-- Texte de la demande -->
		<table width="800"  border="0">
		<tr>
			<td class="tfvNormal" id="f_txtdde">
				<div align="center">Votre message </div>
			</td>
		</tr>
		</table>
		<table width="800"  border="0">
		<tr>
			<td>
				<textarea name="txtdde" cols="125" rows="5" id="txtdde"><?PHP echo $txtdde ?></textarea>
				<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		</table>
		
		<p align="center">
		<input name="RAZ" type="reset" id="RAZ" value="R&eacute;initialiser">
		<input name="enr" type="submit" id="enr" value="Envoyer">
		</p>
		</form>
		
		<?
		if (@$HTTP_SESSION_VARS["niv_log"] <> "") // Espace privé
		{
		?>
			<script>
			// form fields description structure
			var a_fields = {
				'objet':{'l':'Objet','r':true,'t':'f_obj'},
				'dest':{'l':'Destinataire','r':true,'t':'f_dest'},
				'ste':{'l':'Société','r':false,'t':'f_ste'},
				'civilite':{'l':'Civilité','r':true,'f':'alpha','t':'f_civilite'},
				'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':false,'f':'unsigned','t':'f_telp'},
				'email':{'l':'E-mail','r':true,'f':'email','t':'f_email','mx':50},
				'txtdde':{'l':'Votre demande','r':true,'t':'f_txtdde'}
			},
			
			o_config = {
				'to_disable' : ['enr', 'RAZ'],
				'alert' : 1
			}
			
			// validator constructor call
			var v = new validator('dde_maj', a_fields, o_config);
			</script>
		<?PHP
		}
		else
		{
		?>
			<script>
			// form fields description structure
			var a_fields = {
				'objet':{'l':'Objet','r':true,'t':'f_obj'},
				'dest':{'l':'Destinataire','r':true,'t':'f_dest'},
				'cat':{'l':'Vous êtes','r':true,'t':'f_cat'},
				'ste':{'l':'Société','r':false,'t':'f_ste'},
				'civilite':{'l':'Civilité','r':true,'f':'alpha','t':'f_civilite'},
				'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':false,'f':'unsigned','t':'f_telp'},
				'email':{'l':'E-mail','r':true,'f':'email','t':'f_email','mx':50},
				'txtdde':{'l':'Votre demande','r':true,'t':'f_txtdde'}
			},
			
			o_config = {
				'to_disable' : ['enr', 'RAZ'],
				'alert' : 1
			}
			
			// validator constructor call
			var v = new validator('dde_maj', a_fields, o_config);
			</script>
		<?PHP
		}
		?>
	<?PHP 
	} 
	?>
	<!-- Fin affiché uniquement s'il y a un code département et si la source de la demande est identifiée -->

<!-- Fin Affiché uniquement si demande cohérente -->
<?PHP
}
else
{
?>
	<script type="text/javascript">
	setTimeout("self.location.href=('index.php');",2000)
	</script>
	<p align="center" class="annot_std_it">Il y a un prob&egrave;me dans la demande...</p>
    <?PHP
}
?>
