<?php  
/**
 *
 * @package LZ Premium
 */
if(get_theme_mod('lz_fitness_premium_counter_section_disable') != 'on' ){?>

	<section id="counter-section" class="ht-section">	 
		<div class="lightbox">		

			<div class="container">		

				<?php 
				$lz_fitness_countersec_title = get_theme_mod('lz_fitness_countersec_title', '
					Aenean vestibulum tortor erat nec tincidunt ex molestie vel Nam lacus');
				$lz_fitness_counter_subtitle = get_theme_mod('lz_fitness_counter_subtitle', 'Adipiscing elit. Vivamus eu pharetra ex. Etiam eget diam ligula. Sed blandit ante. Vivamus feugiat.');

				?>	  
				<div class="col-md-10 col-md-offset-1 ht-section-title-tagline">

					<h2 class="ht-section-title lz-counter-heading">
						<?php
						if(!empty($lz_fitness_countersec_title))	{
							echo ($lz_fitness_countersec_title);
						} ?>
					</h2>
					
					<div class="clearfix"></div> 
				</div>
				<div class="clearfix"></div>
				<div class="col-md-6 col-md-offset-3 lz-counter-subheading">
						<?php
						if(!empty($lz_fitness_counter_subtitle))	{
							echo ($lz_fitness_counter_subtitle);
						} ?>
					</div> 
					<div class="clearfix"></div>

				<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="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 3:
									case 5:
									case 6:
									$colCls = 'col-md-4 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, 'Management Team');
											$lz_fitness_counter_page_number = get_theme_mod('lz_fitness_counter_page_number_'.$i, '150');
											$lz_fitness_counter_page_id = get_theme_mod('lz_fitness_counter_page'.$i);


											?>

											<div class="<?php echo $colCls;?> padding0 details">
												<div class="counter-post wow zoomIn" data-wow-duration="3s">
													<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;?> padding0 details">
												<div class="counter-post wow wow zoomIn" data-wow-duration="3s">
													<div class="counter-number count">
														150
													</div>
													<h5>Management Team</h5>
													<div class="clearfix"></div>
												</div>
											</div>
										<?php }

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