var bodyEvent = { keep: {}, 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; document.documentElement[handle] = document.body[handle] = function(event) { for (var i = 0; i < keep.length; i++) { keep[i](event); } } 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.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.ffm', 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 = ''; } }; // check all multi checkbox var multiCheck = function(obj, backDepth) { if (!backDepth) backDepth = 0; for (var i = 0; i < backDepth; i++) { obj = obj.parentNode; } var child = obj.getElementsByTagName('input'); var checked; for (var i = 0; i < child.length; i++) { var input = child.item(i); if (input.type == 'checkbox') { input.onclick = function() { return false }; if (typeof(checked) == 'undefined') { checked = input.checked; } input.checked = checked ? false : true; } } }; // 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); var displayWord = word.replace(wordMatch, '' +keyword+ ''); 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.ffm', false); }, 300); }; displayNode.style.position = 'absolute'; displayNode.style.display = 'none'; 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); }; }; // tool tip layer var toolTip = function(obj, message, event) { var tip = $e('toolTipNode'); var box = $e('toolTipBox'); var decode = decodeURIComponent(message); if (!decode) return; cursor.elementMove(tip, event, 10, 10); tip.style.display = 'block'; box.innerHTML = decode; var rect = tip.getRect(); if (rect.width > 300) { tip.style.width = '300px'; } tip.onmousemove = obj.onmousemove = function() { cursor.elementMove(tip, event, 10, 10); var rect = tip.getRect(); if (rect.width > 300) { tip.style.width = '300px'; } }; obj.onmouseout = function() { this.onmousemove = ''; tip.style.display = 'none'; box.innerHTML = ''; tip.style.width = ''; }; }; // 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; var type = ''; if (obj.searchType) { for (var i = 0; i < obj.searchType.length; i++) { var searchType = obj.searchType[i]; if (searchType.value && searchType.checked == true) { type = searchType.value + '/'; } } } if (!keyword) { alert('Please enter a keyword.'); obj.keyword.focus(); } else if (keyword.match(/\//)) { alert('Slash can not enter.'); } else fm.send(action + type + keyword); return false; }; // screen coordinates var cursor = { point: function(event, addX, addY) { if (!event) event = window.event; var position = document.scroll(); 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 + position.left + addX.num(); var pointY = clientY + position.top + 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 scroll = document.scroll(); var element = $e(e); var rect = element.getRect(); var width = point.left + rect.width + 50; var height = point.top + rect.height + 150; var screenWidth = screen.width + scroll.left; var screenHeight = screen.height + scroll.top; 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'; } } }; var cookie = { get: function(name) { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cook = cookies[i].split('='); var cookName = cook.shift().replace(/^\s+|\s+$/, ''); var cookValue = cook.shift(); if (cookName == name) { return cookValue ? unescape(decodeURIComponent(cookValue)) : ''; } } }, set: function(name, value, second) { var domain = '.' + server.host; var date = new Date(); date.setTime(date.getTime() + second * 1000); var cookSecond = second ? "expires=" +date.toGMTString()+ ";" : ''; var cookValue = value ? encodeURIComponent(escape(value)) : ''; document.cookie = name + '=' +cookValue+ "; domain=" +domain+ "; path=/; " +cookSecond; } }; /* 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 }; }; var rollMove = function(lastRoll, rollType) { var scroll = document.scroll(); var scrollTop = scroll.top; var scrollHeight = scroll.height; var clientHeight = scroll.client.height; if (!lastRoll) lastRoll = 0; if ((scrollHeight - clientHeight - 50) < lastRoll) { lastRoll = scrollHeight - clientHeight - 50; } if (!rollType) { if (lastRoll > scrollTop) { rollType = 'down'; } else if (lastRoll < scrollTop) { rollType = 'up'; } else return false; } if (rollType == 'down') { if (scrollTop == 0) scrollTop = 10; if (lastRoll > scrollTop) { scrollTop += parseInt((lastRoll - scrollTop) / 5); scrollTop++; } else return false; } else if (rollType == 'up') { if (lastRoll < scrollTop) { scrollTop -= parseInt((scrollTop - lastRoll) / 5); scrollTop--; } else return false; } else return false; document.body.scrollTop = scrollTop; document.documentElement.scrollTop = scrollTop; setTimeout(function() { rollMove(lastRoll, rollType) }, 1); }; var liveScroll = function(element, defaultTop, depth) { if (typeof(element) != 'object') { element = em.all(element); } if (!depth) depth = 0; var scroll = document.scroll(); var top = scroll.top; var roll = top > depth ? parseInt((top - depth) / 3) : parseInt((depth - top) / 3); if (roll <= 3) roll = 1; if (depth > top) depth -= roll; else if (depth < top) depth += roll; element.style.position = 'absolute'; element.style.top = (depth.num() + defaultTop.num()) + 'Px'; setTimeout(function() { liveScroll(element, defaultTop, depth); }, 25); }; // layer popup var iWindow = { zIndex: 0, stopClear: function(id) { cookie.set('iWindowStop[' +id+ ']', 0); }, stop: function(id, stopTime, element) { cookie.set('iWindowStop[' +id+ ']', 1, stopTime.num() * 3600); this.close(element); }, close: function(element) { for (var i = 0; i <= 10; i++) { this.opacity({ delay: i * 100, opacity: (10 - i) * 10, element: element }); } }, opacity: function(obj) { var self = this; var opacity = obj.opacity; var element = obj.element; setTimeout(function() { element.style.display = opacity ? 'block' : 'none'; element.style.opacity = opacity * 0.01; element.style.filter = 'alpha(opacity=' +opacity+ ')'; }, obj.delay); }, setContent: function(id, content) { var element; if (navigator.aprName == 'Microsoft Internet Explorer') { element = window[id].document; } else element = em.all(id).contentDocument; element.open("text/html"); element.write( ""+ ""+ ""+ " "+ " "+ ""+ "" +content+ ""+ "" ); element.close(); }, open: function(obj) { var self = this; var node = em.all('iWindowNode'); var id = obj.id; var left = obj.left || 100; var top = obj.top || 100; var width = obj.width || 300; var height = obj.height || 400; var src = obj.src || 'about:blank'; var title = obj.title || '제목없음'; var content = obj.content; var stopTime = obj.stopTime || 24; if (cookie.get('iWindowStop[' +id+ ']')) return; var div = document.createElement('div'); var dl = document.createElement('dl'); var dt = document.createElement('dt'); var sub = document.createElement('sub'); var dd = document.createElement('dd'); var iframe = document.createElement('iframe'); var p = document.createElement('p'); var input = document.createElement('input'); div.onmousedown = function(event) { mover(this, event); }; div.onmouseover = function() { this.style.zIndex = ++self.zIndex; }; div.style.zIndex = this.zIndex; div.style.top = top.str('px'); div.style.left = left.str('px'); div.style.opacity = 0; div.style.filter = 'alpha(opacity=0)'; dt.innerHTML = title; sub.innerHTML = '닫기'; sub.onclick = function() { self.close(div); }; iframe.id = id; iframe.frameBorder = 0; iframe.href = src; iframe.style.width = width.str('px'); iframe.style.height = height.str('px'); input.type = 'button'; input.value = stopTime + '시간 이 창을 열지 않겠습니다.'; input.onclick = function() { self.stop(id, stopTime, div); }; dt.appendChild(sub); dd.appendChild(iframe); dl.appendChild(dt); dl.appendChild(dd); p.appendChild(input); div.appendChild(dl); div.appendChild(p); node.appendChild(div); if (content) this.setContent(id, content); for (var i = 0; i <= 10; i++) { var delay = i * 100 + this.zIndex * 500; this.opacity({ delay: delay, opacity: i * 10, element: div }); } this.zIndex++; } }; var progress = function(title) { var createElement; var node = document.createElement('div'); var fieldset = document.createElement('fieldset'); var legend = document.createElement('legend'); var progress = document.createElement('div'); var complete = document.createElement('div'); var graph = document.createElement('div'); /*
동영상 보안 솔루션 적용중입니다.
0%
*/ var scroll = document.scroll(); node.onmousedown = function(event) { mover(this, event) }; node.style.left = parseInt(scroll.width / 2 - 150).str('px'); node.style.top = parseInt(scroll.top + 350).str('px'); node.style.display = 'none'; complete.innerHTML = '0%'; graph.style.width = '0%'; node.className = 'progressElement'; progress.className = 'progress'; complete.className = 'complete'; graph.className = 'graph'; progress.appendChild(complete); progress.appendChild(graph); legend.innerHTML = title; fieldset.appendChild(legend); fieldset.appendChild(progress); node.appendChild(fieldset); document.body.appendChild(node); this.title = function(title) { legend.innerHTML = title }; this.on = function() { node.style.display = 'block' }; this.off = function() { node.style.display = 'none' }; this.set = function(percent) { this.on(); if (percent >= 100) percent = 100; else if (percent <= 0) percent = 0; percent = percent.toFixed(2).str('%'); complete.innerHTML = percent; graph.style.width = percent; }; this.clear = function() { document.body.removeChild(node); }; }; // auto ckeck form var autoCheckForm = function(obj) { var getLikeInputs = function(node, element) { var childs = node.getElementsByTagName(element.tagName); var inputs = []; for (var i = 0; i < childs.length; i++) { if (childs.item(i).type == element.type) { inputs.push(childs.item(i)); } } return inputs; }; var isEmpty = function(td, element, checkType) { var inputs = getLikeInputs(td, element); if (element.type == 'radio' || element.type == 'checkbox') { for (var i = 0; i < inputs.length; i++) { if (inputs[i].checked == true) { return [ false, null, null ]; } } return [ true, null, null ]; } if (checkType == 'numberic' && element.type == 'text') { for (var i = 0; i < inputs.length; i++) { if (!inputs[i].value.match(/^[\d]+$/)) { return [ true, inputs[i], inputs.length - 1 ]; } } } else if (element.type != 'button') { for (var i = 0; i < inputs.length; i++) { if (!inputs[i].value) { return [ true, inputs[i], inputs.length - 1 ]; } } return [ false, null, null ]; } return [ false, null, null ]; }; var checkIndex = function(element, parent) { var check = function(child) { for (var i = 0; i < child.childNodes.length; i++) { var node = child.childNodes.item(i); if (element === node) return true; if (node.childNodes && check(node) == true) return true; } return false; }; var td = parent.getElementsByTagName('td'); for (var i = 0; i < td.length; i++) { if (check(td.item(i)) == true) { return i; } } return 0; }; var elements = obj.elements; var parent; for (var i = 0; i < elements.length; i++) { var element = $e(elements[i]); if (parent = element.getParent('tr')) { var index = checkIndex(element, parent); var th = parent.getElementsByTagName('th').item(index); var td = parent.getElementsByTagName('td').item(index); if (th.className.match(/required|numberic/)) { var empty = isEmpty(td, element, th.className); if (empty[0] == true) { var focusElement = element; var text = ''; if (empty[1] && empty[2] > 0) { focusElement = empty[1]; if (th.className == 'numberic') { text = '숫자만 입력하십시오.'; } else text = '모두 입력하세요.'; } else { if (th.className == 'numberic') { text = '숫자만 입력하십시오.'; } else text = '필수입니다.'; } alert(th.innerHTML.postposition('은', '는') +' '+ text); try { focusElement.focus() } catch (e) {} return false; } } } } return true; }; 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 = "image view"; 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 let = { addFavor: function() { var title = document.title; var url = location.href; if(window.external) window.external.AddFavorite(url, title); else if (window.sidebar) { try { window.sidebar.addPanel(title, url, ""); } catch (e) { alert(e.message); } } else return true; return false; }, /**************************************************************************** 랜덤 스트링 리턴 [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('.'); }, createURI: function(uri, separator) { if (!separator) separator = '/'; var disjunct = uri.split(separator); for (var i = 0; i < disjunct.length; i++) { disjunct[i] = encodeURIComponent(disjunct[i]); } return disjunct.join(separator); } }; 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 route = 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(route, 'get', target); } return false; }, del: function(uri, target, deleteMsg) { if (!deleteMsg) { deleteMsg = '삭제를 진행하면 더 이상 복구가 불가능합니다.\n\n이대로 진행하시겠습니까?'; } if (confirm(deleteMsg)) { this.action(uri, target); } return false; } }; 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 speChar = { chars: '§※☆★○●◎◇◆□■△▲▽▼◁◀▷▶→←↑↓↔↗↙↖↘♤♠♡♥♧♣⊙◈▣◐◑▒▤▥▨▧▦▩♨☏☎☜☞♩♪♬∥「」『』【】“”ㆍ·‥…¨˚˙‘’', created: false, open: function(event, left, top) { this.create(); if (!left) left = 10; if (!top) top = 10; var node = $e('specialCharacters'); var point = cursor.point(event, left, top); node.style.display = 'block'; node.style.left = point.left.str('px'); node.style.top = point.top.str('px'); }, close: function() { var node = $e('specialCharacters'); node.style.display = 'none'; }, create: function() { if (this.created == true) { return false; } var self = this; var chars = this.chars.match(/./g); var html = ''; html += '
'; html += "

아래의 문자를 원하는 곳으로 끌어 넣으세요.

"; for (var i = 0; i < chars.length; i++) { html += ""; } html += "

"; html += '
'; var node = $e('specialCharacters'); node.innerHTML = html; var move = node.getElementsByTagName('p').item(0); move.onmousedown = function(event) { call.func('mover', node, event); }; $eTree('#specialCharacters input').execute(function() { if (this.className == 'chars') { this.mouseover(function() { this.select() }); this.mouseup(function() { this.blur() }); } else this.click(function() { self.close() }); }); this.created = true; } }; var zip = { base: {}, init: function() { var word = $e('zipWord'); var result = $e('zipResult'); word.value = ''; result.innerHTML = '

띄어쓰기로 검색하시면
양질의 결과를 얻을 수 있습니다.

'; 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.ffm', true); } }; call.loaded = true; call.funcExec();