<?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>Adicionar Álbum / 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" src="../ckeditor/ckeditor.js"></script>
<script src="../ckeditor/_samples/sample.js" type="text/javascript"></script>
<div id="conteudo">

	<div id="top_conteudo"> 
    <form name="salvar" action="gerenciar_album.php?pag=1" method="post" enctype="multipart/form-data">
    	<p style=""> Novo album</p>
        <div class="criar_produto">
        		<input type="button" name="salvar_album" value="Salvar" onClick="ExecutaAcao('gerenciar_album.php?pag=1');" />

            </div>
            
            <?php
            
			$select	=	mysql_query("SELECT * FROM tb_album ORDER BY cod DESC LIMIT 1");
			$sql	=	mysql_fetch_assoc($select);
			
			?>
            
            <div class="criar_produto" style="margin:0 10px; text-align:center">
            	<input type="button" name="salvar_album" value="Salvar e Continuar" onClick="ExecutaAcao('editar_album.php');" />
            </div>
        </div> 
                
        <div id="cadastros">
        
                <div id="tabs"> 
            <ul>
        <li><a href="#geral"><span>Geral</span></a></li>
        <li><a href="#fotos"><span>Fotos</span></a></li>
        </ul>
        <div id="geral">
        <table>
        	<input type="hidden" name="album" value="0">
        	<tr>
            	<td>Capa: </td>
                <td><input type="file" name="foto" /> (1100x750px)</td>
            </tr>
            
             <tr>
            	<td>Título: </td>
                <td><input type="text" name="titulo" /></td>
            </tr>

            <tr>
                <td>Texto: </td>
                <td><textarea name="texto" id="editor" class="ckeditor"></textarea></td>
            </tr>
            
            <tr>
            	<td>Ordem de exibição: </td>
                <td><input type="text" name="ordem" /></td>
            </tr>


            <tr>
                <td>Profissional: </td>
                <td><select name="profissional">
                    <option>Selecione um profissional</option>
                <?php

                $selectpro  =   mysql_query("SELECT * FROM tb_profissionais WHERE status = 1");
                while($sqlpro    =   mysql_fetch_array($selectpro)){
                    echo "<option value='".$sqlpro['cod']."'>".$sqlpro['nome']."</option>";
                } 

                ?>
                </select>
                </td>
            </tr>
            
            <tr>
            	<td>Situação: </td>
                <td><select name="status">
                		<option value="2">Desabilitado</option>
                		<option value="1">Habilitado</option>
                    </select>
                </td>
            </tr>
            
            </table>          
        
        </div> 
        <div id="fotos">
        	<p>Após cadastrar, clique em Salvar e Continuar para adicionar as fotos.
        </div>

        </div>
        
        <script>
        $( "#tabs" ).tabs();
        </script>
        </table>
  
    </div> 
    </div> 
    </div>
    </div>

    </form>

    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="ckfinder/ckfinder.js"></script>


    <script>
        CKEDITOR.replace( 'editor', {
        filebrowserBrowseUrl: 'ckfinder/ckfinder.html',
        filebrowserUploadUrl: 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
    } );
    </script>


<script type="text/javascript">

	function ExecutaAcao(valor){
		
   document.salvar.action = valor; 
   document.salvar.submit();
}
</script>

</body>
</html>