var gJsVer = "081203";


var gsAgent = navigator.userAgent.toLowerCase();
var gfAppVer = parseFloat(navigator.appVersion);
var gIsOpera = gsAgent.indexOf("opera") > -1;
var gIsKHTML = gsAgent.indexOf("khtml") > -1 || gsAgent.indexOf("konqueror") > -1 || gsAgent.indexOf("applewebkit") > -1;
var gIsSafari = gsAgent.indexOf("applewebkit") > -1;
var gIsIE = ( gsAgent.indexOf("compatible") > -1 && !gIsOpera ) || gsAgent.indexOf("msie") > -1;
var gIsTT = gIsIE ? (navigator.appVersion.indexOf("tencenttraveler") != -1 ? 1 : 0) : 0;
var gIsFF = gsAgent.indexOf("gecko") > -1 && !gIsKHTML;
var gIsNS = !gIsIE && !gIsOpera && !gIsKHTML && (gsAgent.indexOf("mozilla") == 0) && (navigator.appName.toLowerCase() == "netscape");
var gIsAgentErr = !( gIsOpera || gIsKHTML || gIsSafari || gIsIE || gIsTT || gIsFF || gIsNS );

if ( gIsIE ) {
var reIE = new RegExp( "MSIE (\\d+\\.\\d+);", "i" );
reIE.test( navigator.userAgent );
var gIEVer = parseFloat( RegExp[ "$1" ] );
}

function GetDomain() {
 return location.href.indexOf("foxmail.com") > -1 ? "foxmail.com" : "qq.com";
}

function RegFilter( str ) {
return str.replace( /([\^\.\[\$\(\)\|\*\+\?\{\\])/ig, "\\$1" ) ;
}
function Template( t, f ) {
var cf = typeof( t ) == "string" ? t : ( t.join ? t.join( "" ) : "" );
var gR, pF, ax = f ? f : "$", sC = RegFilter( ax );
var rP =  function(p) {
if ( !gR )
pF = ( gR = cf.split( ax ) ).concat();
for ( var i = 1, aw = gR.length; i < aw; i += 2 )
pF[ i ] = p[ gR[ i ] ];
return pF.join( "" );
};
var rRE = function( p ) {
return cf.replace( new RegExp( [ sC, "(.*?)", sC ].join( "" ), "ig" ), function( m, v ){return p[ v ];} );
};
this.toString = function() {
return cf;
};
this.replace = function( p, defaultFunc ) {
return ( defaultFunc == "parse" || !( document.all && !( /opera/i.test(navigator.userAgent ) ) ) ? rP : rRE )( p );
};
}
function T( t, f ) {
return new Template( t, f );
}

function fixNonBreakSpace( s ) {
return ( s || "" ).replace( /\xA0/ig, " " );
}


var gMailtype = (GetDomain()=="foxmail.com")?"Foxmail.com":"QQ";


var gActiveXCab = "TencentMailActiveX.cab";
var gActiveXExe = "TencentMailActiveXInstall.exe";
var gActiveXObj = [["TXGYMailActiveX.ScreenCapture", "TXGYMailActiveX.UploadFilePartition", "TXGYMailActiveX.Uploader", "TXFTNActiveX.FTNUpload"], ["FMO.ScreenCapture", "TXGYUploader.UploadFilePartition", "FMO.Uploader", "TXFTNActiveX.FTNUpload"]];
var gActivexLastVerNo = ["1.0.1.28", "1.0.1.29", "1.0.1.28", "1.0.0.8"];
var gEditorAxMinVer = [(GetDomain()=="foxmail.com")?"1.0.0.5":"1.0.0.28", "1.0.1.28", "1.0.1.28", "1.0.0.8"];
function CreateActiveX(activexId) {
if (activexId >= 0 && activexId <= 3) {
for (var i = 0, len = gActiveXObj.length; i < len; i++) {
try {
var o = new ActiveXObject(gActiveXObj[i][activexId]);
if (o)
return o;
}
catch (e) {
}
}
}
return null;
}

function DetectActiveX(activexId, detectType, yC) {
var activeXObj = typeof(yC)=="undefined" ? CreateActiveX(activexId):yC;
if (activeXObj == null)
return false;

if (detectType != 1 && detectType != 2)
return true;

if (parseInt(GetActiveXVer(activeXObj).split(".").join("")) >=
parseInt((detectType == 1 ? gEditorAxMinVer : gActivexLastVerNo)[activexId].split(".").join("")))
return true;

return false;
}

function GetActiveXVer(parm) {
try {
var activeXObj = typeof(parm) == "number" ? CreateActiveX(parm) : parm;
var version = activeXObj ? (activeXObj.version ? activeXObj.version : "1.0.0.8") : "";
}
catch (e) {
var version = "";
}
return version;
}


var msgNoSubject = "请填写邮件主题";
var msgNoMail = "未选中任何邮件";
var msgSend = "邮件正在发送中... ";
var msgSave = "&nbsp;&nbsp;&nbsp;邮件正在保存到草稿箱...";
var msgSaveOk = "邮件成功保存到草稿箱";
var msgAutoSave = "&nbsp;&nbsp;&nbsp;邮件正在保存到草稿箱...";
var msgAutoSaveOk = "邮件自动保存到草稿箱";
var msgSendErrorSaveOK = "信件已被保存到草稿箱";
var msgSaveErr = "邮件未能保存到草稿箱";
var msgNoSender = "请填写收件人后再发送";
var msgNoCardSender = "请填写收件人后再发送";
var msgNoCard = "请选中贺卡后再发送";
var msgAddrSearchErr = "请输入搜索内容";
var msgMailSearchErr = "请输入搜索内容";
var msgSettingOk = "设置更改保存成功";
var msgWarnningType = "您的附件中包含可执行文件，出于安全性考虑，不允许发送此类文件";
var msgLinkErr = "网络应答失败";
var msgRejectAlert = "系统会把此邮件地址放入“黑名单”中，您将不再收到来自此地址的邮件。\n\n确认要拒收此发件人的邮件吗？";
var msgCheatAlert = "系统会将此邮件移入到“垃圾邮件”中，并把邮件内容提交给邮箱管理员。\n\n您确定要举报此邮件吗？";
var msgSendTimeErr = "您设置的发送时间不存在";
var msgCreateTimeErr = "您设置的时间不存在";
var msgRemindTimeErr = "您设置的提醒时间不存在";
var msgModifySendTimeMsg = "修改定时邮件将会被暂停发送，您确定要修改定时邮件吗？";
var msgSendMailNoMove="请不要选择定时邮件，您不能移动定时邮件。";
var msgMoveMailSameFldErr="不能移动到相同的目录";


var gd = document;
function Gel(id, ob) {
return ( ob || gd ).getElementById(id);
}
function GelTags(tag, ob) {
return ( ob || gd ).getElementsByTagName(tag);
}
function S(i, win) {
try {
return ( win || window ).document.getElementById(i);
}
catch( e ) {
return null;
}
}
function SO(i, o) {
return Gel(i, o);
}
function SN(i, win) {
try {
return ( win || window ).document.getElementsByName(i);
}
catch( e ) {
return null;
}
}
function SNO(i, o) {
return (o ? o : gd).getElementsByName(i);
}
function SetClass( o, v ) {
if ( o && o.className != v )
o.className = v;
}
function F(sID, win) {
if ( !sID )
return null;
var frame = S( sID, win );
if ( !frame )
return null;
return frame.contentWindow || ( win || window ).frames[sID];
}
function E(list, Func, start, end) {
if (!list)
return;
if ( list.length != null ) {
var len = list.length;
for (var i = (start || 0), end = end < 0 ? (len + end) : (end < len ? end : len); i < end; i++)
try{Func(list[i], i, len);}catch(e){}
}
else {
for (var i in list)
try{Func(list[i], i);}catch(e){}
}
}
function DP(obj, property) {
try{delete obj[property];}catch(e){}
return obj;
}
function InsertHTML(el, where, html) {
if ( !el )
return false;
try {

if (el.insertAdjacentHTML) {
el.insertAdjacentHTML( where, html );
}
else {
var range = el.ownerDocument.createRange();
var isBefore = where.indexOf("before") == 0;
var isBegin = where.indexOf("Begin") != -1;
if (isBefore == isBegin) {
range[isBefore ? "setStartBefore" : "setStartAfter"](el);
el.parentNode.insertBefore(range.createContextualFragment(html), isBegin ? el : el.nextSibling);
}
else {
var obj = el[isBefore ? "lastChild" : "firstChild"];
if (obj) {
range[isBefore ? "setStartAfter" : "setStartBefore"](obj);
el[isBefore ? "appendChild" : "insertBefore"](range.createContextualFragment(html), obj);
}
else {
el.innerHTML = html;
}
}
}
return true;
}
catch( e ) {
return false;
}
}
function IsObjContainTarget( aO, qX ) {
if ( !aO || !qX )
return false;

else if ( aO.contains ) {
return aO.contains( qX );
}
else if ( aO.compareDocumentPosition ) {
var wY = aO.compareDocumentPosition( qX );
return ( wY == 20 || wY == 0 );
}

return false;
}
function RemoveSelf( aO ) {
if ( aO )
aO.parentNode.removeChild( aO );
}
function GetSid() {
try {var s = top.g_sid;}catch(e){}
s = s ? s : (S("sid") ? S("sid").value : "");
if (!s) {
s = (top.location.href.split("?")[1]).split("&");
s = s[0].split("=")[1];
}
return s;
}
function GetUin() {
return top.g_uin;
}
function IsShow(obj) {
obj = (typeof(obj) == "string" ? S(obj) : obj);
if (!obj) return false;
return obj.style.display != "none";
}
function Show(obj, bShow) {
obj = (typeof(obj) == "string" ? S(obj) : obj);
if (obj) obj.style.display= (bShow ? "" : "none");
}
function ShowN(name, bShow) {
var o = SN(name);
for (var i = o.length - 1; i >= 0; i--) {
Show(o[i], bShow);
}
}
function GetPath(type, bMustFull) {
var p = "";
switch ( type ) {
case "image":
try {p = top.images_path;}catch(e){}
if(!p) p = "/zh_CN/htmledition/images/";
break;
case "js":
try {p = top.js_path;}catch(e){}
if(!p) p = "/zh_CN/htmledition/js/";
break;
case "css":
try {p = top.css_path;}catch(e){}
if(!p) p = "/zh_CN/htmledition/style/";
break;
case "stationery":
try {p = top.stationery_path;}catch(e){}
if(!p) p = "http://m33.mail.qq.com/";
break;
case "card":
try {p = top.card_path;}catch(e){}
if(!p) p = "http://m33.mail.qq.com/";
break;
case "mo":
try {p = top.mo_path;}catch(e){}
if(!p) p = "http://m33.mail.qq.com/";
break;
case "editor":
try {p = top.editor_path;}catch(e){}
if(!p) p = "/zh_CN/htmledition/qqmaileditor/";
break;
case "skin":
try {p = top.skin_path;}catch(e){}
if(!p) p = "0";
break;
case "blank":
p = "/zh_CN/htmledition/blank.html";
break;
}

var mD = location.protocol;
if ( bMustFull && type != "skin" && type != "blank" && p.indexOf( mD ) == -1 )
p = [ mD, "//", location.host, p ].join( "" );
return p;
}
function GetEmptyCacheMethod() {
if (gIsIE)
return "Internet选项-->常规-->Internet临时文件-->删除文件-->确定";

if (gIsFF)
return "工具-->清除隐私数据-->立即清除隐私信息";

if (gIsOpera)
return "工具-->删除私人数据-->删除";

if (gIsSafari)
return "Edit-->Empty Cache-->Empty";

return "刷新页面";
}
function GetTopWin() {
return top;
}
function GetMainWin() {
return F( "mainFrame", top ) || top;
}
function GetActionWin() {
return F( "actionFrame", GetTopWin() );
}
function GetLeftWin() {
return top;
}
function GetLeftDateWin() {
return F( "leftFrame", top );
}
function GetSignatureWin() {
return F( "signatureFrame", top );
}


function FilteSignatureTag( dx, dW ) {
if ( dW == "2LOWCASE" ) {
return dx ? dx.replace(
/<sign(.*?)\/>/ig, "<sign$1>" ).replace(
/<qzone(.*?)\/>/ig, "<qzone$1>" ).replace(
/<taotao(.*?)\/>/ig, "<taotao$1>" ).replace(
/<\/sign>/ig, "</sign>" ).replace(
/<\/qzone>/ig, "</qzone>" ).replace(
/<\/taotao>/ig, "</taotao>" ).replace( /<(\/?)includetail>/ig, "<$1tincludetail>" ) : "";
}
if ( dW == "FILTE<:" ) {
return dx ? dx.replace( /<:sign.*?>/ig, "" ).replace(
/<:qzone.*?>/ig, "" ).replace( /<:taotao.*?>/ig, "" ).replace( /<:includetail.*?>/ig, "" ) : ""
}
else {
return dx ? dx.replace( /<\/?sign.*?>/ig, "" ).replace(
/<\/?qzone.*?>/ig, "" ).replace( /<\/?taotao.*?>/ig, "" ).replace( /<\/?includetail.*?>/ig, "" ) : "";
}
}
function GetSignatureHeader() {
return '<div style="color:#909090;font-family:Arial Narrow;font-size:12px">------------------</div>';
}
function CheckSignatureFrame() {
if ( top.loadSignTimeout ) {
top.clearTimeout(top.loadSignTimeout);
top.loadSignTimeout = null;
}

if ( GetSignatureWin() ) {
top.signStatus = "finish";
var isSuccess = true;
try {
if ( !GetSignatureWin().GetUserSignature )
isSuccess = false;
}
catch (e) {
isSuccess = false;
}


if ( !isSuccess && top.reloadSignTimeout == null ) {
top.reloadSignTimeout = top.setTimeout( "top.ReloadSignature( true );", 5000 );
}
}
}
function LoadSignature() {
try {
if ( !S( "signatureFrame", top ) || S( "signatureFrame", top ).src.indexOf( "getcomposedata" ) == -1 )
ReloadSignature();
}
catch(e) {
return ;
}
if ( top.signStatus != "finish" )
throw { message: "get sign error..." };
}
function ReloadSignature( isError, isDispQzone ) {
if ( window != top )
return top.ReloadSignature( isError, isDispQzone );

if ( isError ) {
if ( top.gReloadSignatureErrorTime == null )
top.gReloadSignatureErrorTime = 0;

if ( top.gReloadSignatureErrorTime > 4 )
return;

top.gReloadSignatureErrorTime++;
}

if ( top.reloadSignTimeout ) {
top.clearTimeout( top.reloadSignTimeout );
top.reloadSignTimeout = null;
}
top.signStatus = "load";

RemoveSelf( S( "signatureFrame", top ) );

CreatePanel( top, "signatureFrame", T( [
"/cgi-bin/getcomposedata?t=signature&fun=compose&sid=$sid$&qzonesign=$qzonesign$&r=$rand$" ] ).replace( {
sid       : GetSid(),
qzonesign : isDispQzone ? "disp" : "",
rand      : ( new Date() ).getTime()
} ), "top.CheckSignatureFrame();" );

if ( top.loadSignTimeout ) {
top.clearTimeout( top.loadSignTimeout );
top.loadSignTimeout = null;
}
top.loadSignTimeout = top.setTimeout( "top.CheckSignatureFrame();", 10000 );
}
function GetSignature( bh, Ck ) {
try{return GetSignatureWin().GetUserSignature( bh, Ck );}
catch(e){LoadSignature();return "";}
}
function GetHasQzoneSign() {
try{return GetSignatureWin().HasQzoneSign();}
catch(e){LoadSignature();return 0;}
}
function GetHasTaotaoSign() {
try{return GetSignatureWin().HasTaotaoSign();}
catch(e){LoadSignature();return 0;}
}
function GetDetaultStationery(type) {
try{return type == "Header" ? GetSignatureWin().GetUserDefaultStationeryHeader() : GetSignatureWin().GetUserDefaultStationeryBottom();}
catch (e){LoadSignature();return "";}
}
function GetDefaultEditor() {
try{return GetSignatureWin().GetUserDefaultEditor();}
catch(e) {LoadSignature();return 0;}
}
function GetUserNick(){
try{return GetSignatureWin().GetUserNick();}
catch(e) {LoadSignature();return 0;}
}
function GetDefaultSaveSendbox() {
try{return GetSignatureWin().GetSaveSendbox();}
catch(e){LoadSignature();return 0;}
}
function GV_GetUserAlias() {
try{return GetSignatureWin().GetUserAlias();}
catch(e) {LoadSignature();return "";}
}
function GetDefalutAllMail() {
try{return GetSignatureWin().GetAllMail();}
catch(e) {LoadSignature();return "";}
}
function GetAllSignature() {
try{return GetSignatureWin().GetAllSign();}
catch(e) {LoadSignature();return "";}
}
function GetUserSignatureId() {
try{return GetSignatureWin().GetUserSignatureId();}
catch(e) {LoadSignature();return "";}
}
function GetIsQQClub() {
try {return GetSignatureWin().IsQQClub();}
catch(e) {LoadSignature();return false;}
}
function GetDefaultCardCates() {
try {return GetSignatureWin().GetCardCates();}
catch(e) {LoadSignature();return [[]];}
}
function SetGlobalVarValue( key, value, isNotSeted ) {
if ( !top.DataBase )
top.DataBase = new top.Object;
if ( key && !isNotSeted )
top.DataBase[ key ] = value;
}
function GetGlobalVarValue( key ) {
return top.DataBase && top.DataBase[ key ];
}

function GetUserInfoText(type) {
var o = S( "user" + type, GetTopWin() ) || {};
return fixNonBreakSpace( o.innerText || o.textContent );
}
function GetUserInfo(type) {
return ( S( "user" + type, GetTopWin() ) || {} ).innerHTML || "";
}
function SetUserInfo(type, val) {
try{
S("user" + type, GetTopWin()).innerHTML = HtmlEncode(val);
return true;
}catch(e){return false;}
}

function SetCookie(sName, sValue, oExpires, sPath, sDomain, bSecure) {
if ( sName == null && sValue == null )
return false;
var sCookie = sName + "=" + encodeURIComponent(sValue);
if ( oExpires )
sCookie += "; expires=" + oExpires.toGMTString();
sCookie += "; path=" + ( sPath || '/' );
sCookie += "; domain=" + ( sDomain || ( "mail." + GetDomain() ) );
if ( bSecure )
sCookie += "; secure";
document.cookie = sCookie;
return true;
}
function GetCookie(sName) {
var oRE = new RegExp("(?:; )?" + sName + "=([^;]*);?");
return oRE.test(gd.cookie) ? decodeURIComponent(RegExp["$1"]) : null;
}
function DeleteCookie( sName, sPath, sDomain ) {
SetCookie( sName, "", new Date( 0 ), sPath, sDomain );
}
function GetCookieFlags( bt ) {
   var gf = GetCookie( bt ) || "";
   for( var i = gf.length; i < 6 ; i++ )
   gf += '0';
   return gf.split( "" );
}
function SetCookieFlag( bt, i, flag, eS ) {
 eS      = eS || GetCookieFlags( bt );
 eS[ i ] = flag;
 var expdate  = new Date();
 expdate.setTime( expdate.getTime() + ( 30 * 24 * 3600 * 1000 ) );
 SetCookie( bt, eS.join( "" ), expdate, '/', "mail." + GetDomain() );
 return eS;
}

function fAddEvent(oTarget, sType, fHandler, bRemove) {
if (!oTarget)
return;

if (oTarget.addEventListener) {
bRemove ? oTarget.removeEventListener(sType, fHandler, false) : oTarget.addEventListener(sType, fHandler, false);
}
else if (oTarget.attachEvent) {
bRemove ? oTarget.detachEvent("on" + sType, fHandler) : oTarget.attachEvent("on" + sType, fHandler);
}
else {
oTarget["on" +sType] = bRemove ? null : fHandler;
}
}
function fRemoveEvent(oTarget, sType, fHandler) {
fAddEvent( oTarget, sType, fHandler, true );
}
function fPreventDefault( oEvent ) {
if ( oEvent ) {
if ( oEvent.preventDefault ) {
oEvent.preventDefault();
}
else {
oEvent.returnValue = false;
}
}
}
function fStopPropagation( oEvent ) {
if ( oEvent ) {
if ( oEvent.stopPropagation ) {
oEvent.stopPropagation();
}
else {
oEvent.cancelBubble = true;
}
}
}

function WaitFor( qh, zi, kr, BF ) {
var av= 0;
var Ia= kr || 500;
var Bq= ( BF || 10 * 500 ) / kr;

( function() {
try {
if ( qh() )
return zi( true );

if ( av++ > Bq )
return zi( false );

setTimeout( arguments.callee, Ia );
}
catch( e ) {
}
} )();
}

function fLoadJsFile(file, checked, doc) {
doc = doc || document;
if ( checked ) {
var s = GelTags( "script", doc );
for ( var i = s.length - 1; i >= 0; i-- )
if ( s[ i ].src.indexOf( file ) != -1 )
return;
}
var o      = doc.createElement( "script" );
o.language = "javascript";
o.charset  = "gb2312";
o.src = file;
var h = GelTags("head", doc)[0];
if ( h )
h.appendChild(o);
return o;
}
function fLoadCssFile(file, checked, doc) {
doc = doc ? doc : document;

if ( checked )
for ( var s = GelTags( "link", doc ), i = s.length - 1; i >= 0; i-- )
if ( s[ i ].href.indexOf( file ) != -1)
return;

var jZ  = doc.createElement( "link" );
jZ.type = "text/css";
jZ.rel  = "stylesheet";
jZ.href = file;

var eV = GelTags( "link", doc );
if ( eV.length > 0 ) {
var kT = eV[ eV.length - 1 ];
kT.parentNode.insertBefore( jZ, kT.nextSibling );
}
else {
var h = GelTags("head", doc)[0];
if ( h )
h.appendChild( jZ );
}
return jZ;
}
function fReplaceCssFile( pattern, file, doc ) {
if ( !pattern || !file )
return;

doc = doc || document;

var eV = GelTags( "link", doc );
E( eV, function( o ) {
if ( o.href.indexOf( pattern ) != -1 )
RemoveSelf( o );
} );

if ( file )
fLoadCssFile( file, false, doc);
}
function fReplaceCss( win, skinId ) {
fReplaceCssFile( "skin", [ GetPath("css", true), "skin", ( skinId || top.skin_path ), ".css" ].join(""), ( win || window ).document );
}
function fChangeStyle( skinId ) {
skinId = skinId || top.skin_path;

if ( top.gTempSkinId == skinId )
return;

top.gTempSkinId = skinId;

try {
S("imglogo", top).style.backgroundImage = T( [
"url($images_path$logo/logo_$style$_$logoid$.gif)" ] ).replace( {
images_path : GetPath( "image" ),
style       : skinId,
logoid      : skinId == 0 ? ( top.gLogoId || 0 ) : 0
} );
}
catch( e ) {
}

var wins = [ top, GetMainWin() ];

E( top.dialog_list, function( o, i ) {
wins.push( F( i, top ) );
} );

E( wins, function( o ) {
fReplaceCss( o, skinId );
} );
}
function LoadJsFileToTop( path, filelist ) {
for ( var i = 0, aw = filelist.length; i < aw; i++ )
fLoadJsFile( path + filelist[ i ], true, top.document );
}
function OutputJsReferece( path, filelist ) {
var cf = T( '<script language="JavaScript" src="$file$"></script>' );
for ( var i = 0, bY = [], aw = filelist.length; i < aw; i++ )
bY.push( cf.replace( {
file : path + filelist[ i ]
} ) );
return bY.join( "" );
}

function fParamsInTag( o ) {
var c = "";
var p = GelTags("PARAM", o);
for (var i = p.length - 1; i >= 0; i--)
c += p[i].outerHTML;
return c;
}
function fTagRewrite( tag, container ) {
var o = GelTags( tag, container );
for ( var i = o.length - 1; i >= 0; i-- )
o[ i ].outerHTML = o[ i ].outerHTML.split(">")[ 0 ] + ">" + fParamsInTag( o[ i ] )  + "</" + o[ i ].tagName + ">";
}
function fObjectActive( container ) {
if ( gIsIE ) {
fTagRewrite( "embed", container );
fTagRewrite( "object", container );
}
}

function Trim(sStr) {
return sStr.replace(/(^\s*)|(\s*$)/ig,"");
}
function StrReplace(s, o, d, mode) {
return s.replace(new RegExp( RegFilter(o), mode ), d);
}
function HighLight(filter, head, end) {
return function(str) {
return str.replace(new RegExp(["(", RegFilter(filter), ")"].join(""), "ig"), [head, "$1", end].join(""));
};
}
function FormatDate( CM, Bi, Cz ) {
function jl( gJ ) {
return gJ < 10 ? "0" + gJ : gJ;
}

var dK = CM || new Date();
return T( Bi, Cz ).replace( {
YY : jl( dK.getYear() ),
MM : jl( dK.getMonth() + 1 ),
DD : jl( dK.getDate() ),
hh : jl( dK.getHours() ),
mm : jl( dK.getMinutes() ),
ss : jl( dK.getSeconds() )
} );
}
function GetAsiiStrLen( dx ) {
return ( dx || "" ).replace( /[^\x00-\xFF]/g, "aa" ).length;
}
function SubAsiiStr( dx, yk, oO ) {
dx  = Trim( new String( dx  || "" ) );
oO = oO || "";

var nx = yk - oO.length;
nx     = nx <= 0 ? 1 : nx;

for ( var i = 0, BJ = dx.length, qC = 0, tl = -1; i < BJ; i++ ) {
var qW = dx.charCodeAt( i );


qC += qW == 35 || qW == 87 ? 1.2 : ( qW > 255 ? 1.5 : 1 );
if ( tl == -1 && qC > nx )
tl = i;
if ( qC > yk )
return dx.substr( 0, tl ) + oO;
}

return dx;
}

function GenerateFlashCode( bb, qN, yG, kh ) {
var yU  = [];
var qf = [];
var oQ = [];

var ni  = T( ' $name$=$value$ ' );
var vh = T( '<param name="$name$" value="$value$" />' );
var Hg = T( [
'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ',
'$codebase$ ',
'$attr$ $id$ >',
'$param$',
'<embed $embed$ type="application/x-shockwave-flash" ',
'$pluginspage$ ',
' $name$ ></embed>',
'</object>',
] );

function md( Es, rI ) {
return {
name  : Es,
value : rI
};
}

if ( !kh )
kh = {};
kh.allowScriptAccess = "sameDomain";
kh.quality = "high";

for ( var bt in kh ) {
var au = md( bt, kh[ bt ] );
qf.push( vh.replace( au ) );
oQ.push( ni.replace( au ) );
}

for ( var bt in yG ) {
var au = md( bt, yG[ bt ] );
yU.push( ni.replace( au ) );
oQ.push( ni.replace( au ) );
}

if ( qN ) {
qf.push( vh.replace( md( "movie", qN ) ) );
oQ.push( ni.replace( md( "src", qN ) ) );
}
return Hg.replace( {
id    : bb ? ' id="'   + bb + '"' : '',
name  : bb ? ' name="' + bb + '"' : '',
attr  : yU.join( "" ),
param : qf.join( "" ),
embed : oQ.join( "" ),
codebase : location.protocol == "https:" ? '' : 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ',
pluginspage : location.protocol == "https:" ? '' : 'pluginspage="http://www.macromedia.com/go/getflashplayer" '
} );
}
function GetFlash( bb, df ) {
df = df || window;
var an = df[ bb ] || df.document[ bb ];
return an ? ( an.length ? an[ an.length - 1 ] : an ) : null;
}
function SetPlayer( ah ) {
function xc( ah ) {
if ( !top.qmPlayer ) {
setTimeout( function() {
xc( ah );
}, 200 );
return false;
}

var aH= "qqmailMediaPlayer" + ( ah.id || "" );
var ea= ah.win || window;

if ( !ea || ea[ aH ] )
return false;

if ( !ah.container && !( ah.container = S( "mp3player_container", ea ) ) )
return false;

return ( ea[ aH ] = new top.qmPlayer() ).setup( ah );
}

if ( !top.qmPlayer )
fLoadJsFile( GetPath( "js" ) + "qmplayer.js", true, top.document );

return xc( ah );
}
function PlayUrl( bX ) {
var dC= ( bX.win || window )[ "qqmailMediaPlayer" + ( bX.id || "" ) ];

if ( !dC )
return SetPlayer( bX );

dC.openUrl( bX.url, bX.dispInfo );
}
function StopUrl( bX ) {
if ( !bX )
bX = {};

try {
( bX.win || window )[ "qqmailMediaPlayer" + ( bX.id || "" ) ].stop();
}
catch( e ) {
}
};


function PutTextareaValue(o, val) {
if (o.tagName != "TEXTAREA" && o.tagName != "textarea")
return false;
try {
o[ o.innerText != null ? "innerText" : "value" ] = val;
} catch (e) {
return false;
}
return true;
}
function GetTextareaValue(o) {
if (o.tagName != "TEXTAREA" && o.tagName != "textarea") return null;
return o.value;
}

function ScrollIntoMidView( aO, iE, kY, yE, DZ ) {
if ( !iE )
return false;
var ot = 0;
for ( var o = aO; o && o != iE; o = o.offsetParent )
ot += o.offsetTop;
var h = ot - iE.scrollTop;
if ( kY || h < 0 || h + aO.offsetHeight  > iE.clientHeight )
iE.scrollTop = ot - ( DZ ? ( h < 0 ? 0 : ( iE.clientHeight -
aO.offsetHeight - ( yE || 0 ) ) ) : ( ( iE.clientHeight -
aO.offsetHeight - ( yE || 0 ) ) / 2 ) );
return true;
}

function CreateMessageBox() {
var msgBox = S( "msgBoxDIV", top );
if ( !msgBox ) {
InsertHTML( top.document.body, "afterBegin",
[ '<div id="msgBoxDIV" style="position:absolute;width:100%;padding-top:4px;height:24px;top:', top.bnewwin ? '24' : '43', 'px;text-align:center;"><span></span></div>' ].join( "" ) );
msgBox = S( "msgBoxDIV", top );
}
return msgBox;
}




function fMessageBox( msg, mbtype, bHide, hidetime, dialogTitle, win ) {
if ( window != top )
return top.fMessageBox( msg, mbtype, bHide, hidetime, dialogTitle, win );

if ( !msg ) {
var oMsgObj = S("msg_txt", win || window) || S("msg_txt", GetActionWin());
if ( oMsgObj && ( oMsgObj.innerText || oMsgObj.textContent ) && oMsgObj.getAttribute( "ok" ) != "true" ) {
msg = oMsgObj.innerHTML.replace(/<script .*>(.|\n)*<\/script>/ig, "");
oMsgObj.setAttribute( "ok", "true" );
}
}

if (!msg || !( msg = Trim( msg.replace( /[\r\n]/ig, "" ) ) ) )
return;

HiddenMsg();

if (mbtype == "dialog") {
ModelDialog( 1, dialogTitle ? dialogTitle : "确认", [
"<div style='padding:10px 0 5px 10px;text-align:left;'>",
"<img src='", GetPath("image", true), "ico_question.gif' align='absmiddle' style='float:left;margin:5px 0 0 10px;'>",
"<div style='width:300px;height:80px;overflow:hidden;'><table width=300px height=80px><tr><td>",  msg,  "</td></tr></table></div>",
"</div>",
"<div style='text-align:right;padding:0 10px 10px 0;'>",
"<input class='wd2 btn' type=button id=confirm value=确认>",
"</div>"
].join( "" ), "confirm", ["confirm"], [ function(){ HideModelDialog(); } ] );
}
else {
var msgBox = CreateMessageBox().firstChild;

SetClass( msgBox, mbtype == "success" ? "msg" : "errmsg" );
msgBox.innerHTML = msg;

ShowMsg();

if ( bHide )
top.msgBoxTimer = top.setInterval( top.HiddenMsg, hidetime || 5000);

top.msgDispTime = new Date();
}
}
function comfirmBox( aB ) {
var Ah = false;
ModelDialog( 1, aB.title, T( [
'<div style="padding:10px 0 5px 10px;text-align:left;">',
'<img src="$image_path$ico_question.gif" align="absmiddle" style="float:left;margin:5px 10px 0;">',
'<div style="width:300px;padding-top:22px;height:58px;*height:80px;overflow:hidden;">',
'$msg$',
'</div>',
'</div>',
'<div style="float:left;padding:0 0 0 10px;display:$statusdisp$;">',
'<input id="recordstatus" type="checkbox"/><label for="recordstatus">$recordinfo$</label>',
'</div>',
'<div style="text-align:right;padding:0 10px 10px 0;">',
'<input class="wd2 btn" type=button id=confirm value=确认>',
'<input class="wd2 btn" type=button id=cancel value=取消>',
'</div>'
] ).replace( {
image_path: GetPath("image", true),
msg: aB.msg,
recordinfo: aB.recordInfo,
statusdisp: aB.enableRecord ? "" : "none"
} ), "confirm", [ "confirm", "cancel" ], [
function() {
Ah = true;
HideModelDialog();
},
function() {
HideModelDialog();
} ],
null, null,
function() {
aB.onreturn( Ah, GetDialogObj( "recordstatus" ).checked );
} );
}
function showError(err, dtime) {
fMessageBox(err, "", true, dtime? dtime:5000);
}
function showInfo(info, dtime) {
fMessageBox(info, "success", true, dtime? dtime:5000);
}
function IsShowMsg() {
return top.IsShow( "msgBoxDIV" );
}
function HiddenMsg() {
if ( top.msgBoxTimer ) {
top.clearInterval(top.msgBoxTimer);
top.msgBoxTimer = null;
}
top.Show( "msgBoxDIV", false);
top.ShowProcess( 0 );
}
function ShowMsg() {
top.Show( "msgBoxDIV", true );
}

function IsMaximizeMainFrame() {
var aJ = top.MaximizeMainFrame ;

if ( aJ.isMaximizeMainFrame == null ) {
var o = S( "mainFrame", top ) ;
aJ.isMaximizeMainFrame = o &&
o.parentNode.style.marginLeft == aJ.configMarinLeft ;
}

return aJ.isMaximizeMainFrame ;
}
function MaximizeMainFrame( bMax ) {
bMax = bMax != null ? bMax : 1;

var o     = S("mainFrame", top);
var img   = S("imgLine", top);
var panel = S("leftPanel", top);
var bar   = S( "maxSideBar", top );
if (!o || !img || !panel || bMax == (IsMaximizeMainFrame() ? 1 : 0))
return false;

bMax = bMax == 2 ? ( IsMaximizeMainFrame() ? 0 : 1 ) : bMax ;

var aJ = top.MaximizeMainFrame ;
aJ.isMaximizeMainFrame = bMax ;

if ( bMax ) {
aJ.backupMarginLeft = panel.style.width ;
aJ.imgParentCssText = img.parentNode.style.cssText;
aJ.barLeft          = bar.style.left;
}

o.parentNode.style.marginLeft  = bMax ? "5px" : aJ.backupMarginLeft ;
panel.parentNode.style.cssText = bMax ? "border-left:none;" : "";
img.parentNode.style.cssText   = ( bMax ? "border-left:none;margin-left:0;padding:0;" : "" ) + aJ.imgParentCssText;
bar.style.left                 = bMax ? "0" : aJ.barLeft;

Show( panel, !bMax );
Show( img, !bMax );
Show( S( "qqplus_panel", top ), !bMax );
Show( S("folder", top), !bMax );

return true ;
}
function GetHttpProcesser() {
var httpProcesser = top.gCurHttpProcesser;
httpProcesser = httpProcesser == null ? 0 : httpProcesser;
top.gCurHttpProcesser = (httpProcesser + 1) % 30;
try {
if (top.gHttpProcesserContainer[httpProcesser] != null)
delete top.gHttpProcesserContainer[httpProcesser];
}
catch (e) {
top.gHttpProcesserContainer = {};
}
top.gHttpProcesserContainer[httpProcesser] = new top.Image;
return top.gHttpProcesserContainer[httpProcesser];
}
function RunUrlWithSid(param) {
try {
var obj = top.GetHttpProcesser();
if (obj)
obj.src = [ param, "&sid=", GetSid(), "&r=", Math.random() ].join( "" );
}
catch(e) {
}
}
function SetKeepAlive(win) {
if (top.gKeepAliveNum == null)
top.gKeepAliveNum = 0;

if (win == null || win.gHasSetKeepAlive == true)
return;

win.gHasSetKeepAlive = true;
top.gKeepAliveNum++;
if (top.gKeepAliveTimer == null) {

top.gKeepAliveTimer = top.setInterval(function() {
top.RunUrlWithSid( "/cgi-bin/readtemplate?t=keep_alive" );
}, 900000);
}
fAddEvent( win, "unload", function() {
win.gHasSetKeepAlive = false;
top.gKeepAliveNum--;
if (top.gKeepAliveNum == 0) {
top.clearInterval(top.gKeepAliveTimer);
top.gKeepAliveTimer = null;
}
} );
}
function RecodeComposeStatus(actionId, mailid, failCode, isMust) {
if (!top.gSendTimeStart || !top.gSendTimeStart.valueOf) {
if ( !isMust )
return;
var time = 0;
}
else {
var time = (new Date()).valueOf() - top.gSendTimeStart.valueOf();
top.gSendTimeStart = null;
}
RunUrlWithSid("/cgi-bin/getinvestigate?stat=compose_send&t="+time+"&actionId="+actionId+"&mailid="+(mailid == null ? "" : mailid) + "&isActivex=" + (top.isUseActiveXCompose ? 1 : 0) + "&failCode=" + (failCode == null ? "" : failCode));
top.isUseActiveXCompose = false;
}
function ReloadFrm(frm) {
if ( frm && frm != top ) {
try {
if ( frm.location.search ) {
frm.location.replace( frm.location.href.split( "#" )[ 0 ] );
return true;
}
}
catch( e ) {
}
}
return false;
}
function ReloadLeftWin() {
var frameObj;
if ( !ReloadFrm( GetLeftDateWin() ) && ( frameObj = S( "leftFrame", top ) ) )
frameObj.src = [ "/cgi-bin/folderlist?sid=", GetSid(), "&r=", Math.random() ].join( "" );
}
function ReloadAllFrm(bReloadTop, bReloadTemp, bReloadLeft, bReloadMain) {
var timer = function( jscode ) {
top.setTimeout( jscode, timer.time );
timer.time += 200;
}
timer.time = 0;

if(bReloadMain==null || bReloadMain)
timer( "ReloadFrm(GetMainWin());" );

if(bReloadLeft==null || bReloadLeft)
timer( "ReloadLeftWin();" );
}
function ReloadFrmLeftMain(bReloadLeft, bReloadMain) {
ReloadAllFrm(false, false, bReloadLeft, bReloadMain);
}
function ReloadFrmLeftMainNewWin(bReloadLeft,bReloadMain) {
var op = top.opener;
var hf = op ? (op.GetMainWin ? op.GetMainWin().location.href : "") : "";
if (hf.indexOf("readmail") != -1) {
op.top.GoUrlMainFrm("/cgi-bin/mail_list?sid="+ GetSid());
}
else if (hf.indexOf("mail_list") != -1) {
op.top.ReloadFrmLeftMain(bReloadLeft,bReloadMain);
}
}
function GoUrlMainFrm( url, bReloadLeft, bNoHistroy ) {
try {
if ( bNoHistroy ) {
GetMainWin().location.replace( url );
}
else {
GetMainWin().location.href = url;
}
}
catch( e ) {
top.S( "mainFrame" ).src = url;
}
if ( bReloadLeft == null || bReloadLeft == true )
top.setTimeout( "ReloadLeftWin()" );
}
function HtmlDecode( s ) {
return s && s.replace ? ( s.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,"\"") ) : s;
}
function HtmlEncode( s ) {
return s && s.replace ? ( s.replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;") ) : s;
}
function EncodeURI( s ) {
return s && s.replace ? s.replace( /%/ig, "%25" ).replace( /\+/ig, "%2B" ).replace( /&/ig, "%26" ) : s;
}
function DecodeURI( s ) {
return decodeURIComponent( s || "" );
}

function TextToHtml(content) {

var res = "<DIV>" + content.replace((content.indexOf("<BR>") >= 0)? /<BR>/ig: /\n/g, "</DIV><DIV>") + "</DIV>";
res = res.replace(new RegExp("\x0D","g"), "");
res = res.replace(new RegExp("\x20","g"), "&nbsp;");
res = res.replace(new RegExp("(<DIV><\/DIV>)*$","g"), "");
return res.replace(/<DIV><\/DIV>/g, "<DIV>&nbsp;</DIV>");
}
function TextToHtmlForNoIE( content ) {
return content.replace( /\n/g, "<br>" );
}
function HtmlToText(content) {

var res = content.replace( /\n/ig, "" );

res = res.replace( /(<\/div>)|(<\/p>)|(<br\/?>)/ig, "\n" );
return res;
}

function DoPostFinishCheck( id, win, onerror ) {
if ( !id )
return;

var responseContent = null;
var isErrResponse   = false;
try {
var f = F( id, win );
var b = f.document.body;
var l = f.location.href;

isErrResponse = !( l == "about:blank" || l.indexOf( "javascript:" ) == 0 || b.className != "" || b.style.cssText != "" );
var tmp = f.document.documentElement;
responseContent = ( tmp.textContent || tmp.innerText || "" ).substr( 0, 30 );
}
catch( e ) {
isErrResponse = e.message || true;
}

try {
if ( ( b.className && b.className != id ) || b.style.cssText && id == "sendmailFrame" )
RemoveSelf( S( "sendmailFrame", top ) );
}
catch( e ) {
}

History.recordActionFrameChange();

if ( isErrResponse ) {
debug( "ActionFinishCheck Err " + isErrResponse, "", 61882714 );
if ( typeof( onerror ) == "function" )
onerror( responseContent );
ErrorProcess();
S( id, win ).src = "javascript:'';";
}
}
function ActionFinishCheck() {
DoPostFinishCheck( "actionFrame", top, function( responseContent ) {
showError( msgLinkErr );
} );
 }
function DoSendFinishCheck( frameObj ) {
DoPostFinishCheck( "sendmailFrame", top, function( responseContent ) {
RecodeComposeStatus( 2, null, responseContent || 0 );
fMessageBox( "由于网络原因，邮件发送失败！", "dialog", true, 0, "失败信息" );
} );
}
function SubmitToActionFrm(oForm) {
try {
oForm.submit();
return true;
} catch(e) {
showError(e.message);
return false;
}
}
function AfterAutoSave( attachlist, mailid, msg, notDisable ) {
var mF = top.GetMainWin();

var tf = function() {
if ( mF && mF.DisableAll )
mF.DisableAll( false );
};

if ( mailid == "" || !mailid )
return tf();

if ( !mF || !S( "fmailid", mF ) )
return tf();

if ( S( "fmailid", mF ).value != mailid ) {
S( "fmailid", mF ).value = mailid;
top.setTimeout( function() {
ReloadLeftWin()
},0 );
}

var files    = attachlist.split(" |");
var fileCtls = new Array();
for ( var i = 0; i < mF.AttachID; i++ ) {
var tmp = mF.Gel( "Uploader" + i );
if ( tmp != null && !tmp.disabled && tmp.value != "" )
fileCtls.push( tmp );
}
var len  = files.length - 1;
var len2 = fileCtls.length;
for ( var i = 0; i < len; i++ ) {
var isExist = false;
for ( var j = 0; j <= i && j < len2; j++ ) {
if ( !fileCtls[j].disabled && fileCtls[j].value.indexOf(files[i]) != -1 ) {
fileCtls[j].disabled = true;
isExist = true;
try{
if (gIsIE || gIsSafari)
fileCtls[j].parentNode.childNodes[1].innerText = files[i];
}
catch(e){}
}
}
if ( !isExist ) {
var name = files[i] + " |";
var pos = attachlist.indexOf(name);
if (pos != -1) {
attachlist = attachlist.substr(0, pos) + attachlist.substr(pos + name.length, attachlist.length - pos - name.length);
}
}
}

mF.LoadValue();
if ( attachlist && S( "fattachlist", mF ) )
S( "fattachlist", mF ).value += attachlist;

showInfo( msg || ( ParseStr( ( new Date() ).getHours(), 2 ) + ":" + ParseStr( ( new Date() ).getMinutes(), 2 ) + " " + top.msgSendErrorSaveOK ) );

if ( IsDialogShow( "btn_exit_notsave" ) )
return GetDialogObj("btn_exit_notsave").click();

if ( !notDisable )
tf();

mF.bIsEnableAutoSave = true;
}

function ShowProcess( flag, isShowImg, parm, parm2, isHasCancel ) {
var id = "load_process";
var f = top;
var bar = S( id, f );
if ( flag == 0 ) {
if ( IsShow( bar ) )
Show( bar, false );
return
}

if ( !IsShow(bar) && !( bar = CreateProcessUI( isHasCancel ) ) )
return ;

HiddenMsg();
Show( bar, true );

var info = S( id + "_info", f );
if ( flag == 2 ) {
if ( parm2 != null )
S( id + "_plan_info", f ).innerHTML = parm2;

parm = parseInt( parm );
parm = isNaN( parm ) ? 0 : ( parm < 0 ? 0 : ( parm > 100 ? 100 : parm ) );
S( id + "_plan_rate", f ).innerHTML = parm + "%";
S( id + "_plan_bar", f ).style.width = parm + "%";

Show( S( id + "_plan", f ), true );
Show( S( id + "_img", f ), false );
Show( info, false );
}
else {
if (parm != null)
info.innerHTML = parm;

Show( S( id + "_plan", f ), false );
Show( S( id + "_img", f ), isShowImg );
Show( info, true );
}
}
function CreateProcessUI( isHasCancel ) {
var bar = S( "load_process", top );
var cancel = S( "load_process_cancel", top );


isHasCancel = true;

if ( bar ) {
if ( ( isHasCancel && bar ) || ( !isHasCancel && !bar ) )
return bar;
RemoveSelf( bar );
}

var val = [[240, -120, "padding:0 38px 0 28px;width:174px!important;width:240px;"], [214, -107, "padding:0 0 0 28px;width:170px!important;width:214px;"]][isHasCancel ? 0 : 1];
InsertHTML( top.document.body, "afterBegin", [
'<div id="load_process" class="autosave autosave_txt" style="width:', val[0], 'px;height:19px;position:absolute;top:', top.bnewwin ? '24' : '46', 'px;left:50%;margin-left:', val[1],  'px;text-align:left;overflow:hidden;">',
'<div id="load_process_plan" style="display:none;">',
'<div style="font:1px;height:12px;border:1px solid white;width:104px;text-align:left;float:left;margin:4px 3px 0 0">',
'<div id="load_process_plan_bar" style="background:#fff;height:8px;margin:1px 0 0 0;width:0%;"></div>',
'</div>',
'<div style="width:78px;line-height:18px;">',
'<span id="load_process_plan_info">发信中</span>:<span id="load_process_plan_rate" style="width:35px;text-align:right;">0%</span>',
'</div>',
'</div>',
'<div id="load_process_info" style="display:none;line-height:20px;text-align:center;', val[2],  '"></div>',
'<div id="load_process_img" style="display:none;position:absolute;margin:-18px 0 0 5px!important;margin:-18px 0 0 5px;">',
'<img src="', GetPath("image", true), 'ico_loading.gif" style="width:16px;height:16px;">',
'</div>',
(isHasCancel ? '<div id="load_process_cancel" class="autosave" style="position:absolute;margin:-20px 0 0 200px!important;margin:-19px 0 0 195px;">[<a onclick="top.GetMainWin().CancelDoSend();" style="color:white;">取消</a>]</div>' : ''),
'</div>',
].join("") );

return S( "load_process", top );
}
function GetProcessInfo() {
var id = "load_process";
var f = top;
if ( IsShow( S( id, f ) ) ) {
var info1 = S( id + "_plan_rate", f );
var info2 = S( id + "_info", f );
if ( info2 && IsShow( info2 ) )
return info2.innerHTML;
if ( info1 && IsShow( S( id + "_plan", f ) ) )
return parseInt( info1.innerHTML );
}
return "";
}
function CancelDoSend() {
var mJ = GetMainWin();
if ( mJ.SendMailActiveX && mJ.SendMailActiveX.bT ) {
top.isAbortByUser = true;
mJ.SendMailActiveX.bT.StopUpload();
mJ.SendMailActiveX.bT = null;
}
else {
RemoveSelf( S( "sendmailFrame", top ) );
}

RecodeComposeStatus( 3, null, 0 );
ShowProcess( 0 );
ErrorProcess();
}

function QuickDoSend( gE, bv, hA ) {
try {
CreatePanel( top, 'sendmailFrame', null, 'DoSendFinishCheck(this)' );
if ( hA != "nomsg" )
ShowProcess( 1, 1, hA || msgSend, null, true );

gE.content.value = bv;
gE.target        = "sendmailFrame";
gE.submit();

DisableCtl( "sendbtn", true );
DisableCtl( "source",  true );
}
catch ( e ) {
showError( "发送失败：" + e.message );
DisableCtl( "sendbtn", false );
DisableCtl( "source",  false );
}
}

function EmptyFolder() {
return confirm("你确认要清空此文件夹吗？");
}

function EmptyFolder_inSpam() {
return confirm("你确认要删除在垃圾邮件箱中的所有邮件吗？");
}

function MoveFolder(id,index,fun) {
try
{
var Fids=SN("F_ID");
for (var i=0; i<Fids.length;i++ ) {
if (Fids[i].id == id) break;
}
var j=-1;
j= fun=="up"? (i==0?(i+Fids.length-1):i-1) : ((i + 1)%Fids.length);
GetMainWin().idx1=i;
GetMainWin().idx2=j;
if (j>=0) {
var sf=Gel("frm");
sf.folder2.value = Fids[j].id;
sf.index2.value = Fids[j].value;
sf.folder1.value=id;
sf.index1.value=index;
sf.folderid.value=id;
sf.fun.value="updateindex";
sf.act.value=fun;
SubmitToActionFrm(sf);
}
}catch(e)
{
}
}
function SwitchFolderComm( id, win, containerId, tagName, overCss, noneCss, caller ) {
if ( window != top )
return top.SwitchFolderComm( id, win, containerId, tagName, overCss, noneCss, caller );

if ( caller ) {
if ( id != null )
caller.curFolderId = id;
else
id = caller.curFolderId;
}

if ( !win )
return false;

try {
var folderContainer = S( containerId, win ) ;
if ( !folderContainer )
return false;

var folders = GelTags( tagName , folderContainer ) ;
}
catch (e) {
return false;
}

id = id + "_td";
for ( var i = folders.length - 1 ; i >= 0 ; i-- ) {
var folder = folders[ i ];
if ( !folder.id ) {
continue;
}
else if ( folder.id == id ) {
if ( folder.className != overCss ) {
SetClass( folder, overCss );
ScrollIntoMidView( folder, folderContainer ) ;
}
}
else {
SetClass( folder, noneCss );
}
}

return true;
}
function SwitchFolder( id, win ) {
SwitchFolderComm( id, win || GetLeftWin(), "folder", "li", "fn", "fs", top.SwitchFolder ) ;
}
function SwitchRightFolder( id, rightWin, containerId ) {
SwitchFolderComm( id, rightWin || F( "rightFolderList", GetMainWin() ), containerId || "folder_new", "div", "toolbg", "", top.SwitchRightFolder ) ;
}
function SelectAll(flag) {
var mail_list_table = S('list');
var mail_list_checkbox = GelTags("input", mail_list_table);
for(var i = mail_list_checkbox.length - 1;i >= 0; i--) {
mail_list_checkbox[i].checked = flag;
}
}
function SelectReadMail(flag) {
var mail_list_table = S('list');
var mail_list_checkbox = GelTags("input", mail_list_table);
for(var i = mail_list_checkbox.length - 1;i >= 0; i--) {
mail_list_checkbox[i].checked = (mail_list_checkbox[i].getAttribute('unread') != flag);
}
}
function RenameFolder(FolderID) {
sNewName=prompt("请输入新名字\n\n\n","");
if(sNewName!=null) {
S("frm").name.value=sNewName;
S("frm").folderid.value=FolderID;
S("frm").fun.value="rename";
SubmitToActionFrm(Gel("frm"));
}
}
function ShowQuickReply(isShow)
{
Show(S('quickreply'), isShow);
Show(S('upreply'), !isShow);
RunUrlWithSid("/cgi-bin/getcomposedata?Fun=setshowquickreply&isShowQuickReply=" + (isShow ? 0 : 1));
}
function HiddenReceipt()
{
var receiptDiv = S("receiptDiv");
if(receiptDiv)
Show(receiptDiv, false);
}
function ParseStr(val, len) {
var str = val.toString();
for (var i = str.length; i < len; i++) {
str = "0" + str;
}
return str;
}
function CheckAddrSelected() {
var List = GelTags("input");
for (var Loop = 0; Loop < List.length; Loop++) {
if (List[Loop].type == "checkbox" && List[Loop].checked) {
return true;
}
}
return false;
}
function PGV() {}

function InitAutoComplete() {
var inputNames = [ "to","cc", "bcc"];
var defaltTxt = ["", "", ""];
var defaultCss = ["", "", ""];
var clickObjNames = ["to_btn", "cc_btn", "bcc_btn"];
var rightWidth = [null, null, null];
var targetObj = [null, null, null];
for ( var i = 0, len = inputNames.length; i < len; i++ ) {
var input = S( inputNames[ i ] );
if ( input )
( new QQMail.AutoCompleteAllAddr() ).Init(
input, F( "AutoCompleteFrmId" ), S( "AutoCompleteFrmId" ), true, defaltTxt[ i ], defaultCss[ i ],
S( clickObjNames[ i ] ), rightWidth[ i ], targetObj[ i ] );
}

for ( var i = 0, len = clickObjNames.length; i < len; i++ ) {
var nK = S( inputNames[ i ] );
var wT = S( clickObjNames[ i ] )
if ( nK && wT ) {
wT.onclick = (function() {
var ad = "/zh_CN/htmledition/cardaddr.html?ifid=mainFrame&sw=165&textid=" + inputNames[ i ];
return function() {
window.uploadWindow = OpenDialog("add_address", ad, false, 480, 433);
}
})();
}
}

}
function ErrorProcess() {
try{GetMainWin().ErrorCallBack();}catch(e){try{top.ErrorCallBack();}catch(e){}}
}
function IsDisableCtl(name) {
var ctls = SN(name);
for (i = ctls.length - 1; i >= 0; i--) {
if (ctls[i].disabled) return true;
}
return false;
}
function DisableCtl(name, isDisabled) {
var ctls = SN(name);
for (i = ctls.length - 1; i >= 0; i--) {
ctls[i].disabled = isDisabled;
}
}
function DisableAll(isDisabled) {
try{EnableAutoSave(!isDisabled);}catch(e){}
DisableCtl("sendbtn", isDisabled);
DisableCtl("savebtn", isDisabled);
try{GetDialogObj("btn_exit_save").disabled = isDisabled;}catch(e){}
}
function VerifyCode( Cy, CB ) {
var ij= S( "frmVerify", GetMainWin() );
if ( ij ) {
Show( ij, true );
var gx = GetMainWin().document.body;
ij.style.top= ( gx.scrollTop + ( gx.clientHeight - ij.clientHeight ) / 2 );
ij.style.left= ( gx.clientWidth - ij.clientWidth ) / 2;
ij.src = T( "/cgi-bin/readtemplate?t=$t$&s=$s$&sid=$sid$&r=$r$" ).replace( {
t: CB || "verifycode",
s: Cy,
sid: GetSid(),
r: Math.random()
} );
}
}

function GetFolderUnread( fid, isgroup ) {
return OptFolderUnread( 0, fid );
}
function SetFolderUnread( fid, val, noBold, win ) {
return OptFolderUnread( 1, fid, val ? val : 0, noBold, win );
}
function GetGroupUnread( gid, isgroup ) {
return OptFolderUnread( 0, gid, null, null, GetMainWin() );
}
function SetGroupUnread( gid, val, noBold ) {
return OptFolderUnread( 1, gid, val ? val : 0, noBold, GetMainWin() );
}
function OptFolderUnread( type, fid, val, noBold, win ) {
if (fid == null)
return 0;
var f = win || GetLeftWin();
var folderId = ( new String( fid ) ).toString().split( "folder_" ).pop();
o = S( "folder_" + folderId, f );
if (!o)
return 0;

val = typeof(val) == "number" && val > 0 ? val : 0;
var s = o.innerText || o.textContent;

if ( typeof( s ) != "string" )
s = "";

var p = s.lastIndexOf("(");
var v = 0;
o.title = "";

if (p != -1) {
v = s.substring(p + 1, s.indexOf(")"));
v = parseInt(v);
if (type == 0)
return v;
o.innerHTML = (val == 0 ? s.substring(0, p) : StrReplace(o.innerHTML, "("+v+")", "("+val+")"));
}
else {
if (type == 0 || val == 0)
return 0;
o.innerHTML = noBold ? (s + "(" + val + ")") : ("<b>" + s + "</b><b>(" + val + ")</b>");
}
if ( o.tagName == "B" ) {
var as = GelTags( "a", o.parentNode.parentNode );
if ( as.length < 0 )
return 0;
try{OptFolderUnread(type, fid, val, noBold, GetMainWin());}catch(e){ alert(e.message) }
return SetFolderUnread( as[ 0 ].id, GetFolderUnread( as[ 0 ].id ) - v + val );
}
return 1;
}

function DoFolderEmpty( bh, gE, rn ) {
gE.folderid.value = bh;
gE.rk.value       = Math.random();

if ( gE.loc )
gE.loc.value  = rn;

SubmitToActionFrm( gE );
}


function RecordReadedMailId( mailid, bforcenullpos ) {
top.gReadedMailId = mailid;

}

function RecordCompareReadedMailId( mailid ) {
if ( mailid && top.gReadedMailId != mailid ) {
top.gReadedMailId   = mailid;

}
MailCache.addData( mailid );
}

function SG(groupObj, bSessionMode) {
var l = groupObj.className.length - 2;
var bShow = groupObj.className.charAt( l ) == "s" ? false : true;
var input = GelTags( "input", groupObj.parentNode )[ 0 ];

if ( input && ( input.className == "one" || input.className == "all" ) )
SetClass( input, bShow ? "one" : "all" );

SetClass( groupObj, groupObj.className.substr( 0, l ) + ( bShow ? "st" : "ht" ) );

var div = ( bSessionMode ? groupObj.parentNode.parentNode.parentNode : groupObj.parentNode ).nextSibling;
if ( div.className != "toarea" )
div = div.nextSibling;

if ( div.className != "toarea" )
return;

return Show( div, bShow );
}
function CA(cObj) {
if ( !cObj )
return;

var div = ( cObj.className == "all" ? cObj.parentNode.parentNode.parentNode.parentNode : cObj.parentNode ) .nextSibling;
if ( div.className != "toarea" )
div = div.nextSibling;

if ( div.className != "toarea" )
return;

var putlist=div.getElementsByTagName("input");
for ( var i = putlist.length-1; i >= 0; i-- )
SetListCheck( putlist[ i ], cObj.checked );
}
function RD( oEvent, mailid, unread, type, folderid, bunreadtmpl, bcheck, nXqqstyle, groupid ) {
if ( oEvent )
fPreventDefault( oEvent );

RecordReadedMailId( mailid );

var templatename = type == 0 ? ( nXqqstyle==100 ? "compose_card&s=draft" : "compose&s=draft" ) : ( type == 1 ? "readmail" : "readmail_group" );
if( bcheck==1 )
templatename = "readmail&s=draft";
var subtmpl = top.bnewwin || ( oEvent && oEvent.shiftKey ) ? [ "&s=newwin", "&compose_new=compose" ][ type ? 0 : 1 ] :
[ "", "&s=from_unread_list", "&s=from_star_list" ][ bunreadtmpl != 1 && bunreadtmpl != 2 ? 0 : bunreadtmpl ];

var ad= T( '/cgi-bin/readmail?mailid=$mailid$&folderid=$folderid$&t=$t$&$s$&$unread$&groupid=$groupid$' ).replace( {
mailid: mailid,
folderid: folderid,
t: templatename,
s: subtmpl,
unread: unread ? "&rflist=true" : "",
groupid: groupid
});

if ( oEvent && oEvent.shiftKey ) {
var target = oEvent.target || oEvent.srcElement;
if (target) {
for (; target && target.className != "i M" && target.className != "i F"; target = target.parentNode);
if ( target )
ReadedItem.disp( target );
}
top.open( T( '/cgi-bin/frame_html?sid=$sid$&t=newwin_frame&url=$url$' ).replace( {
sid : GetSid(),
url: encodeURIComponent( ad )
} ) );
}
else {
GoUrlMainFrm( T( '$url$&sid=$sid$' ).replace( {
url: ad,
sid: GetSid()
} ), false );
}
}
function CheckCheckBoxs() {
var bd = GelTags( "input", frm );
for ( var i = 0, aw = bd.length; i < aw; i++ )
if ( bd[ i ].type == "checkbox" && bd[ i ].name == "mailid" && bd[ i ].checked )
return true;
return false;
}

function GetCheckBoxsInfo() {
function GL( an, iV ) {
var kv = an.parentNode;
while (kv != null && kv.tagName.toLowerCase() != iV) {
kv = kv.parentNode;
}
return kv;
}
var bd = GelTags( "input", frm );
var bD = [];
var kX = {};
for ( var i = 0, aw = bd.length; i < aw; i++ ) {
if ( bd[ i ].type == "checkbox" && bd[ i ].name == "mailid" && bd[ i ].checked ) {
var EZ = GL(bd[ i ], "tr");
var gR = EZ.cells[ 2 ].getElementsByTagName( "td" )[0];
if ( !kX[gR.firstChild.innerHTML] ) {
bD.push([gR.firstChild.innerHTML.replace(/\&nbsp;$/, ""), gR.title]);
kX[gR.firstChild.innerHTML] = 1;
}
}
}
return bD;
}

function CheckPerDelML( folderid, isPopFolder ) {
return DelMailML( folderid, isPopFolder, "PerDel" );
}
function DelMailML( folderid, isPopFolder, fun ) {
if ( !CheckCheckBoxs() ) {
showError( msgNoMail );
return false;
}

if ( fun == "PerDel" ) {
var CG = confirm( "您确定要彻底删除选中的邮件吗？" );
GetMainWin().focus();

if ( !CG )
return false;
}

if ( isPopFolder && top.GetGlobalVarValue( "POP_PROPOSE" )) {
return ModelDialog( 1, "邮箱功能推荐", [
'<div id="pop_propose_setting"><div style="padding:10px;" class="txt_left">',
'<div style="margin-top:8px" class="bold">在',gMailtype,'邮箱中删除邮件，同时也删除原邮箱中的对应邮件?</div>',
'<div class="addrtitle" style="margin:4px 0 0 0;">您也可以进入“修改设置”中设置。',
'<a href="http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=26&&no=326" target="_blank" >了解详请</a></div>',
'</div>',
'<div style="margin:15px 7px 0;text-align:left;display:none"><input type="checkbox" id="folderall" name="folderall" checked/>',
'<label for="folderall">&nbsp;将此设置应用到所有"其它邮箱"</label></div>',
'<div class="txt_right" style="padding:26px 10px 5px;">',
'<button id="confirm" class="wd1 btn">确定</button>',
'<button id="cancel" class="wd1 btn">取消</button>',
'</div></div>',
'<div id="pop_propose_setting_ok" style="display:none;padding-top:50px;" >设置成功！并将当前选中邮件删除。</div>'
].join( "" ), "confirm", [ "confirm", "cancel" ], [
function() {
RunUrlWithSid( T( "/cgi-bin/foldermgr?fun=updpop&updflag=22&folderid=$folderid$" ).replace( {
folderid : GetDialogObj( "folderall" ).checked ? "all" : folderid
} ) );
Show( GetDialogObj( "pop_propose_setting" ), false );
Show( GetDialogObj( "pop_propose_setting_ok" ), true );
setTimeout( function() {
HideModelDialog();
}, 500 );
},
function() {
HideModelDialog();
} ], null,null,
function() {
RunUrlWithSid( "/cgi-bin/bubble_opr?fun=set&flag=80" );
SetGlobalVarValue( "POP_PROPOSE", false );
DelMailML( folderid, false, fun, true );
} );
}

frm.Fun.value = fun || "";
frm.mailaction.value = "mail_del";
frm.t.value   = "";
frm.action    = "/cgi-bin/mail_mgr";
SubmitToActionFrm( frm );

return true;
}
function SetListCheck( input, checked, mouseon ) {
if ( input.type != "checkbox" )
return;

if ( checked == null ) {
checked = input.checked;
}
else {
input.checked = checked;
}

var obj = input.parentNode.parentNode;

if ( obj.tagName == "TR" )
obj = obj.parentNode.parentNode;

var tmpClassName = obj.className;
if ( tmpClassName == "B" ) {
tmpClassName = checked ? "B" : "";
}
else {
tmpClassName = StrReplace( tmpClassName, " B", "" ) + ( checked ? " B" : "" );
}

SetClass( obj, tmpClassName );

if ( checked )
ListMouseOut.call( obj );
}
function DoCheck(e, t, isSelectMore) {
e = e ? e : event;
var obj = t ? t : ( e.srcElement || e.target );
var w = GetMainWin();
if ( !obj || !w )
return ;

if( obj.className == "one" || obj.className == "all" )
CA( obj );

SetListCheck( obj, null, true );


if ((e && e.shiftKey || isSelectMore) && w.gCurSelObj && w.gCurSelObj != obj && obj.checked == w.gCurSelObj.checked) {
var s = w.GelTags("input");
var c = 0;
var l = s.length;
for (var i = 0; i < l; i++) {
if (s[i].type != "checkbox")
continue;

if ((s[i] == w.gCurSelObj || s[i] == obj) && c++ == 1)
break;

if (c == 1)
SetListCheck(s[i], obj.checked);
}
}
w.gCurSelObj = obj;
}
function CheckAll( CBName ) {
var cbs = GelTags( "input" );
for ( var i = cbs.length - 1; i >= 0; i-- ) {
if ( cbs[i].name == CBName )
SetListCheck(cbs[i]);
}
}

var ReadedItem      = {};
ReadedItem.addItem  = function( checkbox ) {
if ( !GetMainWin().gMailItems )
GetMainWin().gMailItems = [];
GetMainWin().gMailItems.push( checkbox );
};
ReadedItem.getItems = function() {
return GetMainWin().gMailItems || [];
};
ReadedItem.save     = function( img ) {
GetMainWin().gReadedItemImg = img;
};
ReadedItem.load     = function() {
return GetMainWin().gReadedItemImg;
};
ReadedItem.disp     = function( item ) {
if ( !item )
return ;

var td   = item.type == "checkbox" ? item.parentNode : GelTags( "input", item )[ 0 ].parentNode;
var img  = td.firstChild;

if ( img.tagName != "IMG" ) {
InsertHTML( td, "afterBegin", T(
'<img src="$path$ico_grouplight.gif" class="showarrow" title="这是您最近阅读的一封邮件" />'
).replace( {
path: GetPath( "image" )
} ) );
img = td.firstChild;
}

Show( this.load(), false );
Show( img, true );

this.save( img );
};
ReadedItem.read     = function() {
if ( !this.load() )
return false;
GelTags( "table", this.load().parentNode.parentNode )[ 0 ].parentNode.onclick();
return true;
};
ReadedItem.check    = function( isCheckMore ) {
if ( !this.load() )
return false;

var checkbox = this.load().nextSibling;
checkbox.checked = !checkbox.checked;

DoCheck( null, checkbox, isCheckMore );
return true;
};
ReadedItem.move     = function( mode ) {
var items = this.getItems();
if ( items.length == 0 )
return false;

var pos = -1;
if ( this.load() != null ) {
var item = ReadedItem.load().nextSibling;
for ( var i = items.length - 1; i >= 0; i-- ) {
if ( item == items[ i ] ) {
pos = i;
break;
}
}
}

pos += mode ? 1 : -1;
if ( pos > -1 && pos < items.length ) {
this.disp( items[ pos ] );
ScrollIntoMidView( items[ pos ], GetMainWin().document.body, false );
return true;
}

return false;
};
function ModifyFolder(folderid, popacctid) {
GetMainWin().location.href="/cgi-bin/foldermgr?sid=" + GetSid() + "&fun=detailpop&t=pop_detail&folderid="+folderid + "&acctid=" + popacctid;
}
function RecvPopHidden( folderid ) {
GetMainWin().setTimeout( function() {
if ( !folderid ) {
top.ReloadFrmLeftMain( false, true );
}
else {
var id = "iframeRecvPopHidden";
if ( top.CreatePanel( GetMainWin(), id ) ) {
var url = [ "/cgi-bin/mail_list?sid=", GetSid(), "&folderid=", folderid, "&t=recv_pop_hidden",  ].join( "" );
try {
top.F( id, GetMainWin() ).location.replace( url );
}
catch ( e ) {
top.S( id, GetMainWin() ).src = url;
}
}
}
}, 10000 );
}
function RecvPop( popacctid, folderid ) {
RecvPop_creat( popacctid, folderid );
try {
Gel("tips").innerHTML="<img src='" + GetPath("image", true) + "ico_loading3.gif' align=absmiddle> 正在收取...&nbsp;系统将在后台自动收取，您可以离开此页面，稍后回来查看收取结果。";

RecvPopHidden( folderid );
}
catch(e) {
}
}
function RecvPop_creat(popacctid) {
GetActionWin().location = "/cgi-bin/foldermgr?sid=" + GetSid() + "&fun=recvpop&acctid=" + popacctid;
}
function RecvPopAll() {
GetActionWin().location = "/cgi-bin/foldermgr?sid=" + GetSid() + "&fun=recvpopall";
try{

setTimeout("ReloadFrmLeftMain(false,true)",3000);
}catch(e){}
}
function CheckReject() {
 var o=gd.getElementsByTagName("INPUT"),cnt=0;
 for(var i=0,len=o.length;i<len;i++){
  var t=o[i];
   if(t.type=="checkbox" && t.name =="mailid" && t.checked){
   return true;
   }
 }
 return false;
}
function ReportSpam() {
if ( !document.mail_frm && !CheckCheckBoxs() ) {
showError( msgNoMail );
return false;
}
var of = ""
if ( !document.mail_frm ) {
var at = GetCheckBoxsInfo();
if (at.length == 1) {
var ja = ["将&nbsp;", at[0][0]];
if ( at[0][0] != at[0][1] ) {
ja.push("&lt;");
var lk = 12;
if (at[0][1].length > lk) {
ja.push(at[0][1].substr(0, 12), "...");
} else {
ja.push(at[0][1]);
}
ja.push("&gt;");
} else {
ja.push("&nbsp;");
}
ja.push(" 加入黑名单");
of = ja.join("");
}
}
if ( !of ) {
of = "将发件人加入黑名单";
}

var xx = function( isOk ) {
( function() {
if ( !isOk )
return ;

var f = document.mail_frm || document.frm;
if ( !f )
return ;


f.s.value="readmail_spam";

f.isspam.value='true';
f.mailaction.value = "mail_spam";
f.action='/cgi-bin/mail_mgr';

var qm = GetDialogObj("frm_spamtype").reporttype;
for ( var i = 0; i < qm.length; i++ )
if( qm[ i ].checked ) {
f.reporttype.value = qm[ i ].value;
break;
}
var vt = GetDialogObj("frm_spamtype").refuse;
if ( vt && vt.checked ) {
f.s.value="readmail_reject";
}

SubmitToActionFrm( f );
} )();

HideModelDialog();
};

ModelDialog( 1, "举报并拒收选中邮件", [
"<div style='padding:10px 10px 0 25px;text-align:left;'>",
"<form id='frm_spamtype'>",
"<div style='margin:3px 0 3px 3px'><b>请选择要举报的垃圾类型：</b></div>",

"<div><input type=\"radio\" name=\"reporttype\" id=\"r8\" value=\"8\" checked><label for=\"r8\">其他邮件</label></div>",
"<div><input type=\"radio\" name=\"reporttype\" id=\"r4\" value=\"4\"><label for=\"r4\">广告邮件</label></div>",
"<div><input type=\"radio\" name=\"reporttype\" id=\"r1\" value=\"1\"><label for=\"r1\">欺诈邮件</label></div>",



"<div style=\"padding:5px 0 2px 0\"><input type=\"checkbox\" name=\"refuse\" id=\"refuse\"><label for=\"refuse\">", of, "</label></div>",
"</form>",
"</div><div style='padding:3px 15px 12px 10px;text-align:right;'>",
"<input type=button id='btn_ok' class='btn wd2' value=确定>",
"<input type=button id='btn_cancel' class='btn wd2' value=取消>",
"</div>" ].join( "" ),
"btn_cancel",
[ "btn_ok", "btn_cancel" ],
[ function() {
xx( true );
}, function() {
xx( false );
} ],"400px","190px");

return false;
}
function CBCount(sName) {
var o = GelTags("INPUT"), cnt = 0;
 for(var i = 0, len = o.length; i < len; i++ ) {
  var t=o[i];
  if ( t.type=="checkbox" && t.name == sName && t.checked )
++cnt;
 }
 return cnt;
}
function poperrdone(msg, mbtype, bHide, hidetime, poperr) {
if(msg != null)
{
fMessageBox(msg, mbtype, bHide, hidetime);
}
if(poperr != null)
GetMainWin().ShowPopErr(poperr);
Showsubmitbtn();
}
function Showsubmitbtn() {
if(GetMainWin().S("submitbtn"))
{
GetMainWin().S("submitbtn").disabled = false;
}
}
function Showpopsvr() {
Show( GetMainWin().S("popsvrTR"), true );
}
function SetTaskId(taskid) {
try{
GetMainWin().checkFrom.taskid.value = taskid;
}
catch(e){
}
}
function OnFldSelChg_ML(sel,frm,folderid) {
if(sel[sel.selectedIndex].value=="-2") {
sel.selectedIndex=0;
return;
}
frm.mailaction.value = "mail_move";
frm.destfolderid.value=sel[sel.selectedIndex].value;
if(frm.destfolderid.value == -1)  {
 var nameValue;
 while( (nameValue=prompt("请输入文件夹名字", "")) != null) {
   if(nameValue != "")
  break;
 }
 if(nameValue == null) {
   sel.selectedIndex=0;
  return false;
 }
frm.foldername.value=nameValue;
}

var o=gd.getElementsByTagName("INPUT"),cnt=0;
for(var i=0,len=o.length;i<len;i++){
var t=o[i];
if(t.type=="checkbox" && t.name == "mailid" && t.checked && t.getAttribute( "isendtime" ) == 1){
showError(msgSendMailNoMove);
return false;
}
}
sel.selectedIndex=0;
if(folderid==frm.destfolderid.value )  {
showError(msgMoveMailSameFldErr);
return false;
}
frm.action  = "/cgi-bin/mail_mgr?sid=" + GetSid();
SubmitToActionFrm(frm);
}

function SwitchOption() {
var res = [["<img src='"+ GetPath("image", true) +"ico_quickup.gif' align='absmiddle' alt='隐藏' />", true],["<img src='"+ GetPath("image", true) +"ico_quickdown.gif' align='absmiddle' alt='显示更多操作' />", false]][Gel("trOption").style.display=="none" ? 0 : 1];
S( "aSwitchOption" ).innerHTML = res[ 0 ];
Show( "trOption", res[ 1 ] );
}

function CheckPerDel() {
    if ( confirm( "彻底删除后此邮件将无法取回，您确定要删除吗？" ) )
DelMail( "PerDel" );
}
function DelMail( fun ) {
var f       = mail_frm;
f.action    = "/cgi-bin/mail_mgr?sid=" + GetSid();
f.Fun.value = fun;
f.mailaction.value = "mail_del";
f.t.value   = "";
f.s.value   = window.newwinflag ? "newwin" + "_" + fun : "";
SubmitToActionFrm( f );
}
function QuickSetStar(obj, mailid, bSet) {
if (!star_frm) return false;
if (obj) obj.id = "img_star";
if (mailid) star_frm.mailid.value = mailid;
star_frm.status.value = bSet ? "true" : "false";
star_frm.submit();
return false;
}
function SetMailFlag(frm, type, bIsStar, selObj) {
if (selObj != null) {
if (type == null) type = selObj.value;
if (bIsStar == null) bIsStar = type.indexOf("star") != -1;
if (bIsStar) type = type == "star";
selObj.selectedIndex = 0;
}
if (type == "-2") return;
frm.status.value = type;
frm.mailaction.value='mail_flag';
frm.flag.value = 'new';
if(bIsStar) frm.flag.value = "star";
frm.action='/cgi-bin/mail_mgr';
frm.submit();
}
function SetMailType(type, isspam, isgroup) {
var f = mail_frm;
f.action = "/cgi-bin/mail_mgr?sid=" + GetSid();
f.mailaction.value = "mail_spam";
var str = type == "cheat" ? "spam" : type;
f.s.value = "readmail_" + (isspam ? (isgroup ? "group" : type) : ("not" + type)) + (newwinflag ? "_newwin" : "");
f.isspam.value = isspam;
f.reporttype.value = type == "cheat" ? "1" : "";
SubmitToActionFrm(f);
}
function SetSpamMail( isspam, isgroup ) {
if ( isspam && !isgroup )
return ReportSpam();
SetMailType( "spam", isspam, isgroup );
}
function SetCheatMail( isspam, isgroup ) {
SetMailType( "cheat", isspam, isgroup );
}
function doReject(isspam, isgroup) {
if(confirm(msgRejectAlert))
SetMailType("reject", isspam, isgroup);
}
function MoveMail(obj) {
var dfid = obj.value;
obj.selectedIndex = 0;
if (dfid < 1 && dfid != -1) return ;
var f = mail_frm;
if(dfid == -1)  {
 var nameValue;
 while((nameValue=prompt("请输入文件夹名字", "")) != null){
   if(nameValue != "")  break;
 }
 if(nameValue == null){
obj.selectedIndex = 0;
return ;
 }
f.foldername.value=nameValue;
}
var sfid = (f.srcfolderid.value == 0 ? 1 : f.srcfolderid.value);
if(dfid == sfid) {
obj.selectedIndex = 0;
showError(msgMoveMailSameFldErr);
return ;
}
f.destfolderid.value = dfid;
f.mailaction.value = "mail_move";
f.s.value = ( newwinflag ? "newwin" : "" );
f.action = "/cgi-bin/mail_mgr?sid=" + GetSid();
SubmitToActionFrm(f);
}
function LinkMaker( str ) {
return str.replace( /(https?:\/\/[\w.]+[^ \f\n\r\t\v\"\\\<\>\[\]\u2100-\uFFFF]*)|([a-zA-Z_0-9.-]+@[a-zA-Z_0-9.-]+\.\w+)/ig, function( s, v1, v2 ) {
if ( v2 )
return [ '<a href="mailto:', v2, '">', v2, '</a>' ].join( "" );
else
return [ '<a href="', s, '">', s, '</a>' ].join( "" );
} );
}
function LinkIdentify( obj ) {
if ( !obj || obj.tagName == "A" || obj.tagName == "SCRIPT" ||
obj.tagName == "STYLE" || obj.className == "qqmailbgattach" )
return;

for ( var node = obj.firstChild, nextNode; node; node = nextNode ) {
nextNode = node.nextSibling;
LinkIdentify( node );
}

if ( obj.nodeType == 3 ) {
var str = obj.nodeValue.replace(/</g,"&lt;").replace(/>/g,"&gt;");
var code = LinkMaker( str );

if ( str != code ) {
var ok = false;

if ( obj.previousSibling )
ok = InsertHTML( obj.previousSibling, "afterEnd", code );
else
ok = InsertHTML( obj.parentNode, "afterBegin", code );

if ( ok )
RemoveSelf( obj );
}
}
}

function SwapLink( id, lQ ) {
var obj = S(id);
if (!obj) return;

LinkIdentify( obj );

var as = GelTags( "a", obj );
for ( var i = as.length - 1; i >= 0; i-- ) {
if (as[i].name != "_QQMail_ReferenceGroupMail_" &&
as[i].name != "_QQMail_DownloadGroupMailAttach_" &&
as[i].name != "qqplusa") {
as[i].target = "_blank";
as[i].onclick = function() {
return OpenExtLink.call( this, lQ );
};
}
}

var fs = GelTags( "form", obj );
for ( var i = fs.length - 1; i >= 0; i -- )
fs[ i ].onsubmit = function() {
if ( location.getParams()[ "filterflag" ] == "true" || this.action ) {
this.target = "_blank";
return true;
}
showError( T( [
'出于安全考虑该操作已被屏蔽 [<a onclick="',
'setTimeout( function() {',
'GoUrlMainFrm(\x27$url$&filterflag=true\x27);',
'showInfo(\x27取消屏蔽成功\x27);',
'});',
'" style="color:white;" >取消屏蔽</a>]'
] ).replace( {
url : location.href
} ) );
return false;
};
}
function ZoomImgToBody(obj, ajustValue, isInit) {
var objWidth = obj.getAttribute("ow");
if (!objWidth) {
objWidth = obj.width;
if (!objWidth || !isInit)
return;
obj.setAttribute("ow", objWidth);
}
objWidth = parseInt(objWidth);
var styles = ["点击查看实际尺寸", "zoom+.cur", "缩小图片到适应窗口", "zoom_.cur"];
try {
var bodyWidth = obj.ownerDocument.body.clientWidth - (ajustValue ? ajustValue : 80);
}
catch ( e ) {
return ;
}
if (objWidth > bodyWidth) {
obj.width = bodyWidth;
obj.style.cursor = GetPath("image") + styles[1];
obj.title = styles[0];
fAddEvent( obj, "click", function() {
this.width = parseInt(this.width) > bodyWidth ? bodyWidth : (this.getAttribute("ow"));
this.title = styles[parseInt(this.width) > bodyWidth ? 2 : 0];
this.style.cursor = GetPath("image") + styles[parseInt(this.width) > bodyWidth ? 3 : 1];
} );
}
else if (parseInt(obj.width) < objWidth) {
obj.width = objWidth;
obj.style.cursor = "default";
obj.title = "";
}
}
function openSpam(){
if( confirm( "此邮件的图片可能包含不安全信息，是否查看？" ) )
location.replace( location + "&disptype=html" );
}
function SwapImg( bb, yF, lQ ) {
var as = GelTags( "img", S( bb ) );
for (var i = 0; i < as.length; i++) {
if ( as[i].src ) {
ZoomImgToBody(as[i], yF);

as[i].onload = function() {
ZoomImgToBody(this, yF, true);
};


if ( lQ == "spam" )
fAddEvent( as[ i ], "click", openSpam );
}
}
}
function OpenExtLink( lQ )  {
var a = this;
if (a.href.indexOf("mailto:") == 0 && a.href.indexOf("@") != -1) {
window.open( [ "/cgi-bin/readtemplate?sid=", GetSid(), "&t=compose&s=cliwrite&newwin=true&email=",
a.href.split("mailto:")[1] ].join( "" ) );
return false;
}
else if (a.className == "qqmail_card_reply" || a.className == "qqmail_card_reply_btn") {
GetMainWin().location = ["/cgi-bin/cardlist?sid=", GetSid(),
"&t=compose_card&today_tips=", (a.className.indexOf("btn") != -1 ? "112" : "111"),
"&ListType=No", (a.name ?  "&email=" + a.name : ""),
top.bnewwin ? "&newwin=true" : ""].join("");
return false;
}

else if (a.className == "qqmail_birthcard_reply" || a.className == "qqmail_birthcard_reply_btn") {
GetMainWin().location = ["/cgi-bin/cardlist?sid=", GetSid(),
"&s=replybirthcard&t=compose_card&today_tips=", (a.className.indexOf("btn") != -1 ? "112" : "111"),
"&ListType=No", (a.name ?  "&email=" + a.name : ""),
top.bnewwin ? "&newwin=true" : ""].join("");
return false;
}
else if ( a.className == "qqmail_postcard_reply" ) {
GoUrlMainFrm( T(
'/cgi-bin/readtemplate?sid=$sid$&t=compose_postcard&email=$email$'
).replace( {
sid: GetSid(),
email: a.name
} ), false );
return false;
}
else if (a.className == "groupmail_open") {
GetMainWin().location = [ "/cgi-bin/grouplist?sid=", GetSid(), "&t=compose_group", ( top.bnewwin ? "&newwin=true" : "" ) ].join( "" );
return false;
}
else if (a.className == "reg_alias") {
GetMainWin().location = [ "/cgi-bin/readtemplate?reg_step=1&t=regalias_announce&sid=", GetSid() ].join( "" );
return false;
}

else if ( a.className == "comment_qqmail_link" ) {

GetMainWin().location = T(

'/cgi-bin/reader_detail?sid=$sid$&$param$' ).replace( {

sid: GetSid(),

param: a.getAttribute( "param" )
} );
return false;

}

if ( lQ == "spam" )
return confirm( '你将要打开不安全的链接，是否继续？' );

var str = "http://mail.qq.com/cgi-bin/feed?u=";
if (a.name == "_QQMAIL_QZONESIGN_" || a.href.indexOf(str) == 0) {
if (a.name == "_QQMAIL_QZONESIGN_") {
var dat = a.href.split("/");
var uin = parseInt(dat[2]);
var blog = parseInt(dat.pop());
var parm = ["&sid=", GetSid(), "&feedurl=http%3A%2F%2Ffeeds.qzone.qq.com%2Fcgi-bin%2Fcgi_rss_out%3Fuin%3D", uin].join("");
}
else {
var parm = ["&sid=", GetSid(), "&feedurl=", a.href.substr(str.length)].join("");
}
if (top.bnewwin) {
top.location = ["/cgi-bin/frame_html?target=rssswitch", parm].join("");
}
else {
GetMainWin().location = ["/cgi-bin/reader_switch?rssswitch=1", parm].join("");
}
return false;
}

return true;
}

function GoPrevOrNextMail(mode) {
var obj, win = GetMainWin();
if ( !!( obj = S( [ "prevmail", "nextmail" ][ mode ? 1 : 0 ], win ) ) && !obj.getAttribute( "disabled" ) ) {
win.location = obj.href;
}
else if ( !!( obj = S( [ "prevpage", "nextpage" ][ mode ? 1 : 0 ], win ) ) && !obj.getAttribute( "disabled" ) ) {
win.location = obj.href;
}
}
function GoBackHistory() {
var btn = SN("readmailBack",GetMainWin());
if ( btn.length > 0 && btn[0].style.display != "none" ) {
try {
btn[0].onclick();
return true;
}
catch(e) {
}
}
return false;
}

function QuickReadMail( obj, nofun ) {
var w = GetMainWin();
if ( obj == null ) {
if ( !ReadedItem.load() )
return false;
var checkbox = ReadedItem.load().nextSibling;
var item     = checkbox.parentNode.parentNode.parentNode.parentNode;
var tds      = GelTags( "td", GelTags( "table", item )[ 0 ] );
var obj      = tds[ tds.length - 1 ];
}
else {
var item     = obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
var checkbox = GelTags( "input", item )[ 0 ];
}
var next     = item.nextSibling;
var mailid   = checkbox.value;

if ( !next || !next.className || next.className.indexOf( "QRM" ) == -1 ) {
InsertHTML( item, "afterEnd", T( [
'<div class="qqshowbd QRM" style="height:244px;margin:4px 0;display:none;">',
'<div id="err_$id$" style="background:#ffffe9;padding:7px 0 5px 0;border-bottom:1px solid #e3e6eb;text-align:center;display:none">',
'邮件读取不成功， <a href="javascript:ReQuickReadMail(\'$id$\')">点击重试</a>。',
'</div>',
'<div id="load_$id$" style="background:#4b981d;color:#fff;padding:3px 8px;position:absolute;left:40%;margin-top:90px">',
'<img width="16px" height="16px" src="$path$ico_loading.gif" style="margin:0 3px 0 0;" align="absmiddle"/>',
'邮件正在读取中...',
'</div>',
'<iframe id="frame_$id$" frameborder=0 width=100% height=100% src="',
'/cgi-bin/readmail?mailid=$id$&t=quickreadmail$fun$&sid=$sid$$subt$',
'" onload="var o=S(\'load_$id$\');try{if(F(this.id).document.body.className==\'tbody\')Show(o,false);}catch(e){}if(IsShow(o)){Show(\'err_$id$\', 1);Show(o, 0);Show(o.nextSibling, 0);}"></iframe>',
'</div>'] ).replace( {
id   : mailid,
sid  : GetSid(),
path : GetPath("image"),
subt : window.g_subtmpl == "newmail_list" ? "&s=newmail_list" : "",
fun  : nofun ? "&nofun=1" : ""
} ) );
next = item.nextSibling;
}
else if ( obj.className == "pr2" && IsShow( S( "err_" + mailid, w ) ) ) {
ReQuickReadMail( id );
}

if ( w.gQRMOldObj && w.gQRMOldObj != checkbox ) {
var oldItem = w.gQRMOldObj.parentNode.parentNode.parentNode.parentNode;
Show( oldItem.nextSibling, false );

var tds = GelTags( "td", GelTags( "tr", GelTags( "table", oldItem  )[ 0 ] )[ 0 ] );
SetClass( tds[ tds.length - 1 ], "pr0" );

SetListCheck( w.gQRMOldObj, w.gQRMListSelectObj == w.gQRMOldObj );
}

ReadedItem.disp( item );
Show( next, !IsShow( next ) );
if ( IsShow( next ) )
ScrollIntoMidView( next, w.document.body );

SetClass( obj, IsShow( next ) ? "pr1" : "pr0" );

if ( w.gQRMListSelectObj != checkbox || IsShow( next ) ) {
w.gQRMListSelectObj = checkbox.checked ? checkbox : null;
SetListCheck( checkbox, IsShow( next ) );
}
w.gQRMOldObj = w.gQRMOldObj == checkbox ? null : checkbox;

return true;
}
function ReQuickReadMail( id ) {
var w = GetMainWin();
Show( S( "err_"   + id, w ), false );
Show( S( "frame_" + id, w ), false );
Show( S( "load_"  + id, w ), true  );
ReloadFrm( F( "frame_" + id, w ) );
}

function ReadMailFinish( id, type, fid, gid ) {
MailCache.addData( id );
var w = GetMainWin();

var loading = S( "load_" + id, w );
Show( loading, false );

var item, checkbox;
if ( loading ) {
item = loading.parentNode.previousSibling;
checkbox = GelTags( "input", item )[ 0 ];
}
else {
var bd = GelTags( "input", w.document );
for ( var i = 0, aw = bd.length; i < aw; i++ )
if ( bd[ i ].type == "checkbox" && bd[ i ].value == id && ( checkbox = bd[ i ] ) )
break;
}

if ( checkbox && GetMailListFlag( checkbox ) ) {
SetMailListFlag( checkbox, item, false );
SetMailListInfo( GetMailListInfo().unread - 1 );

if ( fid && parseInt( fid ) > 0 ) {
SetFolderUnread( fid, gid ? GetGroupUnread( "gall" ) : GetMailListInfo().unread );
}
else {
ReloadLeftWin();
}
}
}
function ScrollQuickReadedMail( bUp ) {
if ( !ReadedItem.load() )
return false;
var item = ReadedItem.load().parentNode.parentNode.parentNode.parentNode;
var next = item && item.nextSibling;
if ( !next || !next.className || next.className.indexOf( "QRM" ) == -1 || !IsShow( next ) )
return false;

try {
return F( GelTags( "iframe", next )[ 0 ].id, GetMainWin() ).ScrollPage( bUp );
}
catch( e ) {
return false;
}
}
function ListMouseMove() {
if ( this.className.indexOf( " B" ) == -1 && this.style.backgroundColor != "#f3f3f3" )
this.style.backgroundColor = "#f3f3f3";
}
function ListMouseOut() {
if ( this.style.backgroundColor != "" )
this.style.backgroundColor = "";
}
function ListMouseClick( e ) {
var target, e = e || event;
if ( !( target = e && ( e.target || e.srcElement ) ) )
return ;

if ( target.name == "mailid" )
return DoCheck( e );

if ( target.className.indexOf( "cir" ) == 0 ) {
var dh = GelTags( "table", target.parentNode.parentNode )[ 0 ].parentNode.onclick.toString().split("{")[1].split("}")[0].replace( /event/ig, "{shiftKey:true}" );
if (/\WRD/.test(dh)) {
return eval(dh);
} else {
dh = GelTags( "table", target.parentNode.parentNode )[ 0 ].parentNode.onclick.toString().replace(/.*{/g, "").replace(/}.*/g, "").replace( /event/ig, "{shiftKey:true}" );
return eval(dh);
}
}

if ( target.className.indexOf( "pr" ) == 0 ) {
QuickReadMail( target );
return fStopPropagation( e );
}

if ( target.className == "fg fs1" ) {
QuickSetStar( target, GelTags( "input", target.parentNode.parentNode.parentNode.parentNode.parentNode )[ 0 ].value, false );
return fStopPropagation( e );
}
}

ListCheckBoxTitle = "按住shift点击不同的勾选框 可方便快捷多选";

function ListInitForComm( mode ) {
var clsn = mode == "ft" ? "ft_file" : "M"
var list = GelTags( "div" );
for ( var i = list.length - 1; i >= 0; i-- ) {
var item = list[ i ];
if ( item.className != clsn )
continue;
if ( mode == "ft" )
item = GelTags( "table", item )[ 0 ];

var checkbox = GelTags( "input", item )[ 0 ];
if ( !checkbox || checkbox.type != "checkbox" )
continue;
checkbox.title = ListCheckBoxTitle;
fAddEvent( checkbox, "click", DoCheck );

item[ gIsIE ? "onmouseenter" : "onmousemove" ] = ListMouseMove;
item[ gIsIE ? "onmouseleave" : "onmouseout"  ] = ListMouseOut;
}
}

function ListInitForFT() {
ListInitForComm( "ft" );
}

function ListItemInitForMailList() {
var jP = GelTags( "table" );
var oq  = jP.length;

var cg   = jP[ oq - 2 ];
var Cx  = jP[ oq - 1 ];
var eP    = GelTags( "td", GelTags( "tr", Cx )[ 0 ] );

var qO  = GelTags( "input", cg )[ 0 ];
var iB = qO.value;

ReadedItem.addItem( qO );


if ( MailCache.hasData( iB ) ) {
var data = MailCache.getData( iB );
SetMailListFlag( qO, cg, false, data.reply );

if ( data.star != null ) {
SetClass( eP[ 1 ], data.star ? "fg fs1" : "fg" );
MailCache.addVar( "star", data.star ? 1 : -1 );
}
}

cg[ gIsIE ? "onmouseenter" : "onmousemove" ] = ListMouseMove;
cg[ gIsIE ? "onmouseleave" : "onmouseout"  ] = ListMouseOut;

if ( eP[ 1 ].className == "fg fs1" ) {
eP[ 1 ].title   = "点击图标取消待办邮件待办";
eP[ 1 ].onclick = ListMouseClick;
}
eP[ eP.length - 1 ].onclick = ListMouseClick;

fAddEvent( cg, "click",       ListMouseClick  );
fAddEvent( cg, "selectstart", fPreventDefault );

if ( top.gReadedMailId == iB ) {
ReadedItem.disp( cg );
RecordReadedMailId( null );
}
}
function MLI() {
ListItemInitForMailList();
}
function MLI_A() {
var jP = GelTags( "table" );
var oq  = jP.length;

var cg   = jP[ oq - 1 ];
var iB = cg.getAttribute( "mailid" );

if ( MailCache.hasData( iB ) )
SetClass( cg, "i M" );

cg[ gIsIE ? "onmouseenter" : "onmousemove" ] = ListMouseMove;
cg[ gIsIE ? "onmouseleave" : "onmouseout"  ] = ListMouseOut;

fAddEvent( cg, "selectstart", fPreventDefault );
}

var MailCache = {};
MailCache.isNeedNewCache= function( timeStamp ) {
return top.gMailListStamp != timeStamp;
};
MailCache.newCache= function( timeStamp ) {
top.gMailListStamp = timeStamp;
top.gMailListMap   = new top.Object;
};
MailCache.addData= function( mailid, params ) {
if ( !mailid || !top.gMailListMap )
return ;

if ( !this.hasData( mailid ) )
top.gMailListMap[ mailid ] = { star  : null, reply : null };

if ( !params )
return;

var map = top.gMailListMap[ mailid ];
for ( var i in map )
map[ i ] = params[ i ] == null ? map[ i ] : params[ i ];
};
MailCache.hasData= function( mailid ) {
return ( top.gMailListMap && top.gMailListMap[ mailid ] != null );
};
MailCache.getData= function( mailid ) {
return top.gMailListMap && top.gMailListMap[ mailid ];
};
MailCache.addVar= function( varName, value ) {
GetMainWin()[ varName ] = MailCache.getVar( varName, 0 ) + value;
return GetMainWin()[ varName ];
};
MailCache.getVar= function( varName, defVal ) {
return GetMainWin()[ varName ] || defVal;
};

var qmCache = function( ah ) {
var hv= this.hv= ah.timeStamp;
var hT= this.hT= ah.appName;

if ( !hv || !hT )
throw { message : "qmCache construct : config error!" };

var fJ = top.qmCache.fJ;
if ( !fJ )
fJ = top.qmCache.fJ = {};

var eF = fJ[ hT ];
if ( !eF )
eF = fJ[ hT ] = {
tA: "0",
aJ: {}
};

if ( this.wX( eF.tA, hv ) == 1 )
eF.tA = hv;
};

qmCache.prototype.isHistoryTimeStamp = function() {
return this.wX( top.qmCache.fJ[ this.hT ].tA,
this.hv ) != 0;
};

qmCache.prototype.setData = function( fq, bv ) {
top.qmCache.fJ[ this.hT ][ fq ] = bv;
};

qmCache.prototype.getData = function( fq ) {
return top.qmCache.fJ[ this.hT ][ fq ];
};

qmCache.prototype.delData = function( fq ) {
delete top.qmCache.fJ[ this.hT ][ fq ];
};

qmCache.prototype.wX = function( yQ, yR ) {
if ( yQ == yR )
return 0;
return yQ > yR ? -1 : 1;
};

function OptMailListFlag( checkbox, listitem, uflag, rflag ) {
if ( !( checkbox && checkbox.type == "checkbox" ) )
return false;

if ( uflag == null )
return checkbox.getAttribute( "unread" ) == "true";

if ( !listitem )
listitem = checkbox.parentNode.parentNode.parentNode.parentNode;

if ( ( checkbox.getAttribute( "unread" ) == "true" ) == !!uflag && !rflag )
return uflag;

var gid = checkbox.getAttribute( "gid" );
if ( gid ) {
SetGroupUnread( gid, GetGroupUnread( gid ) - 1 );
SetGroupUnread( "gall", GetGroupUnread( "gall" ) - 1 );
}

checkbox.setAttribute( "unread", uflag ? "true" : "false" );

SetClass( listitem, uflag ? "i F" : "i M" );
SetClass( GelTags( "table", listitem )[ 0 ], uflag ? "i bold" : "i" );


var iconObj = GelTags( "div", listitem )[ 1 ];
if ( iconObj.className.indexOf( "s1bg" ) == -1 ) {
var rf = rflag ? "r" : checkbox.getAttribute( "rf" );
var st = checkbox.getAttribute( "isendtime" );
var cs = "Rr";

if ( st ) {
cs = st == "0" ? "Rc" : "Ti";
}
else if ( uflag ) {
cs = "Ru";
}
else if ( rf ) {
cs = rf == "r" ? "Rh" : "Rz";
}

SetClass( iconObj, "cir " + cs );
}

return uflag;
}
function GetMailListFlag( checkbox ) {
return OptMailListFlag( checkbox );
}
function SetMailListFlag( checkbox, listitem, flag, rflag ) {
return OptMailListFlag( checkbox, listitem, flag, rflag );
}

function GetMailListInfo() {
var w = GetMainWin();
var ur_c = S( "_ur_c", w ), ui_c = S( "_ui_c", w );
return {
unread : ( ur_c && ur_c.innerHTML && parseInt( ur_c.innerHTML ) ) || 0,
star   : ( ui_c && ui_c.innerHTML && parseInt( ui_c.innerHTML ) ) || 0
};
}
function SetMailListInfo( unreadVal, starVal ) {
var w = GetMainWin(), ok = true;
var o = null, ur = S( "_ur", w ), ui = S( "_ui", w );
if ( !isNaN( unreadVal = parseInt( unreadVal ) ) ) {
if ( !!( o = S( "_ur_c", w ) ) ) {
o.innerHTML = unreadVal;
Show( ur, unreadVal != 0 );
}
else {
ok = false;
}
}
if ( !isNaN( starVal   = parseInt( starVal )   ) ) {
if ( !!( o = S( "_ui_c", w ) ) ) {
o.innerHTML = starVal;
Show( ui, starVal   != 0 );
}
else {
ok = false;
}
}
Show( S( "_uc", w ), IsShow( ur ) && IsShow( ui ) );
Show( S( "_ua", w ), IsShow( ur ) || IsShow( ui ) );
return ok;
}
function fIniAllKeyDow(e) {
var target = e.target ? e.target : e.srcElement;
if (e.ctrlKey)
{
if (e.altKey && e.keyCode == "68") {
MaximizeMainFrame(2);
fPreventDefault(e);
return false;
}
else if (e.keyCode == "37" || e.keyCode == "39") {
GoPrevOrNextMail(e.keyCode == "39");
fPreventDefault(e);
return false;
}
}
if (e.keyCode == "46") {
if (target.type != "text" && target.tagName != "TEXTAREA") {
var btn = S(e.shiftKey ? "quick_completelydel" : "quick_del", GetMainWin());
var btn2 = e.shiftKey ? S("quick_del", GetMainWin()) : null;
if (btn && btn.style.display != "none" || btn2 && btn2.style.display != "none") {
try{
(btn ? btn : btn2).onclick();
fPreventDefault(e);
return false;
}catch(e){}
}
}
}
if (e.keyCode == "8") {
if (target.type != "text" && target.tagName != "TEXTAREA" && GoBackHistory()) {
fPreventDefault(e);
return false;
}
}
if (e.keyCode == "13") {
if (target.type != "text" && target.tagName != "TEXTAREA" && ReadedItem.read() ) {
fPreventDefault(e);
return false;
}
}

if ( e.keyCode == "38" || e.keyCode == "40" ) {
if ( target.type != "text" && target.tagName != "TEXTAREA" ) {
if ( !e.ctrlKey && ScrollQuickReadedMail( e.keyCode == "38" ) ) {
fPreventDefault( e );
return false;
}
else if ( e.ctrlKey && ReadedItem.move( e.keyCode == "40" ) ) {
if ( GetMainWin().gQRMOldObj != null )
QuickReadMail();

fPreventDefault( e );
return false;
}
}
}

if ( e.keyCode == "188" || e.keyCode == "190" ) {
if ( target.type != "text" && target.tagName != "TEXTAREA" && ReadedItem.move( e.keyCode == "190" ) ) {
if ( GetMainWin().gQRMOldObj != null )
QuickReadMail();

fPreventDefault( e );
return false;
}
}
if ( e.keyCode == "32" || e.keyCode == "90" ) {
if ( target.type != "text" && target.tagName != "TEXTAREA" && QuickReadMail() ) {
fPreventDefault(e);
return false;
}
}
if ( e.keyCode == "88" ) {
if ( target.type != "text" && target.tagName != "TEXTAREA" && ReadedItem.check( e.shiftKey ) ) {
fPreventDefault(e);
return false;
}
}
}
function DayCtrl(oy,om,od){
var mlen = monthdaylen[om.value-1];
if( (oy.value%4==0&&oy.value%100!=0||oy.value%400==0) && om.value==2 )mlen++;
if(od.options.length>mlen) od.options.length=mlen;
for(var i=od.options.length;i<mlen;i++)
od.options[i] = new Option(i+1,i+1);
}
function makeTimeSelect(sname,label,vObj,attr){
var str;
str = "<SELECT name='"+sname+"' id='"+sname+"' value='' "+attr+" >";
for(k in vObj){
if ( k=="Extend")continue;
str += "<OPTION value='"+vObj[k]+"' >"+k+"</OPTION>";
}
str += "</SELECT> "+label;
return str;
}

function CheckDateTime(strDate) {
var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;
var para = strDate.match(reg);
if(para == null)
return false;
var time = new Date(para[1], para[3]-1, para[4]);
var strFeedback = time.getFullYear() + para[2] + (time.getMonth()+1) + para[2] + time.getDate();
return strFeedback == strDate;
}
function CheckMail(strmail) {
if (strmail=="") {
showError("添加的内容不能为空");
return false;
}
var reg = /^[\.a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
var para = strmail.match(reg);
if (para == null) {
showError("您输入的邮箱地址不正确，请重新输入");
return false;
}
return true;
}

function CheckAndSubmit(i) {
var strmail = Trim(S(i).value);
if(!CheckMail(strmail))
{
S(i).focus();
return false;
}
SubmitToActionFrm(S(i).form);
}

function CreatePanel( win, id, url, onloadEvent, style, className, bodyhtml ) {
if ( !id || !win )
return null;

var jr = S( id, win );
if ( !jr ) {
var gx = win.document.body;
InsertHTML( gx, "afterBegin", T ( [
'<iframe frameborder="0" scrolling="no" id="$id$" name="$id$" class="menu_base_if $className$" ',
'style="$style$" src="$url$" $event$ ></iframe>'] ).replace( {
id        : id,
className : className,
url       : url || "javascript:'';",
event     : onloadEvent ? [ 'onload="', onloadEvent, '"' ].join("") : '',
style     : style || "display:none;left:0;top:0;"
} ) );

jr        = S( id, win );

if ( !url && className ) {
var pL =  F( id, win ).document;
pL.open();
pL.writeln( T(
'<html><body class="$className$">$content$</body></html>' ).replace( {
className : id,
content   : bodyhtml
} ) );
pL.close();
}
}

return jr;
}

function fCalcPos(obj) {
var pos = [0, obj ? obj.offsetWidth : 0, obj ? obj.offsetHeight : 0, 0];
for (; obj;obj = obj.offsetParent) {
pos[3] += obj.offsetLeft;
pos[0] += obj.offsetTop - ( obj.offsetParent ? obj.scrollTop : 0 );
}
pos[1] += pos[3];
pos[2] += pos[0];
return pos;
}

function ShowPageMenu( obj, mid, iLeft, iTop, width, itemHeight, arrOpt, arrFun, fM, Bw ) {
ShowWebMenu( Bw || window, obj, mid, iLeft, iTop, width, itemHeight, arrOpt, arrFun, fM );
}
function ShowTopMenu( obj, mid, iLeft, iTop, width, itemHeight, arrOpt, arrFun, fM ) {
ShowWebMenu( top, obj, mid, iLeft, iTop, width, itemHeight, arrOpt, arrFun, fM );
}
function fWebMenuMouseOver(obj) {
SetClass( obj, "menu_item_high" );
}
function fWebMenuMouseOut(obj) {
SetClass( obj, "menu_item" );
}
function CreateWebMenu( obj, win, mid, width, itemHeight, arrOpt, arrFun, fM ) {
if (!obj || !win) return false;
var f =F(obj.id, win);
var d = S(mid, f);
if (!d && arrOpt != null) {
if (!S("qqmail_menu", f)) {
f.document.open();
f.document.writeln( T( [
"<body style='margin:0'>",
"<div id=qqmail_menu class=menu_base unselectable=on></div>",
"</body>",
"<head>",
"<link rel='stylesheet' type='text/css' href='$csspath$comm.css' />",
"<link rel='stylesheet' type='text/css' href='$csspath$skin$skin$.css' />",
"</head>"
] ).replace( {
csspath : GetPath("css", true),
skin    : GetPath("skin", true)
} ) );
f.document.close();
}
fAddEvent( f.document.body, "contextmenu", fPreventDefault );
fAddEvent( f.document.body, "dragstart", fPreventDefault );
fAddEvent( f.document.body, "selectstart", fPreventDefault );
d = f.document.createElement("div");
d.id = mid;
d.unselectable = "on";
d.innerHTML = '<div unselectable="on" style="overflow-y:auto;overflow-x:hidden;"></div>';
SetClass( d, "menu_bd bd" );

var wD = d.firstChild;

for (var i = 0; i < arrOpt.length; i ++) {
var item = f.document.createElement("div");
SetClass( item, arrFun[i] ? "menu_item" : "menu_item_nofun" );


item.style.height = itemHeight;
item.style.lineHeight = itemHeight;
item.unselectable = "on";
item.innerHTML = arrOpt[i];
if (arrFun[i]) {
item.onmouseover = function() {fWebMenuMouseOver(this);};
item.onmouseout = function() {fWebMenuMouseOut(this);};
fAddEvent(item, "click", arrFun[i]);
fAddEvent(item, "click", function(){fWebMenuMouseOut(this);HideWebMenu();});
}
wD.appendChild(item);
}

var Gf = wD.style.height =
( arrOpt.length > fM ? fM : arrOpt.length ) * parseInt(itemHeight);

var b = S("qqmail_menu", f);
b.innerHTML = "";
b.appendChild(d);
obj.style.width = parseInt(width) + 3;
obj.style.height = Gf + 11;
}
return true;
}
function ShowWebMenu( win, obj, mid, iLeft, iTop, width, itemHeight, arrOpt, arrFun, fM ) {
var baseObj = S( "qqmail_menu", win ) || CreatePanel( win, "qqmail_menu" );

if (top.gCurrentMenuObj && top.gCurrentMenuObj == obj)
return HideWebMenu();

HideWebMenu();
CreateWebMenu( baseObj, win, mid, width, itemHeight, arrOpt, arrFun, fM );

var height = parseInt( itemHeight ) * ( arrOpt.length > fM ? fM : arrOpt.length ) + 11;
var newTop = iTop - height - 20;
if ( newTop > 0 && iTop + height > win.document.body.scrollHeight )
iTop = newTop;

if ( iLeft != null )
baseObj.style.left = iLeft;
if ( iTop != null )
baseObj.style.top = iTop + 2;

Show( baseObj, true );
top.gCurrentMenuObj = obj;
top.gCurrentMenuWin = win;
}
function HideWebMenu() {
if (!top.gCurrentMenuWin) return;
var m = S("qqmail_menu", top.gCurrentMenuWin);
if (m) Show(m, 0);
top.gCurrentMenuObj = null;
top.gCurrentMenuWin = null;
}
function HideEditorMenu() {
if ( top.qmEditor )
top.qmEditor.hideEditorMenu();
}
function HideMenuEvent( e ) {
var obj = e.srcElement || e.target;
if ( !IsObjContainTarget( top.gCurrentMenuObj, obj ) )
HideWebMenu();

try {
top.QQPlusUI.HideMenuEvent( obj );
}
catch (e){
}
}



function ModelDialog( flag, title, content, focusId, arr_id, arr_fun, width, height, hideFunc ) {
var mask    = CreateMask( top );
var baseObj = S( "qqmail_dialog", top );
if ( !baseObj ) {
if ( flag == 0 )
return;
CreatePanel( top, "qqmail_dialog" );
baseObj = S( "qqmail_dialog", top );
}
PushToDialogList( "qqmail_dialog" );

if ( flag != 0 ) {
var tb = top.document.body;
width  = parseInt( width  || 400 );
height = parseInt( height || 163 );

baseObj.allowTransparency = "true";
baseObj.style.width  = ( width  + 5 ) + "px";
baseObj.style.height = ( height + 5 ) + "px";
baseObj.style.left   = ( tb.clientWidth  - width  ) / 2 + tb.scrollLeft;

var fY = ( tb.clientHeight - height ) / 2 + tb.scrollTop - 25;
baseObj.style.top    = fY < 2 ? 2 : fY;

CreateWebDialog( baseObj, top, flag, title, content, focusId, arr_id, arr_fun, width, height );
}


SetDialogEvent( mask, !flag, true );
Show( baseObj, flag );
Show( mask, flag );

setTimeout( function() {
HideWindowsElement( !flag );
}, 0 );

setTimeout( function() {
if( !flag )
return ;
try {
var f = F( baseObj.id, top );
f.focus();
if( !!( f = S( focusId, f ) ) )
f.focus();
}
catch( e ) {
}
}, 0 );

if ( flag == 0 ) {
top.gPageDialogMouseDown = false;
try { top.HideModelDialogEvent(); } catch( e ) {}
}

SetHideModelDialogEvent(hideFunc);
}
function SetHideModelDialogEvent(func) {
top.HideModelDialogEvent = func;
}
function HideModelDialog() {
ModelDialog(0);
}
function IsShowModelDialog() {
return IsShow( S( "qqmail_dialog", top ) );
}


function OpenDialog( id, url, bModel, width, height ) {
var mask = CreateMask( top );
var baseObj = S( id, top );

if ( !baseObj ) {
CreatePanel( top, id, url );
baseObj = S( id, top );
PushToDialogList(id);
}
else {
if ( IsNonModelDialogMinimize( id ) ) {
MaximizeDialog( id );
return baseObj;
}

baseObj.className += " bd";
baseObj.contentWindow.location.replace( url + "&r="+ Math.random() );
}

var tb = top.document.body;
baseObj.allowTransparency = "true";
baseObj.style.width  = ( parseInt( width  || 403 ) + 5 ) + "px";
baseObj.style.height = ( parseInt( height || 390 ) + 5 ) + "px";
baseObj.style.left   = (tb.clientWidth - parseInt(baseObj.style.width)) / 2 + tb.scrollLeft;

var fY = (tb.clientHeight - parseInt(baseObj.style.height)) / 2 + tb.scrollTop - 30;
baseObj.style.top    = fY < 2 ? 2 : fY;

if ( baseObj.style.top < 0 )
baseObj.style.top = 0;

top.gCurrentShowNonModelDialogId = id;

SetDialogEvent( mask, false, bModel );
Show( baseObj, 1 );
Show( mask,    1 );

setTimeout( function(){
HideWindowsElement(false);
}, 0);

return baseObj;
}
function CloseDialog() {
if ( window != top )
return top.CloseDialog();

if ( !top.gCurrentShowNonModelDialogId )
return;

var mask    = S( "qqmail_mask", top );
var baseObj = S( top.gCurrentShowNonModelDialogId, top );
if ( !baseObj )
return;

RemoveSelf( baseObj );
Show( mask, 0 );
SetDialogEvent( mask, true );

top.gPageDialogMouseDown         = false;
top.gCurrentShowNonModelDialogId = null;
top.setTimeout( "HideWindowsElement( true )", 0);
}
function IsNonModelDialogMinimize(id) {
var o = S( id + "_min", GetTopWin() );
return o ? ( o.style.display == "" ? true : false ) : false;
}
function MaximizeDialog(id, bNoAnimation) {
if ( !id )
return;

var baseObj = S(id, top);
if ( !baseObj )
return;

var minObj   = S(id + "_min", GetTopWin());
bNoAnimation = minObj ? bNoAnimation : true;

if (!bNoAnimation) {
var pos = fCalcPos(minObj);
var params = {};
params.descLeft = baseObj.style.left;
params.descTop = baseObj.style.top;
params.descWidth = baseObj.style.width;
params.descHeight = baseObj.style.height;
params.orgLeft = pos[1] - 60;
params.orgTop = pos[0];
params.orgWidth = 40;
params.orgHeight = 18;
}

var mask = S("qqmail_mask", top);
Show(mask, 1);
SetDialogEvent(mask, false, false);

top.gCurrentShowNonModelDialogId = id;

if ( minObj )
Show( minObj, false );

if (!bNoAnimation) {
Animation(baseObj, params, 100, function() {
Show(baseObj, true);
});
}
else {
Show(baseObj, 1);
}
setTimeout(function(){
HideWindowsElement(false);
}, 0);
}
function MinimizeDialog() {
var mc = S( "minimize_container", GetTopWin() );
if ( !top.gCurrentShowNonModelDialogId || !mc )
return;

var baseObj = S( top.gCurrentShowNonModelDialogId, top );
if ( !baseObj )
return;

var mask = S("qqmail_mask", top);
Show(mask, 0);
SetDialogEvent(mask, true);

Show(baseObj, 0);
top.gCurrentShowNonModelDialogId = null;

var minId = baseObj.id + "_min";
var min = S(minId, GetTopWin());
if (!min) {
InsertHTML(mc, "beforeEnd",
['<span id="', minId, '"><a onclick="top.MaximizeDialog(\'', baseObj.id, '\')">',
S("dialog_title", F(baseObj.id, top)).innerHTML,
'</a>&nbsp;&nbsp;|&nbsp;&nbsp;'].join(""));
min = S(minId, GetTopWin());
}
Show(min, true);

var pos = fCalcPos(min);
var params = {
orgLeft:baseObj.style.left,
orgTop:baseObj.style.top,
orgWidth:baseObj.style.width,
orgHeight:baseObj.style.height,
descLeft:pos[1] - 60,
descTop:pos[0],
descWidth:40,
descHeight:18
};

var objPos = [baseObj.style.left, baseObj.style.top, baseObj.style.width, baseObj.style.height];
var pos = fCalcPos(mc);

setTimeout(function(){HideWindowsElement(true);}, 0);

return Animation(baseObj, params, 100);
}

function IsModelDialogShow(id) {
var baseObj = S("qqmail_dialog", top);
if (baseObj && baseObj.style.display != "none")
return id ? (S(id, F("qqmail_dialog", top)) ? true : false) : true;
return false;
}
function IsDialogShow(id) {
var baseObj = S( top.gCurrentShowNonModelDialogId ? top.gCurrentShowNonModelDialogId : "qqmail_dialog", top );
if ( baseObj && baseObj.style.display != "none" )
return id ? (S(id, F(baseObj.id, top)) ? true : false) : true;
return false;
}
function GetDialogObj( bb ) {
var ea = GetDialogWin();
return ea ? S( bb, ea ) : null;
}
function GetDialogWin() {
var baseObj = S( top.gCurrentShowNonModelDialogId || "qqmail_dialog", top );
return baseObj ? F( baseObj.id, top ) : null;
}

function PushToDialogList(id) {
if (!top.dialog_list)
top.dialog_list = new top.Object;
if (!id)
return;
top.dialog_list[id] = true;
}
function SetDialogEvent( mask, bRemove, bModel) {
fAddEvent( top.document, "mousemove", top.fOnDialogMove,    bRemove );
fAddEvent( top.document, "mouseup",   top.fOnDialogMouseUp, bRemove );
if ( mask ) {
fAddEvent( mask, "mousedown", top.HighLightDialog,       bRemove );
fAddEvent( mask, "keydown",   top.DialogKeyEventProcess, bRemove );
}
}
function DialogKeyEventProcess( e ) {
if ( e && e.keyCode == 27 ) {
CloseDialog();
HideModelDialog();

fPreventDefault( e );
}
}
function HighLightDialog() {
if ( top.gCurrentDialogInterval )
clearInterval(top.gCurrentDialogInterval);
if ( IsDialogShow() ) {
var times = 1;
top.gCurrentDialogInterval = setInterval(function(){
var t = GetDialogObj("editor_dialog_titlebar");
var t1 = GetDialogObj("no_move");

SetClass( t, "editor_dialog_titlebar " + (times % 2 ? "toolbg" : "fdbody") );
SetClass( t1, times % 2 ? "" : "fdbody" );

if (times == 4 || !IsDialogShow())
return clearInterval(top.gCurrentDialogInterval);
times ++;
}, 50);
}
}
function CreateMask( win ) {
win = win || top;
var id = "qqmail_mask";
var mask = S(id, win);
if (!mask) {
InsertHTML(win.document.body, "afterBegin",
['<div id="', id, '" class="editor_mask" style="display:none;" onkeypress="return false;" onkeydown="return false;" tabindex="0"></div>'].join(""));
mask = S( id, win );
}
return mask;
}
function CreateWebDialog( obj, win, flag, title, content, focusIn, arr_id, arr_fun, width, height ) {
if (!obj || !win)
return false;

var f = F(obj.id, win);
if ( !S( "dialog_base", f ) ) {
f.document.open();
f.document.writeln( T( [
"<body class='tipbg' onmousedown='return false;' >",
"<div id='opashow' class='opashow' style='width:$width$;height:$height$;position:absolute;'></div>",
"<table class='bd_upload' cellspacing='0' cellpadding='0' style='width:$width$px;height:$height$px;background:white;' >",
"<tr><td id='editor_dialog_titlebar' class='fdbody' style='height:28px;border:none;background-image:none;cursor:move;overflow:hidden;' unselectable='on' onselectstart='return false;' >",
"<div class='fdbody' style='cursor:default;float:right;width:40px;border:none;background-image:none;' id='no_move'>",
"<div id='editor_close' class='editor_close' onmouseover='this.className=\"editor_close_mover\";' onmouseout='this.className=\"editor_close\";'>",
"<img src='$imgpath$ico_closetip.gif' width='12' height='12' ondragstart='return false;'>",
"</div>",
"</div>",
"<div class='editor_dialog_title' id='dialog_title' unselectable='on' ></div>",
"</td></tr>",
"<tr><td id='dialog_content' class='editor_dialog_content mailinfo' style='border:none;height:99%;' unselectable='on' onselectstart='return false;' valign='top'>",
"</td></tr>",
"</table>",
"</body>",
"<head>",
"<link rel='stylesheet' type='text/css' href='$csspath$comm.css' />",
"<link rel='stylesheet' type='text/css' href='$csspath$skin$skin$.css' />",
"</head>"
] ).replace( {
csspath : GetPath("css", true),
skin    : GetPath("skin"),
imgpath : GetPath("image", true),
width   : width,
height  : height
} ) );
f.document.close();

fAddEvent( f.document.body, "contextmenu", top.fPreventDefault );
fAddEvent( f.document.body, "dragstart",   top.fPreventDefault);
fAddEvent( f.document.body, "selectstart", top.fPreventDefault);

fAddEvent( S( "editor_close", f ), "click", top.HideModelDialog );
fAddEvent( S( "editor_dialog_titlebar", f ), "mousedown", top.fOnDialogMouseDown );
fAddEvent( S( "editor_dialog_titlebar", f ), "mouseup",   top.fOnDialogMouseUp );
fAddEvent( f.document, "mousemove", top.fOnDialogMove );
fAddEvent( f.document, "keydown",   top.DialogKeyEventProcess );

InitPageEvent( f );
}

S( "dialog_content", f ).innerHTML = flag ? content : "";
S( "dialog_title",   f ).innerHTML = flag ? title   : "";

if ( !arr_id || !arr_fun )
return;

for ( var i = arr_id.length - 1; i >= 0; i-- ) {
var o = S( arr_id[ i ], f );
if ( o && arr_fun[i] )
fAddEvent( o, "click", arr_fun[ i ] );
}
}
function fOnDialogMouseDown(e) {
if ( ( e.target ? e.target : e.srcElement ).id == "no_move" )
{
return;
}
top.gPageCursorOldX = e.screenX;
top.gPageCursorOldY = e.screenY;
top.gPageDialogMouseDown = true;
return false;
}
function fOnDialogMouseUp(e) {
top.gPageDialogMouseDown = false;
}
function fOnDialogMove(e) {
if( top.gPageDialogMouseDown ) {
var o = S( top.gCurrentShowNonModelDialogId || "qqmail_dialog", top );
if( o ) {
o.style.left = parseInt( o.style.left ) + e.screenX - top.gPageCursorOldX;
o.style.top  = parseInt( o.style.top  ) + e.screenY - top.gPageCursorOldY;
top.gPageCursorOldX = e.screenX;
top.gPageCursorOldY = e.screenY;
}
}
}

function Animation(obj, params, time, callbackFun) {
if (!obj)
return;

var curVal = [parseInt(params.orgLeft), parseInt(params.orgTop), parseInt(params.orgWidth), parseInt(params.orgHeight)];
var range = ["left", "top", "width", "height"];
var rangeLen = range.length;
var interval = 10;

try {
var objDoc = obj.ownerDocument;
var animationObj = objDoc.getElementById(obj.id + "_animation");
if (!animationObj)
{
animationObj = objDoc.createElement("div");
animationObj.id = obj.id + "_animation";
animationObj.style.position = "absolute";
obj.parentNode.appendChild(animationObj);
}
animationObj.className = "bd_upload";
animationObj.style.borderWidth = "2px";
animationObj.style.zIndex = obj.style.zIndex;
animationObj.style.display = "block";
for (var i = 0; i < rangeLen; i++)
animationObj.style[range[i]] = curVal[i] + "px";

}
catch (e) {

if (callbackFun) {
try{callbackFun();}catch(e){}
}
return;
}

time = (time && time > 150 ? time : 150) / interval;
var step = [
  parseInt((params.descLeft != null ? parseInt(params.descLeft) - curVal[0] : 0) / time)
, parseInt((params.descTop != null ? parseInt(params.descTop) - curVal[1] : 0) / time)
, parseInt((params.descWidth != null ? parseInt(params.descWidth) - curVal[2] : 0) / time)
, parseInt((params.descHeight != null ? parseInt(params.descHeight) - curVal[3] : 0) / time)
];

var t = 0;
var func = function() {
if (++t > time) {
Show(animationObj, false);
if (callbackFun) {
try{callbackFun();}catch(e){}
}
return ;
}
try {
for (var i = 0; i < 4; i++) {
curVal[i] = PositiveNumber(curVal[i] + step[i]);
animationObj.style[range[i]] = curVal[i] + "px";
}
}
catch (e) {
}
setTimeout(func, interval);
};
setTimeout(func, interval);
}
function PositiveNumber(val) {
return val >= 0 ? val : 0;
}


var History = {
au : {






},
cj : {






}
};
History.getId = function( aH ) {
return aH;
};
History.getUrl = function( aH ) {
var eF = top.History.cj[ History.getId( aH ) ];
return eF && eF.ad;
};
History.getLastRecordId = function( id ) {
return top.History.au.EK;
}
History.tryBackTo = function( id ) {
var au= top.History.au;
var nQ= History.getId( id );
var jp= top.History.cj[ nQ ];
var AX= jp && jp.ad;
var wZ= jp && jp.Gp >= top.history.length;
var xa= jp && au.Hi == AX;
var IU = jp && !au.HY;


if ( gIsIE && ( wZ || xa ) ) {
top.history.go( AX.split( "#" ).join( "" ) );

return true;
}


if ( !gIsSafari && wZ && xa && IU ) {
top.history.back();
return true;
}

return false;
};
History.su = function( bb, ad ) {
var nQ= History.getId( bb );
var cj= top.History.cj;
var eF= cj[ nQ ];
if ( !eF )
eF = cj[ nQ ] = new top.Object;

eF.Gp= history.length + 1;
eF.ad= ad;

top.History.au.EK= bb;
};
History.recordCurrentUrl = function( df ) {
var ad= df.location.href;
var cj= top.History.cj;
var au= top.History.au;

var Hd= au.Hi = au.Jj;
var FK= au.Jj = ad;

var eb, wx;


for ( var i in cj ) {
if ( cj[ i ].ad == Hd )
eb = i;
if ( cj[ i ].ad == FK )
wx = i;
}


if ( eb && wx )
delete cj[ eb ];


if ( ad.indexOf( "/mail_list" ) != -1 )
this.su( "mail_list", ad );

if ( ad.indexOf( "t=readmail" ) != -1 )
this.su( "readmail", ad );

if ( ad.indexOf( "/today" ) != -1 )
this.su( "today", ad );
};
History.recordActionFrameChange = function( mode ) {
top.History.au.HY = mode != "clear";
};

function DebugCreater( methodType ) {
return function() {
var rl = arguments.length;
if ( rl > 2 && typeof( arguments[ rl - 1 ] ) == "number" && arguments[ rl - 1 ] != top.g_uin )
return ;

if ( top.Console ) {
try {
var wp = top.Console[ methodType ];
wp.add.apply( wp, arguments );
}
catch(e) {
}
}
}
}

function OnError( msg, url, line ) {
try {
var wP= "/cgi-bin/getinvestigate?stat=js_run_err&msg=";
var sP= arguments.callee.caller;
var sL= sP && sP.caller;
var Gw= sL && sL.caller;
var xm= ( sP || "null" ).toString();
var xj= ( sL || "null" ).toString();
var xk= ( Gw || "null" ).toString();


if ( !( url && url.indexOf( "/cgi-bin/mail_list?" ) != -1 && line == "2" ) )
top.RunUrlWithSid( [ wP, msg, "&line=", line, "&url=", encodeURIComponent( url ),
"&func=", encodeURIComponent( xm.replace( /[\r\n\t ]/ig, "" ).substr( 0, 50 ) ) ].join( "" ) );

top.Debug( [ "error:", msg, "<br><b>line</b>:", line, "<br><b>url</b>:", url, "<br><b>function</b>:", xm.substr( 0, 100 ), xj ? "<br><b>parent function</b>:" + xj.substr( 0, 100 ) : "", xk ? "<br><b>parent parent function</b>:" + xk.substr( 0, 100 ) : "" ].join( "" ) , "error" );
}
catch( e ) {
alert( e.message );
( new Image() ).src = [ wP, msg, "&line=", line, "&url=", encodeURIComponent( url ), "&func=", e.message ].join( "" );
}

return true;
}

function FA( df ) {
if ( df.location.getParams )
return ;
df.location.params    = {};
df.location.getParams= function(){
var cD = {};
var fk = ( arguments.length > 0 ? arguments[0].substr( arguments[0].indexOf( "?" )*1+1 ) : this.search.substr( 1 ) );
if ( fk != null && fk != "" ) {
var hE = fk.split("&");
for ( var i = 0 ; i < hE.length ; i++ ) {
var ey = hE[i].split("=");
cD[ ey[0] ] = unescape( ey.slice(1).join("=") );
}
if ( arguments.length > 0 ) {
return cD;
}
else {
this.params = cD;
}
}
return cD;
};
}


function Jl( win ) {
win.Debug   = win.debug = DebugCreater( "debug" );
win.Log     = win.log   = DebugCreater( "log"   );
win.Watch   = win.watch = DebugCreater( "watch" );
win.onerror = OnError;

win.Trace   = win.trace = function( name, desc, mode, project, uin ) {
if ( top.timeTracer && ( !uin || uin == top.g_uin ) )
top.timeTracer.getTracer().trace( name, desc, win, mode, project );
};


if ( win != top && win == GetMainWin() ) {
History.recordCurrentUrl( win );
History.recordActionFrameChange( "clear" );

fAddEvent( win, "unload", function() {

if ( IsShowMsg() && top.msgDispTime && ( new Date() ) - top.msgDispTime > 2000 ) {
HiddenMsg();
}
else {
ShowProcess( 0 );
}
} );
}



if ( win == top && top.location.href.indexOf("/frame_html") != -1 ) {
fAddEvent(win, "load", function(e) {
var b = top.document.body;
fAddEvent( b, "mousewheel", function(e) {
if ( ( e.target || e.srcElement ) == b )
fPreventDefault(e);
} );

if ( gIsIE ) {

E( GelTags( "a" , top.document.body ), function( obj ) {
fAddEvent( obj, "mousedown", function( e ) {
obj.setAttribute( "md", "true" );
setTimeout( function(){ obj.setAttribute( "md", "false" ) }, 1000 );
} );
var tempFunc = obj.onclick;
obj.onclick = function() {};
fAddEvent( obj, "click", function( e ) {
if ( obj.getAttribute( "md" ) != "true" ) {
fPreventDefault( e );
}
else if ( tempFunc ) {
tempFunc.call( obj, e );
}
} );
});
}
});
}
}
function HX( win ) {
try {
fAddEvent( win.document, "mousedown", HideMenuEvent );
fAddEvent( win.document, "click",     HideEditorMenu );
fAddEvent( win.document, "keydown",   fIniAllKeyDow );
}
catch( e ) {

return ;
}

if ( GetMainWin() == win && win != top )
E( [ "/mail_list?", "t=readmail", "t=note_first_page",
"/addr_listall?", "/cgi-bin/read_multilist", "/cgi-bin/reader_"], function( key ) {
var gA = win.location.href;
if ( key && gA.indexOf( key ) != -1 && gA.indexOf( "t=compose" ) == -1 )
win.focus();
} );
}
var InitPageEvent = ( function( win ) {
try {
win = win || window;

if ( !win.gIsInitPageEventProcess ) {
win.gIsInitPageEventProcess = true;

try {
Jl( win );
FA( win );
}
catch( e ) {
OnError( e.message, ( win || window ).location.href, "InitPageEventProcess" );
}

setTimeout( function() {
HX( win );
}, 100 );
}
}
catch( e ) {
debug( "InitPageEvent err:" + e.message );
}

return arguments.callee;
} )();

function HideWindowsElement( bShow, win ) {

win = win || GetMainWin();
if ( !gIsIE || ( win.gHasHideElements || false ) != ( bShow || false ) )
return;

win.gHasHideElements = !bShow;

var swaps = [ "select", "object", "embed" ];
for (var i = swaps.length - 1; i >= 0; i--) {
var objs = GelTags( swaps[i], win.document.body );
for ( var j = objs.length - 1; j >= 0; j-- ) {
var an = objs[ j ];
try {
if ( bShow ) {
an.style.visibility  = an.getAttribute( "savevisibility" );
}
else {
an.setAttribute( "savevisibility", an.style.visibility );
an.style.visibility = "hidden";
}
}
catch( e ) {
}
}
}
}

function FormatAddr(value) {
if(!value || value.length <=0) return "";

var addrs = value.replace(/,/g, ";").split(";");
var map = {},result = [],mkey,key;
for(var i=0,len=addrs.length; i<len; i++)
{
key = addrs[i];
mkey = key.replace(/ /ig, "");
if(mkey !="" && map[mkey] == null)
{
key = key.replace(/\\\"/ig, "<Q>").split("\"");
var keyLen = key.length;
if (keyLen > 3)
{
key.splice(1, keyLen - 2, key.slice(1, keyLen - 1).join("\\\""));
}
result.push(key.join("\"").replace(/<Q>/g, "\\\""));
map[mkey] = 1;
}
}
if (result.length > 0)
{
result.push(" ");
}

return result.join(";");
}
function CheckPopMailShow(str) {
var a = ["@126.com","@163.com","@yahoo.com.cn","@sina.com","@gmail.com","@tom.com","@yeah.net"];
var n = str.toLowerCase();
for(var i=0;i<a.length;i++){if(n.indexOf(a[i])>=0) return true;}
return false;
}
function SetBeforeUnloadCheck(win, msg, focusObj, exceptObjs, container) {
win = win ? win : window;
container = container ? (typeof(container) == "string" ? S(container, win) : container) : win.document;
win.IsBeforeUnloadCheck = true;
var list = ["input", "select", "textarea"];
for (var i = 0, len = list.length; i < len; i++)
{
var name = list[i] + "_save";
win[name] = [];
var tags = GelTags(list[i], container);
for (var j = 0, jlen = tags.length; j < jlen; j++)
{
win[name].push(tags[j].value + tags[j].checked);
tags[j].setAttribute("saveid", j);
}
}
if (!win.onsetbeforeunloadcheck)
{
win.onsetbeforeunloadcheck = function()
{
if (win.IsBeforeUnloadCheck)
{
for (var i = 0, len = list.length; i < len; i++)
{
var name = list[i] + "_save";
var tags = GelTags(list[i], container);
for (var j = 0, jlen = tags.length; j < jlen; j++)
{
var saveid = tags[j].getAttribute("saveid");
if (saveid != null && win[name][saveid] != (tags[j].value + tags[j].checked))
{

return msg ? msg : "您修改的设置尚未保存，确定要离开吗？";
}
}
}
}
};
if (gIsIE)
{
win.document.body.onbeforeunload = function(){return win.onsetbeforeunloadcheck();};
}
else
{
win.document.body.setAttribute("onbeforeunload", "return onsetbeforeunloadcheck();");
}
}
if (!exceptObjs)
{
exceptObjs = ["cancel"];
}
for (var i = 0, len = exceptObjs.length; i < len; i++)
{
var obj = exceptObjs[i];
obj = typeof(obj) == "string" ? S(obj, win) : obj;
fAddEvent(obj, "mousedown", function(){win.IsBeforeUnloadCheck = false;});
}
var f = GelTags("form", win.document);
for (var i = 0, len = f.length; i < len; i++)
{
fAddEvent(f[i], "submit", function(){win.IsBeforeUnloadCheck = false;});
if (!f[i].vF)
{
f[i].vF = f[i].submit;
f[i].submit = function()
{
win.IsBeforeUnloadCheck = false;
this.vF();
};
}
}
}
function GenQzoneSign(sTitle, sLink, sAbstract, sPicLink) {
var Cd= [
'<img src="', sPicLink, '" style="width:60px;float:left;margin:10px 7px 7px 7px;*margin:10px 3px 7px 7px;"/>' ].join( "" );
var Ip= T( [
'<a style="color:blue" name="_QQMAIL_QZONESIGN_" href="%slink%" target="_blank" >',
'%stitle%',
'</a>' ], "%" ).replace( { slink : sLink, stitle: sTitle } );

return T( [
'<div name="qzone" style="background:url(%picurl%) right bottom no-repeat #fff;width:339px;border:1px solid #a7c5e2;font-size:12px;margin-top:6px;padding:1px 1px 0 1px;line-height:19px;">',
'<div style="background:#eff5fb;padding:2px 7px;;">我的QQ空间</div>',
'%spiclink%',
'<div style="padding:7px;float:none;*float:left;word-wrap:word-break;word-break:break-all;">',
'%slink%',
'<div style="color:#666;line-height:16px;margin-top:4px;word-wrap:word-break;word-break:break-all;">%sabstract%</div>',
'</div>',
'<span style="clear:both;height:1px;overflow:hidden;display:block;margin:0;padding:0;"></span>',
'</div>'
], "%" ).replace( {
spiclink: sPicLink ? Cd : "",
slink: sLink? Ip : sTitle,
sabstract: sAbstract,
picurl: (location.protocol == "https:") ? 'https://res.mail.qq.com/zh_CN/htmledition/images/qzone_bg.gif' : 'http://res.mail.qq.com/zh_CN/htmledition/images/qzone_bg.gif'
} );
}
function GenTaotaoSign( sUin ) {
var ad = T( "http://www.taotao.com/res/tt_mail.swf?qq=$uin$" ).replace( { uin: sUin } );
ad= GenerateFlashCode( null, ad, {
width  : 481,
height : 66
}, {
wmode  : "opaque"
} );
ad = "<div name=\"taotao\">"+ad+"</div>";
return ad;
}
function ftSendStatic( code, uin ) {
if( typeof( code ) == "undefined" )
return false;

RunUrlWithSid( T( "/cgi-bin/getinvestigate?stat=exskick&sid=$sid$&uin=$uin$&log=$code$" ).replace( {
uin: uin || top.g_uin,
sid: GetSid(),
code: code
} ) );
}

var FileType  = {};
FileType.data = {
doc  : "doc",
docx : "doc",

xls  : "exl",
xlsx : "exl",

ppt  : "ppt",
pptx : "ppt",

pdf : "pdf",

txt  : "txt",
log  : "txt",
xml  : "txt",
js   : "txt",
css  : "txt",
php  : "txt",
asp  : "txt",
aspx : "txt",
jsp  : "txt",
vbs  : "txt",
h    : "txt",
cpp  : "txt",

eml  : "eml",

rar  : "rar",
zip  : "rar",
"7z" : "rar",
arj  : "rar",

wav : "mov",
mp3  : "mov",
wma : "mov",
mid  : "mov",
rmi  : "mov",
ra   : "mov",
ram  : "mov",

mp1  : "mov",
mp2  : "mov",
mp4 : "mov",
rm : "mov",
rmvb : "mov",
avi : "mov",
mov  : "mov",
qt   : "mov",
mpg  : "mov",
mpeg : "mov",
mpeg4: "mov",
dat  : "mov",
asf  : "mov",
wmv  : "mov",
"3gp": "mov",
ac3 : "mov",
asf : "mov",
divx : "mov",
mkv : "mov",
ogg : "mov",
pmp : "mov",
ts : "mov",
vob : "mov",
xvid : "mov",

htm  : "html",
html : "html",
mht  : "html",

swf : "swf",
flv : "swf",

bmp : "bmp",
gif : "gif",
jpg : "jpg",
jpeg : "jpg",
jpe  : "jpg",
psd : "psd",
pdd  : "psd",
eps  : "psd",

tif  : "tu",
tiff : "tu",
ico : "tu",
png : "tu",
pic : "tu",
ai : "tu"
};
FileType.getFileType = function( filetype ) {
return this.data[ ( Trim( filetype || "" ) ).toLowerCase() ] || "qita";
};
FileType.getFileTypeForFile = function( file ) {
return this.getFileType( ( file || "" ).split( "." ).pop() );
};

var AJAXRequest = function( url, method, timeout ) {

this.method = method || "POST";
this.url = url;
this.async = true;
this.content = "";

this.onComplete = function() {};
this.onError = function(){};

var aa = this;
var cI = false;
var Bt = timeout || 5000;
var gK = null;

try {
cI = new XMLHttpRequest;
}
catch( e ) {
try {
cI = new ActiveXObject( "MSXML2.XMLHTTP" );
}
catch( e2 ) {
try {
cI = new ActiveXObject( "Microsoft.XMLHTTP" );
}
catch( e3 ) {
cI = false;
}
}
}
if (!cI)
return false;

var onOK= function() {
aa.onComplete( cI );
};
var onERR= function( mode ) {
aa.onError( cI, mode );
};
var makeTimer= function() {
if ( !gK ) {
gK = setTimeout( function() {
aa.abort();
}, Bt );
}
}
var clearTimer= function( mode ) {
if ( gK ) {
clearTimeout( gK );
gK = null;
if ( mode != "ok" )
onERR( mode );
}
};


this.abort= function() {
clearTimer( "abort" );
cI.abort();
};
this.send= function( By ) {
if( !this.method || !this.url || !this.async)
return false;

this.abort();

cI.open(this.method, this.url, this.async);
if(this.method == "POST") {
cI.setRequestHeader( "Content-Type", "gb2312" );
cI.setRequestHeader( "Content-length", this.content.length);
cI.setRequestHeader( "Content-Type","application/x-www-form-urlencoded" );
}

cI.onreadystatechange = function() {
if( cI.readyState == 4 ) {
if( cI.status == 200 ) {
clearTimer( "ok" );
onOK();
}
else {
clearTimer( cI.status );
}
}
}

try {
if( this.method == "POST" ) {
cI.send( By || this.content );
}
else {
cI.send( null );
}
makeTimer();
}
catch ( e ) {
onERR();
}
}
};

function IniSender( curFolderId, curSaveFrom, showNode, width ) {
var baseTmp   = T( [
'<div style="width:$width$;padding:4px 0 0 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">',
'<a title="可选择邮箱别名或POP文件夹的邮件地址&#10;作为发信帐号。">发件人</a>',
'：<span id="sendmailname_val" style="cursor:default;color:#000" unselectable="on" onmousedown="return false">',
'$nick$&lt;$email$&gt;',
'</span>',
'</div>'
] );
var emailTmp  = T( "$nick$&lt;$email$&gt;" );

var container = S("Senderdiv");
if ( !container )
return ;

try {
var datas     = GetDefalutAllMail();
}
catch( e ) {
var dh = arguments.callee;
return setTimeout( function() {
dh.apply( window, arguments );
}, 500 );
}
if ( datas.length < 1 )
return;

var code      = [ "选择发信帐号..." ];
var afun      = [ null ];
var selected  = null;

for ( var i = 1; i < datas.length; i ++ ) {
( function() {
var arrData = datas[ i ];
var data = {
nick  : arrData[ 2 ] && "\"" + arrData[ 2 ] + "\"",
email : arrData[ 1 ],
signid: arrData[ 3 ],
qzone: arrData[ 4 ],
taotao: arrData[ 5 ]
};

function HK() {
if ( window.SetSignature ) {
SetSignature( "sign", data.signid == -2 ? GetUserSignatureId(): data.signid );
SetSignature( "qzone", data.qzone == 0 ? -1 : 1 );
SetSignature( "taotao", data.taotao == 0 ? -1 : 1 );
}
}

code.push( emailTmp.replace( data ) );
afun.push( function( e ) {
S( "sendmailname_val" ).innerHTML = T( '$nick$&lt;$email$&gt;' ).replace( data );
S( "sendmailname" ).value = T( '$email$' ).replace( data );
HK();
});

if ( ( curFolderId && curFolderId == arrData[ 0 ] ) ||
( curSaveFrom && curSaveFrom == arrData[ 1 ] ) ||
selected == null ) {
selected = data;
}
} )();
}

selected.width = width || "264px";
container.innerHTML = baseTmp.replace( selected );

container.childNodes[ 0 ].onclick = function() {
var pos = fCalcPos( this.childNodes[ 0 ] );
ShowPageMenu( this, "sendermenu", pos[ 3 ], pos[ 2 ], "264px", "21px", code, afun );
};

S( "sendmailname" ).value = selected.email;
Show( showNode ? container[ showNode ] : container, true );
}

function GetMusicUrl( iR, iU, tx ) {
if ( window != top )
return top.GetMusicUrl( iR, iU, tx );

var hM    = arguments.callee;
var pO = [ iR, iU ].join( "@" );

hM.fCallBack = function( aO ) {
var iA = aO.contentWindow.aUrl;
var az  = -1;

for ( var i = 0, aw = iA.length; i < aw; i++ ) {
var ad = iA[ i ];
if ( ad.charAt( 0 ) != "$" ) {
az = i;
break;
}
}

var ad = hM.nz[ pO ] =
az == -1 ? "" : iA[ az ];
tx( iR, iU, ad );
};

if ( !hM.nz )
hM.nz = {};

if ( hM.nz[ pO ] || !iR || !iU )
return tx( iR, iU, hM.nz[ pO ] );

RemoveSelf( hM.FQ );
hM.FQ = CreatePanel( top, "getMusicUrlFromSoSo", T(
"/zh_CN/htmledition/getmusicurl.html?song=$song$&singer=$singer$" ).replace( {
song   : escape( iR ),
singer : escape( iU ),
rand   : Math.random()
} ), "GetMusicUrl.fCallBack( this );", "display:none;" );

}

function ParsePlayerPrototal( Ez ) {
var hj = GelTags( "player", Ez );
if ( hj.length == 0 )
return ;
function ta( ec, CW, yc ) {
function xN() {
if ( !yc && !confirm( "播放外部音乐有风险，确定播放？" ) )
return ;

Show( "mp3player_container", true );
PlayUrl( {
url      : ec,
dispInfo : CW
} );
};

Show( "bgmusic", true );
if ( yc )
xN();

var zf = GelTags( "a", S( "bgmusic" ) );
zf[ 0 ].href    = ec;
zf[ 1 ].onclick = function() {
xN();
return false;
};

Show( "QQMailBgMusicInfo", false );
}
var Ag = false;

var bP = S( "attachment" );
for( var lZ = 0; lZ < hj.length; lZ++ )
{
var dC = hj[ lZ ];
var pI = dC.id || "";
var nP = pI.toLowerCase();
if ( nP.indexOf( "cmd:" ) == 0 ) {

nP = nP.split( ":" ).pop();
switch( nP ) {
case "voice":
var au  = dC.getAttribute( "param" );
if ( !bP )
return ;
var cV  = GelTags( "span", bP );
for ( var ji, i = 0, aw = cV.length; i < aw; i++ ) {
var dj = cV[ i ];
ji  = dj.getAttribute( "player" );
if ( ji && ( dj.innerText || dj.textContent ) == au ) {
( function() {
var aj = dC.parentNode;
aj.innerHTML = '<div style="padding-left:10px;" ></div>';
var at = {
id: au,
container: aj.firstChild,
url: ji,
dispInfo  : {
title : ( dC.getAttribute( "alias" ) || "您朋友" ) + "的语音"
},
autoPlay: false
};
if( Ag )
{
at.autoPlay = false;
SetPlayer( at );
}
else
{
Ag = true;
at.autoPlay = true;
SetPlayer( at );
}





var eg = GelTags( "a", dj.parentNode.parentNode );
eg[ 0 ].onclick = eg[ eg.length - 1 ].onclick = function() {
StopUrl( at );
PlayUrl( at );
};
} )();
break;
}
}
lZ--;
break;
case "bgmusic":
var ad    = dC.getAttribute( "url" );
var qv   = decodeURIComponent( dC.getAttribute( "song" ) );
var qu = decodeURIComponent( dC.getAttribute( "singer" ) );

if ( ad && !qv && !qu ) {
ta( ad );
}
else {
GetMusicUrl( qv, qu, function( iR, iU, ec ) {
ta( ec || ad, {
author : qu,
title  : qv
}, true );
} );
}

break;
}
}
else if ( pI ) {

ta( pI );
}
}














}

function PlayAttach( DY ) {
var cV = GelTags( "span", DY.parentNode.parentNode );
var qy = cV.length == 0 ? {} : cV[ 0 ];
if ( qy.getAttribute( "player" ) ) {
Show( "mp3player_container", true );
PlayUrl( {
url      : qy.getAttribute( "player" ),
dispInfo : {
title : qy.innerHTML
}
} );
}
}


function StartUpQQPlus( dW, EO ) {
var en = S( "qqplus_panel", top );
if ( gIsOpera || !en )
return;

var zU = GetCookie( "wimrefreshrun" );
if ( EO && zU  )
dW = zU == "1" ? "" : "ready";

if ( dW == "ready" )
return ShowQQPlusInfo( "stop", { title : "点击登录邮箱聊天功能" } );

var au = {
rand: Math.random(),
js_path : GetPath( "js" )
};
if ( !window.QQPlusKernel )
fLoadJsFile( T( [ '$js_path$qqplus_kernel.js' ] ).replace( au ) );

if ( !window.QQPlusUI )
fLoadJsFile( T( [ '$js_path$qqplus_ui.js' ] ).replace( au ) );

ShowQQPlusInfo( "load", { title : "正在加载邮箱聊天..." } );

WaitFor( function() {
return window.QQPlusUI && window.QQPlusKernel;
}, function( cd ) {
if ( cd ) {
QQPlusStartUp( GetUin(), en );
}
else {
ShowQQPlusInfo( "stop", { title : "加载邮箱聊天功能失败，点击重新加载" } );
}
} );

if ( GetMainWin().CheckQQPlusState )
GetMainWin().CheckQQPlusState();
}

function StopQQPlus() {
QQPlusUI.StopQQPlus();
if ( GetMainWin().CheckQQPlusState )
GetMainWin().CheckQQPlusState();
}

function ConfirmQQPlusOpreate( nW ) {
comfirmBox( {
title: "邮箱聊天提示",
msg: T( "您确定要$opt$邮箱聊天？" ).replace( {
opt: nW == "login" ? "登录" : "退出"
} ),
enableRecord: nW == "login" ? true : false,
recordInfo: "进入邮箱自动登录",
onreturn: function( cd, Eb ) {
if ( !cd )
return ;

if ( Eb )
( new AJAXRequest( "/cgi-bin/setting1", "POST" ) ).send( T( 'sid=$sid$&Fun=submit&qqplus=$qqplus$' ).replace( {
sid: GetSid(),
qqplus: nW == "login" ? 1 : 0
} ) );

( nW == "login" ? StartUpQQPlus : StopQQPlus )();
}
} );
};

function ShowQQPlusInfo( yL, aB ) {
var en = S( "qqplus_panel", top );
if ( !en )
return false;

switch( yL ) {
case "stop":
en.innerHTML = T( [
'<a style="font-size:12px;font-weight:normal;padding:2px;" class="onlineman" ',
'title="$title$">',
'<img title="$title$" src="$images_path$qqplus_offline.gif" style="margin:4px 3px 0 4px;width:11px;height:9px;opacity:0.8;filter:alpha(opacity=80);position:absolute;" align="absmiddle"/>',
'</a>'
] ).replace( {
images_path : GetPath( "image" ),
title: aB.title
} );
en.onclick = function() {
ConfirmQQPlusOpreate( "login" );
};
break;
case "custom":
en.innerHTML= aB.html;
en.onclick= aB.onclick;
break;
case "load":
default:
en.innerHTML = T( [
'<img src="$images_path$ico_loading3.gif" title="$title$" ',
'align="absmiddle" style="width:16px;height:16px;margin-left:10px;" />' ] ).replace( {
images_path : GetPath( "image" ),
title: aB.title
} );
en.onclick = function() {
};
}

if ( en.firstChild )
en.title = en.firstChild.title;


arguments.callee.state = yL;

return true;
};


function triggerRecorderFlash( gC, cG, lV )
{
cG = typeof(cG) == "undefined"?!IsShow(gC):cG;
gC = typeof(gC) == "string" ? S(gC) : gC;
if( cG )
{
if( gC.innerHTML == "" )
{
fLoadJsFile( GetPath( "js" ) + "voice.js", true );
gC.innerHTML =
['<div style="height:50px;margin-top:0;*margin-top:1px;" class="attbg bd">',
'<div style="position:absolute;">',
'<span id="flash_obj">',
GenerateFlashCode( "recorder", ["/zh_CN/htmledition/swf/recorder.swf?qq=",top.GetUin(),"&rand=",Math.random()].join(""),
{
width  : 462,
height : 70
},
{
wmode  : "transparent"
}),
'</span>',
'<div id="remember_me" style="padding-top:3px;display:none" class="infobar pointer txt_center" onclick="jfOnRememberMe()" ><a>不想再看到此对话框？</a></div>',
'</div>',
'</div>'].join("");
}
if( S("voice_loc") )
S("voice_loc").value = gC.loc;
S("xqqstyle").value = "400";
}
else
{
var uj = S("voiceid");
lV = typeof(lV)=="undefined"?[
"您正在录音中，确定要放弃录音？", "您的录音没有发送，确定要放弃录音？" ]:lV;
var gH = top.GetFlash( "recorder", window );
if( gH && gH.jfGetFlashCurrentState()== 7 )
{
if( !confirm(lV[0]) )
return false;
}
else if( uj.value )
{
if( !confirm(lV[1]) )
return false;
}
gH.jfReleaseResoure();
uj.value = "";
S("voicename").value = "";
S("streamhost").value = "";
S("voice_loc").value = "";
S("xqqstyle").value = "";
}
Show ( gC,  cG );
return true;
}


function getReaderData( ec ) {
if ( window != top )
return top.getReaderData();
var aa = arguments.callee;
if ( aa.jsObj )
RemoveSelf( aa.jsObj );

aa.jsObj = fLoadJsFile( ec + "&r=" + Math.random() , false, document );
}

function getReaderDataInterval( ec, kr ) {
if ( window != top )
return top.getReaderDataInterval( ec, kr );
var aa = arguments.callee;
if ( aa.timer )
clearInterval( aa.timer );

var tM = ec || "/cgi-bin/reader_data?refresh=1&sid=" + GetSid() + "&t=reader_data&upqu=1" ;
aa.timer = setInterval( function(){ getReaderData( tM ) }, kr || ( 10 * 60 * 1000 ) );
getReaderData( tM );
}



