| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498 |
- // 전역 변수
- var errmsg = "";
- var errfld;
- function _blank(url) {
- window.open(url, '_blank');
- }
- function new_popup(url, name) {
- window.open(url, name, 'height=' + screen.height + ',width=' + screen.width + 'fullscreen=yes');
- }
- function reload() {
- window.location.reload();
- }
- function link_replace(url) {
- window.location.replace(url);
- }
- function link(url) {
- window.location.href = url;
- }
- function popup_full(url, name) {
- window.open(url, name,'height=' + screen.height + ',width=' + screen.width + 'fullscreen=yes');
- }
- function popup_close() {
- self.close();
- }
- var custom_modal_alert_opts = {
- id : '',
- title : '',
- width : '400px',
- // height : '200px',
- height : 'auto',
- zIndex : '99999',
- btn_confirm_text : '확인',
- btn_close_show : true,
- event_esc_key : true,
- }
- var custom_modal_confirm_opts = {
- id : '',
- title : '',
- desc : '',
- width : '400px',
- // height : '200px',
- height : 'auto',
- zIndex : '99999',
- btn_cancel_text : '취소',
- btn_confirm_text : '확인',
- btn_close_show : true,
- event_esc_key : true,
- }
- // $(document).on("add_custom_modal_alert_keyup_event", "#custom_modal_alert", function(e){
- // // console.log($("#custom_modal_alert").css("display") == "flex");
- // // if (e.key === "Escape") {
- // // console.log(e.keyCode);
- // // }
- //
- // console.log('aaaa');
- // });
- $(document).on("add_custom_modal_alert_keyup_event", "#custom_modal_alert", function(e){
- custom_modal_alert_close();
- if(typeof custom_modal_alert_opts.id != "undefined" && $.trim(custom_modal_alert_opts.id) != "" && $("#"+custom_modal_alert_opts.id).attr("type") != "hidden") {
- $("#"+custom_modal_alert_opts.id).focus();
- }
- });
- $(document).on("add_custom_modal_confirm_keyup_event", "#custom_modal_confirm", function(e){
- custom_modal_confirm_close();
- if(typeof custom_modal_confirm_opts.id != "undefined" && $.trim(custom_modal_confirm_opts.id) != "" && $("#"+custom_modal_confirm_opts.id).attr("type") != "hidden") {
- $("#"+custom_modal_confirm_opts.id).focus();
- }
- });
- //alert 오픈
- function custom_modal_alert_open() {
- $("#custom_modal_alert").removeClass("hide");
- }
- //alert 닫음
- function custom_modal_alert_close() {
- $("#custom_modal_alert").addClass("hide");
- }
- //alert 창
- function custom_modal_alert(opts, callback) {
- //option setting
- for(var i in opts) {
- custom_modal_alert_opts[i] = opts[i];
- }
- //제목
- $("#custom_modal_alert_title").html(custom_modal_alert_opts.title.replace(/\n/g, "<br/>").replace(/\\n/g, "<br/>"));
- //확인 버튼
- $("#btn_custom_modal_alert_proc").text(custom_modal_alert_opts.btn_confirm_text);
- if(custom_modal_alert_opts.btn_close_show != true) {
- $("#custom_modal_alert #btn_custom_modal_alert_close").hide();
- }
- $("#custom_modal_alert").zIndex(custom_modal_alert_opts.zIndex);
- $("#custom_modal_alert .custom--pop--wrapper--inner").css({width: custom_modal_alert_opts.with, height: custom_modal_alert_opts.height});
- // console.log(custom_modal_alert_opts);
- custom_modal_alert_open();
- $(document).on("keyup", function(e){
- if(custom_modal_alert_opts.event_esc_key == true) {
- var custom_modal_alert_display = $("#custom_modal_alert").css("display");
- if ($.inArray(custom_modal_alert_display, ['block', 'flex']) != -1 && e.key === "Escape") {
- $("#custom_modal_alert").trigger("add_custom_modal_alert_keyup_event", []);
- }
- }
- });
- //확인
- $("#btn_custom_modal_alert_proc").on("click", function() {
- // console.log(1)
- $("#btn_custom_modal_alert_proc").unbind("click");
- $("#btn_custom_modal_alert_close").unbind("click");
- if(typeof callback === 'function') {
- callback(true);
- }else {
- custom_modal_alert_close();
- }
- });
- //닫기
- $("#btn_custom_modal_alert_close").on("click", function() {
- // console.log(2)
- $("#btn_custom_modal_alert_proc").unbind("click");
- $("#btn_custom_modal_alert_close").unbind("click");
- custom_modal_alert_close();
- });
- }
- //2023-03-28 팝업 신규 디자인 반영
- function custom_modal_alert_new(opts, callback) {
- //option setting
- for(var i in opts) {
- custom_modal_alert_opts[i] = opts[i];
- }
- $("#custom_modal_alert_title").html(custom_modal_alert_opts.title.replace(/\n/g, "<br/>").replace(/\\n/g, "<br/>"));
- $(document).on("keyup", function(e){
- if(custom_modal_alert_opts.event_esc_key == true) {
- var custom_modal_alert_display = $("#custom_modal_alert").css("display");
- if ($.inArray(custom_modal_alert_display, ['block', 'flex']) != -1 && e.key === "Escape") {
- $("#custom_modal_alert").trigger("add_custom_modal_alert_keyup_event", []);
- }
- }
- });
- //확인
- $("#btn_custom_modal_alert_proc").on("click", function() {
- // console.log(1)
- $("#btn_custom_modal_alert_proc").unbind("click");
- $("#btn_custom_modal_alert_close").unbind("click");
- if(typeof callback === 'function') {
- callback(true);
- }else {
- custom_modal_alert_close();
- }
- });
- //닫기
- $("#btn_custom_modal_alert_close").on("click", function() {
- // console.log(2)
- $("#btn_custom_modal_alert_proc").unbind("click");
- $("#btn_custom_modal_alert_close").unbind("click");
- custom_modal_alert_close();
- });
- }
- //modal open
- function custom_modal_confirm_open() {
- $("#custom_modal_confirm").removeClass("hide");
- }
- //modal close
- function custom_modal_confirm_close() {
- $("#custom_modal_confirm").addClass("hide");
- $(".dimLayer").remove();
- }
- //modal open
- function custom_modal_confirm(opts, callback) {
- //option setting
- for(var i in opts) {
- custom_modal_confirm_opts[i] = opts[i];
- }
- //제목
- //<br/>
- $("#custom_modal_confirm #custom_modal_confirm_title").html(custom_modal_confirm_opts.title.replace(/\n/g, "<br/>").replace(/\\n/g, "<br/>"));
- //내용
- $("#custom_modal_confirm #custom_modal_confirm_desc").text(custom_modal_confirm_opts.desc);
- //확인 버튼
- $("#custom_modal_confirm #btn_custom_modal_confirm_proc").text(custom_modal_confirm_opts.btn_confirm_text);
- //취소 버튼
- $("#custom_modal_confirm #btn_custom_modal_confirm_cancel").text(custom_modal_confirm_opts.btn_cancel_text);
- if(custom_modal_confirm_opts.btn_close_show != true) {
- $("#custom_modal_confirm #btn_custom_modal_confirm_close").hide();
- }
- $("#custom_modal_confirm").zIndex(custom_modal_confirm_opts.zIndex);
- $("#custom_modal_confirm .custom--pop--wrapper--inner").css({width: custom_modal_confirm_opts.width, height: custom_modal_confirm_opts.height});
- custom_modal_confirm_open();
- $(document).on("keyup", function(e){
- if(custom_modal_confirm_opts.event_esc_key == true) {
- var custom_modal_confirm_display = $("#custom_modal_confirm").css("display");
- if ($.inArray(custom_modal_confirm_display, ['block', 'flex']) != -1 && e.key === "Escape") {
- $("#custom_modal_confirm").trigger("add_custom_modal_confirm_keyup_event", []);
- }
- }
- });
- //modal confirm
- $("#btn_custom_modal_confirm_proc").on("click", function() {
- $("#btn_custom_modal_confirm_cancel").unbind("click");
- $("#btn_custom_modal_confirm_proc").unbind("click");
- $("#btn_custom_modal_confirm_close").unbind("click");
- // console.log(1)
- if(typeof callback === 'function') {
- callback(true);
- }else {
- custom_modal_confirm_close();
- }
- });
- //modal cancel
- $("#btn_custom_modal_confirm_cancel").on("click", function() {
- // console.log(2)
- $("#btn_custom_modal_confirm_cancel").unbind("click");
- $("#btn_custom_modal_confirm_proc").unbind("click");
- $("#btn_custom_modal_confirm_close").unbind("click");
- custom_modal_confirm_close();
- });
- //modal close
- $("#btn_custom_modal_confirm_close").on("click", function() {
- // console.log(3)
- $("#btn_custom_modal_confirm_cancel").unbind("click");
- $("#btn_custom_modal_confirm_proc").unbind("click");
- $("#btn_custom_modal_confirm_close").unbind("click");
- custom_modal_confirm_close();
- });
- }
- function custom_modal_confirm2(opts, callback) {
- custom_modal_confirm_open();
- if(typeof opts.title != "undefined") {
- $("#custom_modal_confirm #custom_modal_confirm_title").text(opts.title);
- }
- if(typeof opts.desc != "undefined") {
- $("#custom_modal_confirm #custom_modal_confirm_desc").text(opts.desc);
- }
- if(typeof opts.btn_cancel_text != "undefined") {
- $("#custom_modal_confirm #btn_custom_modal_confirm_cancel").text(opts.btn_cancel_text);
- }
- if(typeof opts.btn_confirm_text != "undefined") {
- $("#custom_modal_confirm #btn_custom_modal_confirm_proc").text(opts.btn_confirm_text);
- }
- // console.log("AAAAA", opts.btn_close_show);
- if(typeof opts.btn_close_show != "undefined" && opts.btn_close_show != true) {
- $("#custom_modal_confirm #btn_custom_modal_confirm_close").hide();
- }
- //modal confirm
- $("#btn_custom_modal_confirm_proc").on("click", function() {
- $("#btn_custom_modal_confirm_cancel").unbind("click");
- $("#btn_custom_modal_confirm_proc").unbind("click");
- $("#btn_custom_modal_confirm_close").unbind("click");
- // console.log(1)
- if(typeof callback === 'function') {
- callback(true);
- }else {
- custom_modal_confirm_close();
- }
- });
- //modal cancel
- $("#btn_custom_modal_confirm_cancel").hide();
- $("#btn_custom_modal_confirm_cancel").on("click", function() {
- // console.log(2)
- $("#btn_custom_modal_confirm_cancel").unbind("click");
- $("#btn_custom_modal_confirm_proc").unbind("click");
- $("#btn_custom_modal_confirm_close").unbind("click");
- custom_modal_confirm_close();
- });
- //modal close
- $("#btn_custom_modal_confirm_close").on("click", function() {
- // console.log(3)
- $("#btn_custom_modal_confirm_cancel").unbind("click");
- $("#btn_custom_modal_confirm_proc").unbind("click");
- $("#btn_custom_modal_confirm_close").unbind("click");
- custom_modal_confirm_close();
- });
- }
- function viewLayerPopup(obj){
- var _this = $("."+obj + "_popup");
- var _thisW = _this.width() / 2;
- var _thisH = _this.height() / 2;
- _this.css('margin-left',-_thisW);
- _this.css('margin-top',-_thisH);
- _this.show();
- $("body").append("<div class='dim'></div>");
- }
- function closeLayerPopup(obj){
- $("." + obj + "_popup").hide();
- $(".dim").remove();
- }
- /**
- * console.log() 대용(콘솔 사용불가시 자바스크립트 오류발생 방지)
- **/
- function debugPrint(msg) {
- if (typeof console == 'object' && typeof console.log == 'function') {
- console.log(msg);
- }
- }
- /**
- * 필드 검사
- **/
- function check_field(fld, msg) {
- if((fld.value = trim(fld.value)) == '') {
- error_field(fld, msg);
- } else {
- clear_field(fld);
- }
- return;
- }
- /**
- * 필드 오류 표시
- **/
- function error_field(fld, msg) {
- if(msg != "") errmsg += msg + "\n";
- if(!errfld) errfld = fld;
- fld.style.background = "#BDDEF7";
- }
- /**
- * 필드를 깨끗하게
- **/
- function clear_field(fld) {
- fld.style.background = "#FFFFFF";
- }
- /**
- * @TODO 함수 설명 필요
- **/
- function trim(s) {
- var t = '';
- var from_pos = to_pos = 0;
- for(i = 0; i < s.length; i++) {
- if(s.charAt(i) == ' ') {
- continue;
- } else {
- from_pos = i;
- break;
- }
- }
- for(i = s.length; i >= 0; i--) {
- if(s.charAt(i - 1) == ' ') {
- continue;
- } else {
- to_pos = i;
- break;
- }
- }
- t = s.substring(from_pos, to_pos);
- return t;
- }
- /**
- * 자바스크립트로 PHP의 number_format 흉내를 냄
- * 숫자에 , 를 출력
- **/
- function number_format(data) {
- var tmp = '';
- var number = '';
- var cutlen = 3;
- var comma = ',';
- var i;
- len = data.length;
- mod = (len % cutlen);
- k = cutlen - mod;
- for(i = 0; i < data.length; i++) {
- number = number + data.charAt(i);
- if(i < data.length - 1) {
- k++;
- if((k % cutlen) == 0) {
- number = number + comma;
- k = 0;
- }
- }
- }
- return number;
- }
- /**
- * 새 창
- **/
- function popup_window(url, winname, opt) {
- window.open(url, winname, opt);
- }
- /**
- * a 태그에서 onclick 이벤트를 사용하지 않기 위해
- * @TODO 설명문구 수정
- **/
- function win_open(url, name, option) {
- var popup = window.open(url, name, option);
- popup.focus();
- }
- /**
- * 폼메일 창
- **/
- function popup_formmail(url) {
- opt = 'scrollbars=yes, width=417, height=385, top=10, left=20';
- popup_window(url, 'wformmail', opt);
- }
- /**
- * , 를 없앤다.
- * @TODO 문자열 치환하는데 왜 loop를 돌지?
- **/
- function no_comma(data) {
- var tmp = '';
- var comma = ',';
- var i;
- for(i = 0; i < data.length; i++) {
- if(data.charAt(i) != comma) tmp += data.charAt(i);
- }
- return tmp;
- }
- /**
- * 삭제 검사 확인
- **/
- function del(href) {
- if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
- document.location.href = href;
- }
- }
- /**
- * 쿠키 입력
- * @TODO 쿠키 플러그인으로 대체
- **/
- function set_cookie(name, value, expirehours, domain) {
- var today = new Date();
- today.setTime(today.getTime() + (60 * 60 * 1000 * expirehours));
- document.cookie = name + '=' + escape( value ) + '; path=/; expires=' + today.toGMTString() + ';';
- if(domain) {
- document.cookie += 'domain=' + domain + ';';
- }
- }
- /**
- * 쿠키 얻음
- * @TODO 쿠키 플러그인으로 대체
- **/
- function get_cookie(name) {
- var find_sw = false;
- var start, end;
- var i = 0;
- for(i = 0; i <= document.cookie.length; i++) {
- start = i;
- end = start + name.length;
- if(document.cookie.substring(start, end) == name) {
- find_sw = true;
- break;
- }
- }
- if(find_sw == true) {
- start = end + 1;
- end = document.cookie.indexOf(';', start);
- if(end < start) end = document.cookie.length;
- return document.cookie.substring(start, end);
- }
- return '';
- }
- /**
- * 쿠키 지움
- * @TODO 쿠키 플러그인으로 대체
- **/
- function delete_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();
- }
- }
- var last_id = null;
- /**
- * @TODO 함수설명 필요
- **/
- function menu(id) {
- if(id != last_id) {
- if(last_id != null) {
- jQuery('#' + last_id).hide();
- }
- jQuery('#' + id).show();
- last_id = id;
- } else {
- jQuery('#' + id).hide();
- last_id = null;
- }
- }
- /**
- * @TODO 함수설명 필요
- **/
- function textarea_decrease(id, row) {
- if(document.getElementById(id).rows - row > 0) {
- document.getElementById(id).rows -= row;
- }
- }
- /**
- * @TODO 함수설명 필요
- **/
- function textarea_original(id, row) {
- document.getElementById(id).rows = row;
- }
- /**
- * @TODO 함수설명 필요
- **/
- function textarea_increase(id, row) {
- document.getElementById(id).rows += row;
- }
- /**
- * 글숫자 검사
- * @TODO 함수설명 보완
- **/
- function check_byte(content, target) {
- var i = 0;
- var cnt = 0;
- var ch = '';
- var cont = document.getElementById(content).value;
- for(i = 0; i < cont.length; i++) {
- ch = cont.charAt(i);
- if(escape(ch).length > 4) {
- cnt += 2;
- } else {
- cnt += 1;
- }
- }
- // 숫자를 출력
- document.getElementById(target).innerHTML = cnt;
- return cnt;
- }
- /**
- * 브라우저에서 오브젝트의 왼쪽 좌표
- * @TODO jQuery 함수로 대체
- **/
- function get_left_pos(obj) {
- var parentObj = null;
- var clientObj = obj;
- var left = obj.offsetLeft;
- while((parentObj = clientObj.offsetParent) != null) {
- left = left + parentObj.offsetLeft;
- clientObj = parentObj;
- }
- return left;
- }
- /**
- * 브라우저에서 오브젝트의 상단 좌표
- * @TODO jQuery 함수로 대체
- **/
- function get_top_pos(obj) {
- var parentObj = null;
- var clientObj = obj;
- var top = obj.offsetTop;
- while((parentObj=clientObj.offsetParent) != null) {
- top = top + parentObj.offsetTop;
- clientObj = parentObj;
- }
- return top;
- }
- /**
- * @TODO 함수설명 필요
- **/
- function flash_movie(src, ids, width, height, wmode) {
- var wh = '';
- if(parseInt(width) && parseInt(height)) {
- wh = " width='"+width+"' height='"+height+"' ";
- }
- return "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "+wh+" id="+ids+"><param name=wmode value="+wmode+"><param name=movie value="+src+"><param name=quality value=high><embed src="+src+" quality=high wmode="+wmode+" type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash' "+wh+"></embed></object>";
- }
- /**
- * @TODO 함수설명 필요
- **/
- function obj_movie(src, ids, width, height, autostart) {
- var wh = "";
- if (parseInt(width) && parseInt(height))
- wh = " width='"+width+"' height='"+height+"' ";
- if (!autostart) autostart = false;
- return "<embed src='"+src+"' "+wh+" autostart='"+autostart+"'></embed>";
- }
- /**
- * @TODO 함수설명 필요
- **/
- function doc_write(cont) {
- document.write(cont);
- }
- String.prototype.trim = function() {
- return this.replace(/^\s+|\s+$/g, '');
- }
- String.prototype.ltrim = function() {
- return this.replace(/^\s+/, '');
- }
- String.prototype.rtrim = function() {
- return this.replace(/\s+$/, '');
- }
- /**
- * 한글, 영문, 숫자 검사
- **/
- function chk_hanalnum(s) {
- var pattern = /([^가-힣ㄱ-ㅎㅏ-ㅣ^a-z^0-9])/i;
- return pattern.test(s);
- }
- /**
- *도메인 체크
- */
- function chk_url(s) {
- var pattern =/^((http(s?))\:\/\/)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/;
- return pattern.test(s);
- }
- /**
- * 이메일주소 검사
- **/
- function chk_email(s) {
- var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
- return pattern.test(s);
- }
- function chk_date(s){
- var pattern = /[0-9]{4}-[0-9]{2}-[0-9]{2}/;
- return pattern.test(s);
- }
- /**
- * 전화번호
- **/
- function chk_hp(s) {
- var pattern = /^(01[016789]{1}|02|0[3-9]{1}[0-9]{1})-?[0-9]{3,4}-?[0-9]{4}$/;
- return pattern.test(s);
- }
- function chk_tel(s) {
- var pattern = /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/;
- return pattern.test(s);
- }
- /**
- * 포인트 창
- **/
- var win_point = function(href) {
- var new_win = window.open(href, 'win_point', 'left=100,top=100,width=600, height=600, scrollbars=1');
- new_win.focus();
- }
- /**
- * 쪽지 창
- **/
- var win_memo = function(href) {
- var new_win = window.open(href, 'win_memo', 'left=100,top=100,width=620,height=500,scrollbars=1');
- new_win.focus();
- }
- /**
- * 메일 창
- **/
- var win_email = function(href) {
- var new_win = window.open(href, 'win_email', 'left=100,top=100,width=600,height=580,scrollbars=0');
- new_win.focus();
- }
- /**
- * 우편번호 창
- **/
- var win_zip = function(href) {
- var new_win = window.open(href, 'win_zip', 'width=616, height=460, scrollbars=1');
- new_win.focus();
- }
- // 게시물 이름 클릭하면 나오는 레이어
- var div_sidebox = null;
- jQuery(function($) {
- $('.win_point').click(function() {
- win_point(this.href);
- return false;
- });
- $('.win_memo').click(function() {
- win_memo(this.href);
- return false;
- });
- $('.win_email').click(function() {
- win_email(this.ref);
- return false;
- });
- $('.win_scrap').click(function() {
- win_scrap(this.href);
- return false;
- });
- $('.win_profile').click(function() {
- win_profile(this.ref);
- return false;
- });
- $('.win_homepage').click(function() {
- win_homepage(this.ref);
- return false;
- });
- $('.win_zip_find').click(function() {
- win_zip(this.href);
- return false;
- });
- $('.win_password_lost').click(function() {
- win_password_lost(this.href);
- return false;
- });
- $('.win_poll').click(function() {
- win_poll(this.href);
- return false;
- });
- //==========================================================================
- // 게시물 이름 레이어
- //--------------------------------------------------------------------------
- div_sidebox = document.createElement('DIV');
- div_sidebox.id = 'sidebox';
- div_sidebox.style.display = 'none';
- div_sidebox.style.position = 'absolute';
- document.body.appendChild(div_sidebox);
- var click_document_area = false;
- document.onclick = function() {
- if(!click_document_area) {
- div_sidebox.style.display = 'none';
- } else {
- click_document_area = false;
- }
- }
- $('.sidebox').bind('click', function() {
- var $this = $(this);
- click_document_area = true;
- var top = $this.offset().top;
- var left = $this.offset().left;
- var width = $this.width();
- var height = $this.height();
- $('#sidebox').css({'top' : top + height / 3, 'left' : left + width - 5});
- var aflds = this.rel.split('&');
- var fld;
- for(var i = 0; i < aflds.length; i++) {
- fld = aflds[i].split('=');
- eval('var ' + fld[0] + ' = "' + fld[1] + '";');
- }
- var html = '';
- var first = ' class="first-child"';
- // 쪽지보내기
- if(mb_id) {
- html += "<li"+first+"><a href=\"javascript:win_memo('"+g4_bbs_path+"/memo_form.php?me_recv_mb_id="+mb_id+"');\" class='win_memo'>쪽지보내기</a></li>";
- first = '';
- }
- // 메일보내기
- if(email) {
- html += "<li"+first+"><a href=\"javascript:win_email('"+g4_bbs_path+"/formmail.php?email="+email+"');\" class='win_email'>메일보내기</a></li>";
- first = '';
- }
- // 홈페이지
- if(homepage) {
- html += "<li"+first+"><a href=\"javascript:win_homepage('"+homepage+"');\" class='win_homepage'>홈페이지</a></li>";
- first = '';
- }
- // 자기소개
- if(mb_id) {
- html += "<li"+first+"><a href=\"javascript:win_profile('"+g4_bbs_path+"/profile.php?mb_id="+mb_id+"');\" class='win_profile'>자기소개</a></li>";
- first = '';
- }
- // 아이디로 검색, 이름으로 검색
- if(g4_bo_table) {
- if(mb_id) {
- html += "<li"+first+"><a href=\""+g4_bbs_path+"/board.php?bo_table="+g4_bo_table+"&sca="+g4_sca+"&sfl=mb_id,1&stx="+mb_id+"\">아이디로 검색</a></li>";
- }
- html += "<li"+first+"><a href=\""+g4_bbs_path+"/board.php?bo_table="+g4_bo_table+"&sca="+g4_sca+"&sfl=wr_name,1&stx="+encodeURIComponent(name)+"\">이름으로 검색</a></li>";
- first = '';
- }
- // 전체게시물
- if(mb_id) {
- html += "<li"+first+"><a href=\""+g4_bbs_path+"/new.php?mb_id="+mb_id+"\">전체게시물</a></li>";
- first = '';
- }
- // 최고관리자일 경우
- if(g4_is_admin == 'super') {
- if(mb_id) {
- // 회원정보변경
- html += "<li"+first+"><a href=\""+g4_path+"/" + g4_admin + "/member_form.php?w=u&mb_id="+mb_id+"\">회원정보변경</a></li>";
- // 포인트내역
- html += "<li"+first+"><a href=\""+g4_path+"/" + g4_admin + "/point_list.php?sfl=mb_id&stx="+mb_id+"\">포인트내역</a></li>";
- first = "";
- }
- }
- if(html) {
- html = '<div class="sideview"><ul>' + html + '</ul></div>';
- $('#sidebox').html(html).show('fast');
- }
- });
- // 배경색상 변경
- $('.board_list tbody tr:odd, .table_list tbody tr:odd' ).addClass('list_odd');
- $('.board_list tbody tr:even, .table_list tbody tr:even').addClass('list_even');
- $('.board_list tbody tr, .table_list tbody tr').toggleClass('mouse_over');
- //==========================================================================
- // @FIXME 자동완성 기능을 왜 죄다 꺼버리는가?
- $('form').each(function(i) {
- $(this).attr('autocomplete', 'off');
- });
- });
- //메인메뉴 롤오버 이미지처리
- $(function() {
- $(".gnbSub").hide(); // 2뎁스 메뉴를 모두 숨김
- $(".gnbMain").hover(function(){
- var Img = $(this).contents().contents("img").attr("src").replace("_off.", "_on."); // 1뎁스 이미지명을 찾아서 변경하여 변수에 저장
- $(this).contents().contents("img").attr("src", Img); // 이미지명을 저장한 변수값으로 변경
- $(this).contents("ul").slideDown("fast"); // 2뎁스 노출
- },
- function(){
- var Img = $(this).contents().contents("img").attr("src").replace("_on.", "_off."); // 1뎁스 이미지명을 찾아서 변경하여 변수에 저장
- $(this).contents().contents("img").attr("src", Img); // 이미지명을 저장한 변수값으로 변경
- $(this).contents("ul").slideUp("fast");// 2뎁스 숨김
- });
- $(".gnbSub li").each(function(e){
- $(this).mouseenter(function(e){
- var subImg = $(this).contents().contents("img").attr("src").replace("_off.", "_on.");
- $(this).contents().contents("img").attr("src", subImg);
- });
- $(this).mouseleave(function(e){
- var subImg = $(this).contents().contents("img").attr("src").replace("_on.", "_off.");
- $(this).contents().contents("img").attr("src", subImg);
- });
- });
- });
- // 왼쪽사이드바 서브메뉴 롤오버 이미지처리
- $(function() {
- $(".snbSub").hide(); // 2뎁스 메뉴를 모두 숨김
- $(".snbMain").hover(function(){
- var Img = $(this).contents().contents("img").attr("src").replace("_off.", "_on."); // 1뎁스 이미지명을 찾아서 변경하여 변수에 저장
- $(this).contents().contents("img").attr("src", Img); // 이미지명을 저장한 변수값으로 변경
- $(this).contents("ul").slideDown("fast"); // 2뎁스 노출
- },
- function(){
- var Img = $(this).contents().contents("img").attr("src").replace("_on.", "_off."); // 1뎁스 이미지명을 찾아서 변경하여 변수에 저장
- $(this).contents().contents("img").attr("src", Img); // 이미지명을 저장한 변수값으로 변경
- $(this).contents("ul").slideUp("fast");// 2뎁스 숨김
- });
- $(".snbSub li").each(function(e){
- $(this).mouseenter(function(e){
- var subImg = $(this).contents().contents("img").attr("src").replace("_off.", "_on.");
- $(this).contents().contents("img").attr("src", subImg);
- });
- $(this).mouseleave(function(e){
- var subImg = $(this).contents().contents("img").attr("src").replace("_on.", "_off.");
- $(this).contents().contents("img").attr("src", subImg);
- });
- });
- });
- // rollover이미지 처리 : right_sidebar
- $(function(){
- $("img.rollover").mouseover(function(){
- $(this).attr("src",$(this).attr("src").replace("_off.", "_on."));
- }).mouseout(function(){
- $(this).attr("src",$(this).attr("src").replace("_on.", "_off."));
- }).each(function(){
- $("<img>").attr("src",$(this).attr("src").replace("_off.", "_on."));
- });
- });
- //패밀리사이트
- $(function() {
- $("#family_site").hide();
- $(".family").click(function(){
- $("#family_site").slideDown();
- $("#family_site").mouseleave(function(){closeFamily();return false;})
- }
- );
- $("#family_site a.close").click(function(){closeFamily();return false;});
- $("#family_site").hover(
- function(){
- $("#family_site").slideDown();
- },function(){
- closeFamily();return false;
- }
- );
- });
- function closeFamily(){
- $("#family_site").slideUp();
- }
- //슬라이딩배너
- //new Floating(적용할개체 , X축여백 , Y축여백 , 미끄러지는속도:작을수록빠름..기본20 , 빠르기:작을수록부드러움..기본10);
- function Floating(FloatingObj,MarginX,MarginY,Percentage,setTime) {
- this.FloatingObj = FloatingObj;
- this.MarginX = (MarginX) ? MarginX : 0;
- this.MarginY = (MarginY) ? MarginY : 0;
- //this.MarginX = document.getElementById('body_cus').offsetLeft + 985;
- this.Percentage = (Percentage) ? Percentage : 15;
- this.setTime = (setTime) ? setTime : 10;
- this.FloatingObj.style.position = "absolute";
- this.Body = null;
- this.setTimeOut = null;
- this.Run();
- }
- Floating.prototype.Run = function () {
- if ((document.documentElement.scrollLeft + document.documentElement.scrollTop) > (document.body.scrollLeft + document.body.scrollTop)) {
- this.Body = document.documentElement;
- } else {
- this.Body = document.body;
- }
- var This = this;
- var FloatingObjLeft = (this.FloatingObj.style.left) ? parseInt(this.FloatingObj.style.left,10) : this.FloatingObj.offsetLeft;
- var FloatingObjTop = (this.FloatingObj.style.top) ? parseInt(this.FloatingObj.style.top,10) : this.FloatingObj.offsetTop;
- var DocLeft = this.MarginX;
- var DocTop = this.Body.scrollTop + this.MarginY;
- var MoveX = Math.abs(FloatingObjLeft - DocLeft);
- MoveX = Math.ceil(MoveX / this.Percentage);
- var MoveY = Math.abs(FloatingObjTop - DocTop);
- MoveY = Math.ceil(MoveY / this.Percentage);
- if (FloatingObjLeft < DocLeft) {
- this.FloatingObj.style.left = FloatingObjLeft + MoveX + "px";
- } else {
- this.FloatingObj.style.left = FloatingObjLeft - MoveX + "px";
- }
- if (FloatingObjTop < DocTop) {
- this.FloatingObj.style.top = FloatingObjTop + MoveY + "px";
- } else {
- this.FloatingObj.style.top = FloatingObjTop - MoveY + "px";
- }
- window.clearTimeout(this.setTimeOut);
- this.setTimeOut = window.setTimeout(function () { This.Run(); },this.setTime);
- }
- /* 공통 함수 */
- String.prototype.trim = function() {
- return this.replace(/\s/g, "");
- }
- String.prototype.IsNumber = function()
- {
- return (/^[0-9]+$/).test();
- }
- /* Byte계산 */
- String.prototype.bytes = function() {
- var str = this;
- var len = 0;
- for (var i = 0; i < str.length; i++) {
- len += (str.charCodeAt(i) > 128) ? 2 : 1;
- }
- return len;
- }
- //문자열자르기
- String.prototype.cut = function(len) {
- var str = this;
- var s = 0;
- for (var i = 0; i < str.length; i++) {
- s += (str.charCodeAt(i) > 128) ? 2 : 1;
- if (s > len) {
- return str.substring(0,i);
- }
- }
- return str;
- }
- //시간형태 체크 24시
- function timechk(value) {
- var input = String(value);
- var pattern = /([0-2][0-3])(h|:)([0-5][0-9])/g;
- return pattern.test(input);
- }
- function popupCenter(URL,w, h, s, r) {
- width=screen.width;
- height=screen.height;
- x=(width/2)-(w/2);
- y=(height/2)-(h/2);
- opt = "left=" + x + ", top=" + y + ", width=" + w + ", height=" + h;
- opt = opt + ", toolbar=no,location=no,directories=no,status=no,menubar=no";
- opt = opt + ",scrollbars=" + s;
- opt = opt + ",resizable=" + r;
- window.open(URL, "_blank", opt);
- }
- //<a href="javascript:popupCenter('URL','463','237','no','no');">가운데띄우기</a>
- // 숫자, 영문 체크
- var alpha_numeric = new String("0123456789abcdefghijklmnopqrstuvwxyz.")
- function fnCheckAlphaNumber(str) {
- var rtrn;
- for(j = 0 ; j < str.length; j++) {
- rtn = fnIsAlphaNumeric(str.charAt(j))
- if(rtn == false) {
- return rtn;
- }
- }
- return rtn;
- }
- function fnIsAlphaNumeric(cha1) {
- for(i=0;i<alpha_numeric.length;i++) {
- if(alpha_numeric.charAt(i) == cha1)
- return true;
- }
- return false;
- }
- function isStrongValidFormPassword(val) {
- var check = /^(?=.*[a-zA-Z])(?=.*[!@#$%^*+=-])(?=.*[0-9]).{6,16}$/;
- if (!check.test(val)) {
- alert("비밀번호는 문자, 숫자, 특수문자의 조합으로 입력해주세요.");
- return false;
- }
- if (val.length < 6 || val.length > 16) {
- alert("비밀번호는 6 ~ 16 자리로 입력해주세요.");
- return false;
- }
- return true;
- }
- /*--------------------------------------------------------------
- form 문자열 입력 확인
- 사용법 : fnCheckForm(fieldlist)
- . fieldlist : 배열["form elements", "이름"]
- --------------------------------------------------------------*/
- function fnCheckForm(fieldlist, locale) {
- var add_check_elements = ["checkbox", "radio"];
- if(locale==null || locale==""){locale=="ko";}
- for (i = 0; i < fieldlist.length; i++) {
- var frm = document.getElementById(fieldlist[i][0]);
- //checkbox, radio 는 체크 하지 못해 수정
- if(frm != null) {
- if(frm.value == ""){
- if(locale=="en"){
- alert("Please Check " + fieldlist[i][1]);
- }else{
- // alert(fieldlist[i][1] + "을(를) 확인하세요.1");
- var custom_opts = {
- id : fieldlist[i][0],
- title : fieldlist[i][1] + "을(를) 확인하세요.",
- btn_close_show : false, //닫기 버튼 안보이게
- }
- custom_modal_alert(custom_opts, function() {
- custom_modal_alert_close();
- if(frm.type != "hidden"){
- frm.focus();
- }
- });
- }
- return false;
- }
- // console.log("null");
- }else {
- var $el = $("input[name="+fieldlist[i][0]+"]");
- if($el.length > 0 && $.inArray($el.prop("type"), add_check_elements)) {
- var val = "";
- switch ($el.prop("type")) {
- case "radio":
- case "checkbox":
- val = $("input[name="+fieldlist[i][0]+"]:checked").val();
- $("input[name="+fieldlist[i][0]+"]").eq(0).focus();
- break;
- default:
- break;
- }
- if($.trim(val) == "") {
- if(locale=="en"){
- alert("Please Check " + fieldlist[i][1]);
- }else{
- // alert(fieldlist[i][1] + "을(를) 확인하세요.");
- var custom_opts = {
- id : fieldlist[i][0],
- title : fieldlist[i][1] + "을(를) 확인하세요.",
- btn_close_show : false, //닫기 버튼 안보이게
- }
- custom_modal_alert(custom_opts, function() {
- custom_modal_alert_close();
- if(frm.type != "hidden"){
- frm.focus();
- }
- });
- }
- return false;
- }
- }
- }
- }
- return true;
- }
- // 쿠키생성
- function fnSetCookie(name, value, expiredays,domain ){
- var today = new Date();
- today.setDate( today.getDate() + expiredays );
- var cook = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
- if (domain) cook += "domain=" + domain + ";";
- document.cookie = cook;
- }
- // 쿠키값 확인
- function fnGetCookie( 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 fnDeleteCookie(cookieName)
- {
- var expireDate = new Date();
- //어제 날짜를 쿠키 소멸 날짜로 설정한다.
- expireDate.setDate( expireDate.getDate() - 1 );
- document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
- }
- function fnShowLoading(sEl) {
- $('#'+ sEl).html('<img src="/images/common/loading.gif" />');
- }
- // ajax 가 처리되는 동안 진행되는 작업
- var objLoadingHandlers = {
- onCreate: function() {
- if($(sDiv))
- Element.show(sDiv);
- }
- , onComplete: function() {
- if(Ajax.activeRequestCount == 0) {
- if($(sDiv))
- Element.hide(sDiv);
- }
- }
- }
- // ajax가 처리되는 동안 처리되는 작업을 등록
- //Ajax.Responders.register(objLoadingHandlers);
- // nodevalue 가져오기
- function fnGetNodeValue(oXml, oNode){
- var pNode = oXml.getElementsByTagName(oNode);
- if(pNode[0]){
- if(pNode[0].childNodes[0])
- return pNode[0].childNodes[0].nodeValue;
- else
- return "";
- }else{
- return "";
- }
- }
- // child nodevalue 가져오기
- function fnGetChildNodeValue(oNode) {
- if(oNode.childNodes[0])
- return oNode.childNodes[0].nodeValue;
- else
- return "";
- }
- // select box 만들기
- function fnSetXmlSelectList(oXML, oSelect, iStart) {
- if(!iStart || iStart == "undefined") {
- iStart = 1;
- } else {
- iStart = parseInt(iStart);
- }
- var pNode = oXML.getElementsByTagName("itemlist");
- var id = null;
- var desc = null;
- var objSelect = document.getElementById(oSelect) ? document.getElementById(oSelect) : false;
- if(objSelect) fnSetInitSelect(objSelect, iStart);
- for(i = 0; i < pNode.length; i++) {
- var cNode = pNode[i].childNodes;
- for(j = 0; j < cNode.length; j++) {
- if(cNode[j].nodeName == "id") id = fnGetChildNodeValue(cNode[j]);
- if(cNode[j].nodeName == "desc") desc = fnGetChildNodeValue(cNode[j]);
- }
- if(objSelect) {
- var option = new Option(desc, id);
- objSelect.options[i + iStart] = option;
- }
- }
- }
- // select box 초기화
- function fnSetInitSelect(obj, iStart) {
- if(obj) {
- if(obj.options) {
- for(i = obj.options.length - 1; i >= iStart; i--) {
- obj.options[i] = null;
- }
- }
- }
- }
- // checkbox 선택
- function fnSetCheckAll(objCheck, objTarget) {
- var obj = document.getElementsByName(objTarget);
- for(var i = 0; i < obj.length; i ++) {
- if(document.getElementById(objCheck).checked) {
- obj[i].checked = true;
- } else {
- obj[i].checked = false;
- }
- }
- }
- // 위 함수랑 이름이 같아서 오류 발생함
- // function fnSetCheckAll(objTarget) {
- // var obj = document.getElementsByName(objTarget);
- // for(var i = 0; i < obj.length; i ++) {
- // obj[i].checked = true;
- // }
- // }
- // 체크박스 체크한 개수
- function fnGetCheckCnt(obj) {
- var iCnt = 0;
- var o = document.getElementsByName(obj);
- for(var i = 0; i < o.length; i ++) {
- if(o[i].checked) iCnt ++;
- }
- return iCnt;
- }
- //체크박스 체크값 가져 온다,
- function fnGetCheckVal(obj){
- var strVal='';
- var o = document.getElementsByName(obj);
- for(var i = 0; i < o.length; i ++) {
- if(o[i].checked) strVal= o[i].value;
- }
- return strVal;
- }
- // 올바른 날짜인지 확인
- // 날짜는 yyyy-mm-dd 또는 yyyymmdd 형식으로 입력되어져야 함
- function fnCheckDate(obj) {
- var sValue = obj.value.replace(/-/g,"");
- var iYear = sValue.substr(0, 4);
- var iMonth = sValue.substr(4, 2) - 1;
- var iDay = sValue.substr(6, 2);
- var newDate = new Date(iYear, iMonth, iDay);
- // 입력받은 값과 새로 생성된 날짜를 비교
- if(iYear != newDate.getFullYear()
- || iMonth != newDate.getMonth()
- || iDay != newDate.getDate()) {
- obj.value = "";
- return false;
- } else {
- obj.value = iYear +"-"+ sValue.substr(4, 2) +"-"+ iDay;
- return true;
- }
- }
- //교사팝업 외부 인터페이스
- //플래시 메뉴와 인터페이스시 이용한다.
- function getCookie(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 fnInstallquickLink(){
- alert("퀵메뉴 설치 됩니다");
- var WshShell = new ActiveXObject("WScript.Shell");
- strDesktop = WshShell.SpecialFolders("Desktop");
- var oURLLink = WshShell.CreateShortcut(strDesktop + "\\\\Dogfoot.URL");
- oURLLink.TargetPath = "http://www.readingwell.com";
- oURLLink.Save();
- }
- //DIV영역만 프린트
- function printIt(printThis){
- var win = window.open();
- win.document.open();
- win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>');
- win.document.write('body, td { font-family: Verdana; font-size: 10pt;}');
- win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>');
- win.document.write(printThis);
- win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>');
- win.document.close();
- win.print();
- win.close();
- }
- // 특정영역만 프린트2
- function fnPrintDiv(sDiv){
- var win = window.open('about:blank', '', 'width=670, height=500, scrollbars=yes');
- win.document.open();
- win.document.write('<html><head>');
- win.document.write('<link rel="stylesheet" type="text/css" href="/inc/css/style.css" />');
- win.document.write('<link rel="stylesheet" type="text/css" href="/inc/css/board.css" />');
- win.document.write('</head><body>');
- win.document.write($(sDiv).innerHTML);
- win.document.write('<s'+'cript language="j'+'avascript" type="text/ja'+'vascript">document.getElementById("copy_btn").style.display = "none";</s'+'cript>');
- //win.document.write('<s'+'cript language="j'+'avascript" type="text/ja'+'vascript"></s'+'cript>');
- win.document.write('</body><html>');
- win.document.close();
- win.print();
- win.close();
- }
- // 특정영역만 관리자
- function fnPrintDivAdmin(sDiv){
- var win = window.open('about:blank', '', 'width=670, height=500, scrollbars=yes');
- win.document.open();
- win.document.write('<html><head>');
- win.document.write('<link rel="stylesheet" type="text/css" href="/admin/inc/css/style.css" />');
- win.document.write('<link rel="stylesheet" type="text/css" href="/admin/inc/css/board.css" />');
- win.document.write('</head><body>');
- win.document.write($(sDiv).innerHTML);
- win.document.write('</body><html>');
- win.document.close();
- win.print();
- win.close();
- }
- /***************************************************************
- * COMMON CHECK
- **************************************************************/
- // 공백체크
- function chkSpace( str ){
- if(str.search(/\s/) != -1){
- return false;
- } else {
- return true;
- }
- }
- // 특수문자 체크
- function checkSpecialChar(expression) {
- var strSpecial = ",`~#$%^&*()_+|\;\\/:=-<>.'\"";
- for(i=0;i<expression.length;i++){
- for(j=0;j<strSpecial.length;j++){
- if(expression.charAt(i) == strSpecial.charAt(j)){
- return false;
- }
- }
- }
- return true;
- }
- /***************************************************************
- * 숫자만 체크 확인
- ***************************************************************/
- function ChkNum(x){
- var var_normalize = /[^0-9]/gi;
- //정규식
- if(var_normalize.test(x) == true){
- return false;
- }else{
- return true;
- }
- }
- //아이디 입력시 한글, 특수문자 체크
- function h_check(Objectname) {
- var intErr;
- var strValue = Objectname;
- var retCode = 0;
- var re = /[~!@\#$%<>^&*\()\-=+_\']/gi; //특수문자 정규식 변수 선언
- for (i = 0; i < strValue.length; i++) {
- var retCode = strValue.charCodeAt(i);
- var retChar = strValue.substr(i,1).toUpperCase();
- retCode = parseInt(retCode);
- //입력받은 값중에 한글이 있으면 에러
- if ((retChar < "0" || retChar > "9") && (retChar < "A" || retChar > "Z") && ((retCode > 255) || (retCode < 0)) ) {
- intErr = -1;
- break;
- //입력받은 값중에 특수문자가 있으면 에러
- } else if(re.test(strValue)) {
- intErr = -1;
- break;
- }
- }
- return (intErr);
- }
- function han_check(Objectname) {
- var intErr;
- var strValue = Objectname;
- var retCode = 0;
- for (i = 0; i < strValue.length; i++) {
- var retCode = strValue.charCodeAt(i);
- var retChar = strValue.substr(i,1).toUpperCase();
- retCode = parseInt(retCode);
- //입력받은 값중에 한글이 있으면 에러
- if ((retChar < "0" || retChar > "9") && (retChar < "A" || retChar > "Z") && ((retCode > 255) || (retCode < 0)) ) {
- intErr = -1;
- break;
- }
- }
- return (intErr);
- }
- /*주민번호 체크 JS*/
- function jumin_check(jumin1, jumin2) {
- var er = 0;
- var erm = "주민등록 번호가 잘못되었습니다.";
- var rm = "주민등록번호를 확인하였습니다.";
- var l1 = jumin1;
- var l2 = jumin2;
- if (l1 != 6 || l2 != 7) er=1;
- if (Number(jumin1) == NaN || Number(jumin2) == NaN) er=1;
- var dfdf = jumin1.split(".");
- var fdfd = jumin2.split(".");
- if (dfdf[1] || dfdf[1]){
- er=1;
- }
- var array1 = jumin1.split("");
- var array2 = jumin2.split("");
- var y = array1[0]+array1[1];
- if (Number(array1[2]) == 0) {
- var m = array1[3];
- }
- else if (Number(array1[2])==1){
- var m = array1[2]+array1[3];
- }
- else{
- er=1;
- }
- if (Number(m)>12 || Number(m)<1){
- er=1;
- }
- if (Number(array1[4]) == 0){
- var d = array1[5];
- }else{
- var d = array1[4]+array1[5];
- }
- var f = 0;
- if (Number(y)%4 == 0 && Number(y)%1000 != 0){
- f = 1;
- }
- if (f == 0){
- var ererr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
- }else if(f == 1){
- var ererr = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
- }
- else{
- er=1;
- }
- if (ererr[m-1] < Number(d)) {
- er=1;
- }
- var now = new Date();
- var ny = now.getYear();
- var nm = now.getMonth()+1;
- var nd = now.getDate();
- nc = Math.floor(ny/100)+1-20;
- if (Number(array2[0]) != s_minus(nc, 2) && Number(array2[0]) != s_minus(nc, 1) && Number(array2[0]) != nc && Number(array2[0]) != s_plus(nc, 1) && Number(array2[0]) != s_plus(nc, 2) && Number(array2[0]) != s_plus(nc, 3)){
- er=1;
- }
- nc += 20;
- y = changeC(nc, Number(array2[0]))+y;
- if (ny < Number(y)){
- er=1;
- }
- if (ny == Number(y) && nm < Number(m)){
- er=1;
- }
- if (ny == Number(y) && nm == Number(m) && nd < Number(d)){
- er=1;
- }
- var num=(Number(array1[0])*2)+(Number(array1[1])*3)+(Number(array1[2])*4)+(Number(array1[3])*5)+(Number(array1[4])*6)+(Number(array1[5])*7)+(Number(array2[0])*8)+(Number(array2[1])*9)+(Number(array2[2])*2)+(Number(array2[3])*3)+(Number(array2[4])*4)+(Number(array2[5])*5);
- num=11-(num%11)
- var check=num%10
- if (check != Number(array2[6])){
- er=1;
- }
- if (er==1) {
- alert(erm);
- return false;
- } else if (er==0) {
- return true;
- } else {
- alert(erm);
- return false;
- }
- }
- function s_minus(a, b) {
- var r = a-b;
- while(1) {
- if (r<0){
- r+=10;
- }
- else if(r>=10) {
- r-=10;
- }
- else{
- break;
- }
- }
- return r;
- }
- function s_plus(a, b) {
- var r = a+b;
- while(1) {
- if (r<0){
- r+=10;
- }else if (r>=10) {
- r-=10;
- }else {
- break;
- }
- }
- return r;
- }
- function changeC(nc, s) {
- while(1) {
- if ((nc%5) != 4){
- nc--;
- }else {
- break;
- }
- }
- var ret = nc+s/2-1;
- ret = ""+ret;
- return ret;
- }
- function onlyNumber2(loc) {
- if(/[^0123456789]/g.test(loc.value)) {
- return false;
- }else{
- return true;
- }
- }
- // 숫자만 입력 가능
- function fnOnlyNumber(e) {
- if (!e) var e = window.event;
- // 숫자입력이 아닌 경우
- if((e.keyCode < 48)||(e.keyCode > 57)) {
- // key 패드에서 숫자입력이 아닌 경우
- if((e.keyCode < 96) || (e.keyCode > 105)) {
- // backspace, tab 허용
- if(e.keyCode != 8 && e.keyCode != 9) {
- if (e.preventDefault) {
- e.preventDefault(); // firefox/모질라에서 event 발생시 자체 제공하는 특별기능 끄기.
- } else {
- e.returnValue = false; // IE에서 event 발생시 자체 제공하는 특별기능 끄기.
- }
- }
- }
- }
- }
- //기타벨리데이션 체크
- //정규식타입 케이스별...
- //사용법 isValid('amma76@test.com','regEmail');
- function isValid(field, regExp){
- var regNumber = /^[0-9]+$/; // 숫자
- var regAlphabet = /^[a-zA-Z]+$/; // 알파벳(대문자,소문자)
- var regAlphabetCapital = /^[A-Z]+$/; // 알파벳(대문자)
- var regKorean = /^[가-힣]*$/; // 한글
- var regPhone = /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/; // 집전화
- var regMobilePHone = /^[0-9]{3}-[0-9]{3,4}-[0-9]{4}$/; // 휴대폰
- var regEmail =/^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i; // 이메일
- var regDomain = /^[.a-zA-Z0-9-]+.[a-zA-Z]+$/; // 도메인
- var regIp = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; // IP
- var result = false;
- var fieldValue = field;
- pattern = eval(regExp);
- result = pattern.test(fieldValue);
- return result;
- }
- /**
- * 포커스 자동이동
- *
- * @param id_from - 현재 인풋박스 id
- * @param id_to - 포커스 이동될 인풋 박스 id
- * @param maxSize - 인풋박스에 입력될 글자수
- * 사용예 <input type="text" id="a" onkeyup="moveNext('a','b',6);"> <input type="text" id="b"">
- * 6글자 입력후 포커스가 id=b 인풋 박스로 이동된다.
- ***/
- var next_go = true;
- var cur_val = null;
- function moveNext(id_from,id_to,maxSize) {
- var cur = document.getElementById(id_from).value;
- curSize = cur.length;
- if (curSize == maxSize) {
- if(next_go || cur_val != cur)
- {
- cur_val = cur;
- next_go = false;
- document.getElementById(id_to).focus();
- }
- return true;
- }
- next_go = true;
- }
- /**
- * 두 날짜의 차이를 일자로 구한다.(조회 종료일 - 조회 시작일)
- *
- * @param val1 - 조회 시작일(날짜 ex.2002-01-01)
- * @param val2 - 조회 종료일(날짜 ex.2002-01-01)
- * @return 기간에 해당하는 일자
- */
- function calDateRange(val1, val2)
- {
- var FORMAT = "-";
- // FORMAT을 포함한 길이 체크
- if (val1.length != 10 || val2.length != 10)
- return null;
- // FORMAT이 있는지 체크
- if (val1.indexOf(FORMAT) < 0 || val2.indexOf(FORMAT) < 0)
- return null;
- // 년도, 월, 일로 분리
- var start_dt = val1.split(FORMAT);
- var end_dt = val2.split(FORMAT);
- // 월 - 1(자바스크립트는 월이 0부터 시작하기 때문에...)
- // Number()를 이용하여 08, 09월을 10진수로 인식하게 함.
- start_dt[1] = (Number(start_dt[1]) - 1) + "";
- end_dt[1] = (Number(end_dt[1]) - 1) + "";
- var from_dt = new Date(start_dt[0], start_dt[1], start_dt[2]);
- var to_dt = new Date(end_dt[0], end_dt[1], end_dt[2]);
- return (to_dt.getTime() - from_dt.getTime()) / 1000 / 60 / 60 / 24;
- }
- //사업자번호체크
- function fnChkBNo(vencod) {
- var sum = 0;
- var getlist =new Array(10);
- var chkvalue =new Array("1","3","7","1","3","7","1","3","5");
- for(var i=0; i<10; i++) { getlist[i] = vencod.substring(i, i+1); }
- for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
- sum = sum + parseInt((getlist[8]*5)/10);
- sidliy = sum % 10;
- sidchk = 0;
- if(sidliy != 0) { sidchk = 10 - sidliy; }
- else { sidchk = 0; }
- if(sidchk != getlist[9]) { return false; }
- return true;
- }
- //외국인체크
- function fnChkFNo(fgnno) {
- var sum=0;
- var odd=0;
- buf = new Array(13);
- for(i=0; i<13; i++) { buf[i]=parseInt(fgnno.charAt(i)); }
- odd = buf[7]*10 + buf[8];
- if(odd%2 != 0) { return false; }
- if( (buf[11]!=6) && (buf[11]!=7) && (buf[11]!=8) && (buf[11]!=9) ) {
- return false;
- }
- multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
- for(i=0, sum=0; i<12; i++) { sum += (buf[i] *= multipliers[i]); }
- sum = 11 - (sum%11);
- if(sum >= 10) { sum -= 10; }
- sum += 2;
- if(sum >= 10) { sum -= 10; }
- if(sum != buf[12]) { return false }
- return true;
- }
- //동영상/스틸컷 팝업
- function fnOpenPopup(type,seq){
- var windowW = "855";
- var windowH = "577";
- var windowX = (screen.width/2)-(windowW/2);
- var windowY = (screen.height/2)-(windowH/2);
- var urlPop1 = "/common/popup/pop_photo.asp"; //스틸컷
- var urlPop2 = "/common/popup/pop_movie.asp"; //동영상
- var cineSeq = "?seq="+seq
- //var style = "width=845, height=505, scrollbars=no, left="+windowX+", top="+windowY;
- var style = "width=880, height=606, scrollbars=no, left="+windowX+", top="+windowY;
- if (type == "1"){ //1:스틸컷,2:동영상
- window.open(urlPop1+cineSeq,"스틸컷",style);
- }else{
- window.open(urlPop2+cineSeq,"동영상",style);
- }
- }
- //즐겨찾기추가
- function favoritesite(){
- window.external.AddFavorite(strWasURL, '엔초코');
- }
- //문자열길이 체크 함수
- function CalByte3(tg,objMax, objNow){
- var curText;
- var strLen;
- var byteIs;
- var lastByte;
- var thisChar;
- var escChar;
- var curTotalMsg;
- var okMsg;
- var _size = objMax.html();
- curText = new String(tg.val());
- strLen = curText.length;
- byteIs = 0;
- for(i=0; i<strLen; i++) {
- thisChar = curText.charAt(i);
- escChar = escape(thisChar);
- // ´,¨, ¸ : 2byte 임에도 브라우져에서 1byte로 계산
- if (thisChar == "´" || thisChar == "¨" || thisChar == "¸" || thisChar == "§" ){
- byteIs++;
- }
- if (escChar.length > 4) {
- byteIs += 2; //특수문자 한글인 경우.
- }else if(thisChar != '\r') { //개행을 제외한 이외의 경우
- byteIs += 1;
- }
- if(byteIs > _size){ // 3페이지까지
- alert(_size + '(문자)를 초과하실 수 없습니다.');
- thisText = curText.substring(0, i);
- tg.val(thisText);
- byteIs = lastByte;
- break;
- }
- lastByte = byteIs;
- }
- curTotalMsg = Math.ceil(byteIs / _size);
- curEndByte = _size
- objMax.html(curEndByte);
- objNow.html(byteIs);
- }
- /* 정규 표현식을 사용하여 화이트스페이스를 빈문자로 전환 */
- function trim(str){
- str = str.replace(/^\s*/,'').replace(/\s*$/, '');
- return str; //변환한 스트링을 리턴.
- }
- /*IFRMAE 리사이즈 공용*/
- var IE = false ;
- if (window.navigator.appName.indexOf("Explorer") !=-1){
- IE = true;
- }
- function resizeIfr(obj, minHeight) {
- minHeight = minHeight || 10;
- try {
- var getHeightByElement = function(body) {
- var last = body.lastChild;
- try {
- while (last && last.nodeType != 1 || !last.offsetTop) last = last.previousSibling;
- return last.offsetTop+last.offsetHeight;
- } catch(e) {
- return 0;
- }
- }
- var doc = obj.contentDocument || obj.contentWindow.document;
- if (doc.location.href == 'about:blank') {
- obj.style.height = minHeight+'px';
- return;
- }
- if (/MSIE/.test(navigator.userAgent)) {
- var h = doc.body.scrollHeight;
- } else {
- var s = doc.body.appendChild(document.createElement('DIV'))
- s.style.clear = 'both';
- var h = s.offsetTop;
- s.parentNode.removeChild(s);
- }
- if (h < minHeight) h = minHeight;
- obj.style.height = h + 'px';
- if (typeof resizeIfr.check == 'undefined') resizeIfr.check = 0;
- if (typeof obj._check == 'undefined') obj._check = 0;
- setTimeout(function(){ resizeIfr(obj,minHeight) }, 200); // check 5 times for IE bug
- } catch (e) {
- }
- }
- /*자바스크립트 Mid*/
- function Mid(str, start, len) {
- // Make sure start and len are within proper bounds
- if ( start < 0 || len < 0 ) return "";
- var iEnd, iLen = String(str).length;
- if ( start + len > iLen ) iEnd = iLen;
- else iEnd = start + len;
- return String(str).substring(start,iEnd);
- }
- /*자바스크립트 INSTR*/
- function InStr(strSearch, charSearchFor)
- {
- for (i=0; i < strSearch.length; i++)
- {
- if (charSearchFor == Mid(strSearch, i, 1)){
- return i;
- }
- }
- return -1;
- }
- /* 네이버MAP 호출 다중 OVERLAY형태 조정현 */
- function fnSetAddMaker(obj,pos,iconURL){
- var arrMaker = new NMark(pos, new NIcon(iconURL, new NSize(15, 15),new NSize(15, 15)));
- /*NEvent.addListener(arrMaker, "mouseover", function(){
- obj.setCenterAndZoom(pos,2);
- });
- NEvent.addListener(arrMaker, "mouseout", function(){
- obj.setCenterAndZoom(pos,8)
- });*/
- obj.addOverlay(arrMaker);
- }
- var mapObj=null;;
- function fnSetChangeCenterZoom(obj,mapX,mapY, iDepth){
- if(iDepth == 'undefined' || iDepth == undefined) iDepth = 8;
- var pos = new NPoint(mapX,mapY);
- obj.setCenterAndZoom(pos,iDepth);
- obj.enableWheelZoom(true);
- }
- function fnSetMapOverlayMulty(vId, vWidth, vHeight, vMapData, iDepth){
- if(iDepth == 'undefined' || iDepth == undefined) iDepth = 8;
- var strMapData = vMapData;
- var arrMapData = strMapData.split("|");
- var arrMapDtl = "";
- mapObj = new NMap(document.getElementById(vId),{width:vWidth, height:vHeight, mapMode:0});
- var infowin, arrMaker
- for (var intX = 0;intX < arrMapData.length-1 ; intX++)
- {
- arrMapDtl = arrMapData[intX].split("^");
- var mapX = arrMapDtl[0];
- var mapY = arrMapDtl[1];
- var iconUrl = "/images/date/i_mapnum"+arrMapDtl[2]+".gif";
- var title = arrMapDtl[3];
- var pos = new NPoint(mapX,mapY);
- if (intX==0)
- {
- mapObj.setCenterAndZoom(pos, iDepth);
- mapObj.enableWheelZoom(true);
- /* 지도 좌표, 축적 수 준 초기화 */
- }
- //마커처리한다.
- //마커처리후 이벤트 리스너 등록.
- infowin = new NInfoWindow();
- infowin.set(pos,"<div style=\"color:red;font-weight:bold;\"></div>");
- mapObj.addOverlay(infowin);
- infowin.showWindow();
- fnSetAddMaker(mapObj,pos,iconUrl);
- }
- /* 지도 컨트롤 생성 */
- var zoom = new NZoomControl();
- zoom.setAlign("right");
- zoom.setValign("top");
- mapObj.addControl(zoom);
- /* 지도 모드 변경 버튼 생성 */
- var mapBtns = new NMapBtns();
- mapBtns.setAlign("right");
- mapBtns.setValign("top");
- mapObj.addControl(mapBtns);
- /* 세이브 버튼 생성 */
- var mapSave = new NSaveBtn()
- mapSave.setAlign("right");
- mapSave.setValign("bottom");
- mapObj.addControl(mapSave);
- }
- //업로드 이미지 미리 보기
- function fileUploadPreview(thisObj, preViewer) {
- if(!/(\.gif|\.jpg|\.jpeg|\.png)$/i.test(thisObj.value)) {
- alert("이미지 형식의 파일을 선택하십시오");
- return;
- }
- preViewer = (typeof(preViewer) == "object") ? preViewer : document.getElementById(preViewer);
- preViewer.innerHTML = "";
- var ua = window.navigator.userAgent;
- if (ua.indexOf("MSIE") > -1) {
- var img_path = "";
- if (thisObj.value.indexOf("\\fakepath\\") < 0) {
- img_path = thisObj.value;
- } else {
- thisObj.select();
- var selectionRange = document.selection.createRange();
- img_path = selectionRange.text.toString();
- thisObj.blur();
- }
- preViewer.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fi" + "le://" + img_path + "', sizingMethod='scale')";
- } else {
- preViewer.innerHTML = "";
- var W = preViewer.offsetWidth;
- var H = preViewer.offsetHeight;
- var tmpImage = document.createElement("img");
- preViewer.appendChild(tmpImage);
- tmpImage.onerror = function () {
- return preViewer.innerHTML = "";
- }
- tmpImage.onload = function () {
- if (this.width > W) {
- this.height = this.height / (this.width / W);
- this.width = W;
- }
- if (this.height > H) {
- this.width = this.width / (this.height / H);
- this.height = H;
- }
- }
- if (ua.indexOf("Firefox/3") > -1) {
- var picData = thisObj.files.item(0).getAsDataURL();
- tmpImage.src = picData;
- } else {
- tmpImage.src = "file://" + thisObj.value;
- }
- }
- }
- //공통코드 AJAX 로 반환한다.
- //파라미터 : obj(selectid), table("테이블명"), column (컬럼명) ,setcode(초기셋팅값), initval (선택하세요표시), 만약 상위 코드를 가져와야 하면 상위 코드를 입력한다.
- //Jqtrantform 적용된 select box에서 사용 됨
- function setCodeSelectJqTransForm(mode, obj, table, column, setcode, initval, pcode){
- var url ="/common/lib/api.php?mode="+mode+"&nm_table="+table+"&nm_column="+column+"&pcode="+pcode;
- $.getJSON(url,function(ajaxresult){
- $("#"+obj).children().remove().end();
- if(initval!=""){
- $("#"+obj).append($('<option></option>').val("").html(initval));
- }
- $.each(ajaxresult, function(i,item){
- var cd_seq = item.seq;
- var nm_code = item.code;
- var nm_name = item.name;
- var nm_pcode = item.pcode;
- var nm_etc = item.etc;
- // console.log(nm_code, nm_name);
- if(setcode==nm_code){
- $("#"+obj).append($('<option></option>').val(nm_code).html(nm_name).attr('selected','selected').attr('etc',nm_etc));
- }else{
- $("#"+obj).append($('<option></option>').val(nm_code).html(nm_name).attr('etc',nm_etc));
- }
- });
- // jqtransformdone
- $("#"+obj).jqTransSelectRefresh();
- });
- }
- //공통코드 AJAX 로 반환한다.
- //파라미터 : obj(selectid), table("테이블명"), column (컬럼명) ,setcode(초기셋팅값), initval (선택하세요표시), 만약 상위 코드를 가져와야 하면 상위 코드를 입력한다.
- function setCodeSelect(mode, obj, table, column, setcode, initval, pcode){
- var url ="/common/lib/api.php?mode="+mode+"&nm_table="+table+"&nm_column="+column+"&pcode="+pcode;
- $.getJSON(url,function(ajaxresult){
- $("#"+obj).children().remove().end();
- if(initval!=""){
- $("#"+obj).append($('<option></option>').val("").html(initval));
- }
- $.each(ajaxresult, function(i,item){
- var cd_seq = item.seq;
- var nm_code = item.code;
- var nm_name = item.name;
- var nm_pcode = item.pcode;
- var nm_etc = item.etc;
- if(setcode==nm_code){
- $("#"+obj).append($('<option></option>').val(nm_code).html(nm_name).attr('selected','selected').attr('etc',nm_etc));
- }else{
- $("#"+obj).append($('<option></option>').val(nm_code).html(nm_name).attr('etc',nm_etc));
- }
- });
- });
- }
- function setCodeSelectLi(mode, obj, table, column, setcode, initval, pcode, callback){
- var url ="/common/lib/api.php?mode="+mode+"&nm_table="+table+"&nm_column="+column+"&pcode="+pcode;
- $.getJSON(url,function(ajaxresult){
- $("#"+obj).children().remove().end();
- if(initval!=""){
- $("#"+obj).append($('<li></li>').data("val", "").html(initval));
- }
- $.each(ajaxresult, function(i,item){
- var cd_seq = item.seq;
- var nm_code = item.code;
- var nm_name = item.name;
- var nm_pcode = item.pcode;
- var nm_etc = item.etc;
- if(setcode==nm_code){
- $("#"+obj).append($('<li></li>').data("val", nm_code).html(nm_name).addClass("select"));
- }else{
- $("#"+obj).append($('<li></li>').data("val", nm_code).html(nm_name).removeClass("select"));
- }
- });
- $("#"+obj+" > li").click(function(){
- var _text = $(this).text();
- var _code = $(this).data("val");
- $(this).parent().siblings("span").text(_text);
- $(this).parent().hide();
- $(this).parents().parents().removeClass("open");
- if(!$(this).hasClass("select")){
- $(this).siblings().removeClass("select");
- $(this).addClass("select");
- if(callback){
- callback(_code);
- }
- }
- });
- });
- }
- function setCodeRadio(mode, obj, table, column, setcode, initval, pcode){
- var html = "";
- $.ajax({
- url: '/common/lib/api.php',
- data : {'mode':mode,'nm_table':table,'nm_column':column,'pcode':pcode},
- dataType : 'json',
- method : 'POST',
- success : function(data){
- // $("#"+obj).empty();
- $.each(data , function(idx, row){
- html = "<span class=\"radio_wrap\">\n";
- html+= " <input type=\"radio\" name=\""+obj+"\" id=\""+obj+"\" value=\""+row.code+"\">\n";
- html+= " <i></i>\n";
- html+= " <label for=\""+obj+"\">"+row.name+"</label>\n";
- html+= "</span>\n";
- $("#"+obj).append(html);
- });
- }
- });
- }
- function setCodeRadioLi(mode, obj, table, column, setcode, initval, pcode, callback){
- var html = "";
- $.ajax({
- url: '/common/lib/api.php',
- data : {'mode':mode,'nm_table':table,'nm_column':column,'pcode':pcode},
- dataType : 'json',
- method : 'POST',
- success : function(data){
- $("#"+obj).empty();
- var i=1;
- $.each(data , function(idx, row){
- html = "<li>\n";
- html+= "<span class=\"radio_wrap\">\n";
- html+= " <input type=\"radio\" name=\""+obj+"\" id=\""+obj+i+"\" value=\""+row.code+"\">\n";
- html+= " <i></i>\n";
- html+= " <label for=\""+obj+i+"\">"+row.name+"</label>\n";
- html+= "</span>\n";
- html+= "</li> \n";
- $("#"+obj).append(html);
- i++;
- });
- $('[name="'+obj+'"]').click(function(){
- var _text = $(this).text();
- var _code = $(this).val();
- if(callback){
- callback(_code);
- }
- });
- }
- });
- }
- // 2017.10.19
- // objId 엘리먼트 자식 img num배 확대
- function imgZoom(objId,num){
- var obj = $("#"+objId);
- $(obj).click(function(){
- if($(this).hasClass("on")){
- imgZoomInit(obj);
- $(this).removeClass("on");
- }else{
- imgZoomPlus(obj,num);
- $(this).addClass("on");
- }
- });
- }
- // 초기화
- function imgZoomInit(obj){
- $(obj).attr("style","").children("img").attr("style","");
- }
- // 이미지 확대
- function imgZoomPlus(obj,num){
- var objImg = obj.children("img");
- var objImgW = objImg.width();
- var objImgH = objImg.height();
- $(obj).css({"width":objImgW,"height":objImgH,"overflow":"auto"}).children("img").css({"width":objImgW*num,"height":objImgH*num});
- }
- // end 2017.10.19
- //Ajax페이징
- function ListPgAjax(url,pageno,PageSize,BlockPage,totalrows)
- {
- var lastpgno=parseInt(Math.ceil(totalrows/PageSize)); //마지막 페이지
- var now_num = parseInt(Math.ceil(pageno/BlockPage));
- var start_num = parseInt((now_num - 1) * BlockPage);
- var end_num = parseInt(now_num * BlockPage);
- var next_num = parseInt(end_num + 1);//마지막 페이지 값 구함
- var prev_num = parseInt(start_num);//시작 페이지 값 구함
- var html = "";
- //처음
- if(pageno!=1) {
- html += "<a href=\"javascript:"+url+"(1,"+PageSize+",'1','#car_list1')\" onFocus=\"this.blur();\" class=\"arr first\">맨 처음</a>";
- }
- //이전
- if(now_num > 1) {
- html += "<a href=\"javascript:"+url+"("+prev_num+","+PageSize+",'1','#car_list1')\" onFocus=\"this.blur();\" class=\"arr prev\">이전</a>";
- }
- //블럭단위 페이징
- for (i = start_num + 1; i <= end_num && i <= lastpgno; i++) {
- if (i == pageno) {
- html += " <strong>"+i+"</strong> ";
- }
- else {
- html += "<a href=\"javascript:"+url+"("+i+","+PageSize+",'1','#car_list1')\" onFocus=\"this.blur();\">"+i+"</a> ";
- }
- }
- //다음
- if(end_num < lastpgno) {
- html += " <a href=\"javascript:"+url+"("+next_num+","+PageSize+",'1','#car_list1')\" onFocus=\"this.blur();\" class=\"arr next\">다음</a>";
- }
- //마지막
- if(pageno!=lastpgno && lastpgno>0 ) {
- html += "<a href=\"javascript:"+url+"("+lastpgno+","+PageSize+",'1','#car_list1')\" onFocus=\"this.blur();\" class=\"arr last\">맨 마지막</a>";
- }
- return html;
- }
- //날짜 가져오기
- function getSearchDate(type, num){
- var searchDate = new Date();
- if(type == "year"){
- searchDate.setYear(searchDate.getFullYear()+num);
- }else if(type == "month"){
- searchDate.setMonth(searchDate.getMonth()+num);
- }else if(type == "day"){
- searchDate.setDate(searchDate.getDate()+num);
- }
- var y = searchDate.getFullYear();
- var m = searchDate.getMonth() + 1;
- var d = searchDate.getDate();
- if(m < 10) { m = "0" + m; }
- if(d < 10) { d = "0" + d; }
- var resultDate = y + "-" + m + "-" + d;
- return resultDate;
- }
- //차량정보 AJAX 로 반환한다.
- //파라미터 : obj(selectid), table("테이블명"), column (컬럼명) ,setcode(초기셋팅값), initval (선택하세요표시), 만약 상위 코드를 가져와야 하면 상위 코드를 입력한다.
- function getCarInfo(mode, obj, table, column, setcode, initval, pcode, callback){
- var html = "";
- $.ajax({
- url: '/common/lib/api.php',
- data : {'mode':mode,'nm_table':table,'nm_column':column,'pcode':pcode},
- dataType : 'json',
- method : 'POST',
- success : function(data){
- $("#"+obj).empty();
- var i=1;
- $.each(data , function(idx, row){
- html = "<li>\n";
- html+= "<span class=\"radio_wrap\">\n";
- html+= " <input type=\"radio\" name=\""+obj+"\" id=\""+obj+i+"\" value=\""+row.code+"\">\n";
- html+= " <i></i>\n";
- html+= " <label for=\""+obj+i+"\">"+row.name+"</label>\n";
- html+= "</span>\n";
- html+= "</li> \n";
- $("#"+obj).append(html);
- i++;
- });
- $('[name="'+obj+'"]').click(function(){
- var _text = $(this).text();
- var _code = $(this).val();
- if(callback){
- callback(_code);
- }
- });
- }
- });
- }
- function get_query(enc_str){
- var url = '?'+enc_str;
- var qs = url.substring(url.indexOf('?') + 1).split('&');
- for(var i = 0, result = {}; i < qs.length; i++){
- qs[i] = qs[i].split('=');
- result[qs[i][0]] = decodeURIComponent(qs[i][1]);
- }
- return result;
- }
|