<?php
  ///////////////////////////////////////////////////
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////
require_once "utils/chlang_osn.php";

  $title = $TEXT['menu-btn3-title'];
  $button = $TEXT['btn-search'];
  $action = "extsearch.php";

require_once "config.php";
require_once "utils/functions.php";
require_once "utils/top.php";

if($result2['administrator'] == 0 && $result2['user'] == 0) {puterror2($result2['skin'],$TEXT['error-loginform2']); require_once "utils/bottom.php"; exit();}
?>
<script type="text/javascript" language="JavaScript" src="lang/<?php echo $lang; ?>/calendar_usr.js"></script>
<form name='book' enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table align="center" width="98%" border="0">
<tr>
<td width="32%" valign="top">
<fieldset>
    <legend align="left" title="<?php echo $TEXT['book-fldset1-tit']; ?>"><?php echo $TEXT['book-fldset1']; ?></legend>
<table align="left" width="100%" border="0">
<tr><td class="inform"><?php echo $TEXT['book-izd']; ?>:</td><td>
    <select name="izd_id">
    <?php
        $queryizd = "SELECT izd_id, izdatelstvo FROM `tbl_izdatelstvo` WHERE use_prog='1' ORDER BY `izdatelstvo` ";
          $resultizd = mysqli_query($dbcnx,$queryizd);
            if(!$resultizd) {puterror2($result2['skin'],$TEXT['error-tbl6']); require_once "utils/bottom.php"; exit();}
              while($result_izdatelstvo = mysqli_fetch_array($resultizd))
                {
                 $chk_izdatelstvo = "<option value=".$result_izdatelstvo['izd_id'].">".$result_izdatelstvo['izdatelstvo']."";
                 echo $chk_izdatelstvo;
                }
    ?>
    </select><input type=checkbox name=izd_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['aut-full']; ?>:</td><td>
    <select name="autor_id">
    <?php
        $queryaut = "SELECT autor_id, name, familiya, otchestvo FROM `tbl_autor` ORDER BY name, familiya, otchestvo ";
          $resultaut = mysqli_query($dbcnx,$queryaut);
            if(!$resultaut) {puterror2($result2['skin'],$TEXT['error-tbl1']); require_once "utils/bottom.php"; exit();}
              while($result_autor = mysqli_fetch_array($resultaut))
                {
                 $chk_autor = "<option value=".$result_autor['autor_id'].">".$result_autor['name']." ".$result_autor['otchestvo']." ".$result_autor['familiya']."";
                 echo $chk_autor;
                }
    ?>
    </select><input type=checkbox name=autor_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-name']; ?>:</td><td><input size=30 maxlength=127 type=text name=book_name /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-isbn']; ?>:</td><td><input size=30 maxlength=127 type=text name=isbn /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-opis']; ?>:</td><td><input size=30 maxlength=127 type=text name=opisanie /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-oglavl']; ?>:</td><td><input size=30 maxlength=127 type=text name=oglavlenie /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-show4']; ?>:</td><td><input type=checkbox name=spisano /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-show5']; ?>:</td><td><input type=checkbox name=zakupka /></td></tr>
</table>
</fieldset>
</td>
<td width="52%" valign="top">
<fieldset>
    <legend align="left" title="<?php echo $TEXT['book-fldset2-tit']; ?>"><?php echo $TEXT['book-fldset2']; ?></legend>
<table align="right" width="100%" border="0">
<tr><td class="inform"><?php echo $TEXT['book-data']; ?>:</td><td><input size=4 maxlength=4 type=text name=data_izdaniya /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-data7']; ?>:</td><td><input size=10 maxlength=10 type=text name=data_postupleniya_bol />
<script type="text/javascript" language="JavaScript">
	var o_cal = new tcal ({
		// form name
		'formname': 'book',
		// input name
		'controlname': 'data_postupleniya_bol'
	});
	</script></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-data8']; ?>:</td><td><input size=10 maxlength=10 type=text name=data_postupleniya />
<script type="text/javascript" language="JavaScript">
	var o_cal = new tcal ({
		// form name
		'formname': 'book',
		// input name
		'controlname': 'data_postupleniya'
	});
	</script></td></tr>

<tr><td class="inform"><?php echo $TEXT['ser-title']; ?>:</td><td>
    <select name="ser_id">
    <?php
        $queryser = "SELECT * FROM `tbl_seriya` WHERE use_prog='1' ORDER BY `seriya` ";
          $resultser = mysqli_query($dbcnx,$queryser);
            if(!$resultser) {puterror2($result2['skin'],$TEXT['error-tbl21']); require_once "utils/bottom.php"; exit();}
              while($result_seriya = mysqli_fetch_array($resultser))
                {
                 $chk_seriya = "<option value=".$result_seriya['ser_id'].">".$result_seriya['seriya']."";
                 echo $chk_seriya;
                }
    ?>
    </select><input type=checkbox name=ser_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-zhanr']; ?>:</td><td>
    <select name="zhanr_id">
    <?php
        $query10 = "SELECT * FROM `tbl_zhanr` WHERE use_prog='1' ORDER BY `zhanr` ";
          $result10 = mysqli_query($dbcnx,$query10);
            if(!$result10) {puterror2($result2['skin'],$TEXT['error-tbl14']); require_once "utils/bottom.php"; exit();}
              while($result_zhanr = mysqli_fetch_array($result10))
                {
                 $chk_zhanr = "<option value=".$result_zhanr['zhanr_id'].">".$result_zhanr['zhanr']."";
                 echo $chk_zhanr;
                }
    ?>
    </select><input type=checkbox name=zhanr_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-cicle']; ?>:</td><td>
    <select name="cicle_id">
    <?php
        $query11 = "SELECT * FROM `tbl_cicle` WHERE use_prog='1' ORDER BY `cicle` ";
          $result11 = mysqli_query($dbcnx,$query11);
            if(!$result11) {puterror2($result2['skin'],$TEXT['error-tbl5']); require_once "utils/bottom.php"; exit();}
              while($result_cicle = mysqli_fetch_array($result11))
                {
                 $chk_cicle = "<option value=".$result_cicle['cicle_id'].">".$result_cicle['cicle']."";
                 echo $chk_cicle;
                }
    ?>
    </select><input type=checkbox name=cicle_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-tip-izd']; ?>:</td><td>
    <select name="tip_izd_id">
    <?php
        $query12 = "SELECT * FROM `tbl_tip_izd` WHERE use_prog='1' ORDER BY `tip_izd` ";
          $result12 = mysqli_query($dbcnx,$query12);
            if(!$result12) {puterror2($result2['skin'],$TEXT['error-tbl15']); require_once "utils/bottom.php"; exit();}
              while($result_izd = mysqli_fetch_array($result12))
                {
                 $chk_izd = "<option value=".$result_izd['tip_izd_id'].">".$result_izd['tip_izd']."";
                 echo $chk_izd;
                }
    ?>
    </select><input type=checkbox name=tip_izd_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-bibl']; ?>:</td><td>
    <select name="bibl_id">
    <?php
        $query13 = "SELECT name, bibl_id FROM `tbl_biblioteka` ORDER BY `name` ";
          $result13 = mysqli_query($dbcnx,$query13);
            if(!$result13) {puterror2($result2['skin'],$TEXT['error-tbl2']); require_once "utils/bottom.php"; exit();}
              while($result_libr = mysqli_fetch_array($result13))
                {
                 $chk_libr = "<option value=".$result_libr['bibl_id'].">".$result_libr['name']."";
                 echo $chk_libr;
                }
    ?>
    </select><input type=checkbox name=bibl_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-zal']; ?>:</td><td>
    <select name="zal_id">
    <?php
        $query14 = "SELECT * FROM `tbl_zal` ORDER BY `zal` ";
          $result14 = mysqli_query($dbcnx,$query14);
            if(!$result14) {puterror2($result2['skin'],$TEXT['error-tbl11']); require_once "utils/bottom.php"; exit();}
              while($result_zal = mysqli_fetch_array($result14))
                {
                 $chk_zal = "<option value=".$result_zal['zal_id'].">".$result_zal['zal']."";
                 echo $chk_zal;
                }
    ?>
    </select><input type=checkbox name=zal_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-shkaf']; ?>:</td><td>
    <select name="shkaf_id">
    <?php
        $query15 = "SELECT * FROM `tbl_shkaf` ORDER BY `shkaf` ";
          $result15 = mysqli_query($dbcnx,$query15);
            if(!$result15) {puterror2($result2['skin'],$TEXT['error-tbl9']); require_once "utils/bottom.php"; exit();}
              while($result_shkaf = mysqli_fetch_array($result15))
                {
                 $chk_shkaf = "<option value=".$result_shkaf['shkaf_id'].">".$result_shkaf['shkaf']."";
                 echo $chk_shkaf;
                }
    ?>
    </select><input type=checkbox name=shkaf_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-polka']; ?>:</td><td>
    <select name="polka_id">
    <?php
        $query16 = "SELECT * FROM `tbl_polka` ORDER BY `polka` ";
          $result16 = mysqli_query($dbcnx,$query16);
            if(!$result16) {puterror2($result2['skin'],$TEXT['error-tbl8']); require_once "utils/bottom.php"; exit();}
              while($result_polka = mysqli_fetch_array($result16))
                {
                 $chk_polka = "<option value=".$result_polka['polka_id'].">".$result_polka['polka']."";
                 echo $chk_polka;
                }
    ?>
    </select><input type=checkbox name=polka_ch /></td></tr>
<tr><td class="inform"><?php echo $TEXT['menu-btn35']; ?>:</td><td>
    <select name="bl_id">
    <?php
        $query17 = "SELECT `bl_id`,`booklang` FROM `tbl_booklang` ORDER BY `position`, `booklang` ";
          $result17 = mysqli_query($dbcnx,$query17);
            if (!$result17) {puterror($result2['skin'],$TEXT['error-tbl23']); require_once "../utils/bottom_adm.php"; exit();}
              while($result_bl = mysqli_fetch_array($result17))
                {
                 $chk_bl = "<option value=".$result_bl['bl_id'].">".$result_bl['booklang']."";
                 echo $chk_bl;
                }
    ?>
    </select><input type=checkbox name=bl_ch /></td></tr>
</table>
</fieldset>
</td></tr>
<tr><td><input class="button2" type=submit value='<?php echo $button; ?>' /></td><td></td></tr>
</table>
</form>
<?php
  require_once "utils/bottom.php";
?>