<div class="menucontainer">

<div class="navupbar navupbar1 bgrcolor1">
<div class="navupleft">
<a href="."><img src="img/logo<?php if ($type==3) { echo "-hotel"; }?>.png" alt="<?php echo $adminadmin ?>" title="<?php echo $adminadmin ?>"></a>
</div>
<div class="navupright">
<form name="formasearch" method="post" action="search.php">
<input type="text" name="search" placeholder="<?php echo $adminsearch ?>" size="24" class="forms1" required>
<input name="gosearch" type="image" src="img/search.png" value="submit" alt="<?php echo $adminsearch ?>" title="<?php echo $adminsearch ?>" class="buttonsearch bgrcolor3">
</form>
</div>

<div class="navupright navup1">
<a href="../" target="_blank"><span class="icon fa-link icstyleup"></span> <?php echo $domain ?></a>
<?php if ($domain) { ?>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://www.<?php echo $domain ?>/stats/" target="_blank" title="Statistics"><span class="icon fa-bar-chart icstyleup"></span></a>
<?php } ?>
</div>
<div class="cleared"></div>
</div> 

<!-- Fixed navbar -->

<div class="navbar">
<div class="navupbar">
 
<div class="divnavibutton">
<button type="button" class="navibutton" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
 <div class="cleared"></div>
</div>

<div class="nav-collapse collapse">
<ul class="nav">
<?php
$resultsc = $mysqli->query("SELECT id FROM sections");
$rowssections = mysqli_num_rows($resultsc);

$resultr = $mysqli->query("SELECT id FROM requests");
$rowsrequests = mysqli_num_rows($resultr);

$resultm = $mysqli->query("SELECT id FROM members");
$rowsmembers = mysqli_num_rows($resultm);
?>

<?php if ($user==0 AND $superuser==0) { ?>
<?php } else if ($user==1 OR $superuser==1) { ?>
<!--settings --> 
<li class="dropdown">
<a href="#" class="dropdown-toggle color3"><?php echo $adminsettings ?> <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu1" role="menu">
<li>
<a href="siteinfo.php"><span class="icon fa-cogs color3"></span> <?php echo $adminsiteinfo ?> &amp; <?php echo $adminfeatures ?></a>
&nbsp; &nbsp; 
<a href="system.php"><span class="icon fa-info-circle color2"></span> <?php echo $adminsystem ?></a>
</li>
<li class="divider"></li>
<li>
<a href="sitelayout.php"><span class="icon fa-desktop color3"></span> <?php echo $admincolors ?> & Layout</a>
</li>
<li class="divider"></li> 
<li>

<a href="list-paymethods.php"><span class="icon fa-credit-card color1"></span> Payment methods</a>
<div class="menuicons">
<a href="list-paymethods.php"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-paymethod.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a> 
</div>
</li>
<li class="divider"></li> 

<li>
<a href="list-lang.php"><span class="icon fa-language color1"></span> <?php echo $adminlangs ?></a> 
<div class="menuicons">
<a href="list-lang.php"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-lang.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a> 
</div>
</li>
<div class="cleared"></div>
<li>

<a href="list-langvarsa.php"><span class="icon fa-pencil color1"></span> <?php echo $adminlangvars ?> Webadmin</a>
<div class="menuicons">
<a href="list-langvarsa.php"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-langvar.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a> 
</div>
</li>
<li>

<a href="list-langvars.php"><span class="icon fa-pencil color1"></span> <?php echo $adminlangvars ?> Website</a>
<div class="menuicons">
<a href="list-langvars.php"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-langvar.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a> 
</div>
</li>
 <li class="divider"></li>
</ul>
</li>
 <!--end settings -->
<?php } ?>

<!--management --> 
<li class="dropdown">
<a href="#" class="dropdown-toggle color2"><?php echo $adminadmin ?> <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu1" role="menu">

<li>
<a href="wsinfo.php"><span class="icon fa-cogs color3"></span> <?php echo $adminsiteinfo ?></a>
</li>
<li class="divider"></li>

<?php if ($colors==1 OR $layout==1 OR $css==1) { ?>
<li>
<a href="layout.php"><span class="icon fa-desktop color3"></span> <?php if ($colors==1) { echo $admincolors." & "; } ?>Layout</a>
</li>
<li class="divider"></li>
<?php } ?>

<?php if ($banners==1) { ?>
<li>
<a href="list-banners.php"><span class="icon fa-flag color1"></span> Banners</a>
</li>
<li class="divider"></li>
<?php } ?>

<li>
<a href="list-categories.php?t=3"><span class="icon fa-paperclip color1"></span> <?php echo $adminsubmenu ?></a>
<div class="menuicons">
<a href="list-categories.php?t=3"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-categoryt.php?t=3"><img src="img/add.png" alt="<?php echo $adminaddcat ?>" title="<?php echo $adminaddcat ?>"></a> 
</div>
</li>
<li class="divider"></li>

<?php if ($seasons==1) { ?> 
<li>
<a href="list-seasons.php"><span class="icon fa-calendar-o color1"></span> <?php echo $adminseason ?></a>
<div class="menuicons">
<a href="list-seasons.php"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-season.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a> 
</div>
</li>
<?php } ?>

<?php if ($days==1) { ?> 
<li>
<a href="list-days.php"><span class="icon fa-calendar color1"></span> <?php echo $admindays ?></a>
<div class="menuicons">
<a href="list-days.php"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-day.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a> 
</div>
</li>
<?php } ?>
<?php if ($seasons==1 OR $days==1) { ?>
<li class="divider"></li>
<?php } ?>
 
<?php if ($links==1) { ?>
<li>
<a href="list-links.php"><span class="icon fa-share-alt color1"></span> Social media</a>
<div class="menuicons">
<a href="list-links.php"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-link.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a>
</div>
</li>
<li class="divider"></li>
<?php } ?>

<?php if ($rowsmembers>0 OR $type==2 OR $newsletter==1 OR $reviews==1 OR $reviewsitem==1 OR $reviewsinfo==1) { ?>
<li>
<a href="list-categories.php?t=4"><span class="icon fa-users color2"></span> <?php echo $adminmembers ?></a>
<div class="menuicons">
<a href="list-categories.php?t=4"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-member.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a>
</div>
</li>
<li class="divider"></li>
<?php } ?>

<?php if ($requests==1 OR $user==1 OR $superuser==1) { ?>
<li>
<a href="list-requests.php"><span class="icon fa-envelope-open-o color2"></span> <?php echo $adminrequests ?><?php if ($rowsrequests>0) {?> (<?php echo $rowsrequests ?>)<?php } ?></a>
</li>
<li class="divider"></li>
<?php } ?>
 
</ul>
</li>
 <!--end management --> 

<!--items -->
<?php
$resultcatlang1 = $mysqli->query("SELECT id FROM categories WHERE type<3 AND lang_id=$lang");
$rowscatlang1 = mysqli_num_rows($resultcatlang1);

$resultlid = $mysqli->query("SELECT id FROM lang WHERE active=1 AND id!=$lang ORDER BY priority");
$row = $resultlid->fetch_array(); 
$lid=$row['id'];
$resultcatlang = $mysqli->query("SELECT id FROM categories WHERE type<3 AND lang_id='$lid'");
$rowscatlang = mysqli_num_rows($resultcatlang);

if ($rowscatlang1<$rowscatlang) { 
$lang=$lid;
}

$rescats = $mysqli->query("SELECT COUNT(id) FROM categories WHERE insert_id>1 AND type<3 AND lang_id=$lang");
$rows = $rescats->fetch_row();
$rowscats = $rows[0];
?>
<?php 
$result50 = $mysqli->query("SELECT insert_id, name, publish, priority, type FROM categories WHERE level=1 AND type<3 AND lang_id=$lang ORDER BY priority");
while($row = $result50->fetch_array()) {
$ccount++;
$mcatid=$row['insert_id'];
$mcategory=$row['name'];
$mpublish=$row['publish'];
$mpriority=$row['priority'];
$mtypec=$row['type'];

$result50a = $mysqli->query("SELECT COUNT(id) FROM items WHERE category_id=$mcatid AND section_id=0 AND lang_id=$lang");
$rows = $result50a->fetch_row();
$itemsrowsa = $rows[0];
?>

<li class="dropdown">
<a href="list-items.php?catid=<?php echo $mcatid?>" <?php if ($mpublish=='no') { echo 'class="dropdown-toggle notpublish"'; } else { echo 'class="dropdown-toggle"'; }?>><?php echo $mcategory ?> 
<span class="caret<?php if ($mtypec==2) { echo " color1"; }?>"></span></a>
<ul class="dropdown-menu<?php if ($mcatid==1) { echo " dropdown-menu1"; }?>" role="menu">

<li>
<?php if ($mcatid>1) {?><span class="prioritystyle"><?php echo $mpriority?></span><?php } ?>

<?php if ($mtypec==0) {?>
<span class="icon fa-home"></span>
<?php } ?>
<?php if ($mtypec==1) {?>
<span class="icon fa-list"></span>
<?php } ?>
<?php if ($mtypec==2) {?>
<span class="icon fa-list-alt color1"></span>
<?php } ?>

<?php if ($itemsrowsa>0) {?>
<a href="list-items.php?catid=<?php echo $mcatid?>" <?php if ($mpublish=='no') { echo 'class="notpublish"'; } ?>><?php echo $mcategory ?> (<?php echo $itemsrowsa ?>)</a>
<?php } else { ?>
<span <?php if ($mpublish=='no') { echo 'class="notpublish"'; } ?>><?php echo $mcategory ?></span>
<?php } ?>
<div class="menuicons">
<a href="list-items.php?catid=<?php echo $mcatid?>"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-item.php?catid=<?php echo $mcatid?>"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a>
<a href="edit-category.php?id=<?php echo $mcatid?>"><img src="img/edit1.png" alt="<?php echo $adminedit ?> <?php echo $mcategory ?>" title="<?php echo $adminedit ?> <?php echo $mcategory ?>"></a>
<?php if ($mcatid>1) {?>
<a href="delete-category.php?id=<?php echo $mcatid?>"><img src="img/delete1.png" alt="<?php echo $admindelete ?> <?php echo $mcategory ?>" title="<?php echo $admindelete ?> <?php echo $mcategory ?>"></a>
<?php } ?>
</div>
</li>
<li class="divider1"></li>
<?php if ($mtypec==0) {?> 
<li class="libox"><a href="add-category.php" class="links1"><?php echo $adminaddcat ?> +</a></li>
<?php } ?>

<?php if ($mcatid>1) {?>
 
 <!--subcategories -->
<?php 
$result51 = $mysqli->query("SELECT insert_id, name, publish, priority, type FROM categories WHERE parent=$mcatid AND type<3 AND lang_id=$lang ORDER BY priority");
while($row = $result51->fetch_array()) {
$mcatid2=$row['insert_id'];
$mcategory2=$row['name'];
$mpublish2=$row['publish'];
$mpriority2=$row['priority'];
$mtypec2=$row['type'];

$result51a = $mysqli->query("SELECT COUNT(id) FROM items WHERE category_id=$mcatid2 AND section_id=0 AND lang_id=$lang");
$rows = $result51a->fetch_row();
$itemsrowsb = $rows[0];
?>
<li>
<span class="prioritystyle"><?php echo $mpriority2?></span>

<?php if ($mtypec2==1) {?>
<span class="icon fa-list"></span>
<?php } else { ?>
<span class="icon fa-list-alt color1"></span>
<?php } ?>

<?php if ($itemsrowsb>0) {?>
 <a href="list-items.php?catid=<?php echo $mcatid2?>" <?php if ($mpublish2=='no') { echo 'class="notpublish"'; } ?>><?php echo $mcategory2 ?> (<?php echo $itemsrowsb ?>)</a>
<?php } else { ?>
<span <?php if ($mpublish2=='no') { echo 'class="notpublish"'; } ?>><?php echo $mcategory2 ?></span>
<?php } ?>
<div class="menuicons">
<a href="list-items.php?catid=<?php echo $mcatid2?>"><img src="img/list.png" alt="<?php echo $adminlist ?>" title="<?php echo $adminlist ?>"></a>
<a href="add-item.php?catid=<?php echo $mcatid2?>"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a>
<a href="edit-category.php?id=<?php echo $mcatid2?>"><img src="img/edit1.png" alt="<?php echo $adminedit ?> <?php echo $mcategory2 ?>" title="<?php echo $adminedit ?> <?php echo $mcategory2 ?>"></a>
<a href="delete-category.php?id=<?php echo $mcatid2?>"><img src="img/delete1.png" alt="<?php echo $admindelete ?> <?php echo $mcategory2 ?>" title="<?php echo $admindelete ?> <?php echo $mcategory2 ?>"></a>
</div>
</li>
<div class="cleared"></div>
<?php } ?> 
<!--end subcategories-->
<li class="libox<?php if ($mtypec==2) { echo ' liboxblue'; } ?>"><a href="add-category.php?id=<?php echo $mcatid?>" class="links1"><?php echo $adminaddcat ?> +</a></li>

<?php if ($rowssections>0) {?>
<div class="margtop10">
<!--sections1 -->
<?php 
$result60 = $mysqli->query("SELECT insert_id, name, publish FROM sections WHERE level=1 AND lang_id=$lang ORDER BY priority");
while($row = $result60->fetch_array()) {
$msecid1=$row['insert_id'];
$msec1=$row['name'];

$resultsc11 = $mysqli->query("SELECT COUNT(id) FROM items WHERE category_id=$mcatid AND section_id=$msecid1 AND lang_id=$lang");
$rows = $resultsc11->fetch_row();
$itemsrows = $rows[0];

$resultsc112 = $mysqli->query("SELECT COUNT(id) FROM items WHERE (category_id=$mcatid OR category_id IN (SELECT insert_id FROM categories WHERE parent=$mcatid)) AND (section_id=$msecid1 OR section_id IN (SELECT insert_id FROM sections WHERE parent=$msecid1)) AND lang_id=$lang");
$rows = $resultsc112->fetch_row();
$itemsrowsall = $rows[0];
?>
<?php if ($itemsrowsall>0) {?>

<?php if ($itemsrows>0) {?>
<a href="list-items.php?catid=<?php echo $mcatid?>&amp;secid=<?php echo $msecid1?>" class="mlinks"><?php echo $mcategory ?> <?php echo $msec1 ?> (<?php echo $itemsrows ?>)</a>
<?php } else { ?>
<span class="mlinks"><?php echo $mcategory ?> <?php echo $msec1 ?></span>
<?php } ?>

<li>
<?php 
$result61 = $mysqli->query("SELECT insert_id, name, publish FROM sections WHERE parent=$msecid1 AND lang_id=$lang ORDER BY priority");
while($row = $result61->fetch_array()) {
$msecid2=$row['insert_id'];
$msec2=$row['name'];

$resultsc1 = $mysqli->query("SELECT COUNT(id) FROM items WHERE category_id=$mcatid AND section_id=$msecid2 AND lang_id=$lang");
$rows = $resultsc1->fetch_row();
$itemsrows1 = $rows[0];
?>

<?php if ($itemsrows1>0) {?>
<a href="list-items.php?catid=<?php echo $mcatid?>&amp;secid=<?php echo $msecid2?>" class="mlinks2">&raquo; <?php echo $mcategory ?> <?php echo $msec2 ?> (<?php echo $itemsrows1 ?>)</a> &nbsp; 
<?php } ?>

<?php } ?>
</li>

<!--sections1 subcategories -->
<?php 
$result62 = $mysqli->query("SELECT insert_id, name, publish, type FROM categories WHERE parent=$mcatid AND type<3 AND lang_id=$lang ORDER BY priority");
$itemscatrows = mysqli_num_rows($result62);
while($row = $result62->fetch_array()) {
$mcatid2=$row['insert_id'];
$mcategory2=$row['name'];
$mpublish2=$row['publish'];
$mtypec2=$row['type'];

$resultsc12 = $mysqli->query("SELECT COUNT(id) FROM items WHERE category_id=$mcatid2 AND section_id=$msecid1 AND lang_id=$lang");
$rows = $resultsc12->fetch_row();
$itemsrows12 = $rows[0];
?>
<li class="lineheight">
<?php if ($itemsrows12>0) {?>
<a href="list-items.php?catid=<?php echo $mcatid2?>&amp;secid=<?php echo $msecid1?>" class="mlinks1"><?php echo $mcategory2 ?> <?php echo $msec1 ?> (<?php echo $itemsrows12 ?>)</a>
<?php } ?>

<?php 
$result63 = $mysqli->query("SELECT insert_id, name, publish FROM sections WHERE parent=$msecid1 AND lang_id=$lang ORDER BY priority");
$sectionrows = mysqli_num_rows($result63);
while($row = $result63->fetch_array()) {
$msecid2=$row['insert_id'];
$msec2=$row['name'];

$resultsc2 = $mysqli->query("SELECT COUNT(id) FROM items WHERE category_id=$mcatid2 AND section_id=$msecid2 AND lang_id=$lang");
$rows = $resultsc2->fetch_row();
$itemsrows2 = $rows[0];
?> 
 
<?php if ($itemsrows2>0) {?>
<a href="list-items.php?catid=<?php echo $mcatid2?>&amp;secid=<?php echo $msecid2?>" class="mlinks2">&raquo; <?php echo $mcategory2 ?> <?php echo $msec2 ?> (<?php echo $itemsrows2 ?>)</a> &nbsp;
<?php } ?>

<?php } ?> 
</li> 

<?php } ?>
<!--end sections1 subcategories--> 
<div class="divider"></div>
<?php } ?>

<?php } ?>
<!--end sections1 -->
</div>
<?php } ?>
 
<?php } ?> 
</ul>
 </li>
 
<?php } ?>
<li><a href="add-category.php" title="<?php echo $adminaddcat ?>" class="dropdown-toggle color1"><span class="icon iconadd fa-plus"></span></a></li>
<!--end items --> 

<!--promote items --> 
<?php
$result = $mysqli->query("SELECT COUNT(id) FROM items WHERE promote LIKE '%1%' AND lang_id=$lang");
$rows = $result->fetch_row();
$rowspitems = $rows[0];
?>
<?php if($rowspitems>0) {?>
<li><a href="list-itemsp.php" class="dropdown-toggle color1"><?php echo $adminpromoted ?></a></li>
<?php } ?>
<!--end promote items --> 


<!--sections -->
<?php 
$result54 = $mysqli->query("SELECT insert_id, name, publish, priority FROM sections WHERE level=1 AND lang_id=$lang ORDER BY priority");
while($row = $result54->fetch_array()) {
$mcatid=$row['insert_id'];
$msection=$row['name'];
$mpublish=$row['publish'];
$mpriority=$row['priority'];
?>

<!--subsections -->
<li class="dropdown">
<a href="edit-section.php?id=<?php echo $mcatid?>" <?php if ($mpublish=='no') { echo 'class="dropdown-toggle notpublish"'; } else { echo 'class="dropdown-toggle"';}?>><?php echo $msection ?> <span class="caret color2"></span></a>
<ul class="dropdown-menu" role="menu">

<li>
<span class="prioritystyle"><?php echo $mpriority?></span>
<span class="icon fa-map-marker color2"></span>
<a href="edit-section.php?id=<?php echo $mcatid?>" <?php if ($mpublish=='no') { echo 'class="notpublish"'; } ?>><?php echo $msection ?></a>
<div class="menuicons">
<a href="edit-section.php?id=<?php echo $mcatid?>"><img src="img/edit1.png" alt="<?php echo $adminedit ?> <?php echo $msection ?>" title="<?php echo $adminedit ?> <?php echo $msection ?>"></a>
<a href="delete-section.php?id=<?php echo $mcatid?>"><img src="img/delete1.png" alt="<?php echo $admindelete ?> <?php echo $msection ?>" title="<?php echo $admindelete ?> <?php echo $msection ?>"></a>
</div>
</li>
 <li class="divider"></li>
<?php 
$result55 = $mysqli->query("SELECT insert_id, name, publish, priority FROM sections WHERE parent=$mcatid AND lang_id=$lang ORDER BY priority");
while($row = $result55->fetch_array()) {
$mcatid2=$row['insert_id'];
$msection2=$row['name'];
$mpublish2=$row['publish'];
$mpriority2=$row['priority'];
?>
<li>
<span class="prioritystyle"><?php echo $mpriority2?></span>
<span class="icon fa-map-marker color2"></span>
<a href="edit-section.php?id=<?php echo $mcatid2?>" <?php if ($mpublish2=='no') { echo 'class="notpublish"'; } ?>><?php echo $msection2 ?></a>
<div class="menuicons">
<a href="edit-section.php?id=<?php echo $mcatid2?>"><img src="img/edit1.png" alt="<?php echo $adminedit ?> <?php echo $msection2 ?>" title="<?php echo $adminedit ?> <?php echo $msection2 ?>"></a>
<a href="delete-section.php?id=<?php echo $mcatid2?>"><img src="img/delete1.png" alt="<?php echo $admindelete ?> <?php echo $msection2 ?>" title="<?php echo $admindelete ?> <?php echo $msection2 ?>"></a>
</div>
</li>
<div class="cleared"></div>
<?php } ?> 

<li class="libox liboxgreen"><a href="add-section.php?id=<?php echo $mcatid?>" class="links1"><?php echo $adminaddcat ?> +</a></li>
</ul>
 </li>
<!--end subsections-->

<?php } ?>
<?php if ($rowssections>0) {?>
<li><a href="add-section.php" title="<?php echo $adminaddcat ?>" class="dropdown-toggle color2"><span class="icon iconadd fa-plus"></span></a></li>
<?php } ?>
<!--end sections --> 

</ul>

</div>
</div>

 <div class="cleared"></div>
</div>

</div>