/** @ program : javascript ui framework; @ auth : thKim™ @ desc : 공통자바스크립트 with extend jquery; **/ (function($) { $._default = "/"; $._actionfrm = "actionfrm", $._popupfrm = "popupfrm", $._debug = true, $._zoom_url = $._default+"common/modules/zoom.php", $._login_url = "?c=lgn", $._logout_url = $._default+"common/modules/logout.php", $.checkfrm=1, $.msg_form="이미전송중입니다. 잠시만 기다려주세요.", $.msg_delete = "삭제하시면 복구할 수 없습니다.\n삭제하시겠습니까?", $.msg_submit_error = "전송중 에러가 발생하였습니다.\n잠시 후 다시 시도하시기 바랍니다.", /* start */ $.Id=function(id) { if (typeof(id) !="object") return document.getElementById(id); else return (id); }, $.Name=function(id) { if (typeof(id) !="object") return document.getElementsByName(id); else return (id); }, $.Error=function(e) { if ($._debug) { alert(e+"\n"+e.description); } }, $.Go=function(code, subp){ if (code!=null) { var url = ""; if (arguments[2]) { url = arguments[2]; } this.Url("./?code="+code+"&subp="+subp+url, ""); } }, $.GoLogin=function(){ var strparameter = window.location.search; if (strparameter.length>0) { if (strparameter.indexOf("returl" , 0) > 0){ window.location.reload(); } else { window.location.href=this._login_url +"&returl="+escape(window.location.pathname+window.location.search); } } else { window.location.href=this._login_url +"&returl="+escape(window.location.pathname+window.location.search); } return; }, $.LoginN=function(){ alert("로그인이 필요한 서비스 입니다."); this.GoLogin(); return; }, $.GoLogout=function() { var strparameter = window.location.search; var tmp = ""; if (strparameter.length>0) { tmp = escape(window.location.pathname+window.location.search); } window.location.href= this._logout_url + "?returl="+ tmp; }, $.GoTop=function() { window.scrollTo(0,0); }, $.Back=function() { window.history.go(-1); }, $.Url=function(url, t) { if (t=="blank") { this.Open(url, '', ''); } else { window.location.href=url; } }, $.Reload=function() { window.location.reload(); }, $.Open=function(url, name, feature){ if (url) { var win = window.open(url, name, feature); if (win==null) alert("차단된 팝업창을 허용해주세요."); else win.focus(); } }, $.Close=function() { opener = self; self.close(); }, $.Loading=function() { var msg=arguments[0]; if (!msg) { msg="Loading...."; }var fwMsg = new $.message("

"+msg+"
","","loading"); fwMsg.Init(); window.onresize = function(){ fwMsg.setStatus();} }, $.LoadingClose=function() { $("#message1").hide(); $("#message2").hide(); }, $.LoadingMsg=function() { return "
loading....
"; }, $.ModalCheck=function() { if (window.showModalDialog && document.all) return true; else return false; }, $.Modal=function(url, name, width, height, status) { if (this.ModalCheck()) { window.showModalDialog(url, window, "dialogWidth:"+ width +"px ; dialogHeight:"+ height +"px;status:off; scroll:yes;"); } else { this.Open(url, name, "width="+ width +",height="+ height +", status="+status+",resizable=no,modal=yes,dependent=yes"); } }, $.ModalResize=function() { if (this.ModalCheck()) { var dw = window.dialogWidth; while (isNaN(dw)) { dw = dw.substr(0,dw.length-1); } difw = dw - document.body.clientWidth; window.dialogWidth = document.body.scrollWidth+difw+'px'; var dh = window.dialogHeight; while (isNaN(dh)) { dh = dh.substr(0,dh.length-1); } difh = dh - document.body.clientHeight; window.dialogHeight = document.body.scrollHeight+difh+'px'; } }, $.CloseToday=function(popid, kind) { var nowdate = new Date(); var time = 1440 - (nowdate.getHours()*60+nowdate.getMinutes()); this.setCookie(popid, "none", time); if (!kind) this.Close(); else $("#"+popid).toggle('fast', function(){ $(this).remove() } ); /* $('.'+popid).hide('slow'); */ }, $.setCookie=function(name, value, expiredays) { var todayDate = new Date(); todayDate.setTime(todayDate.getTime() + (1000*60*parseInt(expiredays)) ); document.cookie = name +"="+escape(value)+";path=/; expires=" + todayDate.toGMTString() + ";" ; }, $.getCookie=function(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 ""; }, $.inValid = function(val, frm, msg) { if (val!="checked") var strValue = frm.value; var blnExp = false; switch (val) { case "id" : if (frm.value.match(/[A-Za-z0-9]{4,15}\w*/g)!=strValue) { break; } blnExp = true; case "email" : if (frm.value.match(/[\w\-\.]+\@[\w\-]+(\.[\w\-]+)+/g)!=strValue) { break; } blnExp = true; case "number" : if (frm.value.match(/\d+/g)!=strValue) { break; } blnExp = true; case "phone" : if (frm.value.match(/[0-9]{2,3}\-[0-9]{3,4}\-[0-9]{4}/g)!=strValue) { break; } blnExp = true; case "mphone" : if (frm.value.match(/01[016789]\-[0-9]{3,4}\-[0-9]{4}/g)!=strValue) { break; } blnExp = true; case "date" : if (frm.value.match(/[0-9]{4}\-[0-9]{2}\-[0-9]{2}/g)!=strValue) { break; } blnExp = true; case "homepage" : if (frm.value.match(/\w+:\/\/[^#]*/g)!=strValue) { break; } blnExp = true; case "checked" : if (typeof(frm.length)=="undefined"){ if (frm.checked==true) { blnExp = true; } } else { for (i = 0 ; i < frm.length; i++) { if (frm[i].checked==true){ blnExp = true; } } } break; case "selected" : if (frm.value==""){ break ;} blnExp = true; case "idn1" : if (frm.value.match(/[0-9]{6}/g)!=strValue){ break; } blnExp = true; case "idn2" : if (frm.value.match(/[0-9]{7}/g)!=strValue){break; } blnExp = true; case "company" : if (frm.value.match(/[0-9]{3}\-[0-9]{2}\-[0-9]{5}/g)!=strValue){break;} blnExp = true; default : /*공백체크*/ if (frm.value.match(/\S/)==null){break;} blnExp = true; } if (!blnExp){ if (msg) alert(msg);if ((val!="checked")&&(val!="selected")){ frm.focus(); }; return false; } else{ return true; } }, $.getOs=function() { return window.navigator.appVersion.split(";")[2]; }, $.getBrower=function() { return navigator.userAgent.toUpperCase(); }, $.getXy=function(el) { var parent = null; var pos = []; var box; if (el.getBoundingClientRect) { /* IE */ box = el.getBoundingClientRect(); var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft; return [box.left + scrollLeft, box.top + scrollTop]; } else if (document.getBoxObjectFor) { /*gecko*/ box = document.getBoxObjectFor(el); pos = [box.x, box.y]; return pos; } else { /* safri/opera */ pos = [el.offsetLeft, el.offsetTop]; parent = el.offsetParent; if (parent != el) { while (parent) { pos[0] += parent.offsetLeft; pos[1] += parent.offsetTop; parent = parent.offsetParent; } } /* opera & (safari absolute) incorrectly account for body offsetTop */ var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf('opera') != -1 || ( ua.indexOf('safari') != -1 && this.getStyle(el, 'position') == 'absolute' ) ) { pos[1] -= document.body.offsetTop; } return pos; } }, $.getPos=function(e) { var x = (this.isIE()) ? event.clientX+11 : e.pageX+11; /* ? e.pageX : event.x+document.body.scrollLeft; */ var y = (this.isIE()) ? event.clientY+document.body.scrollTop : e.pageY+1; /* e.pageY : event.y+document.body.scrollTop; */ return [x, y]; }, $.getStyle=function(obj,att){ return obj.style[att]; }, $.isIE=function() { var n = navigator.appName; if (n=="Microsoft Internet Explorer") { return true; } else { return false; } //return ((navigator.appName == 'Microsoft Internet Explorer') || ((navigator.appName == 'Netscape') && (new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) != null))); }, $.isIE11=function() { return ((navigator.appName == 'Netscape') && (new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) != null)); }, $.addEvent=function(obj, type, listener) { if (obj.addEventListener) { if (type=="mousewheel") type="DOMMouseScroll"; obj.addEventListener(type, listener, false) } else { obj.attachEvent("on"+type, listener); } }, $.Trim=function(str) { return str.replace(/S/g, ""); } , $.Flash=function(url, width, height, strparam) { var wmode = "transparent"; var id = ""; var quality = "high"; var menu = "false"; var allowScriptAccess = "sameDomain"; var flash=''; flash += ' '; flash += ''; flash += ''; flash += ''; flash += ''; flash += ''; flash += ' '; flash += ''; document.write(flash); }, $.Embed=function(url, width, height) { var object=''; object=''; document.write(object); }, $.ImageResize=function(imgid, sizew) { var img = $("#"+imgid); if (img) { if (img.length==null){ imgwidth = img.width; imgheight = img.height; if (sizew < imgwidth) { imgW = sizew; imgH = parseInt((sizew/imgwidth) * imgheight); } else { imgW = imgwidth; imgH = imgheight; } img.width = imgW; img.height = imgH; } else { for (i = 0 ; i < img.length; i++) { imgwidth = img[i].width ; imgheight = img[i].height; if (sizew < imgwidth){ imgW = sizew; imgH = parseInt((sizew/imgwidth) * imgheight); } else { imgW = imgwidth; imgH = imgheight; } img[i].width = imgW; img[i].height = imgH; } } } }, $.CheckAll=function(obj) { var chkvalue = this.Name(obj); if (chkvalue) { var chklen = chkvalue.length; if (chklen==null || chklen==""){ if(chkvalue.checked) { chkvalue.checked=false; } else { if (chkvalue.disabled==false) { chkvalue.checked=true; } } } else { for(i=0;i length) { /* alert(length+'자 이하로 해주세요! '); return false; */ } else { return true; } }, $.Zoom=function(url) { this.Open(this._zoom_url+"?name="+url, "", "directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no,width=400,height=400"); }, $.Leftmenu=function(code){ if (code){ var obj = $("#left"+code); // document.all["leftnavi"+code]; var name = obj.attr("name"); obj.attr("src", "images/"+ imgfolder +"/" + name + "_"+ code +"_ov.png"); this.LeftmenuSub(code); } }, $.LeftmenuSub=function(code){ if (code>0){ var obj = $("#table"+ code).toggle(); } }, $.LeftmenuSubImg=function(code){ if (code) { var obj = $("#leftnavi"+code); var name = obj.attr("name"); obj.attr("src", "images/"+ imgfolder +"/" + name + "_"+ code +"_ov.png"); } }, $.ChangeFocus=function(val, len, nextfrm) { if( val.length == len) nextfrm.focus(); }, $.Onlynum=function(event) { //alert(event.keyCode); if(((event.keyCode<48)||(event.keyCode>57))&&(event.keyCode!=45)) { event.returnValue=false; } }, $.NoKey=function(event){ try { if (window.event) { event.returnValue=false; } else { evt.preventDefault(); } } catch (e) { this.Error(e); } }, $.isDate=function(sdate, edate) { if (sdate.indexOf("-")>0) { split_sdate = sdate.split("-"); syear = split_sdate[0]; smonth = Number(split_sdate[1]); sday = Number(split_sdate[2]); } if (edate.indexOf("-")>0) { split_edate = edate.split("-"); eyear = split_edate[0]; emonth = Number(split_edate[1]); eday = Number(split_edate[2]); } var start_date = new Date(syear,smonth-1,sday); var end_date = new Date(eyear,emonth-1,eday); var start_date = new Date(Date.parse(start_date)); var end_date = new Date(Date.parse(end_date)); if (start_date > end_date) { return false; } else { return true; } }, $.ReadOnly=function(frm, color) { try { var f = document.forms[frm]; for (var i=0; i0 && (i%3)==0){ retValue=val.charAt(val.length-i-1)+","+retValue; } else { retValue=val.charAt(val.length-i-1)+retValue; } } } return retValue; }, $.GetLink=function() { var link = location.href; var ranNum = Math.floor(Math.random()*1000); link += "&nocache="+ranNum; return link; }, $.GetSubject=function() { var title = document.title; title = $("#sharetitle").text(); //document.title = title; if (title==""|| title==null) title = document.title; return title; }, $.GetContents=function() { var contents = $("#sharecontents").html(); if (contents==""|| contents==null) contents = document.title; return contents; }, $.FaceBook=function() { var title = encodeURIComponent($.GetSubject()); var link = encodeURIComponent($.GetLink()); var contents = encodeURIComponent($.GetContents()); //var logo = ""; //var url = "http://www.facebook.com/sharer.php?s=100&p[title]="+ title +"&p[url]="+ link +"&p[summary]="+contents; var url = "https://www.facebook.com/sharer/sharer.php?u="+link; $.Open(url, 'facebook', ''); }, $.FaceBookN=function(link) { var ranNum = Math.floor(Math.random()*1000); link += "&nocache="+ranNum; var url = "https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(link); $.Open(url, 'facebook', ''); }, $.Twitter=function(){ var title = $("#og_title").attr("content"); var contents = encodeURIComponent($("#og_desc").attr("content")); var link = encodeURIComponent($("#og_link").attr("content")); var url = "https://twitter.com/intent/tweet?text=" + encodeURIComponent(title) + "&url=" + link; $.Open(url, 'twitter', ''); }, $.TwitterN=function(title, link){ var url = "https://twitter.com/intent/tweet?text=" + encodeURIComponent(title) + "&url=" + encodeURIComponent(link); $.Open(url, 'twitter', ''); }, $.Google=function() { var title = encodeURIComponent(this.GetSubject()); var link = encodeURIComponent(this.GetLink()); var url = "https://plus.google.com/share?url="+link+"&hl=ko"; $.Open(url, 'googleplus', ''); }, $.GoogleN=function(link) { var url = "https://plus.google.com/share?url="+encodeURIComponent(link)+"&hl=ko"; $.Open(url, 'googleplus', ''); }, $.KakaoS=function() { var title = encodeURIComponent(this.GetSubject()); var link = encodeURIComponent(this.GetLink()); var url = "https://story.kakao.com/s/share?url="+link; $.Open(url, 'kakaostroy', ''); }, $.KakaoN=function(link) { var link = encodeURIComponent(link); var url = "https://story.kakao.com/s/share?url="+link ; $.Open(url, 'kakaostroy', ''); }, $.Kakao=function(link) { var title = $("#og_title").attr("content"); var contents = $("#og_desc").attr("content"); var link = this.GetLink(); sendLink(title, contents, link); }, $.Pin=function(){ var title = $("#og_title").attr("content"); var contents = encodeURIComponent($("#og_desc").attr("content")); var link = encodeURIComponent($("#og_link").attr("content")); var img = encodeURIComponent($("#og_image").attr("content")); var url = "http://pinterest.com/pin/create/button/?url="+link+"&media="+img+"&description="+contents; $.Open(url,'pinterest',''); }, $.PinN=function(link, img ,info){ //var img = "http://muee.nayana.kr/" + img; var url = "http://pinterest.com/pin/create/button/?url="+encodeURIComponent(link)+"&media="+encodeURIComponent(img)+"&description="+encodeURIComponent(info); $.Open(url,'pinterest',''); }, $.Naver=function() { var title = encodeURI($("#og_title").attr("content")); var link = encodeURI(encodeURIComponent($("#og_link").attr("content"))); var url = "http://share.naver.com/web/shareView?url="+link+"&title="+title; $.Open(url, 'naver', ''); }, $.NaverN=function(title, url) { var title = encodeURI(title); var link = encodeURI(encodeURIComponent(url)); var url = "http://share.naver.com/web/shareView?url="+link+"&title="+title; $.Open(url, 'naver', ''); }, $.LinkCopy=function() { $('#link-area').attr('type', 'text'); $('#link-area').select(); var copy = document.execCommand('copy'); $('#link-area').attr('type', 'hidden'); if(copy) { alert("링크가 복사되었습니다."); } }, $.TextCopy=function(obj, text) { //$('#'+obj).val($('#'+obj+'_text').text()); if(text) text = text; else text = ""; $('#'+obj).attr('type', 'text'); $('#'+obj).select(); var copy = document.execCommand('copy'); $('#'+obj).attr('type', 'hidden'); if(copy) { alert(text+"복사되었습니다."); } }, $.Captcha=function(lang) { if(!lang) lang = 'ko'; if($("#captcha").val()) { var data = { captcha : $("#captcha").val(), lang : lang }; $.ajax({ type: "GET", url: $._default+"captcha/process.php", data: data, async:false, success: function(ret) { if(ret=='true') { if(lang=='ko') { alert("자동등록방지 성공"); } else if(lang=='en') { alert("Automatic Registration Success"); } else if(lang=='cn') { alert("防止自动注册成功"); } $("#captcha_result").val("y"); $('#captch_button').hide(); $("#captcha").attr('readOnly', true); $('#captchaimage').hide(); } else { if(lang=='ko') { alert("자동등록방지 실패"); } else if(lang=='en') { alert("Automatic Registration Failed"); } else if(lang=='cn') { alert("防止自动注册失败"); } $("#captcha").val("").focus(); } } }); } else { if(lang=='ko') { alert("보안문자를 입력해주세요."); } else if(lang=='en') { alert("Enter Security Letter."); } else if(lang=='cn') { alert("请输入您的安全短信。"); } $("#captcha").focus(); } }, $.isMobile=function(){ // alert(navigator.userAgent.toUpperCase()); var browserCheckText = new Array('iPhone', 'iPod', 'iPad', 'BlackBerry', 'Android', 'Windows CE', 'LG', 'MOT', 'SAMSUNG', 'SonyEricsson'); var mobile = false; for (var word in browserCheckText){ if (navigator.userAgent.toUpperCase().match(browserCheckText[word].toUpperCase()) != null){ mobile = true; break; } } return mobile; }, $.Run=function() { var argu = arguments[0]; var datastr = $('#'+argu.frm).serialize(); //console.log(datastr); if (datastr) { //$.Loading("10"); $.ajax({ url: argu.url, type: "post", data: datastr, datatype: "html" }).success(function(data){ //console.log(data); if (data!="") { var r = eval('('+data+')'); if (r.ResultNo=="00") { //console.log(r.CallBack); if (r.ResultMsg) { alert(r.ResultMsg); } } else { if(r.ResultMsg){ alert(r.ResultMsg.replace("\\n","\n")); } //$.LoadingClose(); } var param = ""; if (r.Param) { param = r.Param; } if (r.CallBack) { window[r.CallBack](param); } } }).error(function(e){ //$.LoadingClose(); $.Error(e); /* for (var a in e) { console.log(a + " : " + e[a]); }*/ }); } else { alert("전송중 에러가 발생하였습니다.\n잠시 후 다시 시도하시기 바랍니다."); return false; } }, // 한글종성여부로 을/를 리턴; $.isKorean=function(val) { var unicode = val.charCodeAt(0) - 0xAC00; var is = unicode % 28; if (is == 0) { return '를'; } else { return '을'; } }, $.FormInit = function(frm) { $('#'+frm).find("input, textarea, select").each(function() { if ($(this).attr("type")=="text"||$(this).attr("type")=="password"||$(this).attr("type")=="number"||$(this).attr("type")=="tel"||$(this).attr("type")=="email") { $(this).addClass("inputbox"); $(this).bind("focus", function(){ $(this).addClass("inputbox_on"); }).bind("blur", function(){ $(this).removeClass("inputbox_on"); }); } else if ($(this).attr("type")=="radio" || $(this).attr("type")=="checkbox") { // $(this).addClass("app_radio"); } else if ($(this).attr("type")=="textarea") { $(this).bind("focus", function(){ $(this).addClass("on"); }).bind("blur", function(){ $(this).removeClass("on"); }); /* $(this).addClass("app_text"); $(this).bind("focus", function(){ $(this).addClass("app_text_on"); //$(this).css("width", $(this).width()-2); }).bind("blur", function(){ $(this).removeClass("app_text_on"); //$(this).css("width", $(this).width()+2); }); */ } else if ($(this).attr("type")=="select") { $(this).bind("focus", function(){ $(this).addClass("selectbox_on"); }).bind("blur", function(){ $(this).removeClass("selectbox_on"); }); } }); }, $.FormCheck=function(frm){ var f = document.frm; var retVal = true; var lang = $('#'+frm).attr('lang'); if(lang=='undefined' || !lang) lang = 'ko'; $('#'+frm).find("input, textarea, select").each(function() { var type = $(this).attr("type"); var text = $(this).attr("data-text"); var name = $(this).attr("name"); var id = $(this).attr('id'); var req = $(this).attr('req'); //alert(required); if((type=="text"||type=="password"||type=="textarea"||type=="tel"||type=="number"||type=="email") && req) { if ($(this).val()=='') { if(lang=='ko') { alert(req+ $.isKorean(req.slice(-1))+" 입력하세요."); } else { alert(req); } $(this).focus(); retVal = false; return false; } } else if ((type=="radio"||type=='checkbox') && req) { var cnt = 0; var length = f[name].length; for(i=0; i마우스로 드래그 하시거나, 파일첨부버튼을 클릭해주세요.", fileName: "file", multiple: false, formData: { "gbn":"upload", "bbsid":opt.bbsid }, showFileCounter:false, fileCounterStyle:'', onLoad:function(obj){ var oldfile = opt.oldfile; if(oldfile) { var sp_file = oldfile.split(","); //$("#eventsmessage").html($("#eventsmessage").html()+"
Widget Loaded:"); for(var i=0; i0){ filename = file[2]; // 기존에 파일이 등록된게 있으면, 파일삭제 후 다시 시도, var oldfile = $('input[name=oldfile'+id+']').val(); if(oldfile) { $.post($._default+'common/upload/upload.db.php', {gbn:'delete', mode:'multi', bbsid:opt.bbsid, oldfile:oldfile, ix:'NEW'}, function(resp,textStatus,jqXHR) { // alert('파일삭제완료'); // $('input[name=fileinfo'+id+']').val(''); }); } $('input[name=oldfile'+id+']').val(filename); if(gubun=="background") { $(opt.obj).parent().css('background-image', 'url(/upload/'+opt.bbsid+'/'+filename+')'); } else { $(opt.obj).parent().find('img').attr('src', '/upload/'+opt.bbsid+'/'+filename); } } //document.frm.uploading.value='N'; //$("#status").html("Upload is success"); }, onError: function(files,status,errMsg) { $('input[name=uploading]').val('N'); alert('업로드실패! 다시업로드해주세요.'); // document.frm.uploading.value='N'; // $("#status").html("Upload is Failed"); }, afterUploadAll:function(obj) { //$("#eventsmessage").html($("#eventsmessage").html()+"
All files are uploaded"); }, deleteCallback:function(data,pd) { var bbsid = opt.bbsid; var id = opt.id; for(var i=0; i"); $(opt.obj).append(""); $(opt.obj).append(""); }, $.UploadCheck=function(f, id) { var files = $('#uploads'+id).nextUntil().children().children('.ajax-file-upload-filename'); if(f.uploading.value=='Y') { alert('파일업로드 중입니다.\n업로드가 완료된 후 전송해주세요.'); return; } $("input[name=filecnt"+id+"]").val(files.size()); var filecnt = files.size(); var fileinfo = ''; if (filecnt>0) { files.each(function(){ fileinfo += $(this).attr("info")+"\n\r"; }); $("input[name=fileinfo"+id+"]").val(fileinfo); } return files.size(); }, $.Layout=function(gubun, val) { $.ajax({ url: $._default+"common/layout.php", type: "post", data: {'gubun':gubun, 'layout':val}, datatype: "html" }).success(function(data){ var r = eval('('+data+')'); if(r.ResultNo=='00') { location.reload(); } else { alert(r.ResultMsg); return; } }); }, $.getImgcode = function() { var curr_date = new Date(); var year = curr_date.getFullYear(); var month = curr_date.getMonth(); var day = curr_date.getDay(); var hours = curr_date.getHours(); var mins = curr_date.getMinutes(); var secs = curr_date.getSeconds(); return year.toString() + month.toString() + day.toString() + hours.toString() + mins.toString() + secs.toString(); }, $.getKakaoMap = function(opt,icon,w,h) { //카카오 지도 api var mapContainer = document.getElementById(opt.id), //지도를 표시할 div mapOption = { center: new daum.maps.LatLng(opt.lng1, opt.lng2), //지도의 중심좌표 level: opt.zoom // 지도의 확대 레벨 }; var map = new daum.maps.Map(mapContainer, mapOption); //지도를 생성합니다 if(opt.addmarker.length>0) { //마커를 표시할 위치와 title 객체 배열입니다 var imageSrc = "../../../../../upload/site/"+icon; var markers = [], infoWindows=[]; map.setZoomable(false); //확대,축소 막기 //지도 확대 축소를 제어할 수 있는 줌 컨트롤을 생성합니다 var zoomControl = new daum.maps.ZoomControl(); map.addControl(zoomControl, daum.maps.ControlPosition.RIGHT); for(var i=0; i' + '
' + title + '
' + '
' + '
' + '
' + addr + '
' + ' ' + '
' + '
' + '', removable : true }); markers.push(marker); infoWindows.push(infoWindow); daum.maps.event.addListener(markers[i], 'click', getEventHandler(i,position2)); } function getEventHandler(i,latlng) { //클릭 이벤트 핸들러 return function() { var chk_num = $('#marker_num').val(); //현재 인포윈도우 값 map.setLevel(4); //지도레벨 변경하기 makeOutListener(chk_num); //기존 인포윈도우 닫기 호출 infoWindows[i].open(map, markers[i]); //현재 인포윈도우 열기 $('#marker_num').val(i); //기존 인포윈도우 지우기 위해 값 저장 map.panTo(latlng); //클릭 위치로 부드럽게 이동 } } //인포윈도우를 닫는 클로저를 만드는 함수입니다 function makeOutListener(i) { if(i) infoWindows[i].close(); } } }, $.getKakaoMap2 = function(opt,icon,w,h) { //카카오 지도 api var mapContainer = document.getElementById(opt.id), //지도를 표시할 div mapOption = { center: new daum.maps.LatLng(opt.lng1, opt.lng2), //지도의 중심좌표 level: opt.zoom // 지도의 확대 레벨 }; var map = new daum.maps.Map(mapContainer, mapOption); //지도를 생성합니다 if(opt.addmarker.length>0) { //마커를 표시할 위치와 title 객체 배열입니다 var imageSrc = "../../../../../upload/site/"+icon; var markers = [], infoWindows=[]; //map.setZoomable(false); //확대,축소 막기 //지도 확대 축소를 제어할 수 있는 줌 컨트롤을 생성합니다 var zoomControl = new daum.maps.ZoomControl(); map.addControl(zoomControl, daum.maps.ControlPosition.RIGHT); for(var i=0; i' + '
' + title + '
' + '
' + '
' + '
' + addr + '
' + ' ' + '
' + '
' + '', removable : true }); markers.push(marker); infoWindows.push(infoWindow); daum.maps.event.addListener(markers[i], 'click', getEventHandler(i,position2)); } function getEventHandler(i,latlng) { //클릭 이벤트 핸들러 return function() { var chk_num = $('#marker_num').val(); //현재 인포윈도우 값 map.setLevel(4); //지도레벨 변경하기 makeOutListener(chk_num); //기존 인포윈도우 닫기 호출 infoWindows[i].open(map, markers[i]); //현재 인포윈도우 열기 $('#marker_num').val(i); //기존 인포윈도우 지우기 위해 값 저장 map.panTo(latlng); //클릭 위치로 부드럽게 이동 } } //인포윈도우를 닫는 클로저를 만드는 함수입니다 function makeOutListener(i) { if(i) infoWindows[i].close(); } } }, $.getKakaoMapSim =function(opt) { //모바일수첩 상세 페이지에 사용 var mapContainer = document.getElementById(opt.id), //지도를 표시할 div mapOption = { center: new daum.maps.LatLng(opt.lng1, opt.lng2), //지도의 중심좌표 level: opt.zoom // 지도의 확대 레벨 }; var map = new daum.maps.Map(mapContainer, mapOption); // 지도를 생성합니다 // 마커가 표시될 위치입니다 var markerPosition = new daum.maps.LatLng(opt.lng1, opt.lng2); // 마커를 생성합니다 var marker = new daum.maps.Marker({ position: markerPosition }); // 마커가 지도 위에 표시되도록 설정합니다 marker.setMap(map); }, $.getGoogleMap = function(opt,icon,w,h) { //구글 지도 api var map = new google.maps.Map(document.getElementById(opt.id), { zoom: Number(opt.zoom), center: new google.maps.LatLng(opt.lng1, opt.lng2), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var marker, i; for(var i=0; i' + '
' + title + '
' + '
' + '
' + '
' + addr + '
' + ' ' + '
' + '
' + '', removable : true }); infowindow.open(map, marker); } })(marker, i)); if(marker) { marker.addListener('click', function() { map.setZoom(17); map.setCenter(this.getPosition()); }); } } }, $.getNaverMapV3 = function(opt,icon,w,h) { //네이버 지도 api if(!opt.img) { opt.img = "../../../../../upload/site/"+icon; } var map = new naver.maps.Map(opt.id, { center: new naver.maps.LatLng(opt.lng1, opt.lng2), zoom: Number(opt.zoom), minZoom:1, zoomControl:true, zoomControlOptions: { //줌 컨트롤의 옵션 position: naver.maps.Position.TOP_RIGHT }, draggable: false, pinchZoom: false, scrollWheel: false, keyboardShortcuts: false, disableDoubleTapZoom: true, disableDoubleClickZoom: true, disableTwoFingerTapZoom: true }); var markers = [], infoWindows=[]; if(opt.addmarker.length>0) { for(var i=0; i' + '
' + title + '
' + '
' + '
' + '
' + addr + '
' + ' ' + '
' + '
' + '', removable : true }); markers.push(marker); infoWindows.push(infoWindow); naver.maps.Event.addListener(markers[i], 'click', getEventHandler(i,position2)); } function getEventHandler(seq,latlng) { return function(e) { var marker = markers[seq], infoWindow = infoWindows[seq]; if(infoWindow.getMap()) { infoWindow.close(); } else { infoWindow.open(map, marker); } map.setCenter(latlng); //클릭 위치로 이동 map.setZoom(17, true); } } } }, $.fileDown = function(mode, ix) { try { var f = document.downfrm; f.mode.value = mode; f.ix.value = ix; f.target = $._actionfrm; f.submit(); } catch (e) { $.Error(e); } }, $.fileDownOne = function(mode, columns, ix) { try { var f = document.downfrm; f.mode.value = mode; f.columns.value = columns; f.ix.value = ix; f.target = $._actionfrm; f.submit(); } catch (e) { $.Error(e); } } })(jQuery); function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i= 0 ) { var eventNames = ["mousedown", "mouseover", "mouseout", "mousemove", "mousedrag", "click", "dblclick", "keydown", "keypress", "keyup" ]; for( var i = 0 ; i < eventNames.length; i++ ) { window.addEventListener( eventNames[i], function(e) { window.event = e; }, true ); } } function closeDaumPostcode() { // iframe을 넣은 element를 안보이게 한다. document.getElementById('layer').style.display = 'none'; } function initLayerPosition(){ var width = 320; //우편번호서비스가 들어갈 element의 width var height = 400; //우편번호서비스가 들어갈 element의 height var borderWidth = 1; //샘플에서 사용하는 border의 두께 // 위에서 선언한 값들을 실제 element에 넣는다. document.getElementById('layer').style.width = width + 'px'; document.getElementById('layer').style.height = height + 'px'; document.getElementById('layer').style.border = borderWidth + 'px solid'; // 실행되는 순간의 화면 너비와 높이 값을 가져와서 중앙에 뜰 수 있도록 위치를 계산한다. document.getElementById('layer').style.left = (((window.innerWidth || document.documentElement.clientWidth) - width)/2 - borderWidth) + 'px'; document.getElementById('layer').style.top = (((window.innerHeight || document.documentElement.clientHeight) - height)/2 - borderWidth) + 'px'; } function addDashMem(check){ var check_string = check.value; var check_string = check_string.replace(/-/gi,''); var len = check_string.length; if (len >= 1 && check_string.substr(0,1) == '1'){ if (len >= 5 && len <= 7){ var subA = check_string.substr(0,4); var subF = check_string.substr(4,4); check.value = subA + "-" + subF; } else if (len >= 8){ var subA = check_string.substr(0,4); var subF = check_string.substr(4,4); check.value = subA + "-" + subF; } else{ check.value = check_string; } } else if (len >= 2 && check_string.substr(0,2) == '02'){ if (len >= 3 && len <= 5){ var subA = check_string.substr(0,2); var subF = check_string.substr(2,3); check.value = subA + "-" + subF; } else if (len >= 6 && len <= 9){ var subA = check_string.substr(0,2); var subF = check_string.substr(2,3); var subB = check_string.substr(5,4); check.value = subA + "-" + subF + "-" + subB; } else if (len >= 10){ var subA = check_string.substr(0,2); var subF = check_string.substr(2,4); var subB = check_string.substr(6,4); check.value = subA + "-" + subF + "-" + subB; } else{ check.value = check_string; } } else if (len >= 2 && check_string.substr(0,2) != '02'){ if (len >= 4 && len <= 6){ var subA = check_string.substr(0,3); var subF = check_string.substr(3,3); check.value = subA + "-" + subF; } else if (len >= 7 && len <= 10){ var subA = check_string.substr(0,3); var subF = check_string.substr(3,3); var subB = check_string.substr(6,4); check.value = subA + "-" + subF + "-" + subB; } else if (len >= 11){ var subA = check_string.substr(0,3); var subF = check_string.substr(3,4); var subB = check_string.substr(7,4); check.value = subA + "-" + subF + "-" + subB; } else{ check.value = check_string; } } else{ check.value = check_string; } } /* //우클릭 방지 $(document).ready(function() { $(document).bind("contextmenu", function(e){ alert("오른쪽 마우스 금지"); return false; }); $('img').bind("contextmenu",function(e){ alert("그림에서 오른쪽 마우스 금지"); return false; }); $('img').bind("selectstart",function(e){ alert("그림에서 오른쪽 마우스 금지"); return false; }); }); document.oncontextmenu=function(){return false;} // 우클릭 방지 document.onselectstart=function(){return false;} // 드래그 방지 document.ondragstart=function(){return false;} // 선택 방지 document.onmousedown=function(){return false;} */