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 == 1){
			$('#logined_username').html(username.value);
			$('#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');
	if(auth != null){
		$('#logined_username').html(unescape(getcookie('username')));
		$('#div_login').hide();
		$('#div_logined').show();
	}else{
		$('#div_logined').hide();
		$('#div_login').show();
	}
}

function show_win_status(n){
	var msg = ["欢迎光临西岭风清，请推荐给你的好友！", "唯一网址: www.xlfqnet.cn","西岭风清，求真务实，品味人生！", "如果网址打不开，请等待半个小时再试！", "忘记网址请在百度或Google中输入“西岭风清”。", "西岭风清：值得你收藏的网站！", "西岭风清：值得你回味的网站！", "西岭风清，最清纯的网络领地！", "西岭风清：更有品位的生活！"];
	if(!n || n<0 || n>=msg.length) n=0;
	window.status = ">>" + msg[n];
	document.title = window.oldtitle + " | " + msg[n];
	setTimeout(function(){show_win_status(++n)}, 1000);
}

$(document).ready(function(){
	window.oldtitle = document.title;
	var hstyle = 'display:none;width:1px;height:1px;overflow:hidden;font-size:1px;';
	var msg = '<font style="'+hstyle+'">转载自<a style="'+hstyle+' href="http://www.xlfqnet.cn/">西岭风清网站(www.xlfqnet.cn)</a>，原文网址：<a style="'+hstyle+' href="' + location.href + '">' + location.href + '</a>。</font>', msg2='<font style="'+hstyle+'"><a style="'+hstyle+' href="http://www.xlfqnet.cn/">转自西岭风清</a></font>';
	show_win_status(0);
	loginshow();
	$('div.content-endtext').append(msg).find('p:eq(3),p:eq(8),p:eq(15),p:eq(20),p:eq(30),div:eq(2),div:eq(16)').append(msg);
	$('div.content-endtext').find('strong:eq(2),strong:eq(5),strong:eq(9),strong:eq(13),b:eq(5),b:eq(10),b:eq(15),td:eq(3),td:eq(9),td:eq(16)').append(msg2);
});