<?
session_start();
require_once('../connect/connect.php');
include_once('../lib/lib.php');
require('pdk.php');

$base_path="../";
$dir=dir_top();


if($_POST['form_viget'])
{
if($_POST['cat_']) $cat_=$_POST['cat_'];
if($_POST['rasp_']) $rasp_=$_POST['rasp_']; else $rasp_="v";
if($_POST['img_']) $img_=1; else $img_=0;
if($_POST['kol_']) $kol_=$_POST['kol_']; else $kol_=5;
if(!$cat_) $viget = "";
else
$viget='cat_'.$cat_.'-rasp_'.$rasp_.'-img_'.$img_.'-kol_'.$kol_.'.js';
	
if($viget)
	{
	$bas="../";
	$dir_viget=dir_top();
	include('viget.php');
	}
}



$titl="Виджеты";
require ('top.php'); 
if($viget)
echo '<textarea cols="80" rows="5">
<script language=JavaScript charset="UTF-8" src="'.$dir_viget.'informer/'.$viget.'"></script>
<script language=JavaScript charset="UTF-8" src="'.$dir_viget.'blok/viget_new.php?viget='.$viget.'"></script></textarea>';

?>
<form method="post" action="">
<table width="437" border="0">
	<tr>
		<td width="210">Категория</td>
		<td width="217">
		<select name="cat_">
			<option value="">НЕТ ВИДЖЕТА</option>
			<?
			$rv = mysql_query ("SELECT * FROM catalog WHERE typ='1'") or die(mysql_error());
			while($rrv = mysql_fetch_array($rv))
			{
			?>
			<option value="<? echo $rrv['id_catalog']; ?>" <? if ($rrv['id_catalog']==$cat_) echo "selected";?>><? echo $rrv['catalog']; ?></option>
			<? 
			} 
			?>	 
		</select>
		</td>
	</tr>
	<tr>
		<td>Расположение на странице</td>
		<td>
		<input name="rasp_" type="radio" value="v" <? if ($rasp_=="v") echo "checked";?>>
		вертикальное 
		<br>
		<input name="rasp_" type="radio" value="g" <? if ($rasp_=="g") echo "checked";?>>
		горизонтальное	  
		</td>
	</tr>
	<tr>
		<td>Только с фото </td>
		<td><input type="checkbox" name="img_" <? if ($img_==1) echo "checked";?>></td>
	</tr>
	<tr>
		<td>Количество блоков</td>
		<td><input type="text" name="kol_" size="3" value="<? echo $kol_; ?>"></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><input type="submit" class="submit" name="Submit" value="Установить">
			<input type="hidden" name="form_viget" value="1">
		</td>
	</tr>
</table>
</form>

<?
	if($viget)
		{
		?>
		<script type="text/javascript" src="<?=$base_path.'informer/'.$viget?>"></script>
		<?
		}


require('bottom.php');

?>
