/*
     $Revision$
     $Id$

     JS voor fac_user_messages.asp
*/
function DoAction(row) {
  	var key = row.getAttribute("ROWKEY");
  	var rowData = eval("(" + row.getAttribute("ROWDATA") + ")");
  	if (rowData.action)
  	{
 			MarkAsRead(key,0);
  		FcltMgr.openDetail("appl/"+rowData.action, { reuse: true });
		}
}

function facDelete(row) {
    var key = row.getAttribute("ROWKEY");
    MarkAsRead(key,1);
 }


function MarkAsRead(messKey, dodelete) {
  var purl = "fac_user_messages_setReadFlag.asp?messKey=" + messKey+(dodelete==1 ? "&purge=1" : "");
  var data = {messKey: messKey};

  protectRequest.dataToken(data);
  $.post(purl
        ,data
        ,FcltCallback
        ,"json"
        );
  if (dodelete) $("[ROWKEY="+messKey+"]").hide();
}

function MarkAsReadAll()
{
  FcltMgr.confirm(L("lcl_fac_delete_all_msg"), function() {
      $.post("fac_user_messages_setReadFlag.asp", {
              deleteall: 1
          },
          FcltCallbackRefresh,
          "json");
  });
}