<?
$ci=& get_instance();

# 테마
# theme_type = 13 (라이프스타일), theme_type = 14 (지금뜨는 라이프)
$ci->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = array('13', '14');
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);

$arr_life_style  = array();
$arr_boomup_life = array();
$i=1;$z=1;
foreach ($arr_theme as $val) {
	if($val['theme_type'] == 13) {
		$arr_life_style[$val['rank']] = array('title' => $val['title'], 'sub_title'=> $val['sub_title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
		if($i>25)   continue;
	}
	if($val['theme_type'] == 14) {
		$arr_boomup_life[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
		if($i>12)   continue;
	}
	$z++;
	$i++;
}


# 많이본 TOP5
$req_data = array();
$req_data['ranking_type']   = '1';
$req_data['content_type']   = $content_type;
$req_data['offset']         = 0;
$req_data['limit']          = 5;
$ci->load->model('web/m_ranking');
$arr_ranking    = $ci->m_ranking->ranking_join_life_list($req_data);



?>





	<div class="life_footer">

			<div class="life_cont1">
				<h4>라이프 스타일</h4>
			<?
				$i=1;
				$life_style_count = count($arr_life_style);
				foreach ($arr_life_style as $val) {
					$display_style = 'display:block';
					$curr_page = '1';
					if($i > 4)	{
						$display_style = 'display:none;';
						$curr_page='2';
					}
					if($i%4==1) echo '<ul class="life_cont1_box life_style_page'.$curr_page.'" style="'.$display_style.'">';

					$title_txt = mb_strimwidth($val['title'], '0', '55', '..', 'utf-8');


			?>

					<li>
						<a  href='/m/life/life_view/<?=$val['content_idx']?>' ><img src="<?=$val['theme_img']?>" class="art-img"></a>
						<p class="life_title"><a href="/m/life/life_view/<?=$val['content_idx']?>"><?=$title_txt?></a></p>
					</li>


			<?
					if($i%4==0 || $life_style_count == $i) echo '</ul>';

					$i++;
				}
			?>



			</div>
			<div class="channel_bottom2">
				<button type="button" class="btn btn-success br20" id="life_style_more_btn" onclick="life_style_more();">더보기 <img src="/img/web/img_down.png" style=padding-top:7px;></button>
			</div>
			<div class="life_cont2">
				<h4>지금 뜨는 라이프 </h4>



			<?
				$i=1;
				$boomup_life_count = count($arr_boomup_life);
				foreach ($arr_boomup_life as $val) {
					$display_style = $i == 1 ? 'display:block' : 'display:none';
					$curr_page = '1';
					if($i >= 2)	{
						$display_style = 'display:none;';
						$curr_page='2';
					}
					echo '<div class="life_cont2_box boomup_life_page'.$curr_page.'" style="'.$display_style.'">';

			?>

				<a href="/m/life/life_view/<?=$val['content_idx']?>">
					<span class="shadow"></span><a href="/m/life/life_view/<?=$val['content_idx']?>"><img src="<?=$val['theme_img']?>"></a><span class="photo_info2"><a href="/m/life/life_view/<?=$val['content_idx']?>"><?=$val['title']?></a></a></span>

					<?
					 echo '</div>';

					$i++;
				}
			?>



			</div>
			<div class="channel_bottom2">
				<button type="button" class="btn btn-success br20" id="boomup_life_more_btn" onclick="boomup_life_more();">더보기 <img src="/img/web/img_down.png" style=padding-top:7px;></button>
			</div>

	<? 	if(count($arr_ranking) > 0) {?>
			<div class="life_cont4" style="margin-top:30px;">
				<h4>많이 본 <span class="beachblue">TOP 5</span> </h4>
				<span class="a_left"><a href=""><img src="/img/mobile/editor_left.gif"></a></span>
				<div class="life_cont4_box responsive">
					<? 	foreach ($arr_ranking as $val) {?>
						<div class="tr_img">
							<a href="/m/life/life_view/<?=$val['content_idx']?>"><img src="<?=$val['main_img']?>" class="art-img"></a>
							<p class="tr_txt"><a href="/m/life/life_view/<?=$val['content_idx']?>"><?=$val['title']?></a></p>
						</div>

					<?	}?>
				</div>
				<span class="a_right"><a href=""><img src="/img/mobile/editor_right.gif"></a></span>
			</div>

		

	<?	}?>


		<div class="banner_grace">
			<!-- <a href="#"><img src="/img/mobile/banner_grace.jpg" alt="banner"></a> -->
<!-- m크맵 _라이프_뷰 -->
<ins class="adsbygoogle"
     style="display:inline-block;width:720px;height:74px"
     data-ad-client="ca-pub-7071495522658800"
     data-ad-slot="5412203153"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
		</div>


			</ul>



	</div>


<script>
function life_style_more() {
	$(".life_style_page2").show();
	$("#life_style_more_btn").hide();
}

function boomup_life_more() {
	$(".boomup_life_page2").show();
	$("#boomup_life_more_btn").hide();
}

$('.share_btn').click(function(e) {
	$("#share_box").toggle();
	var popH = $(this).offset().top;
	$('.popup_share').css('left','50%');
	$('.popup_share').css('top',popH+'px');

});

$(".mask").on('click', function(event){
	$(event.target).parent().hide();

});


function bookmark(){
	if("<?=$SES_MEMBER_ID?>"=="") {
		alert("로그인 후에 이용가능합니다.");
		return;
	}
	var form_data = {
		"content_idx"			: "<?=$idx?>",
		"content_type"			: "<?=$content_type?>"
	};
	$.ajax({
		url: '/web/comm/bookmark_proc',
		async: false,
		type: 'POST',
		dataType: 'JSON',
		data: form_data,
		success: function (rtnJson) {
			if (rtnJson.code == "0000") {
				$("#bookmark_img").attr("src", "/img/web/star_"+rtnJson.data.bookmark_status+".png");
				color = rtnJson.data.bookmark_status == "on" ? "#fdbb00" : "gray";
				$("#bookmark_img").css("color",color);
				$("#share_box").hide();
				if(rtnJson.data.bookmark_status == 'off') {
					alert("북마크함에서 삭제 되었습니다");
					return false;
				} else {
					alert("북마크함에 추가 되었습니다");
				}


			} else {
				alert("북마크에 실패했습니다.");
				return false;
			}
		},
		error: function (rtnJson) {
			alert('북마크에 실패했습니다.');
			return false;
		}
	});

}

function like_proc(){
	if("<?=$SES_MEMBER_ID?>"=="") {
		alert("로그인 후에 이용가능합니다.");
		return;
	}
	var form_data = {
		"content_idx"			: "<?=$idx?>",
		"content_type"			: "<?=$content_type?>"
	};
	$.ajax({
		url: '/web/comm/like_proc',
		async: false,
		type: 'POST',
		dataType: 'JSON',
		data: form_data,
		success: function (rtnJson) {
			if (rtnJson.result_code == "0000") {
				var like_count = setComma(rtnJson.result_data.like_count);
				$("#like_count").html('<img src="/img/mobile/img_heart.gif"> '+like_count);

			} else {
				alert("저장에 실패했습니다.");
				return false;
			}
		},
		error: function (rtnJson) {
			alert('저장에 실패했습니다.');
			return false;
		}
	});

}
</script>
<script>

$('.responsive').slick({
  dots: false,
	infinite: true,
  speed: 300,
  slidesToShow: 3,
  slidesToScroll: 1,
  responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 3,
        slidesToScroll: 1,
       }
    },
    {
      breakpoint: 600,
      settings: {
  slidesToShow: 3,
  slidesToScroll: 1,
      }
    },
    {
      breakpoint: 480,
      settings: {
  slidesToShow: 3,
  slidesToScroll: 1,
      }
    }
   ]
});
</script>
<style>

.life_cont4_box .tr_txt{text-align:center}
.life_cont4 .tr_txt a{display:block;width:90%;margin:0 auto;}
.life_cont4 .a_left, .life_cont4 .a_right{display:none}
.life_cont4 {position:relative}
.life_cont4 .life_cont4_box{float:none;margin:0 auto}
.life_cont4 .slick-prev.slick-arrow{cursor:pointer;z-index:99;position:absolute;left:-5%;top:30%;background:url('/img/mobile/editor_left.gif') center center no-repeat;width:14px;height:25px;border:none;text-indent:-9999rem;}
.life_cont4 .slick-next.slick-arrow{cursor:pointer;z-index:99;position:absolute;right:-5%;top:30%;background:url('/img/mobile/editor_right.gif') center center no-repeat;width:14px;height:25px;border:none;text-indent:-9999rem;}
.life_cont4_box .tr_txt{padding-top:1rem}
.life_cont4 .life_cont4_box div img{margin:0 5%;}
@media screen and (max-width: 640px){
	.life_cont4 .slick-prev.slick-arrow{left:-5%;top:20%;background:url('/img/mobile/editor_left.gif') center center no-repeat;width:10px;background-size:100% auto }
	.life_cont4 .slick-next.slick-arrow{ right:-5%;top:20%;background:url('/img/mobile/editor_right.gif') center center no-repeat;width:10px;background-size:100% auto}
} 
@media screen and (max-width: 400px){
	.life_cont4 .slick-prev.slick-arrow{top:10%;}
	.life_cont4 .slick-next.slick-arrow{top:10%;}
} 
</style>
