PageSourceSearch

https://ticket.melon.com/resource/script/web/common/melonweb_play.js?t=20260807150453

js melon.com collected 2026-10-01 10:26:18 UTC 201,958 bytes, 3,842 lines download raw bytes

1(function() {
2    var WEB_PLAYER_POPUP;
3    var WEB_PLAYER_CTRL;
4    var WEB_PLAYER_STATE = false;
5    var WEB_PLAYER_LIST = [];
6    var WEB_PLAYER_CNT = 0;
7    MELON.WEBSVC.POC = {
8        popupErrorMsg: "\n※ MSN,야후,구글 팝업 차단 툴바가 설치된 경우 팝업허용을 해주셔야만 팝업창이보입니다.\n※ 윈도우 XP SP2 사용자일 경우에는 브라우저 상단의 노란색[알림표시줄]에 있는 팝업 차단 알림줄을 클릭하여 팝업을 허용해 주시기 바랍니다.\n",
9        melonDomain: "melon.com",
10        httpMelonWww: DeployPhaseUtils.convertUrl("http://www.melon.com"),
11        httpMelonLive: DeployPhaseUtils.convertUrl("http://live.melon.com"),
12        httpMelonVod: DeployPhaseUtils.convertUrl("http://vod.melon.com"),
13        setPocId: function() {
14
15            var pocId = "";
16            // gaccount로 회원가입 변경에 따른 POCID 신규 정리 및 분기처리
17            // 계정쪽 로그인 및 회원가입시 변경된 POCID를 TKT_POC_ID에서 참고함 . 따라서 해당 멜론에서 가져온 pocId는 사용하지 못함
18            // try{
19	        //     if(pocId != "WP15" && pocId != "MP15" && pocId != "LP15" && pocId != "WT15" && pocId != "IT15" && pocId != "AT15") {
20	        //     	// 다른 멜론 사이트로부터 pocId 를 가져온 경우 티켓 pocId 로 재설정
21	        //     	pocId = "";
22	        //     }
23            // }
24            // catch(e) {pocId = "";}
25
26            if (pocId == "" || typeof pocId == "undefined") {
27            	$.ajaxSetup({
28                    async: false
29                });
30                $.getJSON("/common/ajax/useragent_info.json", function(data) {
31                    var pocId = data.pocId;
32                    //iPad의 iOS13부터 사파리로 멜론티켓 접속 시 User-Agent값에 "iPad"가 없고 "Macintosh"를 포함하고 있음.
33                    //POC ID 판별 로직(PocVO.java)에서 UA에 iPad가 없으므로 Mac PC로 오인하여 PocId를 "MP15"(Mac PC)로 설정하게 됨
34                    //서버에서 MP15가 내려왔더라도, 브라우저에서 실제 기기가 iPad인지 추가 판별하도록 처리함.
35                    //iOS 13+의 iPad는 데스크톱 모드에서 UA가 "Macintosh"로 보이지만, 터치가 가능하므로 navigator.maxTouchPoints가 1보다 크다.
36                    //따라서 pocId가 "MP15"이고, navigator.maxTouchPoints > 1 이면 iPad로 간주하여 pocId를 "IT15"로 재설정함.
37                    if(data.pocId == "MP15" && navigator.maxTouchPoints > 1){
38                        pocId = "IT15";
39                    }
40                    setCookie("TKT_POC_ID", pocId, 0, "/", MELON.WEBSVC.POC.melonDomain)
41                })
42                $.ajaxSetup({
43                    async: true
44                });
45            }
46        },
47        getPocId: function() {
48            var pocId = getCookie("TKT_POC_ID");
49            return pocId
50        },
51        isIPad : function(){
52            var isIPad = false;
53            if(navigator.platform == 'MacIntel' && navigator.maxTouchPoints > 1){
54                isIPad = true;
55            }
56            return isIPad;
57        },
58        isTablet: function() {
59            var userAgent = navigator.userAgent;
60            var isTablet = false;
61            if (userAgent.indexOf("Android") > 0 && userAgent.indexOf("Mobile") == -1) {
62                isTablet = true
63            } else {
64                if (userAgent.indexOf("iPad") > 0) {
65                    isTablet = true
66                }
67            }
68            return isTablet
69        },
70        tabletGuidePop: function() {
71            window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/error_page/error_tabletTypeB.html"), "tabletPopTypeB", "scrollbars=no, resizable=no, location=no, width=560, height=273")
72        },
73        play: {
74            playSong: function(menuId, songIds, itemFlag) {
75                if (songIds == null || songIds == "") {
76                    alert("대표곡 정보를 준비중입니다.");
77                    return
78                }
79                //ipad
80                if (MELON.WEBSVC.POC.getPocId() == "IT15") {
81                    var urlScheme = "melonipad://play?cid=" + songIds + "&ctype=song&menuId=" + menuId;
82                    MELON.WEBSVC.POC.link.ipadAppLaunch(urlScheme);
83                    return;
84                }
85                if (MELON.WEBSVC.POC.isTablet()) {
86                    MELON.WEBSVC.POC.tabletGuidePop();
87                    return;
88                }
89
90                var isMac = (navigator.userAgent.indexOf("Mac") > 0);
91                if (isMac) {
92                    MELON.WEBSVC.POC.play.macplay(menuId, songIds, itemFlag)
93                } else {
94                    if (typeof itemFlag == "undefined") {
95                        itemFlag = 1
96                    }
97                    var itemFlagArray = new Array();
98                    var itemIdArray = new Array();
99                    if (songIds instanceof Array) {
100                        var tempArray = songIds;
101                        for (var i = 0; i < tempArray.length; i++) {
102                            if (tempArray[i] != "") {
103                                itemFlagArray[i] = itemFlag;
104                                itemIdArray[i] = tempArray[i];
105                            }
106                        }
107                    } else {
108                        itemFlagArray[0] = itemFlag;
109                        itemIdArray[0] = songIds;
110                    }
111                    if (player.isWindowsLowerThan7()) {
112                        alert("PC를 더욱 안전하게 보호하기 위해서 OS 업데이트가 필요합니다.\n\nOS 업데이트 후 새로운 버전의 멜론플레이어를 설치하시면 더욱 다양한 멜론 서비스를 이용하실 수 있습니다.");
113                        return;
114                    } else {
115                        player.newPcpPlay(menuId, itemFlag, itemIdArray);
116                    }
117                }
118            },
119            playHighMv: function(menuId, mvId, itemFlag) {
120                if (mvId == null || mvId == "") {
121                    alert("occur error.");
122                    return
123                }
124                var isMac = (navigator.userAgent.indexOf("Mac") > 0);
125                if (isMac) {
126                    alert("맥에서는 고화질 플레이어 준비중~")
127                } else {
128                    if (typeof itemFlag == "undefined") {
129                        itemFlag = 21
130                    }
131                    if (isMelonLogin()) {
132                        var itemFlagArray = new Array();
133                        var itemIdArray = new Array();
134                        itemFlagArray[0] = itemFlag;
135                        itemIdArray[0] = mvId;
136                        player.ocxPlay(menuId, itemFlagArray, itemIdArray)
137                    } else {
138                        MELON.WEBSVC.POC.login.loginPopupLayerd("");
139                        return
140                    }
141                }
142            },
143            playFormSong: function(menuId, formId, checkBoxName) {
144                var songIds = new Array();
145                if (typeof checkBoxName == "undefined") {
146                    checkBoxName = "input_check";
147                }
148                $("#" + formId).find("input[name='" + checkBoxName + "']:checked").each(function() {
149                    if (!isNaN(this.value)) {
150                        songIds.push($(this).val());
151                    }
152                });
153
154                if (MELON.WEBSVC.POC.getPocId() == "IT15") {
155                    if (songIds.length == 0) {
156                        alert("곡을 선택해 주세요.");
157                        return;
158                    } else {
159                        var strSongId = songIds.join(",");
160                        MELON.WEBSVC.POC.play.playSong(menuId, strSongId);
161                        return;
162                    }
163                }
164
165                if (MELON.WEBSVC.POC.isTablet()) {
166                    MELON.WEBSVC.POC.tabletGuidePop();
167                    return;
168                }
169
170                if (songIds.length == 0) {
171                    alert("곡을 선택해 주세요.");
172                } else {
173                    MELON.WEBSVC.POC.play.playSong(menuId, songIds);
174                }
175            },
176            playAlbum: function(menuId, albumId) {
177                //ipad
178                if(MELON.WEBSVC.POC.getPocId() == 'IT15'){
179                    var urlScheme  = 'melonipad://play?cid='+albumId+'&ctype=alb&menuId='+menuId;
180
181                    MELON.WEBSVC.POC.link.ipadAppLaunch(urlScheme);
182                    return;
183                }
184
185                if (MELON.WEBSVC.POC.isTablet()) {
186                    MELON.WEBSVC.POC.tabletGuidePop();
187                    return
188                }
189                var isMac = (navigator.userAgent.indexOf("Mac") > 0);
190                if (isMac) {
191                    MELON.WEBSVC.POC.play.macplay(menuId,albumId,'2');
192                } else {
193                    itemFlagArray = new Array();
194                    itemIdArray = new Array();
195                    itemFlagArray[0] = 2;
196                    itemIdArray[0] = albumId;
197
198                    //windows7미만 분기처리
199                    if(player.isWindowsLowerThan7()){
200                        alert("PC를 더욱 안전하게 보호하기 위해서 OS 업데이트가 필요합니다.\n\n"
201                            + "OS 업데이트 후 새로운 버전의 멜론플레이어를 설치하시면 더욱 다양한 멜론 서비스를 이용하실 수 있습니다.");
202                        return;
203                    }else{
204                        player.newPcpPlay(menuId, '2', itemIdArray);
205                    }
206                }
207            },
208            playPlayList: function(menuId, plylstId, playListType, targetMemberKey) {
209                if (MELON.WEBSVC.POC.isTablet()) {
210                    MELON.WEBSVC.POC.tabletGuidePop();
211                    return
212                }
213                var isMac = (navigator.userAgent.indexOf("Mac") > 0);
214                if (typeof targetMemberKey == "undefined") {
215                    targetMemberKey = getMemberKey() == "" ? 0 : getMemberKey()
216                }
217                if (isMac) {
218                    //MELON.WEBSVC.POC.play.goWebplyerByPlayList(menuId, plylstId)
219                	alert("맥 OS는 지원하지 않습니다.");
220                } else {
221                    if (isMelonLogin()) {
222                        var itemFlag;
223                        switch (playListType) {
224                            case "dj":
225                                itemFlag = 6;
226                                break;
227                            case "server":
228                                itemFlag = 23;
229                                break;
230                            case "artist":
231                                itemFlag = 26;
232                                break;
233                            default:
234                                itemFlag = 6
235                        }
236                        itemFlagArray = new Array();
237                        itemIdArray = new Array();
238                        itemFlagArray[0] = itemFlag;
239                        itemIdArray[0] = plylstId;
240                        player.ocxPlay(menuId, itemFlagArray, itemIdArray, targetMemberKey)
241                    } else {
242                        //MELON.WEBSVC.POC.play.goWebplyerByPlayList(menuId, plylstId)
243                    	melon.login.loginPopup(1);
244                    }
245                }
246            },
247            playFormStudy: function(menuId, formId, checkBoxName) {
248                if (MELON.WEBSVC.POC.isTablet()) {
249                    MELON.WEBSVC.POC.tabletGuidePop();
250                    return
251                }
252                var songIds = new Array();
253                if (typeof checkBoxName == "undefined") {
254                    checkBoxName = "input_check"
255                }
256                $("#" + formId).find("input[name=" + checkBoxName + "]:checked").each(function() {
257                    if (!isNaN(this.value)) {
258                        songIds.push($(this).val())
259                    }
260                });
261                if (songIds.length == 0) {
262                    alert("강의를 선택해 주세요.")
263                } else {
264                    if (isMelonLogin()) {
265                        MELON.WEBSVC.POC.play.playSong(menuId, songIds, 4)
266                    } else {
267                        alert("어학 컨텐츠는 1분 미리듣기가 제공되지 않습니다.\n              로그인 후 이용해 주세요");
268                        return
269                    }
270                }
271            },
272            playStudy: function(menuId, songId) {
273                if (MELON.WEBSVC.POC.isTablet()) {
274                    MELON.WEBSVC.POC.tabletGuidePop();
275                    return
276                }
277                if (isMelonLogin()) {
278                    MELON.WEBSVC.POC.play.playSong(menuId, songId, 4)
279                } else {
280                    alert("어학 컨텐츠는 1분 미리듣기가 제공되지 않습니다.\n              로그인 후 이용해 주세요");
281                    return
282                }
283            },
284            playMv: function(menuId, mvId) {
285                alert("준비중 재생ID : " + mvId)
286            },
287            goWebplyer: function(menuId, songIds, contsType) {
288                try {
289                    //console.log(" >> " + WEB_PLAYER_STATE)
290                } catch (e) {}
291                if (WEB_PLAYER_STATE) {
292                    return
293                }
294                if (typeof contsType === "undefined" || contsType.length < 1 || contsType == null || contsType == 1) {
295                    contsType = "S"
296                }
297                if (contsType == 4) {
298                    contsType = "E"
299                }
300                MELON.WEBSVC.POC.play.webPlayerInit(menuId, songIds, contsType)
301            },
302            webPlayerInit: function(menuId, songIds, contsType) {
303                try {
304                    //console.log(" webPlayerInit In > ")
305                } catch (e) {}
306                WEB_PLAYER_LIST = [];
307                if (typeof songIds === "number" || typeof songIds === "string") {
308                    WEB_PLAYER_LIST[0] = [songIds, "|^", menuId, "|^", contsType].join("")
309                } else {
310                    $.each(songIds, function(i, v) {
311                        WEB_PLAYER_LIST[i] = [v, "|^", menuId, "|^", contsType].join("")
312                    })
313                }
314                var ua = navigator.userAgent;
315                if (_FLASH_INSTALLED == true || _FLASH_INSTALLED == "true") {
316                    WEB_PLAYER_CTRL = $("#mpCtrl")[0];
317                    if (!WEB_PLAYER_CTRL || WEB_PLAYER_CTRL.length == 0) {
318                        var ctrl;
319                        var isMSIE = false;
320                        var swfParam = "";
321                        if (ua.indexOf("rv:11.0") > -1 || ua.indexOf("MSIE") > -1) {
322                            isMSIE = true
323                        }
324                        if (isMSIE) {
325                            swfParam = "?init=MELON.WEBSVC.POC.play.webPlayerCtrlInit&browserName=" + getBrowserName();
326                            ctrl = ['<object id="mpCtrl" height="1" width="1" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  type="application/x-shockwave-flash">', '<param name="movie" value="' + DeployPhaseUtils.convertUrl('http://www.melon.com/resource/script/player/melonCtrl.swf') + swfParam + '">', '<param name="wmode" value="opaque"/>', '<param name="allowScriptAccess" value="always" />', '<param name="allowFullScreen" value="true" />', '<param name="allowNetworking" value="all" />', "</object>"].join("")
327                        } else {
328                            if (ua.indexOf("Firefox") > -1) {
329                                ctrl = ['<object id="mpCtrl" height="1" width="1" data="' + DeployPhaseUtils.convertUrl('http://www.melon.com/resource/script/player/melonCtrl.swf') + swfParam + '" type="application/x-shockwave-flash">', '<param name="wmode" value="window"/>', '<param name="allowScriptAccess" value="always" />', '<param name="allowFullScreen" value="true" />', '<param name="allowNetworking" value="all" />', "</object>"].join("")
330                            } else {
331                                ctrl = ['<object id="mpCtrl" height="1" width="1" type="application/x-shockwave-flash">', '<param name="movie" value="' + DeployPhaseUtils.convertUrl('http://www.melon.com/resource/script/player/melonCtrl.swf') + swfParam + '">', '<param name="wmode" value="window"/>', '<param name="allowScriptAccess" value="always" />', '<param name="allowFullScreen" value="true" />', '<param name="allowNetworking" value="all" />', "</object>"].join("")
332                            }
333                        }
334                        $("body").append("<div id='mpController' style='width:1px; height:1px;'></div>");
335                        $("#mpController").html(ctrl);
336                        if (!isMSIE) {
337                            var callback = {};
338                            callback.init = "MELON.WEBSVC.POC.play.webPlayerCtrlInit";
339                            callback.browserName = getBrowserName();
340                            setTimeout(MELON.WEBSVC.POC.play.webPlayerCtrlParam, 200, callback)
341                        }
342                    } else {
343                        MELON.WEBSVC.POC.play.webPlayerCtrlInit()
344                    }
345                } else {
346                    webPlayerFlashAlert();
347                    return
348                }
349            },
350            webPlayerCtrlParam: function(param) {
351                var player = document.getElementById("mpCtrl");
352                if (player && player.setParam) {
353                    WEB_PLAYER_CNT = 0;
354                    player.setParam(param)
355                } else {
356                    if (WEB_PLAYER_CNT > 5) {
357                        WEB_PLAYER_CNT = 0;
358                        alert("웹플레이어 구동 중 에러가 발생했습니다.");
359                        return
360                    } else {
361                        WEB_PLAYER_CNT++;
362                        setTimeout(MELON.WEBSVC.POC.play.webPlayerCtrlParam, 200, param)
363                    }
364                }
365            },
366            webPlayerCtrlInit: function() {
367                try {
368                    //console.log(" webPlayerCtrlInit In > ")
369                } catch (e) {}
370                try {
371                    WEB_PLAYER_CTRL = document.getElementById("mpCtrl");
372                    WEB_PLAYER_CTRL.setList({
373                        list: WEB_PLAYER_LIST
374                    });
375                    WEB_PLAYER_CTRL.playerCheck("MELON.WEBSVC.POC.play.webPlayerLoad")
376                } catch (e) {
377                    alert("웹플레이어 구동 중 에러가 발생했습니다.");
378                    return
379                }
380            },
381            webPlayerLoad: function(openFlag) {
382                try {
383                    //console.log(" webPlayerLoad In > " + openFlag)
384                } catch (e) {}
385                WEB_PLAYER_STATE = false;
386                if (!openFlag) {
387                    var url = DeployPhaseUtils.convertUrl("http://www.melon.com/webplayer/index.htm");
388                    var pW = 730;
389                    var pH = 525;
390                    var pL = parseInt((window.screen.width - pW) / 2);
391                    var pT = parseInt((window.screen.height - pH) / 2);
392                    var pProp = "width=" + pW + ",height=" + pH + ",scrollbars=yes,resizable=0,left=" + pL + ",top=" + pT + ",directories=no,status=no,menubar=no";
393                    var ua = navigator.userAgent;
394                    if (ua.indexOf("MSIE 6") > 0 || ua.indexOf("MSIE 7") > 0 || ua.indexOf("MSIE 8") > 0 || ua.indexOf("Edge") > 0) {
395                        WEB_PLAYER_POPUP = window.open("", "WEB_PLAYER_POPUP", pProp);
396                        var f = document.createElement("FORM");
397                        f.action = url;
398                        f.method = "get";
399                        f.target = "WEB_PLAYER_POPUP";
400                        document.body.appendChild(f);
401                        f.submit()
402                    } else {
403                        if (ua.indexOf("Safari") > 0 && ua.indexOf("Mac") > 0) {
404                            WEB_PLAYER_POPUP = window.open(url, "WEB_PLAYER_POPUP", pProp)
405                        } else {
406                            WEB_PLAYER_POPUP = window.open("", "WEB_PLAYER_POPUP", pProp);
407                            try {
408                                WEB_PLAYER_POPUP.location.href = url
409                            } catch (err) {}
410                        }
411                    }
412                    if (!WEB_PLAYER_POPUP) {
413                        alert("차단된 팝업창을 허용해 주세요.")
414                    }
415                }
416                if (window.focus) {
417                    setTimeout(function() {
418                        try {
419                            WEB_PLAYER_POPUP.focus()
420                        } catch (err) {}
421                    }, 1000)
422                }
423            },
424            goWebplyerByAlbum: function(menuId, albumId) {
425                MELON.WEBSVC.POC.play.goWebplyer(menuId, albumId, "A")
426            },
427            goWebplyerByPlayList: function(menuId, plylstId) {
428                MELON.WEBSVC.POC.play.goWebplyer(menuId, plylstId, "P")
429            },
430            playSmartRadio: function(menuId, playOpt) {
431                if (MELON.WEBSVC.POC.isTablet()) {
432                    MELON.WEBSVC.POC.tabletGuidePop();
433                    return
434                }
435                var isMac = (navigator.userAgent.indexOf("Mac") > 0);
436                if (isMac) {
437                    //MELON.WEBSVC.POC.play.goWeplyerSmartRadio(playOpt)
438                	alert("맥 OS는 지원하지 않습니다.");
439                } else {
440                    player.melonplayerPlay(menuId, "smart", "", playOpt)
441                }
442            },
443            goWeplyerSmartRadio: function(playOpt) {
444                if (playOpt != undefined && playOpt != null && playOpt != "") {
445                    var pW = 352;
446                    var pH = 525;
447                    var pL = parseInt((window.screen.width - pW) / 2);
448                    var pT = parseInt((window.screen.height - pH) / 2);
449                    var pProp = "width=" + pW + ",height=" + pH + ",left=" + pL + ",top=" + pT + ",directories=no,status=no,menubar=no";
450                    playOpt = playOpt.replace(/�/gi, "^");
451                    var ua = navigator.userAgent;
452                    if (ua.indexOf("MSIE 6") > 0 || ua.indexOf("MSIE 7") > 0 || ua.indexOf("MSIE 8") > 0) {
453                        WEB_PLAYER_POPUP = window.open("", "WEB_PLAYER_POPUP", pProp);
454                        var f = document.createElement("FORM");
455                        var url = DeployPhaseUtils.convertUrl("http://www.melon.com/webplayer/smartRadio.htm?playOpt=") + playOpt;
456                        f.action = url;
457                        f.method = "get";
458                        f.target = "WEB_PLAYER_POPUP";
459                        var indexQM = url.indexOf("?");
460                        if (indexQM >= 0) {
461                            var params = url.substring(indexQM + 1).split("&");
462                            for (var i = 0; i < params.length; i++) {
463                                var keyValuePair = params[i].split("=");
464                                var input = document.createElement("INPUT");
465                                input.type = "hidden";
466                                input.name = keyValuePair[0];
467                                input.value = keyValuePair[1];
468                                f.appendChild(input)
469                            }
470                        }
471                        document.body.appendChild(f);
472                        f.submit()
473                    } else {
474                        if (ua.indexOf("Safari") > 0 && ua.indexOf("Mac") > 0) {
475                            WEB_PLAYER_POPUP = window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/webplayer/smartRadio.htm?playOpt=") + playOpt, "WEB_PLAYER_POPUP", pProp)
476                        } else {
477                            WEB_PLAYER_POPUP = window.open("", "WEB_PLAYER_POPUP", pProp);
478                            WEB_PLAYER_POPUP.location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/webplayer/smartRadio.htm?playOpt=") + playOpt
479                        }
480                    }
481                    if (!WEB_PLAYER_POPUP) {
482                        alert("차단된 팝업창을 허용해 주세요.")
483                    } else {
484                        if (window.focus) {
485                            setTimeout(function() {
486                                try {
487                                    WEB_PLAYER_POPUP.focus()
488                                } catch (err) {}
489                            }, 1000)
490                        }
491                    }
492                } else {
493                    alert("곡을 선택해 주세요.")
494                }
495            },
496            addPlayList: function(songId) {
497                if (!MELON.WEBSVC.POC.login.isMelonLogin()) {
498                    MELON.WEBSVC.POC.login.loginPopupLayerd("");
499                    return
500                }
501                if (songId == "" || songId == undefined) {
502                    alert("곡을 선택해 주세요.");
503                    return
504                }
505                MELON.WEBSVC.openPopup("/mymusic/common/popup/mymusiccommon_addPlaylistPopUp.htm?songIds=" + songId, 560, 730, {
506                    target: "addPlayList",
507                    scrollbars: "no"
508                }, "center")
509            },
510            addFormPlayList: function(formId) {
511                if (!MELON.WEBSVC.POC.login.isMelonLogin()) {
512                    MELON.WEBSVC.POC.login.loginPopupLayerd("");
513                    return
514                }
515                var songList = new Array();
516                $("#" + formId).find(".input_check:checked").each(function() {
517                    if (!isNaN($(this).val())) {
518                        songList.push($(this).val())
519                    }
520                });
521                if (songList == "") {
522                    alert("곡을 선택해 주세요.");
523                    return
524                }
525                var songCnt = $("#" + formId).find("input:checkbox[name=input_check]:checked").length;
526                if (songCnt == 0) {
527                    alert("곡을 선택해 주세요.");
528                    return
529                }
530                if (songCnt > 500) {
531                    alert("최대 500곡까지 담을 수 있습니다.\n곡 수를 확인하시고 다시 선택해주세요.");
532                    return
533                }
534                var url = "/mymusic/common/popup/mymusiccommon_addPlaylistPopUp.htm";
535                var title = "addPlayList";
536                MELON.WEBSVC.openPopup("", 560, 730, {
537                    target: title,
538                    scrollbars: "no"
539                }, "center", title);
540                $("#" + formId).attr("target", title);
541                $("#" + formId).attr("action", url);
542                $("#" + formId).attr("method", "post");
543                $("#" + formId).submit()
544            },
545            ocxPlay: function(menuId, itemFlags, itemIds) {
546                player.ocxPlay(menuId, itemFlags, itemIds)
547            },
548            melonplayerActualPlay: function(params) {
549                player.melonplayerActualPlay(params)
550            },
551            melonplayerActualPlaySocket: function(menuId, itemFlags, itemList) {
552                player.melonplayerActualPlaySocket(menuId, itemFlags, itemList)
553            },
554            melon_ocx_message: function(PLAYER_RETURN) {
555                return player.melon_ocx_message(PLAYER_RETURN)
556            },
557            getMelonPlayerObject: function() {
558                return melonPlayerFunc.getMelonPlayerObject()
559            },
560            browser: function() {
561                return melonPlayerFunc.browser()
562            },
563            chkMelonPlayerObject: function() {
564                return melonPlayerFunc.chkMelonPlayerObject()
565            },
566            melonplayerPlay: function(menuId, itemFlags, itemIds, playList) {
567                player.melonplayerPlay(menuId, itemFlags, itemIds, playList)
568            },
569            macplay: function(menuId, songIds, itemFlag) {
570                macNotice.open();
571                var kakaoPlay = "";
572                var kakaoRef = "";
573                if (document.getElementById("ref") != null) {
574                    kakaoRef = document.getElementById("ref").value;
575                }
576                if (typeof itemFlag == "undefined") {
577                    itemFlag = 1;
578                }
579                var isMemberAdult = "0";
580                var p_realNameYN = "N";
581                var memberAge = 0;
582                var memberInfo = getMemberInfo();
583                if (memberInfo != null) {
584                    memberAge = memberInfo.MEMBERAGE;
585                    p_realNameYN = memberInfo.REALNAMEYN;
586                }
587                if (memberAge < 19) {
588                    isMemberAdult = "0";
589                } else {
590                    if (memberAge >= 19 && p_realNameYN == "Y") {
591                        isMemberAdult = "1";
592                    } else {
593                        if (memberAge >= 19 && p_realNameYN == "N") {
594                            isMemberAdult = "2";
595                        }
596                    }
597                }
598                var memberAuthInfo = getMemberAuthInfo();
599                var memberAuthFlg = "0";
600                if (memberAuthInfo != null) {
601                    memberAuthFlg = memberAuthInfo.ADULTAUTHFLG;
602                }
603                var IS_INPUT_AUTHENTICATION_ADULT_PWD = getCookie("IS_INPUT_AUTHENTICATION_ADULT_PWD");
604
605                var p_sessionAuthYN = IS_INPUT_AUTHENTICATION_ADULT_PWD == "Y" ? "1" : "0";
606                var p_adultYN = isMemberAdult == "0" ? "0" : "1";
607                var p_adultOptAutoYN = memberAuthFlg;
608                var p_adultOptAutoYN2 = "0";
609                p_adultOptAutoYN2 = p_adultOptAutoYN == "3" ? "2" : p_adultOptAutoYN == "2" ? "1" : p_adultOptAutoYN == "5" ? "1" : "0";
610                var isHiFiMenu = false;
611                try {
612                    if (typeof menuId != "undefined") {
613                        if (menuId.length > 2) {
614                            if ("89" == menuId.substr(0, 2) || "27220201" == menuId || "27220101" == menuId) {
615                                isHiFiMenu = 1;
616                            }
617                        }
618                    }
619                } catch (e) {}
620                if ($("#notifyFrame2").length < 1) {
621                    var notifyFrame2 = '<iframe id="notifyFrame2" name="notifyFrame2" width=0 height=0 src="" style="display:none;"></iframe>';
622                    $(notifyFrame2).appendTo("body");
623                }
624                if ($("#notifyFrame3").length < 1) {
625                    var notifyFrame3 = '<iframe id="notifyFrame3" name="notifyFrame3" width=0 height=0 src="" style="display:none;"></iframe>';
626                    $(notifyFrame3).appendTo("body");
627                }
628                if (kakaoRef != null && kakaoRef != "") {
629                    var api = new MPAPI({
630                        target: $("#notifyFrame2"),
631                        ref: kakaoRef
632                    });
633                } else {
634                    var api = new MPAPI({
635                        target: $("#notifyFrame2")
636                    });
637                }
638                var checkos = true;
639                var uav = api.macOSVersion();
640                var exUA = ["10.9.5", "10.9.4", "10.9.3", "10.9.2", "10.9.1", "10.9", "10.8.5", "10.8.4", "10.8.3", "10.8.2", "10.8.1", "10.8"];
641                $.each(exUA, function(i, v) {
642                    if (uav.indexOf(v) > -1) {
643                        checkos = false;
644                        return;
645                    }
646                });
647                if (!checkos) {
648                    alert("Mac OS에서는 멜론 Mac PC 플레이어를 이용하여 음악을 감상하실 수 있습니다.\n멜론 Mac PC플레이어는 OS 버전 10.10부터 설치 가능합니다.\n사용 중인 OS 버전을 확인해주세요.");
649                    return;
650                }
651                var MAC = chkMACAuth();
652                var list = [];
653                if (songIds instanceof Array) {
654                    var tempArray = songIds;
655                    var itemFlagArray = itemFlag;
656                    for (var i = 0; i < tempArray.length; i++) {
657                        if (tempArray[i] != "") {
658                            list.push({
659                                ITEMFLAG: itemFlagArray,
660                                ITEMID: tempArray[i],
661                                STATISTICID: menuId
662                            });
663                        }
664                    }
665                } else {
666                    var itemFlagArray = itemFlag;
667                    list.push({
668                        ITEMFLAG: itemFlagArray,
669                        ITEMID: songIds,
670                        STATISTICID: menuId
671                    });
672                }
673                var schme = "melonplayer://play?ref=" + kakaoRef + "&menuid=" + menuId + "&cid=" + songIds + "&cflag=" + itemFlag + "&isHifiMenu=" + isHiFiMenu + "&loginTime=&userId=" + encodeURIComponent(getMemberId()) + "&memberKey=" + encodeURIComponent(getMemberKey()) + "&token=" + encodeURIComponent(getMemberToken()) + "&mac=" + encodeURIComponent(getMACHeaderCookie());
674                $("#notifyFrame3").prop("src", schme);
675            }
676        },
677        link: {
678            goSongDetail: function(songId) {
679                if (typeof songId == "undefined") {
680                    return
681                }
682                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/song/detail.htm?songId=") + songId
683            },
684            goAlbumDetail: function(albumId) {
685                if (typeof albumId == "undefined") {
686                    return
687                }
688                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/album/detail.htm?albumId=") + albumId
689            },
690            goMvDetail: function(menuId, mvId, contentsType, mvTypeCode) {
691                if (typeof mvId == "undefined") {
692                    return
693                }
694                var action = MELON.WEBSVC.POC.httpMelonVod;
695                if (typeof mvTypeCode != "undefined" && mvTypeCode == "MV0007") {
696                    action = MELON.WEBSVC.POC.httpMelonLive
697                }
698                var $form = $("<form></form>");
699                var $menId = $('<input type="hidden" name="menuId" value="' + menuId + '"/>');
700                if (contentsType == "song") {
701                    action += "/video/detail.htm?songId=" + mvId
702                } else {
703                    action += "/video/detail.htm?mvId=" + mvId
704                }
705                action += "&menuId=" + menuId;
706                location.href = action
707            },
708            goArtistDetail: function(artistId, tabIndex) {
709                if (typeof artistId == "undefined") {
710                    return
711                }
712                switch (tabIndex != null ? tabIndex.toString() : null) {
713                    case "1":
714                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/timeline.htm?artistId=") + artistId;
715                        break;
716                    case "2":
717                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/detail.htm?artistId=") + artistId;
718                        break;
719                    case "3":
720                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/song.htm?artistId=") + artistId;
721                        break;
722                    case "4":
723                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/album.htm?artistId=") + artistId;
724                        break;
725                    case "5":
726                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/video.htm?artistId=") + artistId;
727                        break;
728                    case "6":
729                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/photo.htm?artistId=") + artistId;
730                        break;
731                    case "7":
732                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/recmlist.htm?artistId=") + artistId;
733                        break;
734                    case "8":
735                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/concert.htm?artistId=") + artistId;
736                        break;
737                    case "9":
738                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/product.htm?artistId=") + artistId;
739                        break;
740                    case "10":
741                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/fan.htm?artistId=") + artistId;
742                        break;
743                    case "11":
744                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/review.htm?artistId=") + artistId;
745                        break;
746                    case "12":
747                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/shop.htm?artistId=") + artistId;
748                        break;
749                    default:
750                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/timeline.htm?artistId=") + artistId;
751                        break
752                }
753            },
754            goProgramDetail: function(menuSeq, progSeq) {
755                if (typeof menuSeq == "undefined" || typeof progSeq == "undefined") {
756                    return
757                }
758                if (menuSeq == "2") {
759                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/tv/mv/index.htm")
760                } else {
761                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/tv/menu/index.htm?menuSeq=") + menuSeq + "&progSeq=" + progSeq
762                }
763            },
764            goThemaDetail: function(themaId) {
765                if (typeof themaId == "undefined") {
766                    return
767                }
768                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/tv/thema/inform.htm?progSeq=") + themaId
769            },
770            goMyMusic: function(memberKey) {
771                if (typeof memberKey == "undefined" || memberKey < 1) {
772                    alert("정상적인 접근이 아닙니다.");
773                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com");
774                    return
775                }
776                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/main/mymusicmainother_list.htm?memberKey=") + memberKey
777            },
778            goPerfDetail: function(artistId, perfId) {
779                if (typeof artistId == "undefined" || typeof perfId == "undefined") {
780                    return
781                }
782                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/concertDetail.htm?artistId=") + artistId + "&perfId=" + perfId
783            },
784            goMessage: function() {
785                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/messagepresent/mymusicmessage_list.htm")
786            },
787            goReturnMessage: function(memberkey, menuId) {
788                if (typeof memberkey == "undefined" || memberkey < 1) {
789                    alert("정상적인 접근이 아닙니다.");
790                    window.location = DeployPhaseUtils.convertUrl("http://www.melon.com");
791                    return
792                }
793                if (!MELON.WEBSVC.POC.login.isMelonLogin()) {
794                    MELON.WEBSVC.POC.login.loginPopupLayerd("");
795                    return
796                }
797                var ua = navigator.userAgent.toLocaleLowerCase();
798                $.get(DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/friend/mymusicfriend_listFriendMemberStatus.json"), {
799                    memberkey: memberkey
800                }, function(data) {}).done(function(data) {
801                    if (data.MEMBERSTATUS != "0") {
802                        alert("탈퇴한 회원입니다.");
803                        return
804                    } else {
805                        params = {
806                            targetMemK: memberkey,
807                            targetMemN: data.MEMBERNICKNAME,
808                            reMessage: "Y",
809                            menuId: menuId
810                        };
811                        method = "POST";
812                        var form = document.createElement("form");
813                        form.setAttribute("method", method);
814                        form.setAttribute("action", DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/messagepresent/popup/mymusicmessage_insertForm.htm"));
815                        for (var key in params) {
816                            var hiddenField = document.createElement("input");
817                            hiddenField.setAttribute("type", "hidden");
818                            hiddenField.setAttribute("name", key);
819                            hiddenField.setAttribute("value", params[key]);
820                            form.appendChild(hiddenField)
821                        }
822                        document.body.appendChild(form);
823                        if (ua.indexOf("safari") > -1 || ua.indexOf("IS40") > -1) {
824                            MELON.WEBSVC.openPopup("", 730, 750, {
825                                target: "pop",
826                                scrollbars: "no"
827                            }, "center", "pop")
828                        } else {
829                            MELON.WEBSVC.openPopup("", 730, 738, {
830                                target: "pop",
831                                scrollbars: "no"
832                            }, "center", "pop")
833                        }
834                        form.setAttribute("target", "pop");
835                        form.submit()
836                    }
837                })
838            },
839            goPresentSong: function() {
840                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/messagepresent/mymusicpresent_list.htm")
841            },
842            goTotalSearch: function(query, contType, formId, section, ipath) {
843                if (typeof query == "undefined") {
844                    return
845                }
846                if (typeof contType == "undefined" || contType == "") {
847                    contType = "total"
848                }
849                if (typeof section == "undefined") {
850                    section = ""
851                }
852                if (typeof ipath == "undefined" || ipath == "") {
853                    ipath = "srch_form"
854                }
855                var fromMPS = getCookie("MPS");
856                var fromMPSYn = fromMPS == null || fromMPS.indexOf("MELONPLAYER") < 0;
857                if (!fromMPSYn) {
858                    ipath = "srch_app"
859                }
860                var formObj = $("#" + formId);
861                var $ipath = $('<input type="hidden" name="ipath" value="' + ipath + '"/>');
862                var rUrl = "";
863                rUrl = DeployPhaseUtils.convertUrl("http://www.melon.com/search/") + contType + "/index.htm";
864                formObj.action = rUrl;
865                formObj.attr("action", rUrl);
866                formObj.attr("method", "get");
867                formObj.find("[name=q]").val(query);
868                formObj.find("[name=section]").val(section);
869                $ipath.appendTo(formObj);
870                formObj.submit()
871            },
872            goJoin: function() {
873                location.href = DeployPhaseUtils.convertUrl("https://member.melon.com/muid/family/ticket/join/web/stipulationagreement_inform.htm?cpId=") + melon.getPocId()
874            },
875            goIdSearch: function() {
876                location.href = DeployPhaseUtils.convertUrl("https://www.melon.com/muid/web/search/idsearch_inform.htm")
877            },
878            goTerms: function(termsType, targetType) {
879                var termsUrl = "";
880                switch (termsType) {
881                    case "use":
882                        termsUrl = DeployPhaseUtils.convertUrl("http://info.melon.com/terms/web/terms1_1.html");
883                        break;
884                    case "player":
885                        termsUrl = DeployPhaseUtils.convertUrl("http://info.melon.com/terms/web/terms2.html");
886                        break;
887                    case "privateinfo":
888                        termsUrl = DeployPhaseUtils.convertUrl("http://info.melon.com/terms/web/terms3.html");
889                        break;
890                    case "youth":
891                        termsUrl = DeployPhaseUtils.convertUrl("http://info.melon.com/terms/web/terms5_1.html");
892                        break;
893                    default:
894                        termsUrl = DeployPhaseUtils.convertUrl("http://info.melon.com/terms/web/terms1_4.html")
895                }
896                if (typeof targetType == "undefined") {
897                    location.href = termsUrl
898                } else {
899                    window.open(termsUrl, termsType)
900                }
901            },
902            goDjPlaylistDetail: function(memberStatus, adminOpenYn, delYn, plylstSeq) {
903                if (adminOpenYn == "N") {
904                    alert("비공개된 컨텐츠 입니다.");
905                    return
906                }
907                if (delYn == "Y") {
908                    alert("삭제된 컨텐츠 입니다.");
909                    return
910                }
911                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/dj/mymusicdjplaylistview_inform.htm?plylstSeq=") + plylstSeq
912            },
913            goDjCollectionWithoutStatus: function(plylstSeq) {
914                if (typeof plylstSeq == "undefined") {
915                    return
916                }
917                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/dj/mymusicdjplaylistview_inform.htm?plylstSeq=") + plylstSeq
918            },
919            goPlaylistWithoutStatus: function(plylstSeq) {
920                if (typeof plylstSeq == "undefined") {
921                    return
922                }
923                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/playlist/mymusicplaylistview_inform.htm?plylstSeq=") + plylstSeq
924            },
925            goArtistPlaylistDetail: function(plylstSeq) {
926                if (typeof plylstSeq == "undefined") {
927                    return
928                }
929                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/playlistDetail.htm?plylstSeq=") + plylstSeq
930            },
931            goMstoryCategory: function(mstoryCateSeq) {
932                if (typeof mstoryCateSeq == "undefined") {
933                    return
934                }
935                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/musicstory/index.htm?mstoryCateSeq=") + mstoryCateSeq
936            },
937            goStoreMelonDetail: function(contsType, prodSeq) {
938                if (typeof contsType == "undefined" || typeof prodSeq == "undefined") {
939                    return
940                }
941                window.open(DeployPhaseUtils.convertUrl("http://store.melon.com/api/gate.htm?type=") + contsType + "&param=" + prodSeq + "&pocId=" + MELON.WEBSVC.POC.getPocId(), contsType)
942            },
943            goPopupWithPageUrl: function(pgeUrl, pgeName) {
944                if (typeof pgeUrl == "undefined" || typeof pgeName == "undefined") {
945                    return
946                }
947                window.open(pgeUrl, pgeName)
948            },
949            goContentsDetail: function(contsType, contsId, menuId) {
950                switch (contsType) {
951                    case "N10001":
952                        MELON.WEBSVC.POC.link.goSongDetail(contsId);
953                        break;
954                    case "N10002":
955                        MELON.WEBSVC.POC.link.goAlbumDetail(contsId);
956                        break;
957                    case "N10003":
958                        MELON.WEBSVC.POC.link.goMvDetail(menuId, contsId);
959                        break;
960                    case "N10004":
961                        MELON.WEBSVC.POC.link.goArtistDetail(contsId);
962                        break;
963                    case "N10005":
964                        MELON.WEBSVC.POC.link.goPlaylistWithoutStatus(contsId);
965                        break;
966                    case "N10006":
967                        MELON.WEBSVC.POC.link.goArtistDetail(contsId);
968                        break;
969                    case "N10007":
970                        MELON.WEBSVC.POC.link.goMstoryDetail(contsId);
971                        break;
972                    case "N10009":
973                        MELON.WEBSVC.POC.link.goDjCollectionWithoutStatus(contsId);
974                        break;
975                    case "N10010":
976                        MELON.WEBSVC.POC.link.goDjCollectionWithoutStatus(contsId);
977                        break;
978                    case "N10016":
979                        MELON.WEBSVC.POC.link.goArtistPlaylistDetail(contsId);
980                        break;
981                    case "DJMGZ":
982                        location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/dj/magazine/djmagazinedetail_listEpsd.htm?magaznSeq=") + contsId;
983                        break;
984                    case "MSTRY":
985                        MELON.WEBSVC.POC.link.goMstoryCategory(contsId);
986                        break;
987                    case "STRPD":
988                        MELON.WEBSVC.POC.link.goStoreMelonDetail("product", contsId);
989                        break;
990                    case "STRAT":
991                        MELON.WEBSVC.POC.link.goStoreMelonDetail("artist", contsId);
992                        break;
993                    default:
994                        MELON.WEBSVC.POC.link.goAlbumDetail(contsId)
995                }
996            },
997            goClassicPeriodArtist: function(classicMenuId, periodCode) {
998                if (typeof classicMenuId == "undefined") {
999                    return
1000                }
1001                if (typeof periodCode == "undefined") {
1002                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/classicPeriodArtist_list.htm?classicMenuId=") + classicMenuId
1003                } else {
1004                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/classicPeriodArtist_list.htm?classicMenuId=") + classicMenuId + "&periodCode=" + periodCode
1005                }
1006            },
1007            goClassicArtist: function(classicMenuId) {
1008                if (typeof classicMenuId == "undefined") {
1009                    return
1010                }
1011                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/classicArtist_list.htm?classicMenuId=") + classicMenuId
1012            },
1013            goClassicArtistAlbum: function(artistId, periodCode) {
1014                if (typeof artistId == "undefined") {
1015                    return
1016                }
1017                if (typeof periodCode == "undefined") {
1018                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/classicArtistAlbum_list.htm?artistId=") + artistId
1019                } else {
1020                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/classicArtistAlbum_list.htm?artistId=") + artistId + "&periodCode=" + periodCode
1021                }
1022            },
1023            goClassicAlbumChart: function(classicMenuId) {
1024                if (typeof classicMenuId == "undefined") {
1025                    return
1026                }
1027                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/classicAlbumChart_list.htm?classicMenuId=") + classicMenuId
1028            },
1029            goClassicMasterpiece: function(classicMenuId) {
1030                if (typeof classicMenuId == "undefined") {
1031                    return
1032                }
1033                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/classicMasterpiece_list.htm?classicMenuId=") + classicMenuId
1034            },
1035            goGenreAlbum: function(classicMenuId, subMenuId) {
1036                if (typeof classicMenuId == "undefined") {
1037                    return
1038                }
1039                if (typeof subMenuId == "undefined") {
1040                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/album_list.htm?classicMenuId=") + classicMenuId
1041                } else {
1042                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/album_list.htm?classicMenuId=") + classicMenuId + "&subMenuId=" + subMenuId
1043                }
1044            },
1045            goGenreSong: function(classicMenuId, subMenuId) {
1046                if (typeof classicMenuId == "undefined") {
1047                    return
1048                }
1049                if (typeof subMenuId == "undefined") {
1050                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/song_list.htm?classicMenuId=") + classicMenuId
1051                } else {
1052                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/song_list.htm?classicMenuId=") + classicMenuId + "&subMenuId=" + subMenuId
1053                }
1054            },
1055            goGenreSongChart: function(classicMenuId) {
1056                if (typeof classicMenuId == "undefined") {
1057                    return
1058                }
1059                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/songChart_list.htm?classicMenuId=") + classicMenuId
1060            },
1061            goGenreThemaChild: function(classCd, genreCd) {
1062                if (typeof classCd == "undefined") {
1063                    return
1064                }
1065                if (typeof genreCd == "undefined") {
1066                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/song_list.htm?classCd=") + classCd
1067                } else {
1068                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/genre/song_list.htm?classCd=") + classCd + "&genreCd=" + genreC
1068d
1069                }
1070            },
1071            goMyCupon: function() {
1072                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/commerce/mypage/coupon/web/couponbox_couponBoxView.htm")
1073            },
1074            goMelonCash: function() {
1075                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/commerce/mypage/cash/web/meloncash_listChargedSpentView.htm")
1076            },
1077            goAnswer: function(faqId) {
1078                if (typeof faqId == "undefined") {
1079                    return
1080                }
1081                location.href = DeployPhaseUtils.convertUrl("http://faqs2.melon.com/customer/faq/informFaq.htm?faqId=") + faqId
1082            },
1083            goMultiMessagePop: function(contsType, contsId, menuId) {
1084                var h = 0;
1085                if (contsType == "song") {
1086                    h = 456
1087                } else {
1088                    if (contsType == "album") {
1089                        h = 456
1090                    } else {
1091                        if (contsType == "artist") {
1092                            h = 456
1093                        } else {
1094                            if (contsType == "mv") {
1095                                h = 460
1096                            } else {
1097                                if (contsType == "plylst") {
1098                                    h = 466
1099                                } else {
1100                                    if (contsType == "djcol") {
1101                                        h = 466
1102                                    } else {
1103                                        if (contsType == "artistplylst") {
1104                                            h = 466
1105                                        } else {
1106                                            if (contsType == "photo") {
1107                                                h = 546
1108                                            }
1109                                        }
1110                                    }
1111                                }
1112                            }
1113                        }
1114                    }
1115                }
1116                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1117                    MELON.WEBSVC.openPopup(DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/messagepresent/popup/mymusicmessage_insertMultiForm.htm?contsType=") + contsType + "&menuId=" + menuId + "&contsId=" + contsId, 730, h, {
1118                        scrollbars: "no"
1119                    }, "center", "multipop")
1120                } else {
1121                    MELON.WEBSVC.POC.login.loginPopupLayerd("");
1122                    return
1123                }
1124            },
1125            goAztalk: function() {
1126                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artistplus/aztalk/index.htm")
1127            },
1128            goMultiMessageNew: function(contsType, contsId, mvTypeCode) {
1129                if (typeof contsId == "undefined") {
1130                    return
1131                }
1132                var action = MELON.WEBSVC.POC.httpMelonVod;
1133                if (typeof mvTypeCode != "undefined" && mvTypeCode == "MV0007") {
1134                    action = MELON.WEBSVC.POC.httpMelonLive
1135                }
1136                switch (contsType) {
1137                    case "song":
1138                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/song/detail.htm?songId=") + contsId);
1139                        break;
1140                    case "album":
1141                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/album/detail.htm?albumId=") + contsId);
1142                        break;
1143                    case "artist":
1144                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/artist/timeline.htm?artistId=") + contsId);
1145                        break;
1146                    case "mv":
1147                        window.open(action + "/video/detail.htm?mvId=" + contsId);
1148                        break;
1149                    case "artistplylst":
1150                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/artist/playlistDetail.htm?plylstSeq=") + contsId);
1151                        break;
1152                    case "photo":
1153                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/artist/photo.htm?artistId=") + contsId);
1154                        break;
1155                    default:
1156                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/song/detail.htm?songId=") + contsId);
1157                        break
1158                }
1159            },
1160            goComingsoon: function() {
1161                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/new/comingsoon/index.htm")
1162            },
1163            goSearchLog: function(w, coll, cpath, srch_wd, doc_id, formId) {
1164                var param;
1165                var docIds = new Array();
1166                $("#" + formId).find("input[name='input_check']:checked").each(function() {
1167                    if (!isNaN(this.value)) {
1168                        docIds.push($(this).val())
1169                    }
1170                });
1171                if (doc_id == "") {
1172                    doc_id = docIds
1173                }
1174                param = "c_w=" + w;
1175                param += "&c_coll=" + coll;
1176                param += "&c_cpath=" + cpath;
1177                param += "&c_srchwd=" + encodeURIComponent(encodeURIComponent(srch_wd));
1178                param += "&c_docid=" + doc_id;
1179                var url = DeployPhaseUtils.convertUrl("http://www.melon.com/searchlog/writer.json?") + param;
1180                $.ajax({
1181                    url: url,
1182                    jsonpCallback: "callBackResponse",
1183                    dataType: "jsonp",
1184                    type: "POST",
1185                    contentType: "application/json; charset=UTF-8",
1186                    scriptCharset: "UTF-8",
1187                    cache: false,
1188                    jsonp: "jscallback"
1189                })
1190            },
1191            goDjtoday: function() {
1192                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/dj/today/djtoday_list.htm")
1193            },
1194            goMyMusicManySong: function(yyyyMM) {
1195                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/top/mymusictopmanysong_list.htm?memberKey=") + getMemberKey() + "&searchDate=" + yyyyMM
1196            },
1197            goPhotoDetail: function(artistId, photoId) {
1198                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/photo.htm?artistId=") + artistId + "&photoId=" + photoId
1199            },
1200            goPhotoBtmDetail: function(artistId, photoId, orderBy) {
1201                if (typeof orderBy == "undefined") {
1202                    orderBy = ""
1203                }
1204                location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/artist/photo_detail.htm?artistId=") + artistId + "&photoId=" + photoId + "&orderBy=" + orderBy
1205            },
1206            goMstoryDetail: function(mstorySeq, cateObj, startIndex, musicToday) {
1207                if (typeof mstorySeq == "undefined") {
1208                    return
1209                }
1210                var redUrl = MELON.WEBSVC.POC.httpMelonWww + "/musicstory/inform.htm?mstorySeq=" + mstorySeq;
1211                if (typeof startIndex != "undefined") {
1212                    redUrl += "&startIndex=" + startIndex
1213                }
1214                if (typeof musicToday != "undefined") {
1215                    redUrl += "&musicToday=" + musicToday
1216                }
1217                if (typeof cateObj == "undefined") {
1218                    redUrl += "&expose=true"
1219                } else {
1220                    if (!$(cateObj).hasClass("on")) {
1221                        redUrl += "&expose=false"
1222                    }
1223                }
1224                location.href = redUrl
1225            },
1226            goMstoryCateDetail: function(mstoryCateSeq, cateObj, startIndex) {
1227                if (typeof mstoryCateSeq == "undefined") {
1228                    return
1229                }
1230                var redUrl = MELON.WEBSVC.POC.httpMelonWww + "/musicstory/index.htm?mstoryCateSeq=" + mstoryCateSeq;
1231                if (typeof startIndex != "undefined") {
1232                    redUrl += "&pageIndex=" + startIndex
1233                }
1234                if (typeof cateObj == "undefined") {
1235                    redUrl += "&expose=true"
1236                } else {
1237                    if (!$(cateObj).hasClass("on")) {
1238                        redUrl += "&expose=false"
1239                    }
1240                }
1241                location.href = redUrl
1242            },
1243            goEntNewsDetail: function(entnewsSeq, cateObj, startIndex, searchWord) {
1244                if (typeof entnewsSeq == "undefined") {
1245                    return
1246                }
1247                var redUrl = MELON.WEBSVC.POC.httpMelonWww + "/musicstory/entnews/inform.htm?entnewsSeq=" + entnewsSeq;
1248                if (typeof startIndex != "undefined") {
1249                    redUrl += "&startIndex=" + startIndex
1250                }
1251                if (typeof searchWord != "undefined") {
1252                    redUrl += "&searchWord=" + searchWord
1253                }
1254                if (typeof cateObj == "undefined") {
1255                    redUrl += "&expose=true"
1256                } else {
1257                    if (!$(cateObj).hasClass("on")) {
1258                        redUrl += "&expose=false"
1259                    }
1260                }
1261                location.href = redUrl
1262            },
1263            goEntNewsList: function(cateObj, startIndex, searchWord) {
1264                var redUrl = MELON.WEBSVC.POC.httpMelonWww + "/musicstory/entnews/index.htm";
1265                if (typeof startIndex != "undefined") {
1266                    redUrl += "?pageIndex=" + startIndex
1267                } else {
1268                    redUrl += "?pageIndex=1"
1269                }
1270                if (typeof searchWord != "undefined") {
1271                    redUrl += "&searchWord=" + searchWord
1272                }
1273                if (typeof cateObj == "undefined") {
1274                    redUrl += "&expose=true"
1275                } else {
1276                    if (!$(cateObj).hasClass("on")) {
1277                        redUrl += "&expose=false"
1278                    }
1279                }
1280                location.href = redUrl
1281            },
1282            goArtistShop: function(artistId, menuId) {
1283                if (typeof artistId == "undefined") {
1284                    return
1285                }
1286                var redUrl = DeployPhaseUtils.convertUrl("http://store.melon.com/api/gate.htm?type=artist&param=") + artistId + "&pocId=" + MELON.WEBSVC.POC.getPocId() + "&menuId=" + menuId;
1287                window.open(redUrl, "_blank")
1288            },
1289            goMelonShopDetail: function(redUrl, minorBuyPosblYn) {
1290                if (typeof redUrl == "undefined") {
1291                    return
1292                }
1293                if (typeof minorBuyPosblYn == "undefined") {
1294                    minorBuyPosblYn = "Y"
1295                }
1296                if (minorBuyPosblYn == "N") {
1297                    if (!isMelonLogin()) {
1298                        alert("이 정보내용은 청소년유해매체물로서 「정보통신망 이용촉진 및 정보보호 등에 관한 법률」 및 「청소년 보호법」 에 따라 19세 미만의 청소년이 이용할 수 없습니다.\n확인을 위해 먼저 로그인 하세요.");
1299                        MELON.WEBSVC.POC.login.loginPopupLayerd("")
1300                    } else {
1301                        var memberAuthFlg = getMemberAuthFlg();
1302                        switch (memberAuthFlg) {
1303                            case "1":
1304                                window.open(redUrl, "_blank");
1305                                break;
1306                            case "0":
1307                            case "2":
1308                                if (!confirm("이 정보내용은 청소년 유해매체물로서 「정보통신이용촉진 및 정보보호 등에 관한 법률」 및 「청소년 보호법」에  따라 19세 미만의 청소년이 이용할 수 없습니다.\n성인인증 후 이용해주세요.")) {
1309                                    return
1310                                }
1311                                niceAuthPop("nineteen", "Y", "", "", true, "01");
1312                                break;
1313                            case "3":
1314                            case "4":
1315                                alert("이 정보내용은 청소년유해매체물로서 「정보통신망 이용촉진 및 정보보호 등에 관한 법률」 및 「청소년 보호법」 에 따라 19세 미만의 청소년이 이용할 수 없습니다");
1316                                break;
1317                            default:
1318                                alert("이 정보내용은 청소년유해매체물로서 「정보통신망 이용촉진 및 정보보호 등에 관한 법률」 및 「청소년 보호법」 에 따라 19세 미만의 청소년이 이용할 수 없습니다");
1319                                break
1320                        }
1321                    }
1322                } else {
1323                    window.open(redUrl, "_blank")
1324                }
1325            },
1326            /**
1327             * 앱실행 후 앱스키마실행(실패시 앱스토어로 이동)
1328             *
1329             * @param urlScheme : scheme url ( String 필수)
1330             * @param options : launchedby, ref (Json Object ex. {launchedby : 'aaa', ref : 'bbb'} 옵션값)
1331             * @examples
1332             * ex. 옵션이 있는 경우 : MELON.WEBSVC.POC.link.ipadAppLaunch(urlScheme, {launchedby : 'aaa', ref : 'bbb'});
1333             * ex. 옵션이 없는 경우 : MELON.WEBSVC.POC.link.ipadAppLaunch(urlScheme);
1334             */
1335            ipadAppLaunch : function(urlScheme, options){
1336                var appleStore =  "https://itunes.apple.com/kr/app/mellon-melon-for-ipad/id416760693?mt=8";
1337                if(urlScheme == null || urlScheme == "" || (MELON.WEBSVC.POC.getPocId() != 'IT15' && !MELON.WEBSVC.POC.isIPad())){
1338                    return;
1339                }
1340
1341                if(typeof options == 'object'){
1342                    var launchedby = options.launchedby;
1343                    var ref        = options.ref;
1344                    //launchedBy, ref 값이 있는 경우
1345                    if(typeof launchedby != 'undefined' && launchedby != '' && launchedby != null){
1346                        urlScheme += '&launchedby=' + launchedby;
1347                    }
1348                    if(typeof ref != 'undefined' && ref != '' && ref != null){
1349                        urlScheme += '&ref=' + ref;
1350                    }
1351                }
1352
1353                location.href = urlScheme;
1354
1355                var entryTime = +new Date;
1356                setTimeout(function() {
1357                    //앱이 설치되지 않았을 때 동작.
1358                    if (+new Date - entryTime < 2500){
1359                        window.location.replace( appleStore );
1360                        return;
1361                    }
1362                }, 2000);
1363                return;
1364            }
1365        },
1366        buy: {
1367            goBuyProduct: function(formName, contsId, contsType, paramsName, buyType, menuId, exceptAll) {
1368                if (MELON.WEBSVC.POC.isTablet()) {
1369                    MELON.WEBSVC.POC.tabletGuidePop();
1370                    return
1371                }
1372                if (isMelonLogin()) {
1373                    MELON.WEBSVC.CM.CONT.goBuyProduct(formName, contsId, contsType, paramsName, buyType, menuId, exceptAll)
1374                } else {
1375                    MELON.WEBSVC.POC.login.loginCheckFuncCall()
1376                }
1377            },
1378            goBuyProductByPlylst: function(contsId, menuId) {
1379                if (MELON.WEBSVC.POC.isTablet()) {
1380                    MELON.WEBSVC.POC.tabletGuidePop();
1381                    return
1382                }
1383                if (isMelonLogin()) {
1384                    $.ajax({
1385                        type: "POST",
1386                        url: "/mymusic/common/mymusiccommon_listPlaylistSongIds.json",
1387                        data: {
1388                            plylstSeq: contsId
1389                        },
1390                        dataType: "json",
1391                        async: false,
1392                        success: function(data) {
1393                            var songList = data.songIds;
1394                            if (document.plylstSongList != undefined) {
1395                                document.body.removeChild(document.plylstSongList)
1396                            }
1397                            if (data.songIds != null && songList.length > 0) {
1398                                var form = "";
1399                                if (MELON.WEBSVC.browser.isIE && MELON.WEBSVC.browser.version < 8) {
1400                                    form = document.createElement("<form name='plylstSongList' style='display:none;'>");
1401                                    for (var key in songList) {
1402                                        var hiddenField = document.createElement("<input type='checkbox' name='song_id_chk' checked='checked' style='display:none;' value='" + songList[key] + "'>");
1403                                        form.appendChild(hiddenField)
1404                                    }
1405                                } else {
1406                                    form = document.createElement("form");
1407                                    form.setAttribute("name", "plylstSongList");
1408                                    form.setAttribute("style", "display:none");
1409                                    for (var key in songList) {
1410                                        var hiddenField = document.createElement("input");
1411                                        hiddenField.setAttribute("type", "checkbox");
1412                                        hiddenField.setAttribute("name", "song_id_chk");
1413                                        hiddenField.setAttribute("checked", true);
1414                                        hiddenField.setAttribute("value", songList[key]);
1415                                        hiddenField.setAttribute("style", "display:none");
1416                                        form.appendChild(hiddenField)
1417                                    }
1418                                }
1419                                document.body.appendChild(form);
1420                                MELON.WEBSVC.CM.CONT.goBuyProduct("plylstSongList", "", "3C0001", "song_id_chk", "0", menuId, "")
1421                            } else {
1422                                alert("다운로드 가능한 곡이 없습니다.");
1423                                return
1424                            }
1425                        }
1426                    })
1427                } else {
1428                    MELON.WEBSVC.POC.login.loginCheckFuncCall()
1429                }
1430            },
1431            goPresentOnlyOne: function(type, contsId, menuId) {
1432                if (!MELON.WEBSVC.POC.login.isMelonLogin()) {
1433                    MELON.WEBSVC.POC.login.loginPopupLayerd("");
1434                    return
1435                }
1436                if (!confirm("해당 곡을 선물 하시겠습니까?")) {
1437                    return
1438                }
1439                location.href = "/mymusic/messagepresent/mymusicpresent_insert.htm?songIds=" + contsId + "&menuId=" + menuId
1440            },
1441            goPresentForAlbum: function(albumId, formId, menuId) {
1442                if (!MELON.WEBSVC.POC.login.isMelonLogin()) {
1443                    MELON.WEBSVC.POC.login.loginPopupLayerd("");
1444                    return
1445                }
1446                if (albumId == "") {
1447                    alert("앨범을 선택해 주세요.");
1448                    return
1449                }
1450                var contsList = new Array();
1451                var songIds = "";
1452                if (formId != null && formId != "") {
1453                    $("#" + formId).find(".input_check").each(function() {
1454                        if (!isNaN($(this).val())) {
1455                            contsList.push($(this).val())
1456                        }
1457                    })
1458                } else {
1459                    $.ajax({
1460                        type: "POST",
1461                        url: "/album/listAlbumSong.json",
1462                        data: {
1463                            albumId: albumId
1464                        },
1465                        dataType: "json",
1466                        async: false,
1467                        success: function(data) {
1468                            for (var key in data.songList) {
1469                                contsList.push(data.songList[key].SONGID)
1470                            }
1471                        }
1472                    })
1473                }
1474                if (contsList == "") {
1475                    alert("선물 가능한 수록곡이 없습니다.");
1476                    return
1477                }
1478                if (menuId == "") {
1479                    alert("메뉴아이디가 존재하지 않습니다.");
1480                    return
1481                }
1482                if (!confirm("앨범을 선물 하시겠습니까?")) {
1483                    return
1484                }
1485                if (contsList.length > 50) {
1486                    alert("한 번에 최대 50곡까지만 선물 가능합니다.");
1487                    return
1488                }
1489                params = {
1490                    songIds: contsList.join(),
1491                    menuId: menuId
1492                };
1493                method = "POST";
1494                var form = document.createElement("form");
1495                form.setAttribute("method", method);
1496                form.setAttribute("action", "/mymusic/messagepresent/mymusicpresent_insert.htm");
1497                for (var key in params) {
1498                    var hiddenField = document.createElement("input");
1499                    hiddenField.setAttribute("type", "hidden");
1500                    hiddenField.setAttribute("name", key);
1501                    hiddenField.setAttribute("value", params[key]);
1502                    form.appendChild(hiddenField)
1503                }
1504                document.body.appendChild(form);
1505                form.submit()
1506            },
1507            goPresent: function(type, formId, menuId) {
1508                if (!MELON.WEBSVC.POC.login.isMelonLogin()) {
1509                    MELON.WEBSVC.POC.login.loginPopupLayerd("");
1510                    return
1511                }
1512                var str = "";
1513                var count = 0;
1514                if (type == "song") {
1515                    str = "곡을"
1516                } else {
1517                    alert("추후 적용될 예정입니다.");
1518                    return
1519                }
1520                var contsList = new Array();
1521                var songIds = "";
1522                $("#" + formId).find(".input_check:checked").each(function() {
1523                    if (!isNaN($(this).val())) {
1524                        contsList.push($(this).val());
1525                        count++
1526                    }
1527                });
1528                if (contsList == "") {
1529                    alert(str + " 선택해 주세요.");
1530                    return
1531                }
1532                if (menuId == "") {
1533                    alert("메뉴아이디가 존재하지 않습니다.");
1534                    return
1535                }
1536                if (!confirm(count + "개의 " + str + " 선물 하시겠습니까?")) {
1537                    return
1538                }
1539                if (contsList.length > 50) {
1540                    alert("한 번에 최대 50곡까지만 선물 가능합니다.");
1541                    return
1542                }
1543                params = {
1544                    songIds: contsList.join(),
1545                    menuId: menuId
1546                };
1547                method = "POST";
1548                var form = document.createElement("form");
1549                form.setAttribute("method", method);
1550                form.setAttribute("action", "/mymusic/messagepresent/mymusicpresent_insert.htm");
1551                for (var key in params) {
1552                    var hiddenField = document.createElement("input");
1553                    hiddenField.setAttribute("type", "hidden");
1554                    hiddenField.setAttribute("name", key);
1555                    hiddenField.setAttribute("value", params[key]);
1556                    form.appendChild(hiddenField)
1557                }
1558                document.body.appendChild(form);
1559                form.submit()
1560            },
1561            popPhoneDecorate: function(tumsFlg, songId) {
1562                if (!isMelonLogin()) {
1563                    //MELON.WEBSVC.POC.login.loginPopupLayerd();
1564                	melon.login.loginPopup(1);
1565                    return
1566                }
1567                if (songId == 0 || typeof songId == "undefined" || songId == "") {
1568                    alert("곡아이디가 없습니다.");
1569                    return
1570                }
1571                var URL = DeployPhaseUtils.convertUrl("http://decop.melon.com/3.0/player/decop_player.jsp?p_tumsFlg=") + tumsFlg + "&p_songId=" + songId + "&truepage=http://decop.melon.com/3.0/gnb2/popupBox/phone_deco_p.jsp%3Fp_songId=" + songId + "%26p_tumsFlg=" + tumsFlg;
1572                show = window.open(URL, "phone", "height=330,width=452,scrollbars=yes");
1573                show.focus()
1574            }
1575        },
1576        login: {
1577            loginCheckFuncCall: function(methodName) {
1578                var iFuncName = 0;
1579                var iParamStart = 1;
1580                var isLogin = isMelonLogin();
1581                if (isLogin) {
1582                    var param = "";
1583                    var cmd = "";
1584                    for (var i = iParamStart; i < arguments.length; i++) {
1585                        param += "arguments[" + i + "]";
1586                        if (i + 1 < arguments.length) {
1587                            param += ","
1588                        }
1589                    }
1590                    cmd = arguments[iFuncName] + "(" + param + ")";
1591                    eval(cmd)
1592                } else {
1593                    //MELON.WEBSVC.POC.login.loginPopupLayerd()
1594                	melon.login.loginPopup(1);
1595                }
1596            },
1597            loginPopup: function(type) {
1598                var popUrl = "";
1599                var urlOpt = "";
1600                if (!type) {
1601                    window.name = "_OPENER_LOGIN_WINDOW";
1602                    //popUrl = "http://www.melon.com/muid/web/login/loginpopup_inform.htm";
1603                    popUrl = DeployPhaseUtils.convertUrl("https://accounts.melon.com/login/login.htm?cpId=")+melon.getPocId() + '&redirectURL=' + encodeURIComponent(location.href);
1604                    urlOpt = "scrollbars=no, resizable=yes,location=no, width=560,height=380, left=20, top=20";
1605                    window.open(popUrl, "_LOGIN_POPUP", urlOpt)
1606                } else {
1607                    // TICKETDEV-2703 팝업 로그인 제거 및 redirect로 변경
1608                    popUrl = DeployPhaseUtils.convertUrl("https://accounts.melon.com/login/login.htm?cpId=")+melon.getPocId() + '&redirectURL=' + encodeURIComponent(location.href);
1609                    location.href = popUrl
1610                }
1611            },
1612            loginPopupLayerd: function(returnPage) {
1613                $.ajax({
1614                    url: "/muid/web/login/loginlayer_inform.htm",
1615                    data: {
1616                        returnPage: returnPage
1617                    }
1618                }).done(function(html) {
1619                    $(html).appendTo("body").modal({
1620                        modal: true,
1621                        clone: true,
1622                        containerCss: {
1623                            backgroundColor: "#fffff"
1624                        },
1625                        removeOnClose: true
1626                    }).find("input[name=returnPage]").val(returnPage || location.href);
1627                    try {
1628                        if ($("script[src='resource/script/muid/web/memberAlertMsg.js']").length == 0 && $("script[src='" + DeployPhaseUtils.convertUrl("https://member.melon.com/resource/script/muid/web/memberAlertMsg.js") + "']").length == 0) {
1629                            var memAlertJsStr = '<script type="text/javascript" src="' + DeployPhaseUtils.convertUrl('https://member.melon.com/resource/script/muid/web/memberAlertMsg.js') + '"><\/script>';
1630                            $(memAlertJsStr).appendTo("body")
1631                        }
1632                        if ($("script[src='/resource/script/muid/web/memberFunc.js']").length == 0 && $("script[src='" + DeployPhaseUtils.convertUrl("https://member.melon.com/resource/script/muid/web/memberFunc.js") + "']").length == 0) {
1633                            var memFuncJsStr = "<script type='text/javascript' src='" + DeployPhaseUtils.convertUrl("https://member.melon.com/resource/script/muid/web/memberFunc.js") + "'><\/script>";
1634                            $(memFuncJsStr).appendTo("body")
1635                        }
1636                        $("input[placeholder]").placeholder({})
1637                    } catch (e) {}
1638                })
1639            },
1640            loginPopupLayerdMMA: function(returnPage) {
1641                $.ajax({
1642                    url: "/muid/web/login/loginlayer_inform.htm",
1643                    data: {
1644                        returnPage: returnPage
1645                    }
1646                }).done(function(html) {
1647                    $(html).appendTo("body").modal({
1648                        modal: true,
1649                        clone: true,
1650                        draggable: false,
1651                        containerCss: {
1652                            backgroundColor: "#fffff"
1653                        },
1654                        removeOnClose: true
1655                    }).find("input[name=returnPage]").val(returnPage || location.href);
1656                    try {
1657                        if ($("script[src='/resource/script/muid/web/memberAlertMsg.js']").length == 0 && $("script[src='" + DeployPhaseUtils.convertUrl("https://member.melon.com/resource/script/muid/web/memberAlertMsg.js") + "']").length == 0) {
1658                            var memAlertJsStr = '<script type="text/javascript" src="' + DeployPhaseUtils.convertUrl('https://member.melon.com/resource/script/muid/web/memberAlertMsg.js') + '"><\/script>';
1659                            $(memAlertJsStr).appendTo("body")
1660                        }
1661                        if ($("script[src='/resource/script/muid/web/memberFunc.js']").length == 0 && $("script[src='" + DeployPhaseUtils.convertUrl("https://member.melon.com/resource/script/muid/web/memberFunc.js") + "']").length == 0) {
1662                            var memFuncJsStr = "<script type='text/javascript' src='" + DeployPhaseUtils.convertUrl("https://member.melon.com/resource/script/muid/web/memberFunc.js") + "'><\/script>";
1663                            $(memFuncJsStr).appendTo("body")
1664                        }
1665                        $("input[placeholder]").placeholder({})
1666                    } catch (e) {}
1667                })
1668            },
1669            isMelonLogin: function() {
1670                return isMelonLogin()
1671            },
1672            gnbLogin: function() {
1673                var loginBoxIdx = 0;
1674                if ($("#gnbLoginDiv").children().eq(1).css("display") == "block") {
1675                    loginBoxIdx = 1
1676                }
1677                var id = $("#gnbLoginDiv").children().eq(loginBoxIdx).find("input[name=memberId]").val();
1678                var pwd = $("#gnbLoginDiv").children().eq(loginBoxIdx).find("input[name=memberPwd]").val();
1679                var saveId = $("#gnbLoginDiv").children().eq(loginBoxIdx).find("input[name=saveId]").prop("checked") ? "Y" : "N";
1680                if (id == "" || id == "아이디") {
1681                    alert("아이디를 입력해 주세요.");
1682                    return false
1683                }
1684                if (pwd == "") {
1685                    alert("비밀번호를 입력해 주세요.");
1686                    return false
1687                }
1688                var loginFrm = $('<form method="post" name="gnbLoginFrm"></form>');
1689                loginFrm.appendTo("body");
1690                var returnURL = document.location.href;
1691                returnURL = encodeURIComponent(returnURL);
1692                var loginRSA;
1693                try {
1694                    loginRSA = new AuthRSA();
1695                    loginRSA.execute(function(p, e) {
1696                        loginFrm.append('<input type="hidden" id="memberId" name="memberId" value="' + loginRSA.encrypt(id) + '">');
1697                        loginFrm.append('<input type="hidden" id="memberPwd" name="memberPwd" value="' + loginRSA.encrypt(pwd) + '">');
1698                        loginFrm.append('<input type="hidden" id="publicKey" name="publicKey" value="' + p + '">');
1699                        loginFrm.append('<input type="hidden" id="saveId" name="saveId" value="' + saveId + '">');
1700                        loginFrm.prop("action", DeployPhaseUtils.convertUrl("https://member.melon.com/muid/web/login/login_informProcs.htm?returnPage=") + returnURL);
1701                        loginFrm.submit()
1702                    })
1703                } catch (e) {
1704                    loginFrm.append('<input type="hidden" id="memberId" name="memberId" value="' + id + '">');
1705                    loginFrm.append('<input type="hidden" id="memberPwd" name="memberPwd" value="' + pwd + '">');
1706                    loginFrm.append('<input type="hidden" id="saveId" name="saveId" value="' + s
1706aveId + '">');
1707                    loginFrm.prop("action", DeployPhaseUtils.convertUrl("https://member.melon.com/muid/web/login/login_informProcs.htm?returnPage=") + returnURL);
1708                    loginFrm.submit()
1709                }
1710            },
1711            gnbLogout: function() {
1712                logout()
1713            },
1714            menuLogin: function(returnPage) {
1715                if (returnPage == null || returnPage == "") {
1716                    location.href = DeployPhaseUtils.convertUrl("https://www.melon.com/muid/web/login/login_inform.htm")
1717                } else {
1718                    var loginFrm = $('<form method="post" name="menuLoginFrm"></form>');
1719                    loginFrm.appendTo("body");
1720                    var inputReturnPage = $("<input />");
1721                    inputReturnPage.attr("name", "returnPage");
1722                    inputReturnPage.attr("value", returnPage);
1723                    inputReturnPage.appendTo(loginFrm);
1724                    loginFrm.attr("action", DeployPhaseUtils.convertUrl("https://www.melon.com/muid/web/login/login_inform.htm"));
1725                    loginFrm.submit()
1726                }
1727            },
1728            menuLoginWithReqType: function(returnPage, reqType) {
1729                if (returnPage == null || returnPage == "") {
1730                    location.href = DeployPhaseUtils.convertUrl("https://www.melon.com/muid/web/login/login_inform.htm")
1731                } else {
1732                    var loginFrm = $('<form method="post" name="menuLoginFrm"></form>');
1733                    loginFrm.appendTo("body");
1734                    var inputReturnPage = $("<input />");
1735                    inputReturnPage.attr("name", "returnPage");
1736                    inputReturnPage.attr("value", returnPage);
1737                    inputReturnPage.appendTo(loginFrm);
1738                    var inputReqType = $("<input />");
1739                    inputReqType.attr("name", "reqType");
1740                    inputReqType.attr("value", reqType);
1741                    inputReqType.appendTo(loginFrm);
1742                    loginFrm.attr("action", DeployPhaseUtils.convertUrl("https://www.melon.com/muid/web/login/login_inform.htm"));
1743                    loginFrm.submit()
1744                }
1745            }
1746        },
1747        menu: {
1748            goMyMusicMain: function() {
1749                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1750                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/main/mymusicmain_list.htm?memberKey=") + getMemberKey()
1751                } else {
1752                    MELON.WEBSVC.POC.login.menuLoginWithReqType(DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/main/mymusicmain_list.htm"), "TYPE01");
1753                    return
1754                }
1755            },
1756            goMyMusicLike: function() {
1757                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1758                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/like/mymusiclikesong_list.htm?memberKey=") + getMemberKey()
1759                } else {
1760                    MELON.WEBSVC.POC.login.menuLogin();
1761                    return
1762                }
1763            },
1764            goMyMusicPlayList: function() {
1765                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1766                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/playlist/mymusicplaylist_list.htm?memberKey=") + getMemberKey()
1767                } else {
1768                    MELON.WEBSVC.POC.login.menuLogin();
1769                    return
1770                }
1771            },
1772            goMyMusicDjCollection: function() {
1773                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1774                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/djcollection/mymusiccollectiondj_list.htm?memberKey=") + getMemberKey()
1775                } else {
1776                    MELON.WEBSVC.POC.login.menuLogin();
1777                    return
1778                }
1779            },
1780            goMyMusicRecentSong: function() {
1781                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1782                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/recent/mymusicplaylistrecentsong_list.htm?memberKey=") + getMemberKey()
1783                } else {
1784                    MELON.WEBSVC.POC.login.menuLogin();
1785                    return
1786                }
1787            },
1788            goMyMusicManySong: function() {
1789                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1790                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/top/m
1790ymusicplaylistmanysong_list.htm?memberKey=") + getMemberKey()
1791                } else {
1792                    MELON.WEBSVC.POC.login.menuLogin();
1793                    return
1794                }
1795            },
1796            goMyMusicFanSignArtist: function() {
1797                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1798                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/artistfan/mymusicartistfan_list.htm?memberKey=") + getMemberKey()
1799                } else {
1800                    MELON.WEBSVC.POC.login.menuLogin();
1801                    return
1802                }
1803            },
1804            goMyMusicFriend: function() {
1805                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1806                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/friend/mymusicfriendmusicchart_list.htm?memberKey=") + getMemberKey()
1807                } else {
1808                    MELON.WEBSVC.POC.login.menuLogin();
1809                    return
1810                }
1811            },
1812            goMyMusicMyFriend: function() {
1813                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1814                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/friend/mymusicfriend_list.htm?memberKey=") + getMemberKey()
1815                } else {
1816                    MELON.WEBSVC.POC.login.menuLogin();
1817                    return
1818                }
1819            },
1820            goMyMusicMessage: function() {
1821                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1822                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/mymusic/messagepresent/mymusicmessage_list.htm")
1823                } else {
1824                    MELON.WEBSVC.POC.login.menuLogin();
1825                    return
1826                }
1827            },
1828            goDjRegister: function() {
1829                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1830                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/dj/djregister/djregister_inform.htm")
1831                } else {
1832                    MELON.WEBSVC.POC.login.menuLogin();
1833                    return
1834                }
1835            },
1836            goMyPage: function() {
1837                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1838                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/commerce/mypage/product/web/producthistory_listCurUserProdView.htm")
1839                } else {
1840                    MELON.WEBSVC.POC.login.menuLogin();
1841                    return
1842                }
1843            },
1844            goMyPageAddCash: function() {
1845                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1846                    window.open(httpsWww + "/buy/meloncash/charge.htm", "melonCash", "app_, width=645, height=612, status=no, toolbar=no, scrollbars=yes")
1847                } else {
1848                    MELON.WEBSVC.POC.login.menuLogin();
1849                    return
1850                }
1851            },
1852            goFeed: function() {
1853                if (MELON.WEBSVC.POC.login.isMelonLogin()) {
1854                    location.href = DeployPhaseUtils.convertUrl("http://www.melon.com/feed/index.htm")
1855                } else {
1856                    MELON.WEBSVC.POC.login.menuLogin(DeployPhaseUtils.convertUrl("http://www.melon.com/feed/index.htm"));
1857                    return
1858                }
1859            },
1860            cm: {
1861                goPamphlet: function() {
1862                    location.href = this.getPamphletUrl()
1863                },
1864                getPamphletUrl: function() {
1865                    return DeployPhaseUtils.convertUrl("http://www.melon.com/commerce/pamphlet/web/sale_listMainView.htm")
1866                }
1867            }
1868        },
1869        sns: {
1870            postFacebook: function(param) {
1871                var memberKey = param.memberKey;
1872                var type = param.type;
1873                var contsId = param.contsId;
1874                var message = param.message;
1875                var menuId = param.menuId;
1876                if (menuId == undefined || menuId == "undefined") {
1877                    menuId = ""
1878                }
1879                if (type == "son") {
1880                    type = "sonDft"
1881                } else {
1882                    if (type == "alb") {
1883                        type = "albDft"
1884                    } else {
1885                        if (type == "art") {
1886                            type = "artDft"
1887                        }
1888                    }
1889                }
1890                var url = DeployPhaseUtils.convertUrl("http://www.melon.com/restful/cds/facebook/web/facebook_posting/") + type + "/" 
1890+ contsId + ".htm";
1891                if (type == "ply" || type == "oab" || type == "apl" || type == "djm" || type == "djc") {
1892                    $.ajax({
1893                        type: "POST",
1894                        url: "/sns/snsposting_informPostingEtcData.json",
1895                        data: {
1896                            type: type,
1897                            contsId: contsId
1898                        },
1899                        async: false,
1900                        success: function(result) {
1901                            url = DeployPhaseUtils.convertUrl("http://www.melon.com/restful/cds/facebook/web/facebook_posting/") + type + "/" + contsId + "/" + result.memberKey + "/" + result.updtDate + ".htm"
1902                        }
1903                    })
1904                }
1905                $.ajax({
1906                    type: "POST",
1907                    url: "/sns/snsposting_postFacebook.json",
1908                    data: {
1909                        memberKey: memberKey,
1910                        url: url,
1911                        message: message
1912                    },
1913                    dataType: "json",
1914                    success: function(result) {
1915                        if (result.result == "SNSOK") {
1916                            var longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&frm=cmt&menuId=" + menuId;
1917                            melon.sns.getShortenUrl({
1918                                longUrl: longUrl,
1919                                type: type,
1920                                ref: "facebook",
1921                                contsId: contsId,
1922                                menuId: menuId
1923                            });
1924                            melon.sns.outPostingLog("facebook", type, contsId)
1925                        } else {
1926                            alert("페이스북 계정연결을 하여야 합니다.")
1927                        }
1928                    }
1929                })
1930            },
1931            postTwitter: function(param) {
1932                var memberKey = param.memberKey;
1933                var type = param.type;
1934                var contsId = param.contsId;
1935                var message = param.message;
1936                var menuId = param.menuId;
1937                if (menuId == undefined || menuId == "undefined") {
1938                    menuId = ""
1939                }
1940                var longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&frm=cmt&menuId=" + menuId;
1941                var url = melon.sns.getShortenUrl({
1942                    longUrl: longUrl,
1943                    type: type,
1944                    ref: "twitter",
1945                    contsId: contsId,
1946                    menuId: menuId
1947                });
1948                $.ajax({
1949                    type: "POST",
1950                    url: "/sns/snsposting_postTwitter.json",
1951                    data: {
1952                        memberKey: memberKey,
1953                        url: url,
1954                        message: message
1955                    },
1956                    dataType: "json",
1957                    success: function(result) {
1958                        if (result.result == "SNSOK") {
1959                            melon.sns.outPostingLog("twitter", type, contsId)
1960                        } else {
1961                            alert("트위터 계정연결을 하여야 합니다.")
1962                        }
1963                    }
1964                })
1965            },
1966            facebook: function(param) {
1967                var adjTitle = "";
1968                var adjDescription = "음악이 필요한 순간, 멜론";
1969                var strStatus = "";
1970                var cbUrl = "";
1971                var type = param.type;
1972                var contsId = param.contsId;
1973                var menuId = param.menuId;
1974                if (menuId == undefined || menuId == "undefined") {
1975                    menuId = ""
1976                }
1977                var artistId = param.artistId;
1978                if (artistId == undefined || artistId == "undefined") {
1979                    artistId = ""
1980                }
1981                var imgUrl = param.imgUrl;
1982                if (imgUrl == undefined || imgUrl == null || imgUrl == "undefined") {
1983                    imgUrl = ""
1984                }
1985                var subType = param.subType;
1986                if (subType == undefined || subType == null || subType == "undefined") {
1987                    subType = ""
1988                }
1989                var wwwHome = DeployPhaseUtils.convertUrl("http://www.melon.com");
1990                var longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&menuId=" + menuId;
1991                var fbFeedUrl = wwwHome + "/restful/cds/facebook/web/facebook_posting/" + type + "/" + contsId + ".htm";
1992                var redirectUrl = DeployPhaseUtils.convertUrl("http://www.melon.com/sns/snsposting_close.htm");
1993                if ("son" == type) {
1994                    adjTitle = param.songName + " - " + param.artistName;
1995                    if (imgUrl.indexOf("noAlbum_") > 0) {
1996                        imgUrl = "/resource/image/web/default/noAlbum_500.jpg"
1997                    } else {
1998                        imgUrl = melon.sns.getImgUrlByWidth(imgUrl, 500)
1999                    }
2000                } else {
2001                    if ("alb" == type) {
2002                        adjTitle = param.albumName + " - " + param.artistName;
2003                        if (imgUrl.indexOf("noAlbum_") > 0) {
2004                            imgUrl = "/resource/image/web/default/noAlbum_500.jpg"
2005                        } else {
2006                            imgUrl = melon.sns.getImgUrlByWidth(imgUrl, 500)
2007                        }
2008                    } else {
2009                        if ("art" == type) {
2010                            adjTitle = param.artistName
2011                        } else {
2012                            if ("playlist" == type || "ply" == type) {
2013                                adjTitle = param.playlistName + " by " + param.memberNickName;
2014                                var memberKey = param.memberKey;
2015                                var updtDate = param.updtDate;
2016                                var albumImage1Path = param.albumImage1Path;
2017                                if (imgUrl == null || imgUrl == "") {
2018                                    if (albumImage1Path == null || albumImage1Path == "") {
2019                                        imgUrl = "/resource/image/web/default/noAlbum_500.jpg"
2020                                    } else {
2021                                        imgUrl = albumImage1Path;
2022                                        imgUrl = melon.sns.getImgUrlByWidth(imgUrl, 500)
2023                                    }
2024                                } else {
2025                                    imgUrl = imgUrl.replace("_190", "_org")
2026                                }
2027                                imgUrl = imgUrl + "?tm=" + updtDate
2028                            } else {
2029                                if ("oalbum" == type || "oab" == type || "djc" == type) {
2030                                    adjTitle = param.playlistName + " by " + param.memberNickName;
2031                                    var memberKey = param.memberKey;
2032                                    var updtDate = param.updtDate;
2033                                    var albumImage1Path = param.albumImage1Path;
2034                                    if (imgUrl == null || imgUrl == "") {
2035                                        if (albumImage1Path == null || albumImage1Path == "") {
2036                                            imgUrl = "/resource/image/web/default/noAlbum_500.jpg"
2037                                        } else {
2038                                            imgUrl = albumImage1Path;
2039                                            imgUrl = melon.sns.getImgUrlByWidth(imgUrl, 500)
2040                                        }
2041                                    } else {
2042                                        imgUrl = imgUrl.replace("_190", "_org")
2043                                    }
2044                                    imgUrl = imgUrl + "?tm=" + updtDate
2045                                } else {
2046                                    if ("pht" == type) {
2047                                        adjTitle = param.artistName;
2048                                        longUrl = longUrl + "&artId=" + artistId;
2049                                        if (imgUrl.indexOf("_org") > 0) {
2050                                            imgUrl = imgUrl.replace("_org", "_500")
2051                                        } else {
2052                                            if (imgUrl.indexOf("noAlbum_") > 0) {
2053                                                imgUrl = "/resource/image/web/default/noAlbum_500.jpg"
2054                                            }
2055                                        }
2056                                    } else {
2057                                        if ("mvd" == type) {
2058                                            longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&menuId=" + menuId + "&subType=" + subType;
2059                                            adjTitle = param.mvdName + " - " + param.artistName;
2060                                            if (imgUrl.indexOf("noMovie_") > 0) {
2061                                                imgUrl = "/resource/image/web/default/noMovie_4x3_640.jpg"
2062                                            } else {
2063                                                imgUrl = melon.sns.getImgUrlByWidth(imgUrl, 640)
2064                                            }
2065                                            if ("live" == subType) {
2066                                                fbFeedUrl = wwwHome + "/restful/cds/facebook/web/facebook_posting/mvdLLk/" + contsId + ".htm"
2067                                            } else {
2068                                                fbFeedUrl = wwwHome + "/restful/cds/facebook/web/facebook_posting/mvdVLk/" + contsId + ".htm"
2069                                            }
2070                                        } else {
2071                                            if ("djm" == type) {
2072                                                adjTitle = param.magaznName + " by " + param.magaznNickname;
2073                                                var memberKey = "1";
2074                                                var updtDate = param.updtDate;
2075                                                if (imgUrl == null || imgUrl == "") {
2076                                                    imgUrl = "/resource/image/web/default/noAlbum_500.jpg"
2077                                                } else {
2078                                                    imgUrl = imgUrl.replace("_220", "_640")
2079                                                }
2080                                                imgUrl = imgUrl + "?tm=" + updtDate
2081                                            } else {
2082                                                if ("mus" == type) {
2083                                                    adjTitle = "[" + param.cateName + "]" + param.mstoryTitle;
2084                                                    if (imgUrl.indexOf("noMovie_") > 0) {
2085                                                        imgUrl = "/resource/image/web/default/noMovie_4x3_640.jpg"
2086                                                    }
2087                                                } else {
2088                                                    if ("nws" == type) {
2089                                                        adjTitle = param.message;
2090                                                        longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=art&sId=") + artistId + "&menuId=" + menuId;
2091                                                        longUrl = longUrl + "&frm=nws";
2092                                                        if (imgUrl.indexOf("noAlbum_") > 0) {
2093                                                            imgUrl = "/resource/image/web/default/noAlbum_500.jpg"
2094                                                        } else {
2095                                                            if (imgUrl.indexOf("/cm/album/images/") > 0) {
2096                                                                imgUrl = melon.sns.getImgUrlByWidth(imgUrl, 500)
2097                                                            }
2098                                                        }
2099                                                    } else {
2100                                                        if ("ntz" == type) {
2101                                                            adjTitle = "멜론 주간 어워드 투표 진행중! 빨리 투표에 참여하세요";
2102                                                            imgUrl = DeployPhaseUtils.convertUrl("http://cdnimg.melon.co.kr/resource/image/web/chart/award_op.jpg")
2103                                                        } else {
2104                                                            if ("apl" == type) {
2105                                                                adjTitle = param.playlistName + " by " + param.artistNameWebList;
2106                                                                var memberKey = param.memberKey;
2107                                                                var updtDate = param.updtDate;
2108                                                                if (imgUrl.indexOf("noAlbum_") > 0) {
2109                                                                    imgUrl = "/resource/image/web/default/noAlbum_500.jpg"
2110                                                                } else {
2111                                                                    imgUrl = melon.sns.getImgUrlByWidth(imgUrl, 500)
2112                                                                }
2113                                                                imgUrl = imgUrl + "?tm=" + updtDate
2114                                                            } else {
2115                                                                if ("afr" == type) {
2116                                                                    adjTitle = param.message;
2117                                                                    longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + artistId + "&menuId=" + menuId;
2118                                                                    var memberKey = param.memberKey;
2119                                                                    var temperature = param.temperature;
2120                                                                    var totalUserRank = param.totalUserRank;
2121                                                                    var userRank = param.userRank;
2122                                                                    var isMeArtist = param.isMeArtist;
2123                                                                    if (temperature == undefined || temperature == "undefined" || temperature == "") {
2124                                                                        temperature = "0"
2125                                                                    }
2126                                                                    imgUrl = "/resource/image/cds/artist/feel/facebook_" + temperature + ".png";
2127                                                                    if (contsId == null || contsId == "0") {
2128                                                                        contsId = artistId
2129                                                                    }
2130                                                                } else {
2131                                                                    if ("thk" == type) {
2132                                                                        adjTitle = param.artistName + "님의 THANK YOU  메시지";
2133                                                                        longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&artId=" + artistId + "&menuId=" + menuId;
2134                                                                        if (imgUrl == "" || imgUrl.indexOf("noAlbum_") > 0) {
2135                                                                            imgUrl = "/resource/image/web/default/noAlbum_500.jpg"
2136                                                                        }
2137                                                                    }
2138                                                                }
2139                                                            }
2140                                                        }
2141                                                    }
2142                                                }
2143                                            }
2144                                        }
2145                                    }
2146                                }
2147                            }
2148                        }
2149                    }
2150                }
2151                cbUrl = melon.sns.getShortenUrl({
2152                    longUrl: longUrl,
2153                    type: type,
2154                    ref: "facebook",
2155                    contsId: contsId,
2156                    menuId: menuId
2157                });
2158                melon.sns.outPostingLog("facebook", type, contsId);
2159                strStatus = "u=" + cbUrl + "&t=" + encodeURIComponent(adjTitle);
2160                if (imgUrl != null) {
2161                    if (imgUrl.indexOf("http") < 0) {
2162                        imgUrl = DeployPhaseUtils.convertUrl("http://cdnimg.melon.co.kr") + imgUrl
2163                    }
2164                }
2165                if ("mvd" == type) {
2166                    cbUrl = fbFeedUrl
2167                }
2168                var facebookURL = "https://www.facebook.com/dialog/feed?app_id=357952407588971&display=popup&name=" + encodeURIComponent(adjTitle) + "&description=" + encodeURIComponent(adjDescription) + "&picture=" + imgUrl + "&link=" + cbUrl + "&redirect_uri=" + redirectUrl + "&caption=www.melon.com";
2169                window.open(facebookURL, "fbPosting", "width=700, height=540, status=no, toolbar=no,resizable=no")
2170            },
2171            twitter: function(param) {
2172                var adjTitle = "";
2173                var strStatus = "";
2174                var cbUrl = "";
2175                var type = param.type;
2176                var contsId = param.contsId;
2177                var menuId = param.menuId;
2178                if (menuId == undefined || menuId == "undefined") {
2179                    menuId = ""
2180                }
2181                var artistId = param.artistId;
2182                if (artistId == undefined || artistI
2182d == "undefined") {
2183                    artistId = ""
2184                }
2185                var subType = param.subType;
2186                if (subType == undefined || subType == null || subType == "undefined") {
2187                    subType = ""
2188                }
2189                var longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&menuId=" + menuId;
2190                if ("son" == type) {
2191                    adjTitle = param.songName + " - " + param.artistName + " - 들어보세요."
2192                } else {
2193                    if ("alb" == type) {
2194                        adjTitle = param.artistName + "의 " + param.albumName + " - 추천합니다."
2195                    } else {
2196                        if ("art" == type) {
2197                            adjTitle = param.artistName + " - 좋아합니다."
2198                        } else {
2199                            if ("playlist" == type || "ply" == type) {
2200                                adjTitle = param.playlistName + " by " + param.memberNickName
2201                            } else {
2202                                if ("oalbum" == type || "oab" == type || "djc" == type) {
2203                                    adjTitle = "DJ 플레이리스트 :: " + param.playlistName + " by " + param.memberNickName
2204                                } else {
2205                                    if ("pht" == type) {
2206                                        adjTitle = param.artistName + "의 포토를 좋아합니다.";
2207                                        longUrl = longUrl + "&artId=" + artistId
2208                                    } else {
2209                                        if ("mvd" == type) {
2210                                            longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&menuId=" + menuId + "&subType=" + subType;
2211                                            adjTitle = param.artistName + "의 " + param.mvdName + " - 감상해보세요."
2212                                        } else {
2213                                            if ("djm" == type) {
2214                                                adjTitle = "DJ 매거진 :: " + param.magaznName + " by " + param.magaznNickname
2215                                            } else {
2216                                                if ("mus" == type) {
2217                                                    adjTitle = "[" + param.cateName + "]" + param.mstoryTitle
2218                                                } else {
2219                                                    if ("nws" == type) {
2220                                                        adjTitle = param.message;
2221                                                        longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=art&sId=") + artistId + "&menuId=" + menuId;
2222                                                        longUrl = longUrl + "&frm=nws"
2223                                                    } else {
2224                                                        if ("ntz" == type) {
2225                                                            adjTitle = "멜론 주간 어워드 투표 진행중! 빨리 투표에 참여하세요"
2226                                                        } else {
2227                                                            if ("apl" == type) {
2228                                                                adjTitle = "아티스트 플레이리스트 :: " + param.playlistName + " by " + param.artistNameWebList
2229                                                            } else {
2230                                                                if ("afr" == type) {
2231                                                                    adjTitle = param.message;
2232                                                                    longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + artistId + "&menuId=" + menuId;
2233                                                                    if (contsId == null || contsId == "0") {
2234                                                                        contsId = artistId
2235                                                                    }
2236                                                                } else {
2237                                                                    if ("thk" == type) {
2238                                                                        adjTitle = param.artistName + "님의 THANK YOU  메시지";
2239                                                                        longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&artId=" + artistId + "&menuId=" + menuId
2240                                                                    }
2241                                                                }
2242                                                            }
2243                                                        }
2244                                                    }
2245                                                }
2246                                            }
2247                                        }
2248                                    }
2249                                }
2250                            }
2251                        }
2252                    }
2253                }
2254                cbUrl = melon.sns.getShortenUrl({
2255                    longUrl: longUrl,
2256                    type: type,
2257                    ref: "twitter",
2258                    contsId: contsId,
2259                    menuId: menuId
2260                });
2261                melon.sns.outPostingLog("twitter", type, contsId);
2262                try {
2263                    adjTitle = MELON.WEBSVC.string.unescapeHTML(adjTitle)
2264                } catch (e) {}
2265                strStatus = encodeURIComponent(adjTitle + " " + cbUrl + " #MelOn");
2266                var twitURL = "http://twitter.com/home?status=" + strStatus;
2267                window.open(twitURL)
2268            },
2269            cyworld: function(param) {
2270                var adjTitle = "";
2271                var strStatus = "";
2272                var cbUrl = "";
2273                var adjSummary = " ";
2274                var type = param.type;
2275                var contsId = param.contsId;
2276                var menuId = param.menuId;
2277                if (menuId == undefined || menuId == "undefined") {
2278                    menuId = ""
2279                }
2280                var artistId = param.artistId;
2281                if (artistId == undefined || artistId == "undefined") {
2282                    artistId = ""
2283                }
2284                var longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&ref=cyworld&menuId=" + menuId;
2285                if ("son" == type) {
2286                    adjTitle = param.songName + "-" + param.artistName;
2287                    if (param.albumName != undefined && param.albumName != "") {
2288                        adjSummary += "[앨범]" + param.albumName
2289                    }
2290                    if (param.adjDate != undefined && param.adjDate != "") {
2291                        param.adjDate = melon.sns.formatDate(param.adjDate, ".");
2292                        adjSummary += " (발매일 : " + param.adjDate + ")"
2293                    }
2294                } else {
2295                    if ("alb" == type) {
2296                        adjTitle = param.albumName + "-" + param.artistName;
2297                        if (param.adjDate != undefined && param.adjDate != "") {
2298                            param.adjDate = melon.sns.formatDate(param.adjDate, ".");
2299                            adjSummary += " (발매일 : " + param.adjDate + ")"
2300                        }
2301                    } else {
2302                        if ("art" == type) {
2303                            adjTitle = param.artistName;
2304                            if (param.adjNation != "") {
2305                                adjSummary += "(국적 : " + param.adjNation + ")"
2306                            }
2307                        } else {
2308                            if ("playlist" == type || "ply" == type) {
2309                                adjTitle = param.playlistName + "-" + param.memberNickName;
2310                                adjSummary = "  "
2311                            } else {
2312                                if ("oalbum" == type || "oab" == type || "djc" == type) {
2313                                    adjTitle = param.playlistName + "-" + param.memberNickName;
2314                                    adjSummary = "  "
2315                                } else {
2316                                    if ("pht" == type) {
2317                                        adjTitle = param.artistName;
2318                                        longUrl = longUrl + "&artId=" + artistId;
2319                                        adjSummary = "  "
2320                                    } else {
2321                                        if ("mvd" == type) {
2322                                            adjTitle = param.mvdName + "-" + param.artistName;
2323                                            adjSummary = "  "
2324                                        } else {
2325                                            if ("djm" == type) {
2326                                                adjTitle = param.magaznName + "-" + param.magaznNickname;
2327                                                adjSummary = "  "
2328                                            } else {
2329                                                if ("mus" == type) {
2330                                                    adjTitle = "[" + param.cateName + "]" + param.mstoryTitle;
2331                                                    adjSummary = "  "
2332                                                } else {
2333                                                    if ("nws" == type) {
2334                                                        adjTitle = param.message;
2335                                                        longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=art&sId=") + contsId + "&menuId=" + menuId;
2336                                                        longUrl = longUrl + "&frm=nws";
2337                                                        adjSummary = "  "
2338                                                    } else {
2339                                                        if ("ntz" == type) {
2340                                                            adjTitle = "멜론 주간 어워드 투표 진행중! 빨리 투표에 참여하세요";
2341                                                            param.imgUrl = DeployPhaseUtils.convertUrl("http://cdnimg.melon.co.kr/resource/image/web/chart/award_op.jpg");
2342                                                            adjSummary = "  "
2343                                                        } else {
2344                                                            if ("apl" == type) {
2345                                                                adjTitle = param.playlistName + "-" + param.artistNameWebList;
2346                                                                adjSummary = "  "
2347                                                            }
2348                                                        }
2349                                                    }
2350                                                }
2351                                            }
2352                                        }
2353                                    }
2354                                }
2355                            }
2356                        }
2357                    }
2358                }
2359                var imgUrl = param.imgUrl;
2360                if (imgUrl.indexOf("http") < 0) {
2361                    imgUrl = DeployPhaseUtils.convertUrl("http://cdnimg.melon.co.kr") + imgUrl
2362                }
2363                var writer = "음악이 필요한 순간, 멜론";
2364                strStatus = "url=" + encodeURIComponent(longUrl) + "&thumbnail=" + encodeURIComponent(imgUrl) + "&title_nobase64=" + encodeURIComponent(adjTitle) + "&summary_nobase64=" + encodeURIComponent(adjSummary) + "&writer=" + encodeURIComponent(writer);
2365                var cyworldURL = "http://csp.cyworld.com/bi/bi_recommend_pop.php?" + strStatus;
2366                melon.sns.outPostingLog("cyworld", type, contsId);
2367                window.open(cyworldURL, "recom_icon_pop", "width=400,height=364,scrollbars=no,resizable=no")
2368            },
2369            nate: function(param) {
2370                var adjTitle = "";
2371                var strStatus = "";
2372                var cbUrl = "";
2373                var type = param.type;
2374                var contsId = param.contsId;
2375                var menuId = param.menuId;
2376                if (menuId == undefined || menuId == "undefined") {
2377                    menuId = ""
2378                }
2379                var artistId = param.artistId;
2380                if (artistId == undefined || artistId == "undefined") {
2381                    artistId = ""
2382                }
2383                var longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=") + type + "&sId=" + contsId + "&menuId=" + menuId;
2384                if ("son" == type) {
2385                    adjTitle = param.songName + " - " + param.artistName
2386                } else {
2387                    if ("alb" == type) {
2388                        adjTitle = param.artistName + "의 " + param.albumName + " 좋아합니다!"
2389                    } else {
2390                        if ("art" == type) {
2391                            adjTitle = param.artistName + " 좋아합니다!"
2392                        } else {
2393                            if ("playlist" == type || "ply" == type) {
2394                                adjTitle = param.memberNickName + "의 " + param.playlistName + " 좋아합니다!"
2395                            } else {
2396                                if ("oalbum" == type || "oab" == type || "djc" == type) {
2397                                    adjTitle = param.memberNickName + "의 " + param.playlistName + " 좋아합니다!"
2398                                } else {
2399                                    if ("pht" == type) {
2400                                        adjTitle = param.artistName + "의 포토를 좋아합니다!";
2401                                        longUrl = longUrl + "&artId=" + artistId
2402                                    } else {
2403                                        if ("mvd" == type) {
2404                                            adjTitle = param.artistName + "의 " + param.mvdName + " 좋아합니다!"
2405                                        } else {
2406                                            if ("djm" == type) {
2407                                                adjTitle = param.magaznNickname + "의 " + param.magaznName + " 좋아합니다!"
2408                                            } else {
2409                                                if ("mus" == type) {
2410                                                    adjTitle = "[" + param.cateName + "]" + param.mstoryTitle
2411                                                } else {
2412                                                    if ("nws" == type) {
2413                                                        adjTitle = param.message;
2414                                                        longUrl = DeployPhaseUtils.convertUrl("http://m.melon.com/pda/msvc/snsGatePage.jsp?type=art&sId=") + contsId + "&menuId=" + menuId;
2415                                                        longUrl = longUrl + "&frm=nws"
2416                                                    } else {
2417                                                        if ("ntz" == type) {
2418                                                            adjTitle = "멜론 주간 어워드 투표 진행중! 빨리 투표에 참여하세요"
2419                                                        } else {
2420                                                            if ("apl" == type) {
2421                                                                adjTitle = param.artistNameWebList + "의 " + param.playlistName + " 좋아합니다!"
2422                                                            }
2423                                                        }
2424                                                    }
2425                                                }
2426                                            }
2427                                        }
2428                                    }
2429                                }
2430                            }
2431                        }
2432                    }
2433                }
2434                cbUrl = melon.sns.getShortenUrl({
2435                    longUrl: longUrl,
2436                    type: type,
2437                    ref: "nate",
2438                    contsId: contsId,
2439                    menuId: menuId
2440                });
2441                melon.sns.outPostingLog("nate", type, contsId);
2442                strStatus = "u=" + cbUrl + "&t=" + encodeURIComponent(adjTitle);
2443                strStatus = encodeURIComponent(adjTitle + " " + cbUrl + " #MelOn");
2444                var nateURL = "http://api.nateon.nate.com/web/note/SendNote.do?msg=" + encodeURIComponent(adjTitle) + "&lurl=" + encodeURIComponent(cbUrl);
2445                window.open(nateURL, "note", "width=500,height=540,scrollbars=no,resizable=no")
2446            },
2447            getShortenUrl: function(param) {
2448                var url = "/sns/snsposting_informShortenUrl.json";
2449                if (param != null && param.ref != null && param.ref != undefined) {
2450                    url += "?ref=" + param.ref;
2451                    param.longUrl += "&ref=" + param.ref
2452                }
2453                if (param != null && param.type != null && typeof(param.type) != undefined) {
2454                    if (url.indexOf("?") != -1) {
2455                        url += "&page=" + param.type;
2456                        param.longUrl += "&page=" + param.type
2457                    } else {
2458                        url += "?page=" + param.type;
2459                        param.longUrl += "?page=" + param.type
2460                    }
2461                }
2462                if (param != null && param.menuId != null && typeof(param.menuId) != undefined) {
2463                    if (url.indexOf("?") != -1) {
2464                        url += "&menuId=" + param.menuId
2465                    } else {
2466                        url += "?menuId=" + param.menuId
2467                    }
2468                }
2469                if (param != null && param.contsId != null && typeof(param.contsId) != undefined) {
2470                    if (url.indexOf("?") != -1) {
2471                        url += "&contsId=" + param.contsId;
2472                        param.longUrl += "&contsId=" + param.contsId
2473                    } else {
2474                        url += "?contsId=" + param.contsId;
2475                        param.longUrl += "?contsId=" + param.contsId
2476                    }
2477                }
2478                var shortUrl = "";
2479                param.longUrl = melon.sns.getUrlRemake({
2480                    url: param.longUrl
2481                });
2482                $.ajax({
2483                    type: "GET",
2484                    url: melon.sns.getUrlRemake({
2485                        url: url
2486                    }),
2487                    data: "longUrl=" + encodeURIComponent(param.longUrl),
2488                    dataType: "json",
2489                    async: false,
2490                    success: function(json) {
2491                        var jsonObj = JSON.parse(json.resultStr);
2492                        shortUrl = jsonObj.results[param.longUrl].shortUrl
2493                    }
2494                });
2495                return shortUrl
2496            },
2497            getShortenUrl2: function(param) {
2498                var url = "/sns/snsposting_informShortenUrl.json";
2499                if (param != null && param.ref != null && param.ref != undefined) {
2500                    url += "?ref=" + param.ref
2501                }
2502                if (param != null && param.type != null && typeof(param.type) != undefined) {
2503                    if (url.indexOf("?") != -1) {
2504                        url += "&page=" + param.type
2505                    } else {
2506                        url += "?page=" + param.type
2507                    }
2508                }
2509                if (param != null && param.menuId != null && typeof(param.menuId) != undefined) {
2510                    if (url.indexOf("?") != -1) {
2511                        url += "&menuId=" + param.menuId
2512                    } else {
2513                        url += "?menuId=" + param.menuId
2514                    }
2515                }
2516                if (param != null && param.contsId != null && typeof(param.contsId) != undefined) {
2517                    if (url.indexOf("?") != -1) {
2518                        url += "&contsId=" + param.contsId
2519                    } else {
2520                        url += "?contsId=" + param.contsId
2521                    }
2522                }
2523                var shortUrl = "";
2524                $.ajax({
2525                    type: "GET",
2526                    url: melon.sns.getUrlRemake({
2527                        url: url
2528                    }),
2529                    data: "longUrl=" + encodeURIComponent(param.longUrl),
2530                    dataType: "json",
2531                    async: false,
2532                    success: function(json) {
2533                        var jsonObj = JSON.parse(json.resultStr);
2534                        shortUrl = jsonObj.results[param.longUrl].shortUrl
2535                    }
2536                });
2537                return shortUrl
2538            },
2539            getUrlRemake: function(param) {
2540                var da = new Date();
2541                var millisecond = da.getMilliseconds();
2542                var url = param.url;
2543                if (url.indexOf("?") >= 0) {
2544                    url = url + "&ajax_ts=" + millisecond
2545                } else {
2546                    url = url + "?ajax_ts=" + millisecond
2547                }
2548                return url
2549            },
2550            formatDate: function(date, gubun) {
2551                var returnDate = "";
2552                if (date == null || date == "" || date.length < 8) {
2553                    return returnDate
2554                } else {
2555                    if (date == "00000000") {
2556                        returnDate = ""
2557                    } else {
2558                        var year = date.substring(0, 4);
2559                        var month = date.substring(4, 6);
2560                        var day = date.substring(6, 8);
2561                        if (year != "0000" && year != "") {
2562                            returnDate = year
2563                        }
2564                        if (month != "00" && month != "") {
2565                            returnDate += gubun + month
2566                        }
2567                        if (day != "0000" && day != "") {
2568                            returnDate += gubun + day
2569                        }
2570                    }
2571                    return returnDate
2572                }
2573            },
2574            outPostingLog: function(ref, page, sId) {
2575                if (page != undefined && page == "playlist") {
2576                    page = "ply"
2577                }
2578                if (page != undefined && page == "oalbum") {
2579                    page = "djc"
2580                }
2581                var memberKey = getMemberKey();
2582                $.ajax({
2583                    type: "POST",
2584                    url: "/sns/snsposting_outPostingLog.json",
2585                    data: {
2586                        ref: ref,
2587                        page: page,
2588                        sId: sId,
2589                        uKey: memberKey
2590                    },
2591                    success: function(result) {}
2592                })
2593            },
2594            getImgUrlByWidth: function(imgUrl, width) {
2595                if (imgUrl == null || imgUrl == undefined) {
2596                    return ""
2597                }
2598                var dotIdx = imgUrl.lastIndexOf(".");
2599                if (dotIdx < 0) {
2600                    return ""
2601                }
2602                var preFix = imgUrl.substring(0, dotIdx);
2603                var postFix = imgUrl.substring(dotIdx, imgUrl.length);
2604                return preFix + "_" + width + postFix
2605            }
2606        },
2607        show: {
2608            moreButton: function(id, height, buttonTarget) {
2609                var realHeight = $("#" + id).height();
2610                $("#" + id).css("height", height + "px");
2611                if (height < realHeight) {
2612                    if (buttonTarget != null && buttonTarget != "") {
2613                        $("#" + buttonTarget).show()
2614                    } else {
2615                        $(".arrow_d").show()
2616                    }
2617                }
2618            }
2619        }
2620    }, commentObj = {
2621        goArtistDtl: function(artistId) {
2622            MELON.WEBSVC.POC.link.goArtistDetail(artistId, 0)
2623        },
2624        goVideoDtl: function(menuId, mvId) {
2625            MELON.WEBSVC.POC.link.goMvDetail(menuId, mvId, "")
2626        },
2627        goAlbumDtl: function(albumId) {
2628            MELON.WEBSVC.POC.link.goAlbumDetail(albumId)
2629        },
2630        goSongDtl: function(songId) {
2631            MELON.WEBSVC.POC.link.goSongDetail(songId)
2632        },
2633        playSong: function(menuId, contentId, isAdultContent) {
2634            MELON.WEBSVC.POC.play.playSong(menuId, contentId)
2635        },
2636        playAlbum: function(menuId, albumId) {
2637            MELON.WEBSVC.POC.play.playAlbum(menuId, albumId)
2638        },
2639        goLogIn: function() {
2640            //MELON.WEBSVC.POC.login.loginPopupLayerd()
2641        	melon.login.loginPopup(1);
2642        },
2643        goBuyProduct: function(formName, contsId, contsType, paramsName, buyType, menuId, exceptAll) {
2644            MELON.WEBSVC.POC.buy.goBuyProduct(formName, contsId, contsType, paramsName, buyType, menuId, exceptAll)
2645        }
2646    };
2647    var melonPlayerPakage__ = "MelonWebLinker.MelonLinker.1";
2648    var melonPlayerVersion__ = "5,14,613,13";
2649    var melonPlayerFunc = {
2650        getMelonPlayerObject: function() {
2651            var melonPlayerObject = "";
2652            var tmpAgent = navigator.userAgent.toUpperCase();
2653            if (tmpAgent.indexOf("MSIE") > -1 || tmpAgent.indexOf("TRIDENT") > -1) {
2654                melonPlayerObject += '<OBJECT ID="MelonWebLinker" WIDTH="0" HEIGHT="0" ';
2655                melonPlayerObject += 'codebase="' + DeployPhaseUtils.convertUrl('http://www.melon.com/resource/cab/webplayer/MelonWebLinker.cab#version=') + melonPlayerVersion__ + '" ';
2656                melonPlayerObject += 'classid="clsid:C6710B89-FB87-4CE8-A719-565767E70D27">';
2657                melonPlayerObject += "</OBJECT>"
2658            } else {
2659                if (tmpAgent.indexOf("SAFARI") > -1) {
2660                    melonPlayerObject += '<object id="MelonWebLinker" type="application/x-melonweblinker" width="0" height="0" ></object>'
2661                } else {
2662                    if (tmpAgent.indexOf("APPLEWEBKIT/5") > -1) {
2663                        melonPlayerObject += '<object id="MelonWebLinker" type="application/x-melonweblinker" width="0" height="0" ></object>'
2664                    } else {
2665                        if (tmpAgent.indexOf("MAC") > -1) {
2666                            melonPlayerObject += '<object id="MelonWebLinker" type="application/x-melonweblinker" width="0" height="0" ></object>'
2667                        } else {
2668                            if (tmpAgent.indexOf("FIREFOX") > -1) {
2669                                melonPlayerObject = '<object id="MelonWebLinker" type="application/x-melonweblinker" width="0" height="0">';
2670                                melonPlayerObject += "</object>"
2671                            } else {
2672                                if (tmpAgent.indexOf("CHROME") > -1) {
2673                                    melonPlayerObject += '<object id="MelonWebLinker" type="application/x-melonweblinker" width="0" height="0" ></object>'
2674                                } else {
2675                                    melonPlayerObject += '<object id="MelonWebLinker" type="application/x-melonweblinker" width="0" height="0" ></object>'
2676                                }
2677                            }
2678                        }
2679                    }
2680                }
2681            }
2682            return melonPlayerObject
2683        },
2684        chkMelonPlayerObject: function() {
2685            try {
2686                var packager = new ActiveXObject(melonPlayerPakage__);
2687                if (packager) {
2688                    return true
2689                } else {
2690                    return false
2691                }
2692            } catch (err) {
2693                return false
2694            }
2695        },
2696        browser: function() {
2697            var tmpAgent = navigator.userAgent.toUpperCase();
2698            var tmpBrowser = "ie";
2699            if (tmpAgent.indexOf("MSIE") > -1 || tmpAgent.indexOf("TRIDENT") > -1) {
2700                tmpBrowser = "ie"
2701            } else {
2702                if (tmpAgent.indexOf("OPR") > -1 || tmpAgent.indexOf("OPERA") > -1) {
2703                    tmpBrowser = "opera"
2704                } else {
2705                    if (tmpAgent.indexOf("CHROME") > -1) {
2706                        tmpBrowser = "chrome"
2707                    } else {
2708                        if (tmpAgent.indexOf("SAFARI") > -1) {
2709                            tmpBrowser = "safari"
2710                        } else {
2711                            if (tmpAgent.indexOf("MAC") > -1) {
2712                                tmpBrowser = "chrome"
2713                            } else {
2714                                if (tmpAgent.indexOf("FIREFOX") > -1) {
2715                                    tmpBrowser = "firefox"
2716                                } else {
2717                                    if (tmpAgent.indexOf("APPLEWEBKIT/5") > -1) {
2718                                        tmpBrowser = "safari"
2719                                    } else {
2720                                        if (tmpAgent.indexOf("EDGE") > -1) {
2721                                            tmpBrowser = "edge"
2722                                        } else {
2723                                            tmpBrowser = "none"
2724                                        }
2725                                    }
2726                                }
2727                            }
2728                        }
2729                    }
2730                }
2731            }
2732            return tmpBrowser
2733        }
2734    };
2735    var PARAM_DELIMITER = "�";
2736    var PARAM_DELIMITER_END = ":";
2737    var itemFlagArray = new Array();
2738    var itemIdArray = new Array();
2739    var contentFlagArray = new Array();
2740    var playItem = "";
2741    var downloadItem = "";
2742    var PLAYER_RETURN = "";
2743    var PLAYER_RETURN_SUCCESS = "RETURN_TOBROWSER_NEED_NOTHING";
2744    var LOGIN_KEY_CHECK = "";
2745    var LOGIN_ID_CHECK = "";
2746    var MELON_PLAYER_OCX_HTTP_HOME = DeployPhaseUtils.convertUrl("http://www.melon.com");
2747    if (typeof httpWww != "undefined" && httpWww != null && httpWww != "") {
2748        MELON_PLAYER_OCX_HTTP_HOME = httpWww
2749    }
2750    var IMAGE_HOME = DeployPhaseUtils.convertUrl("http://cdnimg.melon.co.kr");
2751    var player = {
2752        ocxPlay: function(menuId, itemFlags, itemIds, targetMemberKey) {
2753            if (typeof targetMemberKey == "undefined") {
2754                targetMemberKey = getMemberKey() == "" ? 0 : getMemberKey()
2755            }
2756            var RETURN_NOT_LOGIN = "0";
2757            var RETURN_LOGIN = "1";
2758            var SHOWCASE_ID = "121";
2759            var itemFlag = "";
2760            var itemId = "";
2761            var playList = "";
2762            if (itemFlags.length > 1) {
2763                for (var i = 0; i < itemFlags.length; i++) {
2764                    itemFlag = itemFlag + itemFlags[i];
2765                    if (i < (itemFlags.length - 1)) {
2766                        itemFlag = itemFlag + PARAM_DELIMITER
2767                    }
2768                }
2769            } else {
2770                itemFlag = itemFlags[0]
2771            }
2772            if (itemIds.length > 0) {
2773                for (var i = 0; i < itemIds.length; i++) {
2774                    itemId = itemId + itemIds[i];
2775                    itemId = itemId + PARAM_DELIMITER;
2776                    playList += itemFlags[i] + PARAM_DELIMITER + itemIds[i] + PARAM_DELIMITER + targetMemberKey + PARAM_DELIMITER + menuId + PARAM_DELIMITER + PARAM_DELIMITER_END
2777                }
2778            }
2779            player.melonplayerPlay(menuId, itemFlags, itemIds, playList)
2780        },
2781        melonplayerActualPlay: function(params) {
2782            var IS_INPUT_AUTHENTICATION_ADULT_PWD = getCookie("IS_INPUT_AUTHENTICATION_ADULT_PWD");
2783            var memberAuthFlg = isMemberAdult();
2784            var p_sessionAuthYN = IS_INPUT_AUTHENTICATION_ADULT_PWD == "Y" ? "1" : "0";
2785            var p_realNameYN = isRealNameFlag();
2786            var p_adultYN = isMemberAdult() == "0" ? "0" : "1";
2787            var p_adultOptAutoYN = getMemberAuthFlg() == "3" ? "2" : getMemberAuthFlg() == "2" ? "1" : getMemberAuthFlg() == "5" ? "1" : "0";
2788            params += " /a " + p_sessionAuthYN + p_realNameYN + p_adultYN + p_adultOptAutoYN;
2789            $("body").append(melonPlayerFunc.getMelonPlayerObject());
2790            var MELON_PLAYER = document.getElementById("MelonWebLinker");
2791            if (params.indexOf("ie") > -1) {
2792                if (!melonPlayerFunc.chkMelonPlayerObject()) {
2793                    if (getCookie("melon_player_setup_status") != "1") {
2794                        alert(" 멜론플레이어가 정상적으로 설치되지 않았습니다.\n 멜론플레이어 설치가 필요합니다.");
2795                        setCookie("melon_player_setup_status", "1", 10, "/", "");
2796                        return
2797                    }
2798                    setTimeout("melonplayerActualPlay('" + params + "')", 1000)
2799                } else {
2800                    if (MELON_PLAYER && MELON_PLAYER != null) {
2801                        try {
2802                            MELON_PLAYER.MelOnInvoke(params)
2803                        } catch (e) {}
2804                        setCookie("melon_player_setup_status", "0", -1, "/", "");
2805                        return
2806                    }
2807                }
2808            } else {
2809                if (params.indexOf("chrome") > -1) {
2810                    var isPlugInSetup = false;
2811                    var plugInNameStr = "";
2812                    for (var idx = 0; idx < navigator.plugins.length; idx++) {
2813                        plugInNameStr += navigator.plugins[idx].name + ", ";
2814                        if (navigator.plugins[idx].name.indexOf("MelOnWebLinker") > -1) {
2815                            isPlugInSetup = true
2816                        }
2817                    }
2818                    if (isPlugInSetup) {
2819                        MELON_PLAYER.MelOnInvoke(params)
2820                    } else {
2821                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/plugin/popup/plugin_install.htm"), "_blank", "width=560, height=330, location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=no,status=no")
2822                    }
2823                } else {
2824                    var isPlugInSetup = false;
2825                    for (var idx = 0; idx < navigator.plugins.length; idx++) {
2826                        if (navigator.plugins[idx].name.indexOf("MelOnWebLinker") > -1) {
2827                            isPlugInSetup = true
2828                        }
2829                    }
2830                    if (isPlugInSetup) {
2831                        MELON_PLAYER.MelOnInvoke(params)
2832                    } else {
2833                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/plugin/popup/plugin_install.htm"), "_blank", "width=560, height=330, location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=no,status=no")
2834                    }
2835                }
2836            }
2837        },
2838        melonplayerActualPlaySocket: function(menuId, itemFlags, itemList) {
2839            var IS_INPUT_AUTHENTICATION_ADULT_PWD = getCookie("IS_INPUT_AUTHENTICATION_ADULT_PWD");
2840            var memberAuthFlg = isMemberAdult();
2841            var p_sessionAuthYN = IS_INPUT_AUTHENTICATION_ADULT_PWD == "Y" ? "1" : "0";
2842            var p_realNameYN = isRealNameFlag();
2843            var p_adultYN = isMemberAdult() == "0" ? "0" : "1";
2844            var tmpMemberAuthFlg = getMemberAuthFlg();
2845            var p_adultOptAutoYN = tmpMemberAuthFlg == "3" ? "2" : tmpMemberAuthFlg == "2" ? "1" : tmpMemberAuthFlg == "5" ? "1" : "0";
2846            var p_command = itemFlags == "smart" ? "smartradio" : "play";
2847            var fromMPS = getCookie("MPS");
2848            var fromMPSYn = fromMPS == null || fromMPS.indexOf("MELONPLAYER") < 0;
2849            if (fromMPSYn) {
2850                var rParam = {
2851                    USERID: getMemberId()+ "," + getMemberToken() ,
2852                    USERNO: getMemberKey(),
2853                    COMMAND: p_command,
2854                    BROWSER: navigator.userAgent,
2855                    SESSIONAUTH: p_sessionAuthYN,
2856                    REALNAMETYPE: p_realNameYN,
2857                    ADULTTYPE: p_adultYN,
2858                    PASSWORDAUTOOPTION: p_adultOptAutoYN,
2859                    LOGINTIME: "201506041145",
2860                    LIST: itemList
2861                };
2862                $.fn.chkNotifyInstalled();
2863                var localCnt = 0;
2864                var retry = setInterval(function() {
2865                    if ($.isNotifyInstalled) {
2866                        $.fn.socketPlay(JSON.stringify(rParam))
2867                    }
2868                    localCnt++;
2869                    if (localCnt == 5 || $.isNotifyInstalled) {
2870                        clearInterval(retry);
2871                        if (!$.isNotifyInstalled) {}
2872                    }
2873                }, 1500)
2874            } else {
2875                if (itemList.length > 1) {
2876                    var itemsInfo = new MelOnAPIHelper();
2877                    for (var idx = 0; idx < itemList.length; idx++) {
2878                        itemsInfo.append(itemList[idx].itemIDType, itemList[idx].itemID, itemList[idx].statisticID)
2879                    }
2880                    var itemInfo = unescape(JSON.stringify(itemsInfo).replace(/\\u/g, "%u"));
2881                    if (itemFlags == "smart") {
2882                        MelonAPI.action("smartRadioDetailTabOpen", itemInfo)
2883                    } else {
2884                        MelonAPI.action("listenMusic", itemInfo)
2885                    }
2886                } else {
2887                    for (var idx = 0; idx < itemList.length; idx++) {
2888                        var itemInfo = unescape(JSON.stringify(itemList[idx]).replace(/\\u/g, "%u"));
2889                        if (itemFlags == "smart") {
2890                            MelonAPI.action("smartRadioDetailTabOpen", itemInfo)
2891                        } else {
2892                            MelonAPI.action("listenMusic", itemInfo)
2893                        }
2894                    }
2895                }
2896            }
2897        },
2898        melonplayerActualPlayHighVdo: function(params) {
2899            var IS_INPUT_AUTHENTICATION_ADULT_PWD = getCookie("IS_INPUT_AUTHENTICATION_ADULT_PWD");
2900            var memberAuthFlg = isMemberAdult();
2901            var p_sessionAuthYN = IS_INPUT_AUTHENTICATION_ADULT_PWD == "Y" ? "1" : "0";
2902            var p_realNameYN = isRealNameFlag();
2903            var p_adultYN = isMemberAdult() == "0" ? "0" : "1";
2904            var p_adultOptAutoYN = "1";
2905            params += " /a " + p_sessionAuthYN + p_realNameYN + p_adultYN + p_adultOptAutoYN;
2906            $("body").append(melonPlayerFunc.getMelonPlayerObject());
2907            var MELON_PLAYER = document.getElementById("MelonWebLinker");
2908            if (params.indexOf("ie") > -1) {
2909                if (!melonPlayerFunc.chkMelonPlayerObject()) {
2910                    if (getCookie("melon_player_setup_status") != "1") {
2911                        alert(" 멜론플레이어가 정상적으로 설치되지 않았습니다.\n 멜론플레이어 설치가 필요합니다.");
2912                        setCookie("melon_player_setup_status", "1", 10, "/", "");
2913                        return
2914                    }
2915                    setTimeout("melonplayerActualPlay('" + params + "')", 1000)
2916                } else {
2917                    if (MELON_PLAYER && MELON_PLAYER != null) {
2918                        try {
2919                            MELON_PLAYER.MelOnInvoke(params)
2920                        } catch (e) {}
2921                        setCookie("melon_player_setup_status", "0", -1, "/", "");
2922                        return
2923                    }
2924                }
2925            } else {
2926                if (params.indexOf("chrome") > -1) {
2927                    var isPlugInSetup = false;
2928                    var plugInNameStr = "";
2929                    for (var idx = 0; idx < navigator.plugins.length; idx++) {
2930                        plugInNameStr += navigator.plugins[idx].name + ", ";
2931                        if (navigator.plugins[idx].name.indexOf("MelOnWebLinker") > -1) {
2932                            isPlugInSetup = true
2933                        }
2934                    }
2935                    if (isPlugInSetup) {
2936                        MELON_PLAYER.MelOnInvoke(params)
2937                    } else {
2938                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/plugin/popup/plugin_install.htm"), "_blank", "width=560, height=330, location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=no,status=no")
2939                    }
2940                } else {
2941                    var isPlugInSetup = false;
2942                    for (var idx = 0; idx < navigator.plugins.length; idx++) {
2943                        if (navigator.plugins[idx].name.indexOf("MelOnWebLinker") > -1) {
2944                            isPlugInSetup = true
2945                        }
2946                    }
2947                    if (isPlugInSetup) {
2948                        MELON_PLAYER.MelOnInvoke(params)
2949                    } else {
2950                        window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/plugin/popup/plugin_install.htm"), "_blank", "width=560, height=330, location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=no,status=no")
2951                    }
2952                }
2953            }
2954        },
2955        melon_ocx_message: function(PLAYER_RETURN) {
2956            if (PLAYER_RETURN == 0) {
2957                return PLAYER_RETURN_SUCCESS
2958            } else {
2959                if (PLAYER_RETURN == 1) {
2960                    if (confirm("음악을 듣기 위해서는 멜론 플레이어가 설치되어 있어야 합니다..\n멜론 플레이어를 설치하시겠습니까?")) {
2961                        document.location.href = DeployPhaseUtils.convertUrl("http://appsvr.melon.com/cabv40/Melon4Setup.exe")
2962                    }
2963                    return "RETURN_TOBROWSER_NEED_INSTALL"
2964                } else {
2965                    if (PLAYER_RETURN == -1) {
2966                        alert("쿠키 정보가 없습니다 : ERROR_CODE=[RETURN_TOBROWSER_FAILURE_COOKIE]");
2967                        return "RETURN_TOBROWSER_FAILURE_COOKIE"
2968                    } else {
2969                        if (PLAYER_RETURN == -2) {
2970                            alert("오류가 발생했습니다. 잠시 후에 다시 이용해 주십시오.");
2971                            return "RETURN_TOBROWSER_FAILURE_HTTPCALL"
2972                        } else {
2973                            if (PLAYER_RETURN == -3) {
2974                                alert("오류가 발생했습니다. 잠시 후에 다시 이용해 주십시오.");
2975                                return "RETURN_TOBROWSER_FAILURE_HTTPCALL_STATUS"
2976                            } else {
2977                                if (PLAYER_RETURN == -4) {
2978                                    return PLAYER_RETURN_SUCCESS
2979                                } else {
2980                                    if (PLAYER_RETURN == -5) {
2981                                        alert("사용자 정보가 불충합니다. 잠시 후에 다시 이용해 주십시오.");
2982                                        return "RETURN_TOBROWSER_FAILURE"
2983                                    } else {
2984                                        if (PLAYER_RETURN == -6) {
2985                                            alert("서버와의 통신상에 Error가 발생했습니다. \n잠시 후에 다시 이용해 주십시오.");
2986                                            return "RETURN_TOBROWSER_FAILURE"
2987                                        } else {
2988                                            if (PLAYER_RETURN == -10001) {
2989                                                alert("오류가 발생했습니다. 잠시 후에 다시 이용해 주십시오.");
2990                                                return "RETURN_TOBROWSER_FAILURE"
2991                                            } else {
2992                                                if (PLAYER_RETURN == -10204) {
2993                                                    alert("권리사의 요청으로 서비스가 일시 중지된 곡입니다.");
2994                                                    return "RETURN_TOBROWSER_FAILURE"
2995                                                } else {
2996                                                    if (PLAYER_RETURN == -10201) {
2997                                                        alert("음악 정보가 존재하지 않습니다.");
2998                                                        return "RETURN_TOBROWSER_FAILURE"
2999                                                    } else {
3000                                                        if (PLAYER_RETURN == -10202) {
3001                                                            alert("앨범 정보가 존재하지 않습니다.");
3002                                                            return "RETURN_TOBROWSER_FAILURE"
3003                                                        } else {
3004                                                            if (PLAYER_RETURN == -10203) {
3005                                                                alert("상품 정보가 존재하지 않습니다.");
3006                                                                return "RETURN_TOBROWSER_FAILURE"
3007                                                            } else {
3008                                                                if (PLAYER_RETURN == -10300) {
3009                                                                    alert("구매하지 않은 음악입니다.");
3010                                                                    return "RETURN_TOBROWSER_FAILURE"
3011                                                                } else {
3012                                                                    if (PLAYER_RETURN == -10301) {
3013                                                                        alert("선물 받지 않은 음악입니다.");
3014                                                                        return "RETURN_TOBROWSER_FAILURE"
3015                                                                    } else {
3016                                                                        if (PLAYER_RETURN == -10302) {
3017                                                                            alert("다운로드 기간이 지났습니다.");
3018                                                                            return "RETURN_TOBROWSER_FAILURE"
3019                                                                        } else {
3020                                                                            if (PLAYER_RETURN == -10406) {
3021                                                                                alert("오류가 발생했습니다. 잠시 후에 다시 이용해 주십시오.");
3022                                                                                return "RETURN_TOBROWSER_FAILURE"
3023                                                                            } else {
3024                                                                                if (PLAYER_RETURN == -10409) {
3025                                                                                    alert("오류가 발생했습니다. 잠시 후에 다시 이용해 주십시오.");
3026                                                                                    return "RETURN_TOBROWSER_FAILURE"
3027                                                                                } else {
3028                                                                                    if (PLAYER_RETURN == -10207) {
3029                                                                                        location.href = "/cds/common/web/popnotice_list.htm?ptype=NL";
3030                                                                                        return "RETURN_TOBROWSER_FAILURE"
3031                                                                                    } else {
3032                                                                                        if (PLAYER_RETURN < 0) {
3033                                                                                            alert("오류가 발생했습니다. 잠시 후에 다시 이용해 주십시오.");
3034                                                                                            return "RETURN_TOBROWSER_FAILURE"
3035                                                                                        } else {
3036                                                                                            return ""
3037                                                                                        }
3038                                                                                    }
3039                                                                                }
3040                                                                            }
3041                                                                        }
3042                                                                    }
3043                                                                }
3044                                                            }
3045                                                        }
3046                                                    }
3047                                                }
3048                                            }
3049                                        }
3050                                    }
3051                                }
3052                            }
3053                        }
3054                    }
3055                }
3056            }
3057        },
3058        melonplayerPlay: function(menuId, itemFlags, itemIds, playList) {
3059            var params = "/c ";
3060//            if (isMelonLogin()) {
3061            if(true) {
3062                var tmpItemIds = "";
3063                var arrItemIds = String(itemIds).split(",");
3064                var itemIdsLen = 1;
3065                var cmpBrowser = melonPlayerFunc.browser();
3066                var fromMPS = getCookie("MPS");
3067                var fromMPSYn = fromMPS == null || fromMPS.indexOf("MELONPLAYER") < 0;
3068                var tmpObj = new Object();
3069                var itemList = [];
3070                if (menuId == "") {
3071                    menuId = "58611"
3072                }
3073                if (itemFlags == "smart") {
3074                    var parsedPlaylist = playList.replace(/�/gi, "^");
3075                    var poArr = parsedPlaylist.split("^");
3076                    if (fromMPSYn) {
3077                        if (cmpBrowser == "chrome" || cmpBrowser == "edge" || cmpBrowser == "safari" || cmpBrowser == "firefox") {
3078                            tmpObj = {
3079                                CHID: poArr[0],
3080                                CHINFO: poArr[1],
3081                                CHYEAR: poArr[2],
3082                                STATISTICID: poArr[3]
3083                            };
3084                            itemList.push(tmpObj);
3085                            player.melonplayerActualPlaySocket(menuId, itemFlags, itemList)
3086                        } else {
3087                            playList = playList;
3088                            params += "smartradio /b " + melonPlayerFunc.browser() + " /i " + getMemberId() + " /n " + getMemberKey() + " /s " + playList;
3089                            if (itemFlags == "21") {
3090                                player.melonplayerActualPlayHighVdo(params)
3091                            } else {
3092                                player.melonplayerActualPlay(params)
3093                            }
3094                        }
3095                    } else {
3096                        tmpObj = {
3097                            chinfo: poArr[1],
3098                            chid: poArr[0],
3099                            chname: "smart",
3100                            genreyear: "",
3101                            channelgubun: "A",
3102                            statisticID: poArr[3]
3103                        };
3104                        itemList.push(tmpObj);
3105                        player.melonplayerActualPlaySocket(menuId, itemFlags, itemList)
3106                    }
3107                } else {
3108                    if (itemFlags != "smart") {
3109                        if (fromMPSYn) {
3110                            if (cmpBrowser == "chrome" || cmpBrowser == "edge" || cmpBrowser == "safari" || cmpBrowser == "firefox") {
3111                                for (var idx = 0; idx < itemIds.length; idx++) {
3112                                    tmpObj = {
3113                                        ITEMFLAG: itemFlags[idx],
3114                                        ITEMID: itemIds[idx],
3115                                        FRIENDNO: getMemberKey(),
3116                                        STATISTICID: menuId
3117                                    };
3118                                    itemList.push(tmpObj)
3119                                }
3120                                player.melonplayerActualPlaySocket(menuId, itemFlags, itemList)
3121                            } else {
3122                                if (itemFlags != "4") {
3123                                    itemIdsLen = itemIds.length
3124                                } else {
3125                                    itemIdsLen = arrItemIds.length
3126                                }
3127                                playList = itemIdsLen + PARAM_DELIMITER + playList;
3128                                params += "play /b " + melonPlayerFunc.browser() + " /i " + getMemberId() + "," + getMemberToken()+ " /n " + getMemberKey() + " /s " + playList;
3129                                if (itemFlags == "21") {
3130                                    player.melonplayerActualPlayHighVdo(params)
3131                                } else {
3132                                    player.melonplayerActualPlay(params)
3133                                }
3134                            }
3135                        } else {
3136                            for (var idx = 0; idx < itemIds.length; idx++) {
3137                                tmpObj = {
3138                                    userNo: getMemberKey(),
3139                                    itemIDType: itemFlags[idx],
3140                                    itemID: itemIds[idx],
3141                                    statisticID: menuId
3142                                };
3143                                itemList.push(tmpObj)
3144                            }
3145                            player.melonplayerActualPlaySocket(menuId, itemFlags, itemList)
3146                        }
3147               
3147     }
3148                }
3149            } else {
3150                return false
3151            }
3152        },
3153        newPcpPlay: function(menuId, cType, cIds) {
3154            //연동중 모달
3155            newPcpNotice.loading.open();
3156
3157            //플레이어 설치 체크
3158            var cacheKey = getCookie("PCID");
3159            var appSchem = "melonApp://play";
3160            appSchem += "?cType=" + cType;
3161            appSchem += "&menuId=" + menuId;
3162            appSchem += "&cList=" + cIds.join(",");
3163            appSchem += "&cacheKey=" + cacheKey;
3164
3165            if (getMemberKey() != "") {
3166                $.ajax({
3167                    url: DeployPhaseUtils.convertUrl("http://www.melon.com/player/ott.json"),
3168                    dataType: "json"
3169                }).done(function(data) {
3170                    var ott = data.OTTCODE;
3171                    if (ott != "") {
3172                        appSchem += "&ott=" + ott;
3173                    }
3174                    location.href = appSchem;
3175                })
3176            } else {
3177                location.href = appSchem;
3178            }
3179            var isCache = false;
3180            //3초동안 1초마다 맴캐시에 cacheKey(PCID) 존재하는지 요청
3181            var isCacheInterval = setInterval(function() {
3182                $.ajax({
3183                    url: DeployPhaseUtils.convertUrl("http://www.melon.com//player/setup_cache.json?cacheKey=") + cacheKey,
3184                    async: false,
3185                    dataType: "json"
3186                }).done(function(data) {
3187                    if (data.ISCACHE) {
3188                        isCache = true;
3189                        newPcpNotice.loading.hide();
3190                    }
3191                });
3192                if (isCache) {
3193                    clearTimeout(isCacheInterval);
3194                }
3195            }, 1000);
3196            setTimeout(function() {
3197                //interval 종료
3198                clearTimeout(isCacheInterval);
3199
3200                //맴캐시에 uniqKey(PCID) 없을 경우 설치 유도 팝업 띄움
3201                if (!isCache) {
3202                    newPcpNotice.setup.open();
3203                    newPcpNotice.loading.hide();
3204                }
3205            }, 20000);
3206        },
3207        isWindowsLowerThan7: function() {
3208            var uaProduct = navigator.userAgent.split(" ")[0];
3209            var ua = uaProduct.length > 0 ? navigator.userAgent.replace(uaProduct, "") : navigator.userAgent;
3210            var match = ua.match(/Windows NT (\d+\.\d+)/);
3211            if (match) {
3212                var version = parseFloat(match[1]);
3213                return version < 6.1;
3214            }
3215            return false;
3216        }
3217    };
3218    $.isNotifyInstalled = false;
3219    $.fn.chkNotifyInstalled = function() {
3220        try {
3221            //console.log("ntfy install checking start.")
3222        } catch (e) {}
3223        $.isNotifyInstalled = false;
3224        var maxRetryCnt = 3;
3225        var nFailed_Count = 0;
3226        var reconnectionDelayMax = 1000;
3227        var DestinationIP = "http://127.0.0.1:46286";
3228        if ($("#notifyFrame").length < 1) {
3229            var notifyFrame = '<iframe id="notifyFrame" name="notifyFrame" width=0 height=0 src="" style="display:none;"></iframe>';
3230            $(notifyFrame).appendTo("body")
3231        }
3232        try {
3233            //console.log("ntfy install checking... connect try...")
3234        } catch (e) {}
3235        try {
3236            var connectData = {
3237                reconnection: true,
3238                reconnectionDelay: 1000,
3239                reconnectionDelayMax: 2500,
3240                reconnectionAttempts: maxRetryCnt,
3241                "force new connection": true
3242            };
3243            if (melonPlayerFunc.browser() == "ie" && navigator.userAgent.indexOf("Trident") < 0) {
3244                connectData = {
3245                    reconnection: true,
3246                    timeout: 3000,
3247                    reconnectionDelay: 1000,
3248                    reconnectionDelayMax: 2500,
3249                    reconnectionAttempts: maxRetryCnt,
3250                    "force new connection": true
3251                }
3252            }
3253            socketio = io.connect(DestinationIP, connectData)
3254        } catch (e) {
3255            //console.log(e)
3256        }
3257        socketio.on("connect", function() {
3258            try {
3259                //console.log("ntfy install checking... connect success...")
3260            } catch (e) {}
3261            try {
3262                $.isNotifyInstalled = true;
3263                nFailed_Count = 0;
3264                var checkParam = {
3265                    USERID: getMemberId(),
3266                    USERNO: getMemberKey(),
3267                    COMMAND: "compversion",
3268                    BROWSER: navigator.userAgent,
3269                    VERSIONNO: "51562415"
3270                };
3271                socketio.emit("query", JSON.stringify(checkParam))
3272            } catch (e) {}
3273        });
3274        socketio.on("result", function(result) {
3275            try {
3276                //console.log("ntfy install checking... empty result...")
3277            } catch (e) {}
3278            var rsltObj = JSON.parse(result);
3279            try {
3280                //console.log("ntfy install checking... result.STATUS" + rsltObj.STATUS)
3281            } catch (e) {}
3282            socketio.close();
3283            if (rsltObj.STATUS == "-10001") {
3284                $.isNotifyInstalled = false;
3285                maxRetryCnt = 7;
3286                nFailed_Count = 0;
3287                if (navigator.userAgent.toUpperCase().indexOf("MSIE 9") > -1 && false) {
3288                    var ie9Win = window.open("", "", "scrollbars=no,location=no,width=0,height=0,toolbar=no,left=-10,top=-10");
3289                    ie9Win.document.write("<iframe src='MelOnNtfy2:melonhandler' width=0, height=0, style='display:none;'></iframe>");
3290                    setTimeout(function() {
3291                        try {
3292                            ie9Win.location.href;
3293                            ie9Win.setTimeout("window.close()", 500)
3294                        } catch (e) {
3295                            ie9Win.close()
3296                        }
3297                    }, 1000)
3298                } else {
3299                    try {
3300                        $("#notifyFrame").attr("src", "MelOnNtfy2:melonhandler")
3301                    } catch (e) {}
3302                }
3303            }
3304        });
3305        socketio.on("connect_error", function() {
3306            try {
3307                //console.log("ntfy install checking... connect error..." + nFailed_Count)
3308            } catch (e) {}
3309            nFailed_Count++;
3310            if (nFailed_Count == 1) {
3311                try {
3312                    $("#notifyFrame").attr("src", "MelOnNtfy2:melonhandler")
3313                } catch (e) {}
3314            } else {
3315                if (nFailed_Count >= maxRetryCnt) {
3316                    nFailed_Count = 0;
3317                    try {
3318                        socketio.close()
3319                    } catch (e) {}
3320                    $.isNotifyInstalled = false;
3321                    window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/plugin/popup/melonnotify_install.htm"), "melonnotify_install", "width=560, height=330, location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=no,status=no")
3322                }
3323            }
3324        });
3325        socketio.on("disconnect", function() {
3326            try {
3327                //console.log("ntfy install checking... disconnect after connect ...")
3328            } catch (e) {}
3329        })
3330    };
3331    $.fn.optShift = function() {
3332        var end = 0,
3333            start = 0;
3334        var $chk = this;
3335        $chk.click(function(event) {
3336            start = $chk.index(event.target);
3337            if (event.shiftKey) {
3338                if (start > end) {
3339                    var temp = start;
3340                    start = end;
3341                    end = temp
3342                }
3343                for (var i = start; i < end; i++) {
3344                    if (!$chk.eq(i).is(":disabled")) {
3345                        $chk.eq(i).checked(true)
3346                    }
3347                }
3348            }
3349            end = start
3350        })
3351    };
3352    $.fn.socketPlay = function(queryVal) {
3353        var maxRetryCnt = 3;
3354        var nFailed_Count = 0;
3355        var DestinationIP = "http://127.0.0.1:46286";
3356        if ($("#notifyFrame").length < 1) {
3357            var notifyFrame = '<iframe id="notifyFrame" name="notifyFrame" width=0 height=0 src="" style="display:none;"></iframe>';
3358            $(notifyFrame).appendTo("body")
3359        }
3360        if (typeof socketio == "undefined") {
3361            try {
3362                //console.log("socketio.connect::start")
3363            } catch (e) {}
3364            try {
3365                var connectData = {
3366                    reconnection: true,
3367                    reconnectionDelay: 1000,
3368                    reconnectionDelayMax: 1000,
3369                    reconnectionAttempts: maxRetryCnt,
3370                    "force new connection": true
3371                };
3372                if (melonPlayerFunc.browser() == "ie" && navigator.userAgent.indexOf("Trident") < 0) {
3373                    connectData = {
3374                        reconnection: true,
3375                        timeout: 3000,
3376                        reconnectionDelay: 1000,
3377                        reconnectionDelayMax: 1000,
3378                        reconnectionAttempts: maxRetryCnt,
3379                        "force new connection": true
3380                    }
3381                }
3382                socketio = io.connect(DestinationIP, connectData)
3383            } catch (e) {}
3384        } else {
3385            if (socketio.disconnected) {
3386                try {
3387                    //console.log("socketio.live::disconnected:true")
3388                } catch (e) {}
3389                try {
3390                    var connectData = {
3391                        reconnection: true,
3392                        reconnectionDelay: 1000,
3393                        reconnectionDelayMax: 1000,
3394                        reconnectionAttempts: maxRetryCnt,
3395                        "force new connection": true
3396                    };
3397                    if (melonPlayerFunc.browser() == "ie" && navigator.userAgent.indexOf("Trident") < 0) {
3398                        connectData = {
3399                            reconnection: true,
3400                            timeout: 3000,
3401                            reconnectionDelay: 1000,
3402                            reconnectionDelayMax: 1000,
3403                            reconnectionAttempts: maxRetryCnt,
3404                            "force new connection": true
3405                        }
3406                    }
3407                    socketio = io.connect(DestinationIP, connectData)
3408                } catch (e) {}
3409            } else {
3410                try {
3411                    //console.log("socketio.live::disconnected:false do Nothing!!!!")
3412                } catch (e) {}
3413            }
3414        }
3415        socketio.on("connect_error", function() {
3416            try {
3417                //console.log("socketio.connect_error::nFailed_Count::" + nFailed_Count)
3418            } catch (e) {}
3419            nFailed_Count++;
3420            if (nFailed_Count == 1) {
3421                try {
3422                    $("#notifyFrame").attr("src", "MelOnNtfy2:melonhandler")
3423                } catch (e) {}
3424            } else {
3425                if (nFailed_Count >= maxRetryCnt) {
3426                    window.open(DeployPhaseUtils.convertUrl("http://www.melon.com/plugin/popup/melonnotify_install.htm"), "melonnotify_install", "width=560, height=330, location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=no,status=no");
3427                    nFailed_Count = 0;
3428                    try {
3429                        socketio.close()
3430                    } catch (e) {}
3431                }
3432            }
3433        });
3434        socketio.on("connect", function() {
3435            try {
3436                //console.log("socketio.connect::success")
3437            } catch (e) {}
3438            nFailed_Count = 0;
3439            try {
3440                socketio.emit("query", queryVal)
3441            } catch (e) {}
3442        });
3443        socketio.on("disconnect", function() {
3444            try {
3445                //console.log("socketio.disconnect::")
3446            } catch (e) {}
3447            try {
3448                $("#notifyFrame").attr("src", "")
3449            } catch (e) {}
3450        });
3451        socketio.on("result", function(result) {
3452            try {
3453                //console.log("socketio.result::" + result)
3454            } catch (e) {}
3455            try {
3456                //console.log("socketio.result::close")
3457            } catch (e) {}
3458            socketio.close();
3459            try {
3460                $("#notifyFrame").attr("src", "")
3461            } catch (e) {}
3462        })
3463    }
3464})();
3465
3466function MelOnAPIHelper() {
3467    this.LIST = Array()
3468}
3469MelOnAPIHelper.prototype.append = function(d, c, b) {
3470    var a = this.LIST.length;
3471    this.LIST[a] = {
3472        itemIDType: d,
3473        itemID: c,
3474        statisticID: b
3475    }
3476};
3477MelOnAPIHelper.prototype.stringify = (function() {
3478    return JSON.stringify(this)
3479});
3480var _FLASH_INSTALLED = false;
3481try {
3482    var v = 0;
3483    if (typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") {
3484        _FLASH_INSTALLED = true
3485    }
3486    try {
3487        v = parseFloat((new ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").match(/(.\d?),/)[1], 10);
3488        if (_FLASH_INSTALLED || v > 5) {
3489            _FLASH_INSTALLED = true
3490        }
3491    } catch (e) {}
3492} catch (e) {
3493    _FLASH_INSTALLED = false
3494}
3495getBrowserName = function() {
3496    var b = navigator.userAgent.split(" ")[0];
3497    var a = b.length > 0 ? navigator.userAgent.replace(b, "") : navigator.userAgent;
3498    if (b.indexOf("Opera") >= 0 || a.indexOf("Opera") >= 0 || b.indexOf("OPR") >= 0 || a.indexOf("OPR") >= 0) {
3499        return "Opera"
3500    }
3501    if (a.indexOf("MSIE") >= 0 || a.indexOf("Edge") >= 0) {
3502        return "Internet Explorer"
3503    }
3504    if (a.match("(Windows NT 6.3|Windows NT 6.2|Windows NT 6.1|Windows NT 10.0)") !== null && a.indexOf("Trident") >= 0) {
3505        return "Internet Explorer"
3506    }
3507    if (a.indexOf("Firefox") >= 0) {
3508        return "Firefox"
3509    }
3510    if (a.indexOf("Chrome") >= 0) {
3511        return "Google Chrome"
3512    }
3513    if (a.indexOf("Safari") >= 0) {
3514        return "Safari"
3515    }
3516    if (a.indexOf("Gecko") >= 0) {
3517        return "Gecko"
3518    }
3519    if (a.indexOf("Mozilla") >= 0) {
3520        return "Netscape"
3521    }
3522    return ""
3523};
3524webPlayerFlashAlert = function() {
3525    var b = ['<div class="layer_popup small" style="width:384px; display:none;" >', '<h1 class="layer_title">설치안내</h1>', '<div class="layer_cntt">', '<div class="box_default">', '<p class="txt_emphs">Adobe Flash Player 설치안내</p>', "<p>멜론 웹플레이어를 사용하시려면 <br/> Adobe Flash Player가 설치되어 있어야 합니다.</p>", "<p>[확인]버튼을 클릭하면, 설치 사이트로 이동합니다.</p>", "</div>", '<div class="wrap_btn_c">', '<button type="button" title="확인" class="btn_emphs_small" data-role="ok"><span class="odd_span"><span class="even_span">확인</span></span></button>', '<button type="button" title="취소" class="btn_emphs02_small d_close" data-role="cancel"><span class="odd_span"><span class="even_span">취소</span></span></button>', "</div>", "</div>", '<button type="button" title="닫기" class="btn_close d_close" data-role="ok"><span class="odd_span">닫기</span></button>', '<span class="shadow"></span>', "</div>"].join("");
3526    var c = $(b).appendTo("body").find("div.d_content").html("").end();
3527    var a = MELONTKT.PBPGN.Modal;
3528    var d = new a(c, {
3529        onOk: function() {
3530            window.open("http://get.adobe.com/kr/flashplayer/", "flashurl");
3531            self.close()
3532        }
3533    });
3534    return d.on("modalhidden", function() {
3535        c.remove()
3536    })
3537}; /* melonweb_svc.js */
3538
3539//맥플레이어 안내 팝업
3540var macinterval;
3541var macNotice = {
3542    open : function() {
3543        var popform = ['<div id="macplayer_popup" class="layer_popup">',
3544            '<h1 class="title">안내</h1>',
3545            '<div class="cntt">',
3546            '<p class="text_notice">MAC OS에서는 MAC용 멜론 플레이어를 통해 음악을 <br />감상할 수 있습니다. 멜론 플레이어가 설치 되어있지 <br />않은 경우 App Store에서 설치해 주세요.</p>',
3547            '<ul class="button_group">',
3548            '<li><a href="https://itunes.apple.com/kr/app/%EB%A9%9C%EB%A1%A0-melon/id1236050766?l=ko&ls=1&mt=12" target="_blank">앱스토어 바로가기</a></li>',
3549            '<li><a href="//www.melon.com/customer/serviceintro/multi_pc_web.htm" target="_blank">설치 방법 보기</a></li>',
3550            '</ul>',
3551            '</div>',
3552            '<button type="button" title="로그인 닫기" class="btn_close d_close"><span>닫기</span></button>',
3553            '<span class="shadow"></span>',
3554            '</div>'].join('');
3555        $(popform).appendTo('body').end();
3556        //clearInterval(this.hide)
3557        $('#macplayer_popup').modal('show');
3558        clearInterval(macinterval)	;
3559        this.hide();
3560    },
3561    hide : function() {
3562        macinterval = setInterval(function() {
3563            $('#macplayer_popup').modal('hide');
3564        }, 10000);
3565    }
3566};
3567//New Pcp 안내팝업
3568var newPcpNotice = {
3569    loading : {
3570        open : function() {
3571            $('.newpcp_pop_loading').remove();
3572            var tmpl = ['',
3573                '<div id="pcplayer_popup" class="layer_popup layer_popup_type03 newpcp_pop_loading">',
3574                '  <div class="cntt">',
3575                '    <img class="loading" src="https://cdnimg.melon.co.kr/resource/image/web/common/img_loading.gif" alt="" width="40">',
3576                '    <p class="text_notice">멜론 플레이어를 실행 중입니다.</p>',
3577                '  </div>',
3578                '  <span class="shadow"></span>',
3579                '</div>'].join('');
3580            $(tmpl).appendTo('body').end();
3581            $('.newpcp_pop_loading').modal('show');
3582        },
3583        hide : function(){
3584            $('.newpcp_pop_loading').modal('hide');
3585        }
3586    }
3587    ,setup : {
3588        open : function() {
3589            $('.newpcp_pop_setup').remove();
3590            var tmpl = ['',
3591                '<div id="pcplayer_popup" class="layer_popup layer_popup_type01 newpcp_pop_setup">',
3592                '  <div class="cntt">',
3593                '    <h1 class="title">안내</h1>',
3594                '    <p class="text_notice">해당 서비스를 이용하기 위해서는 멜론 플레이어<br>설치가 필요합니다.<br>멜론 플레이어 설치 후 다양한 멜론 서비스를 이용하세요.</p>',
3595                '    <div class="button_group">',
3596                '      <button type="button" title="플레이어 다운로드" onclick="melon6Setup();"><a href="javascript:;">플레이어 다운로드</a></button>',
3597                '    </div>',
3598                '  </div>',
3599                '  <button type="button" title="팝업 닫기" class="btn_close d_close"><span>팝업 닫기</span></button>',
3600                '  <span class="shadow"></span>',
3601                '</div>'].join('');
3602            $(tmpl).appendTo('body').end();
3603            $('.newpcp_pop_setup').modal('show');
3604        },
3605        hide : function(){
3606            $('.newpcp_pop_setup').modal('hide');
3607        }
3608    }
3609};
3610
3611function melon6Setup(){
3612    var osInfoVar = getOsInfo();
3613
3614    var aboveWindows10DownloadUrl = "https://cdnstatic.melon.co.kr/svc/pcp/apps/w10/MelonSetup.exe";
3615    var belowWindows10DownloadUrl = "https://cdnstatic.melon.co.kr/svc/pcp/apps/MelonSetup.exe";
3616
3617    if(MELON.WEBSVC.POC.isTablet()){
3618        window.open('//www.melon.com/error_page/error_tabletTypeC.html','tabletPopTypeC','scrollbars=no, resizable=no, location=no, width=560, height=273');
3619        return;
3620    } else {
3621        if(osInfoVar.toUpperCase().indexOf('WINDOWS') > -1){
3622
3623            var uaProduct = navigator.userAgent.split(" ")[0];
3624            var ua = uaProduct.length > 0 ? navigator.userAgent.replace(uaProduct, "") : navigator.userAgent;
3625
3626            //크롬에서 windows10이하 지원 종료로 인해 userAgent 정확한 체크 어려움
3627            //따라서 버전 체크를 통해 분기 (크롬 110 버전미만인 경우 윈도우10미만으로 간주)
3628            if(ua.indexOf('Chrome') > -1){
3629                if(getChromeVersion() != null){
3630                    if(getChromeVersion() >= '110'){
3631                        location.href = aboveWindows10DownloadUrl;
3632                    }else{
3633                        location.href = belowWindows10DownloadUrl;
3634                    }
3635                }
3636            }else{
3637                //windows10 이상
3638                if (getPlatformDist() == "") {
3639                    location.href = aboveWindows10DownloadUrl;
3640                    //windows10 이하
3641                }else{
3642                    location.href = belowWindows10DownloadUrl;
3643                }
3644            }
3645        }else{
3646            alert("해당 프로그램은 Windows에서만 설치할 수 있습니다.");
3647        }
3648    }
3649}
3650
3651function getChromeVersion() {
3652
3653    if(navigator.userAgentData == undefined){
3654        return null;
3655    }
3656
3657    if (navigator.userAgentData && navigator.userAgentData.brands) {
3658        var brands = navigator.userAgentData.brands;
3659
3660        for (var i = 0; i < brands.length; i++) {
3661            if (brands[i].brand === "Google Chrome" || brands[i].brand === "Chromium") {
3662                return brands[i].version;
3663            }
3664        }
3665    } else {
3666        return null;
3667    }
3668}
3669
3670function getOsInfo(){
3671    var uaProduct = navigator.userAgent.split(" ")[0];
3672    var ua = uaProduct.length > 0 ? navigator.userAgent.replace(uaProduct, "") : navigator.userAgent;
3673
3674    if (ua.indexOf("Windows") >= 0)
3675        return "Windows";
3676    if (ua.indexOf("CrOS") >= 0)
3677        return "Chrome";
3678    if (ua.toLowerCase().indexOf("psp") >= 0 )
3679        return "PSP";
3680    if (ua.toLowerCase().indexOf("playstation") >= 0 )
3681        return "Playstation";
3682    if (ua.indexOf("iPhone") >= 0 )
3683        return "iPhone";
3684    if (ua.indexOf("iPod") >= 0 )
3685        return "iPod";
3686    if (ua.indexOf("iPad") >= 0 )
3687        return "iPad";
3688    if (ua.indexOf("webOS") >= 0 && ua.indexOf("Pre/1.0") >= 0)
3689        return "PalmPre";
3690    if (ua.indexOf("Android 1.") >= 0 )
3691        return "UnsupportedMobileDevice";
3692    if (ua.indexOf("Android 2.") >= 0 )
3693        return "Android";
3694    if (ua.indexOf("Android 3.") >= 0 )
3695        return "Android";
3696    if (ua.indexOf("Android") >= 0 )
3697        return "Android";
3698    if (ua.indexOf("Mac") >= 0)
3699        return "Macintosh";
3700    if (ua.indexOf("Linux") >= 0)
3701        return "Linux";
3702    if (ua.toLowerCase().indexOf("sunos") >= 0)
3703        return "Solaris";
3704    if (ua.indexOf("AIX") >= 0)
3705        return "AIX";
3706    if (ua.indexOf("HP-UX") >= 0)
3707        return "HP-UX";
3708    if (ua.toLowerCase().indexOf("googlebot") >= 0 || ua.toLowerCase().indexOf("msnbot") >= 0
3709        || ua.toLowerCase().indexOf("slurp") >= 0
3710        || ua.toLowerCase().indexOf("crawler") >= 0
3711        || ua.toLowerCase().indexOf("seekbot") >= 0
3712        || ua.toLowerCase().indexOf("linkwalker") >= 0
3713        || ua.toLowerCase().indexOf("ia_archiver") >= 0
3714        || ua.toLowerCase().indexOf("atomz") >= 0
3715        || ua.toLowerCase().indexOf("gsa-crawler-www") >= 0)
3716        return "Spider";
3717
3718    return "Unknown";
3719}
3720
3721function getPlatformDist(comment) {
3722    var uaProduct = navigator.userAgent.split(" ")[0];
3723    var ua = uaProduct.length > 0 ? navigator.userAgent.replace(uaProduct, "") : navigator.userAgent;
3724
3725    if ((ua.indexOf("Windows NT 6.2") >= 0) || (ua.indexOf("Windows NT 6.3") >= 0)) {
3726        return "Windows 8";
3727    }
3728
3729    if (ua.indexOf("Windows NT 6.1") >= 0) {
3730        return "Windows 7";
3731    }
3732
3733    if (ua.indexOf("Windows NT 6.0") >= 0) {
3734        return "Vista";
3735    }
3736
3737    if (ua.match("Windows NT (5\\.1|32)") !== null || (ua.indexOf("Windows NT 5.2") >= 0 && ua.indexOf("Win64") >= 0)) {
3738        return "XP";
3739    }
3740
3741    if (ua.indexOf("Windows NT 5.2") >= 0) {
3742        return "2003";
3743    }
3744
3745    if (ua.match("Windows (NT 5\\.0|NT 5\\.01|2000)") !== null) {
3746        return "2000";
3747    }
3748
3749    if (ua.match("Windows (98; Win 9x 4\\.90|ME)") !== null) {
3750        return "ME";
3751    }
3752
3753    if (ua.match("Win(98|dows 98)") !== null) {
3754        return "98";
3755    }
3756
3757    if (ua.indexOf("Windows CE") >= 0) {
3758        return "CE";
3759    }
3760
3761    if (ua.toLowerCase().indexOf("mac os x") >= 0) {
3762        return "OSX";
3763    }
3764
3765    if (ua.indexOf("Mac_PowerPC") >= 0) {
3766        return "OS9";
3767    }
3768
3769    if (ua.indexOf("Windows 95") >= 0) {
3770        return "95";
3771    }
3772
3773    if (ua.indexOf("Windows 3.1") >= 0) {
3774        return "3.1";
3775    }
3776
3777    return "";
3778
3779}
3780//회원 정보 가져오기
3781function getMemberInfo() {
3782    var memberKey = getMemberKey();
3783    var memberInfo = null;
3784
3785    if(memberKey == null || memberKey == ''){
3786        return memberInfo;
3787    }
3788
3789    $.ajax({
3790        type: "GET",
3791        url: DeployPhaseUtils.convertUrl("http://www.melon.com/memapi/v1/profileByKey.json"),
3792        data: {
3793            memberKey : memberKey,
3794            properties : 'realNameYn,ipinBirthDate'
3795        },
3796        dataType: "json",
3797        async: false,
3798        error: function(request, status, error) {
3799            return memberInfo;
3800        },
3801        success: function(data) {
3802            if(data.RESULTCODE != undefined || data.RESULTCODE == '0' || data.MEMBERINFO != undefined){
3803                memberInfo = data.MEMBERINFO;
3804            }
3805        }
3806    });
3807    return memberInfo;
3808}
3809
3810//회원 본인/성인 정보 가져오기
3811function getMemberAuthInfo() {
3812    var memberKey = getMemberKey();
3813    var pocId = getCookie("TKT_POC_ID");
3814    var checkAgeAuthInfo = null;
3815
3816    if(memberKey == null || memberKey == ''){
3817        return checkAgeAuthInfo;
3818    };
3819
3820    var url =  DeployPhaseUtils.convertUrl("http://www.melon.com/memapi/v1/checkAgeAuthByKey.json");
3821    $.ajax({
3822        type: "GET",
3823        url: url,
3824        data: {
3825            memberKey : memberKey,
3826            pocId : pocId
3827        },
3828        dataType: 'json',
3829        async: false,
3830        error: function(request, status, error) {
3831            return checkAgeAuthInfo;
3832        },
3833        success: function(data) {
3834            if(data.RESULTCODE != undefined || data.RESULTCODE == '0' || data.CHECKAGEAUTHINFO != undefined){
3835                checkAgeAuthInfo = data.CHECKAGEAUTHINFO;
3836            }
3837        }
3838    });
3839    return checkAgeAuthInfo;
3840}
3841
3842

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.