<?php
/**
 * The template for displaying all pages.
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site may use a
 * different template.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package WP_Corporate
 */

get_header();

 $parents = get_post_ancestors( $post->ID ); $parentName=apply_filters( "the_title", get_the_title( end ( $parents ) ) ); $parentUrl=apply_filters( "page_link", get_page_link( end ( $parents ) ) ); ?>

<!--header class="page-header">
	<?php the_title( '<h1 class="page-title">', '</h1>' ); ?>

</header><!-- .page-header -->
<div id="coverBlock">
				

<div class="ed-container">
    <h1><?php the_title();?></h1>

<p class="newAmps-crumb"><a href="<?php echo get_site_url();?>">Home</a><span class="fa fa-chevron-right"></span><?php if(get_the_title($post->ID)!=='Contact Us'){ echo '<a href="#">'.$parentName.'</a><span class="fa fa-chevron-right"></span>'; } ?><a href="#"><?php the_title();?></a></p>
</div>
    </div>

<div class="ed-container">
	<?php 
	global $post;
	$sidebar = get_post_meta($post->ID, 'wp_corporate_sidebar_layout', true);
	if(empty($sidebar)){
		$sidebar= get_theme_mod('wp_corporate_innerpage_setting_single_page_layout','right-sidebar');
	}
	if($sidebar=='both-sidebar'){
		?>
		<div class="left-sidebar-right">
			<?php
		}
		?>
		<div id="primary" class="content-area">
			<main id="main" class="site-main" role="main">
				
				<?php do_action('wp_corporate_header_allslider');?>
				<?php
				while ( have_posts() ) : the_post();

				get_template_part( 'template-parts/content', 'page' );
					// If comments are open or we have at least one comment, load up the comment template.
				if ( comments_open() || get_comments_number() ) :
					comments_template();
				endif;

				endwhile; // End of the loop.
				?>

			</main><!-- #main -->
		</div><!-- #primary -->
		<?php 
		if($sidebar=='left-sidebar' || $sidebar=='both-sidebar'){
			get_sidebar('left');
		}
		if($sidebar=='both-sidebar'){
			?>
		</div>
		<?php
	}
	if($sidebar=='right-sidebar' || $sidebar=='both-sidebar'){
		get_sidebar('right');
	}
	?>
</div>
<?php if(get_the_title($post->ID)=='Contact Us'){ ?>
<script src='https://maps.googleapis.com/maps/api/js?v=3.exp&key=AIzaSyDgLWtG5JqwqujZTDwHtCS5-ngNNcRCuIM'></script>
<script>'use strict';
var map,marker,
    EasingAnimator = function EasingAnimator(opt) {
    opt = opt || {};
    this.easingInterval = opt.easingInterval;
    this.duration = opt.duration || 1000;
    this.step = opt.step || 50;
    this.easingFn = opt.easingFn || function easeInOutElastic(t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
        return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
    };
    this.callBack = opt.callBack || function () {};
};
EasingAnimator.makeFromCallback = function (callBack) {
    return new EasingAnimator({
        callBack: callBack
    });
};
EasingAnimator.prototype.easeProp = function (obj, propDict) {
    propDict = propDict || {};
    var self = this,
        t = 0,
        out_vals = JSON.parse(JSON.stringify(obj));
    clearInterval(self.easingInterval);
    self.easingInterval = setInterval(function () {
        t += self.step;
        if (t >= self.duration) {
            clearInterval(self.easingInterval);
            self.callBack(propDict);
            return;
        }
        var percent = self.easingFn(t, 0, 1, self.duration);
        Object.keys(propDict).forEach(function (key, i) {
            var old_val = obj[key];
            out_vals[key] = old_val - percent * (old_val - propDict[key]);
        });
        self.callBack(out_vals);
    }, self.step);
};
function initialize() {
//LatLong of 4 Office locations are to be added bellow in a js assoc array
    var points = [{ lat: 22.5125371, lng: 88.3912322 }, { lat: 25.0368893, lng: 55.1887548 }, { lat: 28.5002838, lng: 77.09702 }, { lat: 29.7268107, lng: -95.6531723 }],
    labels = ['Corporate Office & HQ', 'Techcarrot FZ LLC', 'NCR Branch Office', 'US & AMERICA contact center'],
        sel_point = 0;
    map = new google.maps.Map(document.getElementById('map'), {
        zoom: 15,
        center: points[sel_point]
    });
    marker = new google.maps.Marker({
        position: points[sel_point],
        label: {text: labels[sel_point], color: '#000'},
        map: map
    });
    var easingAnimator = EasingAnimator.makeFromCallback(function (latLng) {
        map.setCenter(latLng);
    });
    Array.prototype.slice.apply(document.querySelectorAll('.map_keep__button')).map(function (dom_elem, i) {
        dom_elem.addEventListener('click', function (event) {
            var point = map.getCenter();
            marker.setPosition(points[i]);
            marker.setLabel({text: labels[i], color: '#000'});
            easingAnimator.easeProp({
                lat: point.lat(),
                lng: point.lng()
            }, points[i]);
        });
    });
}
google.maps.event.addDomListener(window, 'load', initialize);
//# sourceURL=pen.js
</script>
<?php } get_footer();
