<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>DESCRIPCION</th>
          <th>LIMITE INFERIOR</th>
          <th>V1</th>
         <th>LIMITE SUPERIOR</th>
          <th>V2</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="eliminar('<?php echo $data['codigo'];?>',<?php echo $inicio; ?>,<?php echo $total_rangos; ?>)" height="20" width="20" alt="Eliminar" title="Eliminar">  </td>
               <td align="center"> <img id="elemento2"  class="confirmar" src="imagenes/editar.jpg" onClick="editar('<?php echo $data['codigo'];?>')" height="20" width="20" alt="Editar" title="Editar">  </td>

               <td align="center"><?php echo $data['codigo'];?></td>
               <td><?php echo ($data['descripcion']);?></td>              
               <td align="center"><?php echo $data['inferior'];?></td>
               <td align="center"><?php echo number_format($data['v1'],1);?></td>
               <td align="center"><?php echo $data['superior'];?></td>
               <td align="center"><?php echo number_format($data['v2'],1);?></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><td></td>
	             </tr>

                 <?php }

                    if($total_rangos>10){ ?>

                        <tr>
                        <td align="center" colspan="2"><INPUT TYPE="button" id="bton_insertar" value="  Insertar  "></td>
                        <td></td><td></td><td></td><td></td><td></td>
                        <td align="center">
                        <INPUT TYPE="button" name="restar" onclick="disminuir(<?php echo $inicio; ?>);" value=" <<  Anterior  ">
                        </td>
                        </tr>
                     <?php } else { ?>

                        <tr>
                        <td align="center" colspan="2"><INPUT TYPE="button" id="bton_insertar" value="  Insertar  "></td>
                        <td></td><td></td><td></td><td></td><td></td><td></td>
                        </tr>

                     <?php }

                  } else {

                       //------------------------------
                       if ($cantidad==0){

                           for ($i=1; $i<=10; $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><td></td>
                            </tr>

                            <?php }?>

                            <tr>
                            <td align="center" colspan="2"><INPUT TYPE="button" id="bton_insertar" value="  Insertar  "></td>
                            <td></td><td></td><td></td><td></td><td></td><td></td>
                            </tr>

                       <?php
                       }
                       else{

                       //------------------------------

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

                          <tr>
                          <td align="center" colspan="2"><INPUT TYPE="button" id="bton_insertar" value="  Insertar  "></td>
                          <td></td><td></td><td></td><td></td><td></td>
                          <td align="center">
                          <INPUT TYPE="button" name="sumar" onclick="aumentar(<?php echo $inicio; ?>);" value=" Siguiente >> ">
                          </td>

                          </tr>

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

                          <tr>
                          <td align="center" colspan="2"><INPUT TYPE="button" id="bton_insertar" value="  Insertar  "></td>
                          <td></td><td></td><td></td><td></td><td></td>
                          <td align="center">
                          <INPUT TYPE="button" name="restar" onclick="disminuir(<?php echo $inicio; ?>);" value=" <<  Anterior  ">
                          </td>
                          </tr>

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

                            <tr>
                            <td align="center" colspan="2"><INPUT TYPE="button" id="bton_insertar" value="  Insertar  "></td>
                            <td></td><td></td><td></td><td></td><td></td><td></td>
                            </tr>

                        <?php }else{  ?>

                          <tr>
                          <td align="center" colspan="2"><INPUT TYPE="button" id="bton_insertar" value="  Insertar  "></td>
                          <td></td><td></td><td></td><td></td>
                          <td align="center" colspan="2">
                          <INPUT TYPE="button" name="restar" onclick="disminuir(<?php echo $inicio; ?>);" value=" <<  Anterior  ">
                          <INPUT TYPE="button" name="sumar" onclick="aumentar(<?php echo $inicio; ?>);" value=" Siguiente >> ">
                          </td>
                          </tr>

                         <?php }
                      }
             } ?>

            </table>

<div id="insertar">

</div>

