//执行首页登陆操作
var doLoginMutex = true; //保证客户端执行这个函数返回后才能继续执行
function doLogin(){
if(doLoginMutex){
		if ($("#username").val().length < 2 || $("#username").val().length > 15 || $("#password").val().length < 6){
			alert("您的用户名或者密码有误，请确认后登录！");
			window.location.href = "http://"+snsDomain+"/st_pass/PreLogin?username=";//首页登录失败，跳转到登录页面去
			return false;
		}
		var d = $('#loginTip');
		d.html("登录中...");
		d.css('display','block');
		var url =  "http://"+snsDomain+"/st_pass/DoLogin";
		var pars = $("#loginform").serialize()+"&fromIndex=y"; 
		doLoginMutex = false;
		$.ajax({
		    url: url,
		    data: pars,
		    type: 'POST',
		    dataType: 'json',
		   	timeout: global_AjaxTimeOut,
		    error: function(){
		       	alert('Error loading XML document');
		        d.html("网络请求超时，请重试");
		       	doLoginMutex = true;
		    },
		    success: function(xml){
				//d.html(xml.msg);
				if(xml.flag){
					if(window.location.href==xml.forward){
						xml.forward = "http://"+snsDomain+"/st/PreMyProfile";	
					}
					window.location.href = xml.forward;
				}else{//登录失败，跳转到登录界面
					alert(xml.msg);
					window.location.href = "http://"+snsDomain+"/st_pass/PreLogin?username="+xml.username;//首页登录失败，跳转到登录页面去
				}
				doLoginMutex = true;
		    }
		});
		
		return true;
	}	
}
