PageSourceSearch

https://www.ohmynews.com/NWS_Web/Common/JS/NWSFunction.JS

js ohmynews.com collected 2026-09-24 08:49:04 UTC 139,815 bytes, 3,623 lines download raw bytes

1
2//////////////////////////////////////////////////////////////////////////////////
3// - JS 스크립트 공통 합수
4//////////////////////////////////////////////////////////////////////////////////
5
6var _cContentID = "ctl00_cphNWS_";
7var _cContentID_MED = "ctl00_cphMED_";
8
9/************************************************************************************************
10* Procedure   : cross browsing
11* Description : Enter 키 막음
12* Parameter   : 
13* Return      : 
14*************************************************************************************************/
15// cross browsing
16document.onkeypress  = function(e){
17    if(typeof(e) != "undefined")
18    {
19	    if (e.which == 13)
20	    {
21		    if(e.target.tagName.toUpperCase() != "TEXTAREA")
22			    e.preventDefault();
23	    }
24    }
25    else
26    {
27	    if (event.keyCode == 13)
28	    {
29		    if(event.srcElement.tagName.toUpperCase() != "TEXTAREA")
30			    event.returnValue = false;
31	    }
32    }
33}
34
35
36/************************************************************************************************
37* Procedure   : doEnterKey
38* Description : Enter 키 실행 처리
39* Parameter   : 
40* Return      : 
41*************************************************************************************************/
42function doEnterKey(pPostBackObjNm)
43{
44    if (event.keyCode == 13)
45    {
46        try
47        {
48            __doPostBack(pPostBackObjNm, "");
49        }
50        catch(e) {}
51    }
52}
53
54/************************************************************************************************
55* Procedure   : AllLayerClose
56* Description : 모든 열린 layer 닫음
57* Parameter   : 
58* Return      : 
59*************************************************************************************************/
60function AllLayerClose() {
61    if(event.srcElement.tagName.toUpperCase() != "A" && event.srcElement.tagName.toUpperCase() != "IMG" && event.srcElement.tagName.toUpperCase() != "INPUT")
62    {
63        PopupClose("ball1");                //커뮤니티 팝업 닫음
64        //PopupClose("repl_layer");           //조회(쓴편집노트 등) 팝업 닫음
65        //PopupClose("hist_layer");           //기사배치이력 팝업 닫음
66    }
67}
68//document.onclick = AllLayerClose;
69
70function PopupClose(pId)
71{
72    var rId = document.getElementById(pId);
73    
74    if(rId != null)
75    {
76        if(rId.style.display == "block" || rId.style.display == "")
77        {
78            rId.style.display = "none";
79        }
80    }
81}
82
83/************************************************************************************************
84* Procedure   : GetBrowserType
85* Description : 브라우저 알아내기
86* Parameter   : 
87* Return      : string
88*************************************************************************************************/
89function GetBrowserType()
90{
91    var strType;
92
93    if(new RegExp(/Firefox/).test(navigator.userAgent)){ 
94        strType = "FF";
95    }else if(new RegExp(/Netscape/).test(navigator.userAgent)){ 
96        strType = "NS";
97    }else if(new RegExp(/MSIE/).test(navigator.userAgent)){
98        strType = "IE";
99    }
100    return strType;
101}
102
103function GetBrowserType2() {
104    var strType;
105
106    if (new RegExp(/Firefox/).test(navigator.userAgent)) {
107        strType = "FF";
108    } else if (new RegExp(/Netscape/).test(navigator.userAgent)) {
109        strType = "NS";
110    } else if (new RegExp(/MSIE/).test(navigator.userAgent)) {
111        strType = "IE";
112    }
113    else if (new RegExp(/rv:11.0/).test(navigator.userAgent)) {
114        strType = "IE";
115    }
116
117    return strType;
118}
119    
120/************************************************************************************************
121* Procedure   : GetObject
122* Description : .NET 에서 master 를 쓸때 페이지에서 해당 컨트롤의 Object 값을 가져올때.
123* Parameter   : pObjNm - string 컨트롤명
124* Return      : Object
125*************************************************************************************************/
126function GetObject(pObjNm)
127{
128    //return eval("document.getElementById('" + _cContentID + pObjNm + "')");
129    if (document.getElementById(_cContentID + pObjNm)) return eval("document.getElementById('" + _cContentID + pObjNm + "')");
130    else return eval("document.getElementById('" + "cphNWS_" + pObjNm + "')");
131}
132
133function GetObject(pObjNm, psMaster)
134{
135    if (psMaster == "MED") {
136        if (document.getElementById(_cContentID + pObjNm)) return eval("document.getElementById('" + _cContentID_MED + pObjNm + "')");
137        else return eval("document.getElementById('" + "cphMED_" + pObjNm + "')");
138        //return eval("document.getElementById('" + _cContentID_MED + pObjNm + "')");
139    }
140    else {
141        if (document.getElementById(_cContentID + pObjNm)) return eval("document.getElementById('" + _cContentID + pObjNm + "')");
142        else return eval("document.getElementById('" + "cphNWS_" + pObjNm + "')");
143        //return eval("document.getElementById('" + _cContentID + pObjNm + "')");
144    }
145        
146        
147}
148/************************************************************************************************
149* Procedure   : GetObjectNm
150* Description : .NET 에서 master 를 쓸때 페이지에서 해당 컨트롤의 Name 값을 가져올때.
151* Parameter   : pObjNm - string 컨트롤명
152* Return      : string 컨트롤 명
153*************************************************************************************************/
154function GetObjectNm(pObjNm)
155{
156    return _cContentID + pObjNm;
157}
158
159function GetObjectNm(pObjNm, psMaster)
160{
161    if(psMaster == "MED")
162        return _cContentID_MED + pObjNm;
163    else
164        return _cContentID + pObjNm;
165}
166/************************************************************************************************
167* Procedure   : XMLHTTPObject
168* Description : HTML로 작성된 파일 웹로그 처리
169* Parameter   : 
170* Return      : 
171*************************************************************************************************/
172function XMLHTTPObject()
173{
174  var oReq = null;  
175  
176  if (window.XMLHttpRequest)
177  {
178    oReq = new XMLHttpRequest();
179    //oReq.overrideMimeType('text/xml');
180  }
181  else if (window.ActiveXObject)
182  {
183    var ms_xml_http = new Array('Msxml2.XMLHTTP.7.0',
184                                'Msxml2.XMLHTTP.6.0',
185                                'Msxml2.XMLHTTP.5.0',
186                                'Msxml2.XMLHTTP.4.0',
187                                'Msxml2.XMLHTTP.3.0',
188                                'Msxml2.XMLHTTP',
189                                'Microsoft.XMLHTTP');
190
191    for (var i = 0; i < ms_xml_http.length; i++)
192    {
193      try
194      {
195        oReq = new ActiveXObject(ms_xml_http[i]);
196        break;
197      }
198      catch (e)
199      {
200        oReq = null;
201      }
202    }
203  }
204
205  return oReq;
206}
207
208function InsWebLog(pCUR_URL, pPRE_URL)
209{
210}
211
212/************************************************************************************************
213* Procedure   : goView
214* Description : 구성요소 상세보기 이동
215* Parameter   : pURL     : 이동 URL
216*               pCNTN_CD : 컨텐츠코드
217*               pPAGE_CD : 면코드
218*               pBLCK_NO : 블럭번호
219*               pCMPT_CD : 구성요소코드
220*               pNEW_GB  : 새창여부
221* Return      : 
222*************************************************************************************************/
223function goView(pURL, pCNTN_CD, pPAGE_CD, pBLCK_NO, pCMPT_CD, pNEW_GB)
224{   
225    var cntnURL = pURL + "?CNTN_CD=" + pCNTN_CD + "&PAGE_CD=" +  pPAGE_CD + "&BLCK_NO" + pBLCK_NO+ "&CMPT_CD" + pCMPT_CD;
226    if (pNEW_GB == "T" || pCNTN_CD.substring(0, 1) == "B"|| pCNTN_CD.substring(0, 1) == "P")
227    {
228        window.open(cntnURL, "_WinView", "").focus();
229    }
230    else location.href = cntnURL;
231}
232
233function goViewlink(pURL, pCNTN_CD, pPAGE_CD, pBLCK_NO, pCMPT_CD, pNEW_GB, objlink)
234{   
235    var strhref = pURL;
236    if (pNEW_GB == "T" || pCNTN_CD.substring(0, 1) == "B"|| pCNTN_CD.substring(0, 1) == "P" || location.href.toLowerCase().indexOf("ojs_adminweb") > 0)
237    {
238        objlink.target="_WinView";
239    }
240    else
241    {
242        strhref = strhref.replace("http://www.ohmynews.com", "");
243        strhref = strhref.replace("https://www.ohmynews.com", "");
244    }
245    strhref = strhref + "?CNTN_CD=" + pCNTN_CD;
246    strhref += "&PAGE_CD=" + pPAGE_CD;
247    strhref += "&BLCK_CD=" + pPAGE_CD;
248    strhref += "&CMPT_CD=" + pCMPT_CD;
249    objlink.href = strhref;    
250}
251
252/************************************************************************************************
253* Procedure   : showPopup
254* Description : 팝업으로 보여짐
255* Parameter   : e : event, id : 팝업으로 보여질 아이디
256* Return      : 
257*************************************************************************************************/
258function showPopup(e, id) {
259	var obj=document.getElementById(id);
260	if (!e) var e = window.event;
261	var posx=0;
262	var posy=0;
263
264	if (e.pageX || e.pageY) { // pageX/Y 표준 검사
265		posx = e.pageX -20;
266		posy = e.pageY;
267	} 
268	else if (e.clientX || e.clientY) { //clientX/Y 표준 검사 Opera
269		posx = e.clientX - 20;
270		posy = e.clientY;
271		
272		if (window.event) { // IE 여부 검사
273			posx += document.documentElement.scrollLeft;
274			posy += document.documentElement.scrollTop;
275		}
276	}
277
278	obj.style.left = posx + "px";
279	obj.style.top = posy + "px";
280	obj.style.display='block';
281}
282
283/************************************************************************************************
284* Procedure   : hidePopup
285* Description : 팝업 숨김
286* Parameter   : id : 숨길 아이디
287* Return      : 
288*************************************************************************************************/
289function hidePopup(id){
290		document.getElementById(id).style.display='none';
291}
292
293/************************************************************************************************
294* Procedure   : showPopupCommunity
295* Description : 커뮤니티 팝업 보여짐
296* Parameter   : pMEM_CD - 멤버CD
297* Return      : 
298*************************************************************************************************/
299function showPopupCommunity(e, id, pMEM_CD, pIsFriend, pPCE_CD) {
300		
301	var obj=document.getElementById(id);
302	obj.setAttribute("memcd",pMEM_CD);
303	obj.setAttribute("pcecd",pPCE_CD);
304	
305	if (pIsFriend)
306	{
307	    var dvProposeFrd = document.getElementById("dvProposeFrd");
308	    var dvGoodByeFrd = document.getElementById("dvGoodByeFrd");
309	    
310	    if (pIsFriend == "Y") //친구사이 : 친구신청 숨김, 결별하기 보임
311	    {
312	        dvProposeFrd.style.display = "none";
313	        dvGoodByeFrd.style.display = "block";
314	    }
315	    else if (pIsFriend == "W") //친구 대기자 : 친구신청,결별하기 모두 숨김.
316	    {
317	        dvProposeFrd.style.display = "none";
318	        dvGoodByeFrd.style.display = "none";
319	    }  
320	}
321	
322	if (!e) var e = window.event;
323	var posx=0;
324	var posy=0;
325
326	if (e.pageX || e.pageY) { // pageX/Y 표준 검사
327		posx = e.pageX -20;
328		posy = e.pageY;
329	} 
330	else if (e.clientX || e.clientY) { //clientX/Y 표준 검사 Opera
331		posx = e.clientX - 20;
332		posy = e.clientY;
333		
334		if (window.event) { // IE 여부 검사
335			posx += document.documentElement.scrollLeft;
336			posy += document.documentElement.scrollTop;
337		}
338	}
339
340	obj.style.left = posx + "px";
341	obj.style.top = posy + "px";
342	obj.style.display='block';
343	obj.style.zIndex = 300;	
344}
345
346/************************************************************************************************
347* Procedure   : hidePopupCommunity
348* Description : 커뮤니티 팝업 숨김
349* Parameter   : 
350* Return      : 
351*************************************************************************************************/
352function hidePopupCommunity(pID){
353	
354	var dvID = (pID) ? pID : "ball1";
355	
356	document.getElementById(dvID).style.display='none';
357}
358
359/************************************************************************************************
360* Procedure   : showPopupSummary
361* Description : 간략히 보기 보여짐
362* Parameter   : pCNTN_CD - 컨텐츠 코드
363* Return      : 
364*************************************************************************************************/
365function showPopupSummary(e, id, pCNTN_CD){
366	var obj=document.getElementById(id);
367	if (!e) var e = window.event;
368	var posx=0;
369	var posy=0;
370
371	if (e.pageX || e.pageY) { // pageX/Y 표준 검사
372		posx = e.pageX - 190;
373		posy = e.pageY;
374	} 
375	else if (e.clientX || e.clientY) { //clientX/Y 표준 검사 Opera
376		posx = e.clientX - 190;
377		posy = e.clientY;
378		if (window.event) { // IE 여부 검사
379			posx += document.documentElement.scrollLeft;
380			posy += document.documentElement.scrollTop;
381		}
382	}
383
384	obj.style.left = posx + "px";
385	obj.style.top = posy + "px";
386	obj.style.display='block';
387	obj.style.zIndex = 200;
388	
389	var strReturn = "";
390	strReturn = NWSSummary.ShowSummary(pCNTN_CD);
391	document.getElementById("tdSummary").innerText = strReturn.value;
392}
393
394/************************************************************************************************
395* Procedure   : hidePopupSummary
396* Description : 간략히 보기 숨김
397* Parameter   : 
398* Return      : 
399*************************************************************************************************/
400function hidePopupSummary()
401{
402    document.getElementById("summary").style.display='none';
403}
404
405/************************************************************************************************
406* Procedure   : setRecommendCnt
407* Description : 추천수 처리
408* Parameter   : pCNTN_CD - 컨텐츠 코드
409* Return      : 
410*************************************************************************************************/
411function setRecommendCnt(pCNTN_CD)
412{
413	var arrResults = "";
414	var strReturn = "";
415	var strMemCd = "";
416	
417	strMemCd = NWSLogIn.GetMemberCd();
418	strReturn = NWSRecommend.ContentsRecommend(pCNTN_CD, strMemCd.value);
419		
420	arrResults = strReturn.value.split("|");
421	if (arrResults[0] == "0")  // 성공적으로 추천
422	{
423	    if (arrResults[1] == "T") // 중복 추천일 경우
424	        alert("해당 컨텐츠의 추천은 한번씩만 가능 합니다.    ");
425        else
426            alert("추천 하였습니다.    ");        
427	}
428	else
429	{
430	    alert("추천하기에 실패 하였습니다.    ");
431	}
432}
433
434/************************************************************************************************
435* Procedure   : GoSimpLogIn
436* Description : 간편로그인 팝업 띄우기(로그인여부 체크 후)
437* Parameter   : 
438* Return      : 
439************************************************************************************************/
440var AFTER_SRC = "";
441var AFTER_TYPE = "";
442function GoSimpLogIn(ev,pAfterSrc,pAfterType, pPositionType, pBackgroun
442d)
443{   
444    if (getCookie("MemCd") == "-1" || getCookie("MemCd") == "")  // 로그인 안됐을때
445    {
446        location.href = "https://www.ohmynews.com/NWS_Web/Mem/mem_login.aspx?goUrl=" + escape(pGoUrl);
447    }
448    else  // 로그인 되었을때
449    {
450    }
451}
452
453function CallBack_GoSimpLogIn(response)
454{
455}
456function SetAfterLogIn(pAfterSrc,pAfterType)
457{
458}
459function GoAfterLogIn()
460{
461}
462
463function GoLoginAfterLogIn()
464{
465}
466
467function hideSimpLogIn()
468{
469}
470
471/************************************************************************************************
472* Procedure   : GoLogIn
473* Description : 로그인 페이지로 이동(로그인여부 체크 후)
474* Parameter   : 
475* Return      : 
476*************************************************************************************************/
477var _AfterSrc = null;
478var _AfterType = null;
479function GoLogIn(pAfterSrc,pAfterType)
480{     
481    _AfterSrc = pAfterSrc;
482    _AfterType = pAfterType;
483    
484    NWSLogIn.IsMemberLogIn(CallBack_GoLogIn);                             
485}
486function CallBack_GoLogIn(response)
487{
488    if (response.error != null)
489    {
490        alert(response.error);
491        return false;
492    }
493             
494   if (response.value)
495   {
496       if (_AfterType == "url")
497            goURL(_AfterSrc);
498       else if (_AfterType == "script")
499            eval(_AfterSrc);  
500   } 
501   else if (!response.value)
502   {
503      var sUrl = "https://www.ohmynews.com/NWS/Mem/mem_login.aspx";
504      var sGoUrl = "";
505      
506      if (_AfterType == "url" && _AfterSrc != null)
507          sGoUrl = _AfterSrc;
508      
509      if (sGoUrl == "") sGoUrl = location.href;
510      
511      sUrl += "?gourl=" + escape(sGoUrl);
512      goURL(sUrl);
513   }          
514}       
515
516/************************************************************************************************
517* Procedure   : Login Y/N
518* Description : 로그인 여부 확인(메인면, 서브면과 같은 HTML 화면에서..)
519* Parameter   : 
520* Return      : 
521************************************************************************************************/
522function SetLoginYN()
523{   
524    NWSLogIn.IsMemberLogIn(CallBack_SetLoginYN);                             
525}
526function CallBack_SetLoginYN(response)
527{     
528    var bLoginYN = false;
529    
530    if (response.error != null)
531    {
532        bLoginYN = false;
533    }
534          
535    bLoginYN = response.value;
536           
537    if (bLoginYN)
538    {
539        var aLogIn = document.getElementById("aLogIn");
540        aLogIn.innerHTML = "로그아웃";
541
542        var aMember = document.getElementById("ctl00_aMember");          
543        aMember.innerHTML = "정보수정";
544        aMember.href = "/NWS_Web/Mem/Mem_Upd_Check.aspx"; 
545        
546        //document.getElementById("divFlash").style.display = "";
547        GetMain_MemCd();
548    }
549}
550
551 function getCookie(Name) {
552    var search = Name + "=";
553    
554    if (document.cookie.length > 0) {                 
555
556        offset = document.cookie.indexOf(search);
557        if (offset != -1){                                                
558
559            offset += search.length;                          
560            end = document.cookie.indexOf(";", offset);   
561            if (end == -1) 
562                end = document.cookie.length;
563            return unescape(document.cookie.substring(offset, end));
564        } 
565        return offset;
566    }
567 }
568
569/************************************************************************************************
570* Procedure   : Get MEM_CD
571* Description : 로그인 여부 확인(메인면, 서브면과 같은 HTML 화면에서..)
572* Parameter   : 
573* Return      : 
574************************************************************************************************/
575function GetMain_MemCd()
576{   
577    NWSLogIn.GetMemberCd(CallBack_GetMain_MemCd);                             
578}
579function CallBack_GetMain_MemCd(response)
580{     
581}
582
583/************************************************************************************************
584* Procedure   : Get MEM_CD
585* Description : 로그인 여부 확인(메인면, 서브면과 같은 HTML 화면에서..)
586* Parameter   : 
587* Return      : 
588************************************************************************************************/
589function GetSSLMemCd()
590{   
591    NWSLogIn.GetMemberCd(CallBack_GetSSLMemCd);
592}
593function CallBack_GetSSLMemCd(response)
594{     
595}
596
597
598/************************************************************************************************
599* Procedure   : goURL
600* Description : 페이지 이동
601* Parameter   : pURL     : 이동 URL
602* Return      : 
603*************************************************************************************************/
604function goURL(pURL)
605{   
606    parent.location.href = pURL;
607}
608
609/************************************************************************************************
610* Procedure   : goTagNetwork
611* Description : 태그 페이지 이동
612* Parameter   : pTAG_NM : 태그명
613* Return      : 
614*************************************************************************************************/
615function goTagNetwork(pTAG_NM)
616{
617
618}
619
620/************************************************************************************************
621* Procedure   : Trim
622* Description : 공백 제거 함수로 스페이스바로 입력 한 공백을 제거한다..
623* Parameter   : pStr - string 확인할 내용
624* Return      : string 공백을 제거한 내용
625*************************************************************************************************/
626function Trim(pStr) 
627{		
628    while (pStr.search(/^\s/) != -1)
629        pStr = pStr.replace(/^\s/,"");	
630    while (pStr.search(/\s$/) != -1)	
631        pStr = pStr.replace(/\s$/,"");
632    return pStr;
633}
634
635/*******************************************************************
636* Procedure   : IsNumeric
637* Description : 소수점 없는 숫자인지 체크.
638* Parameter   : pStr - string 확인할 내용
639* Return      : true/false
640*******************************************************************/
641function IsNumeric(pStr){
642	for(var i=0; i<pStr.length; i++) {
643        var uniCode = pStr.charCodeAt(i);
644
645        if(!(uniCode >= 48 && uniCode <= 57))
646            return false;
647    }
648
649    return true;
650}
651
652/*******************************************************************
653* Procedure   : chkNumKeyPress
654* Description : Keypress Event Only Number  
655* Example     : <asp:TextBox ID="txtYYYY" style="ime-mode:disabled;" onkeypress="chkNumKeyPress();"
656* Parameter   : 
657* Return      : true/false
658*******************************************************************/    
659function chkNumKeyPress() {
660    if ((event.keyCode<48) || (event.keyCode>57))
661        event.returnValue = false;
662}
663
664//소수점 허용
665function chkNumPointKeyPress() {
666   
667    if ((event.keyCode!=46) && (event.keyCode<48) || (event.keyCode>57))
668        event.returnValue = false;
669  
670}
671
672/*******************************************************************
673* Procedure   : IsNumeric
674* Description : 숫자(소수점 포함)인지 체크.
675* Parameter   : pStr - string 확인할 내용
676* Return      : true/false
677*******************************************************************/
678function IsDecimal(pStr){
679	for(var i=0; i<pStr.length; i++) {
680        var uniCode = pStr.charCodeAt(i);
681        
682        if(!((uniCode >= 48 && uniCode <= 57) || uniCode==46))
683            return false;
684    }
685    return true;
686}
687
688/************************************************************************************************
689* Procedure   : CheckRequired
690* Description : 필수항목 체크..입력이 안되었을 경우 메시지 Alert 후 해당 컨트롤에 포커스 이동
691* Parameter   : pObjID - string 컨트롤ID
692*               pMsg   - string 메시지 
693* Return      : true/false
694*************************************************************************************************/
695function CheckRequired(pObjID, pMsg) {
696    if (document.getElementById(pObjID)) {
697        if (Trim(document.getElementById(pObjID).value) == "") {
698            alert(pMsg + "     ");
699
700            try {
701                document.getElementById(pObjID).focus();
702            }
703            catch (E) { }
704
705            return false;
706        } 
707    }
708	
709	return true;
710}
711
712/************************************************************************************************
713* Procedure   : CheckRequired
714* Description : 필수항목 체크..입력이 안되었을 경우 메시지 Alert 후 해당 컨트롤에 포커스 이동
715* Parameter   : pObjID - string 컨트롤ID
716*               pMsg   - string 메시지 
717* Return      : true/false
718*************************************************************************************************/
719function CheckRequired2(pObjID, pMsg) {
720    if ($("[id*='" + pObjID + "']").length) {
721        if (Trim($("[id*='" + pObjID + "']").val()) == "") {
722            alert(pMsg + "     ");
723
724            try {
725                $("[id*='" + pObjID + "']").val().focus();
726            }
727            catch (E) { }
728
729            return false;
730        }
731    }
732
733    return true;
734}
735
736/************************************************************************************************
737* Procedure   : CheckMaxLength
738* Description : 필수항목 체크..입력이 안되었을 경우 메시지 Alert 후 해당 컨트롤에 포커스 이동
739* Parameter   : pObjID - string 컨트롤ID
740*               pMsg   - string 메시지 
741* Return      : true/false
742*************************************************************************************************/
743function CheckMaxLength(pObjID, pMaxLength, pMsg) {
744    if (GetByteSize(document.getElementById(pObjID).value) > pMaxLength) {
745		alert(pMsg + "     ");
746		
747		try {
748		    document.getElementById(pObjID).focus();
749		}
750		catch (E) {}
751		
752		return false; 
753	}
754	
755	return true;
756}
757
758/************************************************************************************************
759* Procedure   : CheckMaxLength2
760* Description : 필수항목 체크..입력이 안되었을 경우 메시지 Alert 후 해당 컨트롤에 포커스 이동
761* Parameter   : pObjID - string 컨트롤ID
762*               pMsg   - string 메시지 
763* Return      : true/false
764*************************************************************************************************/
765function CheckMaxLength2(pObjID, pMaxLength, pMsg) {
766    if (document.getElementById(pObjID).value.length > pMaxLength) {
767		alert(pMsg + "     ");
768		
769		try {
770		    document.getElementById(pObjID).focus();
771		}
772		catch (E) {}
773		
774		return false; 
775	}
776	
777	return true;
778}
779
780/************************************************************************************************
781* Procedure   : CheckMaxLength2
782* Description : 필수항목 체크..입력이 안되었을 경우 메시지 Alert 후 해당 컨트롤에 포커스 이동
783* Parameter   : pObjID - string 컨트롤ID
784*               pMsg   - string 메시지 
785* Return      : true/false
786*************************************************************************************************/
787function CheckMaxLength3(pObjID, pMaxLength, pMsg) {
788    if ($("[id*='" + pObjID + "']").val().length > pMaxLength) {
789        alert(pMsg + "     ");
790
791        try {
792            $("[id*='" + pObjID + "']").focus();
793        }
794        catch (E) { }
795
796        return false;
797    }
798
799    return true;
800}
801
802/************************************************************************************************
803* Procedure   : CheckMaxLengthAll
804* Description : input,textarea 항목의 입력 길이 체크.
805*               maxlength 속성이 지정된 경우에만 체크가능함.
806*               (※textarea는 코드비하인드에서 속성을 추가한다. (예) txtADM_NOTE.Attributes.Add("maxlength", "4000");
807* Parameter   : pObjID - string 컨트롤ID
808*               pMsg   - string 메시지 
809* Return      : true/false
810*************************************************************************************************/
811function CheckMaxLengthAll()
812{   
813     /* 입력 길이 체크 */
814     var controls = document.getElementsByTagName("INPUT");             
815     var i=0;
816     for (i=0; i<controls.length; i++)
817     {
818        if (controls[i].type == "text")
819        {
820            var bMaxLenNoCheck = controls[i].getAttribute("maxlengthnocheck");
821            
822            if(bMaxLenNoCheck == null || !eval(bMaxLenNoCheck))
823            {
824                var intMaxLen = controls[i].getAttribute("maxlength");
825                if (intMaxLen != null && GetByteSize(controls[i].value) > intMaxLen)
826                {
827                    alert(intMaxLen + " Byte" + MSG_5013_6);
828                    controls[i].focus();
829                    controls[i].select();
830                    return false;
831                }
832            }
833        }
834     }
835     controls = document.getElementsByTagName("TEXTAREA"); 
836     for (i=0; i<controls.length; i++)
837     {                
838        var bMaxLenNoCheck = controls[i].getAttribute("maxlengthnocheck");
839        
840        if(bMaxLenNoCheck == null || !eval(bMaxLenNoCheck))
841        {
842            var intMaxLen = controls[i].getAttribute("maxlength");
843            if (intMaxLen != null && GetByteSize(controls[i].value) > intMaxLen)
844            {
845                alert(intMaxLen + " Byte" + MSG_5013_6);
846                controls[i].focus();
847                controls[i].select();
848                return false;
849            }                
850        }
851     }
852     
853     return true;
854}
855
856/************************************************************************************************
857* Procedure   : GetByteSize
858* Description : Byte Size 를 구한다.
859* Parameter   : pStr - string 확인할 내용
860* Return      : int Byte Size
861*************************************************************************************************/
862function GetByteSize(pStr)
863{
864    var intNo, intByteSize;
865    intByteSize = 0;
866    
867    for (intNo = 0; intNo < pStr.length; intNo++)
868    {
869        if ((pStr.charCodeAt(intNo) < 0) || (pStr.charCodeAt(intNo) > 127))
870            intByteSize = intByteSize + 2;
871        else
872            intByteSize++;
873    }
874    
875    return intByteSize;
876}
877
878/************************************************************************************************
879* Procedure   : Modal
880* Description : Modal 로 뛰운다..
881* Parameter   : pUrl - string URL
882*             : pWidth - int Width
883*             : pHeight - int Height
884* Return      : boolean
885*************************************************************************************************/
886function Modal(pUrl, pWidth, pHeight)
887{
888    var strReturnValue = showModalDialog(pUrl, null, 'scroll:0;help:0;status:0;dialogWidth:'+ pWidth + 'px;dialogHeight:' + pHeight + 'px' );
889    
890    return strReturnValue;
891}
892
893/************************************************************************************************
894* Procedure   : Modal
895* Description : Modal 로 뛰운다..
896* Parameter   : pUrl - string URL
897*             : pWidth - int Width
898*             : pHeight - int Height
899* Return      : boolean
900*************************************************************************************************/
901function Modal(pUrl, pWidth, pHeight, pFeature)
902{
903	var strReturnValue = "";
904	
905	if(pFeature != null && pFeature != "")
906		strReturnValue = showModalDialog(pUrl, null, pFeature + 'dialogWidth:'+ pWidth + 'px;dialogHeight:' + pHeight + 'px' );
907	else
908		strReturnValue = showModalDialog(pUrl, null, 'scroll:0;help:0;status:0;dialogWidth:'+ pWidth + 'px;dialogHeight:' + pHeight + 'px' );
909    
910    return strReturnValue;
911}
912
913/************************************************************************************************
914* Procedure   : Open
915* Description : Popup 로 뛰운다..
916* Parameter   : pUrl - string URL
917*             : pWidth - int Width
918*             : pHeight - int Height
919*             : pTop - int Top
920*             : pLeft - int Left
921* Return      : void
922*************************************************************************************************/
923function WinOpen(pUrl, pWidth, pHeight, pTop, pLeft)
924{
925    window.open(pUrl, "","toobar=no,direction=no,status=yes,menubar=no,resizeable=yes,scrollbars=no,width=" 
925+ pWidth + ",height=" + pHeight + ",top=" + pTop + ",left=" + pLeft + "");
926}
927	
928/************************************************************************************************
929* Procedure   : WinOpen
930* Description : Popup 로 뛰운다.. (스크롤여부,Resize여부 지정)
931* Parameter   : pUrl - string URL
932*             : pWidth - int Width
933*             : pHeight - int Height
934*             : pWinName - string window name
935*             : pScroll - string 스크롤여부(yes,no)
936*             : pResize - string Resize여부(yes,no)
937* Return      : void
938*************************************************************************************************/
939function WinOpen(pUrl, pWidth, pHeight, pWinName,pScroll,pResize)
940{
941	var nLeft  = screen.width/2 - pWidth/2 ;
942	var nTop  = screen.height/2 - pHeight/2 ;
943	
944	var scl = "no";
945	if ( pScroll == 'yes' ) scl = pScroll;
946	if ( pUrl.indexOf("article_goodfee_write") > -1) scl = "yes";
947	 
948	var opt = ",toolbar=no,menubar=no,location=no,scrollbars="  + scl + ",status=yes";		
949	if (pResize)
950		opt += ",resizable=" + pResize;
951		
952	var oNewWindow = window.open(pUrl, pWinName, "left=" + nLeft + ",top=" +  nTop + ",width=" + pWidth + ",height=" + pHeight  + opt );
953	
954	//return oNewWindow;
955}
956
957/************************************************************************************************
958* Procedure   : CheckFileExt
959* Description : 파일 확장자 체크
960* Parameter   : pFileName - 파일명(풀 Path 포함 가능)
961*               pAllowExt - 허용 확장자 명, 배열 처리(Array("gif", "jpg", ...))
962* Return      : boolean
963*************************************************************************************************/
964function CheckFileExt(pFileName, pAllowExt)
965{
966    var booAllow    = false;
967    
968    var strExt      = pFileName.substring(pFileName.lastIndexOf(".") + 1);
969    var strAllowExt = "";
970    
971    for (var i = 0; i < pAllowExt.length; i++)
972    {
973        strAllowExt += "*." + pAllowExt[i] + ",";
974        
975        if (pAllowExt[i].toLowerCase() == strExt.toLowerCase())
976        {
977            booAllow = true;
978            break;
979        }
980    }
981    
982    if (!booAllow) 
983        alert(MSG_2019.replace("Ext", strAllowExt.substring(0, strAllowExt.lastIndexOf(","))) + "     ");
984    
985    return booAllow;
986}
987
988/************************************************************************************************
989* Procedure   : ExceptionFile
990* Description : 파일 확장자 체크
991* Parameter   : pFileName - 파일명(풀 Path 포함 가능)
992* Return      : boolean
993*************************************************************************************************/
994function ExceptionFile(pFileName)
995{
996    var strExt = pFileName.substring(pFileName.lastIndexOf("."));
997    
998    strExt = strExt.toLowerCase();
999    
1000    switch(strExt)
1001    {
1002        case ".asp":
1003        case ".aspx":
1004        case ".exe":
1005        case ".bat":
1006        case ".php":
1007        case ".sqp":
1008        case ".html":
1009        case ".ashx":
1010        case ".js":
1011        case ".vbs":
1012        case ".dll":
1013        case ".com":
1014        case ".css":
1015        case ".cer":
1016        case ".htm":
1017        case ".asa":
1018        case ".asax":
1019        case ".mhtml":
1020        case ".hta":
1021        case ".jse":
1022        case ".jsp":
1023        case ".wsf":
1024            return false;
1025            break;
1026        
1027    }
1028}
1029/************************************************************************************************
1030* Procedure   : replaceAll
1031* Description : Replace All
1032* Parameter   : pValue
1033*               pSource
1034*               pTarget
1035* Return      : string
1036*************************************************************************************************/
1037function replaceAll(pValue, pSearch, pReplace)
1038{
1039    var intLimit = 0;
1040    while (pValue.indexOf(pSearch) != -1 || intLimit > 10000)
1041    {
1042        pValue = pValue.replace(pSearch, pReplace);
1043        intLimit++;
1044    }
1045
1046    return pValue;
1047}
1048
1049/************************************************************************************************
1050* Procedure   : Calendar
1051* Description : Calendar
1052* Parameter   : pValue
1053*               pSource
1054*               pTarget
1055* Return      : Calendar(this, this.value)
1056*************************************************************************************************/
1057function Calendar(Object, strCurrentDate) 
1058{
1059    strUrl = "/NWS_Web/Common/Pages/Calendar.aspx";
1060    strFeatures = "dialogWidth:340px; dialogHeight:380px; dialogTop:200px; dialogLeft:400px; help:no; status:no ";
1061    strDate = window.showModalDialog(strUrl, strCurrentDate, strFeatures);
1062    if (strDate != "")
1063        Object.value = strDate;
1064}
1065
1066
1067/************************************************************************************************
1068* Procedure   : Calendar2
1069* Description : 닷넷에서 지원하는 달력을 사용하여 공통 모듈로 만듦
1070* Parameter   : 
1071* Return      : 
1072*************************************************************************************************/
1073function Calendar2(Object, strCurrentDate, e) {
1074    if (!document.getElementById("dvCalendar")) {
1075        if (!e) var e = window.event;
1076        var posx = 0;
1077        var posy = 0;
1078
1079        if (e.pageX || e.pageY) { // pageX/Y 표준 검사
1080            posx = e.pageX - 20;
1081            posy = e.pageY;
1082        }
1083        else if (e.clientX || e.clientY) { //clientX/Y 표준 검사 Opera
1084            posx = e.clientX - 20;
1085            posy = e.clientY;
1086
1087            if (window.event) { // IE 여부 검사
1088                posx += document.documentElement.scrollLeft;
1089                posy += document.documentElement.scrollTop;
1090            }
1091        }
1092        
1093        var pID = Object.attributes.getNamedItem('id').value;
1094        var strHtml = "<iframe id='ifrCalendar' scrolling='no' frameborder='0' width='220' height='200' src='/nws_web/common/pages/Calendar2.aspx?objid=" + pID + "&date=" + strCurrentDate + "' ></iframe>";
1095        var pDiv = document.createElement("div");
1096        pDiv.id = "dvCalendar";
1097        pDiv.style.position = "absolute";
1098        pDiv.style.top = posy + "px";
1099        pDiv.style.left = posx + "px";
1100        pDiv.innerHTML = strHtml;
1101        document.body.appendChild(pDiv);
1102    }
1103}
1104
1105function Calendar3(Object, strCurrentDate) 
1106{
1107    if (GetBrowserType() == "IE")
1108    {
1109        var pWidth = "260px";
1110        var pHeight = "260px";
1111    }
1112    else
1113    {
1114        var pWidth = "270px";
1115        var pHeight = "230px";
1116    }
1117    strUrl = "/NWS_Web/Common/Pages/jQuery_Calendar.aspx?curDate=" + strCurrentDate;   
1118    strFeatures = "dialogWidth:" + pWidth + "; dialogHeight:" + pHeight + "; dialogTop:200px; dialogLeft:400px; help:no; status:no; scroll:no;";
1119    strDate = window.showModalDialog(strUrl, strCurrentDate, strFeatures);
1120    if (strDate)
1121        Object.value = strDate;
1122}
1123
1124/************************************************************************************************
1125* Procedure   : DownFindTagObj
1126* Description : 테이블내 특정 태그 ID 가져오기 -> DownFindTagObj(document.getElementByID("tblList").rows(0).cells(0), "INPUT") 형태로 사용
1127* Parameter   : eventObj
1128*               TagName
1129* Return      : string
1130*************************************************************************************************/
1131function DownFindTagObj(eventObj,TagName)
1132{
1133	if(eventObj.tagName.toUpperCase() == TagName.toUpperCase()) return eventObj;
1134	
1135	var cnt		= 0;
1136	var childs	= eventObj.children;
1137	var rChild	= null;
1138	
1139	if(childs.length == null || childs.length == undefined) return rChild;
1140	for(var cnt = 0 ; cnt < childs.length ; cnt++)
1141	{
1142		if(childs[cnt].tagName.toUpperCase() == TagName.toUpperCase())
1143		{
1144			rChild = childs[cnt];
1145			break;
1146		}
1147		else
1148		{
1149			var returnValue = fn_DownFindTagObj(childs[cnt],TagName);
1150			
1151			if(returnValue != null)
1152			{
1153				rChild = returnValue;
1154				break;
1155			}
1156		}
1157	}
1158	
1159	return rChild;
1160}
1161
1162/************************************************************************************************
1163* Procedure   : ChangePageNo
1164* Description : 검색결과 페이징시 선택한 페이지번호 저장
1165* Parameter   : ObjectName : 페이지 번호 저장할 컨트롤 명
1166*               PageNo : 선택한 페이지 번호
1167* Return      : void
1168*************************************************************************************************/
1169
1170function ChangePageNo(ObjectName, PageNo)
1171{
1172    document.getElementById(ObjectName).value = PageNo;
1173}
1174
1175/************************************************************************************************
1176* Procedure   : AllSettingCheckBoxInDataGrid
1177* Description : DataGrid 에서 헤더의 체크박스를 체크하면 전체가 선택또는 비선택 됨
1178* Parameter   : sConID : DataGrid 의 고유 id
1179                state  : 헤더의 체크박스 체크 상태값
1180*               sCheckBoxID : 체크박스ID (옵션)                
1181* Return      : void
1182*************************************************************************************************/
1183function AllSettingCheckBoxInDataGrid(sConID,state,sCheckBoxID) 
1184{ 
1185    var inputs = document.getElementById(sConID).getElementsByTagName("input");
1186
1187    for(var i = 0; i < inputs.length ; i++) 
1188    { 
1189        if (inputs[i].type == "checkbox")
1190        {
1191            var oCheckBox = null;
1192            if (sCheckBoxID)
1193                if (inputs[i].id == sCheckBoxID) oCheckBox = inputs[i];
1194            else
1195                oCheckBox = inputs[i];
1196            
1197            if( oCheckBox != null && oCheckBox.disabled == false) oCheckBox.checked = state;
1198        } 
1199    } 	 
1200} 
1201
1202/************************************************************************************************
1203* Procedure   : SearchZipNo
1204* Description : 우편번호 검색창 호출
1205* Parameter   : none
1206* Return      : void
1207*************************************************************************************************/
1208function SearchZipNo(pArg)
1209{
1210    //var sUrl = "/NWS_Web/Member/popup/post_search.aspx";   
1211    //var sUrl = "/NWS_Web/Mem/Mem_post_search.aspx";
1212    var sUrl = "/NWS_Web/Mem/Mem_post.aspx";
1213    var sArg = "null";
1214    
1215    if (pArg) sArg = pArg;
1216    
1217    sUrl += "?ARG=" + pArg;
1218        
1219    //WinOpen(sUrl,430,220,'wZipNo','yes','no');
1220    WinOpen(sUrl,500,540,'wZipNo','yes','no');
1221}
1222
1223/************************************************************************************************
1224* Procedure   : CitizenNo_Validation
1225* DateTime    : 2004-10-09
1226* Description : CitizenNo_Validation
1227* Parameter   : 
1228*************************************************************************************************/	
1229function CitizenNo_Validation(pCitizenNo)
1230{
1231    var intCheckNum, booReturn, intNum, strObjectName;
1232    var strCitizenNo = pCitizenNo.replace("-","");
1233    var strCitizenNo1, strCitizenNo2;
1234	
1235    if (strCitizenNo.length != 13)
1236    {
1237        alert(MSG_5013_5);
1238        return false;
1239    }
1240	
1241    strCitizenNo1 = strCitizenNo.substring(0,6);
1242    strCitizenNo2 = strCitizenNo.substring(6,13);		
1243	
1244    intCheckNum = 0;
1245    for(intNum = 0; intNum <= 5; intNum++){
1246	    intCheckNum = intCheckNum + ((intNum%8+2) * parseInt(strCitizenNo1.substring(intNum, intNum+1)))
1247    }
1248    for(intNum = 6; intNum <= 11; intNum++){
1249	    intCheckNum = intCheckNum + ((intNum%8+2) * parseInt(strCitizenNo2.substring(intNum-6, intNum-5)))
1250    }
1251    
1252    intCheckNum = 11 - (intCheckNum %11)
1253    intCheckNum = intCheckNum % 10
1254    if (intCheckNum != parseInt(strCitizenNo2.substring(6,7))){
1255	    booReturn = false;
1256    }
1257    else{
1258	    booReturn = true;
1259    }
1260	
1261    if(booReturn == false){
1262	    alert(MSG_5013_5);			
1263    }
1264		
1265    return booReturn;
1266}
1267/************************************************************************************************
1268* Procedure   : Date_Validation
1269* DateTime    : 
1270* Description : 유효한 날짜형식(ex : 2004-06-06)인지 체크한다. (-)대시를 붙여서 파라미터로 넘긴다.
1271* Parameter   : 
1272*************************************************************************************************/
1273function Date_Validation(str)
1274{
1275    if( str.length == 10 )
1276    {
1277        var vDate = new Date();
1278        
1279        vDate.setFullYear(str.substring(0, 4));
1280        vDate.setMonth(str.substring(5, 7)-1);
1281        vDate.setDate(str.substring(8));
1282        
1283        if(vDate.getFullYear() != str.substring(0, 4) ||
1284            vDate.getMonth() != (str.substring(5, 7) - 1) ||
1285             vDate.getDate() != str.substring(8))
1286        {
1287
1288            return false;
1289        }
1290
1291        return true;
1292    }
1293    else
1294        return false;
1295        
1296}
1297
1298/************************************************************************************************
1299* Procedure   : BlogWinOpen
1300* Description : 블로그 팝업창
1301* Parameter   : none
1302* Return      : void
1303*************************************************************************************************/
1304function BlogWinOpen(pBlogUrl)
1305{
1306	window.open(pBlogUrl, "blog", "scrollbars, menubar, resizable, status, toolbar, location, width=900, height=600");
1307}
1308
1309/************************************************************************************************
1310* Procedure   : SendMemoWinOpen
1311* Description : 쪽지보내기 팝업창
1312* Parameter   : pMEM_CD(회원코드), pCNTN_CD(컨텐츠코드), pPCE_CD(회신대상 쪽지번호)
1313* Return      : 
1314*************************************************************************************************/
1315function SendMemoWinOpen(pMEM_CD,pCNTN_CD,pPCE_CD)
1316{
1317    //alert(pMEM_CD + ":" + pCNTN_CD + ":" + pPCE_CD);
1318    var sUrl = "https://www.ohmynews.com/NWS_Web/iRoom/memo/memo_send.aspx";
1319    
1320    if (pMEM_CD && pMEM_CD != null)
1321        sUrl += "?MEMCD=" + pMEM_CD;
1322        
1323    if (pCNTN_CD && pCNTN_CD != null)
1324    {
1325        if (sUrl.indexOf("?") > -1) 
1326            sUrl += "&";
1327        else
1328            sUrl += "?";
1329            
1330        sUrl += "CNTNCD=" + pCNTN_CD;
1331    }
1332    
1333    if (pPCE_CD && pPCE_CD != null)
1334    {
1335        if (sUrl.indexOf("?") > -1) 
1336            sUrl += "&";
1337        else
1338            sUrl += "?";
1339            
1340        sUrl += "PCECD=" + pPCE_CD;
1341    }
1342    
1343    WinOpen(sUrl,600,400,'wSendMemo','no','no');
1344    
1345}
1346 
1347/************************************************************************************************
1348* Procedure   : CommunityFriendPropose
1349* Description : 친구신청
1350* Parameter   : id(커뮤니티팝업레이어 ID), pMEM_CD(회원코드 : 커뮤니티 팝업 사용하지 않을 때)
1351* Return      : 
1352*************************************************************************************************/
1353function CommunityFriendPropose(id,pMEM_CD)
1354{     
1355}
1356function CallBack_FriendPropose(response)
1357{
1358}
1359
1360/************************************************************************************************
1361* Procedure   : CommunityFriendGoodBye
1362* Description : 친구결별
1363* Parameter   : id(커뮤니티팝업레이어 ID), pMEM_CD(회원코드 : 커뮤니티 팝업 사용하지 않을 때)
1364* Return      : 
1365*************************************************************************************************/
1366function CommunityFriendGoodBye(id,pMEM_CD)
1367{        
1368}
1369
1370function CallBack_FriendGoodBye(response)
1371{
1372}     
1373
1374/************************************************************************************************
1375* Procedure   : CommunityProfile
1376* Description : 프로필
1377* Parameter   : id(커뮤니티팝업레이어 ID), pMEM_CD(회원코드 : 커뮤니티 팝업 사용하지 않을 때)
1378* Return      : 
1379*************************************************************************************************/
1380function CommunityProfile(id,pMEM_CD)
1381{   
1382}  
1383
1384/************************************************************************************************
1385* Procedure   : CommunitySendMemo
1386* Description : 쪽지보내기
1387* Parameter   : id(커뮤니티팝업레이어 ID), pMEM_CD(회원코드 : 커뮤니티 팝업 사용하지 않을 때)
1388* Return      : 
1389*************************************************************************************************/
1390function CommunitySendMemo(id,pMEM_CD)
1391{   
1392    //if (!confirm(MSG_5063)) return;
1393     
1394    var obj;
1395    var pMEM_FRD_CD;
1396    var pPCE_CD;
1397    
1398    if (pMEM_CD)
1399        pMEM_FRD_CD = pMEM_CD;
1400    else
1401    {
1402        obj=document.getElementById(id);
1403	    pMEM_FRD_CD = obj.getAttribute("memcd");
1404	    pPCE_CD = obj.getAttribute("pcecd");
1405	}
1406	
1407	//alert(pMEM_FRD_CD + ":" + pPCE_CD);
1408	
1409	//if (pMEM_FRD_CD == "00297928")
1410	//{
1411	  //  alert(pMEM_FRD_CD);
1412	//}
1413		
1414	SendMemoWinOpen(pMEM_FRD_CD, "", pPCE_CD);
1415}
1416
1417/************************************************************************************************
1418* Procedure   : CommunityReportRead
1419* Description : 구독하기
1420* Parameter   : id(커뮤니티팝업레이어 ID), pMEM_CD(회원코드 : 커뮤니티 팝업 사용하지 않을 때)
1421* Return      : 
1422*************************************************************************************************/
1423function CommunityReportRead(id, pMEM_CD, pCNTN_CD)
1424{
1425} 
1426
1427/************************************************************************************************
1428* Procedure   : CommunityImprint
1429* Description : 발자국
1430* Parameter   : id(커뮤니티팝업레이어 ID), pMEM_CD(회원코드 : 커뮤니티 팝업 사용하지 않을 때)
1431* Return      : 
1432*************************************************************************************************/
1433function CommunityImprint(id,pMEM_CD)
1434{        
1435} 
1436
1437/************************************************************************************************
1438* Procedure   : CommunityWriteArticle
1439* Description : 쓴기사
1440* Parameter   : id(커뮤니티팝업레이어 ID), pMEM_CD(회원코드 : 커뮤니티 팝업 사용하지 않을 때)
1441* Return      : 
1442*************************************************************************************************/
1443function CommunityWriteArticle(id,pMEM_CD)
1444{        
1445}
1446function CallBack_WriteArticle(response)
1447{
1448}
1449
1450/************************************************************************************************
1451* Procedure   : CommunityWriteEdit
1452* Description : 쓴편집노트
1453* Parameter   : id(커뮤니티팝업레이어 ID), pMEM_CD(회원코드 : 커뮤니티 팝업 사용하지 않을 때)
1454* Return      : 
1455*************************************************************************************************/
1456function CommunityWriteEdit(id,pMEM_CD)
1457{        
1458}
1459
1460/************************************************************************************************
1461* Procedure   : CommunityWriteOpinion
1462* Description : 쓴독자의견
1463* Parameter   : id(커뮤니티팝업레이어 ID), pMEM_CD(회원코드 : 커뮤니티 팝업 사용하지 않을 때)
1464* Return      : 
1465*************************************************************************************************/
1466function CommunityWriteOpinion(id,pMEM_CD)
1467{        
1468}
1469
1470/************************************************************************************************
1471* Procedure   : ArticleMobileWinOpen
1472* Description : 기사 휴대폰 전송 팝업
1473* Parameter   : 
1474* Return      : 
1475*************************************************************************************************/
1476function ArticleMobileWinOpen(cntn_cd)
1477{
1478}
1479
1480/************************************************************************************************
1481* Procedure   : ArticleEmailWinOpen
1482* Description : 기사 이메일 전송 팝업
1483* Parameter   : 
1484* Return      : 
1485*************************************************************************************************/
1486function ArticleEmailWinOpen(cntnCd)
1487{
1488}
1489
1490/************************************************************************************************
1491* Procedure   : ArticlePrintWinOpen
1492* Description : 기사 프린트 팝업
1493* Parameter   : 
1494* Return      : 
1495*************************************************************************************************/
1496function ArticlePrintWinOpen(cntnCd)
1497{
1498    //window.open("/NWS_Web/Articleview/article_print.aspx?cntn_cd=" + cntnCd, "print", "width=700, height=607,scrollbars=yes,top=50,left=150 ");
1499    window.open("/NWS_Web/Articleview/article_print.aspx?cntn_cd=" + cntnCd);
1500}
1501
1502/************************************************************************************************
1503* Procedure   : ArticleBlogWinOpen
1504* Description : 기사 블로그 담기 팝업
1505* Parameter   : 
1506* Return      : 
1507*************************************************************************************************/
1508function ArticleBlogWinOpen(cntnCd, Page_Gb)
1509{
1510}
1511
1512/************************************************************************************************
1513* Procedure   : ArticleStraightWinOpen
1514* Description : 글자 +, - 하기 팝업
1515* Parameter   : 
1516* Return      : 
1517*************************************************************************************************/
1518function ArticleTextViewWinOpen(cntnCd)
1519{
1520}
1521
1522/************************************************************************************************
1523* Procedure   : ArticleStraightWinOpen
1524* Description : 글자 +, - 하기 팝업
1525* Parameter   : 
1526* Return      : 
1527*************************************************************************************************/
1528function ArticleStraightWinOpen(cntnCd)
1529{
1530    window.open("/NWS_Web/Articleview/article_straight.aspx?cntn_cd=" + cntnCd, "straight", "width=600, height=520");
1531}
1532
1533/************************************************************************************************
1534* Procedure   : SedUrlWinOpen
1535* Description : 편집노트 출처 팝업
1536* Parameter   : 
1537* Return      : 
1538*************************************************************************************************/
1539function SedUrlWinOpen(url)
1540{
1541    try{ _trk_clickTrace( "RFO", url ); }catch(_e){ };
1542    window.open(url, "SedUrl", "scrollbars, menubar, resizable, status, toolbar, location, width=900, height=600");
1543}
1544
1545/************************************************************************************************
1546* Procedure   : ImgResizeTosmall
1547* Description : 이미지 리사이즈
1548* Parameter   : 
1549* Return      : 
1550*************************************************************************************************/
1551function ImgResizeTosmall(x, pWBalance, pHBalance)
1552{
1553    var vWidth  = x.width;
1554    var vHeight = x.height;
1555    var vWBalance = pWBalance;
1556    var vHBalance = pHBalance;
1557
1558    if (vWidth >= vHeight) {
1559        if (vWidth > vWBalance) {
1560	        vHeight = vHeight * (vWBalance/vWidth);
1561	        vWidth = vWBalance;
1562		    
1563	        if (vHeight > vHBalance) {
1564	            vWidth = vWidth * (vHBalance/vHeight);
1565	            vHeight = vHBalance;
1566            }
1567		    
1568        }
1569    } else {
1570        if (vHeight > vHBalance) {
1571	        vWidth = vWidth * (vHBalance/vHeight);
1572	        vHeight = vHBalance;
1573		    
1574	        if (vWidth > vWBalance) {
1575	            vHeight = vHeight * (vWBalance/vWidth);
1576	            vWidth = vWBalance;
1577	        }
1578		    
1579        }
1580    }
1581
1582    x.style.display = "none";
1583    x.width = vWidth;
1584    x.height = vHeight;
1585    x.style.display = "block";
1586}
1587
1588/************************************************************************************************
1589* Procedure   : juminAge
1590* Description : 생년월일로 나이계산
1591* Parameter   : pYYYMMDD 생년월일
1592* Return      : 만나이
1593*************************************************************************************************/
1594function juminAge(pJuminNm)
1595{
1596     ys=ms=ds=''; //년월일
1597     d=new Date(); //데이트객체
1598     cy=d.getYear(); //올해
1599     cm=d.getMonth()+1;//이번달
1600     
1601     var pYYYYMMDD = "";
1602     var pTyp = pJuminNm.substring(6,7);
1603     if (pTyp == "1" || pTyp == "2")
1604     {
1605        pYYYYMMDD = "19" + pJuminNm.substring(0,6);
1606     }
1607     else if (pTyp == "3" || pTyp == "4")
1608     {
1609        pYYYYMMDD = "20" + pJuminNm.substring(0,6);
1610     }
1611     
1612
1613     var by=pYYYYMMDD.substr(0,4); //출생 년
1614     var bm=pYYYYMMDD.substr(4,2); //출생 월
1615     (parseInt(bm)<parseInt(cm))?aged=cy-by:aged=cy-by-1; //생일이 지나지 않으면 1을 뺀다
1616     return aged;
1617 }
1618
1619/************************************************************************************************
1620* Procedure   : Left_I_FlashView
1621* Description : I판 왼쪽 플래쉬
1622* Parameter   : 
1623* Return      : 
1624*************************************************************************************************/ 
1625 function Left_I_FlashView()
1626 {
1627}
1628
1629/************************************************************************************************
1630* Procedure   : Left_E_FlashView
1631* Description : E판 왼쪽 플래쉬
1632* Parameter   : 
1633* Return      : 
1634*************************************************************************************************/ 
1635 function Left_E_FlashView()
1636 {
1637}
1638
1639/************************************************************************************************
1640* Procedure   : __ws__
1641* Description : 광고용 플래쉬에서 사용
1642* Parameter   : 
1643* Return      : 
1644*************************************************************************************************/ 
1645function __ws__(id)
1646{ 
1647    document.write(id.text);
1648    id.id='';
1649}
1650
1651/************************************************************************************************
1652* function vscroller(s_id, s_width, s_height, s_itemheight, s_scrollitem, s_swap, s_delay, s_darray)
1653*         s_id : 임의의 스크롤 ID 값
1654*      s_width : 화면에서 차지하는 width
1655*     s_height : 화면에서 차지하는 height
1656* s_itemheight : 한 항목이 차지하는 height
1657* s_scrollitem : 한 번에 스크롤되는 항목 수
1658*       s_swap : 스크롤 과정 없이 한 번에 항목 교체 (false, true)
1659*      s_delay : delay 값
1660*     s_darray : 표출 항목들의 array variable
1661*************************************************************************************************/ 
1662var vArg = new Array();
1663var vRolling = true;  // E노트 롤링을 위한 변수
1664
1665function vscroller(s_id, s_width, s_height, s_itemheight, s_scrollitem, s_swap, s_delay, s_darray)
1666{
1667	vArg[s_id] = new Object();
1668	var args = vArg[s_id];
1669
1670	args.s_id = s_id;
1671	args.s_delay = s_delay;
1672	args.s_scrollheight = args.scrollamount = s_itemheight * s_scrollitem;
1673	args.s_swap = s_swap;
1674	args.mouseover = false;
1675	args.swap_pos = args.pos = 0;
1676
1677	var nl = s_darray.length;
1678	args.swap_pos = nl * s_itemheight;
1679	document.write("<div id=\"" + s_id + "\" style=\"position:relative; height:" + s_height + "px; width:" + s_width + "px; overflow:hidden;\" onMouseover=\"vArg['" + s_id + "'].mouseover=true;\" onMouseout=\"vArg['" + s_id + "'].mouseover=false;\">");
1680	document.write("<div id=\"" + s_id + "_scroll_area\" style=\"position:absolute; top:0; overflow:hidden;
1680 width:" + s_width + "px; height:" + (nl * s_itemheight + args.s_scrollheight) + "px;\">\n");
1681	for (var i = 0; i < nl; i++)
1682		document.write("<div style=\"overflow:hidden; width:" + s_width + "px; height:" + s_itemheight + "px;\">"+ s_darray[i] + "</div>\n");
1683	for (i = 0; i < s_scrollitem; i++)
1684		document.write("<div style=\"overflow:hidden; width:" + s_width + "px; height:" + s_itemheight + "px;\">"+ s_darray[i] + "</div>\n");
1685	document.write("</div>\n");
1686	document.write("</div>\n");
1687
1688	args.scroll_id = document.getElementById(s_id + "_scroll_area");
1689	if (s_id == "e_scroll")
1690		window.setTimeout("e_vscroller_scroll(\"" + s_id + "\");", s_delay);
1691	else
1692	    window.setTimeout("vscroller_scroll(\"" + s_id + "\");", s_delay);
1693}
1694
1695function vscroller2(s_id, s_width, s_height, s_itemheight, s_scrollitem, s_swap, s_delay, s_darray, s_speed) {
1696    vArg[s_id] = new Object();
1697    var args = vArg[s_id];
1698
1699    args.s_id = s_id;
1700    args.s_delay = s_delay;
1701    args.s_scrollheight = args.scrollamount = s_itemheight * s_scrollitem;
1702    args.s_swap = s_swap;
1703    args.mouseover = false;
1704    args.swap_pos = args.pos = 0;
1705    args.s_speed = s_speed;
1706
1707    var nl = s_darray.length;
1708    args.swap_pos = nl * s_itemheight;
1709    document.write("<div id=\"" + s_id + "\" style=\"position:relative; height:" + s_height + "px; width:" + s_width + "px; overflow:hidden;\" onMouseover=\"vArg['" + s_id + "'].mouseover=true;\" onMouseout=\"vArg['" + s_id + "'].mouseover=false;\">");
1710    document.write("<div id=\"" + s_id + "_scroll_area\" style=\"position:absolute; top:0; overflow:hidden; width:" + s_width + "px; height:" + (nl * s_itemheight + args.s_scrollheight) + "px;\">\n");
1711    for (var i = 0; i < nl; i++)
1712        document.write("<div style=\"overflow:hidden; width:" + s_width + "px; height:" + s_itemheight + "px;\">" + s_darray[i] + "</div>\n");
1713    for (i = 0; i < s_scrollitem; i++)
1714        document.write("<div style=\"overflow:hidden; width:" + s_width + "px; height:" + s_itemheight + "px;\">" + s_darray[i] + "</div>\n");
1715    document.write("</div>\n");
1716    document.write("</div>\n");
1717
1718    args.scroll_id = document.getElementById(s_id + "_scroll_area");
1719    if (s_id == "e_scroll")
1720        window.setTimeout("e_vscroller_scroll(\"" + s_id + "\");", s_delay);
1721    else
1722        window.setTimeout("vscroller_scroll2(\"" + s_id + "\");", s_delay);
1723}
1724
1725function vscroller_scroll(s_id)
1726{
1727    var args = vArg[s_id];
1728    if (!args.mouseover) {
1729	    if (args.s_swap) {
1730		    args.pos -= args.s_scrollheight;
1731		    args.scrollamount = 0;
1732	    }
1733	    else {
1734		    --args.pos;
1735		    --args.scrollamount;
1736	    }
1737
1738	    if (args.pos + args.swap_pos <= 0) args.pos = 0;
1739	    args.scroll_id.style.top = args.pos + "px";
1740	    if (args.scrollamount <= 0) {
1741		    args.scrollamount = args.s_scrollheight;
1742		    window.setTimeout("vscroller_scroll(\"" + s_id + "\");", args.s_delay);
1743		    return;
1744	    }
1745    }
1746
1747	window.setTimeout("vscroller_scroll(\"" + s_id + "\");", 1);
1748}
1749
1750
1751function vscroller_scroll2(s_id) {
1752    var args = vArg[s_id];
1753    if (!args.mouseover) {
1754        if (args.s_swap) {
1755            args.pos -= args.s_scrollheight;
1756            args.scrollamount = 0;
1757        }
1758        else {
1759            --args.pos;
1760            --args.scrollamount;
1761        }
1762
1763        if (args.pos + args.swap_pos <= 0) args.pos = 0;
1764        args.scroll_id.style.top = args.pos + "px";
1765        if (args.scrollamount <= 0) {
1766            args.scrollamount = args.s_scrollheight;
1767            window.setTimeout("vscroller_scroll2(\"" + s_id + "\");", args.s_delay);
1768            return;
1769        }
1770    }
1771
1772    window.setTimeout("vscroller_scroll2(\"" + s_id + "\");", args.s_speed);
1773}
1774
1775
1776// E노트 롤링
1777function e_vscroller_scroll(s_id)
1778{
1779    if (vRolling == true)
1780    {
1781	    var args = vArg[s_id];
1782	    if (!args.mouseover) {
1783		    if (args.s_swap) {
1784			    args.pos -= args.s_scrollheight;
1785			    args.scrollamount = 0;
1786		    }
1787		    else {
1788			    --args.pos;
1789			    --args.scrollamount;
1790		    }
1791
1792		    if (args.pos + args.swap_pos <= 0) args.pos = 0;
1793		    args.scroll_id.style.top = args.pos + "px";
1794		    if (args.scrollamount <= 0) {
1795			    args.scrollamount = args.s_scrollheight;
1796			    window.setTimeout("e_vscroller_scroll(\"" + s_id + "\");", args.s_delay);
1797			    return;
1798		    }
1799	    }
1800    }
1801
1802	window.setTimeout("e_vscroller_scroll(\"" + s_id + "\");", 1);
1803}
1804
1805// 메인면 오른쪽 E노트 롤링 토글
1806function vscrollToggle(scrollName, pObj)
1807{
1808     if (vRolling == false)
1809     {
1810        if (pObj) pObj.src = 'https://ojsimg.ohmynews.com/images/title_Etoggle_stop.gif';
1811        vRolling = true;
1812     }
1813     else
1814     {
1815        if (pObj) pObj.src = 'https://ojsimg.ohmynews.com/images/title_Etoggle.gif';
1816        vRolling = false;
1817     }
1818}
1819
1820/************************************************************************************************
1821* Procedure   : LogImageNews
1822* Description : 이미지 뉴스 웹로그
1823* Parameter   : 
1824* Return      : 
1825*************************************************************************************************/
1826function LogImageNews(obj)
1827{
1828    eval("try{ _trk_clickTrace('EVT', obj.href ); }catch(_e){ }");
1829}
1830
1831
1832
1833
1834/************************************************************************************************
1835* Procedure   : Write_JingGae
1836* Description : 징계 : 게시판쓰기, 댓글쓰기, 편집노트쓰기, 기사쓰기, 사진동영상 제한
1837* Parameter   : 회원 pMEM_CD, 징계 유형 pJING_TYP 1:게시판쓰기, 2:댓글쓰기, 3:편집노트, 4:기사쓰기, 5:사진동영상, 9:스패머
1838* Return      : 
1839************************************************************************************************/
1840function Write_JingGae1(pMEM_CD, pJING_TYP)
1841{   
1842       var CheckJing =  NWSCheckJoin.Write_JingGae(pMEM_CD, pJING_TYP);
1843       if(CheckJing.value != "")
1844       {
1845           if (CheckJing.value == "1")
1846           {
1847                alert("준회원 정책이 폐지되어 서비스 이용이 제한 됩니다.\n일반 회원으로 전환 가입하세요.");
1848                location.href = 'https://www.ohmynews.com/NWS_Web/Mem/Mem_Choice.aspx';
1849                return false; 
1850           }
1851            
1852           var year = CheckJing.value.substring(2,4) + '년 ';
1853           var month = CheckJing.value.substring(5,7) + '월 ';
1854           var day = CheckJing.value.substring(8,10) + '일';
1855           
1856           switch(pJING_TYP)
1857           {
1858                case "1":
1859                    alert("징계중입니다." + year + month + day + "부터 게시판 쓰기가 가능합니다");
1860                    return false;
1861                    break;
1862                case "2":
1863                    alert("징계중입니다." + year + month + day + "부터 댓글 쓰기가 가능합니다");
1864                    return false;
1865                    break;
1866                case "3":
1867                    alert("징계중입니다." + year + month + day + "부터 편집노트 쓰기가 가능합니다");
1868                    return false;
1869                    break;
1870                case "4":
1871                    alert("징계중입니다." + year + month + day + "부터 기사 쓰기가 가능합니다");
1872                    return false;
1873                    break;
1874                case "5":
1875                    alert("징계중입니다." + year + month + day + "부터 사진,동영상 올리기가 가능합니다");
1876                    return false;
1877                    break; 
1878                case "6":
1879                    alert("징계중입니다." + year + month + day + "부터 찬성이 가능합니다");
1880                    return false;
1881                    break;
1882                case "7":
1883                    alert("징계중입니다." + year + month + day + "부터 반대가 가능합니다");
1884                    return false;
1885                    break;  
1886           }
1887       }
1888       
1889       // 스패머
1890       CheckJing =  NWSCheckJoin.Write_JingGae(pMEM_CD, '9');
1891       if(CheckJing.value != "")
1892       {
1893            alert("등록이 제한되었습니다.");
1894            return false;
1895       }
1896
1897       // 30초 시간체크
1898       switch(pJING_TYP)
1899       {
1900           case "6":
1901           case "7":
1902                break;
1903            default:
1904                CheckJing = NWSCheckWords.PostTimeCheck(pMEM_CD);
1905                if (CheckJing.value != "") {
1906                    alert("등록이 제한되었습니다.");
1907                    return false;
1908                }
1909                break;
1910       }
1911       return true;
1912       
1913       
1914}
1915function CallBack_Write_JingGae(response)
1916{
1917   
1918    if (response.error != null)
1919    {
1920        alert(response.error);
1921        return false;
1922    }
1923     
1924    if (response.value)
1925    {          
1926        alert(response.value);
1927    } 
1928}
1929
1930/************************************************************************************************
1931* Procedure   : Check_Words
1932* Description : 금칙어
1933* Parameter   : 
1934* Return      : 
1935************************************************************************************************/
1936function Check_Words(pContents)
1937{
1938       // 금칙어
1939       CheckJing = NWSCheckWords.CheckWord(pContents);
1940       if(CheckJing.value != "")
1941       {
1942            alert("금칙어로 인해 입력이 제한됩니다.");
1943            return false;
1944       }
1945       return true;
1946}
1947
1948function CallBack_Check_Words(response)
1949{
1950    if (response.error != null)
1951    {
1952        alert(response.error);
1953        return false;
1954    }
1955     
1956    if (response.value)
1957    {          
1958        alert(response.value);
1959    } 
1960}
1961
1962
1963
1964/************************************************************************************************
1965* Procedure   : js_search_to_object
1966* Description : js, htm 파일의 쿠리스트링 가져오기
1967* Parameter   : str : 검색할 쿼리스트링 value
1968* Return      : obj 
1969* 사용법 예제 : obj['abcd']  abcd --> 검색할 쿼리스트링
1970************************************************************************************************/
1971function js_search_to_object(str){ 
1972    if(str){ 
1973        var t = str.substr(0,1) 
1974        if(t=='?' ||t=='&')    var qy = str.substr(1); 
1975        else    var qy = str; 
1976    }else{    var qy = document.location.search.substr(1); 
1977    } 
1978    var obj = new Object(); 
1979    var t = qy.split('&'); 
1980    var tt = Array(); 
1981    for(var i=0,m=t.length;i<m;i++){ 
1982        tt = t[i].split('='); 
1983        if(tt.length>2){ tt[1] = (tt.slice(1)).join('='); } 
1984        else if(tt.length==2){} 
1985        else if(tt.length==1){} 
1986        if(/[^\[]*\[[^\]]*\]$/.test(tt[0])){ 
1987            var tn =  tt[0].match(/([^\[]*)\[([^\]]*)\]$/); 
1988            var tk = tn[1];tv = tn[2]; 
1989            if(tv==''){ //a[]=x  형식 처리 
1990                if(obj[tk]==null){obj[tk]= new Array();} 
1991                obj[tk].push(decodeURI(tt[1])); 
1992            }else{ //a[x]=y 형 처리 
1993                if(obj[tk]==null){obj[tk]= new Object();} 
1994                obj[tk][tv] = decodeURI(tt[1]); 
1995            } 
1996        }else{ 
1997            if(tt[0].length>1)    obj[tt[0]] = tt[1]; 
1998        } 
1999    } 
2000    return obj; 
2001} 
2002
2003
2004/************************************************************************************************
2005* Procedure   : showPopupEHelp
2006* Description : E도움말 보기 보여짐
2007* Parameter   : 
2008* Return      : 
2009*************************************************************************************************/
2010function showPopupEHelp(e, id, pPosition){
2011	var obj=document.getElementById(id);
2012	if (!e) var e = window.event;
2013	var posx=0;
2014	var posy=0;
2015
2016	if (e.pageX || e.pageY) { // pageX/Y 표준 검사
2017		posx = e.pageX;
2018		posy = e.pageY;
2019	} 
2020	else if (e.clientX || e.clientY) { //clientX/Y 표준 검사 Opera
2021		posx = e.clientX;
2022		posy = e.clientY;
2023		if (window.event) { // IE 여부 검사
2024			posx += document.documentElement.scrollLeft;
2025			posy += document.documentElement.scrollTop;
2026		}
2027	}
2028    
2029    if (pPosition == "right")
2030    {
2031        posx = posx - 400;
2032    }
2033    
2034	obj.style.left = posx + "px";   
2035	obj.style.top = posy + "px";
2036	obj.style.display='block';
2037	obj.style.zIndex = 200;
2038}
2039
2040/************************************************************************************************
2041* Procedure   : hidePopupEHelp
2042* Description : 간략히 보기 숨김
2043* Parameter   : 
2044* Return      : 
2045*************************************************************************************************/
2046function hidePopupEHelp(id)
2047{
2048    document.getElementById(id).style.display='none';
2049}
2050
2051/************************************************************************************************
2052* Procedure   : getElementsByClassName
2053* Description : 해당하는 태그, 클래스 객체를 모두 찾아 리턴한다. (IE, Firefox 모두 에서 ellips 적용에 필요한 function)
2054* Parameter   : 
2055* Return      : 
2056*************************************************************************************************/
2057function getElementsByClassName(strClassName, strTagName, oElm){
2058        var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
2059        var arrReturnElements = new Array();
2060        strClassName = strClassName.replace(/\-/g, "\\-");
2061        var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
2062        var oElement;
2063        for(var i=0; i<arrElements.length; i++){
2064            oElement = arrElements[i];     
2065            if(oRegExp.test(oElement.className)){
2066                arrReturnElements.push(oElement);
2067            }  
2068        }
2069        return (arrReturnElements)
2070    }
2071
2072 /************************************************************************************************
2073* Procedure   : ellipsForFirefox
2074* Description : Firefox ellips 실행
2075* Parameter   : 
2076* Return      : 
2077*************************************************************************************************/
2078function ellipsForFirefox(strTagName)   
2079{
2080    var EllipsisText = (function(){
2081    
2082    	if( document.getBoxObjectFor && window.openDialog){
2083    		var d = document.createElement(strTagName);
2084	    	var sNS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
2085		    var xml =  document.createElementNS(sNS , 'window');
2086		    var label = document.createElementNS(sNS, 'description');
2087            label.setAttribute('crop','end');
2088        
2089			xml.appendChild(label); 
2090
2091    		var fn = function(el){
2092
2093			    var xml2 =  xml.cloneNode(true);
2094			    xml2.firstChild.setAttribute('value',el.textContent);
2095			    el.innerHTML = '';
2096			    el.appendChild(xml2);
2097		    };
2098		
2099		    var a = getElementsByClassName('ellipsis',strTagName, document);
2100		    for(var i=0;el=a[i];i++){
2101			    fn(el);
2102		    };
2103
2104	    }else{
2105		    return function(){};
2106	    };
2107	    return fn;
2108    })();
2109}        
2110
2111/************************************************************************************************
2112* Procedure   : goLoginPage()
2113* Description : 로그인 여부 판단하여 로그인 페이지로 이동
2114* Parameter   : 
2115* Return      : 
2116*************************************************************************************************/
2117function goLoginPage() {
2118    var pLoginUrl = "https://www.ohmynews.com/NWS_Web/Mem/mem_login.aspx?goUrl=";
2119    //if (IsMobile()) pLoginUrl = "https://www.ohmynews.com/NWS_Web/Mem/mobile_login.aspx?goUrl=";
2120    if (getCookie("MemCd") == "-1" || getCookie("MemCd") == "" || getCookie("MemCd") == null) {
2121        if (document.location.href == parent.document.location.href) {
2122            location.href = pLoginUrl + escape(location.href);
2123            return false;
2124        }
2125        else if(document.getElementById("hdnNUM1"))
2126        {
2127            parent.document.location.href = pLoginUrl + escape(parent.document.location.href);
2128            return false;        
2129        }
2130        else
2131        {
2132            parent.document.location.href = pLoginUrl + escape(parent.document.location.href);
2133            return false;
2134        }
2135    }
2136    return true;
2137}
2138
2139/************************************************************************************************
2140* Procedure   : goLoginPage(pURL)
2141* Description : 로그인 여부 판단하여 로그인 페이지로 이동
2142* Parameter   : 
2143* Return      : 
2144*************************************************************************************************/
2145function goLoginPage(pURL) {
2146    var pLoginUrl = "https://www.ohmynews.com/NWS_Web/Mem/mem_login.aspx?goUrl=";
2147    //if (IsMobile()) pLoginUrl = "https://www.ohmynews.com/NWS_Web/Mem/mobile_login.aspx?goUrl=";
2148    if (getCookie("MemCd") == "-1" || getCookie("MemCd") == "" || getCookie("MemCd") == null)
2149    {
2150        if (document.location.href == parent.document.location.href) {
2151            if (typeof pURL == "undefined") pURL = location.href;
2152            location.href = pLoginUrl + escape(pURL);
2153        }
2154        else {
2155            if (typeof pURL == "undefined") pURL = parent.document.location.href;
2156            parent.document.location.href = pLoginUrl + escape(pURL);
2157        }
2158        return false;
2159    }
2160    return true;
2161}
2162
2163 /************************************************************************************************
2164* Procedure   : goLoginPageMobile()
2165* Description : 로그인 여부 판단하여 로그인 페이지로 이동 - 이기종
2166* Parameter   : 
2167* Return      : 
2168*************************************************************************************************/
2169function goLoginPageMobile()
2170{
2171    if (getCookie("MemCd") == "-1" || getCookie("MemCd") == "" || getCookie("MemCd") == null)
2172    {
2173        location.href = "/NWS_Web/Mem/Mem_login.aspx?goUrl=" + escape(location.href);
2174        return false;
2175    }
2176    return true;
2177}
2178
2179 /************************************************************************************************
2180* Procedure   : goLoginPageMobile(pURL)
2181* Description : 로그인 여부 판단하여 로그인 페이지로 이동 - 이기종
2182* Parameter   : 
2183* Return      : 
2184*************************************************************************************************/
2185function goLoginPageMobile(pURL)
2186{
2187    if (getCookie("MemCd") == "-1" || getCookie("MemCd") == "" || getCookie("MemCd") == null)
2188    {
2189        location.href = "/NWS_Web/Mem/Mem_login.aspx?goUrl=" + pURL;
2190        return false;
2191    }
2192    return true;
2193}
2194/****************************************************************************************************
2195*Procedure      :  contents_cp,attach_kinref 
2196*Description    :  기사 및 E노트 최종면 붙여넣기시 출처 복사
2197*Parameter      :  ptitl : 제목, pCncnCd : 컨텐츠 코드
2198*Return         :
2199****************************************************************************************************/
2200//s:기사 copy & paste 시 출처 복사
2201function contents_cp(ptitl,pCntnCd)
2202{   
2203     
2204     if (window.event)
2205     {
2206      window.event.returnValue = true;
2207      window.setTimeout("attach_kinref('" + ptitl + "','" + pCntnCd + "')", 25);
2208     }
2209} 
2210
2211function attach_kinref(ptitl,pCntnCd)      // Attaching Knowledge-IN Reference. 즉, 지식인 참조(출처) 붙이기
2212{
2213    if (window.clipboardData) // IE
2214    {
2215        var txt = window.clipboardData.getData('Text');
2216        txt = txt + "\r\n(출처 : " + ptitl + " - 오마이 뉴스)\r\n";
2217        var result = window.clipboardData.setData('Text', txt);
2218    }
2219 }
2220 //e:기사 copy & paste 시 출처 복사
2221 /****************************************************************************************************
2222*Procedure      :  copyClipboard
2223*Description    :  클립보드에 복사
2224*Parameter      :  
2225*Return         :
2226****************************************************************************************************/
2227 function copyUrl(url){          
2228    if(GetBrowserType() == "IE") {  
2229        window.clipboardData.setData('Text',url);  
2230        window.alert("주소가 복사되었습니다");  
2231    } else {  
2232        url = encodeforFlash(url);  
2233        var flashcopier = 'flashcopier';  
2234        if(!document.getElementById(flashcopier))  
2235        {  
2236            var divholder = document.createElement('div');  
2237            divholder.id = flashcopier;  
2238            document.body.appendChild(divholder);  
2239        }  
2240        document.getElementById(flashcopier).innerHTML = '';  
2241        var divinfo = '<embed src="/nws_web/flash/clipboard/clipboard.swf" flashvars="clipboard='+url+'" type="application/x-shockwave-flash" width="1" height="1">';  
2242        document.getElementById(flashcopier).innerHTML = divinfo;  
2243        window.alert("주소가 복사되었습니다");  
2244    }  
2245 }  
2246
2247 function encodeforFlash(str)
2248{
2249    var SAFECHARS = "0123456789" +
2250                  "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
2251                  "abcdefghijklmnopqrstuvwxyz" +
2252                  "-_.!~*'()";
2253
2254    var HEX = "0123456789ABCDEF";
2255
2256    var plaintext = str;
2257    var encoded = "";
2258    for (var i = 0; i < plaintext.length; i++ ) {
2259        var ch = plaintext.charAt(i);
2260        if (ch == " ") {
2261            encoded += "+";
2262        } else if (SAFECHARS.indexOf(ch) != -1) {
2263            encoded += ch;
2264        } else {
2265            var charCode = ch.charCodeAt(0);
2266            if (charCode > 255) {
2267                encoded += ch;
2268            } else {
2269                encoded += "%";
2270                encoded += HEX.charAt((charCode >> 4) & 0xF);
2271                encoded += HEX.charAt(charCode & 0xF);
2272            }
2273        }
2274    }
2275    return encoded;
2276};
2277
2278/********************************************************************
2279* Function    : target(tar)
2280* Description : 새창 본창 여부
2281* Argument    : 
2282* Return      :
2283* 작성자      : 김재훈
2284*********************************************************************/
2285
2286function tagtting(tar, pNewGB)
2287{
2288    // 새창 여부
2289    if (pNewGB == 'T')
2290    {
2291        tar.target = '_blank';
2292    }
2293    
2294    // 블로그 일경우 새창
2295    var idxBlog = tar.href.toUpperCase().indexOf("CNTN_CD=");
2296    idxBlog = idxBlog + 8;
2297    var cntnGB = tar.href.substring(idxBlog,idxBlog + 1);
2298    if (cntnGB == "B")
2299        tar.target = '_blank';
2300
2301}
2302
2303
2304/********************************************************************
2305* Function    : cut(str, len)
2306* Description : 글자를 앞에서부터 원하는 바이트만큼 잘라 리턴합니다. 한글의 경우 2바이트로 계산하며, 글자 중간에서 잘리지 않습니다.
2307* Argument    : str : 글 , len : 자르는 길이
2308* Return      : 
2309* 작성자      : 최용민
2310*********************************************************************/
2311function cut(str, len) {
2312    var l = 0;
2313    for (var i = 0; i < str.length; i++) {
2314        l += (str.charCodeAt(i) > 128) ? 2 : 1;
2315        if (l > len) return str.substring(0, i);
2316    }
2317    return str;
2318}
2319
2320
2321
2322/************************************************************************************************
2323* Procedure   : Write_JingGae
2324* Description : 징계 : 게시판쓰기, 댓글쓰기, 편집노트쓰기, 기사쓰기, 사진동영상 제한
2325* Parameter   : 회원 pMEM_CD, 징계 유형 pJING_TYP 1:게시판쓰기, 2:댓글쓰기, 3:편집노트, 4:기사쓰기, 5:사진동영상, 9:스패머
2326* Return      : true, false
2327************************************************************************************************/
2328function CheckRule(pJING_TYP, pContents) {
2329    var pMsg = "";
2330    $.ajax({
2331        type: "POST",
2332        url: "https://www.ohmynews.com/NWS_Web/Common/Pages/CommonChkMember.aspx",
2333        data: "jingtyp=" + pJING_TYP + "&contents=" + escape(pContents),
2334        success: function(msg) {
2335            if (msg != "") {
2336                alert(msg);
2337            }
2338            else {
2339
2340            }
2341        },
2342        error: function(error) {
2343            alert("입력실패 했습니다.");
2344        }
2345    });
2346}
2347
2348
2349/************************************************************************************************
2350* Procedure   : SNS(type, title, longurl)
2351* Description : SNS 서비스(페이스북,트위터,미투데이,요즘)
2352* Parameter   : type: 서비스종류 title : 컨텐츠내용 logurl : 컨텐츠 URL
2353* Return      : 
2354* 작성자      : 김재훈
2355************************************************************************************************/
2356function SNS(type, title, longurl, pSummary, pThumbnail) {
2357
2358    switch (type) {
2359
2360        case 'me2day':
2361            if (location.href.indexOf('OhmyStar') > -1) title = escape(title);
2362            var tag = '오마이뉴스';
2363            var link = 'http://me2day.net/posts/new?new_post[body]="' + title + '":' + encodeURIComponent(longurl) + '&new_post[tags]=' + encodeURIComponent(tag);
2364            popwin = window.open(link, 'popwin', 'menubar=yes,toolbar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes');
2365            if (popwin)
2366                popwin.focus();
2367            break;
2368
2369        case 'twitter':
2370            if (location.href.indexOf('OhmyStar') > -1) title = escape(title);
2371            var link = '/NWS_Web/View/at_pg_tw.aspx?titl=' + title + '&cncd=' + encodeURIComponent(longurl);
2372            //popwin = window.open(link,'popwin');
2373            popwin = window.open(link, 'popwin', 'menubar=yes,toolbar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes');
2374            if (popwin)
2375                popwin.focus();
2376            break;
2377
2378        case 'yozzm':
2379            if (location.href.indexOf('OhmyStar') > -1) title = escape(title);
2380            var link = 'http://yozm.daum.net/api/popup/prePost?sourceid=41&link=' + encodeURIComponent(longurl) + '&prefix=' + title;
2381            popwin = window.open(link, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2382            if (popwin)
2383                popwin.focus();
2384            break;
2385
2386        case 'facebook':
2387            var link = 'https://www.facebook.com/sharer.php?u=' + encodeURIComponent(longurl) + "&t=" + encodeURIComponent(title);
2388            popwin = window.open(link, 'recom_icon_pop', 'width=600,height=500,scrollbars=no,resizable=no');
2389            if (popwin)
2390                popwin.focus();
2391            break;
2392
2393        case 'gongam':
2394            var link = '';
2395            if (title == 'Article') link = '/NWS_Web/View/at_pg_tw.aspx?sns=gongam&cncd=' + longurl;
2396            else link = 'http://csp.cyworld.com/bi/bi_recommend_pop.php?url=' + encodeURIComponent(longurl) + "&title=" + title + "&thumbnail=" + pThumbnail + "&summary=" + encodeURIComponent(pSummary);
2397            popwin = window.open(link, 'recom_icon_pop', 'width=400,height=364,scrollbars=no,resizable=no');
2398            if (popwin)
2399                popwin.focus();
2400            break;
2401        
2402        default:
2403            break;
2404    }
2405    return;
2406
2407}
2408
2409/************************************************************************************************
2410* Procedure   : SnsShare_Count(type, cntncd)
2411* Description : 페북, 트위터 공유 카운트 저장
2412* Parameter   : type: 서비스종류 pCNTN_CD: 컨텐츠 코드
2413* Return      : 
2414* 작성자      : 최용민
2415************************************************************************************************/
2416function SnsShare_Count(pCNTN_CD) {
2417    if (pCNTN_CD.substr(0, 1) == "A") {
2418        $.ajax({
2419            url: "/NWS_Web/Common/Pages/CommAjaxFunction.aspx",
2420            type: "POST",
2421            data: ({
2422                std : 'articleinfo',
2423                CNTN_CD : pCNTN_CD
2424            })
2425        });
2426    }
2427}
2428
2429/************************************************************************************************
2430* Procedure   : SNS(type, cntncd)
2431* Description : SNS 서비스(페이스북,트위터,미투데이,요즘)
2432* Parameter   : type: 서비스종류 cntncd: 컨텐츠 코드
2433* Return      : 
2434* 작성자      : 최용민
2435************************************************************************************************/
2436function SnsShare(type, cntncd, pTitl, pThumbNail, pURL, pDESC) {
2437
2438    // GA_Share(type, pURL); :: 2023.07.18 구글애널리틱스-UA 트래킹 중지
2439    
2440    var pUrl = "/NWS_Web/Common/Pages/CommSNS.aspx?SNS=" + type + "&CNTN_CD=" + cntncd + "&TITL=" + pTitl + "&THUMBNAIL=" + pThumbNail + "&URL=" + pURL + "&DESC=" + pDESC;
2441    var popwin;
2442        
2443    switch (type.replace("ten", "")) {
2444        case 'twitter':
2445            SnsShare_Count(cntncd); // 공유카운트 저장
2446            var userAgent = navigator.userAgent;
2447            if (userAgent.indexOf('ohmyapp') > -1)
2448                location.href = pUrl;
2449            else
2450                popwin = window.open(pUrl, 'popwin', 'menubar=yes,toolbar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes');
2451            break;
2452        case 'facebook':
2453        case 'facebook_newsphoto':
2454            SnsShare_Count(cntncd); // 공유카운트 저장
2455
2456            var userAgent = navigator.userAgent;
2457            if (userAgent.indexOf('ohmyapp') > -1)
2458                location.href = pUrl;
2459            else
2460                popwin = window.open(pUrl, 'popwin', 'width=600,height=500,scrollbars=no,resizable=no');
2461            break;
2462        case 'kakao':
2463            var pMsg = $("meta[property='og:title']").attr("content");
2464            kakao.link("talk").send({
2465                msg: pMsg,
2466                url: pURL,
2467                appid: "www.ohmynews.com",
2468                appver: "2.0",
2469                appname: "오마이뉴스",
2470                type: "link"
2471            });
2472            break;
2473        case 'kas':
2474            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2475            break;
2476            
2477        case 'google':
2478            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2479            break;
2480        
2481        case 'band':         
2482            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2483            break;
2484
2485        case 'band_mobile':
2486            var titl = "";
2487            var url = "";
2488            if (cntncd.substr(0, 1) == "A") {
2489                titl = $("meta[property='og:title']:eq(0)").attr("content");
2490                if ($("#dvShareTitl").length > 0) titl = $("#dvShareTitl").html();
2491                url = 'https://www.ohmynews.com/NWS_Web/View/at_pg.aspx?CNTN_CD=' + cntncd;
2492            } else if (cntncd.substr(0, 1) == "M") {
2493                titl = $("meta[property='og:title']:eq(0)").attr("content");
2494                if ($("#dvShareTitl").length > 0) titl = $("#dvShareTitl").html();
2495                url = 'https://www.ohmynews.com/NWS_Web/View/mov_pg.aspx?CNTN_CD=' + cntncd;
2496            } else if (cntncd.substr(0, 1) == "I") {
2497                titl = $("meta[property='og:title']:eq(0)").attr("content");
2498                if ($("#dvShareTitl").length > 0) titl = $("#dvShareTitl").html();
2499                url = 'https://www.ohmynews.com/NWS_Web/View/img_pg.aspx?CNTN_CD=' + cntncd;
2500            } else {
2501                titl = pTitl;
2502                url = pURL;
2503            }
2504                        
2505            if ($(".cssClip").length && $(".cssClip").attr("data-clipboard-text").length)
2506                url = $(".cssClip").attr("data-clipboard-text");
2507            else if ($("#txtShortUrl").length && $("#txtShortUrl").html() != "" && $("#txtShortUrl").html() != "undefined")
2508                url = $("#txtShortUrl").html();
2509
2510            var o = {
2511                method: 'web2app',
2512                param: 'create/post?text=' + titl + ' ' + url,
2513                a_store: 'itms-apps://itunes.apple.com/app/id542613198?mt=8',
2514                a_proto: 'bandapp://',
2515                g_store: 'market://details?id=com.nhn.android.band',
2516                g_proto: 'scheme=bandapp;package=com.nhn.android.band'
2517            };
2518
2519            if (navigator.userAgent.match(/android/i)) {
2520                // Android
2521                setTimeout(function() { location.href = 'intent://' + o.param + '#Intent;' + o.g_proto + ';end' }, 100);
2522            }
2523            else if (navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i)) {
2524                // Apple
2525                if (cntncd.substr(0, 1) == "I") {
2526                    setTimeout(function() { parent.location.href = o.a_proto + o.param }, 100);
2527                    setTimeout(function() { parent.location.href = o.a_store; }, 200);
2528                }
2529                else {
2530                    setTimeout(function() { location.href = o.a_proto + o.param }, 100);
2531                    setTimeout(function() { location.href = o.a_store; }, 200);
2532                }
2533            }
2534            else {
2535                alert('이 기능은 모바일에서만 사용할 수 있습니다.');
2536            }
2537            break;             
2538            
2539        case 'line':
2540            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2541            break;
2542            
2543        case 'line_mobile':
2544            var titl= "";
2545            var url = "";
2546            if (cntncd.substr(0, 1) == "A") {
2547                titl= $("#mtTitl").attr('content');
2548                url = 'https://www.ohmynews.com/NWS_Web/View/at_pg.aspx?CNTN_CD=' + cntncd;
2549            }else{
2550                titl= pTitl;
2551                url = pURL;
2552            }
2553            
2554            var o = {
2555                method:'web2app',
2556                param:'msg/text/'+ titl  + '\r\n' + url,
2557                a_store:'itms-apps://itunes.apple.com/app/id542613198?mt=8',
2558                g_store:'market://details?id=jp.naver.line.android',
2559                a_proto:'line://',
2560                g_proto:'scheme=line;package=jp.naver.line.android'
2561            };
2562            
2563            if(navigator.userAgent.match(/android/i)) {
2564                // Android
2565                setTimeout(function(){ location.href = 'intent://' + o.param + '#Intent;' + o.g_proto + ';end'}, 100);
2566            }
2567            else if(navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i)) {
2568                // Apple
2569                setTimeout(function(){ location.href = o.a_store; }, 200);          
2570                setTimeout(function(){ location.href = o.a_proto + o.param }, 100);
2571            }
2572            else {
2573                alert('이 기능은 모바일에서만 사용할 수 있습니다.');
2574            }
2575            break;      
2576               
2577            
2578        default:
2579            break;
2580    }
2581    if (popwin)
2582        popwin.focus();
2583    return;
2584}
2585
2586// SNS(페이스북) 카운트 업데이트
2587function SetFbCount(pCNTN_CD) {
2588}
2589
2590/************************************************************************************************
2591* Procedure   : SnsShare2(type, cntncd, pTitl, pThumbNail, pURL, pDESC)
2592* Description : SNS 서비스(페이스북,트위터,미투데이,요즘)
2593* Parameter   : type: 서비스종류 cntncd: 컨텐츠 코드
2594* Return      : 
2595* 작성자      : 박준규
2596************************************************************************************************/
2597function SnsShare2(type, cntncd, pTitl, pThumbNail, pURL, pDESC) {
2598    var pUrl = "/NWS_Web/Common/Pages/CommSNS.aspx?SNS=" + type + "&CNTN_CD=" + cntncd + "&TITL=" + escape(pTitl) + "&THUMBNAIL=" + escape(pThumbNail) + "&URL=" + escape(pURL) + "&DESC=" + escape(pDESC);
2599    var popwin;
2600    switch (type) {
2601        case 'me2day':
2602            popwin = window.open(pUrl, 'popwin', 'menubar=yes,toolbar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes');
2603            break;
2604        case 'twitter':
2605            popwin = window.open(pUrl, 'popwin', 'menubar=yes,toolbar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes');
2606            break;
2607        case 'yozzm':
2608            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2609            break;
2610        case 'facebook':
2611            popwin = window.open(pUrl, 'popwin', 'width=600,height=500,scrollbars=no,resizable=no');
2612            break;
2613        case 'gongam':
2614            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2615            break;
2616        default:
2617            break;
2618    }
2619    if (popwin)
2620        popwin.focus();
2621    return;
2622}
2623
2624/************************************************************************************************
2625* Procedure   : SnsShare3(type, cntncd, pTitl, pThumbNail, pURL, pDESC, pRefCd)
2626* Description : 시리즈/논쟁용 - 기존 SnsShare() 와 같고 pRefCd 에 AT_CD 전달
2627*               (cntncd 에 ETC 로 받으면 pURL 은 유지하고 공유카운트 업데이트와 태그정보 등 이용)
2628* Parameter   : type: 서비스종류 cntncd: 컨텐츠 코드(ETC), .... pRefCd: AT_CD
2629* Return      : 
2630* 작성자      : 유우종
2631************************************************************************************************/
2632function SnsShare3(type, cntncd, pTitl, pThumbNail, pURL, pDESC, pRefCd) {
2633
2634    // GA_Share(type, pURL);
2634 :: 2023.07.18 구글애널리틱스-UA 트래킹 중지
2635    
2636    var pUrl = "/NWS_Web/Common/Pages/CommSNS.aspx?SNS=" + type + "&CNTN_CD=" + cntncd + "&TITL=" + pTitl + "&THUMBNAIL=" + pThumbNail + "&URL=" + pURL + "&DESC=" + pDESC + "&REF_CD=" + pRefCd;
2637    var popwin;
2638    
2639    if (pRefCd == "") {
2640        pRefCd = "ETC";
2641    }
2642    //alert(pUrl);
2643    switch (type.replace("ten", "")) {
2644        case 'twitter':
2645            SnsShare_Count(pRefCd); // 공유카운트 저장
2646            var userAgent = navigator.userAgent;
2647            if (userAgent.indexOf('ohmyapp') > -1)
2648                location.href = pUrl;
2649            else
2650                popwin = window.open(pUrl, 'popwin', 'menubar=yes,toolbar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes');
2651            break;
2652        case 'facebook':
2653        case 'facebook_newsphoto':
2654            SnsShare_Count(pRefCd); // 공유카운트 저장
2655
2656            var userAgent = navigator.userAgent;
2657            if (userAgent.indexOf('ohmyapp') > -1)
2658                location.href = pUrl;
2659            else
2660                popwin = window.open(pUrl, 'popwin', 'width=600,height=500,scrollbars=no,resizable=no');
2661            break;
2662        case 'kakao':
2663            var pMsg = $("meta[property='og:title']").attr("content");
2664            kakao.link("talk").send({
2665                msg: pMsg,
2666                url: pURL,
2667                appid: "www.ohmynews.com",
2668                appver: "2.0",
2669                appname: "오마이뉴스",
2670                type: "link"
2671            });
2672            break;
2673        case 'kas':
2674            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2675            break;
2676            
2677        case 'google':
2678            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2679            break;
2680        
2681        case 'band':         
2682            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2683            break;
2684
2685        case 'band_mobile':
2686            var titl = "";
2687            var url = "";
2688            if (cntncd.substr(0, 1) == "A") {
2689                titl = $("meta[property='og:title']:eq(0)").attr("content");
2690                if ($("#dvShareTitl").length > 0) titl = $("#dvShareTitl").html();
2691                url = 'https://www.ohmynews.com/NWS_Web/View/at_pg.aspx?CNTN_CD=' + cntncd;
2692            } else if (cntncd.substr(0, 1) == "M") {
2693                titl = $("meta[property='og:title']:eq(0)").attr("content");
2694                if ($("#dvShareTitl").length > 0) titl = $("#dvShareTitl").html();
2695                url = 'https://www.ohmynews.com/NWS_Web/View/mov_pg.aspx?CNTN_CD=' + cntncd;
2696            } else if (cntncd.substr(0, 1) == "I") {
2697                titl = $("meta[property='og:title']:eq(0)").attr("content");
2698                if ($("#dvShareTitl").length > 0) titl = $("#dvShareTitl").html();
2699                url = 'https://www.ohmynews.com/NWS_Web/View/img_pg.aspx?CNTN_CD=' + cntncd;
2700            } else {
2701                titl = pTitl;
2702                url = pURL;
2703            }
2704                        
2705            if ($(".cssClip").length && $(".cssClip").attr("data-clipboard-text").length)
2706                url = $(".cssClip").attr("data-clipboard-text");
2707            else if ($("#txtShortUrl").length && $("#txtShortUrl").html() != "" && $("#txtShortUrl").html() != "undefined")
2708                url = $("#txtShortUrl").html();
2709
2710            var o = {
2711                method: 'web2app',
2712                param: 'create/post?text=' + titl + ' ' + url,
2713                a_store: 'itms-apps://itunes.apple.com/app/id542613198?mt=8',
2714                a_proto: 'bandapp://',
2715                g_store: 'market://details?id=com.nhn.android.band',
2716                g_proto: 'scheme=bandapp;package=com.nhn.android.band'
2717            };
2718
2719            if (navigator.userAgent.match(/android/i)) {
2720                // Android
2721                setTimeout(function() { location.href = 'intent://' + o.param + '#Intent;' + o.g_proto + ';end' }, 100);
2722            }
2723            else if (navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i)) {
2724                // Apple
2725                if (cntncd.substr(0, 1) == "I") {
2726                    setTimeout(function() { parent.location.href = o.a_proto + o.param }, 100);
2727                    setTimeout(function() { parent.location.href = o.a_store; }, 200);
2728                }
2729                else {
2730                    setTimeout(function() { location.href = o.a_proto + o.param }, 100);
2731                    setTimeout(function() { location.href = o.a_store; }, 200);
2732                }
2733            }
2734            else {
2735                alert('이 기능은 모바일에서만 사용할 수 있습니다.');
2736            }
2737            break;             
2738            
2739        case 'line':
2740            popwin = window.open(pUrl, 'popwin', 'width=400,height=364,scrollbars=no,resizable=no');
2741            break;
2742            
2743        case 'line_mobile':
2744            var titl= "";
2745            var url = "";
2746            if (cntncd.substr(0, 1) == "A") {
2747                titl= $("#mtTitl").attr('content');
2748                url = 'https://www.ohmynews.com/NWS_Web/View/at_pg.aspx?CNTN_CD=' + cntncd;
2749            }else{
2750                titl= pTitl;
2751                url = pURL;
2752            }
2753            
2754            var o = {
2755                method:'web2app',
2756                param:'msg/text/'+ titl  + '\r\n' + url,
2757                a_store:'itms-apps://itunes.apple.com/app/id542613198?mt=8',
2758                g_store:'market://details?id=jp.naver.line.android',
2759                a_proto:'line://',
2760                g_proto:'scheme=line;package=jp.naver.line.android'
2761            };
2762            
2763            if(navigator.userAgent.match(/android/i)) {
2764                // Android
2765                setTimeout(function(){ location.href = 'intent://' + o.param + '#Intent;' + o.g_proto + ';end'}, 100);
2766            }
2767            else if(navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i)) {
2768                // Apple
2769                setTimeout(function(){ location.href = o.a_store; }, 200);          
2770                setTimeout(function(){ location.href = o.a_proto + o.param }, 100);
2771            }
2772            else {
2773                alert('이 기능은 모바일에서만 사용할 수 있습니다.');
2774            }
2775            break;      
2776               
2777            
2778        default:
2779            break;
2780    }
2781    if (popwin)
2782        popwin.focus();
2783    return;
2784}
2785
2786/************************************************************************************************
2787* Procedure   : confirmMovie_Mobile(pIsFree)
2788* Description : 모바일에서 영상 보기 할때...
2789* Parameter   : pIsFree: 유료 무료
2790* Return      : 
2791* 작성자      : 최용민
2792************************************************************************************************/
2793// 영상보기 경고 메세지
2794function confirmMovie_Mobile(pIsFree, pMOV_CD) {
2795
2796    if (pIsFree != "F") {
2797        if (!goLoginPage()) return false;
2798    }
2799    var pStr = $.ajax({
2800        url: "/NWS_Web/OhmyTV/tvinfoa_mobile.aspx",
2801        async: false,
2802        type: "POST",
2803        data: ({ MOV_CD: pMOV_CD })
2804    }).responseText;
2805
2806    if (pStr != 'FAIL') {
2807        if (confirm('3G로 접속할 경우 과도한 데이터패킷이 발생할 수 있습니다.')) {
2808            window.open(pStr);
2809        }
2810    }
2811    else {
2812        if (pIsFree != "F") alert('유료영상 콘텐츠입니다.');
2813        else alert('플레이에 실패 하였습니다.');
2814    }
2815}
2816/************************************************************************************************
2817* Procedure   : confirmMovie_Mobile(pIsFree, pMOV_CD, pDivice)
2818* Description : 모바일 특강 인증
2819* Parameter   : pIsFree: 유료 무료, pMOV_CD: 영상코드, pDivice: 기기
2820* Return      : 
2821* 작성자      : 이기종
2822************************************************************************************************/
2823// 영상보기 경고 메세지
2824function confirmMovie_Mobile2(pIsFree, pMOV_CD, pDivice) {
2825    if (pIsFree != "F") {
2826        if(pDivice == "Mobile")
2827        {
2828            if (!goLoginPageMobile()) return false;
2829        }else{
2830            if (!goLoginPage()) return false;
2831        }
2832    }
2833    
2834    var pStr = $.ajax({
2835        url: "/NWS_Web/OhmyTV/tvinfoa_mobile.aspx",
2836        async: false,
2837        type: "POST",
2838        data: ({ MOV_CD: pMOV_CD })
2839    }).responseText;
2840
2841    if (pStr != 'FAIL') {
2842        if (confirm('3G로 접속할 경우 과도한 데이터패킷이 발생할 수 있습니다.')) {
2843            window.open(pStr);
2844        }
2845    }
2846    else {
2847        if (pIsFree != "F") alert('유료영상 콘텐츠입니다.');
2848        else alert('플레이에 실패 하였습니다.');
2849    }
2850} 
2851
2852
2853// 추천, 찬성, 반대
2854// pStd 설명 1: 게시판 첨부파일 다운로드 로그, recommand : 추천, disagree : 반대
2855function Recommand(pCNTN_CD, pID, pStd) {
2856    
2857    var pStr = $.ajax({
2858        url: "/NWS_Web/Common/Pages/CommAjaxFunction.aspx",
2859        async: false,
2860        type: "POST",
2861        data: ({ CNTN_CD: pCNTN_CD, std: pStd })
2862    }).responseText;
2863
2864    if (pStr == "OK") {
2865        if (pID != '') {
2866            var pCnt = Number($('#' + pID).html()) + 1;
2867            $('#' + pID).html(pCnt);
2868        }
2869        else {
2870            alert("추천 하였습니다.    ");
2871        }
2872    }
2873    else {
2874        switch (pCNTN_CD.substr(0, 1)) {
2875            case 'M':
2876            case 'I':            
2877                alert("이미 추천 하셨습니다.");
2878                break;
2879            default :
2880                alert(eval(pStr));
2881                break;
2882        }
2883    }
2884}
2885
2886// 축약주소 알아내기 ajax 사용
2887function GetShortUrl(pCNTN_CD, pSTD) {
2888    var pCT_GB = pCNTN_CD.substr(0, 1)
2889    var pURL = "";
2890    switch (pCT_GB) {
2891        case "A":
2892            if (pSTD == "24")
2893                pURL = "https://www.ohmynews.com/NWS_Web/OhmyStar/at_pg.aspx?CNTN_CD=" + pCNTN_CD;
2894            else
2895                pURL = "https://www.ohmynews.com/NWS_Web/View/at_pg.aspx?CNTN_CD=" + pCNTN_CD;
2896            break;
2897        case "I":
2898            if (pSTD == "24")
2899                pURL = "https://www.ohmynews.com/NWS_Web/OhmyStar/img_pg.aspx?CNTN_CD=" + pCNTN_CD;
2900            else
2901                pURL = "https://www.ohmynews.com/NWS_Web/View/img_pg.aspx?CNTN_CD=" + pCNTN_CD;
2902            break;
2903        case "M":
2904            pURL = "https://www.ohmynews.com/NWS_Web/View/mov_pg.aspx?CNTN_CD=" + pCNTN_CD;
2905            break;
2906    }
2907    
2908    var pStr = $.ajax({
2909        url: "/NWS_Web/Common/Pages/CommSNS.aspx",
2910        async: false,
2911        type: "POST",
2912        data: ({ ajaxurl: pURL, CNTN_CD: pCNTN_CD })
2913    }).responseText;
2914    pStr = $.trim(pStr);
2915
2916    return pStr;
2917}
2918
2919/************************************************************************************************
2920* Procedure   : Layer_Popup
2921* Description : 레이어 팝업
2922* Parameter   : 
2923* Return      : 
2924*************************************************************************************************/
2925function Layer_Popup(pID, pUrl, pWidth, pHeight, pScroll) {
2926    var pLayerHtml = "";
2927    pLayerHtml += "<div id='dvPopUp' style='display:none; position:fixed; _position:absolute; top:0; left:0; width:100%; height:100%; z-index:10000;'>";
2928    pLayerHtml += "     <div id='dvBg' style='position:absolute; top:0; left:0; width:100%; height:100%; background:#000; opacity:.5; filter:alpha(opacity=50);'></div>";
2929    pLayerHtml += "</div>";
2930    pLayerHtml += "<div id='dvPopContent' style='display:none; position:absolute; left:50%; background:#fff; padding:0px; border:4px solid #ddd; border-top:30px solid #ddd; width:" + pWidth + "px; height:" + pHeight + "px; z-index:10001;'></div>";
2931
2932    $('body').append(pLayerHtml);
2933    $('#dvPopContent').append("<img id='imgClose' src='https://ojsimg.ohmynews.com/images/close.jpg' style='position:absolute;top:-25px;left:" + (pWidth - 20) + "px;cursor:pointer;' />")
2934
2935    if (pID != "") {
2936        $('#dvPopContent').append($('#' + pID).html());
2937    }
2938    if (pUrl != "") {
2939        $('#dvPopContent').append("<iframe id='ifr' src='" + pUrl + "' width='" + pWidth + "' height='" + pHeight + "' frameborder='0' scrolling='" + pScroll + "'></iframe>");
2940    }
2941
2942    var pDocHeight = $(document).height();
2943    $('#dvPopUp').css('height', pDocHeight + 'px');
2944    $('#dvBg').css('height', pDocHeight + 'px');
2945
2946    // 팝업 열기
2947    $('#dvPopUp, #dvPopContent').fadeIn();
2948    centerScreen($('#dvPopContent'));
2949
2950
2951    // 팝업닫기
2952    $(document).keydown(function(e) {
2953        if (e.keyCode == 27) {
2954            LayerPopup_Hide();
2955        }
2956    });
2957
2958    $('#imgClose').on('click', function() {
2959        LayerPopup_Hide();
2960    });
2961
2962    $("#dvPopContent").on({
2963        "mouseover": function() {
2964           // $(this).draggable({ cursor: "move" });
2965           // $(this).css("cursor", "move");
2966        }
2967    });
2968}
2969
2970/************************************************************************************************
2971* Procedure   : Layer_Popup2
2972* Description : 레이어 팝업
2973* Parameter   : 
2974* Return      : 
2975*************************************************************************************************/
2976function Layer_Popup2(pID, pUrl, pWidth, pHeight, pScroll) {
2977    var pLayerHtml = "";
2978    pLayerHtml += "<div id='dvPopUp' style='display:none; position:fixed; _position:absolute; top:0; left:0; width:100%; height:100%; z-index:10000;'>";
2979    pLayerHtml += "     <div id='dvBg' style='position:absolute; top:0; left:0; width:100%; height:100%; background:#000; opacity:.5; filter:alpha(opacity=50);'></div>";
2980    pLayerHtml += "</div>";
2981    pLayerHtml += "<div id='dvPopContent' style='display:none; position:absolute; left:50%; background:#fff; padding:0px; border:4px solid #ddd; width:" + pWidth + "px; height:" + pHeight + "px; z-index:10001;'></div>";
2982
2983    $('body').append(pLayerHtml);
2984    //$('#dvPopContent').append("<img id='imgClose' src='https://ojsimg.ohmynews.com/images/close.jpg' style='position:absolute;top:-25px;left:" + (pWidth - 20) + "px;cursor:pointer;' />")
2985
2986    if (pID != "") {
2987        $('#dvPopContent').append($('#' + pID).html());
2988    }
2989    if (pUrl != "") {
2990        $('#dvPopContent').append("<iframe id='ifr' src='" + pUrl + "' width='" + pWidth + "' height='" + pHeight + "' frameborder='0' scrolling='" + pScroll + "'></iframe>");
2991    }
2992
2993    var pDocHeight = $(document).height();
2994    $('#dvPopUp').css('height', pDocHeight + 'px');
2995    $('#dvBg').css('height', pDocHeight + 'px');
2996
2997    // 팝업 열기
2998    $('#dvPopUp, #dvPopContent').fadeIn();
2999    centerScreen($('#dvPopContent'));
3000
3001
3002    // 팝업닫기
3003    $(document).keydown(function(e) {
3004        if (e.keyCode == 27) {
3005            LayerPopup_Hide();
3006        }
3007    });
3008
3009    $('#imgClose').on('click', function() {
3010        LayerPopup_Hide();
3011    });
3012
3013    $("#dvPopContent").on({"mouseover": function() {
3014           // $(this).draggable({ cursor: "move" });
3015           // $(this).css("cursor", "move");
3016        }
3017    });
3018}
3019
3020/************************************************************************************************
3021* Procedure   : Layer_Popup_Loading
3022* Description : 레이어 팝업
3023* Parameter   : 
3024* Return      : 
3025*************************************************************************************************/
3026function Layer_Popup_Loading() {
3027    $('body').ajaxStart(function() {
3028        var pLayerHtml = "<div id='dvPopUp' style='position:absolute; top:0; left:0; width:100%; height:" + document.body.scrollHeight + "px; background:#000; opacity:.5; filter:alpha(opacity=50);  z-index:10000;'></div>";
3029        $(this).append(pLayerHtml);
3030       
3031        $('#dvPopUp').append("<img id='imgLoading' src='https://ojsimg.ohmynews.com/images/loading2012.gif' style='position:absolute; top:-50px; left:-50px; cursor:pointer;' />");
3032        centerScreen($('#imgLoading'));
3033
3034    });
3035
3036    $("body").ajaxStop(function() {
3037        setTimeout(LayerPopup_Hide, 500);
3038    });
3039}
3040
3041function Layer_Popup_Loading2() {
3042    var pLayerHtml = "<div id='dvPopUp' style='position:absolute; top:0; left:0; width:100%; height:" + document.body.scrollHeight + "px; background:#000; opacity:.5; filter:alpha(opacity=50);  z-index:10000;'></div>";
3043    $('body').append(pLayerHtml);
3044
3045    $('#dvPopUp').append("<img id='imgLoading' src='https://ojsimg.ohmynews.com/images/loading2012.gif' style='position:absolute; top:-50px; left:-50px; cursor:pointer;' />");
3046    centerScreen($('#imgLoading'));
3047}
3048
3049// 팝업닫기
3050function LayerPopup_Hide() {
3051    $('#dvPopUp, #dvPopContent').fadeOut('fast', function() {
3052        $('#dvPopUp, #dvPopContent').remove();
3053    });
3054}
3055
3056// 팝업가운데로
3057function centerScreen(obj) {
3058    var pTop = $(document).scrollTop() + Math.ceil(($(window).height() - obj.outerHeight()) / 2);
3059    obj.css('top', pTop + 'px');
3060    obj.css('left', $(window).width() / 2 - obj.width() / 2);
3061}
3062
3063//숫자콤마
3064function set_commma(n){
3065    var reg=/(^[+-]?\d+)(\d{3})/;
3066    n += '';
3067    while(reg.test(n))
3068        n = n.replace(reg,'$1' + ',' + '$2');
3069        
3070    return n;
3071}
3072
3073//동일IP 연속등록 제한
3074function CheckIpLimit(pBoardCd)    
3075{
3076    var pStr = $.ajax({
3077        url: "/NWS_Web/Common/Pages/CommonChkMember.aspx",
3078        async: false,
3079        type: "POST",
3080        data: ({ pMode: "ipLimit", pCheck: "timeLmt", pBoardCd: pBoardCd })
3081    }).responseText;
3082    
3083    // 0: 등록가능, 1: 30초(26초) 등록제한, 2: 3시간(2시간30분) 이내 연속등록 5회
3084    if (pStr == '1') {
3085        alert('동일 IP로 30초이내 연속등록은 제한됩니다.');
3086        return false;
3087    } else if (pStr == '2') {
3088        alert('동일 IP로 5회이상 연속등록하여 3시간동안 제한됩니다.');
3089        
3090        return false;
3091    }
3092    
3093    return true;
3094}
3095
3096// 1,000단위 마다 콤마(,) 추가하기
3097function setComma(pStr) {
3098    var reg = /(^[+-]?\d+)(\d{3})/;
3099    pStr += '';
3100    while (reg.test(pStr))
3101        pStr = pStr.replace(reg, '$1' + ',' + '$2');
3102    return pStr;
3103}
3104
3105//금액 콤마 삭제
3106function delComma(n) {
3107    return parseInt(n.replace(/,/g, ""));
3108}
3109
3110// 모바일 페이지 여부 확인
3111function IsMobile()
3112{
3113    var ua = window.navigator.userAgent.toLowerCase(); 
3114    if ( /iphone/.test(ua) || /android/.test(ua) || /opera/.test(ua) || /bada/.test(ua) || /mobile/.test(ua) ) { 
3115        return true;
3116    } else {
3117        return false;
3118    }
3119}
3120
3121//** IsIOSHiddn()
3122function IsIOSHiddn()
3123{
3124    return;
3125    var ua = window.navigator.userAgent.toLowerCase(); 
3126    if (ua.match(/(iphone)|(ipod)|(ipad)/i) && ua.indexOf("ohmyapp") > -1 || ua.match(/(android)/i) && ua.indexOf("ohmyapp") > -1) { //ios, android
3127        pLocation = location.href.toLowerCase();
3128        if (pLocation.indexOf("mobile/ten/tenman_ins") > -1 || pLocation.indexOf("mobile/pay_ini/tenman_ins_tpr") > -1 ) { 
3129            location.href="/NWS_Web/Mobile/Ten/index.aspx";
3130        }
3131        //mobilemaster2016
3132        $(".btn_give, .payment > .give, .clubbt_box, .payment_box, .btn_money, .button_left > .btn_money").hide();
3133        $("#tenman_li_support").hide();
3134        
3135        //mem_login.aspx
3136        $(".social-login-container").hide();
3137                
3138        //pay_ini/10mainin.aspx
3139        $("#dvDin").hide();
3140        $("#dvMin").show();
3141        $("#autoPay").attr("href","javascript:;");    
3142        
3143        //ten/10manin.aspx
3144        $("#yearPay").attr("href","javascript:;");
3145
3146        $(".itbtn.money").hide();
3147    } 
3148}
3149
3150// 기사스크랩
3151function CntnScrap(pCNTN_CD, pGB) {
3152    if (goLoginPage(location.href)) {
3153        var pStr = $.ajax({
3154            url: "/NWS_Web/Common/Pages/CommAjaxFunction.aspx",
3155            async: false,
3156            type: "POST",
3157            data: ({ std: "scrap",
3158                CNTN_CD: pCNTN_CD,
3159                gb: pGB
3160            })
3161        }).responseText;
3162
3163        if (pStr == "1") alert("이미 스크랩 되었습니다.");
3164
3165        if (pGB == "add") {
3166            $(".cssAScrap").attr("href", "javascript:CntnScrap('" + pCNTN_CD + "', 'delete');");
3167            $(".scrap_off").addClass("scrap");
3168            $(".scrap_off").removeClass("scrap_off");
3169
3170            $(".bmk").attr("href", "javascript:CntnScrap('" + pCNTN_CD + "', 'delete');");
3171            $(".bmk").addClass("on");
3172
3173            if (confirm("기사를 스크랩했습니다. \n스크랩 페이지로 이동 하시겠습니까?")) {
3174                if (IsMobile()) location.href = "/NWS_Web/Mobile/scrap.aspx";
3175                else location.href = "/NWS_Web/i_room/Closed/scrap.aspx";
3176            }
3177
3178            var pObj = $(".arc-btns-wrap").find("button[onclick*='CntnScrap(']");
3179            if (pObj.length) {
3180                pObj.addClass("on");
3181                var pONCLICK_TXT = pObj.attr("onclick");
3182                pONCLICK_TXT = pONCLICK_TXT.replace("'add'", "'delete'");
3183                pObj.attr("onclick", pONCLICK_TXT);
3184            }
3185            
3186        }
3187        else {
3188            $(".cssAScrap").attr("href", "javascript:CntnScrap('" + pCNTN_CD + "', 'add');");
3189            $(".scrap").addClass("scrap_off");
3190            $(".scrap").removeClass("scrap");
3191
3192            $(".bmk").attr("href", "javascript:CntnScrap('" + pCNTN_CD + "', 'add');");
3193            $(".bmk").removeClass("on");
3194
3195            var pObj = $(".arc-btns-wrap").find("button[onclick*='CntnScrap(']");
3196            if (pObj.length) {
3197                pObj.removeClass("on");
3198                var pONCLICK_TXT = pObj.attr("onclick");
3199                pONCLICK_TXT = pONCLICK_TXT.replace("'delete'", "'add'");
3200                pObj.attr("onclick", pONCLICK_TXT);
3201            }
3202                        
3203            
3204        }
3205    }
3206}
3207
3208// 태그제거
3209function stripHTMLtag(string) {
3210    var objStrip = new RegExp();
3211    objStrip = /[<][^>]*[>]/gi;
3212    return string.replace(objStrip, "");
3213}
3214
3215
3216// 송고된 기사인지 검사
3217function IsToDesk(pCNTN_CD) {
3218    var pStr = $.ajax({
3219        url: "/NWS_Web/Common/Pages/CommAjaxFunction.aspx",
3220        async: false,
3221        type: "POST",
3222        data: ({ std: "istodesk",
3223                 CNTN_CD: pCNTN_CD
3224        })
3225    }).responseText;
3226
3227    if (pStr == "true") {
3228        alert("이미 송고된 기사 입니다.");
3229        return true;
3230    }
3231    else if (pStr == "false") return false;
3232}
3233
3234/************************************************************************************************
3235* Procedure   : Set_Slide
3236* Description : 슬라이드 기본형
3237* Parameter   : pSlideID, pNaviClassName, pTitleID, pJnrstID
3238* Return      : 
3239*************************************************************************************************/
3240function Set_Slide(pSlideID, pNaviClassName, pTitleID, pJnrstID, pIsRandom, LRShow) {
3241
3242    var pIdx = 0;
3243    if (pIsRandom == true) pIdx = Math.floor(Math.random() * $("." + pNaviClassName).length);
3244    
3245    if (LRShow == null || LRShow == "")
3246    {
3247        LRShow = "1";   
3248    }
3249    
3250    var options = {
3251        $StartIndex: pIdx,
3252        $ArrowNavigatorOptions: {                           //[Optional] Options to specify and enable arrow navigator or not
3253            $Class: $JssorArrowNavigator$,                   //[Requried] Class to create arrow navigator instance
3254            $ChanceToShow: LRShow                            //0: nerver, 1:mouse over, 2:always
3255        }
3256    };
3257    var jssor_slider1 = new $JssorSlider$(pSlideID, options);
3258
3259    var pCNTN_CD = $("." + pNaviClassName + ":eq(" + pIdx + ")").find("img").attr("imgcd");
3260    var pJNRST_CD = $("." + pNaviClassName + ":eq(" + pIdx + ")").find("img").attr("jnrstcd");
3261    var pURL = $("." + pNaviClassName + ":eq(" + pIdx + ")").find("img").attr("viewurl");
3262    if (pCNTN_CD) {
3263        if (pTitleID == "aMovBoxTitle") {
3264            $(".playbtn").attr("onclick", "PlayMovie('" + $("." + pNaviClassName + ":eq(" + pIdx + ")").find("img").attr("imgcd") + "')");
3265            $("#" + pTitleID).attr("href", pURL);
3266            if (pURL.indexOf('onair.aspx') > -1) $("#" + pTitleID).attr("target", "_blank");
3267            else $("#" + pTitleID).removeAttr("target");
3268            $("#" + pJnrstID).attr("href", "/NWS_Web/I_Room/Open/Open_Profile.aspx?MEM_CD=" + pJNRST_CD + "&CMPT_CD=M0116");
3269        }
3270        if (pTitleID == "aPhBoxTitle") {
3271            $("#" + pTitleID).attr("href", pURL);
3272            $("#" + pJnrstID).attr("href", "/NWS_Web/I_Room/Open/Open_Profile.aspx?MEM_CD=" + pJNRST_CD + "&CMPT_CD=M0115");
3273        }
3274    }
3275
3276    jssor_slider1.$On($JssorSlider$.$EVT_PARK, function(slideIndex, fromIndex) {
3277        $("." + pNaviClassName).removeClass("on");
3278        $("." + pNaviClassName + ":eq(" + slideIndex + ")").addClass("on");
3279        $("#" + pTitleID).html($("." + pNaviClassName + ":eq(" + slideIndex + ")").find("img").attr("alt"));
3280        $("#" + pJnrstID).html($("." + pNaviClassName + ":eq(" + slideIndex + ")").find("img").attr("jnrst"));
3281
3282        pCNTN_CD = $("." + pNaviClassName + ":eq(" + slideIndex + ")").find("img").attr("imgcd");
3283        pJNRST_CD = $("." + pNaviClassName + ":eq(" + slideIndex + ")").find("img").attr("jnrstcd");
3284        pURL = $("." + pNaviClassName + ":eq(" + slideIndex + ")").find("img").attr("viewurl");
3285        if (pCNTN_CD) {
3286            if (pTitleID == "aMovBoxTitle") {
3287                $(".playbtn").attr("onclick", "PlayMovie('" + $("." + pNaviClassName + ":eq(" + pIdx + ")").find("img").attr("imgcd") + "')");
3288                $("#" + pTitleID).attr("href", pURL);
3289                if (pURL.indexOf('onair.aspx') > -1) $("#" + pTitleID).attr("target", "_blank");
3290                else $("#" + pTitleID).removeAttr("target");
3291                $("#" + pJnrstID).attr("href", "/NWS_Web/I_Room/Open/Open_Profile.aspx?MEM_CD=" + pJNRST_CD + "&CMPT_CD=M0116");
3292            }
3293            if (pTitleID == "aPhBoxTitle") {
3294                $("#" + pTitleID).attr("href", pURL);
3295                $("#" + pJnrstID).attr("href", "/NWS_Web/I_Room/Open/Open_Profile.aspx?MEM_CD=" + pJNRST_CD + "&CMPT_CD=M0115");
3296            }
3297        }
3298
3299        if (pSlideID == "movbox_slider_container") { // 2015 영상 메인
3300            $("#" + pSlideID).find("img").show();
3301            $(".playbtn").show();
3302            $("#" + pSlideID).find("iframe").remove();
3303        }
3304    });
3305
3306    $("." + pNaviClassName).on('click', function() {
3307        jssor_slider1.$PlayTo($(this).attr('idx'));
3308    });
3309}
3310
3311//추천-취소
3312function Set_RECM(pRECMGB, pCNTNCD) {
3313
3314    var pStr = $.ajax({
3315        url: "/NWS_Web/Common/Pages/CommAjaxFunction.aspx",
3316        async: false,
3317        type: "POST",
3318        datatype: "xml",
3319        data: ({ std: "ajaxRecm", CNTN_CD: pCNTNCD, RECMGB: pRECMGB })
3320    }).responseText;
3321
3322    var arrStr = pStr.split("|");
3323    
3324    
3325    var pObj = $(".arc-btns-wrap").find("button[onclick*='Set_RECM(']");
3326    
3327    if(arrStr[0] == "OK")
3328    {
3329        if(pRECMGB == "F")//취소
3330        {
3331            $("#top_recm").html("<span class='sym-s_off'>추천</span>"+arrStr[1]);
3332            $("#bottom_recm").attr("class","btn-like_off");
3333            $("#top_recm, #bottom_recm").attr("onclick","javascript:Set_RECM('T', '" + pCNTNCD + "');");
3334            $(".cssSCCnt, .cssSCdt").removeClass("good_on").addClass("good_off");
3335            $("#list_recm" + pCNTNCD).attr("class","btn-like_off");
3336            $("#list_recm" + pCNTNCD).attr("onclick","javascript:Set_RECM('T', '" + pCNTNCD + "');");
3337
3338            $(".recm_btn").removeClass("on");
3339            $(".recm_btn").attr("onclick", "javascript:Set_RECM('T', '" + pCNTNCD + "');");
3340            
3341            // GNB 2019
3342            $("#topGNB_RECM").removeClass("on");
3343            $("#topGNB_RECM").attr("onclick", "javascript:Set_RECM('T', '" + pCNTNCD + "');");
3344            
3345            if (pObj.length) {
3346                pObj.removeClass("on");
3347                var pONCLICK_TXT = pObj.attr("onclick");
3348                pONCLICK_TXT = pONCLICK_TXT.replace("'F'", "'T'");
3349                pObj.attr("onclick", pONCLICK_TXT);
3350            }            
3351        }else{
3352            $("#top_recm").html("<span class='sym-s_on'>추천</span>"+arrStr[1]);
3353            $("#bottom_recm").attr("class","btn-like_on");
3354            $("#top_recm, #bottom_recm").attr("onclick","javascript:Set_RECM('F', '" + pCNTNCD + "');");
3355            $(".cssSCCnt, .cssSCdt").removeClass("good_off").addClass("good_on");
3356            $("#list_recm" + pCNTNCD).attr("class","btn-like_on");
3357            $("#list_recm" + pCNTNCD).attr("onclick","javascript:Set_RECM('F', '" + pCNTNCD + "');");
3358            
3359            $(".recm_btn").addClass("on");
3360            $(".recm_btn").attr("onclick", "javascript:Set_RECM('F', '" + pCNTNCD + "');");
3361            
3362            // GNB 2019
3363            $("#topGNB_RECM").addClass("on");
3364            $("#topGNB_RECM").attr("onclick", "javascript:Set_RECM('F', '" + pCNTNCD + "');");
3365
3366            if (pObj.length) {
3367                pObj.addClass("on");
3368                var pONCLICK_TXT = pObj.attr("onclick");
3369                pONCLICK_TXT = pONCLICK_TXT.replace("'T'", "'F'");
3370                pObj.attr("onclick", pONCLICK_TXT);
3371            }              
3372        }
3373
3374        pObj = $(".arc-btns-wrap").find("button[onclick*='Set_RECM(']");
3375        if (pObj.find(".number").length > 0)
3376            pObj.find(".number").html(arrStr[1]);
3377        else
3378            pObj.append("<span class='number'>" + arrStr[1] + "</span>");
3379        
3380        $(".cssSCCnt").html(arrStr[1]);
3381        $(".recm_btn").find(".non").html(arrStr[1]);
3382        $("#bottom_recm").html("<div class='icon-area'><span class='fin_on'>추천</span>추천</div><div class='count-a'>"+arrStr[1]+"</div>");
3383        $("#list_recm" + pCNTNCD).html("<div class='icon-area'><span class='fin_on'>추천</span>추천</div><div class='count-a'>"+arrStr[1]+"</div>");
3384        
3385        // GNB 2019
3386        $("#topGNB_RECM > .data").html(arrStr[1]);
3387        
3388        if(arrStr[1] == "0") // 점수없음
3389        {
3390            $("#bottom_recm").attr("class","btn-like");
3391            $("#bottom_recm").html("<div class='icon-area'><span class='fin_on'>추천</span>추천</div>");
3392            
3393            $("#list_recm" + pCNTNCD).attr("class","btn-like");
3394            $("#list_recm" + pCNTNCD).html("<div class='icon-area'><span class='fin_on'>추천</span>추천</div>");
3395
3396            pObj.find(".number").remove();
3397            
3398            // GNB 2019
3399            $("#topGNB_RECM > .data").html("");
3400        }
3401    }else{
3402        alert(pStr);
3403    }
3404}
3405
3406// 팩트체크
3407function Set_FCHK(pNum, pCNTNCD) {
3408    var pStr = $.ajax({
3409        url: "/NWS_Web/Common/Pages/CommAjaxFunction.aspx",
3410        async: false,
3411        type: "POST",
3412        data: ({ std: "ajaxFchk", CNTN_CD: pCNTNCD, num: pNum })
3413    }).responseText;
3414
3415    var arrStr = pStr.split("|");
3416    
3417    if(arrStr[0] == "OK") {
3418        //var NUM_MAX = parseInt(arrStr[1]);
3419        var NUM = new Array(0, parseInt(arrStr[2]), parseInt(arrStr[3]), parseInt(arrStr[4]), parseInt(arrStr[5]), parseInt(arrStr[6]), parseInt(arrStr[7]));
3420        var bDup = arrStr[8];
3421        var i;
3422        for (i = 1; i <= 6; i++) {
3423            //if (NUM_MAX != 0 && NUM_MAX == NUM[i]) $("#fchkcss"+i).attr("class", "pinocchio"+i+"_on");
3424            if (pNum == i && bDup == 'F') $("#fchkcss"+i).attr("class", "pinocchio"+i+"_on");
3425            else $("#fchkcss"+i).attr("class", "pinocchio"+i+"_off");
3426            $("#fchkcnt"+i).html(""+NUM[i]);
3427        }
3428    }
3429    else alert(pStr);
3430}
3431
3432function MoveTenman_bottom()
3433{
3434    //http://www.ohmynews.com/NWS_Web/
3435    //console.log(location.href);
3436    var thisUrl = location.href.toLowerCase();
3437    var cmptCd = "";
3438    if (thisUrl.indexOf('www.ohmynews.com/nws_web/') > -1) {
3439        cmptCd = "PT008";
3440    } else {
3441        cmptCd = "PT005";
3442    }
3443    
3444    GA_Event('10민_버튼', 'mnb_링크_클릭', '메인_버튼_하단배너_10만인후원');
3445    location.href = 'https://www.ohmynews.com/NWS_Web/tenman/club_support.aspx?CMPT_CD=' + cmptCd;
3446}
3447
3448// html5 video
3449function goTenClub() {
3450    var pUrl = "https://www.ohmynews.com/NWS_Web/tenman/tenman_ins.aspx";
3451    if (document.location.href == parent.document.location.href) location.href = pUrl;
3452    else parent.document.location.href = pUrl;
3453    return false;
3454}
3455
3456function findMovDiv(c) {
3457    var n = 10;
3458    while (n-- > 0) {
3459        if ($(c).attr("class") == 'vodhtml') return c;
3460        c = $(c).parent();
3461    }
3462    return null;
3463}
3464
3465function startMovie5(c) {
3466    if ((c = findMovDiv(c)) == null) return;
3467    if ($(c).attr("DATA_PR_GB") != "F") {
3468        if (getCookie("MemCd") == "-1" || getCookie("MemCd") == "" || getCookie("MemCd") == null) {
3469            $(c).html("<div class='vod-view' style='width: " + $(c).attr("DATA_WIDTH") + "px; " + "height: " + $(c).attr("DATA_HEIGHT") + "px;'><div class='popup'><strong class='title'>10만인클럽 회원 전용 콘텐츠입니다.<br> 로그인 후 이용하세요.</strong><a href='javascript:void(0)' onclick='goLoginPage(); return false;' class='login'>로그인</a></div><div class='bg-cover'></div><img src='" + $(c).attr("DATA_TMB_IMG_NM") + "' class='h-mov' style='max-width: 100%; max-height: 100%; object-fit: contain;' onload='fitThumb5(this," + $(c).attr("DATA_WIDTH") + "," + $(c).attr("DATA_HEIGHT") + ");'/></div>");
3470            return false;
3471        }
3472        if (!goLoginPage()) return false;
3473    }
3474    var pStr = $.ajax({
3475        url: "/NWS_Web/OhmyTV/tvinfoa_mobile.aspx",
3476        async: false,
3477        type: "POST",
3478        data: ({ MOV_CD: $(c).attr("DATA_MOV_CD") })
3479    }).responseText;
3480
3481    if (pStr != 'FAIL') {
3482        $(c).html("<video style='background-color: #000;' width=" + $(c).attr("DATA_WIDTH") + " height=" + $(c).attr("DATA_HEIGHT") + " controls disablePictureInPicture controlsList=\"nodownload\" isfirst=\"1\" oncanplay=\"if(this.getAttribute('isfirst')=='1'){this.removeAttribute('isfirst');this.play();}\" onended=\"endMovie5(this);\"><source src=\"" + pStr + "\" type=\"video/mp4\" /></video>");
3483    }
3484    else {
3485        $(c).html("<div class='vod-view' style='width: " + $(c).attr("DATA_WIDTH") + "px; " + "height: " + $(c).attr("DATA_HEIGHT") + "px;'><div class='popup'><strong class='title'>10만인클럽 회원 전용 콘텐츠입니다.</strong><a href='javascript:void(0)' onclick='goTenClub(); return false;' class='ten-view'>10만인클럽 가입하기</a></div><div class='bg-cover'></div><img src='" + $(c).attr("DATA_TMB_IMG_NM") + "' class='h-mov' style='max-width: 100%; max-height: 100%; object-fit: contain;' onload='fitThumb5(this," + $(c).attr("DATA_WIDTH") + "," + $(c).attr("DATA_HEIGHT") + ");'/></div>");
3486    }
3487}
3488
3489function endMovie5(c) {
3490    if ((c = findMovDiv(c)) == null) return;
3491    $(c).html("<div class='cssEnd5' style='width: " + $(c).attr("DATA_WIDTH") + "px; " + "height: " + $(c).attr("DATA_HEIGHT") + "px;'><div class='act-box'><a href='javascript:void(0)' onclick='replayMovie5(this); return false;'><span class='return-btn'></span><strong>다시보기</strong></a><a href='javascript:void(0)' onclick='recomMovie5(this); return false;'><span class='recommend-btn'></span><strong>추천</strong></a></div><div class='bg-cover'></div><img src='" + $(c).attr("DATA_TMB_IMG_NM") + "' class='h-mov' style='max-width: 100%; max-height: 100%; object-fit: contain;' onload='fitThumb5(this," + $(c).attr("DATA_WIDTH") + "," + $(c).attr("DATA_HEIGHT") + ");'></div>");
3492}
3493
3494function replayMovie5(c) { startMovie5(c); }
3495
3496function recomMovie5(c) {
3497    if ((c = findMovDiv(c)) == null) return;
3498    Recommand($(c).attr("DATA_MOV_CD"), "", "recommand");
3499}
3500
3501function fitThumb5(img, w, h)
3502{
3503    if (img.naturalWidth > 0 && img.naturalHeight > 0) {
3504    	var ratio = img.naturalHeight / img.naturalWidth;
3505	    if (ratio < h / w) img.width = w;
3506	    else img.height = h;
3507	}
3508}
3509
3510/************************************************************************************************
3511* 2022.06.16 :: 시리즈 구독서비스 :: 구독버튼 액션 클릭이벤트
3512*************************************************************************************************/
3513function FbtnSubscribe(val, csrs_cd, th)
3514{
3515    if (csrs_cd == null || csrs_cd == '') return;
3516    if(val == 'N' || val == null || val == '' || getCookie("MemCd") == "-1" || getCookie("MemCd") == "" || getCookie("MemCd") == null) { 
3517        goLoginPage();
3518        return;
3519    }
3520    
3521    //$('#dvLoadingLayer').show();
3522    
3523    var pStr = $.ajax({
3524        url: "/NWS_Web/Mapi/srs_choice_json.aspx",
3525        async: false,
3526        type: "POST",
3527        datatype: "json",
3528        data: ({ fgb: 'srs_add', srsCD: csrs_cd, gb: val })
3529    }).responseText;
3530    
3531    // GA Click Event
3532    var strCateNm = $(th).attr('data-cate');
3533    var strActionNm = strCateNm + $(th).attr('data-action');
3534    var strLabelNm = strActionNm + $(th).attr('data-label');
3535    GA_Event(strCateNm, strActionNm, strLabelNm);
3536        
3537    var obj = JSON.parse(pStr);
3538    
3539    if (obj.code == "200"){
3540    
3541            if(val == '1'){
3542                $('.srs_'+ csrs_cd).attr('onclick', "FbtnSubscribe('2', '" + csrs_cd + "', this);").addClass('on').html('구독중');
3543            }else{
3544                $('.srs_'+ csrs_cd).attr('onclick', "FbtnSubscribe('1', '" + csrs_cd + "', this);").removeClass('on').html('구독하기');
3545            }
3546            
3547            if (obj.result == "0") {
3548                // 구독수 0일때 숨김처리
3549                 if ($(th).attr('data-knd') == "li" || $(th).attr('data-knd') == "star") {
3550                    $('.cnt_'+ csrs_cd).remove();
3551                } else {
3552                    $('.cnt_'+ csrs_cd).html("");
3553                }  
3554                
3555            } else {
3556            
3557                if ($(th).attr('data-knd') == "box") {
3558                    // 구독수 카운팅이 box안에 있을때
3559                    $('.cnt_'+ csrs_cd).html("<span class=\"lis-bar\">ㅣ</span>구독 " + obj.result);
3560                    
3561                } else if ($(th).attr('data-knd') == "li") {                    
3562                    // 구독수 카운팅이 li tag 안에 있을때                    
3563                    if ($('.lybox ul').eq(1).find('li').eq(1).attr('class') == 'cnt_'+ csrs_cd){
3564                        $('.cnt_'+ csrs_cd).html('구독<em class=\"tt02\">'+ obj.result +'</em>');
3565                    } else {
3566                        $('.lybox ul').eq(1).find('li').eq(0).after('<li class=cnt_'+ csrs_cd +'>구독<em class=\"tt02\">'+ obj.result +'</em></li>');
3567                    }
3568                    
3569                } else if ($(th).attr('data-knd') == "star") {
3570                    // 오마이스타에서 구독수 카운팅 표시할때
3571                    if ($('.left-flo ul').eq(0).find('li').eq(2).attr('class') == 'cnt_'+ csrs_cd) {
3572                        $('.cnt_'+ csrs_cd).html('구독<em class=\"tt02\">'+ obj.result +'</em>');
3573                    } else {
3574                        $('.left-flo ul').eq(0).find('li').eq(1).after('<li class=cnt_'+ csrs_cd +'>구독<em class=\"tt02\">'+ obj.result +'</em></li>');
3575                    }
3576                    
3577                } else {
3578                    // 구독수 > 0 일때 default
3579                    $('.cnt_'+ csrs_cd).html("구독 " + obj.result);
3580                    //$('.cnt_'+ csrs_cd).html(obj.result);
3581                }
3582            }
3583
3584    } else {
3585    
3586        if (getCookie("MemCd") == "-1" || getCookie("MemCd") == "" || getCookie("MemCd") == null) {
3587            goLoginPage();
3588        } else {
3589            alert(obj.message);
3590            window.location.reload();
3591        }
3592        
3593    }
3594    
3595    //$('#dvLoadingLayer').hide();
3596}
3597
3598
3599/************************************************************************************************
3600* GTM & GA4 사용자속성
3601* 2023.05.08 userid Tracking
3602*************************************************************************************************/
3603// SHA256 js
3604function gtm_sha256_function(x){function d(c,b){var e=(c&65535)+(b&65535);c=(c>>16)+(b>>16)+(e>>16);return c<<16|e&65535}function g(c,b){return c>>>b|c<<32-b}function z(c,b){var e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,
3605    113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756
3605734187,3204031479,3329325298],a=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],m=Array(64),u,f;c[b>>5]|=128<<24-b%32;c[(b+64>>
3606    9<<4)+15]=b;for(u=0;u<c.length;u+=16){b=a[0];var p=a[1];var q=a[2];var y=a[3];var n=a[4];var v=a[5];var w=a[6];var k=a[7];for(f=0;64>f;f++){if(16>f)m[f]=c[f+u];else{var h=f;var l=m[f-2];l=g(l,17)^g(l,19)^l>>>10;l=d(l,m[f-7]);var r=m[f-15];r=g(r,7)^g(r,18)^r>>>3;m[h]=d(d(l,r),m[f-16])}h=n;h=g(h,6)^g(h,11)^g(h,25);h=d(d(d(d(k,h),n&v^~n&w),e[f]),m[f]);k=b;k=g(k,2)^g(k,13)^g(k,22);l=d(k,b&p^b&q^p&q);k=w;w=v;v=n;n=d(y,h);y=q;q=p;p=b;b=d(h,l)}a[0]=d(b,a[0]);a[1]=d(p,a[1]);a[2]=d(q,a[2]);a[3]=d(y,a[3]);
3607    a[4]=d(n,a[4]);a[5]=d(v,a[5]);a[6]=d(w,a[6]);a[7]=d(k,a[7])}return a}function A(c){for(var b=[],e=(1<<t)-1,a=0;a<c.length*t;a+=t)b[a>>5]|=(c.charCodeAt(a/t)&e)<<24-a%32;return b}function B(c){c=c.replace(/\r\n/g,"\n");for(var b="",e=0;e<c.length;e++){var a=c.charCodeAt(e);128>a?b+=String.fromCharCode(a):(127<a&&2048>a?b+=String.fromCharCode(a>>6|192):(b+=String.fromCharCode(a>>12|224),b+=String.fromCharCode(a>>6&63|128)),b+=String.fromCharCode(a&63|128))}return b}function C(c){for(var b=D?"0123456789ABCDEF":
3608    "0123456789abcdef",e="",a=0;a<4*c.length;a++)e+=b.charAt(c[a>>2]>>8*(3-a%4)+4&15)+b.charAt(c[a>>2]>>8*(3-a%4)&15);return e}var t=8,D=0;s=B(x);return C(z(A(x),x.length*t))};
3609
3610// GTM-UserID
3611var ga_memcd = (getCookie("MemCd") == "" || getCookie("MemCd") == "undefined" || getCookie("MemCd") == "-1") ? "" : getCookie("MemCd");
3612var ga_memType = (getCookie("MemTypReal") == "" || getCookie("MemTypReal") == "undefined" || getCookie("MemTypReal") == "-1") ? "" : getCookie("MemTypReal");
3613var ga_Tenman_YN = (getCookie("MEMTEN") == "" || getCookie("MEMTEN") == "undefined" || getCookie("MEMTEN") == "-1") ? "" : getCookie("MEMTEN");
3614if (ga_memcd != '') {
3615    window.dataLayer = window.dataLayer || [];
3616    dataLayer.push({
3617        'event': 'member_check',
3618        'user_id': gtm_sha256_function(ga_memcd),
3619        'user_mem_type': ga_memType,
3620        'user_mem_tenman': ga_Tenman_YN,
3621        'login_type': 'memcd'
3622    });
3623}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.