function loginSubmit(login, uc)
{
	var username = login.elements['username'];
	var password = login.elements['password'];
   if(!loginCheck(login)) return false;
	if(uc == 1) return true;
	$.post(login.action, 'action=ajax&username='+username.value+'&password='+password.value, function(data){
		if(data == 11)
		{
			document.getElementById('logined_admurl').href = "yp/business/";
			$('#logined_admurl').html("企业管理后台");
			$('#logined_username').html(username.value);
			$('#logined_identity').html("企业会员");
			$('#div_login').hide();
			$('#div_logined').show();
		}
		else if(data==10){
			document.getElementById('logined_admurl').href="member/";
			$('#logined_username').html(username.value);
			$('#logined_identity').html("个人会员");
			$('#div_login').hide();
			$('#div_logined').show();
			}
		else
		{
			alert('登录失败');
			redirect(login.action);
		}
		username.value = password.value = '';
	});
	return false;
}

function logout(url)
{
	$.get(url+'&id='+Math.random()*5, function(data){
		if(data != 1) alert(data);
	});
	$('#div_logined').hide();
	$('#div_login').show();
}

function loginshow()
{
	var auth = getcookie('auth');
	var membertype= getcookie('membertype');
	if(auth != null)
	{
		$('#logined_username').html(unescape(decodeURIComponent(getcookie('username'))));
		
		$('#div_login').hide();
		$('#div_logined').show();
		if(membertype==11){
			
			document.getElementById('logined_admurl').href = "yp/business/";
			$('#logined_admurl').html("企业管理后台");
			$('#logined_identity').html("企业会员");
			}
	}
	else
	{
			
		$('#logined_identity').html("个人会员");
		$('#div_login').show();
		$('#div_logined').hide();
	}
}

$(function(){
   if(document.getElementById('div_login'))   loginshow();
});
