$(document)
		.ready(
				function() {
					likes.popHtml = "		<dl>"
							+ "			<dt><strong>보관함에 추가되었습니다.</strong></dt>"
							+ "			<dd class=\"text\">담기나 좋아를 클릭하면 내 좋아보관함에<br>담기고 <strong>좋아 점수가 +1</strong> 됩니다.</dd>"
							+ "			<dd class=\"check\">"
							+ "			<input type=\"checkbox\" id=\"noMessage\" class=\"checkbox\" onclick=\"javscript:likes.setNoPop();\" /> <label for=\"noMessage\">앞으로 이 메시지 표시 안 함</label>"
							+ "			</dd>"
							+ "		</dl>"
							+ "		<div class=\"btnArea\">"
							+ "			<span class=\"button typeME\"><a href=\""
							+ g_urlMe
							+ "/library/song\" type=\"ok\">보관함 보기</a></span>"
							// + " <span class=\"button typeM\"><a
							// href=\"javascript:void(0);\"
							// onclick=\"javascript:$('div.layerPopup.noTitle.layerAddMylist').hide('blind',
							// 'normal', {}, function() {
							// $('div.layerPopup.noTitle.layerAddMylist').remove();
							// bugs.ui.modalLayer.hide(); });\">닫기</a></span>"
							+ "			<span class=\"button typeM\"><a href=\"#\" type=\"cancel\">닫기</a></span>"
							+ "		</div>";

					// likes.getPopYn();
					/*
					 * likes.popHtml = " <div class=\"layerGuide layerLike\">" + "
					 * <div class=\"content\"><p>" + " 좋아보관함 > 아티스트에 담겼습니다.
					 * <br />" + " <a href=\"#\">좋아보관함 바로가기</a>" + " </p><div
					 * class=\"btnClose\"><a
					 * href=\"javascript:void($('.layerLike').hide())\"><span>닫기</span></a></div>" + "
					 * </div>" + " <div class=\"layerBg\"></div></div>";
					 */
				});
/*
 * likes.popHtml = " <div class=\"layerGuide layerLike\">" + " <div
 * class=\"content\"><p>" + " 좋아보관함 > 아티스트에 담겼습니다. <br />" + " <a
 * href=\"#\">좋아보관함 바로가기</a>" + " </p><div class=\"btnClose\"><a
 * href=\"javascript:void($('.layerLike').hide())\"><span>닫기</span></a></div>" + "
 * </div>" + " <div class=\"layerBg\"></div></div>";
 */

if ("undefined" == typeof likes) {
	likes = {
		TYPE_TRACK : "TRACK",
		TYPE_ARTIST : "ARTIST",
		TYPE_ALBUM : "ALBUM",
		TYPE_MV : "MV",
		TYPE_PLAYLIST : "PLAYLIST",
		TYPE_MEMBER : "MEMBER",
		TYPE_MY_COMMENT : "MY_COMMENT",

		draggble_count : 0,
		draggable_pos : 0,
		draggable_ids : "",
		draggable_target : 0,
		draggable_priority : 0,
		draggable_data_reset : false,
		draggable_data_from : 0,
		drag_on : false,
		popHtml : "",
		pop : false,
		popCheck : false,
		openWindow : false,
		anchor : "",
		type : "",
		// 뉴벅스 이벤트 ===============================================
		// eventLikesType : "",
		// eventMissionLike : false,
		// ============================================================
		adds : function(id, type, callbackTrue, callbackFalse) {
			this.adds(ids, type, {}, callbackTrue, callbackFalse)
		},
		add : function(id, type, option, callbackTrue, callbackFalse) {
			// likes.eventLikesType = type; // 뉴벅스 이벤트
			likes.hideAddAlert();
			try {
				$.getJSON(g_urlLikes + "/add/" + type + "/" + id, {}, function(
						data) {

					if (data.result) {
						likes.anchor = option.anchor;
						likes.type = type;

						// if (likes.pop) likes.showAddAlert();
						if (true)
							likes.showAddAlert(); // 항상 레이어 보여줘야 함
						else if (!likes.popCheck)
							likes.getPopYn();
						// else likes.openNbugsEventPop(true); // 뉴벅스 이벤트

						if (typeof (callbackTrue) == "string")
							eval(callbackTrue);
						else if (typeof (callbackTrue) == "function")
							callbackTrue(data);
					} else {
						if (data.error_type == "NOT_LOGGED")
							bugs.ui.showLoginLayer();

						if (typeof (callbackFalse) == "string")
							eval(callbackFalse);
						else if (typeof (callbackFalse) == "function")
							callbackFalse(data);
					}
				});
			} catch (e) {
				if (typeof (callbackFalse) == "string")
					eval(callbackFalse);
				else if (typeof (callbackFalse) == "function")
					callbackFalse();
			}
		},
		adds : function(ids, type, option, callbackTrue, callbackFalse) {
			likes.hideAddAlert();
			// likes.eventLikesType = type; // 뉴벅스 이벤트
			var splitIDs = ids.split(",");
			if (splitIDs.length > 150) {
				bugs.ui.showAlert("1회에 150개까지 가능합니다.", {
					css : "layerAlert layerAdultNotice"
				});
				return;
			}
			try {
				likes.anchor = option.anchor;
				likes.type = type;				
				$.post(g_urlLikes + "/adds/" + type, {
					"ids" : ids
				}, function(data) {
					if (data.result) {

						if (true)
							likes.showAddAlert();
						else if (!likes.popCheck)
							likes.getPopYn();
						// else likes.openNbugsEventPop(true); // 뉴벅스 이벤트

						if (typeof (callbackTrue) == "string")
							eval(callbackTrue);
						else if (typeof (callbackTrue) == "function")
							callbackTrue(data);
					} else {
						if (data.error_type == "NOT_LOGGED")
							bugs.ui.showLoginLayer();
						if (data.error_type == "DB_ERROR")
							if (likes.type == "MV")
								likes.showAleadyAlert();

						if (typeof (callbackFalse) == "string")
							eval(callbackFalse);
						else if (typeof (callbackFalse) == "function")
							callbackFalse(data);
					}
				}, "json");
			} catch (e) {
				if (typeof (callbackFalse) == "string")
					eval(callbackFalse);
				else if (typeof (callbackFalse) == "function")
					callbackFalse();
			}
		},
		del : function(id, type, option, callbackTrue, callbackFalse) {
			likes.hideAddAlert();
			try {
				
				$.getJSON(g_urlLikes + "/delete/" + type + "/" + id, {},
						function(data) {
							if (data.result) {
								if (typeof (callbackTrue) == "string")
									eval(callbackTrue);
								else if (typeof (callbackTrue) == "function")
									callbackTrue(data);
							} else {
								if (data.error_type == "NOT_LOGGED")
									bugs.ui.showLoginLayer();

								if (typeof (callbackFalse) == "string")
									eval(callbackFalse);
								else if (typeof (callbackFalse) == "function")
									callbackFalse(data);
							}
						});
			} catch (e) {
				if (typeof (callbackFalse) == "string")
					eval(callbackFalse);
				else if (typeof (callbackFalse) == "function")
					callbackFalse();
			}
		},
		getPopYn : function() {
			$.getJSON(g_urlLikes + "/check/pop", {}, function(data) {
				likes.pop = data;
				likes.popCheck = true;

				if (likes.pop)
					likes.showAddAlert();
				// else likes.openNbugsEventPop(true); // 뉴벅스 이벤트
			});
		},
		setNoPop : function() {
			if ($("#noMessage").attr("checked")) {
				$.getJSON(g_urlLikes + "/set/pop/N", {}, function(data) {
					likes.pop = false;
				});
			}
		},
		deletes : function(ids, type, option, success, error) {
			likes.hideAddAlert();
			var splitIDs = ids.split(",");
			if (splitIDs.length > 150) {
				bugs.ui.showAlert("1회에 150개까지 가능합니다.", {
					css : "layerAlert layerAdultNotice"
				});
				return;
			}
			try {
				$.post(g_urlLikes + "/list/delete/" + type, {
					"ids" : ids
				}, function(data) {
					if (data.result) {
						success(data);
					} else {
						if (data.error_type == "NOT_LOGGED")
							bugs.ui.showLoginLayer();
						error(data);
					}
				}, "json");
			} catch (e) {
				error();
			}
		},
		memCount : function(id, type, success, error) {
			if (typeof error == "undefined")
				error = function() {
				};
			try {
				$.getJSON(g_urlLikes + "/count/members/" + type + "/" + id, {},
						function(data) {
							success(data);
						});
			} catch (e) {
				error();
			}
		},
		count : function(type, success, error) {
			if (typeof error == "undefined")
				error = function() {
				};
			try {
				$.getJSON(g_urlLikes + "/count/" + type, {}, function(data) {
					success(data);
				});
			} catch (e) {
				error();
			}
		},
		getCount : function(msrl, type, success, error) {
			if (typeof error == "undefined")
				error = function() {
				};
			try {
				$.getJSON(g_urlLikes + "/count/" + msrl + "/" + type, {},
						function(data) {
							success(data);
						});
			} catch (e) {
				error();
			}
		},
		goToLikeBox :function(url,winName) {
			// 개인화에서는 제창, 그 외에서는 새창
			//alert(location.href);
			if (location.href.indexOf("/user/") == -1 || typeof (bugs.mvPlayer) == "object")
				window.open(url, winName);
			else location.href = url;
		},
		showAleadyAlert : function() {
			// alert(likes.type);
			var yy = 0;
			var popMsg = "<p>이미 추가된 뮤직비디오입니다.<br /><a href=\"javascript:void(likes.goToLikeBox('" + g_urlMe
					+ "/library/mv','LIKEBOX1'));\">좋아보관함>뮤직비디오  바로가기</a></p>";
			if (likes.type == "ESALBUM" || likes.type == "PLAYLIST") {
				if ($.browser.name == "msie")
				{
					yy = 36;
					//if ($.browser.versionNumber == "6")
					//	yy = -14;
				}
			}	
			//if (!likes._successPop) {
				likes._successPop = $(
						"<div class=\"layerGuide layerLike\"><div class=\"content\">"
								+ popMsg
								+ "<div class=\"btnClose\"><a href=\"javascript:void($('.layerLike').hide())\"><span>닫기</span></a></div></div><div class=\"layerBg\"></div></div>")
						.appendTo("body");
			//}

			if (typeof (bugs.mvPlayer) == "object")
				bugs.layermenu.layerEventHandler(likes.anchor,
						likes._successPop, -10, -70);
			else {
					bugs.layermenu.layerEventHandler2(likes.anchor,
							likes._successPop, 0+yy, 0);
			}
			// likes._successPop.show();
			// likes.openNbugsEventPop(false); // 뉴벅스 이벤트
		},
		showAddAlert : function() {
			//alert(likes.type);
			
			if (likes.type == "MY_COMMENT" || likes.type == "COMMENT") return;
			
			var yy = 0;
			var xx = 0;
			var popMsg = "<p>좋아보관함에 담겼습니다. <br /><a href=\"javascript:void(likes.goToLikeBox('" + g_urlMe
					+ "/library/song','LIKEBOX1'));\">좋아보관함 바로가기</a></p>";
			if (likes.type == "MV") {
				popMsg = "<p>좋아보관함 > 뮤직비디오에 담겼습니다. <br /><a href=\"javascript:void(likes.goToLikeBox('"
						+ g_urlMe + "/library/mv','LIKEBOX2'));\">좋아보관함 바로가기</a></p>";
			} else if (likes.type == "ARTIST") {
				popMsg = "<p>좋아보관함 > 아티스트에 담겼습니다. <br /><a href=\"javascript:void(likes.goToLikeBox('" + g_urlMe
						+ "/library/artist','LIKEBOX3'));\">좋아보관함 바로가기</a></p>";
			} else if (likes.type == "ALBUM") {
				popMsg = "<p>좋아보관함 > 앨범에 담겼습니다. <br /><a href=\"javascript:void(likes.goToLikeBox('" + g_urlMe
						+ "/library/album','LIKEBOX4'));\">좋아보관함 바로가기</a></p>";
			} else if (likes.type == "ESALBUM") {
				if ($.browser.name == "msie")
				{
					yy = 36;
					if ($.browser.name == "msie" && $.browser.versionNumber == "6")
						yy = yy -33;
				}
				popMsg = "<p>좋아보관함>앨범>에센셜앨범에 담겼습니다. <br /><a href=\"javascript:void(likes.goToLikeBox('" + g_urlMe
						+ "/library/album/ESALBUM','LIKEBOX5'));\">좋아보관함 바로가기</a></p>";
			} else if (likes.type == "MEMBER") {
				popMsg = "<p>좋아보관함 > 사람에 담겼습니다. <br /><a href=\"javascript:void(likes.goToLikeBox('" + g_urlMe
				+ "/library/user','LIKEBOX6'));\">좋아보관함 바로가기</a></p>";
			} else if (likes.type == "COMMENT") {
				popMsg = "<p>좋아보관함 > 한마디에 담겼습니다. <br /><a href=\"javascript:void(likes.goToLikeBox('" + g_urlMe
				+ "/library/comment','LIKEBOX7'));\">좋아보관함 바로가기</a></p>";
			} else if (likes.type == "MY_COMMENT") {
				xx = -10;yy = 22;
				if ($.browser.name == "msie"){yy += 24}
				
				popMsg = "<p>좋아보관함 > 한마디에 담겼습니다. <br /><a href=\"javascript:void(likes.goToLikeBox('" + g_urlMe
				+ "/library/comment','LIKEBOX7'));\">좋아보관함 바로가기</a></p>";
			}else if (likes.type == "PLAYLIST") {
				if ($.browser.name == "msie")
				{
					yy = 36;
					if ($.browser.name == "msie" && $.browser.versionNumber == "6")
						yy = yy -33;
				}
				popMsg = "<p>좋아보관함>앨범>공개앨범에 담겼습니다. <br /><a href=\"javascript:void(likes.goToLikeBox('" + g_urlMe
				+ "/library/album/PLAYLIST','LIKEBOX8'));\">좋아보관함 바로가기</a></p>";
			}
			
			//if (!likes._successPop) {
				likes._successPop = $(
						"<div class=\"layerGuide layerLike\"><div class=\"content\">"
								+ popMsg
								+ "<div class=\"btnClose\"><a href=\"javascript:void($('.layerLike').hide())\"><span>닫기</span></a></div></div><div class=\"layerBg\"></div></div>")
						.appendTo("body");
			//}

			if (likes.type == "ALBUM" || likes.type == "ARTIST" || likes.type == "MEMBER" || likes.type == "MV")
			{
				if (typeof (bugs.mvPlayer) != "object" && $.browser.name == "msie" && $.browser.versionNumber == "7")
					yy = yy + likes.anchor.find("img").height();
			}
			if (likes.type == "MEMBER" && likes.anchor.find("img").height() == 27 && likes.anchor.find("img").width()==110)
				yy = yy + 8;
			if (typeof (bugs.mvPlayer) == "object")
				bugs.layermenu.layerEventHandler(likes.anchor,
						likes._successPop, -10, -70);
			else {
					bugs.layermenu.layerEventHandler2(likes.anchor,
							likes._successPop, 0+yy, 0+xx);
			}
			// likes._successPop.show();
			// likes.openNbugsEventPop(false); // 뉴벅스 이벤트
		},
		hideAddAlert : function() {
			$('.layerLike').hide();
		},
		/*
		 * setDraggable : function (JqueryObj) { JqueryObj.draggable({ appendTo :
		 * $("#movingArea"), cursorAt: { top: -12, left: -20 }, helper:
		 * function(event) { return $('<div class=\"moveBoxWrap\"><div
		 * class=\"moveBox no\"><span class=\"mark\">-</span><span
		 * class=\"songTitle\">0곡</span></div></div>'); }, start :
		 * function(ev, ui) { likes.drag_on = true;
		 * 
		 * if (likes.draggable_data_reset) { likes.draggble_count = 0;
		 * likes.draggable_ids = "";
		 * 
		 * if (likes.draggable_data_from == 1) {
		 * $(this).parent().find("TR").each( function() { if
		 * ($(this).attr("checked") == "checked") { likes.draggble_count++; if
		 * (likes.draggable_ids == "") likes.draggable_ids =
		 * $(this).find("td:first .checkbox > INPUT:first").val(); else
		 * likes.draggable_ids = likes.draggable_ids + "," +
		 * $(this).find("td:first .checkbox > INPUT:first").val(); } } ) } } },
		 * drag: function(ev, ui) { if ( likes.draggable_pos ) { if (
		 * likes.draggable_pos == 1 || likes.draggable_pos == 2 )
		 * $(".moveBoxWrap").html("<div class=\"moveBox yes\"><span
		 * class=\"mark\">+</span><span
		 * class=\"songTitle\">"+likes.draggble_count+"곡</span></div>"); if (
		 * likes.draggable_pos == 3 ) $(".moveBoxWrap").html("<div
		 * class=\"moveBox selectTrack\"><span class=\"mark\">↕</span><span
		 * class=\"songTitle\">"+likes.draggble_count+"곡</span></div>"); }
		 * else { $(".moveBoxWrap").html("<div class=\"moveBox no\"><span
		 * class=\"mark\">-</span><span
		 * class=\"songTitle\">"+likes.draggble_count+"곡</span></div>"); } },
		 * stop: function(ev, ui) { if ( likes.draggable_pos == 1 )
		 * likes.adds(likes.draggable_ids, "TRACK", function() {}, function()
		 * {}); if ( likes.draggable_pos == 2 )
		 * playlists.add(likes.draggable_target, likes.draggable_ids,
		 * function(cnt) { if (cnt > 0) { var successPop = new
		 * bugs.ui.popup($("#success"), { onInit : function(popup) { $("#success
		 * .content .putOk > P > EM").text(cnt+"곡"); $("#success .content
		 * .button > A").attr("href",
		 * g_urlMe+"/library/myalbum/"+likes.draggable_target); } });
		 * successPop.show(); setTimeout(function(){ successPop.hide('blind'); },
		 * 10000); } else { var msg = "선택된 곡은 이미 수록되어있습니다.";
		 * 
		 * bugs.ui.showAlert(msg, {css : "layerAlert layerAdultNotice"});
		 * return; } }, function(ret) { if (ret.error_type == "EXCEED") { var
		 * exceedPop = new bugs.ui.popup($("#exceed"), { onInit :
		 * function(popup) { $("#exceed .content .putFailure .button >
		 * A").attr("href", g_urlMe+"/library/myalbum/"+likes.draggable_target); }
		 * }); exceedPop.show(); setTimeout(function(){ exceedPop.hide('blind'); },
		 * 10000); } }); if ( likes.draggable_pos == 3 ) { if
		 * (trackPlaylists.sort != "PRIORITY" && trackPlaylists.sort_type !=
		 * "ASC") { var sortPop = new bugs.ui.popup($("#sortConfirm"), {});
		 * sortPop.show(); setTimeout(function(){ sortPop.hide('blind'); },
		 * 10000); } else { playlists.setPriority(likes.draggable_target,
		 * likes.draggable_ids, likes.draggable_priority, function() {
		 * trackPlaylists.sortListByPriority(likes.draggable_priority); },
		 * function() {}); } } likes.drag_on = false;
		 * 
		 * if (likes.draggable_data_reset) { likes.draggble_count = 0;
		 * likes.draggable_ids = ""; } } }); }, destroyDraggable : function
		 * (JqueryObj) { JqueryObj.draggable('destroy'); },
		 */
		checkWinSize : function() {
			if (window.innerHeight) {
				return window.innerHeight;
			} else if (document.documentElement
					&& document.documentElement.clientHeight) {
				return document.documentElement.clientHeight;
			} else if (document.body.clientHeight) {
				return document.body.clientHeight;
			}
		},
		adultLayerShow : function() {
			var msg = "해당곡은 청소년 유해매체물로서 정보통신망<br />"
					+ "이용 촉진 및 정보보호 등에 관한 법률 및<br />" + "청소년보호법의 규정에 의하여<br />"
					+ "19세 미만의 청소년이 이용할 수 없습니다. ";

			bugs.ui.showAlert(msg, {
				css : "layerAlert layerAdultNotice"
			});
		},
		addLike : function(id, type, obj) {
			likes.add(id, type, {
				anchor : $(obj)
			}, function(ret) {
				obj.find("img").attr("src",
						g_urlFile + "/common/button/new/bc_likeCancel.gif");
				obj.find("img").attr("alt", "좋아 취소");
				obj.unbind("click");
				obj.removeAttr("onclick");
				obj.bind("click", function() {
					likes.delLike(id, type, obj);
				});
			}, function() {
			});
		},
		delLike : function(id, type, obj) {
			likes.del(id, type, {
				anchor : $(obj)
			}, function(ret) {
				obj.find("img").attr("src",
						g_urlFile + "/common/button/new/bc_like.gif");
				obj.find("img").attr("alt", "좋아");
				obj.unbind("click");
				obj.removeAttr("onclick");
				obj.bind("click", function() {
					likes.addLike(id, type, obj);
				});
			}, function() {
			});
		},
		addLikeGr : function(id, type, obj, callbackTrue) {
			likes.add(id, type, {
				anchor : $(obj)
			}, function(ret) {
				obj.find("img").attr("src",
						g_urlFile + "/common/button/new/bc_likeCancel.gif");
				obj.find("img").attr("alt", "좋아 취소");
				obj.unbind("click");
				obj.removeAttr("onclick");
				obj.bind("click", function() {
					likes.delLikeGr(id, type, obj);
				});

				if (typeof (callbackTrue) == "function")
					callbackTrue();
			}, function() {
			});
		},
		delLikeGr : function(id, type, obj, callbackTrue) {
			likes.del(id, type, {
				anchor : $(obj)
			}, function(ret) {
				obj.find("img").attr("src",
						g_urlFile + "/common/button/new/bc_like.gif");
				obj.find("img").attr("alt", "좋아");
				obj.unbind("click");
				obj.removeAttr("onclick");
				obj.bind("click", function() {
					likes.addLikeGr(id, type, obj);
				});

				if (typeof (callbackTrue) == "function")
					callbackTrue();
			}, function() {
			});
		},
		addBLike : function(id, type, obj) {
			likes.add(id, type, {
				anchor : $(obj)
			}, function(ret) {
				obj.find("img").attr("src",
						g_urlFile + "/common/button/new/bbc_likeCancel.gif");
				obj.find("img").attr("alt", "좋아 취소");
				obj.unbind("click");
				obj.removeAttr("onclick");
				obj.bind("click", function() {
					likes.delBLike(id, type, obj);
				});
			}, function() {
			});
		},
		delBLike : function(id, type, obj) {
			likes.del(id, type, {
				anchor : $(obj)
			}, function(ret) {
				obj.find("img").attr("src",
						g_urlFile + "/common/button/new/bbc_like.gif");
				obj.find("img").attr("alt", "좋아");
				obj.unbind("click");
				obj.removeAttr("onclick");
				obj.bind("click", function() {
					likes.addBLike(id, type, obj);
				});
			}, function() {
			});
		},
		addMLike : function(id, type, obj) {
			likes.add(id, type, {
				anchor : $(obj)
			}, function(ret) {
				likes.memCount(id, type, function(result) {
					obj.html(result);
				});
				obj.removeClass().addClass("likeThisAction selected");
				obj.unbind("click");
				obj.removeAttr("onclick");
				obj.bind("click", function() {
					likes.delMLike(id, type, obj);
				});
			}, function() {
			});
		},
		delMLike : function(id, type, obj) {
			likes.del(id, type, {
				anchor : $(obj)
			}, function(ret) {
				likes.memCount(id, type, function(result) {
					obj.html(result);
				});
				obj.removeClass().addClass("likeThisAction");
				obj.unbind("click");
				obj.removeAttr("onclick");
				obj.bind("click", function() {
					likes.addMLike(id, type, obj);
				});
			}, function() {
			});
		},
		addPDLike : function(id, type, obj) {
			likes.add(id, type, {
				anchor : $(obj)
			},
					function(ret) {
						likes.memCount(id, type, function(result) {

							$(obj).parent().parent().find(
									"strong.pd_like_count").html(result);
						});
						$(obj).find("img").attr(
								"src",
								$(obj).find("img").attr("src").replace("O",
										"CancelB"));
						$(obj).unbind("click");
						$(obj).removeAttr("onclick");
						$(obj).bind("click", function() {
							likes.delPDLike(id, type, obj);
						});
					}, function() {
					});
		},
		delPDLike : function(id, type, obj) {
			likes.del(id, type, {
				anchor : $(obj)
			},
					function(ret) {
						likes.memCount(id, type, function(result) {
							$(obj).parent().parent().find(
									"strong.pd_like_count").html(result);
						});

						$(obj).find("img").attr(
								"src",
								$(obj).find("img").attr("src").replace(
										"CancelB", "O"));
						$(obj).unbind("click");
						$(obj).removeAttr("onclick");
						$(obj).bind("click", function() {
							likes.addPDLike(id, type, obj);
						});
					}, function() {
					});
		},
		openLoading : function(type, message) {
			var msg = "";
			if (type == "TRACK")
				msg = "곡";
			else if (type == "MV")
				msg = "뮤직비디오";
			else if (type == "ARTIST")
				msg = "뮤직비디오";
			else if (type == "MY_COMMENT")
				msg = "한마디";
			else if (type == "MEMBER")
				msg = "회원";
			else if (type == "ALBUM")
				msg = "앨범";
			else if (type == "PLAYLIST")
				msg = "앨범";
			else if (type == "ETC") {
				if (typeof (message) != "undefined") {
					msg = message;
				}
			}

			if (!likes._loadingPop)
				likes._loadingPop = new bugs.ui.popup(
						$("div.layerAlert.layerLoading"), {
							onInit : function(popup) {
								$("div.layerAlert.layerLoading .content > P")
										.html(msg + " 리스트를 불러오는 중입니다.");
							}
						});
			else
				$("div.layerAlert.layerLoading .content > P").html(
						msg + " 리스트를 불러오는 중입니다.");

			likes._loadingPop.show();
		},
		closeLoading : function() {
			likes._loadingPop.hide();
		},
		closeEventWin : function(chk, type, callback) {
			if (chk) {
				var oDate = new Date();
				oDate.setDate(oDate.getDate() + 7200);
				bugs.cookie.set(type, "true", oDate, "/");

				callback();
			}
		},
		openAlert : function(msg) {
			var msg = "<div class=\"putFailure\"><p>"
					+ msg
					+ "</p><span class=\"button typeME\"><a href=\"javascript:$('div.layerPopup.layerPutSong').remove();bugs.ui.modalLayer.hide();\">확인</a></span></div>";

			var popup = new bugs.ui.popup(msg, {
				title : "LOGO",
				css : "layerPutSong"
			});
			popup.show();
		},
		setFooterPosition : function() {
			var brName = $.browser.name;
			if (brName == "msie") {
				var verNumber = $.browser.versionNumber;
				if (verNumber == 6) {
					var bodyHeight = $("body").height();
					var windowHeight = $(window).height();
					var wrapHeight = $("#wrap").height();
					height = (windowHeight > bodyHeight ? windowHeight
							: bodyHeight) > wrapHeight ? (windowHeight > bodyHeight ? windowHeight
							: bodyHeight)
							: wrapHeight;

					var new_position = height - 35;
					$("#footer").css("top", new_position + "px");
				}
			}
		}
	/*
	 * , // 뉴벅스 이벤트 openNbugsEventPop : function(setModal) { var openPop =
	 * bugs.cookie.get("NBUGS_LIKE"); if (!openPop && likes.eventLikesType ==
	 * "ARTIST") { var html = " <div>" + " <p class=\"title\"><strong>이벤트 진행중!</strong><br />“좋아”
	 * 미션을 완료하셨습니다.</p>" + " <p><a href=\""+g_urlWww+"/event/nbugs\">이벤트 보기</a></p>" + "
	 * <p class=\"checkbox\"><input name=\"\" type=\"checkbox\" value=\"\"
	 * onclick=\"javascript:likes.closeEventWin(this.checked, 'NBUGS_LIKE',
	 * function() { $('div.layerPopup.layerEvent250').hide();
	 * bugs.ui.modalLayer.hide(); });\" />5일동안 이 메시지 표시 안 함</p>" + " <span
	 * class=\"button typeME\"><button type=\"button\"
	 * onclick=\"javascript:$('div.layerPopup.layerEvent250').hide();";
	 * 
	 * if (setModal) html = html + "bugs.ui.modalLayer.hide();";
	 * 
	 * html = html + "\">확인</button></span>" + " </div>";
	 * 
	 * if (likes.eventMissionLike) { successPop = new bugs.ui.popup(html, {title :
	 * "LOGO", css : "layerPopup layerEvent250", modal : setModal });
	 * successPop.show(); } else { $.getJSON(g_urlLikes+"/event/check", {},
	 * function(data) { if (data) { successPop = new bugs.ui.popup(html, {title :
	 * "LOGO", css : "layerPopup layerEvent250", modal : setModal });
	 * successPop.show(); likes.eventMissionLike = true; } }); } } }
	 */
	};
}
