var selectusers = ""; //查询往来邮件人员帐号
var currusers = ""; //当前用户
var statusbox = {};
statusbox["MailTotal"] = 0;
statusbox["PageTotal"] = 1;
statusbox["tmpPageTotal"] = 0;
statusbox["PageLast"] = 0; //判断是不是跳转到最后一页
statusbox["CurPage"] = 1;
statusbox["filter"] = ""; //搜索条件
statusbox["searchdate"] = "";//日期搜索范围
var Odata;
var showresultstates ="false";//是否显示结果工具条
$(window).resize(function(){
//	ResizeWin();
});
function ResizeWin()
{
	var width = $(window).width();
	var height = $(window).height();
	if(showresultstates =="true")
	{
		$("#history_list").height(height - 66);
	}else
	{
		$("#history_list").height(height -37);
	}
}

function reflashmaillist() {
    Odata = getHisMailLists();
    ListMail("box");
    showpage(); //控制页面显示 
}
//从客户端获取邮件列表数据
function getHisMailLists() {
    var datepoint;
    switch (statusbox["searchdate"]) //判断是否需要页面跳转
    {
        case "最近一周":
            datepoint = GetDateStr(-7);
            break;
        case "最近一月":

            datepoint = GetDateStr(-30);
            break;
        case "最近三月":
            datepoint = GetDateStr(-90);
            break;
        case "全部":
            datepoint = GetDateStr(-9999);
            break;
    }

    var data = f_client_call("G_MSG_LIST",currusers + ";" + selectusers + "\r\n1");
    var datas = data.split("\r\n");
    //datas = datas.reverse();
    var OReturn = {};
    OReturn["ibox"] = 0; //邮件总数
    OReturn["abox"] = new Array; //邮件数组
    for (i = 0; datas != null && i < datas.length; i++) {
        if (datas[i] == "") {
            continue;
        }


        var mail = datas[i].split("|");
        var object = {};
        object["seq"] = mail[0];
        object["time"] = mail[1];
        var tmpdateCompare = dateCompare(ql_date_yyyymmdd(object["time"]), ql_date_yyyymmdd(datepoint));
        if (tmpdateCompare) {
            continue;
        }
        object["attrib"] = "000000" + parseFloat(mail[2]).toString(16);
        object["mailsource"] == mail[2];
        //	object["mailstate"] = "";
        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") {
            continue;
        }
        switch (sattr.substring(3, 6)) {
            case "001":
                object["mailstate"] = "sent"; //sent发件箱
                OReturn["ibox"] = OReturn["ibox"] + 1;
                OReturn["abox"].push(object);
                break;
            case "002":
                object["mailstate"] = "inbox"; //inbox收件箱
                OReturn["ibox"] = OReturn["ibox"] + 1;
                OReturn["abox"].push(object);
                break;
            case "000":
                //	OReturn["iDrafts"] = OReturn["iDrafts"] + 1;
                //	OReturn["aDrafts"].push(object);
                break;
        }
    }
//////        OReturn["abox"] = OReturn["abox"].sort(function (a, b) {
//////          if(a.seq < b.seq) {
//////                return -1;
//////            }
//////            else {
//////                return 1;
//////            }
//////            return 0;
//////        });

//////    OReturn["abox"] = OReturn["abox"].sort(function (a, b) {
//////        if (ql_date_compare(a.time, b.time, false) > 0) {
//////            return -1;
//////        }
//////        else {
//////            return 1;
//////        }
//////        return 0;
//////
//////    });
    return OReturn;
}

function ListMail(stab) {
    var sdetails = "";
    var iCurPage = 1;
	if (statusbox["filter"] != "") {
	    for (var i = 0; Odata["a" + stab] && i < Odata["a" + stab].length; i++) {
			ReadMailDetail(i, stab);
		}
    }
//    if (selectusers != "") {
//        Odata["a" + stab] = $.grep(Odata["a" + stab], function (val, key) {
//            return ((val["from"].toLowerCase().indexOf(currusers.toLowerCase()) >= 0) && (val["to"].toLowerCase().indexOf(selectusers.toLowerCase()) >= 0)) ||
//                    ((val["to"].toLowerCase().indexOf(currusers.toLowerCase()) >= 0) && (val["from"].toLowerCase().indexOf(selectusers.toLowerCase()) >= 0));
//        });
//    }
    if (statusbox["filter"] != "") {
        Odata["a" + stab] = $.grep(Odata["a" + stab], function (val, key) {
            return (val["title"].toLowerCase().indexOf(statusbox["filter"].toLowerCase()) >= 0) ||
                        (val["uncontent"].toLowerCase().indexOf(statusbox["filter"].toLowerCase()) >= 0);
        });
    }
    Odata["ibox"] = Odata["a" + stab].length;

    statusbox["MailTotal"] = Odata["a" + stab].length;
    statusbox["PageTotal"] = Math.ceil(statusbox["MailTotal"] / 20);
    iCurPage = statusbox["CurPage"];
    if (statusbox["CurPage"] > statusbox["PageTotal"] && statusbox["PageTotal"] > 0) {
        statusbox["CurPage"] = statusbox["PageTotal"];
        statusbox["PageLast"] = 1;
    }
    if (statusbox["tmpPageTotal"] > statusbox["PageTotal"] && statusbox["CurPage"] == statusbox["PageTotal"]) {
        statusbox["PageLast"] = 1;
    }
    //	$("#InboxNum").text(statusInbox["MailTotal"].toString());//收件箱总邮件数量
    //if(Odata["iindexUnRead"] != "" && Odata["iindexUnRead"] > 0)
    //{
    //	statusbox["UnreadMailTotal"]=Odata["iindexUnRead"];
    //}
    //else
    //{
    //	statusbox["UnreadMailTotal"]=0;
    //}
    //$("#InboxNum").text(statusbox["UnreadMailTotal"].toString());//收件箱总邮件数量

}




function goPage(pageIndex, stab) {
    var sdetails = [];
    var iCurPage = pageIndex;
    if (pageIndex > statusbox["PageTotal"]) {
        iCurPage = statusbox["PageTotal"];
    }
    statusbox["CurPage"] = iCurPage;
    if (iCurPage < 1) {
        iCurPage = 1;
    }

    for (var i = (iCurPage - 1) * 20; Odata["a" + stab] && i < (Odata["a" + stab].length < iCurPage * 20 ? Odata["a" + stab].length : iCurPage * 20); i++) {
        ReadMailDetail(i,stab);//////////////////////////////////////////////////////////////////////////////////////////////////////如果不行，放开 
        var sfrom = Odata["a" + stab][i]["from"];
        var stimestamp = Odata["a" + stab][i]["timestamp"];
        var stitle = Odata["a" + stab][i]["title"];
        var scontent = Odata["a" + stab][i]["content"];
        var attachfiles = getattachfile(scontent);
        scontent = checkimgstrip(scontent);
        scontent = checkinputstrip(scontent, Odata["a" + stab][i]["seq"]);
        var sbox = "";
        var sname = "";
        if (Odata["a" + stab][i]["mailstate"] == "inbox") {
            sbox = "发件人";
            if (Odata["a" + stab][i]["fromName"] == "") {
                sname = Odata["a" + stab][i]["from"]
            }
            else {
                sname = Odata["a" + stab][i]["fromName"];
            }
           sdetails.push("	<div style=\" background:url(img/i1.gif) right top repeat-y; margin-right:16px;\">");
            sdetails.push("<div id=\"pop_mail_inner\" class=\"history_inner\" style=\"margin:8px 5px 0 60px;\">");
        }
        else {
            sbox = "收件人";
            if (Odata["a" + stab][i]["toName"] == "") {
                sname = Odata["a" + stab][i]["to"];
            }
            else {
                sname = Odata["a" + stab][i]["toName"];
            }
            sdetails.push("	<div style=\" background:url(img/i1.gif) right top repeat-y; margin-right:55px;\">");
            sdetails.push(" <div id=\"pop_mail_inner\" class=\"history_inner\" style=\"background:#d8e9fb; margin:6px 5px 0 20px;\">");
        }
        sdetails.push("                <div  class=\"pop_mail_title\">");
        sdetails.push("                    <em >" + sbox + "：</em><span style=\"width: 450px;\"> ");
        sdetails.push("                        " + sname + " ");
        sdetails.push("                    </span>");
        sdetails.push("                </div>");
        sdetails.push("                <div  class=\"pop_mail_title\" style=\"width: 150px;\">");
        sdetails.push("                    <em>时&nbsp;&nbsp;间：</em><span >" + stimestamp + "</span>");
        sdetails.push("                </div>");
        sdetails.push("                <div class=\"clear\">");
        sdetails.push("                </div>");
        sdetails.push("                <div  class=\"pop_mail_title\" style=\"height: auto; float: none;\">");
        sdetails.push("                    <em>标&nbsp;&nbsp;题：</em><div style=\"margin-left: 48px; color: #135daf;\" id=\"txtTitle\">");
        sdetails.push("                        " + stitle + "</div>");
        sdetails.push("                </div>");
        sdetails.push("                <div class=\"clear\">");
        sdetails.push("                </div>");
        sdetails.push("                <div class=\"attachment_look\" style=\"margin-left: -4px;\">");
        sdetails.push("                    <div class=\"attachment_look_name\">");
        sdetails.push("                        附&nbsp;&nbsp;件：</div>");
        sdetails.push("                    <ul class=\"fl\" >");

        if (attachfiles.length > 0) {
            var reverse_attachfiles = attachfiles.reverse();
            $.each(reverse_attachfiles, function (index, item) {
                //兼容老版本(有2种老版本)做特殊处理
                if (item["filename"].indexOf("/") >= 0) {
                    item["filename"] = G_DOWNLOADSERVICE() + item["filename"];
                }
                else {
                    if (item["path"].indexOf("http://") >= 0) {
                        item["path"] = item["fullpath"].substr(item["fullpath"].indexOf("/attachs/") + 10, item["fullpath"].length - 1) + "/";
                    }
                    item["filename"] = G_DOWNLOADSERVICE() + item["path"] + item["filename"];
                }
                sdetails.push("                        <li><span>" + item["localfilename"] + "</span>");
                sdetails.push("                           <a href=\"" + item["filename"] + "\" target=\"_blank\">下载</a></li>");


            });
            reverse_attachfiles = null;
        }
        sdetails.push("                    </ul>");
        sdetails.push("                </div>");
        sdetails.push("                <div class=\"hr_line clear\">");
        sdetails.push("                </div>");
        sdetails.push("                <div name=\"msgcontent\"  class=\"history_text\" style=\"word-wrap:break-word;\">");
        sdetails.push(scontent); //正文
        sdetails.push("                </div>");
        sdetails.push("            </div>");
              sdetails.push("            </div>");
           sdetails.push(" 	<div class=\"clear\"></div>	");
        if (Odata["a" + stab][i]["mailstate"] == "inbox") {
           // sdetails.push(" <div style=\"text-align: right; margin: -1px 30px 0 0; height: 30px;\"><img src=\"img/right_icon.gif\" /></div> ");
             sdetails.push("	<div style=\" text-align:right; margin:-1px 16px 0 60px; height:30px; background:url(img/i2.gif) left top repeat-x;\"><img src=\"img/i3.gif\" /></div>");
  
                } else {

          //    sdetails.push(" <div style=\"margin: -1px 0 0 30px; height: 30px;\"><img src=\"img/left_icon.gif\" /></div>");
                 sdetails.push(" 				<div style=\" margin:-1px 57px 0 20px; height:30px; background:url(img/i2.gif) left top repeat-x;\"><img src=\"img/h3.gif\" /></div>");
   
        }





    }
    if (sdetails.length == 0) {
        sdetails.push("	<div id=\"pop_mail_inner\" class=\"history_inner\" style=\"border: 1px solid #64a8e7;background: #e7f3fe; margin: 8px 30px 0 30px;\"><span style=\" font-size: 15px; algin:center;\"><font color=\"#808080\">当前列表无查询结果</font></span></div>");
    }

    $("#history_list").html(sdetails.join(""));
}

//获取附件文件信息;
function getattachfile(sbody) {

    var strpoint = sbody.indexOf("<div id=\"start_content\" attach='");
    if (strpoint != 0) {
        return [];
    }
    var shead = sbody.substring(32);
    if (shead.length <= 0) {
        return [];
    }
    strpoint = shead.indexOf("'");
    if (strpoint <= 0) {
        return [];
    }
    shead = shead.substring(0, strpoint);
    if (shead.length <= 0) {
        return [];
    }
    var data = decodeURIComponent(shead);
    return eval("(" + data + ")");
}
//利用JavaScript来获取img标签字符串，并替换绝对路径。
function checkimgstrip(html) {
    var tmp = document.createElement("DIV");
    tmp.innerHTML = html;
    $(tmp).find("img").each(function () {
        if (typeof ($(this).attr("filename")) != "undefined") {
            if ($(this).attr("filename").length > 0) {
                $(this).attr("src", G_DOWNLOADSERVICE() + $(this).attr("filename"));
            }
        }
        else {
            var OLDATTACHSERVICES = OLDATTACHSERVICE();
            for (var i = 0; i < OLDATTACHSERVICES.length; i++) {
                $(this).attr("src", $(this).attr("src").replace(OLDATTACHSERVICES[i], G_DOWNLOADSERVICE()));
            }
            OLDATTACHSERVICES = null;
        }
    });
    return tmp.innerHTML;
}

//利用JavaScript来获取input标签字符串，并设置GLOBAL_Seq值。
function checkinputstrip(html, sSeq) {
    var tmp = document.createElement("DIV");
    tmp.innerHTML = html;
    $(tmp).find("input").each(function () {
        if (typeof ($(this).attr("onclick")) != "undefined") {
            var tmpstring = $(this).attr("onclick")
            if (tmpstring.toLowerCase().indexOf("avascript:op(") >= 0) {
                tmpstring = tmpstring.replace("avascript:op(", "avascript:SetGLOBAL_Seq(" + sSeq + ");op(");
                $(this).attr("onclick", tmpstring);
            }
        }
    });
    return tmp.innerHTML;
}
function getHTMLText1(tmphtml) {
 	 var tmpsbody = document.createElement("DIV");
 // $("#tmpcontent").val("");
 //   $("#tmpcontent").innerHTML = tmphtml;
 //   var tmpcontent = $("#tmpcontent").val();
 	tmpsbody.innerHTML = tmphtml;   
    return tmpcontent;
}

function getHTMLText(str) {
            str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag
            str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白
            str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
            str=str.replace(/&nbsp;/ig,'');//去掉&nbsp;         
            return str;
    }

function ReadMailDetail(i, stab) {
    try {
        if (typeof (Odata["a" + stab][i]["mailsource"]) == "undefined" || Odata["a" + stab][i]["mailsource"] == "") {
            var text = GetMail(Odata["a" + stab][i]["seq"]);
            Odata["a" + stab][i]["mailsource"] = text;
            var iFirstContent = text.indexOf("<content><![CDATA[");
            var iLastContent = text.lastIndexOf("]]></content>");
            var sbody = text.substring(iFirstContent + 18, iLastContent);
            var tmpcontent = getHTMLText(sbody);

            var sRight = "";
            for (key in G_Rights) {
                Odata["a" + stab][i][key] = false;
            }
            if ((iFirstContent < 0) || (iLastContent < 0)) {
                Odata["a" + stab][i]["timestamp"] = "";
                Odata["a" + stab][i]["type"] = "";
                Odata["a" + stab][i]["title"] = "邮件接收错误";
                Odata["a" + stab][i]["to"] = "";
                Odata["a" + stab][i]["fromName"] = "";
                Odata["a" + stab][i]["toName"] = "";
                Odata["a" + stab][i]["TypeAndRight"] = "";
                Odata["a" + stab][i]["content"] = "";
                Odata["a" + stab][i]["uncontent"] = "";

            }
            else {
                //去除邮件正文
                text = text.substring(0, iFirstContent) + "<content></content>" + text.substring(iLastContent + 13, text.length);
                var xml = ql_xml_stringtoxml(text.replace(/\r/g, ""));
                Odata["a" + stab][i]["timestamp"] = $($(xml).find("mail")[0]).attr("timestamp");
                Odata["a" + stab][i]["type"] = $($(xml).find("type")[0]).attr("no");
                var stitle = decodeString($($(xml).find("title")[0]).text());
                Odata["a" + stab][i]["title"] = html_encode(stitle);

                if (Odata["a" + stab][i]["type"] == "4") {
                    Odata["a" + stab][i]["goldcode"] = $($(xml).find("goldcode")[0]).text();
                }
                Odata["a" + stab][i]["to"] = $($(xml).find("to")[0]).text();
                Odata["a" + stab][i]["from"] = $($(xml).find("from")[0]).text();
                var sfromname = Odata["a" + stab][i]["from"].toLowerCase();
                //获取附件及权限类型
                Odata["a" + stab][i]["TypeAndRight"] = "";
                var tmptypeandright = $($(xml).find("type")[0]).attr("subno");
                if (tmptypeandright != undefined && tmptypeandright != "") {
                    Odata["a" + stab][i]["TypeAndRight"] = tmptypeandright;
                }
                //获取发件人中文名称
                var tmpsfromname = $($(xml).find("from")[0]).attr("name");
                Odata["a" + stab][i]["fromName"] = "";

                if (tmpsfromname != undefined && tmpsfromname != "") {
                    Odata["a" + stab][i]["fromName"] = tmpsfromname;
                }
                //获取收件人中文名称	
                Odata["a" + stab][i]["toName"] = "";
                var Tos = Odata["a" + stab][i]["to"].split(";");
                var tmpstoName = $($(xml).find("to")[0]).attr("name");
                if (tmpstoName != undefined && tmpstoName != "") {
                    stoName = tmpstoName;
                    Odata["a" + stab][i]["toName"] = tmpstoName;
                }
                //邮件正文内容及过滤后内容
                Odata["a" + stab][i]["content"] = sbody;
                Odata["a" + stab][i]["uncontent"] = tmpcontent;
            }
        }
    }
    catch (e) {
    }
}






//计算日期为昨天函数
 function GetDateStr(AddDayCount) {  
     var dd = new Date();  
     dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期  
     var y = dd.getFullYear();  
     var m = dd.getMonth()+1;//获取当前月份的日期  
     var d = dd.getDate();  
     return y+"-"+m+"-"+d;
 }

 //时间比较函数
 function dateCompare(startdate, enddate) {


     var arr = startdate.split("-");
     var starttime = new Date(arr[0], arr[1], arr[2]);
     var starttimes = starttime.getTime();

     var arrs = enddate.split("-");
     var lktime = new Date(arrs[0], arrs[1], arrs[2]);
     var lktimes = lktime.getTime();

     if (starttimes >= lktimes) {
         return false;
     }
     else{
         return true;
     }

 }





 //控制页面显示
 function showpage() {
     var tmppage = 1;
     $("#CurPage").val(statusbox["PageTotal"]);
     if (statusbox["PageTotal"] > 1) {
         tmppage = statusbox["CurPage"];
         if (tmppage < 1) {
             tmppage = 1;
         }
         if (tmppage == 1) {


             $("#firstpage").attr("src", "img/end_previous.gif");
             $("#uppage").attr("src", "img/previous.gif");
             $("#downpage").attr("src", "img/next_online.gif");
             $("#lastpage").attr("src", "img/end_online.gif");

             $("#firstpage").unbind('mousedown');
             $("#uppage").unbind('mousedown');
             $("#downpage").unbind().bind('mousedown', function () { checkpage('1'); });
             $("#lastpage").unbind().bind('mousedown', function () { PageLast(); });

         }
         else if (tmppage == statusbox["PageTotal"]) {
             $("#firstpage").attr("src", "img/end_previous_online.gif");
             $("#uppage").attr("src", "img/previous_online.gif");
             $("#downpage").attr("src", "img/next.gif");
             $("#lastpage").attr("src", "img/end.gif");

             $("#firstpage").unbind().bind('mousedown', function () { PageFirst(); });
             $("#uppage").unbind().bind('mousedown', function () { checkpage('-1'); });
             $("#downpage").unbind('mousedown');
             $("#lastpage").unbind('mousedown');
         }
         else {
             $("#firstpage").attr("src", "img/end_previous_online.gif");
             $("#uppage").attr("src", "img/previous_online.gif");
             $("#downpage").attr("src", "img/next_online.gif");
             $("#lastpage").attr("src", "img/end_online.gif");

             $("#firstpage").unbind().bind('mousedown', function () { PageFirst(); });
             $("#uppage").unbind().bind('mousedown', function () { checkpage('-1'); });
             $("#downpage").unbind().bind('mousedown', function () { checkpage('1'); });
             $("#lastpage").unbind().bind('mousedown', function () { PageLast(); });
         }
     } else {

         $("#firstpage").attr("src", "img/end_previous.gif");
         $("#uppage").attr("src", "img/previous.gif");
         $("#downpage").attr("src", "img/next.gif");
         $("#lastpage").attr("src", "img/end.gif");

         $("#firstpage").unbind('mousedown');
         $("#uppage").unbind('mousedown');
         $("#downpage").unbind('mousedown');
         $("#lastpage").unbind('mousedown');

     }
     $("#CurPage").val(statusbox["CurPage"]);
     $("#PageTotal").text(statusbox["PageTotal"]);

 }

 //首页
 function PageFirst() {
     goPage(1, 'box');
     showpage();
     imgonload("history_list"); //初始化图片放大
     	    $("#history_list").scrollTop($("#history_list")[0].scrollHeight);

 }

 //尾页
 function PageLast() {
     goPage(statusbox["PageTotal"], 'box');
     showpage();
     imgonload("history_list"); //初始化图片放大
     	    $("#history_list").scrollTop($("#history_list")[0].scrollHeight);
 }

 //更改页
 function checkpage(num) {
     var tmpCurPage = Number(statusbox["CurPage"]) + Number(num);
     goPage(tmpCurPage, 'box');
     showpage();
     imgonload("history_list"); //初始化图片放大
     	    $("#history_list").scrollTop($("#history_list")[0].scrollHeight);
 }
 
 //跳转到指定页
 function trunpage() {
     var tmptrunpage = $("#CurPage").val();
     if (TestRgexp(tmptrunpage)) {
         if (tmptrunpage > 0 && tmptrunpage <= statusbox["PageTotal"]) {
             goPage(tmptrunpage, 'box');
             showpage();
         }
         else {
             alert("请输入正确页码！");
             $("#CurPage").select();
         }
     } else {
         alert("请输入正确页码！");
     }
 }

 //验证是否为正整数 返回true或false
 function TestRgexp(checkstr) { // 参数说明 re 为正则表达式 s 为要判断的字符 
     var re = /^[0-9]*[1-9][0-9]*$/;
     return re.test(checkstr);
 }

 function showloading() {
     $("#searchok").hide();
     $("#showloading").show();
 }
 function hideloading() {
     $("#showloading").hide();
     $("#searchok").show();
 }
 function showresult()
 {
 	 showresultstates ="true";
   //  $("#history_list").attr("class","history_wrapper_h");  
   //	$("#history_list").height(575);
    $("#btnback").show();
    ResizeWin();
 }
 function hideresult()
 {     showresultstates ="false";
    // $("#history_list").attr("class","history_wrapper");
     $("#btnback").hide();
     ResizeWin();
 }
 /*
 *查询邮件内容
 */
 function searchClick() {
 	 showresult();
     showloading();
     searchTXT();
     hideloading();
     
 }
/*
*搜索事件内容
*/
 function searchTXT() {
     var searchdate = $('#selectdate').find('option:selected').val();
     statusbox["searchdate"] = searchdate;
     statusbox["filter"] = $("#searchfilter").val().replace(/(^\s*)|(\s*$)/g, ""); //查询内容
     reflashmaillist();
   //   PageFirst();
    PageLast();

     imgonload("history_list"); //初始化图片放大
      $("#history_list").scrollTop($("#history_list")[0].scrollHeight);
      $("#resultnum").text(statusbox["MailTotal"]);
 }
/*
*首次加载搜索事件内容
*/
 function firstsearchTXT() {
 	  showloading();
     statusbox["searchdate"] = "全部";
     $("#searchfilter").val("");
     statusbox["filter"] = $("#searchfilter").val().replace(/(^\s*)|(\s*$)/g, ""); //查询内容
     reflashmaillist();
 //    PageFirst();
PageLast();
     imgonload("history_list"); //初始化图片放大
      $("#history_list").scrollTop($("#history_list")[0].scrollHeight);
        hideloading();
        hideresult();

 }
 
 function myload() {
 	 ResizeWin();
     var p = new Poly9.URLParser((window.location.href).replace(/%26/g, "&"));
     var suid = p.getParameter("suid");
     selectusers = suid; //查询帐号
	 var userinfo = getSysUser();
	 currusers = userinfo[0].toLowerCase();
     $("#showloading").hide();
     $("#searchfilter").val("");
     $("#CurPage").val("1");
     $("#selectdate  option[value='最近一周'] ").attr("selected", true);

     firstsearchTXT();

     //imgonload("history_list"); //初始化图片放大
     //$("#history_list").scrollTop($("#history_list")[0].scrollHeight);
      	 
 }

 //日志记录用
 function oop(value) {
   
 }
 //回执记录用
 function ooop(value) {

 }
 //重新登录
function loginagain()
{
	LoginAgain();
	closeWindow();
}
 function SetGLOBAL_Seq(value) {
 	 GetMail(value);
     GLOBAL_Seq = value;
 }