$(document).ready(function() {
 var header = $("#navbar");
 var subnav = $("#nav_wrap > .lnb > li > .subnav");
 var subnavH = subnav.children().height();
 var navbg = $("#nav_wrap > .subnav-bg");
 var maxCount = 0;
 var maxHeight = 0;
 var openBtn = $("#nav_wrap > .btnOpenMenu");
 var calcBgHeight = function() {
  var winWidth = $(window).width();
  if(winWidth > 892) maxHeight = 0;
  $("#nav_wrap > .lnb > li").each(function() {
   if($(this).find('.subnav').height() > maxHeight) maxHeight = $(this).find('.subnav').height();
  });
  maxHeight = maxHeight + 60;
  navbg.css('height', maxHeight);
 }
 var removeStyle = function() {
  subnav.removeAttr('style');
  navbg.removeAttr('style'); 
 };
 $("#nav_wrap > .lnb > li").mouseenter(function() {
  var winWidth = $(window).width();
  if(winWidth > 892) {
   header.addClass('on');
   subnav.stop().slideDown(400);
   navbg.stop().slideDown(400);
  }
 });
 header.mouseleave(function() {
  var winWidth = $(window).width();
  if(winWidth > 892) {
   subnav.stop().slideUp(400);
   navbg.stop().slideUp(400);
   header.removeClass('on');
  }
 });
 $(window).bind('scroll', function() {
  var scrTop = $(this).scrollTop();
  var headerSize = header.height();
  if(scrTop >= headerSize) {
   if(!header.hasClass('fixed')) header.addClass('fixed');
  } else {
   header.removeClass('fixed');
  }
 });
 $(window).bind('load resize', function() {
  removeStyle();
  calcBgHeight();
 }).resize();
 var openMenu = function() {
  var topDepth = $.urlParam('tm') - 1,
   subDepth = $.urlParam('sm') - 1;
  openBtn.addClass('open');
  $("#nav_wrap").addClass('open');
  if(topDepth !== -1 && subDepth !== -1) {
   $("#nav_wrap > .lnb > li:eq(" + topDepth + ")").addClass('open');
   $("#nav_wrap > .lnb > li:eq(" + topDepth + ") > .subnav").css('display','block');
  }
  $("#nav_wrap > .lnb-overlay").stop().fadeIn(400);
 };
 var closeMenu = function() {
  openBtn.removeClass('open');
  $("#nav_wrap").removeClass('open');
  $("#nav_wrap > .lnb-overlay").stop().fadeOut(400, function() {
   removeStyle();
  });
 };
 $("#nav_wrap > .lnb-overlay").click(function() {
  closeMenu();
 });
 openBtn.click(function() {
  if(!openBtn.hasClass('open')) {
   openMenu();
  } else {
   closeMenu();
  }
 });
// $("#nav_wrap > .lnb > li > a").bind('click touchend', function(e) {
//  var winWidth = $(window).width();
//  if(winWidth < 1025) {
//   if($(this).siblings('.subnav').length) e.preventDefault();
//   if(!$(this).parent().hasClass('open')) {
//    $("#nav_wrap > .lnb > li > .subnav").stop().slideUp(300);
//    $("#nav_wrap > .lnb > li").removeClass('open');
//    $(this).parent().addClass('open');
//    $(this).siblings('.subnav').stop().slideDown(300);
//   } else {
//    $(this).parent().removeClass('open');
//    $(this).siblings('.subnav').stop().slideUp(300);
//   }
//  }
// });
});
/*--------------------- �명꽣 �ㅽ겕由쏀듃 ---------------------*/

/*--------------------- �쒕툕�섏씠吏� �ㅽ겕由쏀듃 ---------------------*/


// 占쎌꼷�좑쭪占� 占쎌뮇��




 


























    


/*
function positionFooter() {
    
            var $containerWidth = $(window).width();
            if ($containerWidth <= 769) {}
            else { 
                
                $('ul.nav li.dropdown').hover(function () {
                    $(this).find('.dropdown-menu').stop(true, true).delay(100).slideDown("400");
                }, function () {
                    $(this).find('.dropdown-menu').stop(true, true).delay(100).slideUp("400");
                });
                $('.sub_tab .btn-group').hover(function () {
                    $(this).find('.dropdown-menu').stop(true, true).delay(100).slideDown("400");
                }, function () {
                    $(this).find('.dropdown-menu').stop(true, true).delay(100).slideUp("400");
                });
            }
        }
        $(document).ready(function () {
            positionFooter(); //run when page first loads
        });
        $(window).resize(function () {
            positionFooter(); //run on every window resize
        });
        $(document).ready(function () {
            $('.animate').scrolla({�됤��
                mobile: true
            });
        });
 */
// $(document).ready(function () {
//            $('.animate').scrolla({�됤��
//                mobile: false
//            });
// �섏씠吏� �쒖옉
//$.urlParam = function(name){
//    var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
//    if (results==null){
//       return null;
//    }
//    else{
//       return decodeURI(results[1]) || 0;
//    }
//}

   
    

//});
$(document).ready(function () {
            $('.animate').scrolla({�됤��
                mobile: true
            });
/*
    $(".depth1").hover(function () {
                $('.dropdown-menu', this).not('.in .dropdown-menu').stop(true, true).slideDown("400");
                $(this).toggleClass('open');
            }, function () {
                $('.dropdown-menu', this).not('.in .dropdown-menu').stop(true, true).slideUp("400");
                $(this).toggleClass('open');
            });
           $(".depth2").hover(function () {
                $('.dropdown-menu', this).not('.in .dropdown-menu').stop(true, true).slideDown("400");
                $(this).toggleClass('open');
            }, function () {
                $('.dropdown-menu', this).not('.in .dropdown-menu').stop(true, true).slideUp("400");
                $(this).toggleClass('open');
            });
*/
        });
$(document).ready(function () {
var depthActive = function() {
  var topCount = $("#nav_wrap > .lnb > li").length,
   subCount = 0;
   topName = [],
   subName = [],
   topURL = [],
   subURL = [],

   topHTML = "",
   subHTML = ""; 
  $("#nav_wrap > .lnb  > li").each(function(i) {
   topName[i] = $(this).children('a').text();
   topURL[i] = $(this).children('a').attr('href');
   i++;
  });
  topHTML += '<ul class="dropdown-menu" role="menu">'; 
  for(i=0; i<topCount; i++) {
   topHTML += '<li><a href="' + topURL[i] + '">' + topName[i] + '<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a></li>';
  }
  topHTML += '</ul>';
  $("#breadcrumbs .depth1").append(topHTML);
  if(topDepth !== -1 && subDepth !== -1) {
   subCount = $("#nav_wrap > .lnb  > li:eq(" + topDepth + ")").find('ul').children().length;
   $("#nav_wrap > .lnb  > li:eq(" + topDepth + ")").find('ul').children().each(function(i) {
    subName[i] = $(this).find('a').text();
    subURL[i] = $(this).find('a').attr('href');
    i++;
   });
   subHTML += '<ul class="dropdown-menu" role="menu">'; 
   for(i=0; i<subCount; i++) {
    subHTML += '<li><a href="' + subURL[i] + '">' + subName[i] + '<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a></li>';
   }
   subHTML += '</ul>';
   $("#breadcrumbs .depth2").append(subHTML);
   $("#breadcrumbs .depth1 > a").text($("#nav_wrap > .lnb > li:eq(" + topDepth + ")").find('a:first').text());
   $("#breadcrumbs .depth2 > a").text($("#nav_wrap > .lnb  > li:eq(" + topDepth + ")").find('ul').children().eq(subDepth).find('a').text());
 /*  雅뚯눘苑� 筌욑옙占쎈챷�� 筌롫뗀�� 占쎌꼷�좑쭪占� 占쎈챷�뉛옙占�
 $("#navbar > .navbar-nav > li:eq(" + topDepth + ")").addClass('on open');
   $("#navbar > .navbar-nav > li:eq(" + topDepth + ")").find('ul').children().eq(subDepth).addClass('on');
   */
  }
 };
    
depthActive();
});