//更新session数据
$.get("/user/user_updateSessionInfo.do",{rand:Math.random()});

function myLoad( obj,url )
{
     var xhr = window.ActiveXObject ? new  window.ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
     xhr.onreadystatechange = function()
     {
         if( xhr.readyState == 4 && 
            ( xhr.status == 200 || xhr.status == 304 ) )
               obj.innerHTML = xhr.responseText;
     }
     xhr.open( 'get',url,true );
     xhr.send(null);
}


function indexLogin(){
	
	var loginNameIdVal = $("#loginNameId").val();
	var passwordIdVal = $("#passwordIdP").val();
	if ((loginNameIdVal == null || loginNameIdVal.length < 1) && (passwordIdVal == null || passwordIdVal.length < 1)) {
		alert("用户名和密码不能为空");
		$("#loginNameId").focus();
		return ;
	}
	
	if (loginNameIdVal == null || loginNameIdVal.length < 1) {
		$("#loginNameId").focus();
		alert("用户名不能为空");
		return ;
	}
	if (passwordIdVal == null || passwordIdVal.length < 1) {
		$("#passwordIdP").focus();
		alert("密码不能为空");
		return ;
	}
	var myForm = document.forms['indexLoginForm'];
	myForm.target = "loginFrame";
	
	myForm.action = "/user/ws_normalLogin.do";
	myForm.submit();
	
}

function loginSuccess() {
	$("#topLayout").load("/top.jsp?rand="+Math.random());
	var loginDiv = document.getElementById("loginDiv");
	if (loginDiv) {
		$("#loginDiv").load("/user/loginSuccess.jsp?time="+Math.random());
	}
	
	var matchLoginDiv = document.getElementById("matchLoginDiv");
	if (matchLoginDiv) {
		$("#matchLoginDiv").load("/user/matchloginSuccess.jsp?time="+Math.random());
	}
	
	//加载冒泡tips
	var tips = document.getElementById("tips");
	if (tips) {
		$("#tips").load("/user/tips.jsp?rand="+Math.random());
	}
}

function loginFailure(errorCode){
	$("#topLayout").load("/top.jsp?rand="+Math.random());
	var loginDiv = document.getElementById("loginDiv");
	if (loginDiv) {
		$("#loginDiv").load("/user/beforeLogin.jsp?errorCode="+errorCode+"&time="+Math.random()+"&indexLogin=indexLogin");
	}
	
	var matchLoginDiv = document.getElementById("matchLoginDiv");
	if (matchLoginDiv) {
		$("#matchLoginDiv").load("/user/beforeLogin.jsp?errorCode="+errorCode+"&time="+Math.random());
	}
	
}


