var util = { user : function(type){ if(!type) return; if(type=="ie") return (!!(window.attachEvent && !window.opera)); if(type=="firefox") return (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1); if(type=="opera") return (!!window.opera); if(type=="webkit") return (navigator.userAgent.indexOf("AppleWebKit/") > -1); if(type=="gecko") return (navigator.userAgent.indexOf("Gecko") > -1 && navigator.userAgent.indexOf("KHTML") == -1); if(type=="mobile") return (navigator.userAgent.match(/iPhone|iPad|iPod|Android|Windows CE|BlackBerry|Symbian|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson/i) != null || navigator.userAgent.match(/phone|samsung|lgtel|mobile|skt|nokia|blackberry|android|sony/i) != null); return type; }, bigImg : function(obj,$bigObj,$item){ $bigObj.attr("src",obj.href); if($item) $item.removeClass("active").filter(obj).addClass("active"); }, reflash: function (containerid, swfid, src, w, h, flashvars, base, wmode, bg) { // flash reWrite. var wmode = wmode || "transparent", bg = bg || "none", base = base || "", flashvars = flashvars || "", html = ""; if (!!(window.attachEvent && !window.opera)) { html += ""; } else { html += ""; } if($("#" + containerid).length>0) $("#" + containerid).html(html); else return html; }, tabChange : function($item){ $item.click(function(){ var curObj = this; $item.each(function(){ if(this==curObj){ if(this.href.split("#").length>1) $("#"+this.href.split("#")[1]).addClass("active"); }else{ if(this.href.split("#").length>1) $("#"+this.href.split("#")[1]).removeClass("active"); } }); }) }, trace : function(msg,type){ //util.trace(1); if($("#trace").length==0) $("body").append("
"); $box = $("#trace"); msg = (type) ? $box.html()+" || "+msg : msg; $box.html(msg); }, getCookie : function(name){ var start = document.cookie.indexOf(name + "="); var len = start + name.length + 1; if ((!start) && (name != document.cookie.substring(0, name.length))) return null; if (start == -1) return null; var end = document.cookie.indexOf(";", len); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(len, end)); }, setCookie : function(name, value, expires, path, domain, secure){ var today = new Date(); today.setTime(today.getTime()); if (expires) expires = expires * 1000 * 60 * 60 * 24; var expires_date = new Date(today.getTime() + (expires)); document.cookie = name+"="+escape(value) + ((expires) ? ";expires="+expires_date.toGMTString() : "") + //expires.toGMTString() ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ((secure) ? ";secure" : ""); }, toggleList : function($obj){ var obj = $obj[0]; obj.reset = function(){ obj.t = $obj.find(".listHead"), obj.btn = obj.t.find(".btn"), obj.v = $obj.find(".listBody"); obj.v.eq(obj.v.length-1).addClass("last"); if(obj.t.length==0) return; obj.btn.each(function(z){ this.flag = (obj.t[z].className.match(/active/)) ? true : false; this.onclick = function(){ var bThis = this; obj.t.each(function(i){ if(z==i && !obj.btn[i].flag){ obj.btn[i].flag = true, obj.btn[i].title = bThis.title.replace("열기","닫기");; obj.t.eq(i).addClass("active"); obj.v.eq(i).addClass("active"); }else{ obj.btn[i].flag = false, obj.btn[i].title = bThis.title.replace("닫기","열기"); obj.t.eq(i).removeClass("active"); obj.v.eq(i).removeClass("active"); } }); return false; } }); } obj.reset(); } } var page={ wrap : null, active : [0,0,0], depName : ["g", "l", "s"], gnb : { $obj : null, obj : null, resettimer : null, flag : false, maxH : null, minH : null, dep1 : null, dep2 : null, over : function(){ var gnb = page.gnb; if(gnb.$obj.height()==gnb.maxH) return; gnb.$obj.find(".dep2,.dep4").show(); gnb.$obj.stop().animate({"height":gnb.maxH},300,'easeInOutCubic'); }, out : function(){ var gnb = page.gnb; if(gnb.$obj.height()==gnb.minH) return; gnb.$obj.stop().animate({"height":gnb.minH},300,'easeInOutCubic'); }, one : function(type){ var gnb = page.gnb; gnb.dep1.not(this.parentNode.parentNode).find(".dep2,.dep4").children().children("a").removeClass("active").end().end().end().end().removeClass("active").filter(this.parentNode.parentNode).addClass("active"); if(type!=true) gnb.over(); }, two : function(type){ var gnb = page.gnb, $this = $(this); gnb.dep2.removeClass("active").filter(this).addClass("active"); if(type!=true) gnb.one.call($this.parent().parent().prev().find("a")[0]); }, resetaction : function(){ var gnb = page.gnb; if(page.active[0] <= gnb.dep1.length && page.active[0]-1 != -1) gnb.one.call(gnb.dep1.filter("."+page.depName[0]+ page.active[0]).find("strong a")[0], true); else gnb.dep1.removeClass("active"); if(page.active[1] <= gnb.dep1.find(".dep2,.dep4").children().children("a").length && page.active[1]-1 != -1) gnb.two.call(gnb.dep1.filter("."+page.depName[0]+ page.active[0]).find("."+page.depName[1]+ page.active[1]).children("a")[0], true); else gnb.dep2.removeClass("active"); gnb.out(); }, clearreset : function(){ clearTimeout(page.gnb.resettimer); }, reset : function(nodelay){ var gnb=page.gnb; gnb.clearreset(); if(gnb.$obj.find(":focus").length>0 || page.gnb.flag) return false; if(nodelay===true) gnb.resetaction(true); else gnb.resettimer=setTimeout(function(){ gnb.reset(true); }, 300); }, init : function(){ var gnb = this; gnb.$obj = $("#menu .gnb"); //gnb.$obj.parent().append('').parent().prepend(''); //그림자 효과 dep2 효과 on gnb.$obj.parent().append('').parent().prepend(''); //그림자 효과 dep2 효과 none gnb.obj = gnb.$obj[0]; gnb.maxH = gnb.obj.scrollHeight; gnb.minH = gnb.obj.offsetHeight; gnb.$obj.mouseover(function(){ gnb.flag = true; gnb.clearreset(); gnb.over.call(this); }) .mouseout(function(){ gnb.flag = false; gnb.reset(); }) .find("strong a").focus(function(){ gnb.clearreset(); gnb.one.call(this); }) .each(function(){ if(util.user('mobile')){ this.onclick = function(){ gnb.clearreset(); gnb.one.call(this); return false; } } }) //모바일 클릭 .mouseover(function(){ gnb.flag = true; gnb.clearreset(); gnb.one.call(this); }) .blur(gnb.reset); gnb.dep1 = gnb.$obj.children(); gnb.dep2 = gnb.$obj.find(".dep2,.dep4").hide().children().children("a").focus(gnb.two).mouseover(gnb.two).blur(gnb.reset); gnb.resetaction(); } }, path : { $obj : null, resettimer : null, flag : false, one : function(){ $(this).parent().addClass("view").parent().find(".view").not(this.parentNode).removeClass("view").find(".other").slideUp(100).end().end().end().end().end().next().slideDown(100,function(){ this.style.display = "block" }); }, two : function(){ if(this.className.match(/more/)){ $(this).parent().addClass("active").end().next().css({"display":"block"}).parent().parent().children().not(this.parentNode).removeClass("active").find(".dep3").css({"display":"none"}); }else{ $(this).parent().addClass("active").parent().children().not(this.parentNode).removeClass("active").find(".dep3").css({"display":"none"}); } }, out : function(type){ page.path.$obj.find(".view").removeClass("view") .find(".other").slideUp(100) .find(".active").removeClass("active") .find(".dep3").css({"display":"none"}).end().end().end().end() .find("."+page.depName[1]+page.active[1]).addClass("active").end().find(".sub").not(".fixed").find("."+page.depName[2]+page.active[2]).addClass("active"); }, clearreset : function(){ clearTimeout(page.path.resettimer); }, reset : function(type,nodelay){ var path=page.path, $this = $(this), curThis = this; type = type || "one"; path.clearreset(); if($this.find(":focus").length>0 || path.flag) return false; if(nodelay===true) path.out.call(this, type); else path.resettimer=setTimeout(function(){ path.reset.call(curThis, type, true); }, 100); }, init : function(){ var path = this; if(page.gnb.$obj == 0 || page.active[0] == 0) return; var curPath = page.gnb.$obj.find("."+page.depName[0]+page.active[0]); var dep2, dep3, dep2This, dep3This; var html = '