/**
 * ¹÷½º À½¾Ç °ü·Ã ½ºÅ©¸³Æ®
 *
 * @author °æ½ÂÈ£ <daygoods@einsdigital.com>
 * @date 2008-05-20
 */


var ML =
{
	// ÃßÃµ °î Æ÷ÇÔ ¿©ºÎ
	isSelectLimit : false,

	// ÀüÃ¼ ¼±ÅÃ, ÇØÁ¦ - OK
	doSelectCheck : function()
	{
		var objCheck = arguments[0] || null;

		if (Common.isNull(objCheck.isCheck))
		{
			this.doSelectCheckAll(arguments[1]);
			objCheck.isCheck = true;
		}
		else
		{
			this.doSelectCheckCancel(arguments[1]);
			objCheck.isCheck = false;
		}

		/*
		var objFrm;
		if (arguments.length > 0)	objFrm = arguments[0] || document.all;
		else						objFrm = document.all;

		if (!objFrm.SelectCheckBox) return;

		if (objFrm.SelectCheckBox.length > 0)
		{
			for (i=0;i<objFrm.SelectCheckBox.length;i++)
			{
				objFrm.SelectCheckBox[i].checked = !objFrm.SelectCheckBox[i].checked;
			}
		}
		else
		{
			objFrm.SelectCheckBox.checked = !objFrm.SelectCheckBox.checked;
		}
		*/
	},

	// ÀüÃ¼ ¼±ÅÃ - OK
	doSelectCheckAll : function()
	{
		var objFrm;
		if (arguments.length > 0)	objFrm = arguments[0] || document.all;
		else						objFrm = document.all;

		if (!objFrm.SelectCheckBox) return;

		if (objFrm.SelectCheckBox.length > 0)
		{
			for (i=0;i<objFrm.SelectCheckBox.length;i++)
			{
				objFrm.SelectCheckBox[i].checked = true;
			}
		}
		else
		{
			objFrm.SelectCheckBox.checked = true;
		}
	},

	// ÀüÃ¼ ¼±ÅÃ ÇØÁ¦ - OK
	doSelectCheckCancel : function()
	{
		var objFrm;
		if (arguments.length > 0)	objFrm = arguments[0] || document.all;
		else						objFrm = document.all;

		if (!objFrm.SelectCheckBox) return;

		if (objFrm.SelectCheckBox.length > 0)
		{
			for (i=0;i<objFrm.SelectCheckBox.length;i++)
			{
				objFrm.SelectCheckBox[i].checked = false;
			}
		}
		else
		{
			objFrm.SelectCheckBox.checked = false;
		}
	},

	// ¼±ÅÃ°ª ¾ò±â - OK
	getSelectCheckValue : function()
	{
		var objFrm, chkLen;
		var nCnt=0, nStartNo=0, tmpVal = '', SelectVal = '';
		if (arguments.length > 0)
		{
			objFrm = arguments[0] || document.all;
			chkLen = (!Common.isNull(objFrm.SelectCheckBox)) ? (objFrm.SelectCheckBox.length || 1) : 0;
			recLen = (!Common.isNull(objFrm.RecommendMusic)) ? (objFrm.RecommendMusic.length || 1) : 0;
		}
		else
		{
			objFrm = document.all;
			chkLen = document.getElementsByName('SelectCheckBox').length;
			recLen = document.getElementsByName('RecommendMusic').length;
		}

		if (this.isSelectLimit)
		{
			if ((chkLen - recLen) <= 0) return;
			nStartNo = recLen;
		}
		else
		{
			if (!chkLen) return;
			nStartNo = 0;
		}

		if (chkLen > 1)
		{
			for (i=nStartNo;i<objFrm.SelectCheckBox.length;i++)
			{
				if (objFrm.SelectCheckBox[i].checked && !objFrm.SelectCheckBox[i].disabled)
				{
					if (objFrm.SelectCheckBox[i].value)
					{
						tmpVal = tmpVal+objFrm.SelectCheckBox[i].value+',';
						nCnt++;
					}
				}
			}
			SelectVal = tmpVal.substr(0,tmpVal.length - 1);
		}
		else
		{
			if (objFrm.SelectCheckBox.checked && !objFrm.SelectCheckBox.disabled)
			{
				if (objFrm.SelectCheckBox.value)
				{
					SelectVal = objFrm.SelectCheckBox.value;
					nCnt++;
				}
			}
		}		
		
		return SelectVal;
	},

	// ÇÃ·¹ÀÌ¾î È£Ãâ - OK
	doPlayerCallMusic : function()
	{
		var MediaList  = arguments[0] || null;
		var AppendType = arguments[1] || null;
		var PlayerMode = arguments[3] || null;

		var width		= 430;
		var height		= 596;
		var left		= screen.width/2 - width/2;
		var top			= screen.height/2 - height/2;
		var MusicVal	= '';

		try
		{
			nRet = document.getElementById('XTools').XIsWndRunning("!!¹÷½º!!");
			if (nRet == 0 || AppendType == 'random') {

				MusicVal = 'http://player.bugs.co.kr/player/player';
				MusicVal += '?idx=' + MediaList + '&KeyMode=' + AppendType + '&mode=' + PlayerMode + '&fromUrl=' + Base64.encode(document.location.href);
				win = window.open(MusicVal, 'BugsPlayer', 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no');
				win.focus();

			} else {
				/*
				*	0 : track_id
				*	1 : °î Ãß°¡ Å¸ÀÔ(all,sel,random,One)
				*	2 : bitrate(»ç¿ë¾ÈÇÔ)
				*	3 : link url
				*/
				MusicVal = MediaList + "|" + AppendType + "||" + Base64.encode(document.location.href);
				document.getElementById('XTools').XSendMessage(MusicVal);
			}

			if (!Common.isNull(arguments[2]))
			{
				location.href = arguments[2];
			}
		}
		catch (e)
		{
			alert('ÅëÇÕ ÀÎ½ºÅç·¯°¡ Á¤»óÀûÀ¸·Î ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù.\n\nÅëÇÕ ÀÎ½ºÅç·¯¸¦ ¼³Ä¡ÇÑ ÈÄ ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.');
			void(window.open('http://www.bugs.co.kr/common/install/','BugsActiveXpop','toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,width=536,height=633,top=100,left=100'));
			return;
		}
	},

	// ¹Âºñ ÇÃ·¹ÀÌ¾î È£Ãâ - OK
	doPlayerCallMovie : function()
	{
		var MediaList  = arguments[0] || null;
		var AppendType = arguments[1] || null;
		var PlayerType = arguments[3] || null;

		var width		= 330;
		var height		= 315;
		var left		= screen.width/2 - 757/2;
		var top			= screen.height/2 - 502/2;
		var MusicVal	= '';

		try
		{
			nRet = document.getElementById('XTools').XIsWndRunning("¹÷½º¹ÂÁ÷ºñµð¿À");
			if (nRet == 0 || AppendType == 'all' || AppendType == 'sel') {

				MusicVal = 'http://player.bugs.co.kr/mv/player/';
				MusicVal += '?idx=' + MediaList + '&mode=' + PlayerType;

				win = window.open(MusicVal, 'BugsMvPlayer', 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no');
				win.focus();

			} else {
				/*
				*	0 : track_id
				*	1 : °î Ãß°¡ Å¸ÀÔ(all,sel,One) -»èÁ¦
				*	2 : link url			   -»èÁ¦
				*/
				MusicVal = MediaList;
				document.getElementById('XTools').XSendMessage(MusicVal);
			}
			if (!Common.isNull(arguments[2]))
			{
				location.href = arguments[2];
			}
		}
		catch (e)
		{
			alert('ÅëÇÕ ÀÎ½ºÅç·¯°¡ Á¤»óÀûÀ¸·Î ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù.\n\nÅëÇÕ ÀÎ½ºÅç·¯¸¦ ¼³Ä¡ÇÑ ÈÄ ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.');
			void(window.open('http://www.bugs.co.kr/common/install/','BugsActiveXpop','toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,width=536,height=633,top=100,left=100'));
			return;
		}
	},

	// ÀüÃ¼ µè±â - OK
	doListenAll : function()
	{
		var Select_Seq = '';

		if (arguments.length > 0)	this.doSelectCheckAll(arguments[0]);
		else						this.doSelectCheckAll();

		this.isSelectLimit = true;
		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			this.doPlayerCallMusic(Select_Seq, 'all');
		}
		else
		{
			alert('°î¸íÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}

		this.isSelectLimit = false;
		this.doSelectCheckCancel(arguments[0]);
		return;
	},

	// Å¬¶óÀÌ¾ðÆ® ÀüÃ¼ µè±â - OK
	doClientListenAll : function()
	{
		var Select_Seq = '';
		if (arguments.length > 0)	this.doSelectCheckAll(arguments[0]);
		else						this.doSelectCheckAll();

		this.isSelectLimit = true;
		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			location.href="bugs://allplaysong="+Select_Seq.replace(/,/gi,":");
		}
		else
		{
			location.href="bugs://allplaysong=";
		}
		
		this.isSelectLimit = false;
		this.doSelectCheckCancel(arguments[0]);

		for(i=0; i<arguments[1]; i ++)
		{
			if(document.getElementById('click'+i).className == 'check click')
			{
				document.getElementById('SelectCheckBox'+i).checked = true;
			}	
		}
		
		return;
	},
	
	// ¼±ÅÃ µè±â - OK
	doListenSelect : function()
	{
		var Select_Seq = '';

		if (arguments[1] == 'Direct')
		{
			Select_Seq = arguments[0];
		}
		else
		{
			Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		}

		if (!Common.isNull(Select_Seq))
		{
			this.doPlayerCallMusic(Select_Seq, 'sel');
		}
		else
		{
			alert('°î¸íÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}
		return;
	},
	
	// Å¬¶óÀÌ¾ðÆ® ÁÁ¾Æ
	doClientLikeAnother : function ( boolen , svc ,contentsid )
	{
		var vprompt, vparam;
		vprompt = "ilike"+svc+"=";
		if( boolen )
		{
			vparam = vprompt+contentsid;
			location.href = "bugs://"+vparam;		
		}
		else
		{
			location.href = "bugs://"+vprompt;		
		}	
		return;
	},
	
	doClientLikeSelect : function ()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		
		if (!Common.isNull(Select_Seq))
		{
			location.href="bugs://ilikesong="+Select_Seq.replace(/,/gi,":");
		}
		else
		{
			location.href="bugs://ilikesong=";
		}
		return;
	},
	
	
	// Å¬¶óÀÌ¾ðÆ® ¼±ÅÃ µè±â - OK
	doClinetListenSelect : function()
	{
		var Select_Seq = '';
		
		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		
		if (!Common.isNull(Select_Seq))
		{
			location.href="bugs://playsong="+Select_Seq.replace(/,/gi,":");
		}
		else
		{
			location.href="bugs://playsong=";
		}
		return;
	}, 
	
	// Å¬¶óÀÌ¾ðÆ® ¼±ÅÃ ´Ù¿î·Îµå - OK
	doClinetdownSelect : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();

		if (!Common.isNull(Select_Seq))
		{
			location.href="bugs://downloadsong="+Select_Seq.replace(/,/gi,":");
		}
		else
		{
			location.href="bugs://downloadsong=";
		}
		return;
	}, 
	
	// Å¬¶óÀÌ¾ðÆ® ¼±ÅÃ ´Ù¿î·Îµå - OK
	doAddClinetplaySelect : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();

		if (!Common.isNull(Select_Seq))
		{
			location.href="bugs://addplaylist="+Select_Seq.replace(/,/gi,":");
		}
		else
		{
			location.href="bugs://addplaylist=";
		}
		return;
	}, 
	
	// Å¬¶óÀÌ¾ðÆ® ¼±ÅÃ ´Ù¿î·Îµå - OK
	doClinetInsertMyalbumSelect : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();

		if (!Common.isNull(Select_Seq))
		{
			location.href="bugs://insertmyalbum="+Select_Seq.replace(/,/gi,":");
		}
		else
		{
			location.href="bugs://insertmyalbum=";
		}
		return;
	},
	
	// ·£´ý µè±â - OK
	doListenRamdom : function()
	{
		var Select_Seq = '';

		if (arguments[1] == 'Direct')
		{
			Select_Seq = arguments[0];
		}
		else
		{
			Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		}

		if (!Common.isNull(Select_Seq))
		{
			// ·¥´ý Àû¿ë
//			var _rList = Select_Seq.split(',');
//			Select_Seq = FN.randArray(_rList);
			this.doPlayerCallMusic(Select_Seq, 'random');
		}
		else
		{
			alert('°î¸íÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}
		return;
	},

	// ÇÑ°î µè±â - OK
	doListenSingle : function(argMediaID)
	{
		//ÄÚÅ©Ãß°¡·Î ÀÎÇÑ ÇÃ·¹ÀÌ¾î µðÀÚÀÎ¸ðµå Ãß°¡
		var PlayerMode = arguments[1] || null;
		if (!Common.isNull(argMediaID))
		{
			this.doPlayerCallMusic(argMediaID, 'One', '', PlayerMode);
		}
		else
		{
			alert('°î¸íÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}
		return;
	},

	// Å¸ÀÌÆ²°î µè±â - OK
	doListenTitle : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			var _root = this;

			var doSuccessProc = function(Request)
			{
				var Response = Request.responseXML.getElementsByTagName("TrackInfo");

				if(Response == null || Response.length < 1) { return; }

				var Medias = new Array();
				for(var i=0; i < Response.length; i++)
				{
					if(Response[i].nodeType != 1) { continue; }

					var xmlMediaInfo = Response[i].childNodes;
					for(var j=0; j < xmlMediaInfo.length; j++)
					{
						if(xmlMediaInfo[j].nodeType != 1) { continue; }
						if(xmlMediaInfo[j].nodeName == "Track_id") Medias.push(xmlMediaInfo[j].text);
					}
				}

				if (Medias.length > 0)
				{
					_root.doListenSingle(Medias.join(','));
				}

				return;
			}

			var doFailureProc = function(Request)
			{
				alert("Å¸ÀÌÆ²°î Á¤º¸¸¦ ÀÐÀ»¼ö ¾ø½À´Ï´Ù. Àá½Ã ÈÄ ÀÌ¿ëÇØ ÁÖ¼¼¿ä.");
				return;
			}

			var SetParameter = {
				LoadURL : "http://music.bugs.co.kr/xml/titletrack/artist/" + argMediaID
			};

			new Ajax.Request(
				"/global/common/general/Proxy.php",
				{
					method			: 'post',
					parameters		: SetParameter,
					onSuccess		: doSuccessProc.bind(this),
					onFailure		: doFailureProc.bind(this)
				}
			);
		}
		else
		{
			alert('°¨»óÇÏ½Ç ¸ñ·ÏÀÇ Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ¾Ù¹ü µè±â - OK
	doListenAlbum : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			var _root = this;
			//ÄÚÅ©Ãß°¡·Î ÀÎÇÑ ÇÃ·¹ÀÌ¾î µðÀÚÀÎ¸ðµå Ãß°¡
			var PlayerMode = arguments[1] || null;

			var doSuccessProc = function(Request)
			{
				var Response = Request.responseXML.getElementsByTagName("TrackInfo");

				if(Response == null || Response.length < 1) { return; }

				var Medias = new Array();
				for(var i=0; i < Response.length; i++)
				{
					if(Response[i].nodeType != 1) { continue; }

					var xmlMediaInfo = Response[i].childNodes;
					for(var j=0; j < xmlMediaInfo.length; j++)
					{
						if(xmlMediaInfo[j].nodeType != 1) { continue; }
						if(xmlMediaInfo[j].nodeName == "Track_id") Medias.push(xmlMediaInfo[j].text);
					}
				}

				if (Medias.length > 0)
				{
					_root.doListenSingle(Medias.join(','),PlayerMode);
				}

				return;
			}

			var doFailureProc = function(Request)
			{
				alert("¾Ù¹ü Á¤º¸¸¦ ÀÐÀ»¼ö ¾ø½À´Ï´Ù. Àá½Ã ÈÄ ÀÌ¿ëÇØ ÁÖ¼¼¿ä.");
				return;
			}

			var SetParameter = {
				LoadURL : "http://music.bugs.co.kr/xml/albumtrack/media/" + argMediaID
			};

			new Ajax.Request(
				"/global/common/general/Proxy.php",
				{
					method			: 'post',
					parameters		: SetParameter,
					onSuccess		: doSuccessProc.bind(this),
					onFailure		: doFailureProc.bind(this)
				}
			);
		}
		else
		{
			alert('°¨»óÇÏ½Ç ¸ñ·ÏÀÇ Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ÀüÃ¼ ±¸¸Å °î - OK
	doBuyMp3All : function()
	{
		var Select_Seq = '';

		if (arguments.length > 0)	this.doSelectCheckAll(arguments[0]);
		else						this.doSelectCheckAll();

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			UI.doOpenBuy('Mp3', Select_Seq);
		}
		else
		{
			alert('±¸¸ÅÇÏ½Ç ¸ñ·ÏÀÇ Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}

		this.doSelectCheckCancel(arguments[0]);
		return;
	},

	// ¹Ù·Î ±¸¸Å °î - OK
	doBuyMp3Direct : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			UI.doOpenBuy('Mp3', Select_Seq);
		}
		else
		{
			alert('¹Ù·Î ±¸¸Å ÇÏ½Ç ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}

		this.doSelectCheckCancel(arguments[0]);
		return;
	},

	// ±¸¸Å °î ÇÁ·Î¼¼½º - OK
	doBuyMp3Single : function(argMediaID)
	{
		var mGubun = arguments[1] || null;

		if (!Common.isNull(argMediaID))
		{
			UI.doOpenBuy('Mp3', argMediaID, mGubun);
		}
		else
		{
			alert('±¸¸ÅÇÏ½Ç ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}
		return;
	},

	// ¾ÆÆ¼½ºÆ® ´ëÇ¥ °î ±¸¸Å - OK
	doBuyMp3TitleByArtistID : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			var _root = this;

			var doSuccessProc = function(Request)
			{
				var Response = Request.responseXML.getElementsByTagName("TrackInfo");

				if(Response == null || Response.length < 1) { return; }

				var Medias = new Array();
				for(var i=0; i < Response.length; i++)
				{
					if(Response[i].nodeType != 1) { continue; }

					var xmlMediaInfo = Response[i].childNodes;
					for(var j=0; j < xmlMediaInfo.length; j++)
					{
						if(xmlMediaInfo[j].nodeType != 1) { continue; }
						if(xmlMediaInfo[j].nodeName == "Track_id") Medias.push(xmlMediaInfo[j].text);
					}
				}

				if (Medias.length > 0)
				{
					_root.doBuyMp3Single(Medias.join(','));
				}

				return;
			}

			var doFailureProc = function(Request)
			{
				alert("Å¸ÀÌÆ²°î Á¤º¸¸¦ ÀÐÀ»¼ö ¾ø½À´Ï´Ù. Àá½Ã ÈÄ ÀÌ¿ëÇØ ÁÖ¼¼¿ä.");
				return;
			}

			var SetParameter = {
				LoadURL : "http://music.bugs.co.kr/xml/titletrack/artist/" + argMediaID
			};

			new Ajax.Request(
				"/global/common/general/Proxy.php",
				{
					method			: 'post',
					parameters		: SetParameter,
					onSuccess		: doSuccessProc.bind(this),
					onFailure		: doFailureProc.bind(this)
				}
			);
		}
		else
		{
			alert('¾ÆÆ¼½ºÆ® ¾ÆÀÌµð°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ¾Ù¹ü °î ±¸¸Å - OK
	doBuyMp3ByAlbumID : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			var _root = this;

			var doSuccessProc = function(Request)
			{
				var Response = Request.responseXML.getElementsByTagName("TrackInfo");

				if(Response == null || Response.length < 1) { return; }

				var Medias = new Array();
				for(var i=0; i < Response.length; i++)
				{
					if(Response[i].nodeType != 1) { continue; }

					var xmlMediaInfo = Response[i].childNodes;
					for(var j=0; j < xmlMediaInfo.length; j++)
					{
						if(xmlMediaInfo[j].nodeType != 1) { continue; }
						if(xmlMediaInfo[j].nodeName == "Track_id") Medias.push(xmlMediaInfo[j].text);
					}
				}

				if (Medias.length > 0)
				{
					_root.doBuyMp3Single(Medias.join(','));
				}

				return;
			}

			var doFailureProc = function(Request)
			{
				alert("¾Ù¹ü Á¤º¸¸¦ ÀÐÀ»¼ö ¾ø½À´Ï´Ù. Àá½Ã ÈÄ ÀÌ¿ëÇØ ÁÖ¼¼¿ä.");
				return;
			}

			var SetParameter = {
				LoadURL : "http://music.bugs.co.kr/xml/albumtrack/media/" + argMediaID
			};

			new Ajax.Request(
				"/global/common/general/Proxy.php",
				{
					method			: 'post',
					parameters		: SetParameter,
					onSuccess		: doSuccessProc.bind(this),
					onFailure		: doFailureProc.bind(this)
				}
			);
		}
		else
		{
			alert('°¨»óÇÏ½Ç ¸ñ·ÏÀÇ Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ¹Ù·Î ±¸¸Å ¹Âºñ - OK
	doBuyMvDirect : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			UI.doOpenBuy('Mv', Select_Seq);
		}
		else
		{
			alert('¹Ù·Î ±¸¸Å ÇÏ½Ç ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}

		this.doSelectCheckCancel(arguments[0]);
		return;
	},

	// ±¸¸Å ¹Âºñ ÇÁ·Î¼¼½º - OK
	doBuyMvSingle : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenBuy('Mv', argMediaID);
		}
		else
		{
			alert('±¸¸ÅÇÏ½Ç ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}
		return;
	},

	// ¼±ÅÃ ´ã±â °î - OK
	doPlusSelect : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			UI.doOpenMyAlbum('aod', Select_Seq);
		}
		else
		{
			alert('´ã±âÇÏ½Ç °î ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}
		return;
	},

	// °³º° ´ã±â °î - OK
	doPlusSingle : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenMyAlbum('aod', argMediaID);
		}
		else
		{
			alert('´ã±âÇÏ½Ç °î ¸ñ·ÏÀÇ Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ¼±ÅÃ ´ã±â ¹Âºñ - OK
	doPlusSelectMv : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			UI.doOpenMyAlbum('vod', Select_Seq);
		}
		else
		{
			alert('´ã±âÇÏ½Ç ¹Âºñ ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}
		return;
	},

	// °³º° ´ã±â ¹Âºñ - OK
	doPlusSingleMv : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenMyAlbum('vod', argMediaID);
		}
		else
		{
			alert('´ã±âÇÏ½Ç ¹Âºñ ¸ñ·ÏÀÇ Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ¼±ÅÃ ´ã±â ¾Ù¹ü - OK
	doPlusSelectAlbum : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			UI.doOpenMyAlbum('lod', Select_Seq);
		}
		else
		{
			alert('´ã±âÇÏ½Ç ¾Ù¹ü ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}
		return;
	},

	// Àå¹Ù±¸´Ï -MNp3 - OK
	doBasketMp3Select : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			UI.doOpenCartAdd('mp3', Select_Seq);
		}
		else
		{
			alert('Àå¹Ù±¸´Ï¿¡ ´ãÀ¸½Ç ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}

		this.doSelectCheckCancel(arguments[0]);
	},

	// Àå¹Ù±¸´Ï - Mv - OK
	doBasketMvSelect : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			UI.doOpenCartAdd('mv', Select_Seq);
		}
		else
		{
			alert('Àå¹Ù±¸´Ï¿¡ ´ãÀ¸½Ç ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}

		this.doSelectCheckCancel(arguments[0]);
	},

	// ¾Ù¹ü Á¤º¸ º¸±â - OK
	doAlbumView : function(argMediaID, argOpen)
	{
		UI.doAlbumView(argMediaID, argOpen);
	},

	// ¾ÆÆ¼½ºÆ® Á¤º¸ º¸±â - OK
	doArtistView : function(argMediaID, argOpen)
	{
		UI.doArtistView(argMediaID, argOpen);
	},

	// Àå¸£ ½ºÅ¸ÀÏ »çÀü - OK
	doOpenGenreStyleDoc : function(argGenreID)
	{
		var theURL = 'http://music.bugs.co.kr/info/index/doc/?genre_cd='+argGenreID;
		SetWin = window.open(theURL, 'GenreStyleDoc', "width=480,height=616,resizable=no,scrollbars=0");
		SetWin.focus();
	},

	// CD ±¸¸ÅÇÏ±â - OK
	doOpenCdMall : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenCp('CdMall', argMediaID);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ÃßÃµ ¸ÞÀÏ º¸³»±â
	doRecommendMail : function(argGubun, argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			var theURL = (argGubun.toLowerCase() == 'artist')
								? 'http://music.bugs.co.kr/info/index/recommendmail/gubun/artist/artist_id/'+argMediaID
								: 'http://music.bugs.co.kr/info/index/recommendmail/gubun/album/album_id/'+argMediaID

			void(window.open(theURL, 'RecommendMail', "width=484,height=547,resizable=no,scrollbars=0"));
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ¸µÅ© ¼­ºñ½º
	doLinkService : function(argTarget, argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			try
			{
				var theURL	= 'http://music.bugs.co.kr/service/link/track_id/'+argMediaID
				var bValue	= BFU.setClipboard(theURL);
				if (!Common.isNull(bValue))
				{
					LinkService.doShow(argTarget);
				}
			}
			catch (e) {}
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// °¡»ç º¸±â - OK
	doLyricView : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			var theURL = 'http://music.bugs.co.kr/info/adult/lyric/?track_id='+argMediaID;
			SetWin = window.open(theURL, 'LyricView', "width=480,height=600,resizable=no,scrollbars=0");
			SetWin.focus();
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},	

	// °¡»ç ¿äÃ»
	doLyricRequest : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			var theURL = 'http://music.bugs.co.kr/info/index/lyricrequest/?track_id='+argMediaID;
			SetWin = window.open(theURL, 'LyricReq', "width=480,height=600,resizable=no,scrollbars=0");
			SetWin.focus();
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// À½¾Ç ¸ÞÀÏ
	doMusicMail : function(argMediaID, argOpen)
	{
		if (!Common.isNull(argMediaID))
		{
			if (!Common.isNull(argOpen)) {
				void(window.open('http://mmail.bugs.co.kr/index/write?track_id='+argMediaID));
			}
			else {
				if(Const.isLogged) {
					location.href='http://mmail.bugs.co.kr/index/write?track_id='+argMediaID;
				}
				else {
					var rUrl = Base64.encode('http://mmail.bugs.co.kr/index/write/track_id/'+argMediaID) || null;
					Login.doPopLogin('opener', rUrl);
				}
			}

		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ¹Âºñ ¸ÞÀÏ
	doMovieMail : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			alert('[¹Âºñ ¸ÞÀÏ] ¹Âºñ ¸ÞÀÏ ·Î ÀÌµ¿ÇÕ´Ï´Ù.\n\n'+argMediaID)
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ÀüÃ¼ ¹Âºñ º¸±â - OK
	doMovieAll : function()
	{
		var Select_Seq = '';

		if (arguments.length > 0)	this.doSelectCheckAll(arguments[0]);
		else						this.doSelectCheckAll();

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			this.doPlayerCallMovie(Select_Seq,'all');
		}
		else
		{
			alert('°¨»óÇÏ½Ç ¸ñ·ÏÀÇ Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}

		this.doSelectCheckCancel(arguments[0]);
		return;
	},

	// ¼±ÅÃ º¸±â - OK
	doMovieSelect : function()
	{
		var Select_Seq = '';

		Select_Seq = (arguments.length > 0) ? this.getSelectCheckValue(arguments[0]) : this.getSelectCheckValue();
		if (!Common.isNull(Select_Seq))
		{
			this.doPlayerCallMovie(Select_Seq,'sel');
		}
		else
		{
			alert('°¨»óÇÏ½Ç ¸ñ·ÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
		}
		return;
	},

	// ¹Âºñ º¸±â - OK
	doMovieSingle : function(argMediaID)
	{
		//ÄÚÅ©ÇÃ·¹ÀÌ¾î°ü·Ã ÇÃ·¹ÀÌ¾îÅ¸ÀÔ ¼±¾ð
		var PlayerType = arguments[1] || null;
		if (!Common.isNull(argMediaID))
		{
			this.doPlayerCallMovie(argMediaID,'One', '', PlayerType);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// Æù °ü·Ã º¸±â - OK
	doPhoneExtends : function(argTarget, argMediaID, argLivebellYN, argRingYN, WepPlayer_layer)
	{
		try
		{
			PhoneExtends.doShow(argTarget, argMediaID, argLivebellYN, argRingYN, WepPlayer_layer);
		}
		catch (e) {}
	},

	// ¹Âºñ °ü·Ã º¸±â - OK
	doMovieExtends : function(argTarget, argMediaID, argStrRightsYN, argDnlRightsYN, argHDRightsYN, WepPlayer_layer)
	{
		try
		{
			MovieExtends.doShow(argTarget, argMediaID, argStrRightsYN, argDnlRightsYN, argHDRightsYN, WepPlayer_layer);
		}
		catch (e) {}
	},

	// ±¸¸Å º¸±â - OK
	doBuyExtends : function(argTarget, argMediaID, argInElem, argSection)
	{
		try
		{
			var SetData = (Common.isNull(argSection)) ? eval('_Extends_'+argMediaID) : eval(argSection+'_Extends_'+argMediaID);
			Extends.doShow(argTarget, SetData, argInElem);
		}
		catch (e) {}
	},

	// ¶óÀÌºêº§ - OK
	doExtendsLivebell : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenCp('Livebell',argMediaID,'ME');
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ÄÃ·¯¸µ - OK
	doExtendsColoring : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenCp('Coloring', argMediaID);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ÅëÈ­¿¬°áÀ½ ¼±¹° - OK
	doExtendsRingGift : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenCp('RingGift', argMediaID);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// º§¼Ò¸® - OK
	doExtendsBell : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenCp('Bell', argMediaID);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// º§¼Ò¸® - OK
	doExtendsBellGift : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenCp('BellGift', argMediaID);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// MP3 ±¸¸ÅÇÏ±â - OK
	doExtendsMp3Buy : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			this.doBuyMp3Single(argMediaID);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// MP3 ¼±¹°ÇÏ±â - OK
	doExtendsMp3Gift : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenGift('Mp3', argMediaID);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ¹ÂÁ÷ºñµð¿À ±¸¸Å - OK
	doExtendsMvBuy : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			this.doBuyMvSingle(argMediaID);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// ¾Çº¸±¸¸Å - OK
	doExtendsScoreBuy : function(argMediaID)
	{
		if (!Common.isNull(argMediaID))
		{
			UI.doOpenCp('Mscore', argMediaID);
		}
		else
		{
			alert('¼±ÅÃ ¹Ìµð¾î Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	// À½¹Ý±¸¸Å - OK
	doExtendsCdMall : function(argMediaID)
	{
		this.doOpenCdMall(argMediaID);
	},

	// 19±Ý ¾Ë¸² - OK
	doAdultNoticeShow : function(argTarget)
	{
		try
		{
			Notice.doShowAdultNotice(argTarget);
		}
		catch (e) {}
	},

	// 19±ÝÁö°î ±¸¸Å,´ã±â  ·¹ÀÌ¾î 
	doAdultLayerShow : function(argTarget)
	{
		try
		{
			Notice.doShowAdultLayer(argTarget);
		}
		catch (e) {}
	},

	// À½¾Ç ¸ÞÀÏ - ÆíÁöÁö ¾ÆÀÌÅÛ
	doMusicMailPaper : function(argPaperID, argOpen)
	{
		if (!Common.isNull(argPaperID))
		{
			if(Const.isLogged) {
				location.href='http://mmail.bugs.co.kr/index/write?paper_srl='+argPaperID;
			}
			else {
				var rUrl = Base64.encode('http://mmail.bugs.co.kr/index/write/paper_srl/'+argPaperID) || null;
				if(!Common.isNull(argOpen))
					location.href = Const.Domain.Reg+'/member/login/form/?rUrl=' + rUrl;
				else
					Login.doPopLogin('opener', rUrl);
			}

		}
		else
		{
			alert('¼±ÅÃ ÆíÁöÁö Á¤º¸°¡ ¾ø½À´Ï´Ù.');
		}
		return;
	},

	nullTmp : {}
}


// ¸µÅ© ¼­ºñ½º
var LinkService =
{
	isHide : true,

	// º¸±â
	doShow : function(argTarget, argData)
	{
		var strLinkServiceID	= $('__PrintLinkService__') || this.doBuildLinkService();
		var strPrintHtml		= this.getPrintHtml();

		var arrPosition			= Position.cumulativeOffset($(argTarget));
		var nLeft				= (arrPosition[0]) || 0;
		var nTop				= (arrPosition[1] - 5) || 0;
		//var nLeft				= (arrPosition[0] - $(argTarget).getWidth()) || 0;
		//var nTop				= (arrPosition[1] + $(argTarget).getHeight() + 5) || 0;

		strLinkServiceID.update(strPrintHtml);
		strLinkServiceID.setStyle({
				'top'		: nTop  + 'px',
				'left'		: nLeft + 'px',
				'display'	: ''
			});
	},

	// ¼û±â±â
	doHide : function()
	{
		try {
			if (arguments[0])
			{
				$('__PrintLinkService__').hide();
			}
			else
			{
				if (this.isHide)
				{
					$('__PrintLinkService__').hide();
				}
			}
		}
		catch (e) {}
	},

	// È®Àå º£ÀÌ½º ¸¸µé±â
	doBuildLinkService : function()
	{
		var _buildDiv = new Element('div', { id: '__PrintLinkService__' });
		_buildDiv.setStyle({
				'position'	: 'absolute',
				'width'		: '159px',
				'top'		: '0px',
				'left'		: '0px',
				'z-index'	: '1000',
				'display'	: 'none'
			});
		new Insertion.Bottom(document.body, _buildDiv);

		var _root = this;
		Event.observe(_buildDiv, 'mouseover', function() { _root.isHide = false; });
		Event.observe(_buildDiv, 'mouseout',  function() { _root.isHide = true;  });
		Event.observe(document,  'mousedown', function() { _root.doHide();       });

		return _buildDiv;
	},

	// È®Àå ¸Þ´º ¸¸µé±â
	getPrintHtml : function()
	{
		var theHtml = '';

		theHtml += '<div class="link_copy">';
		theHtml += '	<div class="link_copy_tit">';
		theHtml += '		<div class="fr"><a href="javascript:LinkService.doHide(true);" title="´Ý±â"><img src="http://file.bugsm.co.kr/bugs/images_v1/common/btn/layer_close.gif" width="13" height="13" onclick="" /></a></div>';
		theHtml += '		<span class="tit">¾È³»</span>';
		theHtml += '	</div>';
		theHtml += '	<div class="link_copy_con">';
		theHtml += '		<table width="160" cellpadding="0" cellspacing="0">';
		theHtml += '		<tr>';
		theHtml += '			<td>';
		theHtml += '				<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#f4f4f4">';
		theHtml += '				<tr>';
		theHtml += '					<td width="3"><img src="http://file.bugsm.co.kr/bugs/images/common/layer_graybox_t_left.gif" width="3" height="3" /></td>';
		theHtml += '					<td width="100%" height="3" nowrap></td>';
		theHtml += '					<td width="3"><img src="http://file.bugsm.co.kr/bugs/images/common/layer_graybox_t_right.gif" width="3" height="3" /></td>';
		theHtml += '				</tr>';
		theHtml += '				<tr>';
		theHtml += '					<td colspan="3" style="padding:3px 0 0 5px">³ë·¡ ÁÖ¼Ò°¡ <b class="point">¼º°øÀûÀ¸·Î º¹»ç</b><br>µÇ¾ú½À´Ï´Ù. </td>';
		theHtml += '				</tr>';
		theHtml += '				<tr>';
		theHtml += '					<td width="3"><img src="http://file.bugsm.co.kr/bugs/images/common/layer_graybox_b_left.gif" width="3" height="3"></td>';
		theHtml += '					<td height="3" nowrap></td>';
		theHtml += '					<td width="3"><img src="http://file.bugsm.co.kr/bugs/images/common/layer_graybox_b_right.gif" width="3" height="3"></td>';
		theHtml += '				</tr>';
		theHtml += '				</table>';
		theHtml += '			</td>';
		theHtml += '		</tr>';
		theHtml += '		<tr>';
		theHtml += '			<td style="padding:6px 0 0 5px">Áö±Ý ¸Þ½ÅÀú ´ëÈ­Ã¢¿¡ <br><b class="point">ºÙ¿©³Ö±â(Ctrl+V)</b>¸¦ ÇÏ½Ã¸é<br>Ä£±¸¿¡°Ô ³ë·¡¸¦ ÃßÃµ ÇÒ ¼ö<br>ÀÖ½À´Ï´Ù.</td>';
		theHtml += '		</tr>';
		theHtml += '		</table>';
		theHtml += '	</div>';
		theHtml += '	<div class="link_copy_bottom"></div>';
		theHtml += '</div>';

		return theHtml;
	},

	nullTmp : {}
}



// Æù È®Àå ¸Þ´º
var PhoneExtends =
{
	isHide : true,

	// º¸±â
	doShow : function(argTarget, argMediaID, argLivebellYN, argRingYN, WepPlayer_layer)
	{
		var objExtends	= $('__PrintPhoneExtends__') || this.doBuildExtends();
		var strMenuHtml	 = this.getMenuList(argMediaID, argLivebellYN, argRingYN);
		objExtends.update(strMenuHtml);

		// ·¹ÀÌ¾î ³ôÀÌ Á¶Á¤
		if (argLivebellYN == 'Y' && argRingYN == 'Y')	{ objExtends.setStyle({'height' : '41px'}); }
		else if (argLivebellYN == 'Y')					{ objExtends.setStyle({'height' : '21px'}); }

		// À§Ä¡ Á¶Á¤
		var arrPosition		= Position.cumulativeOffset($(argTarget));
		var nLeft			= (arrPosition[0] + 25) || 0;
		var nTop			= (arrPosition[1]) || 0;
		var ViewPort		= document.viewport.getScrollOffsets();
		
		if (WepPlayer_layer =='player')
		{
			if (argLivebellYN == 'Y' && argRingYN == 'Y')
			{
				nTop = 182;
				nLeft = 82;
			}
			else 
			{
				nTop = 162;
				nLeft = 82;
			}			
			
		}
			
		
		// À§Ä¡Á¶Á¤ - border-line:4px!
		if ((ViewPort.top + document.viewport.getHeight()) < (nTop + $(argTarget).getHeight() + objExtends.getHeight()))
		{
			nTop = (nTop - objExtends.getHeight() - $(argTarget).getHeight() - 5) || 0;
		}

		// À§Ä¡Á¶Á¤ - border-line:2px!
		if ((ViewPort.left + document.viewport.getWidth()) < (nLeft + objExtends.getWidth()))
		{
			nLeft = (nLeft - objExtends.getWidth() + $(argTarget).getWidth() - 3) || 0;
		}

		// Big Size
		if ($(argTarget).getHeight() == 22)
		{
			nTop = nTop + 4;
		}

		objExtends.setStyle({
				'top'		: nTop  + 'px',
				'left'		: nLeft + 'px',
				'display'	: ''
			});
	},

	// ¼û±â±â
	doHide : function()
	{
		try {
			if (this.isHide)
			{
				$('__PrintPhoneExtends__').hide();
			}
		}
		catch (e) {}
	},

	// È®Àå º£ÀÌ½º ¸¸µé±â - 'height'	: '41px',
	doBuildExtends : function()
	{
		var _buildDiv = new Element('div', { id: '__PrintPhoneExtends__' });
		_buildDiv.setStyle({
				'position'	: 'absolute',
				'width'		: '71px',
				'top'		: '0px',
				'left'		: '0px',
				'z-index'	: '1000',
				'display'	: 'none'
			});
		new Insertion.Bottom(document.body, _buildDiv);

		var _root = this;
		Event.observe(_buildDiv, 'mouseover',  function() { _root.isHide = false; });
		Event.observe(_buildDiv, 'mouseout',   function() { _root.isHide = true;  });
		Event.observe(document,  'mousedown',  function() { _root.doHide();       });
		Event.observe(document,  'mousewheel', function() { _root.doHide();       });

		return _buildDiv;
	},

	// È®Àå ¸Þ´º ¸¸µé±â
	getMenuList : function(argMediaID, argLivebellYN, argRingYN)
	{
		var theHtml = '';

		theHtml += '<div class="list_layer">';
		theHtml += '	<dl>';

		// ¶óÀÌºêº§
		if (argLivebellYN == 'Y')
		{
			theHtml += '		<dd><a href="javascript:ML.doExtendsLivebell(\''+argMediaID+'\');" title="¶óÀÌºêº§"><img src="http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_livebell.gif" onmouseover="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_livebell_on.gif\'" onmousedown="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_livebell_on.gif\'" onmouseout="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_livebell.gif\'" width="67" height="21" alt="¶óÀÌºêº§" /></a></dd>';
		}

		// ÅëÈ­¿¬°áÀ½
		if (argRingYN == 'Y' && argLivebellYN == 'Y')
		{
			theHtml += '		<dd><a href="javascript:ML.doExtendsColoring(\''+argMediaID+'\');" title="ÄÃ·¯¸µ"><img src="http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_coloring.gif" onmouseover="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_coloring_on.gif\'" onmousedown="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_coloring_on.gif\'" onmouseout="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_coloring.gif\'" width="67" height="20" alt="ÄÃ·¯¸µ" /></a></dd>';
		}

		theHtml += '	</dd>';
		theHtml += '</div>';

		return theHtml;
	},

	nullTmp : {}
}


// ¹Âºñ È®Àå ¸Þ´º
var MovieExtends =
{
	isHide : true,

	// º¸±â
	doShow : function(argTarget, argMediaID, argStrRightsYN, argDnlRightsYN, argHDRightsYN, WepPlayer_layer)
	{
		var objExtends	= $('__PrintMovieExtends__') || this.doBuildExtends();
		var strMenuHtml		= this.getMenuList(argMediaID, argStrRightsYN, argDnlRightsYN, argHDRightsYN);
		objExtends.update(strMenuHtml);

		// ·¹ÀÌ¾î ³ôÀÌ Á¶Á¤
		if (argStrRightsYN == 'Y' && argDnlRightsYN == 'Y')	{ objExtends.setStyle({'height' : '41px'}); }
		else if (argStrRightsYN == 'Y')						{ objExtends.setStyle({'height' : '21px'}); }
		else if (argDnlRightsYN == 'Y')						{ objExtends.setStyle({'height' : '20px'}); }

		// À§Ä¡ Á¶Á¤
		var arrPosition		= Position.cumulativeOffset($(argTarget));
		var nLeft			= (arrPosition[0] + 25) || 0;
		var nTop			= (arrPosition[1]) || 0;
		var ViewPort		= document.viewport.getScrollOffsets();
		
		if(WepPlayer_layer)
		{
			if (argStrRightsYN == 'Y' && argDnlRightsYN == 'Y')
			{
				nTop = 182;
				nLeft = 108;
			}
			else 
			{
				nTop = 162;
				nLeft = 108;
			}			
		}

		// À§Ä¡Á¶Á¤ - border-line:4px!
		if ((ViewPort.top + document.viewport.getHeight()) < (nTop + $(argTarget).getHeight() + objExtends.getHeight()))
		{
			nTop = (nTop - objExtends.getHeight() - $(argTarget).getHeight() - 5) || 0;
		}

		// À§Ä¡Á¶Á¤ - border-line:2px!
		if ((ViewPort.left + document.viewport.getWidth()) < (nLeft + objExtends.getWidth()))
		{
			nLeft = (nLeft - objExtends.getWidth() + $(argTarget).getWidth() - 3) || 0;
		}

		// Big Size
		if ($(argTarget).getHeight() == 22)
		{
			nTop = nTop + 4;
		}

		objExtends.setStyle({
				'top'		: nTop  + 'px',
				'left'		: nLeft + 'px',
				'display'	: ''
			});
	},

	// ¼û±â±â
	doHide : function()
	{
		try {
			if (this.isHide)
			{
				$('__PrintMovieExtends__').hide();
			}
		}
		catch (e) {}
	},

	// È®Àå º£ÀÌ½º ¸¸µé±â
	doBuildExtends : function()
	{
		var _buildDiv = new Element('div', { id: '__PrintMovieExtends__' });
		_buildDiv.setStyle({
				'position'	: 'absolute',
				'width'		: '70px',
				'top'		: '0px',
				'left'		: '0px',
				'z-index'	: '1000',
				'display'	: 'none'
			});
		new Insertion.Bottom(document.body, _buildDiv);

		var _root = this;
		Event.observe(_buildDiv, 'mouseover',  function() { _root.isHide = false; });
		Event.observe(_buildDiv, 'mouseout',   function() { _root.isHide = true;  });
		Event.observe(document,  'mousedown',  function() { _root.doHide();       });
		Event.observe(document,  'mousewheel', function() { _root.doHide();       });

		return _buildDiv;
	},

	// È®Àå ¸Þ´º ¸¸µé±â
	getMenuList : function(argMediaID, argStrRightsYN, argDnlRightsYN, argHDRightsYN)
	{
		var theHtml = '';

		theHtml += '<div class="list_layer">';
		theHtml += '	<dl>';

		// ¹Âºñº¸±â
		if (argStrRightsYN == 'Y')
		{
			// 2009-10-21 ÀÓ»óÈ£ sover@neowizbugs.com hd ¹ÂÁ÷ºñµð¿À Ç¥½Ã ³ëÃâ
			if (argHDRightsYN == 'Y')
			{
				theHtml += '		<dd><a href="javascript:ML.doMovieSingle(\''+argMediaID+'\');" title="¹Âºñº¸±â"><img src="http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_view01_off.gif" onmouseover="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_view01_on.gif\'" onmousedown="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_view01_on.gif\'" onmouseout="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_view01_off.gif\'" height="21" alt="¹Âºñº¸±â" /></a></dd>';
			}
			else
			{
				theHtml += '		<dd><a href="javascript:ML.doMovieSingle(\''+argMediaID+'\');" title="¹Âºñº¸±â"><img src="http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_view.gif" onmouseover="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_view_on.gif\'" onmousedown="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_view_on.gif\'" onmouseout="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_view.gif\'" width="67" height="21" alt="¹Âºñº¸±â" /></a></dd>';
			}
		}
		// ¹Âºñ±¸¸Å
		if (argDnlRightsYN == 'Y')
		{
			// 2009-10-21 ÀÓ»óÈ£ sover@neowizbugs.com hd ¹ÂÁ÷ºñµð¿À Ç¥½Ã ³ëÃâ
			if (argHDRightsYN == 'Y')
			{
				theHtml += '		<dd><a href="javascript:ML.doBuyMvSingle(\''+argMediaID+'\');" title="HD±¸¸Å"><img src="http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_hdmv_view_off.gif" onmouseover="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_hdmv_view_on.gif\'" onmousedown="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_hdmv_view_on.gif\'" onmouseout="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_hdmv_view_off.gif\'" height="20" alt="HD±¸¸Å" /></a></dd>';
			}
			else
			{
				theHtml += '		<dd><a href="javascript:ML.doBuyMvSingle(\''+argMediaID+'\');" title="¹Âºñ±¸¸Å"><img src="http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_buy.gif" onmouseover="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_buy_on.gif\'" onmousedown="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_buy_on.gif\'" onmouseout="this.src=\'http://file.bugsm.co.kr/bugs/images_v1/common/list/layer_mv_buy.gif\'" width="67" height="20" alt="¹Âºñ±¸¸Å" /></a></dd>';
			}
		}

		theHtml += '	</dd>';
		theHtml += '</div>';

		return theHtml;
	},

	nullTmp : {}
}


// È®Àå ¸Þ´º
var Extends =
{
	isHide : true,

	// º¸±â
	doShow : function(argTarget, argData, argInElem)
	{
		var SetExtendsID	= $('__PrintExtends__') || this.doBuildExtends();
		var SetMenuHtml		= this.getMenuList(argData);
		SetExtendsID.update(SetMenuHtml);

		var SetPosition		= Position.cumulativeOffset($(argTarget));
		var SetLeft			= (SetPosition[0] - (SetExtendsID.getWidth() - $(argTarget).getWidth())) || 0;
		var SetTop			= (SetPosition[1] + $(argTarget).getHeight()) || 0;
		var ViewPort		= document.viewport.getScrollOffsets();

		// À§Ä¡Á¶Á¤
		if (!Common.isNull(argInElem))
		{
			SetTop = SetTop - $(argInElem).scrollTop;

			if (document.body.clientHeight < (SetTop + SetExtendsID.getHeight()))
			{
				SetTop = (SetTop - (SetExtendsID.getHeight() + $(argTarget).getHeight())) || 0;
			}
		}
		else
		{
			if ((ViewPort.top + document.body.clientHeight) < (SetTop + SetExtendsID.getHeight()))
			{
				SetTop = (SetPosition[1] - SetExtendsID.getHeight()) || 0;
			}
		}

		SetExtendsID.setStyle({
				'top'		: SetTop  + 'px',
				'left'		: SetLeft + 'px',
				'display'	: ''
			});
	},

	// ¼û±â±â
	doHide : function()
	{
		try {
			if (this.isHide)
			{
				$('__PrintExtends__').hide();
			}
		}
		catch (e) {}
	},

	// È®Àå º£ÀÌ½º ¸¸µé±â
	doBuildExtends : function()
	{
		var _buildDiv = new Element('div', { id: '__PrintExtends__' });
		_buildDiv.setStyle({
				'position'	: 'absolute',
				'width'		: '106px',
				'top'		: '0px',
				'left'		: '0px',
				'z-index'	: '1000',
				'display'	: 'none'
			});
		new Insertion.Bottom(document.body, _buildDiv);

		var _root = this;
		Event.observe(_buildDiv, 'mouseover',  function() { _root.isHide = false; });
		Event.observe(_buildDiv, 'mouseout',   function() { _root.isHide = true;  });
		Event.observe(document,  'mousedown',  function() { _root.doHide();       });
		Event.observe(document,  'mousewheel', function() { _root.doHide();       });

		return _buildDiv;
	},

	// È®Àå ¸Þ´º ¸¸µé±â
	getMenuList : function(argData)
	{
		var theHtml = '', SvcCheck = false;
		var _mVal = argData || null;

		theHtml += '<table cellpadding="0" cellspacing="1" border="0" width="100%" bgcolor="#ffffff">';
		theHtml += '<tr>';
		theHtml += '	<td valign="top" style="border:2px solid #889aa6; padding: 4px 2px 2px 2px">';
		theHtml += '		<table cellpadding="0" cellspacing="0" border="0" width="100%">';


		// ¶óÀÌºêº§
		if (_mVal.Livebell_yn == 'Y')
		{
			SvcCheck = true;
			theHtml += '		<tr>';
			theHtml += '			<td class="pat2 layer_style" style="letter-spacing:-1px"><span style="cursor:hand;" onClick="ML.doExtendsLivebell(\''+_mVal.TrackID+'\');"><img src="http://file.bugsm.co.kr/bugs/images/common/btn/btn_mp_buy.gif" align="absmiddle"> ¶óÀÌºêº§</span></td>';
			theHtml += '		</tr>';
		}

		// ÄÃ·¯¸µ
		if (_mVal.Ring_yn == 'Y' && _mVal.Livebell_yn == 'Y')
		{
			SvcCheck = true;
			theHtml += '		<tr>';
			theHtml += '			<td class="pat2 layer_style" style="letter-spacing:-1px"><span style="cursor:hand;" onClick="ML.doExtendsColoring(\''+_mVal.TrackID+'\');"><img src="http://file.bugsm.co.kr/bugs/images/common/btn/btn_mp_buy.gif" align="absmiddle"> ÄÃ·¯¸µ</span></td>';
			theHtml += '		</tr>';
		}

		// º§¼Ò¸®
		if (_mVal.Bell_cd)
		{
			SvcCheck = true;
			theHtml += '		<tr>';
			theHtml += '			<td class="pat2 layer_style" style="letter-spacing:-1px"><span style="cursor:hand;" onClick="ML.doExtendsBell(\''+_mVal.Bell_cd+'\');"><img src="http://file.bugsm.co.kr/bugs/images/common/btn/btn_mp_buy.gif" align="absmiddle"> º§¼Ò¸®</span></td>';
			theHtml += '		</tr>';
		}

		// MP3 ±¸¸ÅÇÏ±â
		if (_mVal.DnMp3_Show_yn == 'Y')
		{
			SvcCheck = true;
			theHtml += '		<tr>';
			theHtml += '			<td class="pat2 layer_style" style="letter-spacing:-1px"><span style="cursor:hand;" onClick="ML.doExtendsMp3Buy(\''+_mVal.TrackID+'\');"><img src="http://file.bugsm.co.kr/bugs/images/common/btn/btn_mp_buy.gif" align="absmiddle"> MP3 ±¸¸ÅÇÏ±â</span></td>';
			theHtml += '		</tr>';
		}

		// MP3 ¼±¹°ÇÏ±â
//		if (_mVal.DnMp3_Show_yn == 'Y')
//		{
//			SvcCheck = true;
//			theHtml += '		<tr>';
//			theHtml += '			<td class="pat2 layer_style" style="letter-spacing:-1px"><span style="cursor:hand;" onClick="ML.doExtendsMp3Gift(\''+_mVal.TrackID+'\');"><img src="http://file.bugsm.co.kr/bugs/images/common/btn/btn_mp_pre.gif" align="absmiddle"> MP3 ¼±¹°ÇÏ±â</span></td>';
//			theHtml += '		</tr>';
//		}

		// ¹Âºñ ±¸¸ÅÇÏ±â
		if (_mVal.DnMv_Show_yn == 'Y')
		{
			SvcCheck = true;
			theHtml += '		<tr>';
			theHtml += '			<td class="pat2 layer_style" style="letter-spacing:-1px"><span style="cursor:hand;" onClick="ML.doExtendsMvBuy(\''+_mVal.MovieID+'\');"><img src="http://file.bugsm.co.kr/bugs/images/common/btn/btn_mv_buy.gif" align="absmiddle"> ¹ÂÁ÷ºñµð¿À±¸¸Å</span></td>';
			theHtml += '		</tr>';
		}

		// ¾Çº¸±¸¸Å
		if (_mVal.Score_cd)
		{
//			SvcCheck = true;
//			theHtml += '		<tr>';
//			theHtml += '			<td class="pat2 layer_style" style="letter-spacing:-1px"><span style="cursor:hand;" onClick="ML.doExtendsScoreBuy(\''+_mVal.Score_cd+'\');"><img src="http://file.bugsm.co.kr/bugs/images/common/btn/btn_mv_buy.gif" align="absmiddle"> ¾Çº¸±¸¸Å</span></td>';
//			theHtml += '		</tr>';
		}

		// À½¹Ý±¸¸Å
		if (_mVal.Cdmall_cd)
		{
			SvcCheck = true;
			theHtml += '		<tr>';
			theHtml += '			<td class="pat2 layer_style" style="letter-spacing:-1px"><span style="cursor:hand;" onClick="ML.doExtendsCdMall(\''+_mVal.Cdmall_cd+'\');"><img src="http://file.bugsm.co.kr/bugs/images/common/btn/btn_album_buy.gif" align="absmiddle"> À½¹Ý±¸¸Å</span></td>';
			theHtml += '		</tr>';
		}

		// °ü·Ã»óÇ°¾øÀ½
		if (!SvcCheck)
		{
			theHtml += '		<tr>';
			theHtml += '			<td class="pat2 layer_style" align="center">°ü·Ã»óÇ°¾øÀ½</a></td>';
			theHtml += '		</tr>';
		}

		theHtml += '		</table>';
		theHtml += '	</td>';
		theHtml += '</tr>';
		theHtml += '</table>';

		return theHtml;
	},

	nullTmp : {}
}


// °øÁö ·¹ÀÌ¾î
var Notice =
{
	isHide : true,

	// º¸±â
	doShowAdultNotice : function(argTarget)
	{
	
		var SetNoticeID		= $('__PrintAdultNotice__') || this.doBuildNotice('__PrintAdultNotice__');
		var SetNoticeBody	= this.getContentAdultNotice();
		var SetPosition		= Position.cumulativeOffset($(argTarget));
		var SetLeft			= (SetPosition[0]) || 0;
		var SetTop			= (SetPosition[1] + $(argTarget).getHeight()) || 0;

		//var SetLeft			= (SetPosition[0] - (SetExtendsID.getWidth() - $(argTarget).getWidth())) || 0;
		//var SetTop			= (SetPosition[1] + $(argTarget).getHeight()) || 0;

		SetNoticeID.update(SetNoticeBody);
		SetNoticeID.setStyle({
				'top'		: SetTop  + 'px',
				'left'		: SetLeft + 'px',
				'display'	: ''
			});
	},
	
	// º¸±â
	doShowAdultLayer : function(argTarget)
	{
		var SetNoticeID		= $('__PrintAdultNotice__') || this.doBuildNotice('__PrintAdultNotice__');
		var SetNoticeBody	= this.getContentAdultLayer();
		var SetPosition		= Position.cumulativeOffset($(argTarget));
		var SetLeft			= (SetPosition[0]) || 0;
		var SetTop			= (SetPosition[1] + $(argTarget).getHeight()) || 0;

		for( var i in SetPosition )
		{	
			tmp = i + " = " + SetPosition[i] + "\n";
			alert(tmp);
		}
		//var SetLeft			= (SetPosition[0] - (SetExtendsID.getWidth() - $(argTarget).getWidth())) || 0;
		//var SetTop			= (SetPosition[1] + $(argTarget).getHeight()) || 0;
	
		SetNoticeID.update(SetNoticeBody);
		SetNoticeID.setStyle({
				'top'		: SetTop  + 'px',
				'left'		: SetLeft + 'px',
				'display'	: ''
			});
	},

	// ¼û±â±â
	doHide : function()
	{
		try {
			if (this.isHide)
			{
				if (arguments.length > 0)
				{
					$(arguments[0]).hide();
				}
			}
		}
		catch (e) {}
	},

	// °øÁö ·¹ÀÌ¾î ¸¸µé±â
	doBuildNotice : function(argID)
	{
		var _buildDiv = new Element('div', { id: argID });
		_buildDiv.setStyle({
				'position'	: 'absolute',
				'top'		: '0px',
				'left'		: '0px',
				'z-index'	: '1000',
				'display'	: 'none'
			});
		new Insertion.Bottom(document.body, _buildDiv);

		return _buildDiv;
	},

	// 19±Ý °øÁö ¸¸µé±â
	getContentAdultNotice : function()
	{
		var theHtml = '';

		theHtml += '<div class="fl" style="border:1px solid #ffffff; background-color:#ffffff;">';
		theHtml += '	<div class="txt_jus fs11 line_h14 ls1" style="width:284px; padding:9px 9px 2px 9px; border:2px solid #889aa6;">';
		theHtml += '		<span class="gray_color">ÇØ´ç°îÀº Ã»¼Ò³â À¯ÇØ¸ÅÃ¼¹°·Î¼­</span> Á¤º¸Åë½Å¸Á ÀÌ¿ë ÃËÁø';
		theHtml += '		¹× Á¤º¸º¸È£ µî¿¡ °üÇÑ ¹ý·ü ¹× Ã»¼Ò³âº¸È£¹ýÀÇ ±ÔÁ¤<span class="gray_color">¿¡ ÀÇÇÏ¿©</span>';
		theHtml += '		<span class="color_ff3300">19¼¼ ¹Ì¸¸ÀÇ Ã»¼Ò³âÀÌ ÀÌ¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.</span>';
		theHtml += '		<div style="text-align:center; margin-top:4px">';
		theHtml += '			<img src="http://file.bugsm.co.kr/bugs/images/common/btn/btn_confirm.gif" width="26" height="14" alt="È®ÀÎ" onclick="Notice.doHide(\'__PrintAdultNotice__\');" style="cursor:hand;">';
		theHtml += '		</div>';
		theHtml += '	</div>';
		theHtml += '</div>';

		return theHtml;
	},
	
	// 19±Ý ±¸¸Å,´ã±â ·¹ÀÌ¾î ¸¸µé±â
	getContentAdultLayer : function()
	{
		var theHtml = '';

		theHtml += '<div id="EID_LimitShow" style="position: absolute; top: 220px; left: 190px; solid; display: none; z-index: 60000;" >';
		theHtml += '	<ul style="width:211px">';
		theHtml += '		<li id="layer_tbg">';
		theHtml += '			<div id="layer_tl"><img src="http://file.bugsm.co.kr/bugs/images/webplayer/layer_tit_1.gif" height="7" border="0"></div>';
		theHtml += '			<div id="layer_tr"><img src="http://file.bugsm.co.kr/bugs/images/webplayer/layer_icon_1.gif" onclick="doLimitClose()" width="14" height="12" border="0"></a></div>';
		theHtml += '		</li>';
		theHtml += '		<li id="layer_cbg">';
		theHtml += '			<div id="layer_con">';
		theHtml += '				<!--·¹ÀÌ¾î ³»¿ë ½ÃÀÛ-->';
		theHtml += '				<div class="layer_txt" style="width:177px; margin: 9px 0 5px 17px; text-align:left;">';
		theHtml += '					Áö±Ý ±¸¸ÅÇÏ°íÀÚ ÇÏ´Â °î(µé)Áß¿¡ <span  class="color_e85e00 b">Ã»¼Ò³â À¯ÇØ ¸ÅÃ¼¹°</span>·Î¼­ °áÁ¤¡¤°í½ÃµÈ °îµéÀÌ Æ÷ÇÔµÇ¾î ÀÖ°í Ã»¼Ò³â À¯ÇØ ¸ÅÃ¼¹°Àº Á¤º¸Åë½Å¸ÁÀÌ¿ëÃËÁø¹×Á¤º¸º¸È£µî¿¡°üÇÑ¹ý·ü ¹× Ã»¼Ò³âº¸È£¹ýÀÇ ±ÔÁ¤¿¡ ÀÇÇÏ¿© <span  class="color_e85e00 b">19¼¼ ¹Ì¸¸ÀÇ Ã»¼Ò³âÀÌ ±¸¸ÅÇÒ ¼ö ¾ø½À´Ï´Ù.</span>';
		theHtml += '				</div>';  
		theHtml += '				<!--·¹ÀÌ¾î ³»¿ë -->';
		theHtml += '			</div>';
		theHtml += '		</li>';
		theHtml += '		<li id="layer_bbg">';
		theHtml += '			<div id="layer_bl"></div>';
		theHtml += '			<div id="layer_br"></div>';
		theHtml += '		</li>';
		theHtml += '	</ul>';	
		theHtml += '</div>';

		return theHtml;
	},

	nullTmp : {}
}


// ·¹ÀÌ¾î ³ëÃâ
// LayerShow.doShow(argTarget,'OriginalSound', {left:-7, top:-18});
// LayerShow.doHide('OriginalSound');
var LayerShow =
{
	isHide : true,

	// º¸±â
	doShow : function(argTarget, argGubun, argPosi)
	{
		var strLayerShowID		= '__Print' + argGubun + '__';
		var objLayerShowID		= $(strLayerShowID) || this.doBuildLayerShow(strLayerShowID);
		var strLayerContents	= this.getLayerContents(argGubun);

		var arrPosition		= Position.cumulativeOffset($(argTarget));
		var nLeft			= (arrPosition[0] + argPosi.left) || 0;
		var nTop			= (arrPosition[1] + argPosi.top)  || 0;

		objLayerShowID.update(strLayerContents);
		objLayerShowID.setStyle({
				'top'		: nTop  + 'px',
				'left'		: nLeft + 'px',
				'display'	: ''
			});
	},

	// ¼û±â±â
	doHide : function(argGubun)
	{
		try {
			if (this.isHide)
			{
				var strLayerShowID = '__Print' + argGubun + '__';
				$(strLayerShowID).hide();
			}
		}
		catch (e) {}
	},

	// ·¹ÀÌ¾î ¸¸µé±â
	doBuildLayerShow : function(argID)
	{
		var _buildDiv = new Element('div', { id: argID });
		_buildDiv.setStyle({
				'position'	: 'absolute',
				'top'		: '0px',
				'left'		: '0px',
				'z-index'	: '1000',
				'display'	: 'none'
			});
		new Insertion.Bottom(document.body, _buildDiv);

		return _buildDiv;
	},

	// ·¹ÀÌ¾î ³»¿ë ¸¸µé±â
	getLayerContents : function(argGubun)
	{
		var theHtml = '';
		switch (argGubun)
		{
			case 'OriginalSound' :
				theHtml += '<div class="fl" style="border:1px solid #ba0000; background-color:#ffffff;">';
				theHtml += '	¿øÀ½';
				theHtml += '</div>';
				break;
		}

		return theHtml;
	},

	nullTmp : {}
}


