<div class="t"><?php echo $titulo; ?></div>
<table border="0" cellspacing="0" cellpadding="0" class="hovertable" width="100%">
	  <tr>
          <th colspan="2"></th>
	  <th>CODIGO</th>
	  <th>FECHA</th>
	  <th>FALTA</th>
	  <th>PERIODO</th>
	  <th>DESCRIPCI&Oacute;N</th>
	  </tr>

           <?php $cantidad=0; ?>
	   <?php foreach ($tsArray as $data): ?>

               <?php $cantidad++; ?>
	       <tr onmouseover="this.style.backgroundColor='#89F2AC';" onmouseout="this.style.backgroundColor='#BBE9EE';">
               <td align="center"> <img id="elemento1"  class="confirmar" src="imagenes/foto1.jpg" onClick="Eliminarelebus(<?php echo $data['orden'];?>,<?php if($periodo=='*'){echo "'".$periodo."'";}else{echo $periodo;}?>,<?php echo $data['codigo'];?>,<?php echo $inicio; ?>,<?php echo $total_tpsofalta;?>)" height="20" width="20" alt="Eliminar" title="Eliminar">  </td>
               <td align="center"> <img id="elemento2"  class="confirmar" src="imagenes/editar.jpg" onClick="EditarBus(<?php echo $data['orden'];?>,<?php echo $inicio; ?>)" height="20" width="20" alt="Editar" title="Editar">  </td>
               <td align="center"><?php echo $data['codigo'];?></td>               
               <td><?php echo ($data['fecha']);?></td>            
               <td><?php echo ($data['falta']);?></td> 
               <td><?php echo ($data['periodo']);?></td>
               <td><?php echo ($data['descripcion']);?></td>
	      </tr>
	   <?php endforeach; ?>

            <?php

            if ($cantidad>=1 && $cantidad<10){

                  for ($i=1; $i<=10-$cantidad; $i++) {  ?>

                     <tr onmouseover="this.style.backgroundColor='#89F2AC';" onmouseout="this.style.backgroundColor='#BBE9EE';">
                     <td align="center"> <img id="elemento1"  class="confirmar" src="imagenes/foto1b.jpg" height="20" width="20" >  </td>
                     <td align="center"> <img id="elemento2"  class="confirmar" src="imagenes/foto1b.jpg" height="20" width="20" >  </td>
                     <td></td>
                     <td></td><td></td><td></td><td></td>
                     </tr>

                 <?php }

                    if($total_tpsofalta>10){ ?>

                        <tr>
                        <td align="center" colspan="2"></td>
                        <td align="center"><INPUT TYPE="button" id="btn_buscar" value="  Buscar  "></td>
                        <td><input type="button" onclick="todasfalt()" value="Todas Las Faltas"></td>
                        <td></td><td></td>
                        <td align="center">
                        <INPUT TYPE="button" name="restar" onclick="disminuirb(<?php echo $inicio; ?>,<?php echo $data['codigo'];?>,<?php echo $data['periodo'];?>);" value=" <<  Anterior  ">
                        </td>
                        
                        </tr>
                     <?php } else { ?>

                        <tr>
                        <td align="center" colspan="2"></td>
                        <td align="center" ><INPUT TYPE="button" id="btn_buscar" value="  Buscar  "></td>
                        <td><input type="button" onclick="todasfalt()" value="Todas Las Faltas"></td>
                        <td></td><td></td><td></td>
                        </tr>

                     <?php }

                  } else {

                        if ($inicio==0 && $total_tpsofalta>10){ ?>

                          <tr>
                          <td align="center" colspan="2"></td>
                          <td align="center"><INPUT TYPE="button" id="btn_buscar" value="  Buscar  "></td>
                          <td><input type="button" onclick="todasfalt()" value="Todas Las Faltas"></td>
                          <td></td><td></td>
                          <td align="center">
                          <INPUT TYPE="button" name="sumar" onclick="aumentarb(<?php echo $inicio; ?>,<?php echo $data['codigo'];?>,<?php echo $data['periodo'];?>);" value=" Siguiente >> ">
                          </td>

                          </tr>

                        <?php }else if (($inicio==$total_tpsofalta-10)&& ($total_tpsofalta>10)){ ?>

                          <tr>
                          <td align="center" colspan="2"></td>
                          <td align="center"><INPUT TYPE="button" id="btn_buscar" value="  Buscar  "></td>
                          <td><input type="button" onclick="todasfalt()" value="Todas Las Faltas"></td>
                          <td></td><td></td>
                          <td align="center">
                          <INPUT TYPE="button" name="restar" onclick="disminuirb(<?php echo $inicio; ?>,<?php echo $data['codigo'];?>,<?php echo $data['periodo'];?>);" value=" <<  Anterior  ">
                          </td>
                          </tr>

                         <?php }else if ($total_tpsofalta==10){ ?>

                            <tr>
                            <td align="center" colspan="2"></td>
                            <td align="center"><INPUT TYPE="button" id="btn_buscar" value="  Buscar  "></td>
                            <td><input type="button" onclick="todasfalt()" value="Todas Las Faltas"></td>
                            <td></td><td></td><td></td>
                            </tr>

                        <?php }else{  ?>

                          <tr>
                          <td align="center" colspan="2"></td>
                          <td align="center"><INPUT TYPE="button" id="btn_buscar" value="  Buscar  "></td>
                          <td><input type="button" onclick="todasfalt()" value="Todas Las Faltas"></td>
                          <td></td><td></td>
                          <td align="center" colspan="2">
                          <INPUT TYPE="button" name="restar" onclick="disminuirb(<?php echo $inicio; ?>,<?php echo $data['codigo'];?>,<?php echo $data['periodo'];?>);" value=" <<  Anterior  ">
                          <INPUT TYPE="button" name="sumar" onclick="aumentarb(<?php echo $inicio; ?>,<?php echo $data['codigo'];?>,<?php echo $data['periodo'];?>);" value=" Siguiente >> ">
                          </td>
                          </tr>

                         <?php }

             } ?>

            </table>

<div id="insertar">

</div>
