﻿
// JScript 文件
function GetObj(strkj) {
    try {
        if (GetObj) {
            return eval('document.getElementById("' + strkj + '")');
        }
        else {
            return eval('document.all.' + strkj);
        }
    }
    catch (e)
	{ }
}
Date.prototype.format = function(format) {
    var o = {
        "M+": this.getMonth() + 1, //month
        "d+": this.getDate(),    //day
        "h+": this.getHours(),   //hour
        "m+": this.getMinutes(), //minute
        "s+": this.getSeconds(), //second
        "q+": Math.floor((this.getMonth() + 3) / 3),  //quarter
        "S": this.getMilliseconds() //millisecond
    }
    if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
	(this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o) if (new RegExp("(" + k + ")").test(format))
        format = format.replace(RegExp.$1,
	RegExp.$1.length == 1 ? o[k] :
	("00" + o[k]).substr(("" + o[k]).length));
    return format;
}

var nTime;
function GetCodeImg() {
    nTime = new Date();
    nTime = nTime.format("yyyyMMddhhmmss");
    GetObj("iTime").value = nTime;
    GetObj("ImgText").innerHTML = "<img src='http://www.icxx.net/Login/Code.aspx?Time=" + nTime + "' alt='单击更换验证码,区分大小写' onclick='GetCodeImg();' border='0' class='codeImg' />";
}

function LoadUserId(iStr) {
    GetObj("Lid").value = iStr;
}
function submitForm(obj) {
    var IsPostBack = false;
    var lId = GetObj("Lid").value.replace(" ");
    var lPd = GetObj("Pwd").value.replace(" ");
    var lCo = GetObj("CodeImg").value.replace(" ", "");
    var obj = GetObj("LogInfo");
    if (lId == "") {
        alert("请输入您的登陆用户名");
        GetObj("Lid").focus();
    } else if (lPd == "") {
        alert("请输入您的密码");
        GetObj("Pwd").focus();
    } else if (lCo == "") {
        alert("请输入验证码（图片中出现的字符）");
        GetObj("CodeImg").focus();
    } else {
        if (AjaxCheck.CheckImg(lCo, nTime).value) {
            var iLogin = AjaxCheck.LoginIndex(lId, lPd).value;
            if (CheckValue(iLogin)) {
                GetObj("CheckInfo").innerHTML = "正在登陆,请稍候...";
                GetObj("CheckInfo").style.display = "block";
                IsPostBack = true;
            } else {
                obj.style.background = "#FFFFCC";
                obj.innerHTML = "<img src='../images/stop.gif' border='0' align='textTop' width='14' height='14' />&nbsp;" + iLogin.replace("|", "<br />").replace("|", "<br />");
                alert(iLogin.replace("|", "\n").replace("|", "\n"));
                GetObj("Lid").focus();
            }
        } else {
            obj.style.background = "#FFFFCC";
            obj.innerHTML = "<span>登陆失败</span>您输入的验证码不正确，请输入右侧图片中出现的字符";
            alert('您输入的验证码不正确');
            GetObj("CodeImg").focus();
        }
    }
    return IsPostBack;
}
function CheckValue(obj) {
    var patn1 = /^\d{1}$/;
    if (patn1.test(obj)) return true;
    return false;
}

