<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="edit">
    <h3 style="position:relative;left:-185px;"><?php echo 'MY PROFILE'; ?></h3>
	<hr style="margin-left:-190px;">
	  <div id="tabs" class="htabs">
			<a href="#tab-personal" style="font-family:calibri;">PERSONAL DETAILS</a>
			<a href="#tab-address" style="font-family:calibri;">ADDRESS</a>
	  </div>
	  
	  
    <div class="content" id="tab-personal" style="background:none;border-right:none;border-left:none;border-bottom:none;">
      <table class="form">
        <tr>
          <td> <?php echo $entry_firstname; ?></td>
          <td><input type="text" name="firstname" value="<?php echo $firstname; ?>" />
            <?php if ($error_firstname) { ?>
            <span class="error"><?php echo $error_firstname; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td> <?php echo $entry_lastname; ?></td>
          <td><input type="text" name="lastname" value="<?php echo $lastname; ?>" />
            <?php if ($error_lastname) { ?>
            <span class="error"><?php echo $error_lastname; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td> <?php echo $entry_email; ?></td>
          <td><input type="text" name="email" value="<?php echo $email; ?>" />
            <?php if ($error_email) { ?>
            <span class="error"><?php echo $error_email; ?></span>
            <?php } ?></td>
        </tr>
		
		
		<tr>
          <td> <?php echo 'Change Password'; ?></td>
          <td><input type="password" name="password" value="<?php echo $password; ?>" />
            <?php if ($error_password) { ?>
            <span class="error"><?php echo $error_password; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td> <?php echo 'Confirm Password'; ?></td>
          <td><input type="password" name="confirm" value="<?php echo $confirm; ?>" />
            <?php if ($error_confirm) { ?>
            <span class="error"><?php echo $error_confirm; ?></span>
            <?php } ?></td>
        </tr>
		 <tr>
          <td><?php echo $entry_newsletter; ?></td>
          <td><?php if ($newsletter) { ?>
            <input type="radio" name="newsletter" value="1" checked="checked" />
            <?php echo $text_yes; ?>&nbsp;
            <input type="radio" name="newsletter" value="0" />
            <?php echo $text_no; ?>
            <?php } else { ?>
            <input type="radio" name="newsletter" value="1" />
            <?php echo $text_yes; ?>&nbsp;
            <input type="radio" name="newsletter" value="0" checked="checked" />
            <?php echo $text_no; ?>
            <?php } ?></td>
        </tr>
		
      </table>
	  
 <div class="buttons">
      <div class="left" style="position:relative;left:153px;"><a href="<?php echo $back; ?>" class="button"><span>Cancel</span></a></div>
      <div class="left" style="position:relative;left:-157px;"><a onclick="$('#edit').submit();" class="button"><span>Save</span></a></div>
    </div>
	  
    </div>
	
		<div class="content" id="tab-address" style="background:none;border-right:none;border-left:none;border-bottom:none;">	
			<?php foreach ($addresses as $result) { ?>
				<div class="content" style="background:none;border-right:none;border-left:none;border-bottom:none;">
					<table style="width: 100%;">
						<tr>
							<td><?php echo $result['address']; ?></td>
							<td style="text-align: right;"><a href="<?php echo $result['update']; ?>" class="button"><span><?php echo $button_edit; ?></span></a> &nbsp; <a href="<?php echo $result['delete']; ?>" class="button"><span><?php echo $button_delete; ?></span></a></td>
						</tr>
					</table>
				</div>
			<?php } ?>
			<div class="center"><a style="position:relative;left:1px;" href="<?php echo $insert; ?>" class="button"><span>Add New Address</span></a></div>
			<br>
		</div>
	

  </form>
  <?php echo $content_bottom; ?></div>
<?php echo $footer; ?>
<script type="text/javascript"><!--
$('#tabs a').tabs();
//--></script> 

<script type="text/javascript"><!--
function image_upload(field, thumb) {
	$('#dialog').remove();
	
	$('#content').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/filemanager&token=<?php echo $token; ?>&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');
	
	$('#dialog').dialog({
		title: '<?php echo $text_image_manager; ?>',
		close: function (event, ui) {
			if ($('#' + field).attr('value')) {
				$.ajax({
					url: 'index.php?route=common/filemanager/image&token=<?php echo $token; ?>&image=' + encodeURIComponent($('#' + field).val()),
					dataType: 'text',
					success: function(data) {
						$('#' + thumb).replaceWith('<img src="' + data + '" alt="" id="' + thumb + '" />');
					}
				});
			}
		},	
		bgiframe: false,
		width: 800,
		height: 400,
		resizable: false,
		modal: false
	});
};
//--></script> 