/* -----------------------------------------------------------------------------------------------------------------
	PC Manager ´Ù¿î·Îµå ¼³Ä¡ ÇÁ·Î±×·¥ URL ¹×  Á¢¼Ó »çÀÌÆ® URL, Cookie Name
	¼­¹ö Ãø¿¡¼­ Àü´ÞÇØ ÁØ ³»¿ë
	- by (ÁÖ)¸ðºôÅ¾
----------------------------------------------------------------------------------------------------------------- */
//
var JSessionID = "JSESSIONID"
var namePCM = "/LGT_mobile_manager_Install.exe"
var TimeoutPCM = "10"

/*
// ¼­¹ö Ãø¿¡¼­ Àü¿ªÀ¸·Î Á¤ÀÇµÇ¾î ÀÖÀ½.
//var siteURL = "http://211.115.75.161:6701/portal";
//var installURL = "/protal/jsp/pcmgr/install";

// Test : ±âÁ¸ MusicON3
//var installURL = "http://www.musicon.co.kr/";
//var namePCM ="/Client/musicON3Compact_Setup.exe"; // Test ±âÁ¸ ¹ÂÁ÷¿Â
*/

/*
	PC Manager ÆäÀÌÁöÈ£Ãâ ÈÄ ÃÊ±âÈ­

	webUrl : À¥ÆäÀÌÁö URL
	message_command : Àü¹® Command
	message_params : Àü¹® °¢Ç×¸ñ °ª
*/
function InitPCManager()
{
	var f = document.form1;

	f.webUrl.value          = "";
	f.message_command.value = "";
	f.message_params.value  = "";
}

/*
	PC Manager ÆäÀÌÁöÈ£Ãâ

	webUrl : À¥ÆäÀÌÁö URL
	message_command : Àü¹® Command
	message_params : Àü¹® °¢Ç×¸ñ °ª

	ex) var webUrl = 'http://localhost:7001/musicon/jsp/ctnt.album.AlbumDetail.web?albumId=1000000';
		var message_command = 'CN_ALBUM_MUSIC_LIST';
		var message_params = 'albumId=1000000|page=1|displayCount=50';

		pcmgr_action (webUrl, message_command, message_params);"
*/
/* -----------------------------------------------------------------------------------------------------------------
	pcmgr_actionÀº ActiveX¿¡¼­ »ç¿ëÇÏÁö ¾ÊÀ½.
	- by (ÁÖ)¸ðºôÅ¾
----------------------------------------------------------------------------------------------------------------- */
function pcmgr_action (_webUrl, _message_command, _message_params)
{

//	var str  = 'PC Manager ÆäÀÌÁöÈ£Ãâ';
//		str += '\n' + 'webUrl : ' + _webUrl;
//		str += '\n' + 'message_command : ' + _message_command;
//		str += '\n' + 'message_params : ' + _message_params;
//	alert(str);

	var f = document.form1;

	f.webUrl.value          = _webUrl;
	f.message_command.value = _message_command;
	f.message_params.value  = _message_params;

	/*================ TEST ¿ë =================*/
	if (parent)
	{
		if (parent.webFrame)
		{
			if (_message_command)
			{
				parent.document.all.webFrame.height  = 400;
				parent.document.all.applFrame.height = 200;
			}
			else
			{
				parent.document.all.webFrame.height  = 600;
				parent.document.all.applFrame.height = 0;
			}

			parent.webFrame.location.href = _webUrl;
		}
	}
	/*================ TEST ¿ë =================*/
}

/*
	°îµè±â

	1. »óÇ° ID
	2. »óÇ°Å¸ÀÔ
	             C01 - ¹ÂÁ÷
	             D01 - µ¿¿µ»ó
	3. Å¸ÀÌÆ²
	4. ¾ÆÆ¼½ºÆ®
	5. ¾Ù¹ü
	6. ÆÄÀÏÅ©±â
	7. Àç»ý½Ã°£
	8. À½Áú
	9. Æù²Ù¹Ì±â
	10. ¸Þ´º¾ÆÀÌµð (Ãß°¡)

	ex) var product_info = new Array();

		product_info [0] = {'C01000001', 'C01', 'Ä£±¸¿©', 'Á¶¿ëÇÊ', '2Áý', '3834503', '03:56', '196', 'Y', '00000238'};

		product_info [1] = {'C01000002', 'C01', '±î¸¸¾È°æ', 'ÀÌ·ç', '1Áý', '76098882', '04:23', 'K3G', 'N', '00000238'};

		pcmgr_music_play (product_info);
 */
function pcmgr_music_play (product_info, kind, formName)
{
	try {
		/*
		var str    = "°îµè±â\n\n";

		for (var i = 0; i < product_info.length; i++)
		{
			var productInfoDetail = product_info[i];

			str += "»óÇ° ID [" + productInfoDetail[0] + "]";
			str += ", »óÇ°Å¸ÀÔ [" + productInfoDetail[1] + "]";
			str += ", Å¸ÀÌÆ² [" + productInfoDetail[2] + "]";
			str += ", ¾ÆÆ¼½ºÆ® [" + productInfoDetail[3] + "]";
			str += ", ¾Ù¹ü [" + productInfoDetail[4] + "]";
			str += ", ÆÄÀÏÅ©±â [" + productInfoDetail[5] + "]";
			str += ", Àç»ý½Ã°£ [" + productInfoDetail[6] + "]";
			str += ", À½Áú [" + productInfoDetail[7] + "]";
			str += ", Æù²Ù¹Ì±â [" + productInfoDetail[8] + "]";
			str += ", ¸Þ´º¾ÆÀÌµð [" + productInfoDetail[9] + "]\n\n";
		}

		alert(str);
		*/
		var webPlayChk = false;

//		if (!isLogin)
		{
			var _pId = new Array();
			for (var i = 0; i < product_info.length; i++)
			{
				var productInfoDetail = product_info[i];
				//alert(productInfoDetail[10]);
				//if (productInfoDetail[10] == "904" && product_info.length == 1){
				if (productInfoDetail[10] != "" && productInfoDetail[10] == "904"){
					webPlayChk = false;
					if (!isLogin) checkAdultAuth();
					//loginNeedPopup();
					break;
				} else if (productInfoDetail[10] != "904") {
					webPlayChk = true;
					_pId[i] = productInfoDetail[0];
				}
			}
		}
		if (isLogin)
//		else
		{
			
			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : Streaming / Streaming Type = 1 (music)
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager;
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str    = "1" + "\x02" + product_info.length + "\x02" + kind;
					for (var i = 0; i < product_info.length; i++)
					{
						
						var productInfoDetail = product_info[i];


						if ( (iisRating != "904" || imemberType == "$generalMember") && productInfoDetail[10] == "904" ){
							if( imemberType == "$generalMember" ){
								logincheckGenAuth();
								return;
							}else{
								logincheckAdultAuth();
								return;
							}
				
						}
										
						if (productInfoDetail[10] == "901" || (productInfoDetail[10] == "904" && iisRating == "904")) {
							if (productInfoDetail[0].indexOf("(") >= 0)
							{
								productInfoDetail[0] = productInfoDetail[0].substr(0, productInfoDetail[0].lastIndexOf("("));
							}
							str += "\x02" + productInfoDetail[0] + "\t"+ productInfoDetail[1] + "\t"+ productInfoDetail[2] + "\t"+ productInfoDetail[3] + "\t"+ productInfoDetail[4] + "\t"+ productInfoDetail[5] + "\t"+ productInfoDetail[6] + "\t"+ productInfoDetail[7] + "\t"+ productInfoDetail[8] + "\t"+ productInfoDetail[9] + "\t"+ productInfoDetail[10];
						}
					}

					musicONCtrl.Streaming = str;
					return;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
						return;
					}
					else
					{
						// for ¼­¹ö Ãø
						// Web Player ½ÇÇà
						installNeedAlert();
						webPlayChk = true;
					}
				}
			}
		}

		if (webPlayChk) {
			if (kind == "all")
			{
				// web Player ÀüÃ¼µè±â ÇÔ¼ö
				AllPlay (formName);
			}
			else if (kind == "choice")
			{
				// web Player ¼±ÅÃµè±â ÇÔ¼ö
				SelectPlay (formName);
			}
			else if (kind == "single")
			{
				// web Player ÇÑ°îµè±â ÇÔ¼ö
				SinglePlay (_pId);
			}
		}
	} catch (Exception){}
}

/*
	¹ÂÁ÷ºñµð¿À

	FILEPATH

	ex) pcmgr_music_video_play (CMID)
*/
function pcmgr_music_video_play (CMID)
{
	try {	/*
		 var str  = "CMID : " + CMID;

		 alert(str);
		 */

		var webPlayChk = false;

		if (!isLogin)
		{
			loginNeedPopup();
		}
		else
		{
			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : Streaming / Streaming Type = 2 (music video), length = 1
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str	= "2" + "\x02" + "1" + "\x02" + CMID;
				    musicONCtrl.Streaming = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// Web Player ½ÇÇà
						installNeedAlert();
						webPlayChk = true;
					}
				}
			}
		}
	} catch (Exception){}
}

/*
	¹ÂÁ÷ºñµð¿À

	FILEPATH

	ex) pcmgr_music_video_play_selected (product_info, formName)
*/
function pcmgr_music_video_play_selected (product_info, formName)
{
	try {	/*
		 var str  = "CMID : " + CMID;

		 alert(str);
		 */

		var webPlayChk = false;

		if (!isLogin)
		{
			loginNeedPopup();
		}
		else
		{
			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : Streaming / Streaming Type = 2 (music video), length = 1
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str	= "";
					for (var i = 0; i < product_info.length; i++)
					{
						var productInfoDetail = product_info[i];
						str	+= "2" + "\x02" + "1" + "\x02" + productInfoDetail[0];
					}
					musicONCtrl.Streaming = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// Web Player ½ÇÇà
						installNeedAlert();
						webPlayChk = true;
					}
				}
			}
		}
	} catch (Exception){}
}

/*
	¹ÂÁ÷ºñµð¿À by PID

	FILEPATH

	ex) pcmgr_music_video_play_by_pid (PID)
*/
function pcmgr_music_video_play_by_pid (PID)
{
	try {	/*
		 var str  = "PID : " + PID;

		 alert(str);
		 */

		var webPlayChk = false;

		if (!isLogin)
		{
			loginNeedPopup();
		}
		else
		{
			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : Streaming / Streaming Type = 2 (music video), length = 1
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str	= "4" + "\x02" + "1" + "\x02" + PID;
					musicONCtrl.Streaming = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// Web Player ½ÇÇà
						installNeedAlert();
						webPlayChk = true;
					}
				}
			}
		}
	} catch (Exception){}
}

/*
	µ¿¿µ»ó»ùÇÃº¸±â

	1. »óÇ° ID
	2. »óÇ°Á¾·ù         1 - ´ÜÀÏ»óÇ°
	              2 - º¹ÇÕ»óÇ°
	3. Å¸ÀÌÆ²
	4. ¾ÆÆ¼½ºÆ®¸í
	5. Àç»ý½Ã°£
	6. ÁÙ°Å¸®
	7. »ùÇÃÆÄÀÏ°æ·Î
	8. ¾Ù¹üÀÌ¹ÌÁö°æ·Î
	9. ¸Þ´ºID

	ex) pcmgr_video_play ('http://~~~/video001.wmv');
*/
function pcmgr_video_play (product_info, kind)
{
	/*
	var str    = "µ¿¿µ»ó»ùÇÃº¸±â\n\n";

	for (var i = 0; i < product_info.length; i++)
	{
		var productInfoDetail = product_info[i];

		str += "»óÇ° ID [" + productInfoDetail[0] + "]";
		str += ", »óÇ°Á¾·ù [" + productInfoDetail[1] + "]";
		str += ", Å¸ÀÌÆ² [" + productInfoDetail[2] + "]";
		str += ", ¾ÆÆ¼½ºÆ®¸í [" + productInfoDetail[3] + "]";
		str += ", Àç»ý½Ã°£ [" + productInfoDetail[4] + "]";
		str += ", ÁÙ°Å¸® [" + productInfoDetail[5] + "]";
		str += ", »ùÇÃÆÄÀÏ°æ·Î  [" + productInfoDetail[6] + "]";
		str += ", ¾Ù¹üÀÌ¹ÌÁö°æ·Î [" + productInfoDetail[7] + "]\n\n";
		str += ", ¸Þ´ºID [" + productInfoDetail[8] + "]\n\n";
	}
	alert(str);
	*/

	try {

		var webPlayChk = false;

//		if (!isLogin)
		{
			var _pId = new Array();
			for (var i = 0; i < product_info.length; i++)
			{
				var productInfoDetail = product_info[i];
				if (productInfoDetail[9] != "" && productInfoDetail[9] == "904"){
					webPlayChk = false;
					//loginNeedPopup();
					if (!isLogin) checkAdultAuth();
					//break;
				} else {
					webPlayChk = true;
					_pId[i] = productInfoDetail[0];
				}
			}
		}
//		else
		if (isLogin)
		{
			/*---------------------------------------------------------------------------------------
				ActiveX : Streaming / Streaming Type = 3 (video, µ¿¿µ»ó »ùÇÃº¸±â)
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------*/
			var SessionKey;
			var os_check = WEBDown_Check();
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str    = "3" + "\x02" + product_info.length;
					for (var i = 0; i < product_info.length; i++)
					{
						var productInfoDetail = product_info[i];
						if (productInfoDetail[9] == "901" || (productInfoDetail[9] == "904" && iisRating == "904")) {
							str += "\x02" + productInfoDetail[0] + "\t" + productInfoDetail[1] + "\t" + productInfoDetail[2] + "\t"+ productInfoDetail[3] + "\t"+ productInfoDetail[4] + "\t"+ productInfoDetail[5] + "\t"+ productInfoDetail[6] + "\t"+ productInfoDetail[7] + "\t"+ productInfoDetail[8];
						}
					}

					musicONCtrl.Streaming = str;
					return;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
						return;
					}
					else
					{
						// for ¼­¹ö Ãø
						// Web Player ½ÇÇà
						installNeedAlert();
						webPlayChk = true;
					}
				}
			}
		}

		if (webPlayChk)
		{
			if (kind == "all")
			{
				// web Player ÀüÃ¼º¸±â ÇÔ¼ö
				AllPlay (_pId);
			}
			else if (kind == "choice")
			{
				// web Player ¼±ÅÃº¸±â ÇÔ¼ö
				SelectPlay (formName);
			}
			else if (kind == "single")
			{
				// web Player ÇÑ°îº¸±â ÇÔ¼ö
				SinglePlay (_pId);
			}
		}
	} catch (Exception){}
}

/*
	µ¿¿µ»ó°­ÀÇ»ùÇÃº¸±â

	1. ¾Ù¹ü ID
	2. PTID('D01')
	3. »ùÇÃÆÄÀÏ°æ·Î

	ex) pcmgr_video_play ('http://~~~/video001.wmv');
*/
function pcmgr_video_sample_play (product_info, kind)
{
	try {
		var webPlayChk = false;

		if (!isLogin) {
			var _pId = new Array();
			for (var i = 0; i < product_info.length; i++)
			{

				var productInfoDetail = product_info[i];
				//alert(productInfoDetail[5]);
				if (productInfoDetail[5] != "" && productInfoDetail[5] == "904"){
					webPlayChk = false;
					checkAdultAuth();
					//loginNeedPopup();
					//break;
				} else {
					webPlayChk = true;
					_pId[i] = product_info[i][4];
				}
				//_pId[i] = product_info[i][4];
			}
		} else {
					/*---------------------------------------------------------------------------------------
				ActiveX : Streaming / Streaming Type = 3 (video, µ¿¿µ»ó°­ÀÇ »ùÇÃº¸±â)
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------*/
			var SessionKey;
			var os_check = WEBDown_Check();
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					//var str    = "3" + "\x02" + product_info.length;
					for (var i = 0; i < product_info.length; i++)
					{
						//var productInfoDetail = product_info[i];
						str += productInfoDetail[0] + "\t" + productInfoDetail[1] + "\t" + productInfoDetail[2] + "\t" + productInfoDetail[3] + "\t" + productInfoDetail[5];
					}

					musicONCtrl.QupV2 = str;
					return;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
						return;
					}
					else
					{
						// for ¼­¹ö Ãø
						// Web Player ½ÇÇà
						installNeedAlert();
						webPlayChk = true;
					}
				}
			}
		}

		if (webPlayChk)
		{
			if (kind == "single")
			{
				// web Player ÇÑ°îº¸±â ÇÔ¼ö
				SinglePlay (_pId, 'true');
			}
		}
	} catch (Exception){}
}

/*
	´Ù¿î·Îµå

	1. »óÇ° ID
	2. »óÇ°Å¸ÀÔ
	             C01 - ¹ÂÁ÷
	             D01 - µ¿¿µ»ó
	3. Å¸ÀÌÆ²
	4. À¯Çü
	              000 - °Ç´ç (¹ÂÁ÷)
	              001 - È¸º°
	              002 - ÇÏÀÌ¶óÀÌÆ®
	              003 - ¿ä¾àÆí
	              004 - ÀüÆí
	5. °¡°Ý
	6. ÆÄÀÏÅ©±â
	7. À½Áú
	8. ¸Þ´º¾ÆÀÌµð (Ãß°¡)
	9. Àç»ý±¸ºÐ
	10. »ç¿ë±â°£
	11. Non-DRM ±¸¸Å¿©ºÎ(Y/N)
	12. Non-DRM °¡°Ý
	13. Non-DRM ÆÄÀÏ »çÀÌÁî

	ex) var product_info = new Array();

		product_info [0] = {'C01000001', 'C01', 'Ä£±¸¿©', '000', '500', '3834503', '196', '00000238', null, null};

		product_info [1] = {'D01000001', 'D01', 'ÁÖ¸ù1È¸', '001', '1500', '76098882', 'K3G', '00000238', '051', 30};

		pcmgr_download (product_info);
*/
function pcmgr_download (product_info)
{
	try {
		/*
		var str    = "´Ù¿î·Îµå\n\n";

		for (var i = 0; i < product_info.length; i++)
		{
			var productInfoDetail = product_info[i];

			str += "»óÇ° ID [" + productInfoDetail[0] + "]";
			str += ", »óÇ°Å¸ÀÔ [" + productInfoDetail[1] + "]";
			str += ", Å¸ÀÌÆ² [" + productInfoDetail[2] + "]";
			str += ", À¯Çü [" + productInfoDetail[3] + "]";
			str += ", °¡°Ý [" + productInfoDetail[4] + "]";
			str += ", ÆÄÀÏÅ©±â [" + productInfoDetail[5] + "]";
			str += ", À½Áú  [" + productInfoDetail[6] + "]";
			str += ", ¸Þ´º¾ÆÀÌµð [" + productInfoDetail[7] + "]";
			str += ", Àç»ý±¸ºÐ [" + productInfoDetail[8] + "]";
			str += ", »ç¿ë±â°£ [" + productInfoDetail[9] + "]";
			str += ", Non-DRM ±¸¸Å¿©ºÎ(Y/N) [" + productInfoDetail[11] + "]";
			str += ", Non-DRM °¡°Ý [" + productInfoDetail[12] + "]";
			str += ", Non-DRM ÆÄÀÏ »çÀÌÁî [" + productInfoDetail[13] + "]\n\n";
		}
		alert(str);
		*/

		//test-start	//WILL BE DELETED.
		//loginUserRating();
		//var strViewRate = product_info[0];
		//alert(product_info.length);
		//alert("PID= "+strViewRate[0]);
		//alert("myphone= "+strViewRate[8]);
		//alert("VIEWRATE= "+strViewRate[10]);
		//alert("Rating= "+iisRating);
		//if (strViewRate[10] == "901"){
		//	alert("The content that you selected is for "+strViewRate[10]+".\nThis means that you can't use it.\nGet out of here.");
		//	showUnderAgePopup();
		//}
		//test-end		//WILL BE DELETED.

		if (!isLogin)
		{
			//loginNeedPopup();
			var strViewRate = product_info[0];
			//alert(strViewRate[10]);
			if (strViewRate[10] != "904"){
				loginNeedPopup();
				//showAdultCheckPopup(); //¼ºÀÎÀÎÁõ ÆäÀÌÁö È£Ãâ
			}else{
				//showUnderAgePopup();
				checkAdultAuth();
			}
		}
		else
		{
					/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : Download
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					/* -----------------------------------------------------------------------------------------------------
					   °ü¶÷µî±Þ Ã¼Å©
					-----------------------------------------------------------------------------------------------------*/

	                //############################################################
	                //### 2008.07.18 NODRM °ü·Ã ÀÎÅÍÆäÀÌ½º º¯°æ
					//### var str    = product_info.length;
	                //############################################################
					var len    = product_info.length;
					var str    = "";

					str		   += len;
	                //############################################################

					var nodrmStore;

					for (var i = 0; i < product_info.length; i++)
					{
						var productInfoDetail = product_info[i];
						////Content Grade: 18 over, User's year-old(Rating): between 12 and 15
						//if (productInfoDetail[10] == "904" && isRating == "902"){
						//	alert("The content that you select is for 19 over.\nThis means that you can't use it.\nGet out of here.");
						////Content Grade: 18 over, User's year-old(Rating): between 15 and 18
						//}else if(productInfoDetail[10] == "904" && isRating == "903"){
						//	alert("The content that you select is for 19 over.\nThis means that you can't use it.\nGet out of here.");
						////Content Grade: 15 over, User's year-old(Rating): between 12 and 15
						//}else if(productInfoDetail[10] == "903" && isRating == "902"){
						//	alert("The content that you select is for 15 over.\nThis means that you can't use it.\nGet out of here.");
						////Content Grade: 12 over, User's year-old(Rating): 12 under
						//}else if(productInfoDetail[10] == "902" && isRating == "901"){
						//	alert("The content that you select is for 12 over.\nThis means that you can't use it.\nGet out of here.");
						////Content Grade: all
						//if ((productInfoDetail[10] == "904" && iisRating == "902") ||
						//	(productInfoDetail[10] == "904" && iisRating == "903") ||
						//	(productInfoDetail[10] == "903" && iisRating == "902") ||
						//	(productInfoDetail[10] == "902" && iisRating == "901") ){
						if (productInfoDetail[10] == "904" && iisRating != "904") {
							logincheckAdultAuth();
							return;
							
							
						}else{
							//str += "\x02" + productInfoDetail[0] + "\t"+ productInfoDetail[1] + "\t"+ productInfoDetail[2] + "\t"+ productInfoDetail[3] + "\t"+ productInfoDetail[4] + "\t"+ productInfoDetail[5] + "\t"+ productInfoDetail[6] + "\t"+ productInfoDetail[7] + "\t"+ productInfoDetail[8] + "\t"+ productInfoDetail[9];

							//insert that here.

							//var str    = product_info.length;
							//for (var i = 0; i < product_info.length; i++)
							//{
							//	var productInfoDetail = product_info[i];

			                //############################################################
			                //### 2008.07.18 NODRM °ü·Ã ÀÎÅÍÆäÀÌ½º º¯°æ
							//### str += "\x02" + productInfoDetail[0] + "\t"+ productInfoDetail[1] + "\t"+ productInfoDetail[2] + "\t"+ productInfoDetail[3] + "\t"+ productInfoDetail[4] + "\t"+ productInfoDetail[5] + "\t"+ productInfoDetail[6] + "\t"+ productInfoDetail[7] + "\t"+ productInfoDetail[8] + "\t"+ productInfoDetail[9];// + "\t"+ productInfoDetail[10];
			                //############################################################
							str += "\x02" + productInfoDetail[0] + "\t"+ productInfoDetail[1] + "\t"+ productInfoDetail[2] + "\t"+ productInfoDetail[3] + "\t"+ productInfoDetail[4] + "\t"+ productInfoDetail[5] + "\t"+ productInfoDetail[6] + "\t"+ productInfoDetail[7] + "\t"+ productInfoDetail[8] + "\t"+ productInfoDetail[9];// + "\t"+ productInfoDetail[10];

							nodrmStore = (productInfoDetail[11] == "Y");

			                if (nodrmStore) {
			                	if (musicONCtrl.CheckInstallVersion != "V2") {
			                		popupAlert("MP3°ü·Ã ±â´ÉÀº PC ¸Å´ÏÀú 2.0¿¡¼­¸¸ Áö¿øÇÕ´Ï´Ù.");
			                		return;
			                	} else {
									//str += "\t" + productInfoDetail[12] + "\t"+ productInfoDetail[13] + "\t"+ productInfoDetail[14];
			                	}
			                }
				            //############################################################

							//}
						}
					}

					/*if (nodrmStore) {
						musicONCtrl.musicONV2 = "nonDRM_Download" + "\x02" + str;
					} else {*/
						musicONCtrl.Download = str;
					//}
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
						installNeedAlert();
					}
				}
			}
			//located here.
		}
	} catch (Exception){}
}

/*
	¸¶ÀÌÆäÀÌÁö ´Ù¿î·Îµå

	1. »óÇ° ID
	2. »óÇ°Å¸ÀÔ
	             C01 - ¹ÂÁ÷
	             D01 - µ¿¿µ»ó
	3. Å¸ÀÌÆ²
	4. À¯Çü
	              000 - °Ç´ç (¹ÂÁ÷)
	              001 - È¸º°
	              002 - ÇÏÀÌ¶óÀÌÆ®
	              003 - ¿ä¾àÆí
	              004 - ÀüÆí
	5. °¡°Ý
	6. ÆÄÀÏÅ©±â
	7. À½Áú
	8. ¸Þ´º¾ÆÀÌµð (Ãß°¡)
	9. Àç»ý±¸ºÐ
	10. »ç¿ë±â°£
	11. ¼±¹° ¹øÈ£
	12. ÇØ´çÇÔ ±¸ºÐ
					0 : ±¸¸ÅÇÔ
					1 : ¼±¹°ÇÔ
					2 : ¿¹¾àÇÔ
	13. ¼±¹° ¹øÈ£ (¼±¹°ÇÔ¿¡¼­¸¸ »ç¿ë, ³ª¸ÓÁö´Â null)
	14. Non-DRM ±¸¸Å¿©ºÎ(Y/N)
	15. Non-DRM °¡°Ý
	16. Non-DRM ÆÄÀÏ »çÀÌÁî

	ex) var product_info = new Array();

		product_info [0] = {'C01000001', 'C01', 'Ä£±¸¿©', '000', '500', '3834503', '196', '00000238', null, null, '20000000002603', '1', '0'};

		product_info [1] = {'D01000001', 'D01', 'ÁÖ¸ù1È¸', '001', '1500', '76098882', 'K3G', '00000238', '051', 30, '20000000002604', '1', '0'};

		pcmgr_download (product_info);
*/
function pcmgr_mypage_download (product_info)
{
	try {
		/*
		var str    = "¸¶ÀÌÆäÀÌÁö ´Ù¿î·Îµå\n\n";

		for (var i = 0; i < product_info.length; i++)
		{
			var productInfoDetail = product_info[i];

			str += "»óÇ° ID [" + productInfoDetail[0] + "]";
			str += ", »óÇ°Å¸ÀÔ [" + productInfoDetail[1] + "]";
			str += ", Å¸ÀÌÆ² [" + productInfoDetail[2] + "]";
			str += ", À¯Çü [" + productInfoDetail[3] + "]";
			str += ", °¡°Ý [" + productInfoDetail[4] + "]";
			str += ", ÆÄÀÏÅ©±â [" + productInfoDetail[5] + "]";
			str += ", À½Áú  [" + productInfoDetail[6] + "]";
			str += ", ¸Þ´º¾ÆÀÌµð [" + productInfoDetail[7] + "]";
			str += ", Àç»ý±¸ºÐ [" + productInfoDetail[8] + "]";
			str += ", »ç¿ë±â°£ [" + productInfoDetail[9] + "]";
			str += ", ¼±¹°seq [" + productInfoDetail[10] + "]";
			str += ", ÇØ´çÇÔ±¸ºÐ [" + productInfoDetail[11] + "]";
			str += ", ¼±¹°¹øÈ£ [" + productInfoDetail[12] + "]";
			str += ", Non-DRM ±¸¸Å¿©ºÎ(Y/N) [" + productInfoDetail[13] + "]";
			str += ", Non-DRM °¡°Ý [" + productInfoDetail[14] + "]";
			str += ", Non-DRM ÆÄÀÏ »çÀÌÁî [" + productInfoDetail[15] + "]\n\n";
		}
		alert(str);
		*/

		if (!isLogin)
		{
			loginNeedPopup();
		}
		else
		{
			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : Download
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

	                //############################################################
	                //### 2008.07.18 NODRM °ü·Ã ÀÎÅÍÆäÀÌ½º º¯°æ
					//### var str    = product_info.length;
	                //############################################################
					var len    = product_info.length;
					var str    = "";

					str		   += len;
	                //############################################################

					for (var i = 0; i < product_info.length; i++)
					{
						var productInfoDetail = product_info[i];

		                //############################################################
		                //### 2008.07.18 NODRM °ü·Ã ÀÎÅÍÆäÀÌ½º º¯°æ
						//### str += "\x02" + productInfoDetail[0] + "\t"+ productInfoDetail[1] + "\t"+ productInfoDetail[2] + "\t"+ productInfoDetail[3] + "\t"+ productInfoDetail[4] + "\t"+ productInfoDetail[5] + "\t"+ productInfoDetail[6] + "\t"+ productInfoDetail[7] + "\t"+ productInfoDetail[8] + "\t"+ productInfoDetail[9];// + "\t"+ productInfoDetail[10];
		                //############################################################
						str += "\x02" + productInfoDetail[0] + "\t"+ productInfoDetail[1] + "\t"+ productInfoDetail[2] + "\t"+ productInfoDetail[3] + "\t"+ productInfoDetail[4] + "\t"+ productInfoDetail[5] + "\t"+ productInfoDetail[6] + "\t"+ productInfoDetail[7] + "\t"+ productInfoDetail[8] + "\t"+ productInfoDetail[9] + "\t"+ productInfoDetail[10] + "\t"+ productInfoDetail[11] + "\t"+ productInfoDetail[12];

						if (musicONCtrl.CheckInstallVersion == "V2") {
							str += "\t" + productInfoDetail[13] + "\t"+ productInfoDetail[14] + "\t"+ productInfoDetail[15];
						} else {
							if (productInfoDetail[13] == "Y") {
								popupAlert("MP3°ü·Ã ±â´ÉÀº PC ¸Å´ÏÀú 2.0¿¡¼­¸¸ Áö¿øÇÕ´Ï´Ù.");
								return;
							}
						}
			            //############################################################
					}

					if (musicONCtrl.CheckInstallVersion == "V2") {
						musicONCtrl.musicONV2 = "nonDRM_Download" + "\x02" + str;
					} else {
						musicONCtrl.MyPageDownload = str;
					}
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
						installNeedAlert();
					}
				}
			}
		}
	} catch (Exception){}

}

/*
	Àå¹Ù±¸´Ï
*/
function pcmgr_cart()
{
	try {
	//alert('Àå¹Ù±¸´Ï');

	/* -----------------------------------------------------------------------------------------------------------------
		ActiveX : Àå¹Ù±¸´Ï
		- by (ÁÖ)¸ðºôÅ¾
	----------------------------------------------------------------------------------------------------------------- */
	var SessionKey;
	var os_check = WEBDown_Check();
	if (os_check){
	}else{
		APPCheck = musicONCtrl.CheckManager
		if (APPCheck=="true"){
			SessionKey = GetCookie(JSessionID);
			musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

			/*
			var str    = _pid.length;
			for (var i = 0; i < _pid.length; i++)
			{
				str += "," + _pid[i];
			}
			*/

			musicONCtrl.ShoppingCart = "ok";
		}else{
			//AskInstall = musicONCtrl.AskManagerInstall
			AskInstall = askQupInstallPopup();
			if (AskInstall=="true")
			{
				pcmanagerInstall();
			}
			else
			{
				// for ¼­¹ö Ãø
				// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
				installNeedAlert();
			}
		}
	}
	} catch (Exception){}
}


/*
	RSS¿¡¼­ PC Manager ¼³Ä¡ ¿©ºÎ È®ÀÎ
*/
function pcmgr_install_check()
{
	try {
		APPCheck = musicONCtrl.CheckManager

		if (APPCheck=="true"){

		  	location.href="/musicon/jsp/mypage/ChannelSearchPopup.jsp";

		}else{
			//AskInstall = musicONCtrl.AskManagerInstall
			AskInstall = askQupInstallPopup();
			if (AskInstall=="true")
			{
				pcmanagerInstall();
			}
			else
			{
				// for ¼­¹ö Ãø
				// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
				installNeedAlert();
			}
		}
	} catch (Exception){}
}


/*
	¼±¹°ÇÏ±â (¹ÂÁ÷, µ¿¿µ»ó)

	1. »óÇ° ID
	2. »óÇ°Å¸ÀÔ
	             C01 - ¹ÂÁ÷
	             D01 - µ¿¿µ»ó
	3. Å¸ÀÌÆ²
	4. À¯Çü
	              000 - °Ç´ç (¹ÂÁ÷)
	              001 - È¸º°
	              002 - ÇÏÀÌ¶óÀÌÆ®
	              003 - ¿ä¾àÆí
	              004 - ÀüÆí
	5. °ü¶÷µî±Þ
	              001 - ÀüÃ¼ÀÌ¿ë°¡
	              002 - 12¼¼ ÀÌ»ó°¡
	              003 - 15¼¼ ÀÌ»ó°¡
	              004 - 19¼¼ ÀÌ»ó°¡
	6. °¡°Ý
	7. ÆÄÀÏÅ©±â
	8. À½Áú
	9. ¸Þ´º¾ÆÀÌµð (Ãß°¡)
	10. Àç»ý±¸ºÐ
	11. »ç¿ë±â°£

	ex) var product_info = new Array();

		product_info [0] = {'C01000001', 'C01', 'Ä£±¸¿©', '000', 'NULL', '500', '3834503', '196', '00000238', null, null};

		product_info [1] = {'D01000001', 'D01', 'ÁÖ¸ù1È¸', '001', '003', '1500', '76098882', 'K3G', '00000238', '051', 30};

		pcmgr_present (product_info);
*/
function pcmgr_present (product_info)
{
	try {
		/*
		var str    = "¼±¹°ÇÏ±â (¹ÂÁ÷, µ¿¿µ»ó)\n\n";

		for (var i = 0; i < product_info.length; i++)
		{
			var productInfoDetail = product_info[i];

			str += "»óÇ° ID [" + productInfoDetail[0] + "]";
			str += ", »óÇ°Å¸ÀÔ [" + productInfoDetail[1] + "]";
			str += ", Å¸ÀÌÆ² [" + productInfoDetail[2] + "]";
			str += ", À¯Çü [" + productInfoDetail[3] + "]";
			str += ", °ü¶÷µî±Þ [" + productInfoDetail[4] + "]";
			str += ", °¡°Ý [" + productInfoDetail[5] + "]";
			str += ", ÆÄÀÏÅ©±â [" + productInfoDetail[6] + "]";
			str += ", À½Áú [" + productInfoDetail[7] + "]";
			str += ", ¸Þ´º¾ÆÀÌµð [" + productInfoDetail[8] + "]";
			str += ", Àç»ý±¸ºÐ [" + productInfoDetail[9] + "]";
			str += ", »ç¿ë±â°£ [" + productInfoDetail[10] + "]\n\n";
		}

		alert(str);
		*/

		/* -----------------------------------------------------------------------------------------------------------------
			ActiveX : Present
			- by (ÁÖ)¸ðºôÅ¾
		----------------------------------------------------------------------------------------------------------------- */
		var SessionKey;
		var os_check = WEBDown_Check();

		/* -----------------------------------------------------------------------------------------------------
		   °ü¶÷µî±Þ Ã¼Å©
		-----------------------------------------------------------------------------------------------------*/
		if (!isLogin)
		{
			//loginNeedPopup();
			var strViewRate = product_info[0];
			if (strViewRate[4] != "904"){
				loginNeedPopup();
				//showAdultCheckPopup(); //¼ºÀÎÀÎÁõ ÆäÀÌÁö È£Ãâ
			}else{
				showUnderAgePopup();
			}
		}
		else
		{	
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str    = product_info.length;
					for (var i = 0; i < product_info.length; i++)
					{
						var productInfoDetail = product_info[i];
						//if ((productInfoDetail[10] == "904" && iisRating == "902") ||
						//	(productInfoDetail[10] == "904" && iisRating == "903") ||
						//	(productInfoDetail[10] == "903" && iisRating == "902") ||
						//	(productInfoDetail[10] == "902" && iisRating == "901") ){
					
						if (productInfoDetail[10] == "904" && iisRating != "904" ) { //¼ºÀÎÄÜÅÙÃ÷ Â÷
								logincheckAdultAuth();
								return;
						}else if(productInfoDetail[4] == "904" && iisRating != "904" )
						{
							logincheckAdultAuth();
								return;
								
						}else{
							str += "\x02" + productInfoDetail[0] + "\t"+ productInfoDetail[1] + "\t"+ productInfoDetail[2] + "\t"+ productInfoDetail[3] + "\t"+ productInfoDetail[4] + "\t"+ productInfoDetail[5] + "\t"+ productInfoDetail[6] + "\t"+ productInfoDetail[7] + "\t"+ productInfoDetail[8] + "\t"+ productInfoDetail[9] + "\t"+ productInfoDetail[10];
						}
					}
					musicONCtrl.Present = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
						installNeedAlert();
					}
				}
			}
		}
	} catch (Exception){}
}

/*
	Æù²Ù¹Ì±â

	PID : »óÇ° ID

	ex) var PID = new Array();
		var _menuId = new Array();

		PID [0] = 'C01000000001';
		PID [1] = 'C01000000002';

		_menuId [0] = '00000283';
		_menuId [1] = '00000283';

		pcmgr_my_phone(PID, _menuId);
*/
function pcmgr_my_phone (_pid, _menuId,product_info)
{
	try {
		/*
		var str    = "Æù²Ù¹Ì±â\n\n";

		for (var i = 0; i < _pid.length; i++)
		{
			str += "PID [" + _pid[i] + "]\n";
			str += "_menuId [" + _menuId[i] + "]\n\n";
		}

		alert(str);
		*/

		if (!isLogin)
		{
			loginNeedPopup();
		}
		else
		{

			for (var j = 0; j < product_info.length; j++)
			{
				var productInfoDetail = product_info[j];
				if (iisRating != "904" && productInfoDetail[10] == "904"){
			
				logincheckAdultAuth();
				return;		
				}
		
			}

			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : MyPhone : ÇùÀÇ ÇÊ¿ä, ÆÄ¶ó¹ÌÅÍ È®ÀÎ ÇÊ¿ä
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str    = _pid.length;
					for (var i = 0; i < _pid.length; i++)
					{
						str += "\x02" + _pid[i] + "\t"+ _menuId[i];
					}

					musicONCtrl.MyPhone = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
						installNeedAlert();
					}
				}
			}
		}
	} catch (Exception){}
}

/*
	¼±¹°ÇÔ ÇÊ¸µ ¼³Á¤

	PID : »óÇ° ID

	ex) var PID = new Array();
		var _menuId = new Array();

		PID [0] = 'C01000000001';
		PID [1] = 'C01000000002';

		_menuId [0] = '00000283';
		_menuId [1] = '00000283';

		pcmgr_my_phone(PID, _menuId);
*/
function pcmgr_present_feeling (_pid, _menuId)
{
	try {
		/*
		var str    = "Æù²Ù¹Ì±â\n\n";

		for (var i = 0; i < _pid.length; i++)
		{
			str += "PID [" + _pid[i] + "]\n";
			str += "_menuId [" + _menuId[i] + "]\n\n";
		}

		alert(str);
		*/

		if (!isLogin)
		{
			loginNeedPopup();
		}
		else
		{
			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : MyPhone : ÇùÀÇ ÇÊ¿ä, ÆÄ¶ó¹ÌÅÍ È®ÀÎ ÇÊ¿ä
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str = _pid + "\t"+ _menuId;
					musicONCtrl.PresentFeeling = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
						installNeedAlert();
					}
				}
			}
		}
	} catch (Exception){}
}

function pcmgr_fill_up()
{
	try {

		if (false)
		{

			loginNeedPopup();

		}
		else
		{

			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : fill up (ÃæÀüÇÏ±â ¿Ï·á ack):
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){

			}else{

				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					// ÃæÀüÇÏ±â´Â ·Î±×ÀÎ Á¤º¸¸¦ º¸³»Áö ¾Ê°í ±×³É È£ÃâÇÑ´Ù.
					//SessionKey = GetCookie(JSessionID);
					//musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					/*
					var str    = PID.length;
					for (var i = 0; i < PID.length; i++)
					{
						str += "\x02" + PID[i];
					}
					*/

					musicONCtrl.FillUp = "ok";
				}else{
					// PC manager°¡ ¼³Ä¡µÇ¾î ÀÖÁö ¾ÊÀ¸¸é ±×³É ¹«½ÃÇÑ´Ù.
					/*
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						//alert('PC Manager ¼³Ä¡ ÇÁ·Î±×·¥ ¿ë·® °ü°è·Î WebÀ¸·Î ¼³Ä¡´Â ÃßÈÄ ÁøÇà ¿¹Á¤');
						pcmanagerInstall();
					}
					else
					{
						installNeedAlert();
					}
					*/
				}
			}
		}
	} catch (Exception){}
}

/*
	À¥ÆäÀÌÁö¿¡¼­ PC Manager ÆäÀÌÁöÈ£Ãâ

	webUrl : À¥ÆäÀÌÁö URL
	menuId : ¸Þ´º¾ÆÀÌµð (Ãß°¡)
	message_command : Àü¹® Command
	message_params : Àü¹® °¢Ç×¸ñ °ª

	ex) var webUrl = 'http://localhost:7001/musicon/jsp/ctnt.album.AlbumDetail.web?albumId=1000000';
		var message_command = 'CN_ALBUM_MUSIC_LIST';
		var message_params = 'albumId=1000000|page=1|displayCount=50';

		pcmgr_web_link (webUrl, message_command, message_params);"

*/
function pcmgr_web_link_qup (webUrl, menuId, message_command, message_params, isLogin)
{
	try {

		if(!isLogin){

			isLogin = "1";

		}

		/*
		var str  = 'PC Manager ÆäÀÌÁöÈ£Ãâ';
			str += '\n' + 'webUrl : ' + webUrl;
			str += '\n' + 'menuId : ' + menuId;
			str += '\n' + 'message_command : ' + message_command;
			str += '\n' + 'message_params : ' + message_params;
			str += '\n' + 'isLogin : ' + isLogin;
		alert(str);
		*/

		/* -----------------------------------------------------------------------------------------------------------------
			ActiveX : pcmgr_web_link
			- by (ÁÖ)¸ðºôÅ¾
		----------------------------------------------------------------------------------------------------------------- */
		var SessionKey;
		var os_check = WEBDown_Check();

		if (isLogin == 1)
		{
			// Web loginµÈ »óÅÂ¿¡¼­ È£ÃâÇÔ
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str	= webUrl + "\x02" + menuId + "\x02" + message_command + "\x02" + message_params + "\x02" + "QUP";
					musicONCtrl.WebLink = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
						installNeedAlert();
					}
				}
			}
		}
		else
		{
			// Web login ¾ÈµÈ »óÅÂ¿¡¼­ È£ÃâÇÔ
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = "Pass" + "\x02" + "Pass" + "\x02" + TimeoutPCM;

					var str	= webUrl + "\x02" + menuId + "\x02" + message_command + "\x02" + message_params + "\x02" + "QUP";
					musicONCtrl.WebLink = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
						installNeedAlert();
					}
				}
			}
		}



	} catch (Exception){}
}


/*
	QUPÀ¥ÆäÀÌÁö¿¡¼­ PC Manager ÆäÀÌÁöÈ£Ãâ(¸Þ´ÏÀúÀÌ »ó´Ü À½¾Ç ºÎºÐÀ¸·Î ÀÌµ¿ÇÏ±â À§ÇØ)

	webUrl : À¥ÆäÀÌÁö URL
	menuId : ¸Þ´º¾ÆÀÌµð (Ãß°¡)
	message_command : Àü¹® Command
	message_params : Àü¹® °¢Ç×¸ñ °ª

	ex) var webUrl = 'http://localhost:7001/musicon/jsp/ctnt.album.AlbumDetail.web?albumId=1000000';
		var message_command = 'CN_ALBUM_MUSIC_LIST';
		var message_params = 'albumId=1000000|page=1|displayCount=50';

		pcmgr_web_link (webUrl, message_command, message_params);"

*/
function pcmgr_web_link_music (webUrl, menuId, message_command, message_params, isLogin)
{
	try {

		if(!isLogin){

			isLogin = "1";

		}

		/*
		var str  = 'PC Manager ÆäÀÌÁöÈ£Ãâ';
			str += '\n' + 'webUrl : ' + webUrl;
			str += '\n' + 'menuId : ' + menuId;
			str += '\n' + 'message_command : ' + message_command;
			str += '\n' + 'message_params : ' + message_params;
			str += '\n' + 'isLogin : ' + isLogin;
		alert(str);
		*/

		/* -----------------------------------------------------------------------------------------------------------------
			ActiveX : pcmgr_web_link
			- by (ÁÖ)¸ðºôÅ¾
		----------------------------------------------------------------------------------------------------------------- */
		var SessionKey;
		var os_check = WEBDown_Check();

		if (isLogin == 1)
		{
			// Web loginµÈ »óÅÂ¿¡¼­ È£ÃâÇÔ
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str	= webUrl + "\x02" + menuId + "\x02" + message_command + "\x02" + message_params + "\x02" + "MUSIC";
					musicONCtrl.WebLink = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
						installNeedAlert();
					}
				}
			}
		}
		else
		{
			// Web login ¾ÈµÈ »óÅÂ¿¡¼­ È£ÃâÇÔ
			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = "Pass" + "\x02" + "Pass" + "\x02" + TimeoutPCM;

					var str	= webUrl + "\x02" + menuId + "\x02" + message_command + "\x02" + message_params + "\x02" + "MUSIC";
					musicONCtrl.WebLink = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						// for ¼­¹ö Ãø
						// PC Manager ¼³Ä¡°¡ ÇÊ¿äÇÔÀ» ¾Ë¸®´Â arelt
						installNeedAlert();
					}
				}
			}
		}



	} catch (Exception){}
}


/* -----------------------------------------------------------------------------------------------------------------
	OS Ã¼Å©ÇÏ±â
	´ë»ó : Manager¸¦ Áö¿øÇÏÁö ¾Ê´Â À©µµ¿ì ÀÏ°æ¿ì
	- by (ÁÖ)¸ðºôÅ¾
----------------------------------------------------------------------------------------------------------------- */
function WEBDown_Check(){
 	var request_os = window.navigator.appVersion;
 	var subport_os = false
 	var inport_os = new Array("Windows 95","Windows 98","Windows NT 4.0");

	/*
 	var manager_use = Getcookie("manager_use");
 	// ¸Þ´ÏÀú ¼³Ä¡ ¿©ºÎ È®ÀÎ
 	if( manager_use){
 		subport_os = true
 		alert("¹ÂÁ÷¿Â ¸Å´ÏÀú°¡ ¼³Ä¡µÇÁö ¾Ê¾Æ ´Ù¿î·Îµå°¡ ºÒ°¡´É ÇÕ´Ï´Ù.\n¹ÂÁ÷¿Â ¸Å´ÏÀú¸¦ ¼³Ä¡ ÇÏ½Ã¸é ¸ðµç ¼­ºñ½º¸¦ ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.")
	 	return subport_os;
 	}else{
 	*/

 	/*
 	Áö¿ø ºÒ°¡´É À©µµ¿ì
 	Window 95		=> Window 95°³Åë
 	Window 98		=> Window 98°³Åë, Window me
 	Window NT 4.0
 	Áö¿ø °¡´É À©µµ¿ì
 	Windows NT 5.0  => Window 2000
 	Windows NT 5.1  => Window XP
 	Windows NT 5.2  => Window 2003
 	*/
 	for (i=0; i < 3; i++){
 		if(request_os.indexOf(inport_os[i])!=-1 ){
 			subport_os = true
 			alert("Windows 2000¹Ì¸¸¿¡¼­ ¹ÂÁ÷ ¿Â ¸Þ´ÏÀú°¡ ¼³Ä¡ µÇÁö ¾Ê¾Æ ´Ù¿î·Îµå°¡ ºÒ°¡´ÉÇÕ´Ï´Ù.\n Windows 2000 ÀÌ»óÀ¸·Î ¾÷±×·¹ÀÌµå ÇÏ½Ã¸é ¸ðµç ¼­ºñ½º¸¦ ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.")
 			return subport_os;
			break;
 		}
 	}

 	return subport_os;
 }

/* -----------------------------------------------------------------------------------------------------------------
	ÄíÅ° °ª °¡Á®¿À±â for TEST
	- by (ÁÖ)¸ðºôÅ¾
----------------------------------------------------------------------------------------------------------------- */
 function GetCookie(keyName){
 	var tmp, index1,index2,index3;
 	tmp = document.cookie + ";";
 	index1 = tmp.indexOf(keyName, 0);
 	if(index1 !=-1){
 		tmp = tmp.substring(index1,tmp.length);
 		index2 = tmp.indexOf("=",0)+1;
 		index3 = tmp.indexOf(";",index2)
 		return(unescape(tmp.substring(index2,index3)))
 	}
 	return("");
 }

/* -----------------------------------------------------------------------------------------------------------------
	ÄíÅ° °ª °¡Á®¿À±â for TEST
	- by (ÁÖ)¸ðºôÅ¾
----------------------------------------------------------------------------------------------------------------- */
 function SetCookie(keyName,val){
 	tmp = keyName + "="+escape(val)+ ";";
 	tmp += "expires = ";
 	document.cookie = tmp;
 }


/* -----------------------------------------------------------------------------------------------------------------
	ÄíÅ° °ª °¡Á®¿À±â
	- add by (ÁÖ)¸ðºôÅ¾. Serverside¿¡¼­ Àü´Þ ¹ÞÀ½.
----------------------------------------------------------------------------------------------------------------- */
/*
function getcookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);

	if (endstr == -1)
    		endstr = document.cookie.length;

  	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
	var arg = name + "=";
  	var alen = arg.length;
	var clen = document.cookie.length;
  	var i = 0;

  	while (i < clen) {
     		var j = i + alen;
     		if (document.cookie.substring(i, j) == arg)
       			return getcookieVal  ( j);
     		i = document.cookie.indexOf(" ", i) + 1;
     		if (i == 0) break;
   	}
   	

   	return null;
}
*/




/* -----------------------------------------------------------------------------------------------------------------
	PC Manager Install
----------------------------------------------------------------------------------------------------------------- */

function pcmanagerInstall ()
{

	//musicONCtrl.InstallURL = installURL + namePCM;
	//alert('PC Manager ¼³Ä¡ ÇÁ·Î±×·¥ ¿ë·® °ü°è·Î WebÀ¸·Î ¼³Ä¡´Â ÃßÈÄ ÁøÇà ¿¹Á¤');
	if (g_selected_manager_version == "V3") {

			musicONCtrl.InstallURL = "http://dn.musicon.co.kr:6701/wasdata/webdata/musicon/LGTmobilemanager/install/V3/LGTmobilemanagerV3_Install.exe";


	} else {

			musicONCtrl.InstallURL = "http://dn.musicon.co.kr:6701/wasdata/webdata/musicon/LGTmobilemanager/install/LGTmobilemanager_Install.exe";

	}

}







/*
	¸¶ÀÌ¾Ù¹ü ´ã±â

	1. »óÇ° ID
	2. ¸Þ´º¾ÆÀÌµð

	ex) var product_info = new Array();

		product_info [0] = {'C01000001', '00000238'};

		product_info [1] = {'D01000001', '00000238'};

		pcmgr_my_album_add (product_info);
*/
function pcmgr_my_album_add (product_info)
{
	try {
		/*
		var str    = "¸¶ÀÌ¾Ù¹ü ´ã±â\n\n";

		for (var i = 0; i < product_info.length; i++)
		{
			var productInfoDetail = product_info[i];

			str += "»óÇ° ID [" + productInfoDetail[0] + "]";
			str += ", ¸Þ´º ID [" + productInfoDetail[1] + "]\n\n";
		}

		alert(str);
		*/

		if (isLogin)
		{
			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : Streaming / Streaming Type = 1 (music)
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

					var str;
					if (product_info.length > 0)
					{
						var productInfoDetail = product_info[0];
						if (productInfoDetail[0].indexOf("(") >= 0)
						{
							productInfoDetail[0] = productInfoDetail[0].substr(0, productInfoDetail[0].lastIndexOf("("));
						}
						str = productInfoDetail[0] + "|"+ productInfoDetail[1];
					}

					for (var i = 1; i < product_info.length; i++)
					{

						var productInfoDetail = product_info[i];
						if (productInfoDetail[0].indexOf("(") >= 0)
						{
							productInfoDetail[0] = productInfoDetail[0].substr(0, productInfoDetail[0].lastIndexOf("("));
						}
						str += "\t" + productInfoDetail[0] + "|"+ productInfoDetail[1];
					}
					//Ç®¾úÀ½.
					musicONCtrl.MyAlbum = str;
				}else{
					//AskInstall = musicONCtrl.AskManagerInstall
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						installNeedAlert();
					}
				}
			}
		}
		else
		{
			loginNeedPopup();
		}
	} catch (Exception){}
}

/*
	ÇÇ¾¾¸Å´ÏÁ® È£Ãâ - pcmgr_save_pid

	1. product_info -  pid
    2. kind ÇÇ¾¾¸Å´ÏÁ® È­¸éÈ£Ãâ ±¸ºÐÀÚ
       MyAlbumAdd ¸¶ÀÌ¾Ù¹ü´ã±â
       PlayListAdd Àç»ý¸ñ·ÏÀúÀå

*/
function pcmgr_save_pid (product_info, kind)
{
	try {

		if (!isLogin)
		{
			loginNeedPopup();
		}
		else
		{
			/* -----------------------------------------------------------------------------------------------------
			   pid ¹è¿­
			-----------------------------------------------------------------------------------------------------*/
    		var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

			/* -----------------------------------------------------------------------------------------------------
			   ÃÊ±â ±¸ºÐÀÚ "/"
			   parameter ±¸ºÐÀÚ ":"
			   roof±¸ºÐÀÚ "\x02"
			-----------------------------------------------------------------------------------------------------*/
					var str    ="/"+kind+"|";
					for (var i = 0; i < product_info.length; i++)
					{
						var productInfoDetail = product_info[i];
						str += "\x02" + productInfoDetail[0] ;
					}

					musicONCtrl.QupV2 = str;
				}else{
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						installNeedAlert();
					}
				}
			}
			//located here.
		}
	} catch (Exception){}
}

/*
	ÇÇ¾¾¸Å´ÏÁ® È£Ãâ - pcmgr_gourl

	1. kind ÇÇ¾¾¸Å´ÏÁ® È­¸éÈ£Ãâ ±¸ºÐÀÚ
    2. È£ÃâÈÄ ÀÌµ¿ÇØ¾ßÇÒ url

*/
function pcmgr_gourl ( pKind, gourl)
{
	try {

		if (!isLogin)
		{
			loginNeedPopup();
		}
		else
		{
			/* -----------------------------------------------------------------------------------------------------------------
				ActiveX : Download
				- by (ÁÖ)¸ðºôÅ¾
			----------------------------------------------------------------------------------------------------------------- */
			var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

			/* -----------------------------------------------------------------------------------------------------
			   ÃÊ±â ±¸ºÐÀÚ "/"
			   parameter ±¸ºÐÀÚ ":"
			   roof±¸ºÐÀÚ "\x02"
			-----------------------------------------------------------------------------------------------------*/
					var str    ="/"+pKind+"|"+gourl;

					musicONCtrl.QupV2 = str;
				}else{
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						installNeedAlert();
					}

				}
			}
			//located here.
		}
	} catch (Exception){}
}

/*
	ÇÇ¾¾¸Å´ÏÁ® È£Ãâ - pcmgr_download_qcc

	1. product_info -  qccid
    2. kind ÇÇ¾¾¸Å´ÏÁ® È­¸éÈ£Ãâ ±¸ºÐÀÚ
       QccDownload qcc ÆÄÀÏ ´Ù¿î·Îµå

*/
function pcmgr_download_qcc ( downLoadUrl)
{
	try {

		if (!isLogin)
		{
			loginNeedPopup();
		}
		else
		{
			/* -----------------------------------------------------------------------------------------------------
			   pid ¹è¿­
			-----------------------------------------------------------------------------------------------------*/
    		var SessionKey;
			var os_check = WEBDown_Check();

			if (os_check){
			}else{
				APPCheck = musicONCtrl.CheckManager
				if (APPCheck=="true"){
					SessionKey = GetCookie(JSessionID);
					musicONCtrl.LoginRequest = SessionKey + "\x02" + siteURL + "\x02" + TimeoutPCM;

			/* -----------------------------------------------------------------------------------------------------
			   ÃÊ±â ±¸ºÐÀÚ "/"
			   parameter ±¸ºÐÀÚ ":"
			   roof±¸ºÐÀÚ "\x02"
			-----------------------------------------------------------------------------------------------------*/
					musicONCtrl.QupV2 = downLoadUrl;
				}else{
					AskInstall = askQupInstallPopup();
					if (AskInstall=="true")
					{
						pcmanagerInstall();
					}
					else
					{
						installNeedAlert();
					}

				}
			}
			//located here.
		}
	} catch (Exception){}
}
