<script>
 
</script>


<script> 


function AddSelectOption(selectObj, text, value, isSelected) 
{
    if (selectObj != null && selectObj.options != null)
    {
        selectObj.options[selectObj.options.length] = 
            new Option(text, value, false, isSelected);
    }
}

function mensaje()

{

//alert ("CREADO"); 

};

</script>

<script language="Javascript">

function preguntar(inst1,dato){

eliminar=confirm("Borra este item? " + dato);

if (eliminar)

window.location.href = inst1; 

}

</script>
 
 
  

<p>&nbsp;</p><form name="form2" id="form2" method="post" action="guardarecomendaciones_catalogo.php"  >

  <table width="432" border="0" cellpadding="1" style="line-height:25px">

    <tr> 

      <td width="164" height="26"  ><font size="2" face="Arial, Helvetica, sans-serif">Descripción</font>&nbsp;&nbsp;<input name="txtitem" type="text" size="50" id="txtitem" ></td>

      

    </tr>
    <tr>
      <td height="26" colspan="2" ><input type="button" name="Submit" value="Crear" onclick="AddSelectOption(parent.document.getElementById('recomendaciones1'),  document.getElementById('txtitem').value,  document.getElementById('txtitem').value, false);
      AddSelectOption(parent.document.getElementById('recomendaciones2'), document.getElementById('txtitem').value,  document.getElementById('txtitem').value, false);
      AddSelectOption(parent.document.getElementById('recomendaciones3'), document.getElementById('txtitem').value,  document.getElementById('txtitem').value, false);
     AddSelectOption(parent.document.getElementById('recomendaciones4'), document.getElementById('txtitem').value,  document.getElementById('txtitem').value, false);document.getElementById('form2').action='guardarecomendaciones_catalogo.php';document.getElementById('form2').submit();" />
      &nbsp;&nbsp;<input type="button" name="Submit2" value="Buscar" onclick="document.getElementById('form2').action='recomendaciones_catalogo.php';document.getElementById('form2').submit();" /></td>
    </tr>

  </table>

 <br />

    <?php

	include("../conexion.php"); 

$cond='';
$cond.= ( (trim($_POST[txtitem])!= '' and $cond!='') ? ' and ': '') . (trim($_POST[txtitem])!='' ? " item like '".trim($_POST[txtitem])."%' " : '' );
//$cond.= ( (trim($_POST[txtcountry])!= '' and $cond!='') ? ' and ': '') . (trim($_POST[txtcountry])!='' ? " country like '".trim($_POST[txtcountry])."%' " : '' );

if($cond==''){
	$result = mysqli_query("SELECT * FROM recomendaciones_catalogo order by item"); 
}else{
	$result = mysqli_query("SELECT * FROM recomendaciones_catalogo where ".$cond." order by item"); 
	//echo "SELECT *,if(international_name='',name_without_diacritics,international_name) as nombre FROM puertos_k where ".$cond." order by international_name";
}
	

if ($row = mysqli_fetch_array($result)){ 
?>

<table border = "1" align="left"  style="font-family:Arial, Helvetica, sans-serif; font-size:11px"> 
<TR class='yellow' >
<TD><strong><font size="1" face="Arial, Helvetica, sans-serif">Descripción</TD>
<TD><strong><font size="1" face="Arial, Helvetica, sans-serif">Borrar</TD>
<TD><strong><font size="1" face="Arial, Helvetica, sans-serif">Modificar</TD>
</TR>
<?
do {
?> 
<TR  >
<TD style="cursor:pointer" ><font size="1" face="Arial, Helvetica, sans-serif"><?=$row["item"]?></TD>
<TD><a href="javascript:preguntar('borrarecomendaciones_catalogo.php?id=<?=$row[id]?>','')">Borrar</a></TD>
<TD><a href="cambiorecomendaciones_catalogo.php?id=<?=$row[id]?>">Modificar</a></TD>
</TR> 
<?
   } while ($row = mysqli_fetch_array($result)); 
?>
</table>
<?
}
?>

  </form>

<script>
//parent.document.getElementById('recomendaciones1').click()
//ajaxrec()
//parent.document.getElementById('recomendaciones2').click()
//ajaxrec3()
//ajaxrec4()
//var theSelectList = $('theBigFatSelectList');


</script>