<?php
  ///////////////////////////////////////////////////
  //2007 (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['otd-title3'];
  $helppage = $TEXT['otd-help3'];

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

  if($result2['user'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['master'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['manager'] == 1) puterror2($TEXT['error-loginform4']);

  if(!isset($title)) $title = $TEXT['otd-title3'];
  if(!isset($button)) $button = $TEXT['btn_edit'];
  if(!isset($action)) $action = "edit.php";

  if(strlen($_GET['otd_id'])>11) puterror2($TEXT['error-otd9']);
  $_GET['otd_id'] = rep($_GET['otd_id']);

  $old_otd_id = $_GET['otd_id'];

  $query = "SELECT * FROM `tbl_otdel` WHERE `otd_id`='".$_GET['otd_id']."' ";
  $result = mysql_query($query);
  if (!$result) puterror2($TEXT['error-tbl8']);
   $result2 = mysql_fetch_array($result);
         $otdel = $result2['otdel'];
         $position = $result2['position'];
         $phone_int = $result2['phone'];
?>
<form enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table align="center"  width="40%">
<tr><td class="useraddedit"><?php echo $TEXT['otd-field4']; ?></td><td class="useraddedit"><input size=30 maxlength=70 class="inputmandatory" type=text name=otdel value='<?php echo $otdel; ?>' /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['post-pos']; ?></td><td class="useraddedit"><input size=5 maxlength=5 class="inputmandatory" type=text name=position value='<?php echo $position; ?>' /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['usr-field3']; ?></td><td class="useraddedit"><input size=20 maxlength=20 type=text name=phone_int value='<?php echo $phone_int; ?>' /></td></tr>
<tr><td></td><td>
<input class="button" type=submit value='<?php echo $button; ?>' />
<input type=hidden name=otd_id value='<?php echo $old_otd_id; ?>' />
</td></tr>
</table>
</form>
<?php
  require_once "../util/bottom.php";
?>