<?php
session_start();
if(strpos(strtolower($_SERVER['REQUEST_URI']), 'phpsessid') !== false)
{
  session_destroy();
  session_regenerate_id();
  session_start();
                              
}

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

$id = $_GET['id'];


$sql = mysql_query("SELECT * FROM cobertura WHERE id='$id'");

$lin = mysql_fetch_assoc($sql);


include "../includes/topo.php"; 

?>


        <ul class="breadcrumb">
          <li><a href="<?php echo sti('adm');  ?>">Home</a></li>
          <li>Editar Bairro
          <li class="active"><?php echo $lin['bairro']; ?> </li>
        </ul>

 <form class="form-horizontal" method="post" action="edita.php" id='depform'  enctype="multipart/form-data">
  <input type="hidden" name="id" value="<?php echo $id ?>">
        <fieldset>



           <div class="control-group">
            <label class="control-label"  for="depp">Nome do bairro</label>
            <div class="controls">
             <input type="text" name="nome" value="<?php echo $lin['bairro']; ?>">
            </div>
          </div>
         
            <div class="control-group">
            <label class="control-label" for="nome">Slug</label>
            <div class="controls">
              <input type="text" class="input-xlarge" name='slug' size='45' id="slug" value="<?php echo $lin['slug']; ?>">
            </div>
          </div> 


        <div class="control-group">
            <label class="control-label"  for="depp">Taxa</label>
            <div class="controls">
            <div class="input-prepend input-append">
              <input style='text-align:right' type="text" class="input-large" name='taxa' id="real" value="<?php echo $lin['taxa']; ?>">
            </div> 
            </div>
          </div> 

        

          <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>

<script type='text/javascript'>
$("#real").maskMoney({prefix:'R$ ', allowNegative: true, thousands:'', decimal:',', affixesStay: false});

$.validator.setDefaults({
  submitHandler: function() { $('#depform').submit(); }
});

$().ready(function() {

  $("#depforms").validate({
    rules: {
      nome: {
        required: true 
      },      
      titulop: {
        required: true,
        maxlength: 40
      },
      tituloi: {
        required: true,
        maxlength: 40
      },
      tituloe: {
        required: true,
        maxlength: 40 }
      },            
      
    messages: {
      nome:{required:"Digite um nome"},
      titulop: {
        required:"Digite um título",
        maxlength:"Digite um título menor"
      },
      tituloi: {
        required:"Digite um título",
        maxlength:"Digite um título menor"
      },
      tituloe: {
        required:"Digite um título",
        maxlength:"Digite um título menor"
      }
    },
    highlight: function(element) {
    $(element).closest('.control-group').removeClass('success').addClass('error');
  },
  success: function(element) {
    element
    .text('OK!').addClass('valid')
    .closest('.control-group').removeClass('error').addClass('success');
  }
  });


});
</script>



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