function data_fun(msg, set_var)
{
	var URL = "chat_his.php?";
	if(msg)
	{
		URL += "msg="+msg;
	}
	if(set_var)
	{
		URL += "&set_var="+set_var;
	}
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest();
	}
	else
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById('chat_his').innerHTML=xmlhttp.responseText;
			document.getElementById('chat_his').scrollTop = document.getElementById('chat_his').scrollHeight;
		}
	}
	xmlhttp.open("GET", URL, true);
	xmlhttp.send();
}
function check_chat(uid)
{
	var URL = "chat/check_chat.php?uid="+uid;
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest();
	}
	else
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var flag = xmlhttp.responseText;
			if(flag)
			{
//			window.open('chat/chat.php?url='+flag, 'mywindow','location=1,status=1,scrollbars=1, width=660,height=380');
				document.getElementById('reply_chat_box').style.display = "block";
//				if(xmlhttp.responseText!="")
					document.getElementById('reply_chat_box').innerHTML = xmlhttp.responseText;
//				else 
//					document.getElementById('reply_chat_box').innerHTML += '';
			}

		}
	}
	xmlhttp.open("GET", URL, true);
	xmlhttp.send();
}
function clear_data(var1)
{
	var URL = "chat_his.php?var1="+var1;
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest();
	}
	else
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var flag = xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET", URL, true);
	xmlhttp.send();
}
function tmp_remove(var1, type)
{
	var URL = "chat/check_chat.php?tmp_rmv="+var1+"&type="+type;
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest();
	}
	else
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var flag = xmlhttp.responseText;
			window.location.reload(true);
		}
	}
	xmlhttp.open("GET", URL, true);
	xmlhttp.send();
}
