/*******************************************************************************
 * ³»  ¿ë :	»óÇ° ºí·Î±× °ø¿ë ÀÚ¹Ù ½ºÅ©¸³Æ®
 * Âü  °í :
 * Á¢±ÙDB :
 * ÀÛ¼ºÀÚ :	±èÁ¾Áø
 * ¼öÁ¤ÀÚ :
 * ÀÛ¼ºÀÏ :	2006-05-10
 ******************************************************************************/

//Å©·Î½º µµ¸ÞÀÎÀ» À§ÇØ
document.domain="danawa.com";

//·Î±×ÀÎ ÆÄ¼­
function loginPage(passUrl)
{
	top.frMain.location.href= passUrl;

	top.frTop.location.reload();
	top.frLeft.location.reload();
	top.frBottom.location.reload();
}//end loginPage

//·Î±×¾Æ¿ô ÆÄ¼­
function logoutPage()
{
	top.location.reload();
}//end logoutPage

//»óÇ° ºí·Î±× ¸Þ´º ÀÌµ¿ ÇÔ¼ö
function ProdMenu(url,nPcode,ankerTarget)
{
	// Ä¿¹Â´ÏÆ¼¿Í »óÇ°ºí·Î±×ÀÇ »óÇ° ÄÚµå º¯¼ö°¡ Æ²¸®¹Ç·Î
	var prod_c = (!nPcode)?"":"?prod_c="+nPcode;
	var ankerTarget = (!ankerTarget)?"":ankerTarget;
	top.frMain.location.href=url+prod_c+ankerTarget;
}//end ProdMenu

//»óÇ° ºí·Î±× ÆäÀÌÁö º¯È¯
function ProdReflash(url)
{
	parent.location.href=url;
}//end ProdReflash

//·Î±×ÀÎ ÆäÀÌÁö ÀÌµ¿ ÇÔ¼ö
function ProdLoginPaser(url)
{
	var frMainUrl = encodeURIComponent(encodeURIComponent(top.frMain.location.href));
	top.frMain.location.href=url + frMainUrl;
}//end ProdLoginPaser

//ÆË¾÷Ã¢¿¡¼­ ·Î±×ÀÎ ÆäÀÌÁö ÀÌµ¿ÇÔ¼ö
function ProdLoginPaserPop(url)
{
	alert('·Î±×ÀÎÈÄ »ç¿ë¼öÀÖ½À´Ï´Ù.');
	var frMainUrl = encodeURIComponent(encodeURIComponent(opener.top.frMain.location.href));
	opener.top.frMain.location.href=url + frMainUrl;
	self.close();
}//end ProdLoginPaser

//Å¬¸³º¸µå º¹»ç ÇÔ¼ö
function CopyClip(ctext)
{
	if (window.clipboardData)
	{
		// IE ÀÏ¶§
		window.clipboardData.setData("Text", ctext);
		alert("Áö±Ý º¸½Ã´Â Á¤º¸ Ã¢ÀÇ ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù\n´Ù¸¥ °÷¿¡ ºÙ¿©³Ö±â ÇÏ¿© ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
	}else{
		alert("IE Àü¿ëÀÔ´Ï´Ù. ºÒÆíÀ» µå·Á¼­ ÁË¼ÛÇÕ´Ï´Ù.");
	}
}//end CopyClip

//»õÃ¢ ¿­±â
function WindowOpen(url, name, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}//end WindowOpen

//Æ¯Á¤ Å¸ÄÏÀ¸·Î url º¯°æ ÇÏ±â
function PaseTargetUrl(target,url)
{
	ifrObj = document.getElementById(target);

	if ( ifrObj == null )
	{
		alert('target error');
	}//end if

	ifrObj.src = url;
}//end ProdSave

//°¡°Ýº¯µ¿ ±×·¡ÇÁ
function view_graph(period,nPcode)
{
	var code = parseInt(nPcode);
	var file1 = Math.floor(code/500);
	var file2 = code + ".PNG";

//	var chg_grp = 'http://www.danawa.net/price_graph/graph/month_' + period + "/" + file1 + "/" + file2;
	var chg_grp = 'http://img.danawa.com/graph/month_' + period + "/" + file1 + "/" + file2;
	var grp_obj = document.getElementById('month_graph');

	var new_grp = new Image();
	new_grp.src = chg_grp;
	grp_obj.src = new_grp.src;

	var radio_obj = document.getElementById('view_month');
}


//¾ÆÀÌÇÁ·¹ÀÓ ¸®»çÀÌÁî
function ResizeIframe(name)
{
	try
	{
		var oBody 	= document.frames(name).document.body;
		var oFrame 	= document.all(name);

		oFrame.style.width
				= oBody.scrollWidth + (oBody.offsetWidth-oBody.clientWidth);
		oFrame.style.height
				= oBody.scrollHeight + (oBody.offsetHeight-oBody.clientHeight);

		if (oFrame.style.height == "0px" || oFrame.style.width == "0px")
		{
			oFrame.style.width = "0px";
			oFrame.style.height = "0px";
			window.status = 'iframe resizing fail.';
		}else{
			window.status = '';
		}
	}

	catch(e)
	{
//		window.status = 'Error: ' + e.number + '; ' + e.description;
	}
}

//ÇÚµåÆù º¸Á¶±Ý ÀÔ·Â
function mobileInBoxChange()
{
	document.getElementById('mobilePriceInBox').style.display = "block";
	document.getElementById('mobilePriceViewBox').style.display = "none";
}//end function

//ÇÚµåÆù º¸Á¶±Ý Ã³¸®
function frmSubmit(nFrm, nUrl)
{
	var frm		= eval("document."+nFrm);
	var nPara	= encodeURIComponent(frm.nReturnUrl.value);
	var nPara2	= encodeURIComponent(frm.hpPrice.value);

	if(isNaN(nPara2) == false)
	{
		frm.action	= nUrl+"?mode=insert&nReturnUrl="+nPara+"&hpPrice="+nPara2;
		frm.submit();
	}else{
		alert("¼ýÀÚ¸¸ ÀÔ·ÂÇÏ¼¼¿ä!");
	}//end if
}//end function


//ajax ¿ÜºÎ »óÇ° ¼³¸í ÄÁÅÙÃ÷ ¼ÂÆÃÇÏ±â
function setExtendDescAjax(nOouterSeq)
{
	var nOouterSeq = (!nOouterSeq || nOouterSeq == "[object]")? "":nOouterSeq ;
	var prod_c	= $('nProdC').value;
	var nDpLayer= "extendDescDP";
	var url		= "/prod/include/include_product_extend_desc.php";
	var pars	= "prod_c="+prod_c+"&outer_seq="+nOouterSeq;

	var myAjax = new Ajax.Updater(
				{success: nDpLayer},
				url,
				{
					method: 'post',
					parameters: pars,
					onFailure: rpError
				});
}//end function


//¿¡·¯ Ãâ·Â
function rpError()
{
	alert("Á¤»óÀûÀ¸·Î Ã³¸®µÇÁö ¾Ê¾Ò½À´Ï´Ù.");
}//end function


//ÄÁÅÙÃ÷ Ä«¿îÅÍ
// ÂüÁ¶: http://loggerdb.danawa.com/manual/helpView.tsp?node=1179&upperNode=309&nodeType=P&mode=
function _trkEventLog(str)
{
	try {_trk_clickTrace('EVT', str);} catch(_e) {}
}//end function


