<?php
/**
 *
 * @package Luzuk 
 */
if(get_theme_mod('luzuk_gallery_section_disable') != 'on' ){ ?>
	<?php 
	if( get_theme_mod('sec_galleryTpadding',true) ) {
		$sec_galleryTpadding = 'padding-top:'.esc_attr(get_theme_mod('sec_galleryTpadding')).';';
	}
	if( get_theme_mod('sec_galleryBpadding',true) ) {
		$sec_galleryBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('sec_galleryBpadding')).';';
	}

	?>	
	<section id="ht-gallery-section" class="lz-gallery-section wow slideInUp" style="<?php echo esc_attr($sec_galleryTpadding); ?>" "<?php echo esc_attr($sec_galleryBpadding); ?>">
		<div class="owl-carousel owl-theme">
			<?php 
			$showStatic = true;
			$cols = get_theme_mod('lz_luzuk_gallery_npp_count', 19); 
			$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-3 col-sm-6';
				break;
				default: 
				$colCls = 'col-md-3 col-sm-6';
				break;
			}
			for( $i = 1; $i <= $cols; $i++ ){
				$luzuk_gallery_page_id = get_theme_mod('luzuk_gallery_page'.$i); 
				$luzuk_gallery_page_icon = get_theme_mod('luzuk_gallery_page_icon'.$i);
				if($luzuk_gallery_page_id){
					$showStatic = false;
					echo galleryShortCode($luzuk_gallery_page_id, $isCustomizer=true, $i);
				}
			}

			$args = array(
				'post_type' => 'our_gallery',
				'post_status' => 'publish'
			);
			$new = new WP_Query($args); 
			$i=1;
			if($showStatic == true){
				while ( $new->have_posts() ){
					$new->the_post(); 
					$thumb = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'medium_large' );
					if(has_post_thumbnail()) { $thumb_url = $thumb['0']; }
					$url = $thumb['0'];?>
					<div class="item <?php //echo $colCls; ?> gallery-image">
						<a class="group1" href="<?php echo esc_url($thumb_url); ?>" title="<?php the_title(); ?>"><img class="secondry-bg img-responsive" src="<?php echo esc_url($thumb_url); ?>" alt="" />
							<div class="overlay-box"><h4><?php the_title(); ?></h4></div>    
						</a></div>
						<?php 
						$i++; } wp_reset_query();
					} ?>
				</div>
				<div class="clearfix"></div>
			</section>
			<script>
				$(document).ready(function() {
					$('#ht-gallery-section .owl-carousel').owlCarousel({
						autoplay: true,
						autoplaySpeed:2000,
						smartSpeed: 2000,                         	    
						loop: true,
						margin: 30,
						responsiveClass: true,
						responsive: {
							0: {
								items: 1,
								nav: true
							},
							600: {
								items:2,
								nav: true
							},
							1000: {
								items:6,
								nav: true,
								loop: true,
								margin:20
							}
						}
					})
				})
			</script>
		<?php }