﻿//begin
function createAjax() {			
	var _xmlhttp;
	try {	
		_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	
	}
	catch (e) {
		try {
			_xmlhttp=new XMLHttpRequest();	
		}
		catch (e) {
			_xmlhttp=false;		
		}
	}
	return _xmlhttp;	
}
//=================================
//------------------------------
function load_staus(obj,url) {		
	var xmlhttp=createAjax();	
	if (xmlhttp) {		
		var cont=document.getElementById(obj);		
		xmlhttp.open('get',''+url+'?n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				cont.innerHTML=unescape(xmlhttp.responseText);	
			}
			else {
				cont.innerHTML='<span style="color:red"><img src="img/loading.gif"></span>';	
			}
		}
		xmlhttp.send(null);	
	}
}

function chk_staus(u_name,url,obj) {
	//alert("名！");
	var xmlhttp=createAjax();	
	if (xmlhttp) {		
		var cont=document.getElementById(obj);		
		xmlhttp.open('get',''+url+'?un='+u_name+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				cont.innerHTML=unescape(xmlhttp.responseText);	
			}
			else {
				cont.innerHTML='<span style="color:red"><img src="img/loading.gif"></span>';	
			}
		}
		xmlhttp.send(null);	
	}
}
//======================================
function check_user(obj,url,var1,var2) {
	//var v_dt=var1;
	//var v_dt_1=var2;
	//alert(v_dt);
	//alert(v_dt_1);
	//return false;
	var xmlhttp=createAjax();	
	if (xmlhttp) {		
		var cont=document.getElementById(obj);	
		//alert(var1);
		xmlhttp.open('post',''+url+'?n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				cont.innerHTML=unescape(xmlhttp.responseText);	
			}
			else {
				cont.innerHTML='<span style="color:red"><img src="images/loading_b.gif" width="16" height="16" />&nbsp;&nbsp;正在检测用户，请稍候......</span>';	
			}
		}
		xmlhttp.send(null);	
	}
	return true;
}
//============================================
function add_sumit(obj,url,var1,var2,type,bl_stype) {
	//var v_dt=var1;
	//var v_dt_1=var2;
	//alert(var1);
	//alert(var2);
	var xmlhttp=createAjax();	
	if (xmlhttp) {		
		var cont=document.getElementById(obj);		
		xmlhttp.open('get',''+url+'?ac_id='+id+'&var1='+var1+'&var2='+var2+'&bl_ty='+bl_stype+'&type='+type+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				cont.innerHTML=unescape(xmlhttp.responseText);	
			}
			else {
				cont.innerHTML='<span style="color:red"><img src="images/loading_b.gif" width="16" height="16" />&nbsp;&nbsp;正在添加数据，请稍候......</span>';	
			}
		}
		xmlhttp.send(null);	
	}
	return true;
}
///////////========================
function hit()
{
	if(document.getElementById("uer_name").value=="")
	{	
	alert("请输入用户名！");
	document.getElementById("uer_name").focus();
	return false;
		}
		if(document.getElementById("pw_user").value=="")
	{
	alert("请输入密码！");
	document.getElementById("pw_user").focus();
	return false;
		}
		//alert(document.getElementById("uer_name").value);
		//alert(document.getElementById("pw_user").value);
		//return false;
	//return false;
	check_user('login','login_chk.asp',document.getElementById('uer_name').value,document.getElementById('pw_user').value);
	}
	///================================
	function submit_pl(obj1,obj2,url,obj3,type,bl_stype,flag)
{
	if(document.getElementById(obj1).value=="")
	{	
	alert("请输入用户名或登陆后再发表，谢谢！");
	if(flag=="first")
	{
	document.getElementById("jb_name").focus();
	}
	else
	{
		document.getElementById(obj1).focus();
		}
	return false;
		}
		if(document.getElementById(obj2).value=="")
	{
	alert("请输入观点或看法内容！");
	document.getElementById(obj2).focus();
	return false;
		}
		if(document.getElementById(obj2).value.length>3000)
		{alert("论点不要超过3000字！");
		document.getElementById(obj2).focus();
		return false;
		}
	//return false;
	var flag
	flag=add_sumit(obj3,'ad_pl.asp',escape(document.getElementById(obj1).value),escape(document.getElementById(obj2).value),type,bl_stype);
	if(flag)
	  {alert("发表成功！")
		  set_nothing(obj1,obj2);
		}
		getweblist_more(1,obj3,url);
	}
	//===================================================
	function srt_zero(obj1,obj2)
	{//document.getElementById(obj1).value="";	
	document.getElementById(obj2).value="";
	document.getElementById(obj2).focus();		
		}
		//====================
		function set_nothing(obj1,obj2)
	{//document.getElementById(obj1).value="";
	document.getElementById(obj2).value="";
	document.getElementById(obj2).focus();		
		}
		//=================================================
function getweblist_more(page,obj,url) {		
	var xmlhttp=createAjax();	
	if (xmlhttp) {		
		var content=document.getElementById(obj);		
		xmlhttp.open('get',''+url+'.asp?a_id='+id+'&page='+page+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				content.innerHTML=unescape(xmlhttp.responseText);	
			}
			else {
				content.innerHTML='<span style="color:red">正在从服务器提取数据......</span>';	
			}
		}
		xmlhttp.send(null);	
	}
	document.getElementById(page);
}
//==========================
function psh_load(obj,t_id) {	
//alert(t_id);
//return false;
	var xmlhttp=createAjax();	
	if (xmlhttp) {		
		var content=document.getElementById(obj);		
		xmlhttp.open('get','psh_load.asp?id='+t_id+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				content.innerHTML=unescape(xmlhttp.responseText);	
			}
			else {
				content.innerHTML='<span style="color:red">...</span>';	
			}
		}
		xmlhttp.send(null);	
	}
}
//========================
<!--
function gotourl(obj,url) {		
	var xmlhttp=createAjax();	
	if (xmlhttp) {		
		var content=document.getElementById(obj);		
		xmlhttp.open('get',url+'?id='+id+'&ClassID='+clid+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				content.innerHTML=unescape(xmlhttp.responseText);	
			}
			else {
				content.innerHTML='<img src="images/loading_b.gif"><span style="color:red">正在读取相关内容，请稍候......</span>';	
			}
		}
		xmlhttp.send(null);	
	}
}
//-->
function ConfirmDel()
{
	if(confirm("确定要删除吗？"))
		    return true;
		else
			return false;
	}
	function serch(obj){
		if(document.getElementById(obj).value=="")
		{
		alert("请输入查询内容！");
		document.getElementById(obj).focus();
		return false;
		}
		var text=document.getElementById(obj).value;
		//alert('aa.htm?vars='+text+'');
		window.open('class_search.htm?a_id='+text+'');
	}
	function serchs(obj){
		if(document.getElementById(obj).value=="")
		{
		alert("请输入查询内容！");
		document.getElementById(obj).focus();
		return false;
		}
		var text=document.getElementById(obj).value;
		//alert('aa.htm?vars='+text+'');
		serach_more('1','yt_content','yt_list_ser',text);
	}
	
	//////////////////////
	function serach_more(page,obj,url,v_id) {		
	var xmlhttp=createAjax();	
	if (xmlhttp) {		
		var content=document.getElementById(obj);		
		xmlhttp.open('get',''+url+'.asp?a_id='+v_id+'&page='+page+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				content.innerHTML=unescape(xmlhttp.responseText);	
			}
			else {
				content.innerHTML='<span style="color:red">正在从服务器提取数据......</span>';	
			}
		}
		xmlhttp.send(null);	
	}
	//document.getElementById(page);
}
//======================================
function check_jbuser(obj,url,var1,var2,var3) {
	//var v_dt=var1;
	//var v_dt_1=var2;
	//alert(v_dt);
	//alert(v_dt_1);
	//return false;
	var xmlhttp=createAjax();	
	if (xmlhttp) {		
		var cont=document.getElementById(obj);	
		//alert(var1);
		xmlhttp.open('post',''+url+'?var1='+var1+'&var2='+var2+'&var3='+var3+'&id='+id+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				cont.innerHTML=unescape(xmlhttp.responseText);	
			}
			else {
				cont.innerHTML='<span style="color:red"><img src="images/loading_b.gif" width="16" height="16" />&nbsp;&nbsp;正在检测用户，请稍候......</span>';	
			}
		}
		xmlhttp.send(null);	
	}
	return true;
}
//============================================
///////////========================
function log_in(obj1,obj2,obj3)
{
	if(document.getElementById(obj1).value=="")
	{	
	alert("请输入用户名！");
	document.getElementById(obj1).focus();
	return false;
		}
		if(document.getElementById(obj2).value=="")
	{
	alert("请输入密码！");
	document.getElementById(obj2).focus();
	return false;
		}
		if(document.getElementById(obj3).value=="")
	{
	alert("请选择角色！");
	document.getElementById(obj3).focus();
	return false;
		}
		//alert(document.getElementById("uer_name").value);
		//alert(document.getElementById("pw_user").value);
		//return false;
	//return false;
	check_jbuser('jb_login','jb_login_chk.asp',document.getElementById(obj1).value,document.getElementById(obj2).value,document.getElementById(obj3).value);
	}
	///================================