///// String 관련 //get파라미터가져오기 function request(param) { try { var aParams = new Array(); var sUrlParam = document.location.search.substring(1); for(var nIdx=0; nIdx 4){nbytes += 2;}else if(ch =="\n"){if(orgText.charAt(i-1) != "\n"){nbytes +=1;}}else if(ch == "<" || ch == ">"){nbytes += 4;}else{nbyte += 1;} } return nbytes; } //글자수 잘라내기 //아래 함수로 교체 //jaeils function fnSetLength_BACKUP(orgText, maxLen, addStr) { var inc = 0, nbytes = 0, msg = "", msglen = orgText.length; for(i=0;i 4){inc = 2;}else if(ch == "\n"){if(orgText.charAt(i-1) != "\n"){inc = 1;}}else if(ch == "<" || ch == ">"){inc = 4;}else{inc = 1;}if((nbytes + inc) > maxLen){msg += addStr;break;} nbytes += inc; msg += ch; } return msg; } //글자수 잘라내기 jaeils 2012-12-13 html decoding 후 문자열 짤라낸다. function fnSetLength(orgText, maxLen, addStr) { var inc = 0, nbytes = 0, msg = "", msglen = 0, newText = "", newMaxLen; try { el = document.createElement('div'); el.innerHTML = orgText; el.innerHTML = el.innerHTML; newText = el.innerText; msglen = newText.length; newMaxLen = maxLen; for(i=0;i 4){inc = 2;}else if(ch == "\n"){if(newText.charAt(i-1) != "\n"){inc = 1;}}else if(ch == "<" || ch == ">"){inc = 4;}else{inc = 1;}if((nbytes + inc) > newMaxLen){msg += addStr;break;} nbytes += inc; msg += ch; } return msg; } catch(ex) { return orgText.substring(0, parseInt(maxLen/2, 10)) + addStr; } } //왼쪽 공백문자 제거(별로 안좋아보이므로 담에 다시 바꾸자) function fn_Ltrim(strValue) { try { while (strValue.length>0){if(strValue.charAt(0) == ' '){strValue=strValue.substring(1,strValue.length);}else{return strValue;}} return strValue; } catch(e){alert(e.description);} } //오른쪽 공백문자 제거(별로 안좋아보이므로 담에 다시 바꾸자) function fn_Rtrim(strValue) { try { while (strValue.length>0){if(strValue.charAt(strValue.length-1)==' '){strValue=strValue.substring(0,strValue.length-1);}else{return strValue;}} return strValue; } catch(e){alert(e.description);} } //String 의 공백을 모두 제거한다. function fn_Trim(sourceString) { try{return sourceString.replace(/\s/g,"");}catch(exception){return sourceString;} } //String 의 양쪽공백을 모두 제거한다. function fn_RLTrim(strSource) { try{return strSource.replace(/(^\s*)|(\s*$)/g, "");}catch(exception){return strSource;} } //html 태그(<로 시작해서 >로 닫히는 문자열) 제거 function skip_html(string) { try { var objStrip = new RegExp(); objStrip = /[<][^>]*[>]/gi; return string.replace(objStrip, ""); } catch(e) { alert(e.description); } } //문자열 바꿈 function fn_ReplaceAll(oldStr,findStr,repStr) { try { var srchNdx = 0, newStr = ""; while (oldStr.indexOf(findStr,srchNdx) != -1){newStr += oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));newStr += repStr;srchNdx = (oldStr.indexOf(findStr,srchNdx) + findStr.length);} newStr += oldStr.substring(srchNdx,oldStr.length); return newStr; } catch(exception){} } //숫자 포맷.. 세자리수마다.. 콤마 표시 function fn_ReturnMoneyFormatString(numValue) { var strValue = "", retValue = ""; try { strValue = "" + numValue + ""; for(i=0; i 0 && (i%3)==0){retValue = strValue.charAt(strValue.length - i -1) + "," + retValue;}else{retValue = strValue.charAt(strValue.length - i -1) + retValue;}} return retValue; } catch(exception){} } //// 윈도우 창 관련 //윈도우창 모니터화면 가운데 띄우기 function fn_OpenCenterWindow(url, width, height, winName, feature) { var nTop = 0, nLeft = 0, nHeight = height, nWidth = width, strFeature = "", oWindow = null; try { if(feature != null && feature.length > 0){strFeature = "," + feature;}else{strFeature = strFeature;} nTop = (window.screen.height / 2) - (nHeight / 2);nLeft = (window.screen.width / 2) - (nWidth / 2); oWindow = window.open(url, winName, "width=" + nWidth + ",height=" + nHeight + ",top=" + nTop + ",left=" + nLeft + strFeature); if(oWindow) { oWindow.focus(); } } catch(e){alert(e.description);} finally{oWindow = null;} } //윈도우창 클릭한 브라우져의 가운데에 띄우기 function fn_OpenCenterBrowserWindow(url, width, height, winName, feature) { var nTop = 0, nLeft = 0, nHeight = height, nWidth = width, strFeature = "", oWindow = null; try { if(feature != null && feature.length > 0){strFeature = "," + feature;}else{strFeature = strFeature;} if(window.document.body.offsetHeight > height && window.document.body.offsetWidth > width) { nTop = ((window.document.body.offsetHeight - height) / 2) + window.screenTop; nLeft = ((window.document.body.offsetWidth - width) / 2) + window.screenLeft; if(nTop < (window.screen.height - height) && nLeft < (window.screen.width - width)) { oWindow = window.open(url, winName, "width=" + nWidth + ",height=" + nHeight + ",top=" + nTop + ",left=" + nLeft + strFeature); if(oWindow) { oWindow.focus(); } } else { //새창이 모니터 화면을 벗어나면 가운데 열기 fn_OpenCenterWindow(url, width, height, winName, feature); } } else { //새창이 더 크면 모니터화면 가운데에 열기 fn_OpenCenterWindow(url, width, height, winName, feature); } } catch(e){alert(e.description);} finally{oWindow = null;} } //마우스 클릭한데서 띄우기 function fn_OpenMousePointWindow(url, width, height, winName, feature, MouseEvent) { var nTop = 0, nLeft = 0, nHeight = height, nWidth = width, strFeature = "", oWindow = null, nMouseTop = 0, nMouseLeft = 0; try { nMouseTop = MouseEvent.screenY;nMouseLeft = MouseEvent.screenX; if(feature != null && feature.length > 0){strFeature = "," + feature;}else{strFeature = strFeature;} if((nMouseTop + height) > window.screen.height){nTop = (window.screen.height - height) - 90;}else{nTop = nMouseTop;} if((nMouseLeft + width) > window.screen.width){nLeft = (window.screen.width - width) - 10;}else{nLeft = nMouseLeft;} oWindow = window.open(url, winName, "width=" + nWidth + ",height=" + nHeight + ",top=" + nTop + ",left=" + nLeft + strFeature); if(oWindow) { oWindow.focus(); } } catch(e){alert(e.description);} finally{oWindow = null;} } //모달팝업창을 띠운다. function fn_OpenModalDialog(sUrl,sParam, sFeature) { try { var strReturn = ""; strReturn = window.showModalDialog("/_include/html/ModalDialog.html?" + sUrl, sParam, sFeature); return strReturn; } catch(exception){} } //모달리스팝업창을 띠운다. function fn_OpenModelessDialog(sUrl,sParam, sFeature) { try { var strReturn = ""; strReturn = window.showModelessDialog("/_include/html/ModelessDialog.html?" + sUrl, sParam, sFeature); return strReturn; } catch(exception){} } //리스트 화면에서 쓰는 함수이다.. //날짜 관련함수 (선택된 월의 마지막날짜 구하고 출력) function GetLastDay(oYear, oMonth, oDay, currentDay) { try { oDay.options.length=1; month_day = new Array(31,28,31,30,31,30,31,31,30,31,30,31); if(parseInt(oYear.value) % 4 == 0){month_day[1] = 29;} for(i=0; i<12; i++){if(oMonth[i].selected){print_day = month_day[i];break;}} for(i=0; i"); } /*************************************************** interactive 관련 함수 2010.7.21 추가 ***************************************************/ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab
"); var flashvars = {xmlPath:"http://static.joins.com/joongang/data/interactive/_xml/"+strDir+"/"+strAid+".xml", id:"swfId"+sid}; var attributes = {id:"swfId"+sid}; var params = {wmode:"opaque", allowfullscreen:"true", allowscriptaccess:"always"}; //고정 swfobject.embedSWF("http://static.joins.com/joongang/ui/swf/interactive/chart_pie_a.swf", "swfdiv"+sid, "250", "308", "10.0.0", "http://static.joins.com/joongang/ui/swf/interactive/expressInstall.swf", flashvars, params, attributes); } //interactive flash 에서 호출하는 함수 function setSwfHeight(swfID,swfH) { swfobject.getObjectById(swfID).height = swfH; } function interactive_flash(url, width, height){ //단품형 플레쉬 호출 var flashvars = {xmlPath:"", id:"swfIdstamdalone"}; var attributes = {id:"swfIdstamdalone"}; var params = {wmode:"opaque", allowfullscreen:"true", allowscriptaccess:"always"}; //고정 document.write ("
"); swfobject.embedSWF(url, "swfIdstamdalone", width, height, "10.0.0", "http://static.joins.com/joongang/ui/swf/interactive/expressInstall.swf", flashvars, params, attributes); } function interactive_swf_chart(sid,swfurl,width,height) { //chart_type 은 추후에 그래프 이외로 들어갈때 사용하자 var strAid = sid, cntAid = strAid.length; var strDir = strAid.substring(cntAid-3, cntAid); // 끝에서 세번째 숫자(디렉토리)를 읽어오자 if (strDir.length == 2){strDir = "0"+strDir} if (strDir.length == 1){strDir = "00"+strDir} if (width=="250"){document.write ("
");} else{document.write ("
");} var flashvars = {xmlPath:"http://static.joins.com/joongang/data/interactive/_xml/"+strDir+"/"+strAid+".xml", id:"swfId"+sid}; var attributes = {id:"swfId"+sid}; var params = {wmode:"opaque", allowfullscreen:"true", allowscriptaccess:"always"}; //고정 swfobject.embedSWF(swfurl, "swfdiv"+sid, width, height, "10.0.0", "http://static.joins.com/joongang/ui/swf/interactive/expressInstall.swf", flashvars, params, attributes); } /* function skip_html(string) { var objStrip = new RegExp(); objStrip = /[<][^>]*[>]/gi; return string.replace(objStrip, ""); } */ function alt_title(string) { otValue = string; try { otValue = skip_html(otValue); otValue = otValue.replace(/\"/g, "“"); return otValue; } catch (e) { alert(e.description); } } //두 날짜 사이의 간격을 리턴한다. function fnDateDiff(sDate, eDate) { var arrDate, dtStart, dtEnd, dtDiff, iDays; try { arrDate = sDate.split("-"); dtStart = new Date( fn_GetInt(arrDate[0]), fn_GetInt(arrDate[1]) - 1, fn_GetInt(arrDate[2]) ); arrDate = eDate.split("-"); dtEnd = new Date( fn_GetInt(arrDate[0]), fn_GetInt(arrDate[1]) - 1, fn_GetInt(arrDate[2]) ); dtDiff = dtEnd.getTime() - dtStart.getTime(); iDays = Math.floor(dtDiff/1000/60/60/24); return iDays; } catch(exception){return null;} } function fn_GetInt(sNum) { try { for ( var i =0 ; i < sNum ; i++ ) { if ( sNum.substring(0, 1) == 0 ){sNum = sNum.substring(1, sNum.length);} else{return parseInt(sNum);} } return parseInt(sNum); } catch (exception){} } //링크에서 TOTLA_ID 추출 function fnGetTotalIdfromLink(sLink) { var strtotal_id = ""; sLink = $.trim(sLink); if (sLink.indexOf("total_id=") > 0) strtotal_id = unescape((RegExp('total_id=' + '(.+?)(&|$)').exec(sLink) || [, ""])[1]); else if (sLink.indexOf("Total_ID=") > 0) strtotal_id = unescape((RegExp('Total_ID=' + '(.+?)(&|$)').exec(sLink) || [, ""])[1]); else if (sLink.indexOf("listid=") > 0) strtotal_id = unescape((RegExp('listid=' + '(.+?)(&|$)').exec(sLink) || [, ""])[1]); else strtotal_id = sLink.split(/[\/ ]+/).pop(); strtotal_id = strtotal_id.split(/[\. ]+/)[0]; return strtotal_id }