varichatstate;
try{
xmlHttp=newActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttp=newActiveXObject("Microsoft.XMLHTTP");
}catch(e2){
xmlHttp=false;
}
}
if(!xmlHttp&&typeofXMLHttpRequest!='undefined'){
xmlHttp=newXMLHttpRequest();
}
functionsendmsg(){
varmsgbody=escape(document.getElementById("msgbody").value);
varsendto=escape(document.getElementById("sendto").value);
varSendData="msgbody="+msgbody+"&sendto="+sendto;
xmlHttp.open("POST","../ichat/sendmsg.asp",false);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.onreadystatechange=functionsendok(){if(xmlHttp.readyState==4){}}
xmlHttp.send(SendData);
document.getElementById("msgbody").value="";
showmsg();
}
functionhot_key(){
if(window.event.keyCode==13&&window.event.ctrlKey&&document.getElementById("msgbody").value!=""){sendmsg();}
}
functionexitchat(){
varurl="../ichat/online.asp?action=exit&pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
functionintochat(){
window.ionline.location.href="../ichat/online.asp?action=intochat";
showmsg();
}
functionshowonline(){
varurl="../ichat/online.asp?action=showonline&pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
functionshowmsg(){
varurl="../ichat/getmsg.asp?pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX;
xmlHttp.send(null);
}
functionreloadX(){
if(xmlHttp.readyState==4){
varresponse=xmlHttp.responseText;
document.getElementById("mymsg").innerHTML=response;
document.getElementById("mymsg").scrollTop=document.getElementById("mymsg").scrollHeight;
setTimeout("showmsg();",10000);
}
}
functionsaveset(){
varmycolor=document.getElementById("mycolor").value;
varmsgtotal=document.getElementById("msgtotal").value;
varmystate=document.getElementById("mystate").value;
varallowmsg=document.getElementById("allowmsg").value;
varclosemsg;
if(document.getElementById("closemsg").checked){
closemsg=document.getElementById("closemsg").value;
}else{
closemsg="off";
}
varSendData="mycolor="+mycolor+"&msgtotal="+msgtotal+"&mystate="+mystate+"&allowmsg="+allowmsg+"&closemsg="+closemsg;
xmlHttp.open("POST","../ichat/chatset.asp",false);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.onreadystatechange=functionsendok(){if(xmlHttp.readyState==4){
alert('设定已经保存')
if(ichatstate=="open"){window.location.reload();}
}}
xmlHttp.send(SendData);
showmsg();
document.getElementById('layer_ichatset').style.display='none';
}
functionopenichat(){
ichatstate="open"
}
functioncloseichat(){
ichatstate="close"
}
functionshowonlineuser(){
document.getElementById('layer_online').style.display='block';
varurl="../ichat/showonline.asp?pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX2;
xmlHttp.send(null);
}
functionreloadX2(){
if(xmlHttp.readyState==4){
varresponse=xmlHttp.responseText;
document.getElementById("onlineuser").innerHTML=response;
}
}
functionreadset(){
document.getElementById('layer_ichatset').style.display='block';
varurl="../ichat/myset.asp?pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=showset;
xmlHttp.send(null);
}
functionshowset(){
if(xmlHttp.readyState==4){
varresponse=xmlHttp.responseText;
document.getElementById("setplan").innerHTML=response;
}
}
functionsetsendto(username){
if(username=="所有人"){
document.getElementById("sendto").value='';
document.getElementById("talkwith").innerHTML='所有成员';
}else{
document.getElementById("sendto").value=username;
document.getElementById("talkwith").innerHTML=username;
}
varurl="../ichat/checkuser.asp?user="+escape(username)+"&pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=showtips;
xmlHttp.send(null);
}
functionshowtips(){
if(xmlHttp.readyState==4){
varresponse=xmlHttp.responseText;
document.getElementById("userstate").innerHTML=response;
}
}
functionclearlog(){
if(window.confirm("您确定需要清除所有聊天记录吗?")==true)
{
varurl="../ichat/clearlog.asp?pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}
varichatwinstate
ichatwinstate="max";
functionmin()
{
ichatwinstate=(ichatwinstate=="max")?"min":"max"
if(ichatwinstate=="min"){
document.getElementById('mbody').style.display='none';
document.getElementById('myichat').height=parseInt(document.getElementById('ichat_title').height);
document.getElementById('myichat').style.top=document.body.clientHeight-parseInt(document.getElementById("ichat_title").style.height)+document.body.scrollTop;
}else{
document.getElementById('mbody').style.display='block';
iresize();
}
}
functioncloseit(){
document.getElementById('myichat').style.display='none';
}
functioniresize(){
if(ichatwinstate=="min"){
document.getElementById('myichat').style.top=document.body.clientHeight-parseInt(document.getElementById("ichat_title").style.height)+document.body.scrollTop-1;
}else{
document.getElementById('myichat').style.top=document.body.clientHeight+document.body.scrollTop-parseInt(document.getElementById("mbody").style.height)-85;
}
}
varey=0,ex=0,lx=0,ly=0,canDrg=false,thiso=null;
varx,y,rw,rh;
functiondargit(o,e)//主函数
{
thiso=o;
canDrg=true;
if(!document.all)
{
lx=e.clientX;ly=e.clientY;
}
else
{
lx=event.x;ly=event.y;
}
if(document.all)thiso.setCapture();
try{}
catch(e){}
st(o);//置前或置后
}
document.onmousemove=function(e)
{
if(!document.all){x=e.clientX;y=e.clientY;}else{x=event.x;y=event.y;}
if(canDrg)
{
varofsx=x-lx;
thiso.style.left=parseInt(thiso.style.left)+ofsx;
lx=x;
varofsy=y-ly;
thiso.style.top=parseInt(thiso.style.top)+ofsy;
ly=y;
//状态栏显示数据
//window.status=thiso.style.left+"left:top"+thiso.style.top+"rh:rw"+rh+"+"+rw;
}
}
document.onmouseup=function()
{
canDrg=false;//拖拽变量设为false
try{}
catch(e){}
if(document.all&&thiso!=null)
{
//ie下,将清捕获;
thiso.releaseCapture();
thiso=null;
}
}
functionst(o)
{
varp=o.parentNode;
if(p.lastChild!=o)
{
p.appendChild(o);
}
if(rh<=20&&rw>=160)
{
canDrg=false;
if(rw<180)
{
//设置关闭区域;//如果不需要可以注释掉;
//alert("关闭");
p.removeChild(o)
//removeChild(this);
}
else
{
window.status=rw+"|"+rh;
if(p.firstChild==o)return;
p.insertBefore(o,p.firstChild);
}
}
}