
//登录方法
function doLogin() {

	if(doCheck()){
	var username = document.getElementById("r_username").value;
	var password = document.getElementById("r_password").value;
	//记录字段判断为学员/会员登录
	var hourValue = document.getElementById("hourValue").value;
		BufIndexUserLoginManager.doLogin(username,password,hourValue,function(data,textStatus){
			if(data.status){
				window.location.reload();
			}else {
				alert(data.message);
			}
		});
	}
}
//退出登录
function removeLogin() {
	BufIndexUserLoginManager.removeLogin(function(data,textStatus){
		if(data.status){
			window.location.href="indexHudong.htm";
		}else {
			alert("退出失败");
		}
	});
}
//检查登录
function doCheck() {
	var username = document.getElementById("r_username").value;
	var password = document.getElementById("r_password").value;
	if(username.length==0){
		alert("请输入用户名！");
		return false;
	}else if (password.length==0){
		alert("请输入密码！");
		return false;
	}
	return true;
}

//学员or会员转换
function setTab2(name,id)
{
	for(var i=0;i<10;i++)
	{
		if(document.getElementById(name+i))
		{
			document.getElementById(name+i).className='';
		}
	}
	if(document.getElementById(name+id))
	{
		document.getElementById(name+id).className='hover';
	}
}

function openlink(url)
{
	parent.window.location = url;
}
