//////////////////////////////////////////////
// Name : msnAlert.js
//////////////////////////////////////////////

document.write("<div id=popupWin style=\"width:182px; height:135px; right:15px; bottom:15px; display:none; background:#E0E9F8; border-right:1px solid #455690; border-bottom:1px solid #455690; border-left:1px solid #B9C9EF; border-top:1px solid #B9C9EF; position:absolute; z-index:9999;\" onselectstart=\"return false;\" onmousedown=\"return popupWinespopup_DragDrop(event);\">");
document.write("	<div id=popupWin_header style=\"left:2px; width:176px; top:2px; height:14px; cursor:default; display:none; position:absolute; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#FFE0E9F8', EndColorStr='#FFFFFFFF');font:bold 12px arial,sans-serif; color:red; text-decoration:none;\">");
document.write("		<span	id=popupWintitleEl></span>");
document.write("		<span	style=\"position:absolute; right:0px; top:0px; cursor:pointer; color:#728EB8; font:bold 12px arial,sans-serif; position:absolute; right:3px;\" onclick=\"popupWinespopup_Close()\" onmousedown=\"event.cancelBubble=true;\" onmouseover=\"style.color='#455690';\" onmouseout=\"style.color='#728EB8';\">X</span>");
document.write("	</div>");
document.write("	<div id=popupWin_content onmousedown=\"event.cancelBubble=true;\" style=\"left:2px; width:176px; top:20px; height:110px; display:none; border-left:1px solid #728EB8; border-top:1px solid #728EB8; border-bottom:1px solid #B9C9EF; border-right:1px solid #B9C9EF; background:#E0E9F8; padding:2px; overflow:hidden; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FFE0E9F8', EndColorStr='#FFFFFFFF'); color:blue; font:12px arial,sans-serif; position:absolute;\">");
document.write("		<span id=popupWin_showMsg></span>");
document.write("	</div>");
document.write("</div>");

var popupWinoldonloadHndlr=window.onload, popupWinpopupHgt=135, popupWinactualHgt, popupWintmrId=-1, popupWinresetTimer;
var popupWintitHgt, popupWincntDelta, popupWintmrHide=-1, popupWinhideAfter=5000, popupWinhideAlpha, popupWinhasFilters=true;
var popupWinnWin, popupWinshowBy=null, popupWindxTimer=-1, popupWinpopupBottom;

function msnAlert(strTitle, strContent, strUrl)
{
	popupWintitleEl.innerHTML = strTitle;
	if(strUrl!="" && strUrl!=undefined)
		strContent = "<a href='" + strUrl + "' style='color:blue'>" + strContent + "</a>";
	popupWin_showMsg.innerHTML = strContent;

	if (popupWinoldonloadHndlr!=null) popupWinoldonloadHndlr();

	elCnt=document.getElementById('popupWin_content')
	elTit=document.getElementById('popupWin_header');
	el=document.getElementById('popupWin');
	popupWinpopupBottom=el.style.bottom.substr(0,el.style.bottom.length-2);

	popupWintitHgt=elTit.style.height.substr(0,elTit.style.height.length-2);
	popupWinpopupHgt=el.style.height;
	popupWinpopupHgt=popupWinpopupHgt.substr(0,popupWinpopupHgt.length-2); popupWinactualHgt=0;
	popupWincntDelta=popupWinpopupHgt-(elCnt.style.height.substr(0,elCnt.style.height.length-2));

	popupWinresetTimer = true;
	if (strUrl=='stop') popupWinresetTimer = false;

	popupWinespopup_ShowPopup(null);
}

var bodyScrollHeight, bodyScrollTop;
bodyScrollHeight = document.body.scrollHeight;
bodyScrollTop = document.body.scrollTop;

function popupWinespopup_ShowPopup(show)
{
	if (popupWindxTimer!=-1)
		el.filters.blendTrans.stop();

	if ((popupWintmrHide!=-1) && ((show!=null) && (show==popupWinshowBy)))
	{
		clearInterval(popupWintmrHide);
		popupWintmrHide=setInterval(popupWinespopup_tmrHideTimer,popupWinhideAfter);
		return;
	}

	if (popupWintmrId!=-1) return;

	popupWinshowBy=show;

	elCnt=document.getElementById('popupWin_content');
	elTit=document.getElementById('popupWin_header');
	el=document.getElementById('popupWin');
	el.style.left='';
	el.style.top='';
	el.style.filter='';

	if (popupWintmrHide!=-1) clearInterval(popupWintmrHide); popupWintmrHide=-1;

	document.getElementById('popupWin_header').style.display = 'none';
	document.getElementById('popupWin_content').style.display = 'none';

	if (navigator.userAgent.indexOf('Opera')!=-1) {
		el.style.bottom=(bodyScrollHeight*1-bodyScrollTop*1
			- document.body.offsetHeight*1+1*popupWinpopupBottom)+'px';
	}

	popupWinactualHgt=0; el.style.height=popupWinactualHgt+'px';
	el.style.visibility='';
	if (!popupWinresetTimer) el.style.display='';
	popupWintmrId=setInterval(popupWinespopup_tmrTimer,(popupWinresetTimer?1000:20));
}

function popupWinespopup_tmrTimer()
{
	el=document.getElementById('popupWin');
	if (popupWinresetTimer)
	{
		el.style.display='';
		clearInterval(popupWintmrId); popupWinresetTimer=false;
		popupWintmrId=setInterval(popupWinespopup_tmrTimer,20);
	}

//	ÇÑÈ­¸é¿¡¼­ ÆË¾÷ ¸ðµâÀ» º¹¼öÈ½¼ö·Î »ç¿ëÇÏ±â À§ÇØ ÃÊ±â ¼³Á¤°ªÀ» Á¤ÇÑ´Ù.
	popupWinpopupHgt = 135;
	popupWincntDelta = 25;

	popupWinactualHgt+=5;

	if (popupWinactualHgt>=popupWinpopupHgt)
	{
		popupWinactualHgt=popupWinpopupHgt; clearInterval(popupWintmrId); popupWintmrId=-1;
		document.getElementById('popupWin_content').style.display='';

		if (popupWinhideAfter!=-1) popupWintmrHide=setInterval(popupWinespopup_tmrHideTimer,popupWinhideAfter);
	}

	if (popupWintitHgt<popupWinactualHgt-6)
		document.getElementById('popupWin_header').style.display='';

	if ((popupWinactualHgt-popupWincntDelta)>0)
	{
		elCnt=document.getElementById('popupWin_content')
		elCnt.style.display='';
		elCnt.style.height=(popupWinactualHgt-popupWincntDelta)+'px';
	}
	el.style.height=popupWinactualHgt+'px';
}

function popupWinespopup_tmrHideTimer()
{

}

function popupWinespopup_dxTimer()
{
	clearInterval(popupWindxTimer); popupWindxTimer=-1;
}

function popupWinespopup_Close()
{
	if (popupWintmrId==-1)
	{
		el=document.getElementById('popupWin');
		el.style.filter='';
		el.style.display='none';

		if (popupWintmrHide!=-1) clearInterval(popupWintmrHide); popupWintmrHide=-1;
	}
}

var popupWinmousemoveBack,popupWinmouseupBack;
var popupWinofsX,popupWinofsY;

function popupWinespopup_DragDrop(e)
{
	popupWinmousemoveBack=document.body.onmousemove;
	popupWinmouseupBack=document.body.onmouseup;
	ox=(e.offsetX==null)?e.layerX:e.offsetX;
	oy=(e.offsetY==null)?e.layerY:e.offsetY;
	popupWinofsX=ox; popupWinofsY=oy;

	document.body.onmousemove=popupWinespopup_DragDropMove;
	document.body.onmouseup=popupWinespopup_DragDropStop;

	if (popupWintmrHide!=-1) clearInterval(popupWintmrHide);
}

function popupWinespopup_DragDropMove(e)
{
	el=document.getElementById('popupWin');

	if (e==null&&event!=null)
	{
		el.style.left=(event.clientX*1+ bodyScrollLeft - popupWinofsX)+'px';
		el.style.top=(event.clientY*1+ bodyScrollTop - popupWinofsY)+'px';
		event.cancelBubble=true;
	}
	else
	{
		alert(bodyScrollLeft - popupWinofsX);
		el.style.left=(e.pageX*1-popupWinofsX)+'px';
		el.style.top=(e.pageY*1-popupWinofsY)+'px';
		e.cancelBubble=true;
	}

	if ((event.button&1)==0) popupWinespopup_DragDropStop();
}

function popupWinespopup_DragDropStop()
{
	document.body.onmousemove=popupWinmousemoveBack;
	document.body.onmouseup=popupWinmouseupBack;
}
