
// 用正则表达式将前后空格,用空字符串替代(PS:因为js没有现成的trim,所以要加上这个)
String.prototype.trim = function() { 
	return this.replace(/(^s*)|(s*$)/g, ""); 
};
var MailLogin = {
mailCache:[], sendMail:function () {
	var B = G("daohang_mail_username").value, 
	C = G("daohang_mail_passwd").value, 
	E = G("daohang_mail_options"), 
	A = document.mailForm,
	 _ = E.selectedIndex,
	  H = Config.MailConfig[_],
	  F={u:B,p:C};
	if (H.val == 0) {
		alert("\u60a8\u6ca1\u6709\u9009\u62e9\u90ae\u7bb1\uff01");
		return;
	}
	if (F.u.trim() == "") {
		alert("\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a\uff01");
		G("daohang_mail_username").focus();
		return;
	}
	if (F.p.trim() == "") {
		alert("\u5bc6\u7801\u4e0d\u80fd\u4e3a\u7a7a\uff01");
		G("daohang_mail_passwd").focus();
		return;
	}
			if (this.mailCache.index != _) {
				this.mailCache.index = _;
				for (var I = 0, D = this.mailCache.length; I < D; I++) {
					A.removeChild(this.mailCache[I]);
				}
				this.mailCache = [];
			}
			A.action = H.action;
			for (I in H.params) {
				var $ = Ci(I, format(H.params[I], F));
				this.mailCache.push($);
				A.appendChild($);
			}
			G("daohang_mail_username").value = "";
			G("daohang_mail_passwd").value = "";
			A.submit();
			document.charset="utf-8";
			G("daohang_mail_username").value = B;
}, 
			change:function (_) {
				var $ = Config.MailConfig[_.selectedIndex];
				if ($.type == "link") {
					window.open($.action);
					//_.selectedIndex = 12;
				}
			}
};
