/* * Select box 선택 * @param : * cmCdType : 코드 유형 * clsName : 코드를 넣을 부분 Class * */ function f_doSelected (cdIdName, cdOption, selectedVal) { switch (cdOption) { case 'value': $('#'+cdIdName).val(selectedVal); break; case 'text': $('#'+cdIdName).find('option').each(function(){ var comm_cd_nm = $(this).text(); if (comm_cd_nm == selectedVal) { $(this).attr("selected","true"); } }); break; default : } } function getCodeSelectByClass(clsName, cdmst_id) { var cdUrl = '/kor/common/getcodelist.xsl;jsessionid=BE63332AD49F62F0BAC74053D7BFBC5E'; var cdQuery = 'cdmst_id='+cdmst_id; $.ajax({ url: cdUrl, type: 'post', dataType:'xml', cache: false, data: cdQuery, timeout: 3000, error: function(){ alert('Error loading XML document'); }, success: function(data){ var $firstOption = $('.'+clsName).find('option:first').eq(0); $('.'+clsName).find('option').remove(); $('.'+clsName).append($firstOption); $(data).find('com\\.itc\\.base\\.common\\.domain\\.CommonCodeDto').each(function(){ var cdmst_name = $(this).find('cdmst_name').text(); var cdmst_value = $(this).find('cdmst_value').text(); $('.'+clsName).each(function() { $(this).append($("").attr("value",cdmst_value).text(cdmst_name)); }); }); // 기본값세팅 $('.'+clsName).each(function() { $(this).val($(this).attr('defaultValue')); }); } }); } /* * 코드 가져오기 * @param : * cmCdType : 코드 유형 * idName : 코드를 넣을 아이디 * seletedVal : 선택될 항목 값 여기서 처리하거나 필요시에 $('#id명').val(selectedVal); */ function getCodeSelectById(idName, cdmst_id, defaultValue) { var cdUrl = '/kor/common/getcodelist.xsl;jsessionid=BE63332AD49F62F0BAC74053D7BFBC5E'; var cdQuery = 'cdmst_id='+cdmst_id; $.ajax({ url: cdUrl, type: 'post', dataType:'xml', cache: false, data: cdQuery, timeout: 3000, error: function(){ alert('Error loading XML document'); }, success: function(data){ var $firstOption = $('#'+idName).find('option:first').eq(0); $('#'+idName).find('option').remove(); $('#'+idName).append($firstOption); $(data).find('com\\.itc\\.base\\.common\\.domain\\.CommonCodeDto').each(function(){ var cdmst_name = $(this).find('cdmst_name').text(); var cdmst_value = $(this).find('cdmst_value').text(); $('#'+idName).each(function() { $(this).append($("").attr("value",cdmst_value).text(cdmst_name)); }); }); // 기본값 세팅 if (defaultValue!=null && defaultValue!='') { $('#'+idName).val(defaultValue); } else { $('#'+idName).val($('#'+idName).attr('defaultValue')); } } }); } function setAutoEmail(TargetID, Value) { if (Value!='self') { $('#'+TargetID).val(Value); if (!$('#'+TargetID).hasClass("readonly")) { $('#'+TargetID).addClass("readonly"); //$('#'+TargetID).attr("readonly"); // ie 7 에서 readonly속성이 풀리지 않아 아래로 수정 document.getElementById(TargetID).readOnly = true; } } else { $('#'+TargetID).removeClass("readonly"); //$('#'+TargetID).removeAttr("readonly"); // ie 7 에서 readonly속성이 풀리지 않아 아래로 수정 document.getElementById(TargetID).readOnly = false; $('#'+TargetID).val(""); document.getElementById(TargetID).focus(); } } function addComma(n) { if(isNaN(n)){return 0;} var reg = /(^[+-]?\d+)(\d{3})/; n += ''; while (reg.test(n)) n = n.replace(reg, '$1' + ',' + '$2'); return n; } $(function() { getBoardImg(); doCheckMyPath(); $('.twitter').click(function() { var pageText = '['+$('title').text()+'] '+$('.root strong').text()+' '; window.open('https://twitter.com/share?text='+pageText,'width=350,height=300'); }); $('.facebook').click(function() { var pageUrl = encodeURIComponent(location.href); var pageText = encodeURIComponent('['+$('title').text()+'] '+$('.root strong').text()+' '); window.open('http://www.facebook.com/sharer.php?u='+pageUrl+'&title='+pageText,'width=350,height=300'); }); }); function getBoardImg() { $('#nv_first').attr('src','/kor/img/btn/page_first.gif;jsessionid=BE63332AD49F62F0BAC74053D7BFBC5E'); $('#nv_prev').attr('src','/kor/img/btn/page_prev.gif;jsessionid=BE63332AD49F62F0BAC74053D7BFBC5E'); $('#nv_last').attr('src','/kor/img/btn/page_last.gif;jsessionid=BE63332AD49F62F0BAC74053D7BFBC5E'); $('#nv_next').attr('src','/kor/img/btn/page_next.gif;jsessionid=BE63332AD49F62F0BAC74053D7BFBC5E'); } function doCheckMyPath() { try { var pathArray = new Array(); $('.root a').each(function(index) { pathArray[index] = $(this).text(); }); pathArray[pathArray.length] = $('.root strong').text(); // Sub Menu $('.snb ').find('a').each(function() { for (var i=1; i < pathArray.length; i++) { if ($(this).text().replace(" ","")==pathArray[i].replace(" ","")) { $(this).parent().parent().parent().addClass("on"); $(this).parent().addClass("on"); } } }); // Sub Menu $('.snb ').find('img').each(function() { for (var i=1; i < pathArray.length; i++) { if ($(this).attr("alt").replace(" ","")==pathArray[i].replace(" ","")) { $(this).parent().parent().parent().addClass("on"); } } }); // Top Menu $('.gnb ').find('img').each(function() { if (pathArray[1].replace(" ","")==$(this).attr("alt").replace(" ","")) { $(this).parent().parent().parent().addClass("on"); } }); } catch (e) { } } function getReservationApp(url){ window.open(url); $('.dialog-type-A').remove(); $('.modal-overlay').remove(); } //두 값이 같은지 체크하는 함수 function eqVal(obj1 , obj2){ return obj1.val() == obj2.val(); } //값이 숫자만 인지 체크 function isNum(obj){ var reg = /^\d+$/; return reg.test(obj.val()); } //이메일 유효성 체크 function isEmail(obj){ var reg = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/; return reg.test(obj.val()); } //파일 다운로드 function getAttachFile(file_name){ document.location.href = '/kor/common/files/downloadFile.do;jsessionid=BE63332AD49F62F0BAC74053D7BFBC5E?file=' + file_name; } //팝업 하루동안 열지않기 function getPopupCookie(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 ''; }