var		MSG_COOKIE_NAME = "PDP_REPLY";

function checkSelectAll(fVar)
{
	var		saVar = fVar.form.SELECT_ALL;
	
	if (!fVar.checked && saVar.checked)
		checkboxSet(saVar, false);
}

function msgDel(id)
{
	var		rl = escape(location.pathname + location.search);

	if (confirm("Are you sure you want to delete this message?")) {
		location = "/sqd/msg/delete?MSG_ID=" + id + "&RL=" + rl;
	}

}

function msgDelMulti(fObj, delFlag)
{
	var		rl = location.pathname + location.search;
	var		n = checkCount(fObj['MSG_ID[]']);
	
	if (confirm("Are you sure you want to delete the " + n + " selected messages?")) {
/*
		fObj.action = (delFlag) ? "/mem/cgi/msg-del" : "/mem/cgi/msg-move";
		fObj.M_FLDR.value = "TRASH";
		fObj.RL.value = rl;
		fObj.submit();
*/
	}

}

function msgViewDel(id, fldr)
{
	var		rl = escape("/sqd/msg/messages?MSG_FLDR=" + fldr);

	if (confirm("Are you sure you want to delete this message?")) {
		location = "/sqd/msg/delete?MSG_ID=" + id + "&RL=" + rl;
	}

}

function trimSubject(fVar)
{
	var		foo = fVar.value;

	if (foo.substring(0,3) != "Re:") {
		foo = "Re: " + foo;
	}

	if (foo.length > 50) {
		foo = foo.substring(0,46);
		foo += "..."
	}

	fVar.value = foo;
}

function msgBlock(id, mode)
{
	var		rl = escape(location.pathname + location.search);

	switch(mode) {
		case 1:
			location = "/mem/cgi/msg-per-blk-ins?MPB_FID_B=" + id + "&RL=" + rl;
			break;
		case 0:
			location = "/mem/cgi/msg-per-blk-del?MPB_FID_B=" + id + "&RL=" + rl;
			break;
	}
}

function setPdpReply(url, name)
{

	var oneYear = 365 * 7 * 24 * 60 * 1000;
	var expDate = new Date();
	expDate.setTime (expDate.getTime() + oneYear);
	var cookieAttributes = "; expires=" + expDate.toGMTString()  + "; path=/";

	var pdpCookie = MSG_COOKIE_NAME + "=" + escape(url) + "|" + escape(name);

	document.cookie = pdpCookie + cookieAttributes;
}

function clearPdpReply()
{
	document.cookie = MSG_COOKIE_NAME + "=; path=/"
}

function getPdpReply()
{
	var		cookieVal = getCookie(MSG_COOKIE_NAME);
	
	if (!cookieVal || cookieVal == "")
		return;

	var		valArray = new Array();
	valArray = cookieVal.split('|');

	document.write('<img src="/img/button/bullet1.gif" width="13" height="13" hspace="3" align="absmiddle">' + 
                       '<a href="' + valArray[0] + '" class="content-b">' + 
	               'Continue your message to ' + valArray[1] + '</a><br>');
	               
  
}


