/**index.axps页登录处理*/
//////////////////////////////*------------start
var bln;
var userid = "";
var userType = "";
function LoginSystem(){
    //检测登陆数据
    if(!CheckData()){
        return false;
    }
    //登录处理
    LoginDo();
        
    return false;           
}
function LoginSystem_Per(){
    //检测登陆数据
    if(!CheckPerData()){
        return false;
    }
    //登录处理
    LoginDo();
        
    return false;   
}
/*登录处理*/
function LoginDo(){
    var userNo = document.all.txtUserName.value;
    var userpwd = document.all.txtPassWord.value;
    var radPer = document.all.radInd.checked;
    var radCom = document.all.radEnte.checked;
    
    JsLogin.LoginDoDB(userNo,userpwd,radPer,radCom,LoginDoDB_CallBack);                 
}
function LoginDoDB_CallBack(response){
    var msg = response.value;
    if(msg != ""&&msg != null &&msg != "null"){
        alert(response.value);                    
    }
    //设置
    LoginUserIDType();                     
}
/*退出登录*/
function ExitLogin(){
    ClearSession();                               
}   
/*清除登录状态的Session*/
function ClearSession(){
    JsLogin.ClearLogin();                
    tblContent.style.display = "";
    tblType.style.display = "";
    tblView.style.display = "none"; 
    document.all.txtUserName.value = "";
    document.all.txtPassWord.value = "";
    document.all.radInd.checked = false;
    document.all.radEnte.checked = false;                
} 

/*校验登录名称和密码、登录身份*/
function LoginValidate(){
    JsLogin.LoginCheck(LoginValidate_CallBack);                
}
function LoginValidate_CallBack(response){
    bln = response.value;                
}
/*取得登录ID*/
function LoginUserIDType(){
    JsLogin.GetUserSessionMethod(LoginUseridType_CallBack);
}
function LoginUseridType_CallBack(response){                
    userid = response.value[0];            
    loginid.innerText = userid; 
    userType = response.value[1];
    logintype.innerText = userType; 
    
    var strType = logintype.innerText;
    GetMangerPage(strType);
    //处理登录状态的显示 
    ShowLoginState();                                       
}  
    /*处理是否处于登录状态*/
function ShowLoginState(){ 
    if( userid == null || userid == "null"||userid ==""){                    
        tblContent.style.display = "";
        tblType.style.display = "";
        tblView.style.display = "none"; 
        document.all.txtUserName.value = "";
        document.all.txtPassWord.value = "";
        document.all.radInd.checked = false;
        document.all.radEnte.checked = false;                    
    }else{
        tblContent.style.display = "none";
        tblType.style.display = "none";
        tblView.style.display = "";
    }
}
/* 获得进入用户管理页面的路径 */
function GetMangerPage(type){
    JsLogin.GetUserPage(type,GetManagerPage_CallBack);    
}
function GetManagerPage_CallBack(response){
    hnkManager.href=response.value;
}

