function loginBbs(opt)
{
	//popupUrl = "http://www.melon.com/PIMS/myMelon/newMyInfo/popup/loginPop.jsp?";
	popupUrl = "/bbs/loginCheck.jsp?";
	
	var paramUrl = document.bbsMasterForm.BBS_ParamReferer.value;
	paramUrl += "&bbsMode="+opt;
	paramUrl = paramUrl.replace(/&/g,";");
	
	window.open(popupUrl+"return_url="+paramUrl,'bbs','height=400,width=400');
}

function send2Twitter(bbsCd, subId, messageId, bt)
{
	var MAX_CHAR	= 140;
	var strStatus	= "";
	var strUrl		= window.location.href;
	var cbUrl		= "";
	var strTitle	= "";
	
	if (bbsCd == null || bbsCd == "")
	{
		return;
	}

	if (bt == "A")
	{
		/* cbUrl template
		 * /svc/cb_scrap.jsp?bt|mid|sid
		 */
		strTitle		= document.getElementById("T_MESSAGE_TITLE").value;
	}
	else
	{
		// comment or BType BBS
		strTitle	= document.getElementById(bt).value;
	}
	
	if (bbsCd == "ent")
	{
		// ¿¬¿¹´º½º /svc/cb_scrap.jsp?ent-123123-0
		cbUrl	= "http://www.melon.com/svc/cb_scrap.jsp?" + bbsCd + "-" + messageId + "-0";
	}
	else if (bbsCd == "alb")
	{
		// ¾Ù¹ü
		cbUrl	= "http://www.melon.com/svc/cb_scrap.jsp?" + bbsCd + "-" + messageId + "-" + subId;
	}
	else if (bbsCd == "art")
	{
		// ¾ÆÆ¼½ºÆ®
		cbUrl	= "http://www.melon.com/svc/cb_scrap.jsp?" + bbsCd + "-" + messageId + "-" + subId;
	}
	else if (bbsCd == "mus")
	{
		// ¹ÂÁ÷½ºÅä¸®
		cbUrl	= "http://www.melon.com/svc/cb_scrap.jsp?" + bbsCd + "-" + messageId + "-0";
	}
	
	strTitle		= stripHTMLtagTweeter(strTitle);
	var totLength	= (cbUrl.length + strTitle.length);
	var adjTitle	= strTitle;
	
	if (totLength > MAX_CHAR)
	{
		var nGap	= MAX_CHAR - totLength;
		adjTitle	= strTitle.substring(0, (strTitle.length - nGap -2)) + "..";
	}
	
	strStatus	= encodeURIComponent(adjTitle + " " + cbUrl);
	var twitURL		= "http://twitter.com/home?status=" + strStatus;
	
	window.open(twitURL);
}

function send2Me2Day(bbsCd, subId, messageId, bt)
{
	var MAX_CHAR	= 150;
	var strStatus	= "";
	var strUrl		= window.location.href;
	var cbUrl		= "";
	var strTitle	= "";
	
	if (bbsCd == null || bbsCd == "")
	{
		return;
	}

	if (bt == "A")
	{
		/* cbUrl template
		 * /svc/cb_scrap.jsp?bt|mid|sid
		 */
		strTitle	= document.getElementById("T_MESSAGE_TITLE").value;
	}
	else
	{
		// comment or BType BBS
		strTitle	= document.getElementById(bt).value;
	}
	
	if (bbsCd == "ent")
	{
		// ¿¬¿¹´º½º /svc/cb_scrap.jsp?ent-123123-0
		cbUrl	= "http://www.melon.com/svc/cb_scrap.jsp?" + bbsCd + "-" + messageId + "-0";
	}
	else if (bbsCd == "alb")
	{
		// ¾Ù¹ü
		cbUrl	= "http://www.melon.com/svc/cb_scrap.jsp?" + bbsCd + "-" + messageId + "-" + subId;
	}
	else if (bbsCd == "art")
	{
		// ¾ÆÆ¼½ºÆ®
		cbUrl	= "http://www.melon.com/svc/cb_scrap.jsp?" + bbsCd + "-" + messageId + "-" + subId;
	}
	else if (bbsCd == "mus")
	{
		// ¹ÂÁ÷½ºÅä¸®
		cbUrl	= "http://www.melon.com/svc/cb_scrap.jsp?" + bbsCd + "-" + messageId + "-0";
	}
	
	strTitle		= stripHTMLtagTweeter(strTitle);
	// ¹ÌÅõµ¥ÀÌ´Â callbackurl »©°í 150
	var totLength	= strTitle.length;
	var adjTitle	= strTitle;
	
	if (totLength > MAX_CHAR)
	{
		var nGap	= (MAX_CHAR) - totLength;
		adjTitle	= strTitle.substring(0, (strTitle.length - nGap -2)) + "..";
	}
	
	strStatus	= encodeURIComponent("\"" + adjTitle + "\":" + cbUrl);
	var twitURL	= "http://me2day.net/posts/new?new_post[body]=" + strStatus;
	
	window.open(twitURL);
}

function stripHTMLtagTweeter(string)
{
	var objStrip = new RegExp();
	objStrip = /[<][^>]*[>]/gi;
	return string.replace(objStrip, "");
}
