var WCMS4Service = { Article: { list: function() { var qs = arguments[0]; var re = '/' + qs + '=(([^&])*)(&)?/gi'; re = eval(re) ; var pos = document.URL.indexOf('?'); var host = document.URL.substring(0, pos); var queryString = document.URL.substring(pos+1); if ( !(!queryString) ) { host = host.replace('#', '') + '?' + queryString.replace(re, ''); } location.href = host; }, paging: function() { var idx = arguments[0]; var innerObj = arguments[1]; var loadSrc = document.URL.split('?')[0].replace('#', '') + Com.QueryString.sets('PAGE', idx); if ( !innerObj ) { location.href = loadSrc; } else { while ( !innerObj.getAttribute('_TEMPLATE') ) { if ( innerObj.parentNode.tagName.toUpperCase() == 'BODY' ) break; innerObj = innerObj.parentNode; } innerObj = innerObj.parentNode; if ( !(!innerObj.getAttribute('loadSrc')) ) { loadSrc = innerObj.getAttribute('loadSrc'); loadSrc = loadSrc.split('?')[0] + Com.QueryString.sets('PAGE', idx, loadSrc); } innerObj.removeAttribute('loadHtml'); WCMS4Service.Html.gets(loadSrc, innerObj); } }, search: function() { var idx = arguments[0]; var dp = arguments[1]||0; var host = (!(!arguments[2])) ? document.URL.split('?')[0].replace(/http:\/\/([^\/]*)/gi, arguments[2]) : document.URL.split('?')[0]; if ( host.indexOf('#') != -1 ) host = host.replace('#', ''); var open = arguments[3]; var url = host + Com.QueryString.sets('DP'+escape('$')+dp, '1',Com.QueryString.sets('RD' + escape('$') + 'ARTICLE4LAYOUT', idx, Com.QueryString.removes('IDX'))); if ( !(!open) ) window.open(url, open); else location.href = url; }, view: function() { var idx = arguments[0]; var dpNum = arguments[1]; location.href = document.URL.split('?')[0].replace('#', '') + Com.QueryString.sets('DP$'+dpNum, 1, Com.QueryString.sets('IDX', idx, Com.QueryString.removes('IDX'))); } }, Board: { FreeBoard: { movePage: function() { var pageUrl = arguments[0]; var param = arguments[1]; var val = arguments[2]; var queryStr = arguments[3]||''; if (!pageUrl) pageUrl = document.URL.split('?')[0]; if ( pageUrl.indexOf('#') != -1 ) pageUrl = pageUrl.replace('#', ''); if ( !(!val) ) { if ( Com.QueryString.exist(param) ) pageUrl += Com.QueryString.sets(param, val); else pageUrl += '?' + param + '=' + val; } else { if ( !(!param) ) pageUrl += '?' + param + '=' + Com.QueryString.gets(param); } if (pageUrl.indexOf('?') == -1) pageUrl += '?' + queryStr; else pageUrl += '&' + queryStr; location.href = pageUrl; }, submitForm: function() { var formObj = arguments[0]; var param = arguments[1]; if ( !(!param) ) { formObj[param].value = Com.QueryString.gets(param); } for ( var i=0; i < formObj.elements.length; i++ ) { switch ( formObj.elements[i].getAttribute('constraint') ) { case 'value': if ( !formObj.elements[i].value.replace(/\s/gi, '') ) { alert(formObj.elements[i].getAttribute('msg')); return; } default: break; } } formObj.submit(); } } }, Html: { puts: function() { var requestUrl = arguments[0]; var sendData = arguments[1]; if ( !sendData ) sendData = ''; var oParam = { isXml: false, callBack: false, data: sendData, url: requestUrl } new window.$CLASS.HttpRequest().send(oParam); }, gets: function() { var requestUrl = arguments[0]; var innerObj = arguments[1]; if (!innerObj.getAttribute('loadHtml')) { result = { Html: function(){ var html = arguments[0]; html = html.substring(html.indexOf('')); html = html.substring(html.indexOf('>') + 1); arguments.callee.owner.innerHTML = html; arguments.callee.owner.setAttribute('loadHtml', 1); } } result.Html.owner = innerObj; fault = function(){ } var oParam = { loadTime: 5000, isXml: false, callBack: true, fnResult: result, fnError: fault, data: '', url: requestUrl } innerObj.setAttribute('loadSrc', requestUrl); new window.$CLASS.HttpRequest().send(oParam); } } }, Image: { resize: function() { var obj = arguments[0]; var nWidth = arguments[1]; var nHeight = arguments[2]; var objParent = arguments[3]; var fnCallBack = arguments[4]; if (obj.width == 0) { var timeFn = function() { if ( arguments.callee.timer ) clearTimeout(arguments.callee.timer); if (arguments.callee.obj.width == 0) { arguments.callee.timer = setTimeout(arguments.callee, 100); return; } else { if ((arguments.callee.nWidth > -1) && (arguments.callee.obj.width > arguments.callee.nWidth)) { arguments.callee.obj.height = (arguments.callee.obj.height * arguments.callee.nWidth) / arguments.callee.obj.width; arguments.callee.obj.width = arguments.callee.nWidth; } else { if ((arguments.callee.nHeight > -1) && (arguments.callee.obj.height > arguments.callee.nHeight)) { arguments.callee.obj.width = (arguments.callee.obj.width * arguments.callee.nHeight) / arguments.callee.obj.height; arguments.callee.obj.height = arguments.callee.nHeight; } } if ( !(!arguments.callee.objParent) ) arguments.callee.objParent.width = arguments.callee.obj.width; if ( !(!arguments.callee.fnCallBack) ) arguments.callee.fnCallBack(); } } timeFn.obj = obj; timeFn.objParent = objParent; timeFn.nWidth = nWidth; timeFn.nHeight = nHeight; timeFn.proc = this.resize; timeFn.fnCallBack = fnCallBack; timeFn.timer = setTimeout(timeFn, 100); return; } if ((nWidth > -1) && (obj.width > nWidth)) { obj.height = (obj.height * nWidth) / obj.width; obj.width = nWidth; } else { if ((nHeight > -1) && (obj.height > nHeight)) { obj.width = (obj.width * nHeight) / obj.height; obj.height = nHeight; } } if ( !(!fnCallBack) ) { fnCallBack(); } }, resizeList: function() { var targetId = arguments[0]; var nWidth = arguments[1]; var nHeight = arguments[2]; var lists = document.getElementsByName(targetId); for ( var i=0; i < lists.length; i++ ) { this.resize(lists[i], nWidth, nHeight); } } }, Request: { Post: { Reply: { del: function() { var requestUrl = arguments[0]; /* 요청 URL */ var innerObj = arguments[1]; /* 응답 받을 객체 */ var replyKey = arguments[2]; if ( !(!innerObj) && innerObj.getAttribute('_TEMPLATE') ) { requestUrl = requestUrl.split('?')[0] + Com.QueryString.sets('$RS_TEMPLATE', innerObj.getAttribute('_TEMPLATE'), requestUrl); requestUrl = requestUrl.split('?')[0] + Com.QueryString.sets('IDX', Com.QueryString.gets('IDX'), requestUrl); } result = { Html: function(){ var html = arguments[0]; var posBody = html.indexOf('')); html = html.substring(html.indexOf('>') + 1); } arguments.callee.owner.outerHTML = html; } } result.Html.owner = innerObj; fault = function(){ alert(' 데이타 전송 중 오류가 발생하였습니다 '); } var oParam = { isXml: false, callBack: true, fnResult: result, fnError: fault, data: 'CMD=PROC_PROCEDURE&PROC=T_Reply_D&@V_USERID=$CK_USERID&@IDX=' + replyKey, url: requestUrl } new window.$CLASS.HttpRequest().send(oParam); }, ins: function() { var requestUrl = arguments[0]; /* 요청 URL */ var innerObj = arguments[1]; /* 응답 받을 객체 */ var formObj = arguments[2]; /* 폼 객체 */ if (!(!innerObj) && innerObj.getAttribute('_TEMPLATE')) { requestUrl = requestUrl.split('?')[0] + Com.QueryString.sets('$RS_TEMPLATE', innerObj.getAttribute('_TEMPLATE'), requestUrl); requestUrl = requestUrl.split('?')[0] + Com.QueryString.sets('IDX', Com.QueryString.gets('IDX'), requestUrl); } result = { Html: function() { var html = arguments[0]; var posBody = html.indexOf('')); html = html.substring(html.indexOf('>') + 1); } arguments.callee.owner.outerHTML = html; } } result.Html.owner = innerObj; result.Html.form = formObj; fault = function(){ alert(' 데이타 전송 중 오류가 발생하였습니다 '); } Com.Form.request(requestUrl, innerObj, formObj, result, fault); } } }, Get: { } }, rolling: function() { /* * default require */ var id = arguments[0]||''; var childId = arguments[1]||''; var type = arguments[2]||''; /* * option */ var nTime = arguments[3]||100; var nPauseTime = arguments[4]||1000; var nHeight = arguments[5]||1; var nStop = arguments[6]||20; var nRollCount = arguments[7]||1; var seperate = arguments[8]; if (!arguments.callee.list) { arguments.callee.list = new Array(); } if (!(!arguments.callee.list[id])) { alert('Rolling Object Id[ ' + id + ' Exist'); return; } arguments.callee.list[id] = new window.$CLASS.Rolling(arguments.callee, id, childId, type, nTime, nPauseTime, nHeight, nStop, nRollCount, seperate).start(); }, visit: function() { var today = new Date(); var checkCookie = today.getMonth() + '.' + today.getDate(); var cookieValue = Com.Cookie.gets('VISIT'); if (!cookieValue || (cookieValue != checkCookie)) { Com.Cookie.sets('VISIT', checkCookie); WCMS4Service.Html.puts('/visit/checkVisit.html'); } } } //WCMS4Service.visit(); //sg function resizePhoto() { var _obj = arguments[0]; var _w = arguments[1]; var _h = arguments[2]; var obj = document.getElementsByName(_obj); for( var i = 0 ; i < obj.length ; i++ ) { var w = obj[i].width; var h = obj[i].height; w = w / _w; h = h / _h; if(w > h) obj[i].width = _w; else obj[i].height = _h; } }