
//获取邮件列表
function getMailLists()
{
	var data = f_client_call("G_MSG_LIST");
	
	var datas = data.split("\r\n");
	datas = datas.reverse();
	var OReturn = new Object();
	OReturn["iSent"] = 0;
	OReturn["iTrashUnRead"] = 0;
	OReturn["iindexUnRead"] = 0;
	OReturn["iInbox"] = 0;
	OReturn["iTrash"] = 0;
	OReturn["iDrafts"] = 0;
	OReturn["aInbox"] = new Array;
	OReturn["aDrafts"] = new Array;
	OReturn["aSent"] = new Array;
	OReturn["aTrash"] = new Array;
	for( i=0 ; datas!=null && i<datas.length ; i++ )
	{
		if (datas[i] == "")
		{
			continue;
		}
		var mail = datas[i].split("|");
		var object = new Object();
		object["seq"] = mail[0];
		object["time"] = mail[1];
		object["attrib"] = "000000" + parseFloat(mail[2]).toString(16);
		object["mailsource"] == "";
		object["unread"] = 0;//已读
		var sattr = object["attrib"].substring(object["attrib"].length-6,object["attrib"].length);
		object["from"] = mail[3];
		var s2 = parseFloat(sattr.substring(1,2)).toString(2);
		if (s2.substring(s2.length -2,s2.length -1) == "1")
		{
			OReturn["iTrash"] = OReturn["iTrash"] + 1;
			if (s2.substring(s2.length -1) == "0")
			{
				OReturn["iTrashUnRead"] = OReturn["iTrashUnRead"] + 1;
				object["unread"] = 1;//未读
			}
			OReturn["aTrash"].push(object);
			continue;
		}
		switch(sattr.substring(3,6)) 
		{
			case "001":
				OReturn["iSent"] = OReturn["iSent"] + 1;
				OReturn["aSent"].push(object);
				break;
			case "002":
				OReturn["iInbox"] = OReturn["iInbox"] + 1;
				if (s2.substring(s2.length -1) == "0")
				{
					OReturn["iindexUnRead"] = OReturn["iindexUnRead"] + 1;
					object["unread"] = 1;//未读
				}
				OReturn["aInbox"].push(object);
				break;
			case "000":
				OReturn["iDrafts"] = OReturn["iDrafts"] + 1;
				OReturn["aDrafts"].push(object);
				break;
		}
	}
	return OReturn;
}
