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'); /*아래의 문자를 원하는 곳으로 끌어 넣으세요.
"; for (var i = 0; i < chars.length; i++) { html += ""; } html += ""; html += '띄어쓰기로 검색하시면
양질의 결과를 얻을 수 있습니다.
예) 삼성 코엑스 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();