<?php   
if(get_theme_mod('featured_section_disable') != 'on' ){?>
	<?php 
	if( get_theme_mod('featuredTpadding',true) ) {
		$featuredTpadding = 'padding-top:'.esc_attr(get_theme_mod('featuredTpadding')).';';
	}
	if( get_theme_mod('featuredBpadding',true) ) {
		$featuredBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('featuredBpadding')).';';
	}
	?>	
	<div id="featured" style="<?php echo esc_attr($featuredTpadding); ?>" class="feature-area">	
		<?php
		$showStatic = true;
		for( $i = 1; $i < 4; $i++ ){
			$url = get_theme_mod('featured_page_url_'.$i, '#');
			$featured_page_id = get_theme_mod('featured_page_icon'.$i); 
			if(!empty($featured_page_id)){
				$showStatic = false;
				break;
			}
		}
		?> 
		<div class="row">
			<?php
			$cols = get_theme_mod('featured_npp_count', 3);
			$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:
				case 9:
				$colCls = 'col-md-4 col-sm-6';
				break;
				case 4:
				case 7:
				case 8:
				case 10:
				case 11:
				case 12:
				$colCls = 'col-md-3 col-sm-6';
				break;
				default: 
				$colCls = 'col-md-3 col-sm-6';
				break;
			}
			$icons = array(1=>'heart', 2=>'star', 3=>'flash', 4=>'bell',5=>'heart', 6=>'star', 7=>'flash', 8=>'bell');
			?>
			<div class="row featured-main-wrapper feature-box" style="<?php echo esc_attr($featuredBpadding); ?>">
				<div class="container">
					<div class="featured-single-bx">
						<?php
						for( $i = 1; $i <= $cols; $i++ ){
							if($showStatic === false){
								$url = get_theme_mod('featured_page_url_'.$i, '#');
								$featured_page_title = get_theme_mod('featured_page_title_'.$i, 'Free delivery');
								$featured_page_Number = get_theme_mod('featured_page_Number_'.$i, '1');
								$featured_page_id = get_theme_mod('featured_page'.$i);
								$featured_page_icon = get_theme_mod('featured_page_icon'.$i);
								if($featured_page_icon){

									?>

									<div class="<?php echo $colCls;?> pd-5">
										<div class="feature-item">
											<span class="feature__number">
												<?php echo $featured_page_Number; ?>
											</span>
											<span class="feature__icon">
												<i class="<?php echo $featured_page_icon; ?>"></i>
											</span>
											<h3 class="feature__title">
												<a href="<?php echo esc_url(!empty($url)?$url:'#');?>"> <?php echo $featured_page_title; ?> </a>
											</h3>
											<?php
											$Featured_page_button_title = get_theme_mod('Featured_page_button_title_'.$i, 'Read More');
											?>

											<?php if($Featured_page_button_title || $url ){ ?>
												<a class="main-btn btn-1" href="<?php echo esc_url(!empty($url)?$url:'#');?>"><?php echo $Featured_page_button_title; ?>  <i class="fa fa-long-arrow-right"></i></a>
											<?php }?>
										</div><!-- end feature-item -->
									</div>
									<?php
								}	
							}else{?>
								<div class="<?php echo $colCls;?> pd-5">
									<div class="feature-item">
										<span class="feature__number">1</span>

										<span class="feature__icon">
											<i class="fa fa-truck"></i>
										</span>
										<h3 class="feature__title">
											<a href=""> Free delivery</a>
										</h3>
										<a class="main-btn btn-1" href="">Read More  <i class="fa fa-long-arrow-right"></i></a>

									</div><!-- end feature-item -->
								</div>
							<?php }
						}?>
						<div class="clearfix"></div>
					</div>
				</div>
			</div>
		</div>
		<div class="clearfix"></div>
	</div>
<script type="text/javascript">
		 $(document).ready(function() {
		$(function(){
			function featureitemHeight(){
				var ht = 0;
				$('.feature-area .feature-box .feature-item').each(function(i){
					var tHt = $(this).height();
					if(ht<tHt){
						ht=tHt;
					}
				});
				$('.feature-area .feature-box .feature-item').height(ht+'px');
			}
			featureitemHeight();
		});
		$( window ).resize(function(){
			featureitemHeight();
		});
	</script>



<?php }