﻿var xmlHttp = false;
try {
	xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	try {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (ex) {
		xmlHttp = false;
	}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
	xmlHttp = new XMLHttpRequest();
}
var validateError = false;
var d = document,w=window;
//var webUrl = "http://192.168.1.167/";
function m_validate()
{     
	var url = "GlobalManager/Manager_99pan.aspx?action=validate&val="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange = function(){
		if(xmlHttp.readyState == 4){
			if(xmlHttp.status == 200){
				if(xmlHttp.responseText == 1){
					validateError = true;
					d.getElementById("validateCode_d").style.display = "block";     
					refer(); 
				}
			}	
		}
	}
	xmlHttp.send(null);
}
function submitForm()
{
    var userName = d.getElementById("userName");
    var passWord = d.getElementById("passWord");
    var validate = d.getElementById("validate");            
    if(userName.value==""){
        userName.focus();
        d.getElementById("msgUserName").innerHTML = "<span style='color:red;'>* 帐号不能为空!</span>";
        return false;
    }else if(passWord.value ==""){
        passWord.focus();
        d.getElementById("msgPass").innerHTML = "<span style='color:red;'>* 密码不能为空!</span>";
        return false;
    }else if(validate.value=="" && validateError == true){
        validate.focus();
        d.getElementById("msgValidate").innerHTML = "<span style='color:red;'>* 验证码不能为空!</span>";
        return false;
    }
    else
    {           
		popupLoadLayer();
        openMask();       
        if(d.getElementById("loginObj") != null)
        {
            d.getElementById("loginObj").style.display = "none";
        }
        d.form1.action = action;
        d.form1.submit();
        return true;
    }
}
function onblurValidate()
{
    var userName = d.getElementById("userName");
    var passWord = d.getElementById("passWord");
    var validate = d.getElementById("validate");
    if(userName.value!=""){
        //var illegalChar = "~!@%^&*();'\"?><[]{}\\|,:/=+—“”‘";
        var illegalChar = "";
        var tempStr = true;
        for(i=0;i<userName.value.length;i++)
        {
            if(illegalChar.indexOf(userName.value.charAt(i))!=-1){//E0691A
                d.getElementById("msgUserName").innerHTML = "<span style='color:red;'>您输入的帐号包含非法字符!</span>";
                tempStr = false;
            }  
        }
        if(tempStr==true){
             d.getElementById("msgUserName").innerHTML = "请输入您注册帐号";
        }
    }else if(passWord.value !=""){
        d.getElementById("msgPass").innerHTML = "请输入您密码";
    }else if(validate.value!=""){s
        d.getElementById("msgValidate").innerHTML = "请输入左边的验证码!";
    }
}      
function doUserCheckbox()
{
    var user_CheckBox =  d.getElementById("usercheckbox").value;
    if(user_CheckBox == "")
    {
        user_CheckBox = "userCheckBox";
    }
    //alert(d.getElementById("usercheckbox").value);
}
function refer()
{
    d.getElementById("safecode").src="Imagecode/ImagecodeManager_login.aspx?"+ Math.random();
}
function Enter(evt)
{
    if(evt.keyCode==13) 
    {
       return submitForm();
    }
}
var login = "<form action=\"\" method=\"post\" name=\"form1\" onkeydown=\"return Enter(event)\"><div id=\"login_content\"><div style=\"margin-bottom:20px;margin-top:20px; width:440px;height:35px\"><span id=\"login_r_a\">我还没有注册,现在<a href=\"http://www.99pan.com/register.html\" target=\"_blank\">马上注册</a>拥有1-100G免费空间</span></div><div style=\"width:440px;height:35px\"><div class=\"login__left_ca\" style=\"height:31px;\">帐号：</div><div class=\"login__left_cb\" style=\"height:35px\"><input id=\"userName\" name=\"userName\" type=\"text\" onblur=\"onblurValidate()\" style=\"height:18px; width:180px;\"/></div><div class=\"login_content_a\" style=\"height:31px\" id=\"msgUserName\">请输入您注册帐号</div></div><div style=\"width:440px;height:35px\"><div class=\"login__left_ca\" style=\"height:29px\">密码：</div><div class=\"login__left_cb\" style=\"height:33px\"><input id=\"passWord\" name=\"pass\" type=\"password\"  onblur=\"onblurValidate()\" style=\"height:18px; width:180px;\"/></div><div class=\"login_content_b\" style=\"height:29px\" id=\"msgPass\">请输入密码</div></div><div style=\"width:440px;height:35px\"><div id=\"validateCode_d\" style=\"display:none;\"><div class=\"login__left_ca\" style=\"height:33px; padding-top:10px;\">验证码：</div><div class=\"login__left_cb\" style=\"height:42px\"><input id=\"validate\" name=\"validate\" type=\"text\" size=\"4\" onblur=\"onblurValidate()\" style=\"height:18px;\" />&nbsp;<img id=\"safecode\" src=\"\" style=\"width:66px; height:26px\"  alt=\"看不清楚，请点击我\" onclick=\"refer();\"/>&nbsp;<a href=\"javascript:refer();\">看不清楚</a></div><div class=\"login__left_cc\" style=\"height:42px\" id=\"msgValidate\">请输入左边验证码</div>	</div><div style=\"width:400px; padding-left:40px;height:35px;\">		<div class=\"login__left_ca\" style=\"height: 29px\">登录有效期：</div><div class=\"login__left_cb\" style=\"height: 34px; width: 231px;\" id=\"login__left_cb\"><input name=\"radio\" type=\"radio\" value=\"not\" checked=\"checked\" />不记录<input name=\"radio\" type=\"radio\" value=\"day\" />一天<input name=\"radio\" type=\"radio\" value=\"month\" />一月<input name=\"radio\" type=\"radio\" value=\"forever\" />永久</div></div><div style=\"width:440px;height:35px\"><div style=\"text-align:left; padding-left:26px; padding-top:10px; padding-left:60px;\"> &nbsp;<input id=\"loginBut\" type=\"submit\" value=\" 登录 \" onclick=\" return submitForm()\" class=\"buttonStyle\"/> <a href=\"forgetPassword.html\" target=\"_blank\">忘记密码</a></div></div></div></form>";