<?php
if(!defined('CONST_VALS')) {
 die('You cannot access this file directly!');
}
if($editor == '1') {
?>
<script src="scripts/ckeditor/ckeditor.js"></script>
<script src="scripts/ckeditor/config.js"></script>
<?php } ?>
<form action="edit.php" id="incformer" enctype="multipart/form-data" method="post">
<input type="hidden" name="newsid" value="<?php echo $newsid; ?>" />
<input name="curcat" value = "<?php echo $idblog; ?>" type="hidden" />
<input type="hidden" name="token" value="<?php echo $token; ?>" />
<div class="ten column marginTop">
<h2><?php echo $lang['234']; ?></h2>
</div>
<div class="ten marginTop">
<div class="five column">
<label><?php echo $lang['224']; ?></label>
<input type="text" class="input" name="title"  value="<?php echo $title; ?>" data-validation="length" data-validation-length="5-160" />
</div>
<div class="five column">
<?php echo $lang['225']; ?>:
<?php
$result = "SELECT * FROM categori ORDER by parent, catid ASC";
$an = $conn->Execute($result);
echo "<select name='idblog'>";
if(!$an)
 print $conn->ErrorMsg();
else
 while(!$an->EOF) {
  if($an->fields['catid'] == $idblog) {
   echo "<option value='".$an->fields['catid']."|".$an->fields['name']."|".$an->fields['seoname']."' selected> ".$an->fields['name']." </option>";
  } else {
   if($an->fields['cord'] == 0) {
    echo "<option value='".$an->fields['catid']."|".$an->fields['name']."|".$an->fields['seoname']."'> ".$an->fields['name']." </option>";
   } else {
    echo "<option value='".$an->fields['catid']."|".$an->fields['name']."|".$an->fields['seoname']."'> - - ".$an->fields['name']." </option>";
   }
  }
  $an->MoveNext();
 }
echo '</select>';
?>
</div>
</div>
<div class="ten column marginTop">
<label><?php echo $lang['226']; ?></label>
<input type="text" name="brief" class="input" value="<?php echo $brief; ?>" data-validation="length" data-validation-length="max500" data-validation-optional="true" />
</div>
<div class="ten">
<div class="two column">
<label><?php echo $lang['227']; ?></label>
<input type="file" name="image" />
</div>
<div class="two column">
<?php if($image == true) { ?>
<img width="184" height="112" src="<?php echo 'minthumb/'.$image; ?>">
<?php } ?>
</div>
<div class="two column">
<label><?php echo $lang['243']; ?></label>
<input type="checkbox" name="myoption" value="1" />
</div>
<div class="three column">
<label><?php echo $lang['233']; ?></label>
<?php if($main == 0) { ?>
<input type="radio" class="radios" name="main" id="0" value="0" checked="checked" />&nbsp;<?php echo $lang['228']; ?>
&nbsp;&nbsp;<input type="radio" class="radios" name="main" id="4" value="4" />&nbsp;<?php echo $lang['229']; ?>
<?php }
if($main == 4) { ?>
<input type="radio" class="radios" name="main" id="0" value="0" />&nbsp;<?php echo $lang['228']; ?>
&nbsp;&nbsp;<input type="radio" class="radios" name="main" id="4" value="4" checked="checked" />&nbsp;<?php echo $lang['229']; ?>
<?php } ?>
</div>
</div>
<div class="ten column marginTop">
<label><?php echo $lang['230']; ?>&nbsp;&nbsp;<font class="ckarea" style="display:none;"><?php echo $lang['231']; ?></font></label>
<textarea name="longdesc" id="longdesc" class="postarea" required="required"><?php echo stripslashes($longdesc); ?></textarea>
<?php if($editor == '1') { ?>
<script>
CKEDITOR.replace( 'longdesc' );
</script>
<?php } ?>
</div>
<div class="ten column marginTop">
<input class="blue medium button" type="submit" value="<?php echo $lang['130']; ?>" name="query" />
</div>
</form>
<script src="<?php echo $sitepath; ?>/scripts/jquery.form-validator.min.js"></script>
<script src="<?php echo $sitepath; ?>/scripts/jquery.are-you-sure.js"></script>
<script src="<?php echo $sitepath; ?>/scripts/ays-beforeunload-shim.js"></script>
<script>$(function() {$('#incformer').areYouSure({message: "The changes you made will be lost. Are you sure you want to leave this page?"});});</script>
<script>$.validate();</script>
<?php if($editor == '1') { ?>
<script>
$("form").submit(function(e) {
    var description = CKEDITOR.instances['longdesc'].getData().replace(/<[^>]*>/gi, '').length;
    if (!description) {
        $(".ckarea").show();
        return false;
    }
});
</script>
<?php } ?>