String.prototype.trim = function ()
		{
			return this.replace(/(^[\s]*)|([\s]*$)/g, "");
		}

		function email_uid_focus(uidinput)
		{
			if (uidinput.value.trim() == "请输入用户名")
			{
				uidinput.value = "";
			}
		}

		function email_uid_blur(uidinput)
		{
			var uidtxt = uidinput.value.trim();
			if (uidtxt == "")
			{
				uidinput.value = "请输入用户名";
			}
			else
			{
				if (uidtxt.indexOf("@") != -1)
				{
					switch (uidtxt.split("@")[1].toLowerCase())
					{
						case "qy.shanghai.gov.cn":
							document.getElementById("radio2").checked = true;
							break;
						case "smmail.cn":
							document.getElementById("radio3").checked = true;
							break;
						default:
							document.getElementById("radio1").checked = true;
							break;
					}
				}
				else
				{
					if (document.getElementById("radio2").checked)
					{
						uidinput.value = uidtxt + "@qy.shanghai.gov.cn";
					}
				}
			}
		}

		function email_type_change()
		{
			var uidinput = document.getElementById("uid");
			var uidtxt = uidinput.value.trim();
			if (uidtxt != "请输入用户名")
			{
				if (uidtxt.indexOf("@") != -1)
				{
					if (document.getElementById("radio2").checked)
					{
						uidinput.value = uidtxt.split("@")[0] + "@qy.shanghai.gov.cn";
					}
					else if (document.getElementById("radio3").checked)
					{
						uidinput.value = uidtxt.split("@")[0];
					}
					else //radio1
					{
						if (uidtxt.split("@")[1].toLowerCase() == "smmail.cn" || uidtxt.split("@")[1].toLowerCase() == "qy.shanghai.gov.cn")
						{
							uidinput.value = uidtxt.split("@")[0];
						}
					}
				}
				else
				{
					if (document.getElementById("radio2").checked)
					{
						uidinput.value = uidtxt + "@qy.shanghai.gov.cn";
					}
				}
			}
		}

		function email_signin()
		{
		
			if (document.getElementById("radio3").checked)
			{
				
				document.getElementById("loginForm").action = "http://info.smmail.cn/RunControl?sTargetService=user.LOGIN01";
				
			}
			else
			{
				
				document.getElementById("loginForm").action = "http://mail.shanghai.gov.cn/webmail/login.jsp";
				
			}

			//alert(document.getElementById("loginForm").action);
		 
			var uidtxt = document.getElementById("uid").value;
			var pwdtxt = document.getElementById("password").value;
			if (uidtxt == "" || uidtxt == "请输入用户名")
			{
				alert("请输入用户名！");
				document.getElementById("uid").focus();
				return;
			}
			
			if (pwdtxt == "")
			{
				alert("请输入密码！");
				document.getElementById("password").focus();
				return;
			}

			document.getElementById("textfield").value = document.getElementById("UserName").value = document.getElementById("user").value = uidtxt;
			document.getElementById("loginpassword").value = document.getElementById("Pwd").value = pwdtxt;
			document.getElementById("loginForm").submit();
			//document.getElementById("password").value = "";
		}

		function mailhelp()
		{
			var shelpurl;
			if (loginform.boxType[2].checked)
			{
				shelpurl = "http://www.smmail.cn/smmail/sy/zxbz/index.html";
			}
			else if (loginform.boxType[1].checked)
			{
				shelpurl = "http://www.sgs.gov.cn/qymail/help/html/index.html";
			}
			else
			{
				shelpurl = "http://mail.shanghai.gov.cn/common/help/faq/faq_simple_zh_CN.htm";
			}
			window.open(shelpurl);
		}

