<?php   
if (get_theme_mod('dinero_counter_enable', true) == true) { ?>
	<div class="counter-area text-center" id="counter">
	<div class="counter-bg"></div>
			<div class="<?php if(get_theme_mod('dinero_counter_section_width','Box Width') == 'Box Width'){ ?>container <?php } elseif(get_theme_mod('dinero_counter_section_width','Box Width') == 'Full Width'){ ?> container-fluid <?php }?>">
			<?php
			$showStatic = true;
			for( $i = 1; $i < 7; $i++ ){
				$url = get_theme_mod('dinero_counter_page_url_'.$i, '#');
				$link = get_theme_mod('dinero_counter_page_link'.$i);
				$dinero_counter_page_id = get_theme_mod('dinero_counter_page_icon'.$i); 
				if(!empty($dinero_counter_page_id)){
					$showStatic = false;
					break;
				}
			}
			$dinero_counter_page_id = get_theme_mod('dinero_counter_page');	
			$dinero_counter_maintitle = get_theme_mod('dinero_counter_maintitle', 'OUR INTRODUCTION');
			$dinero_counter_subtitle = get_theme_mod('dinero_counter_subtitle', 'Innovative and Preminum Service');
			
			?>
			
			<div class="row ">
				<?php if($dinero_counter_maintitle || $dinero_counter_subtitle){ ?>
					<div class="col-xl-12 col-lg-12 col-sm-12">
					<div class="dinero-section-head" style="text-align: <?php if(get_theme_mod('dinero_counter_head_align','Left') == 'Left'){ ?> left <?php } elseif(get_theme_mod('dinero_counter_head_align','Center') == 'Center'){ ?> center <?php } elseif(get_theme_mod('dinero_counter_head_align','Right') == 'Right'){ ?> right <?php } ?> ">
						<?php if($dinero_counter_maintitle){ ?>
		                        <h2><?php echo ($dinero_counter_maintitle);  ?></h2>
		                        <?php }?>
						   <?php if( get_theme_mod('dinero_counter_head_icon_enable','No') == 'Yes'){ ?>
      						<div class="dinero-section-head-icon">
  								<i class="<?php echo esc_attr(get_theme_mod('dinero_counter_head_icon', 'fa fa-bell')); ?>"></i>
  							</div>
  							<?php }?>
						<h3><?php echo ($dinero_counter_subtitle);  ?></h3>			
					</div>
				</div>
				<?php }?>
			</div>

			<div class="dinero-counter-area">  
				<?php
				$cols = get_theme_mod('dinero_counter_npp_count', 3);
				$cols++;
							// echo '$cold: '.$cols;
				switch($cols){
					case 1:
					$colCls = 'col-md-12 col-sm-12 col-xs-12';
					break;
					case 2:	
					$colCls = 'col-md-6 col-sm-6 col-xs-12';
					break;
					case 3:
					case 5:
					case 6:
					case 9:
					case 11:
					case 13:
					case 15:
					$colCls = 'col-md-4 col-sm-6 col-xs-12';
					break;
					default: 
					$colCls = 'col-md-3 col-sm-6 col-xs-12';
					break;
				}
				$icons = array(1=>'heart', 2=>'star', 3=>'flash', 4=>'bell',5=>'heart', 6=>'star', 7=>'flash', 8=>'bell');
				?>

				<?php
				for( $i = 1; $i <= $cols; $i++ ){
					
					if($showStatic === false){
						$url = get_theme_mod('dinero_counter_page_url_'.$i, '#');

						$dinero_counter_page_title = get_theme_mod('dinero_counter_page_title_'.$i, 'Working Hours');
						$dinero_counter_page_num = get_theme_mod('dinero_counter_page_num_'.$i, '26');
						$dinero_counter_page_unit = get_theme_mod('dinero_counter_page_unit_'.$i, 'K');
						$dinero_counter_page_id = get_theme_mod('dinero_counter_page'.$i); 
						$dinero_counter_page_icon = get_theme_mod('dinero_counter_page_icon'.$i);
						if($dinero_counter_page_icon){
							?>
							<div class="<?php echo $colCls;?> dinero-counter-b">
								<div counter-match-height="groupName" class="dinero-counter-single <?php echo esc_attr(get_theme_mod('dinero_counter_box_onload_effects','wow zoomIn')); ?>" data-wow-duration="2s" style="text-align : <?php if(get_theme_mod('dinero_counter_box_align','Left') == 'Left'){ ?> left <?php } elseif(get_theme_mod('dinero_counter_box_align','Center') == 'Center'){ ?> center <?php } elseif(get_theme_mod('dinero_counter_box_align','Right') == 'Right'){ ?> right <?php } ?> ">
									<div class="row">
									<div class="col-md-3">
										<a href="<?php echo esc_url(!empty($url)?$url:'#');?>" class="ficon">
											<div class="dinero-counter-icon"><span class="<?php echo $dinero_counter_page_icon; ?>"></span></div>
										</a>
									</div>
									<div class="col-md-9">
										<span class="dinero-counter-num count">
												<?php echo $dinero_counter_page_num; ?>
											</span><sup><?php echo $dinero_counter_page_unit; ?></sup>
									</div>
									<div class="clearfix"></div>
								</div>
										<h4 class="dinero-counter-title inner-area-title" style="text-transform : <?php if(get_theme_mod('dinero_counter_title_case','Uppercase') == 'Uppercase'){ ?> uppercase <?php } elseif(get_theme_mod('dinero_counter_title_case','Lowercase') == 'Lowercase'){ ?> lowercase <?php } elseif(get_theme_mod('dinero_counter_title_case','Capitalize') == 'Capitalize'){ ?> capitalize <?php } ?>">
											<?php echo $dinero_counter_page_title; ?>
										</h4>
											<div class="clearfix"></div>
									</div>
								</div>
							<?php
						}
					}else{?>
						<div class="<?php echo $colCls;?> dinero-counter-b">
								<div counter-match-height="groupName" class="dinero-counter-single <?php echo esc_attr(get_theme_mod('dinero_counter_box_onload_effects','wow zoomIn')); ?>" data-wow-duration="2s" style="text-align : <?php if(get_theme_mod('dinero_counter_box_align','Left') == 'Left'){ ?> left <?php } elseif(get_theme_mod('dinero_counter_box_align','Center') == 'Center'){ ?> center <?php } elseif(get_theme_mod('dinero_counter_box_align','Right') == 'Right'){ ?> right <?php } ?> ">
									<div class="row">	
									<div class="col-md-3">
										<a href="#" class="ficon">
											<div class="dinero-counter-icon"><span class="fa fa-clock-o"></span></div>
										</a>
									</div>
									<div class="col-md-9">
										
										<span class="dinero-counter-num count">
												26
										</span><sup>K</sup>
									</div>
									<div class="clearfix"></div>
								</div>
											<h4 class="dinero-counter-title inner-area-title" style="text-transform : <?php if(get_theme_mod('dinero_counter_title_case','Uppercase') == 'Uppercase'){ ?> uppercase <?php } elseif(get_theme_mod('dinero_counter_title_case','Lowercase') == 'Lowercase'){ ?> lowercase <?php } elseif(get_theme_mod('dinero_counter_title_case','Capitalize') == 'Capitalize'){ ?> capitalize <?php } ?>">
												Working Hours
											</h4>			
											<div class="clearfix"></div>
									</div>
								</div>
					<?php }

				}?>

			</div>
	      
			</div>
		<div class="clearfix"></div>
	</div>
<script>
	var matchHeight = function () {
	
	function init() {
		eventListeners();
		matchHeight();
	}
	
	function eventListeners(){
		$(window).on('resize', function() {
			matchHeight();
		});
	}
	
	function matchHeight(){
		var groupName = $('[counter-match-height]');
		var groupHeights = [];
		
		groupName.css('min-height', 'auto');
		
		groupName.each(function() {
			groupHeights.push($(this).outerHeight());
		});
		
		var maxHeight = Math.max.apply(null, groupHeights);
		groupName.css('min-height', maxHeight);
	};
	
	return {
		init: init
	};
	
} ();

$(document).ready(function() {
	matchHeight.init();
});
</script>
<script>
  $(document).ready(function() {

  var counters = $(".count");
  var countersQuantity = counters.length;
  var counter = [];

  for (i = 0; i < countersQuantity; i++) {
    counter[i] = parseInt(counters[i].innerHTML);
  }

  var count = function(start, value, id) {
    var localStart = start;
    setInterval(function() {
      if (localStart < value) {
        localStart++;
        counters[id].innerHTML = localStart;
      }
    }, 40);
  }

  for (j = 0; j < countersQuantity; j++) {
    count(0, counter[j], j);
  }
});
</script>
<?php }