
var WMail={DataList:{},TagId:0,MaxId:0,TagId:0,PageIndex:1,PageSize:25,AllCount:0,unf:null,xzi:null,jet:null,zre:null,$divWMailRcvList:null,iiu:null,akl:null};$(window).load(function(){WMail.mta=$("#calContainer");WMail.mta.css({"border-width":"0px"});WMail.UserId=Dcx.lux();$("div.avatar").find("img").attr("src",Dcx.jbc(WMail.UserId,3));WMail.xzi=$("#myCalender");DcxCld.Init("myCalender",WMail.xzi);DcxCld.eui=function(a){var d=a;var b=new Date(d.getFullYear(),d.getMonth(),d.getDate());var c=new Date(d.getFullYear(),d.getMonth(),d.getDate(),23,59,59);WMail.ucl(b,c)};WMail.unf=$("#ulTab");WMail.unf.children("[ismsgtab=1]").unbind("click").click(function(){var a=$(this);WMail.TagId=parseInt(a.attr("val"),10);if(isNaN(WMail.TagId))WMail.TagId=0;if(WMail.TagId==0)WMail.MaxId=-1;WMail.unf.children().removeClass("active");a.addClass("active");WMail.PageIndex=1;WMail.$divWMailRcvList.children("div[ismsglist=1]").html("");WMail.$divWMailRcvList.children("div[istopmsg=1]").html("");if(WMail.akl==null)WMail.akl=WMail.$divWMailRcvList.children("div[ispage=1]").find("#divMsgPage");WMail.akl.html("");WMail.$divWMailRcvList.children("div[isloading=1]").show();WMail.suk()});WMail.jet=$("#a_curPage");WMail.zre=WMail.jet.prev();var e=$.browser.msie?"mouseenter":"mouseover";var f=$.browser.msie?"mouseleave":"mouseout";WMail.jet.unbind(e).bind(e,function(){WMail.jet.prev().show()});$(document).mouseup(function(a){WMail.jet.prev().hide()});WMail.vkf=$("#writeBox");DcxEditor.Init(WMail.vkf,"txtMsgContent","inputCharCount","/Ajax/UploadFile/Upload.ashx",true);DcxEditor.wbt=5;DcxEditor.kwi="/Ajax/UploadFile/Upload.ashx";WMail.$divWMailRcvList=$("#divWMailRcvList");WMail.suk();WMail.hpq=WMail.vkf.find("#SendBtnPanel");WMail.hpq.children("a:first").unbind("click").bind("click",function(a){WMail.cow(this)});WMail.ada=$("#ulConvert");var g=WMail.ada.children();g.unbind("click").bind("click",function(){var a=parseInt($(this).attr("mode"),10);g.removeClass("currpage");$(this).addClass("currpage");if(a==1){WMail.ada.parent().next().show()}else if(a==2){WMail.ada.parent().next().hide()}});var h=tzm("userId");if(!ymr(h)&&!isNaN(h))h=parseInt(h,10);else h=-1;var i=unescape(tzm("userName"));if(!ymr(i)&&h>0){fvv.eni(h,i,"dcx_SendMsgBtn");WMail.ada.children("[mode=1]").click()}});WMail.sly=function(a){if(ymr(a))a=new Array();if(ymr(a)||a.length<1){return null}
var b=new nzy();for(var i=0;i<a.length;i++){var c=a[i];var d=jbc(c.SenderId,2);b.append("<div class=\"WB_feed_type SW_fun  S_line2\" MId=\""+c.MId+"\" RcvId=\""+c.RcvId+"\" isMsg=1>\n");b.append("    <div class=\"WB_screen\">\n");b.append("        <a href=\"javascript:void(0);\" class=\"W_ico12 icon_choose\"></a>\n");b.append("    </div>\n");b.append("    <div class=\"WB_feed_datail S_line2 clearfix\">\n");b.append("        <div class=\"WB_face\">\n");b.append("            <a class=\"W_face_radius\" href=\"/fwsc\">\n");b.append("                <img src=\""+d+"\" width=\"50\" height=\"50\" namecard=\""+c.SenderName+"\" />\n");b.append("            </a>\n");b.append("        </div>\n");b.append("        <div class=\"WB_detail\" >\n");b.append("            <div class=\"WB_info\" >\n");b.append("                <span  namecard=\""+c.SenderName+"\" >"+c.SenderName+"</span>"+"<div isStar=\"1\" title=\"星标微邮\" style=\""+(c.TagId==1?"":"display:none;")+"float:right;width: 20px;height: 20px;background: url(/images/common/ico_attachment104470.png) no-repeat -94px -65px;_background: url(/images/common/ico_attachment104470.gif) no-repeat -94px -65px;\"></div>\n");b.append("            </div>\n");b.append("            <div class=\"WB_text\" node-type=\"feed_list_content\" isMsgText=1  style=\"");if(!isNaN(c.ColorId)&&c.ColorId>0)b.append("color:"+WMail.smo(c.ColorId)+";");b.append("\">\n");b.append("                <span style=\"line-height:23px;margin:0;padding:0;\"><img src=\"/images/common/unread.png\" style=\""+(c.IsRead?"display:none;":"")+"vertical-align:inherit;width:15px;height: 11px;background:url('/images/common/unread.png') no-repeat;\" title=\"未读\" sign=\"logo\" isUnread=\"1\" /></span>");b.append("<a isTopHtml=1 title=\"取消置顶\" href=\"javascript:void(0);\" onclick=\"javascript:WMail.rbd("+c.MId+",this);\"  style=\""+(!c.IsTop?"display:none;":"")+"\" ><span class=\"W_ico20 ico_feedpin\"></span></a>\n");b.append("<span istitle=1 style=\"\">【"+c.Title+"】</span>"+c.MsgContent+"</div>\n");if(!ymr(c.FileJson)){var e=null;try{e=eval("("+c.FileJson+")")}catch(err){}
if(!ymr(e)&&e.length>0){var f=new nzy();var g=new nzy();f.append("<ul class=\"WB_media_list clearfix\" style=\"\">\n");f.append("<li>\n");f.append("<div class=\"list_pic_list out_width\" style=\"height: 115px;\">\n");f.append("<ul class=\"pic_list clearfix inner_width\">\n");g.append("<ul class=\"WB_media_list clearfix\" style=\"padding: 0px 0 5px;\">\n");g.append("<li>\n");g.append("<div class=\"list_pic_list2 \">\n");g.append("<ul class=\"filecell unselect pic_list clearfix inner_width\">\n");var h=false;var j=false;for(var k=0;k<e.length;k++){var l=e[k];if(l.FileTypeId!=2){g.append("<li class=\"filecolumn\" "+($.browser.msie?"onmouseleave='javascript:pcq(this,false);'  onmouseenter='javascript:pcq(this,true);'":"")+" fileId=\""+l.FileId+"\" MId=\""+c.MId+"\" >\n");g.append("<a class=\"f_type f_type_single\"><span class=\""+fdo(l.FileTypeId)+"\" unselectable=\"on\"></span></a>\n");g.append("<div class=\"filedetail\" data-columnselect=\"1\">\n");g.append("<div onclick=\"Attach.rename(this);getTop().stopPropagation(event);\" class=\"filename\" >"+l.FileName+"</div>\n");g.append("<p class=\"graytext datasize\" data-columnselect=\"1\">"+Dcx.Utility.ucr(l.FileSize)+"</p>\n");g.append("</div>\n");g.append("<div class=\"operation\" onclick=\"\">\n");g.append("<ul class=\"btn_operation\">\n");g.append("<li><a class=\"ico_attach ico_odown\" title=\"下载\" onclick=\"Dcx.ped('"+escape(l.FilePath)+"',"+l.FileId+")\"></a></li>\n");g.append("<li><a class=\"ico_attach ico_ostar\" title=\"删除\" onclick=\"Dcx.DeleteFile('"+escape(l.FilePath)+"',"+l.FileId+")\"></a></li>\n");g.append("</ul>\n");g.append("</div>\n");g.append("</li>\n");j=true}else{f.append("<li fileId=\""+l.FileId+"\" MId=\""+c.MId+"\" onclick=\"javascript:WMail.ggn(this);\">\n");f.append(" <img title=\""+l.FileName+"\" class=\"bigcursor\" src=\""+Dcx.File.trv(l.FilePath)+"\">");f.append("</li>\n");h=true}}
f.append("</ul>\n");f.append("</div>\n");f.append("</li>\n");f.append("</ul>\n");g.append("</ul>\n");g.append("</div>\n");g.append("</li>\n");g.append("</ul>\n");if(h)b.append(f.toString());if(j)b.append(g.toString())}}
b.append("<div class=\"WB_func clearfix\">\n");b.append("<div class=\"WB_handle\">\n");b.append("<a href=\"javascript:void(0);\" onclick=\"javascript:WMail.fvs("+c.MId+",this);\" class=\"hide\">删除</a><i class=\"S_txt3 hide\">|</i>\n");b.append("<a href=\"javascript:void(0);\" onclick=\"javascript:WMail.dgo("+c.MId+",this);\" val=\""+(c.IsRead?"1":"0")+"\" title=\"请点击\" isReadBtn=1 class=\"\">标记为<b style=\"position:relative;top:1px;\" class=\"dcx-ico menu-ico-dArr\">d</b></a>\n");b.append("</div>\n");b.append("<div class=\"WB_from\" style=\"padding-top: 0px;\">\n");b.append("<a  href=\"javascript:void(0);\" class=\"S_link2 WB_time\">"+Dcx.Date.mnf(c.SentDate)+"</a>\n");b.append("</div>\n");b.append("</div>\n");b.append("<div class=\"WB_media_expand repeat S_line1 S_bg4\" style=\"display: none;\">\n");b.append("</div>\n");b.append("</div>\n");b.append("</div>\n");b.append("</div>\n")}
return b.toString()}
WMail.hhr=function(a){var b=WMail.unf.children("li[val="+a+"]");if(b.length>0)return b.text();else return"未分类"};WMail.uac=function(a){var b=$(a).parent();while(b.length>0){if(b.hasClass("WB_media_expand"))break;b=b.parent()}
b.prev().show();b.remove()};WMail.ggn=function(c,d){var e=$(c).parent().parent().parent().parent();e.hide();var d=parseInt($(c).attr("fileId"),10);var f=parseInt($(c).attr("mId"),10);var c=WMail.ikr(f);var g=eval("("+c.FileJson+")");var h=null;var i=new nzy();i.append("<div class=\"WB_media_expand SW_fun2 S_line1 S_bg1\" style=\"\">\n");i.append("<div class=\"\">\n");i.append("<p class=\"medis_func S_txt3\"><a href=\"javascript:void(0);\" onclick=\"javascript:WMail.uac(this);\" class=\"retract\"><em class=\"W_ico12 ico_retract\"></em>收起</a><i class=\"W_vline\">|</i><a href=\"javascript:void(0);\" class=\"show_big\" target=\"_blank\"><em class=\"W_ico12 ico_showbig\"></em>查看大图</a><i class=\"W_vline\">|</i><a href=\"javascript:void(0);\" onclick=\"javascript:rotate(this,'left');\" class=\"turn_left\"><em class=\"W_ico12 ico_turnleft\"></em>向左转</a><i class=\"W_vline\">|</i><a href=\"javascript:void(0);\"  onclick=\"javascript:rotate(this,'right');\" class=\"turnRight\"><em class=\"W_ico12 ico_turnright\"></em>向右转</a></p>\n");i.append("<div class=\"pic_list_view\">\n");i.append("<div class=\"pic_show_box\" style=\"position: relative;\">\n");i.append("<ul class=\"clearfix smallcursor\"><img class=\"picloading\" style=\"display: none;\" src=\"/images/common/loading.gif\">");if(!ymr(g)&&g.length>0){for(var k=0;k<g.length;k++){var j=g[k];if(j.FileId==d){i.append("<li fileId=\""+j.FileId+"\" MId=\""+c.MId+"\" onclick=\"javascript:WMail.uac(this);\">\n");i.append(" <img isbigImg=1 title=\""+j.FileName+"\" src=\""+j.FilePath+"\" />");i.append("</li>\n");h=j.FilePath;break}}}
i.append("</ul>\n");i.append("<div style=\"top: 0px; left: 0px; display: none;\" class=\"W_layer\">\n");i.append("<div class=\"bg\"><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody><tr><td><div class=\"content\">\n");i.append("<a href=\"javascript:void(0);\" action-type=\"closeRecLayer\" class=\"W_close\"></a>\n");i.append("<div class=\"layer_view_morepic\">\n");i.append("<div class=\"W_tips clearfix\">\n");i.append("<p class=\"txt\"> 翻完啦！<a href=\"\" target=\"_blank\" node-type=\"toprofile\">看他的更多图片</a></p>\n");i.append("</div>\n");i.append("<div class=\"view_pic\" node-type=\"recBox\">\n");i.append("<ul class=\"pic_list clearfix\"><li><a href=\"javascript:void(0);\" class=\" current\"><img class=\"S_line2\" src=\"\" alt=\"\"></a></li></ul>");i.append("</div>\n");i.append("</div></div></td></tr></tbody></table>\n");i.append("</div>\n");i.append("</div>\n");i.append("</div>\n");i.append("<div class=\"pic_choose_box clearfix\">\n");i.append("<a href=\"javascript:void(0);\" class=\"arrow_left_small btn_pic_prevdis S_bg2\" title=\"上一页\"><em class=\"ico_pic_prev S_txt3\">&lt;</em></a>\n");i.append("<div class=\"stage_box\"><ul class=\"choose_box clearfix\" style=\"margin-left: 1px;\">");if(!ymr(g)&&g.length>0){for(var k=0;k<g.length;k++){var j=g[k];if(j.FileTypeId==2){i.append("<li fileId=\""+j.FileId+"\" MId=\""+c.MId+"\" >\n");i.append("<a href=\"javascript:void(0);\" style=\"display:inherit;\" class=\" "+(j.FileId==d?"current":"")+"\"><img title=\""+j.FileName+"\" class=\"S_line2\" src=\""+Dcx.File.trv(j.FilePath)+"\" /></a>");i.append("</li>\n");t1=true}}}
i.append("</ul></div>\n");i.append("<a href=\"javascript:void(0);\"class=\"arrow_right_small btn_pic_prevdis S_bg2\"  title=\"下一页\"><em class=\"ico_pic_next S_txt3\">&gt;</em></a></div>\n");i.append("</div>\n");i.append("</div>\n");i.append("</div>\n");e.after(i.toString());var l=e.next();l.find("ul.choose_box").children().bind("click",function(){var a=$(this).find("img");var b=Dcx.File.fxg(a.attr("src"));l.find("ul.choose_box").find("a").removeClass("current");$(this).find("a").addClass("current");l.find("div.pic_show_box").find("ul").find("li:first").find("img").attr("src",b);l.find("p.medis_func").find("a.show_big").attr("href",b)});l.find("p.medis_func").find("a.show_big").attr("href",h)}
function rotate(a,p){var b=$(a).parent();while(b.length>0){if(b.hasClass("WB_media_expand"))break;b=b.parent()}
var c=b.find("img[isbigImg=1]").get(0);Dcx.Rotate(c,p)}
WMail.tmc=function(a){if(WMail.$divWMailRcvList==null)WMail.$divWMailRcvList=$("#divWMailRcvList");var b=WMail.$divWMailRcvList.children("div[ispage=1]");if(WMail.akl==null)WMail.akl=b.find("#divMsgPage");if(isNaN(a)||a<1){a=0}
var c=parseInt(WMail.AllCount/WMail.PageSize,10);if(WMail.AllCount%WMail.PageSize!=0)c=c+1;if(WMail.AllCount<1||c==1)b.hide();else b.show();var d=50;var e=a-d;var f=a+d;if(e<1)e=1;if(f>c)f=c;var g=new nzy();for(var i=e;i<=f;i++){g.append("<a pageId=\""+i+"\"    style=\"width:50px;\"  href =\"javascript:void(0);\" onclick=\"javascript:WMail.uio("+i+",this);\" "+(i==a?" class=\"current\" ":"")+">第&nbsp;"+i+"&nbsp;页</a>\n")}
WMail.akl.html(g.toString());if(a<2)b.find("[isPrev=1]").hide();else b.find("[isPrev=1]").show();if(c<=a)b.find("[isNext=1]").hide();else b.find("[isNext=1]").show();WMail.akl.css("overflow-x","hidden");WMail.akl.css("overflow-y","auto")}
WMail.ikr=function(a){if(!ymr(WMail.DataList["P"+WMail.PageIndex])){for(var i=0;i<WMail.DataList["P"+WMail.PageIndex].length;i++){if(WMail.DataList["P"+WMail.PageIndex][i].MId==a)return WMail.DataList["P"+WMail.PageIndex][i]}}
if(!ymr(WMail.DataList["T"+WMail.TagId])){for(var i=0;i<WMail.DataList["T"+WMail.TagId].length;i++){if(WMail.DataList["T"+WMail.TagId][i].MId==a)return WMail.DataList["T"+WMail.TagId][i]}}
return null}
function fdo(a){if(a==1){return"pic_v2"}else if(a==3){return"pic_v2 v_pic_txt "}else if(a==4){return"pic_v2 v_pic_doc "}else if(a==5){return"ico_fppt"}else if(a==6){return"ico_fexl"}else if(a==7){return"pic_v2 v_pic_pdf"}else if(a==8){return"ico_frar"}else{return"ico_fother"}}
WMail.hrk=function(a,b){var c=WMail.ikr(a);if(c!=null)return c[b];return null}
WMail.twv=function(a,b,c){if(!ymr(WMail.DataList["P"+WMail.PageIndex])){for(var i=0;i<WMail.DataList["P"+WMail.PageIndex].length;i++){if(WMail.DataList["P"+WMail.PageIndex][i].MId==a){WMail.DataList["P"+WMail.PageIndex][i][b]=c;return true}}}
if(!ymr(WMail.DataList["T"+WMail.TagId])){for(var i=0;i<WMail.DataList["T"+WMail.TagId].length;i++){if(WMail.DataList["T"+WMail.TagId][i].MId==a){WMail.DataList["T"+WMail.TagId][i][b]=c;return true}}}
false}
WMail.uio=function(a,b,p){var c=WMail.$divWMailRcvList.children("div[ispage=1]");if(a<1){if(p==1)WMail.PageIndex=WMail.PageIndex-1;else WMail.PageIndex=WMail.PageIndex+1;if(WMail.PageIndex<1){WMail.PageIndex=1;art.VLdialog.tips("已是第一页",1.8);return}
var d=c.find("[isPageList=1]");d.children().removeClass("current");var e=d.children("[pageId="+WMail.PageIndex+"]");if(e!=null&&e.length>0)e.addClass("current");c.find("[isCurPage=1]").html("第&nbsp;"+WMail.PageIndex+"&nbsp;页")}else{WMail.PageIndex=a;var d=$(b).parent();d.children().removeClass("current");$(b).addClass("current");d.next().find("span").html("第&nbsp;"+a+"&nbsp;页");d.hide()}
WMail.$divWMailRcvList.children("div[ismsglist=1]").html("");WMail.$divWMailRcvList.children("div[istopmsg=1]").html("");WMail.$divWMailRcvList.children("div[isloading=1]").show();$('body,html').scrollTop(0);var f=parseInt(WMail.AllCount/WMail.PageSize,10);if(WMail.AllCount%WMail.PageSize!=0)f=f+1;if(WMail.PageIndex<2)c.find("[isPrev=1]").hide();else c.find("[isPrev=1]").show();if(f<=WMail.PageIndex)c.find("[isNext=1]").hide();else c.find("[isNext=1]").show();$('body,html',window.top.document).scrollTop(0);WMail.iwl()}
WMail.goz=function(a,b){if(WMail.$divWMailRcvList==null)WMail.$divWMailRcvList=$("#divWMailRcvList");WMail.$divWMailRcvList.children("div[isloading=1]").hide();if(b!=2){WMail.DataList["P"+WMail.PageIndex]=a}else{WMail.DataList["T"+WMail.TagId]=a}
if((ymr(a)||a.length<1)&&WMail.PageIndex==1){if(b!=2)WMail.$divWMailRcvList.children("div[ismsglist=1]").html("");else WMail.$divWMailRcvList.children("div[istopMsg=1]").html("");if(b!=2){WMail.$divWMailRcvList.children("[iswarn=1]").show().html("<span style=\"font-size:17px;\">亲，没有找到微邮哦...</span>")}
return false}else if(b!=2)WMail.$divWMailRcvList.children("[iswarn=1]").hide();if(!ymr(a)){if(a.length>0)WMail.$divWMailRcvList.children("[iswarn=1]").hide();var c=WMail.sly(a);if(!ymr(c)){if(b!=2)WMail.$divWMailRcvList.children("div[ismsglist=1]").html(c);else WMail.$divWMailRcvList.children("div[istopMsg=1]").html(c)}}}
WMail.suk=function(){if(WMail.$divWMailRcvList==null)WMail.$divWMailRcvList=$("#divWMailRcvList");var c="/WebServices/MyApp/WMail.asmx/suk";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:c,data:"{tagId:"+WMail.TagId+", pageSize:"+WMail.PageSize+"}",dataType:'json',beforeSend:function(a){},complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>600)b=b.substr(0,600);alert("读取我的消息失败。详情："+b);return false},success:function(a){a=hmy(a);if(!ymr(a)){if(a.UserId>0)WMail.UserId=a.UserId;if(!ymr(a.UserName))WMail.UserName=a.UserName;WMail.goz(a.List,1);WMail.AllCount=a.MsgCount;WMail.tmc(1)}else{}}})}
WMail.iwl=function(){var c={tagId:WMail.TagId,pageIndex:WMail.PageIndex,pageSize:WMail.PageSize};var d="P"+WMail.PageIndex+"";if(WMail.TagId>0)d="T"+WMail.TagId+"";if(!ymr(WMail.DataList[d])){WMail.goz(WMail.DataList[d],1);return true}
var e="/WebServices/MyApp/WMail.asmx/iwlList";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:e,data:JSON2.stringify(c),dataType:'json',beforeSend:function(a){},complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>6000)b=b.substr(0,6000);alert("读取我的微邮失败。详情："+b);return false},success:function(a){a=hmy(a);if(ymr(a))a=new Array();WMail.DataList[d]=a;WMail.goz(a,1)}})}
WMail.ucl=function(c,d){var e={tagId:WMail.TagId,"fromDate":c,"toDate":d};var f="D"+c.getFullYear()+"_"+c.getMonth()+"_"+c.getDate()+"_"+d.getFullYear()+"_"+d.getMonth()+"_"+d.getDate();WMail.unf.children().removeClass("active");WMail.unf.children(":first").addClass("active");WMail.TagId=0;WMail.$divWMailRcvList.children("div[istopMsg=1]").html("");var g="/WebServices/MyApp/WMail.asmx/iwlList2";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:g,data:JSON2.stringify(e),dataType:'json',beforeSend:function(a){},complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>600)b=b.substr(0,600);alert("读取我的微邮失败。详情："+b);return false},success:function(a){a=hmy(a);if(ymr(a))a=new Array();WMail.DataList[f]=a;WMail.goz(a,1)}})}
WMail.fvs=function(d,e){art.VLdialog.confirm('确定要删除吗？',function(){if(isNaN(d)||d<1)d=parseInt(fokMsg.attr("curValue"),10);if(isNaN(d)||d<1)return null;var c="/WebServices/MyApp/WMail.asmx/DeleteWMailRcv";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:c,data:"{\"mId\":"+d+",tagId:"+WMail.TagId+"}",dataType:'json',beforeSend:function(a){},complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>600)b=b.substr(0,600);alert("读取我的微邮失败。详情："+b);return false},success:function(r){r=hmy(r);if(r){art.VLdialog.tips("删除成功！",0.8);WMail.$divWMailRcvList.find("[MId="+d+"][isMsg=1]").remove();WMail.twv(d,"IsDeleted",true);return false}else{art.VLdialog.alert("删除失败。",function(){},12,"提示")}}})},function(){art.VLdialog.tips('你取消了删除',0.8)})}
WMail.rbd=function(c){if(isNaN(c)||c<1)c=parseInt(fokMsg.attr("curValue"),10);var d=WMail.hrk(c,"IsTop");if(d==undefined||d==null)d=true;if(d=="1")d=false;else d=true;if(isNaN(c)||c<1)return null;var e="/WebServices/MyApp/WMail.asmx/SetTop";var f=0;$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:e,data:"{mId:"+c+",IsTop:"+d+",tagId:"+WMail.TagId+"}",dataType:'json',complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>600)b=b.substr(0,600);alert("读取我的微邮失败。详情："+b);return false},success:function(r){r=hmy(r);if(r){art.VLdialog.tips("设置成功！",0.8);var a=WMail.$divWMailRcvList.find("[MId="+c+"][isMsg=1]");var b=a;if(d){b.find("[isTopHtml=1]").show()}else{b.find("[isTopHtml=1]").hide()}
WMail.twv(c,"IsTop",d);return false}else{art.VLdialog.alert("设置失败。",function(){},12,"提示")}}})}
WMail.wra=function(c){if(WMail.TagId==3){art.VLdialog.alert("已发送不需要设置已读。",function(){},12,"提示");return false}
if(isNaN(c)||c<1)c=parseInt(fokMsg.attr("curValue"),10);var d=WMail.hrk(c,"IsRead");if(d==undefined||d==null)d=true;if(d=="1")d=false;else d=true;if(isNaN(c)||c<1)return null;var e="/WebServices/MyApp/WMail.asmx/SetRead";var f=0;$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:e,data:"{mId:"+c+",isRead:"+d+"}",dataType:'json',complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>600)b=b.substr(0,600);alert("读取我的微邮失败。详情："+b);return false},success:function(r){r=hmy(r);if(r){art.VLdialog.tips("设置成功！",0.8);var a=WMail.$divWMailRcvList.find("[MId="+c+"][isMsg=1]");var b=a;if(d){b.find("[isUnread=1]").hide()}else{b.find("[isUnread=1]").show()}
WMail.twv(c,"IsRead",d);return false}else{art.VLdialog.alert("设置失败。",function(){},12,"提示")}}})}
var fokMsg=null;WMail.dgo=function(m,n){if(fokMsg==null){fokMsg=$("#divSetMsgNavMore");var o=$.browser.msie?"mouseenter":"mouseover";var p=$.browser.msie?"mouseleave":"mouseout";var q=fokMsg.children();q.unbind(o).bind(o,function(){q.children("div[isNext=1]").hide();var a=$(this);var b=a.children("div[isNext=1]");if(b.length>0){var c=fokMsg.offset().left;var d=fokMsg.offset().top;var e=a.width();var f=a.height();var g=a.offset().left+e-c;var h=0;var i=$(window).height();var j=b.height();var k=a.offset().top;var l=$(window).scrollTop();if(k+j>i+l)h=l+i-k-j-20;b.css("position","relative").css("top",h+"px").css("left",g+"px").show()}}).unbind(p).bind(p,function(){});var r=false;fokMsg.unbind("click").bind("click",function(){r=true});$(document).mouseup(function(a){if(!r)fokMsg.hide();r=false})}
var s=WMail.ikr(m);if(!ymr(s)){if(s.IsTop){fokMsg.children("[indexId=1]").hide();fokMsg.children("[indexId=2]").show()}else{fokMsg.children("[indexId=1]").show();fokMsg.children("[indexId=2]").hide()}
if(s.IsRead){fokMsg.children("[indexId=41]").show();fokMsg.children("[indexId=42]").hide()}else{fokMsg.children("[indexId=41]").hide();fokMsg.children("[indexId=42]").show()}
if(s.IsProcessed){fokMsg.children("[indexId=15]").show();fokMsg.children("[indexId=16]").hide()}else{fokMsg.children("[indexId=15]").hide();fokMsg.children("[indexId=16]").show()}
if(s.TagId==1){fokMsg.children("[indexId=24]").show();fokMsg.children("[indexId=23]").hide()}else{fokMsg.children("[indexId=24]").hide();fokMsg.children("[indexId=23]").show()}}
fokMsg.attr("curValue",m);var t=5;var u=16;var v=$(n).offset().left-t;var w=$(n).offset().top+u+10;fokMsg.css("top",w+"px").css("left",v+"px").show();w=$(n).offset().top+u;fokMsg.stop().animate({'top':w+"px"},350)}
WMail.smo=function(a){if(isNaN(a)||a<1)return"#333";var b=[{"Id":1,Color:"#c7284a",Name:"红色"},{"Id":2,Color:"#349b08",Name:"绿色"},{"Id":3,Color:"#ed501a",Name:"橙色"},{"Id":4,Color:"#1797dc",Name:"蓝色"},{"Id":5,Color:"#e33d97",Name:"粉色"},{"Id":6,Color:"#c79c17",Name:"黄色"},{"Id":7,Color:"#ad50d8",Name:"紫色"},{"Id":8,Color:"#818181",Name:"灰色"}];for(var i=0;i<b.length;i++){if(b[i].Id==a)return b[i].Color}
return"#333"}
WMail.esz=function(a,b){if(isNaN(a)||a<1)a=parseInt(fokMsg.attr("curValue"),10);if(isNaN(a)||a<1)return null;var c="/WebServices/MyApp/WMail.asmx/SetColor";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:c,data:"{mId:"+a+",colorId:"+b+",tagId:"+WMail.TagId+"}",dataType:'json',success:function(r){r=hmy(r);if(r){art.VLdialog.tips("设置成功！",0.8);WMail.$divWMailRcvList.find("[MId="+a+"][isMsg=1]").find("[isMsgText=1]").css("color",WMail.smo(b));WMail.twv(a,"ColorId",b);return false}else{art.VLdialog.alert("设置失败。",function(){},12,"提示")}}})}
WMail.qil=function(c,d){if(isNaN(c)||c<1)c=parseInt(fokMsg.attr("curValue"),10);if(isNaN(c)||c<1)return null;var e={"mId":c,"tagId":d};var f="/WebServices/MyApp/WMail.asmx/SetTagId";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:f,data:JSON2.stringify(e),dataType:'json',complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>600)b=b.substr(0,600);alert("设置微邮分类失败。详情："+b);return false},success:function(r){r=hmy(r);if(r){art.VLdialog.tips("设置成功！",0.8);var a=WMail.$divWMailRcvList.find("[MId="+c+"][isMsg=1]");var b=a;if(d==1){b.find("[isStar=1]").show()}else if(d==0){b.find("[isStar=1]").hide()}
WMail.twv(c,"TagId",d);return false}else{art.VLdialog.alert("设置失败。",function(){},12,"提示")}}})}
WMail.cow=function(d,e){if(ymr(fvv.rmk)||ymr(fvv.grv)||fvv.rmk.length<1||fvv.grv.length<1){art.VLdialog.tips("请选择可视范围！",1.8);return false}
if(ymr(DcxEditor.zcw)){art.VLdialog.alert("IM加载失败，请刷新页面重新发送。",function(){},12,"提示");return false}
var f=$("#txtTitle");var g=f.val();if(ymr(g)){art.VLdialog.tips("请输入主题！",1.8);return false}
var h={"msgContent":null,"title":g,"userList":fvv.rmk,"userNameList":fvv.grv,"fileList":null};h.msgContent=DcxEditor.rtg();h.fileList=DcxEditor.FileList;if(ymr(h.msgContent)){if(!ymr(DcxEditor.FileList)&&DcxEditor.FileList.length>0){h.msgContent="";var j=false;var k=false;for(var i=0;i<DcxEditor.FileList.length;i++){if(DcxEditor.FileList[i].IsImg==true)j=true;else k=true}
if(j)h.msgContent=h.msgContent+"上传图片";if(k){if(j)h.msgContent=h.msgContent+",";h.msgContent=h.msgContent+"上传附件"}}else{var l=xfx(d,"Left")-200;var m=xfx(d,"Top")-200;art.VLdialog.tips("请输入内容！",1.8);return false}}
var n="/WebServices/MyApp/WMail.asmx/SendMsg";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:n,data:JSON2.stringify(h),dataType:'json',beforeSend:function(a){},complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>600)b=b.substr(0,600);alert("保存微邮失败。详情："+b);return false},success:function(a){a=hmy(a);if(ymr(a)){art.VLdialog.tips("保存失败！",5);return}
if(!a.IsOK){art.VLdialog.tips(a.ErrorMsg,4);return}
var b=new Array();var c={};c.Title=h.title;c.MsgContent=h.msgContent;c.MId=a.NewId;c.SentDate=new Date();c.SenderId=WMail.UserId;c.SenderName=WMail.UserName;c.FileJson=a.ErrorMsg;b.push(c);WMail.$divWMailRcvList.children("div[ismsglist=1]").prepend(WMail.sly(b));DcxEditor.olh();fvv.oxt();f.val("");if(WMail.TagId>0){WMail.DataList["T"+WMail.TagId].splice(0,0,c)}else{WMail.DataList["P"+WMail.PageIndex].splice(0,0,c)}
art.VLdialog.tips("保存成功！",1)}})}