\n";
thisObj.innerHTML = calendar_area;
}
function calendarClose()
{
dy_calOpen = 'n';
thisObj.parentNode.removeChild(thisObj);
}
function calendarPrint(date)
{
if( tagNm == "INPUT" ) eventElement.value = date;
else eventElement.innerHTML = date;
calendarClose();
}
function calendar_get_objectTop(obj){
if (obj.offsetParent == document.body) return obj.offsetTop;
else return obj.offsetTop + get_objectTop(obj.offsetParent);
}
function calendar_get_objectLeft(obj){
if (obj.offsetParent == document.body) return obj.offsetLeft;
else return obj.offsetLeft + get_objectLeft(obj.offsetParent);
}
/*** onLoad 이벤트에 함수 할당 ***/
function addOnloadEvent(fnc)
{
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", fnc, false );
else if ( typeof window.attachEvent != "undefined" ) {
window.attachEvent( "onload", fnc );
}
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
window[fnc]();
};
}
else window.onload = fnc;
}
}
function order_print(frmp_nm, frml_nm)
{
var frmp = document.forms[frmp_nm];
var frml = document.forms[frml_nm];
if ( frmp['list_type'][0].checked != true && frmp['list_type'][1].checked != true ) return;
if ( frmp['list_type'][0].checked == true && frmp['list_type'][0].value == 'list' ){
if ( PubChkSelect( frml['chk[]'] ) == false ){
alert( "선택한 내역이 없습니다." );
return;
}
var cds = new Array();
var idx = 0;
var count=frml['chk[]'].length;
if ( count == undefined ){
if ( frml['chk[]'].ordno != null ) cds[ idx++ ] = frml['chk[]'].ordno;
else cds[ idx++ ] = frml['chk[]'].value;
}
else
for ( i = 0; i < count ; i++ )
if ( frml['chk[]'][i].checked )
if ( frml['chk[]'][i].ordno != null ) cds[ idx++ ] = frml['chk[]'][i].ordno;
else cds[ idx++ ] = frml['chk[]'][i].value;
frmp['ordnos'].value = cds.join( ";" );
}
var orderPrint = window.open("","orderPrint","width=750,height=600,menubar=yes,scrollbars=yes" );
frmp.target='orderPrint';
frmp.action='../order/_paper.php';
frmp.submit();
orderPrint.focus();
}
/* 브라우저별 이벤트 처리*/
function addEvent(obj, evType, fn){
if (obj.addEventListener) {
obj.addEventListener(evType, fn, false);
return true;
} else if (obj.attachEvent) {
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
return false;
}
}
function delEvent(obj, evType, fn){
if (obj.removeEventListener) {
obj.removeEventListener(evType, fn, false);
return true;
} else if (obj.detachEvent) {
var r = obj.detachEvent("on"+evType, fn);
return r;
} else {
return false;
}
}
function getTargetElement(evt)
{
if ( evt.srcElement ) return target_Element = evt.srcElement; // 익스
else return target_Element = evt.target; // 익스외
}
function popupEgg(asMallId, asOrderId){
//창을 화면의 중앙에 위치
iXPos = (window.screen.width - 700) / 2;
iYPos = (window.screen.height - 600) / 2;
var egg = window.open("https://gateway.usafe.co.kr/esafe/InsuranceView.asp?mall_id="+asMallId + "&order_id=" + asOrderId, "egg", "width=700, height=600, scrollbars=yes, left=" + iXPos + ", top=" + iYPos);
egg.focus();
}
function inArray( needle, haystack )
{
for ( i = 0; i < haystack.length; i++ )
if ( haystack[i] == needle ) return true;
return false;
}
/*** AJAX GRAPH METHOD (AGM) ***/
AGM = {
bMsg : new Array(),
iobj : new Array(),
articles: new Array(),
running: new Array(),
interverID: '',
act: function (c)
{
if (c && typeof(c.onStart) == 'function'){
this.func = c;
this.func.onStart(this);
this.start();
}
else return;
},
start: function ()
{
this.running = new Array();
this.clearinterverid();
this.layout = "\
\
{title}
\
전송상태
브리핑 메시지 샘플.
\
준비중..
\
\
\
\
\
";
this.layout = this.layout.replace(/{title}/,this.layoutTitle);
popupLayer('',550,300);
document.getElementById('objPopupLayer').innerHTML = this.layout;
document.getElementById('report_graph').style.width = "0%";
if (this.articles.length < 1){
this.briefing(this.bMsg['chkEmpty'], true);
this.closeBtn();
return;
}
this.briefing(this.bMsg['chkCount'].replace(/__count__/, this.articles.length), true);
this.briefing(this.bMsg['start']);
this.request();
},
request: function ()
{
if (this.running.length < this.articles.length) // 전송중
{
var idx = this.articles[ this.running.length ];
var tmp = new Array(); tmp.push(idx);
this.running.push(tmp);
document.getElementById('report_step').innerHTML = '[' + this.iobj[0][idx].getAttribute('subject') + '] 내역 처리중';
this.func.onRequest(this, idx);
this.setIntervalId("AGM.graph()", 500);
}
else if (this.running.length == this.articles.length){ // 전송완료
this.clearinterverid();
this.done();
}
},
complete: function (req)
{
this.running[(this.running.length - 1)].push(true);
var idx = this.running[(this.running.length - 1)][0];
var subObj = this.iobj[0][idx];
var response = req.responseText.replace(/{subject}/, subObj.getAttribute('subject'));
this.briefing(response);
this.setIntervalId("AGM.graph('continue')", 30);
},
error: function (req)
{
this.running[(this.running.length - 1)].push(false);
var idx = this.running[(this.running.length - 1)][0];
var subObj = this.iobj[0][idx];
var msg = req.getResponseHeader("Status").replace(/{subject}/, subObj.getAttribute('subject'));
if (msg == null || msg.length == null || msg.length <= 0)
{
this.briefing("Error! Request status is " + req.status);
this.setIntervalId("AGM.graph('continue')", 30);
}
else
{
var remsg = '';
var tmp = msg.split("^");
for (i = 0; i < tmp.length; i++)
{
if (i == 1) remsg += '';
if (i == 0) remsg += tmp[i];
else remsg += '
' + tmp[i] + '
';
if (i > 0 && (i+1) == tmp.length) remsg += '';
}
this.briefing(remsg, false, 'red');
if (req.status == 600) this.done();
else this.setIntervalId("AGM.graph('continue')", 30);
}
},
done: function ()
{
this.briefing(this.bMsg['end']);
document.getElementById('report_step').innerHTML = '완료';
this.closeBtn();
this.clearinterverid();
},
closeBtn: function ()
{
var btnDiv = document.getElementById('report_btn');
btnDiv.childNodes[0].href = "javascript:closeLayer();";
btnDiv.style.display = "block";
if (this.func && typeof(this.func.onCloseBtn) == 'function') this.func.onCloseBtn(this, btnDiv);
},
setIntervalId: function (func, interval)
{
this.clearinterverid();
this.interverID = setInterval(func.toString(), interval);
},
clearinterverid: function ()
{
clearInterval(this.interverID);
this.interverID = '';
},
briefing: function (str, emtpy, color)
{
var briefing = document.getElementById('briefing').childNodes[(document.getElementById('briefing').childNodes[0].nodeType == 1 ? 0 : 1)];
if (emtpy == true) while (briefing.childNodes.length > 0) briefing.removeChild(briefing.lastChild);
var liNode = document.createElement('LI');
briefing.appendChild(liNode);
liNode.innerHTML = str;
if (color != '') liNode.style.color = color;
},
graph: function (code)
{
var limitPercent = eval(this.running.length) / eval(this.articles.length) * 100;
var nowPercent = eval(document.getElementById('report_graph').style.width.replace( /%/, ''));
if (limitPercent > nowPercent) document.getElementById('report_graph').style.width = ++nowPercent + '%';
else if (code == 'continue') this.request();
}
}
/**
* extComma(x), extUncomma(x)
*
* 숫자 표시 (3자리마다 콤마찍기, 마이너스 및 소수점 유지)
*
* @Usage var money = -1000.12;
* money = extComma(money);
* alert(money); // -1,000.12
* alert(extUncomma(money)); // -1000.12
*/
function extComma(x){
var head = '', tail = '', minus = '';
if (x < 0){
minus = '-';
x = x * (-1) + "";
}
if ( x.indexOf(".") >= 0 ) {
head = comma(x.substring ( 0 , x.indexOf(".") ));
tail = uncomma(x.substring ( x.indexOf(".") + 1, x.length ));
}
else head = comma(x);
x = minus + head;
if ( tail.toString().length > 0 ) x += "." + tail;
return x;
}
function extUncomma(x){
var head = '', tail = '', minus = '';
if (x < 0){
minus = '-';
x = x * (-1) + "";
}
if ( x.indexOf(".") >= 0 ) {
head = uncomma(x.substring ( 0 , x.indexOf(".") ));
tail = uncomma(x.substring ( x.indexOf(".") + 1, x.length ));
}
else head = uncomma(x);
x = minus + head;
if ( tail.toString().length > 0 ) x += "." + tail;
return x;
}
/*** UI NAVIGATION METHOD (UNM) ***/
UNM = {
m_no: "",
m_id: "",
isOver: false,
agoMenuNo: "",
overBgcolor: "#e4ff75",
outBgcolor: "#ffffff",
popup: "",
inner: function ()
{
document.onclick = this.mouseDown;
var navigs = document.getElementsByName('navig');
for (no = 0; no < navigs.length; no++)
{
navigs[no].style.position = "relative";
content = navigs[no].innerHTML;
navigs[no].innerHTML = '';
navigs[no].style.zIndex = 0;
var va = navigs[no].appendChild(document.createElement('A'));
va.href = "javascript:UNM.callMenu('" + navigs[no].getAttribute('m_no') + "', '" + navigs[no].getAttribute('m_id') + "', '" + navigs[no].getAttribute('popup') + "');";
va['onmouseover'] = function(e) { UNM.evtHandler(); };
va.innerHTML = content;
va.setAttribute('no', no);
var vDiv = navigs[no].insertBefore(document.createElement('DIV'), navigs[no].childNodes[0]);
vDiv.setAttribute('id', 'menuarent' + no);
with (vDiv.style){
position = 'absolute';
display = 'none';
top = -3;
left = -132;
}
var menu = '';
menu += '
';
menu += '
';
menu += '
CRM (고객관리) 보기
';
menu += '
';
menu += '
';
menu += '
';
menu += '
SMS 보내기
';
menu += '
';
menu += '
';
menu += '
';
menu += '
메일 보내기
';
menu += '
';
menu += '
';
menu += '
';
menu += '
주문내역 보기
';
menu += '
';
menu += '
';
menu += '
';
menu += '
적립금내역 보기
';
menu += '
';
vDiv.innerHTML = menu;
}
},
callMenu: function (m_no, m_id, popup)
{
this.m_no = m_no;
this.m_id = m_id;
this.popup = popup;
},
evtHandler: function ()
{
if (window.navigator.appName.indexOf("Explorer") == -1) return;
document.onclick = this.mouseDown;
},
mouseDown: function (e)
{
var event = e || window.event;
var evtTarget = event.target || event.srcElement;
if (evtTarget.toString().indexOf("javascript:UNM.callMenu(") && evtTarget.parentNode != null) evtTarget = evtTarget.parentNode;
if (evtTarget.toString().indexOf("javascript:UNM.callMenu(") && evtTarget.parentNode != null) evtTarget = evtTarget.parentNode;
if (!UNM.isOver) UNM.hideAll();
if (!evtTarget.toString().indexOf("javascript:UNM.callMenu(") && evtTarget.getAttribute('no') != null){
UNM.agoMenuNo = evtTarget.getAttribute('no');
_ID('menuarent' + evtTarget.getAttribute('no')).style.display = 'block';
_ID('menuarent' + evtTarget.getAttribute('no')).parentNode.style.zIndex = document.getElementsByName('navig').length;
}
else return;
},
menuOver: function (e, obj)
{
var event = e || window.event;
this.isOver = true;
this.chgBgcolor(obj);
},
menuOut: function (obj)
{
this.isOver = false;
this.chgBgcolor(obj);
},
chgBgcolor: function (obj)
{
if (typeof obj.painted == 'undefined') obj.painted = false;
obj.style.backgroundColor = obj.painted?this.outBgcolor:this.overBgcolor;
obj.painted = !obj.painted;
},
hideAll: function ()
{
try {
document.getElementById("menuarent" + this.agoMenuNo).style.display = 'none';
document.getElementById("menuarent" + this.agoMenuNo).parentNode.style.zIndex = 0;
} catch(e) { return; }
},
exec: function (key)
{
this.hideAll();
switch(key) {
case "EVENT1" :
(this.popup == '1' ? popup :popupLayer)('../member/Crm_view.php?m_id=' + this.m_id,780,600);
break;
case "EVENT2" :
(this.popup == '1' ? popup :popupLayer)('../member/popup.sms.php?m_id=' + this.m_id,780,600);
break;
case "EVENT3" :
(this.popup == '1' ? popup :popupLayer)('../member/email.php?type=direct&m_id=' + this.m_id,780,600);
break;
case "EVENT4" :
(this.popup == '1' ? popup :popupLayer)('../member/orderlist.php?m_no=' + this.m_no,500,600);
break;
case "EVENT5" :
(this.popup == '1' ? popup :popupLayer)('../member/popup.emoney.php?m_no=' + this.m_no,600,500);
break;
}
}
}
function panel(idnm, section)
{
if (document.getElementById(idnm) == null) return;
var ajax = new Ajax.Request( "../proc/indb.php",
{
method: "post",
parameters: "mode=getPanel&idnm=" + idnm + "§ion=" + section,
onComplete: function ()
{
var req = ajax.transport;
if (req.status != 200) return;
if (req.responseText =='') return;
var obj = document.getElementById(idnm);
if (idnm == 'paneltop')
{
obj.parentNode.style.textAlign = 'right';
obj.parentNode.style.width = 808;
}
obj.innerHTML = req.responseText;
if(idnm == 'maxlicense'){
popupLayerAgree(idnm,530,430);
}
if(idnm == 'maxagree'){
window.onload=function(){popupLayerAgree(idnm,530,430);}
}
}
} );
}
/*** license ***/
function popupLayerAgree(s,w,h)
{
if (!w) w = 600;
if (!h) h = 400;
var pixelBorder = 3;
var titleHeight = 12;
w += pixelBorder * 2;
h += pixelBorder * 2 + titleHeight;
var bodyW = document.body.clientWidth;
var bodyH = document.body.clientHeight;
var posX = (bodyW - w) / 2;
var posY = (bodyH - h) / 2;
hiddenSelectBox('hidden');
/*** 백그라운드 레이어***/
var obj = document.createElement("div");
with (obj.style){
position = "absolute";
left = 0;
top = 0;
width = "100%";
height = document.body.scrollHeight;
backgroundColor = "#000000";
filter = "Alpha(Opacity=70)";
opacity = "0.5";
}
obj.id = "objPopupLayerBg";
document.body.appendChild(obj);
/*** 내용프레임 레이어 ***/
var obj = document.createElement("div");
with (obj.style){
position = "absolute";
left = posX + document.body.scrollLeft;
top = posY + document.body.scrollTop;
width = w;
height = h;
}
obj.id = "objPopupLayer";
obj.innerHTML = document.getElementById(s).innerHTML;
document.body.appendChild(obj);
}
function inFocus1(i) {
(i).style.border='2px solid #627dce';
}
function outFocus1(i) {
(i).style.border='1px solid #cccccc';
}
function LogininFocus(i) {
(i).style.border='3px solid #00a8ff';
(i).style.height='22px';
}
function LoginoutFocus(i) {
(i).style.border='1px solid #242425';
(i).style.height='22px';
}
/*** 포커스 테두리 넣기 ***/
function linecss(){
var obj = document.getElementsByTagName('input');
var obj_txa = document.getElementsByTagName('textarea');
for( e =0; e < obj.length; e++ ){
var type = obj[e].getAttribute('type');
if( type == 'text' || type == 'password' || type == 'file'){
var isClsnm = false;
var clsnm = obj[e].className.toString().split(' ');
for (c = 0; c < clsnm.length; c++){
if (inArray(clsnm[c], Array('lline', 'line', 'rline', 'cline', 'loginline'))) isClsnm = true;
}
if (isClsnm === true){
addEvent(obj[e], 'focus', function(e) { inFocus1(getTargetElement(e)); });
addEvent(obj[e], 'blur', function(e) { outFocus1(getTargetElement(e)); });
}
}
}
for( t =0; t < obj_txa.length; t++ ){
var clsnm = obj_txa[t].className.toString().split(' ');
if (inArray("tline", clsnm)){
addEvent(obj_txa[t], 'focus', function(e) { inFocus1(getTargetElement(e)); });
addEvent(obj_txa[t], 'blur', function(e) { outFocus1(getTargetElement(e)); });
}
}
}
/*** 디자인코디 IFRAME HEIGHT 재설정 ***/
function setHeight_ifrmCodi(){
if (parent._ID('ifrmCodi')){
parent._ID('ifrmCodi').style.height = document.body.scrollHeight;
document.body.style.margin = '0';
return true;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
/**
* input check 전체 체크처리 공통
* @param {} form
* @return
* @type
*/
function MsgUserAllCheck(){
$("input[type='checkbox']").attr('checked', $('#isall').is(':checked'));
}
/**
* 팝업 공통 close
* @param {Y/N} isOpenerReload : 팝업닫을경우 부모창 리로드여부
* @return N/A
* @type
*/
function popClose(isOpenerReload){
if (isOpenerReload == 'Y'){opener.history.go();}
window.self.close();
}
/**
* 팝업 공통 close
* @param {Y/N} isOpenerReload : 팝업닫을경우 부모창 리로드여부
* @param {} msg : CONFIRM 메시지 내용
* @return N/A
* @type
*/
function popCloseCfm(isOpenerReload, msg){
var confirmwin = window.confirm(msg);
if (confirmwin){popClose(isOpenerReload);}
}
/**
* input radio 객체가 체크되었는지 확인
* @param {} object
* @return Y|N
* @type
*/
function isRadioChecked(object){
var result = "N";
for(i=0; i -1)
{
temp_str = temp_str.replace(str1, str2);
}
}
return temp_str;
}
*/
/**
* 공통엑셀다운로드
*/
function commonExeclDown(title, rowcount){
if (rowcount > 0){
var data = document.all.item("resultdata").innerHTML;
data = data.replaceAll("img", "a");
data = data.replaceAll("IMG", "a");
data = data.replaceAll("checkbox", "hidden");
//alert(data);
var form = document.createElement("form");
var obj_title = document.createElement("input");
var obj_data = document.createElement("input");
obj_title.name = "sheettitle";
obj_title.value = title;
obj_data.name = "data";
obj_data.value = data;
form.appendChild(obj_title);
form.appendChild(obj_data);
document.body.appendChild(form);
form.method = "post";
form.action = "/admin/common/exceldown.jsp";
form.submit();
} else {
alert("검색된 결과가 없습니다.");
}
}
//오직 숫자 하이픈(-)만 허용
function onlyNum1(id) {
$('#'+id).numeric({allow:"-"});
$('#'+id).css("ime-mode","disabled");
}
//오직 숫자만 입력 허용
function onlyNum2(id) {
$('#'+id).numeric();
$('#'+id).css("ime-mode","disabled");
}
//오직 숫자만 입력 허용
function onlyNum2_class(classNm) {
$('.'+classNm).numeric();
$('.'+classNm).css("ime-mode","disabled");
}
//숫자, 알파벳만 허용
function onlyNumAlpha(id) {
$('#'+id).numeric({allow:"abcdefghijklmnopqrstuvwxyz"});
$('#'+id).css("ime-mode","disabled");
}
/**
* ajax 공통 모듈
* url :
* data :
* dataType : json / html / xml / text
* callback : 콜백함수
*/
function ajaxSubmit(url, data, dataType, callback){
$.ajax({
url : url,
data : data,
dataType : dataType,
type : 'POST',
success : function(result) {
callback(result);
},
error : function(e) {
alert("error :" + e.responseText);
}
});
}
(function (window, $, _, undefined) {
var sangs = window.sangs = window.sangs || {};
sangs.areaCombo = {
_selectorCombo1 : '',
_selectorCombo2 : '',
_selectorCombo3 : '',
_defaultOption : '',
init : function(combo1, combo2, combo3){
_selectorCombo1 = $('#'+combo1);
_selectorCombo2 = $('#'+combo2);
_selectorCombo3 = $('#'+combo3);
this.list(_selectorCombo1, "/admin/lecture/sidoList.do");
//**************** Event ************//
_selectorCombo1.change(function(e){
_selectorCombo3.empty().append(sangs.areaCombo._defaultOption);
_selectorCombo2.empty().append(sangs.areaCombo._defaultOption);
sangs.areaCombo.list(_selectorCombo2, "/admin/lecture/guList.do", {sidoCode : $(this).val()});
});
_selectorCombo2.change(function(e){
_selectorCombo3.empty().append(sangs.areaCombo._defaultOption);
sangs.areaCombo.list(_selectorCombo3, "/admin/lecture/dongList.do", {guCode : $(this).val()});
});
},
selected : function(comboVal1, comboVal2, comboVal3){
_selectorCombo1.val(comboVal1).attr('selected', true).trigger('change');
_selectorCombo2.val(comboVal2).attr('selected', true).trigger('change');
_selectorCombo3.val(comboVal3).attr('selected', true);
},
list : function($selector, url, data){
//console.log(data + "====="+ url + "====" + $selector);
$.ajax({
url : url,
type : "POST",
data : data,
dataType: "json",
async : false,
success : function(data, status) {
$selector.empty().append(sangs.areaCombo._defaultOption);
$.each(data.result, function(i, item){
$selector.append('');
});
}
});
}
};
}(window, jQuery));
//이미지 미리보기 함수
function fnPreviewImg(input) {
if (input.files && input.files[0]) {
if(fnIsImgFile(input.files[0].name)){
var reader = new FileReader();
reader.onload = function(e) {
$('#'+input.id+'Preview').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
$('#'+input.id+'Preview').show();
}else{
alert('bmp,gif,jpg,png,jpeg 확장자만 등록이 가능합니다.');
input.value = '';
$('#'+input.id+'Preview').hide();
}
}
}
//첨부파일 확장자 이미지 인지 체크
function fnIsImgFile(filename){
var _fileLen = filename.length;
var _lastDot = filename.lastIndexOf('.');
var _fileExt = filename.substring(_lastDot, _fileLen).toLowerCase();
var _result;
// 미리보기 가능한 확장자는 배열에 넣기
var _arrExt = new Array( ".bmp", ".gif", ".jpg", ".png", ".jpeg");
// 배열 요소를 검사하여 체크
for(var i=0; i<_arrExt.length; i++) {
if(_arrExt[i] == _fileExt) {
_result = true;
break;
} else
_result = false;
}
return _result;
}
/**
* modal alert
* msg : text
* callback : callback 함수
*/
function fnModalMsg(msg, callback){
modal({
type: 'alert',
title: '',
text: ""+msg+"",
callback: function(result) {
if(typeof callback == 'function'){
callback();
}
}
});
}
//}(window, jQuery, underscore));
/**
* modal Msg
* obj : jquery obj focuse 맞출 이벤트
* type : confirm, alert (default)
* iconType : iconType
* msg : text
* callback : 확인 버튼 후 후처리
* 예) fnModal( $('#focusId')
* , 'confirm'
* ,"등록 하시겠습니까?"
* ,function(){
* 처리 영역
* });
*/
//popup 접근성 관련 포커스 강제 이동
var thisFocus;
function modalOpen() {
var showTarget = $('[data-tooltip-con="pop-alert"]');
showTarget.show().focus();
}
function modalClose(t) {
t.parents(".layerpop").hide();
$('.p_btn_center').html('');
thisFocus.focus();
}
function fn_setModalCookie(cookieNm, value){
if(value == null || value == ""){
value = "Y";
}
$.cookie(cookieNm,value,{
expires : 1//쿠키보관일
})
}
function fn_getModalCookie(cookieNm){
return $.cookie(cookieNm);
}
function fnModalMsg( obj, type, msg, callback, cookieYn, cookieNm ){
var html = "";
var openBtn = obj; // 접근성 포커스 이동
var closeBtn = '.modal-tooltip-close';
$('.p_btn_center').html('');
$('.alert_msg').html(msg);
if(type == 'confirm'){
$('.alert_msg').removeClass('ico_chk');
$('.alert_msg').addClass('ico_confirm');
html = '';
html += '';
} else {
$('.alert_msg').removeClass('ico_confirm');
$('.alert_msg').addClass('ico_chk');
html = '';
}
if(cookieYn == "Y"){
if(fn_getModalCookie(cookieNm) == "Y"){
if(typeof callback == 'function'){
if(type == 'confirm'){
callback(true);
} else {
callback();
}
}
return;
}
html += '
';
html += ' ';
html += ' ';
html += '
';
}
$('.p_btn_center').append(html);
thisFocus = openBtn;
modalOpen();//modal 메시지
$('#modalConfirmOk').focus();
$(closeBtn).click(function(e) {
e.preventDefault();
modalClose($(this));
if(typeof callback == 'function'){
if(type == 'confirm'){
callback(false);
}
}
});
$('#modalConfirmOk').click(function() {
if(cookieYn == "Y" && $("#btn_modalCookie").is(":checked")){
fn_setModalCookie(cookieNm);
}
$('.p_btn_center').html('');
$('.layerpop').hide();
if(thisFocus != null && thisFocus.length > 0)thisFocus.focus();
if(typeof callback == 'function'){
if(type == 'confirm'){
callback(true);
} else {
callback();
}
}
});
}
function fnLoginModal( obj, callback ){
var html = "";
var openBtn = obj; // 접근성 포커스 이동
closeBtn = '.modal-tooltip-close';
$('.alert_msg').text("로그인 후 이용하실 수 있습니다.");
$('.alert_msg').removeClass('ico_chk');
$('.alert_msg').addClass('ico_lock');
html = '';
html += '';
$('.p_btn_center').append(html);
thisFocus = openBtn;
modalOpen();//modal 메시지
$('#modalConfirmOk').focus();
$(document).on('click', closeBtn, function(e) {
e.preventDefault();
modalClose($(this));
});
$('#modalConfirmOk').click(function() {
$('.p_btn_center').html('');
$('.layerpop').hide();
if(thisFocus.length > 0)thisFocus.focus();
fnLogin();
});
}
// 우편번호 찾기 화면을 넣을 element
var element_layer = document.getElementById('layer');
// 주소 검색 시작
function fnOpenDaumPostAppend( pthis ){
var postAppend = '
';
postAppend += '';
postAppend += '
';
$(pthis).parent().append(postAppend);
element_layer = document.getElementById('layer');
}
function isMobile() {
return /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}
function closeDaumPostcode() {
// iframe을 넣은 삭제
$('#layer').remove();
}
function openDaumPostcode( pthis , zipcodeObj, addr1Obj) {
fnOpenDaumPostAppend( pthis );
daum.postcode.load(function(){
new daum.Postcode({
oncomplete: function(data) {
// 각 주소의 노출 규칙에 따라 주소를 조합한다.
// 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다.
var fullAddr = data.address; // 최종 주소 변수
var extraAddr = ''; // 조합형 주소 변수
// 기본 주소가 도로명 타입일때 조합한다.
if(data.addressType === 'R'){
//법정동명이 있을 경우 추가한다.
if(data.bname !== ''){
extraAddr += data.bname;
}
// 건물명이 있을 경우 추가한다.
if(data.buildingName !== ''){
extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName);
}
// 조합형주소의 유무에 따라 양쪽에 괄호를 추가하여 최종 주소를 만든다.
fullAddr += (extraAddr !== '' ? ' ('+ extraAddr +')' : '');
}
// 우편번호와 주소 정보를 해당 필드에 넣는다.
if(zipcodeObj == null){
$('.ibxCompPostNo').val(data.zonecode) //5자리 새우편번호 사용
}else{
zipcodeObj.val(data.zonecode) //5자리 새우편번호 사용
}
if(addr1Obj == null){
$('.ibxCompAddr1').val(fullAddr) //기본 주소
}else{
addr1Obj.val(fullAddr) //5자리 새우편번호 사용
}
pthis.focus();
//document.getElementById('sample2_addressEnglish').value = data.addressEnglish;
// iframe을 넣은 element를 안보이게 한다.
// (autoClose:false 기능을 이용한다면, 아래 코드를 제거해야 화면에서 사라지지 않는다.)
element_layer.style.display = 'none';
closeDaumPostcode();
},
width : '100%',
height : '100%',
maxSuggestItems : 5
}).embed(element_layer);
});
// iframe을 넣은 element를 보이게 한다.
element_layer.style.display = 'block';
// iframe을 넣은 element의 위치를 화면의 가운데로 이동시킨다.
initLayerPosition();
}
// 브라우저의 크기 변경에 따라 레이어를 가운데로 이동시키고자 하실때에는
// resize이벤트나, orientationchange이벤트를 이용하여 값이 변경될때마다 아래 함수를 실행 시켜 주시거나,
// 직접 element_layer의 top,left값을 수정해 주시면 됩니다.
function initLayerPosition(){
var width = 300; //우편번호서비스가 들어갈 element의 width
if (!isMobile()) {
width = 620;
}
var height = 400; //우편번호서비스가 들어갈 element의 height
var borderWidth = 2; //샘플에서 사용하는 border의 두께
// 위에서 선언한 값들을 실제 element에 넣는다.
element_layer.style.width = width + 'px';
element_layer.style.height = height + 'px';
element_layer.style.border = borderWidth + 'px solid';
// 실행되는 순간의 화면 너비와 높이 값을 가져와서 중앙에 뜰 수 있도록 위치를 계산한다.
element_layer.style.left = (((window.innerWidth || document.documentElement.clientWidth) - width)/2 - borderWidth - 6) + 'px';
element_layer.style.top = (((window.innerHeight || document.documentElement.clientHeight) - height)/2 - borderWidth) + 'px';
}
// 주소 검색 종료
function dateFormat( e, oThis) {
var num_arr = [97,98,99,100,101,102,103,104,105,96,48,49,50,51,52,53,54,55,56,57];
var key_code = (e.which) ? e.which: e.keyCode;
if(num_arr.indexOf(Number(key_code)) != -1){
var len = oThis.value.length;
if(len == 4) oThis.value += "-";
if(len == 7) oThis.value += "-";
}
}
function checkValidDate(value) {
var result = true;
try {
var date = value.split("-");
var y = parseInt(date[0], 10),
m = parseInt(date[1], 10),
d = parseInt(date[2], 10);
var dateRegex = /^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-.\/])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
result = dateRegex.test(d+'-'+m+'-'+y);
} catch (err) {
result = false;
}
return result;
}