<?php //$user=$_SESSION['MM_Username'];
if(isset($_GET['which'])){$which=$_GET['which'];} 
else $which='0';
$level="";
$level2="../../";
if(isset($_GET['level']))
{
	$level=$_GET['level'];
	if($level==9)
	{
		$level="./ajax/examples/";
		$level2="./";
	}
	if($level==8)
	{
		$level="../../../ajax/examples/";
		$level2="../../../";
	}
}
?>

<nav class="navbar navbar-toggleable-md navbar-inverse" style="background-color: #385b93;z-index:4">
      <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <a class="navbar-brand" href="#">
	  	  <?php 
	  switch ($which) {
    case 1:
        echo "<font style='font-size:14px'>Pacientes ".$actual_doc."</font>";
        break;
    case 2:
        echo "Todos Los Pacientes";
        break;
    case 3:
        echo "Archivos";
        break;
	case 4:
        echo "Fichas";
        break;
	default:
echo "Pondercom";
break;	
}
	  ?>

	  </a>

      <div class="collapse navbar-collapse" id="navbarsExampleDefault">
        <ul class="navbar-nav mr-auto">
          <li class="nav-item active">
            <a class="nav-link" href="<?php	echo $level;?>inicio.php">Inicio <span class="sr-only">(current)</span></a>
          </li>
		  <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Pacientes</a>
            <div class="dropdown-menu" aria-labelledby="dropdown01">
<a class="dropdown-item" href="<?php echo $level;?>pacientes.php?which=2">Todos</a>
			<?php 
$query_rs_todos1 = "SELECT * FROM `ingreso` WHERE `clinica` like '$clinica'  AND `aut` like '1'";
$rs_ingreso1 = mysqli_query($odonto_connection,$query_rs_todos1) or die(mysqli_error());
$row_rs_ingreso1 = mysqli_fetch_assoc($rs_ingreso1);
	  do{
	  echo '<a class="dropdown-item" href="'.$level.'pacientes.php?which=1&id_user='.$row_rs_ingreso1['id_user'].'">'.$row_rs_ingreso1['alias_doc'].'</a>';
	  
	  }
	  while ($row_rs_ingreso1 = mysqli_fetch_assoc($rs_ingreso1));
	  ?>
	        </div>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Turnos</a>
            <div class="dropdown-menu" aria-labelledby="dropdown01">
              <?php 
$query_rs_todos1 = "SELECT * FROM `ingreso` WHERE `clinica` like '$clinica' AND `aut` like '1'";
$rs_ingreso1 = mysqli_query($odonto_connection,$query_rs_todos1) or die(mysqli_error());
$row_rs_ingreso1 = mysqli_fetch_assoc($rs_ingreso1);
if($user != 'galdaberos'){
	  do{
	  echo '<a class="dropdown-item" href="'.$level.'../../dhtmlxscheduler/samples/01_initialization_loading/agen_doctor_solo.php?level=8&id_doc='.$row_rs_ingreso1['id_user'].'">'.$row_rs_ingreso1['alias_doc'].'</a>';
	  } while ($row_rs_ingreso1 = mysqli_fetch_assoc($rs_ingreso1));

echo '<a class="dropdown-item" href="'.$level.'../../dhtmlxscheduler/samples/01_initialization_loading/agen_doctores.php?level=8">Todos</a>';

}
else
{
	  echo '<a class="dropdown-item" href="'.$level.'../../dhtmlxscheduler/samples/01_initialization_loading/agen_doctor_solo.php?level=8&id_doc=206">Dr Aldabe Rosario</a>';
	
}
	  ?>
             
	<?php if($clinica=='clinica_17')
	{
		echo "<a class='dropdown-item' href='".$level."../../dhtmlxscheduler/samples/01_initialization_loading/agen_doctores_consult1_pepe.php?level=8&id_doc=46'>CONSULT 1</a>";
		echo "<a class='dropdown-item' href='".$level."../../dhtmlxscheduler/samples/01_initialization_loading/agen_doctores_consult2_pepe.php?level=8&id_doc=45'>CONSULT 2</a>";
	}
	if($clinica=='clinica_32')
	{
		echo "<a class='dropdown-item' href='".$level."../../dhtmlxscheduler/samples/01_initialization_loading/agen_doctores_consult1_mastria.php?level=8&id_doc=100'>CONSULT 1</a>";
	}
	if($clinica=='clinica_46')
	{
		echo "<a class='dropdown-item' href='".$level."../../dhtmlxscheduler/samples/01_initialization_loading/agen_doctores_consult1_pedro.php?level=8&id_doc=100'>KINESIO</a>";
	}
	?>

			</div>
          </li>
          <li class="nav-item">
            <a class="nav-link enable" href="<?php	
			if($level=='../../../ajax/examples/') echo $level."buscar.php";
			else echo $level."contra.php";
			?>"><?php if($level=='../../../ajax/examples/') echo "Buscar";
			else echo "Contraseña";?></a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="<?php	echo $level2;?>index.php?which=3&deslogueo=1">Salir</a>
          </li>
		<?php   if(isset($_GET['id_doc'])){$id_doc=$_GET['id_doc'];
$query_rs_todos1 = "SELECT doc FROM `ingreso` WHERE `id_user` like '$id_doc' ";
$rs_ingreso1 = mysqli_query($odonto_connection,$query_rs_todos1) or die(mysqli_error());
$row_rs_ingreso1 = mysqli_fetch_assoc($rs_ingreso1);
	echo "<li class='nav-item'><a class='nav-link' href='#'>Agenda ".$row_rs_ingreso1['doc']."</a></li>";
		}
		?>  		  
        </ul>
      </div>
<style>
marquee {
    font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
	font-size:22px;
	color:#CEE3F6;
	width:900px;
}
</style>
<!--	  <marquee>Feliz dia de la Madre...!!!...les desea el staff de pondercom...</marquee> -->
    </nav>