<!--LINK rel="stylesheet" type="text/css" href="css/menu.css"/-->  
<script src="css/components/transition.js"></script>
<script src="css/components/dropdown.js"></script>
<script src="js/iframe.js"></script>
<style>
  .ui.menu {
    margin: 0.1em 0em;
  }
  .ui.menu:last-child {
    margin-bottom: 0px;
  }
  </style>

  <!--- Example Javascript -->
  <script>
  $(document)
    .ready(function() {
      $('.ui.menu .ui.dropdown').dropdown({
        on: 'hover'
      });
      $('.ui.menu a.item')
        .on('click', function() {
          $(this)
            .addClass('active')
            .siblings()
            .removeClass('active')
          ;
        })
      ;
    })
  ;
</script>
<?php
if ($_SESSION[gr] == 0){
    $sql = "SELECT * FROM tbl_menu WHERE kd_induk = 0 and is_group = 'Y' ORDER BY kd_menu";
} else {
    $sql = "SELECT DISTINCT a.* 
        FROM tbl_menu a
        join tbl_menu b on b.kd_induk = a.kd_menu
        join tbl_group_menu c ON c.kode_menu = b.kd_menu and c.kd_group_user = $_SESSION[gr]
        WHERE a.kd_induk = 0 and a.is_group = 'Y' 
        ORDER BY a.kd_menu";
}

@$r1 = mysql_query($sql);
@$n1 = mysql_num_rows($r1);
$nama_aktif = $_SESSION[nama_usr];
?>

<div class="ui inverted menu">
  <div class="active header item"><a href="index3.php">Home</a></div>
  <!--a class="item">Link</a-->
  <?php if (isset($_GET[p])){ ?>
  <?php while (@$row = mysql_fetch_array($r1)) { ?>
  <div class="ui dropdown item">
    <?php echo $row["nama_menu"]; ?>
    <i class="dropdown icon"></i>
    <div class="menu">
    	<?php 
        if ($_SESSION[gr] == 0){
            $sql2 = "SELECT a.* FROM tbl_menu a WHERE a.kd_induk = '$row[kd_menu]' ORDER BY a.kd_menu";
        } else {
            $sql2 = "SELECT a.* FROM tbl_menu a join tbl_group_menu b on b.kode_menu = a.kd_menu and b.kd_group_user = $_SESSION[gr] WHERE a.kd_induk = '$row[kd_menu]' ORDER BY a.kd_menu";
        }
        @$r2 = mysql_query($sql2);
        @$n2 = mysql_num_rows($r2);
        while (@$row2 = mysql_fetch_array($r2)) { ?>
      <a href="<?php echo $row2["url_menu"]; ?>" class="item"><?php echo $row2["nama_menu"]; ?> </a>
	 
      <?php } ?>
        
      <!--div class="divider"></div-->
    </div>
  </div>
  <?php } 
  
  	
  	} else {
		
  ?>
  <div class="item"><a href="index2.php?p=guest_inhouse">Active Menu</a></div>
  <?php } ?>
  <div class="right menu">
	<a href="<?php echo $SC."?p=change_pass";?>" class="active header item" ><b>Change Password</b></a>
    <div class="item">
      <font color="#ffffff">Login as : <?php echo $nama_aktif; ?></font>
      </div>
    </div>
    <a href="actions/logout.php" class="active header item" onClick="return confirm('Apakah yakin akan Log-Out?')"><b>Log-Out</b></a>
  </div>



