<?php
error_reporting(E_WARNING);
require_once("funcoes.php");
require_once("valida.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php 

	$edit	=	$_GET['edit'];
	$selectnot	=	"SELECT * FROM tb_banner WHERE cod = $edit";
	$querynot	=	mysql_query($selectnot);
	$sqlnot	=	mysql_fetch_array($querynot);
	
	
echo $sqlnot['titulo'] ?> / Banner / Painel de Administra&ccedil;&atilde;o</title>
<?php require_once("topo.php"); ?>  
<link rel="stylesheet" href="css/query-ui.css" />
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.js"></script>
<script type="text/javascript">

	$(document).ready(function(){
							   
		$("select[name=categoria]").change(function(){
														
			$("select[name=subcategoria]").html('<option value="0">Carrengado...</option>');	
				$.post("subcategorias.php",
				{categoria:$(this).val()},
				function(valor){
					$("select[name=subcategoria]").html(valor);	
					
				})

		})
	})

</script>

<div id="conteudo">

	<div id="top_conteudo"> 
    <form action="gerenciar_banners.php?pag=1" method="post" enctype="multipart/form-data">
    	<p style=""> Editando o banner <?php echo $sqlnot['titulo']?></p>
        <a href="#"><div id="criar_produto"><input type="submit" name="editar_banner" value="Salvar" style="color:#fff; cursor:pointer; font-size:12px; font-weight:bold; background-color:transparent; border:0" /></div></a>
        </div> 
                
        <div id="cadastros">
        
                <div id="tabs"> 
            <ul>
        <li><a href="#geral"><span>Geral</span></a></li>
        </ul>
        <div id="geral">
        <?php
        if(isset($_GET['edit'])){
        
		$cod	=	$_GET['edit'];
		$select	=	"SELECT * FROM tb_banner WHERE cod = $cod LIMIT 1";
		$query	=	mysql_query($select);
		echo mysql_error();
		while($sql	=	mysql_fetch_array($query)){
		
		?>
        
        <table>
        	
			<input type="hidden" name="cod" value="<?php echo $sql['cod']; ?>" />
          
            <tr>
                <td>Tipo: </td>
                <td><select name="tipo">
                        <option value="<?php echo $sql['tipo'] ?>" selected="selected"><?php if($sql['tipo'] == 1) { echo "Banner principal"; } else { echo "Linhas em destaques"; } ?></option>
                        <?php if($sql['tipo'] == 1) { ?> <option value="2">Linhas em destaque</option> <?php } else { ?> <option value="1">Banner principal</option><?php } ?>
                        
                    </select>
                </td>
            </tr>

        	<tr>
            	<td>Imagem: </td>
                <td><img src="../images/banner/<?php echo $sql['imagem']; ?>" width="50" /> <input type="file" name="foto" /></td>
            </tr>
            
             <tr>
            	<td>Título: </td>
                <td><input type="text" name="titulo" value="<?php echo $sql['titulo']; ?>" required="" /></td>
            </tr>
            
              <tr>
            	<td>Ordem de exibição: </td>
                <td><input type="text" name="ordem" value="<?php echo $sql['ordem']; ?>" /></td>
            </tr>
            
            <tr>
            	<td>Url: </td>
                <td><input type="text" name="url" value="<?php echo $sql['url']; ?>" /></td>
            </tr>
            
            <tr>
            	<td>Situação: </td>
                <td><select name="status">
                		<option value="<?php echo $sql['status'] ?>" selected="selected"><?php if($sql['status'] == 1) { echo "Habilitado"; } else { echo "Desabilitado"; } ?></option>
                		<?php if($sql['status'] == 1) { ?> <option value="2">Desabilitado</option> <?php } else { ?> <option value="1">Habilitado</option><?php } ?>
                		
                    </select>
                </td>
            </tr>
            
            <tr>
            	<td>Abrir em nova janela: </td>
                <td><select name="blank">
                		<option value="<?php echo $sql['blank'] ?>" selected="selected"><?php if($sql['blank'] == 1) { echo "Sim"; } else { echo "Não"; } ?></option>
                		<?php if($sql['blank'] == 1) { ?> <option value="2">Não</option> <?php } else { ?> <option value="1">Sim</option><?php } ?>
                		
                    </select>
                </td>
            </tr>
            
            </table>          
        
        <?php } } ?>
        </div> 
        </div>
        
        <script>
        $( "#tabs" ).tabs();
        </script>
        </table>
  
    </div> 
    </div> 
    </div>
    </div>

    </form>

<?php require_once("footer.php"); ?>


</body>
</html>