<?php $this->load->view('header');?>

	<div class="row-fluid">
		<div class="span12">

			<!-- BEGIN PAGE TITLE & BREADCRUMB-->

			<h3 class="page-title"><?php echo $this->lang->line('hf_edit_member');?> </h3>

			<ul class="breadcrumb">

				<li><i class="icon-home"></i><a href="<?php echo base_url();?>home/"><?php echo $this->lang->line('hf_home');?></a> <i class="icon-angle-right"></i></li>
				<li><?php echo $this->lang->line('hf_member_manager');?> <i class="icon-angle-right"></i></li>
				<li><?php echo $this->lang->line('hf_edit_member');?></li>
			</ul>
			<!-- END PAGE TITLE & BREADCRUMB-->
		</div>
	</div>
	
	<div class="row-fluid">
		<div class="span12">
			<div class="portlet box blue">

				<div class="portlet-title">

					<div class="caption"><i class="icon-reorder"></i><?php echo $this->lang->line('hf_edit_member');?></div>

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="member-form" class="form-horizontal" method="post" action="<?php echo base_url();?>member/update/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form')">
						<?php 
							$alert_box = '';
							$alert_msg = '';
							
							if($this->session->userdata('form_msg_type') == 100) {
								$alert_box = 'success';
								$alert_msg = $this->session->userdata('form_msg');
							}
							else if($this->session->userdata('form_msg_type') == 200) {
								$alert_box = 'error';
								$alert_msg = $this->session->userdata('form_msg');
							}
							
							if($this->session->userdata('form_msg_type') == 100 OR $this->session->userdata('form_msg_type') == 200) {
								$this->session->unset_userdata(array('form_msg_type' => '', 'form_msg' => ''));
							}

							if( ! empty($alert_msg)) {
						?>
						<div class="alert alert-<?php echo $alert_box;?>">
							<button class="close" data-dismiss="alert"></button>
							<?php echo $alert_msg;?>
						</div>
						<?php }?>
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_account');?></h3>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_username');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($username) ? $username : (isset($profile['username']) ? $profile['username'] : '');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_password');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($password_origin) ? $password_origin : (isset($profile['password_origin']) ? $profile['password_origin'] : '');?> &nbsp;&nbsp;&nbsp; <a href="<?php echo base_url();?>member/reset_login/<?php echo isset($member_id) ? $member_id : (isset($profile['member_id']) ? $profile['member_id'] : '');?>/" OnClick="return confirm('<?php echo $this->lang->line('registration_confirm_reset');?>');"><?php echo $this->lang->line('registration_reset');?></a></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<input type="password" id="password" name="password" class="m-wrap span4" value="">
								<span class="help-block"><?php echo $this->lang->line('registration_password_format');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_security_password');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($security_password_origin) ? $security_password_origin : (isset($profile['security_password_origin']) ? $profile['security_password_origin'] : '');?> &nbsp;&nbsp;&nbsp; <a href="<?php echo base_url();?>member/reset_security/<?php echo isset($member_id) ? $member_id : (isset($profile['member_id']) ? $profile['member_id'] : '');?>/" OnClick="return confirm('<?php echo $this->lang->line('registration_confirm_reset');?>');"><?php echo $this->lang->line('registration_reset');?></a></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<input type="password" id="security_password" name="security_password" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_introducer');?>: </label>
							<div class="controls">
								<span class="text"><?php echo isset($introducer) ? $introducer : (isset($profile['introducer']) ? $profile['introducer'] : '-');?></span>
							</div>
						</div>  
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_member_type');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($member_type) ? $this->lang->line(get_member_type($member_type)) : (isset($profile['member_type']) ? $this->lang->line(get_member_type($profile['member_type'])) : '');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_package');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($package_type) ? $this->lang->line(get_package($package_type)) : (isset($profile['package_type']) ? $this->lang->line(get_package($profile['package_type'])) : '');?> <?php echo (isset($special_package_type) AND $special_package_type > 0) ? ' (* ' . $this->lang->line(get_package($special_package_type)) . ')' :  ((isset($profile['special_package_type']) AND $profile['special_package_type'] > 0) ? ' (* ' . $this->lang->line(get_package($profile['special_package_type'])) . ')' : '');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_level');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($level) ? $this->lang->line(get_level($level)) : (isset($profile['level']) ? $this->lang->line(get_level($profile['level'])) : '');?>  <?php echo (isset($special_level) AND $special_level > 0) ? ' (* ' . $this->lang->line(get_level($special_level)) . ')' :  ((isset($profile['special_level']) AND $profile['special_level'] > 0) ? ' (* ' . $this->lang->line(get_level($profile['special_level'])) . ')' : '');?></span>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('platform_1');?>: </label>
							<div class="controls">
								<span class="text"><?php echo isset($casino_ply_1) ? $casino_ply_1 : (isset($profile['casino_ply_1']) ? $profile['casino_ply_1'] : '-');?></span>
							</div>
						</div> 
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('platform_2');?>: </label>
							<div class="controls">
								<span class="text"><?php echo isset($casino_ply_2) ? $casino_ply_2 : (isset($profile['casino_ply_2']) ? $profile['casino_ply_2'] : '-');?></span>
							</div>
						</div> 
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_joined_date');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($contract_start_date) ? date('Y-m-d H:i:s', $contract_start_date) :  (isset($profile['contract_start_date']) ? date('Y-m-d H:i:s', $profile['contract_start_date']) : '');?></span>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label"><?php echo $this->lang->line('registration_expiry_date');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($contract_expiry_date) ? date('Y-m-d H:i:s', $contract_expiry_date) :  (isset($profile['contract_expiry_date']) ? date('Y-m-d H:i:s', $profile['contract_expiry_date']) : '');?></span>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label"><?php echo $this->lang->line('registration_contract_remaining_date');?>:</label>
							<div class="controls">
								<span class="text">
								<?php 
									$remaining_day = TENURE_CONTRACT;
									if(isset($contract_expiry_date)) {
										$current_date = time();
										
										if($contract_expiry_date > $current_date) {
											$tmp = ($contract_expiry_date - $current_date);
											$tmp2 = ($tmp / 86400);
											$arr = explode('.', $tmp2);
											$remaining_day = $arr[0];
										}
										else {
											$remaining_day = 0;
										}
									}
									else if(isset($profile['contract_expiry_date'])) {
										$current_date = time();
										
										if($profile['contract_expiry_date'] > $current_date) {
											$tmp = ($profile['contract_expiry_date'] - $current_date);
											$tmp2 = ($tmp / 86400);
											$arr = explode('.', $tmp2);
											$remaining_day = $arr[0];
										}
										else {
											$remaining_day = 0;
										}
									}
									
									if($remaining_day > 1) {
										echo $remaining_day . $this->lang->line('registration_days');
									}
									else {
										echo $remaining_day . $this->lang->line('registration_day');
									}
								?>
								</span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_insurance_remaining_date');?>:</label>
							<div class="controls">
								<span class="text">
								<?php 
									$remaining_day = 0;
									if(isset($insurance_date)) {
										$current_date = time();
										
										if($insurance_date > $current_date) {
											$tmp = ($insurance_date - $current_date);
											$tmp2 = ($tmp / 86400);
											$arr = explode('.', $tmp2);
											$remaining_day = $arr[0];
										}
										else {
											$remaining_day = 0;
										}
									}
									else if(isset($profile['insurance_date'])) {
										$current_date = time();
										
										if($profile['insurance_date'] > $current_date) {
											$tmp = ($profile['insurance_date'] - $current_date);
											$tmp2 = ($tmp / 86400);
											$arr = explode('.', $tmp2);
											$remaining_day = $arr[0];
										}
										else {
											$remaining_day = 0;
										}
									}
									
									if($remaining_day > 1) {
										echo $remaining_day . $this->lang->line('registration_days');
									}
									else {
										echo $remaining_day . $this->lang->line('registration_day');
									}
								?>
								</span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_last_login');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($last_login_date) ? date('Y-m-d H:i:s', $last_login_date) :  (isset($profile['last_login_date']) ? date('Y-m-d H:i:s', $profile['last_login_date']) : '-');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_registered_by');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($registered_by) ? $registered_by : (isset($profile['registered_by']) ? $profile['registered_by'] : '');?></span>
							</div>
						</div>
						
						<?php 
							if(isset($placement)) {
								if($placement->num_rows() > 0) {
									foreach($placement->result() as $row) {
										if($row->transaction_type == 1 && $row->credit_amount > 0) {
											echo '<div class="control-group"><label class="control-label">&nbsp;</label><div class="controls"><span class="text">' . $this->lang->line('wallet_3') . ': ' . number_format($row->credit_amount, 2, '.', '') . '</span></div></div>';
										}
										else if($row->transaction_type == 2 && $row->credit_amount > 0) {
											echo '<div class="control-group"><label class="control-label">&nbsp;</label><div class="controls"><span class="text">' . $this->lang->line('wallet_5') . ': ' . number_format($row->credit_amount, 2, '.', '') . '</span></div></div>';
										}
									}
								}
							}
						?>
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_coin_info');?></h3>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('wallet_1');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($v_unit) ? $v_unit :  (isset($profile['v_unit']) ? $profile['v_unit'] : '0.00');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('wallet_2');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($v_unit2) ? $v_unit2 :  (isset($profile['v_unit2']) ? $profile['v_unit2'] : '0.00');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('wallet_3');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($v_unit3) ? $v_unit3 :  (isset($profile['v_unit3']) ? $profile['v_unit3'] : '0.00');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('wallet_4');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($v_unit4) ? $v_unit4 :  (isset($profile['v_unit4']) ? $profile['v_unit4'] : '0.00');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('wallet_5');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($v_unit5) ? $v_unit5 :  (isset($profile['v_unit5']) ? $profile['v_unit5'] : '0.00');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('wallet_6');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($v_unit6) ? $v_unit6 :  (isset($profile['v_unit6']) ? $profile['v_unit6'] : '0.00');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('wallet_7');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($v_unit7) ? $v_unit7 :  (isset($profile['v_unit7']) ? $profile['v_unit7'] : '0.00');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('wallet_8');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($v_unit8) ? $v_unit8 :  (isset($profile['v_unit8']) ? $profile['v_unit8'] : '0.00');?></span>
							</div>
						</div>
						
						<h3 class="form-section"><?php echo $this->lang->line('member_reinvest_package');?></h3>
						<?php 
							if(isset($reinvest)) {
								if($reinvest->num_rows() > 0) {
									foreach($reinvest->result() as $row) {
						?>
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('member_package');?>:</label>
							<div class="controls">
								<span class="text"><?php echo $this->lang->line(get_package($row->reinvest_package_type));?></span>
							</div>
						</div>
						<?php
									}
								}
							}
						?>
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_personal_info');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_status');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="active" name="active" class="m-wrap span4">
									<?php
										foreach(get_account_status() as $k => $v) {
											if(isset($active)) {
												if($k == $active) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 1) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_name');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="text" id="full_name" name="full_name" class="m-wrap span4" value="<?php echo isset($full_name) ? htmlspecialchars($full_name, ENT_QUOTES) : '';?>">
							</div>
						</div>    
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_date_of_birth');?>: </label>
							<div class="controls">
								<div class="input-append date date-picker" data-date="<?php echo date('Y-m-d');?>" data-date-format="yyyy-mm-dd" data-date-viewmode="years">
									<input class="m-wrap m-ctrl-medium date-picker" readonly size="16" type="text" id="dob" name="dob" value="<?php echo isset($dob) ? htmlspecialchars($dob, ENT_QUOTES) : '';?>"><span class="add-on"><i class="icon-calendar"></i></span>
								</div>
							</div>
						</div>  
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_gender');?>: </label>
							<div class="controls">
								<select id="gender" name="gender" class="m-wrap span2">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_gender() as $k => $v) {
											if(isset($gender)) {
												if($k == $gender) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_id_file');?>: </label>
							<div class="controls">
								<select id="id_type" name="id_type" class="m-wrap span2">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_id_type() as $k => $v) {
											if(isset($id_type)) {
												if($k == $id_type) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_id_no');?>: </label>
							<div class="controls">
								<input type="text" id="id_no" name="id_no" class="m-wrap span4" value="<?php echo isset($id_no) ? htmlspecialchars($id_no, ENT_QUOTES) : '';?>">
							</div>
						</div>  
						
						<?php if(file_exists('./../miner/uploads/' . md5($this->uri->segment(3) . '_id_file_' . $this->config->item('encryption_key')) . '.jpg')){?>
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_id_file');?>: </label>
							<div class="controls">
								<a href="<?php echo str_replace('backoffice', 'miner', base_url()) . 'uploads/' . md5($this->uri->segment(3) . '_id_file_' . $this->config->item('encryption_key')) . '.jpg';?>" target="_blank"><img src="<?php echo str_replace('backoffice', 'miner', base_url()) . 'uploads/' . md5($this->uri->segment(3) . '_id_file_' . $this->config->item('encryption_key')) . '.jpg';?>" border="0" width="150" /></a>
							</div>
						</div>  
						<?php }?>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_nationality');?>: </label>
							<div class="controls">
								<select id="nationality" name="nationality" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_country_name() as $k => $v) {
											if(isset($nationality)) {
												if($k == $nationality) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 'MY') {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>  
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_email');?>:</label>
							<div class="controls">
								<input type="text" id="email" name="email" class="m-wrap span4" value="<?php echo isset($email) ? htmlspecialchars($email, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_mobile_number');?>: </label>
							<div class="controls">
								<input type="text" id="mobile_no" name="mobile_no" class="m-wrap span4" value="<?php echo isset($mobile_no) ? htmlspecialchars($mobile_no, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_address');?>: </label>
							<div class="controls">
								<input type="text" id="address" name="address" class="m-wrap span4" value="<?php echo isset($address) ? htmlspecialchars($address, ENT_QUOTES) : '';?>">
							</div>
						</div>

						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_city_town');?>: </label>
							<div class="controls">
								<input type="text" id="city" name="city" class="m-wrap span4" value="<?php echo isset($city) ? htmlspecialchars($city, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_zip_postal_code');?>: </label>
							<div class="controls">
								<input type="text" id="postal_code" name="postal_code" class="m-wrap span4" value="<?php echo isset($postal_code) ? htmlspecialchars($postal_code, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_state_province');?>: </label>
							<div class="controls">
								<input type="text" id="state" name="state" class="m-wrap span4" value="<?php echo isset($state) ? htmlspecialchars($state, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_country');?>: </label>
							<div class="controls">
								<select id="country" name="country" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_country_name() as $k => $v) {
											if(isset($country)) {
												if($k == $country) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 'MY') {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_bank_info');?></h3>

						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_name');?>: </label>
							<div class="controls">
								<input type="text" id="bank_name" name="bank_name" class="m-wrap span4" value="<?php echo isset($bank_name) ? htmlspecialchars($bank_name, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_account_no');?>: </label>
							<div class="controls">
								<input type="text" id="bank_account_no" name="bank_account_no" class="m-wrap span4" value="<?php echo isset($bank_account_no) ? htmlspecialchars($bank_account_no, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_account_holder_name');?>: </label>
							<div class="controls">
								<input type="text" id="account_holder_name" name="account_holder_name" class="m-wrap span4" value="<?php echo isset($account_holder_name) ? htmlspecialchars($account_holder_name, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_address');?>: </label>
							<div class="controls">
								<input type="text" id="bank_address" name="bank_address" class="m-wrap span4" value="<?php echo isset($bank_address) ? htmlspecialchars($bank_address, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_country');?>: </label>
							<div class="controls">
								<select id="bank_country" name="bank_country" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_country_name() as $k => $v) {
											if(isset($bank_country)) {
												if($k == $bank_country) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 'MY') {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_swift_code');?>: </label>
							<div class="controls">
								<input type="text" id="bank_swift_code" name="bank_swift_code" class="m-wrap span4" value="<?php echo isset($bank_swift_code) ? htmlspecialchars($bank_swift_code, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_coin_wallet_address');?>: </label>
							<div class="controls">
								<input type="text" id="wallet_address" name="wallet_address" class="m-wrap span4" value="<?php echo isset($wallet_address) ? htmlspecialchars($wallet_address, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_permission');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_withdraw_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_withdraw" name="allowed_withdraw" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_withdraw)) {
												if($k == $allowed_withdraw) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_withdraw_unlimited');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="unlimited_withdraw" name="unlimited_withdraw" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($unlimited_withdraw)) {
												if($k == $unlimited_withdraw) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_transfer_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_transfer" name="allowed_transfer" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_transfer)) {
												if($k == $allowed_transfer) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_convert_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_convert" name="allowed_convert" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_convert)) {
												if($k == $allowed_convert) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_topup_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_topup" name="allowed_topup" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_topup)) {
												if($k == $allowed_topup) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_game_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_game" name="allowed_game" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_game)) {
												if($k == $allowed_game) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="member-form-9" class="form-horizontal" method="post" action="<?php echo base_url();?>member/update_insurance_date/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form-9')">
						
						<h3 class="form-section"><?php echo $this->lang->line('insurance_expiry_date');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('insurance_expiry_date');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<div class="input-append date insurance-date-picker" data-date="<?php echo date('d-m-Y');?>" data-date-format="dd-mm-yyyy" data-date-viewmode="years">
									<input class="m-wrap m-ctrl-medium insurance-date-picker" readonly size="16" type="text" name="insurance_date" value="<?php echo isset($insurance_date) ? date('d-m-Y', $insurance_date) : (isset($profile['insurance_date']) ? date('d-m-Y', $profile['insurance_date']) : date('d-m-Y'));?>" /><span class="add-on"><i class="icon-calendar"></i></span>
								</div>
							</div>
						</div>

						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_security_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="security_key" name="security_key" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<span class="help-block mandatory"><?php echo $this->lang->line('registration_avoid_bonus_hour');?></span>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>

				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="member-form-2" class="form-horizontal" method="post" action="<?php echo base_url();?>member/reinvest/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form-2')">
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_reinvest');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_package');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="reinvest_package_type" name="reinvest_package_type" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										if($package_listing->num_rows() > 0) {
											foreach($package_listing->result() as $row) {
												if(isset($reinvest_package_type)) {
													if($row->package_id == $reinvest_package_type) {
														echo '<option value="' . $row->package_id . '" selected="selected">' . $row->package_name . '</option>';
													}
													else {
														echo '<option value="' . $row->package_id. '">' . $row->package_name . '</option>';
													}
												}
												else {
													echo '<option value="' . $row->package_id. '">' . $row->package_name . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>

						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_security_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="security_key" name="security_key" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<span class="help-block mandatory"><?php echo $this->lang->line('registration_avoid_bonus_hour');?></span>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="member-form-8" class="form-horizontal" method="post" action="<?php echo base_url();?>member/update_introducer_name/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form-8')">
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_update_introducer_name');?></h3>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_introducer');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="text" id="introducer" name="introducer" class="m-wrap span4" value="<?php echo isset($introducer) ? $introducer : (isset($profile['introducer']) ? $profile['introducer'] : '');?>">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_security_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="security_key" name="security_key" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<span class="help-block mandatory"><?php echo $this->lang->line('registration_avoid_bonus_hour');?></span>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="member-form-7" class="form-horizontal" method="post" action="<?php echo base_url();?>member/upgrade_level/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form-1')">
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_upgrade_level');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_level');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="special_level" name="special_level" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_level(-1) as $k => $v) {
											if(isset($special_level)) {
												if($k == $special_level) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_security_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="security_key" name="security_key" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<span class="help-block mandatory"><?php echo $this->lang->line('registration_avoid_bonus_hour');?></span>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
				
				<div class="portlet-body form" style="display: none;">

					<!-- BEGIN FORM-->

					<form id="member-form-1" class="form-horizontal" method="post" action="<?php echo base_url();?>member/upgrade/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form-1')">
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_upgrade_package');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_package');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="special_package_type" name="special_package_type" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										if($package_listing->num_rows() > 0) {
											foreach($package_listing->result() as $row) {
												if(isset($special_package_type)) {
													if($row->package_id == $special_package_type) {
														echo '<option value="' . $row->package_id . '" selected="selected">' . $row->package_name . '</option>';
													}
													else {
														echo '<option value="' . $row->package_id. '">' . $row->package_name . '</option>';
													}
												}
												else {
													echo '<option value="' . $row->package_id. '">' . $row->package_name . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<span class="help-block mandatory"><?php echo $this->lang->line('registration_avoid_bonus_hour');?></span>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_upgrade_package');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
				
				<div class="portlet-body form" style="display: none;">

					<!-- BEGIN FORM-->

					<form id="member-form-3" class="form-horizontal" method="post" action="<?php echo base_url();?>member/update_username/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form-3')">
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_update_username');?></h3>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('registration_username');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="text" id="username" name="username" class="m-wrap span4" value="<?php echo isset($username) ? $username : (isset($profile['username']) ? $profile['username'] : '');?>">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_security_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="security_key" name="security_key" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<span class="help-block mandatory"><?php echo $this->lang->line('registration_avoid_bonus_hour');?></span>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="member-form-4" class="form-horizontal" method="post" action="<?php echo base_url();?>member/update_package/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form-4')">
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_update_package');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_package');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="package_type" name="package_type" class="m-wrap span4">
									<?php
										if($package_listing->num_rows() > 0) {
											foreach($package_listing->result() as $row) {
												if(isset($package_type)) {
													if($row->package_id == $package_type) {
														echo '<option value="' . $row->package_id . '" selected="selected">' . $row->package_name . '</option>';
													}
													else {
														echo '<option value="' . $row->package_id. '">' . $row->package_name . '</option>';
													}
												}
												else {
													echo '<option value="' . $row->package_id. '">' . $row->package_name . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_security_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="security_key" name="security_key" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<span class="help-block mandatory"><?php echo $this->lang->line('registration_avoid_bonus_hour');?></span>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="member-form-5" class="form-horizontal" method="post" action="<?php echo base_url();?>member/update_member_type/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form-5')">
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_update_member_type');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_member_type');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="member_type" name="member_type" class="m-wrap span4">
									<?php
										foreach(get_member_type() as $k => $v) {
											if(isset($member_type)) {
												if($k == $member_type) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_security_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="security_key" name="security_key" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<span class="help-block mandatory"><?php echo $this->lang->line('registration_avoid_bonus_hour');?></span>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="member-form-6" class="form-horizontal" method="post" action="<?php echo base_url();?>member/delete/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('member-form-6')">
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_delete_member');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_security_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="security_key" name="security_key" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" >&nbsp;</label>
							<div class="controls">
								<span class="help-block mandatory"><?php echo $this->lang->line('registration_avoid_bonus_hour');?></span>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_delete');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
			</div>					
		</div><!-- End span12 -->
		
	</div> <!-- End Row Fluid -->
	
<?php $this->load->view('footer');?>