<?php
/**
 * The template for displaying Category pages.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage classiera
 * @since classiera 1.0
 */

get_header(); 

	global $redux_demo, $maximRange; 
	$mapOnCat = $redux_demo['map-on-category'];
	$max_range = $redux_demo['max_range'];
	if(!empty($max_range)) {
		$maximRange = $max_range;
	} else {
		$maximRange = 1000;
	}
$caticoncolor="";
$category_icon_code ="";
$category_icon ="";
$category_icon_color="";
?>
<?php 
	$titleBg = $redux_demo['title-bg']['url'];
?>
<section class="pageHeading <?php if($mapOnCat == 1){ echo "removeMargin"; } ?>" style="background:url(<?php echo $titleBg; ?>);">
	<div class="row">
	<?php 
		$cat_id = get_cat_ID(single_cat_title('', false));
		$this_category = get_category($cat_id);
		$cat_id = get_cat_ID(single_cat_title('', false));
		$cat_parent_ID = isset( $cat_id->category_parent ) ? $cat_id->category_parent : '';
		if ($cat_parent_ID == 0) {
			$tag = $cat_id;
		}else{
			$tag = $cat_parent_ID;
		}
		$category = get_category($tag);
		$count = $category->category_count;
		$catName = get_cat_name( $tag );
	?>
		<h3><?php echo $catName; ?></h3>
	<?php 
		$q = new WP_Query( array(
			'nopaging' => true,
			'tax_query' => array(
				array(
					'taxonomy' => 'category',
					'field' => 'id',
					'terms' => $tag,
					'include_children' => true,
				),
			),
			'fields' => 'ids',
		) );
		$allPosts = $q->post_count;
	?>
		<p><?php echo $allPosts; ?>&nbsp;<?php esc_html_e( 'ads found', 'classiera' ); ?></p>
	</div>
</section><!-- End page Heading -->
<?php 
global $redux_demo;
$mapOnCat = $redux_demo['map-on-category'];
if($mapOnCat == 1){
?>
<section id="big-map">
	<div class="mainSearch">
		<div id="classiera-main-map"></div>

		<script type="text/javascript">
		var mapDiv,
			map,
			infobox;
		jQuery(document).ready(function($) {

			mapDiv = $("#classiera-main-map");
			mapDiv.height(650).gmap3({
				map: {
					options: {
						"draggable": true
						,"mapTypeControl": true
						,"mapTypeId": google.maps.MapTypeId.ROADMAP
						,"scrollwheel": false
						,"panControl": true
						,"rotateControl": false
						,"scaleControl": true
						,"streetViewControl": true
						,"zoomControl": true
						<?php global $redux_demo; $map_style = $redux_demo['map-style']; if(!empty($map_style)) { ?>,"styles": <?php echo $map_style; ?> <?php } ?>
					}
				}
				,marker: {
					values: [

					<?php

						$wp_query= null;

						$wp_query = new WP_Query();
						
						$category_id = get_cat_ID($catName);
						
						$wp_query->query('post_type=post&posts_per_page=-1&cat='.$category_id);	
						
						while ($wp_query->have_posts()) : $wp_query->the_post(); 

						$post_latitude = get_post_meta($post->ID, 'post_latitude', true);
						$post_longitude = get_post_meta($post->ID, 'post_longitude', true);

						$theTitle = get_the_title();

						$post_price = get_post_meta($post->ID, 'post_price', true);


						$category = get_the_category();

						$tag = $category[0]->cat_ID;

							$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
							if (isset($tag_extra_fields[$tag])) {
								$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
								$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
								$your_image_url = $tag_extra_fields[$tag]['your_image_url'];
							}

						if (empty($category_icon_code) || empty($category_icon_color) || empty($your_image_url)) {

							$tag = $category[0]->category_parent;

							$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
							if (isset($tag_extra_fields[$tag])) {
								if (empty($category_icon_code)){
									$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
								}
								if (empty($category_icon_color)){
									$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
								}
								if (empty($your_image_url)){
									$your_image_url = $tag_extra_fields[$tag]['your_image_url'];
								}
							}

						}
						if(!empty($category_icon_code)) {

							$category_icon = stripslashes($category_icon_code);

					     }
						if(!empty($your_image_url)) {

					    	$iconPath = $your_image_url;

					    } else {

					    	$iconPath = get_template_directory_uri() .'/images/icon-services.png';

					    }
						$postCatgory = get_the_category( $post->ID );

						if(!empty($post_latitude)) {?>

							 	{
							 		<?php require_once get_template_directory() . '/inc/BFI_Thumb.php'; ?>
									<?php 
									$imageurl = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'classiera-grid');
									$thumb_id = get_post_thumbnail_id($post->id);
									$alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true);
									?>
									latLng: [<?php echo $post_latitude; ?>,<?php echo $post_longitude; ?>],
									options: {
										icon: "<?php echo $iconPath; ?>",
										shadow: "<?php echo get_template_directory_uri() ?>/images/shadow.png",
									},
									data: '<section id="advertisement" class="removePad removeMargin noBorder"><div class="row"><div class="advContent"><div class="tabs-content removeMargin"><div class="large-10 medium-12 columns advItems end removeMargin"><div class="advItem"> <div class="advItem-img" id="AdvMapImg"><img src="<?php echo $imageurl[0]; ?>" alt="<?php if(empty($alt)){echo "Image";}else{ echo $alt; } ; ?>" /></div><span class="price"><?php echo $post_price; ?></span><a class="hover" href="<?php the_permalink(); ?>"></a><div class="info"><a href="<?php the_permalink(); ?>"><i class="<?php echo $category_icon_code; ?>" style="background-color:<?php echo $category_icon_color; ?>"></i><span class="title"><?php echo $theTitle; ?></span><span class="cat">category &nbsp;:&nbsp;<?php echo $postCatgory[0]->name; ?><span></a></div></div></div></div><div class="close"></div></div></div></section>'
								}
							,

					<?php } endwhile; ?>	

					<?php wp_reset_query(); ?>
						
					],
					options:{
						draggable: false
					},
					
					events: {
						click: function(marker, event, context){
							map.panTo(marker.getPosition());

							var ibOptions = {
							    pixelOffset: new google.maps.Size(-125, -88),
							    alignBottom: true
							};

							infobox.setOptions(ibOptions)

							infobox.setContent(context.data);
							infobox.open(map,marker);

							// if map is small
							var iWidth = 370;
							var iHeight = 370;
							if((mapDiv.width() / 2) < iWidth ){
								var offsetX = iWidth - (mapDiv.width() / 2);
								map.panBy(offsetX,0);
							}
							if((mapDiv.height() / 2) < iHeight ){
								var offsetY = -(iHeight - (mapDiv.height() / 2));
								map.panBy(0,offsetY);
							}

						}
					}
				}
				 		 	},"autofit");

			map = mapDiv.gmap3("get");
		    infobox = new InfoBox({
		    	pixelOffset: new google.maps.Size(-50, -65),
		    	closeBoxURL: '',
		    	enableEventPropagation: true
		    });
		    mapDiv.delegate('.infoBox .close','click',function () {
		    	infobox.close();
		    });

		    if (Modernizr.touch){
		    	map.setOptions({ draggable : false });
		        var draggableClass = 'inactive';
		        var draggableTitle = "Activate map";
		        var draggableButton = $('<div class="draggable-toggle-button '+draggableClass+'">'+draggableTitle+'</div>').appendTo(mapDiv);
		        draggableButton.click(function () {
		        	if($(this).hasClass('active')){
		        		$(this).removeClass('active').addClass('inactive').text("Activate map");
		        		map.setOptions({ draggable : false });
		        	} else {
		        		$(this).removeClass('inactive').addClass('active').text("Deactivate map");
		        		map.setOptions({ draggable : true });
		        	}
		        });
		    }

		jQuery( "#advance-search-slider" ).slider({
		      	range: "min",
		      	value: 500,
		      	min: 1,
		      	max: <?php echo $maximRange; ?>,
		      	slide: function( event, ui ) {
		       		jQuery( "#geo-radius" ).val( ui.value );
		       		jQuery( "#geo-radius-search" ).val( ui.value );

		       		jQuery( ".geo-location-switch" ).removeClass("off");
		      	 	jQuery( ".geo-location-switch" ).addClass("on");
		      	 	jQuery( "#geo-location" ).val("on");

		       		mapDiv.gmap3({
						getgeoloc:{
							callback : function(latLng){
								if (latLng){
									jQuery('#geo-search-lat').val(latLng.lat());
									jQuery('#geo-search-lng').val(latLng.lng());
								}
							}
						}
					});

		      	}
		    });
		    jQuery( "#geo-radius" ).val( jQuery( "#advance-search-slider" ).slider( "value" ) );
		    jQuery( "#geo-radius-search" ).val( jQuery( "#advance-search-slider" ).slider( "value" ) );

		    jQuery('.geo-location-button .fa').click(function()
			{
				
				if(jQuery('.geo-location-switch').hasClass('off'))
			    {
			        jQuery( ".geo-location-switch" ).removeClass("off");
				    jQuery( ".geo-location-switch" ).addClass("on");
				    jQuery( "#geo-location" ).val("on");

				    mapDiv.gmap3({
						getgeoloc:{
							callback : function(latLng){
								if (latLng){
									jQuery('#geo-search-lat').val(latLng.lat());
									jQuery('#geo-search-lng').val(latLng.lng());
								}
							}
						}
					});

			    } else {
			    	jQuery( ".geo-location-switch" ).removeClass("on");
				    jQuery( ".geo-location-switch" ).addClass("off");
				    jQuery( "#geo-location" ).val("off");
			    }
		           
		    });

		});
		</script>

		<?php 

			global $redux_demo; 			

		?>
	

		<!--Search Section Start -->
		<div class="advanceSearch">
			<div class="advSearchBtn"><!--Search bar hide Show Button -->
				<div class="row">
					<a id="searchbtn" href="#">
						<i class="fa fa-search"></i>
						<span><?php esc_html_e( 'Advance Search', 'classiera' ); ?></span>
						<i class="fa fa-caret-down"></i>
					</a>
				</div>
			</div><!--END Search bar hide Show Button -->
			<div class="advSeachBar"><!--AdvSeachBar Start -->
				<div class="row"><!--row Start -->
					<form action="<?php echo home_url(); ?>" method="get" id="views-exposed-form-search-view-other-ads-page" accept-charset="UTF-8">
						<input placeholder="<?php esc_html_e( 'Enter keyword...', 'classiera' ); ?>" type="text" id="edit-search-api-views-fulltext" name="s" value="" size="30" maxlength="128" class="form-text">
						<!--<input type="hidden" id="hidden-keyword" name="s" value="all" size="30" maxlength="128" class="form-text">-->
						<!--Select Category-->
						<?php $turnonsearchcat = $redux_demo['turnonsearchcat']; ?>
						<?php if($turnonsearchcat == 1){?>
						<select id="edit-field-category" name="category_name" class="form-select">
							<option value="All" selected="selected"><?php esc_html_e( 'Category...', 'classiera' ); ?></option>
							<?php
							$args = array(
								'hierarchical' => '0',
								'hide_empty' => '0'
							);
							$categories = get_categories($args);
							foreach ($categories as $cat) {
								if ($cat->category_parent == 0) { 
									$catID = $cat->cat_ID;
									?>
									<option value="<?php echo $cat->slug; ?>"><?php echo $cat->cat_name; ?></option>
									<?php 
									$args2 = array(
										'hide_empty' => '0',
										'parent' => $catID
									);
									$categories = get_categories($args2);
									foreach ($categories as $cat) { ?>
									<option value="<?php echo $cat->slug; ?>">- <?php echo $cat->cat_name; ?></option>
									<?php } ?>
								<?php } else { ?>
								<?php }
							} ?>

						</select>
						<?php }?>
						<!--Select Category -->
						<!--Choose Location-->
						<?php $turnonsearchloc = $redux_demo['turnonsearchloc']; ?>
						<?php $locShownBy = $redux_demo['location-shown-by']; ?>
						<?php if($turnonsearchloc == 1){?>
						<select id="edit-ad-location" name="post_location" class="form-select">
							<option value="All" selected="selected"><?php esc_html_e( 'Location...', 'classiera' ); ?></option>
							<?php
							$args_location = array( 'posts_per_page' => -1 );
							$lastposts = get_posts( $args_location );
							$all_post_location = array();
							foreach( $lastposts as $post ) {								
								$all_post_location[] = get_post_meta( $post->ID, $locShownBy, true );
							}
							$directors = array_unique($all_post_location);
							foreach ($directors as $director) { ?>
								<option value="<?php echo $director; ?>"><?php echo $director; ?></option>
							<?php }?>
							<?php wp_reset_query(); ?>
						</select>
						<?php } ?>
						<!--End Choose Location -->
						<!--Range Slider-->
						<?php $turnonsearchrange = $redux_demo['turnonsearchrange']; ?>
						<?php if($turnonsearchrange == 1){?>
						<div class="range" id="advance-search-slider"> 
							<div class="range-slider round" data-slider data-options="display_selector: #sliderOutput3;">
							  <span class="range-slider-handle" role="slider" aria-valuenow="50" aria-valuemin="1" aria-valuemax="1000">
								 <!--<span class="range-slider-out" id="sliderOutput3"></span>-->
								 <input type="text" class="range-slider-out" name="geo-radius" id="geo-radius" value="100" data-default-value="100" />
							  </span>
							  <span class="range-slider-active-segment"></span>
							</div>
						</div>
						<?php } ?>
						<input type="text" name="geo-location" id="geo-location" value="off" data-default-value="off">
						<input type="text" name="geo-radius-search" id="geo-radius-search" value="500" data-default-value="500">
						<input type="text" name="geo-search-lat" id="geo-search-lat" value="0" data-default-value="0">
						<input type="text" name="geo-search-lng" id="geo-search-lng" value="0" data-default-value="0">
						<!--End Range Slider -->
						<button class="btn btn-primary form-submit submit" id="edit-submit-search-view" name="search" value="Search" type="submit">
                                <span><?php esc_html_e( 'Search Now', 'classiera' ); ?></span>
                                <i class="fa fa-search"></i>
                        </button>
					</form>
				</div><!--row END -->
			</div><!--AdvSeachBar END -->
		</div>
		<!--END Search Section -->
	</div>
</section>
<?php } ?>
<?php 

	global $redux_demo;
	$featured_ads_option = $redux_demo['featured-options-on'];
	$premiumSECtitle = $redux_demo['premium-sec-title'];
	$premiumSECdesc = $redux_demo['premium-sec-desc'];	
	$featuredCatOn = $redux_demo['featured-caton'];
	$featuredCat = $redux_demo['featured-ads-cat'];

?>

<?php if($featured_ads_option == 1) { ?>
 <!-- Premium Advertisement -->
 <section id="premiumAdv">
	<div class="row">
		<div class="mainHeading">
			<div class="large-7 medium-8 large-centered medium-centered columns">
				<h2><?php echo $premiumSECtitle;?></h2>
				<p><span class="line"><i class="fa fa-circle"></i></span></p>
				<p><?php echo $premiumSECdesc;?></p>
			</div>
		</div><!--End mainHeading-->
	</div><!--End Heading row-->
	<div class="customNavigation">
		<div class="row">
			<div class="medium-4 medium-centered columns">
			<?php 
				$previous = $redux_demo['trns-btn-previous'];
				$next = $redux_demo['trns-btn-next'];
				$caraCategory = $redux_demo['trns-cara-cat'];
				$classieraRelatedCat = $redux_demo['featured-related-cat'];
			?>
				<div class="navText">					
					<a class="prev"><i class="fa <?php if(is_rtl()){ echo "fa-angle-right";}else{ echo "fa-angle-left"; } ?>"></i></a>
					<span><?php echo $previous;?></span>
					<span><?php echo $next;?></span>					
					<a class="next"><i class="fa <?php if(is_rtl()){ echo "fa-angle-left";}else{ echo "fa-angle-right"; } ?>"></i></a>
				</div>
			</div>
		</div>
	</div><!--End customNavigation-->
	<!--Start Premium Carousel-->
	<div id="owl-demo" class="owl-carousel">
		<?php 
			$cat_id = get_cat_ID(single_cat_title('', false)); 
			global $paged, $wp_query, $wp;
			$args = wp_parse_args($wp->matched_query);
			$temp = $wp_query;
			$wp_query= null;
			$wp_query = new WP_Query();
			
			if($featuredCatOn == 1){
				$wp_query->query('post_type=post&posts_per_page=-1&cat='.$featuredCat.'');
			}elseif($classieraRelatedCat == 1){
				$wp_query->query('post_type=post&posts_per_page=-1&cat='.$cat_id);
			}else{
				$wp_query->query('post_type=post&posts_per_page=-1');
			}			
			$current = -1;
			
		?>
		<?php while ($wp_query->have_posts()) : $wp_query->the_post();
			$featuredMeta = get_post_meta($post->ID, 'featured_post', true);
			
			if($featuredCatOn == 1){
			$featured_post = "1";
			}else{
				$featured_post = "0";
			}
			$post_price_plan_activation_date = get_post_meta($post->ID, 'post_price_plan_activation_date', true);
			$post_price_plan_expiration_date = get_post_meta($post->ID, 'post_price_plan_expiration_date', true);
			$post_price_plan_expiration_date_noarmal = get_post_meta($post->ID, 'post_price_plan_expiration_date_normal', true);
			$todayDate = strtotime(date('m/d/Y h:i:s'));
			$expireDate = $post_price_plan_expiration_date;
			if(!empty($post_price_plan_activation_date) && $featuredMeta == 1) {
				if(($todayDate < $expireDate) or $post_price_plan_expiration_date == 0) {
					$featured_post = "1";
				}
			}elseif($featuredMeta == 1){
				$featured_post = "1";
			}
		
		?>
		<?php if($featured_post == "1") {
				$current++;
		?>
		<div class="item">
			<div class="carousel">
			<?php 
				if ( has_post_thumbnail()) {
						$imageurl = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'classiera-pslider');
						$thumb_id = get_post_thumbnail_id($post->id);
						$alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true);			
						$postTiti= get_the_title();
						?>
						<div class="premiumIMG"><img src="<?php echo $imageurl[0]; ?>" alt="<?php if(empty($alt)){echo "Image";}else{ echo $alt; } ; ?>"/></div>
						<?php
					}else{
						?>
						<div class="premiumIMG">
							<img src="<?php echo get_template_directory_uri() . '/images/nothumb/nothumbpslider.png' ?>" alt="No Thumb"/>
						</div>
						<?php
					}					
			?>
			
			<?php 
				$category = get_the_category();
				if ($category[0]->category_parent == 0) {
					$tag = $category[0]->cat_ID;
					$category_icon_code = "";
					$category_icon_color = "";
					$your_image_url = "";
					$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
					if (isset($tag_extra_fields[$tag])) {
						$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
						$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
					}
				}else{
					$tag = $category[0]->category_parent;
					$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
					if (isset($tag_extra_fields[$tag])) {
						$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
						$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
					}
				}
				if(!empty($category_icon_code)) {
					$catIcon = stripslashes($category_icon_code);
				}
				$category_icon_code = "";				
				$catName = $category->term_id;
				$postCatgory = get_the_category( $post->ID );
			?>
			<?php
				$post_price = get_post_meta($post->ID, 'post_price', true);
				if(!empty($post_price)){								
				?>
					<span class="price" style="background-color:<?php echo $category_icon_color; ?>;"><?php echo $post_price; ?></span>
				<?php } ?>
				<div class="hover">					
					<a href="<?php the_permalink(); ?>">						
						<span class="info">
							<i class="<?php echo $catIcon; ?>" style="background-color:<?php echo $category_icon_color; ?>;"></i>
							<span class="title"><?php echo $postTiti; ?></span>
							<small><?php echo $caraCategory; ?>: <?php echo $postCatgory[0]->name; ?></small>
						</span>
					</a>
				</div>
			</div>
			
		</div>
<?php }?>
		<?php endwhile; ?>
		<?php wp_reset_query(); ?>			
	</div><!--End Premium Carousel-->
 </section><!--End premiumAdv-->
<?php } ?>
<!-- advertisement Start-->
<section id="advertisement" class="noBorder removePad">
	<div class="row">
		<div class="large-8 medium-12 columns">
			<?php
				if ($wp_rewrite->permalink_structure == ''){
					//we are using ?page_id
					 $permalink_type = "&";
					}else{
					//we are using permalinks
					 $permalink_type = "?";
				}
				$cat_counter = $redux_demo['home-ads-view'];
				if(isset($_GET['view-type'])){
						 $current_view_type = $_GET['view-type'];
					}else{
						 $current_view_type = $cat_counter;
				} 
				
				//Call List Template for category
				if($current_view_type == 'list'){
					get_template_part('templates/cat-list'); 
				}
				
				//Call Grid Template for category
				if($current_view_type == 'grid'){		
				get_template_part('templates/cat-grid');
				}
			?>
			<section class="authorAd removePad">
			<?php 
			$catgoryAds = '';
			$homeAdImg2 = $redux_demo['post_ad']['url']; 
			$homeAdImglink2 = $redux_demo['post_ad_url']; 
			$postAdsHTML = $redux_demo['post_ad_code_html']; 
			
			if(!empty($postAdsHTML) || !empty($homeAdImg2)){
				if(!empty($postAdsHTML)){
						$catgoryAds = $postAdsHTML;
				}else{
						$catgoryAds = '<a href="'.$homeAdImglink2.'" target="_blank"><img alt="image" src="'.$homeAdImg2.'" /></a>';
				}
			}
			?>	
				<?php echo $catgoryAds; ?>
            </section><!-- End author ad -->
		</div><!-- large-8 End-->
		<!-- Sidebar -->
		<div class="large-4 medium-12 columns">
			<section class="sidebar">
				<div class="row collapse">
				<?php 
				
				$cat_term_ID = $this_category->term_id;
				$cat_child = get_term_children( $cat_term_ID, 'category' );
				//print_r($cat_child);
				if (!empty($cat_child)) {
				?>
					<div class="large-12 medium-6 columns medium-centered">
						<div class="widgetBox">
							<div class="widgetTitle">
								<i class="fa fa-list-ul"></i>
								<h4><?php esc_html_e( 'SUBCATEGORIES', 'classiera' ); ?></h4>
							</div><!-- widgetTitle End-->
							<div class="widgetContent">
								<div class="cats">
									<ul>
									<?php 
									$args = array(
									'type' => 'post',
									'child_of' => $cat_id,
									'parent' => get_query_var(''),
									'orderby' => 'name',
									'order' => 'ASC',
									'hide_empty' => 0,
									'hierarchical' => 1,
									'taxonomy' => 'category',
									'pad_counts' => true );
									$category = get_categories($args);
									if ($category[0]->category_parent == 0) {

											$tag = $category[0]->cat_ID;
											$category_icon_code = "";
											$category_icon_color = "";
											$your_image_url = "";
											$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
											if (isset($tag_extra_fields[$tag])) {
												$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
												$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
											}

										} else {

											$tag = $category[0]->category_parent;

											$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
											if (isset($tag_extra_fields[$tag])) {
												$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
												$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
											}

										}
										foreach($category as $category) { 
									?>
										<li>
											<a href="<?php echo get_category_link( $category->term_id )?>" title="View posts in <?php echo $category->name?>">
											<?php if(!empty($category_icon_code)) { 
												$category_icon = stripslashes($category_icon_code);
											?>
												<i style="background:<?php echo $category_icon_color; ?>;" class="<?php echo $category_icon; ?>"></i>
											<?php } ?>	
												<?php echo $category->name ?>
												<span>(<?php echo $category->count ?>)</span>
											</a>
										</li>
									<?php } ?>
									</ul>
								</div><!-- cats End-->
							</div><!-- widgetContent End-->
						</div><!-- widgetBox End-->
					</div><!-- medium-centered End-->
				<?php } ?>	
				<?php get_sidebar('pages'); ?>
				</div><!-- Inner Section Main Row End-->
				
			</section><!-- Sidebar Inner Section End-->
		</div>
		<!-- Sidebar End-->
	</div><!-- Main Row End-->
</section>
<!-- advertisement End-->
<?php get_footer(); ?>