// º¼·ýÄíÅ°¼³Á¤
function setCookie(name, value, path, service, strExpires, strDomain)
{
	expireDate = new Date();
	if(strExpires == undefined || strExpires == "undefined")
		expireDate.setDate(expireDate.getDate() + 10000000);
	else
		expireDate.setMinutes(expireDate.getMinutes () + strExpires);

	if(strExpires != null)
		strExpires = expireDate.toGMTString();

	strDomainVal = "";
	if(strDomain != undefined)
		strDomainVal = "; domain=" + g_domain;

	document.cookie = name + "=" + escape(value) + strDomainVal +((strExpires == null) ? "" : "; expires="+ strExpires) +((path == null) ? "" : "; path="+ path);

	if(service != "qing" && service != "chkAD_flvPlayer" && service != "partner" && service != "plusbar")
		setVolume();
}

// º¼·ýÄíÅ°Á¤º¸¾ò±â
function getCookie(name)
{
	var argv = getCookie.arguments;
	var argc = getCookie.arguments.length;
	var value = (argc > 1) ? argv[1] : null;

	var cookies = document.cookie.split("; ");

	for (i=0;i<cookies.length;i++)
	{
		var arr = cookies[i].split("=");
		if (name == arr[0]) return unescape(arr[1]);
	}

	return value;
}

// ÄíÅ°»èÁ¦
function delCookie(name, value, path)
{
	 var expireDate = new Date();
	 expireDate.setDate(expireDate.getDate() - 1);
	 document.cookie = name + "=" + escape(value) + "; expires=" + expireDate.toGMTString() +((path == null) ? "" : "; path="+ path);
}

// º¼·ý¼³Á¤
function setVolume()
{
	var movieMute = getCookie("movieMute", "0");
	var movieVol = getCookie("movieVol", "100");

	var els = document.getElementsByName("FLVPlayer");
	for (var i=0; i<els.length; i++)
	{
		els[i].SetVariable.mute(movieMute);
		els[i].SetVariable.volume(movieVol);
	}
}

// µ¿¿µ»ó ¼Ò½ºº¹»ç
//function copySource(id, lngdocid)
//{
//	var url = "QsMovieCopy.asp?id=" + id + "&docid=" + lngdocid;
//	openPopup("winMovieCopy", url, 460, 420, "no");
//}

// ½ºÅ² Ã¼Å©
function checkSkin(form, chkPoint, dbSkinType)
{
	var argSkinType = form.skinType;
	//var choiceCnt = 0;
	//for(i=0;i<argSkinType.length;i++)
	//{
	//	if(argSkinType.options[i].selected)
	//	{
	//		chVal = i;
	//		choiceCnt++;
	//	}
	//}
	//if(choiceCnt == 0)
	//{
	//	alert("½ºÅ²À» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä");
	//	return false;
	//}
	//else if(choiceCnt > 1)
	//{
	//	alert("½ºÅ²Àº ÇÏ³ª¸¸ ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä");
	//	//for(i=0;i<argSkinType.length;i++)
	//	//	argSkinType.options[i].selected = false;
	//	return false;
	//}

	//arrItemInfo = argSkinType.options[chVal].value.split("-");
	arrItemInfo = argSkinType.options[argSkinType.selectedIndex].value.split("-");
	itemStatus = arrItemInfo[2];
	itemCode = arrItemInfo[1];

	if(itemStatus == "8")
	{
		if(chkPoint == "reg")
		{
			if(dbSkinType != itemCode || dbSkinType == "onAir")
			{
				alert("»ç¿ë¸¸·áµÈ ½ºÅ²ÀÔ´Ï´Ù");
				//argSkinType.selectedIndex = 0;
				//choiceSkin("0-DEFAULT-1", form)
				return false;
			}
		}
		else
			return false;
	}

	return true;
}

// ÇÃ·¹ÀÌ¾î ½ºÅ²¼±ÅÃ
function choiceSkin(itemCode, form)
{
	arrItemInfo = itemCode.split("-");
	itemCode = arrItemInfo[1];

	//if(itemCode == "DEFAULT")
	//{
	//	itemUrl = g_qsvr + arrDefaultSkin[0];
	//}
	//else
	//{
	//	var folder1 = itemCode.substr(0, 1);
	//	var folder2 = itemCode.substr(1, 1);
	//	var folder3 = itemCode.substr(2, 1);
	//	var folder4 = itemCode.substr(3, 1);
	//	var folder5 = itemCode.substr(4, 1);
	//	var folder6 = itemCode.substr(5, 1);
	//
	//	itemUrl = g_qsvr + "/_qitem/" + folder1 + "/" + folder2 + "/" + folder3 + "/" + folder4 + "/" + folder5 + "/" + folder6 + "/";
	//	itemUrl += itemCode + "/" + itemCode + "_dp.gif";
	//}
	//
	//document.getElementById("dpItem").src = itemUrl;

	chkSkin = checkSkin(form);
	if(!chkSkin)
	{
		return;
	}
}

// ½ºÅ²¹Ì¸®º¸±â
function previewSkin(form)
{
	//chkSkin = checkSkin(form);
	//if(!chkSkin)
	//{
	//	return;
	//}

	var itemCode = form.skinType.options[form.skinType.selectedIndex].value;
	var arrItemInfo = itemCode.split("-");
	itemCode = arrItemInfo[1];

	openPopup("winSkinPreview", g_qsvr+"/Service/Movie/QsMovieSkinPreview.asp?itemCode=" + itemCode, 565, 640, "no");
}

// ¸ð¹ÙÀÏ ¼­¹öÀÎÄÚµù¿äÃ»
function mvEncoding(goFileName, serviceID)
{
	fileExt  = document.writeform.movieOriFile.value.substr(document.writeform.movieOriFile.value.length - 4);
	fileName = document.writeform.movieFile.value.replace(".flv", fileExt);

	frmProcess.location.href = goFileName + "?fileName=" + fileName + "&serviceID=" + serviceID;
}

// ¸ð¹ÙÀÏ ¼­¹öÀÎÄÚµù¿Ï·á
function msgEncoding(val, num)
{
	switch(val)
	{
		case "O" :
			msg = "";
			break;
		case "W" :
			msg = "¼­¹öÀÎÄÚµù ´ë±âÁßÀÔ´Ï´Ù. ´ë±âÀÚ " + num + "¸í ÀÔ´Ï´Ù";
			break;
		case "E" :
			msg = "Ã³¸®Áß¿¡ ¿¡·¯°¡ ¹ß»ýÇß½À´Ï´Ù";
			break;
	}

	if(msg != "")
		alert(msg);

	if(val == "E")
		return;
	else
		document.writeform.submit();
}

// ÇÃ·¹ÀÌ¾îÀÇ ·Îµù Ã¼Å©¿ë ÇÔ¼ö
//function checkPlayerLoading()
//{
//	var player = document.getElementById("FLVPlayer");
//
//	if (player.PercentLoaded() < 100) return;
//	player.SetVariable.resize();
//
//	clearInterval(checkLoadingIntervalId);
//}

// ½ºÅ²»çÀÌÁî·Î ÇÃ·¹ÀÌ¾î ¸®»çÀÌÁî - ÇÃ·¡½Ã ÇÃ·¹ÀÌ¾î¿¡¼­ È£Ãâ
function resizePlayer(width, height)
{
	//document.getElementById("FLVPlayer").width  = width;
	//document.getElementById("FLVPlayer").height = height;
	document.getElementById("FLVPlayer").style.width  = width +"px";
	document.getElementById("FLVPlayer").style.height = height +"px";
	//return 1;
}

// Å¥À×¼³Ä¡¿©ºÎ È®ÀÎ - ÇÃ·¹ÀÌ¾î¿¡¼­ È£Ãâ
function checkQingApp()
{
	// ¾×Æ¼ºê¿¢½º ¼³Ä¡
	try{
		var obj = new ActiveXObject('Qing.CCheckQingInstall');
		if(obj)
		{
			viewLayer = 0;
		}
		else viewLayer = 1;
	}catch(ex){
		viewLayer = 1;
	}

	return viewLayer;

	// ÄíÅ°Ã¼Å©
	//var setupQingView = getCookie("setupQing");	// 0 : ¿À´ÃÇÏ·ç ÀÌÃ¢º¸Áö¾Ê±âÃ¼Å©
	//
	//if(Installed == true || setupQingView == "0")
	//	document.getElementById("FLVPlayer").qingOk();
	//else
	//	document.getElementById("FLVPlayer").qingDown();
}

// Å¥À×¼³Ä¡
function downQingApp()
{
	checkOS = referOS();
	url = g_qsvr + "/Qing/QQingCompInit.asp?userOs=" + checkOS;

	openPopup("winMovieUpload", url,355,146,"no");
}

function  chkFNFormat(tmp)
{
	fmt = /^\d{12,18}$/;

	if (!fmt.test(tmp))
	{
		return false;
	}
	return true;
}

// ¾÷·Îµå ÆÄÀÏ Ã¼Å©
function chkUploadLimit()
{
	var frm = opener.writeform;
	if(frm.dbFileName == undefined)
	{
		document.location.href = "QsMovieLink.asp";
	}
	else
	{
		var tFName = frm.dbFileName.value;
		var arrFName = tFName.split(".");
		var retVal = chkFNFormat(arrFName[0]);

		if(retVal && arrFName[1].toUpperCase() == "FLV")
		{
			alert("¾÷·Îµå µÈ ÆÄÀÏÀº ¸µÅ©·Î ¼öÁ¤ÀÌ ºÒ°¡´ÉÇÕ´Ï´Ù.");
			return;
		}
		else {
			document.location.href = "QsMovieLink.asp";
		}
	}
}

// ------------------------------------------------------------------------------------
// ³ìÈ­/¾÷·Îµå ½º³À¼¦ °ü·Ã
// ------------------------------------------------------------------------------------
// ½º³À¼¦ Ç¥½Ã
function displaySnapShot(start)
{
	if(start > -1)
		stillStart = start;


	for(i = 0;  i < 5; i++)
	{
		if((i+1) > arrStillInfo.length)
			break;
		
		eval("document.getElementById('img" + (i+1) + "')").src = arrStillInfo[stillStart - i];
		eval("document.getElementById('Layer" + (i+1) + "')").style.display = "block";
	}
}


// ½º³À¼¦ ÀÌÀü/´ÙÀ½
function stillPreNext(act)
{
	if(act == "next")
		start = stillStart - 1;
	else
		start = stillStart + 1;

	if(start - 4 < 0) return;

	if(start > arrStillInfo.length-1) return;

	displaySnapShot(start);
}

// ½º³À¼¦ »èÁ¦
function clearThumnail(num)
{
	if(arrStillInfo.length < 6)
	{
		alert("5°³ÀÌÇÏ·Î »èÁ¦ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
		return;
	}

	snapIndex = eval(stillStart - num);

	for(i = 0; i< arrStillInfo.length; i++)
	{
		if(i >= snapIndex)
			arrStillInfo[i] = arrStillInfo[i+1];
		else
			arrStillInfo[i] = arrStillInfo[i];
	}

	arrStillInfo.pop();
	stillCnt -= 1;
	stillStart -= 1;
	autoSnapShotCnt -= 1;

	if(snapIndex > 4)
	{
		if(snapIndex == arrStillInfo.length)
			start = arrStillInfo.length - 1;
		else
			start = stillStart;
	}
	else
	{
		if(arrStillInfo.length > 3)
			start = arrStillInfo.length-1;
		else
			start = stillStart - 1;
	}

	displaySnapShot(start);
}

//-------------------------------------------------------------
// ÅÂ±× Æ¯¼ö¹®ÀÚ, °ø¹é Ã¼Å© ¹× Á¦°ÅÇÏ±â
// M: ½°Ç¥·Î ¸ÖÆ¼ ÀÔ·Â Çã¿ë)
// S: ½°Ç¥ Á¦ÇÑ..½Ì±Û
//-------------------------------------------------------------
function ChkStrValidate(obj, str, opt)
{
	var iOpt = (typeof(opt) == "undefined"?"M":opt);
	if (iOpt == "M")
		var gnSpecial = "!@#$%^&*()-=\\+|`~<>?/':\"[]{}.; ";
	else
		var gnSpecial = "!@#$%^&*()-=\\+|`~<>?/':\"[]{}.;, ";


	var returnStr = "";
	var sChar;
	var cnt = 0;

	for (var i=0; i<str.length; i++)
	{
		sChar = str.substring(i, i+1);
		if(gnSpecial.indexOf(sChar) >= 0)
		{
			if(sChar == " ")
			{
				returnStr = returnStr + sChar.replace(sChar, "");cnt--;
			}
			else
			{
				returnStr = returnStr + sChar.replace(sChar, "");cnt++;
			}
		}
		else
			returnStr = returnStr + sChar;
	}

	if(cnt > 0)
	{
		obj.value = returnStr;
		return false;
	}
	else
	{
		obj.value = returnStr;
		return true;
	}
}

// ------------------------------------------------------------------------------------
// º°Á¡ °ü·Ã
// ------------------------------------------------------------------------------------
function ShowStarMyQ(StarNum)
{
	for (idx=1;idx<=5;idx++)
	{
		eval("document.getElementById('Star" + idx + "h').style.display = 'none'");

		if (idx <= StarNum)
			eval("document.getElementById('Star" + idx + "').style.display = ''");
		else
			eval("document.getElementById('Star" + idx + "').style.display = 'none'");

		if (idx == StarNum)
			eval("document.getElementById('StarC0" + idx + "').style.display = 'block'");
		else
			eval("document.getElementById('StarC0" + idx + "').style.display = 'none'");
	}

}

function RestoreStarMyQ()
{
	var avgPoint = document.voteform.voteavg.value;

	for (idx=1;idx<=5;idx++)
	{
		if (idx <= avgPoint)
		{
			eval("document.getElementById('Star" + idx + "').style.display = ''");

			if (avgPoint % 1 > 0 && parseInt(avgPoint) == idx)
				eval("document.getElementById('Star" + (idx+1) + "h').style.display = ''");
		}
		else
		{
			eval("document.getElementById('Star" + idx + "').style.display = 'none'");
		}

		eval("document.getElementById('StarC0" + idx + "').style.display = 'none'");
	}

	document.getElementById("totalpoint").innerHTML = document.voteform.votesum.value;
}


var xmlType = "";
function votePointMyQ(strUserid, lngDocID, point)
{
	if(xmlType!="get")
	{
		beforeRequestXHR = function(){
			document.getElementById("StarC99").style.display = "block";
			document.getElementById("StarC99").innerHTML = "Ã³¸®ÁßÀÔ´Ï´Ù.";
		}

		afterRequestXHR = function(sData){
			if (sData.split("\n")[0] == -1) 	// ÀÌ¹Ì Âü¿©ÇÑ °æ¿ì
				document.getElementById("StarC99").innerHTML = "ÀÌ¹Ì Âü¿©ÇÏ¼Ì½À´Ï´Ù.";
			else
			{
				document.getElementById("StarC99").innerHTML = "¿Ï·áµÇ¾ú½À´Ï´Ù.";
				document.voteform.votesum.value = sData.split("\n")[0];
				document.voteform.voteavg.value = sData.split("\n")[1];
				document.getElementById("totalpoint").innerHTML = document.voteform.votesum.value;
				RestoreStarMyQ();
			}

		}

		errorRequestXHR = function(sErr) {
			document.getElementById("StarC99").innerHTML = "Á¶È¸ Áß ¿¡·¯¹ß»ý " + sErr;
		}
		xmlType = "get";
	}

	getRequestXHR("QsMovieVotePoint.asp?id=" + strUserid + "&docid=" + lngDocID + "&point=" + point);
}

function HideStarMentMyQ()
{
	document.getElementById("StarC99").style.display = "none";
}

// ¹®ÀÚ¿­±æÀÌ ¾ò±â
function stringLen(str)
{
	strLength = str.length+(escape(str)+"%u").match(/%u/g).length-1;
	return strLength;
}

// ¼îÇÎSCC º¸±â
function showSccCategory()
{
	var sccComboLy   = document.getElementById("SccCatLy");
	//var ifrm         = document.getElementById("frmCombo");
	var sccComboLyVw = document.getElementById('SccCatLy').style.display;

	//ifrm.style.width  = 200;
	//ifrm.style.height = 160;
	//ifrm.style.left   = 100;
	//ifrm.style.top    = 375;

	document.getElementById('SccCatLy').style.display = "block";

	//if(document.all)
	//ifrm.style.filter="alpha(opacity=15)";
	//else
	//	ifrm.style.MozOpacity = 0.5;
}

// ¼îÇÎSCC È®ÀÎ/Ãë¼Ò Ã³¸®
function setSccCategory(type)
{
	var sccComboLy   = document.getElementById("SccCatLy");
	//var ifrm         = document.getElementById("frmCombo");
	var sccComboLyVw = document.getElementById('SccCatLy').style.display;

	//ifrm.style.width  = 0;
	//ifrm.style.height = 0;
	//ifrm.style.left   = 0;
	//ifrm.style.top    = 0;

	document.getElementById('SccCatLy').style.display = "none";

	//if(document.all)
	//	ifrm.style.filter="alpha(opacity=15)";
	//else
	//	ifrm.style.MozOpacity = 0.5;

	try
	{
		if(type == "ok")
		{
			sccSel = false;
			for(i=0; i<document.writeform.SccCategory.length; i++)
			{
					if(document.writeform.SccCategory[i].checked)
					{
						sccSel = true;
						break;
					}

			}

			if(sccSel == true)
				document.getElementById("sccDP").innerHTML = "¼îÇÎ Ä«Å×°í¸® ¼±ÅÃ¿Ï·á";
			else
				document.getElementById("sccDP").innerHTML = "¼îÇÎ Ä«Å×°í¸®¸¦ ¼±ÅÃÇÏ¼¼¿ä.";
		}
	}catch(e){}
}

// ¼îÇÎ ¹®±¸¼³Á¤
function popMentReg()
{
	openPopup("winMovieShopMent","QsMovieShopMentRegForm.asp",400,250,"no");
}

// ------------------------------------------------------------------------------------
// ¼­¹öÀÎÄÚµù °ü·Ã
// ------------------------------------------------------------------------------------
var intProgressID;
var saveAsFileName;
function OnFileSelected()
{
	var InputFile = document.uploadForm.InputFile.value;
	InputFile = trim(InputFile);

	var fileExtLen = InputFile.length - InputFile.lastIndexOf(".") - 1;
	if(fileExtLen > 4)
	{
		alert("Àß¸øµÈ ÆÄÀÏÇü½Ä ÀÔ´Ï´Ù.");
		return;
	}

	var fileExt = InputFile.slice(InputFile.length-fileExtLen);
	fileExt = fileExt.toLowerCase();

	if(supportExt.indexOf(fileExt) < 0)
	{
		alert(supportExt + " ÆÄÀÏ¸¸ Áö¿øµË´Ï´Ù.");
		return;
	} else {
		document.uploadForm.txtFile.value = InputFile;
	}

	getProgressId('normal');
}

var progressType;
var strServerDomain;
function getProgressId(getType)
{
	//if(progressType!="get")
	//{
		beforeRequestXHR = function() {
			intProgressID = 0;
			document.uploadForm.saveAsFileName.value = "";
			strServerDomain = "";
		}

		afterRequestXHR = function(sData) {
			var InputFile;

			if(getType == "admin")
				InputFile = document.uploadForm.InputFileFlv.value;
			else
				InputFile = document.uploadForm.InputFile.value;
			InputFile = trim(InputFile);

			var fileExtLen = InputFile.length - InputFile.lastIndexOf(".") - 1;
			if(fileExtLen > 4)
			{
				alert("Àß¸øµÈ ÆÄÀÏÇü½Ä ÀÔ´Ï´Ù.");
				return;
			}

			var fileExt = InputFile.slice(InputFile.length-fileExtLen);
			fileExt = fileExt.toLowerCase();

			strServerDomain = sData.split("|rnqns|")[0];
			intProgressID   = sData.split("|rnqns|")[1];
			saveAsFileName  = sData.split("|rnqns|")[2];
			saveAsFileName  = saveAsFileName + "." + fileExt;

			document.uploadForm.saveAsFileName.value = saveAsFileName;
			if(getType != "admin")
				document.writeform.originFilePath.value = InputFile;
		}

		errorRequestXHR = function(sErr) {
			alert("¾÷·ÎµåÃÊ±âÈ­ Áß ¿¡·¯¹ß»ý " + sErr);
		}
		progressType = "get";
	//}

	getRequestXHR("/common/movie/MovieProgressIdProxy.asp");
}

var uploadType;
var progress_timer;
var strUploadFileName;
function getXMLData()
{
	clearTimeout(progress_timer);

	//if(uploadType!="get")
	//{
		beforeRequestXHR = function() {
			if(isUpload == true)
			{
				var InputFile = document.uploadForm.InputFile.value;
				InputFile = trim(InputFile);
				strUploadFileName = InputFile.substr(InputFile.lastIndexOf("\\")+1);

				document.getElementById("uploadFormLy").style.display = "none";
				document.getElementById("progressLy").style.display = "";
				document.getElementById("txtUplodFileName").innerHTML = "[" + strUploadFileName + "] <span class='skyblue02'>¾÷·Îµå Áß</span>ÀÔ´Ï´Ù.";
			}
		}

		afterRequestXHR = function(sData) {
			if(isUpload == true)
			{
				if(trim(sData) == "")
				{
					alert("¾÷·Îµå Áß ¿À·ù¹ß»ý[205] \n ´Ù½Ã ½ÃµµÇØÁÖ½Ê½Ã¿ä ")
					location.reload();
					return;
				}

				disProgress(sData, "normal");

				if(sData == 100)
				{
					uploaInit(2);
				}
				else if(0 <= sData &&  sData < 100)
				{
					progress_timer = setTimeout("getXMLData()", 3000);
				}
			}
		}

		errorRequestXHR = function(sErr) {
			alert("¾÷·Îµå Áß ¿¡·¯¹ß»ý[201] " + sErr);

			uploaInit();
		}
		uploadType = "get";
	//}

	getRequestXHR("/common/movie/MovieProgressProxy.asp?progressid=" + intProgressID + "&serverDomain=" + strServerDomain);
}

function getXMLDataForAdmin()
{
	clearTimeout(progress_timer);

	//if(uploadType!="get")
	//{
		beforeRequestXHR = function() {
			if(isUpload == true)
			{
				var InputFile = document.uploadForm.InputFileFlv.value;
				InputFile = trim(InputFile);
				strUploadFileName = InputFile.substr(InputFile.lastIndexOf("\\")+1);

				//document.getElementById("uploadFormLy").style.display = "none";
				//document.getElementById("progressLy").style.display = "";
				document.getElementById("txtUplodFileName").innerHTML = "[" + strUploadFileName + "] <span class='skyblue02'>¾÷·Îµå Áß</span>ÀÔ´Ï´Ù.";
			}
		}

		afterRequestXHR = function(sData) {
			if(isUpload == true)
			{
				if(trim(sData) == "")
				{
					alert("¾÷·Îµå Áß ¿À·ù¹ß»ý[2051] \n ´Ù½Ã ½ÃµµÇØÁÖ½Ê½Ã¿ä ")
					location.reload();
					return;
				}

				disProgress(sData, "admin");

				if(sData == 100)
				{
					checkMetaInfo();
				}
				else if(0 <= sData &&  sData < 100)
				{
					progress_timer = setTimeout("getXMLDataForAdmin()", 3000);
				}
			}
		}

		errorRequestXHR = function(sErr) {
			alert("¾÷·Îµå Áß ¿¡·¯¹ß»ý[201] " + sErr);

			initCompent('stop');
		}
		uploadType = "get";
	//}

	getRequestXHR("/common/movie/MovieProgressProxy.asp?progressid=" + intProgressID + "&serverDomain=" + strServerDomain);
}

var isUpload = false;
function uploadMovie()
{
	if(document.uploadForm.InputFile.value == "")
	{
		alert("¾÷·ÎµåÇÒ ÆÄÀÏÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä");
		return;
	}

	if(intProgressID == 0 || typeof(intProgressID) == "undefined")
	{
		alert("¾÷·Îµå ¼­¹ö¿¡ Á¢¼ÓÇÏÁö ¸øÇß½À´Ï´Ù\n´Ù½Ã ½ÃµµÇØ ÁÖ¼¼¿ä");
		location.reload();
		return;
	}

	strLog = "¾÷·ÎµåÈ£Ãâ½ÃÀÛ[uploadMovie]-" + strServerDomain + "/Q/uploadSMovie.asp?progressid=" + intProgressID + ", "
	strLog += "fileName=" + document.uploadForm.saveAsFileName.value + ", userid=" + document.uploadForm.id.value;
	frmUpload.location.href = g_qsvr + "/Service/Movie/QsMovieError.asp?gbn=uploadJava&type=call&fileName=" + document.uploadForm.saveAsFileName.value +"&error=" + escape(strLog);

	document.uploadForm.target = "frmUpload";
	document.uploadForm.action = strServerDomain + "/Q/uploadSMovie.asp?progressid=" + intProgressID;
	document.uploadForm.submit();

	isUpload = true;
	progress_timer = setTimeout("getXMLData()", 1000);
}

function uploadErr(strMsg)
{
	clearTimeout(progress_timer);

	alert("¾÷·Îµå Áß ¿¡·¯¹ß»ý[203] " + strMsg);

	uploaInit();
}

function uploadErrForAdmin(strMsg)
{
	clearTimeout(progress_timer);

	alert("¾÷·Îµå Áß ¿¡·¯¹ß»ý[2031] " + strMsg);

	initCompent('stop');
}

function disProgress(lngPer, getType)
{
	if(isUpload == true)
	{
		var graphWidth;
		if(getType == "admin")
			graphWidth = 260;
		else
			graphWidth = 368;

		lngProgress = parseInt(graphWidth * lngPer / 100);
		if(lngPer == 100) lngProgress = graphWidth;
		document.getElementById("imgProgress").style.width = lngProgress;
		document.getElementById("txtProgress").innerHTML = lngPer + "%";
	}
}

var snapType;
var arrThumnailInfo;
var isGetThumnail=false;
var intRetryCnt = 0;
var intRetryLimitCnt = 2;
function getThumnail()
{
	var strSaveAsFileName, strUserId, strFileName;

	if(isGetThumnail)
		return;

	//if(snapType!="get")
	//{
		beforeRequestXHR = function() {
			isGetThumnail     = true;
		}

		afterRequestXHR = function(sData) {
			arrThumnailInfo = sData.split("\n");
			uploaInit(3);
			dispThumnail();
		}

		errorRequestXHR = function(sErr) {
			intRetryCnt++
			if(intRetryCnt <= intRetryLimitCnt)
			{
				strMent			= '<span class="skyblue02">´ëÇ¥ÀÌ¹ÌÁö</span> ÃßÃâ½ÇÆÐ. Àç½ÃµµÇÕ´Ï´Ù.(' + intRetryCnt + ")"
				isGetThumnail	= false;
				document.getElementById("snapshotMent").innerHTML = strMent
				setTimeout('getThumnail()', 1000);
			}
			else
			{
				alert("´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ¿¡ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù.\n" + sErr);
				intRetryCnt = 0;
				uploaInit();
				strError = "´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ Áß ¿¡·¯¹ß»ý[getThumnail] - " + sErr + "(fileName-" + strFileName + ", userid-" + strUserId + ")";
				frmUpload.location.href = g_qsvr + "/Service/Movie/QsMovieError.asp?gbn=snapJava&type=fail&fileName=" + strFileName + "&error=" + escape(strError);
			}
		}
	//	snapType = "get";
	//}

	strSaveAsFileName = document.uploadForm.saveAsFileName.value;
	strUserId         = document.uploadForm.id.value;
	strFileName       = strUserId + "_" +  strSaveAsFileName;

	getRequestXHR("/common/movie/MovieSnapshotProxy.asp?filename=" + strFileName);
}

var strThumnailName;
function dispThumnail()
{
	var strError = "";
	var strSaveAsFileName, strUserId, strFileName;

	strSaveAsFileName = document.uploadForm.saveAsFileName.value;
	strUserId         = document.uploadForm.id.value;
	strFileName       = strUserId + "_" +  strSaveAsFileName;
	

	if(arrThumnailInfo.length == 2)
	{
		if(arrThumnailInfo[1] != "")
		{
			if(arrThumnailInfo[0] > 0)
			{
				document.uploadSubForm.playTime.value = arrThumnailInfo[0];

				arrThumnailList = arrThumnailInfo[1].split(",");
				
				var str = "";
				for(i=0; i<arrThumnailList.length; i++)
				{
					arrThumnail = arrThumnailList[i].split("-");

					if(i == 0)
					{
						str = str + "<li><table class='on' id='snap" + i + "'><tr><td><a href='javascript:choiceThumnail(" + i + ");'><img src='" + g_editorsvr + "/getFileUU.asp?mnf=" + arrThumnail[1].replace("_", "?") + "'></a></td></tr></table></li>";
						strThumnailName = arrThumnail[1];
					}
					else
					{
						str = str + "<li><table id='snap" + i + "'><tr><td><a href='javascript:choiceThumnail(" + i + ");'><img src='" + g_editorsvr + "/getFileUU.asp?mnf=" + arrThumnail[1].replace("_", "?") + "'></a></td></tr></table></li>";
					}
				}

				document.uploadSubForm.stilImgGroup.value = arrThumnailInfo[1];
				document.getElementById("snapshotList").innerHTML = str;
			}
			else
			{
				alert("Àç»ý½Ã°£ÀÌ 0ÀÎ Àß¸øµÈ ¿µ»óÀÔ´Ï´Ù.");
				uploaInit();
				strError = "Error(Àç»ý½Ã°£ÀÌ 0ÀÎ Àß¸øµÈ ¿µ»óÀÔ´Ï´Ù.)-/common/movie/MovieSnapshotProxy.asp?filename=" + strFileName;
			}
		}
		else
		{
			if(arrThumnailInfo[0] < 0)
			{
				alert("´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ¿¡ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù");
				uploaInit();
				strError = "Error([102]´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ¿¡ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù.)-/common/movie/MovieSnapshotProxy.asp?filename=" + strFileName;
			}
			else
			{
				intRetryCnt++
				if(intRetryCnt <= intRetryLimitCnt)
				{
					strMent			= '<span class="skyblue02">´ëÇ¥ÀÌ¹ÌÁö</span> ÃßÃâ½ÇÆÐ. Àç½ÃµµÇÕ´Ï´Ù.(' + intRetryCnt + ")"
					isGetThumnail	= false;
					document.getElementById("snapshotMent").innerHTML = strMent
					setTimeout('getThumnail()', 1000);
				}
				else
				{
					alert("´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ¿¡ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù");
					intRetryCnt = 0;
					uploaInit();
					strError = "Error([101]´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ¿¡ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù.)-/common/movie/MovieSnapshotProxy.asp?filename=" + strFileName;
				}
			}
		}
	}
	else
	{
		alert(arrThumnailInfo[0])
		if(arrThumnailInfo[0] == -999)
		{
			alert("´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ¿¡ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù");
			intRetryCnt = 0;
			uploaInit();
			strError = "Error(´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ¿¡ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù. µ¿¿µ»ó ÆÄÀÏÀÌ ÀúÀåµÇÁö ¾Ê¾Ò½À´Ï´Ù)-/common/movie/MovieSnapshotProxy.asp?filename=" + strFileName;
		}
		else
		{
			intRetryCnt++
			if(intRetryCnt <= intRetryLimitCnt)
			{
				strMent			= '<span class="skyblue02">´ëÇ¥ÀÌ¹ÌÁö</span> ÃßÃâ½ÇÆÐ. Àç½ÃµµÇÕ´Ï´Ù.(' + intRetryCnt + ")"
				isGetThumnail	= false;
				document.getElementById("snapshotMent").innerHTML = strMent
				setTimeout('getThumnail()', 1000);
			}
			else
			{
				alert("´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ¿¡ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù\nµ¿¿µ»ó Æ÷¸ËÀ» º¯°æÇÏ¿© ¾÷·ÎµåÇØÁÖ¼¼¿ä");
				intRetryCnt = 0;
				uploaInit();
				strError = "Error(´ëÇ¥ÀÌ¹ÌÁö ÃßÃâ¿¡ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù. µ¿¿µ»ó Æ÷¸ËÀ» º¯°æÇÏ¿© ¾÷·ÎµåÇØÁÖ¼¼¿ä.)-/common/movie/MovieSnapshotProxy.asp?filename=" + strFileName;
			}
		}
	}

	if(strError != "")
	{
		if(strError == undefined || strError == "undefined" || typeof(strError) == "undefined")
		{
			strError = "Àß¸øµÈ ÆÄÀÏ¸í[dispThumnail]-" + strFileName + "(" + strServerDomain + "," + strSaveAsFileName + "," + strUserId + ")";
		}

		frmUpload.location.href = g_qsvr + "/Service/Movie/QsMovieError.asp?gbn=snapJava&type=fail&fileName=" + strFileName + "&error=" + escape(strError);
	}
}

function choiceThumnail(num)
{
	for(i=0; i<5; i++)
	{
		document.getElementById("snap" + i).className = "";
	}

	document.getElementById("snap" + num).className = "on";

	arrThumnailList = arrThumnailInfo[1].split(",");
	strThumnailName = arrThumnailList[num].split("-")[1];
	document.uploadSubForm.stilImgName.value = strThumnailName;
}

function OnStilFileSelected()
{
	var InputFile = document.uploadForm.StilFile.value;
	InputFile = trim(InputFile);

	var fileExtLen = InputFile.length - InputFile.lastIndexOf(".") - 1;
	if(fileExtLen > 4)
	{
		alert("Àß¸øµÈ ÆÄÀÏÇü½Ä ÀÔ´Ï´Ù.");
		return;
	}

	var fileExt = InputFile.slice(InputFile.length-fileExtLen);
	fileExt = fileExt.toLowerCase();

	if(fileExt != "jpg")
	{
		alert("´ëÇ¥ÀÌ¹ÌÁö´Â 10K¹Ì¸¸ÀÇ JPG ÆÄÀÏ¸¸ Áö¿øµË´Ï´Ù.");
		return;
	} else {
		document.uploadForm.txtStilFile.value = InputFile;
	}
}

function encCheckStart()
{
	if(typeof(document.uploadForm.StilFile) == "object")
	{
		if(document.uploadForm.txtStilFile.value == "")
			encStart();
		else
		{
			if(arrThumnailInfo.length == 2)		// ½º¼¦ÀÌ Á¦´ë·Î ÃßÃâµÈ °æ¿ì
			{
				if(arrThumnailInfo[1] != "")	// ÃßÃâµÈ ½º¼¦ÀÌ¹ÌÁö ¸®½ºÆ®°¡ Á¦´ë·Î ³Ñ¾î¿Â °æ¿ì
				{
					if(arrThumnailInfo[0] > 0)	// Àç»ý½Ã°£ÀÌ 0ÀÌ»óÀÎ ¿µ»ó
					{
						arrThumnailList = arrThumnailInfo[1].split(",");
						arrThumnailName = arrThumnailList[0].split("-")
						strMovieSnapPath = document.uploadForm.txtStilFile.value;

						document.getElementById("btn1_snap").display = "none";
						document.getElementById("btn2_snap").display = "block";
						document.uploadSubForm.stilImgName.value = arrThumnailName[1];

						var strUploadUrl = g_upsvr + "/Q/uploadMovieSnap.asp?saveAsFileName=" + arrThumnailName[1];

						try
						{
							Upload.Reset();
							intFileSize = Upload.AddFile("thumnail", strMovieSnapPath);
							if(intFileSize > 15360)
							{
								alert("´ëÇ¥ÀÌ¹ÌÁöÀÇ ¿ë·®Àº 15K ¹Ì¸¸ ÀÔ´Ï´Ù.")
								return;
							}
							Upload.Upload(strUploadUrl);
						}
						catch (e)
						{
							alert("¾÷·Îµå ½ÇÆÐ : " + e.description);
						}
						
					}
				}
			}
		}
	}
	else
		encStart();
}

function snapUploadComplete()
{
	snapGroup = document.uploadSubForm.stilImgGroup.value;
	startNum = snapGroup.indexOf("-");
	// ±³Ã¼µÈ ½º¼¦Àº ¹«Á¶°Ç 0ÃÊ¿¡ ÂïÈù°ÍÀ¸·Î Ã³¸®
	newSnapGroup = "0" + snapGroup.substring(startNum);
	document.uploadSubForm.stilImgGroup.value = newSnapGroup;
	
	encStart();
}

function encStart()
{
	strObjid = document.uploadSubForm.objid.value;
	strActMode = document.writeform.actMode.value;

	if(strObjid != "PTN01" && strObjid != "PTN02")
		uploaInit(4);

	if(document.uploadSubForm.stilImgName.value == "")
	{
		choiceThumnail(0);
	}

	var lngObjSeq = "";
	if(strActMode == "write")
	{
		if(strObjid == "QCOM03")
			strSubmitURL = "QsMovieWriteSe.asp";
		else if(strObjid == "QTVS01")
			strSubmitURL = "QTVMovieWriteSe.asp";
		else if(strObjid == "GCOM61")
			strSubmitURL = "CsBBSWriteSe.asp";
		else if(strObjid == "LCOM00")
			strSubmitURL = "LsStoreRegSe.asp";
		else if(strObjid == "LCOM01")
			strSubmitURL = "LsStoreMovieWriteSe.asp";
		else if(strObjid == "PTN01")
			strSubmitURL = g_qtvsvr + "/movie/QTVMovieWriteSe.asp?serviceType=PTN01";
		else if(strObjid == "PTN02")
			strSubmitURL = g_qsvr + "/Service/movie/QsMovieWriteSe.asp?serviceType=PTN02";
		else if(strObjid == "FCOM26")
			strSubmitURL = "/mail/movie/FwMovieWriteSe.asp";


		if(strObjid == "GCOM61")
			lngObjSeq = document.writeform.ObjSeq.value;
		else if(strObjid == "LCOM00" || strObjid == "LCOM01" || strObjid == "PTN01" || strObjid == "FCOM26")
		{
			// ¾Æ¹«Ã³¸® ¾ÈÇÔ
		}
		else
			lngObjSeq = document.writeform.ObjSeq[document.writeform.ObjSeq.selectedIndex].value;
	}
	else if(strActMode == "update")
	{
		if(strObjid == "QCOM03")
		{
			strSubmitURL = "QsMovieUpdateSe.asp";
			lngObjSeq = document.writeform.ObjSeq.value;
		}
		else if(strObjid == "QTVS01")
			strSubmitURL = "QTVMovieUpdateSe.asp";
		else if(strObjid == "GCOM61")
		{
			strSubmitURL = "CsBBSUpdateSe.asp";
			lngObjSeq = document.writeform.ObjSeq.value;
		}
		else if(strObjid == "LCOM00")
			strSubmitURL = "LsStoreUpdateSe.asp";
		else if(strObjid == "LCOM01")
			strSubmitURL = "LsStoreMovieUpdateSe.asp";
		else if(strObjid == "PTN01")
			strSubmitURL = g_qtvsvr + "/movie/QTVMovieUpdateSe.asp?serviceType=PTN01";
		else if(strObjid == "PTN02")
			strSubmitURL = g_qsvr + "/service/movie/QsMovieUpdateSe.asp?serviceType=PTN02";
	}
	else
	{
		alert("µî·ÏÁß ¿À·ù¹ß»ý");
		return;
	}

	if(lngObjSeq != "")
		document.uploadSubForm.TargetObjSeq.value = lngObjSeq;

	document.uploadSubForm.attachedFile.value = document.uploadForm.saveAsFileName.value;

	//document.uploadSubForm.target = "frmUpload";
	document.uploadSubForm.action = strSubmitURL;
	document.uploadSubForm.submit();
}

function uploaInit(step)
{
	try
	{
		document.getElementById("uploadFormLy").style.display   = "none";
		document.getElementById("progressLy").style.display     = "none";
		document.getElementById("makeSnapshot").style.display   = "none";
		document.getElementById("choiceSnapshot").style.display = "none";
		document.getElementById("uploadlayoutLy").style.display = "none";

		// µî·Ï¹öÆ° ¼û±èÃ³¸®
		try{
			document.getElementById("btn1").style.display = "none";
			document.getElementById("btn3").style.display = "";
		}catch(e){
			try{
				// µ¿¿µ»ó¸ÞÀÏÀÎ °æ¿ì(»óÇÏ ¹öÆ°µÎ°³ Ã³¸®)
				document.getElementById("btn1_0").style.display = "none";
				document.getElementById("btn1_5").style.display = "none";
				document.getElementById("btn3_0").style.display = "";
				document.getElementById("btn3_5").style.display = "";
			}catch(e){}
		}

		isUpload = false;
		strObjid = document.uploadSubForm.objid.value;


		if(step == 0)			// ¾÷·ÎµåÁß ¿¡·¯
		{
			document.getElementById("uploadFormLy").style.display   = "";
			document.getElementById("uploadlayoutLy").style.display = "";
		}
		else if(step == 1)		// ¾÷·Îµå ½Ãµµ
		{
			document.getElementById("btnUpload").style.display      = "none";

			document.getElementById("uploadFormLy").style.display   = "";
			document.getElementById("uploadlayoutLy").style.display = "";

			setLayInit("", 452, 230, defaultLeft, defaultTop)
		}
		else if(step == 2)		// ½º³À¼¦ »ý¼ºÁß
		{
			document.getElementById("makeSnapshot").style.display   = "";
			document.getElementById("uploadlayoutLy").style.display = "";

			setTimeout('getThumnail()', 1000);
		}
		else if(step == 3)		// ½º³À¼¦ ¼±ÅÃ
		{
			document.getElementById("snapshotList").innerHTML       = "";
			document.getElementById("choiceSnapshot").style.display = "";
			document.getElementById("uploadlayoutLy").style.display = "";
		}
		else if(step == 4 || step == 5)		// ÀÎÄÚµù ¿äÃ» or PCÄ· ³ìÈ­·Î ÀÌµ¿
		{
			setLayInit("SET", 0, 0, 0, 0);
		}
		else					// Ãë¼Ò½Ã
		{
			if(strObjid =="PTN01" || strObjid =="PTN02")
			{
				window.close();
			}
			else
			{
				document.getElementById("btnUpload").style.display = "";
				try{
					document.getElementById("btn1").style.display = "";
					document.getElementById("btn3").style.display = "none";
				}catch(e){
					try{
						// µ¿¿µ»ó¸ÞÀÏÀÎ °æ¿ì(»óÇÏ ¹öÆ°µÎ°³ Ã³¸®)
						document.getElementById("btn1_0").style.display = "";
						document.getElementById("btn1_5").style.display = "";
						document.getElementById("btn3_0").style.display = "none";
						document.getElementById("btn3_5").style.display = "none";
					}catch(e){}
				}

				isGetThumnail           = false;
				frmUpload.location.href = "about:blank";

				setLayInit("SET", 0, 0, 0, 0);
			}
		}
	}catch(e){}
}

function setLayInit(type, intWidth, intHeight, intLeft, intTop)
{
	// ÄÞº¸¼û±è ¾ÆÀÌÇÁ·¹ÀÓ Á¶Á¤
	try
	{
		var ifrm         = document.getElementById("frmCombo");
		ifrm.style.width  = intWidth;
		ifrm.style.height = intHeight;
		ifrm.style.left   = intLeft;
		ifrm.style.top    = intTop;

		if(document.all)
			ifrm.style.filter="alpha(opacity=15)";
		else
			ifrm.style.MozOpacity = 0.5;
	}catch (e){}
	

	if(type == "SET")
	{
		// ·¹ÀÌ¾î À§Ä¡Á¶Á¤
		document.getElementById("uploadlayoutLy").style.pixelTop  = defaultTop;
		document.getElementById("uploadlayoutLy").style.pixelLeft = defaultLeft;
	}
}

function RegErr(strMsg)
{
	alert("¾÷·Îµå µî·Ï Áß ¿¡·¯¹ß»ý[204] " + strMsg);
	uploaInit();
}

var encType;
function getProgress()
{
	clearTimeout(encProgress_timer);

	if(encType!="get")
	{
		beforeRequestXHR = function() {
		}

		afterRequestXHR = function(sData) {

			if(sData >= 0)
			{
				lngProgress = parseInt(183 * sData / 100);
				if(sData > 100) lngProgress = 183;
				document.getElementById("imgEncProgress").style.width = lngProgress;
				//document.getElementById("txtEncProgress").innerHTML = strUploadFileName + "....ÀÎÄÚµùÁß" + sData + "%";

				if(sData >= 100)
					document.getElementById("txtEncProgress").innerHTML = "... ÀÎÄÚµù ¿Ï·á!";
				else
					document.getElementById("txtEncProgress").innerHTML = "... ÀÎÄÚµùÁß " + sData + "%";
			}
			else if(sData == -1)
			{
				//document.getElementById("txtEncProgress").innerHTML = strUploadFileName + "....ÀÎÄÚµù ÁØºñÁßÀÔ´Ï´Ù.";
				document.getElementById("txtEncProgress").innerHTML = "... ÀÎÄÚµù ÁØºñÁßÀÔ´Ï´Ù.";
			}
			else if(sData == -2)
			{
				//document.getElementById("txtEncProgress").innerHTML = strUploadFileName + "....ÀÎÄÚµù ½ÇÆÐ";
				document.getElementById("txtEncProgress").innerHTML = "... ÀÎÄÚµù ½ÇÆÐ";
			}

			if(sData > -2 && sData < 100)
					encProgress_timer = setTimeout('getProgress()',1000);
		}

		errorRequestXHR = function(sErr) {
		}

		encType = "get";
	}

	strFileName = document.uploadForm.saveAsFileName.value;
	strFileName = strFileName.slice(0, strFileName.length-4);
	strUserid   = document.uploadForm.id.value;

	getRequestXHR("/common/movie/MovieGetXML.asp?filename=" + strFileName + "&userid=" + strUserid);
}

var encProgress_timer;
function completeCallEnc(lngDocid)
{

	var InputFile = document.uploadSubForm.attachedFile.value;
	var strObjid  = document.uploadSubForm.objid.value;

	var fileExtLen = InputFile.length - InputFile.lastIndexOf(".") - 1;
	if(fileExtLen > 4)
	{
		alert("Àß¸øµÈ ÆÄÀÏÇü½Ä ÀÔ´Ï´Ù.");
		return;
	}

	strFileName = InputFile.slice(0, InputFile.length-fileExtLen);

	document.writeform.DocId.value        = lngDocid;
	//document.writeform.StilImgName.value  = strFileName + "jpg";
	document.writeform.StilImgName.value  = document.uploadSubForm.stilImgName.value;
	document.writeform.stilImgGroup.value  = document.uploadSubForm.stilImgGroup.value;
	document.writeform.movieFile.value    = strFileName + "flv";
	document.writeform.playTime.value     = 0;
	document.writeform.playViewSize.value = "480*360";
	document.writeform.bitRate.value      = 500;
	document.writeform.movieType.value    = "SE";

	// µî·Ï¹öÆ° Ã³¸®
	try{
		document.getElementById("btn1").style.display = "";
		document.getElementById("btn3").style.display = "none";
	}catch(e){
		try{
			document.getElementById("btn1_0").style.display = "";
			document.getElementById("btn1_5").style.display = "";
			document.getElementById("btn3_0").style.display = "none";
			document.getElementById("btn3_5").style.display = "none";
		}catch(e){}
	}

	if(strObjid == "QCOM03" || strObjid == "GCOM61")
	{
		if(document.getElementById("Content").value == "")
			document.getElementById("Content").className = "textbg input";
		encProgress_timer = setTimeout('getProgress()',1000);
	}
	else if(strObjid == "QTVS01")
	{
		document.getElementById("mov").style.display = "none";
		document.getElementById("trPlayProgress").style.display = "block";


		if(document.getElementById("Content").value == "")
			document.getElementById("Content").className = "textbg";
		else
			document.getElementById("Content").className = "";
		//document.getElementById("tdContent").className = "tit";


		strActMode = document.writeform.actMode.value;
		if(strActMode == "write")
			document.getElementById("TagInfoBox").style.pixelTop = 0;

		cookieVol = getCookie("movieVol");
		if(cookieVol == "" || cookieVol == null)
			cookieVol = 80;

		cookieMute = getCookie("movieMute");
		if(cookieMute == "" || cookieMute == null)
			cookieMute = 0;

		encPlayerURL = playerURL + "&docId=" + lngDocid + "&movieMute=" + cookieMute + "&movieVol=" + cookieVol;
		document.getElementById("FLVPlayer").movie = encPlayerURL;
	}
	else if(strObjid == "LCOM00"||strObjid == "LCOM01")
	{
		document.getElementById("LyPlayProgress").style.display = "";

		if(strObjid == "LCOM01")
		{
			if(document.getElementById("Content").value == "")
				document.getElementById("Content").className = "textbg input";
			else
				document.getElementById("Content").className = "textbg02 input";
		}

		cookieVol = getCookie("movieVol");
		if(cookieVol == "" || cookieVol == null)
			cookieVol = 80;

		cookieMute = getCookie("movieMute");
		if(cookieMute == "" || cookieMute == null)
			cookieMute = 0;

		encPlayerURL = playerURL + "&docId=" + lngDocid + "&movieMute=" + cookieMute + "&movieVol=" + cookieVol;
		document.getElementById("FLVPlayer").movie = encPlayerURL;
	}
	else if(strObjid == "PTN01")
	{
		document.writeform.action = "PsMovieWriteForm.asp";
		document.writeform.submit();
	}
	else if(strObjid == "PTN02")
	{
		document.writeform.action = "PsMovieMyQWriteForm.asp";
		document.writeform.submit();
	}
	else if(strObjid == "FCOM26")
	{
		document.getElementById("skinPreview").style.display = "block";

		cookieVol = getCookie("movieVol");
		if(cookieVol == "" || cookieVol == null)
			cookieVol = 80;

		cookieMute = getCookie("movieMute");
		if(cookieMute == "" || cookieMute == null)
			cookieMute = 0;

		encPlayerURL = playerURL + "&docId=" + lngDocid + "&movieMute=" + cookieMute + "&movieVol=" + cookieVol;
		document.getElementById("FLVPlayer").movie = encPlayerURL;
	}
	//uploaInit();
}

function completeRecordCallEnc(strError)
{
	var strObjid
	
	if(typeof(opener.document.uploadSubForm) == "object")
		strObjid  = opener.document.uploadSubForm.objid.value;
	else if(typeof(opener.document.writeform) == "object")
		strObjid  = opener.document.writeform.objid.value;

	// µî·Ï¹öÆ° ¼û±èÃ³¸®
	try{
		opener.document.getElementById("btn1").style.display = "";
		opener.document.getElementById("btn3").style.display = "none";
	}catch(e){
		try{
			// µ¿¿µ»ó¸ÞÀÏÀÎ °æ¿ì(»óÇÏ ¹öÆ°µÎ°³ Ã³¸®)
			opener.document.getElementById("btn1_0").style.display = "";
			opener.document.getElementById("btn1_5").style.display = "";
			opener.document.getElementById("btn3_0").style.display = "none";
			opener.document.getElementById("btn3_5").style.display = "none";
		}catch(e){}
	}

	if(strError == "Y") return;
	
	if(strObjid == "QCOM03" || strObjid == "GCOM61")
	{
		opener.document.getElementById("imgEncProgress").style.width = 183;
		opener.document.getElementById("txtEncProgress").innerHTML = "³ìÈ­ ¿µ»óÀÌ ¾÷·Îµå µÇ¾ú½À´Ï´Ù";
	}
	else if(strObjid == "QCOM09")
	{
		// ¿µ»ó¹æ¸í·Ï½Ã ÀÌ¹ÌÁö, ¾Æ¹ÙÅ¸¹æ¸í·ÏÀ¸·Î ÀüÈ¯ ÇÔ¼ö
		opener.dpImg(true,'M');
	}
	else if(strObjid == "QTVS01")
	{
		// Å¥Æ¼ºñ ¹Ì¸®º¸±â È£Ãâ
		opener.moviePopComplete();

		opener.document.getElementById("mov").style.display = "none";
		opener.document.getElementById("trPlayProgress").style.display = "block";

		if(opener.document.getElementById("Content").value == "")
			opener.document.getElementById("Content").className = "textbg";
		else
			opener.document.getElementById("Content").className = "";
		//opener.document.getElementById("tdContent").className = "tit";

		strActMode = opener.document.writeform.actMode.value;
		if(strActMode == "write")
			opener.document.getElementById("TagInfoBox").style.pixelTop = 0;

		cookieVol = getCookie("movieVol");
		if(cookieVol == "" || cookieVol == null)
			cookieVol = 80;

		cookieMute = getCookie("movieMute");
		if(cookieMute == "" || cookieMute == null)
			cookieMute = 0;

		// µî·Ï¾ÈµÈ °Ô½Ã¹° ¹Ì¸®º¸±â¶ó ¹æ¸í·Ï ¼­ºñ½º ÄÚµå·Î º¸¿©ÁÜ(±¤°í ¹× °ü·Ã ¸ðµÎ ¹æ¸í·Ï¿¡ µû¸§)
		encPlayerURL = opener.playerURL + "&fileName=" + opener.document.writeform.movieFile.value.replace(".flv","")
		encPlayerURL += "&qGrpId=" + opener.document.writeform.id.value + "&liveId=-1&movieMute=" + cookieMute + "&movieVol=" + cookieVol;

		opener.document.getElementById("FLVPlayer").movie = encPlayerURL;
	}
	else if(strObjid == "LCOM00"||strObjid == "LCOM01")
	{
		opener.document.getElementById("LyPlayProgress").style.display = "";

		if(strObjid == "LCOM01")
		{
			if(opener.document.getElementById("Content").value == "")
				opener.document.getElementById("Content").className = "textbg input";
			else
				opener.document.getElementById("Content").className = "textbg02 input";
		}

		cookieVol = getCookie("movieVol");
		if(cookieVol == "" || cookieVol == null)
			cookieVol = 80;

		cookieMute = getCookie("movieMute");
		if(cookieMute == "" || cookieMute == null)
			cookieMute = 0;


		// µî·Ï¾ÈµÈ °Ô½Ã¹° ¹Ì¸®º¸±â¶ó ¹æ¸í·Ï ¼­ºñ½º ÄÚµå·Î º¸¿©ÁÜ(±¤°í ¹× °ü·Ã ¸ðµÎ ¹æ¸í·Ï¿¡ µû¸§)
		encPlayerURL = opener.playerURL + "&fileName=" + opener.document.writeform.movieFile.value.replace(".flv","")
		encPlayerURL += "&qGrpId=" + opener.document.writeform.id.value + "&liveId=-1&movieMute=" + cookieMute + "&movieVol=" + cookieVol;

		opener.document.getElementById("FLVPlayer").movie = encPlayerURL;
	}
	else if(strObjid == "PTN01")
	{
		document.writeform.action = "PsMovieWriteForm.asp";
		document.writeform.submit();
	}
	else if(strObjid == "PTN02")
	{
		document.writeform.action = "PsMovieMyQWriteForm.asp";
		document.writeform.submit();
	}
	else if(strObjid == "FCOM26")
	{
		opener.document.getElementById("skinPreview").style.display = "block";

		cookieVol = getCookie("movieVol");
		if(cookieVol == "" || cookieVol == null)
			cookieVol = 80;

		cookieMute = getCookie("movieMute");
		if(cookieMute == "" || cookieMute == null)
			cookieMute = 0;

		// µî·Ï¾ÈµÈ °Ô½Ã¹° ¹Ì¸®º¸±â¶ó ¹æ¸í·Ï ¼­ºñ½º ÄÚµå·Î º¸¿©ÁÜ(±¤°í ¹× °ü·Ã ¸ðµÎ ¹æ¸í·Ï¿¡ µû¸§)
		encPlayerURL = opener.playerURL + "&fileName=" + opener.document.writeform.movieFile.value.replace(".flv","")
		encPlayerURL += "&qGrpId=" + opener.document.writeform.id.value + "&liveId=-1&movieMute=" + cookieMute + "&movieVol=" + cookieVol;

		opener.document.getElementById("FLVPlayer").movie = encPlayerURL;
	}

	//uploaInit();
}

function seUploadLyMove(aEvent)
{
	var localEvent = aEvent ? aEvent : window.event;

	if (localEvent.button==1&&dragapproved)
	{
		document.getElementById("uploadLyTitle").style.cursor = "move";

		if(temp1 == 0)
		{
			document.getElementById("uploadlayoutLy").style.pixelLeft = defaultLeft;
		}
		else
		{
			if(temp1+localEvent.clientX-x1 > leftboundary)
			{
				document.getElementById("uploadlayoutLy").style.pixelLeft = Math.min(rightboundary, temp1+localEvent.clientX-x1);
			}
			else
			{
				document.getElementById("uploadlayoutLy").style.pixelLeft = Math.max(0, temp1+localEvent.clientX-x1);
			}
		}

		if(temp2 == 0)
		{
			document.getElementById("uploadlayoutLy").style.pixelTop = defaultTop;
		}
		else
		{
			if( temp2+localEvent.clientY-y1 > 0)
			{
				document.getElementById("uploadlayoutLy").style.pixelTop = Math.min(topboundary, temp2+localEvent.clientY-y1);
			}
			else
			{
				document.getElementById("uploadlayoutLy").style.pixelTop = Math.max(0, temp2+localEvent.clientY-y1);
			}
		}

		setLayInit("", 452, 230, document.getElementById("uploadlayoutLy").style.pixelLeft, document.getElementById("uploadlayoutLy").style.pixelTop)

		return false;
	}
}

function seUploadLyDrags(aEvent)
{
	var localEvent = aEvent ? aEvent : window.event;

	dragapproved = true;
	temp1 = document.getElementById("uploadlayoutLy").style.pixelLeft;
	temp2 = document.getElementById("uploadlayoutLy").style.pixelTop;
	x1    = localEvent.clientX;
	y1    = localEvent.clientY;

	document.onmousemove = seUploadLyMove;
	document.onmouseup = new Function("dragapproved=false");
}

isShowCat = false;
function showHideCat()
{
	if(isShowCat == false)
		MM_showHideLayers('Layer1','','show')
	else
		MM_showHideLayers('Layer1','','hide')

	isShowCat = !isShowCat;
}

//°íÈ­Áú»ç¿ëÀÚ ºñÆ®·¹ÀÌÆ® ¼³Á¤
function chgBitRate()
{
	var strBitRate = document.uploadForm.userBiteRate.options[document.uploadForm.userBiteRate.selectedIndex].value;
	document.uploadSubForm.bitrate.value = strBitRate;
}

// ------------------------------------------------------------------------------------
// Àç»ýÈ÷½ºÅä¸® °ü·Ã
// ------------------------------------------------------------------------------------
isViewHistory = false;
function viewPlayHistory(fileName, playDomain, type)
{
	isViewHistory      = !isViewHistory;

	if(isViewHistory)
	{
		document.getElementById("playHistory").style.display = "block";
		getPlayHistList(fileName, playDomain, type);
	}
	else
	{
		document.getElementById("playHistory").style.display = "none";
	}
}

var detailLyNum = "";
function viewPlayHistoryDetail(lyNum, fileName, playDomain, type)
{
	detailLyNum = lyNum;
	lyDisplay   = eval("document.getElementById('playHistoryDetail" + lyNum + "')").style.display;

	if(lyDisplay == "none")
	{
			eval("document.getElementById('playHistoryDetail" + lyNum + "')").style.display = "block";
			eval("document.getElementById('showText" + lyNum + "')").innerHTML = "Á¢±â<img src='" + g_imgsvr + "/qtv/ico/ico_up.gif' />";
	}
	else
	{
			eval("document.getElementById('playHistoryDetail" + lyNum + "')").style.display = "none";
			eval("document.getElementById('showText" + lyNum + "')").innerHTML = "¿­±â<img src='" + g_imgsvr + "/qtv/ico/ico_down.gif' />";
	}

	if(lyDisplay == "none")
	{
		getPlayHistList(fileName, playDomain, type);
	}

}

function retPlayHistList()
{
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			playList = xmlHttp.responseText;
			if(playList == "")
			{
				strHistory = "Àç»ýµÈ ÁÖ¼Ò°¡ ¾ø½À´Ï´Ù.";
			}
			else
			{
				arrPlayList = playList.split("|");

				strHistory = "";
				for(index =0; index<arrPlayList.length-1; index++)
				{
					playInfo = arrPlayList[index].split("-");

					if(playInfo[0].substring(0, 4).toLowerCase() == "http")
						dispURL = playInfo[0]
					else
						dispURL = "¾Ë¼ö¾øÀ½"


					strHistory += "<li>";
					strHistory += "	<span class='no'>" + (index+1) + ".</span>";
					strHistory += "	<span class='link'><a href=\"javascript:viewPlayHistoryDetail(" + (index+1) + ", '" + PlayHistFileName + "', '" + playInfo[0] + "', 'detail')\">" + dispURL + "</a></span>";
					strHistory += "	<span class='play'>" + playInfo[1] + "</span>";
					strHistory += "	<span class='open'><a href=\"javascript:viewPlayHistoryDetail(" + (index+1) + ", '" + PlayHistFileName + "', '" + playInfo[0] + "', 'detail')\"><span id='showText" + (index+1) + "'>¿­±â<img src='" + g_imgsvr + "/qtv/ico/ico_down.gif' /></span></a></span>";
					strHistory += "</li>";
					strHistory += "<li id='playHistoryDetail" + (index+1) + "' style='display:none;' class='cont longcut'></li>";
				}
			}
			document.getElementById("playHistoryLst").innerHTML = strHistory;
			document.getElementById("playHistoryLst").style.overflowY = "scroll";
			document.getElementById("playHistoryLst").style.overflowX = "hidden";
		}
	}
}

function retPlayHistDetailList()
{
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			playList = xmlHttp.responseText;
			if(playList == "")
			{
				strHistory = "Àç»ýµÈ ÁÖ¼Ò°¡ ¾ø½À´Ï´Ù.";
			}
			else
			{
				arrPlayList = playList.split("|");

				strHistory = "";
				for(index =0; index<arrPlayList.length-1; index++)
				{
					playInfo = arrPlayList[index].split("-");

					if (index != 0)
						strHistory += "<br>";

					if(playInfo[0] == "about:blank" || playInfo[0] == "null" || playInfo[0] == "undefined")
						strHistory += "<NOBR>[" + playInfo[1] + "] ¾Ë¼ö¾øÀ½</NOBR>";
					else
						strHistory += "<NOBR>[" + playInfo[1] + "] <a href='" + playInfo[0] + "' target='_blank'>" + playInfo[0] + "</a></NOBR>";
				}
			}
			eval("document.getElementById('playHistoryDetail" + detailLyNum + "')").innerHTML = strHistory;
		}
	}
}

var PlayHistFileName = "";
function getPlayHistList(fileName, playDomain, type)
{
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.xmlHttp");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}

	PlayHistFileName = fileName;


	xmlHttp.open("post", "/common/movie/MoviePlayHistory.asp?type=" + type + "&filename=" + fileName + "&playDomain=" + playDomain, true);
	if(type == "detail")
			xmlHttp.onreadystatechange = retPlayHistDetailList;
	else
		xmlHttp.onreadystatechange = retPlayHistList;
	xmlHttp.send(null);
}


// ------------------------------------------------------------------------------------
// ³ìÈ­ÇÏ±â(ÆíÁýÇÏ±â·Î È®Àå¿¹Á¤)
// ------------------------------------------------------------------------------------
// PCÄ·³ìÈ­(ÀÏ¹Ý Layer¿ë)
function recordingTool()
{
	var target = "QsMovieEditRecord.asp";
	var strObjid  = document.uploadSubForm.objid.value;

	if(strObjid == "GCOM61" || strObjid == "FCOM26")
		openUrl = "movie/QsMovieCompInit.asp";
	else
		openUrl = "QsMovieCompInit.asp";

	checkOS = referOS();
	url = openUrl + "?userOs=" + checkOS + "&target=" + target;

	openPopup("winMovieUpload", url,355,146,"no");

	uploaInit(5);
}

// PCÄ·³ìÈ­(ÇÃ·§ÆûÁ¦ÈÞ ÆË¾÷¿ë)
function recordingToolPartner()
{
	var lngObjSeq = "";

	try
	{
		lngObjSeq = document.writeform.ObjSeq.options[document.writeform.ObjSeq.selectedIndex].value;
		lngObjSeq = lngObjSeq.replace("|rnqns|", "|rnqnsrnqns|");
	}catch(e){}

	var target = "QsMovieEditRecord.asp?enterWay=partner|rnqns|bbsInfo=" + lngObjSeq;

	checkOS = referOS();
	url = "QsMovieCompInit.asp?userOs=" + checkOS + "&target=" + target;

	location.href = url;
}

// ------------------------------------------------------------------------------------
// Äü¸®½ºÆ® °ü·Ã
// ------------------------------------------------------------------------------------
var QuickList = {
	intQPage: 1,
	intQMovieCntPerPage: 9999999,
	intQTotCnt: 0,
	intQPageCnt: 0,
	vntQuickListInfo: null,
	
	strQImgErrUrl: g_imgsvr + "/QTV/common/img_movie_thum.gif",	
	queryUrl: "/common/movie/MovieQuickList.asp",
	delUrl: "/common/movie/MovieDelQuickList.asp",
	
	getList: function(delIndex){
		new Ajax.Request(this.queryUrl, {
				method: 'get',
				asynchronous: true,
				contentType: 'application/x-www-form-urlencoded',
				encoding: 'euc-kr',
				parameters: {},
				onSuccess: function(xmlHttp){
					document.getElementById("imgDelAll").style.display	= "block";
					this.setList(xmlHttp,delIndex);
	        		}.bind(this)
	     	});
	},
	setList: function(xmlObj,delIndex){
		var movieListNode = xmlObj.responseXML.getElementsByTagName("movieList")[0];
		var itemNodes 	  = movieListNode.childNodes;
		this.intQTotCnt   = itemNodes.length;
		this.intQPageCnt  = parseInt(this.intQTotCnt / this.intQMovieCntPerPage);
		if(this.intQTotCnt % this.intQMovieCntPerPage > 0) this.intQPageCnt = this.intQPageCnt + 1;
		if(this.intQTotCnt > 0){
			this.vntQuickListInfo = new Array(this.intQTotCnt-1);
			for(var index=0; index<itemNodes.length; index++){
				this.vntQuickListInfo[index] = {};
				this.vntQuickListInfo[index].linkUrl = itemNodes[index].childNodes.item(7).firstChild.nodeValue;
				this.vntQuickListInfo[index].image = g_editorsvr + "/GetFileU.asp?mnf="	+ itemNodes[index].childNodes.item(9).firstChild.nodeValue + "?" + itemNodes[index].childNodes.item(17).firstChild.nodeValue + ".jpg";
				this.vntQuickListInfo[index].title = itemNodes[index].childNodes.item(2).firstChild.nodeValue;
				this.vntQuickListInfo[index].uid = itemNodes[index].childNodes.item(0).firstChild.nodeValue+"-"+itemNodes[index].childNodes.item(1).firstChild.nodeValue;
				//if(this.vntQuickListInfo[index].title.length > 6)
				//	this.vntQuickListInfo[index].title = this.vntQuickListInfo[index].title.substr(0, 6) + ".."
			}
			document.getElementById('qListCount').innerHTML = " ("+this.intQTotCnt+")";
			this.movePage('init', delIndex)
		}
		else{
			document.getElementById('qListCount').innerHTML			= "";
			document.getElementById("imgDelAll").style.display		= "none";
			document.getElementById("myQuickListPoket").className	= "myQuickList";
			document.getElementById("myQuickListPoket").innerHTML	= '<img src="' + g_imgsvr + '/qtv_new/common/txt_qlist.gif" width="190" height="121" border="0" alt="+ ¹öÆ°À» Å¬¸¯ÇÏ¿© Äü¸®½ºÆ®¸¦ ´ãÀ¸¼¼¿ä." />'
		}
	},
	movePage: function(type, delIndex){
		if(type=="prev" && (this.intQPage <= 1)) return;
		if(type=="next" && (this.intQPage >= this.intQPageCnt)) return;
		if(type == "prev")
			this.intQPage = this.intQPage - 1;
		else if(type == "next")
			this.intQPage = this.intQPage + 1;
		else{
			if(delIndex >= 0){
				this.intQPage = (delIndex+1)%this.intQMovieCntPerPage==0 ? (delIndex+1)/this.intQMovieCntPerPage : Math.floor((delIndex+1)/this.intQMovieCntPerPage)+1;
				this.intQPage = this.intQTotCnt%this.intQMovieCntPerPage==0 ? this.intQPage-1:this.intQPage;
			}else{
				this.intQPage = (this.intQTotCnt%this.intQMovieCntPerPage)==0 ? this.intQTotCnt/this.intQMovieCntPerPage : Math.floor(this.intQTotCnt/this.intQMovieCntPerPage)+1;
			}
		}
		startNum = (this.intQPage - 1) * this.intQMovieCntPerPage;
		endNum = startNum + this.intQMovieCntPerPage - 1;
		if(endNum > this.intQTotCnt -1) endNum = this.intQTotCnt -1
		this.displayList(startNum, endNum);
	},
	displayList: function(intQStartNum, intQEndNum){
		var listStr = "";

		listStr	+= '<div class="listBox">';
		for(index=intQStartNum; index<=intQEndNum; index++)	{
			strLink 		= this.vntQuickListInfo[index].linkUrl;
			strStilImgUrl	= this.vntQuickListInfo[index].image;
			strSubject		= this.vntQuickListInfo[index].title;
			strDocId		= this.vntQuickListInfo[index].uid;

			listStr	+= '<dl id="qList.'+index+'">';
			listStr += '	<dd class="img"><a href="' + strLink + '"><img src="' + strStilImgUrl + '" onerror="this.src=\'' + this.strQImgErrUrl + '\'" width="47" height="35" border="0" /></a><span class="btndel"><a href="javascript:QuickList.delList('+index+',\''+strDocId+'\')"><img src="' + g_imgsvr + '/qtv_new/btn/btn_del_item.gif" width="11" height="11" border="0" alt="Äü¸®½ºÆ®¿¡¼­ »èÁ¦" title="Äü¸®½ºÆ®¿¡¼­ »èÁ¦"/></a></span></dd>'
			listStr += '	<dt><a href="' + strLink + '">' + strSubject + '</a></dt>'
			listStr += '</dl>';
		}
		listStr	+= '</div>';
		
		document.getElementById("myQuickListPoket").innerHTML = listStr;
	},
	delList: function(delIndex, uid){
		var delObj = document.getElementById('qList.'+delIndex);
		if(delObj){
			var arrDelInfo = uid.split("-");
			var param = "objid=" + arrDelInfo[1] + "&docid=" + arrDelInfo[0];
			
			new Ajax.Request(this.delUrl, {
					method: 'get',
					asynchronous: true,
					contentType: 'application/x-www-form-urlencoded',
					encoding: 'euc-kr',
					parameters: param,
					onSuccess: function(xmlHttp){
						delObj.parentNode.removeChild(delObj);
						this.getList(delIndex);
					}.bind(this)
		     	});
		}
	},
	delAll: function(){
		if(confirm("Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")){
			var param = "type=all";

			new Ajax.Request(this.delUrl, {
					method: 'get',
					asynchronous: true,
					contentType: 'application/x-www-form-urlencoded',
					encoding: 'euc-kr',
					parameters: param,
					onSuccess: function(xmlHttp){
						alert("ÀüÃ¼ »èÁ¦ µÇ¾ú½À´Ï´Ù");
						document.getElementById('qListCount').innerHTML			= "";
						document.getElementById("imgDelAll").style.display		= "none";
						document.getElementById("myQuickListPoket").className	= "myQuickList";
						document.getElementById("myQuickListPoket").innerHTML	= '<img src="' + g_imgsvr + '/qtv_new/common/txt_qlist.gif" width="190" height="121" border="0" alt="+ ¹öÆ°À» Å¬¸¯ÇÏ¿© Äü¸®½ºÆ®¸¦ ´ãÀ¸¼¼¿ä." />'
					}.bind(this)
				});
		}
	}
}

function retPutQuickList()
{
	if(xmlHttp.readyState == 4){		
		if(xmlHttp.status == 200){
			moiveInfo = xmlHttp.responseText;
			arrMoiveInfo = moiveInfo.split("|");

			//if(confirm("Äü¸®½ºÆ® ´ã±â°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù.\n´ã±âÇÑ ¿µ»óÀ» È®ÀÎÇÏ½Ã°Ú½À´Ï±î?"))
			//{
			//	if(arrMoiveInfo[1] == "QTVS01")
			//		url = g_qtvsvr + "/movie/QTVMovieView.asp?docid=" +  arrMoiveInfo[0]
			//	else
			//		url = "/common/Movie/MovieQuickListView.asp?objid=" + arrMoiveInfo[1] + "&docid=" +  arrMoiveInfo[0]
			//	if(arrMoiveInfo[2] != "")
			//		eval(arrMoiveInfo[2]).location.href = url
			//	else
			//		location.href = url
			//}
			//else
			//{
				//if(arrMoiveInfo[2] !="")
				//{
				//	alert(eval("ifrmBest.document.getElementById('" + arrMoiveInfo[3] + "')"))
				//	eval(arrMoiveInfo[2] + ".document.getElementById('" + arrMoiveInfo[3] + "')").style.display	= "none";
				//	eval(arrMoiveInfo[2] + ".document.getElementById('" + arrMoiveInfo[3].replace("_IMG", "_MENT") + "')").style.display	= "block";
				//}
				//else
				//{
					eval("document.getElementById('" + arrMoiveInfo[3] + "')").style.display	= "none";
					eval("document.getElementById('" + arrMoiveInfo[3].replace("_IMG", "_MENT") + "')").style.display	= "block";
				//}

				if(arrMoiveInfo[2] !="")
					parent.QuickList.getList();
				else
					QuickList.getList();
			//}
		}
	}
}

function putQuickList(objid, docid, lnkTarget, obj)
{
	var serviceNm = obj.name;

	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.xmlHttp");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}

	url = "/common/movie/MoviePutQuickList.asp?objid=" + objid + "&docid=" + docid + "&target=" + lnkTarget + "&serviceNm=" + serviceNm;

	xmlHttp.open("post", url, true);
	xmlHttp.onreadystatechange = retPutQuickList;
	xmlHttp.send(null);
}

// ------------------------------------------------------------------------------------
// ³»°¡º» µ¿¿µ»ó
// ------------------------------------------------------------------------------------
var lastViewList = {
	intPage: 1,
	intMovieCntPerPage: 2,
	intTotCnt: 0,
	intTotNodeCnt:0,
	intPageCnt: 0,
	vntlastViewListInfo: null,
	
	strStilImgErrUrl: g_imgsvr + "/QTV/common/img_movie_thum.gif",
	queryUrl: "/common/movie/MovieLatestViewListForPaging.asp",
	delUrl: "/common/movie/MovieLatestViewListForPagingDel.asp",
	logUrl: "/common/qtv/TargetWiseLog.asp",
	
	getList: function(objid){
		var param = "page=" + this.intPage + "&pageSize=" + this.intMovieCntPerPage + "&objid=" + objid;

		new Ajax.Request(this.queryUrl, {
			method: 'get',
			asynchronous: true,
			contentType: 'application/x-www-form-urlencoded',
			encoding: 'euc-kr',
			parameters: param,
			onSuccess: function(xmlHttp){
				this.setList(xmlHttp);
			}.bind(this)
		});
	},
	setList: function(xmlObj){
		var movieListNode	= xmlObj.responseXML.getElementsByTagName("movieList")[0];
		var itemNodes		= movieListNode.childNodes;
		this.intTotNodeCnt	= itemNodes.length;
		this.intTotCnt		= xmlObj.responseXML.getElementsByTagName("movieList").item(0).getAttribute("listTotalCnt");

		this.intPageCnt		= parseInt(this.intTotCnt / this.intMovieCntPerPage);
		if(this.intTotCnt % this.intMovieCntPerPage > 0) this.intPageCnt = this.intPageCnt + 1;
		if(this.intTotNodeCnt > 0){
			this.vntLastViewListInfo = new Array(this.intTotNodeCnt-1);
			for(var index=0; index<itemNodes.length; index++){
				this.vntLastViewListInfo[index] = {};
				this.vntLastViewListInfo[index].linkUrl	= itemNodes[index].childNodes.item(7).firstChild.nodeValue;
				this.vntLastViewListInfo[index].image	= g_editorsvr + "/GetFileU.asp?mnf="	+ itemNodes[index].childNodes.item(10).firstChild.nodeValue + "?" + itemNodes[index].childNodes.item(9).firstChild.nodeValue + ".jpg";
				this.vntLastViewListInfo[index].title	= itemNodes[index].childNodes.item(2).firstChild.nodeValue;
				this.vntLastViewListInfo[index].uid		= itemNodes[index].childNodes.item(0).firstChild.nodeValue+"-"+itemNodes[index].childNodes.item(1).firstChild.nodeValue;
			}
			
			startNum = 0
			endNum = this.intMovieCntPerPage - 1;
			if(endNum > this.intTotNodeCnt -1) endNum = this.intTotNodeCnt -1

			this.displayList(startNum, endNum);
		}
		else{
			document.getElementById("watchedMov").style.display = "none";
		}
	},
	setWiseLog: function(strAction){
		var param;
		if (strAction == "prev") param = "LogSection=QTV000_RMLT01_001";
		else param = "LogSection=QTV000_RMLT01_003";
		
		new Ajax.Request(this.logUrl, {
			method: 'get',
			asynchronous: true,
			contentType: 'application/x-www-form-urlencoded',
			encoding: 'euc-kr',
			parameters: param,
			onSuccess: function(xmlHttp){

			}.bind(this)
		});
	},
	initPage: function(type, objid){
		if(type=="prev" && (this.intPage <= 1)) return;
		if(type=="next" && (this.intPage >= this.intPageCnt)) return;
		if(type == "prev"){
			this.intPage = this.intPage - 1;
			this.setWiseLog("prev");
		}else if(type == "next"){
			this.intPage = this.intPage + 1;
			this.setWiseLog("next");
		}
		this.getList(objid)
	},
	displayList: function(intStartNum, intEndNum){
		var listStr = "";

		listStr	+= '<ul>';
		for(index=intStartNum; index<=intEndNum; index++)	{
			strLink 		= this.vntLastViewListInfo[index].linkUrl;
			strStilImgUrl	= this.vntLastViewListInfo[index].image;
			strSubject		= this.vntLastViewListInfo[index].title;
			strDocId		= this.vntLastViewListInfo[index].uid;

			listStr	+= '<li>';
			listStr	+= '	<dl>';
			listStr	+= '		<dd class="img"><a href="' + strLink + '"><img src="' + strStilImgUrl + '" onerror="this.src=\'' + this.strStilImgErrUrl + '\'" width="75" height="55" border="0" /></a><span class="btndel"><a href="javascript:lastViewList.delList(\''+strDocId+'\')"><img src="' + g_imgsvr + '/qtv_new/btn/btn_del_item.gif" width="11" height="11" border="0" alt="»èÁ¦"/></a></span></dd>';
			listStr	+= '		<dt><a href="' + strLink + '">' + strSubject + '</a></dt>';
			listStr	+= '	</dl>';
			listStr	+= '</li>';
		}
		listStr	+= '</ul>';

		document.getElementById("lastViewListPoket").innerHTML = listStr;
	},
	delList: function(uid){
		var arrDelInfo = uid.split("-");
		var param = "page=" + this.intPage + "&pageSize=" + this.intMovieCntPerPage + "&objid=" + arrDelInfo[1] + "&docid=" + arrDelInfo[0];
		
		new Ajax.Request(this.delUrl, {
				method: 'get',
				asynchronous: true,
				contentType: 'application/x-www-form-urlencoded',
				encoding: 'euc-kr',
				parameters: param,
				onSuccess: function(xmlHttp){
					this.setList(xmlHttp);
				}.bind(this)
		});
	}
}

// ------------------------------------------------------------------------------------
// ¿£½áÁî¿¬µ¿ °ü·Ã
// ------------------------------------------------------------------------------------
function playTimeDisp(lngPlayTime, strSeparate)
{
	switch(strSeparate)
	{
		case "s":
			strSeparate_h = "½Ã";
			strSeparate_m = "ºÐ";
			strSeparate_s = "ÃÊ";
			break;
		default :
			strSeparate_h = ":";
			strSeparate_m = ":";
			strSeparate_s = "";
	}

	lngSecond	= lngPlayTime % 60;
	lngMinute	= parseInt(lngPlayTime / 60);
	lngHour		= 0
	if(lngMinute > 60)
	{
		lngMinute	= lngMinute % 60;
		lngHour		= parseInt(lngMinute / 60);
	}
	
	var strPlayTime  = "";
	if(lngHour > 0)
	{
		if(lngHour < 10) lngHour = "0" + lngHour;
		strPlayTime += lngHour + strSeparate_h;
	}

	if(lngMinute > 0)
	{
		if(lngMinute < 10) lngMinute = "0" + lngMinute;
		strPlayTime += lngMinute + strSeparate_m;
	}

	if(lngSecond > 0)
	{
		if(lngSecond < 10) lngSecond = "0" + lngSecond;
		strPlayTime += lngSecond + strSeparate_s;
	}

	return strPlayTime;
}

function blankClose()
{
	if (/MSIE/.test(navigator.userAgent)) {
		if(navigator.appVersion.indexOf("MSIE 8.0")>=0) {
			window.open('about:blank','_self').close();
		} else {
			window.opener = self;
			self.close();
		}
	}
}

//Sleep
function jsSleep(numberMillis)
{
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;

	while (true) {
		now = new Date();
		if (now.getTime() > exitTime)
			return;
	}
}