/* ´Ù¾ËÁö »ç¿ë ½ºÅ©¸³Æ® */
document.domain	='danawa.com';
var domain_img	= "http://img.danawa.com";
var domain_bbs	= "http://bbs.danawa.com";
var domain_blog = "http://blog.danawa.com";
var domain_dmall= "http://dmall.danawa.com";
var oNow = new Date();

// ÆäÀÌÁö ÀüÈ¯
function GoDargLink(nUrl,sMode)
{
	if(sMode == "P") {
		opener.parent.location.href = nUrl;
	}else {
		top.location.href=nUrl;
	}//end if
}//end function GoDargLink(nUrl)

// ¸µÅ© ÀüÈ¯
function GoDargLinkHref(nUrl, sText)
{
	if(sText == 'L') {
		alert('·Î±×ÀÎ ÈÄ ÀÌ¿ëÇØ ÁÖ½Ê½Ã¿À.');
	}//end if

	location.href=nUrl;
}//end function GoDargLinkHref(nUrl)

// ÆË¾÷Ã¢ ¶ç¿ì±â
function GoDargPopupLink(nWidth,nHeight,nPosx,nPosy,nUrl)
{
	nPosition = "width="+nWidth+",height="+nHeight+",scrollbars=yes,resizable=no,top="+nPosx+",left="+nPosy;
	window.open(nUrl,'GoPopupLink',nPosition);
}//end function GoDargPopupLink(nWidth,nHeight,nPosx,nPosy,nUrl)

// ÆË¾÷Ã¢ ¶ç¿ì±â
function GoDargPopupLink2(nWidth,nHeight,nPosx,nPosy,nUrl)
{
	nPosition = "width="+nWidth+",height="+nHeight+",scrollbars=no,resizable=no,top="+nPosx+",left="+nPosy;
	window.open(nUrl,'GoPopupLink',nPosition);
}//end function GoDargPopupLink(nWidth,nHeight,nPosx,nPosy,nUrl)

// °³ÀÎ Á¤º¸Ã¢
function ViewUserInfo(sid,nNick,nMemSeq)
{
	var width=300;
	var height=200;
	var posx=100;
	var posy=100;
	position = "width="+width+",height="+height+",scrollbars=no,resizable=no,top="+posy+",left="+posx;
    window.open(domain_bbs + '/pop_user_info.php?nMebSeq='+nMemSeq,'pop_link', position);
}//end function ViewUserInfo(sid,nNick,nMemSeq)

// ³» ºí·Î±×¿¡ ´ã±â
function MyBlog_Scrap(LoginCk,nMemSeq,nBlogSeq,nScrap,nSeq,nGroup,nBlogCateSeq1)
{
	if(nScrap == "Y")
	{
		if(LoginCk > 0)
		{
			if(nBlogSeq > 0)
			{
				if(nMemSeq == LoginCk)
				{
					alert("º»ÀÎÀÌ ÀÛ¼ºÇÑ ±ÛÀº ½ºÅ©·¦ ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
				} else {
					window.open(domain_blog+'/archive/form_scrap.php?nListSeq='+nSeq+'&nGroup='+nGroup+'&nBlogCateSeq1='+nBlogCateSeq1+'&nScrapSeq='+nSeq+'&nSzBlogSeq='+nBlogSeq,'scrap_pop','width=400, height=350');
				} //end if
			} else {
				alert("ºí·Î±×¸¦ ¸¸µå¼Å¾ß ½ºÅ©·¦ ±â´ÉÀ» ÀÌ¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
			}//end if
		} else {
			alert("½ºÅ©·¦À» ÇÏ·Á¸é ¸ÕÀú ·Î±×ÀÎ ÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		}//end if
	} else {
		alert("½ºÅ©·¦ÀÌ Çã¿ëµÇÁö ¾ÊÀº ±Û ÀÔ´Ï´Ù.");
	}//end if
}//end function MyBlog_Scrap(LoginCk,nMemSeq,nBlogSeq,nScrap,nSeq,nGroup,nBlogCateSeq1)

// °Ë»ö ÇÔ¼ö
function DargSearchList(nUrl)
{
	var sSearchUrl	= nUrl;
	document.frmDrgSearch.action = nUrl;
	document.frmDrgSearch.method = 'get';
	var sLikeKey	= document.frmDrgSearch.sLikeKey.options[document.frmDrgSearch.sLikeKey.selectedIndex].value;
	var sLikeValue	= document.frmDrgSearch.sLikeValue.value;

	if(sLikeValue=='')
	{
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');
		document.frmDrgSearch.sLikeValue.value='';
		document.frmDrgSearch.sLikeValue.focus();
		return false;
	}//end if

	//sSearchUrl = sSearchUrl + '&sLikeKey=' + sLikeKey;
	//sSearchUrl = sSearchUrl + '&sLikeValue=' + sLikeValue;
	document.frmDrgSearch.submit();
	//document.location.href = sSearchUrl;
}//end function DargSearchList(nUrl)

// ¿ë¾î»çÀü °Ë»ö ÇÔ¼ö
function DargGlossarySearch(nUrl)
{
	var sSearchUrl	= nUrl;
	var sLikeValue	= document.frmDrgSearch.sLikeValue.value;

	if(sLikeValue=='')
	{
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');
		document.frmDrgSearch.sLikeValue.value='';
		document.frmDrgSearch.sLikeValue.focus();
		return false;
	}//end if

	sSearchUrl = sSearchUrl + '&sTermKeyValue=' + sLikeValue;
	document.location.href = sSearchUrl;
}//end function DargGlossarySearch(nUrl)

// ÅÜ ÀÌ¹ÌÁö
function DargShowImgTab(OBJ, count)
{
	for(i=1;i<=count;i++)
	{
		if(i == OBJ)
		{
			document.getElementById('tab_css_'+OBJ).className = "point_red";
		}else {
			document.getElementById('tab_css_'+i).className = "";
		}//end if
	}//end for
}//end function DargShowImgTab(OBJ, count)

// ½Å°íÇÏ±â
function DargComplaint(nListSeq,nBoardSeq)
{
	var width=400;
	var height=350;
	var posx=0;
	var posy=0;

	position = "width="+width+",height="+height+",scrollbars=no,resizable=yes,top="+posy+",left="+posx;
    window.open(domain_bbs+'/form_complaint.php?nListSeq='+nListSeq+'&nBlogCateSeq1='+nBoardSeq,'Complaint', position);
}//end function DargComplaint(nListSeq,nGroup,nBlogCateSeq1)

// ´ñ±Û ½Å°íÇÏ±â
function DargComplaint_Com(nCommentSeq,nBoardSeq)
{
	var width=400;
	var height=350;
	var posx=0;
	var posy=0;

	position = "width="+width+",height="+height+",scrollbars=no,resizable=yes,top="+posy+",left="+posx;
    window.open(domain_bbs + '/form_complaint.php?nCommentSeq='+nCommentSeq+'&nBlogCateSeq1='+nBoardSeq,'CommentComplaint', position);
}//end function DargComplaint_Com(nCommentSeq,nGroup,nBlogCateSeq1)

// ÀÌ¹ÌÁö ¾øÀ»½Ã noimg °¡Á®¿À±â
function DargnoImage(img,size)
{
	var args = DargnoImage.arguments;
	switch (size)
	{
		case 75 : var altImg = domain_img + '/new/dalgi/common/noimg_75.gif'; break;
		case 80 : var altImg = domain_img + '/new/dalgi/common/noimg_80.gif'; break;
	}//end switch

	if (args[0].src == altImg)
	{
		args[0].onerror = null;
	} else {
		var imgWidth = args[1] ? args[1] : size;
		var imgHeight = args[2] ? args[2] : size;
		args[0].src = altImg;
		args[0].width = imgWidth;
		args[0].height = imgHeight;
	}//end if
}//end function DargnoImage(img,size)

// °ü·Ã ÀåÅÍ»óÇ° ÀÌ¹ÌÁö Å©°Ôº¸±â
function openImgPreView(nSeq,nProdC,bUseImg)
{
	window.open(domain_dmall+'/sale/imgPreview.php?nSeq='+nSeq+'&nProdC='+nProdC+'&bUseImg='+bUseImg ,'PreviewImg','toolbar=no,location=no,status=no,menubar=no,scrollbars=YES,resizable=No,width=700,height=500,top=0,left=0')
}//end 	function openImgPreView(nSeq,nProdC,bUseImg)

// ÆË¾÷Ã¢ ¶ç¿ì±â 2008.02.20 ³²¹Ì°æ
function GoPopupLink(nWidth,nHeight,nPosx,nPosy,nUrl)
{
	nPosition = 'width='+nWidth+',height='+nHeight+',scrollbars=yes,resizable=no,top='+nPosx+',left='+nPosy;
	window.open(nUrl,'GoPopupLink',nPosition);
}//end function GoPopupLink(nWidth,nHeight,nPosx,nPosy,nUrl)

// ±Û»èÁ¦ÇÏ±â
function listDel_Darg()
{
	if(confirm('Á¤¸» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?'))
	{
		document.FrmDargDelete.submit();
	}//end if
}//end function listDel_Darg()

// Å×¸¶ ´ä±Û»èÁ¦ÇÏ±â
function SubListDel_Darg(nCSeq)
{
	if(confirm('Á¤¸» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?'))
	{
		document.getElementById('nCSeq').value = nCSeq;
		document.getElementById('FrmDargSubListDelete').submit();
	}//end if
}//end function listSubDel_Darg()

// ¿¡µðÅÍ »èÁ¦ÇÏ±â
function getDargEditDelete()
{
	if(confirm('¿¡µðÅÍ¸¦ Á¤¸» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?\n\n»èÁ¦¸¦ ¿øÇÏ½Ç °æ¿ì \'È®ÀÎ\'À» Å¬¸¯ÇÏ½Å ÈÄ\nºê¶ó¿ìÀú¸¦ ´Ý¾ÆÁÖ¼Å¾ß¸¸ »èÁ¦°¡ ÁøÇàµË´Ï´Ù.'))
	{
		location.href = domain_dmall+'/namo6/NamoActiveSquare6_UnInstall.exe';
	}//end if
}//end function getDargEditDelete()

// ±Û¾²±â ¸ðµå ¼±ÅÃ
function DargchangeWrite(sEditer,nMode)
{
	if(sEditer == 'E'){
		if(document.getElementById('sContentNamo').style.display == 'none')	{
			document.getElementById('sContentNamo').style.display = 'block';
			document.getElementById('sContentHtml').style.display = 'none';
		}//end if
		document.getElementById('sEditer').value='E';
		contentNamoGo();
	}else {
		if(sEditer == 'H')	{
			document.getElementById('sEditer').value='H';
		}else {
			document.getElementById('sEditer').value='T';
		}//end if

		if(document.getElementById('sContentHtml').style.display == 'none')	{
			if (nMode != 'Y')
			{
				alert("¿¡µðÅÍ¿¡¼­ ÀÛ¾÷ÇÑ ³»¿ëÀÌ È£È¯µÇÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù.");
				contentHtmlGo();
			}//end if

			document.getElementById('sContentHtml').style.display = 'block';
			document.getElementById('sContentNamo').style.display = 'none';
		}//end if
	}//end if

	switch (sEditer)
	{
		case 'T': ShowdivTextTabImg('1','3','divTextImg_','editor','Y');	break;
		case 'H': ShowdivTextTabImg('2','3','divTextImg_','editor','Y');	break;
		case 'E': ShowdivTextTabImg('3','3','divTextImg_','editor','Y');	break;
	}//end switch
}//end function DargchangeWrite(nInputC,nMode)

// ÀÌ¹ÌÁö ÅÇ º¯°æ
function ShowdivTextTabImg(OBJ, nCnt, nDiv, nImg, ntype)
{
	for(var i=1; i<=nCnt; i++)
	{
		if (OBJ == i)
		{
			document.getElementById(nDiv+OBJ).src = 'http://img.danawa.com/new/dalgi/common/'+nImg+OBJ+'_on.gif';
		} else {
			document.getElementById(nDiv+i).src = 'http://img.danawa.com/new/dalgi/common/'+nImg+i+'.gif';
		}//end if
	}//end for

	if (ntype != 'Y')
	{
		switch (OBJ)
		{
			case '1': DargchangeWrite('T','E');	break;
			case '2': DargchangeWrite('H','E');	break;
			case '3': DargchangeWrite('E','E');	break;
		}//end switch
	}//end if
}//end function ShowdivTextTabImg(OBJ, nCnt, nDiv, nImg, ntype)



/* AJAX °ü·Ã ÇÔ¼ö ¸ðÀ½ ½ÃÀÛ */
// ¿¡·¯ Ãâ·Â
function rpError()
{
	alert("Á¤»óÀûÀ¸·Î Ã³¸®µÇÁö ¾Ê¾Ò½À´Ï´Ù.");
}//end function rpError()



// °ü·ÃÀÌº¥Æ® º¸±â(ºä ÆäÀÌÁö)
function getDargViewEventList(nSeq,nType,nDpLayer)
{
	var url		= "/DargRelEvent_ajax.php";
	var pars	= "nSeq="+nSeq+"&nType="+nType;

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargViewEventList(nSeq,sTable,nType,nDpLayer)

// °ü·Ãºê·£µå º¸±â(ºä ÆäÀÌÁö)
function getDargViewBrandList(nSeq,nType,nDpLayer)
{
	var url		= "/DargRelBrand_ajax.php";
	var pars	= "nSeq="+nSeq+"&nType="+nType;

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargViewBrandList(nSeq,sTable,nType,nDpLayer)

// °ü·Ã±âÈ¹Àü º¸±â(ºä ÆäÀÌÁö)
function getDargViewPlanList(nSeq,nType,nDpLayer)
{
	var url		= "/DargRelPlan_ajax.php";
	var pars	= "nSeq="+nSeq+"&nType="+nType;

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargViewPlanList(nSeq,sTable,nType,nDpLayer)

// °ü·Ã±â»ç º¸±â(ºä ÆäÀÌÁö)
function getDargViewCmsList(nSeq,nType,nDpLayer)
{
	var url		= "/DargRelCms_ajax.php";
	var pars	= "nSeq="+nSeq+"&nType="+nType;

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargViewCmsList(nSeq,nType,nDpLayer)

// °ü·Ã »óÇ° º¸±â(ºä ÆäÀÌÁö)
function getDargViewProdList(nSeq,nType,nDpLayer)
{
	var url		= "/DargRelProd_ajax.php";
	var pars	= "nSeq="+nSeq+"&nType="+nType;

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargViewProdList(nSeq,sTable,nType,nDpLayer)

// °ü·Ã ÀåÅÍ»óÇ° º¸±â(ºä ÆäÀÌÁö)
function getDargViewMarketProdList(nCate,nSeq,nType,nDpLayer)
{
	var url		= "/DargRelMarketProd_ajax.php";
	var pars	= "nCate="+nCate+"&nSeq="+nSeq+"&nType="+nType;

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargViewMarketProdList(nCate,nSeq,sTable,nType,nDpLayer)


// ÀúÀåÁß
function setDargComment_Save(nSeq,nDpLayer)
{
	var div_id = nDpLayer;
	$(div_id).innerHTML = "<table width=\"100%\" align=\"center\"><tr><td align=\"center\" height=\"30\">¿äÃ»ÀÌ ÁøÇàÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À.</td></tr><tr><td align=\"center\"><img src=\"http://img.danawa.com/buy/img/ing.gif\" width=\"266\" height=\"11\"></td></tr></table>";
}//end function setDargComment_Save(nSeq,nDpLayer)


// ´äº¯ È°¼ºÈ­
function setDargDivDisplay(nSeq,nDpLayer)
{
	var obj = document.getElementById(nDpLayer);

	if(obj.style.display == "none")
	{
		obj.style.display = "block";
	}else{
		obj.style.display = "none";
	}//end if
}//end function setDargDivDisplay(nSeq,nDpLayer)

// ´ñ±Û È°¼ºÈ­
function setDargDivDisplay2D(nCSeq,nDpLayer)
{
	var obj = document.getElementById(nDpLayer);

	if(obj.style.display == "none")
	{
		obj.style.display	= "block";
	}else{
		obj.style.display	= "none";
	}//end if
}//end function setDargDivDisplay2D(nCSeq,nDpLayer)

// ´ñ±Û ·Î±×ÀÎ
function checkLoginDargComment(obj)
{
	oForm = document.getElementById(obj);
	oForm.hdnUrl.value = location.href;

	// ¾ÆÀÌµð Ã¼Å©
	if(oForm.txtId.value.split(/\s/).join('') == '')
	{
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		oForm.txtId.focus();
		return;
	}//end if

	// ºñ¹Ð¹øÈ£ Ã¼Å©
	if(oForm.pwdPasswd.value == '')
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		oForm.pwdPasswd.focus();
		return;
	}//end if

	bSubmitLock = true;
	oForm.submit();
}//end function checkLoginDargComment(obj)

//±ÛÀÚ ¼öÁ¦ÇÑ ÇÏ±â
function getDargCharByte(nCheckFld,	nDpFld,nCutCnt){
	var nChObj	= document.getElementById(nCheckFld);				// Ã¼Å© ´ë»ó
	var nDpObj	= (!nDpFld) ? "" : document.getElementById(nDpFld) ;// »óÅÂÇ¥½Ã ´ë»ó

	var nChString		= nChObj.value;
	var nChStringCnt	= nChString.length;

	var i = 0;			//¹Ýº¹¹® º¯¼ö
	var nCutByte = 0;	//¹ÙÀÌÆ®¼ö Ä«¿îÅÍ
	var nOneCharAscii;	//±ÛÀÚ´ç ¾Æ½ºÅ°ÄÚµå
	var nDpByte;		//Ç¥½ÃµÉ ¹ÙÀÌÆ®¼ö

	//±ÛÀÚ¼ö Ä«¿îÆ®
	for(i=0; i<nChStringCnt; i++)
	{
		nOneCharAscii = escape(nChString.charAt(i));

		//ÇÑ±ÛÃ³¸®
		if(nOneCharAscii.length > 4)
		{
			nCutByte += 2;
		}else if(nOneCharAscii != "%0D" || nOneCharAscii != "%0A"){ //°³Çà ¹®ÀÚ ÇÊÅÍ
			nCutByte += 1;
		}//end if
	}//end for

	//±ÛÀÚ Á¦ÇÑ
	if(nCutByte <= nCutCnt)	{
		(!nDpFld) ? "" : nDpObj.innerHTML = nCutByte ;
		return true;
	}else{
		alert(nCutCnt+"ÀÚ ÀÌ»óÀº ÀÔ·Â ÇÏ½Ç¼ö ¾ø½À´Ï´Ù!");

		//Á¦ÀÏ ¸¶Áö¸·¿¡ ÀÔ·ÂµÈ ¹®ÀÚ
		nOneCharAscii = escape(nChString.charAt(nChString.length-1));

		if(nOneCharAscii == "%0D" || nOneCharAscii == "%0A") //°³Çà ¹®ÀÚ ÇÊÅÍ
		{
			nChObj.value = nChString.substr(0,nChString.length-2);
		}else{
			nChObj.value = nChString.substr(0,nChString.length-1);
		}//end if

		(!nDpFld) ? "" : nDpObj.innerHTML = nCutCnt ;
		nChObj.focus();
		return false;
	}//end if
}//end function getDargCharByte(nCheckFld,nDpFld,nCutCnt)

// Å×¸¶ ´Ù¾ËÁö ´äº¯ ¸®½ºÆ®Áß¿¡¼­ ´ñ±Û ´õº¸±â(Å×¸¶ ´Ù¾ËÁö)
function getDargSubListCom(nSeq,nDpLayer,nDpLayer2)
{
	var obj = document.getElementById(nDpLayer2+nSeq);

	if(obj.style.display == "block")
	{
		obj.style.display = "none";
	}//end if

	var url		= "/Darg_SubListCom_ajax.php";
	var pars	= "nSeq="+nSeq+"&" + oNow.getTime();

	var myAjax = new Ajax.Updater(
				{success: nDpLayer+nSeq},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargSubListCom(nSeq,nDpLayer)

// Å×¸¶ ´Ù¾ËÁö Ã¤ÅÃµÈ Å×¸¶¿¡¼­ ´ñ±Û ´õº¸±â
function getDargSubListReCom(nSeq,nDpLayer,nDpLayer2)
{
	var obj = document.getElementById(nDpLayer2+nSeq);

	if(obj.style.display == "block") {
		obj.style.display = "none";
	}//end if

	var url		= "/Darg_SubListReCom_ajax.php";
	var pars	= "nSeq="+nSeq+"&" + oNow.getTime();
	var myAjax = new Ajax.Updater(
				{success: nDpLayer+nSeq},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargSubListReCom(nSeq,nDpLayer)

// Ã¤ÅÃµÈ ´ñ±Û ¼ø¼­ Á¤ÀÇ(Å×¸¶ ´Ù¾ËÁö)
function setDargMenuSort(nSeq,sMode,nMenuIdx) {
	var url		= "/DargSave_ThemeBestPopup_ajax.php";
	var pars	= "nSeq="+nSeq+"&sMode="+sMode+"&nMenuIdx="+nMenuIdx;

	var myAjax = new Ajax.Updater(
				'aDargBestPopup',
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError,
					evalScripts : true,
					onSuccess: function()
					{
						getDargMenuSortView(nSeq, 'aDargBestPopup');
					}
				});
}//end function setDargMenuSort(nSeq,sMode,nMenuIdx)

// °ü·Ã Ã¤ÅÃµÈ ´ñ±Û ¼ø¼­ Á¤ÀÇµÈ ÈÄ ·Îµù(Å×¸¶ ´Ù¾ËÁö)
function getDargMenuSortView(nSeq, nDpLayer)
{
	var url		= "/Darg_ThemeBestPopup.php";
	var pars	= "nSeq="+nSeq;
	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargMenuSortView(nSeq)

/*
// Ã¤ÅÃµÈ ´ñ±Û º¸±â(ºä ÆäÀÌÁö - Å×¸¶ ´Ù¾ËÁö Á¦¿Ü)
function getDargViewRecommend(nSeq,nDarg, nDpLayer)
{
	var url		= "/DargRecommend_ajax.php";
	var pars	= "nSeq="+nSeq+"&nDarg="+nDarg;

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargViewRecommend(nSeq,nCSeq,nDarg,nType,nDpLayer)
*/

// Ã¤ÅÃµÈ Å×¸¶ ´äº¯ ºÒ·¯¿À±â (5°³ ±îÁö)
function getDargViewSubRecommendList(nSeq,nPage,nDpLayer)
{
	var url		= "Darg_SubList_Recommend_ajax.php";
	var pars	= "nSeq="+nSeq+"&nPage="+nPage+"&"+ oNow.getTime();

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargViewSubRecommendList(nSeq,nPage,nDpLayer)

// Å×¸¶ ´Ù¾ËÁö ´äº¯±Û ºÒ·¯¿À±â
function getDargThemeViewCommentList(nPage,sPars)
{
	var url		= "Darg_SubList_ajax.php";
	var pars	= nPage + sPars+"&" + oNow.getTime();
	var myAjax = new Ajax.Updater(
				{success: "aDargCommentList"},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargThemeViewCommentList(nPage,sPars)

// ´ñ±Û ºí·¯¿À±â
/*
//function getDargViewCommentList(nSeq,nDarg,nPage,nDpLayer)
function getDargViewCommentList(nPage,sPars)
{
	var url		= "Darg_Comment_ajax.php";
	var pars	= nPage + sPars+"&" + oNow.getTime();

	var myAjax = new Ajax.Updater(
				{success: "aDargCommentList"},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError

				});
}//end function getDargViewCommentList(nSeq,nDarg,nPage,nDpLayer)
*/

// 2Â÷ ´ñ±Û ´Þ±â È°¼ºÈ­
function setDargDivDisplay2Depth(nSeq,nDpLayer)
{
	var objW = document.getElementById(nDpLayer);

	if(objW.style.display == "block")
	{
		objW.style.display = "none";
	}else{
		objW.style.display = "block";
	}//end if
}//end function setDargDivDisplay2Depth(nSeq,nDpLayer)

// 1Â÷ ´ä±Û ¼öÁ¤ È°¼ºÈ­
function setDargCommentModify1Depth(nCSeq,nDpLayer,nDpLayer2,nDpLayer3)
{

	var obj			= document.getElementById(nDpLayer+nCSeq);
	var objMod		= document.getElementById(nDpLayer2+nCSeq);
	var objModText	= document.getElementById(nDpLayer3+nCSeq);

	if(obj.style.display != "none") {
		obj.style.display	='none';
		objMod.style.display='block';
		objModText.focus();
	}else {
		obj.style.display	='block';
		objMod.style.display='none';
	}//end if
}//end function setDargCommentModify1Depth(nCSeq,nDpLayer,nDpLayer2)

// 2Â÷ ´ñ±Û ¼öÁ¤ È°¼ºÈ­
function setDargCommentModify2Depth(nCSeq,nDpLayer,nDpLayer2,nDpLayer3)
{

	var obj			= document.getElementById(nDpLayer+nCSeq);
	var objMod		= document.getElementById(nDpLayer2+nCSeq);
	var objModText	= document.getElementById(nDpLayer3+nCSeq);

	if(obj.style.display != "none")
	{
		obj.style.display	='none';
		objMod.style.display='block';
		objModText.focus();
	}else {
		obj.style.display	='block';
		objMod.style.display='none';
	}//end if
}//end function setDargCommentModify2Depth(nCSeq,nDpLayer,nDpLayer2)

// ±ÝÁö¾î, ºñ¼Ó¾î Ã¼Å©
function setCommentSlanderCheck(sComment){
	for(var nLoop=0; nLoop<aSlander.length; nLoop++){
		if((sComment.indexOf(aSlander[nLoop], 0)) >= 0 ){
			alert('´ñ±Û ['+aSlander[nLoop]+']Àº(´Â) ±ÝÁö´Ü¾î ÀÔ´Ï´Ù.');
			return false;
		}//end if
	}//end for
	return true;
}// end function setCommentSlanderCheck

/*
// ´ñ±Û ÀÛ¼º
function setDargComControl(LoginCk,nDarg,nSeq,nCSeq,sMode,sComment,nPage,nDpLayer,nPSeq,sListType)
{
	if(LoginCk == "0")
	{
		alert("·Î±×ÀÎÇÏ½Ã¸é ´ñ±ÛÀ» ÀÛ¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.");
		document.getElementById('txtId').focus();
		return false;
	}//end if

	switch(sMode){
		case "new":
		case "reply":
		case "modify":
			var objDesc = document.getElementById(sComment);
			var nDescM	= encodeURIComponent(objDesc.value);

			if(!nDescM)	{
				alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
				objDesc.focus();
				return false;
			}else{
				// ´ñ±Û ³½¿ë ±ÝÁö ´Ü¾î Ã¼Å©
				if(!setCommentSlanderCheck(objDesc.value)){
					return;
				}// end if
			}//end if
		break;

		case "delete":
			if(confirm('»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')){
			}else {
				return;
			}//end if
		break;
	}//end switch

	var url		= "DargSave_comment.php";
	var pars	= "nPSeq="+nPSeq+"&nSeq="+nSeq+"&nCSeq="+nCSeq+"&sComment="+nDescM+"&sMode="+sMode+"&sListType="+sListType+"&" + oNow.getTime();

	// ´ñ±Û ¸®½ºÆ® ºÒ·¯¿À±â À§ÇÑ ÆÄ¶ó¹ÌÅÍ ¼³Á¤
	var sPageParam = "nPage="+nPage;
	var sParam	   = "";
	if(nDarg == 1){
		sParam	   = "&nSeq="+nPSeq;
	}else{
		sParam	   = "&nSeq="+nSeq;
	}// end if
	var myAjax = new Ajax.Updater(
				//{success: nDpLayer},
				'',
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError,
					onComplete: function(e)
					{
						getDargResult(e);

						switch(sListType){
							case 'recommend':	// Ã¤ÅÃµÈ ´ñ±Û¿¡ ´ñ±Û ´Þ¾ÒÀ»°æ¿ì ¸®½ºÆ® ¸®·Îµå
								getDargViewRecommend(nSeq, nDarg,nDpLayer);
							break;
							case 'nDarg1': // Å×¸¶´Ù¾ËÁö Ã¤ÅÃµÈ ´ä±Û¿¡ ´ñ±Û ´Þ¾ÒÀ»°æ¿ì ¸®½ºÆ® ¸®·Îµå
								getDargViewSubRecommendList(nPSeq, nPage, nDpLayer);
							break;
						}// end switch

						if (nDarg == 1) {	// Å×¸¶ ´Ù¾ËÁö ´äº¯±Û(´ñ±ÛÆ÷ÇÔ) ¸®½ºÆ®
							getDargThemeViewCommentList(sPageParam,sParam);
						}else{
							getDargViewCommentList(sPageParam,sParam);
						}//end if

					},
					onSuccess:function()
					{
						setDargComment_Save(nSeq,nDpLayer);
					}
				});

	if(sMode !="delete")
	{
		objDesc.value = "";
	}//end if
}//end function setDargComControl(LoginCk,nSeq,nCSeq,sMode,nDepth,sComment,nDpLayer)
*/

// ÂªÀº´äº¯ ÀÛ¼º
function setDargSubListControl(LoginCk,nSeq,nCSeq,sMode,sComment,nPage,nDpLayer)
{
	if(LoginCk == "0")
	{
		alert("·Î±×ÀÎÇÏ½Ã¸é ´ñ±ÛÀ» ÀÛ¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.");
		document.getElementById('txtId').focus();
		return false;
	}//end if

	switch(sMode)
	{
		case "new":
		case "modify":
			var objDesc = document.getElementById(sComment);
			var sContent	= encodeURIComponent(objDesc.value);

			if(!sContent){
				alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
				objDesc.focus();
				return false;
			}//end if
		break;
	}//end switch

	var url		= "DargSave_SubCom.php";
	var pars	= "nSeq="+nSeq+"&nCSeq="+nCSeq+"&sContent="+sContent+"&sMode="+sMode+"&" + oNow.getTime();

	// ÂªÀº ´äº¯ ¸®½ºÆ® ºÒ·¯¿À±â À§ÇÑ ÆÄ¶ó¹ÌÅÍ ¼³Á¤
	var sPageParam = "nPage="+nPage;
	var sParam	   = "&nSeq="+nSeq;

	var myAjax = new Ajax.Updater(
			//	{success: nDpLayer},
				'',
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError,
					onComplete: function(e)
					{
						getDargResult(e);
						getDargViewSubRecommendList(nSeq, nPage, nDpLayer);		// ´äº¯ Ã¤ÅÃ ¸®½ºÆ®
						getDargThemeViewCommentList(sPageParam,sParam);			// ´äº¯±Û ¸®½ºÆ®
					},
					onSuccess:function()
					{
						setDargComment_Save(nSeq,nDpLayer);
					}
				});

	if(sMode !="delete")
	{
		objDesc.value = "";
	}//end if
}//end function setDargSubListControl(LoginCk,sTable,nSeq,nCSeq,sMode,sComment,nPage,nDpLayer)

//ÆÛ°¡±â Ã³¸® 2011-03-28 ¹ÚÁø¼ö
function viewScrap(nListSeq) {

	 var sUrl = './viewScrap_ajax.php';
	 var param = 'nSeq='+nListSeq;
	
	 var myAjax = new Ajax.Request( 
			 	  sUrl, 
			 	  { 
			         method: 'post', 
			    	 parameters: param, 
			         onSuccess: scrapResponse,	                             
			         onFailure: function() { alert('¹®Á¦°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù'); } 
			 	  } 
	 			); 
}

function scrapResponse(data) {
	window.clipboardData.setData('Text', data.responseText);
	alert("º¹»ç°¡ ¿Ï·á µÇ¾ú½À´Ï´Ù.");
} // end function viewScrap

// °á°ú Ã¼Å©
function getDargResult(e)
{
	var result		= e.responseText.split("/");
	var AdminCheck	= result[0];					// ±ÇÇÑÃ¼Å©
	var ComCount	= result[1];					// ´ñ±Û¼ö
	var DescText	= result[2];					// Á¦ÇÑ´Ü¾î

	if (AdminCheck != "Y")
	{
		switch (AdminCheck)
		{
			case ("N"): alert("°Ô½Ã¹°¿¡ ´ëÇÑ ±ÇÇÑÀÌ ¾ø½À´Ï´Ù."); break;
			case ("W"): alert("¼­¹ö ¹®Á¦·Î ÀÎÇÏ¿© ÀúÀå µÇÁö ¾Ê¾Ò½À´Ï´Ù. ´Ù½Ã ½ÃµµÇØ ÁÖ½Ê½Ã¿À."); break;
			case ("M"): alert("¼­¹ö ¹®Á¦·Î ÀÎÇÏ¿© ¼öÁ¤ µÇÁö ¾Ê¾Ò½À´Ï´Ù. ´Ù½Ã ½ÃµµÇØ ÁÖ½Ê½Ã¿À."); break;
			case ("D"): alert("¼­¹ö ¹®Á¦·Î ÀÎÇÏ¿© »èÁ¦ µÇÁö ¾Ê¾Ò½À´Ï´Ù. ´Ù½Ã ½ÃµµÇØ ÁÖ½Ê½Ã¿À."); break;
			case ("P"): alert("¼öÁ¤&»èÁ¦°¡ ºÒ°¡´ÉÇÑ °Ô½Ã±Û ÀÔ´Ï´Ù!!."); break;
			case ("C"): alert("Çù·Â»ç È¸¿ø¸¸ °¡´ÉÇÕ´Ï´Ù."); break;
			case ("T"): alert("Á¶¸³µýÁö Æò°¡¸¦ ÇØÁÖ½Ê½Ã¿À."); break;
			case ("SYSTEM"): alert("½Ã½ºÅÛ Á¡°Ë ÁßÀÔ´Ï´Ù."); break;
		}//end switch
	}//end if

	if(DescText != "") {
		if (e.responseText != '')	alert(e.responseText);
		else						alert("»ç¿ë±ÝÁö¾ð¾î (" + DescText + ")ÀÌ/°¡ »ç¿ëµÇ¾ú½À´Ï´Ù.");
	}//end if

	if ( ComCount > 0) {
		$('DargCommentCnt').innerHTML = ComCount;
	}

}//end function getResult(e)

// ÆÄÀÏÃ£±â innerHTML
function fileAlertPress()
{
	var oAttachFileRow = document.getElementById('attachFileRow');
	oAttachFileRow.innerHTML = "";
	oAttachFileRow.innerHTML ="<input type=\"text\" name=\"upfile\" style=\"width:280px; height:20px;\" class=\"openinput\" readonly>&nbsp;"+
							"<span style=\"overflow:hidden; width:63px; height:20px; background-image:url(http://img.danawa.com/new/openmarket/btn/btn_file.gif); background-repeat:no-repeat\">"+
							"<input type=\"file\" name=\"fAttach\" style=\"width:0px;height:20px;filter:alpha(opacity=0);\" onchange=\"Darg_LoadImg(this.value);\" style=\"cursor:pointer;\">"+
							"</span>&nbsp;(gif, jpg È®Àå¸í ÆÄÀÏ°¡´É / 500kÀÌÇÏ) <br />";
}//end function fileAlertPress()

// ÀÌ¹ÌÁö ÆÄÀÏ Ã¼Å©
function Darg_LoadImg(value)
{
	var imgInfo = new Image();
	var form = document.getElementById('frmDargWriteSave');
	var sImgExt = value.substring(value.lastIndexOf('.')+1,value.lastIndexOf('.')+4);
	sImgExt = sImgExt.toLowerCase();


	if(!(sImgExt == 'jpg' || sImgExt == 'gif'))
	{
		alert('ÀÌ¹ÌÁö ÆÄÀÏÀº JPG , GIF ¸¸ Çã¿ëµË´Ï´Ù.')
		fileAlertPress();
		return false;
	}else {
		form.upfile.value=value;
	    imgInfo.onload = Darg_img_Load;
	    imgInfo.src = value;
	}//end if
}//end function Darg_LoadImg(value)

// Ã·ºÎÆÄÀÏ Å©±â Ã¼Å©
function Darg_img_Load()
{
    var imgFileSize;
    var maxFileSize;
    maxFileSize = 400*1024;  //byte
    imgFileSize = this.fileSize;

    if (imgFileSize > maxFileSize)
	{
        alert('¼±ÅÃÇÏ½Å ÆÄÀÏÀº Çã¿ë ÃÖ´ëÅ©±âÀÎ ' + maxFileSize/1024 + 'KB ¸¦ ÃÊ°úÇÏ¿´½À´Ï´Ù.');
		fileAlertPress();
    }//end if
}//end function Darg_img_Load()

// ´Ù¾ËÁö »ó´Ü ÀÌ¹ÌÁö ¿À¹ö½Ã ÀÌº¥Æ® Ã³¸®
function DargShowTopSImg(OBJ,count,nDpLayer,nDpLayer2,nDpLayer3)
{
	for(i=1;i<=count;i++)
	{
		if(i == OBJ)
		{
			document.getElementById(nDpLayer+OBJ).style.display = "block";			// ÁÂÃø ³ëÃâºÎºÐ
			document.getElementById(nDpLayer2+OBJ).className	= "maintemaTopImg";
			document.getElementById(nDpLayer3+OBJ).className	= "midtxton";
		}else {
			document.getElementById(nDpLayer+i).style.display	= "none";			// ÁÂÃø ³ëÃâºÎºÐ
			document.getElementById(nDpLayer2+i).className		= "maintemaTopImgNo";
			document.getElementById(nDpLayer3+i).className		= "midtxtdis";
		}//end if
	}//end for
}//end function DargShowTopSImg(OBJ,count,nDpLayer,nDpLayer2,nDpLayer3)

// ´Ù¾ËÁö »óÇ° ÄÚµå Ãß°¡
function setDargProdCodeMulti()
{
	try{
		var nCh			= 0;
		var obj			= document.getElementById("sProdCodeMult");
		var objSiteC	= document.frmDargWriteSave.sDargSite;
		var sDargCate	= document.frmDargWriteSave.sDargCate;

		var nSiteText	= objSiteC.options[objSiteC.selectedIndex].text;
		var cCateText	= nSiteText + " > " + sDargCate.options[sDargCate.selectedIndex].text;
		var nSiteValue	= objSiteC.options[objSiteC.selectedIndex].value;
		var nCateValue	= sDargCate.options[sDargCate.selectedIndex].value;

		//Áßº¹°Ë»ç
		for(var i=0; i<obj.length; i++)
		{
			if(obj.options[i].value == nCateValue)
			{
				nCh = nCh+1;
			}//end if
		}//end for

		if(nCh > 0)
		{
			alert("ÀÌ¹Ì µî·ÏµÈ ÀÚ·áÀÔ´Ï´Ù.");
		}else if (nSiteValue == 0)
		{
			alert("Ä«Å×°í¸®¸¦ Ãß°¡ÇØ ÁÖ½Ê½Ã¿À.");
		}else{
			obj.options[obj.length] = new Option(cCateText,nCateValue);
		}//end if
	} catch(e){alert(e); }
}//end function setDargProdCodeMulti()

//¸ÖÆ¼ »óÇ° ÄÚµå »èÁ¦
function setDargProdCDel()
{
	var obj = document.getElementById('sProdCodeMult');
	var objCnt = obj.length;

	for(var i=objCnt-1; i>=0; i--)
	{
		if(obj.options[i].selected == true)
		{
			obj.options[i] = null;
		}//end if
	}//end for
}//end function setDargProdCDel()

// ´Ù¾ËÁö QNA ºÒ·¯¿À±â
function getDargQnAList(nMode, nSiteC, nCateC1, nCateC2, nCateC3, nCateC4, nDpLayer)
{
	var url		= "/Darg_CateMain_qna.php";
	var pars	= "nMode="+nMode+"&nSiteC="+nSiteC+"&nCateC1="+nCateC1+"&nCateC2="+nCateC2+"&nCateC3="+nCateC3+"&nCateC4="+nCateC4;

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'get',
					parameters: pars,
					onFailure: rpError
				});
}//function getDargQnAList(nMode,nSiteC, nCateC1, nCateC2, nCateC3, nCateC4, nDpLayer)

// ´Ù¾ËÁö ±Û¾²±â ÆË¾÷ °Ë»ö ÇÔ¼ö
function DargCommonSearch(sMode, sUrl, nWidth, nHeight, nPosx, nPosy)
{
	var sSearchUrl	= sUrl;
	var sLikeValue	= document.frmDargWriteSave.sLikeValue.value;

	if(sLikeValue == '')
	{
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');
		document.frmDargWriteSave.sLikeValue.value='';
		document.frmDargWriteSave.sLikeValue.focus();
		return false;
	}//end if

	sSearchUrl = sSearchUrl + '?sTermKeyValue=' + encodeURIComponent(sLikeValue);

	if (sMode == 'P')	// ÆË¾÷¿¡¼­ ÀÚÃ¼ °Ë»ö
	{
		document.location.href = sSearchUrl;
	}else {
		nPosition = "width="+nWidth+",height="+nHeight+",scrollbars=yes,resizable=no,top="+nPosx+",left="+nPosy;
		window.open(sSearchUrl,'GoPopupLink',nPosition);
	}//end if
}//end function DargCommonSearch(sMode, sUrl,nWidth, nHeight, nPosx, nPosy)

// ´äº¯ Ã¤ÅÃ ·çÆ¾
function DargReCommentChoice(nSeq,nCSeq,nDarg,sUrl,sMode,nException)
{
	if(nDarg == 1) {
		if(sMode == "delete"){
			var sText = '´äº¯ Ã¤ÅÃÀ» ÇØÁ¦ ÇÏ½Ã°Ú½À´Ï±î?';
		}else{
			if (nException > 0) {
				var sText = '´äº¯ Ã¤ÅÃ ÇÏ½Ã°Ú½À´Ï±î?';
			} else {
				var sText = '´äº¯ Ã¤ÅÃÀº 5°³ ±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù. Ã¤ÅÃ ÇÏ½Ã°Ú½À´Ï±î?';
			}
		}// end if
	}else {
		if(sMode == "delete"){
			var sText = '´äº¯ Ã¤ÅÃÀ» ÇØÁ¦ ÇÏ½Ã°Ú½À´Ï±î?';
		} else {
			if (nException > 0) {
				var sText = '´äº¯ Ã¤ÅÃ ÇÏ½Ã°Ú½À´Ï±î?';
			} else {
				var sText = '´äº¯ Ã¤ÅÃÀº 1°³¸¸ °¡´ÉÇÕ´Ï´Ù. Ã¤ÅÃ ÇÏ½Ã°Ú½À´Ï±î?';
			}
		}
	}//end if

	if(confirm(sText))
	{
		var url		= "/DargSave_Recomment_Choice.php";
		var pars	= "nSeq="+nSeq+"&nCSeq="+nCSeq+"&nDarg="+nDarg+"&sMode="+sMode+"&nException="+nException+"&"+ oNow.getTime();
		var myAjax = new Ajax.Updater(
					//{success: aDargSubRecommend},
					'',
					url,
					{
						method: 'post',
						parameters: pars,
						onFailure: rpReComError,
						onComplete: function(e)
						{
							//alert(e.responseText); return;
							getDargReComResult(e,sUrl);
						},
						onSuccess:function()
						{
						}
					});
	}else {
		return;
	}//end if
}//end function DargReCommentChoice(nSeq,nCSeq,sTable,sUrl,sMode)

/**
 * Á¶¸³µýÁö ´ñ±Û ±âº»°ª ³Ö±â
 * @param nDefaultComment (1,2,3)
 * @param sTextAreaId
 * @param nLoginCkeck
 */
function setCommentDefaultValue(nDefaultComment, sTextAreaId, nLoginCkeck) {
	var oTextAreaComment = document.getElementById(sTextAreaId);

	if ( nLoginCkeck == 0) {
		alert('·Î±×ÀÎ ÈÄ »ç¿ë ÇÏ½Ê½Ã¿À.');
		return;
	}// end if

	switch (nDefaultComment){
		case (1):
			oTextAreaComment.value = "ÃÖ°íÀÇ ±¸¼ºÀÔ´Ï´Ù. ±¸ÀÔÇÏ¼¼¿ä.";
		break;

		case (2):
			oTextAreaComment.value = "È£È¯¼º ÀÌ»ó ¾ø½À´Ï´Ù.";
		break;

		case (3):
			oTextAreaComment.value = "";
		break;

		default:
	}// end switch
}// end function

/**
 * ÆË¾÷Ã¢¿¡¼­ ºÎ¸ðÃ¢¿¡ °ª ¼±ÅÃµÈ °ª ¼ÂÆÃ ÇÏ±â
 * @param sProductName
 * @param nProductSeq
 * @param sSelectBoxId
 */
function setParentProductSeq(sProductName, nProductSeq, sSelectBoxId) {
	try {
		if (sSelectBoxId == "") {
			sSelectBoxId = "aProductSeq";
		}// end if

		var oSelectProduct = document.getElementById(sSelectBoxId);
		var nOptionSize = oSelectProduct.length;
		var nDupleCount = 0;

		// »óÇ° °¹¼ö Á¦ÇÑ
		if (nOptionSize >= 50 ) {
			alert('»óÇ° 50°³ ÃÊ°ú µî·Ï ÇÒ¼ö ¾ø½À´Ï´Ù.');
			return;
		}// end if

		// Áßº¹ °Ë»ç
		for(var i=0; i<nOptionSize; i++) {
			if (oSelectProduct.options[i].value == nProductSeq) {
				nDupleCount ++;
			}//end if
		}//end for

		if (nDupleCount > 0 ) {
			alert('ÀÌ¹Ì µî·ÏµÈ »óÇ° ÀÔ´Ï´Ù.');
			return;
		} else {
			oOption = document.createElement("option");
			oOption.appendChild(document.createTextNode(sProductName));
			oOption.setAttribute("value",nProductSeq);

			oSelectProduct.appendChild(oOption);
		}//end if


	} catch (e) {
		alert(e);
	}// end try
}//end function

/**
 * ´ñ±Û ¼±ÅÃµÈ »óÇ° ÄÚµå »èÁ¦
 * @param sSelectBoxId
 */
function setProductSeqDelete(sSelectBoxId){
	var oSelectProduct = document.getElementById(sSelectBoxId);
	var nOptionSize = oSelectProduct.length;

	for(var i = nOptionSize-1; i>=0; i--) {
		if(oSelectProduct.options[i].selected == true)	{
			oSelectProduct.options[i] = null;
		}//end if
	}//end for
}//end function setProductSeqDelete()

/**
 * Á¶¸³µýÁö Æò°¡ Á¡¼ö °¡Á®¿À±â (´ñ±ÛÀ» ´Þ¶§ »ç¿ëÇÔ)
 * Âü°í : Á¶¸³µýÁö ±Û¸¸ Æò°¡ Á¡¼ö°¡ ÀÖÀ½.
 * @return nScore (1~5)
 */
function getArticleScore() {
	try {
		var oRadioScore = document.getElementsByName('sArticleTest');
		var nRadioCount = oRadioScore.length;
		var nScore = 0;

		for (var i = 0; i < nRadioCount; i++ ) {
			if (oRadioScore[i].checked) {
				nScore = oRadioScore[i].value;
			}
		}// end for
	} catch(e) {
		nScore = 0;
	}// end try
	return nScore;
}// end function

/**
 * »óÇ°°ª °¡Á®¿À±â (´ñ±ÛÀ» ´Þ¶§ »ç¿ëÇÔ)
 * @param nCommentListSeq ´ñ±Û °íÀ¯Å°
 * Âü°í : Á¶¸³µýÁö, QNA, »óÇ° ÃßÃµ »ç¿ë
 * @return »óÇ°ÄÚµå,»óÇ°ÄÚµå, ..
 */
function getCommentProduct(nCommentListSeq) {
	try {
		var sSelectBoxId = "aProductSeq";
		if (nCommentListSeq){
			sSelectBoxId = "aProductSeq_"+nCommentListSeq;
		}// end if
		var oSelectProduct = document.getElementById(sSelectBoxId);
		var nOptionCount = oSelectProduct.length;
		var sProductSeq = "";

		for (var i = 0; i < nOptionCount; i++ ) {
			if (i == (nOptionCount-1)) {
				sProductSeq =  sProductSeq + oSelectProduct.options[i].value;
			} else {
				sProductSeq =  sProductSeq + oSelectProduct.options[i].value + ",";
			}// end if
		}// end for
	} catch(e) {
		sProductSeq = '';
	}// end try
	return sProductSeq;
}// end function

/**
 * ´ñ±Û »óÇ° ¼¿·ºÆ® ¹Ú½º ÃÊ±âÈ­
 */
function setCommentProductInit() {
	try {
		var sSelectBoxId = "aProductSeq";
		var oSelectProduct = document.getElementById(sSelectBoxId);
		var nOptionCount = oSelectProduct.length-1;

		for (var i = nOptionCount; i >= 0; i-- ) {
			oSelectProduct.options[i] = null;
		}// end for
	} catch (e) {
	}// end try
}// end function

/**
 *	´ñ±Û ÀúÀå ÇÔ¼ö
 * @param nLoginCheck ·Î±×ÀÎ Ã¼Å©
 * @param nDarg ´Ù¾ËÁö ¸Þ´ºÅ°
 * @param nListSeq °Ô½Ã±Û °íÀ¯Å°
 * @param nCommentListSeq ´ñ±Û °íÀ¯Å°
 * @param sMode ¸ðµå
 * @param sComment ´ñ±Û ³»¿ë
 * @param nPage ÆäÀÌÁö
 * @param sDisplayLayer Ãâ·ÂµÈ ·¹ÀÌ¾î
 * @param nParentListSeq Å×¸¶´Ù¾ËÁö °Ô½Ã±Û¹øÈ£
 * @param sListType ¸®½ºÆ®Å¸ÀÔ
 */
function setDargCommmentProcess(nLoginCheck,nDarg,nListSeq,nCommentListSeq,sMode,sComment,nPage,sDisplayLayer,nParentListSeq,sListType) {
	// Á¶¸³µýÁö¸¸ »ç¿ëÇÔ
	var nScore = 0;
	var sProductSeq = "";

	if(nLoginCheck == 0) {
		alert("·Î±×ÀÎÇÏ½Ã¸é ´ñ±ÛÀ» ÀÛ¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.");
		document.getElementById('txtId').focus();
		return false;
	}//end if

	switch(sMode){
		case "new":
		case "reply":
		case "modify":
			var objDesc = document.getElementById(sComment);
			var nDescM	= encodeURIComponent(objDesc.value);

			if(!nDescM)	{
				alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
				objDesc.focus();
				return false;
			}else{
				// ´ñ±Û ³½¿ë ±ÝÁö ´Ü¾î Ã¼Å©
				if(!setCommentSlanderCheck(objDesc.value)){
					return;
				}// end if

				if (sMode == "reply") {
					// ±Û³»¿ë ±æÀÌ Á¦ÇÑ Ã¼Å©
					if (getCommentSize(objDesc.value) > 1000){
						alert("1000ÀÚ ÀÌ»óÀº ÀÔ·Â µÇÁö ¾Ê½À´Ï´Ù.");
						return;
					}
				}// end if

			}//end if

			// Æò°¡ Á¡¼ö
			if (sMode == "new")	{
				if (nDarg == 3)	{ // Á¶¸³µýÁö ÀÏ°æ¿ì
					nScore = getArticleScore();

					if (nScore == 0){
						alert("°ßÀûÆò°¡¸¦ ÇØÁÖ½Ê½Ã¿À.");
						return;
					}
				}//  end if
			}// end if

			// ÃßÃµ »óÇ°
			if (sMode != "reply"){
				if (nDarg ==2 || nDarg == 3 || nDarg == 6)	{ // QNA, Á¶¸³µýÁö, »óÇ° ÃßÃµ
					sProductSeq = getCommentProduct(nCommentListSeq);
				}//  end if
			}// end if
		break;

		case "delete":
			if(confirm('»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')){
			}else {
				return;
			}//end if
		break;
	}//end switch

	var url		= "DargCommentProcessAjax.php";
	var pars	= "nParentListSeq="+nParentListSeq+"&nListSeq="+nListSeq+"&nCommentListSeq="+nCommentListSeq+"&sComment="+nDescM+"&sMode="+sMode+"&sListType="+sListType+"&nScore=" +nScore+"&sProductSeq="+sProductSeq+"&" + oNow.getTime();

	// ´ñ±Û ¸®½ºÆ® ºÒ·¯¿À±â À§ÇÑ ÆÄ¶ó¹ÌÅÍ ¼³Á¤
	var sPageParam = "nPage="+nPage;
	var sParam	   = "";
	if(nDarg == 1){
		sParam	   = "&nSeq="+nParentListSeq;
	}else{
		sParam	   = "&nListSeq="+nListSeq+"&nDarg="+nDarg;
	}// end if
	var myAjax = new Ajax.Updater(
				//{success: sDisplayLayer},
				'',
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError,
					onComplete: function(e)
					{
						//alert(e.responseText);
						//return;
						getDargResult(e);

						switch(sListType){
							case 'recommend':	// Ã¤ÅÃµÈ ´ñ±Û¿¡ ´ñ±Û ´Þ¾ÒÀ»°æ¿ì ¸®½ºÆ® ¸®·Îµå
								getDargCommentRecommendListAjax(nListSeq, nDarg,sDisplayLayer);
							break;
							case 'nDarg1': // Å×¸¶´Ù¾ËÁö Ã¤ÅÃµÈ ´ä±Û¿¡ ´ñ±Û ´Þ¾ÒÀ»°æ¿ì ¸®½ºÆ® ¸®·Îµå
								getDargViewSubRecommendList(nParentListSeq, nPage, sDisplayLayer);
							break;
						}// end switch

						if (nDarg == 1) {	// Å×¸¶ ´Ù¾ËÁö ´äº¯±Û(´ñ±ÛÆ÷ÇÔ) ¸®½ºÆ®
							getDargThemeViewCommentList(sPageParam,sParam);
						}else{
							getDargCommentListAjax(sPageParam,sParam);
						}//end if

					},
					onSuccess:function()
					{
						setDargComment_Save(nListSeq,sDisplayLayer);
					}
				});

	if(sMode !="delete"){
		if (nDarg == 2 || nDarg == 3 || nDarg == 6)	{
			setCommentProductInit(); // ´ñ±Û »óÇ° ÃÊ±âÈ­
		}// end if
		objDesc.value = "";
	}//end if
}//end function setDargCommmentProcess(nLoginCheck,nDarg,nListSeq,nCommentListSeq,sMode,sComment,nPage,nDpLayer,nParentLIstSeq,sListType)

/**
 *	´ñ±Û ºÒ·¯ ¿À±â
 * @param nPage (nPage=1)
 * @param sPars ()
 */
function getDargCommentListAjax(nPage,sPars) {
	var url		= "DargCommentListAjax.php";
	var pars	= nPage + sPars+"&" + oNow.getTime();

	var myAjax = new Ajax.Updater(
				{success: "aDargCommentList"},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargCommentListAjax(nPage,sPars)

/**
 * Ã¤ÅÃµÈ ´ñ±Û º¸±â(ºä ÆäÀÌÁö - Å×¸¶ ´Ù¾ËÁö Á¦¿Ü)
 * @param nListSeq °Ô½Ã±Û °íÀ¯Å°
 * @param nDarg ´Ù¾ËÁö ¸Þ´ºÅ°
 * @param sDisplayLayer Ãâ·ÂÇÒ ·¹ÀÌ¾î id
 * getDargCommentRecommendListAjax(nSeq,nDarg, nDpLayer) -> ¹Ù²ñ
 */
function getDargCommentRecommendListAjax(nListSeq,nDarg, sDisplaypLayer)
{
	var url		= "/DargCommentRecommendListAjax.php";
	var pars	= "nListSeq="+nListSeq+"&nDarg="+nDarg;

	var myAjax = new Ajax.Updater(
				{success: sDisplaypLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function getDargCommentRecommendListAjax(nSeq,nCSeq,nDarg,nType,nDpLayer)

/**
 *	ÆÇ¸ÅÁ¡ °¡°Ý ºÒ·¯¿À±â (Á¶¸³µýÁö)
 * @param nPage (nPage=1)
 * @param sPars ()
 */
function getDargStorePriceListAjax(nPage,sPars) {
	var url		= "DargStorePriceListAjax.php";
	var pars	= nPage + sPars+"&" + oNow.getTime();

	var myAjax = new Ajax.Updater(
				{success: "aDargCommentList"},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError

				});
}//end function getDargStorePriceListAjax(nPage,sPars)


/**
 * ±¸¸ÅÃßÃµ ¼­ºñ½º(Á¶¸³µýÁö) ASÁ¤Ã¥ º¸±â
 * @param sCompanySeq È¸»ç ÄÚµå
 */
function sSalerAS(sCompanySeq) {
	window.open('http://shop.danawa.com/baropc/myPage/sSalerAS.php?sCompanySeq='+sCompanySeq,'','width=630,height=515,scrollbars=yes');
}// end function sSalerAS(sCompanySeq)


/**
 * ±¸¸ÅÃßÃµ ¼­ºñ½º(Á¶¸³µýÁö) ¾È½É±¸¸ÅÇÏ±â
 * @param sCompanySeq È¸»ç ÄÚµå, ±¸¸Å ÃßÃµ °íÀ¯Å°
 */
function sBuyEstimate(sCompanySeq,nBidListSeq) {
	var frm=document.frm;

	if(sCompanySeq==''){
		alert('¾È½É±¸¸ÅÇÒ ¾÷Ã¼¸¦ ¼±ÅÃÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.');
	}

	if(nBidListSeq==''){
		alert('°ßÀûÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù');
	}

	if(sCompanySeq && nBidListSeq){
		frm.sCompanySeq.value=sCompanySeq;
		frm.nBidListSeq.value=nBidListSeq;

		frm.action = 'http://shop.danawa.com/baropc/order/order_form.php';
		frm.method='post';
		frm.submit();
	}

} // end function sBuyEstimate(sCompanySeq,nBidListSeq)

/**
 * ±ÛÀÚ¼ö Ã¼Å©
 * @param sComment
 */
function getCommentSize( sComment ) {
	var nLength = 0;
	for( i = 0 ; i < sComment.length ; i++) {
		sValue = sComment.charAt(i);
		if( escape( sValue ).length > 4) {
			nLength += 2;
		} else if( sValue != '\\r' ) {
			nLength ++;
		}
	}
	return nLength;
} // end function


// Ã¤ÅÃÇÏ±â °á°ú Ã¼Å©
function getDargReComResult(e,sUrl) {
	var result	= e.responseText;

	switch (result) {
		case ("N"): alert("Á¤»óÀûÀ¸·Î Ã³¸®µÇÁö ¾Ê¾Ò½À´Ï´Ù.");	break;
		case ("D"): alert("Ã¤ÅÃ ÇØÁ¦ µÇ¾ú½À´Ï´Ù.");				break;
		case ("Y"): alert("Ã¤ÅÃ µÇ¾ú½À´Ï´Ù.");					break;
		case ("R"): alert("´äº¯ Ã¤ÅÃÀº 1È¸¸¸ °¡´ÉÇÕ´Ï´Ù.");		break;	// QnA & Á¶¸³µýÁö
		case ("T"): alert("´äº¯ Ã¤ÅÃÀº 5È¸±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù."); break;	// Å×¸¶ Ã¤ÅÃ
		case ("SYSTEM"): alert("½Ã½ºÅÛ Á¡°Ë Áß ÀÔ´Ï´Ù."); break;	// ½Ã½ºÅÛ Á¡°Ë
	}//end switch

	top.location.href=sUrl;
}//end function getDargReComResult(e,sUrl)

// Ã¤ÅÃÇÏ±â ¿¡·¯ Ãâ·Â
function rpReComError() {
	alert("Ã¤ÅÃÇÏ±â°¡ Á¤»óÀûÀ¸·Î Ã³¸®µÇÁö ¾Ê¾Ò½À´Ï´Ù.");
}//end function rpReComError()

/* AJAX °ü·Ã ÇÔ¼ö ¸ðÀ½ ½ÃÀÛ */

/**
 * ·¹ÇÁÆ® ¸Þ´º ÇÏÀ§ Ä«Å×°í¸® µð½ºÇÃ·¹ÀÌ ¼ÂÆÃ
 * @param obj ¸Þ´º ±×¸² ÆÄÀÏ °´Ã¼
 */
function setSubCategoryDisplay(obj) {
	var sOriginImgSrc = 'http://img.danawa.com/new/dalgi/common/servm7.gif';
	var sChangeImgSrc = '';
	if ( document.getElementById('subCategoryArea').style.display == 'none') {
		sChangeImgSrc = 'http://img.danawa.com/new/dalgi/common/servm7_on.gif';
		document.getElementById('subCategoryArea').style.display = 'block';
	} else {
		sChangeImgSrc = sOriginImgSrc;
		document.getElementById('subCategoryArea').style.display = 'none';
	}
	this.src = sChangeImgSrc;
}

/**
 * µð¾Æºí·Î »ó´ã ½ÅÃ» check Ã³¸®
 * 2011-11-14 ¹ÚÁø¼ö
 * @return
 */
function diaCheckDisplay() {
	
	var obj = document.frmDargWriteSave;
	if (obj.stDiabloCheck.checked) {
		var oOption = document.createElement("option");
		oOption.setAttribute("value", "6_1393_1403_1427_0_679943_6286_0");
		oOption.innerHTML = "µð¾Æºí·Î3";
		document.getElementById("sProdCodeMult").appendChild(oOption);
	} else {
		var nSelectLength = document.getElementById("sProdCodeMult").options.length;
		for (var i = 0; i < nSelectLength; i++) {
			var sProdValue = document.getElementById("sProdCodeMult").options[i].value;
			if (sProdValue == "6_1393_1403_1427_0_679943_6286_0") {
				document.getElementById("sProdCodeMult").removeChild(document.getElementById("sProdCodeMult").options[i]);
			}
		}
	}
}



