<link rel="stylesheet" type="text/css" href="css/component.css" />
<script src="js/modernizr.custom.js"></script>

<?php
	if(isset($_SESSION['username']))
	{
	$user=$_SESSION['username'];
	$userdept=$_SESSION['depart_id'];
	$userid=$_SESSION['admin_id'];
	$branch_id=$_SESSION['branch_id'];
	}else{
	header("location:index.php");
	}
	include_once("class/class.MySQL.php");
	$db	=new MySQL();

	
	$rowsg = mysql_query("SELECT e_post,e_id,departid FROM employee where e_id='$userid'");
    $rowsg = mysql_fetch_array($rowsg);
	$desigs = mysql_query("SELECT * FROM designation where desig_id='$rowsg[e_post]' and departs_id='$rowsg[departid]'");
    $desigs = mysql_fetch_array($desigs);
	//echo $desigs['desig_rights'];

?>
<script type="text/javascript" src="js/showpath.js" > 

</script>
<div class="logo"><a href="dashboard.php"><img src="images/logo.jpg" alt="" width="208" height="63" border="0" /></a></div>

<div class="welcome-name">Welcome <strong><?=$_SESSION['username'];?><input type="hidden" name="userid" class="userid" value="<?=$userid?>"  /><input type="hidden" name="depart_id" class="depart_id" value="<?=$userdept?>"  /><input type="hidden" name="user_name" class="user_name" value="<?=$user?>"  /><input type="hidden" name="sessionbranch_id" class="sessionbranch_id" value="<?=$branch_id?>"  /><input type="hidden" name="hiddenuser_type" id="hiddenuser_type" class=".hiddenuser_type" value="<?php echo $_SESSION['usertype'];?>" /></strong></div>

<div class="clear-float"></div>
<!-- MENU RESPONSIVE -->
<div class="main clearfix">
				<nav id="menu" class="nav">					
					<ul>
						<li>
							<a href="dashboard.php">
								<span class="icon">
									<i aria-hidden="true" class="icon-nav-1"></i>
								</span>
								<span>Home</span>
							</a>
						</li>
						<?php
						
						$db	=new MySQL();
						if($userid==1)
						{
						//echo "SELECT * FROM menu where  sort_order!=0 order by sort_order";
						$menu_list=$db->fetchQuery("SELECT * FROM menu where  sort_order!=0 order by sort_order");
						}
						else
						{
						//echo "SELECT * FROM menu where menu_id in(".$desigs['desig_rights'].") order by sort_order";
						$menu_list=$db->fetchQuery("SELECT * FROM menu where menu_id in(".$desigs['desig_rights'].") and sort_order!=0 order by sort_order");
						}
						$i=2;
						foreach($menu_list as $menu_items)
						{
							echo '<li>
								<a href="'.$menu_items['menu_link'].'">
									<span class="icon"> 
										<i aria-hidden="true" class="icon-nav-'.$i.'"></i>
									</span>
									<span>'.$menu_items['menu_name'].'</span>
								</a>
							</li>';
							$i++;
						}
						?>
						<li>
							<a href="logout.php">
								<span class="icon">
									<i aria-hidden="true" class="icon-nav-12"></i>
								</span>
								<span>Logout</span>
							</a>
						</li>
					</ul>
				</nav>
				<div class="clear-float"></div>

			</div>
<!-- /MENU RESPONSIVE -->		
<?php /*?><div class="menu-nav">
<ul>
<!--<li><a href="index.html">Home</a></li>
<li><a href="#">Inventory</a></li>
<li class="notification">55</li>-->
<li><a href="dashboard.php" title="Home"><img src="images/icon-hom.png" alt="" /><!--Notification--></a></li>
<?php
if($_SESSION['usertype'] != 'Subadmin')
{	
?>
<li><a href="employee-lists.php" title="Employee List"><img src="images/icon-profile.png" /><!--Report--></a></li>
<?php } ?>
<!--<li><a href="#" title="Hr"><img src="images/icon-hr.png" /></a></li>-->
<?php
if($_SESSION['usertype'] == 'Subadmin')
{	
?>
<li><a href="timesheet-individual.php?employees=<?=$userid?>" title="Attendance"><img src="images/attendance.png" alt="" border="0" /></a></li>
<?php } 
else{?>

<li><a href="timesheet-individual.php" title="Attendance"><img src="images/attendance.png" alt="" border="0" /></a></li>
<?php

}
?>
<li><a href="leave-request.php" title="Leave Apply & Tracking"><img src="images/leave.png" alt="" border="0" /></a></li>
<li><a href="payroll-management.php#paySalary" title="Salary"><img src="images/salary.png" alt="" border="0" /></a></li>
<li><a href="productivity-list.php" title="Productivity Tracking"><img src="images/productivity.png" alt="" border="0" /></a></li>
<?php
if($_SESSION['usertype'] != 'Subadmin')
{	
?>
<li><a href="recruitment-list.php" title="Recuirement"><img src="images/recuirement.png" alt="" border="0" /></a></li>
<?php

}
?>
<li><a href="performance-review-form.php" title="Performance Review"><img src="images/performanace.png" alt="" border="0" /></a></li>
<li><a href="circular-polcies.php" title="Circulars , Policies & Forms"><img src="images/circular.png" alt="" border="0" /></a></li>
<?php
if($_SESSION['usertype'] != 'Subadmin')
{	
?>
<li><a href="reporting-time.php" title="Reporting Timing"><img src="images/reporting-time.png" alt="" border="0" /></a></li>
<li><a href="master-lists.php#Branch" title="Settings"><img src="images/icon-settings.png" alt="" border="0" /></a></li>
<?php } ?>
<li style="float:right;"><a href="logout.php" title="Log Out"><img src="images/icon-logout.png" alt="" border="0" /></a></li>
</ul>
</div><?php */?>
<div class="clear-float"></div>

<script>
			//  The function to change the class
			var changeClass = function (r,className1,className2) {
				var regex = new RegExp("(?:^|\\s+)" + className1 + "(?:\\s+|$)");
				if( regex.test(r.className) ) {
					r.className = r.className.replace(regex,' '+className2+' ');
			    }
			    else{
					r.className = r.className.replace(new RegExp("(?:^|\\s+)" + className2 + "(?:\\s+|$)"),' '+className1+' ');
			    }
			    return r.className;
			};	

			//  Creating our button in JS for smaller screens
			var menuElements = document.getElementById('menu');
			menuElements.insertAdjacentHTML('afterBegin','<button type="button" id="menutoggle" class="navtoogle" aria-hidden="true"><i aria-hidden="true" class="icon-menu"> </i> Menu</button>');

			//  Toggle the class on click to show / hide the menu
			document.getElementById('menutoggle').onclick = function() {
				changeClass(this, 'navtoogle active', 'navtoogle');
			}

			
			document.onclick = function(e) {
				var mobileButton = document.getElementById('menutoggle'),
					buttonStyle =  mobileButton.currentStyle ? mobileButton.currentStyle.display : getComputedStyle(mobileButton, null).display;

				if(buttonStyle === 'block' && e.target !== mobileButton && new RegExp(' ' + 'active' + ' ').test(' ' + mobileButton.className + ' ')) {
					changeClass(mobileButton, 'navtoogle active', 'navtoogle');
				}
			}
		</script>