<?php require_once('../Connections/netboxManagerMitru.php'); ?>
<?php
////////////PARAMETROS //////////
$bw_standard=7000; //kbps
$bw_premium=22000; //kbps
$ip_this="192.168.21.105";

?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {
  $insertSQL = sprintf("INSERT INTO hab_check (hab_bw, hab_nombre, hab_apellido, hab_email, hab_idioma, hab_nrohab) VALUES (%s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['hab_bw'], "text"),
                       GetSQLValueString($_POST['hab_nombre'], "text"),
                       GetSQLValueString(genusername($_POST['hab_apellido']), "text"),
                       GetSQLValueString($_POST['hab_email'], "text"),
                       GetSQLValueString($_POST['hab_idioma'], "text"),
                       GetSQLValueString($_POST['hab_nrohab'], "int"));

  mysql_select_db($database_netboxManagerMitru, $netboxManagerMitru);
  //$Result1 = mysql_query($insertSQL, $netboxManagerMitru) or die(mysql_error());
  $url1="http://$ip_this/netbox/main/scripts/checkin.php?";
  $url2="usuario=NetboxMitru&token=W0OKjdJUH1j5InOsw9YNGH72DzneSqMm&nombre=".urlencode($_POST['hab_nombre'])."&apellido=".urlencode($_POST['hab_apellido'])."&hab=".$_POST['hab_nrohab']."&email=".$_POST['hab_email']."&celular=&idioma=".$_POST['hab_idioma'];
  $urlget=file_get_contents($url1.$url2);
  $insertGoTo = "estadoHuesped.php?newhab=".$_POST['hab_nrohab'];
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
  //echo($urlget);
}

mysql_select_db($database_netboxManagerMitru, $netboxManagerMitru);
$query_EstadoHabitaciones = "SELECT * FROM hab_check WHERE hab_activo = 1";
$EstadoHabitaciones = mysql_query($query_EstadoHabitaciones, $netboxManagerMitru) or die(mysql_error());
$row_EstadoHabitaciones = mysql_fetch_assoc($EstadoHabitaciones);
$totalRows_EstadoHabitaciones = mysql_num_rows($EstadoHabitaciones);
?>
<?
$seccion="funcionesHuesped";
$opcion="estado"
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>netbox Manager | Hotel Mitru Sur</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- Bootstrap 3.3.2 -->
	<link href="../SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css">
	<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
	<?php include("linksCSS.php"); ?>
  <script src="../SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
  <script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
  <script language="javascript">
function setBwPremium(hab)
	{
	var xhttp = new XMLHttpRequest();
	//xhttp.timeout = 3000;
	xhttp.onreadystatechange = function() {
		if (this.readyState == 4 && this.status == 200) {
		document.getElementById("bwdata"+hab).innerHTML="PREMIUM<i class=\"fa fa-fw fa-wifi\"></i>";
		document.getElementById("bwdata"+hab).classList.remove('text-aqua');
		document.getElementById("bwdata"+hab).classList.add('text-fuchsia');
		}
	};
	xhttp.open("GET", "setBwPremium.php?hab="+hab+"&bw=<?= $bw_premium ?>", true);
	xhttp.send();
	var resp=xhttp.responseText;
	document.getElementById("").classList.add('MyClass');
	}
	
function setBwStandard(hab)
	{
	var xhttp = new XMLHttpRequest();
	//xhttp.timeout = 3000;
	xhttp.onreadystatechange = function() {
		if (this.readyState == 4 && this.status == 200) {
		document.getElementById("bwdata"+hab).innerHTML="STANDARD<i class=\"fa fa-fw fa-wifi\"></i>";
		document.getElementById("bwdata"+hab).classList.remove('text-fuchsia');
		document.getElementById("bwdata"+hab).classList.add('text-aqua');
		}
	};
	xhttp.open("GET", "setBwStandard.php?hab="+hab+"&bw=<?= $bw_standard ?>", true);
	xhttp.send();
	var resp=xhttp.responseText;
	}

function CheckOutHab(hab)
	{
	X=confirm("Está seguro de hacer Checkout a la Habitación "+hab+"?\n\nEsta acción desabilitará las llamadas telefónicas y desconectará de Internet todos los dispositivos asignados a la habitación.");
	if (X) CheckOutHabConf(hab);
	}
function CheckOutHabConf(hab)
	{
	var xhttp = new XMLHttpRequest();
	//xhttp.timeout = 3000;
	xhttp.onreadystatechange = function() {
		if (this.readyState == 4 && this.status == 200) {
		document.getElementById("box_"+hab).innerHTML="<div class='info-box'><span class='info-box-icon bg-red-gradient'>"+hab+"</span><div class='info-box-content bg-lgray'><span class='info-box-text'>&nbsp;</span><span class='info-box-text'>&nbsp;</span><span class='info-box-text text-right text-fuchsia'>&nbsp;</span><span class='info-box-text text-red'><i class='fa fa-fw fa-close'></i>SIN HUESPED</span></div></div>";
		}
	};
	xhttp.open("GET", "scripts/checkout.php?usuario=NetboxMitru&token=W0OKjdJUH1j5InOsw9YNGH72DzneSqMm&hab="+hab, true);
	xhttp.send();
	var resp=xhttp.responseText;	
	}
  </script>
  </head>
<body class="skin-blue">
	<div class="wrapper">
      <?php include("header.php"); ?>
      <!-- Left side column. contains the logo and sidebar -->
      <?php include("sidebar.php");  ?>
      <!-- Right side column. Contains the navbar and content of the page -->
		<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header no-margin">
        <h1 class="text-center">
            Estado Huéspedes</h1>
        </section>
        

        <!-- Content Header (Page header) -->
        <section class="content-header no-margin">
        	<div class="row">
            	<div class="col-md-12">
            		<div class="box-body">
                 		<div class="box-group" id="accordion">
                    	<!-- we are adding the .panel class so bootstrap.js collapse plugin detects it -->           
                    		<div class="panel box box-danger">
                      			<div class="box-header with-border">
                            	<h4 class="box-title">
                          		<a data-toggle="collapse" data-parent="#accordion" href="#collapseADD" class="danger">
                           		Checkin Huepedes 
                          		</a>
                                </h4>
							</div>
                      		<form name="form" action="<?php echo $editFormAction; ?>" method="POST">
                			<div id="collapseADD" class="panel-collapse collapse out">
                				<div class="box-body">  
                        			<div class="row">
                      					<div class="col-xs-12 col-md-4 col-lg-4">
                      					<span class="input-group-addon"><i class="fa fa-building"></i>&nbsp;Habitación</span><span id="spryselect1">
                      					<select name="hab_nrohab" class="form-control" id="hab_nrohab">
                      					  <option value="0">&nbsp;NRO. DE HABITACIÓN...</option>
                      					  <? 	for ($piso=2; $piso<=8; $piso++)
												{
												for ($hab=1;$hab<=8; $hab++)
													{
													$nrohab=($piso*100)+$hab;
													$habdet[$nrohab]["estado"]=0;
													$habdet[$nrohab]["cantpax"]=0;
													if ($piso==2 && $hab>1) continue;
													if (($piso==7 || $piso==8) && $hab>6) continue;
														?>
                      					  <option value="<?= $nrohab ?>">&nbsp;HABITACIÓN
                      					    <?= $nrohab ?>
                   					      </option>
                      					  <?
									
													}
												}
														?>
                   					    </select>
                      					<span class="selectInvalidMsg">Seleccione un elemento válido.</span><span class="selectRequiredMsg">Seleccione un elemento.</span></span></div>
										
                                        <div class="col-xs-12 col-md-4 col-lg-4">
                      					<span class="input-group-addon"><i class="fa fa-globe"></i>&nbsp;Idioma</span><span id="spryselect2">
                      					<select name="hab_idioma" class="form-control" id="hab_idioma">
                      					  <option value="0">&nbsp;IDIOMA...</option>
                      					  <option value="es">&nbsp;Español</option>
                      					  <option value="en">&nbsp;Inglés</option>
                   					    </select>
                      					<span class="selectInvalidMsg">Seleccione un elemento válido.</span><span class="selectRequiredMsg">Seleccione un elemento.</span>></span></div>
                                        
                                        <div class="col-xs-12 col-md-4 col-lg-4">
    <div class="form-group">
                <label>Minimal</label>
                <select class="form-control select2" style="width: 100%;">
                  <option selected="selected">Alabama</option>
                  <option>Alaska</option>
                  <option>California</option>
                  <option>Delaware</option>
                  <option>Tennessee</option>
                  <option>Texas</option>
                  <option>Washington</option>
                </select>
              </div>
</div>
									</div>
								</div>
								<div class="box-body">
                  					<div class="row">
                    					<div class="col-xs-12 col-md-4 col-lg-4">
                      					<span class="input-group-addon"><i class="fa fa-user"></i></span><span id="sprytextfield1">
                                        <input name="hab_nombre" type="text" class="form-control" id="hab_nombre" placeholder="Nombre">
                                        <span class="textfieldRequiredMsg">Se necesita un valor.</span><span class="textfieldMinCharsMsg">No se cumple el mínimo de caracteres requerido.</span></span></div>
                    					<div class="col-xs-12 col-md-4 col-lg-4">
                      					<span class="input-group-addon"><i class="fa fa-user"></i></span><span id="sprytextfield2">
                                        <input name="hab_apellido" type="text" class="form-control" id="hab_apellido" placeholder="Apellido">
                                        <span class="textfieldRequiredMsg">Se necesita un valor.</span><span class="textfieldMinCharsMsg">No se cumple el mínimo de caracteres requerido.</span></span></div>
                    					<div class="col-xs-12 col-md-4 col-lg-4">
                      					<span class="input-group-addon"><i class="fa fa-envelope"></i></span><span id="sprytextfield3">
                                        <input name="hab_email" type="text" class="form-control" id="hab_email" placeholder="Email">
<span class="textfieldInvalidFormatMsg">Formato no válido.</span></span></div>
                  					</div>   
                    			</div>
                                
								<div class="box-body">
                  					<div class="row">
                                        <div class="col-xs-12 col-md-12 col-lg-12">
                      					<button type="submit" class="btn btn-primary">Check-In</button>
                    					</div>
                  					</div>   
                    			</div>
                			</div>
                			<input type="hidden" name="MM_insert" value="form">
                    		<input name="hab_bw" type="hidden" id="hab_bw" value="STANDARD">
                     		</form>
						</div>
					</div><!-- /.box -->
				</div><!-- /.col -->
			</div><!-- /.row -->
          <!-- FIN COLLAPSABLE  -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="16%" rowspan="2" valign="middle" bgcolor="#CCCCCC"><span class="text-right">&nbsp;&nbsp;&nbsp;Ocupacion Habitaciones:&nbsp;&nbsp;</span></td>
    <td bgcolor="#CCCCCC">&nbsp;</td>
    <td width="16%" rowspan="2" bgcolor="#CCCCCC"></td>
  </tr>
  <tr>
    <td width="68%" bgcolor="#CCCCCC"><div class="progress progress-xs progress-striped active">
      <div class="progress-bar" style="width: 0%" id="progbar"></div>
    </div></td>
    </tr>
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
</table>

        </section>
        <!-- Main content -->
        <section class="content">
        
        
        
        <div class="row">
            <div class="col-md-12">
              <div class="box box-solid">
                <div class="box-header with-border">
                </div><!-- /.box-header -->
                <div class="box-body">
                  <div class="box-group" id="accordion">
                    <!-- we are adding the .panel class so bootstrap.js collapse plugin detects it -->
<?php
						for ($piso=2; $piso<=8; $piso++)
								{
								for ($hab=1;$hab<=7; $hab++)
									{
									if ($piso==2 && $hab>1) continue;
									if (($piso==7 || $piso==8) && $hab>6) continue;
									$nrohab=($piso*100)+$hab;
									$datos_hab="SELECT * FROM hab_check WHERE hab_nrohab=$nrohab and hab_activo=1";
									$datos_habx=mysql_query($datos_hab);
									$cantpax=0;
									$nropax=mysql_num_rows($datos_habx);
									if ($nropax>0)
									while ($habs = mysql_fetch_assoc($datos_habx))
										{
										$habdet[$nrohab]["estado"]=1;
										$habdet[$nrohab]["bw"]=$habs["hab_bw"];
										$habdet[$nrohab]["pax"][$cantpax]=strtoupper($habs["hab_apellido"]).", ".ucwords(strtolower($habs["hab_nombre"]));
										$cantpax++;
										}
								    
									
									}
								}

/* $habdet[101]["estado"]=1;
$habdet[101]['h1']='ATIX'; 
$habdet[101]['bw']='STANDARD'; 
$habdet[102]["estado"]=0;
$habdet[103]["estado"]=1;
$habdet[103]['h1']='MAZUCA'; 
$habdet[103]['bw']='PREMIUM'; 
$habdet[104]["estado"]=1;
$habdet[104]['h1']='ATIX'; 
$habdet[104]['bw']='STANDARD'; 
$habdet[105]["estado"]=1;
$habdet[105]['h1']='NOBREGA'; 
$habdet[105]['bw']='STANDARD'; 
$habdet[106]["estado"]=0;
$habdet[107]["estado"]=1;
$habdet[107]['h1']='LIANG'; 
$habdet[107]['bw']='PREMIUM'; 
$habdet[107]['h2']='YUE'; 
$habdet[108]["estado"]=1;
$habdet[108]['h1']='ATIX'; 
$habdet[108]['bw']='STANDARD'; 
$habdet[201]["estado"]=1;
$habdet[201]['h1']='BROWN'; 
$habdet[201]['bw']='PREMIUM'; 
$habdet[202]["estado"]=1;
$habdet[202]['h1']='CANEDO'; 
$habdet[202]['bw']='STANDARD'; 
$habdet[203]["estado"]=1;
$habdet[203]['h1']='ATIX'; 
$habdet[203]['bw']='PREMIUM'; 
$habdet[204]["estado"]=1;
$habdet[204]['h1']='PENA'; 
$habdet[204]['bw']='STANDARD'; 
$habdet[205]["estado"]=1;
$habdet[205]['h1']='VELA'; 
$habdet[205]['bw']='PREMIUM'; 
$habdet[206]["estado"]=0;
$habdet[207]["estado"]=1;
$habdet[207]['h1']='VICINTIN'; 
$habdet[207]['bw']='PREMIUM'; 
$habdet[208]["estado"]=1;
$habdet[208]['h1']='TAVOLARA'; 
$habdet[208]['bw']='STANDARD'; 
$habdet[301]["estado"]=1;
$habdet[301]['h1']='ATIX'; 
$habdet[301]['bw']='STANDARD'; 
$habdet[302]["estado"]=1;
$habdet[302]['h1']='RIVERA'; 
$habdet[302]['bw']='PREMIUM'; 
$habdet[303]["estado"]=1;
$habdet[303]['h1']='ATIX'; 
$habdet[303]['bw']='STANDARD'; 
$habdet[303]['h2']='ATIX'; 
$habdet[304]["estado"]=1;
$habdet[304]['h1']='DOBBINS'; 
$habdet[304]['bw']='STANDARD'; 
$habdet[305]["estado"]=0;
$habdet[306]["estado"]=0;
$habdet[307]["estado"]=1;
$habdet[307]['h1']='MACHADO'; 
$habdet[307]['bw']='STANDARD'; 
$habdet[308]["estado"]=1;
$habdet[308]['h1']='VELASCO'; 
$habdet[308]['bw']='PREMIUM'; 
$habdet[308]['h2']='VELASCO'; 
$habdet[401]["estado"]=0;
$habdet[402]["estado"]=1;
$habdet[402]['h1']='CLARK'; 
$habdet[402]['bw']='STANDARD'; 
$habdet[403]["estado"]=1;
$habdet[403]['h1']='XIE'; 
$habdet[403]['bw']='STANDARD'; 
$habdet[404]["estado"]=1;
$habdet[404]['h1']='GENG'; 
$habdet[404]['bw']='STANDARD'; 
$habdet[405]["estado"]=1;
$habdet[405]['h1']='XU'; 
$habdet[405]['bw']='STANDARD'; 
$habdet[406]["estado"]=1;
$habdet[406]['h1']='VROMAN'; 
$habdet[406]['bw']='STANDARD'; 
$habdet[407]["estado"]=1;
$habdet[407]['h1']='GARCIA'; 
$habdet[407]['bw']='PREMIUM'; 
$habdet[407]['h2']='QIANG'; 
$habdet[408]["estado"]=1;
$habdet[408]['h1']='TRIGO'; 
$habdet[408]['bw']='STANDARD'; 
$habdet[408]['h2']='TRIGO';  
$habdet[501]["estado"]=0;
$habdet[502]["estado"]=1;
$habdet[502]['h1']='SCHLINK'; 
$habdet[502]['bw']='STANDARD'; 
$habdet[503]["estado"]=1;
$habdet[503]['h1']='YANG'; 
$habdet[503]['bw']='STANDARD'; 
$habdet[504]["estado"]=1;
$habdet[504]['h1']='ATIX'; 
$habdet[504]['bw']='STANDARD'; 
$habdet[505]["estado"]=1;
$habdet[505]['h1']='ZEGADA'; 
$habdet[505]['bw']='STANDARD'; 
$habdet[506]["estado"]=1;
$habdet[506]['h1']='CHAN'; 
$habdet[506]['bw']='PREMIUM'; 
$habdet[507]["estado"]=1;
$habdet[507]['h1']='JUSTO'; 
$habdet[507]['bw']='STANDARD'; 
$habdet[508]["estado"]=1;
$habdet[508]['h1']='JIA'; 
$habdet[508]['bw']='PREMIUM'; 
$habdet[508]['h2']='MELTON'; 
$habdet[601]["estado"]=0;
$habdet[602]["estado"]=0;
$habdet[603]["estado"]=0;
$habdet[604]["estado"]=1;
$habdet[604]['h1']='CHAIN'; 
$habdet[604]['bw']='STANDARD'; 
$habdet[605]["estado"]=0;
$habdet[606]["estado"]=0;
$habdet[607]["estado"]=0;
$habdet[608]["estado"]=1;
$habdet[608]['h1']='ATIX'; 
$habdet[608]['bw']='STANDARD';  */
?>


<?php 
$totalhabs=0;
$habsocup=0;
for ($piso=2; $piso<=8; $piso++)
				{
					?>                    
                    
                    <div class="panel box box-primary">
                      <div class="box-header with-border">
                        <h4 class="box-title">
                          <a data-toggle="collapse" data-parent="#accordion" href="#collapse<?= $piso ?>">
                           PISO <?= $piso ?>
                          </a>
                        </h4>
                      </div>
                      <div id="collapse<?= $piso ?>" class="panel-collapse collapse out">
                        <div class="box-body">
                          
          <!-- HABITACIONES PISO -->
<? 





$n=($piso*100)+1;
for($j=1;$j<=2;$j++) { ?>
		  <div class="row">
          <? for($i=1;$i<=4; $i++) { 
		  $hab=$n++;
		  if ($hab=="202" || $hab=="203" || $hab=="204" || $hab=="205" || $hab=="206" || $hab=="207" || $hab=="208" || $hab=="308" || $hab=="408" || $hab=="508" || $hab=="608" || $hab=="707" || $hab=="708" || $hab=="807" || $hab=="808") $oculto=true;
			else
				{
				$oculto=false;
				$totalhabs++;
				}
			$vis="";
			if ($oculto) $vis=" style=\"display:none;\" ";
           if ($habdet[$hab]["estado"]==1)
		   	{
			if (!$oculto) $habsocup++;
			?>
          <!-- INICIO BOX INDIVIDUAL -->
            <div class="col-md-3 col-sm-6 col-xs-12" <?= $vis ?>  id="box_<?= $hab ?>">
              <div class="info-box">
                <span class="info-box-icon bg-green"><?= $hab ?></span>
                <div class="info-box-content bg-lgray">
                  
					
                 <? 
				 for ($hh=0; $hh<=5; $hh++)
				 	{
				 	if (isset($habdet[$hab]["pax"][$hh])) { ?> <span class="info-box-text"><i class="fa fa-fw fa-user"></i><?= $habdet[$hab]["pax"][$hh] ?>

                    </span> <?php }
					}
					?>

				  <? if ($habdet[$hab]["bw"]=="PREMIUM") { $bwprem=true; $prem="text-fuchsia"; } ?>
                  <? if ($habdet[$hab]["bw"]=="STANDARD") { $bwprem=false; $prem="text-aqua"; } ?>
                  <span id="bwdata<?= $hab ?>" class="info-box-text text-right  <?= $prem ?>"><?= $habdet[$hab]["bw"] ?><i class="fa fa-fw fa-wifi"></i></span>
                  <span>
                  <div class="btn-group">
                      <button type="button" class="btn btn-success">Acciones</button>
                      <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">
                        <span class="caret"></span>
                        <span class="sr-only"></span>
                      </button>
                      <ul class="dropdown-menu" role="menu">
                        <li><a href="javascript:setBwStandard(<?= $hab ?>)"><i class="fa fa-fw fa-wifi"></i>Ancho de Banda STANDARD</a></li>
                        <li><a href="javascript:setBwPremium(<?= $hab ?>)"><i class="fa fa-fw fa-wifi"></i>Ancho de Banda <strong>PREMIUM</strong></a></li>
                        <li><a href="#"><i class="fa fa-fw fa-phone"></i>Reiniciar Teléfono</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:CheckOutHab(<?= $hab ?>);"><i class="fa fa-fw fa-close"></i>Checkout</a></li>
                      </ul>
                     
                    </div>
				</span>
                    
                </div><!-- /.info-box-content -->
             
              </div><!-- /.info-box -->
              
            </div><!-- /.col -->
            
            <!-- FIN BOX CON HUESPED -->
            <?
			}
			else
			{
			?>
             <!-- INICIO BOX VACIO -->
            
            <div class="col-md-3 col-sm-6 col-xs-12"  <?= $vis ?>   id="box_<?= $hab ?>" >
              <div class="info-box">
                <span class="info-box-icon bg-red-gradient"><?= $hab ?></span>
                <div class="info-box-content bg-lgray">
                  
                  <span class="info-box-text">&nbsp;</span>
                  <span class="info-box-text">&nbsp;</span>

                  <span class="info-box-text text-right text-fuchsia">&nbsp;</span>
                   <span class="info-box-text text-red"><i class="fa fa-fw fa-close"></i>SIN HUESPED</span>
                  
                  
                </div><!-- /.info-box-content -->
              </div><!-- /.info-box -->
            </div><!-- /.col -->
            
            <?
			}
			?>
            
            <!-- FIN BOX INDIVIDUAL -->
            
            
            <? if ($i==4 || $i==2) { ?><!-- fix for small devices only -->
            <div class="clearfix visible-sm-block"></div>
            <? } ?>
		<? } ?>
          </div><!-- /.row -->
      <? } ?>
          <!-- FIN FILAS HABITACIONES -->
                        </div>
                      </div>
                    </div>
                    
                    
            <? } 
$porc=round(($habsocup/$totalhabs)*100);
if ($porc>0) $progcolor="progress-bar-aqua";
if ($porc>18) $progcolor="progress-bar-success";
if ($porc>55) $progcolor="progress-bar-warning";
if ($porc>80) $progcolor="progress-bar-danger";
?>        
                    
<script language="javascript">
document.getElementById("progbar").style.width="<?= $porc ?>%";
document.getElementById("progbar").classList.add("<?= $progcolor ?>");
</script>               
                  
                  </div>
                </div><!-- /.box-body -->    
              </div><!-- /.box -->
            </div><!-- /.col -->
          </div><!-- /.row -->
          <!-- FIN COLLAPSABLE  -->
<?php
echo("Habs Ocup: ".$habsocup."<br>".
"Total Habs: ".$totalhabs."<br>".
"Porcentaje: ".$porc); ?>
        </section><!-- /.content -->
      </div><!-- /.content-wrapper -->
	 <?php include("footer.php"); ?>
    </div><!-- ./wrapper -->

    <!-- jQuery 2.1.3 -->
    <script src="../plugins/jQuery/jQuery-2.1.3.min.js"></script>
    <!-- Bootstrap 3.3.2 JS -->
    <script src="../bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <!-- Select 2 -->
    <script src="../plugins/select2/select2.full.min.js"></script>
    <!-- Slimscroll -->
    <script src="../plugins/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script>
    <!-- FastClick -->
    <script src='../plugins/fastclick/fastclick.min.js'></script>
    <!-- AdminLTE App -->
    <script src="../dist/js/adminlte.js" type="text/javascript"></script>    
    <!-- Bootstrap WYSIHTML5 -->
    <script src="../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>
    <!-- iCheck -->
    <script src="../plugins/iCheck/icheck.min.js" type="text/javascript"></script>
    <!-- Page script -->
    <script type="text/javascript">
$(function () {

        "use strict";

        //iCheck for checkbox and radio inputs
        $('input[type="checkbox"]').iCheck({
          checkboxClass: 'icheckbox_minimal-blue',
          radioClass: 'iradio_minimal-blue'
        });

        //When unchecking the checkbox
        $("#check-all").on('ifUnchecked', function (event) {
          //Uncheck all checkboxes
          $("input[type='checkbox']", ".table-mailbox").iCheck("uncheck");
        });
        //When checking the checkbox
        $("#check-all").on('ifChecked', function (event) {
          //Check all checkboxes
          $("input[type='checkbox']", ".table-mailbox").iCheck("check");
        });
        //Handle starring for glyphicon and font awesome
        $(".fa-star, .fa-star-o, .glyphicon-star, .glyphicon-star-empty").click(function (e) {
          e.preventDefault();
          //detect type
          var glyph = $(this).hasClass("glyphicon");
          var fa = $(this).hasClass("fa");

          //Switch states
          if (glyph) {
            $(this).toggleClass("glyphicon-star");
            $(this).toggleClass("glyphicon-star-empty");
          }

          if (fa) {
            $(this).toggleClass("fa-star");
            $(this).toggleClass("fa-star-o");
          }
        });

        //Initialize WYSIHTML5 - text editor
        $("#email_message").wysihtml5();
      });
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {invalidValue:"0"});
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {invalidValue:"0"});
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {minChars:2});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {minChars:2});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "email", {isRequired:false});
    </script>
  </body>
</html>
<?php
mysql_free_result($EstadoHabitaciones);
?>
