<?php
include "../include/configsession.php";
include "../include/validsession.inc";
include "../include/top.inc";
include "../include/fonction.inc";
include "../include/opendb.inc";
?>


<SCRIPT Language="JAVASCRIPT">

function nextStep()
{
	if (validate() == true)
	{
		document.Organisme.action="xtUpdateOrganisme.php";
		document.Organisme.method = "Post"
		document.Organisme.submit();
	}
}

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}


function validate()
{
	if (document.Organisme.Nom.value == "")
	{
		alert("SVP le Nom de l'organisme est obligatoire");
		document.Organisme.Nom.focus();
		return false
	}
	
	if ((!isEmailAddr(document.Organisme.Email.value)) && (document.Organisme.Email.value != ""))
  {
    alert("SVP l'adresse email n'est pas complet.");
    document.Organisme.Email.focus();
    return (false);
  }
return true
}
</Script>

<?php 

$code = $_REQUEST["code"];
$exist = $_REQUEST["exist"];

if ( isset($code) && !empty($code) ) {
$strSqlM = "SELECT * from organisations where CodeO = ". $code ."";
$rsQueryM = mysql_query($strSqlM);
mysql_error();
if ($row = mysql_fetch_assoc($rsQueryM)) {
$Nom = $row["Nom"]; 
$Statut = $row["Statut"]; 
$Type = $row["Type"]; 
$Description = $row["Description"]; 
$Adresse = $row["Adresse"]; 
$Quartier = $row["Quartier"]; 
$Ville = $row["Ville"]; 
$Province = $row["Province"]; 
$codepostal = $row["codepostal"]; 
$Tel = $row["Tel"]; 
$Fax = $row["Fax"]; 
$NumeroPermis = $row["NumeroPermis"]; 
$NumeroEntreprise = $row["NumeroEntreprise"]; 
$NumeroOrganismeCh = $row["NumeroOrganismeCh"]; 
$NumeroTVQ = $row["NumeroTVQ"]; 
$NumeroTPS = $row["NumeroTPS"]; 
$NomResponsable = $row["NomResponsable"]; 
$PrenomResponsable = $row["PrenomResponsable"]; 
$Email = $row["Email"]; 
$TelResponsable = $row["TelResponsable"]; 
$Cellulaire = $row["Cellulaire"]; 
$DateD = $row["DateD"]; 
$DateM = $row["DateM"]; 

}
}

 ?>

<table>
        <tr> 
          <td width="5">&nbsp;</td>
          <td valign="top" width="738"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
          <td width="23" rowspan="2"><img src="<?php echo $path; ?>/images/innertopleft.gif" width="23" height="23"></td>
          <td bgcolor="#000066" width="1"><img src="<?php echo $path; ?>/images/clearpix.gif" width="1" height="1"></td>
          <td width="23" rowspan="2"><img src="<?php echo $path; ?>/images/innertopright.gif" width="23" height="23"></td>
        </tr>
        <tr>
          <td width="100%">&nbsp;<font color="#10307B" face="Georgia" size="2"><b><i>

          
        </i></b></font><font color="#000080"><i><b>Gestion des organismes </b></i></font></td>
        </tr>
        <tr>
          <td background="<?php echo $path; ?>/images/leftbg.gif"><img src="<?php echo $path; ?>/images/clearpix.gif" width="23" height="1"></td>
          <td width="100%" valign="top">
          
          <div align="center">
            <center>
            
            <table border="0" cellpadding="0" cellspacing="0" width="600">
              <tr>
                <td>
                <FORM Action="xtUpdateOrganisme.php" Method=Post Name="Organisme">
                <table width="475" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td colspan="3" height="15"class="formtxt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><br>
                                                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                  Coordonnées de l'organisme </b><b>:</b></td>
											</tr>
											<tr>
												<td colspan="3"><img src="<?php echo $path; ?>/images/form_top.gif" width="650" height="17" alt="" border="0"></td>
											</tr><tr>
												<td bgcolor="#DD7242"><img src="<?php echo $path; ?>/images/spacer.gif" width="1" height="1" alt="" border="0"></td>
            </center>
												<td align="center" bgcolor="#F2F2F2" class="normal">														
                                                <p align="left">														
												<img src="<?php echo $path; ?>/images/spacer.gif" width="648" height="1" alt="" border="0"><br>
                                                <div align="center">
                                                  <center>
                                                  <table border="0" cellpadding="0" cellspacing="0" width="648">
                                                    <tr>
                                                      <td width="160" valign="top"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Nom
                          de l'organisme:</font></td>
                                                      <td width="490" colspan="3" valign="top"><input type="text" NAME="Nom" size="10" class="input" style="width: 393; height: 16" tabindex="6" value="<?php echo $Nom ; ?>">
                                                     
													  <input type="hidden"  NAME="code" VALUE="<?php echo $_REQUEST["code"]  ;?>" size="40" class="input" style="width: 138; height: 16" tabindex="1">
			
													   </td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                            <img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Description
                          :</font>
                                                      </td>
                                                      <td width="490" colspan="3" valign="top"><textarea rows="2" name="Description" cols="47" class="input1" tabindex="7"><?php echo $Description ; ?></textarea></td>
                                                      
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                                                      </td>
                                                      <td width="215" valign="top"></td>
                                                      
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Statut
                                                        :</font>
                                                      </td>
                                                      <td width="215" valign="top"><select name="Statut" class="select" size="1" tabindex="8">
                            <option value="0" <?php if ($Statut == 0){ echo "selected"; }  ?>>Inactif</option>
                            <option value="1" <?php if ($Statut == 1){ echo "selected"; }  ?>>Actif</option>
							</select></td>
                                                      <td width="133" valign="top"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Type
                                                        :</font></td>
                                                      <td width="145" valign="top"><select name="Type" class="select" size="1" tabindex="8">
                            <option value="1" <?php if ($Type == 0){ echo "selected"; }  ?> >Interne</option>
                            <option value="0" <?php if ($Type == 1){ echo "selected"; }  ?> >Externe</option>
                                                        </select></td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Adresse
                            :</font>
                                                      </td>
                                                      <td width="490" valign="top" colspan="3"><input type="text" NAME="adresse" size="10" class="input" style="width: 396; height: 16" tabindex="8" value="<?php echo $Adresse ; ?>"></td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                                                      <img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Quartier
                            :</font>
                                                      </td>
                                                      <td width="215" valign="top">
                                                      <SELECT name="Quartier" class="select2" size="1" tabindex="17" >
                         	<option value = "0" selected >Choisissez</option>
						    <?php 
							$strSqlQ = "SELECT * from quartier where Statut = true  order by Nom ";
							$rsQueryQ = mysql_query($strSqlQ);
							while ($row = mysql_fetch_assoc($rsQueryQ)) {
							?>
							<option value = '<?php echo $row["CodeQ"]; ?>' <?php if ($Quartier == $row["CodeQ"]) { echo "selected"; }; ?> ><?php echo $row["Nom"];?></option>
							<?php 		
							}
							?>
							</select>
                                                     
                                                      </td>
                                                      <td width="133" valign="top"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Ville
                            :</font>
                                                      </td>
                                                      <td width="145" valign="top">
													  <SELECT name="ville" class="select2" size="1" tabindex="14" >
														<option value = "0" selected >Choisissez&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
														<?php 
														$strSqlV = "SELECT * from ville where Statut = true  order by Nom ";
														$rsQueryV = mysql_query($strSqlV);
														while ($row = mysql_fetch_assoc($rsQueryV)) {
														?>
														<option value = '<?php echo $row["CodeV"]; ?>' <?php if ($Ville == $row["CodeV"]) { echo "selected"; }; ?> ><?php echo $row["Nom"];?></option>
														<?php 		
														}
														?>
														</select>
													  
													 
													  
													  </td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                                                      <img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Province
                            :</font>
                                                      </td>
                                                      <td width="215" valign="top"><input type="text" name="province" size="10" class="input" style="width: 110; height: 16" tabindex="11" value="<?php echo $province ;?>">
                                                      </td>
                                                      <td width="133" valign="top"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Code
                          postal :</font></td>
                                                      <td width="145" valign="top"><input type="text" NAME="codepostal" size="10" class="input" tabindex="12" value="<?php echo $codepostal ;?>"></td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                                                      <img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Tél.&nbsp; :</font>
                                                      </td>
                                                      <td width="215" valign="top"><input type="text" NAME="Tel" size="40" class="input" style="width: 110; height: 16" tabindex="13" value="<?php echo $Tel ; ?>">
                                                      </td>
                                                      <td width="133" valign="top"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Télécopieur
                                                        :</font></td>
                                                      <td width="145" valign="top"><input type="text" NAME="Fax" size="40" class="input" style="width: 111; height: 16" tabindex="14" value="<?php echo $Fax ; ?>"></td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                                                      <img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Numéro
                                                      de permis :</font>
                                                      </td>
                                                      <td width="215" valign="top">
                                                      <input type="text" NAME="NumeroPermis" size="8" class="input" tabindex="15" value="<?php echo $NumeroPermis ; ?>">
                                                      </td>
                                                      <td width="133" valign="top"></td>
                                                      <td width="145" valign="top"></td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                                                      <img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Numéro
                                                      d'entreprise :</font>
                                                      </td>
                                                      <td width="215" valign="top">
                                                      <input type="text" NAME="NumeroEntreprise" size="8" class="input" tabindex="15" value="<?php echo $NumeroEntreprise ; ?>">
                                                      </td>
                                                      <td width="133" valign="top"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Numéro
                                                        de TVQ :</font></td>
                                                      <td width="145" valign="top"><input type="text" NAME="NumeroTVQ" size="8" class="input" tabindex="16" value="<?php echo $NumeroTVQ ; ?>"></td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                                                      <img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Numéro
                                                      de charité :</font>
                                                      </td>
                                                      <td width="215" valign="top">
                                                      <input type="text" NAME="NumeroOrganismeCh" size="8" class="input" tabindex="17" value="<?php echo $NumeroOrganismeCh ; ?>">
                                                      </td>
                                                      <td width="133" valign="top"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Numéro
                                                        de TPS :</font></td>
                                                      <td width="145" valign="top"><input type="text" NAME="NumeroTPS" size="8" class="input" tabindex="18" value="<?php echo $NumeroTPS ; ?>"></td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                                                      <img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Note
                          :</font>
                                                      </td>
                                                      <td width="490" valign="top" colspan="3">
                                                      <textarea rows="2" name="NoteG" cols="48" class="input1" tabindex="19"><?php echo $NoteG ; ?></textarea>
                                                      </td>
                                                    </tr>
                                                    <tr>
                                                      <td width="160" valign="top">
                                                      </td>
                                                      <td width="215" valign="top">
                                                      </td>
                                                      <td width="133" valign="top"></td>
                                                      <td width="145" valign="top"></td>
                                                    </tr>
                                                  </table>
                                                  </center>
                                                </div>
            <center>
                                                </center>
												</td>
													<td bgcolor="#DD7242"><img src="<?php echo $path; ?>/images/spacer.gif" width="1" height="1" alt="" border="0"></td>
												</tr>

								
												<tr>
													<td colspan="3"><img src="<?php echo $path; ?>/images/form_bot.gif" width="650" height="16" alt="" border="0"></td>
												</tr>
										</table>

                
                
                </td>
              </tr>
            </table>
          </div>
            &nbsp;
          <div align="center">
            <center>
            <table border="0" cellpadding="0" cellspacing="0" width="600">
              <tr>
                <td>
                <table width="475" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td colspan="3" height="15"class="formtxt">&nbsp;&nbsp;&nbsp;&nbsp;
                                                  <b>Coordonnées de responsable
                                                  : </b></td>
											</tr>
											<tr>
												<td colspan="3"><img src="<?php echo $path; ?>/images/form_top.gif" width="650" height="17" alt="" border="0"></td>
											</tr><tr>
												<td bgcolor="#DD7242"><img src="<?php echo $path; ?>/images/spacer.gif" width="1" height="1" alt="" border="0"></td>
            </center>
												<td align="center" bgcolor="#F2F2F2" class="normal">														
                                                <p align="left">														
												<img src="<?php echo $path; ?>/images/spacer.gif" width="648" height="1" alt="" border="0"><br>
                                                <div align="center">
                                                  <table border="0" cellpadding="0" cellspacing="0" width="630">
                                                    <tr>
                                                      <td width="128">
                                                        <p align="left"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Nom
                          :&nbsp;</font></td>
                                                      <td width="162">
                                                      <input type="text" NAME="NomResponsable" size="40" class="input" style="width: 162; height: 16" tabindex="20" value="<?php echo $NomResponsable ; ?>">
                                                      </td>
                                                      <td width="12"></td>
                                                      <td width="144"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Prénom
                                  :</font>
                                                      </td>
                                                      <td width="189"><input type="text" NAME="PrenomResponsable" size="40" class="input" style="width: 142; height: 16" tabindex="21" value="<?php echo $PrenomResponsable ; ?>">
                                                      </td>
                                                    </tr>
                                                    <tr>
                                                      <td width="128">
                                                        <p align="left"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Courriel
                          :</font></p>
                                                      </td>
                                                  <center>
                                                      <td width="162"><input type="text" NAME="Email" size="40" class="input" style="width: 163; height: 16" tabindex="22" value="<?php echo $Email ; ?>">
                                                      </td>
                                                      <td width="12"></td>
                                                  </center>
                                                      <td width="144">
                                                        <p align="left"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Tél.&nbsp;</font></p>
                                                      </td>
                                                  <center>
                                                      <td width="189"><input type="text" NAME="TelResponsable" size="40" class="input" style="width: 142; height: 16" tabindex="23" value="<?php echo $TelResponsable ; ?>"></td>
                                                    </tr>
                                                  </center>
                                                    <tr>
                                                      <td width="128">
                            <p align="right">
                                                      </td>
                                                      <td width="162">
                                                      </td>
                                                      <td width="12"></td>
                                                      <td width="144">
                                                        <p align="left"><img src="<?php echo $path; ?>/images/pr.gif" border="0" width="6" height="6"><font class="formtxt">Cellulaire
                          :</font></td>
                                                      <td width="189"><input type="text" NAME="Cellulaire" size="40" class="input" style="width: 142; height: 16" tabindex="24" value="<?php echo $Cellulaire ; ?>"></td>
                                                    </tr>
                                                    <tr>
                                                      <td width="128">
                                                      </td>
                                                      <td width="162"></td>
                                                      <td width="12"></td>
                                                      <td width="144"></td>
                                                      <td width="189"></td>
                                                    </tr>
                                                  <center>
                                                  </table>
                                                  </center>
                                                </div>
												</td>
													<td bgcolor="#DD7242"><img src="<?php echo $path; ?>/images/spacer.gif" width="1" height="1" alt="" border="0"></td>
												</tr>

								
												<tr>
													<td colspan="3"><img src="<?php echo $path; ?>/images/form_bot.gif" width="650" height="16" alt="" border="0"></td>
												</tr>
										</table>

                
                
                </td>
              </tr>
            </table>
          </div>
          <p align="center">
                                                                      <input type="button" value=" :: Enregistrer :: " onclick="javascript:nextStep();" id=button1 name=button1 class=btnfrm>
                                                                      
            <table width="680" BORDER="0" CELLPADDING="0" CELLSPACING="0">
              <tr>
                <td align="left" width="394">
               
                 
                  
                  </td>
                </tr>
              </table>
            </td>
            <td width"23" background="<?php echo $path; ?>/images/rightbg1.gif"><img src="<?php echo $path; ?>/images/clearpix.gif" width="23" height="1"></td>
          </tr>
          <tr>
            <td width="23" rowspan="2"><img src="<?php echo $path; ?>/images/innerbottomleft.gif" width="23" height="23"></td>
            <td width="100%">
              <p align="center"><img src="<?php echo $path; ?>/images/a.gif" width="1" height="22"></td>
            <td width="23" rowspan="2"><img src="<?php echo $path; ?>/images/innerbottomright.gif" width="23" height="23"></td>
          </tr>
          <tr>
            <td width="1" bgcolor="#000066" height="1"><img src="<?php echo $path; ?>/images/clearpix.gif" width="1" height="1"></td>
          </tr>
        </table>
        <font color="#0000FF"><img src="<?php echo $path; ?>/images/clearpix.gif" width="1" height="22"></font>
          </td>

  
<?php
  include "../include/footer.inc";
?>