ÿØÿà JFIF ` ` ÿþ
Server : Apache System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : tkt_travelbus ( 1137) PHP Version : 7.0.0p1 Disable Function : mysql_pconnect Directory : /tkt_travelbus/www/js/ |
Upload File : |
/** * 공통 스크립트 * * 작성일 : 2007.10.15 * 수정일 : 2008.09.27 * 수정일 : 2008.11.14 * 수정일 : 2009.05.11 (버그 및 잡다한것 수정) * 수정일 : 2009.08.17 (즐겨찾기 함수 추가 : bookmark();) * 수정일 : 2009.08.17 (make_flash() 줄임 함수 : mf(), make_movie() 줄임 함수 : mm() 추가) * 수정일 : 2009.11.10 (플래시 wmode값을 기본으로 transparent 사용하도록 변경 : 레이어 많이 사용하므로... ) * 수정일 : 2009.12.04 (플래시 함수 사용쉽도록 변경 : mf('소스', '너비', '높이');) * 수정일 : 2010.01.15 (file_check() 함수 추가) * 수정일 : 2010.01.23 (lpad(), rpad() 함수 추가) * 수정일 : 2010.02.25 (get_numeric() 함수 추가) * 수정일 : 2010.02.25 (auto_comma() 함수 추가) * 수정일 : 2010.04.02 (changeCSS() 함수 추가) * 수정일 : 2010.04.14 (parse_url() 함수 추가) * 수정일 : 2010.09.27 (textarea 관련함수 수정) */ // COMMON_JS if (typeof(COMMON_JS) == 'undefined') { var COMMON_JS = true; var is_ie = window.navigator.userAgent.toLowerCase().indexOf("msie") != -1; var is_gecko = window.navigator.userAgent.toLowerCase().indexOf("gecko") != -1; var is_xp2 = window.navigator.userAgent.indexOf("SV1") != -1 function get_js_path() { var elements = document.getElementsByTagName('script'); for (var i=0; i<elements.length; i++) { if (elements[i].src && elements[i].src.indexOf('common.js') != -1) { return elements[i].src.substring(0, elements[i].src.lastIndexOf('/') + 1); } } } var js_path = get_js_path(); // FF 때문에;; /* DOM fix ie6 background image flicker */ //try { document.execCommand('BackgroundImageCache', false, true); } catch(me) {} // prototype 사용안할 경우 (20100820 ) if (typeof(Prototype) != 'object') { // bind 함수 /*Function.prototype.bind = function() { var method = this, args = [], object = null; for (var i=0, len=arguments.length; i<len; i++) args[i] = arguments[i]; object = args.shift(); return function() { return method.apply(object, args); } }*/ // bindAsEvent 함수 Function.prototype.bindAsEvent = function(object) { var method = this, args = []; for (var i=0, len=arguments.length; i<len; i++) args[i] = arguments[i]; object = args.shift(); return function(e) { return method.apply(object, [e || window.event].concat(args)); } } } // 이벤트(크로스브라우저) 함수 var Evt = { add: function(obj, evt, fnc) { if (obj.addEventListener) obj.addEventListener(evt, fnc, false); else obj.attachEvent('on' + evt, fnc); }, remove: function(obj, evt, fnc) { if (obj.addEventListener) obj.removeEventListener(evt, fnc, false); else obj.detachEvent('on' + evt, fnc); } } // 동적 CSS 변경 (20100402 ) function changeCSS(id, css) { var obj = document.getElementById(id); if (obj) { obj.href = css; //document.title = obj.href; } } // 객체 받기 /* if (typeof($) != 'function') { function $(element) { if (typeof(element) == 'string') element = document.getElementById(element); return element; } } */ // JS lpad() function lpad(s, len, c) { c = c || '0'; s = s.toString(); while (s.length < len) s = c + s; return s; } // JS rpad() function rpad(s, len, c) { c = c || '0'; s = s.toString(); while (s.length < len) s = s + c; return s; } // JS trim() function trim(s) { return s.replace(/^\s+|\s+$/g,''); } // JS number_format() function number_format(s) { s = s.toString(); return s.replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1,'); } // 값을 숫자로 변환해서 가져옴 (20100225 ) function get_numeric(str) { if (!str) str = 0; str = str.toString(); str = str.replace(/[^\d]/g, ''); return (!str) ? 0 : parseInt(str, 10); } // 공백, 콤마(,) 제거 function no_comma(s) { s = s.toString(); return s.replace(/[\s,]/g,''); } // 숫자일 경우 true 리턴 function is_num(str) { if (/[^0-9]/.test(str)) return false; return true; } // 필드 검사 function check_field(fld, msg) { if ((fld.value = trim(fld.value)) == "") { if (msg) alert(msg); fld.focus(); return false; } } // 토글 셀렉트 함수 (20090706 ) function toggle_select(obj) { if (obj.savedIndex == obj.selectedIndex) { obj.selectedIndex = -1; } obj.savedIndex = obj.selectedIndex; } // 오토콤마 함수 (20100225 ) function auto_comma(obj) { if (trim(obj.value)) { var num = get_numeric(obj.value); obj.value = number_format(num); } } // 오토셀렉트 함수 function auto_select(sel, val) { sel = (typeof(sel) == 'string') ? document.getElementById(sel) : sel; val = trim(val); if (sel && val) { sel.value = val; if (val == '') sel.options[0].selected = true; } } // 오토 체크 함수 (20080903 ) function auto_checked(name, val) { obj = document.getElementsByName(name); var arr = []; if (val instanceof Array) arr = val; else arr[0] = val; if (obj) { var cnt = obj.length; for (var i=0; i<cnt; i++) { for (key in arr) { if (obj[i].value == arr[key]) { obj[i].checked = true; break; } } } } } // 오토탭 함수 function auto_tab(obj, tar, len) { if (obj.value.length >= len) { tar = (typeof(tar) == 'string') ? document.getElementById(tar) : tar; if (tar && tar.disabled == false) { tar.focus(); return false; } } } // 엔터탭 함수 function enter_tab(e) { var evt = e || window.event; if (evt.keyCode == 13) evt.keyCode = 9; } // 숫자만 입력받도록 하는 함수 function auto_numeric(obj) { //$(obj).value = $(obj).value.replace(/[^\d]/g, ''); obj.value = obj.value.replace(/[^\d]/g, ''); } // 체크박스 전체 선택 함수 function check_all(obj, tar, bool) { if (bool != undefined) $(obj).checked = bool; tar = document.getElementsByName(tar); for (var i=0; i<tar.length; i++) { tar[i].checked = $(obj).checked; } } // 전화번호 자동 하이픈 넣기 function auto_phone(obj) { var bs_number = obj.value.toString(); bs_number = bs_number.replace(/[^0-9]/g, ''); var bs_number_length = bs_number.length; var t_limit1 = 2 // 처음 번호까지 거리 var bs_1 = ''; var bs_2 = ''; var t_limit1 = 0; if (bs_number_length >= 9) { var ck_1 = bs_number.substr(0, 2); if (ck_1 != '02') t_limit1 = 3; else t_limit1 = 2; } var t_st2 = 0; var t_limit3 = 4; if (bs_number_length < 4) t_limit3 = bs_number_length; t_st2 = t_limit1; var t_limit2 = bs_number_length - t_limit3-t_limit1; var t_st3 = bs_number_length - t_limit3; if (t_st3 < 0) t_st3 = 0; var result = ''; var bs_3 = bs_number.substr(t_st3, t_limit3); if (bs_number_length > 4) { bs_2 = bs_number.substr(t_st2, t_limit2); } if (bs_number_length >= 9) { bs_1 = bs_number.substr(0, t_limit1 ); } if (bs_3.length != 0) result += bs_3; if (bs_2.length != 0) result = bs_2 +'-'+ result; if (bs_1.length != 0) result = bs_1 +'-'+ result; obj.value = result; } // 삭제 체크 function del(href, msg) { if (!msg) msg = "한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?"; //if (!msg) msg = "You can not recover deleted data.\n\nYou really want to delete?"; if (confirm(msg)) document.location.href = href; } // 삭제 체크 function del_chk(form, tar, action) { form = (typeof(form) == 'string') ? document.forms[form] : form; tar = document.getElementsByName(tar); if (!form || !tar) return; var cnt = 0; for (var i=0; i<tar.length; i++) { if (tar[i].checked) { cnt++; break; } } if (cnt == 0) { alert('Choose to Delete'); return; } var msg = "You can not recover deleted data.\n\nYou really want to delete?"; if (confirm(msg)) { if (action) form.action = action; if (!form.action) { alert('This action of form is not set'); return; } form.submit(); } } // 문자열 길이를 바이트로 계산 function get_byte(str, target) { var tmpLen = 0; var tmpChar; var byteLen = 0; var tmpStr = new String(str); tmpLen = tmpStr.length; for (var i=0 ;i<tmpLen ; i++) { tmpChar = tmpStr.charAt(i); if (escape(tmpChar).length > 4) { byteLen += 2; } else if (tmpChar != '\r') { byteLen ++; } } if (target) document.getElementById(target).innerHTML = byteLen; return byteLen; } // 문자열 길이를 max 바이트만큼 반환 function cut_byte(str, max) { var tmpLen = 0; var tmpChar; var byteLen = 0; var tmpStr = new String(str); tmpLen = tmpStr.length; for (var i=0 ;i<tmpLen ; i++) { tmpChar = tmpStr.charAt(i); if (escape(tmpChar).length > 4) { byteLen += 2; } else if (tmpChar != '\r') { byteLen ++; } if (byteLen > max) { tmpStr = tmpStr.substring(0,i); break; } } return tmpStr; } // 텍스트어리어 // pixel 추가 (20100927 ) function textarea_size(id, row) { var obj = document.getElementById(id); if (obj) { if (String(row).indexOf('px') != -1) { // px if (parseInt(obj.style.height) + parseInt(row) > 0) obj.style.height = (parseInt(obj.style.height) + parseInt(row)) + 'px'; } else { if (obj.rows + row > 0) { obj.rows += row; } } } } // pixel 추가 (20100927 ) function textarea_rows(id, row) { var obj = document.getElementById(id); if (obj) { if (String(row).indexOf('px') != -1) { // px obj.style.height = parseInt(row) + 'px'; } else { document.getElementById(id).rows = row; } } } function textarea_clear(obj) { obj = (typeof(obj) == 'string') ? document.getElementById(obj) : obj; obj.value = ''; obj.focus(); } // 쿠키 입력 function set_cookie(name, value, expire) { var today = new Date(); today.setTime(today.getTime() + (60 * 60 * 1000 * expire)); // hours //today.setDate(today.getDate() + expire); // days if (expire == null) var expires_str = ""; else var expires_str = "; expires=" + today.toGMTString() + ";"; document.cookie = name + "=" + escape(value) + "; path=/" + expires_str; } // 쿠키 얻음 function get_cookie(name) { var nameOfCookie = name + "="; var x = 0; while (x <= document.cookie.length) { var y = (x + nameOfCookie.length); if (document.cookie.substring(x, y) == nameOfCookie) { if ((endOfCookie = document.cookie.indexOf(";", y)) == -1) endOfCookie = document.cookie.length; return unescape(document.cookie.substring(y, endOfCookie)); } x = document.cookie.indexOf(" ", x) + 1; if (x == 0) break; } return ""; } // 쿠키 지움 function del_cookie(name) { var today = new Date(); today.setTime(today.getTime() - 1); var value = get_cookie(name); if (value != "") document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString(); } function div_display(obj, bool) { obj = (typeof(obj) == 'string') ? document.getElementById(obj) : obj; if (obj == null) { return; } if (bool != null) { // bool 이 true 면 보임, false 면 감춤 if (bool) obj.style.display = 'block'; else obj.style.display = 'none'; return; } // bool 이 null(값이 없음)이면 기본적으로 감춤이면 보임, 보임이면 감춤 if (obj.style.display == 'none') obj.style.display = 'block'; else obj.style.display = 'none'; return; } function sleep(sec) { var now = new Date(); var exitTime = now.getTime() + (sec * 1000); while (true) { now = new Date(); if (now.getTime() > exitTime) return; } } function set_blink() { var blink = document.getElementsByTagName("blink"); for (var i=0; i<blink.length; i++) { blink[i].style.visibility = blink[i].style.visibility == '' ? 'hidden' : ''; } window.setTimeout("set_blink()", 500); } // iframe resize (간단) function iframe_resize(id, full) { obj = (typeof(id) == 'string') ? document.getElementById(id) : id; if (obj.src) { obj.width = obj.height = 100; var objBody = obj.contentWindow.document.getElementsByTagName('BODY')[0]; obj.height = objBody.scrollHeight; if (full) obj.width = objBody.scrollWidth; } } // iframe resize (기능추가 버전) (20081114 ) function iframe_resize(obj, percent, resize) { var obj_iframe = (typeof(obj) == 'string') ? document.getElementById(obj) : obj; var doc_body = (document.body) ? document.body : document.documentElement; if (!obj_iframe) return; // iframe info var iframe_info = 'iframe offsetTop:' + obj_iframe.offsetTop + ' / body.offsetHeight:' + doc_body.offsetHeight; // iframe height var height = 0; if (percent) { height = window.innerHeight || doc_body.clientHeight; height -= obj_iframe.offsetTop; var int_percent = String(percent).replace(/[^0-9]/g, ''); height = parseInt(height * int_percent / 100, 10); } else { var obj_body = obj_iframe.contentWindow.document.getElementsByTagName('BODY')[0]; height = obj_body.scrollHeight; } if (!height || height < 0) height = 0; obj_iframe.style.height = height + 'px'; // onresize if (resize == true && !this.resizable) { this.resizable = true; var fnc = function () { iframe_resize(obj_iframe, int_percent, resize); } if (window.addEventListener) window.addEventListener('resize', fnc, false); else window.attachEvent('onresize', fnc); } } // 이미지 리사이즈 함수 (20090403 ) function img_resize(obj) { // 호환 : ie, firefox, mozilla, netscafe var obj = (typeof(obj) == 'string') ? document.getElementById(obj) : obj; var max = parseInt(obj.style.width) || parseInt(obj.width) || parseInt(obj.clientWidth); var img_height = 0; var img = obj.getElementsByTagName("img"); for(var i=0; i<img.length; i++) { if (img[i].width > max) { var rate = parseFloat(max / img[i].width); img_height = parseInt(img[i].height * rate); img[i].width = max; img[i].height = img_height; img[i].style.width = ''; img[i].style.height = ''; } // 이미지 스타일 설정 //img[i].style.border = '1px solid #000000'; } } // js 파일 인클루드 function js_include(path) { var d = document, s; s = d.createElement('script'); s.setAttribute('type', 'text/javascript'); s.setAttribute('src', path); d.getElementsByTagName("head")[0].appendChild(s); } // 디버깅 function debug(str, opt) { document.title = str; if (opt == 'alert') alert(str); } // 새 창 function win_open(url, name, option) { var win = window.open(url, name, option); win.focus(); } // Modal 창 function win_modal(url, name, width, height, option) { if (window.showModalDialog) { var win_modal = window.showModalDialog(url, name, 'dialogWidth:'+width+'px; dialogHeight:'+height+'px'); } else { var win_modal = window.open(url, name, 'width='+width+',height='+height+',status=yes,scrollbars=no,resizable=no,modal=yes,dependent=yes'); } } // Modeless 창 function win_modeless(url, name, width, height, option) { if (window.showModelessDialog) { var win_modeless = window.showModelessDialog(url, name, 'dialogWidth:'+width+'px; dialogHeight:'+height+'px'); } else { var win_modeless = window.open(url, name, 'width='+width+',height='+height+',status=yes,scrollbars=no,resizable=no,modal=yes,dependent=yes'); } } // 팝업 중앙 정렬 function win_center(offsetY) { offsetY = (offsetY != undefined) ? parseInt(offsetY, 10) : 0; var x, y; if (self.innerHeight) { x = (screen.availWidth - self.innerWidth)/2; y = (screen.availHeight - self.innerHeight)/2; } else if (document.documentElement && document.documentElement.clientHeight) { x = (screen.availWidth - document.documentElement.clientWidth)/2; y = (screen.availHeight - document.documentElement.clientHeight)/2; } else if (document.body) { x = (screen.availWidth - document.body.clientWidth)/2; y = (screen.availHeight - document.body.clientHeight)/2; } y = y + offsetY; window.moveTo(x, y); } // 레이어 중앙 정렬 (20090710 ) function layer_center(obj) { obj = (typeof(obj) == 'string') ? document.getElementById(obj) : obj; if (obj) { obj.style.position = 'absolute'; if (!obj.style.zIndex) obj.style.zIndex = '99999'; var h = (window.innerHeight || self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight); var w = (window.innerWidth || self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth); var l = ((window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft) + ((w-(obj.width||parseInt(obj.style.width)||obj.offsetWidth))/2)); var t = ((window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop) + ((h-(obj.height||parseInt(obj.style.height)||obj.offsetHeight))/2)); if((obj.width||parseInt(obj.style.width)||obj.offsetWidth) >= w) l = 0; if((obj.height||parseInt(obj.style.height)||obj.offsetHeight) >= h) t = (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); if (obj.style.visibility == 'hidden') obj.style.visibility = 'visible'; obj.style.display = 'block'; obj.style.left = l + 'px'; obj.style.top = t + 'px'; } } function mouseX(e) { var evt = e || window.event; var x = 0; x = evt.pageX || evt.clientX + document.body.scrollLeft; return x; } function mouseY(e) { var evt = e || window.event; var y = 0; y = evt.pageY || evt.clientY + document.body.scrollTop; return y; } function objectX(el) { var left = 0; while (el) { left += el.offsetLeft; el = el.offsetParent; } return left; } function objectY(el) { var top = 0; while (el) { top += el.offsetTop; el = el.offsetParent; } return top; } // getTopParent() (20080927 ) function getTopParent() { var parent_doc = "parent.document"; var parent_save = null; while (eval(parent_doc) && eval(parent_doc) != parent_save) { parent_doc = "parent." + parent_doc; parent_save = eval(parent_doc); } return eval(parent_doc); } // 즐겨찾기 추가 함수 (20090731 ) function bookmark(title, url) { if (window.sidebar) { // firefox window.sidebar.addPanel(title, url, ""); } else if (window.external) { // ie window.external.AddFavorite(url, title); } else if(window.opera && window.print) { // opera var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute('rel','sidebar'); elem.click(); } } // 파일명 체크 함수 (20100115 ) // 정규식 수정 (20100813 ) function file_check(type, file, ext) { var result = true; if (file) { switch (type) { case "img": // 이미지 파일 if (!ext) ext = 'jpg|jpeg|gif|png'; var reg = new RegExp('\.('+ext+')$','i'); if (!reg.test(file)) result = false; break; case "wmv": // 동영상 파일 if (!ext) ext = 'asf|wmv'; var reg = new RegExp('\.('+ext+')$','i'); if (!reg.test(file)) result = false; break; case "swf": // 플래쉬 if (!ext) ext = 'swf|flv'; var reg = new RegExp('\.('+ext+')$','i'); if (!reg.test(file)) result = false; break; } } return result; } // 셀렉트박스 토글 함수 (20100403 ) function toggleSelects(state) { var ieversion = 0; if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { ieversion = new Number(RegExp.$1) } if (ieversion > 0 && ieversion < 8) { var selects = document.getElementsByTagName("select"); for (var i = 0; i < selects.length; i++ ) { selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible'; } } } // 파라메터 가져오는 함수 (20100414 ) function parse_url(url, encode) { encode = (encode == true) ? true : false; // 인코딩 여부 url = (url) ? url.substr(url.indexOf('?')) : top.location.search; var param = url; if (param.charAt(0) == '?' || param.charAt(0) == '&') param = param.substr(1); if (param != '') { // '&' and '=' split encode var parameters = param.split('&'); var data = new Array(); for (var i=0; i<parameters.length; i++) { var query = parameters[i].split('='); if (encode == true) data[i] = encodeURIComponent(query[0]) + '=' + encodeURIComponent(query[1]); else data[query[0]] = query[1]; } } return data; } /** * 이미지의 크기에 맞게 팝업으로 띄움 * * @s : src * @w : width fixed * @h : height fixed * @t : window title */ function image_popup(s, w, h, t) { var img = (typeof(s) == 'string') ? s : s.src; this.imgSrc = img; var loadingImage = new Image(); loadingImage.src = "http://image.webcom.or.kr/js/loading.gif"; var getImage = new Image(); var charset = 'euc-kr'; var opt = 'width=100,height=100,top=0,left=0,status=yes,scrollbars=no,resizable=no'; if (!t) var t = '이미지 보기'; var win = window.open("", "popup_image", opt); win.document.open(); var _html = "<html><head> \n"; _html += "<meta http-equiv='imagetoolbar' content='no'> \n"; _html += "<meta http-equiv='content-type' content='text/html; charset=" + charset + "'> \n"; _html += "<title>" + t + "</title> \n"; win.document.write(_html); var _js = "<script language='javascript'> \n"; _js += "<!-- \n"; _js += "var is_ie = window.navigator.userAgent.toLowerCase().indexOf('msie') != -1; \n"; _js += "var isdrag = false; \n"; _js += "var x,y; \n"; _js += "var dobj; \n"; _js += "function movemouse(e) { \n"; _js += " if (isdrag) { \n"; _js += " dobj.style.left = is_ie ? tx + event.clientX - x : tx + e.clientX - x; \n"; _js += " dobj.style.top = is_ie ? ty + event.clientY - y : ty + e.clientY - y; \n"; _js += " return false; \n"; _js += " } \n"; _js += "} \n"; _js += "\n"; _js += "function selectmouse(e) { \n"; _js += " var fobj = is_ie ? event.srcElement : e.target; \n"; _js += " var topelement = is_ie ? 'BODY' : 'HTML'; \n"; _js += " if (fobj.tagName.toLowerCase() == 'img') { document.oncontextmenu = function() { return true; }} else { document.oncontextmenu = function() { return false; }} \n"; _js += " while (fobj.tagName != topelement && fobj.className != 'dragme') { \n"; _js += " fobj = is_ie ? fobj.parentElement : fobj.parentNode; \n"; _js += " } \n"; _js += " if (fobj.className == 'dragme') { \n"; _js += " isdrag = true; \n"; _js += " dobj = fobj; \n"; _js += " tx = parseInt(dobj.style.left + 0); \n"; _js += " ty = parseInt(dobj.style.top + 0); \n"; _js += " x = is_ie ? event.clientX : e.clientX; \n"; _js += " y = is_ie ? event.clientY : e.clientY; \n"; _js += " document.onmousemove = movemouse; \n"; _js += " return false; \n"; _js += " } \n"; _js += "} \n"; _js += "document.onmousedown = selectmouse; \n"; //_js += "document.onmouseup = new Function('isdrag=false'); \n"; _js += "document.onmouseup = function() { isdrag = false; } \n"; _js += "\n"; _js += "function getKey(e) { \n"; _js += " var evt = (e) ? e : window.event; \n"; _js += " keycode = (evt.keyCode) ? evt.keyCode : evt.which; \n"; _js += " keychar = String.fromCharCode(keycode).toLowerCase(); \n"; _js += " // 'esc' or 'x' key press close \n"; _js += " if (keycode == 27 || keychar == 'x') window.close(); \n"; _js += " // F5, F11, Ctrl, Alt key block \n"; _js += " if (keycode == 116 || keycode == 122 || evt.ctrlKey == true || evt.altKey == true) { \n"; _js += " if (window.event) { // ie \n"; _js += " evt.keyCode = 0; \n"; _js += " evt.cancelBubble = true; \n"; _js += " evt.returnValue = false; \n"; _js += " } else { // mozilla \n"; _js += " keycode = 0; \n"; _js += " evt.stopPropagation(); \n"; _js += " evt.preventDefault(); \n"; _js += " } \n"; _js += " } \n"; _js += "} \n"; _js += "document.onkeydown = getKey; \n"; //_js += "document.oncontextmenu = new Function('return false'); \n"; _js += "//--> \n"; _js += "</"+"script> \n"; win.document.write(_js); var _html2 = "<style type='text/css'>.dragme {position:relative;}</style> \n"; _html2 += "</head> \n\n"; _html2 += "<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' bgcolor='#dddddd' style='margin:0px;'> \n"; _html2 += "<table width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td align='center'><img id='imgLoad' src='" + loadingImage.src + "' border='0' ondblclick='window.close();'></td></tr></table> \n"; _html2 += "</body></html>"; win.document.write(_html2); win.document.close(); getImage.onload = function() { var objImgLoad = win.document.getElementById("imgLoad"); objImgLoad.src = getImage.src; w = (w) ? w : getImage.width; h = (h) ? h : getImage.height; objImgLoad.width = w; objImgLoad.height = h; var sw = window.screen.width; var sh = window.screen.height; var wl = (w >= sw) ? 0 : (sw - w) / 2; var wt = (h >= sh) ? 0 : (sh - h) / 3; var size = '이미지 사이즈 : ' + w + ' x ' + h; if (!wl || !wt) { objImgLoad.style.cursor = 'move'; objImgLoad.title = size + " \n\n더블 클릭하거나 ESC키를 누르면 창이 닫힙니다. \n\n이미지 사이즈가 화면보다 큽니다. \n왼쪽 버튼을 클릭한 후 마우스를 움직여서 보세요."; objImgLoad.className = 'dragme'; } else { objImgLoad.style.cursor = 'pointer'; objImgLoad.title = size + " \n\n더블 클릭하거나 ESC키를 누르면 창이 닫힙니다."; objImgLoad.className = ''; } win.window.moveTo(wl, wt); if (is_ie) { if (is_xp2) win.window.resizeTo(w+10, h+58); else window.resizeTo(w+10, h+38); } else win.window.resizeTo(w+6, h+54); getImage.src = ""; } getImage.src = imgSrc; if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } /** * make flash contents * * @s : source url * @w : source width * @h : source height * @d : flash id * @t : wmode ("" for none, transparent, opaque ...) */ function make_flash(s, w, h, t, d) { if (t == undefined) t = 'transparent'; if (d == undefined) d = ''; var embed = ""; embed += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + w + "\" height=\"" + h + "\" id=\"" + d + "\">"; embed += "<param name=\"Movie\" value=\"" + s + "\" />"; embed += "<param name=\"Src\" value=\"" + s + "\" />"; embed += "<param name=\"WMode\" value=\"" + t + "\" />"; embed += "<param name=\"Quality\" value=\"high\" />"; embed += "<param name=\"Menu\" value=\"false\" />"; embed += "<embed type=\"application/x-shockwave-flash\" src=\"" + s +"\" id=\"" + d + " quality=\"high\" wmode=\"" + t + "\" width=\"" + w + "\" height=\"" + h + "\"></embed>"; embed += "</object>"; documentwrite(embed); } // make_flash() 줄임 함수 (쉽게쓰기 위함) (20090817 ) function mf(s, w, h, d, t) { make_flash(s, w, h, d, t); } /** * make movie contents * * @s : source url * @w : source width * @h : source height * @d : movie id * @auto: autostart * @ctrl : controls * @status : statusbar * @etc : etc options */ function make_movie(s, w, h, d, auto, ctrl, status, etc) { if (d == undefined) d = ''; if (auto == undefined) auto = 1; if (ctrl == undefined) ctrl = 1; if (etc == undefined) etc = ''; var wh = ""; // controls : 45px, status : 23px; if (parseInt(w) || parseInt(h)) { h = parseInt(h, 10); if (h) { if (ctrl) h += 45; if (status) h += 23; } if (w) wh += " width='" + w + "'"; if (h) wh += " height='" + h + "'"; } // for FF! (true:1, false:0) var opt = " invokeURLs='false' loop='1'"; opt += " autostart='" + auto + "'"; opt += " showcontrols='" + ctrl + "'"; if (status != undefined) opt += " showstatusbar='" + status + "'"; //opt += " showaudiocontrols='0' showpositioncontrols='0' showtracker='0'"; var embed = "<embed id='" + d + "' src='" + s + "'" + wh + opt + etc +"></embed>"; documentwrite(embed); } // make_movie() 줄임 함수 (쉽게쓰기 위함) (20090817 ) function mm(s, w, h, d, auto, ctrl, status, etc) { make_movie(s, w, h, d, auto, ctrl, status, etc); } // write document contents function documentwrite(src) { document.write(src); } // assign code innerHTML function setcode(target, code) { target.innerHTML = code; } function MM_jumpMenu(v){ var v; location.href=v; } // Magnific Popup // jquery 갤러리(movegellery) // 갤러리 썸네일 슬라이딩 // var to_gallery = { // 레이어 팝업 갤러리 gallery: function(obj,target) { // object target = ( target ) ? target:'a'; if (!obj) return; $(obj).each(function(){ $(this).magnificPopup({ delegate: target, type: 'image', closeOnContentClick: false, closeBtnInside: false, fixedContentPos: false, mainClass: 'mfp-with-zoom mfp-img-mobile', image: { verticalFit: true, tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', titleSrc: function(item) { return item.el.attr('title'); } }, gallery: {enabled: true}, zoom: { enabled: true, opener: function(element) { if(element.is(':visible')) return element.find('img'); else return $(obj); } } }); }); }, //데이터 직접입력 gellery_json: function (obj, data) { //배열을 JSON으로 var data_str = []; $.each(data,function(index, value){ save_data = {}; save_data.src=value[0]; save_data.title=value[1]; data_str.push(save_data); }); //alert(obj); $(obj).magnificPopup({ items: data_str, gallery:{enabled:true}, mainClass: 'mfp-with-zoom mfp-img-mobile', type:'image', fixedContentPos: false, midClick: true, zoom:{ enabled: true, opener:function(){return $(obj);} } }); }, // 썸네일 이미지 슬라이딩 slider: function(obj) { if (!obj) return; // 슬라이딩 활성화 $(obj).infiniteCarousel(); }, // 클릭하면 큰그림 보기 thumb: function(sour_id,targ_id) { // sour_id : 썸네이목록 id명 or class명 , targ_id : 보여줄 id명 or class명 if (!sour_id || !targ_id) return; $(sour_id+' li img').click(function(){ if($(this).parent('li').hasClass('on')) return; var img_id = $(this).attr('img-id'); $(targ_id).children('a').stop(false, true).fadeOut(300); $(targ_id+' a img').each(function() { if ( img_id == $(this).attr('img-id') ) { $(this).parent('a').stop(false, true).fadeIn(300); } }); $(this).parent('li').addClass('on').siblings().removeClass('on'); }); } } //jquery-ui 기반으로 작동 다이알로그 레이어 BOX // 변경 : (20150316.박건호) image로드 수정.. 이미지 로드 완료될때까지 팝업을 생성하지 않음... 로드 완료된후 이미지 사이즈를 구해서 창을 띄움.(섬네일을 클릭해서 원본띄우기가 원래 불가능 했었는데 가능해졌습니다.) 그리고 이미지 사이즈가 창사이즈보다 클 경우에 창 크기의 95프로로 축소시켜 보여줍니다.(모바일까지 호환) // 변경 : (20160103.허종) close시에 콜백(callback) 함수추가 var to_dialog = { width:'500',//기본가로사이즈 height:'400',//기본세로사이즈 title:'',//기본타이틀 modal: true,//모달 유무 resize: true,//리사이즈 가능 유무 scrollbar: 'auto',//스크롤바 유무 layer_nm : '', iframe_nm : '', ajax: function(url,title,w,h,modal,resize){ var lynm; var loading; option = {}; this.option = option; option.width = (w) ? w:this.width; option.height = (h) ? h:this.height; option.modal = (modal==false)? modal : this.modal; option.resize = (resize==false)? resize : this.resize; option.title = (title) ? title:this.title; if(!url)return false; this.layer_nm = this.create_layer('ajax'); //레이어 생성 lynm = this.layer_nm; if(url.indexOf('?') > 0) url+='&tmp_layer_id='+lynm; else url+='?tmp_layer_id='+lynm; loading = "<span style='both:clean;float:left;width:100%;margin-top:"+parseInt(option.height/3)+"px;text-align:center;'><img src='/admin/image/ajax-loader.gif' /></span>"; $("#"+lynm).html(loading);//로딩 $("#"+this.layer_nm ).dialog({ create: function(){ window.setTimeout(function(){$("#"+lynm).load(url);},300); }, close : function(){to_dialog.close(lynm);}, title : option.title, height : option.height, width : option.width, modal : option.modal, resizable: option.resize }); }, iframe: function(url,title,w,h,modal,resize,scrollbar,callback){ var lynm,ifnm,loading; option = {}; this.option = option; if(!url)return false; this.layer_nm = this.create_layer(); //레이어 생성 this.iframe_nm = 'ifrm_'+this.layer_nm;//아이프레임 생성 lynm = this.layer_nm; ifnm = this.iframe_nm; option.width = (w) ? w:this.width; option.height = (h) ? h:this.height; html = "<span style='both:clean;float:left;width:100%;margin-top:"+parseInt(option.height/3)+"px;text-align:center;'><img src='/admin/image/ajax-loader.gif' /></span>"; $("#"+lynm).html(html);//로딩 option.modal = (modal==false)? modal : this.modal; option.resize = (resize==false)? resize : this.resize; option.title = (title) ? title:this.title; option.scrollbar = (scrollbar) ? scrollbar:this.scrollbar; option.callback = callback; $("#"+lynm).dialog({ create : function(){ window.setTimeout(function(){ this.url = url; this.ifnm = ifnm; this.lynm = lynm; if(this.url.indexOf('?') > 0) this.url+='&tmp_layer_id='+lynm; else this.url+='?tmp_layer_id='+lynm; console.log(this.url); this.ifr = document.createElement('iframe'); this.ifr.setAttribute('frameBorder',0); this.ifr.setAttribute('width','100%'); this.ifr.setAttribute('height','100%'); this.ifr.setAttribute('scrolling',option.scrollbar); this.ifr.setAttribute('id',this.ifnm); $("#"+lynm).html(""); $("#"+lynm).append(this.ifr); $('#'+ifnm).attr("src",this.url); },300); }, close : function(){ to_dialog.close(lynm,option.callback); }, title : option.title, height : option.height, width : option.width, modal : option.modal, resizable: option.resize }); // 다이얼로그 close 콜백 $("#"+lynm).on("dialogbeforeclose",function(){ if(typeof(option.callback)=='string') { eval(option.callback); } }); }, image: function(src,title){ var lynm,tit,img_w,img_h,html,img_width,paddings; var image = document.createElement('img'); if(!src)return false; this.layer_nm = this.create_layer(); //레이어 생성 lynm = this.layer_nm; tit = (title) ? title:this.title; image.src=src; html = "<span style='both:clean;position:absolute;top:50%;height:24px;width:100%;margin-top:-12px;text-align:center;cursor:pointer;' title='클릭시 취소' onclick='to_dialog.close(\""+lynm+"\");'><img src='../image/ajax-loader.gif' style='vertical-align:middle;' /></span>"; $("#"+lynm).html(html);//로딩 var guard = 0; onLoadComplete = function() { if(image.complete){ img_w = parseInt(image.width) || 30; img_h = parseInt(image.height); if(tit) img_h += 38; //화면크기보다 이미지 크기가 크다면 화면의 95프로크기로 if(parseInt($(window).width()) < img_w ) img_width = Math.round($(window).width() * 0.95); else img_width = img_w; var persent = 100 - ((img_width/img_w)*100) //퍼센트구하기 img_h = img_h - Math.round(img_h*persent/100); img_w = img_width;//이미지크기와 레이어크기를 같게 $("#"+lynm).dialog({ create: function(){ if(tit==''){ $(".ui-dialog-titlebar").last().hide(); } $(".ui-dialog-content").last().css('padding','0px 0px'); $("#"+lynm).html("<img src='"+src+"' width='"+img_width+"' onclick='javascript:to_dialog.close(\""+lynm+"\");'>"); }, close : function(){ to_dialog.close(lynm); }, width : img_w, height : img_h, title : tit, modal : false, resizable: true }); }else{ guard++; if(guard < 300) { setTimeout(onLoadComplete,100); } else { alert('로딩시간초과'); to_dialog.close(lynm); } } } onLoadComplete(); }, create_layer: function(flow_y){ var layer,ly_obj,layer_y; var t = new Date(); if(flow_y=='ajax') layer_y='auto'; else layer_y="hidden"; layer_str = 'templayr_'+t.getHours()+'_'+t.getMinutes()+'_'+t.getSeconds()+'_'+t.getMilliseconds(); ly_obj = document.createElement('div'); ly_obj.setAttribute('id',layer_str); ly_obj.setAttribute('style','display:none;overflow-y:'+layer_y+';'); $('body').append(ly_obj); return layer_str; }, close: function(lynm){ if(lynm){ $('#'+lynm).dialog("close"); $('#'+lynm).dialog("destroy"); $('#'+lynm).html(''); $('#'+lynm).remove(); } } } // 레이어를 중앙에서 보기(레이어 보기(on),감추기(off)) function objCenter(obj,disp) { if(!obj) return; if(disp=="on"){ //보이기 var win = $(window); var winH = win.scrollTop() + ((win.height() - $('#'+ obj).height()) / 2); var winW = win.scrollLeft() + ((win.width() - $('#'+ obj).width()) / 2); $('#'+ obj).css('top', winH); $('#'+ obj).css('left', winW); $('#'+ obj).css('z-index', '99999'); $('#'+ obj).show(); $('#'+ obj).focus(); }else{ //감추기 $('#'+ obj).hide(); } } //jQuery 페이지 로더 - object에 로딩 function ajax_obj_loader(url,id) { if(!url || !id) return; ajax_load_html(id); setTimeout("ajax_loader_to('"+url+"','"+id+"')",300); } //jQuery 페이지 로더 function ajax_loader(url,id,loading) { if(!url) return; if(!id) id="ajax_proc"; if ( loading != false) { objCenter("ajax_loading_bar","on");//중앙에 보이기. setTimeout("ajax_loader_to('"+url+"','"+id+"')",300); }else{ ajax_loader_to(url,id); } } function ajax_loader_to(url,id) { if(!url || !id) return; objCenter("ajax_loading_bar","off");//감추기 //console.log('ajax loader to', url, id); $('#'+id).load(url); } // jQuery POST // // @params id : 결과출력레이어 // @params url : 파라메터를 전송할 url // @params frm : 폼 // @params func_nm : 성공시 실행할 함수명 // @params loading : 로딩바 , false이면 로딩바 출력안함. function ajax_post(id,url,frm,func_nm,loading) { var form, params; if(!url) return; if(!id) id = "ajax_proc"; //로딩바 on if ( loading != false) objCenter("ajax_loading_bar","on"); //파라메터 if (frm) { // 폼 파라메터 전송(파일포함) $("form").each(function(index){ if ($(this).attr("id")==frm) { form = $('form')[index]; params = new FormData(form); } }); // 폼없이 전송 if (typeof(form)=='undefined') var params = ($('#'+frm)) ? $('#'+frm).serialize() : params; } //post 전송 jQuery.ajax({ type: 'POST', processData: false, contentType: false, url: url, data: params, success: function(data,status){ // console.log('aaa '+JSON.stringify(data)); if (func_nm) // 함수 호출 { var fn = func_nm+"(data,status);"; eval(fn); }else // 레이어에다 출력 if(id) $("#"+id).html(data); }, fail: function(){ alert('중대한 오류가 발생했습니다.!!'); objCenter("ajax_loading_bar","off");//로딩바 off }, complete: function(){ setTimeout('objCenter("ajax_loading_bar","off")',300);//로딩바 off } }); } //jQuery post function jquery_post(id,url,frm,params) { ajax_post(id,url,frm,params); } //jQuery updater function jquery_updater(id,url,loading) { ajax_post(id,url,'','',loading); } //로딩바 (object 내에 적용) function ajax_load_html(id, html) { if ($("#"+id)) { if (html == undefined) { var h = ($("#"+id).height()) ? $("#"+id).height() : 10; var load_html = '<img src="/admin/image/ajax-loader_circle.gif"/>'; } else { var load_html = html; } $("#"+id).html(load_html); } } //obj위치로 스크롤(2016-11-15) function scrollLink(obj, num){ if(typeof(num)=='undefined') num=0; var position = jQuery("#"+obj).offset(); if(position==undefined) return; jQuery('html, body').animate({scrollTop : position.top-parseInt(num)}, 500, 'swing'); } function scrollFast(obj, num){ if(typeof(num)=='undefined') num=0; var position = jQuery("#"+obj).offset(); if(position==undefined) return; jQuery('html, body').scrollTop(position.top-parseInt(num)); } function scrollTab(obj, num){ $("#"+obj).siblings().hide(); jQuery("#"+obj).show(); var position = jQuery("#"+obj).offset(); if(position==undefined) return; jQuery('html, body').scrollTop(position.top-parseInt(num)); } //모바일 체크 var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; // Nicepay 내장 모바일 체크 함수 function checkPlatform(ua) { if(ua === undefined) { ua = window.navigator.userAgent; } ua = ua.toLowerCase(); var platform = {}; var matched = {}; var userPlatform = "pc"; var platform_match = /(ipad)/.exec(ua) || /(ipod)/.exec(ua) || /(windows phone)/.exec(ua) || /(iphone)/.exec(ua) || /(kindle)/.exec(ua) || /(silk)/.exec(ua) || /(android)/.exec(ua) || /(win)/.exec(ua) || /(mac)/.exec(ua) || /(linux)/.exec(ua) || /(cros)/.exec(ua) || /(playbook)/.exec(ua) || /(bb)/.exec(ua) || /(blackberry)/.exec(ua) || []; matched.platform = platform_match[0] || ""; if(matched.platform) { platform[matched.platform] = true; } if(platform.android || platform.bb || platform.blackberry || platform.ipad || platform.iphone || platform.ipod || platform.kindle || platform.playbook || platform.silk || platform["windows phone"]) { userPlatform = "mobile"; } if(platform.cros || platform.mac || platform.linux || platform.win) { userPlatform = "pc"; } return userPlatform; } /* kcp신용카드 영수증 연동 스크립트 */ function kcp_receiptView(tno) { receiptWin = "https://admin.kcp.co.kr/Modules/Sale/Card/ADSA_CARD_BILL_Receipt.jsp?c_trade_no=" + tno; window.open(receiptWin , "" , "width=420, height=670"); } } // COMMON_JS 닫기