/*
	SMS Àü¼Û°ü·Ã ½ºÅ©¸³Æ® Á¤ÀÇ

	Xonda.Net

	ÀÛ¼ºÀÏ	:	2004.11.20  ÀÌ»ó¿­
	¼öÁ¤ÀÏ	:	2005.07.13  ÀÌ»ó¿­

	Copyright(c) 2001-2005 Xonda.net Co,.Ltd. All Rights Reserved.
*/

document.write("<div id='preview_win' style='border: 1 solid; width: 110px; display: none; position: absolute; z-index: 25'></div>");

function previewEmoticon(msg) {

	msg = msg.replace(/aR_/g, '<br>');
	msg = msg.replace(/bQ_/g, '\"');
	msg = msg.replace(/nQ_/g, '\'');
	msg = msg.replace(/ /g, '&nbsp;');
	msg = msg.replace(/yQ_/g, '');
	msg = msg.replace(/mQ_/g, '\\');
	
	//alertMSG(msg);
	preview_win.innerHTML = '<table border=0 cellspacing=0 cellpadding=0 width=150 style="table-layout: fixed; filter: alpha(opacity=90)"><tr><td style="color: black; background-color: #FFFFFF; font-size:9pt; font-family: µ¸¿òÃ¼; padding: 5 5 5 5">'+ msg +'</td></tr></table>';
	preview_win.style.top = event.clientY + document.body.scrollTop + 10;
	preview_win.style.left = event.clientX + document.body.scrollLeft + 10;
	preview_win.style.display = 'inline';

}

function movePreview() {
	preview_win.style.top = event.clientY + document.body.scrollTop + 10;
	preview_win.style.left = event.clientX + document.body.scrollLeft + 10;
}

function hidePreview() {
	preview_win.innerHTML = '';
	preview_win.style.top = 0;
	preview_win.style.left = 0;
	preview_win.style.display = 'none';
}

/*
	ÀÌ¸ðÆ¼ÄÜ Ã³¸® ÇÔ¼ö...
*/
function grabEmoticon(emID, emText)
{
	if(MyUserNo == "" || MyUserID == "")
	{
		alertMSG("·Î±×ÀÎÈÄ »ç¿ë ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù...");
		return;
	}

	if(!confirmMSG(emText + "\n\n³ª¸¸ÀÇ ÀÌ¸ðÆ¼ÄÜÀ¸·Î ÀúÀå ÇÏ½Ã°Ú½À´Ï±î?"))
		return;

	window.location = "./Proc/Grab_MyEmoticon.asp?EmID=" + emID + "&returnURL=" + escape(document.URL);
}

function regist_EmoticonContest(form)
{
	if(MyUserNo == "" || MyUserID == "")
	{
		alertMSG("·Î±×ÀÎÈÄ »ç¿ë ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù...");
		return;
	}

	var emCode = form.Emoticons.value;
	var emText = form.EmoticonContents.value;

	if(emCode == "" || !parseFloat(emCode))
	{
		alertMSG("µî·ÏÇÒ Ç×¸ñÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä...");
		form.Emoticons.focus();
		return;
	}
	else if(parseFloat(emCode) < 1 && parseFloat(emCode) != -500 && parseFloat(emCode) != -600)
	{
		alertMSG("µî·ÏÇÒ Ç×¸ñÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä...");
		form.Emoticons.focus();
		return;
	}

	if(emText == "")
	{
		alertMSG("µî·ÏÇÒ ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä...");
		form.EmoticonContents.focus();
		return;
	}

	if(StrByteLengthEx(emText) > 80)
	{
		alertMSG("³»¿ëÀÌ ³Ê¹« ±æ¾î µî·Ï ÇÒ ¼ö ¾ø½À´Ï´Ù.\n\n³»¿ëÀ» 80 Byte ÀÌ³»·Î ÀÛ¼ºÇØ ÁÖ¼¼¿ä...");
		form.EmoticonContents.focus();
		return;
	}

	if(!confirmMSG(emText + "\n\nµî·Ï ÇÏ½Ã°Ú½À´Ï±î?"))
		return;

	window.location = "./Proc/Regist_EmoticonContest.asp?EmCode=" + emCode + "&EmText=" + escape(emText) + "&returnURL=" + escape(document.URL);
}

function deleteMyEmoticon(emID, emText)
{
	if(MyUserNo == "" || MyUserID == "")
	{
		alertMSG("·Î±×ÀÎÈÄ »ç¿ë ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù...");
		return;
	}

	if(!confirmMSG(emText + "\n\n³ª¸¸ÀÇ ÀÌ¸ðÆ¼ÄÜÀ» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?"))
		return;

	window.location = "./Proc/Remove_MyEmoticon.asp?EmID=" + emID + "&returnURL=" + escape(document.URL);
}

function deleteALLMyEmoticon()
{
	if(MyUserNo == "" || MyUserID == "")
	{
		alertMSG("·Î±×ÀÎÈÄ »ç¿ë ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù...");
		return;
	}

	if(!confirmMSG("È®ÀÎÀ» ´©¸£½Ã¸é ³ª¸¸ÀÇ ÀÌ¸ðÆ¼ÄÜÀÌ ¸ðµÎ »èÁ¦ µË´Ï´Ù\n\n½ÇÇà ÇÏ½Ã°Ú½À´Ï±î?"))
		return;

	window.location = "./Proc/Remove_MyEmoticon.asp?EmID=-1&procType=ALL&returnURL=" + escape(document.URL);
}

function sendEmoticon(emID, emText)
{
	if(MyUserNo == "" || MyUserID == "")
	{
		alertMSG("·Î±×ÀÎÈÄ »ç¿ë ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù...");
		return;
	}

	openWindow("/SMS/Send_Main.asp?OpCode=SENDSMS&SubType=&ContentsType=EMOTICON&subID=" + emID + "&SendMessage=" + escape(emText), "SendSMS", 720, 515, c_CENTER, c_TOP);
}

/*
	³ª¸¸ÀÇ ¹®ÀÚ Ã³¸® ÇÔ¼ö...
*/

function registMyMessage(form)
{
	if(MyUserNo == "" || MyUserID == "")
	{
		alertMSG("·Î±×ÀÎÈÄ »ç¿ë ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù...");
		return;
	}
	
	var emText = form.MyMessage.value;

	if(emText == "")
	{
		alertMSG("µî·ÏÇÒ ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä...");
		form.MyMessage.focus();
		return;
	}

	if(StrByteLengthEx(emText) > 80)
	{
		alertMSG("³»¿ëÀÌ ³Ê¹« ±æ¾î µî·Ï ÇÒ ¼ö ¾ø½À´Ï´Ù.\n\n³»¿ëÀ» 80 Byte ÀÌ³»·Î ÀÛ¼ºÇØ ÁÖ¼¼¿ä...");
		form.MyMessage.focus();
		return;
	}

	if(!confirmMSG(emText + "\n\nµî·Ï ÇÏ½Ã°Ú½À´Ï±î?"))
		return;

	window.location = "./Proc/Regist_MyMessage.asp?EmText=" + escape(emText) + "&returnURL=" + escape(document.URL);
}

function deleteMyMessage(emID, emText)
{
	if(MyUserNo == "" || MyUserID == "")
	{
		alertMSG("·Î±×ÀÎÈÄ »ç¿ë ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù...");
		return;
	}

	if(!confirmMSG(emText + "\n\n³ª¸¸ÀÇ ¹®ÀÚ¸¦ »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?"))
		return;

	window.location = "./Proc/Remove_MyMessage.asp?EmID=" + emID + "&returnURL=" + escape(document.URL);
}

function deleteALLMyMessage()
{
	if(MyUserNo == "" || MyUserID == "")
	{
		alertMSG("·Î±×ÀÎÈÄ »ç¿ë ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù...");
		return;
	}

	if(!confirmMSG("È®ÀÎÀ» ´©¸£½Ã¸é ³ª¸¸ÀÇ ¹®ÀÚ°¡ ¸ðµÎ »èÁ¦ µË´Ï´Ù\n\n½ÇÇà ÇÏ½Ã°Ú½À´Ï±î?"))
		return;

	window.location = "./Proc/Remove_MyMessage.asp?EmID=-1&procType=ALL&returnURL=" + escape(document.URL);
}

function sendMessage(emID, emText)
{
	if(MyUserNo == "" || MyUserID == "")
	{
		alertMSG("·Î±×ÀÎÈÄ »ç¿ë ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù...");
		return;
	}

	openWindow("/SMS/Send_Main.asp?OpCode=SENDSMS&SubType=&ContentsType=MYMESSAGE&subID=" + emID + "&SendMessage=" + escape(emText), "SendSMS", 720, 515, c_CENTER, c_TOP);
}


