$(document).ready(function(){$("#top_layout .search > a").on("click",function(){if($(this).attr("class")=="open"){$(this).parent().addClass("on");$("#search_box .input_wrap #search_input").focus();$("body").css({"overflow":"hidden","height":"100%"});$("#gnb_layout, .gnb_bg").addClass("no_open");}else{$(this).parent().removeClass("on");$("body").removeAttr("style");$("#gnb_layout, .gnb_bg").removeClass("no_open");$("#btnAllmenu").focus();}});$(".allmenu").on("click",function(){});});function gnb(param,obj,btn,wrap,dur,meth){var param=$(param);var btn=param.find(btn);var obj=param.find(obj);var wrap=$(wrap);var data=false;var elem;var targetHeight=new Array();var targetHeightResult;var heightResult=btn.outerHeight(true);function gnb_height(){$.each(obj,function(idx){targetHeight[idx]=$(this).parent().find(".item").outerHeight(true)+80;});}
function _open(){btn.parent().find(".item").removeAttr("style");btn.not(elem).removeClass("current").eq(elem).addClass("current");obj.not(elem).hide().css({display:"none",opacity:0});gnb_height();obj.eq(elem).show().stop().animate({display:"block",opacity:1},{duration:300,easing:'swing'});param.stop(true,false).animate({"height":targetHeight[elem]},{duration:300,easing:'swing'});param.addClass("open");$("#top_layout").addClass("on");}
function _close(){btn.removeClass("current");obj.css({display:"none",opacity:0});param.stop(true,false).animate({"height":heightResult},{duration:300,easing:'swing'});param.removeClass("open");$("#top_layout").removeClass("on");}
btn.on('mouseover focusin',function(){elem=$(this).parent().index();_open();});obj.item=obj.find(".depth2_ul");obj.btn=obj.find(".depth2_ul>li>a");obj.item.on("mouseenter focus",function(){$(this).siblings().removeClass('on').find('*.on').removeClass('on');$(this).addClass("on");});obj.btn.on("mouseenter focus",function(){var t=$(this);obj.btn.removeClass("on");t.addClass("on");$(".depth3_ul").hide();t.next().show();t.find(".depth3_ul").show().addClass('open');if(t.next().is(".depth3_ul")){var th3Height=t.next().outerHeight(true)+btn.outerHeight(true);if(th3Height<param.outerHeight()){param.stop(true,false).animate({"height":targetHeight[elem]},{duration:300,easing:'swing'});}else{param.stop(true,false).animate({"height":th3Height},{duration:300,easing:'swing'});return false;}
t.parent().parent().height(t.next().innerHeight());return false;}else{param.stop(true,false).animate({"height":targetHeight[elem]},{duration:300,easing:'swing'});}});obj.btn.next('.depth3_ul').on("mouseenter focus",function(){$(this).addClass("open");$(this).prev('a').addClass("on");});obj.btn.next('.depth3_ul').on("mouseleave",function(){$(this).removeClass("open");$(this).prev('a').removeClass("on");});obj.find("a").last().on("focusout",function(){_close();btn.removeClass("current");param.removeClass("open");wrap.removeClass("on");});wrap.on("mouseleave",function(){_close();});}
function gnb_open(){var param=$('#mobile-menu');var str=location.pathname;var n=0;var dur=300;var meth="easeOutExpo";param.find(".depth2_ul").hide();var t1=param.find('.depth3_ul> li > a[href*="'+str+'"]');var t2=param.find('.depth2_ul > li > a[href*="'+str+'"]');if(t1.length>0)
{param.find('.depth3_ul > li > a[href*="'+str+'"] > span').css('color',"#1f699c;");param.find('.depth3_ul > li > a[href*="'+str+'"]').parents('.depth2_ul').css('display','block').prev().addClass("ov");param.find('.depth3_ul > li > a[href*="'+str+'"]').parents('.depth3_ul').css('display','block').prev().addClass("ov");param.find('.depth3_ul > li > a[href*="'+str+'"]').parents('.depth2_ul').addClass("ov").next().stop(true,true).slideDown(150);}
else{param.find('.depth2_ul > li > a[href*="'+str+'"] > span').css('color',"#1f699c");param.find('.depth2_ul > li > a[href*="'+str+'"]').parents('.depth2_ul').css('display','block').prev().addClass("ov");}
param.find("a").on("click",function(event){if(param.is(":animated")&&param.find(":animated").size()){return false;}});function hideMenu(){param.find('.collapse').hide().removeClass('ov');}
param.find(".depth1_ul>li>a").on("click",function(event){n=$(this).parent().index();if($(this).next().attr("class").match("depth2_ul")){if($(this).next().css("display")=="none"){param.find(".depth1_ul>li>a").not(n).removeClass("ov").next().stop(true,true).delay(150).slideUp(150);param.find(".depth1_ul>li>a").eq(n).addClass("ov").next().stop(true,true).slideDown(150);}}
event.preventDefault();});param.find(".depth2_ul>li>a").on("click",function(event){var t=$(this);if(t.next().attr("class").match("depth3_ul")){if(t.next().css("display")!="block"){t.addClass("ov");t.next().slideDown(150);}else{t.removeClass("ov");t.next().slideUp(150);}
event.preventDefault();}});$(window).on('resize',function(){$('.mobile-close').click();$('#gnb_layout').removeAttr('style');});}