/*-- ------------------------------------------------------ oxsolution JAVASCRIPT functions http://www.oxsolution.com ------------------------------------------------------ --*/ function _touch() { var c = arguments.callee; if (!(this instanceof c)) return new c(); this.START_POS = null; } _touch.prototype.start = function(e) { if (this.START_POS == null) { var touches = e.changedTouches; //À©µµ¿ì µð¹ÙÀ̽º´Â °í·ÁÇÏÁö ¾ÊÀ½ if (touches.length) { this.START_POS = [touches[0].pageX,touches[0].pageY]; return true; } } this.START_POS = null; return false; } _touch.prototype.end = function(e) { var xy = [0,0]; if (this.START_POS != null) { var touches = e.changedTouches; if (touches.length) { xy[0] = touches[0].pageX - this.START_POS[0]; xy[1] = touches[0].pageY - this.START_POS[1]; } } this.START_POS = null; return xy; } function openMenu(btn) { addClass(btn,"close"); addClass(getById("navgrp"),"open"); document.body.style.overflow = "hidden"; } function closeMenu(btn) { removeClass(btn,"close"); removeClass(getById("navgrp"),"open"); document.body.style.overflow = ""; } function toggleMenu(btn) { (hasClass(btn,"close")? closeMenu : openMenu)(btn); } function toggleSide(btn) { toggleClass(btn,"close"); toggleClass(getById("side"),"open"); } function _navItem(e) { if (!e) e = window.event; var item = getSrcElement(e); do { if (item.tagName == "LI" && /\bm(\d+)\b/.test(item.className)) return item; item = getParentElement(item,"li"); } while (isElement(item)); } (function() { //Àü¿ª ¸Þ´º var gnb = getById("gnb"); if (!gnb) return; var bg = document.createElement("div"); getById("header").appendChild(bg); bg.className = "gnb_bg"; var on = function(e) { var item = _navItem(e); if (item) { addClass(item,"on"); addClass(gnb,"on"); addClass(bg,"on"); } }; var off = function() { var item; for (var i=0,n=gnb.children.length; i 50 && Math.abs(xy[0]) > Math.abs(xy[1]) * 2) closeMenu(btn); }; attachFunc(nav,"touchstart",touchStart); attachFunc(nav,"touchend",touchEnd); attachFunc(nav,"touchcancel",touchEnd); } } })(); (function(mp,cmd) { //Áö¿ª ¸Þ´º var lnb = getById("lnb"); if (!lnb || !mp) return; var mpArr = []; if (mp == "member") { //ȸ¿ø¿µ¿ª ¿¹¿Ü ó¸® if (IS_LOGIN) { if (cmd == "login" || cmd == "register" || cmd == "register_ok" || cmd == "") cmd = "mypage"; }else{ if (cmd == "mypage" || cmd == "info_change" || cmd == "user_del" || cmd == "") cmd = "login"; else if (cmd == "register_ok") cmd = "register"; } mpArr.push(mp); /* }else if (mp == "") { //±âŸ ¿¹¿Ü ó¸® */ }else if (mp.indexOf("_") != -1) { //ÀϹÝÀûÀÎ °èÃþ ±¸Á¶ mpArr = mp.split("_"); cmd = ""; }else{ mpArr.push(mp); } //ÇöÀç ¸Þ´º ¹ÝÀü(on) var a = lnb.getElementsByTagName("a"), ok = false; var on = function(e) { while (isElement(e)) { if (e.id == "lnb") break; if (e.tagName == "LI") addClass(e,"on"); e = e.parentNode; } ok = true; }; var reg, i, n = a.length; while (mpArr.length) { mp = mpArr.join("_"); if (mpArr.pop() != "") { if (mpArr.length) mpArr.push(""); reg = new RegExp("\\bmp="+mp+"\\b"); }else{ reg = new RegExp("\\bmp="+mp+"[a-z0-9]+\\b"); } for (i=0; i 0) { imgs[n].style.zIndex = (n == onImgN)? 110 : 100; } n = btns.length; while (n-- > 0) { btns[n].className = (n == onImgN)? "on" : ""; } }, prev = function() { dir = -1; lastImgN = onImgN--; if (onImgN < 0) onImgN = imgs.length - 1; sort(); fadein(); }, next = function() { dir = 1; lastImgN = onImgN++; if (onImgN > imgs.length - 1) onImgN = 0; sort(); fadein(); }, pick = function(n) { if (onImgN != n) { lastImgN = onImgN; onImgN = n; sort(); fadein(); } }, stopTimer = function() { if (timer != null) { clearTimeout(timer); timer = null; } }, setTimer = function(func,sec) { stopTimer(); timer = setTimeout(func,sec); if (sec >= secStop) busy = false; }, fadein = function() { busy = true; var elm = imgs[onImgN], o = getOpacity(elm); o = Math.min((o * 100 + 10) / 100, 1); setOpacity(elm,o); if (o < 1) { setTimer(fadein,secChange); }else if (lastImgN != onImgN) { if (lastImgN != -1) { setOpacity(imgs[lastImgN],0); } setTimer((dir > 0)? next : prev, secStop); } }; _prevVisual = function() {if (!busy) prev()}; _nextVisual = function() {if (!busy) next()}; _pickVisual = function(n) {if (!busy) pick(n)}; _stopVisual = function() {if (!busy) stopTimer()}; ox_addBodyOnLoad(function() { for (var i=0,elm; i 1) { var tmp = document.createElement("div"); lst.appendChild(tmp); tmp.className = "btns"; tmp.innerHTML = ''; tmp = document.createElement("ul"); lst.appendChild(tmp); tmp.className = "navi"; for (var i=0,item; i'+(i + 1)+''; tmp.appendChild(item); btns.push(item); } if (IS_MOBILE) { var oTouch = _touch(), touchStart = function(e) { if (oTouch.start(e)) { _stopVisual(); }else{ fadein(); } }, touchEnd = function(e) { var xy = oTouch.end(e); if (Math.abs(xy[0]) > 50 && Math.abs(xy[0]) > Math.abs(xy[1]) * 2) { if (xy[0] > 0) { _prevVisual(); }else{ _nextVisual(); } }else{ fadein(); } }; attachFunc(visual,"touchstart",touchStart); attachFunc(visual,"touchend",touchEnd); attachFunc(visual,"touchcancel",touchEnd); } } next(); //½ÃÀÛ /* setTimeout(function() { //CSS animation ¹ÌÁö¿ø ȯ°æ var slogan = getLastChild(visual,".slogan"); var v = slogan.style.visibility || (slogan.currentStyle && slogan.currentStyle.visibility) || (window.getComputedStyle && window.getComputedStyle(slogan,null).getPropertyValue("visibility")) || ""; if (v == "hidden") { setOpacity(slogan,0); slogan.style.visibility = "visible"; var fadeinSlogan = function() { var o = getOpacity(slogan); if (o < 1) { setOpacity(slogan, Math.min((o * 100 + 10) / 100, 1)); setTimeout(fadeinSlogan, secChange); } }; fadeinSlogan(); } }, 500); //CSS animationÀ» »ç¿ëÇؼ­ 0.3ÃÊ ÈĺÎÅÍ visibility¸¦ visible·Î º¯°æÇÔ, ÀÌ·ÐÀûÀ¸·Î 300(0.3ÃÊ)ÀÌ»óÀÇ °ªÀ» ¼³Á¤ÇÏ¸é µÇÁö¸¸, Å×½ºÆ® ÈÄ Àû´çÇÑ °ªÀ¸·Î ¼öÁ¤ÇÔ */ }); })(5000,30); (function(hiddenY) { //¼­ºê ºñÁÖ¾ó var visual = getById("visual"); if (!visual) return; var elm = getFirstChild(visual); if (!elm || elm.tagName != "IMG" || !/\bvisual_sub\d*\b/.test(elm.src)) return; attachFunc(window,"scroll",function() { elm.style.top = "-"+Math.min(document.body.scrollTop || document.documentElement.scrollTop || 0, hiddenY)+"px"; }); })(350 - 300); //(¿øº» À̹ÌÁö ³ôÀÌ) - (È­¸é¿¡ ³ëÃâµÇ´Â ¿µ¿ª ³ôÀÌ) /* (function(elmId,stopSec) { //Æ˾÷Á¸ var lst = getById(elmId); if (!lst) return; var items = lst.getElementsByTagName("li"), btns; var itemCnt = items.length; addClass(lst,"n"+itemCnt); if (itemCnt < 2) return; var showN = 0, dir = 1, timer = null, prevN = function() { var n = showN - 1; if (n < 0) n = itemCnt - 1; return n; }, nextN = function() { var n = showN + 1; if (n > itemCnt - 1) n = 0; return n; }, stop = function() { if (timer) { clearTimeout(timer); timer = null; } }, show = function(n) { stop(); if (n == null) { n = (dir > 0)? nextN() : prevN(); } for (var i=0; i'+j+''; } var e = document.createElement("ul"); e.className = "btns"; e.innerHTML = html; lst.parentNode.appendChild(e); btns = e.getElementsByTagName("a"); var a = lst.getElementsByTagName("a"); for (var i=0; i 50 && Math.abs(xy[0]) > Math.abs(xy[1]) * 2) { if (xy[0] > 0) { _prevPopzone(); }else{ _nextPopzone(); } }else{ _playPopzone(); } }; attachFunc(lst,"touchstart",touchStart); attachFunc(lst,"touchend",touchEnd); attachFunc(lst,"touchcancel",touchEnd); } })("popzone",3000); */ function _latest(elmId) { //ÃßÃâÅÇ var elm = getById(elmId); if (!elm) return; var on = function(e) { if (!e) e = window.event; var eTab = getParentElement(getSrcElement(e),"div.tab"); for (var i=0,n=elm.children.length; i 0 && w - this.LIST.offsetWidth > 2) { //¹è³Ê Å©±â¸¦ ÆÛ¼¾Æ®(%)·Î Á¤ÀÇÇÏ¸é ¾à 2px Á¤µµÀÇ ¿ÀÂ÷°¡ ¹ß»ýÇÒ ¼ö ÀÖÀ½ if (!btns) { btns = document.createElement("div"); btns.className = "btns"; btns.innerHTML = '' +(this.AUTO_MOVE ? '' : "") +''; this.BOX.parentNode.appendChild(btns); } btns.style.display = ""; if (this.AUTO_MOVE) { this.IS_GO = true; this.start(this.STOP_SEC); } }else{ this.IS_GO = false; this.stop(); this.LIST.style.left = 0; if (btns) { btns.style.display = "none"; } } } _banner.prototype.move = function(direc) { if (!this.IS_GO) return; this.stop(); var lft = parseInt(this.LIST.style.left,10) || 0, to = 0, sec = 10; if (!direc) direc = this.DIREC; if (direc == -1) { //¿À¸¥ÂÊÀ¸·Î if (lft >= to) { this.LIST.insertBefore(getLastChild(this.LIST),this.LIST.firstChild); this.LIST.style.left = (this.ITEM_W * -1)+"px"; if (this.DIREC == direc) { if (!this.AUTO_MOVE) return; sec = this.STOP_SEC; } }else{ this.LIST.style.left = Math.min(lft + Math.max(Math.floor((to - lft) / 5), 1), to)+"px"; } }else{ //¿ÞÂÊÀ¸·Î to = this.ITEM_W * -1; if (lft <= to) { this.LIST.appendChild(getFirstChild(this.LIST)); this.LIST.style.left = 0; if (this.DIREC == direc) { if (!this.AUTO_MOVE) return; sec = this.STOP_SEC; } }else{ this.LIST.style.left = Math.max(lft - Math.max(Math.floor((lft - to) / 5), 1), to)+"px"; } } this.DIREC = direc; var that = this; this.TIMER = setTimeout(function() {that.move()}, sec); } _banner.prototype.start = function(sec) { if (!this.IS_GO) return; this.stop(); var that = this; this.TIMER = setTimeout(function() {that.move()}, sec || 10); } _banner.prototype.stop = function() { if (!this.IS_GO || !this.TIMER) return; clearTimeout(this.TIMER); this.TIMER = null; } _banner.prototype.toLeft = function() { this.IS_GO = true; this.move(1); } _banner.prototype.toRight = function() { this.IS_GO = true; this.move(-1); } ox_addBodyOnLoad(function() { _banner("banner",3000); }); (function() { //Ä«ÇǶóÀÌÆ® ÇÏ´Ü¿¡ ºÙÀ̱â var content = getById("container") || getById("content"), footer = getById("footer"); if (!content || !footer) return; var _resize = function() { content.style.marginBottom = footer.offsetHeight+"px"; }; ox_addBodyOnLoad(function() { footer.style.width = "100%"; footer.style.position = "absolute"; footer.style.left = 0; footer.style.bottom = 0; _resize(); attachFunc(window,"resize",_resize); }); })();