<style>
.widget_menu {cursor:pointer;}
</style>
<main id="main" role="main" tabindex="-1">
  <div class="container">
    <div class="layout-blog">
      <div>
<?php
if(isset($today[$today_date])==TRUE) {
  switch ($today_date) {
    case 'mon'  : $yoil = '월'; break;
    case 'tue'  : $yoil = '화'; break;
    case 'wed'  : $yoil = '수'; break;
    case 'thu'  : $yoil = '목'; break;
    case 'fri'  : $yoil = '금'; break;
    case 'sat'  : $yoil = '토'; break;
  }
  $today_maptoon = $today[$today_date];
  if(count($today_maptoon)) {
  ?>
  <article class="featured-webtoon poster gap-bottom-sm">
    <div class="webtoon-slider">
    <?foreach($today_maptoon as $v){?>
      <div>
        <a href="<?=$v['maptoon_url']?>"><img src="<?php echo imgSrc($v['main_img'])?>" alt="" width="191" height="241"></a>
        <div class="label"><span class="highlight"><?php echo $yoil;?></span>오늘의 웹툰</div>
        <a href="<?=$v['maptoon_url']?>"><h2 class="title"><?php echo stripslashes($v['name']);?></h2></a>
        <div class="summary"><?php echo stripslashes($v['description']);?></div>
      </div>
    <?}?>
    </div>
    <?if(count($today_maptoon)>1){?>
      <div class="webtoon-controls">
              <div class="arrowPrev"><i class="fas fa-chevron-left"></i></div>
              <div class="arrowNext"><i class="fas fa-chevron-right"></i></div>
      </div>
    <?}?>
  </article>
    <? }
} else {
  echo '<article class="featured-webtoon poster gap-bottom-sm">&nbsp;</article>';
}?>

        <section class="todays-webtoon gap-bottom-md">
          <header>
            <h2>오늘의 웹툰</h2>
            <div class="link"><a>공지사항</a></div>
          </header>
          <ol>    
<?php
foreach($today as $k=>$v){
    foreach($v as $x){
      if(isset($x['maptoon_url'])==TRUE) {
        echo '<li>';
        if($k=='mon') {
          echo '<span class="week">월요일</span>';
        } else if($k=='tue') {
          echo '<span class="week">화요일</span>';
        } else if($k=='wed') {
          echo '<span class="week">수요일</span>';
        } else if($k=='thu') {
          echo '<span class="week">목요일</span>';
        } else if($k=='fri') {
          echo '<span class="week">금요일</span>';
        } else if($k=='sat') {
          echo '<span class="week">토요일</span>';
        } else if($k=='sun') {
        }
        echo '<a href="'.$x['maptoon_url'].'" class="thumb"><img src="'.imgSrc($x['main_img']).'" alt="" width="83" height="90"></a>';
        echo ' <span class="txt">
                  <a href="'.$x['maptoon_url'].'" class="title">'.stripslashes($x['name']).'</a>
                <span class="summary">'.stripslashes($x['description']).'</span>
                <a class="artist">'.$x['cartoonist'].'</a>
              </span>';  
      }
      echo '</li>';
    }
}
?>
          </ol>
        </section>
  
        <section class="gap-bottom-md">
          <header class="row-header row-header-tools">
            <h2 class="title"><a>추천 웹툰</a></h2>
            <div class="tools sortby">
              <a class="update current widget_menu" base="recomm_toons" tg="recomm_toon_update">업데이트순</a>
              <a class="view-count widget_menu" base="recomm_toons" tg="recomm_toon_count">조회순</a>
              <a class="star-score widget_menu" base="recomm_toons" tg="recomm_toon_grade">별점순</a>
            </div>
          </header>
          <ul class="gallery-3 recomm_toons" id="recomm_toon_update">
<?php
foreach($recomm_date as $v) {
  echo '<li>';
  echo '<a class="img-scaleup" href="'.$v['episode_url'].'"><img src="'.imgSrc($v['main_img']).'" alt="" width="218" height="120"></a>';
  echo '<h3 class="row-title"><a href="'.$v['maptoon_url'].'">'.stripslashes($v['name']).'</a></h3>';
  echo '<div class="row-des"><a href="'.$v['episode_url'].'">'.stripslashes($v['title']).'</a></div>';
  echo '<div class="row-user">'.stripslashes($v['cartoonist']).'</div>';
  echo '</li>';
}
?>          
          </ul>
          <ul class="gallery-3 recomm_toons" id="recomm_toon_count" style="display:none;">
<?php
foreach($recomm_count as $v) {
  echo '<li>';
  echo '<a class="img-scaleup" href="'.$v['episode_url'].'"><img src="'.imgSrc($v['main_img']).'" alt="" width="218" height="120"></a>';
  echo '<h3 class="row-title"><a href="'.$v['maptoon_url'].'">'.stripslashes($v['name']).'</a></h3>';
  echo '<div class="row-des"><a href="'.$v['episode_url'].'">'.stripslashes($v['title']).'</a></div>';
  echo '<div class="row-user">'.stripslashes($v['cartoonist']).'</div>';
  echo '</li>';
}
?>          
          </ul>
          <ul class="gallery-3 recomm_toons" id="recomm_toon_grade" style="display:none;">
<?php
foreach($recomm_grade as $v) {
  echo '<li>';
  echo '<a class="img-scaleup" href="'.$v['episode_url'].'"><img src="'.imgSrc($v['main_img']).'" alt="" width="218" height="120"></a>';
  echo '<h3 class="row-title"><a href="'.$v['maptoon_url'].'">'.stripslashes($v['name']).'</a></h3>';
  echo '<div class="row-des"><a href="'.$v['episode_url'].'">'.stripslashes($v['title']).'</a></div>';
  echo '<div class="row-user">'.stripslashes($v['cartoonist']).'</div>';
  echo '</li>';
}
?>          
          </ul>
        </section>
  
        <section class="gap-bottom-md">
          <header class="row-header row-header-tools">
            <h2 class="title"><a>신앙하는 우리 이야기</a></h2>
            <div class="tools sortby">
              <a class="update current widget_menu" base="story_toons" tg="story_toon_update">업데이트순</a>
              <a class="view-count widget_menu" base="story_toons" tg="story_toon_count">조회순</a>
              <a class="star-score widget_menu" base="story_toons" tg="story_toon_grade">별점순</a>
            </div>
          </header>
          <ul class="gallery-3 story_toons" id="story_toon_update">
<?php
foreach($story_date as $v) {
  echo '<li>';
  echo '<a class="img-scaleup" href="'.$v['episode_url'].'"><img src="'.imgSrc($v['main_img']).'" alt="" width="218" height="120"></a>';
  echo '<h3 class="row-title"><a href="'.$v['maptoon_url'].'">'.stripslashes($v['name']).'</a></h3>';
  echo '<div class="row-des"><a href="'.$v['episode_url'].'">'.stripslashes($v['title']).'</a></div>';
  echo '<div class="row-user">'.stripslashes($v['cartoonist']).'</div>';
  echo '</li>';
}
?>  
          </ul>
          <ul class="gallery-3 story_toons" id="story_toon_count" style="display:none;">
<?php
foreach($story_count as $v) {
  echo '<li>';
  echo '<a class="img-scaleup" href="'.$v['episode_url'].'"><img src="'.imgSrc($v['main_img']).'" alt="" width="218" height="120"></a>';
  echo '<h3 class="row-title"><a href="'.$v['maptoon_url'].'">'.stripslashes($v['name']).'</a></h3>';
  echo '<div class="row-des"><a href="'.$v['episode_url'].'">'.stripslashes($v['title']).'</a></div>';
  echo '<div class="row-user">'.stripslashes($v['cartoonist']).'</div>';
  echo '</li>';
}
?>  
          </ul>
          <ul class="gallery-3 story_toons" id="story_toon_grade" style="display:none;">
<?php
foreach($story_grade as $v) {
  echo '<li>';
  echo '<a class="img-scaleup" href="'.$v['episode_url'].'"><img src="'.imgSrc($v['main_img']).'" alt="" width="218" height="120"></a>';
  echo '<h3 class="row-title"><a href="'.$v['maptoon_url'].'">'.stripslashes($v['name']).'</a></h3>';
  echo '<div class="row-des"><a href="'.$v['episode_url'].'">'.stripslashes($v['title']).'</a></div>';
  echo '<div class="row-user">'.stripslashes($v['cartoonist']).'</div>';
  echo '</li>';
}
?>  
          </ul>
        </section>
  
        <section class="gap-bottom-md">
          <header class="row-header row-header-tools">
            <h2 class="title"><a>말씀 새롭게 읽기</a></h2>
            <div class="tools sortby">
              <a class="update current widget_menu" base="read_toons" tg="read_toon_update">업데이트순</a>
              <a class="view-count widget_menu" base="read_toons" tg="read_toon_count">조회순</a>
              <a class="star-score widget_menu" base="read_toons" tg="read_toon_grade">별점순</a>
            </div>
          </header>
          <ul class="gallery-3 read_toons" id="read_toon_update">
<?php
foreach($read_date as $v) {
  echo '<li>';
  echo '<a class="img-scaleup" href="'.$v['episode_url'].'"><img src="'.imgSrc($v['main_img']).'" alt="" width="218" height="120"></a>';
  echo '<h3 class="row-title"><a href="'.$v['maptoon_url'].'">'.stripslashes($v['name']).'</a></h3>';
  echo '<div class="row-des"><a href="'.$v['episode_url'].'">'.stripslashes($v['title']).'</a></div>';
  echo '<div class="row-user">'.stripslashes($v['cartoonist']).'</div>';
  echo '</li>';
}
?>  
          </ul>
          <ul class="gallery-3 read_toons" id="read_toon_count" style="display:none;">
<?php
foreach($read_count as $v) {
  echo '<li>';
  echo '<a class="img-scaleup" href="'.$v['episode_url'].'"><img src="'.imgSrc($v['main_img']).'" alt="" width="218" height="120"></a>';
  echo '<h3 class="row-title"><a href="'.$v['maptoon_url'].'">'.stripslashes($v['name']).'</a></h3>';
  echo '<div class="row-des"><a href="'.$v['episode_url'].'">'.stripslashes($v['title']).'</a></div>';
  echo '<div class="row-user">'.stripslashes($v['cartoonist']).'</div>';
  echo '</li>';
}
?>  
          </ul>
          <ul class="gallery-3 read_toons" id="read_toon_grade" style="display:none;">
<?php
foreach($read_grade as $v) {
  echo '<li>';
  echo '<a class="img-scaleup" href="'.$v['episode_url'].'"><img src="'.imgSrc($v['main_img']).'" alt="" width="218" height="120"></a>';
  echo '<h3 class="row-title"><a href="'.$v['maptoon_url'].'">'.stripslashes($v['name']).'</a></h3>';
  echo '<div class="row-des"><a href="'.$v['episode_url'].'">'.stripslashes($v['title']).'</a></div>';
  echo '<div class="row-user">'.stripslashes($v['cartoonist']).'</div>';
  echo '</li>';
}
?>  
          </ul>
        </section>
      </div>
  
      <!-- side bar -->
      <?php include_once ('mt_right_inc.php');?>
      <!-- //side bar -->
    </div>
  </div>
</main>

<script>
$(document).ready(function() {
  $(".widget_menu").click(function() {
    base = $(this).attr('base');
    tg_id = $(this).attr('tg');

    if(base!=undefined && tg_id!=undefined) {
      reset_menu(base);
      $("#"+tg_id).show();
      $(this).addClass('current');
    }
    return false;
  });

  var reset_menu = function(menu_class) {
    if(menu_class!=undefined) {
      $("."+menu_class).hide();
      $(".widget_menu[base="+menu_class+"]").removeClass('current');
    }
  }
});

var today_webtoon=<?=count($today[$today_date])?>;
if(today_webtoon>1){
var webtoon_wrapper = doc.querySelector('.webtoon-slider'),
    webtoon_controls = doc.querySelector('.webtoon-controls');
if (webtoon_wrapper) {
  var logo_box_slider = tns({
    container: webtoon_wrapper,
    items: 1,
    mouseDrag: true,
    controlsContainer: webtoon_controls,
  });
}
}



</script>