var cs_username = ""; var cs_ape_username = ""; var cs_name = ""; var cs_english_name = ""; var cs_nickname = ""; var cs_email = ""; var cs_level = ""; var cs_mobile = ""; var cs_tel_country_code = ""; var cs_language_code = ""; var cs_nationality_code = ""; var cs_country_code = ""; var cs_kor_country_name = ""; var cs_eng_country_name = ""; var cs_location_code =""; var MobileDevice = new Object(); var Browser = new Object(); var Browser_language = "";//브라우저의 언어 var Browser_language1 = "";//브라우저의 임시저장 언어 var Temp_language = "";//한국어와 한국어가 아닌 경우의 두가지로만 분류하여 처리할 때 임시로 쓰일 언어 var Real_language = "";//로그인되어 있을 경우:프로필 정보에 세팅되어 있는 사용언어 / 로그인되어 있지 않을 경우:브라우저의 언어 var Real_country_code = "";//실제 국가 코드 var Temp_country_code = "";//한국과 한국이 아닌 경우의 두가지로만 분류하여 처리할 때 임시로 쓰일 국가 var Tel_country_code = ""//국가 전화 코드 var Temp_country_name = "";//한국과 한국이 아닌 경우의 두가지로만 분류하여 처리할 때 임시로 쓰일 국가명 /* json데이타의 무한루프 도는 문자 제거 */ function del_looping(json) { if(json.substring(0,8) == "for(;;);") { json = json.substring(8); } return json; } /* get_username_from_ape_username */ function get_username_from_ape_username(ape_username) { var temp_username = new Array(); temp_username = ape_username.split("*"); return temp_username[0]; } function get_country_code_from_ip(){ if("") {//로그인된 경우 Real_country_code = ""; Tel_country_code = ""; if(Real_language == 'ko') { Temp_country_name = ""; } else { Temp_country_name = ""; } } else { //아이피로부터 국가코드 가져오기 var num_temp = Math.ceil(Math.random() * 10000); var requester_str = "num_temp=" + num_temp + "&mode=get_country_code_from_ip&ip=" + "3.144.36.141&language=" + Real_language; $.ajax({ url: 'common/search_data.php', type: 'post', data: requester_str, success: function (content) { contents = eval("(" + content + ")"); if(contents.ok=='ok'){ Real_country_code = contents.country_code; Tel_country_code = contents.tel_country_code; if(Real_language == 'ko') { Temp_country_name = contents.country_name_ko; } else { Temp_country_name = contents.country_name_en; } } } }) } } //문자열을 timestamp값으로 변환 function toTimestamp(strDate){ var datum = Date.parse(strDate); return datum / 1000; } /* 유닉스 타임스탬프 구하기 유닉스 타임스탬프는 1970년 1월 1일 0시부터 지금까지 시각을 초로 환산한 것이다. 각종 시간 수치의 기본형으로 활용하기 편하다. 다양한 값으로 변환해 사용할 수 있다. */ fetch_unix_timestamp = function() { return Math.floor(new Date().getTime() / 1000); } fetch_unix_timestamp_str = function(str) { return Math.floor(new Date(str).getTime() / 1000); } //trim 함수 function trim(str) { if(!str) { return ''; } else { str = str.replace(/^\s+/, ''); for (var i = str.length - 1; i > 0; i--) { if (/\S/.test(str.charAt(i))) { str = str.substring(0, i + 1); break; } } return str; } } /* 브라우저간 호환성을 위한 함수들 */ function setInnerTextProperty()//FF에서 innerText 사용 가능하게 함. { if (typeof HTMLElement != "undefined" && typeof HTMLElement.prototype.__defineGetter__ != "undefined") { HTMLElement.prototype.__defineGetter__("innerText", function () { if (this.textContent) { return(this.textContent) } else { var r=this.ownerDocument.createRange(); r.selectNodeContents(this);return r.toString(); } } ); HTMLElement.prototype.__defineSetter__("innerText", function (sText) { this.innerHTML=sText } ); } } function IE_Ver() {//IE 버전 체크 함수 if(navigator.appName.match(/Explorer/i)) { return navigator.appVersion.match(/MSIE \d+.\d+/)[0].split(" ")[1]; } else { return 0; } } function browser_check(){//브라우저 체크함수 Browser.isIE = (navigator.userAgent.toLowerCase().indexOf("msie")!=-1); Browser.isIE_SV1 = (navigator.userAgent.toLowerCase().indexOf("sv1")!=-1); Browser.isIE_SV2 = (navigator.userAgent.toLowerCase().indexOf("sv2")!=-1); Browser.isIE_7 = (navigator.userAgent.toLowerCase().indexOf("msie 7")!=-1); Browser.isIE_8 = (navigator.userAgent.toLowerCase().indexOf("msie 8")!=-1); Browser.isIE_9 = (navigator.userAgent.toLowerCase().indexOf("msie 9")!=-1); Browser.isIE_10 = (navigator.userAgent.toLowerCase().indexOf("msie 10")!=-1); Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1); Browser.isChrome = (navigator.userAgent.toLowerCase().indexOf("chrome")!=-1); Browser.isSafari = (navigator.userAgent.toLowerCase().indexOf("safari")!=-1); Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1); Browser.isNetscape = (navigator.userAgent.toLowerCase().indexOf("netscape")!=-1); Browser.isEtc = (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1 && navigator.userAgent.toLowerCase().indexOf("firefox")==-1 && navigator.userAgent.toLowerCase().indexOf("netscape")==-1 ); if(Browser.isIE && IE_Ver() <= 10) { // IE 브라우저인 경우 버전10 미만인일 때 Browser.islowIE10 = true; } } function mobile_check() { var deviceAgent = navigator.userAgent.toLowerCase(); MobileDevice.is_android = deviceAgent.match(/android/i); MobileDevice.is_webos = deviceAgent.match(/webos/i); MobileDevice.is_iphone = deviceAgent.match(/iphone/i); MobileDevice.is_ipod = deviceAgent.match(/ipod/i); MobileDevice.is_ipad = deviceAgent.match(/ipad/i); MobileDevice.is_blackberry = deviceAgent.match(/blackberry/i); if(deviceAgent.match(/android/i) || deviceAgent.match(/webos/i) || deviceAgent.match(/iphone/i) || deviceAgent.match(/ipod/i) || deviceAgent.match(/ipad/i) || deviceAgent.match(/blackberry/i)){ return true; } else { return false; } } // ************** 공용 함수 ************** // //화면 중앙에 오도록 새창 뛰우는 함수 시작 function win_comment(mypage, myname, w, h, scroll) { var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrolling='+scroll+',noresizable=yes'+',location=no,menubar=no,status=no,toolbar=no'; win=window.open(mypage, myname, winprops); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } win.focus(); } //화면 중앙에 오도록 새창 뛰우는 함수 끝 //html 문서 없이 이미지창 열게 하는 스크립트 시작 var win1Open = null function displayImage(picName, windowName, windowWidth, windowHeight){ return window.open(picName,windowName,"toolbar=no,scrollbars=no,resizable=no,width=" + (parseInt(windowWidth)+20) + ",height=" + (parseInt(windowHeight)+15)) } function winClose(){ if(win1Open != null) win1Open.close() } function doNothing(){} function displayImage(picName, windowName, windowWidth, windowHeight){ var winl = (screen.width - windowWidth) / 2; var wint = (screen.height - windowHeight) / 2; var winHandle = window.open("" ,windowName,"toolbar=no,scrollbars=no,resizable=no,width=" + windowWidth + ",height=" + windowHeight + ",left=" + winl + ",top=" + wint) if(winHandle != null){ var htmlString = "Picture" htmlString += "" htmlString += "닫기" htmlString += "" winHandle.document.open() winHandle.document.write(htmlString) winHandle.document.close() } if(winHandle != null) winHandle.focus() return winHandle } //html 문서 없이 이미지창 열게 하는 스크립트 끝 function getRightURL(n) { /* 문자열의 공백을 모두 제거한 뒤에 문자열을 검사해서 http:// , https://, ftp:// .. etc 로 시작하지 않을 경우 http:// 를 맨앞에 붙여서 반환 */ var tmpURL = n.replace(/\s/g, "") var tmp = tmpURL.toLowerCase(); if( tmp.indexOf("http://") == 0 || tmp.indexOf("https://") == 0 || tmp.indexOf("ftp://") == 0 || tmp.indexOf("mailto://") == 0 || tmp.indexOf("mms://") == 0 || tmp.indexOf("pnm://") == 0 || tmp.indexOf("telnet://") == 0 || tmp.indexOf("rlogin://") == 0 || tmp.indexOf("news://") == 0 || tmp.indexOf("file://") == 0) return tmpURL; else return "http://"+tmpURL; } /* function capitalize(str){//첫글자를 대문자로... var str1 = str.substring(0,1).toUpperCase(); var str1 = str.substring(1); return str1 + str2; } */ function detect_browser_language() {//구글 언어셋에 브라우저 언어가 일치하는 것이 있는지 검사하여 일치하는 게 없으면 "en"으로 설정 Browser_language = "";//브라우저의 언어값중 앞에서 2자리를 가져옴 Browser_language1 = "";//브라우저의 언어값중 앞에서 2자리를 가져옴 //Browser_language = "구글에 없는 언어"; //Browser_language = "ja"; /* 구글 언어셋과 일치하지 않는 브라우저 언어셋을 구글 언어셋으로 맞추어 줌 */ if(Browser_language == "he") { Browser_language1 = "iw"; } else if(Browser_language == "in") { Browser_language1 = "id"; } else if(Browser_language == "ji") { Browser_language1 = "yi"; } var target = "en"; var num_temp = Math.ceil(Math.random() * 10000); var url = 'https://www.googleapis.com/language/translate/v2/languages?key=AIzaSyAFV-IkO8gMPXjpSNFpyREQ3p9ugQIqb7E&callback=detect_list&target=' + target+"&num_temp="+num_temp; $.ajax({ asyn: false, type: 'get', url: url, dataType: "script" }); } function detect_list(response) { var count = 0; for (l in response.data.languages) { var lngCode = response.data.languages[l].language.toLowerCase(); //var lngCode = response.data.languages[l].language; if (lngCode == Browser_language1) { count++;break; } } if(count == 0) { Browser_language1 = "en"; } } function get_language_code_from_browser(){ detect_browser_language(); if("") {//로그인된 경우 Real_language = ""; } else {//로그인 안한 경우 Real_language = Browser_language1; } if(Real_language == "ko") { Temp_language = "ko"; } else { Temp_language = "en"; } } function get_country_code(){// $.getJSON("http://api.wipmania.com/jsonp?callback=?",'',function(data) { var country_code1 = data.address.country_code.toLowerCase();//접속 IP로 국가 코드를 얻는다. if(country_code1 == "kr") { var country_code = "ko"; } else{ var country_code = "en"; } jQuery.jCookie("IP_COUNTRY_CODE",country_code); }); } /* function get_country_code_from_ip(){//현재 유료 서비스로 바뀐듯. var country_code; $.getJSON("http://api.wipmania.com/jsonp?callback=?",'',function(data) { var country_code1 = data.address.country_code.toLowerCase();//접속 IP로 국가 코드를 얻는다. if(country_code1 == "kr") { country_code = "ko"; } else{ country_code = "en"; } alert("get_country_code_from_ip : "+country_code); //return country_code; }); } */ function $fr(fr,id) {//fr은 frame name return top.frames[fr].document.getElementById(id); } function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } String.prototype.capitalize = function() { //첫글자를 대문자로... return this.replace(/\b([a-z])/g, function($1){ return $1.toUpperCase(); }) ; }; String.prototype.trim = function(){// 문장의 앞과 뒤의 공백 제거 a = this var search = 0 while ( a.charAt(search) == " ") search = search + 1 a = a.substring(search, (a.length)) search = a.length - 1 while (a.charAt(search) ==" ") search = search - 1 return a.substring(0, search + 1) } /** 쿠키 관련 함수 시작 **/ function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie(name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function DeleteCookie(name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } function currunt_timestamp(){ var now = new Date(); var timestamp = (now.getTime()/1000).toFixed(); return timestamp; } /** 쿠키 관련 함수 끝 **/ /* 객체 길이 구하는 함수 */ function obj_len(obj) { //obj_len = function(obj) { var L=0; $.each(obj, function(i, elem) { L++; }); return L; }