<?php echo $header; ?>
<div id="content">
<div class="breadcrumb">
  <?php foreach ($breadcrumbs as $breadcrumb) { ?>
  <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
  <?php } ?>
</div>
    
<div id="notification">    
<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<?php if ($success) { ?>
      <div class="success"><?php echo $success; ?></div>
<?php } ?>
</div>
<div class="box">
  <div class="heading">
    <h1><img src="view/template/module/modulo-futura/logo-futura.png" width="20" height="20" style="margin-right:8px;"/><?php echo $heading_title; ?></h1>
   <div class="buttons"><a onclick="" class="button" id="salvar"><?php echo $button_save; ?></a><a onclick="location = '<?php echo $cancel; ?>';" class="button"><?php echo $button_cancel; ?></a></div>
  </div>
  <div class="content">  
     <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
      <table class="form">
		<tr>
		   <td><label><?php echo $text_senha_atual ?></label></td>
		   <td><input type="password" name="senha_anterior" id="senha_anterior_id" /></td>
		</tr>
		<tr>
		   <td><label><?php echo $text_senha_nova ?></label></td>
		   <td><input type="password" name="senha_nova" id="senha_nova_id"/></td>
		</tr>
		<tr>
		   <td><label><?php echo $text_senha_confirma ?></label></td>
		   <td><input type="password" name="senha_nova_confirm" id="senha_nova_confirm_id" /></td>
		</tr>
	  </table>  
    </form>
  </div>
    
</div>

<script type="text/javascript">
    $('#form input').keydown(function(e) {
	if (e.keyCode === 13) {
           $("#salvar").click();
        }
    });
        
    $("#salvar").bind('click',function(){
      var result = $("#form").serialize();
      $.ajax({
           
            type     : 'POST',
            url      : 'index.php?route=user/trocasenha/verifica&token=<?php echo $token; ?>',
            data     : result,
            datatype :  'json',
            error: function (json) {
                      alert(JSON.stringify(json));  
                    },
            success: function(data) {
               $('.success, .warning, .attention, information, .error').remove();			
               //alert(data);
               var myjson ="["+data+"]";
               var arr = JSON.parse(myjson);
                             
		    if (arr[0].error) {
                           $('#notification').append('<div class="warning" style="display: none;">' + arr[0].error + '<!--img src="catalog/view/theme/default/image/close.png"--> <alt="" class="close" /></div>');
                           $('.warning').fadeIn('slow');    				
                           $('html, body').animate({ scrollTop: 0 }, 'slow');      
                    }
                    if (arr[0].success) {
                           $('#notification').html('<div class="success" style="display: none;">' + arr[0].success + '<!--img src="catalog/view/theme/default/image/close.png"--> <alt="" class="close" /></div>');
	                   $('.success').fadeIn('slow');
			   $('html, body').animate({ scrollTop: 0 }, 'slow'); 
                           location.reload();
		   }	
		}
                
        });
    
    } );
    
    
</script>
<?php echo $footer; ?>