<?php
session_start();

include "../phpconfig/config.php";
include "../phpconfig/valida_login.php";
include "../includes/topo.php"; 



$sqle = mysql_query("SELECT * FROM l_estados ORDER BY estado asc");
$sqlc = mysql_query("SELECT * FROM l_cidades ORDER BY cidade asc");



?>

<script src="jquery.uploadifive.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="uploadifive.css">
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
        <ul class="breadcrumb">
          <li><a href="<?php echo sti('adm');  ?>">Home</a></li>
          <li class="active">Adicionar Notícia</li>
        </ul>


<div class='row'>

  <div class='col-md-8'>
 <form class="form-horizontal" method="post" action="adiciona.php" id='depform' enctype="multipart/form-data">
        <fieldset>

               <input type='hidden'  id='uf' name='uf'>
               <input type='hidden'  id='cidade' name='cidade'>

   <br/>
  <div class="control-group">
            <label>Estado</label>
              <select id='estados' name='estados' class="form-control">
             <option>- Estado -</option>

                <?php while($line = mysql_fetch_assoc($sqle)){ ?>                
                  <option value='<?php  echo $line['id'];  ?>' <?php if(isset($id_uf)){ if($id_uf==$line['id']) {echo 'selected';}    } ?> ><?php  echo $line['estado'];  ?></option>
                <?php } ?>   

              </select>  <br />

                <div id='retc'>

<div class="control-group">
            <label>Cidade</label>
                <select id='cidades' name='cidades' class="form-control">
              <option> - Cidade - </option>
                <?php while($line = mysql_fetch_assoc($sqlc)){ ?>                
                  <option value='<?php  echo $line['id'];  ?>' <?php if(isset($id_cidade)){ if($id_cidade==$line['id']) {echo 'selected';}    } ?> ><?php  echo $line['cidade'];  ?></option>
                <?php } ?>   

              </select>  
            </div>
            
        
          <br/>
          <div class="control-group">
            <label class="control-label" for="nome_esta">Nome da Cidade (emp)</label>
            <div class="controls">
              <input type="text" class="input-xlarge" name='titulop'size='45' id="titulop">
            </div>
          </div>
   <br/>
          <div class="control-group">
            <label class="control-label" for="nome_esta">Titulo para slug</label>
            <div class="controls">
              <input type="text" class="input-xlarge" name='titulopl'size='45' id="titulopl">
            </div>
          </div>
           <br/>
          <div class="control-group">
            <label class="control-label"  for="depp">Adicionar - Info Cidade</label>
            <div class="controls">
              <textarea name='depp'  id="myArea2" cols='30'style='width:800px' class="  " rows='10' ></textarea>
            </div>
          </div>
 
         <br/>
          <div class="form-actions">
            <input  type="submit" class="btn btn-primary" value='Salvar' />
            <a class="btn btn-warning pull-right" href="index.php">Voltar</a>
          </div>
        </fieldset>
      </form>

</div>

<div class='col-md-4'>

              
</div>
</div>
 <script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
    <script type="text/javascript">
      //<![CDATA[
      var area1;

      function toggleArea1() {
      
            area1 = new nicEditor({fullPanel : true}).panelInstance('myArea2',{hasPanel : true});

      }


      bkLib.onDomLoaded(function() { 
      
          new nicEditor({buttonList : ['fontFormat','bold','italic','underline','strikeThrough','subscript','superscript','html','image','link','ul']}).panelInstance('myArea2');
      
      toggleArea1(); });

       $("#estados").change(function(){
        var uf = $("#estados").val();

    $.ajax({   
      url: "retCidades.php?uf="+uf,
      type: 'GET',
      beforeSend: function() {    


      },
    success: function(data)
    {
 
        $('#retc').html(data);  
        $("#uf").val(uf);
 
    }
  });

      });

      </script>

<?php include "../includes/rodape.php"; ?>
