﻿// JScript 文件
var uin;var imgurl="/web/mymanage/friends/skin/default/";var fromnickname;var dt;var username; var x0=0,y0=0,x1=0,y1=0;var offx=6,offy=6;var moveable=false;
var hover='orange',normal='#7F7F7F';//color;
var index=10000;//z-index;
var boolsearch="1";  //搜索类型,1：表示精确搜索，2：表示模糊搜索
var friendname=""//好友名
var type = "";//用户，还是昵称类型
var indua="";//大类行业
var indub="";//中类行业
var induc="";//小类行业
var province="";//省份
var city="";//城市
var pinp="";//品牌
var keys="";//关键字
var arrwin=new Array(); 
//开始拖动;
function startDrag(obj)
{
//锁定标题栏;
obj.setCapture();
//定义对象;
var win = obj.parentNode;
//var sha = win.nextSibling;
//记录鼠标和层位置;
x0 = event.clientX;
y0 = event.clientY;
x1 = parseInt(win.style.left);
y1 = parseInt(win.style.top);
moveable = true;
}
//拖动;
function drag(obj)
{
var win = obj.parentNode;
//var sha = win.nextSibling;
if(moveable)
{
  if(parseInt(y1 + event.clientY - y0)>=0 && parseInt(x1 + event.clientX - x0)>=0)
  {
     win.style.left = x1 + event.clientX - x0;
     win.style.top = y1 + event.clientY - y0;
  }
}
}
//停止拖动;
function stopDrag(obj)
{
obj.releaseCapture();
moveable = false;
}   
//得到好友
function Get_Friends(uin)
{     var url="Get_Friends.ashx?uin="+uin+"&name="+username+"&dt="+dt+"&flag=1&temp="+Math.random();
      Request.sendGET(url, "divcomlistgroup", doGet_FriendsRes,true, doGet_FriendsRes);
      $("divcomlistgroup").innerHTML="正在加载好友信息/web/mymanage/web/mymanage/web/mymanage";   
}
function doGet_FriendsRes(req,data)
{
    $(data).innerHTML=req.responseText;
}
//创建webim
function createIm(fromuin,fromnick,fromdt)
{
    uin=fromuin;
    fromnickname=fromnick;
    dt=fromdt;
    var stronclick="";
    if($("divcommunionim")==null)
    {       
var strim="<Div style=\"position:absolute;z-index:"+(index+1)+";\" id='divcommunionim' onmousedown='getFocus(\"divcommunionim\");'>"
+"<div class='jl_online_head' id='divcommunionim_title'"
+ "onmousedown='startDrag(this)' "
+ "onmouseup='stopDrag(this)' "
+ "onmousemove='drag(this)' "
+">"
+"<div style=\"float:left;margin:5px 0px 0px 3px;\"><img src=\""+imgurl+"image/online_8.gif\" width=\"13\" height=\"14\" /></div>"
+"<div style=\"float:left;margin:6px 0px 0px 3px;color:#020202;\">通讯录</div>"
+"<div style=\"float:right;margin-right:5px;margin-top:6px;\" onclick='CloseCommunionim()'><img alt='关闭' src=\""+imgurl+"image/online_3.gif\"  style='cursor:hand' width=\"11\" height=\"11\" border=\"0\" /></div>"
+"</div>"
+"<div id='divcommunion_content' class='jl_online_bian'>"
+"<div class='jl_online_bg'>"
+"<div style=\"width:100%;margin-top:5px;\">"
+"<div style=\"float:left;margin-left:5px;\"><img src=\""+imgurl+"image/online_1.gif\" width=\"20\" height=\"16\" /></div>"
+"<div style=\"float:left;margin-left:8px;margin-top:3px;color:#1c3596;font-weight:bold;width:100px;white-space:nowrap;overflow: hidden;\">"+fromnickname+"</div>"
+"<div style=\"float:left;margin-left:5px;margin-top:3px;color:#1c3596;\"> - 在线</div>"
+"<div style=\"float:left;margin-left:5px;margin-top:5px;\"><img src=\""+imgurl+"image/online_2.gif\" width=\"6\" height=\"8\" /></div>"
+"</div>"
+"<div style=\"background: url("+imgurl+"image/online_bg.gif);width:183px;height:38px;margin-top:5px;margin-left:4px;\">"
+"<div style=\"margin:10px 0px 0px 5px;float:left;\"><input style=\"border:1px solid #7aa2d9;height:17px;\" id='txtfriendname' type=\"text\"  size=\"10\" /></div>"
+"<div style=\"margin:10px 0px 0px 10px;float:left;\"><img src=\""+imgurl+"image/online_4.gif\" onclick='ShowListFriend();' width=\"62\" height=\"23\" border=\"0\" /></div>"
+"</div>"
+"<div class=\"jl_online\" id='divcomlistgroup'>"
+"</div>"
+"</div>"
+"</div>"
+"<div class='jl_online_bottom'></div><div id='aaa' style='position:absolute'></div>"
+"</Div>";
document.body.insertAdjacentHTML("beforeEnd",strim);
document.getElementById("divcommunionim").style.top="50px";
document.getElementById("divcommunionim").style.left="780px";           
Get_Friends(uin);  
     } 
}
function CloseCommunionim()
{  
   Element.remove("divcommunionim");
}
//隐藏Im
function displayIm()
{
    if(Element.visible("divcommunion_content"))
    {
        Element.hide("divcommunion_content");
    }
    else{Element.show("divcommunion_content");}
}
//获得焦点;
function getFocus(obj){
index = index + 2;
var idx = index;
$(obj).style.zIndex=idx;
}
function minFreindsWin(touin){
if(Element.visible("divfriendsmid"+touin))
{
Element.hide("divfriendsmid"+touin);
Element.hide("imgwin"+touin);
$("divwinfriend"+touin).style.width="100px";
}}
function CloseFriendsWin(touin)
{
Element.remove("divwinfriend"+touin);
arrwin.length-=1;
}
//发送好友信息
function SendFriendsWin(touin,tonick,todt){
if(uin==""){
alert("请先登录");
return;
}
if(uin==touin){
alert("自己不能与自己私聊");
return;
}
if($("divwinfriend"+touin)==null){
var l=350*Math.random()+document.documentElement.scrollLeft;
var t=150*Math.random()+document.documentElement.scrollTop;
var strwin="<div class=\"siliao\" id='divwinfriend"+touin+"' style='left:"+l+";top:"+t+";z-index:"+(index+1)+";' onmousedown='getFocus(\"divwinfriend"+touin+"\");'>"
//<!--私聊头部-->
+"<div id='divwinfriendtitle"+touin+"' onmousedown='startDrag(this)' onmouseup='stopDrag(this)' onmousemove='drag(this)'>"
+"<div class=\"siliao_head_left\"></div>"
+"<div class=\"siliao_head\"  >"
+"<div class=\"siliao_head_mingc\">与 "+tonick+" 交谈中 <span id='spanmsg"+touin+"'></span></div>"
+"<div style=\"float:right;padding:5px 0px 0px 0px;\"><img src=\""+imgurl+"image/siliao_close.gif\" onclick='CloseFriendsWin(\""+touin+"\");' alt='关闭' width=\"22\" height=\"20\" /></div>"
+"<div style=\"float:right;padding:4px 0px 0px 0px;\"><img src=\""+imgurl+"image/siliao_xiao.gif\" id='imgwin"+touin+"' onclick='minFreindsWin(\""+touin+"\");' width=\"22\" height=\"20\" /></div>"
+"</div>"
+"<div class=\"siliao_head_right\"></div>"
+"</div>"
//<!--私聊头部结束-->
//<!--私聊中间-->
+"<div class=\"siliao_middle\" id='divfriendsmid"+touin+"'>"
//<!--左边-->
+"<div class=\"siliao_middle_left\">"
+"<div style='width:97.3%; height:180px; position:relative;background: #fff;'>"
+"<span style='position:absolute; right:16px; bottom:0px; cursor:hand;' onclick='saveWebchatBydai(\""+uin+"\",\""+touin+"\",\""+tonick+"\")'>保存</span>"
+"<div   id='recentMsg"+touin+"' style='97.3%; height:180px; border:1px solid #000000;background: #fff; overflow:auto; overflow-x:hidden;'>"
+"</div>"
+"</div>"
+publicSendWin(touin,tonick,todt,"1")
+"</div>"
+"<div id='oldMsg"+touin+"' style=\"clear:left;font-size:12px;display:none;\"></div>"
+"</div>"
//<!--私聊中间结束-->
+"<div class=\"siliao_bottom_left\"></div>"
+"<div class=\"siliao_bottom\"></div>"
+"<div class=\"siliao_bottom_right\"></div>"
+"</div>";
document.body.insertAdjacentHTML("beforeEnd",strwin);
getNewMessage(uin,touin,dt);  
arrwin.length+=1;
} 
else{
getFocus("divwinfriend"+touin);
}}
///保存单独的聊天文件
function saveWebchatBydai(uin,touin,tonick){
if ( confirm("确定保存与"+tonick+"的聊天记录吗") )
{
var now = new Date(); //获取系统日期，即Sat Jul 29 08:24:48 UTC+0800 2006 
var yy = now.getYear(); //截取年，即2006 
var MM = now.getDate(); //截取月，即07 
var dd = now.getDay(); //截取日，即29  
var hh = now.getHours(); //截取小时，即8 
var mm = now.getMinutes(); //截取分钟，即34 
var title ="与"+tonick+yy+"年"+MM+"月"+dd+"日"+hh+"点"+mm+"分聊天记录"
var content = $("recentMsg"+touin).innerHTML;
if( content == "" || content ==null )
{return ""}
var url="WebImMessage.ashx?uin="+uin+"&touin="+touin+"&content="+content+"&title="+title+"&dt="+dt+"&flag=9&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
    var html=xmlhttp.responseText;        
    if(!html || html.length==0){}
    else{alert("保存成功!");}
  }
});
} }
//touin:接受者uin，tonick接受者nick
function publicSendWin(touin,tonick,todt,flag,fromuin,fromnick,fromdt,title,type,id,guanz,cid,flagdongt,dongttype,m_flag,flagtype,content){  
if(content==null)
{content="";}
var strltjl="";var txtarea="";var butsend="";
if(flag=="1"){
    strltjl="<input type='button' class='siliao_button' value='交谈记录(H)' onclick='GetAllFreindMsg(\""+touin+"\",\"1\")' />";
    txtarea="<textarea  class=\"kuang_nerong_xie\" style=\"height:60px;border-bottom:none;\" onFocus='CloseTools(\""+touin+"\");'  id='txtSendMessage"+touin+"' onkeydown='if (event.keyCode==13) {sendMessage(\""+touin+"\",\""+tonick+"\",\""+todt+"\",\""+type+"\");return false;}' ></textarea>"
    +"</textarea>";
    butsend="<input type='button' class=siliao_button onclick='sendMessage(\""+touin+"\",\""+tonick+"\",\""+todt+"\",\""+type+"\");' value='发送(S)'/>";
}
   else if(title=="交流大厅"){
    txtarea="<textarea class=\"siliao_middle_textarea\" style=\"height:60px;border-bottom:none;\" onFocus='CloseTools(\""+touin+"\");' id='txtSendMessage"+touin+"' onkeydown='if (event.keyCode==13) {publicSendMsg(\""+fromuin+"\",\""+fromnick+"\",\""+fromdt+"\",\""+touin+"\",\""+tonick+"\",\""+todt+"\",\""+title+"\",\""+type+"\",\""+id+"\",\""+guanz+"\",\""+cid+"\",\""+flagdongt+"\",\""+dongttype+"\",\""+m_flag+"\",\""+flagtype+"\");return false;}' >"+content+"</textarea>"
    +"</textarea>";
    butsend="<input type='button' class=siliao_button onclick='publicSendMsg(\""+fromuin+"\",\""+fromnick+"\",\""+fromdt+"\",\""+touin+"\",\""+tonick+"\",\""+todt+"\",\""+title+"\",\""+type+"\",\""+id+"\",\""+guanz+"\",\""+cid+"\",\""+flagdongt+"\",\""+dongttype+"\",\""+m_flag+"\",\""+flagtype+"\");' value='发送(S)'/>";
    }
    else{
   txtarea="<textarea class=\"kuang_nerong_xie\" onFocus='CloseTools(\""+touin+"\");' id='txtSendMessage"+touin+"' onkeydown='if (event.keyCode==13) {publicSendMsg(\""+fromuin+"\",\""+fromnick+"\",\""+fromdt+"\",\""+touin+"\",\""+tonick+"\",\""+todt+"\",\""+title+"\",\""+type+"\",\""+id+"\",\""+guanz+"\",\""+cid+"\",\""+flagdongt+"\",\""+dongttype+"\",\""+m_flag+"\",\""+flagtype+"\");return false;}' >"+content+"</textarea>";
   butsend="<input type='button' class=\"kuang_fashon_butbg\" onclick='publicSendMsg(\""+fromuin+"\",\""+fromnick+"\",\""+fromdt+"\",\""+touin+"\",\""+tonick+"\",\""+todt+"\",\""+title+"\",\""+type+"\",\""+id+"\",\""+guanz+"\",\""+cid+"\",\""+flagdongt+"\",\""+dongttype+"\",\""+m_flag+"\",\""+flagtype+"\");' value='发送(S)'/></p>";
    } 
   var strsend="";
   if(flag=="1")
   {
    strsend+="<div style=\"margin-left:0px;height:25px;\" id='divfriendtool"+touin+"'>"
    +"<a href=\"javascript:www()\" onclick='getshowface(\""+touin+"\");' style=\"float:left;\"><img src=\""+imgurl+"image/pr8_cn.gif\" border=\"0\" /></a>"
    +"<a href='javascript:www()' onclick='toinsertimg1(\""+touin+"\");' style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/pr2_cn.gif\" border=\"0\" /></a>"
    +"<a href=\"http://www.communion.cn/mymanage/send_sms.aspx\" target=\"_blank\" style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/shouj.gif\" border=\"0\" /></a>"
    +"<a href=\"http://www.communion.cn/mymanage/postfax.aspx\" target=\"_blank\" style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/chuanz.gif\" border=\"0\" /></a>"
    +"<a href=\"javascript:www()\" onclick='showfile(\""+tonick+"\",\""+todt+"\",\""+touin+"\")' style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/pr5_cn.gif\" border=\"0\" /></a>"
    +"</div>"
    +"<div style=\"margin-left:1px;\">"
    +txtarea
    +"</div>"
    +"<div>"
    +"<div class=\"siliao_middle_left_bg1\"></div>"
    +"<div class=\"siliao_middle_left_bg3\"></div>"
    +"<div class=\"siliao_middle_left_bg2\"></div>"
    +"</div>"
    +"<div style=\"width:100%;\">"
    +"<div style=\"float:left;\">"+strltjl+"</div>"
    +"<div style=\"float:right;padding-right:10px;\">"+butsend+"</div>"
    +"<div style=\"float:right;padding-right:5px;\"><input type='button' onclick='Element.remove(\"divwinfriend"+touin+"\");' class=siliao_button value='关闭(C)' /></div>"
    +"</div>";
   }
   else if(title=="交流大厅" )
   {
    strsend+="<div style=\"margin-left:0px;height:25px;\" id='divfriendtool"+touin+"'>"
    +"<a href=\"javascript:www()\" onclick='getshowface(\""+touin+"\");' style=\"float:left;\"><img src=\""+imgurl+"image/pr8_cn.gif\" border=\"0\" /></a>"
    +"<a href='javascript:www()' onclick='toinsertimg1(\""+touin+"\");' style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/pr2_cn.gif\" border=\"0\" /></a>"
    +"<a href=\"http://www.communion.cn/mymanage/send_sms.aspx\" target=\"_blank\" style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/shouj.gif\" border=\"0\" /></a>"
    +"<a href=\"http://www.communion.cn/mymanage/postfax.aspx\" target=\"_blank\" style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/chuanz.gif\" border=\"0\" /></a>"
    +"<a href=\"javascript:www()\" onclick='showfile(\""+tonick+"\",\""+todt+"\",\""+touin+"\")' style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/pr5_cn.gif\" border=\"0\" /></a>"
    +"</div>"
    +"<div style=\"margin-left:1px;\">"
    +txtarea
    +"</div>"
    +"<div>"
    +"<div class=\"siliao_middle_left_bg1\"></div>"
    +"<div class=\"siliao_middle_left_bg3\"></div>"
    +"<div class=\"siliao_middle_left_bg2\"></div>"
    +"</div>"
    +"<div style=\"width:100%;\">"
    +"<div style=\"float:left;\">"+strltjl+"</div>"
    +"<div style=\"float:right;padding-right:10px;\">"+butsend+"</div>"
    +"<div style=\"float:right;padding-right:5px;\"><input type='button' onclick='Element.remove(\"divwinfriend"+touin+"\");' class=siliao_button value='关闭(C)' /></div>"
    +"</div>";
   }
   else
   {
    strsend+="<div class=\"kuang_nerong\">"+txtarea+"</div>"
    +"<div  class=\"kuang_fashon\" id='divfriendtool"+touin+"'>"
    +"<p class=\"kuang_fashon_but\"><input type='button' onclick='Element.remove(\"divwinfriend"+touin+"\");' class=\"kuang_fashon_butbg\" value='关闭(C)' />"
    +""+butsend+""
    +"<ul>"
    +"<li><a href=\"javascript:www()\" onclick='getshowface(\""+touin+"\",\"1\");' style=\"float:left;\"><img src=\""+imgurl+"image/pr8_cn.gif\" align=\"absbottom\"  /></a></li>"
    +"<li><a href='javascript:www()' onclick='toinsertimg1(\""+touin+"\");' style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/pr2_cn.gif\" align=\"absbottom\" /></a></li>"
    +"<li><a href=\"http://www.communion.cn/mymanage/send_sms.aspx\" target=\"_blank\" style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/shouj.gif\" align=\"absbottom\" /></a></li>"
    +"<li><a href=\"http://www.communion.cn/mymanage/postfax.aspx\" target=\"_blank\" style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/chuanz.gif\" align=\"absbottom\" /></a></li>"
    +"<li><a href=\"javascript:www()\" onclick='showfile(\""+tonick+"\",\""+todt+"\",\""+touin+"\")' style=\"float:left;margin-left:4px;\"><img src=\""+imgurl+"image/pr5_cn.gif\" align=\"absbottom\" /></a></li>"
    +"</ul>"
    +"</div>";}
return strsend;
}
function FristpublicWin(type,typeid,title,cid,touin,tonick,todt){
touin=="";
if($F("hidfromuin")!=""){
touin=$F("hidfromuin");tonick=$F("hidfromnick");todt=$F("hidfromdt"); 
} 
if(touin==""){
touin="999999999";tonick="交流访客";todt="20050101";
} 
if(uin==""){
publicuin="999999999";publicdt="20050101";publicnick="交流访客";   
}
else{
publicuin=$F("hiduin");publicdt=$F("hiddt");publicnick=$F("hidnick");   
}
publicWin(publicuin,publicnick,publicdt,'2',touin,tonick,todt,title,type,typeid,'','','0','0','1','0'); 
}
function FristpublicWinBBS(type,typeid,title,cid,touin,tonick,todt,publicuinbbs,publicdtbbs,publicnickbbs,publicnamebbs)
{    
    publicname = publicnamebbs;
    publicuin = publicuinbbs;
    publicnick = publicnickbbs;
    publicdt = publicdtbbs;    
    publicWin(touin,tonick,todt,'2',publicuin,publicnick,publicdt,title,type,typeid,'','','0','0','1','0');    
}
function publicWin(touin,tonick,todt,flag,fromuin,fromnick,fromdt,title,type,id,guanz,cid,flagdongt,dongttype,m_flag,flagtype,content){   
    if($("divwinfriend"+touin)!=null){
    Element.remove($("divwinfriend"+touin));
    }
    var strwin=""
    if(flag=="1"){
    strwin +="<div class=\"siliao\" id='divwinfriend"+touin+"' onmousedown='getFocus(\"divwinfriend"+touin+"\");'style='position:absolute;z-index:"+(index+1)+";'>"
    //<!--私聊头部-->
    +"<div id='divwinfriendtitle"+touin+"'  onmousedown='startDrag(this)' onmouseup='stopDrag(this)' onmousemove='drag(this)' >"
    +"<div class=\"siliao_head_left\"></div>"
    +"<div class=\"siliao_head\"  >"
    +"<div class=\"siliao_head_mingc\">对 "+title+" 回复 <span id='spanmsg"+touin+"'></span></div>"
    +"<div style=\"float:right;padding:5px 10px 0px 0px;\"><img src=\""+imgurl+"image/siliao_close.gif\" onclick='Element.remove(\"divwinfriend"+touin+"\");' width=\"22\" height=\"20\" /></div>"
    +"<div style=\"float:right;padding:4px 5px 0px 0px;\"><img src=\""+imgurl+"image/siliao_xiao.gif\" width=\"22\" height=\"20\" /></div>"
    +"</div>"
    +"<div class=\"siliao_head_right\"></div>"
    +"</div>"
    //<!--私聊头部结束-->
    //<!--私聊中间-->
    +"<div class=\"siliao_middle\">"
    //<!--左边-->
    +"<div class=\"siliao_middle_left\">"
    +publicSendWin(touin,tonick,todt,flag,fromuin,fromnick,fromdt,title,type,id,guanz,cid,flagdongt,dongttype,m_flag,flagtype,content)
    +"</div>"
    +"</div>"
    +"<div class=\"siliao_bottom_left\"></div>"
    +"<div class=\"siliao_bottom\"></div>"
    +"<div class=\"siliao_bottom_right\"></div>"
    +"</div>";
    }
    else if( title=="交流大厅" )
    {
    strwin +="<div class=\"siliao\" id='divwinfriend"+touin+"' onmousedown='getFocus(\"divwinfriend"+touin+"\");'style='position:absolute;z-index:"+(index+1)+";'>"
    //<!--私聊头部-->
    +"<div id='divwinfriendtitle"+touin+"'  onmousedown='startDrag(this)' onmouseup='stopDrag(this)' onmousemove='drag(this)' >"
    +"<div class=\"siliao_head_left\"></div>"
    +"<div class=\"siliao_head\"  >"
    + "<div class=\"siliao_head_mingc\">对 "+title+" 回复 <span id='spanmsg"+touin+"'></span></div>"
    +"<div style=\"float:right;padding:5px 10px 0px 0px;\"><img src=\""+imgurl+"image/siliao_close.gif\" onclick='Element.remove(\"divwinfriend"+touin+"\");' width=\"22\" height=\"20\" /></div>"
    +"<div style=\"float:right;padding:4px 5px 0px 0px;\"><img src=\""+imgurl+"image/siliao_xiao.gif\" width=\"22\" height=\"20\" /></div>"
    +"</div>"
    +"<div class=\"siliao_head_right\"></div>"
    +"</div>"
    //<!--私聊头部结束-->
    //<!--私聊中间-->
    +"<div class=\"siliao_middle\">"
    //<!--左边-->
    +"<div class=\"siliao_middle_left\">"
    +publicSendWin(touin,tonick,todt,flag,fromuin,fromnick,fromdt,title,type,publicname,guanz,cid,flagdongt,dongttype,m_flag,flagtype,content)
    +"</div>"
    +"</div>"
    +"<div class=\"siliao_bottom_left\"></div>"
    +"<div class=\"siliao_bottom\"></div>"
    +"<div class=\"siliao_bottom_right\"></div>"
    +"</div>";
    }
    else 
    {
    strwin +="<div class=\"kuang_big\" id='divwinfriend"+touin+"' style='position:absolute;z-index:"+(index+1)+";' onmousedown='getFocus(\"divwinfriend"+touin+"\");' >"
    //<!--私聊头部-->
    +"<div class=\"kuang_big2\" id='divwinfriendtitle"+touin+"' onmousedown='startDrag(this)' onmouseup='stopDrag(this)' onmousemove='drag(this)' >"
    +"<h3 ><span><img  onclick='Element.remove(\"divwinfriend"+touin+"\");'  src=\""+imgurl+"image/close.gif\" align=\"absmiddle\" /></span><span id='spanmsg"+touin+"' style='margin-right:20px;color:#ff0000'></span><img src=\""+imgurl+"image/xiaoxi.gif\" align=\"absmiddle\" /> 对 "+title+" 评论</h3>";
    strwin +="</div>";    
    strwin +=publicSendWin(touin,tonick,todt,flag,fromuin,fromnick,fromdt,title,type,publicname,guanz,cid,flagdongt,dongttype,m_flag,flagtype,content)
    +"<br clear=\"left\" />"
    +"</div>";
    }    
    document.body.insertAdjacentHTML("beforeEnd",strwin);
    if( event!=null ){
    if(window.parent.frames.length==1){ 
    $("divwinfriend"+touin).style.top=(event.offsetY+220)+"px"; //30
    $("divwinfriend"+touin).style.left=(event.clientX-document.documentElement.scrollLeft-600)+"px";
    }
    else{
    $("divwinfriend"+touin).style.top=(document.documentElement.scrollTop+document.documentElement.offsetHeight-200)+"px";
    $("divwinfriend"+touin).style.left=(205)+"px";
    }}
}
//共享好友
function Sharingfriends(touin,id)
{
    var url="/web/Dynamic/Add_Sharing.aspx?groupid="+id+"&uin="+uin+"&touin="+touin+"&temp="+Math.random();
    new Ajax.Request(url,{
    method:"GET",
    onComplete:function(xmlhttp){
    var html=xmlhttp.responseText; 
    if(!html || html.length==0){
       alert("连接服务超时");
    }
    else{
    if(html=="0")
    {alert("共享失败");}
    else{
        $("sharing"+touin).innerHTML="共享";
    }}}
    });
}
//取消共享
function deleteSharingfriends(touin,id)
{
var url="/web/Dynamic/Delete_Sharing.aspx?groupid="+id+"&uin="+uin+"&touin="+touin+"&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;        
if(!html || html.length==0){
alert("连接服务超时");
}
else{                                
if(html=="0"){
alert("共享失败");
}
else{
$("sharing"+touin).innerHTML="";
}}}
});
}
//添加关注
function addguanzfriends(touin,id)
{
var url="/web/Dynamic/Add_GuanZhu.aspx?groupid="+id+"&uin="+uin+"&touin="+touin+"&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;        
if(!html || html.length==0){
alert("关注失败");
}
else{                                
if(html=="0"){
alert("关注失败");
}
else{
$("guanz"+touin).innerHTML="关注";
}}}
}); 
}
//取消关注
function deleteguanzfriends(touin)
{
var url="/web/Dynamic/Delete_GuanZhu.aspx?uin="+uin+"&touin="+touin+"&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;        
if(!html || html.length==0){
alert("关注失败");
}
else{                                
if(html=="0"){
alert("关注失败");
}
else{
if($("divguanz"+touin)!=null){
Element.remove("divguanz"+uin);
}
$("guanz"+touin).innerHTML="";
}}}
});  
}
//删除联系人
function deleteFriend(touin,id)
{
if(confirm("你确实要删除联系人吗？")==true){  
var url="HttpFriends.ashx?uin="+uin+"&touin="+touin+"&groupid="+id+"&flag=4&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;        
if(!html || html.length==0){
alert("删除失败");
}
else{                                
if(html=="1"){
Element.remove("divuser"+touin);
}}}
});       
}
}
//转移联系人
function movefriends(touin,id,tonick,flag,todt) 
{
if(flag=="2"){
mouefriendsgogroup(touin,id,tonick,flag,todt);
}
else{        
var str="<div id='divfriendgroup' class='model_div01' style='width:300px;height:50;POSITION:absolute;z-index:"+(parseInt(index)+1)+"'>"
+"<div class='model_div02' style='height:17px;cursor:move;' id='divfriendgrouptitle'><div class='model_div03'>转移联系人</div>"
+"<div class='model_div04'><img src='/web/mymanage/img/close_button.gif' style='cursor:hand' alt='关闭' border=0 onclick='Element.remove(\"divfriendgroup\");'></div></div>"
+"<div align=center class='model_div05' style='height:50px;'><div style='margin-top:20px;'>"
+"<div style='margin:5px 0px 0px 0px;'><span class='link01_font'>请选择转移组：</span>"
+"<span class='picture01_font' style='margin:20px 5px 10px 0px;padding-bottom:3px;' id='spangroup'>"
+"</span></div><div style='width:100%;margin:20px 0px 5px 0px;'>"
+"<div align=right style='float:left;width:45%;'><input type='button' value='确定' onclick='mouefriendsgogroup(\""+touin+"\",\""+id+"\",\""+tonick+"\",\""+flag+"\",\""+todt+"\")' class='btn' /></div>"
+"<div align=left style='float:right;width:45%;'><input type='button' onclick='Element.remove(\"divfriendgroup\");' value='取消' class='btn' /></div></div></div></div></div>"
document.body.insertAdjacentHTML("beforeEnd",str);
$("divfriendgroup").style.left=document.body.scrollLeft+120;
$("divfriendgroup").style.top=document.body.scrollTop+150;
new Draggable("divfriendgroup",{handle:"divfriendgrouptitle", 
scroll: true
});
GetUserGroup("spangroup"); }
}
//得到好友组
function GetUserGroup(obj)
{
    var url="HttpFriends.ashx?uin="+uin+"&flag=5&temp="+Math.random();
    new Ajax.Request(url,{
    method:"GET",
    onComplete:function(xmlhttp){
    var html=xmlhttp.responseText;      
    if(!html || html.length==0)    {
    alert("加载好友失败");
    }
    else{                                
     $(obj).innerHTML=html;
    }}
    });
}
//转移联系人
function mouefriendsgogroup(touin,id,tonick,flag,todt){
var toid=""; 
if(flag=="2"){
var frm=confirm("你确认要把"+tonick+"转入到黑名单吗？");
if(frm){
toid="1000";
}
else{return;}
}
else{
toid = document.getElementById("friendgroup").options[document.getElementById("friendgroup").selectedIndex].value;
}
if(toid==""){
alert("请选择组");
return;
}
if(id==toid){return;}
var url="/web/Dynamic/Move_Friends.aspx?fromid="+id+"&toid="+toid+"&uin="+uin+"&touin="+touin+"&flag="+flag+"&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;                
if(!html || html.length==0){alert("转移失败");}
else{ 
if(html=="1"){    
if($("divfriendgroup")!=null)
Element.remove("divfriendgroup");                              
Element.remove("divuser"+touin);
var strpage="";                 
var status=$F("hidstatus"+touin);
var m_flag ="";
if( $("guanz" + touin ) ==null ){
m_flag="<span id='guanz" + touin + "' style='color:red'></span><span id='sharing" + touin + "' style='color:blue'></span>";   
}
if(status=="1"){
strpage="<div class=\"jl_online_zu2\"  id='divuser" + touin + "'>"
+ "<div style=\"float:left;margin:2px 0px 0px 15px;width:16px;\"><img onmouseout='close_UserInfo(\"" + touin + "\")' id='friendimg" + touin + "' onmouseover='getUserinfo(\"" + touin + "\");' src=\"/web/mymanage/friends/skin/default/image/online_6.gif\" width=\"16\" height=\"15\"/></div>"
+ "<div class=\"jl_online_zi\" ondblclick='SendFriendsWin(\"" + touin + "\",\"" + tonick + "\",\"" + todt + "\")' onmousedown='LeftFriendsWin(\"" + touin + "\",\"" + tonick + "\",\"" + toid + "\",\"" + todt + "\")'  style=\"margin:7px 0px 0px 0px;cursor:default;\">" + tonick + " " + m_flag + "</div>"
+ "</div><div class=\"body_bg\" id='divuserinfo" + touin + "' style='position:absolute;display:none;left:0px;top:0px;'></div><input type='hidden' id='hidstatus" + touin + "' value='" + status + "'/>";
}
else{
strpage="<div class=\"jl_online_zu2\"  id='divuser" + touin + "'>"
+ "<div style=\"float:left;margin:2px 0px 0px 15px;width:16px;\"><img onmouseout='close_UserInfo(\"" + touin + "\")' id='friendimg" + touin + "' onmouseover='getUserinfo(\"" + touin + "\");' src=\"/web/mymanage/friends/skin/default/image/online_7.gif\" width=\"16\" height=\"15\"/></div>"
+ "<div class=\"jl_online_zi\" ondblclick='SendFriendsWin(\"" + touin + "\",\"" + tonick + "\",\"" + todt + "\")' onmousedown='LeftFriendsWin(\"" + touin + "\",\"" + tonick + "\",\"" + toid + "\",\"" + todt + "\")'  style=\"margin:7px 0px 0px 0px;cursor:default;\">" + tonick + " " + m_flag + "</div>"
+ "</div><div class=\"body_bg\" id='divuserinfo" + touin + "' style='position:absolute;display:none;left:0px;top:0px;'></div><input type='hidden' id='hidstatus" + touin + "' value='" + status + "'/>";
}                     
new Insertion.Bottom("divfriends"+toid,strpage); 
alert("转移联系人成功");
}
else{alert("转移失败");}                              
}}
});
}
//重命名组
function UpdateGroupclick(id){
if($("divUpgroupname"+id)==null){
var groupname=$("group"+id).innerHTML;    
var str="<div class='model_div01' id='divUpgroupname"+id+"' style='width:300px;height:50px;POSITION: absolute;Z-INDEX:"+(parseInt(index)+1)+"'>"
+"<div class='model_div02' style='height:17px;cursor:move'  onmousedown='startDrag(this)' onmouseup='stopDrag(this)' onmousemove='drag(this)' id='divUpgroupnameTitle"+id+"'><div class='model_div03'>修改组</div>"
+"<div class='model_div04'><img src='/web/mymanage/img/close_button.gif' style='cursor:hand' alt='关闭' onclick='Element.hide(\"divUpgroupname"+id+"\");' border=0></div></div>"
+"<div align=center class='model_div05' style='height:70px;'><div style='margin-top:20px;'>"
+"<div style='margin:5px 0px 0px 0px;'><span class='link01_font'>请输入组名：</span>"
+"<input type='text' value='"+groupname+"' id='Textgroupname"+id+"'  class='model01_box' /></div>"
+"<div style='width:100%;margin:20px 0px 5px 0px;'><div align=right style='float:left;width:45%;'><input type='button' value='确定' onclick='UpdateGroup(\""+id+"\",\""+groupname+"\");' class='btn' /></div>"
+"<div align=left style='float:right;width:45%;'><input type='button' value='取消' onclick='Element.hide(\"divUpgroupname"+id+"\");' class='btn' /></div></div></div></div></div>";    
document.body.insertAdjacentHTML("beforeEnd",str);
$("divUpgroupname"+id).style.left=document.body.scrollLeft+120;
$("divUpgroupname"+id).style.top=document.body.scrollTop+150;
}
else{
Element.show("divUpgroupname"+id);
$("divUpgroupname"+id).style.zIndex=index+1;
}}
//修改组名
function UpdateGroup(groupid,m_groupname){
var groupname=$("Textgroupname"+groupid).value;   
if(groupname.strip()==m_groupname){
return;
}
if(groupname.length >= 12){
alert("输入的组名字符不能太长");
$("Textgroupname").select();return; 
}       
if(groupname==""){
alert("请输入组名");
document.getElementById("Textgroupname"+groupid).focus();
return;
} 
var url="HttpFriends.ashx?uin="+uin+"&groupname="+groupname+"&groupid="+groupid+"&flag=6&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;        
if(!html || html.length==0){alert("删除失败");}
else{
if(html=="1"){
//alert("修改成功");
$("group"+groupid).innerHTML=groupname;
Element.remove("divgroupname"+groupid);
}
else{alert("修改失败");}
}}
});
}
//删除组
function DeleteGroup(id)
{if(confirm("你确实要删除组吗？")==true)
{var url="HttpFriends.ashx?uin="+uin+"&groupid="+id+"&flag=7&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;        
if(!html || html.length==0){
alert("删除失败");}
else{                         
if(html=="1"){              
  Element.remove("divfgroup"+id);  
}
else{
alert("删除失败");
}}}
});
}
}
//创建组的名称
function CteateGroupdiv(id)
{
if($("divgroupname")==null)
{
var str="<div class='model_div01' id='divgroupname' style='width:300px;height:50px;POSITION: absolute;Z-INDEX:"+parseInt(index)+1+"'>"
+"<div class='model_div02' style='height:17px;'><div class='model_div03'>添加组</div>"
+"<div class='model_div04'><img src='/web/mymanage/img/close_button.gif' onclick='Element.hide(\"divgroupname\");' border=0></div></div>"
+"<div align=center class='model_div05' style='height:70px;'><div style='margin-top:20px;'>"
+"<div style='margin:5px 0px 0px 0px;'><span class='link01_font'>请输入组名：</span>"
+"<input type='text' id='Textgroupname' class='model01_box' /></div>"
+"<div style='width:100%;margin:20px 0px 5px 0px;'><div align=right style='float:left;width:45%;'><input type='button' value='确定' onclick='addgroupname(\""+id+"\");' class='btn' /></div>"
+"<div align=left style='float:right;width:45%;'><input type='button' value='取消' onclick='Element.hide(\"divgroupname\");' class='btn' /></div></div></div></div></div>";
document.body.insertAdjacentHTML("beforeEnd",str);
$("divgroupname").style.left=document.body.scrollLeft+120;
$("divgroupname").style.top=document.body.scrollTop+150;
}
else{
Element.show("divgroupname");
$("divgroupname").style.zIndex=index+1;
}    
}
//添加组名        
function addgroupname(id){
var name=document.getElementById("Textgroupname").value;      
if(name.length >= 12){
alert("输入的组名字符不能太长");
$("Textgroupname").select();
return;         
}
var uin = document.getElementById("hiduin").value;
if(name=="")
{
alert("请输入组名");
document.getElementById("Textgroupname").focus();
return;
}
var groupid=$F("hidgroupid"+id);  
var url="HttpFriends.ashx?uin="+uin+"&groupid="+groupid+"&groupname="+name+"&flag=8&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var contactgroupid=xmlhttp.responseText;                 
if(contactgroupid!="0")
{                              
var strpage = "<div style=\"width:100%;\" id='divfgroup" + contactgroupid + "' onmousedown='showfriend(\"" + contactgroupid + "\");' style='cursor:hand'>"
+ "<div style=\"float:left;margin:3px 0px 0px 5px;\"><img src=\"/web/mymanage/friends/skin/default/image/online_5.gif\" width=\"11\" id='imgicon" + contactgroupid + "' height=\"12\" /></div>"
+ "<div class=\"jl_online_zu\"><span id='group" + contactgroupid + "'>" + name + "</span> (<span id='spanonlinenum"+contactgroupid+"'>0</span>/<span id='spannum"+contactgroupid+"'>0</span>)</div>"
+ "</div><div id='divfriends" + contactgroupid + "' ></div><input type='hidden' id='hidgroupid" + contactgroupid + "' value='" + contactgroupid + "'/>";                        
new Insertion.Top("divfgroup999",strpage); 
}
else
{
alert("添加失败，或者已经添加相同的组");
$("Textgroupname").select();
}
}
});
}
function close_UserInfo(touin)
{   if($("divuserinfo"+touin)!=null)
{
Element.hide("divuserinfo"+touin);
}
if($("divuserinfo")!=null)
{
Element.hide("divuserinfo");
}
}

function close_LianxirenUserInfo()
{   if($("divLianxirenuserinfo")!=null)
{
Element.hide("divLianxirenuserinfo");
}
if($("divLianxirenuserinfo")!=null)
{
Element.hide("divLianxirenuserinfo");
}   
}
function getUserinfo(touin,flag)
{
if(flag=="1"){
Element.show("divuserinfo");          
$("divuserinfo").style.left=document.body.scrollLeft+event.clientX-event.offsetX-265;
$("divuserinfo").style.top=document.body.scrollTop+event.clientY-event.offsetY;     
var url="HttpFriends.ashx?uin="+touin+"&flag=9&temp="+Math.random();
Request.sendGET(url, "divuserinfo", doSearchFriendsRes,true, doSearchFriendsFail);
$("divuserinfo").innerHTML="正在加载中/web/mymanage/web/mymanage/web/mymanage";	      
}
else{
if($("divuserinfo"+touin).innerHTML==""){              
$("divuserinfo"+touin).style.zIndex=index+1;
Element.show("divuserinfo"+touin);          
$("divuserinfo"+touin).style.left=document.body.scrollLeft-260;
$("divuserinfo"+touin).style.top=document.body.scrollTop+event.clientY-event.offsetY-25;            
var url="HttpFriends.ashx?uin="+touin+"&flag=9&temp="+Math.random();
Request.sendGET(url, "divuserinfo"+touin, doSearchFriendsRes,true, doSearchFriendsFail);
$("divuserinfo"+touin).innerHTML="正在加载中/web/mymanage/web/mymanage/web/mymanage";
}
else{
Element.show("divuserinfo"+touin);
}}
}
function getLianxirenUserinfo(touin){
$("divLianxirenuserinfo").style.zIndex=index+1;
Element.show("divLianxirenuserinfo");          
$("divLianxirenuserinfo").style.left=(document.documentElement.scrollLeft+event.clientX-event.offsetX+30)+"px";
$("divLianxirenuserinfo").style.top=document.body.scrollTop+event.clientY-event.offsetY-25;            
var url="HttpFriends.ashx?uin="+touin+"&flag=11&temp="+Math.random();
Request.sendGET(url, "divLianxirenuserinfo", doSearchFriendsRes,true, doSearchFriendsFail);
$("divLianxirenuserinfo").innerHTML="正在加载中/web/mymanage/web/mymanage/web/mymanage";
}
function displayIm()
{
if(Element.visible("divcommunion_content"))
{
    Element.hide("divcommunion_content");
}
else{Element.show("divcommunion_content");}
}
//移动层
function PublicMoveDiv(obj,moveobj){
new Draggable(obj,{handle:moveobj, 
scroll: true,
zindex:index       
}); 
}
function ShowListFriend(){
if($("txtfriendname").value.strip()!=""){}
else{
Displaymu();
}
}
function closeaddfriends(){
Element.hide("divselectfriends");
}
//显示模糊查找的面板
function  Displaymu(){
if($("divselectfriends")==null){
var str="<div class='model_div01' style='width:797px;height:503px; position:absolute;top:80;left:150;z-index:"+(index+1)+";' id='divselectfriends'>"
+"<div id='divselectfriendstitle' onmousedown='startDrag(this)' onmouseup='stopDrag(this)' onmousemove='drag(this)'>"
+"<div class='model_div02' style='height:17px;'>"
+"<div class='model_div03'>查找/添加联系人</div>"
+"<div class='model_div04'><img src='/web/mymanage/img/close_button.gif' border=0 onclick='Element.hide(\"divselectfriends\")'></div>"
+"</div></div>"
+"<div align=center class='model_div05' style='height:100%;'><div style='margin-top:20px;'>"
+"<div class='container'><ul class='navPyra'><li><a class='active' href='#' >精确查找</a></li></ul></div></div>"
+"<div align=left style='font-size:12px;margin:5px 20px 0px 20px;display:block;' id=divsearch>"
+"<div><img src='/web/mymanage/img/sear.jpg' />&nbsp;<span style='color:#003399;'>在此你可以设置查询条件来查找用户。</span></div>"
+"<div style='margin:10px 3px 0px 30px;'><input   type='radio'   name=answer   value=1   id=radionfriends checked=checked　>昵称   <input   type='radio'  name=answer   value=2   >用户名 &nbsp;&nbsp;&nbsp;<span style='color:#0047D5;'>请输入：</span>&nbsp;<input id = 'txtfriend' type = 'text' />&nbsp;<input type = 'button' value = '开始查找' class='btn' onclick = 'selectfriendmu()' /></div>"
+"</div>"
+"<div style='margin:10px 10px 10px 10px;color:#003399;font-size:14px' align=left>以下是交流为您查询到的用户：</div>"
+"<div style='margin:0px 0px 0px 0px;'><div align='center' style='background-color:#ffffff;' ID = 'listfriends'></div></div>"
+"</div></div><div class=\"body_bg\" id='divuserinfo' style='position:absolute;left:0px;top:0px;display:none;z-index:"+index+4+"'></div>";
document.body.insertAdjacentHTML("beforeEnd",str);
allsearchfriends(1);
}
else{
Element.show("divselectfriends");
}}
function selectfriendmu(){   
var elements=document.getElementsByName("answer");      
for(i=0;i<elements.length;i++){
if(elements[i].checked ){  
type=elements[i].value;
}
}
friendname = document.getElementById("txtfriend").value;
if(friendname == ""){
alert("请输入要查找的用户");
}else{
allsearchfriends(1);
}
}
//查找的联系人
function allsearchfriends(m)
{
var url="Get_Friends.ashx?m="+m+"&type="+type+"&name="+friendname+"&boolsearch="+boolsearch+"&flag=2&temp="+Math.random();
Request.sendGET(url, "listfriends", doSearchFriendsRes,true, doSearchFriendsFail);
$("listfriends").innerHTML="正在加载中/web/mymanage/web/mymanage/web/mymanage";  
}
function addselectfriendtogroup(touin,toname,tonick,status,todt){
if(uin==touin)
{
alert("自己不能添加自己做！");
return;
}
if($("divaddfriend")!=null){
Element.reomove("divaddfriend");
}
    var str="<div class='model_div01' style='width:300px;height:200px;position:absolute; z-index:"+parseInt(index)+1+";' ID = 'divaddfriend'>"
+"<div class='model_div02' style='height:17px;'  onmousedown='startDrag(this)' onmouseup='stopDrag(this)' onmousemove='drag(this)' id='divaddfriendtitle'><div class='model_div03'>查找/添加联系人</div>"
+"<div class='model_div04'><img src='/web/mymanage/img/close_button.gif' style='cursor:hand' border=0 onclick='Element.remove(\"divaddfriend\")'></div></div>"
+"<div align=center class='model_div05' style='height:100%;'><div align=left style='margin:20px 0px 0px 15px;font-size:12px;'>"
+"<div>您将添加：<font style='color:#ff3300;'>"+tonick+"</font> 为联系人。</div>"
+"<div style='margin:5px 0px 10px 0px;'>请选择分组：<span id='spangroup'></span></div>"
+"<div>附言(认真填写哦，好友会根据附言决定是否添加你)</div>"
+"<div style='margin-top:10px;'><textarea  id='txtfriendmsg' cols='42' rows='5' class='friends01_box'></textarea></div>"
+"<div align=center style='margin:10px 0px 10px 0px;'><input type = 'button'  value = '添加' onclick = 'selectsendmsgtofriend(\""+touin+"\",\""+toname+"\",\""+tonick+"\",\""+status+"\",\""+todt+"\")' class='btn' />&nbsp;&nbsp;<input name='Submit3' type='button' class='btn' onclick='Element.remove(\"divaddfriend\")' value='取消'></div>"
+"</div></div></div>";
document.body.insertAdjacentHTML("beforeEnd",str);
document.getElementById("divaddfriend").style.left=(document.body.scrollWidth)/2;
document.getElementById("divaddfriend").style.top=document.body.scrollTop+150;  
GetUserGroup("spangroup");     
}
function selectsendmsgtofriend(touin,toname,tonick,status,todt){
var content=$F("txtfriendmsg").strip();
if(content==""){
CreateDiv("你输入验证信息");
return;
}
var groupid = document.getElementById("friendgroup").options[document.getElementById("friendgroup").selectedIndex].value;
if(groupid=="" || groupid==null){
CreateDiv("请选择加入联系人组");
return;
}
var url="HttpFriends.ashx?groupid="+groupid+"&uin="+uin+"&touin="+touin+"&flag=10&temp="+Math.random();     
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;        
if(!html || html.length==0){}
else{if(html=="1"){
var m_url="WebImMessage.ashx?uin="+uin+"&touin="+touin+"&fromnick="+fromnickname+"&tonick="+tonick+"&dt="+dt+"&todt="+todt+"&content=收到“"+fromnickname+"”添加为联系人请求。附加信息："+content+"&flag=3&type=0&temp="+Math.random();
Request.sendGET(m_url, "", doSystemMessageRec,true,null);                                                    
var strpage="";
var m_flag="<span id='guanz" + touin + "' style='color:red'></span><span id='sharing" + touin + "' style='color:blue'></span>";
if(status=="1"){
strpage="<div class=\"jl_online_zu2\"  id='divuser" + touin + "'>"
+ "<div style=\"float:left;margin:2px 0px 0px 15px;width:16px;\"><img onmouseout='close_UserInfo(\"" + touin + "\")' id='friendimg" + touin + "' onmouseover='getUserinfo(\"" + touin + "\");' src=\"/web/mymanage/friends/skin/default/image/online_6.gif\" width=\"16\" height=\"15\"/></div>"
+ "<div class=\"jl_online_zi\" ondblclick='SendFriendsWin(\"" + touin + "\",\"" + tonick + "\",\"" + todt + "\")' onmousedown='LeftFriendsWin(\"" + touin + "\",\"" + tonick + "\",\"" + groupid + "\",\"" + todt + "\")'  style=\"margin:7px 0px 0px 0px;cursor:default;\">" + tonick + " " + m_flag + "</div>"
+ "<input type='hidden' id='hidstatus" + touin + "' value='" + status + "'/></div><div class=\"body_bg\" id='divuserinfo" + touin + "' style='position:absolute;display:none;left:0px;top:0px;'></div>";
}
else{
strpage="<div class=\"jl_online_zu2\"  id='divuser" + touin + "'>"
+ "<div style=\"float:left;margin:2px 0px 0px 15px;width:16px;\"><img onmouseout='close_UserInfo(\"" + touin + "\")' id='friendimg" + touin + "' onmouseover='getUserinfo(\"" + touin + "\");' src=\"/web/mymanage/friends/skin/default/image/online_7.gif\" width=\"16\" height=\"15\"/></div>"
+ "<div class=\"jl_online_zi\" ondblclick='SendFriendsWin(\"" + touin + "\",\"" + tonick + "\",\"" + todt + "\")' onmousedown='LeftFriendsWin(\"" + touin + "\",\"" + tonick + "\",\"" + groupid + "\",\"" + todt + "\")'  style=\"margin:7px 0px 0px 0px;cursor:default;\">" + tonick + " " + m_flag + "</div>"
+ "<input type='hidden' id='hidstatus" + touin + "' value='" + status + "'/></div><div class=\"body_bg\" id='divuserinfo" + touin + "' style='position:absolute;display:none;left:0px;top:0px;'></div>";
}
new Insertion.Bottom("divfriends"+groupid,strpage);
} 
else if(html=="-1"){
CreateDiv("不能自己添加自己"); 
} 
else{
CreateDiv("添加失败！或者你已添加该好友。");
}
Element.remove("divaddfriend");                        
}}
});
}
function doSystemMessageRec(reg,data){
var result=reg.responseText;
if(result=="1"){
CreateDiv("发送成功,请等待对方的验证");
}
else{
CreateDiv("发送失败,请稍后再发");  
}}
//返回成功信息
function doSearchFriendsRes(req,data){
var html=req.responseText;
if(html=="1"){
$(data).innerHTML="发送成功";
}
else{
$(data).innerHTML=html;
}
}
//返回失败信息
function doSearchFriendsFail(req,data){
$(data).innerHTML=req.responseText;
}
//统一聊天框 发送评论 发送前台聊天室消息
function publicSendMsg(fromuin,fromnick,fromdt,touin,tonick,todt,title,type,id,guanz,cid,flagdongt,dongttype,m_flag,flagtype)
{
var ta_content = $("txtSendMessage"+touin);				
var temp_content=escape(ta_content.innerHTML);   
// 如果输入内容不为空
if(temp_content.strip()==""){
CreateDiv("内容不能为空");
return;
}
if(m_flag=="0"){		 
var url="WebImMessage.ashx?fromuin="+fromuin+"&touin="+touin+"&fromnick="+fromnick+"&tonick="+tonick+"&fromdt="+fromdt+"&todt="+todt+"&content="+temp_content+"&title="+title+"&id="+id+"&type="+type+"&flagdongt="+flagdongt+"&dongttype="+dongttype+"&guanz="+guanz+"&cid="+cid+"&flagtype="+flagtype+"&flag=4&temp="+Math.random();
Request.sendGET(url, "spanmsg"+touin, doSearchFriendsRes,true, doSearchFriendsFail);
if(flagdongt=="1"){
var murl="WebChat.ashx?name="+username+"&uin="+fromuin+"&title="+temp_content+"&type=0&tags=&flag=7&temp="+Math.random();
Request.sendGET(murl,null, null,true, null);		            
}}
else{
var url="WebChat.ashx?touin="+touin+"&todt="+todt+"&nick="+fromnick+"&name="+publicname+"&uin="+fromuin+"&fromdt="+fromdt+"&type="+type+"&typeid="+id+"&newtype=007&cid="+cid+"&title="+title+"&content="+temp_content+"&flag=3&temp="+Math.random();
Request.sendGET(url, "spanmsg"+touin, null,true, null);
window.setTimeout("GetComment(\""+type+"\",\""+id+"\",\""+cid+"\",\"1\",\"10\",\""+publictimes+"\");",2000);
}
ta_content.innerHTML="";  
} 
function scall(){
if($("divmsgwin")!=null)
ChangeMsgWinPosition();
}
function GetComment(type,typeid,condition,currentPage,readPageCount,times)
{
publictimes=times;
var filename=type+typeid;
if($("divcomment"+filename)!=null)
{
Element.show("divcomment"+filename);
}
$("divcomment"+filename).innerHTML="正在加载评论信息/web/mymanage.";
var url="/web/Dynamic/getCommenton.aspx?type="+type+"&typeid="+typeid+"&condition="+condition+"&currentPage="+currentPage+"&readPageCount="+readPageCount+"&times="+times+"&flag=4&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;
if(!html || html.length==0){
}
else{ 
var comment=html;
if(comment!="暂无评论信息"){    
$("divcomment"+filename).innerHTML=comment;
var pageCount=parseInt($("hidlastCount").value);    
var currentPage=parseInt($("hidcurrentPage").value);
var Counts=$("hidMsgCounts").value;
if(publictimes=="0"){
$("divcomment"+filename).innerHTML+=ShowListPage(pageCount,currentPage);
}}
else{
$("divcomment"+filename).innerHTML=comment;
}}}
});
}
function doGetCommentSucceed(req,data){
var comment=req.responseText;
if(comment!="暂无评论信息"){    
$(data).innerHTML=comment;
var pageCount=parseInt($("hidlastCount").value);    
var currentPage=parseInt($("hidcurrentPage").value);
var Counts=$("hidMsgCounts").value;
if(publictimes=="0"){
$(data).innerHTML+=ShowListPage(pageCount,currentPage);
}}
else{
$(data).innerHTML=comment;
}}
function visibleDivComment(type,typeid){
if(Element.visible("divcomment"+type+typeid)){
Element.hide("divcomment"+type+typeid);
}
else{
Element.show("divcomment"+type+typeid);
}}
function updateComment(id,type,typeid,m_flag){
if(confirm("你确实要删除评论吗？")){
var url="WebChat.ashx?type="+type+"&typeid="+typeid+"&id="+id+"&m_flag="+m_flag+"&uin="+uin+"&dt="+dt+"&flag=6&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;
if(!html || html.length==0){
alert("删除失败");}
else{ 
if(html=="1"){              
alert("删除成功！");
Element.remove("divShowComment"+id);
}
else{
alert("删除失败");
}}}
}); }
}
function delComment(id,type,typeid,m_flag)
{
var url="WebChat.ashx?type="+type+"&typeid="+typeid+"&id="+id+"&m_flag="+m_flag+"&uin="+uin+"&dt="+dt+"&flag=8&temp="+Math.random();
new Ajax.Request(url,{
method:"GET",
onComplete:function(xmlhttp){
var html=xmlhttp.responseText;
if(!html || html.length==0){alert("删除失败");}
else{ 
if(html=="1"){              
alert("删除成功！");
Element.remove("divShowComment"+id);
}
else{alert("删除失败");}
}}
});
}
//分页
function ShowListPage(pageCount,currentPage)
{
var strNav="<div class=\"pinglun_next\"><div style=\"text-center:center;padding-right:20px;font-size:12px;margin-top:5px;\" class=\"next_pinlun\">";
var endpage;  
if(currentPage>1){strNav+="<a href='#'>上一页</a>";
}
if(currentPage>10){
strNav+="<a href='#'>1</a>/web/mymanage.";
}
if(pageCount>currentPage+10){      
endpage=currentPage+10;
}
else{
endpage=pageCount;
}  
for (var i = currentPage - 10; i < endpage + 1; i++)
{        
if (i >= 1){
if (i == currentPage){
strNav += "<font color=#990000><strong>" + i + "</strong></font> ";
}
else{
strNav += "<a href='#'>" + i + "</a> ";
}}
}
if ((currentPage + 10) < pageCount){
strNav += "/web/mymanage. <a href='#'>" + pageCount.ToString() + "</a>";
}
if (currentPage < pageCount){
strNav += " <a href='#'>下一页</a>  ";
}
return strNav+"</div></div>";   
}       	  
function hideGetuserInfo()
{
   if(window.event.toElement.id!="divcard" && window.event.toElement.id!="divgetuserinfo")
   {
     Element.hide("divgetuserinfo");
   }
}
var cardname="";
function showGetUserInfo(name)
{  
document.getElementById("divgetuserinfo").style.display="";           
if(cardname!=name){
cardname=name;        
var url="/web/Dynamic/getUserInfo.aspx?name="+name+"&temp="+Math.random();
Request.sendGET(url, "divgetuserinfo", doGet_FriendsRes,true, doGet_FriendsRes);    
$("divgetuserinfo").innerHTML="正在加载信息/web/mymanage.";   
if ( event.clientX < 300 ){
document.getElementById("divgetuserinfo").style.left=document.body.scrollLeft+event.clientX-event.offsetX;
document.getElementById("divgetuserinfo").style.top=document.body.scrollTop+event.clientY-event.offsetY+25;     
}
else{
document.getElementById("divgetuserinfo").style.left=document.body.scrollLeft+event.clientX-event.offsetX;
document.getElementById("divgetuserinfo").style.top=document.body.scrollTop+event.clientY-event.offsetY;  
}  }
}
function closeMingP()
{
   Element.hide("divgetuserinfo");
}
//发送好友信息
function SendFriendsWinAD(touin,tonick,todt,fromuin,fromnick,fromdt,adID)
{
uin=fromuin;
fromnickname=fromnick;
dt=fromdt;

if(uin==touin)
{
alert("自己不能与自己私聊");
return;
}
if($("divwinfriend"+touin)==null)
{
var l=350*Math.random()+document.documentElement.scrollLeft;
var t=150*Math.random()+document.documentElement.scrollTop;
var strwin="<div class=\"siliao\" id='divwinfriend"+touin+"' style='left:"+l+";top:"+t+";z-index:"+(index+1)+";' onmousedown='getFocus(\"divwinfriend"+touin+"\");'>"
//<!--私聊头部-->
+"<div id='divwinfriendtitle"+touin+"' onmousedown='startDrag(this)' onmouseup='stopDrag(this)' onmousemove='drag(this)'>"
+"<div class=\"siliao_head_left\"></div>"
+"<div class=\"siliao_head\"  >"
+"<div class=\"siliao_head_mingc\">与 "+tonick+" 交谈中 <span id='spanmsg"+touin+"'></span></div>"
+"<div style=\"float:right;padding:5px 0px 0px 0px;\"><img src=\""+imgurl+"image/siliao_close.gif\" onclick='CloseFriendsWin(\""+touin+"\");' alt='关闭' width=\"22\" height=\"20\" /></div>"
+"<div style=\"float:right;padding:4px 0px 0px 0px;\"><img src=\""+imgurl+"image/siliao_xiao.gif\" id='imgwin"+touin+"' onclick='minFreindsWin(\""+touin+"\");' width=\"22\" height=\"20\" /></div>"
+"</div>"
+"<div class=\"siliao_head_right\"></div>"
+"</div>"
//<!--私聊头部结束-->
//<!--私聊中间-->
+"<div class=\"siliao_middle\" id='divfriendsmid"+touin+"'>"
//<!--左边-->
+"<div class=\"siliao_middle_left\">"
+"<div  class=\"siliao_middle_content\" id='recentMsg"+touin+"'>"
+"</div>"
+publicSendWin(touin,tonick,todt,"1",fromuin,fromnick,fromdt,"",adID);
+"</div>"
//<!--右边信息显示部分结束-->
+"<div id='oldMsg"+touin+"' style=\"clear:left;font-size:12px;display:none;\"></div>"
+"</div>"
//<!--私聊中间结束-->
+"<div class=\"siliao_bottom_left\"></div>"
+"<div class=\"siliao_bottom\"></div>"
+"<div class=\"siliao_bottom_right\"></div>"
+"</div>";
document.body.insertAdjacentHTML("beforeEnd",strwin);
getNewMessage(uin,touin,dt);  
arrwin.length+=1;
} 
else{
  getFocus("divwinfriend"+touin);
}  
}
//查找联系人跳到第几页
function gotoPageDai(PageCount){
var   r   =   /^[0-9]*[1-9][0-9]*$/;　　//正整数
var   str = $F("textPageDai");
if(r.test(str)){
if(str>PageCount){
str = PageCount;
}
allsearchfriends(str);
}
else{
alert("输入格式错误");
}
}

