<?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" style="margin-top: 9px;" class="htabs">
			<a href="#tab-publicprofile">PUBLIC PROFILE</a>
			<a href="#tab-personal">PERSONAL DETAILS</a>
			<a href="#tab-address">ADDRESS</a>
			<a href="#tab-paymentdetails">PAYMENT DETAILS</a>
	  </div>
	  
	  
    <div class="content" id="tab-personal">
      <table class="form" style="margin-left:20px;margin-top:20px;">
        <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></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></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></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></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></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" style="width: 120px;margin-left: 174px;margin-top: -18px;">
      <div class="left"><a href="<?php echo $back; ?>" class="button"><span><?php echo 'Cancel'; ?></span></a></div>
      <div class="right"><a onclick="$('#edit').submit();" class="button"><span><?php echo 'Save'; ?></span></a></div>
    </div>
    </div>
	
		<div class="content" id="tab-address">	
			<?php foreach ($addresses as $result) { ?>
				<div class="content">
					<table style="width: 95%;margin-left:20px;margin-top:20px;">
						<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="left"><a style="position:relative;" href="<?php echo $insert; ?>" class="button"><span>New Address</span></a></div>
			<br>
		</div>
		
			<div class="content" id="tab-publicprofile">
				<table class="form"  style="margin-left:20px;margin-top:20px;">
					<tr>
						<td> <?php echo $entry_dispname; ?></td>
						<td><input type="text" name="dispname" value="<?php echo $dispname; ?>" /></td>
					</tr>
					<tr><td></td></tr>
					 <tr>
						<td><?php echo $entry_profpic; ?></td>
						<td valign="top">
						<div class="image"><img width="100" height="100" src="<?php echo $thumb; ?>" alt="" id="thumb" />
						<input type="hidden" name="image" value="" id="image" />
						<br /><a onclick="image_upload('image', 'thumb');"><?php echo 'Add/Change'; ?></a>&nbsp;&nbsp;|&nbsp;&nbsp;<a onclick="$('#thumb').attr('src', '<?php echo $no_image; ?>'); $('#image').attr('value', '');"><?php echo $text_clear; ?></a>
						</div>
						</td>
					</tr>
					<tr><td></td></tr>
					 <tr>
						<td><?php echo $entry_gender; ?></td>
						<td><?php if ($gender) { ?>
							<input type="radio" name="gender" value="1" checked="checked" />
							<?php echo $text_male; ?>&nbsp; <br>
							<input type="radio" name="gender" value="0" />
							<?php echo $text_female; ?>
							<?php } else { ?>
							<input type="radio" name="gender" value="1" />
							<?php echo $text_male; ?>&nbsp; <br>
							<input type="radio" name="gender" value="0" checked="checked" />
							<?php echo $text_female; ?>
							<?php } ?>
						</td>
					</tr>
					<tr><td></td></tr>
					 <tr>
						<td><?php echo $entry_langknown; ?></td>
						
						<td>
						
						<?php if ($lang) { ?>
						<input type="checkbox" name="lang" value="1" checked="checked" /><?php echo $text_english; ?>
						<?php } else { ?>
						<input type="checkbox" name="lang" value="1" /><?php echo $text_english; ?>
						<?php } ?>
						
						<?php if ($lang1) { ?>
						<input type="checkbox" name="lang1" value="1" checked="checked" /><?php echo $text_french; ?>
						<?php } else { ?>
						<input type="checkbox" name="lang1" value="1" /><?php echo $text_french; ?>
						<?php } ?>
						
						<?php if ($lang2) { ?>
						<input type="checkbox" name="lang2" value="1" checked="checked" /><?php echo 'Italian'; ?>
						<?php } else { ?>
						<input type="checkbox" name="lang2" value="1" /><?php echo 'Italian'; ?>
						<?php } ?> 
						</td>

						
						
						
					</tr>
					<tr><td></td></tr>
					<tr>
						<td><?php echo $entry_yourself; ?></td>
						<td><textarea rows="5" cols="70" name="about_yourself"><?php echo $about_yourself; ?></textarea></td>
					</tr>	
				</table>
		
    <div class="buttons" style="width: 120px;margin-left: 174px;margin-top: -18px;">
      <div class="left"><a href="<?php echo $back; ?>" class="button"><span><?php echo 'Cancel'; ?></span></a></div>
      <div class="right"><a onclick="$('#edit').submit();" class="button"><span><?php echo 'Save'; ?></span></a></div>
    </div>
		</div>
		
		<div class="content" id="tab-paymentdetails">	
			<table class="form"  style="margin-left:20px;margin-top:20px;">
					 <tr>
			<td><?php echo 'Payment Method'; ?></td>
						
						
			<td><?php if ($payment == 'cheque') { ?>
              <input type="radio" name="payment" value="cheque" id="cheque" checked="checked" />
              <?php } else { ?>
              <input type="radio" name="payment" value="cheque" id="cheque" />
              <?php } ?>
              <label for="cheque"><?php echo $text_cheque; ?></label>
			  
              <?php if ($payment == 'paypal') { ?>
              <input type="radio" name="payment" value="paypal" id="paypal" checked="checked" />
              <?php } else { ?>
              <input type="radio" name="payment" value="paypal" id="paypal" />
              <?php } ?>
              <label for="paypal"><?php echo $text_paypal; ?></label>		  
			  			  
              <?php if ($payment == 'moneybrookers') { ?>
              <input type="radio" name="payment" value="moneybrookers" id="moneybrookers" checked="checked" />
              <?php } else { ?>
              <input type="radio" name="payment" value="moneybrookers" id="moneybrookers" />
              <?php } ?>
              <label for="moneybrookers"><?php echo $text_money; ?></label>
			  
              <?php if ($payment == 'banktransfer') { ?>
              <input type="radio" name="payment" value="banktransfer" id="banktransfer" checked="checked" />
              <?php } else { ?>
              <input type="radio" name="payment" value="banktransfer" id="banktransfer" />
              <?php } ?>
              <label for="banktransfer"><?php echo $text_bank; ?></label></td>
				</tr>		
				<tr><td></td></tr>
				<tr><td></td></tr>
		<tbody id="payment-cheque" class="payment">
          <tr>
            <td><?php echo $text_cheque_payeename; ?></td>
            <td><input type="text" name="cheque" value="<?php echo $cheque; ?>" /></td>
          </tr>
        </tbody>
		
		
		<tbody class="payment" id="payment-moneybrookers">
          <tr>
            <td><?php echo $text_money; ?></td>
            <td><input type="text" name="moneybrookers" value="<?php echo $moneybrookers; ?>" /></td>
          </tr>
        </tbody>	

		<tbody class="payment" id="payment-paypal">
          <tr>
            <td><?php echo $text_paypal; ?></td>
            <td><input type="text" name="paypalemail" value="<?php echo $paypalemail; ?>" /></td>
          </tr>
        </tbody>
			
        <tbody id="payment-banktransfer" class="payment">
          <tr>
            <td><?php echo $entry_bank_name; ?></td>
            <td><input type="text" name="bank_name" value="<?php echo $bank_name; ?>" /></td>
          </tr>
          <tr>
            <td><?php echo $entry_bank_branch_number; ?></td>
            <td><input type="text" name="bank_branch_number" value="<?php echo $bank_branch_number; ?>" /></td>
          </tr>
          <tr>
            <td><?php echo $entry_bank_swift_code; ?></td>
            <td><input type="text" name="bank_swift_code" value="<?php echo $bank_swift_code; ?>" /></td>
          </tr>
          <tr>
            <td><?php echo $entry_bank_account_name; ?></td>
            <td><input type="text" name="bank_account_name" value="<?php echo $bank_account_name; ?>" /></td>
          </tr>
          <tr>
            <td><?php echo $entry_bank_account_number; ?></td>
            <td><input type="text" name="bank_account_number" value="<?php echo $bank_account_number; ?>" /></td>
          </tr>
        </tbody>
						
						<!-- <td><?php if ($cheque) { ?>
							<input type="checkbox" name="cheque" value="1" checked="checked" />
							<?php } else { ?>
							<input type="checkbox" name="cheque" value="1" />
							<?php } ?><?php echo $text_cheque; ?>
						<?php if ($paypal) { ?>
							<input type="checkbox" name="paypal" value="1" checked="checked" />
							<?php } else { ?>
							<input type="checkbox" name="paypal" value="1" />
							<?php } ?><?php echo $text_paypal; ?>
						<?php if ($moneybrookers) { ?>
							<input type="checkbox" name="moneybrookers" value="1" checked="checked" />
							<?php } else { ?>
							<input type="checkbox" name="moneybrookers" value="1" />
							<?php } ?><?php echo $text_money; ?>
						<?php if ($banktransfer) { ?>
							<input type="checkbox" name="banktransfer" value="1" checked="checked" />
							<?php } else { ?>
							<input type="checkbox" name="banktransfer" value="1" />
							<?php } ?><?php echo $text_bank; ?>
						</td> -->
					
						
				</table>
				
    <div class="buttons" style="width: 120px;margin-left: 174px;margin-top: -18px;">
      <div class="left"><a href="<?php echo $back; ?>" class="button"><span><?php echo 'Cancel'; ?></span></a></div>
      <div class="right"><a onclick="$('#edit').submit();" class="button"><span><?php echo 'Save'; ?></span></a></div>
    </div>
		</div>
	
  </form>
  <?php echo $content_bottom; ?></div>
<?php echo $footer; ?>
<script type="text/javascript"><!--
$('#tabs a').tabs();
//--></script> 

<script type="text/javascript"><!--
$('input[name=\'payment\']').bind('change', function() {
	$('.payment').hide();
	
	$('#payment-' + this.value).show();
});

$('input[name=\'payment\']:checked').trigger('change');
//--></script>

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