/*******************************************************************************
 * ³»  ¿ë :	»óÇ° ºí·Î±× °¡°Ýºñ±³ ÀÚ¹Ù ½ºÅ©¸³Æ®
 * Âü  °í :
 * Á¢±ÙDB :
 * ÀÛ¼ºÀÚ :	±èÁ¾Áø
 * ¼öÁ¤ÀÚ :
 * ÀÛ¼ºÀÏ :	2006-05-26
 ******************************************************************************/
//ºê¶ó¿ìÀú Å¸ÀÔ»êÃâ
function objMyBrowser()
{
	var strUA, s, i;
	this.isIE = false;		// ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯ÀÎÁö¸¦ ³ªÅ¸³»´Â ¼Ó¼º
	this.isNS = false;		// ³Ý½ºÄÉÀÌÇÁÀÎÁö¸¦ ³ªÅ¸³»´Â ¼Ó¼º

	// Agent Á¤º¸¸¦ ´ã°í ÀÖ´Â ¹®ÀÚ¿­.
	strUA = navigator.userAgent;

	// Agent ¹®ÀÚ¿­(strUA) "MSIE"¶õ ¹®ÀÚ¿­ÀÌ µé¾î ÀÖ´ÂÁö Ã¼Å©
	s = "MSIE";
	if ((i = strUA.indexOf(s)) >= 0)
	{
		this.isIE = true;
		// º¯¼ö i¿¡´Â strUA ¹®ÀÚ¿­ Áß MSIE°¡ ½ÃÀÛµÈ À§Ä¡ °ªÀÌ µé¾îÀÖ°í,
		// s.length´Â MSIEÀÇ ±æÀÌ Áï, 4°¡ µé¾î ÀÖ´Ù.
		// strUA.substr(i + s.length)¸¦ ÇÏ¸é strUA ¹®ÀÚ¿­ Áß MSIE ´ÙÀ½¿¡
		// ³ª¿À´Â ¹®ÀÚ¿­À» Àß¶ó¿Â´Ù.
		// ±× ¹®ÀÚ¿­À» parseFloat()·Î º¯È¯ÇÏ¸é ¹öÀüÀ» ¾Ë¾Æ³¾ ¼ö ÀÖ´Ù.
		return;
	}

	// Agent ¹®ÀÚ¿­(strUA) "Netscape6/"ÀÌ¶õ ¹®ÀÚ¿­ÀÌ µé¾î ÀÖ´ÂÁö Ã¼Å©
	s = "Netscape6/";
	if ((i = strUA.indexOf(s)) >= 0)
	{
		this.isNS = true;
		return;
	}

	// ´Ù¸¥ "Gecko" ºê¶ó¿ìÀú´Â NS 6.1·Î Ãë±Þ.
	s = "Firefox/";
	if ((i = strUA.indexOf(s)) >= 0)
	{
		this.isNS = true;
		return;
	}
}
var objMyBrowser	= new objMyBrowser();


function clearbrowseredge(obj, whichedge)
{
	var edgeoffset = (whichedge=="rightedge") ? -3*-1 : 0*-1;

	if (whichedge=="rightedge")
	{
		var windowedge = (objMyBrowser.isIE) ? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
		tooltip_obj.contentmeasure=tooltip_obj.offsetWidth;
		if (windowedge-tooltip_obj.x < tooltip_obj.contentmeasure) edgeoffset=tooltip_obj.contentmeasure-obj.offsetWidth;
	}
	else
	{
		var windowedge = (objMyBrowser.isIE) ? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
		tooltip_obj.contentmeasure=tooltip_obj.offsetHeight;
		if (windowedge-tooltip_obj.y < tooltip_obj.contentmeasure) edgeoffset=tooltip_obj.contentmeasure+obj.offsetHeight;
	}

	return edgeoffset
}

function layer_make_message(title, message, tipwidth)
{
	var str =	  "<table cellspacing='1' width='" + tipwidth + "' cellcpacing='0' bgcolor='#333333'>"
				+ "<tr><td bgcolor='#FFF8E1' align='center'>" + title + "</td></tr>"
				+ "<tr><td bgcolor='#EEEEEE'>" + message + "</td></tr></table>";
	return str;
}


function iecompattest()
{
	return (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;
}

//·¹ÀÌ¾î º¸¿©ÁÖ±â ¼³Á¤
function tooltip_layer_view(layertype, obj, e, title, msg, tipwidth)
{
	tooltip_obj = document.getElementById ? document.getElementById("ToolTip_Layer") : ToolTip_Layer;

	if(layertype != '' && title == '' && msg == '')
	{
		var htmlTag = layer_static_message(layertype, tipwidth);
	}else if(title != '' && msg != ''){
		var htmlTag = layer_make_message(title, msg, tipwidth);
	}else{
		return false;
	}

	tooltip_obj.innerHTML=htmlTag;

	if(objMyBrowser.isNS || objMyBrowser.isIE)
	{
		showhide(tooltip_obj.style, e, "visible", "hidden", tipwidth);

		tooltip_obj.x			= getposOffset(obj, "left");
		tooltip_obj.y			= getposOffset(obj, "top");

		tooltip_obj.style.left	= tooltip_obj.x - clearbrowseredge(obj, "rightedge") + "px"
		tooltip_obj.style.top	= tooltip_obj.y - clearbrowseredge(obj, "bottomedge") + obj.offsetHeight + "px"
	}
}//end tooltip_layer_view()


//·¹ÀÌ¾î º¸¿©ÁÖ±â
function showhide(obj_style, e, visible, hidden, tipwidth)
{
	if(objMyBrowser.isNS || objMyBrowser.isIE) tooltip_obj.style.left=tooltip_obj.style.top = -500;

	if (tipwidth != '')
	{
		tooltip_obj.widthobj		= tooltip_obj.style;
		tooltip_obj.widthobj.width	= tipwidth;
	}

	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
	{
		obj_style.visibility="visible";
		obj_style.display="block";
	}
	else if (e.type=="click")
	{
		obj_style.visibility="hidden";
		obj_style.display="none";
	}
}//end showhide()


// object ÁÂÇ¥°ª
function getposOffset(obj, offsettype)
{
	var totaloffset	= (offsettype == "left") ? obj.offsetLeft : obj.offsetTop;
	var parentEl	= obj.offsetParent;

	while (parentEl != null)
	{
		totaloffset = (offsettype == "left") ? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}

	return totaloffset;
}

//·¹ÀÌ¾î ¼û±â±â
function tooltip_layer_hide()
{
	if (typeof(tooltip_obj) != "undefined")
	{
		if(objMyBrowser.isNS || objMyBrowser.isIE)
		{
			tooltip_obj.style.visibility	= "hidden";
			tooltip_obj.style.display		= "none";
		}
	}
}//end tooltip_layer_hide()

//Ç¥½ÃµÉ ÁöÁ¤µÈ ¸Þ½ÃÁö
function layer_static_message(name, tipwidth)
{
	var str = '';
	switch(name)
	{
		case('buy_jehu'): //Á¦ÈÞ¸ô
			str ="<table width='"+ tipwidth +"' height='40' border='0' cellpadding='1' cellspacing='1'>"
				+ "<tr><td bgcolor='#7ED739'>"
				+ "<table width='100%' border='0' cellspacing='3' cellpadding='0' bgcolor='#F5FDEE'>"
				+ "<tr><td height='1'></td></tr><tr><td valign='top'>"
				+ "<img src='http://img.danawa.com/elec/product/img/buy_jehu2.gif'></td>"
				+ "<td><font face='±¼¸²' color='#003AE0'>ÇØ´ç ¼îÇÎ¸ôÀÇ Á¦Ç° ±¸¸Å ÆäÀÌÁö·Î ÀÌµ¿ÇÕ´Ï´Ù. ÀÌµ¿ÈÄ ±¸¸Å °úÁ¤Àº ´Ù³ª¿Í¿Í ¹«°üÇÕ´Ï´Ù.</font></td></tr></table></td></tr></table>";
		break

		case('buy_chunja'): //ÀüÀÚº¸Áõ(À¯Å©¸¯ Àü¿ë)
			str ="<table width='"+ tipwidth +"' height='40' border='0' cellpadding='1' cellspacing='1'>"
				+ "<tr><td bgcolor='#0B54AD'>"
				+ "<table width='100%' border='0' cellspacing='3' cellpadding='0' bgcolor='#E7F1FC'>"
				+ "<tr><td height='1'></td></tr>"
				+ "<tr><td valign='top'><img src='http://img.danawa.com/elec/product/img/buy_chunja2.gif'></td>"
				+ "<td><font face='±¼¸²' color='#0B54AD'>ÀüÀÚº¸Áõ¼­ºñ½º¸¦ ¼±ÅÃÇÏ¿© ±¸¸ÅÇÏ´Â °æ¿ì¿¡ ÀüÀÚº¸Áõ(¸Å¸Åº¸È£) ¼­ºñ½º°¡ Á¦°øµË´Ï´Ù.</font></td></tr></table></td></tr></table>";
		break


		case('buy_escro'): //¿¡½ºÅ©·Î
			str ="<table width='"+ tipwidth +"' height='40' border='0' cellpadding='1' cellspacing='1'>"
				+ "<tr><td bgcolor='#0B54AD'>"
				+ "<table width='100%' border='0' cellspacing='3' cellpadding='0' bgcolor='#E7F1FC'>"
				+ "<tr><td height='1'></td></tr>"
				+ "<tr><td valign='top'><img src='http://img.danawa.com/elec/product/img/buy_escro2.gif'></td>"
				+ "<td><font face='±¼¸²' color='#0B54AD'>ÇÏ³ªÀºÇàÀÌ Á¦°øÇÏ´Â ¸Å¸Åº¸È£ ¼­ºñ½ºÀÎ ÀüÀÚ»ó°Å·¡ °áÁ¦´ë±Ý ¿¹Ä¡Á¦ÀÔ´Ï´Ù.</font></td></tr></table></td></tr></table>";
		break

		case('buy_boil'): //ÀüÀÚº¸Áõ/ÀÏ¹Ý
			str ="<table width='"+ tipwidth +"' height='37' border='0' cellpadding='1' cellspacing='1'>"
				+ "<tr><td bgcolor='#F88017'>"
				+ "<table width='100%' border='0' cellspacing='3' cellpadding='0' bgcolor='#FFF5EC'>"
				+ "<tr><td height='1'></td></tr><tr>"
				+ "<td valign='top'><img src='http://img.danawa.com/elec/product/img/buy_boil2.gif'></td>"
				+ "<td><font face='±¼¸²' color='#8E00A1'>ÇØ´ç¼îÇÎ¸ô·Î Á÷Á¢ ÀÌµ¿ÇÏ¿© ±¸¸ÅÇÏ°Å³ª ÀüÀÚº¸ÁõÀ» ÀÌ¿ëÇÑ ±¸¸ÅÀÇ ¼±ÅÃÀÌ °¡´ÉÇÑ ¼îÇÎ¸ôÀÔ´Ï´Ù.</font></td></tr></table></td></tr></table>";
		break

		case('buy_ilban'): //ÀÏ¹Ý
			str ="<table width='"+ tipwidth +"' height='40' border='0' cellpadding='1' cellspacing='1'>"
				+ "<tr><td bgcolor='#7ED739'>"
				+ "<table width='100%' border='0' cellspacing='3' cellpadding='0' bgcolor='#F5FDEE'>"
				+ "<tr><td height='1'></td></tr><tr><td valign='top'>"
				+ "<img src='http://img.danawa.com/elec/product/img/buy_ilban2.gif'></td>"
				+ "<td><font face='±¼¸²' color='#003AE0'>ÇØ´ç¼îÇÎ¸ôÀÇ »óÇ° ±¸¸Å ÆäÀÌÁö·Î Á÷Á¢ ÀÌµ¿ ÇÕ´Ï´Ù. ¸Å¸Åº¸È£ ¼­ºñ½º Á¦°ø ¿©ºÎ¿Í ½Å·Úµµ´Â ¼îÇÎ¸ô¸¶´Ù ´Ù¸¦¼ö ÀÖ½À´Ï´Ù.</font></td></tr></table></td></tr></table>";
		break

		case('buy_dsp'): //DSP ¼ÒÇÁÆ®¿þ¾î
			str ="<table width='"+ tipwidth +"' height='40' border='0' cellpadding='1' cellspacing='1'><tr><td bgcolor='#39B4D7'>"
				+ "<table width='100%' border='0' cellspacing='3' cellpadding='0' bgcolor='#EEFAFD'>"
				+ "<tr><td height='1'></td></tr><tr><td valign='top'>"
				+ "<img src='http://img.danawa.com/elec/product/img/buy_ilban2.gif'></td>"
				+ "<td><font face='±¼¸²' color='#0974AB'>DSP´Â Á¶¸³¿ë PC¾÷Ã¼¿¡¸¸ Á¦°øµÇ´Â Á¦Ç°±ºÀÌ¸ç S/W´ÜÇ°À¸·Î¸¸ ±¸ÀÔÇÒ °æ¿ì Á¤»óÀûÀÎ Á¦Ç°»ç¿ëÀÇ ±Ç¸®¸¦ ÀÎÁ¤¹ÞÁö ¸øÇÕ´Ï´Ù.</font></td>"
				+ "</tr></table></td></tr></table>";
		break
	}

	return str;
}

function PayPaser(nType,nParameta)
{
	var iXPos=0, iYPos=0;
	switch(nType)
	{
		case("buy_boil"):
			iXPos = (window.screen.width - 610) / 2;
			iYPos = (window.screen.height-800) / 2;
			window.open(nParameta,"safe_confirm","left="+iXPos+",top="+iYPos+",width=680,height=700,scrollbars=no");
		break;

		case("buy_chunja1"):
			iXPos = (window.screen.width - 610) / 2;
			iYPos = (window.screen.height-800) / 2;
			window.open(nParameta,"safe_confirm","left="+iXPos+",top="+iYPos+",width=664,height=640,scrollbars=no");
		break;


		case("etc"):
			iXPos = (window.screen.width - 610) / 2;
			iYPos = (window.screen.height-800) / 2;
			window.open(nParameta,"safe_confirm","left="+iXPos+",top="+iYPos+",width=480,height=300,scrollbars=no");
		break;

		default:
			window.open(nParameta,"");
		break;
	}//end switch
}//end function