if (typeof(COMMON_JS) == 'undefined') {
if (typeof rt_path == 'undefined')
alert('rt_path 변수가 선언되지 않았습니다.');
var COMMON_JS = true;
$(document).ready(function() {
// onlyNum 클래스 숫자만 입력
$('.onlyNum').css('ime-mode', 'disabled')
.bind('keypress', function(ev) {
return only_number(this, ev);
})
.bind('keyup', function(ev) {
this.value = this.value.replace(/[^0-9]/g, '');
}
);
// top 버튼 show/hide
$('.btn_top').hide();
$(window).scroll(function() {
if($(this).scrollTop() > 30) {
$('.btn_top').fadeIn(800);
}
else {
$('.btn_top').fadeOut(800);
}
});
// 툴팁 (tooltip 클래스는 tooltip 속성 값을 말풍선으로 출력. tooltip-togle 속성이 있으면 클릭시 안닫히고 고정 시킬수 있음)
$('.tooltip').hover(function() {
$(this).prepend('
'+ $(this).attr('tooltip') +'
');
},
function() {
if($(this).attr('tooltip-toggle') == 'undefined' || $(this).attr('tooltip-toggle') != 'fixed') {
$(this).find('.tipbox').remove();
}
}
).click(function() {
if($(this).attr('tooltip-toggle') != undefined) {
if($(this).attr('tooltip-toggle') != 'fixed') {
$(this).attr('tooltip-toggle', 'fixed');
$(this).css('padding-bottom', '3px').css('border-top', '1px #000 dotted').css('border-bottom', '1px #000 dotted');
}
else {
$(this).attr('tooltip-toggle', 'false');
$(this).css('padding-bottom', '0').css('border-top', '0').css('border-bottom', '0');
}
}
});
});
function goto_url(url, transition) {
if($.mobile == undefined) {
location.href = url;
}
else {
$.mobile.changePage(url, { transition: transition });
}
}
// 검색
function selfSearch(f) {
var stx = f.stx.value.replace(/(^\s*)|(\s*$)/g,'');
if (stx.length < 2) {
alert('2글자 이상으로 검색하십시오.');
f.stx.focus();
return false;
}
location.href = f.action +'/sfl/'+ f.sfl.value +'/stx/'+ sEncode(stx);
return false;
}
function win_open(url, name, option) {
if(url.match(/^\/+/g, '') == null) {
url = rt_path + '/' + url
}
var popup = window.open(url, name, option);
if(popup) {
popup.focus();
}
}
// 쪽지 창
function win_memo(url) {
if (!url)
url = "member/memo/lists";
win_open(url, "winMemo", "left=50,top=50,width=616,height=460,scrollbars=1");
}
// 자기소개 창
function win_profile(mb_id) {
win_open("member/profile/qry/"+mb_id, 'winProfile', 'left=50,top=50,width=400,height=500,scrollbars=1');
}
// 우편번호 창
function win_zip(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2) {
url = rt_path+"/useful/zip/qry/"+frm_name+"/"+frm_zip1+"/"+frm_zip2+"/"+frm_addr1+"/"+frm_addr2;
win_open(url, "winZip", "left=50,top=50,width=463,height=400,scrollbars=1");
}
// POST 전송, 결과값 리턴
function post_s(href, parm, del) {
if (!del || confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
$.post(rt_path + '/' + href, parm, function(req) {
document.write(req);
});
}
}
// POST 이동
function post_goto(url, parm, target, confirm_msg) {
var f = document.createElement('form');
var basePath, objs, value;
for (var key in parm) {
value = parm[key];
objs = document.createElement('input');
objs.setAttribute('type', 'hidden');
objs.setAttribute('name', key);
objs.setAttribute('value', value);
f.appendChild(objs);
}
if (target)
f.setAttribute('target', target);
if (url.match(/^http:\/\//) || url.match(/^https:\/\//))
basePath = '';
else
basePath = '/'
if(confirm_msg == undefined || confirm(confirm_msg)) {
f.setAttribute('method', 'post');
f.setAttribute('action', basePath + url);
document.body.appendChild(f);
f.submit();
}
}
// POST 창
function post_win(name, url, parm, opt) {
var temp_win = window.open('', name, opt);
post_goto(url, parm, name);
}
// 일반 삭제 검사 확인
function del(href) {
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?"))
document.location.href = rt_path + '/' + href;
}
// 플래시에 변수 추가 fh
function flash(src, ids, width, height, wmode, fh) {
var wh = "";
if (parseInt(width) && parseInt(height))
wh = " width='"+width+"' height='"+height+"' ";
return document.write("");
}
// 동영상 파일 (html 임베드)
function embed(src, ids, width, height, autostart) {
var wh = "";
if (parseInt(width) && parseInt(height))
wh = " width='"+width+"' height='"+height+"' ";
if (!autostart) autostart = false;
return document.write("");
}
// 아이프레임 높이 자동조절
function reSize(obj) {
try {
var objBody = frames[obj].document.body;
var objFrame = document.getElementById(obj);
ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
objFrame.style.height = ifrmHeight;
}
catch(e) {}
}
function sEncode(val) {
return encodeURIComponent(val).replace(/%/g, '.');
}
// script 에서 js 파일 로드
function importScript(FILES) {
var _importScript = function(filename) {
if (filename) {
document.write('