// JScript
//alert('x');
//var cmeUrl="http://cme45.91huayi.com/secure/LoginHandler.ashx";
var cmeUrl = "https://cme28.91huayi.com/ashx/loginJsonp.ashx";//"https://cme28.91huayi.com/secure/LoginHandler_v4.ashx";
var cmeDataCountUrl = "https://hyservice.91huayi.com/hy_service/Hy_GetUserCount.ashx";
//var cmeUrl_new="https://cme100.91huayi.com/ashx/LoginHandler_v4.ashx";
//var cmeUrl_new = "https://cme45.91huayi.com/ashx/LoginHandler_v4.ashx";
var cmeUrl_new = "https://cme28.91huayi.com/ashx/loginJsonp.ashx";//"https://cme28.91huayi.com/ashx/LoginHandler_v4.ashx";
var cmeUrl_new1 = "https://cme1.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new2 = "https://cme2.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new3 = "https://cme3.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new5 = "https://cme20.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new6 = "https://cme21.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new7 = "https://cme22.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new8 = "https://cme23.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new9 = "https://cme7.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new10 = "https://cme40.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new11 = "https://cme41.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new12 = "https://cme26.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new13 = "https://cme27.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new14 = "https://cme42.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new15 = "https://cme43.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new16 = "https://cme44.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
var cmeUrl_new17 = "https://cme45.91huayi.com/ashx/loginJsonp2.ashx";//secure/LoginHandler_v3.ashx";
$(document).ready(function() {
    var loginName = getCookie("rememberName");
    var loginPwd = getCookie("rememberPwd");
    var login_id_ = getCookie("rememberUserID");
    Getuserintegrallevel(login_id_, 1, 2);
    if (loginName != null && loginName != "") {
        $("#userName").val(loginName);
    }
    if (loginPwd != null && loginPwd != "") {
        $("#userPwd").val(loginPwd);
    }
    var loginedUserName = getCookie("rememberLoginUser");
    if (loginedUserName != "" && loginedUserName != null) {
        /*  $(".login").hide();
          $(".login_error").hide();
          $(".dfhdgdg").hide();
          $(".tele").hide();
          $(".index_zc").hide(); // 3 button
          $(".logined").show();*/
        $("#loginx").hide();
        $("#comUserName").html(loginedUserName);
        document.getElementById('updataPwd').href = "http://hyuser.91huayi.com/AccountCenter/setpwd.aspx?tag=91huayi&uid=" + getCookie("rememberUserID") + "&user_name=" + loginName;
        document.getElementById('updateUinfo').href = "http://wxmp.91huayi.com/toUpdateUserInfo?userId=" + getCookie("xsign");
        //document.getElementById('gocmelogin').href="http://cme45.91huayi.com/secure/regConfirmation.aspx?uid="+getCookie("rememberUserID");
        document.getElementById('gocmelogin').href = "https://cme28.91huayi.com/cme.html";
        //document.getElementById('headCmeLink').href="http://cme45.91huayi.com/secure/regConfirmation.aspx?uid="+getCookie("rememberUserID");
        document.getElementById('headCmeLink').href = "https://cme28.91huayi.com/cme.html";
    }
    $.ajax({
        url: cmeDataCountUrl,
        dataType: "jsonp",
        jsonp: "jsonpcallback",
        success: function(data) {
            var json = eval(data);
            $.each(json, function(id, item) {
                if (id == "regstuNum") {
                    $("#LabRegstuNum").html(item);
                    $("#LabRegstuNum2").html(item);
                    //$("#LabRegstuNum").html("1029871");
                }
                if (id == "stuNum") {
                    $("#LabHospNum").html(item);
                    $("#LabHospNum2").html(item);
                    //$("#LabHospNum").html("5728");
                }
                if (id == "hospNum") {
                    $("#LabStuNum").html(item);
                    $("#LabStuNum2").html(item);
                    //$("#LabStuNum").html("77516");
                }
            })
        }
    })
    /*  $("#KSS_content>a:nth-child(2)").bind("click",function(){
             var userID=getCookie("rememberUserID");
             var userName=getCookie("rememberLoginUser");
             if (userName!=null) {
                 this.href='http://thanks.91huayi.com/Home/Thank?userID='+userID+'&userName='+encodeURI(userName);
             }
             else {
                 this.href='http://thanks.91huayi.com/Home/Thank';
             }
 
     });*/
    $("#xmen").bind("click", function() {
        var userID = getCookie("rememberUserID");
        var userName = getCookie("rememberLoginUser");
        if (userName != null) {
            this.href = 'http://thanks.91huayi.com/Home/Thank?userID=' + userID + '&userName=' + encodeURI(userName);
        } else {
            this.href = 'http://thanks.91huayi.com/Home/Thank';
        }
    });
});
function writeInfo() {
    if ($("#checkInfo").attr("checked") == true) {
        var uName = $("#userName").val();
        var uPwd = $("#userPwd").val();
        writeCookie("rememberName", uName);
        writeCookie("rememberPwd", uPwd);
    }
}
function deletInfo() {
    delCookie("rememberName");
    delCookie("rememberPwd");
}
function loginOut() {
    delCookie("rememberLoginUser");
    delCookie("rememberUserID");
    $("#userPwd").val("");
    $(".login").show();
    $("#user_pwd_window").val("");
    // $(".dfhdgdg").show();
    // $(".tele").show();
    $(".logined").hide();
    // document.getElementById('headCmeLink').href="http://cme45.91huayi.com";
    // location.href="https://sso.91huayi.com/sso/logout_all.aspx?url=http://www.91huayi.com";
}
function aloneLogin() {
    if ($("#checkInfo").attr("checked") == true) {
        writeInfo();
    } else {
        deletInfo();
    }
    var loginName = $("#userName").val();
    var loginPwd = $("#userPwd").val();
    if (loginName == "" || loginName == "左侧可选择登录方式") {
        alert("请输入用户名");
        return;
    }
    if (loginPwd == "") {
        alert("请输入密码");
        return;
    }
    $.ajax({
        url: cmeUrl,
        dataType: "jsonp",
        data: {
            UserName: loginName,
            Password: loginPwd,
            loginType: "1"
        },
        jsonp: "jsonpcallback",
        beforeSend: loading,
        success: function(data) {
            var json = eval(data);
            var backuser = "";
            $.each(json, function(id, item) {
                if (id == "msg") {
                    if (item != "error") {
                        writeCookie("rememberLoginUser", item);
                        $(".login").hide();
                        $(".login_error").hide();
                        //$(".dfhdgdg").hide();
                        $(".index_zc").hide(); // 3 button
                        $(".dfhdgdg").hide(); // 3 count
                        $(".tele").hide();
                        $(".logined").show();
                        $("#comUserName").html(item);
                    } else {
                        alert("您输入的账号或密码错误!");
                        return;
                    }
                } else if (id == "uid") {
                    writeCookie("rememberUserID", item);
                    window.location.href = 'index.html';
                } else {
                    alert("您输入的账号或密码错误!");
                }
            })
        }
    })
}
function Getuserintegrallevel(sid, startnumber, type) {
    var reg = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
    var reg1 = /^[0-9]*[1-9][0-9]*$/;
    if (!reg.test(sid)) {
        //alert("????????Ч?????");
        return false;
    }
    if (!reg1.test(startnumber)) {
        //alert("????????Ч?????");
        return false;
    }
    $.ajax({
        type: "GET",
        url: "https://jifen.91huayi.com/home/Getuserintegrallevel",
        data: {
            sid: sid,
            startnumber: startnumber,
            zip: Math.random()
        },
        cache: false,
        error: function() {
            //alert("???????,??????????.");
            return false;
        },
        dataType: "jsonp",
        jsonp: 'callback',
        beforeSend: function() {
            $("#page_net img").attr("src", "http://www.91huayi.com/huayi_yidou/images/page_loading.gif");
        },
        success: function(msg) {
            if (msg != null) {
                if (msg.success == true) {
                    //???
                    if (msg.img != null && msg.img != "") {
                        $(".g-sd1-1 img").attr("src", msg.img);
                    }
                    //??????????
                    $("#comUserName_jf").html(msg.integral);
                    $("#comUserName_dj").html(msg.level);
                    $("#my_yd").attr("href", "http://www.91huayi.com/huayi_yidou.html?id=" + sid);
                } else {
                    alert(msg.message);
                    return false;
                }
            }
        }
    });
}
function loginFun() {
    if ($("#checkInfo").attr("checked") == true) {
        writeInfo();
    } else {
        deletInfo();
    }
    var loginName = $("#userName").val(); // ???? base64 ????
    var loginPwd = $("#userPwd").val(); // ???? base64 ????
    // var loginTypeValue = getSelectValue("selectLoginType");		// ??????????
    var loginTypeValue = $("#selectLoginType").val(); // ??????????
    if (loginName == "" || loginName == "左侧可选择登录方式") {
        alert("请输入用户名");
        return;
    }
    if (loginPwd == "") {
        alert("请输入密码");
        return;
    }
    $.ajax({
        url: cmeUrl,
        dataType: "jsonp",
        // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
        data: {
            UserName: loginName,
            Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
            loginType: 1
        },
        jsonp: "jsonpcallback",
        beforeSend: loading,
        success: function(data) {
            var json = eval(data);
            var backuser = "";
            $.each(json, function(id, item) {
                if (id == "msg") {
                    //if(item!="error")
                    //{
                    //    writeCookie("rememberLoginUser",item);
                    //    $(".login").hide();
                    //    $(".login_error").hide();
                    //    $(".index_zc").hide(); // 3 button
                    //    $(".dfhdgdg").hide();  // 3 count
                    //    $(".tele").hide();	
                    //    $(".logined").show();
                    //    $("#comUserName").html(item);
                    //}
                    //
                    //if (backuser == "" || backSeesion == "") {
                    //    $("#logindiv").empty();
                    //    $("#logindiv").html(loginhtml);
                    //    GetFocus($("#loginAccessName"));
                    //}
                    if (item == "01") {
                        // $("#login_error").html("??????????????");
                        alert("用户名或密码错误");
                    } else if (item == "0") {
                        //  $("#login_error").html("??????????????");
                        alert("用户名或密码错误");
                    } else if (item == "1") {
                        // $("#login_error").html("??????????????");
                        alert("用户名或密码错误");
                    } else if (item == "2") {
                        //  $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "3") {
                        // $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "4") {
                        // $("#login_error").html("??????????????????");
                        alert("用户名或密码错误");
                    } else if (item == "5") {
                        //  $("#login_error").html("????????????");
                        alert("用户名或密码错误");
                    } else if (item == "6") {
                        // $("#login_error").html("????????????");
                        alert("用户名或密码错误");
                    } else if (item == "7") {
                        // $("#login_error").html("?????????????????");
                        alert("用户名或密码错误");
                    } else if (item == "8") {
                        // $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "9") {
                        // $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "10") {
                        // $("#login_error").html("??????????????????");
                        alert("用户名或密码错误");
                    } else {
                        $("#loginx").hide();
                        // ?????? ???
                        writeCookie("rememberLoginUser", item);
                        /* $(".login").hide();
                         $(".login_error").hide();
                         $(".index_zc").hide(); // 3 button
                         $(".dfhdgdg").hide();  // 3 count
                         $(".tele").hide();	
                      $(".login_after").show();
                        */
                        $("#comUserName").html(item);
                        // ?????? ????
                    }
                    //					
                    //else
                    //{
                    //alert("??????????????????!");
                    //   $("#login_error").html("??????????????????!");
                    //}
                } else if (id == "uid") {
                    //???????????????
                    Getuserintegrallevel(item, 1, 2);
                    writeCookie("rememberUserID", item);
                    document.getElementById('updataPwd').href = "http://hyuser.91huayi.com/AccountCenter/setpwd.aspx?tag=91huayi&uid=" + item + "&user_name=" + loginName;
                    document.getElementById('updateUinfo').href = "http://wxmp.91huayi.com/toUpdateUserInfo?userId=" + item;
                    //document.getElementById('gocmelogin').href="http://cme45.91huayi.com/secure/regConfirmation.aspx?uid="+item;
                    //document.getElementById('gocmelogin').href="http://cme45.91huayi.com/cme.html";
                    //document.getElementById('headCmeLink').href="http://cme45.91huayi.com/secure/regConfirmation.aspx?uid="+item;
                    //document.getElementById('headCmeLink').href="http://cme45.91huayi.com";
                    // 2011-11-20 sso begin -------------------------------
                    var ifr;
                    try {
                        ifr = document.createElement('');
                    } catch (ex) {
                        ifr = document.createElement('iframe');
                    }
                    ifr.id = 'sso_iframe';
                    ifr.name = 'sso_iframe';
                    ifr.width = 0;
                    ifr.height = 0;
                    ifr.marginHeight = 0;
                    ifr.marginWidth = 0;
                    ifr.src = 'https://sso.91huayi.com/sso/login_all.ashx?username=' + loginName + '&password=' + loginPwd + '&loginType=1&from=91huayi';
                    document.body.appendChild(ifr);
                    // 2011-11-20 sso end ----------------------------------
                } else {
                    alert("您输入的账号或密码错误!");
                }
            })
        }
    })
}
function checkCode() {
    var myDate = new Date();
    document.getElementById("imgCheckCode").src = "https://cme28.91huayi.com/secure/CheckCode.aspx?id=" + myDate.toLocaleTimeString();
    document.getElementById("imgCheckCode1").src = "https://cme28.91huayi.com/secure/CheckCode.aspx?id=" + myDate.toLocaleTimeString();
    // document.getElementById("imgCheckCode").src = "http://cme100.91huayi.com/secure/CheckCode.aspx?id=" + myDate.toLocaleTimeString();
    //document.getElementById("imgCheckCode1").src = "http://cme100.91huayi.com/secure/CheckCode.aspx?id=" + myDate.toLocaleTimeString();
}
function loginFun_new() {
     var _uidforauth='';
    
    var  newsign='';
    
    if (document.getElementById("agree2").checked != true) {
        alert("请勾选隐私协议");
        return false;
    }
    if ($("#checkInfo").attr("checked") == true) {
        writeInfo();
    } else {
        deletInfo();
    }
    var loginName = $("#userName").val(); // ???? base64 ????
    var loginPwd = $("#userPwd").val(); // ???? base64 ????
    var xx = $("#loginAccessPwd2").val();
    // var loginTypeValue = getSelectValue("selectLoginType");		// ??????????
    var loginTypeValue = $("#selectPopLoginType").val(); // ??????????
    if (loginName == "" || loginName == "左侧可选择登录方式") {
        alert("请输入用户名");
        return;
    }
    if (loginPwd == "") {
        alert("请输入密码");
        return;
    }
    if (xx == "") {
        alert("验证码不可为空");
        return;
    }
    $.ajax({
        url: cmeUrl_new,
        dataType: "jsonp",
        // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
        data: {
            UserName: loginName,
            Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
            loginType: loginTypeValue,
            code: xx
        },
        jsonp: "jsonpcallback",
        beforeSend: loading,
        success: function(data) {
           try
           {
            var json = eval(data);
           } catch (e) {
              alert("用户个人信息数据有误");
               checkCode();
           }
            var backuser = "";
            $.each(json, function(id, item) {
                if(id=="sign")
                {
                  newsign=item;
     writeCookie("xsign", newsign);
      document.getElementById('updateUinfo').href = "http://wxmp.91huayi.com/toUpdateUserInfo?userId=" + item;
                }
                if (id == "msg")
                {
                    //if(item!="error")
                    //{
                    //    writeCookie("rememberLoginUser",item);
                    //    $(".login").hide();
                    //    $(".login_error").hide();
                    //    $(".index_zc").hide(); // 3 button
                    //    $(".dfhdgdg").hide();  // 3 count
                    //    $(".tele").hide();	
                    //    $(".logined").show();
                    //    $("#comUserName").html(item);
                    //}
                    //
                    //if (backuser == "" || backSeesion == "") {
                    //    $("#logindiv").empty();
                    //    $("#logindiv").html(loginhtml);
                    //    GetFocus($("#loginAccessName"));
                    //}
                    if (item == "01") {
                        // $("#login_error").html("??????????????");
                        alert("用户名或密码错误");
                    } else if (item == "00") {
                        alert("验证码错误");
                        checkCode();
                    } else if (item == "0") {
                        //  $("#login_error").html("??????????????");
                        alert("用户名或密码错误");
                    } else if (item == "1") {
                        // $("#login_error").html("??????????????");
                        alert("用户名或密码错误");
                    } else if (item == "2") {
                        //  $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "3") {
                        // $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "4") {
                        // $("#login_error").html("??????????????????");
                        alert("用户名或密码错误");
                    } else if (item == "5") {
                        //  $("#login_error").html("????????????");
                        alert("用户名或密码错误");
                    } else if (item == "6") {
                        // $("#login_error").html("????????????");
                        alert("用户名或密码错误");
                    } else if (item == "7") {
                        // $("#login_error").html("?????????????????");
                        alert("用户名或密码错误");
                    } else if (item == "8") {
                        // $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "9") {
                        // $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "10") {
                        // $("#login_error").html("??????????????????");
                        alert("用户名或密码错误");
                    } else if (backuser == "00") {
                        alert("用户名或密码错误");
                        checkCode();
                        GetFocus($("#loginAccessPwd1"));
                    } else {
                        $("#loginx").hide();
                        // ?????? ???
                        writeCookie("rememberLoginUser", item);
                        /* $(".login").hide();
                         $(".login_error").hide();
                         $(".index_zc").hide(); // 3 button
                         $(".dfhdgdg").hide();  // 3 count
                         $(".tele").hide();	
                      $(".login_after").show();
                        */
                        $("#comUserName").html(item);
                        // ?????? ????
                    }
                    //					
                    //else
                    //{
                    //alert("??????????????????!");
                    //   $("#login_error").html("??????????????????!");
                    //}
                } else if (id == "uid") {
                    //???????????????
                    Getuserintegrallevel(item, 1, 2);
                    _uidforauth=item;
                    writeCookie("rememberUserID", item);
                    document.getElementById('updataPwd').href = "http://hyuser.91huayi.com/AccountCenter/setpwd.aspx?tag=91huayi&uid=" + item + "&user_name=" + loginName;
                   
                    //document.getElementById('gocmelogin').href="http://cme45.91huayi.com/secure/regConfirmation.aspx?uid="+item;
                    //document.getElementById('gocmelogin').href="http://cme45.91huayi.com/cme.html";
                    //document.getElementById('headCmeLink').href="http://cme45.91huayi.com/secure/regConfirmation.aspx?uid="+item;
                    //document.getElementById('headCmeLink').href="http://cme45.91huayi.com";
                    // 2011-11-20 sso begin -------------------------------
                    var ifr;
                    try {
                        ifr = document.createElement('');
                    } catch (ex) {
                        ifr = document.createElement('iframe');
                    }
                    ifr.id = 'sso_iframe';
                    ifr.name = 'sso_iframe';
                    ifr.width = 0;
                    ifr.height = 0;
                    ifr.marginHeight = 0;
                    ifr.marginWidth = 0;
                    ifr.src = 'https://sso.91huayi.com/sso/login_all.ashx?username=' + loginName + '&password=' + loginPwd + '&loginType=1&from=91huayi';
                    document.body.appendChild(ifr);
                    // 2011-11-20 sso end ---------------------------------
                } else if (id == 'province_name') {
                  if (item == "湖北省") {
                        document.getElementById('chaxunxuefen').href = "http://kjpt.wsglw.net";
                        document.getElementById('chaxunxuefen1').href = "http://kjpt.wsglw.net";
                    } 
                   else  if (item == "重庆市") { 
                        //document.getElementById('chaxunxuefen').href = "http://www.icme.cqwsjsw.com";
                       // document.getElementById('chaxunxuefen1').href = "http://www.icme.cqwsjsw.com";
                        document.getElementById('chaxunxuefen').href = "http://183.230.146.12:20000";
                        document.getElementById('chaxunxuefen1').href = "http://183.230.146.12:20000";
                    } else if (item == "湖南省") {
                        document.getElementById('chaxunxuefen').href = "https://hunan.wsglw.net";
                        document.getElementById('chaxunxuefen1').href = "https://hunan.wsglw.net";
                    } else if (item == "陕西省") {
                        document.getElementById('chaxunxuefen').href = "http://124.115.170.210:8005/kjptwsw"; //"http://124.115.170.210:8005/kjptwsw";
                        document.getElementById('chaxunxuefen1').href = "http://124.115.170.210:8005/kjptwsw"; //"http://124.115.170.210:8005/kjptwsw";
                    } else if (item == "广西省" || item == "广西壮族自治区") {
                        document.getElementById('chaxunxuefen').href = "https://jxjy.wsjkw.gxzf.gov.cn/kjptwsw";
                        document.getElementById('chaxunxuefen1').href = "https://jxjy.wsjkw.gxzf.gov.cn/kjptwsw";
                    } else if (item == "山西省") {
                        /*  try { $(".zz_sx_bg").css("display","block");  }catch(err) {    }
                         */
                        document.getElementById('chaxunxuefen').href = "http://218.26.86.33:9922/Hylogin";
                        document.getElementById('chaxunxuefen1').href = "http://218.26.86.33:9922/Hylogin";
                    } else if (item == "上海市") {
                        try {
                            $(".zz_sh_bg").css("display", "block");
                        } catch (err) {}
                    } else if (item == "安徽省") {
                        document.getElementById('chaxunxuefen').href = "http://www.ahscme.cn";
                        document.getElementById('chaxunxuefen1').href = "http://www.ahscme.cn";
                    } else if (item == "四川省") {
                        document.getElementById('chaxunxuefen').href = "http://202.61.90.26/gateway/home.html";
                        document.getElementById('chaxunxuefen1').href = "http://202.61.90.26/gateway/home.html";
                    } else if (item == "贵州省") {
                        document.getElementById('chaxunxuefen').href = "http://gzcme.yiboshi.com";
                        document.getElementById('chaxunxuefen1').href = "http://gzcme.yiboshi.com";
                    } else if (item == "山东省") {
                        document.getElementById('chaxunxuefen').href = "http://sdyj.wsglw.net";
                        document.getElementById('chaxunxuefen1').href = "http://sdyj.wsglw.net";
                    } else if (item=="甘肃省"){
                        document.getElementById('chaxunxuefen').href = "https://kjpt.wsglw.net";
                        document.getElementById('chaxunxuefen1').href = "https://kjpt.wsglw.net"; 
                    }
                     else if (item == "浙江省") {
                        document.getElementById('chaxunxuefen').href = "https://cme.wsjkw.zj.gov.cn";
                        document.getElementById('chaxunxuefen1').href = "https://cme.wsjkw.zj.gov.cn";
                    } else if (item == "福建省") {
                        document.getElementById('chaxunxuefen').href = "http://220.160.53.27:18021/kjptwsw";
                        document.getElementById('chaxunxuefen1').href = "http://220.160.53.27:18021/kjptwsw";
                    } else if (item == "广东省") {
                        document.getElementById('chaxunxuefen').href = "http://gdkjpt.91huayi.com";
                        document.getElementById('chaxunxuefen1').href = "http://gdkjpt.91huayi.com";
                    } else if (item == "山西省") {
                        /* try { $(".zz_sx_bg").css("display","block");  }catch(err) {    }
                         */
                        document.getElementById('chaxunxuefen').href = "http://218.26.86.33:9922/Hylogin";
                        document.getElementById('chaxunxuefen1').href = "http://218.26.86.33:9922/Hylogin";
                    } else if (item == "海南省") {
                        document.getElementById('chaxunxuefen').href = "https://kjpt.wsglw.net";
                        document.getElementById('chaxunxuefen1').href = "https://kjpt.wsglw.net ";
                    } else if (item == "上海市") {
                        try {
                            $(".zz_sh_bg").css("display", "block");
                        } catch (err) {}
                    } else if (item == "青海省") {
                        document.getElementById('chaxunxuefen').href = "https://kjpt.wsglw.net/";
                        document.getElementById('chaxunxuefen1').href = "https://kjpt.wsglw.net/";
                    }
                    else if (item == "宁夏回族自治区") {
                        document.getElementById('chaxunxuefen').href = "https://kjpt.wsglw.net/";
                        document.getElementById('chaxunxuefen1').href = "https://kjpt.wsglw.net/";
                    }
                    else if (item == "内蒙古自治区") {
                        document.getElementById('chaxunxuefen').href = "https://kjpt.wsglw.net/";
                        document.getElementById('chaxunxuefen1').href = "https://kjpt.wsglw.net/";
                    }
                    else if(item=="辽宁省"){
                       document.getElementById('chaxunxuefen').href = "https://cme41.91huayi.com/pages/study_info_list.aspx";
                        document.getElementById('chaxunxuefen1').href = "https://cme41.91huayi.com/pages/study_info_list.aspx";
                    }
                     else if (item == "河南省") {
                        document.getElementById('chaxunxuefen').href = "http://222.143.64.114:443";
                        document.getElementById('chaxunxuefen1').href = "http://222.143.64.114:443";
                    } else {
                        document.getElementById('chaxunxuefen').href = "http://kjptwsw.91huayi.com";
                        document.getElementById('chaxunxuefen1').href = "http://kjptwsw.91huayi.com";
                    }
                } else if (id == "ifCanBuyCard") {
                    if (item == "0") {
                        $("#xxxx").css("display", "none");
                    }
                    if (item == "1") {
                        $("#xxxx").css("display", "block");
                    }
                } else {
                    if(id=="token")
                    {
                      if (item!='')
                      {
                        window.location.href='https://empower.91huayi.com/root/empowerForMain?pid='+_uidforauth+'&token='+item;
                      }
                    }
                }
            })
            try {
        
 //$.ajax({url:"https://zzfk.91huayi.com/login?sign="+newsign+"&userId="+getCookie('rememberUserID'),success:function(result){
 
 //   }});
/*
                $.ajax({
                    url: ',
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
*/
                
                $.ajax({
                    url: cmeUrl_new1,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new2,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new3,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
	 $.ajax({
                    url:"https://cme.91huayi.com/secure/LoginHandler_v3.ashx",
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new5,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new6,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new7,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new8,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new9,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new10,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new11,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new12,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new13,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new14,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new15,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new16,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
                $.ajax({
                    url: cmeUrl_new17,
                    dataType: "jsonp",
                    // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
                    data: {
                        UserName: loginName,
                        Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
                        loginType: loginTypeValue,
                        code: xx,
                        sign:newsign
                    },
                    jsonp: "jsonpcallback",
                    beforeSend: loading,
                    success: function(data) {}
                });
            } catch (e) {}
        }
    })
}
function loginFun_new_window() {
if(document.getElementById("agree").checked!=true){alert("请勾选隐私协议");return false;}
    if ($("#checkInfo").attr("checked") == true) {
        writeInfo();
    } else {
        deletInfo();
    }
    var loginName = $("#user_name_window").val(); // ???? base64 ????
    var loginPwd = $("#user_pwd_window").val(); // ???? base64 ????
    var xx = $("#yzm_window").val();
    // var loginTypeValue = getSelectValue("selectLoginType");		// ??????????
    var loginTypeValue = 1; // ??????????
    if (loginName == "" || loginName == "左侧可选择登录方式") {
        alert("请输入用户名");
        return;
    }
    if (loginPwd == "") {
        alert("请输入密码");
        return;
    }
    if (xx == "") {
        alert("验证码不可为空");
        return;
    }
    $.ajax({
        url: cmeUrl_new,
        dataType: "jsonp",
        // data: { UserName: loginName , Password: $.base64.encode(loginPwd), loginType: loginTypeValue },
        data: {
            UserName: loginName,
            Password: $.base64.encode(loginPwd).replace(/\+/g,'-').replace(/\//g,'_'),
            loginType: 1,
            code: xx
        },
        jsonp: "jsonpcallback",
        beforeSend: loading,
        success: function(data) {
            var json = eval(data);
            var backuser = "";
            $.each(json, function(id, item) {
               if(id=="sign")
                {
                  newsign=item;
     writeCookie("xsign", newsign);
      document.getElementById('updateUinfo').href = "http://wxmp.91huayi.com/toUpdateUserInfo?userId=" + item;
                }
                if (id == "msg") {
                    //if(item!="error")
                    //{
                    //    writeCookie("rememberLoginUser",item);
                    //    $(".login").hide();
                    //    $(".login_error").hide();
                    //    $(".index_zc").hide(); // 3 button
                    //    $(".dfhdgdg").hide();  // 3 count
                    //    $(".tele").hide();	
                    //    $(".logined").show();
                    //    $("#comUserName").html(item);
                    //}
                    //
                    //if (backuser == "" || backSeesion == "") {
                    //    $("#logindiv").empty();
                    //    $("#logindiv").html(loginhtml);
                    //    GetFocus($("#loginAccessName"));
                    //}
                     
                    if (item == "01") {
                        // $("#login_error").html("??????????????");
                        alert("用户名或密码错误");
                    } else if (item == "00") {
                        alert("验证码错误");
                    } else if (item == "0") {
                        //  $("#login_error").html("??????????????");
                        alert("用户名或密码错误");
                    } else if (item == "1") {
                        // $("#login_error").html("??????????????");
                        alert("用户名或密码错误");
                    } else if (item == "2") {
                        //  $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "3") {
                        // $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "4") {
                        // $("#login_error").html("??????????????????");
                        alert("用户名或密码错误");
                    } else if (item == "5") {
                        //  $("#login_error").html("????????????");
                        alert("用户名或密码错误");
                    } else if (item == "6") {
                        // $("#login_error").html("????????????");
                        alert("用户名或密码错误");
                    } else if (item == "7") {
                        // $("#login_error").html("?????????????????");
                        alert("用户名或密码错误");
                    } else if (item == "8") {
                        // $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "9") {
                        // $("#login_error").html("?????????????");
                        alert("用户名或密码错误");
                    } else if (item == "10") {
                        // $("#login_error").html("??????????????????");
                        alert("用户名或密码错误");
                    } else if (backuser == "00") {
                        alert("用户名或密码错误");
                        checkCode();
                        GetFocus($("#loginAccessPwd1"));
                    } else {
                        $("#loginx").hide();
                        // ?????? ???
                        writeCookie("rememberLoginUser", item);
                        /* $(".login").hide();
                         $(".login_error").hide();
                         $(".index_zc").hide(); // 3 button
                         $(".dfhdgdg").hide();  // 3 count
                         $(".tele").hide();	
                      $(".login_after").show();
                        */
                        document.getElementById('window').style.display = 'none';
                        $("#comUserName").html(item);
                        //window.open(current_url);
                        // ?????? ????
                    }
                    //					
                    //else
                    //{
                    //alert("??????????????????!");
                    //   $("#login_error").html("??????????????????!");
                    //}
                } else if (id == "uid") {
                    //???????????????
                    Getuserintegrallevel(item, 1, 2);
                    document.getElementById('window').style.display = 'none';
                    writeCookie("rememberUserID", item);
                    window.open(current_url);
                    document.getElementById('updataPwd').href = "http://hyuser.91huayi.com/AccountCenter/setpwd.aspx?tag=91huayi&uid=" + item + "&user_name=" + loginName;
                   
                    //document.getElementById('gocmelogin').href="http://cme45.91huayi.com/secure/regConfirmation.aspx?uid="+item;
                    //document.getElementById('gocmelogin').href="http://cme45.91huayi.com/cme.html";
                    //document.getElementById('headCmeLink').href="http://cme45.91huayi.com/secure/regConfirmation.aspx?uid="+item;
                    //document.getElementById('headCmeLink').href="http://cme45.91huayi.com";
                    // 2011-11-20 sso begin -------------------------------
                    var ifr;
                    try {
                        ifr = document.createElement('');
                    } catch (ex) {
                        ifr = document.createElement('iframe');
                    }
                    ifr.id = 'sso_iframe';
                    ifr.name = 'sso_iframe';
                    ifr.width = 0;
                    ifr.height = 0;
                    ifr.marginHeight = 0;
                    ifr.marginWidth = 0;
                    ifr.src = 'https://sso.91huayi.com/sso/login_all.ashx?username=' + loginName + '&password=' + loginPwd + '&loginType=1&from=91huayi';
                    document.body.appendChild(ifr);
                    // 2011-11-20 sso end ---------------------------------
                } else if (id == 'province_name') {
                    if (item == "重庆市") {
                        //document.getElementById('chaxunxuefen').href = "http://www.icme.cqwsjsw.com";
                        //document.getElementById('chaxunxuefen1').href = "http://www.icme.cqwsjsw.com";
                        
                         document.getElementById('chaxunxuefen').href = "http://183.230.146.12:20000";
                      document.getElementById('chaxunxuefen1').href = "http://183.230.146.12:20000";
                    } else if (item == "湖南省") {
                        document.getElementById('chaxunxuefen').href = "http://hunan.wsglw.net";
                        document.getElementById('chaxunxuefen1').href = "http://hunan.wsglw.net";
                    } else if (item == "陕西省") {
                        document.getElementById('chaxunxuefen').href = "http://124.115.170.210:8005/kjptwsw";
                        document.getElementById('chaxunxuefen1').href = "http://124.115.170.210:8005/kjptwsw";
                    } else if (item == "山西省") {
                        /* try { $(".zz_sx_bg").css("display","block");  }catch(err) {    }
                         */
                        document.getElementById('chaxunxuefen').href = "http://218.26.4.129/Hylogin";
                        document.getElementById('chaxunxuefen1').href = "http://218.26.4.129/Hylogin";
                    } else if (item == "上海市") {
                        try {
                            $(".zz_sh_bg").css("display", "block");
                        } catch (err) {}
                    } else if (item == "安徽省") {
                        document.getElementById('chaxunxuefen').href = "http://www.ahscme.cn";
                        document.getElementById('chaxunxuefen1').href = "http://www.ahscme.cn";
                    } else if (item == "四川省") {
                        document.getElementById('chaxunxuefen').href = "http://202.61.90.26/gateway/home.html";
                        document.getElementById('chaxunxuefen1').href = "http://202.61.90.26/gateway/home.html";
                    } else if (item == "贵州省") {
                        document.getElementById('chaxunxuefen').href = "http://gzcme.yiboshi.com";
                        document.getElementById('chaxunxuefen1').href = "http://gzcme.yiboshi.com";
                    } else if (item == "山东省") {
                        document.getElementById('chaxunxuefen').href = "http://sdyj.wsglw.net";
                        document.getElementById('chaxunxuefen1').href = "http://sdyj.wsglw.net";
                    } else if (item == "江苏省") {
                        document.getElementById('chaxunxuefen').href = "https://cme.jsma.net.cn";
                        document.getElementById('chaxunxuefen1').href = "https://cme.jsma.net.cn";
                    } else if (item=="甘肃省"){
                        document.getElementById('chaxunxuefen').href = "https://kjpt.wsglw.net";
                        document.getElementById('chaxunxuefen1').href = "https://kjpt.wsglw.net"; 
                    }
                    else if (item == "河北省") {
                        document.getElementById('chaxunxuefen').href = "http://icme.haoyisheng.com";
                        document.getElementById('chaxunxuefen1').href = "http://icme.haoyisheng.com";
                    } else if (item == "北京市") {
                        document.getElementById('chaxunxuefen').href = "http://www.bjicme.com/";
                        document.getElementById('chaxunxuefen1').href = "http://www.bjicme.com/";
                    } else if (item == "新疆维吾尔自治区") {
                        document.getElementById('chaxunxuefen').href = "http://icme.haoyisheng.com";
                        document.getElementById('chaxunxuefen1').href = "http://icme.haoyisheng.com";
                    } else if (item == "天津市") {
                        document.getElementById('chaxunxuefen').href = "http://icme.haoyisheng.com";
                        document.getElementById('chaxunxuefen1').href = "http://icme.haoyisheng.com";
                    } else {
                        document.getElementById('chaxunxuefen').href = "http://kjptwsw.91huayi.com";
                        document.getElementById('chaxunxuefen1').href = "http://kjptwsw.91huayi.com";
                    }
                } else if (id == "ifCanBuyCard") {
                    if (item == "0") {
                        $("#xxxx").css("display", "none");
                    }
                    if (item == "1") {
                        $("#xxxx").css("display", "block");
                    }
                } else {
                    // alert("用户名或密码错误");
                }
            })
        }
    })
}
function loading() {
    $("#butLogin").val("正在登录..");
}
function writeCookie(key, value) {
    var sExpires = new Date();
    sExpires.setTime(sExpires.getTime() + 24 * 60 * 60 * 1000);
    setCookie(key, value, "", "/", sExpires.toGMTString(), "");
    if (getCookie(key) == null) {
        setCookie(key, value, "", "/", sExpires.toGMTString(), "");
    }
}
function writeCookie91huayi(key, value) {
    var sExpires = new Date();
    sExpires.setTime(sExpires.getTime() + 24 * 60 * 60 * 1000);
    setCookie(key, value, "91huayi.com", "/", sExpires.toGMTString(), "");
    if (getCookie(key) == null) {
        setCookie(key, value, "91huayi.com", "/", sExpires.toGMTString(), "");
    }
}
function writeCookieWeek(key, value) {
    var sExpires = new Date();
    sExpires.setTime(sExpires.getTime() + 7*24 * 60 * 60 * 1000);
    setCookie(key, value, "", "/", sExpires.toGMTString(), "");
    if (getCookie(key) == null) {
        setCookie(key, value, "", "/", sExpires.toGMTString(), "");
    }
}
function writeCookieRCWeek(key, value) {
    var sExpires = new Date();
    sExpires.setTime(sExpires.getTime() + 15*24 * 60 * 60 * 1000);
    setCookie(key, value, "", "/", sExpires.toGMTString(), "");
    if (getCookie(key) == null) {
        setCookie(key, value, "", "/", sExpires.toGMTString(), "");
    }
}
function getCookie(sKey) {
    var sCookie = document.cookie;
    if (!sCookie) return null;
    var sTag = sKey + "=";
    var iBegin = sCookie.indexOf(sTag);
    if (iBegin < 0) return null;
    iBegin += sTag.length;
    var iEnd = sCookie.indexOf(";", iBegin);
    if (iEnd < 0) iEnd = sCookie.length;
    return sCookie.substring(iBegin, iEnd);
}
function setCookie(sKey, sValue, sDomain, sPath, sExpires, blSecure) {
    var sCookieStr = sKey + "=" + sValue + ";";
    if (sDomain) sCookieStr += " DOMAIN=" + sDomain + ";";
    if (sPath) sCookieStr += " PATH=" + sPath + ";";
    if (sExpires) sCookieStr += " EXPIRES=" + sExpires + ";";
    if (blSecure) sCookieStr += " SECURE";
    document.cookie = sCookieStr;
}
  function testx(url)
        {
            if  (url.indexOf("https://")>=0)
            {
              window.location.href='https://hysso.91huayi.com/checkLogin?returnUrl=https://hysslogin.91huayi.com/callBack/ticket?homeUrl='+url;
return false;
            }else {
window.location.href='https://hysso.91huayi.com/checkLogin?returnUrl=https://hysslogin.91huayi.com/callBack/ticket?homeUrl='+'https://www.91huayi.com/'+url;return false;}
        }
function delCookie(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = getCookie(name);
    if (cval != null) document.cookie = name + "=" + cval + ";path=/;expires=" + exp.toGMTString();
}
function getSelectValue(name) {
    var obj = document.getElementById(name);
    return obj.value;
}