<?php
// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) {
	exit;
}
?>

<?php 
/**
 * Template Name: Contact Page
 */ 
__( 'Contact Page', 'profile' );
?>

<?php get_header(); ?>

</div> <!-- // top_wrap -->

<div class="grid">
	
	<?php
	global $post;
	
	$frag = new IMI_Fragment_Cache( 'crb' , get_permalink( $post->ID ) );
	
	if ( !$frag->output() ) {
	?>
	
		<?php the_breadcrumbs(); ?>
	
		<?php
		
		$frag->store();
	}
	?>
	
	<?php
	$frag = new IMI_Fragment_Cache( 'pst' , get_permalink( $post->ID ) );

	if ( !$frag->output() ) {
	?>
	
		<main id="main_internal" class="full_width">
		
			<div id="contact"><!--
			
				--><div class="inline">
					
						<section class="c_box contact_address ib <?php $field = get_field( 'cp_branch_rep' ); if( !$field ) echo 'big'; ?>">
							
							<div class="bg"><div class="box_style shaded"></div></div>
							
							<div class="divin">
							
								<h1 class="c1"><?php the_title(); ?></h1>
								
								<address class="runner">
								
									<?php the_field( 'cp_content' ); ?>
									
								</address>
								
							</div>
							
						</section><!--
					
					<?php if ( $branches = get_field( 'cp_branch_rep' ) ) { ?>
					
					--><section class="c_box thin ib has_map"><div class="bg"><div class="box_style shaded"></div></div><div class="divin">
							
							<h2 class="ff_text"><?php the_field( 'cp_map_title' ); ?></h2>
								
								<div class="branches"><!--
									
									<?php foreach ( $branches as $bk => $bv ) { ?>
									
									--><span class="bh">
										
										<a id="branch<?php echo $bk + 1; ?>" class="branch<?php if ($bk == 0) { ?> active<?php } ?>" href="javascript:void(0)"><?php echo $bv['cp_br_r_title']; ?></a>
										
									</span><!--
									
									<?php } ?>
                                    
								--></div>
								
								<div class="maps">
									
									<?php foreach ( $branches as $br ) { ?>
									
									<div class="gmap" data-address='<?php echo $br['cp_br_r_address']; ?>'></div>
									
									<?php } ?>
									
								</div>
								
					</div></section><!--
					
					<?php } else echo '--><section class="c_box thin ib has_map" style="display: none;"></section><!--'; ?>
					
				--></div><!--
				
				--><section class="c_box thin ib main_form <?php $field = get_field( 'cp_branch_rep' ); if( !$field ) echo 'big'; ?>">
				
					<div class="bg"><div class="box_style shaded gradient"></div></div><div class="divin">
					
					<h2 class="ff_text"><?php the_field( 'htb_ct_title','option' ); ?></h2>
					
					<form method="post">
						
						<div class="text runner_s">
						
							<?php the_field( 'htb_ct_subtitle', 'option' ); ?>
							
						</div><!--
						
						--><div class="bf_s"><input type="text" placeholder="<?php echo __( 'Full Name', 'profile' ); ?>" name="full_name" autocomplete="off"></div><!--
						
						--><div class="bf_s"><input type="tel" placeholder="<?php echo __( 'Phone', 'profile' ); ?>" name="phone" autocomplete="off"></div><!--
						
						--><div class="bf_s"><input type="email" placeholder='<?php echo __( 'Email', 'profile' ); ?>' name="email" autocomplete="off"></div><!--
						
						--><div class="bf_s subject"><textarea placeholder="<?php echo __( 'Subject', 'profile' ); ?>" name="message"></textarea></div><!--
						
						<?php if ( get_field( 'recaptcha', 'option' ) ) { ?>
						
							<?php if ( $public_key = get_field( 'recaptcha_key', 'option' ) ) { ?>
							
							--><div class="gr_hold loading">
								
								<input type="hidden" value="<?php echo md5( $post->ID ); ?>" name="gid">
								
								<div class="g-recaptcha" id="<?php echo md5( $post->ID ); ?>" data-key="<?php echo $public_key; ?>"></div>
								
							</div><!--
							
							<?php } ?>
						
						<?php } ?>
						
						--><fieldset class="">
							
							<label class="side_checkbox">
								<input type="checkbox" value="1" checked name="approve"> 
								<span><?php echo __( 'Allow updates', 'profile' ); ?></span>
							</label>
						
							<span class="has_submit"><input class="spread ff" type="submit" value="<?php echo __( 'Send', 'profile' ); ?>"/></span>	
						
						</fieldset>
						
					</form>
					
				</div></section><!--
				
			--></div><!--
			
		--></main>
		
		<?php
		
		$frag->store();
	}
	?>
	
</div>

<?php get_footer(); ?>