<?php
  ///////////////////////////////////////////////////
  //2009 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang."/".$lang.".php")) include "../lang/".$lang."/".$lang.".php";
     else include "../lang/ru/ru.php";

  $title=$titlepage=$TEXT['pochta-title'];
  $helppage=$TEXT['pochta-help'];

  require_once "../config.php";
  require_once "../util/top.php";

  if($result2['administrator'] == 0) puterror2($TEXT['error-loginform4']);
?>
<form action=mail.php method=post>
<table align="center" width="20%" class="topheader" border="0" cellspacing="2">
    <tr>
	<td class="useraddedit" rowspan=4><?php echo $TEXT['pochta-komu']; ?></td>
	<td class="useraddedit"><?php echo $TEXT['tbl-org']; ?></td>
        <td class="useraddedit"><select class="input" name="org_id">
    <?php
       $query4 = "SELECT * FROM `tbl_organizaciya` WHERE `visible` != 'hide' ORDER BY position";
        $organizaciya_tmp = mysql_query($query4);
          if(!$organizaciya_tmp) puterror2($TEXT['error-tbl7']);
              while($organizaciya = mysql_fetch_array($organizaciya_tmp,MYSQL_ASSOC))
                {
                 $chk = "<option value=".$organizaciya['org_id'].">".$organizaciya['organizaciya']."";
                 echo $chk;
                }
    ?>
    </select></td><td><input type=checkbox name=old_org ></td></tr>
<tr>
	<td class="useraddedit"><?php echo $TEXT['tbl-upr']; ?></td>
	<td class="useraddedit"><select class="input" name="upr_id">
    <?php
       $query5 = "SELECT * FROM `tbl_upravlenie` ORDER BY position";
        $upravlenie_tmp = mysql_query($query5);
          if(!$upravlenie_tmp) puterror2($TEXT['error-tbl9']);
              while($upravlenie = mysql_fetch_array($upravlenie_tmp,MYSQL_ASSOC))
                {
                 $chk = "<option value=".$upravlenie['upr_id'].">".$upravlenie['upravlenie']."";
                 echo $chk;
                }
    ?>
    </select></td><td><input type=checkbox name=old_upr ></td></tr>
<tr>
	<td class="useraddedit"><?php echo $TEXT['tbl-otd']; ?></td>
	<td class="useraddedit"><select class="input" name="otd_id">
    <?php
       $query6 = "SELECT * FROM `tbl_otdel` ORDER BY position";
        $otdel_tmp = mysql_query($query6);
          if(!$otdel_tmp) puterror2($TEXT['error-tbl8']);
              while($otdel = mysql_fetch_array($otdel_tmp,MYSQL_ASSOC))
                {
                 $chk = "<option value=".$otdel['otd_id'].">".$otdel['otdel']."";
                 echo $chk;
                }
    ?>
    </select></td><td><input type=checkbox name=old_otd ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-post']; ?></td>
    <td class="useraddedit"><select class="input" name="dol_id">
    <?php
        $query7 = "SELECT * FROM `tbl_dolzhnost` ORDER BY dolzhnost, position";
        $dolzhnost_tmp = mysql_query($query7);
          if(!$dolzhnost_tmp) puterror2($TEXT['error-tbl6']);
              while($dolzhnost = mysql_fetch_array($dolzhnost_tmp,MYSQL_ASSOC))
                {
                 $chk = "<option value=".$dolzhnost['dol_id'].">".$dolzhnost['dolzhnost']."";
                 echo $chk;
                }
    ?>
    </select></td><td><input type=checkbox name=old_dol ></td></tr>
     <tr>
	<td class="useraddedit"><?php echo $TEXT['pochta-tema']; ?></td>
	<td class="useraddedit" colspan=2><input size=50 maxlength=100 class="input" type=text name=tema ></td>
     </tr>
     <tr>
	<td align="center" class="useraddedit" colspan="3"><textarea class="input" cols="100" rows="10" name=message ></textarea></td>
     </tr>
     <tr>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td align="right"><input type=submit value='<?php echo $TEXT['btn-mail']; ?>'></td></tr>
</table>
</form>
<?php
  require_once "../util/bottom.php";
?>