var xmlHttp = false;
try {
xmlHttp = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
xmlHttp = false;
}
}
}
if (!xmlHttp){
alert("无法创建 XMLHttpRequest 对象！");
}

function ajax_tj(){
	if(document.flog.user.value.length <2 || document.flog.user.value.length >12){
		alert('用户名长度有误');
		document.flog.user.focus();
		return false;
	}
	if(document.flog.psw.value.length <6 || document.flog.psw.value.length >20){
		alert('密码长度有误');
		document.flog.psw.focus();
		return false;
	}
	var name=document.getElementById('user').value;
	var pass=document.getElementById('password').value;
	var url='login.php?n=' + name + '&p=' + pass +'&t=tj';
	xmlHttp.open("GET",url,true);//这里的true代表是异步请求
	xmlHttp.onreadystatechange = ajax_tj_c;
	xmlHttp.send(null);
}
function ajax_tj_c(){
	if(xmlHttp.readyState == 4){
		var rs = xmlHttp.responseText;
		window.location.href="book.php";
		alert(rs);
	}
}

function ajax_gb_tj(){
	if(document.fgb.user.value.length <2 || document.fgb.user.value.length >12){
		alert('用户名长度有误');
		document.fgb.user.focus();
		return false;
	}
	if(document.fgb.psw.value.length <6 || document.fgb.psw.value.length >20){
		alert('密码长度有误');
		document.fgb.psw.focus();
		return false;
	}
	var name=document.getElementById('user').value;
	var pass=document.getElementById('password').value;
	var url='login.php?n=' + name + '&p=' + pass +'&t=tj';
	xmlHttp.open("GET",url,true);//这里的true代表是异步请求
	xmlHttp.onreadystatechange = ajax_gb_tj_c;
	xmlHttp.send(null);
}
function ajax_gb_tj_c(){
	if(xmlHttp.readyState == 4){
		var rs = xmlHttp.responseText;
		window.location.href="gb.php";
		alert(rs);
	}
}

function modify(id){
	var id;
	var vinput='a' + id;
	var v=document.getElementById(vinput).value;
	var url='_lianxi.php?id=' + id + '&v=' + v;
	xmlHttp.open("GET",url,true);//这里的true代表是异步请求
	xmlHttp.onreadystatechange = modify_c;
	xmlHttp.send(null);
}
function modify_c(){
	if(xmlHttp.readyState == 4){
		var rs = xmlHttp.responseText;
		window.location.href="lianxi.php";
		alert(rs);
	}
}

function replyToGuest(id){
	var con,id;
 	con=document.getElementById('reply').value;
	//alert(con);
	//return false;
	var url='_reply.php?con=' + con + '&id=' + id;
	xmlHttp.open("GET",url,true);//这里的true代表是异步请求
	xmlHttp.onreadystatechange = replyToGuest_c;
	xmlHttp.send(null);	
}
function replyToGuest_c(){
	if(xmlHttp.readyState == 4){
		var rs = xmlHttp.responseText;
		alert(rs);
	}	
}

//quote
function quote(id){
	var url='_quote.php?id=' + id;
	xmlHttp.open("GET",url,true);//这里的true代表是异步请求
	xmlHttp.onreadystatechange = quote_c;
	xmlHttp.send(null);	
}
function quote_c(){
	if(xmlHttp.readyState == 4){
		var rs = xmlHttp.responseText;
		var quote=rs.split('<yg-sep>');
		document.getElementById('qn').innerHTML=quote[0];
		document.getElementById('detail').innerHTML=quote[1];
	}else{
		document.getElementById('detail').innerHTML='正在请求页面请稍等……';	
	}
}
//quote

//showjob
function showjob(id){
	var url='showjob.php?id=' + id;
	xmlHttp.open("GET",url,true);//这里的true代表是异步请求
	xmlHttp.onreadystatechange = showjob_c;
	xmlHttp.send(null);	
}
function showjob_c(){
	if(xmlHttp.readyState == 4){
		var rs = xmlHttp.responseText;
		var job=rs.split('<yg-sep>');
		document.getElementById('jobname').innerHTML=job[0];
		document.getElementById('jobcon').innerHTML=job[1];
	}else{
		document.getElementById('jobcon').innerHTML='招聘信息正在加载中，请稍等……';	
	}
}
//showjob

//统计开始
function tongji(){
	var url='tongji.php?'+Math.random();
	xmlHttp.open("GET",url,true);//这里的true代表是异步请求
	xmlHttp.onreadystatechange = tongji_c;
	xmlHttp.send(null);
}
function tongji_c(){
	if(xmlHttp.readyState == 4){
		var rs = xmlHttp.responseText;
		document.getElementById('tongji').innerHTML=rs;
	}else{
		document.getElementById('tongji').innerHTML='……';	
	}
}
//统计结束