﻿function check_reg(f) {
	
	if(!isNotEmpty(f.username)) {
		alert('对不起，登陆账号不能为空！');
		return false;
	}
	if(!isNotEmpty(f.password)) {
		alert('对不起，登陆密码不能为空！');
		return false;
	}	
	if(!isNotEmpty(f.confirm_pass)) {
		alert('对不起，请重复输入您的密码！');
		return false;
	}	
}


function login() {
	if(!isNotEmpty($id('login_form').username)) {
		alert('对不起,用户名不能为空！');
		return false;			
	}
	if(!isNotEmpty($id('login_form').password)) {
		alert('对不起,密码不能为空！');
		return false;			
	}
	if(!isNotEmpty($id('login_form').authcode)) {
		alert('对不起,验证码不能为空！');
		return false;			
	}
	var username= $id('login_form').username.value;
	var password= $id('login_form').password.value; 
	var authcode= $id('login_form').authcode.value;  
	
	var contant="username="+username+"&password="+password+"&authcode="+authcode;
	send_request1('userlogin.php','post',contant);

}

function ajax_do1() {
	var context=http_request.responseText;
	if(context=='1') {
		alert("对不起，您输入的用户名和密码有误，请重新输入！");
	}else if(context=='2') {
		alert("对不起，您输入验证码有误，请重新输入！");		
	}else{
		var context1=http_request.responseText.split('|');
		var username=context1[1];
		$id('userlogin').innerHTML='<table width="170" border="0" cellspacing="0" cellpadding="0"><tr><td height="10" colspan="3"></td></tr><tr><td width="58" height="60" align="right" rowspan="2"><img src="images/denglu_1.jpg" /></td><td width="2" rowspan="2"></td><td width="110" align="center" class="right_login" colspan="2">欢迎您:'+username+'</td></tr><tr><td align="center"><input type="button" value="信息修改" onclick="modify();" style="cursor:pointer;width:60px;" /></td><td align="center"><input type="button" value="注销" onclick="logout();" style="cursor:pointer;width:40px;" /></td></tr><tr><td height="10" colspan="3"></td></tr></table>';
		$id('img_login').innerHTML='<img src="images/right3.jpg" width="71" height="20" border="0" />';
	}
}

function modify() {
	
	window.location.href="user_modify.php";	
	
}


function logout() {
	window.location.href="logout.php";
}

function tiwen() {
	//window.location.href="tiwen.php";	
	window.location.href="http://ask.qianliekang.net/ask.aspx";	
}

function wenti() {
	//window.location.href="wenti.php";	
	window.location.href="http://ask.qianliekang.net";	
}

function check_tiwen(f) {
	if(!isNotEmpty(f.title)) {
		alert('对不起,标题不能为空！');
		return false;			
	}
	if(!isNotEmpty(f.ask)) {
		alert('对不起,详细描述不能为空！');
		return false;			
	}	
	
}
