var bodyEvent = { keep: {}, addEventHandleName: { onmousewheel: 'DOMMouseScroll' }, set: function(handle, func) { var self = this; if (typeof(this.keep[handle]) == 'undefined') { this.keep[handle] = []; } var keep = this.keep[handle]; var len = keep.length; keep[len] = func; var activeExecuter = function(event) { for (var i = 0; i < keep.length; i++) { keep[i](event); } }; var eventHandleName = this.addEventHandleName[handle]; if (window.addEventListener && eventHandleName) { window.addEventListener(eventHandleName, activeExecuter, false); } else document.documentElement[handle] = document.body[handle] = activeExecuter; return { handle: handle, code: len, clear: function() { self.keep[handle][len] = function() {}; } }; }, clear: function(handle, code) { this.keep[handle][code] = function() {}; } }; var calendar = { getCal: function() { var cal = em.all('displayCalendar'); if (!cal) { var div = document.createElement('div'); div.id = 'displayCalendar'; document.getElementsByTagName('body').item(0).appendChild(div); cal = em.all('displayCalendar'); } return cal; }, open: function(input, event) { var point = cursor.point(event, -180); var cal = this.getCal(); cal.style.display = 'block'; cal.style.top = point.pixelY; cal.style.left = point.pixelX; cal.innerHTML = "서버에 달력을 요청 중입니다..."; var obj = em.all(input); var matchs = obj.value.replace(/[^\d]/g, '').match(/(.)/g); var year = matchs[0] + matchs[1] + matchs[2] + matchs[3]; var month = matchs[4] + matchs[5]; var day = matchs[6] + matchs[7]; this.load(year, month, input); }, load: function(year, month, input) { var cal = this.getCal(); var ax = new ajaxClassic(); ax.success = function() { cal.innerHTML = this.html(); var td = cal.getElementsByTagName('td'); for (var i = 0; i < td.length; i++) { if (td.item(i).className.match(/day/)) { td.item(i).onmouseover = function() { this.style.backgroundColor = '#df8'; } td.item(i).onmouseout = function() { this.style.backgroundColor = ''; } } } }; ax.fail = function() { cal.innerHTML = "서버로의 요청이 실패하였습니다."; } if (year) ax.param('year', year); if (month) ax.param('month', month); if (input) ax.param('input', input); ax.send('/proxy/async-html/calendar.kgr', true, 'get'); }, set: function(ymd, input) { em.all(input).value = ymd; this.close(); }, close: function() { var cal = this.getCal(); cal.style.display = 'none'; cal.style.innerHTML = ''; } }; var flash = { echo: function(obj) { var node = $e(obj.node); var src = obj.src; var width = obj.width; var height = obj.height; var mobile = obj.mobile; var wmode = 'transparent'; var code = 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'; var classId = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'; var type = 'application/x-shockwave-flash'; var plug = 'http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash'; var html = ""; if (mobile && server.device == 'mobile') { var link = mobile.link; var map = mobile.map; if (link) { html += "" html += ""; html += ""; } else if (map) { var usemap = map.usemap; var area = map.area; html += ""; html += ""; } } else { html += ""; } if (node) node.innerHTML = html; return html; }, link: function(param) { var url = this.url(param); if (url) { if (url.match(/^alert:/i)) { alert(url.replace(/^alert:/i, '')); } else loc.action(url); } else alert('지정되지 않은 파라미터: [' +param+ ']'); }, url: function(param) { switch (param) { case 'menu:01': return server.uri('pr'); case 'menu:01:01': return server.uri('pr', 'camp.kgr'); case 'menu:01:02': return server.uri('pr', 'activity.kgr'); case 'menu:01:03': return server.uri('pr', 'price.kgr'); case 'menu:01:04': return server.uri('pr', 'scheduleToday.kgr'); case 'menu:01:05': return server.uri('pr', 'scheduleAll.kgr'); case 'menu:02': return server.uri('info'); case 'menu:02:01': return server.uri('info', 'station.kgr'); case 'menu:02:02': return server.uri('info', 'location.kgr'); case 'menu:02:03': return server.uri('info', 'provision.kgr'); case 'menu:02:04': return server.uri('info', 'foodMenu.kgr'); case 'menu:03': return server.uri('study'); case 'menu:03:01': return server.uri('study', 'station.kgr'); case 'menu:03:02': return server.uri('study', 'price.kgr'); case 'menu:03:03': return server.uri('study', 'procedure.kgr'); case 'menu:03:04': return server.uri('study', 'curriculum.kgr'); case 'menu:03:05': return server.uri('bbs', '캠프액티비티'); case 'menu:03:06': return server.uri('bbs', '캠프동영상'); case 'menu:04': return server.uri('bbs', '연수생활'); case 'menu:04:01': return server.uri('bbs', '연수생활'); case 'menu:04:02': return server.uri('bbs', '연수액티비티'); case 'menu:04:03': return server.uri('bbs', '연수동영상'); case 'menu:05': return server.uri('bbs', '공지사항'); case 'menu:05:01': return server.uri('bbs', '공지사항'); case 'menu:05:02': return server.uri('bbs', '자유게시판'); case 'menu:05:03': return server.uri('bbs', '격려편지'); case 'menu:05:04': return server.uri('bbs', '갤러리'); } } }; var Flash = flash; Flash.Link = flash.link; // auto complete keyword var autoComplete = function(obj) { var inputNode = $e(obj.inputNode); var displayNode = obj.displayNode; var addLeft = obj.addLeft ? obj.addLeft.num() : 0; var addTop = obj.addTop ? obj.addTop.num() : 0; var addWidth = obj.addWidth ? obj.addWidth.num() : 0; var formElement = inputNode.getParent('form'); var widthStyle = function() { var displayWidth = inputNode.clientWidth.num() + addWidth; displayNode.style.width = displayWidth.str('px'); }; var timeSet; var focusIndex = -1; var max = 0; var data; var keyword; var display = function(signal) { var displayType = signal ? 'block' : 'none'; if (displayNode.style.display != displayType) { displayNode.style.display = displayType; return true; } return false; }; var limited = function(limit) { if (limit < -1) limit = max; else if (limit > max) limit = -1; return limit; }; var command = function(event) { if (!event) event = window.event; if (inputNode.value == '') { keyword = ''; display(false); } else if (event.keyCode == 27) { inputNode.value = keyword; display(false); } else if (event.keyCode == 38) { // list focus up if (display(true) == false) { focusIndex = limited(--focusIndex); selecter(true); } } else if (event.keyCode == 40) { // list focus down if (display(true) == false) { focusIndex = limited(++focusIndex); selecter(true); } } else if (keyword != inputNode.value) { // call of auto complete call(); } }; var selecter = function(insertValue) { var list = displayNode.getElementsByTagName('li'); for (var i = 0; i < list.length; i++) { list.item(i).className = ''; } if (focusIndex == -1) { inputNode.value = keyword; } else { list.item(focusIndex).className = 'over'; if (insertValue) { inputNode.value = list.item(focusIndex).word; } } }; var call = function() { clearTimeout(timeSet); timeSet = setTimeout(function() { if (!inputNode.value) return false; var ax = new ajaxClassic(); ax.param('keyword', inputNode.value); ax.success = function() { keyword = inputNode.value; var result = this.node('result'); if (result.length) { display(true); var ol = document.createElement('ol'); for (var i = 0; i < result.length; i++) { var word = result.item(i).getAttribute('word'); var count = result.item(i).getAttribute('count'); var wordMatch = new RegExp('(' +keyword+ ')', 'i'); var displayWord = word.replace(wordMatch, '$1'); var li = document.createElement('li'); li.innerHTML = displayWord+ "결과 " +count.num().format()+ "건"; li.word = word; li.index = i; li.onmouseover = function() { focusIndex = this.index; selecter(); }; li.onmousedown = function() { focusIndex = this.index; selecter(true); if (formElement.onsubmit()) { formElement.submit(); } }; ol.appendChild(li); } displayNode.innerHTML = ''; displayNode.appendChild(ol); max = result.length - 1; } }; ax.send('/proxy/async/autoComplete.kgr', false); }, 300); }; displayNode.style.position = 'absolute'; displayNode.style.display = 'none'; displayNode.style.zIndex = 3; displayNode.style.marginLeft = addLeft.str('px'); displayNode.style.marginTop = addTop.str('px'); inputNode.onkeyup = command; inputNode.ondblclick = command; widthStyle(); var tmpValue = ''; var tmpInterval; inputNode.onfocus = function(event) { var self = this; tmpInterval = setInterval(function() { if (tmpValue != self.value) { try { command(event); } catch (e) {} } tmpValue = self.value; widthStyle(); }, 500); }; inputNode.onblur = function() { clearInterval(tmpInterval); display(false); }; }; // element position move var mover = function(target, event) { var point = cursor.point(event); var targetObj = typeof(target) == 'object' ? target : em.all(target); targetObj.style.position = 'absolute'; var position = document.scroll(); var defaultPosition = { left: targetObj.style.left.num(), top: targetObj.style.top.num() }; if (!defaultPosition.left) { defaultPosition.left = targetObj.getBoundingClientRect().left.num() + position.left; } if (!defaultPosition.top) { defaultPosition.top = targetObj.getBoundingClientRect().top.num() + position.top; } var defaultCursor = { left: point.left.num(), top: point.top.num() }; var mouseMove = bodyEvent.set('onmousemove', function(event) { var nowPoint = cursor.point(event); var top = defaultPosition.top + (nowPoint.top.num() - defaultCursor.top); var left = defaultPosition.left + (nowPoint.left.num() - defaultCursor.left); targetObj.style.top = top + 'px'; targetObj.style.left = left + 'px'; }); var mouseUp = bodyEvent.set('onmouseup', function() { mouseMove.clear(); mouseUp.clear(); }); }; // virtual submit form var form = function() { var element = document.createElement('form'); this.param = function(name, value) { if (name) { var node = document.createElement('input'); node.type = 'hidden'; node.name = name; node.value = value; element.appendChild(node); } }; this.send = function(action, method, target) { document.body.appendChild(element); if (action) element.action = action; if (target) element.target = target; if (method) element.method = method; element.submit(); } }; // search check and send var search = function(obj) { var fm = new form(); var action = obj.action; var keyword = obj.keyword.value; if (keyword.match(/\//)) { alert('can not slash enter.'); } else fm.send(action + keyword); return false; }; // screen coordinates var cursor = { point: function(event, addX, addY) { if (!event) event = window.event; if (!addX) addX = 0; if (!addY) addY = 0; var definedEvent = false; var clientX = (typeof(event.clientX) == 'number') ? event.clientX : 0; var clientY = 0; if (typeof(event.clientY) == 'number') { clientY = event.clientY; definedEvent = true; } var pointX = clientX + $('html, body').scrollLeft() + addX.num(); var pointY = clientY + $('html, body').scrollTop() + addY.num(); return { definedEvent: definedEvent, left: pointX, top: pointY, pixelX: pointX + 'px', pixelY: pointY + 'px' }; }, elementMove: function(e, event, addX, addY) { if (!addX) addX = 0; if (!addY) addY = 0; var point = this.point(event); var element = $e(e); var rect = element.getRect(); var width = point.left + (rect.width * 1.5); var height = point.top + (rect.height * 1.5); var screenWidth = screen.width + $('html, body').scrollLeft(); var screenHeight = screen.height + $('html, body').scrollTop(); var left = (screenWidth > width) ? point.left + addX.num() : point.left - rect.width; var top = (screenHeight > height) ? point.top + addY.num() : point.top - rect.height; element.style.position = 'absolute'; element.style.left = left.str('px'); element.style.top = top.str('px'); } }; // overlap thumbnail view var cross = { up: function(obj, type) { var parent = obj.parentNode; var img = parent.getElementsByTagName('img'); var cross1 = img.item(0); var cross2 = img.item(1); if (type == 1) { cross1.style.zIndex = 2; cross1.style.filter = 'alpha(opacity=100)'; cross1.style.opacity = '1.00'; cross2.style.zIndex = 1; cross2.style.filter = 'alpha(opacity=40)'; cross2.style.opacity = '0.40'; } else { cross1.style.zIndex = 1; cross1.style.filter = 'alpha(opacity=40)'; cross1.style.opacity = '0.40'; cross2.style.zIndex = 2; cross2.style.filter = 'alpha(opacity=100)'; cross2.style.opacity = '1.00'; } } }; /* document inner function */ document.scroll = function() { var left = document.body.scrollLeft || document.documentElement.scrollLeft || 0; var top = document.body.scrollTop || document.documentElement.scrollTop || 0; var width = document.body.scrollWidth || document.documentElement.scrollWidth || 0; var height = document.body.scrollHeight || document.documentElement.scrollHeight || 0; var client = { width: document.documentElement.clientWidth || window.innerWidth || 0, height: document.documentElement.clientHeight || window.innerHeight || 0 }; return { left: left.num(), top: top.num(), width: width.num(), height: height.num(), client: client }; }; // relation product - selection object var sprObj = { page: 0, searchValue: '', formElement: null, search: function() { var sprForm = this.get(); var node = em.childElement(sprForm, 'className', 'list'); node.innerHTML = "
상품을 찾고있습니다.
"; this.searchValue = sprForm.searchValue.value; this.page = 0; this.call(); return false; }, equip: function(key) { var sprForm = this.get(); var sprKeys = this.formElement.sprKeys; var keys = sprKeys.value.split(/,/); keys.push(key); var result = []; for (var i = 0; i < keys.length; i++) { if (keys[i]) result.push(keys[i]); } sprKeys.value = result.join(','); }, call: function() { var sprForm = this.get(); var node = em.childElement(sprForm, 'className', 'list'); var ax = new ajaxClassic(); ax.param('page', this.page); ax.param('searchValue', this.searchValue); ax.success = function() { node.innerHTML = this.html(); }; ax.send('/proxy/async-html/sprGet.kgr', true); }, move: function(page) { this.page = page; this.call(); }, get: function() { return em.all('sprForm') }, init: function(obj) { var node = em.childElement(sprForm, 'className', 'list'); node.innerHTML = ''; this.page = 0; obj.style.top = ''; obj.style.left = ''; obj.style.display = ''; obj.name.value = ''; this.formElement = null; }, initGet: function() { var sprForm = this.get(); this.init(sprForm); return sprForm; }, open: function(obj, event) { var point = cursor.point(event, -300, -200); var sprForm = this.initGet(); sprForm.style.display = 'block'; sprForm.style.top = point.top.str('px'); sprForm.style.left = point.left.str('px'); this.formElement = em.getParent(obj, 'form'); }, close: function() { var sprForm = this.initGet(); sprForm.style.display = 'none'; } }; // TGCORP 영수증 발행 var tgcorpBill = function(MxID, MxIssueNO, Smode) { // BillType: 00=과세, 10=면세 var path = 'https://npg.tgcorp.com/dlp/tgcorpbill.jsp'; var param = 'MxID=' + MxID; param += '&MxIssueNO=' + MxIssueNO; param += '&Smode=' + Smode; param += '&BillType=00'; var win = window.open(path +'?'+ param, '_tgcorpBill', 'width=400, height=640, menubar=no, resizable=yes'); if(win.focus) win.focus(); }; var imageCache = { image: new Array(), block: function(parent, tagName) { // 이미지 입력 var data = null; var cnt = 0; while (data = parent.getElementsByTagName(tagName).item(cnt++)) { if (data.src) this.blockKeep(data.src); else if (data.style.backgroundImage) { this.blockKeep(data.style.backgroundImage.replace(/url|\(|\)/, '')); } } }, blockKeep: function(src) { if (!this.image[src]) { this.image[src] = new Image(); this.image[src].src = src; } } }; var imageView = { nodeHidden: function(nodeName, visibility) { var node = document.getElementsByTagName(nodeName); var cnt = 0; var data = null; while (data = node.item(cnt++)) { data.style.visibility = visibility; } }, setElement: function(parentId) { var self = this; var parentNode = em.all(parentId); var img = parentNode.getElementsByTagName('img'); var cnt = 0; var node = null; while (node = img.item(cnt++)) { node.style.cursor = 'pointer'; node.onclick = function(event) { self.nodeHidden('object', 'hidden'); imageView.nodeHidden('embed', 'hidden'); var body = document.getElementsByTagName('body').item(0); var viewerBase = em.all('grayViewerBase'); if (!imageNode) { var div = document.createElement('div'); div.id = 'viewerBase'; body.appendChild(div); viewerBase = em.all(div.id); viewerBase.style.textAlign = 'center'; } var filter = em.all('grayViewerFilter'); var imageNode = em.all('grayViewerNode'); if (!filter) { var div = document.createElement('div'); div.id = 'grayViewerFilter'; div.style.display = 'none'; div.style.position = 'absolute'; div.style.filter = 'alpha(opacity=70)'; div.style.opacity = '0.70'; div.style.backgroundColor = '#000000'; viewerBase.appendChild(div); filter = em.all(div.id); } if (!imageNode) { var div = document.createElement('div'); div.id = 'grayViewerNode'; div.style.display = 'none'; div.style.position = 'absolute'; viewerBase.appendChild(div); imageNode = em.all(div.id); } var width = document.body.scrollWidth || document.documentElement.scrollWidth; var height = document.body.scrollHeight || document.documentElement.scrollHeight; var top = document.body.scrollTop || document.documentElement.scrollTop; var imageURI = this.src; var bodyObj = bodyEvent.set('onscroll', function() { var top = document.body.scrollTop || document.documentElement.scrollTop; filter.style.top = top + 'px'; }); var point = cursor.point(event); filter.style.display = 'block'; filter.style.top = top + 'px'; filter.style.left = '0px'; filter.style.width = width + 'px'; filter.style.height = height + 'px'; filter.style.zIndex = 99; filter.style.cursor = 'pointer'; imageNode.style.display = 'block'; imageNode.style.top = top + 'px'; imageNode.style.left = '0px'; imageNode.style.width = width + 'px'; imageNode.style.height = height + 'px'; imageNode.style.zIndex = 100; imageNode.style.cursor = 'pointer'; filter.onmousedown = imageNode.onmousedown = function() { viewerBase.innerHTML = ''; self.nodeHidden('object', 'visible'); self.nodeHidden('embed', 'visible'); bodyObj.clear(); } imageNode.innerHTML = ""; var cloneImg = imageNode.getElementsByTagName('img').item(0); cloneImg.style.border = '7px groove #ddf'; cloneImg.style.marginTop = '100px'; cloneImg.style.filter = 'alpha(opacity=0)'; cloneImg.style.opacity = '0.0'; cloneImg.src = imageURI; for (var cnt = 1; cnt <= 100; cnt++) { self.action(cloneImg, cnt); } return false; } } }, action: function(node, cnt) { setTimeout(function() { node.style.filter = 'alpha(opacity=' +cnt+ ')'; node.style.opacity = cnt / 100; }, cnt * 10); } }; var itemKeeper = { multi: function(mode) { var itemSelecter = em.all('itemSelecter'); var index = []; var len; if (len = itemSelecter.index.length) { var check = 0; for (var i = 0; i < len; i++) { var indexElement = itemSelecter.index[i]; if (indexElement.checked) index.push(indexElement.value); } if (index.length == 0) alert('선택한 상품이 없습니다.'); else { if (mode == 'wishlist') { var data = []; for (var i = 0; i < index.length; i++) { data.push({ index: index[i], codes: '', quantity: 0 }); } this.check(data, mode); } else this.selecter(index, mode); } } else if (itemSelecter.index.checked == true) { if (mode == 'wishlist') { this.check({ index: itemSelecter.index.value, codes: '', quantity: 0 }, mode); } else this.selecter([ itemSelecter.index.value ], mode); } else alert('선택한 상품이 없습니다.'); }, check: function(data, mode, detailType, choice) { var self = this; var ax = new ajaxClassic(); var codeSet = false; if (data.length) { for (var i = 0; i < data.length; i++) { ax.param('index', data[i].index); ax.param('quantity', data[i].quantity); ax.param('codes', data[i].codes); if (data[i].codes) codeSet = true; } } else { ax.param('index', data.index); ax.param('quantity', data.quantity); ax.param('codes', data.codes); } if (choice == true && codeSet == false && mode != 'wishlist') { alert('옵션을 하나 이상은 선택해야합니다.'); return false; } ax.param('mode', mode); ax.success = function() { var count = 0; var doneMessage = ''; var noneMessage = ''; var allowMessage = ''; var stockMessage = ''; var selloutMessage = ''; var selectMessage = ''; var inquiriesMessage = ''; var minQuantityMessage = ''; var otherMessage = ''; var result; while (result = this.node('result').item(count)) { var resultCode = result.getAttribute('code');// 결과코드 var resultName = result.getAttribute('name');// 상품명 var resultIndex = result.getAttribute('index');// 상품번호 if (resultCode != 'ok') { // 장바구니에 상품이 들어가지 못하는 상황 if (resultCode == 'fail-login') { if (confirm('로그인이 필요한 서비스 입니다. 로그인 페이지로 이동 하시겠습니까?')) { var match = new RegExp('^(http|https)://' + document.domain, ''); var action = server.uri('mypage', 'memberLogin.kgr'); action += '?loc=' + encodeURIComponent(location.href.replace(match, '')); loc.action(action); } return false; } if (resultCode == 'fail-none') { noneMessage += resultIndex + ', '; } else if (resultCode == 'fail-inquiries') { // 가격문의 inquiriesMessage += " ☞상품코드: " +resultIndex+ ", 상품명: " +resultName+ "\n"; } else if (resultCode == 'fail-select') { // 옵션 필수선택 알림 selectMessage += " ☞상품코드: " +resultIndex+ ", 상품명: " +resultName+ "\n"; } else if (resultCode == 'fail-allow') { // 구매 불가능 상품 알림 allowMessage += " ☞상품코드: " +resultIndex+ ", 상품명: " +resultName+ "\n"; } else if (resultCode == 'fail-stock') { // 재고부족 알림 stockMessage += " ☞상품코드: " +resultIndex+ ", 상품명: " +resultName+ "\n"; } else if (resultCode == 'fail-sellout') { // 품절상품 알림 selloutMessage += " ☞상품코드: " +resultIndex+ ", 상품명: " +resultName+ "\n"; } else if (resultCode == 'fail-min-quantity') { // 최소수량 알림 minQuantityMessage += " ☞상품코드: " +resultIndex+ ", 상품명: " +resultName+ "\n"; } else { // 그외 오류 알림 otherMessage += " ☞상품코드: " +resultIndex+ ", 상품명: " +resultName; otherMessage += ", 오류코드: " +resultCode+ "\n"; } } else { // 상품이 입력됨을 알림 doneMessage += " ☞상품코드: " +resultIndex+ ", 상품명: " +resultName+ "\n"; } count++; } // 메시지 설정 var message = []; if (doneMessage) { if (mode == 'wishlist') { message.push("『아래와 같은 상품을 찜 목록에 저장 하였습니다.』\n"); message.push(doneMessage); } else { message.push("『아래와 같은 상품을 장바구니에 입력 하였습니다.』\n"); message.push(doneMessage); } } if (inquiriesMessage) { message.push("『아래와 같은 상품은 가격문의를 먼저 하시기 바랍니다.』\n"); message.push(inquiriesMessage); } if (selectMessage) { message.push("『아래와 같은 상품의 옵션은 필수 선택입니다.』\n"); message.push(selectMessage); } if (noneMessage) { message.push("『아래와 같은 상품은 존재하지 않습니다.』\n"); message.push(noneMessage); } if (otherMessage) { message.push("『알 수 없는 이유로 입력에 실패한 상품입니다.』\n"); message.push(otherMessage); } if (stockMessage) { message.push("『상품의 재고가 부족합니다.』\n"); message.push(stockMessage); } if (selloutMessage) { message.push("『품절된 상품으로는 진행 할 수 없습니다.』\n"); message.push(selloutMessage); } if (allowMessage) { message.push("『구매 될 수 없는 상품입니다.』\n"); message.push(allowMessage); } if (minQuantityMessage) { message.push("『최소 구매 수량이 부족한 상품입니다.』\n"); message.push(minQuantityMessage); } var messageText = message.join("\n"); if (doneMessage) { if (!detailType) self.selecterClose(); if (mode == 'cart' && confirm(messageText + '\n\n장바구니로 이동 하시겠습니까?')) { var action = server.uri('mypage', 'cart.kgr'); loc.action(action); } else if (mode == 'direct' && confirm(messageText + '\n\주문 페이지로 이동 하시겠습니까?')) { var action = server.uri('mypage', 'orderForm.kgr'); loc.action(action); } else if (mode == 'wishlist' && confirm(messageText + '\n\n내가 찜한 상품 목록으로 이동 하시겠습니까?')) { var action = server.uri('mypage', 'wishlist.kgr'); loc.action(action); } } else alert(messageText); }; ax.send('/proxy/async/shop-product-keeper.kgr', false, 'post'); return false; }, selecter: function(index, mode) { var self = this; var ax = new ajaxClassic(); var width = document.body.scrollWidth || document.documentElement.scrollWidth; var top = document.body.scrollTop || document.documentElement.scrollTop; var positionLeft = width / 2 - 150; var positionTop = top + 300; var node = em.all('itemOptionSelecter'); node.style.display = 'block'; node.style.left = positionLeft.str('px'); node.style.top = positionTop.str('px'); ax.success = function() { node.innerHTML = this.html(); self.formula(); }; for (var i = 0; i < index.length; i++) { ax.param('index', index[i]); } ax.param('mode', mode); ax.send('/proxy/async-html/shopChoice.kgr', true, 'post'); }, selecterClose: function() { var itemOptionSelecter = em.all('itemOptionSelecter'); itemOptionSelecter.style.display = 'none'; itemOptionSelecter.innerHTML = ''; }, click: function(index, mode) { this.selecter([ index ], mode); }, getWareData: function() { var element = em.all('itemChoiceForm'); if (!element) element = em.all('itemForm'); return { element: element, get: function(name, index) { var inputObj = element[name +'[' +index+ ']']; if (!inputObj) inputObj = element[name]; if (!inputObj) inputObj = em.childElement(element, 'id', name + '[' +index+ ']'); if (!inputObj) inputObj = em.childElement(element, 'id', name); return inputObj; } }; }, choice: function(mode, detailType) { var obj = this.getWareData(); var element = obj.element; var input = element.elements; var data = []; var count = 0; for (var i = 0; i < input.length; i++) { if (input[i].name && input[i].value) { if (input[i].name.match(/^index/)) { count = data.length; if (mode != 'wishlist' && !this.choiceCheck(count, 1)) return false; data[count] = { index: input[i].value, codes: '' }; } if (input[i].name.match(/^code/)) { if (!data[count].codes) data[count].codes = ''; if (input[i].disabled == false && input[i].type != 'checkbox') { data[count].codes += input[i].value + ','; } else if (input[i].type == 'checkbox' && input[i].checked) { data[count].codes += input[i].value + ','; } } else if (input[i].name.match(/^quantity/)) { data[count].quantity = input[i].value; } } } return this.check(data, mode, detailType, true); }, choiceDisable: function(input, index) { var obj = this.getWareData(); var element = obj.element; if (this.choiceCheck(index)) { var code = obj.get('code', index); if (code) { if (code.length) { for (var i = 0; i < code.length; i++) { if (code[i].type != 'checkbox') { var parent = em.getParent(code[i], 'tr'); em.childDisable(parent, input.checked); } } } else if (code.type != 'checkbox') { code.parentNode.parentNode.disabled = input.checked; } } } else input.checked = false; }, choiceCheck: function(index, isSubmit) { var obj = this.getWareData(); var element = obj.element; var absolute = obj.get('absolute', index); var type = obj.get('type', index); var code = obj.get('code', index); var quantity = obj.get('quantity', index).value.num(); var minQuantity = obj.get('minQuantity', index).value.num(); if (minQuantity > quantity) { alert('최소 구매 수량은 ' +minQuantity+ '개 입니다.'); obj.get('quantity', index).value = minQuantity; obj.get('quantity', index).focus(); this.formula(); return false; } if (absolute) { if (absolute.length) { for (var i = 0; i < absolute.length; i++) { if (absolute[i].value == '1') { if ((isSubmit && !code[i].value) || !isSubmit) { var message = '물품 및 옵션중 ' +type[i].value.postposition('이', '가')+ ' 필수 선택입니다.'; if (!isSubmit) message += ' 상품의 기본 옵션은 선택할 수 없습니다.'; alert(message); code[i].focus(); return false; } } } } else if (absolute.value == '1') { if ((isSubmit && !code.value) || !isSubmit) { var message = '물품 및 옵션중 ' +type.value.postposition('이', '가')+ ' 필수 선택입니다.'; if (!isSubmit) message += ' 상품의 기본 옵션은 선택할 수 없습니다.'; alert(message); code.focus(); return false; } } } return true; }, formula: function() { var self = this; var handlerSet = function(count, codeElement) { var handler = (codeElement.type == 'checkbox') ? 'onclick' : 'onchange'; codeElement.count = count; codeElement[handler] = function() { if (this.type == 'checkbox') self.choiceDisable(this, this.count); self.formula(); } }; var obj = this.getWareData(); var element = obj.element; var length = element.count.length ? element.count.length : 1; for (var count = 0; count < length; count++) { var index = obj.get('index', count); var itemPoint = obj.get('itemPoint', count);// 포인트 필드 var itemBasicPrice = obj.get('itemBasicPrice', count);// 가격 보기 var itemLevelPrice = obj.get('itemLevelPrice', count);// 가격 보기 var itemFreight = obj.get('itemFreight', count);// 배송비 필드 var frePrice = obj.get('frePrice', count).value.num(); var freLimit = obj.get('freLimit', count).value.num(); var priceOrg = obj.get('priceOrg', count).value.num(); var basicPrice = obj.get('basicPrice', count).value.num(); var levelPrice = obj.get('levelPrice', count).value.num(); var inquiries = obj.get('inquiries', count).value; var pointType = obj.get('pointType', count).value.num(); var point = obj.get('point', count).value.num(); var quantity = obj.get('quantity', count).value.num(); var minQuantity = obj.get('minQuantity', count).value.num(); if (minQuantity <= 0) minQuantity = 1; var quantityAlert = $(obj.get('quantity', count)).parents('.quantity').first().find('.alert'); if (minQuantity > quantity) { quantityAlert.html('최소 구매 수량은 ' +minQuantity+ '개 입니다.'); } else { quantityAlert.empty(); } // 옵션 가격 합계 var optionBasicPrice = 0; var optionLevelPrice = 0; var code = obj.get('code', count); $(code).each(function(i) { var codeElement = this; // 핸들러 셋팅 handlerSet(count, codeElement); var codeValue = codeElement ? codeElement.value : ''; if (codeValue && codeElement.disabled == false) { var addBasicPrice = obj.get('addBasicPrice[' +codeValue+ ']', count).value.num(); var addLevelPrice = obj.get('addLevelPrice[' +codeValue+ ']', count).value.num(); optionBasicPrice += addBasicPrice; optionLevelPrice += addLevelPrice; } }); // 총 가격 (상품가 + 옵션가) * 수량 var totalBasicPrice = (basicPrice + optionBasicPrice) * quantity; var totalLevelPrice = (levelPrice + optionLevelPrice) * quantity; if (inquiries) { if (itemBasicPrice) itemBasicPrice.innerHTML = '가격문의: ' + inquiries; if (itemFreight) itemFreight.innerHTML = '--'; if (itemPoint) itemPoint.innerHTML = '--'; if (itemLevelPrice) itemLevelPrice.innerHTML = '--'; } else { // 계산된 가격 적용 if (itemBasicPrice) { itemBasicPrice.innerHTML = totalBasicPrice.format().str('원'); } if (itemLevelPrice) { itemLevelPrice.innerHTML = totalLevelPrice.format().str('원'); } if (itemFreight) { // 상품 구매액이 배송비 제한액보다 작으면 배송비 표시 if (itemLevelPrice) { if (totalLevelPrice < freLimit) { itemFreight.innerHTML = frePrice.format(); } else itemFreight.innerHTML = 0; } else { if (totalBasicPrice < freLimit) { itemFreight.innerHTML = frePrice.format(); } else itemFreight.innerHTML = 0; } itemFreight.innerHTML += '원'; } // 포인트 표출 if (itemPoint) { // 포인트 지정 유형이 1이면 지정 액수로 0이면 %로 if (pointType == 1) itemPoint.innerHTML = parseInt(point * quantity).format(); else if (pointType == 0) { if (itemLevelPrice) { itemPoint.innerHTML = parseInt(totalLevelPrice / 100 * point).format(); } else itemPoint.innerHTML = parseInt(totalBasicPrice / 100 * point).format(); } itemPoint.innerHTML += '포인트'; } } } } }; var let = { bookmark: function(url, title) { if (window.sidebar) { // FF try { window.sidebar.addPanel(title, url, ''); } catch (e) { alert(e.message); } return false; } else if(window.external) { // IE try { window.external.AddFavorite(url, title); return false; } catch (e) { alert(e.message); } } else return true; var message = []; message.push('즐겨찾기를 메소드로 제공하는 브라우저가 아닙니다.'); message.push('원하실 경우 직접 추가만 가능합니다.'); alert(message.join('\n')); }, addFavor: function() { return this.bookmark(location.href, document.title); }, /**************************************************************************** 랜덤 스트링 리턴 [2008.08.26 / Add By Flour] ****************************************************************************/ rand: function(len) { var str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var arr = str.replace(/(\w{1})/g, '$1,').split(/,/); var idx = 0; var code = ""; while (len--) { idx = parseInt(Math.random() * arr.length); code += arr[idx]; } return code; }, unique: function() { var argv = []; for (var i = 0; i < arguments.length; i++) { argv.push(arguments[i]); } var date = new Date(); argv.push(date.getTime()); argv.push(this.rand(15)); return argv.join('.'); } }; var loc = { action: function(uri, target) { var IE6 = (typeof ActiveXObject == 'function' && !window.XMLHttpRequest) ? true : false; if (IE6 == true) { var a = document.createElement('a'); a.style.display = 'none'; a.href = uri; if (target) a.target = target; document.body.appendChild(a); a.click(); } else { var fm = new form(); var split = uri.split(/\?/); var path = typeof(split[0]) != 'undefined' ? split[0] : ''; var param = typeof(split[1]) != 'undefined' ? split[1] : ''; param = param.split(/&/); for (var i = 0; i < param.length; i++) { var paramSplit = param[i].split(/=/); var name = typeof(paramSplit[0]) != 'undefined' ? paramSplit[0] : ''; var value = typeof(paramSplit[1]) != 'undefined' ? paramSplit[1] : ''; fm.param(name, decodeURIComponent(value)); } fm.send(path, 'get', target); } return false; }, del: function(uri, target, deleteMsg) { if (!deleteMsg) { deleteMsg = '삭제를 진행하면 더 이상 복구가 불가능합니다.\n\n이대로 진행하시겠습니까?'; } if (confirm(deleteMsg)) { this.action(uri, target); } return false; } }; var member = { loginCheck: function(obj) { if (!obj.logId.value) { alert('ID를 입력하세요.'); obj.logId.focus(); return false; } else if (!obj.logPw.value) { alert('비밀번호를 입력하세요.'); obj.logPw.focus(); return false; } return true; }, withdrawalCheck: function(obj) { if (this.loginCheck(obj)) { var msg = '탈퇴를 진행하면 회원에 관련된 모든 정보가 소멸되며 더 이상의 복구가 불가능합니다.\n\n'; msg += '정말로 회원 탈퇴를 진행하시겠습니까?'; if (confirm(msg)) { return this.loginCheck(obj); } } return false; }, // 회원 ID입력바 백그라운드 클리어 loginFocus: function(obj) { obj.style.backgroundImage = 'url()'; obj.onblur = function() { if (this.value) { this.style.backgroundImage = 'url()'; } else this.style.backgroundImage = ''; }; }, autoCheck: function(obj) { var msg = ''; msg += '자동 로그인을 하시겠습니까?\n\n'; msg += '※※ 주의 ※※\n\n'; msg += '여러 사람들이 사용하는 공공장소에서는 다른 사람이 자신의 로그인 정보를 사용할 수 있으므로\n'; msg += '이런 경우는 사용을 자제하시기 바랍니다.\n\n'; msg += '원하지 않으면 `취소`를 선택하시기 바랍니다.\n\n'; if (obj.checked == true && !confirm(msg)) obj.checked = false; }, // 회원 가입, 수정 폼 체크 writeCheck: function(obj, isAdmin) { if (!obj.mbAreaCode.value) { alert('주소를 입력하세요.'); return false; } if (!obj.mbPhone1.value || !obj.mbPhone2.value || !obj.mbPhone3.value) { alert('휴대폰을 모두 입력하세요.'); obj.mbPhone1.focus(); return false; } if (!$(obj).find('input[name=mbGender]').is(':checked')) { alert('성별을 선택하세요.'); return false; } if (!obj.birthYear.value || !obj.birthMonth.value || !obj.birthDay.value) { alert('생년월일을 모두 입력해야합니다.'); obj.birthYear.focus(); return false; } if (obj.writeMode.value == 'write' && obj.mbIds.value.length < 4) { // 회원가입일 경우 ID길이 체크 alert('ID는 4자리 이상 입력을 해야합니다.'); obj.mbIds.focus(); return false; } if (obj.writeMode.value == 'write' && obj.mbIds.value.match(/[^\w]/)) { // 회원가입일 경우 ID길이 체크 alert('ID는 영문 및 숫자만 가능합니다.'); obj.mbIds.focus(); return false; } if (obj.writeMode.value == 'write' && obj.mbPw1.value.length < 4) { // 회원가입일 경우 무조건 비번 길이 체크 alert('비밀번호는 4자리 이상 입력을 해야합니다.'); obj.mbPw1.focus(); return false; } if (obj.writeMode.value == 'update' && obj.mbPw1.value && obj.mbPw1.value.length < 4) { // 정보 수정이면 값이 있을 경우 길이 체크 alert('비밀번호는 4자리 이상 입력을 해야합니다.'); obj.mbPw1.focus(); return false; } if (obj.mbPw1.value != obj.mbPw2.value) { alert('비밀번호가 서로 다릅니다.'); obj.mbPw2.focus(); return false; } if (!isAdmin && !obj.mbQs.value) { alert('비밀번호 분실시 조회를 위해 비밀번호 질문은 선택하셔야합니다.'); obj.mbQs.focus(); return false; } if (isAdmin && !obj.mbQs.value && !confirm('비밀번호 분실시 조회를 위해 비밀번호 질문은 필요하나 무시 하시겠습니까?')) { obj.mbQs.focus(); return false; } if (!isAdmin && !obj.mbAns.value) { alert('비밀번호 분실시 조회를 위해 비밀번호 답변은 입력하셔야합니다.'); obj.mbAns.focus(); return false; } if (isAdmin && !obj.mbAns.value && !confirm('비밀번호 분실시 조회를 위해 비밀번호 답변은 필요합니다. 무시 하시겠습니까?')) { alert('비밀번호 분실시 조회를 위해 비밀번호 답변은 입력하셔야합니다.'); obj.mbAns.focus(); return false; } if (!obj.mbName.value) { alert('이름을 입력하세요.'); obj.mbName.focus(); return false; } if (!obj.mbEmail.value) { alert('이메일은 [비밀번호/아이디 찾기]를 위해 반드시 필요합니다.'); obj.mbEmail.focus(); return false; } if (!obj.mbEmail.value.match(/^[^@]+@[\w\.\-]+\.[a-z]+$/i)) { alert('올바른 이메일을 입력하세요.'); obj.mbEmail.focus(); return false; } return true; }, exist: { timeset: null, email: function(idx) { var mbWrite = em.all('mbWrite'); var node = em.all('existEmail'); var email = mbWrite.mbEmail.value; if (!email) { node.className = 'empty'; node.innerHTML = '이메일을 입력하세요.'; } else if (!email.match(/^[^@]+@[\w\.\-]+\.[a-z]+$/i)) { node.className = 'wrong'; node.innerHTML = '올바른 이메일을 입력하세요.'; } else this.req(email, 'email', node, idx); }, ids: function(idx) { var mbWrite = em.all('mbWrite'); var node = em.all('existId'); var ids = mbWrite.mbIds.value; if (ids.length < 4) { node.className = 'empty'; node.innerHTML = 'ID는 4자리 이상입니다.'; } else if (ids.match(/[^\w]/)) { node.className = 'wrong'; node.innerHTML = 'ID는 영문 및 숫자만 가능합니다.'; } else this.req(ids, 'ids', node, idx); }, req: function(word, mode, node, idx) { if (!idx) idx = 0; idx = idx.num(); clearTimeout(this.timeset); node.className = 'load'; node.innerHTML = '조회 요청을 시도합니다.'; this.timeset = setTimeout(function() { var ax = new ajaxClassic(); ax.success = function() { var result = this.node("result").item(0); var index = result.getAttribute('index').num(); if (idx && idx.num() == index) { node.className = ''; node.innerHTML = ''; } else if (index) { node.className = 'exist'; node.innerHTML = '중복된 회원이 존재합니다.'; } else { node.className = 'done'; node.innerHTML = '사용하실 수 있습니다.'; } }; ax.param('word', word); ax.param('mode', mode); ax.send("/proxy/async/memberExist.kgr", false); }, 500); } }, getQs: function(findId, findAnswer, questionNode) { if (!findId) findId = em.all('findId'); else findId = (typeof findId == 'string') ? em.all(findId) : findId; if (!findAnswer) findAnswer = em.all('findAnswer'); else findAnswer = (typeof findAnswer == 'string') ? em.all(findAnswer) : findAnswer; if (!questionNode) questionNode = em.all('question'); else questionNode = (typeof questionNode == 'string') ? em.all(questionNode) : questionNode; if (!findId.value) { alert('ID가 비었습니다.'); findId.focus(); } else { var ax = new ajaxClassic(); ax.success = function() { var result = this.node('result').item(0); var error = this.node('error').item(0); if (result) { var question = result.getAttribute('question'); questionNode.innerHTML = question; findAnswer.focus(); } else if (error) { var message = error.getAttribute('message'); alert(message); } else alert('unknown error.'); } ax.fail = function(req) { alert('데이터 요청에 실패하였습니다.'); } ax.param('findId', findId.value); ax.send('/proxy/async/question.kgr', true, 'post'); } } }; var selectBox = function(nodeId) { var node = (typeof(nodeId) == 'object') ? nodeId : document.getElementById(nodeId); if (!node) return false; if (navigator.appName == 'Opera' || server.device == 'mobile') { node.style.display = 'inline-block'; return false; } var self = this; this.set = function(auto) { this.back(boxKey); inputKey.value = boxOption[boxKey].value; this.value = boxOption[boxKey].value; inputText.value = boxOption[boxKey].text; this.text = boxOption[boxKey].text; this.selectedIndex = boxKey; inputText.blur(); inputText.onblur(); if (auto && inputKey && typeof(inputKey.onchange) == 'function') { inputKey.onchange(); } }; this.select = function(selected, auto) { boxKey = selected; this.set(auto); }; this.back = function(selected) { var cnt = 0; var data = null; while (data = fieldNode.getElementsByTagName('div').item(cnt++)) { data.style.backgroundColor = (data.pointer == true) ? '#fda' : ''; } var option = fieldNode.getElementsByTagName('div').item(selected); option.style.backgroundColor = '#ddd'; option.innerHTML += ''; }; var boxElement = node.getElementsByTagName('select').item(0); if (!boxElement) return false; var boxName = boxElement.name; var boxId = boxElement.id; var boxValue = boxElement.value; var boxText = boxElement.text; var boxKey = boxElement.selectedIndex; var maxLen = 0; var func = boxElement.onchange; var data; var cnt = 0; var boxOption = new Array(); while (data = boxElement.getElementsByTagName('option').item(cnt++)) { var len = data.innerHTML.codeLength(); maxLen = maxLen < len ? len : maxLen; boxOption[boxOption.length] = { value: data.value, text: data.innerHTML, pointer: (data.className == 'pointer') ? true : false }; } var letterSpacing = 2; var width = maxLen * (6.5 + letterSpacing); node.innerHTML = " "; var nodeBase = node.getElementsByTagName('div').item(0); var inputKey = nodeBase.getElementsByTagName('input').item(0); var inputText = nodeBase.getElementsByTagName('input').item(1); var fieldNode = nodeBase.getElementsByTagName('div').item(0); inputKey.focus = function() { inputText.focus(); inputText.select(); }; inputKey.object = this; inputKey.onchange = func; // Style Set node.style.display = 'inline-block'; node.style.zoom = 1; nodeBase.style.display = 'inline'; nodeBase.style.zoom = 1; nodeBase.style.backgroundColor = '#ffffff'; nodeBase.style.width = width + 'px'; nodeBase.style.cursor = 'pointer'; nodeBase.style.margin = '0px'; //nodeBase.style.marginRight = '13px'; inputText.style.width = (width + 4) + 'px'; inputText.style.border = '1px solid #c8c8c8'; inputText.style.cursor = 'pointer'; inputText.style.fontFamily = '굴림체'; inputText.style.letterSpacing = letterSpacing + 'px'; inputText.style.fontSize = '12px'; inputText.readOnly = true; inputText.style.padding = '3px 3px 3px 3px'; inputText.style.backgroundImage = 'url(/proxy/img/boxOpener.gif)'; inputText.style.backgroundRepeat = 'no-repeat'; inputText.style.backgroundPosition = 'right'; inputText.onkeydown = function(event) { if (!event) event = window.event; if (event.keyCode >= 37 && event.keyCode <= 40) { if (event.keyCode == 38) { boxKey--; } else if (event.keyCode == 40) { boxKey++; } if (boxKey < 0) boxKey = 0; else if (boxOption.length - 1 <= boxKey) boxKey = boxOption.length - 1; // up: 38, down 40, left: 37, right: 39 self.set(true); this.select(); return false; } }; inputText.onkeyup = function() { this.select(); } inputText.onclick = function() { this.select(); } inputText.onmouseup = function() { this.select(); } inputText.onmousedown = function() { this.select(); if (fieldNode.style.display == 'block') { fieldNode.style.display = 'none'; } else fieldNode.style.display = 'block'; }; inputText.onblur = function() { fieldNode.style.display = 'none'; }; fieldNode.style.display = 'none'; fieldNode.style.width = (width + 10) + 'px'; fieldNode.style.border = '1px solid #c8c8c8'; fieldNode.style.position = 'absolute'; var IE67 = navigator.appVersion.match(/compatible;\s+MSIE [67]/i); var IE89 = navigator.appVersion.match(/compatible;\s+MSIE [89]/i); if (IE67 && !IE89) { fieldNode.style.marginTop = '21px'; fieldNode.style.marginLeft = (-1 * (width + 12)) + 'px'; } else fieldNode.style.marginTop = '-1px'; //fieldNode.style.left = '0px'; fieldNode.style.textAlign = 'left'; fieldNode.style.backgroundColor = '#ffffff'; fieldNode.style.zIndex = 1; // Handle Set fieldNode.innerHTML = ''; for (var i = 0; i < boxOption.length; i++) { var optionElement = document.createElement('div'); optionElement.innerHTML = boxOption[i].text; optionElement.pointer = boxOption[i].pointer; optionElement.style.width = (width + 4) + 'px'; optionElement.style.fontFamily = '굴림체'; optionElement.style.letterSpacing = letterSpacing + 'px'; optionElement.style.fontSize = '12px'; optionElement.style.padding = '3px'; optionElement.index = i; optionElement.onmouseover = function() { self.back(this.index) }; optionElement.onmouseout = function() { self.back(boxKey) }; optionElement.onmousedown = function() { self.select(this.index, true) }; fieldNode.appendChild(optionElement); } inputKey.name = boxName; inputKey.id = boxId ? boxId : boxName; this.set(); }; var zip = { base: {}, init: function() { var word = $e('zipWord'); var result = $e('zipResult'); word.value = ''; result.innerHTML = '띄어쓰기로 검색하시면
양질의 결과를 얻을 수 있습니다.
예) 삼성 코엑스 or 부산 벡스코
'; }, open: function(base, event) { var point = cursor.point(event, -100, -100); var node = $e('zipNode'); node.style.display = 'block'; node.style.left = point.left.str('px'); node.style.top = point.top.str('px'); em.focus('zipWord'); this.base = base; this.init(); }, close: function() { var node = $e('zipNode'); node.style.display = 'none'; }, find: function() { var self = this; var ax = new ajaxClassic(); var word = $e('zipWord'); var result = $e('zipResult'); var zip1 = this.base.getElementsByTagName('input').item(0); var zip2 = this.base.getElementsByTagName('input').item(1); var addr1 = this.base.getElementsByTagName('input').item(2); var addr2 = this.base.getElementsByTagName('input').item(3); if (!word.value) { alert('검색어를 입력하세요.'); word.focus(); return false; } result.innerHTML = '결과를 얻어오고 있습니다. 잠시 기다려주세요.
'; ax.param('word', word.value); ax.success = function() { var error = ax.node('error'); if (error && error.item(0)) { alert(error.item(0).getAttribute('message')); return false; } var zipCode = ax.node('zipCode'); var ul = document.createElement('ul'); result.innerHTML = ''; var count = 0; var data; while (data = zipCode.item(count++)) { var li = document.createElement('li'); var index = data.getAttribute('index'); var code = data.getAttribute('code'); var sido = data.getAttribute('sido'); var gugun = data.getAttribute('gugun'); var dong = data.getAttribute('dong'); var bunji = data.getAttribute('bunji'); var addr = sido+ " " +gugun+ " " +dong+ " " +bunji; li.index = index; li.code = code; li.sido = sido; li.gugun = gugun; li.dong = dong; li.bunji = bunji; li.addr = addr; li.onclick = function() { var code = this.code.replace(/[^\d]/g, ''); var zipCode1 = code.replace(/.{3}$/, ''); var zipCode2 = code.replace(/^.{3}/, ''); zip1.value = zipCode1; zip2.value = zipCode2; addr1.value = this.addr; addr2.focus(); self.close(); }; li.innerHTML = "[" +code+ "] " + addr; ul.appendChild(li); } result.appendChild(ul); }; ax.send('/proxy/async/zipFind.kgr', true); } }; call.loaded = true; call.funcExec();