<?php

// Prevent Direct Access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$contact_title = get_theme_mod('contact_title');

$contact_info_display = get_theme_mod('contact_info_display', true);
$contact_info_phone = get_theme_mod('contact_info_phone');
$contact_info_email = get_theme_mod('contact_info_email');
$contact_info_address = get_theme_mod('contact_info_address');

$contact_form_display = get_theme_mod('contact_form_display', true);
$contact_form_id = get_theme_mod('contact_form_id');

$contact_map_display = get_theme_mod('contact_map_display', true);
$contact_map_iframe = get_theme_mod('contact_map_iframe', '');

if($contact_map_display && ($contact_form_display || $contact_info_display)){
	$map_class = 'bghalf';
	$info_class = 'col-sm-6';
}
else{
	$map_class = '';
	$info_class = 'col-xs-12';
}

$section_id = get_theme_mod('contact_menu_id', 'contact');

?>

<section class="bg bglight" id="<?php echo $section_id ?>">

	<?php if($contact_map_display){ ?>
	<div class="<?php echo $map_class ?> equalheight">
		<div id="maxo-map">
			<?php if($contact_map_iframe != ''){ echo $contact_map_iframe; } ?>
		</div>
	</div>
	<?php } ?>
	
	<?php if($contact_info_display || $contact_form_display){ ?>
	<div class="container-fluid">
		<div class="row">
		
			<div class="<?php echo $info_class ?>">
				<div class="padding equalheight darkcolor left">
				
				
					<?php if( $contact_title != '' ){ echo '<h2 class="bottom25 secondary_font">'.$contact_title.'</h2>'; } ?>
					
					
					<?php if($contact_info_display){ ?>
					
					<?php if($contact_info_phone != ''){ ?>
					<div class="locations top15">
						<i class="fa fa-phone"></i>
						<span class="ltr_text"><?php echo $contact_info_phone ?></span>
					</div>
					<?php } ?>
					
					<?php if($contact_info_email != ''){ ?>
					<div class="locations top15">
						<i class="fa fa-envelope-o"></i>
						<span class="ltr_text"><a href="<?php echo $contact_info_email ?>"><?php echo $contact_info_email ?></a></span>
					</div>
					<?php } ?>
					
					<?php if($contact_info_address != ''){ ?>
					<div class="locations top15">
						<i class="fa fa-map-marker"></i>
						<span><?php echo $contact_info_address ?></span>
					</div>
					<?php } ?>
					
					<?php } ?>
					
					
					<?php
					if($contact_form_display){
						echo do_shortcode('[contact-form-7 id="'.$contact_form_id.'" title="'.esc_html__('Contact Form', 'maxo-fa').'" html_class="callus top40"]');
					} 
					?>
					
					
				</div>
			</div>
			
		</div>
	</div>
	<?php } ?>
	
</section>