<?php
$front_required = __('front_required', true);
$front_validation = __('front_validation', true); 
?>
<div class="heading"><?php __('front_label_register');?></div>
<div class="body">
	<form action="" method="post" name="ml_registration_form" class="ml-form">
		<input type="hidden" name="pjSelect" value="<?php echo $_GET['pjSelect'];?>"/>
		<?php
		if($_GET['pjSelect'] == 'Yes')
		{
			?>
			<p>
				<label class="title"><?php __('front_label_group');?></label>
				<span class="form-field">
					<select name="group_id" class="ml-select<?php echo $tpl['option_arr']['o_rf_include_fname'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['group']); ?>">
						<option value="">-- <?php __('front_label_choose'); ?>--</option>
						<?php
						foreach ($tpl['group_arr'] as $k => $v)
						{
							?><option value="<?php echo $v['id']; ?>" <?php echo isset($_GET['group_id']) ? ($_GET['group_id'] == $v['id'] ? 'selected="selected"' : null) : null;?>><?php echo $v['group_title']; ?></option><?php
						}
						?>
					</select>
				</span>
			</p>
			<?php
		}else{
			?><input type="hidden" name="group_id" value="<?php echo isset($_GET['group_id']) ? $_GET['group_id'] : null;?>"/><?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_fname'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_first_name');?> <?php if($tpl['option_arr']['o_rf_include_fname'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="first_name" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_fname'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['first_name']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_lname'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_last_name');?> <?php if($tpl['option_arr']['o_rf_include_lname'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="last_name" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_lname'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['last_name']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_email'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_email');?> <?php if($tpl['option_arr']['o_rf_include_email'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="email" class="ml-text email<?php echo $tpl['option_arr']['o_rf_include_email'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['email']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_password'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_password');?> <?php if($tpl['option_arr']['o_rf_include_password'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="password" name="password" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_password'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['password']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_phone'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_phone');?> <?php if($tpl['option_arr']['o_rf_include_phone'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="phone" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_phone'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['phone']); ?>" "/>
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_website'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_website');?> <?php if($tpl['option_arr']['o_rf_include_website'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="website" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_website'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['website']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_gender'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_gender');?> <?php if($tpl['option_arr']['o_rf_include_gender'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<select name="gender" class="ml-select<?php echo $tpl['option_arr']['o_rf_include_gender'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['gender']); ?>" >
						<option value="">-- <?php __('front_label_choose'); ?>--</option>
						<?php
						foreach (__('genderarr', true) as $k => $v)
						{
							?><option value="<?php echo $k; ?>"><?php echo $v; ?></option><?php
						}
						?>
					</select>
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_age'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_age');?> <?php if($tpl['option_arr']['o_rf_include_age'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="age" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_age'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['age']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_birthday'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_birthday');?> <?php if($tpl['option_arr']['o_rf_include_birthday'] == 3){?><span class="star">*</span><?php }?></label>
				<?php
				echo pjUtil::dateSuite($tpl['option_arr']['o_date_format'], '', '', ''); 
				?>
				<input type="hidden" name="birthday" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_birthday'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['birthday']); ?>" />
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_address'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_address');?> <?php if($tpl['option_arr']['o_rf_include_address'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="address" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_address'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['address']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_city'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_city');?> <?php if($tpl['option_arr']['o_rf_include_city'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="city" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_city'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['city']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_state'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_state');?> <?php if($tpl['option_arr']['o_rf_include_state'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="state" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_state'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['state']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_country'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_country');?> <?php if($tpl['option_arr']['o_rf_include_country'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<select name="country_id" class="ml-select<?php echo $tpl['option_arr']['o_rf_include_country'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['country']); ?>" >
						<option value="">-- <?php __('front_label_choose'); ?>--</option>
						<?php
						foreach ($tpl['country_arr'] as $k => $v)
						{
							?><option value="<?php echo $v['id']; ?>"><?php echo $v['country_title']; ?></option><?php
						}
						?>
					</select>
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_zip'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_zip');?> <?php if($tpl['option_arr']['o_rf_include_zip'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="zip" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_zip'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['zip']); ?>" />
				</span>
			</p>
			<?php
		}
		if (in_array($tpl['option_arr']['o_rf_include_company'], array(2, 3)))
		{ 
			?>
			<p>
				<label class="title"><?php __('front_label_company_name');?> <?php if($tpl['option_arr']['o_rf_include_company'] == 3){?><span class="star">*</span><?php }?></label>
				<span class="form-field">
					<input type="text" name="company_name" class="ml-text<?php echo $tpl['option_arr']['o_rf_include_company'] == 3 ? ' ml-required' : null;?>" lang="<?php echo htmlspecialchars($front_required['company_name']); ?>" />
				</span>
			</p>
			<?php
		}
		?>
		<p>
			<label class="title"><?php echo __('front_label_captcha'); ?> <span class="star">*</span></label>
			<span class="form-field"> 
				<span class="ml-captcha-container ml-w300">
					<input type="text" name="captcha" maxlength="6" class="ml-text ml-captcha ml-w100 ml-required" lang="<?php echo htmlspecialchars($front_required['captcha']); ?>" />
					<img id="ml_captcha_image" src="<?php echo PJ_INSTALL_FOLDER; ?>index.php?controller=pjFront&amp;action=pjActionCaptcha&amp;rand=<?php echo rand(1, 999999); ?><?php echo isset($_GET['session_id']) ? '&session_id=' . $_GET['session_id'] : NULL;?>" alt="Captcha" />
				</span>
			</span>
		</p>
		<div id="ml_fee_container">
			<p>
				<label class="title"><?php echo __('front_label_registration_fee'); ?></label>
				<label id="ml_registration_fee" class="content"></label>
			</p>
			<p>
				<label class="title"><?php echo __('front_label_subscription_fee'); ?></label>
				<label id="ml_subscription_fee" class="content"></label>
			</p>
		</div>
		<ul class="ml-error-container ml-register-error-container" style="display: none"></ul>
		<p class="ml-message-container ml-register-message-container" style="display: none"></p>
		<p>
			<label class="title empty">&nbsp;</label>
			<input type="button" value="<?php __('front_button_register'); ?>" name="ml_register_form_register" class="ml-button" />
		</p>
		<div id="pjSocialLoginContainer" style="display: none;">
			<p>
				<label class="title">&nbsp;</label>
				<label class="content">
					<?php
					if($tpl['option_arr']['o_facebook_allow'] == 'Yes' && $tpl['option_arr']['o_google_allow'] == 'Yes') 
					{
						?>
						<a id="pjMlFacebookLogin" href="<?php echo $tpl['loginUrl'];?>" class="ml-forgot-password" target="_blank"><?php __('front_register_with_facebook');?></a>
						&nbsp;&nbsp;|&nbsp;&nbsp;
						<a id="pjMlGoogleLogin" href="<?php echo $tpl['authUrl'];?>" class="ml-forgot-password"><?php __('front_register_with_google');?></a>
						<?php
					}else if($tpl['option_arr']['o_facebook_allow'] == 'Yes' && $tpl['option_arr']['o_google_allow'] == 'No'){
						?>
						<a id="pjMlFacebookLogin" href="<?php echo $tpl['loginUrl'];?>" class="ml-forgot-password" target="_blank"><?php __('front_register_with_facebook');?></a>
						<?php
					}else if($tpl['option_arr']['o_facebook_allow'] == 'No' && $tpl['option_arr']['o_google_allow'] == 'Yes'){
						?>
						<a id="pjMlGoogleLogin" href="<?php echo $tpl['authUrl'];?>" class="ml-forgot-password"><?php __('front_register_with_google');?></a>
						<?php
					} 
					?>
				</label>
			</p>
		</div>
	</form>
	<div id="ml_payment_container" style="display: none"></div>
</div>