<?php
require ("Conexion/Conexion.php");
require ("lib/lib.php");
if(!isset($_SESSION['WEB2'])){	
	echo "<script language='JavaScript'>location.href = 'index.php'</script>";
	die();
} else{
	Inactividad();
	
	if($_POST['Opcion'] != '' || $_GET['Opcion'] != ''){
		$ClienteID = $_SESSION["ClienteID"];
		if($_POST['Opcion'] != '') {
			if(preg_match("/^[[:digit:]]+$/", $_POST['Opcion'])){
				$Opcion = $_POST['Opcion'];
				$Bandera = 1;
			}else
				$Bandera = 'error2';
		}
		if($Bandera == 1){
			if($Opcion == 1){
				$QueryCatalogo = mssql_query("SELECT * FROM SeccionWeb WHERE NombreSeccion <> '' AND ClienteID = '$ClienteID' ORDER BY SeccionWebID");	
				$TotalRegistros = mssql_num_rows($QueryCatalogo);	?>
                <script>
                $(document).ready(function(){
					$('#green2').smartpaginator({ 
						totalrecords: 		<? echo $TotalRegistros; ?>, 
						recordsperpage: 	20, 
						datacontainer: 		'mt', 
						dataelement: 		'tr', 
						initval: 			0, 
						next: 				'Sig', 
						prev: 				'Ant', 
						first: 				'Prim', 
						last: 				'Ult', 
						theme: 				'green' 
					});
				});
                </script>
                <div id="green-contents" class="contents2" style="border: solid 1px #5f9000;">
				<table align="center" width="600" border="0" cellspacing="0" cellpadding="0" class="table" id="mt">
				  <tr height="30" class="header">
					<th width="100" 	bgcolor="#46AD34" id="CelAzul" scope="col">No. Grupo</th>
					<th align="left" 	bgcolor="#46AD34" id="CelAzul" scope="col">Nombre del Grupo</th>
				  </tr>				
<?					while ($EvaluarCatalogo = mssql_fetch_array($QueryCatalogo)) {
						if ($colorfila == 0){
							$color = "trlight";	
							$colorfila = 1;
						}else{
							$color = "trblue";
							$colorfila = 0;	
						}
					echo"<tr height='20' id='$color'>"; ?> 
					<th align="center" scope="row"><? echo $EvaluarCatalogo['SeccionWebID']; ?></th>
					<th align="left"><? echo utf8_encode($EvaluarCatalogo['NombreSeccion']); ?></th>
				  </tr>  
					<? 
					}?>
				  <tr>
					  <th align="center" 	bgcolor="#46AD34" scope="row">&nbsp;</th>
					  <th align="left" 		bgcolor="#46AD34">&nbsp;</th>
				  </tr>
				</table>
                <div id="green2" style="margin: auto;" >
                </div>
            </div>
<?			}else	echo 'error2';
		}else	echo $Bandera;
	}else	echo 'error1';
}	?>