// 전역 변수 var errmsg = ""; var errfld = null; // 필드 검사 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"; } function trim(s) { var t = ""; var from_pos = to_pos = 0; for (i=0; i=0; i--) { if (s.charAt(i-1) == ' ') continue; else { to_pos = i; break; } } t = s.substring(from_pos, to_pos); // alert(from_pos + ',' + to_pos + ',' + t+'.'); return t; } // 자바스크립트로 PHP의 number_format 흉내를 냄 // 숫자에 , 를 출력 function number_format(data) { var tmp = ''; var number = ''; var cutlen = 3; var comma = ','; var i; var sign = data.match(/^[\+\-]/); if(sign) { data = data.replace(/^[\+\-]/, ""); } len = data.length; mod = (len % cutlen); k = cutlen - mod; for (i=0; i 0) document.getElementById(id).rows -= row; } function textarea_original(id, row) { document.getElementById(id).rows = row; } function textarea_increase(id, row) { document.getElementById(id).rows += row; } // 글숫자 검사 function check_byte(content, target) { var i = 0; var cnt = 0; var ch = ''; var cont = document.getElementById(content).value; for (i=0; i 4) { cnt += 2; } else { cnt += 1; } } // 숫자를 출력 document.getElementById(target).innerHTML = cnt; return cnt; } // 브라우저에서 오브젝트의 왼쪽 좌표 function get_left_pos(obj) { var parentObj = null; var clientObj = obj; //var left = obj.offsetLeft + document.body.clientLeft; var left = obj.offsetLeft; while((parentObj=clientObj.offsetParent) != null) { left = left + parentObj.offsetLeft; clientObj = parentObj; } return left; } // 브라우저에서 오브젝트의 상단 좌표 function get_top_pos(obj) { var parentObj = null; var clientObj = obj; //var top = obj.offsetTop + document.body.clientTop; var top = obj.offsetTop; while((parentObj=clientObj.offsetParent) != null) { top = top + parentObj.offsetTop; clientObj = parentObj; } return top; } function flash_movie(src, ids, width, height, wmode) { var wh = ""; if (parseInt(width) && parseInt(height)) wh = " width='"+width+"' height='"+height+"' "; return ""; } 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 ""; } function doc_write(cont) { document.write(cont); } var win_password_lost = function(href) { window.open(href, "win_password_lost", "left=50, top=50, width=617, height=330, scrollbars=1"); } $(document).ready(function(){ $("#login_password_lost, #ol_password_lost").click(function(){ win_password_lost(this.href); return false; }); }); /** * 포인트 창 **/ 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_profile = function(href) { var new_win = window.open(href, 'win_profile', 'left=100,top=100,width=620,height=510,scrollbars=1'); new_win.focus(); } /** * 스크랩 창 **/ var win_scrap = function(href) { var new_win = window.open(href, 'win_scrap', 'left=100,top=100,width=600,height=600,scrollbars=1'); new_win.focus(); } /** * 홈페이지 창 **/ var win_homepage = function(href) { var new_win = window.open(href, 'win_homepage', ''); new_win.focus(); } /** * 우편번호 창 **/ var win_zip = function(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2, frm_addr3, frm_jibeon) { if(typeof daum === 'undefined'){ alert("다음 juso.js 파일이 로드되지 않았습니다."); return false; } new daum.Postcode({ oncomplete: function(data) { // 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분. // 우편번호와 주소 정보를 해당 필드에 넣고, 커서를 상세주소 필드로 이동한다. var of = document[frm_name]; of[frm_zip1].value = data.postcode1; of[frm_zip2].value = data.postcode2; of[frm_addr1].value = data.address1; of[frm_addr2].value = ""; of[frm_addr3].value = ""; if( data.addressType == "R" ){ //도로명이면 of[frm_addr3].value = data.address2; } if(of[frm_jibeon] !== undefined){ of[frm_jibeon].value = data.addressType; } of[frm_addr2].focus(); } }).open(); } /** * sms5 창 **/ var win_sms5 = function(href) { var new_win = window.open(href, 'win_sms5', 'width=474, height=560, scrollbars=1'); new_win.focus(); } /** * 새로운 비밀번호 분실 창 : 101123 **/ win_password_lost = function(href) { var new_win = window.open(href, 'win_password_lost', 'width=617, height=330, scrollbars=1'); new_win.focus(); } /** * 설문조사 결과 **/ var win_poll = function(href) { var new_win = window.open(href, 'win_poll', 'width=616, height=500, scrollbars=1'); new_win.focus(); } /** * 스크린리더 미사용자를 위한 스크립트 - 지운아빠 2013-04-22 * alt 값만 갖는 그래픽 링크에 마우스오버 시 title 값 부여, 마우스아웃 시 title 값 제거 **/ $(function() { $('a img').mouseover(function() { $a_img_title = $(this).attr('alt'); $(this).attr('title', $a_img_title); }).mouseout(function() { $(this).attr('title', ''); }); }); /** * 텍스트 리사이즈 **/ function font_resize(id, rmv_class, add_class) { var $el = $("#"+id); $el.removeClass(rmv_class).addClass(add_class); set_cookie("ck_font_resize_rmv_class", rmv_class, 1, g5_cookie_domain); set_cookie("ck_font_resize_add_class", add_class, 1, g5_cookie_domain); } $(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_password_lost").click(function() { win_password_lost(this.href); return false; }); $(".win_sms5").click(function() { win_sms5(this.href); return false; }); /* $(".win_poll").click(function() { win_poll(this.href); return false; }); */ // 사이드뷰 var sv_hide = false; $(".sv_member, .sv_guest").click(function() { $(".sv").removeClass("sv_on"); $(this).closest(".sv_wrap").find(".sv").addClass("sv_on"); }); $(".sv, .sv_wrap").hover( function() { sv_hide = false; }, function() { sv_hide = true; } ); $(".sv_member, .sv_guest").focusin(function() { sv_hide = false; $(".sv").removeClass("sv_on"); $(this).closest(".sv_wrap").find(".sv").addClass("sv_on"); }); $(".sv a").focusin(function() { sv_hide = false; }); $(".sv a").focusout(function() { sv_hide = true; }); // 셀렉트 ul var sel_hide = false; $('.sel_btn').click(function() { $('.sel_ul').removeClass('sel_on'); $(this).siblings('.sel_ul').addClass('sel_on'); }); $(".sel_wrap").hover( function() { sel_hide = false; }, function() { sel_hide = true; } ); $('.sel_a').focusin(function() { sel_hide = false; }); $('.sel_a').focusout(function() { sel_hide = true; }); $(document).click(function() { if(sv_hide) { // 사이드뷰 해제 $(".sv").removeClass("sv_on"); } if (sel_hide) { // 셀렉트 ul 해제 $('.sel_ul').removeClass('sel_on'); } }); $(document).focusin(function() { if(sv_hide) { // 사이드뷰 해제 $(".sv").removeClass("sv_on"); } if (sel_hide) { // 셀렉트 ul 해제 $('.sel_ul').removeClass('sel_on'); } }); $("textarea#wr_content[maxlength]").live("keyup change", function() { var str = $(this).val() var mx = parseInt($(this).attr("maxlength")) if (str.length > mx) { $(this).val(str.substr(0, mx)); return false; } }); });