<div class="panel panel-default pjCcMain">
	<?php
	include_once dirname(__FILE__) . '/elements/header.php';
	
	$FORM = @$_SESSION[$controller->defaultForm];
	?>

	<div class="panel-body pjCcBody">
		<div class="row">
			<aside class="col-lg-3 col-md-3 col-sm-4 col-xs-12 pull-right pjCcAside">
				<div class="panel panel-default">
					<header class="panel-heading pjCcAsideHead">
						<p class="panel-title pjCcAsideTitle"><?php __('front_your_booking')?></p><!-- /.panel-title pjCcAsideTitle -->
					</header><!-- /.panel-heading pjCcAsideHead -->

					<div class="panel-body pjCcAsideBody">
						<?php
						include_once dirname(__FILE__) . '/elements/booking.php';
						?>
					</div><!-- /.panel-body pjCcAsideBody -->
				</div><!-- /.panel panel-default -->
			</aside><!-- /.col-lg-3 col-md-3 col-sm-4 col-xs-12 pull-right pjCcAside -->

			<div class="col-lg-9 col-md-9 col-sm-8 col-xs-12 pull-left pjCcContent">
				<div class="pjCcForm pjCcFormAddress">
					<form id="pjCbsCheckoutForm_<?php echo $_GET['index'];?>" name="pjCbsCheckoutForm" action="#" method="post" role="form">
						<input type="hidden" name="cbs_checkout" value="1" />
						<header class="pjCcFormHead">
							<p class="pjCcFormTitle"><?php __('front_your_address');?></p><!-- /.pjCcFormTitle -->
						</header><!-- /.pjCcFormHead -->

						<div class="row pjCcFormBody">
							<?php
							if (in_array((int) $tpl['option_arr']['o_bf_include_address'], array(2,3)))
							{
								?>
								<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
									<div class="form-group">
										<input type="text" id="c_address" name="c_address" placeholder="<?php __('front_address'); ?>" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_address'] === 3 ? ' required' : NULL; ?>" value="<?php echo pjSanitize::html(@$FORM['c_address']); ?>" data-msg-required="<?php __('pj_field_required'); ?>">
								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<?php
							}
							if (in_array((int) $tpl['option_arr']['o_bf_include_city'], array(2,3)))
							{
								?>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<input type="text" id="c_city" name="c_city" placeholder="<?php __('front_city'); ?>" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_city'] === 3 ? ' required' : NULL; ?>" value="<?php echo pjSanitize::html(@$FORM['c_city']); ?>" data-msg-required="<?php __('pj_field_required'); ?>">
								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<?php
							}
							if (in_array((int) $tpl['option_arr']['o_bf_include_state'], array(2,3)))
							{
								?>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<input type="text" id="c_state" name="c_state" placeholder="<?php __('front_state'); ?>" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_state'] === 3 ? ' required' : NULL; ?>" value="<?php echo pjSanitize::html(@$FORM['c_state']); ?>" data-msg-required="<?php __('pj_field_required'); ?>">
								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<?php
							}
							if (in_array((int) $tpl['option_arr']['o_bf_include_zip'], array(2,3)))
							{
								?>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<input type="text" id="c_zip" name="c_zip" placeholder="<?php __('front_zip'); ?>" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_zip'] === 3 ? ' required' : NULL; ?>" value="<?php echo pjSanitize::html(@$FORM['c_zip']); ?>" data-msg-required="<?php __('pj_field_required'); ?>">
								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<?php
							}
							if (in_array((int) $tpl['option_arr']['o_bf_include_country'], array(2,3)))
							{
								?>
								<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
									<div class="form-group">
										<select id="c_country" name="c_country" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_country'] === 3 ? ' required' : null;?>" data-msg-required="<?php __('pj_field_required'); ?>">
											<option value="">-- <?php __('front_country');?> --</option>
											<?php
											foreach($tpl['country_arr'] as $k => $v) 
											{
												?><option value="<?php echo $v['id'];?>"<?php echo isset($FORM['c_country']) ? ($FORM['c_country'] == $v['id'] ? ' selected="selected"' : null) : null;?>><?php  echo $v['country_title'];?></option><?php
											}
											?>
										</select>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<?php
							}
							if (in_array((int) $tpl['option_arr']['o_bf_include_title'], array(2,3)))
							{
								?>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<select id="c_title" name="c_title" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_title'] === 3 ? ' required' : null;?>" data-msg-required="<?php __('pj_field_required'); ?>">
											<option value="">-- <?php __('front_title'); ?>-- </option>
											<?php
											foreach(__('personal_titles', true) as $k => $v) 
											{
												?><option value="<?php echo $k;?>"<?php echo isset($FORM['c_title']) ? ($FORM['c_title'] == $k ? ' selected="selected"' : null) : null;?>><?php  echo $v;?></option><?php
											}
											?>
										</select>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<?php
							}
							if (in_array((int) $tpl['option_arr']['o_bf_include_name'], array(2,3)))
							{
								?>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<input type="text" id="c_name" name="c_name" placeholder="<?php __('front_name'); ?>" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_name'] === 3 ? ' required' : NULL; ?>" value="<?php echo pjSanitize::html(@$FORM['c_name']); ?>" data-msg-required="<?php __('pj_field_required'); ?>">
								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
								    </div>
								</div>
								<?php
							}
							if (in_array((int) $tpl['option_arr']['o_bf_include_email'], array(2,3)))
							{
								?>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<input type="text" id="c_email" name="c_email" placeholder="<?php __('front_email'); ?>" class="form-control email<?php echo (int) $tpl['option_arr']['o_bf_include_email'] === 3 ? ' required' : NULL; ?>" value="<?php echo pjSanitize::html(@$FORM['c_email']); ?>" data-msg-required="<?php __('pj_field_required'); ?>" data-msg-email="<?php __('pj_email_validation'); ?>">
								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<?php
							}
							if (in_array((int) $tpl['option_arr']['o_bf_include_phone'], array(2,3)))
							{
								?>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<input type="text" id="c_phone" name="c_phone" placeholder="<?php __('front_phone'); ?>" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_phone'] === 3 ? ' required' : NULL; ?>" value="<?php echo pjSanitize::html(@$FORM['c_phone']); ?>" data-msg-required="<?php __('pj_field_required'); ?>">
								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<?php
							}
							?>
							
							<div class="col-lg-10 col-md-12 col-sm-12 col-xs-12">
								<div class="form-group pjCcFormRadios">
									<div class="pjCcRadio pjCcCustomRadio">
										<input type="radio" id="pjCcCustomRadioGroup1" name="home" value="someone"<?php echo isset($FORM['home']) ? ($FORM['home'] == 'someone' ? ' checked="checked"' : NULL ) : ' checked="checked"';?> autocomplete="off" />
											
										<label for="pjCcCustomRadioGroup1">
											<span class="pjCcCustomRadioFake"></span>
											
											<?php __('front_someone_is_home');?>
										</label>
									</div><!-- /.pjCcRadio pjCcCustomRadio -->
							
									<div class="pjCcRadio pjCcCustomRadio">
										<input type="radio" id="pjCcCustomRadioGroup2" name="home" value="hidekey"<?php echo isset($FORM['home']) && $FORM['home'] == 'hidekey' ? ' checked="checked"' : NULL;?> autocomplete="off" />
											
										<label for="pjCcCustomRadioGroup2">
											<span class="pjCcCustomRadioFake"></span>
											
											<?php __('front_i_hide_the_key');?>
										</label>
									</div><!-- /.pjCcRadio pjCcCustomRadio -->
								</div><!-- /.form-group pjCcFormRadios -->
							</div><!-- /.col-lg-10 col-md-12 col-sm-12 col-xs-12 -->
							<?php
							if (in_array((int) $tpl['option_arr']['o_bf_include_notes'], array(2,3)))
							{
								?>
								<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
									<div class="form-group">
										<textarea id="c_notes" name="c_notes" cols="30" rows="10" placeholder="<?php __('front_notes')?>" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_notes'] === 3 ? ' required' : NULL; ?>" data-msg-required="<?php __('pj_field_required'); ?>"><?php echo pjSanitize::html(@$FORM['c_notes']); ?></textarea>
								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<?php
							}
							?>
						</div><!-- /.row pjCcFormBody -->
						
						<?php
						if ($tpl['option_arr']['o_payment_disable'] == 'No')
						{
							?>
							<header class="pjCcFormHead">
								<p class="pjCcFormTitle"><?php __('front_payment_method');?></p><!-- /.pjCcFormTitle -->
							</header><!-- /.pjCcFormHead -->
							
							<div class="row pjCcFormBody">
								<div class="col-lg-5 col-md-5 col-sm-8 col-xs-8">
									<div class="form-group">
										<select name="payment_method" class="form-control required" data-msg-required="<?php __('pj_field_required'); ?>">
											<option value="">-- <?php __('front_payment_method');?> --</option>
											<?php
											foreach (__('payment_methods', true) as $k => $v)
											{
												if ($tpl['option_arr']['o_allow_' . $k] === "Yes")
												{
													?><option value="<?php echo $k; ?>"<?php echo @$FORM['payment_method'] != $k ? NULL : ' selected="selected"'; ?>><?php echo $v; ?></option><?php
												}
											}
											?>
										</select>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
							</div><!-- /.row pjCcFormBody -->
							<div class="row pjCcFormBody pjCbsBankWrap" style="display: <?php echo @$FORM['payment_method'] != 'bank' ? 'none' : NULL; ?>">
								<div class="col-lg-5 col-md-5 col-sm-8 col-xs-8">
									<label class="text-muted"><?php echo nl2br(pjSanitize::html($tpl['option_arr']['o_bank_account'])); ?></label>
								</div>
							</div><!-- /.row pjCcFormBody -->
							<div class="row pjCcFormBody pjCbsCcWrap" style="display: <?php echo @$FORM['payment_method'] != 'creditcard' ? 'none' : NULL; ?>">
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<select name="cc_type" class="form-control required" data-msg-required="<?php __('pj_field_required'); ?>">
								    		<option value="">-- <?php __('front_cc_type');?> --</option>
								    		<?php
											foreach (__('cc_types', true) as $k => $v)
											{
												?><option value="<?php echo $k; ?>"<?php echo @$FORM['cc_type'] != $k ? NULL : ' selected="selected"'; ?>><?php echo $v; ?></option><?php
											}
											?>
								    	</select>
								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<input type="text" name="cc_num" placeholder="<?php __('front_cc_num');?>" class="form-control required" value="<?php echo pjSanitize::html(@$FORM['cc_num']); ?>"  autocomplete="off" data-msg-required="<?php __('pj_field_required'); ?>"/>
						    			<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<input type="text" name="cc_code" placeholder="<?php __('front_cc_code');?>" class="form-control required" value="<?php echo pjSanitize::html(@$FORM['cc_code']); ?>"  autocomplete="off" data-msg-required="<?php __('pj_field_required'); ?>"/>
						    			<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="row">
										<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
											<div class="form-group">
												<?php
												$rand = rand(1, 99999);
												$time = pjTime::factory()
													->attr('name', 'cc_exp_month')
													->attr('id', 'cc_exp_month_' . $rand)
													->attr('class', 'form-control required')
													->prop('format', 'F');
												if (isset($FORM['cc_exp_month']) && !is_null($FORM['cc_exp_month']))
												{
													$time->prop('selected', $FORM['cc_exp_month']);
												}
												echo $time->month();
												?>
											</div>
										</div>
										<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
											<div class="form-group">
												<?php
												$time = pjTime::factory()
													->attr('name', 'cc_exp_year')
													->attr('id', 'cc_exp_year_' . $rand)
													->attr('class', 'form-control required')
													->prop('left', 0)
													->prop('right', 10);
												if (isset($FORM['cc_exp_year']) && !is_null($FORM['cc_exp_year']))
												{
													$time->prop('selected', $FORM['cc_exp_year']);
												}
												echo $time->year();
												?>
											</div>
										</div>
									</div>
								</div>
							</div>
							<?php
						}
						if (in_array((int) $tpl['option_arr']['o_bf_include_captcha'], array(3)))
						{
							?>
							<br/>
							<div class="row pjCcFormBody">
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
									<div class="form-group">
										<div class="row">
											<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
												<img src="<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjFront&amp;action=pjActionCaptcha&amp;rand=<?php echo rand(1, 99999); ?><?php echo isset($_GET['session_id']) ? '&session_id=' . $_GET['session_id'] : NULL;?>" alt="Captcha" style="vertical-align: middle" />
											</div><!-- /.col-sm-4 -->
			
											<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
												<input type="text" name="captcha" placeholder="<?php __('front_captcha');?>" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_captcha'] === 3 ? ' required' : NULL; ?>" maxlength="6" autocomplete="off" data-msg-required="<?php __('pj_field_required'); ?>" data-msg-remote="<?php __('front_incorrect_captcha');?>">
		  								    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
											</div><!-- /.col-sm-4 -->
										</div><!-- /.row -->
									</div>
								</div>
							</div><!-- /.row pjCcFormBody -->
							<?php
						}

						$terms = __('front_agree_with_terms', true);
						if(!empty($tpl['terms_conditions']))
						{
							$terms = str_replace("{STAG}", '<a href="#" class="pjTbModalTrigger" data-toggle="modal" data-target="#pjNcbTermModal" data-title="'.__('front_terms_title', true).'">', $terms);
							$terms = str_replace("{ETAG}", '</a>', $terms);
						}else{
							$terms = str_replace("{STAG}", '', $terms);
							$terms = str_replace("{ETAG}", '', $terms);
						}
						?>
						<div class="row pjCcFormBody">
							<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
								<div class="form-group">
									<div class="checkbox">
										<label style="display: block;padding-bottom: 20px;">
											<input type="checkbox" name="terms" value="1" class="required" data-msg-required="<?php __('pj_field_required'); ?>">
									      	<?php echo $terms;?>
										</label>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div>
								</div>
							</div>
						</div><!-- /.row pjCcFormBody -->
						
						<footer class="clearfix pjCcFormFoot">
							<a href="#" data-load="loadDateTime" class="btn btn-info pull-left pjCcBtnBack pjCbsMenuItem"><?php __('front_btn_back');?></a>

							<button type="submit" class="btn btn-primary pull-right"><?php __('front_btn_confirm');?></button>
						</footer><!-- /.clearfix pjCcFormFoot -->
					</form>
					
					<div class="modal fade pjTbModal" id="pjNcbTermModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
					  	<div class="modal-dialog">
					    	<div class="modal-content">
					      		<div class="modal-header">
					        		<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only"><?php __('front_btn_close');?></span></button>
					        		<h4 class="modal-title pjTbModalTitle" id="myModalLabel"><?php __('front_terms_title', false, true); ?></h4>
					      		</div>
							    <div class="modal-body">
							    	<?php echo nl2br(stripslashes($tpl['terms_conditions'])); ?>
							    </div>
						      	<div class="modal-footer">
						        	<button type="button" class="btn btn-default" data-dismiss="modal"><?php __('front_btn_close');?></button>
						      	</div>
					    	</div>
					  	</div>
					</div>
					
				</div><!-- /.pjCcForm pjCcFormAddress -->
			</div><!-- /.col-lg-9 col-md-9 col-sm-8 col-xs-12 pull-left pjCcContent -->
		</div><!-- /.row -->
	</div><!-- /.panel-body pjCcBody -->
</div><!-- /.panel panel-default pjCcMain -->