﻿// JScript 文件

function AddFriendData(FromID,ToID,Content)
{
    AjaxFriends.Invite_Friends(FromID,ToID,Content,AddFriendData_Result_CallBack);       
}
function AddFriendData_Result_CallBack(response)
{
 if (response.value != null)
	{
	    var iRows = response.value;	    
	    return iRows;
	 }
	 return 0;
}

 function Invite_Friends_On(ID,FromID,ToID)
 {
     AjaxFriends.Invite_Friends_On(ID,FromID,ToID,Invite_Friends_On_Result_CallBack);       
 }

function Invite_Friends_On_Result_CallBack(response)
{
 if (response.value != null)
	{
	    var iRows = response.value;	   
	    return iRows;
	 }
	 return 0;
}
function Invite_Friends_No(ID,FromID,ToID)
{
     AjaxFriends.Invite_Friends_No(ID,FromID,ToID,Invite_Friends_No_Result_CallBack);       
}

function Invite_Friends_No_Result_CallBack(response)
{
     if (response.value != null)
	{
	    var iRows = response.value;	   
	    return iRows;
	 }
	 return 0;
}

function deleteMessage(ID,LGN_ID)
{
    AjaxFriends.deleteMessage(ID,LGN_ID,deleteMessage_Result_CallBack);    
    document.getElementById("message_"+ID).style.display="none";
}　　

function deleteMessage_Result_CallBack(response)
{

    if (response.value != null)
	{
	    var iRows = response.value;	  
	    return iRows;
	 }
	 return 0;
}

function replayMessageData(ID,FromID,ToID)
{
     var content =document.getElementById("txt_Content").value;
     AjaxFriends.replayMessageData(ID,FromID,ToID,content,replayMessageData_Result_CallBack);
     document.getElementById("replay_"+ID).innerHTML ="回复成功";
}

function replayMessageData_Result_CallBack(response)
{
    if (response.value != null)
	{
	    var iRows = response.value;	  
	    return iRows;
	 }
	 return 0;
}

function getMSGCollentData()
{
    AjaxFriends.getMSGCollectData(getMSGCollentData_Result_CallBack)
}

function getMSGCollentData_Result_CallBack(response)
{
     var sb= new StringBuilder("");
   
    if (response.value != null)
	{
	   	var ds = response.value;
		if(ds != null && typeof(ds) == "object" && ds.Tables != null)
		{		
		    var iRows = ds.Tables[0].Rows.length;
		    var dr = ds.Tables[0].Rows[0];
		     sb.Append("<table>");
		     sb.Append("<tr><td style='width:100px;background:#f0f0f0;'>系统消息</td>");
		     if(dr.Total==0)
		     {
		        sb.Append("<td style='width:60px;'><a href=\"msg/sys.aspx\">0条新</a></td>");
		     }
		     else
		     {
		        sb.Append("<td style='width:60px;'><a href=\"msg/sys.aspx\"><font color='red'>" + dr.Total + "条新</font></a></td>");
		     }
		  
		    dr = ds.Tables[0].Rows[1];
		    sb.Append("<td style='width:100px;background:#f0f0f0;'>短消息</td>");
		     if(dr.Total==0)
		     {
		        sb.Append("<td style='width:60px;'><a href=\"msg/sys.aspx\">0条新</a></td>");
		     }
		     else
		     {
		        sb.Append("<td style='width:60px;'><a href=\"msg/sys.aspx\"><font color='red'>" + dr.Total + "条新</font></a></td>");
		     }
		    sb.Append("</tr>");
		    sb.Append("</table>");
		    
		    document.getElementById("ctl00_CPR_msgList").innerHTML = sb.ToString();
		}
	 }
	// alert(sb.ToString());
}

function WriteMessagesData(FromID,ToID,Content)
{
  AjaxFriends.WriteMessages(FromID,ToID,Content,WriteMessagesData_Result_CallBack);       
}

function WriteMessagesData_Result_CallBack(response)
{
    if (response.value != null)
	{
	    var iRows = response.value;	    
	    return iRows;
	 }
	 return 0;
}