<?php
/**
 *
 * @package LZ Premium
 */
if(get_theme_mod('lz_fitness_premium_counter_section_disable') != 'on' ){?>
 
	<section id="counter-section" class="ht-section">	
	<div class="container">		
		<div class="counterbox">
			<div class="counter-box">				
					<?php
					$showStatic = true;
					for( $i = 1; $i < 4; $i++ ){
						$lz_fitness_counter_page_id = get_theme_mod('lz_fitness_counter_page_number'.$i); 
						if(!empty($lz_fitness_counter_page_id)){
							$showStatic = false;
							break;
						}
					}
					$lz_fitness_counter_title = get_theme_mod('lz_fitness_counter_title', 'WHY CHOOSE US');
					?>

					
					<div class="clearfix"></div>
					<div class="row">
						<div class="col-md-5 col-sm-12 col-xs-12">
								<div class="ht-section-title-tagline">
								<h2 class="ht-section-title lz-counter-heading">
									<?php
									if(!empty($lz_fitness_counter_title))	{
										echo ($lz_fitness_counter_title);
									} ?>
								</h2>
								<div class="dlab-separator-outer m-b0">
					                <div class="dlab-separator text-primary style-icon"></div>
					            </div>
					            <div class="httagline"></div>
								</div>
						</div>
					<div class="col-md-7 col-sm-12 col-xs-12">
						<div class="counter-box">
								<div class="counter-post-wrap">
									<?php
									$cols = get_theme_mod('lz_fitness_counter_npp_count', 2);
									$cols++;
							// echo '$cold: '.$cols;
									switch($cols){
										case 1:
										$colCls = 'col-md-12 col-sm-12';
										break;
										case 2:
										$colCls = 'col-md-6 col-sm-6';
										break;

										case 4:
										$colCls = 'col-md-3 col-sm-3';
										break;

										default: 
										$colCls = 'col-md-4 col-sm-4';
										break;
									}
									$icons = array(1=>'heart', 2=>'star', 3=>'flash', 4=>'bell',5=>'heart', 6=>'star', 7=>'flash', 8=>'bell');
									?>
									<div class="row counter-post-boxes">
										<?php
										for( $i = 1; $i <= $cols; $i++ ){
											if($showStatic === true){
												$lz_fitness_counter_page_title = get_theme_mod('lz_fitness_counter_page_title_'.$i, 'Staff');
												$lz_fitness_counter_page_number = get_theme_mod('lz_fitness_counter_page_number_'.$i, '125');
												$lz_fitness_counter_page_id = get_theme_mod('lz_fitness_counter_page'.$i);
												

													?>

													<div class="<?php echo $colCls;?> details">
														<div class="counter-post wow fadeInUp">
																<div class="counter-number count">
																	<?php echo $lz_fitness_counter_page_number; ?>
																</div>
																<h5><?php echo $lz_fitness_counter_page_title; ?></h5>
															<div class="clearfix"></div>
														</div>
													</div>
													
													<?php	
											}else{?>
												<div class="<?php echo $colCls;?> details">
													<div class="counter-post wow fadeInUp">
														<div class="counter-number count">
															125
														</div>
														<h5>Staff</h5>
														<div class="clearfix"></div>
													</div>
												</div>
											<?php }

										}?>
										<div class="clearfix"></div>
									</div>
								</div>
						</div>
						<div class="clearfix"></div>
					</div>				

				</div>
				<div class="clearfix"></div>
			</div>
			<div class="clearfix"></div>
		</div>
		</div>
		<div class="clearfix"></div>
	</section>
	<script>
	jQuery.noConflict();
	$(function(){
		function detailsHeight(){
			var ht = 0;
			$('#counter-section .counter-post h5').each(function(i){
				var tHt = $(this).height();
				if(ht<tHt){
					ht=tHt;
				}
			});
			$('#counter-section .counter-post h5').height(ht+'px');
		}
		detailsHeight();
	});
	$( window ).resize(function(){
		detailsHeight();
	});
</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 }