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").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").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").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").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 = '
home'; html += curPath.find("strong").html(); dep2 = curPath.children(".dep2").children(); if( curPath.find("."+page.depName[1]+page.active[1]).length > 0 ){ html += ''; html += ''+curPath.find("."+page.depName[1]+page.active[1]+" a").first().text()+''; dep2.each(function(i){ dep2This = $(this); if(dep2.length>0 && i==0) html += ''; dep3 = dep2This.find(".dep3").children(); html += ''+dep2This.find("a").first().text()+''; dep3.each(function(j){ dep3This = $(this); if(j==0) html += ''; html += ''+dep3This.find("a").first().text()+''; if(j==dep3.length-1) html += ''; }); html += ''; if(dep2.length>0 && i==dep2.length-1) html += ''; }); html += ''; dep3 = curPath.find("."+page.depName[1]+page.active[1]).find(".dep3").children(); if(dep3.length > 0){ if(dep3.filter("."+page.depName[2]+page.active[2]).length>0){ html += ''; html += ''+dep3.filter("."+page.depName[2]+page.active[2]).find("a").first().text()+''; if(dep3.length>1) html += ''; dep3.each(function(j){ dep3This = $(this); html += ''+dep3This.find("a").first().text()+''; }); if(dep3.length>1) html += ''; html += ''; } } } html += '
'; $("#container .titleDep1").after(html); this.$obj = $("#container .locationIn"); if(this.$obj == 0) return; page.winTitle(); var curName = ""; this.$obj.children().eq(2).addClass("fixed").end().last().each(function(){ if(this.nodeName.toLowerCase()=="a") $(this).addClass("last"); else $(this).children("a").first().addClass("last"); }); this.$obj.find(".sub").children().each(function(){ if(this.nodeName.toLowerCase()=="a"){ curName = $(this).mouseover(function(){ path.flag = true; path.clearreset(); path.one.call(this); }).focus(function(){ path.flag = true; path.clearreset(); path.one.call(this); }).text(); if(util.user('mobile')){ this.onclick = function(){ path.flag = true; path.clearreset(); path.one.call(this); return false; } } //모바일 클릭 }else{ $(this).children().find("a").not(".more").mouseover(function(){ path.flag = true; $(this).parent().parent().children().removeClass("active"); path.two.call(this); }).focus(function(){ path.flag = true; $(this).parent().parent().children().removeClass("active"); }).end().end().find(".more").each(function(){ if(util.user('mobile')){ this.onclick = function(){ path.flag = true; path.clearreset(); path.two.call(this); return false; } } //모바일 클릭 $(this).mouseover(function(){ path.flag = true; path.clearreset(); path.two.call(this); }) .focus(function(){ path.flag = true; path.clearreset(); path.two.call(this); }) .next().find("a").mouseover(function(){ path.flag = true; path.clearreset(); path.two.call($(this).parent().parent().prev()[0]); }) .focus(function(){ path.flag = true; path.clearreset(); path.two.call($(this).parent().parent().prev()[0]); }); }); } }); this.$obj.find("a").blur(function(){ path.flag = false; path.reset.call(this); }) .mouseout(function(){ path.flag = false; path.reset.call(this); }); } }, winTitle : function(){ var pathTxt = [], addTxt = $(".winTitleAd"); page.path.$obj.children().each(function(){ if($(this).children().length>0) pathTxt.push($(this).children().first().text()); else if($(this).text()!="home") pathTxt.push($(this).text()); }); addTxt.each(function(){ pathTxt.push($(this).text()); }); document.title = pathTxt.join(" > ") +" | "+ document.title; }, footer : { $obj : null, wing : { $obj : null, baseSc : 0, baseMg : 0, maxWidth : 1000, sc : function(){ var wing = page.footer.wing; var $obj = ($("html").scrollTop() > $("body").scrollTop()) ? $("html") : (($("html").scrollLeft() > $("body").scrollLeft()) ? $("html") : $("body")); var obj = $obj.get(0); if(obj.scrollTop <= wing.baseSc) wing.$obj.css({"top":(wing.baseSc-obj.scrollTop)+"px"}); else wing.$obj.css({"top":0}); if(obj.clientWidth < wing.maxWidth) wing.$obj.css({"left":0,"margin-left":(wing.maxWidth-obj.scrollLeft-wing.$obj.width()-20)+"px"}); else wing.$obj.css({"left":"auto","right":"20px","margin-left":wing.baseMg}); }, init : function($obj){ this.baseSc = (page.active[0]==0) ? 290 : this.$obj.offset().top; this.baseMg = ((this.maxWidth/2)-this.$obj.width())+"px"; if(!util.user("mobile")){ this.$obj.css({"position":"fixed","top":this.baseSc+"px"}) $(window, "body", "html").resize(this.sc).scroll(this.sc) this.sc(); } } }, init : function(){ this.$obj = $("#footer"); if(this.$obj.length==0) return; this.$obj.find(".gnbWrap").html(page.gnb.$obj.parent().html()); this.wing.init(); } }, init : function(){ this.wrap = $('#wrap'); this.footer.wing.$obj = $("#footer .sideMenu"); if(page.wrap.length>0){ if(!page.wrap[0].className) return; if(!page.wrap[0].className.match(/active-/)) return; var acNum = page.wrap[0].className.replace(/active-/g,'').split('-'); for(i=0;i