///////////////////////////////////////
//发送好友要请
function GetAddContent(uid,fid,fUserName)
{
    
    
    var html='';
    if(uid==fid)//不可以加自己
    {
        html+='<h1>提示</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
        html+='<div class="popupmenu_inner" style="width: 300px;" id="popupmenu_inner">对不起，您不可以加自己为好友。';
        html+='</div>';
        return html;
    }
    var C ;
    C=CheckFriend(uid,fid);
    if(C==1)
    {
        html+='<h1>提示</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
        html+='<div class="popupmenu_inner" style="width: 300px;" id="popupmenu_inner">你们已经是好友了。';
        html+='</div>';
        return html;
    }
    else if(C==2)
    {
        html+='<h1>提示</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
        html+='<div class="popupmenu_inner"  style="width: 300px;" id="popupmenu_inner">正在等待对方认证中......';
        html+='</div>';
        return html;
    }
    
    html+='<h1>加好友</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
    html+='<table cellspacing="0" cellpadding="3">';
		html+='<tr>';
			html+='<th width="52"><a href="space.aspx?uid=' + fid + '"><img border="0" src="face/UserPhoto.aspx?uid=' + fid + '&type=small" alt="' + fUserName + '" width="48" height="48" /></th>';
			html+='<td>加 <strong>' + fUserName + '</strong> 为好友，附言：<br />';
				html+='<input type="text" name="note" value="" size="20" class="t_input" style="width: 300px;" />';
				html+='<p class="gray">(附言为可选，' + fUserName + ' 会看到这条附言，最多50个字符)</p>';
			html+='</td>';
		html+='</tr>';
		html+='<tr>';
			html+='<th>&nbsp;</th>';
			html+='<td>';
				html+='分组: <select name="gid">' ;
				    var GroupList;
                    GroupList=AjaxController.GetUserGroup(uid).value;
                    for(var i=0;i<GroupList.length;i++)
                    {
				        html+='<option value="' + GroupList[i].GroupId  + '">' + GroupList[i].GroupName + '</option>';
				    }

				html+='</select>';
				html+='<input type="button" name="addsubmit_btn" id="addsubmit_btn" value="确定" class="submit" onclick="javascript:AddFriend('+ uid + ',' + fid + ');")" />';
			html+='</td>';
		html+='</tr>';
	html+='</table>';
	html+='</div>';
	return html;
}
//判断是否已经是好友
function CheckFriend(uid,fid)
{
    var R=AjaxController.CheckFriend(uid,fid).value;
    if(R=="true")
    {
        return 0;
    }
    else if(R=="false1")
    {
        return 1;
    }
    else if(R=="false2")
    {
        return 2;
    }
}
//添加好友
function AddFriend(uid,fid)
{
    var GroupId=$("gid").options[$("gid").selectedIndex].value;
    var Note=$("note").value;
    var R =AjaxController.AddFriend(uid,fid,GroupId,Note).value;
    if(R=="OK")
    {
        $("popupmenu_inner").innerHTML="成功发送请求，请等待对方的回复确认。";
    }
    else if(R=="false")
    {
        $("popupmenu_inner").innerHTML="您已经和对方是好友或正在等待确认";
    }
    else
    {
        $("popupmenu_inner").innerHTML=R;
    }
    
    setTimeout('hideMenu()', 1000)
    
}
//通过请求
function CheckMyFriend(uid,fid)
{
    
    var GroupId=$("gid").options[$("gid").selectedIndex].value;
    var Note="";
    var R =AjaxController.CheckMyFriend(uid,fid,GroupId,Note).value;
    if(R=="OK")
    {
        $("popupmenu_inner").innerHTML="审核成功。";
        $("friend_" + uid + "_" + fid).style.display="none";
        if((parseInt($("FriendCount").value)-1)==0)
        {
            $("AllFriend").style.display="none";
        }
        else
        {
            $("FriendCount").value=parseInt($("FriendCount").value)-1;
        }
    }
    else
    {
        $("popupmenu_inner").innerHTML=R;
    }
    setTimeout('hideMenu()', 1000);
    
    
}

//批准请求
function CheckFriendContent(uid,fid,fUserName)
{
    var html='';
    html+='<h1>批准请求</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
    html+='<table cellspacing="0" cellpadding="3">';
		html+='<tr>';
			html+='<th width="52"><a href="/space.aspx?uid=' + fid + '"><img border="0" src="/face/UserPhoto.aspx?type=small&uid=' + fid + '" width="48" height="48" /></th>';
			html+='<td>批准 <strong>' + fUserName + '</strong> 的好友请求，并分组：<br>';
				html+='<select id="gid" name="gid">';
				 var GroupList;
                    GroupList=AjaxController.GetUserGroup(uid).value;
                    for(var i=0;i<GroupList.length;i++)
                    {
				        html+='<option value="' + GroupList[i].GroupId  + '">' + GroupList[i].GroupName + '</option>';
				    }
				html+='</select>';
				html+='<input type="button" name="add2submit_btn" value="批准" class="submit" onclick="CheckMyFriend(' + uid + ','+ fid + ')" />';
			html+='</td>';
		html+='</tr>';
	html+='</table>';
	html+='</div>';
	return html;
}
//拒绝请求
function DelFriend(uid,fid)
{
   
    AjaxController.DelFriend(fid,uid);
    $("friend_" + uid + "_" + fid).style.display="none";
     if((parseInt($("FriendCount").value)-1)==0)
    {
        $("AllFriend").style.display="none";
    }
    else
    {
        $("FriendCount").value=parseInt($("FriendCount").value)-1;
    }
    
}

//打招呼
function PokeContent(uid,fid,fUserName)
{
    var html='';
    
    html+='<h1>打招呼</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
  
    html+='<table cellspacing="0" cellpadding="3">';
		 html+='<tr>';
			html+='<th width="52"><a href="space.aspx?uid=' + fid + '"><img border="0" src="/face/UserPhoto.aspx?type=small&uid=' + fid + '" alt="' + fUserName + '" width="48" height="48" /></th>';
			html+='<td>向 <strong>' + fUserName + '</strong> 打招呼：<br />';
				html+='<input type="text" id="note" name="note" value="" size="20" class="t_input"  style="width: 300px;" maxlength="25" />';
				html+='<p class="gray">(内容为可选，并且会覆盖之前的招呼，最多25个汉字)</p>';
			html+='</td>';
		html+='</tr>';
		html+='<tr>';
			html+='<th>&nbsp;</th>';
			html+='<td>';
				html+='<input type="button" name="pokesubmit_btn" id="pokesubmit_btn" value="确定" class="submit" onclick="SendPoke(' + fid + ',' + uid + ')" />';
			html+='</td>';
		html+='</tr>';
	html+='</table>';
	
	html+='</div>';
	return html;
}
//发送打招呼
function SendPoke(uid,fid)
{
    var Note=$("note").value;
    AjaxController.SendPoke(uid,fid,Note);
    $("popupmenu_inner").innerHTML="已经发送，好友下次访问时会收到通知";
    setTimeout('hideMenu()', 1000);
    try
    {
        $("Poke_" +uid  + "_" + fid).style.display="none";
         if((parseInt($("FriendCount").value)-1)==0)
        {
            $("AllFriend").style.display="none";
        }
        else
        {
            $("FriendCount").value=parseInt($("FriendCount").value)-1;
        }
    }
    catch(e)
    {}
}
//删除单条打招呼
function DelPoke(uid,fid)
{
    AjaxController.DelPoke(uid,fid);  
    try
    {
        $("Poke_" +fid  + "_" + uid).style.display="none";
        
         if((parseInt($("FriendCount").value)-1)==0)
            {
                $("AllFriend").style.display="none";
            }
            else
            {
                $("FriendCount").value=parseInt($("FriendCount").value)-1;
            }
    }
    catch(e)
    {} 
}
//删除所有某个的打招呼
function DelAllPoke(uid)
{
    AjaxController.DelAllPoke(uid);  
    try
    {
        $("poke_ul").style.display="none";
    }
    catch(e)
    {} 
}

//生成信息对话框
function PmContent(uid,fid,fUserName)
{
    var html='';
    
    html+='<h1>发短消息</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
  
    html+='<table cellspacing="0" cellpadding="3">';
		      html+='<tr>';
		         html+='<th><label for="subject">标题：</label></th>';
		         html+='<td><input type="text" id="subject" name="subject" value="" size="38" tabindex="2" class="t_input" style="width: 396px;" /></td>';
	        html+=' </tr>';
	         html+='<tr>';
		        html+=' <th style="vertical-align: top;"><label for="message">内容：</label></th>';
		         html+='<td><textarea id="message" name="message" cols="40" rows="4" tabindex="3" style="width: 400px; height: 150px;" ></textarea></td>';
	         html+='</tr>';
	         html+='<tr>';
		         html+='<th>&nbsp;</th>';
		         html+='<td>';
		         html+='<input type="button" name="pmsubmit_btn" id="pmsubmit_btn" value="发送" tabindex="4" class="submit" onclick="SendPm(' + uid + ',' + fid + ')" />';
		        html+=' </td>';
	        html+=' </tr>';
	html+='</table>';
	html+='</div>';
	return html;
}
//发送短信
function SendPm(uid,fid)
{
    var Subject=$("subject").value;
    var Message=$("message").value;
    AjaxController.SendPm(uid,fid,Subject,Message);
    $("popupmenu_inner").innerHTML="进行的操作已经完成";
    setTimeout('hideMenu()', 1000);

}
function DelPmContent(pmid,InOrOut)
{
     var html='';
        html+='<h1>确定删除指定的短消息吗？</h1><br>';
        html+='<div class="popupmenu_inner" id="popupmenu_inner">';
	    html+='<p class="btn_line" align=center>';
		    html+='<input type="button" name="deletesubmit_btn" value="确定" class="submit" onclick="DelPm('+ pmid + ',\'' + InOrOut + '\')" />&nbsp;';
		    html+='<button name="btncancel" type="button" class="submit" onclick="hideMenu()">取消</button>';
	    html+='</p>';
	    html+='<br>';
	    html+='</div>';
	    return html;
	
}
function DelPm(pmid,InOrOut)
{
    AjaxController.DelPm(pmid,InOrOut);
    $("popupmenu_inner").innerHTML="进行的操作已经完成";
    setTimeout('hideMenu()', 1000);
    //$("pm_" +pmid).style.display="none";
}


//修改留言
function CommentContent(CommentId,Message)
{
Message=$("Message_" + CommentId).innerHTML;
var html='';
    
    html+='<h1>编辑</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
    html+='<table>';
	html+='<tr>';
		html+='<td>';

			html+='<label for="message">编辑内容：</label>';

			html+='<img border="0" src="/image/zoomin.gif" onmouseover="this.style.cursor=\'pointer\'" onclick="zoomTextarea(\'message\', 1)"> ';

			html+='<img border="0" src="/image/zoomout.gif" onmouseover="this.style.cursor=\'pointer\'" onclick="zoomTextarea(\'message\', 0)">';

			html+='<br />';
			html+='<textarea id="message" name="message" cols="70"  rows="8">' + Message + '</textarea></td>';
	html+='</tr>';
	html+='<tr>';
		html+='<td>';
		html+='<input type="button" name="editsubmit_btn" id="editsubmit_btn" value="提交" class="submit" onclick="EditContent(' + CommentId + ')" />';
		html+='</td>';
	html+='</tr>';
    html+='</table>';
	html+='</div>';
	return html;
}
function EditContent(CommentId)
{
    var Message=$("message").value;
    AjaxController.EditContent(CommentId,Message);
    setTimeout('hideMenu()', 1000);
    $("Message_" +CommentId).innerHTML=Message;
}
//
function CheckMsg(id)
{
    var Message=$(id).value;
    if (Message=="")
    {
        alert("请输入留言内容");
        return false;
    }  
    else
    {
        return true;
    }
}
//添加留言
function AdContent(FromUserId,UserId,FromUserName)
{
    var Message=$("comment_message").value;
    if (Message=="")
    {
        alert("请输入留言内容");
        return false;
    }
    else
    {
                
                
        var CommentId=AjaxController.ReCommentContent(FromUserId,UserId,FromUserName,Message,0).value;
        var newli = document.createElement("span");
        var s= '';
        s+='';
            s+='<table id="Wall_' + CommentId +'" width="100%" border="0" cellpadding="0" cellspacing="0" class="jl8 xian2 jl">'
                s+='<tr>'
                    s+='<td width="72" valign="top">'
                        s+='<div class="l51_s_list">'
                             s+='<a href="/space.aspx?uid=' + FromUserId + '"><img border="0" src="/face/UserPhoto.aspx?type=small&uid=' + FromUserId + '" class="summaryimg image"/></a>';
                             s+='</div>'
                   s+=' </td>'
                    s+='<td valign="top">'
                        s+='<A href="/space.aspx?uid=' + FromUserId + '">' + FromUserName + '</A> <br>';
                        s+='<span id=Message_' + CommentId + '> '
    　　                s+=Message;
                        s+='</span>'
                        s+='</td>'
                    s+='<td width="120" valign="top" class="time dq">'
                        s+= showdate();
                        s+='<a id="CommentR_' + CommentId + '" onclick="ajaxmenu(event,this.id, 99999, -1,\'Rewall\',' + UserId + ',' + FromUserId + ',\'' + FromUserName + '\')" href="#">回复</a> ';
                        s+='<a id=Comment_' + CommentId + ' onclick="ajaxmenu(event,this.id, 99999, -1,\'editwall\',' + CommentId + ',0,\'' + Message + '\')"  href="#">编辑</a> ';
                        s+='<a id=id=CommentDel_' + CommentId + ' onclick="ajaxmenu(event,this.id, 99999, -1,\'dewall\',' + CommentId + ',0,\'\')" href="#">删除</a> ';
                         s+='</td>'
                s+='</tr>'
            s+='</table>'        
        newli.innerHTML = s;
        if($('comment_ul').childNodes[0]!=null)
        {
            $('comment_ul').insertBefore(newli,$('comment_ul').childNodes[0]);  
        }
        else
        {
            $('comment_ul').appendChild(newli);
        }
        $("comment_message").value="";
    }
}
function showdate() //显示系统日期   
{   
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds()
    var timeValue = now.getYear()+"-"+(now.getMonth()+1)+"-"+now.getDate()+"日" 
    timeValue += hours
    timeValue += ((minutes < 10) ? ":0" : ":") + minutes
    timeValue += ((seconds < 10) ? ":0" : ":") + seconds
    return timeValue;
}   

//回复留言
function ReContent(FromUserId,UserId,FromUserName)
{
    if(FromUserId==-1)
    {
        alert("请先登录。");
        window.navigate("/home.aspx");
        return ;
    }
    var html='';
    html+='<h1>回复</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
    html+='<table>';
		html+='<tr>';
			html+='<td>';
				html+='<label for="message">内容：</label>';
				html+='<img src="image/zoomin.gif" onmouseover="this.style.cursor=\'pointer\'" onclick="zoomTextarea(\'message_pop\', 1)"> ';
				html+='<img src="image/zoomout.gif" onmouseover="this.style.cursor=\'pointer\'" onclick="zoomTextarea(\'message_pop\', 0)">';
				html+='<br />';
				html+='<textarea id="message_pop" name="message" rows="8" cols="70"></textarea>';
			html+='</td>';
		html+='</tr>';
		html+='<tr>';
			html+='<td>';
				html+='<input type="button" name="commentsubmit_btn" id="commentsubmit_btn" value="回复" class="submit" onclick="ReCommentContent(' + FromUserId + ',' + UserId + ',\'' + FromUserName + '\')" />	';
			html+='</td>';
		html+='</tr>';
	html+='</table>';
	html+='</div>';
	return html;
}

function ReCommentContent(FromUserId,UserId,FromUserName)
{
    var Message=$("message_pop").value;
    AjaxController.ReCommentContent(FromUserId,UserId,FromUserName,Message,0);
    $("popupmenu_inner").innerHTML="进行的操作已经完成";
    setTimeout('hideMenu()', 1000);
}

function DelCommentContent(CommentId,uid)
{
     var html='';
        html+='<h1>确定删除指定的回复吗？</h1><br>';
        html+='<div class="popupmenu_inner" id="popupmenu_inner">';
	    html+='<p class="btn_line" align=center>';
		    html+='<input type="button" name="deletesubmit_btn" value="确定" class="submit" onclick="DelComment('+ CommentId + ',' + uid + ')" />&nbsp;';
		    html+='<button name="btncancel" type="button" class="submit" onclick="hideMenu()">取消</button>';
	    html+='</p>';
	    html+='<br>';
	    html+='</div>';
	    return html;
}

function  DelComment(CommentId,uid)
{
    AjaxController.DelComment(CommentId,uid);
    $("popupmenu_inner").innerHTML="进行的操作已经完成";
    setTimeout('hideMenu()', 1000);
    $("Wall_" +CommentId).style.display="none";
}
function DelStudent_Book(uid,bookId)
{
    var html='';
        html+='<h1>确定删除指定的课本吗？</h1><br>';
        html+='<div class="popupmenu_inner" id="popupmenu_inner">';
	    html+='<p class="btn_line" align=center>';
		    html+='<input type="button" name="deletesubmit_btn" value="确定" class="submit" onclick="DelBook('+ uid + ','+ bookId + ')" />&nbsp;';
		    html+='<button name="btncancel" type="button" class="submit" onclick="hideMenu()">取消</button>';
	    html+='</p>';
	    html+='<br>';
	    html+='</div>';
	    return html;
}
function  DelBook(uid,bookId)
{
    AjaxController.DelBook(uid,bookId);
    $("popupmenu_inner").innerHTML="进行的操作已经完成";
    setTimeout('hideMenu()', 1000);
    $("book_" +bookId).style.display="none";
}
//
function ShowWebEdit()
{
    var html='';
    html+='<h1>回复</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
     html+='<table >';
		html+='<tr>';
			html+='<td>';
            html+='<iframe id="iframe1" name="iframe1" frameborder=0 width=500 height=320 src="WebEdit.htm"></iframe>';			
            html+='</td>';
		html+='</tr>';
		html+='<tr>';
			html+='<td>';
				html+='<input type="button" name="commentsubmit_btn" id="commentsubmit_btn" value="确 定" class="submit" onclick="EditMsg()" />	';
			html+='</td>';
		html+='</tr>';
	html+='</table>';
    return html;
}
function EditMsg()
{
    iframe1.KindSubmit();
    var Content=$("iframe1").contentWindow.document.getElementById("content").value;
    alert(Content);
}

///删除日记评论
function DelPost(pid)
{
    if(confirm("您真的要删除此评论吗？"))
    {
        AjaxController.DelPost(pid);
        $("Post_" +pid).style.display="none";
    }
}

///删除日记评论
function DelGroup(gid,type)
{
    if(type=="True")
    {
        alert("不允许删除默认分类");
        return;
    }
    if(confirm("您真的要删除此分类吗？"))
    {
        AjaxController.DelGroup(gid);
        $("group_" +gid).style.display="none";
    }
}
function DelNote(NoteId)
{
    if(confirm("您真的要删除此日记吗？"))
    {
        AjaxController.DelNote(NoteId);
       window.navigate("/note/NoteList.aspx?ac=me");
    }
}
function mtagDel(obj) {
    
    AjaxController.DelLove(obj.parentNode.id);
    obj.parentNode.parentNode.removeChild(obj.parentNode);
}
function mtagAdd(LoveType,TextId,UserId)
{
    var LoveName
    LoveName=$(TextId).value
   if (LoveName!="")
   {
        var LoveId
        LoveId=AjaxController.AddLoves(LoveName,LoveType,UserId).value;
        var newli = document.createElement("li");
        newli.id= LoveId
        var s= LoveName + ' &nbsp;<A class=float_del onclick="mtagDel(this);return false;"  href="javascript:;">删除</A>'
        newli.innerHTML = s;
        $('mtag_'+LoveType+'_ul').appendChild(newli);
   }
   else
   {
        alert("请输入内容");
   }
}

function Ini(GroupId,ThreadId)
{   
   SetTag(ThreadId);
   var Content=GetChildTags(GroupId).value;
   catelogCount=Content.length;
    for(var i=0;i<Content.length;i++)
    {
        catelogs[i]=new Array(Content[i].TagName,"",0,Content[i].TagId,Content[i].TagLevel);
    }
    jobtypeSelector=new Selector("jobtypeSelector",5,1);
    jobtypeSelector.Init();
}
function SetTag(ThreadId)
{
   var Content= AjaxController.GetTagByThread(ThreadId).value;
   $("jTypeId").value="";
   $("jTypeId").value=Content;
   $("HideThreadId").value=ThreadId;
}

function SaveTag()
{
    var ThreadId=$("HideThreadId").value;
    var Tags=$("jTypeId").value;
    if (ThreadId=="")
    {
        alert("请选择贴子");
        return ;
    }
    if (Tags=="")
    {
        alert("请选择学标");
        return ;
    }
    AjaxController.AddTag(ThreadId,Tags);
    var ImgHtml='<img src="/image/tb.gif" tag="带学标">';
    var html= ImgHtml + $("tdtid_" + ThreadId).innerHTML;
    $("tdtid_" + ThreadId).innerHTML=html;
}

//网教添加留言
function AdTeacherContent(FromUserId,UserId,FromUserName)
{
    if(FromUserId==-1)
    {
        alert("请先登录。");
        window.navigate("/home.aspx");
        return ;
    }
    var Message=$("comment_message").value;
    if (Message=="")
    {
        alert("请输入留言内容");
        return false;
    }
    else
    {

        var CommentId=AjaxController.ReCommentContent(FromUserId,UserId,FromUserName,Message,1).value;
        if(CommentId==-1)
        {
            $("comment_message").value="";
            alert("您输入的留言中有敏感字符。请重新输入");
            return ;
        }
        var newli = document.createElement("span");
        var s= '<table id="Wall_' + CommentId + '" width="100%"  border="0" cellpadding="0" cellspacing="0" class="jl8 xian2 jl">';
        s+='<tr>';
        s+='<td width="72" valign="top">';
        s+='<DIV class=l51_s_list>';
        s+='<A href="/space.aspx?uid=' + FromUserId + '">';
        s+='<IMG src="/face/UserPhoto.aspx?type=small&uid=' + FromUserId + '" width=50 height=50 border="0"></A></DIV></td>';
        s+='<td valign="top"><A href="/space.aspx?uid=' + FromUserId + '">' + FromUserName + '</A>  <br>';
        s+='<span id=Message_' + CommentId + '>';
        s+=Message;
        s+='</span></td>';
        s+='<td width="200" valign="top" class="time dq"><span class="time dq">' + showdate() + '　';
        s+='<a id=Comment_' + CommentId + ' onclick="ajaxmenu(event,this.id, 99999, -1,\'editwall\',' + CommentId + ',0,\'' + Message + '\')"  href="#">编辑</a> ';
        s+='<a id=id=CommentDel_' + CommentId + ' onclick="ajaxmenu(event,this.id, 99999, -1,\'dewall\',' + CommentId + ',0,\'\')" href="#">删除</a> ';
        s+='</td>';
        s+='</tr>';
        s+='</table>';

        newli.innerHTML = s;
        if($('comment_ul').childNodes[0]!=null)
        {
            $('comment_ul').insertBefore(newli,$('comment_ul').childNodes[0]);  
        }
        else
        {
            $('comment_ul').appendChild(newli);
        }
        $("comment_message").value="";
    }
}

///删除日记评论
function DelCounselingGroup(gid,type)
{
    if(type=="True")
    {
        alert("不允许删除默认分类");
        return;
    }
    if(confirm("您真的要删除此分类吗？"))
    {
        AjaxController.DelCounselingGroup(gid);
        $("group_" +gid).style.display="none";
    }
}
function SendToFriend(uid,UserName)
{
    var Question=$("txtQuestion").value;
    if (Question=="")
    {
        alert("请输入内容");
        return false;
    }
    else
    {
         AjaxController.SendQuestionToFriend(uid,UserName,Question);
    }
}

////
//投票
function AddVoteItem(fid)
{
    var html='';
    
    html+='<h1>添加投票项</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
  
    html+='<table cellspacing="0" cellpadding="3">';
		      html+='<tr>';
		         html+='<td><label for="subject">输入新增的投票候选项</label><br><input type="text" id="subject" name="subject" value="" size="38" tabindex="2" class="t_input" style="width: 396px;" /></td>';
	        html+=' </tr>';
	         html+='<tr>';
		         html+='<td>';
		         html+='<input type="button" name="pmsubmit_btn" id="pmsubmit_btn" value="确 定" tabindex="4" class="submit" onclick="ajaxAddVoteItem(' + fid + ')" />';
		        html+=' </td>';
	        html+=' </tr>';
	html+='</table>';
	html+='</div>';
	return html;
}
function ajaxAddVoteItem(SubjectId)
{
    var Question=$("subject").value;
    if (Question=="")
    {
        alert("请输入内容");
        return false;
    }
    else
    {
         AjaxController.AddVoteItem(SubjectId,Question);
    }
    window.location.reload();
}

function EditVoteEndDate(fid)
{
    var html='';
    html+='<h1>修改截止时间</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
  
    html+='<table cellspacing="0" cellpadding="3">';
		      html+='<tr>';
		         html+='<td><label for="subject">请设置新的截止时间：</label><br><input type="text" id="subject" name="subject" value="" size="38" tabindex="2" onfocus="selectDate(this)" class="t_input" style="width: 200px;" /></td>';
	        html+=' </tr>';
	         html+='<tr>';
		         html+='<td>';
		         html+='<input type="button" name="pmsubmit_btn" id="pmsubmit_btn" value="确 定" tabindex="4" class="submit" onclick="ajaxEditVoteEndDate(' + fid + ')" />';
		        html+=' </td>';
	        html+=' </tr>';
	html+='</table>';
	html+='</div>';
	return html;
}
function ajaxEditVoteEndDate(SubjectId)
{
    var Question=$("subject").value;
    if (Question=="")
    {
        alert("请输入时间");
        return false;
    }
    else
    {
         AjaxController.EditVoteEndDate(SubjectId,Question);
    }
    window.location.reload();
}

function WriteNote(fid)
{
    var html='';
    html+='<h1>写写投票总结</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
  
    html+='<table cellspacing="0" cellpadding="3">';
		      html+='<tr>';
		         html+='<td><label for="subject">请输入对此次投票的总结：</label><br><textarea id="Content" name="Content" cols="70"  rows="8"></textarea></td>';
	        html+=' </tr>';
	         html+='<tr>';
		         html+='<td>';
		         html+='<input type="button" name="pmsubmit_btn" id="pmsubmit_btn" value="确 定" tabindex="4" class="submit" onclick="ajaxWriteNote(' + fid + ')" />';
		        html+=' </td>';
	        html+=' </tr>';
	html+='</table>';
	html+='</div>';
	return html;
}
function ajaxWriteNote(SubjectId)
{
    var Question=$("Content").value;
    if (Question=="")
    {
        alert("请输入时间");
        return false;
    }
    else
    {
         AjaxController.WriteNote(SubjectId,Question);
    }
    window.location.reload();
}
function ajaxDelVote(SubjectId)
{
     if(confirm("您真的要删除此投票吗？"))
     {
         AjaxController.DelVote(SubjectId);
         window.navigate("/Vote/VoteList.aspx?ac=my");
     }
}
function PostVoteComment(SubjectId,UserId,UserName)
{
    var Content=$("Content").value;
    if (Content=="")
    {
        alert("请输入留言内容");
        return false;
    }
    else
    {
         AjaxController.AddVoteComment(SubjectId,Content,UserId,UserName);
         window.location.reload();
    }
}
function DelVotePost(CommentId,CommentNum,LblNumId)
{
    AjaxController.DelVotePost(CommentId);
    $("Comment_" +CommentId).style.display="none";
    
    $(LblNumId).innerHTML=CommentNum-1;
}

function EditUserInfo(uid)
{
    var UserInfo=$("PanUserInfo").innerText;
    var html='';
    html+='<h1>修改个人简介</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
  
    html+='<table cellspacing="0" cellpadding="3">';
		      html+='<tr>';
		         html+='<td><label for="subject">请输入个人简介：</label><br><textarea id="Content" name="Content" cols="70"  rows="8">' + UserInfo + '</textarea></td>';
	        html+=' </tr>';
	         html+='<tr>';
		         html+='<td>';
		         html+='<input type="button" name="pmsubmit_btn" id="pmsubmit_btn" value="确 定" tabindex="4" class="submit" onclick="ajaxEditUserInfo(' + uid + ')" />';
		        html+=' </td>';
	        html+=' </tr>';
	html+='</table>';
	html+='</div>';
	return html;
}

function ajaxEditUserInfo(uid)
{
    var Question=$("Content").value;
    if (Question=="")
    {
        alert("请输入个人简介");
        return false;
    }
    else
    {
         AjaxController.EditUserInfo(uid,Question);
         $("PanUserInfo").innerHTML=Question;
         $("popupmenu_inner").innerHTML="进行的操作已经完成";
         setTimeout('hideMenu()', 1000);
    }
}

function EditShareSumary(uid,sid)
{
    var html='';
    html+='<h1>添加总结</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
  
    html+='<table cellspacing="0" cellpadding="3">';
		      html+='<tr>';
		         html+='<td><label for="subject">请输入总结内容：</label><br><textarea id="Content" name="Content" cols="70"  rows="8"></textarea></td>';
	        html+=' </tr>';
	         html+='<tr>';
		         html+='<td>';
		         html+='<input type="button" name="pmsubmit_btn" id="pmsubmit_btn" value="确 定" tabindex="4" class="submit" onclick="ajaxEditShareSumary(' + uid + ',' + sid + ')" />';
		        html+=' </td>';
	        html+=' </tr>';
	html+='</table>';
	html+='</div>';
	return html;
}

function ajaxEditShareSumary(uid,sid)
{
    var Sumary=$("Content").value;
    if (Sumary=="")
    {
        alert("请输入结内容");
        return false;
    }
    else
    {
         AjaxController.EditShareSumary(uid,sid,Sumary);
         window.location.reload();
    }
}
function DelUserFriend(uid,fid)
{
     if(confirm("您真的要解除好友关系吗？"))
     {
         AjaxController.DelUserFriend(uid,fid);
         window.location.reload();
     }
}
function SendQuestionMsg(uid)
{
    var html='';
    html+='<h1>提示信息</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
  
    html+='<table cellspacing="0" cellpadding="3">';
		      html+='<tr>';
		         html+='<td>您提出的问题，将通知您的同学和老师。如果您还没有建立自己的同学和老师关系，<br>请在“我的好友”中查找添加。<br><input type="checkbox" name="checkbox" id="IsDisplay">我知道了。</td>';
	        html+=' </tr>';
	         html+='<tr>';
		         html+='<td>';
		         html+='　　<input type="button" name="pmsubmit_btn" id="pmsubmit_btn" value="确 定" tabindex="4" class="submit" onclick="SetIsDisplay(' + uid + ')" />';
		        html+=' </td>';
	        html+=' </tr>';
	html+='</table>';
	html+='</div>';
	return html;
}
function EditGroupName(uid,fid)
{
    var html='';
    
    html+='<h1>修改好友分组</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
  
    html+='<table cellspacing="0" cellpadding="3">';
		 html+='<tr>';
			html+='<td>';
				html+='<input type="text" id="txtGroupName" name="note" value="" size="20" class="t_input"  style="width: 300px;" maxlength="25" />';
				html+='<p class="gray">(最多16个汉字)</p>';
			html+='</td>';
		html+='</tr>';
		html+='<tr>';
			html+='<th>&nbsp;</th>';
			html+='<td>';
				html+='<input type="button" name="pokesubmit_btn" id="pokesubmit_btn" value="确定" class="submit" onclick="SaveUserGroupName(' + uid + ',' + fid + ')" />';
			html+='</td>';
		html+='</tr>';
	html+='</table>';
	
	html+='</div>';
	return html;
}
function DelFriendGroup(gid,uid)
{
    if(confirm("您真的要删除此分组吗？在删除之前请确定是否移除该分组里的好友。"))
    {
        var FC=AjaxController.GetGroupFriendCount(uid,gid).value;
        if(FC==0)
        {
            AjaxController.SaveUserGroupName(gid,uid,"");
            window.location.reload();
        }
        else
        {
            alert("删除失败，该分组里还有好友。");
        }
    }
}
function DelCounselingPost(pid)
{
    if(confirm("您真的要删除此评论吗？"))
    {
        AjaxController.DelCounselingPost(pid);
        window.location.reload();
    }
}
function SaveUserGroupName(gid,uid)
{
    var GroupName=$("txtGroupName").value;
    if(GroupName=="")
    {
        alert("请输入组名");
        return ;
    }
    if(fucCheckLength(GroupName)>32)
    {
         alert("不能多于16个汉字");
        return ;
    }
    AjaxController.SaveUserGroupName(gid,uid,GroupName);
    window.location.reload();
}
function SetIsDisplay(uid)
{
    if($("IsDisplay").checked)
    {
        setCookie(uid,"1");
    }
    window.location.reload();
    
}

function setCookie(name,value)
{
var Days = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
//读取cookies
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)) return unescape(arr[2]);
else return null;
}
//删除cookies
function delCookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

function DelCounseling(UserId, BookId,CounselingId)
{
    if(confirm ("您真的要删除此方案吗？"))
    {
        window.navigate("/Knowledge/do.aspx?ac=tbook&uid=" + UserId + "&bid=" + BookId + "&cid=" + CounselingId + "&action=del");
    }
}

function AddUserGroup(uid,gid,jid)
{
    AjaxController.JoinGroupUser(uid,gid);
    DelUserJoin(jid);
}
function DelUserJoin(jid)
{
    AjaxController.DelUserJoin(jid);
    $("J_" +jid).style.display="none";
    if((parseInt($("FriendCount").value)-1)==0)
    {
        $("AllFriend").style.display="none";
    }
    else
    {
        $("FriendCount").value=parseInt($("FriendCount").value)-1;
    }
}

function SetIsView(type,nid)
{
    AjaxController.SetIsView(type,nid);
    $("N_" +nid).style.display="none";
    if((parseInt($("FriendCount").value)-1)==0)
    {
        $("AllFriend").style.display="none";
    }
    else
    {
        $("FriendCount").value=parseInt($("FriendCount").value)-1;
    }
}

function SendToStudentMssageBox(ctrlid, timeout,offset,uid,tid) 
{
	divclass = 'popupmenu_popup';
	duration = timeout > 10000 ? 3 : 0;
	if(offset == -1) {
		divclass = 'popupmenu_centerbox';
	}
	var div = $(ctrlid + '_menu');
		if(!div) {
			div = document.createElement('div');
			div.ctrlid = ctrlid;
			div.id = ctrlid + '_menu';
			div.style.display = 'none';
			div.className = divclass;
			$('append_parent').appendChild(div);
		}
		var Content=SendToStudentMssageBoxContent(uid,tid);
        div.innerHTML =Content;
        showMenu(ctrlid, 'click', offset,duration, timeout, 0, ctrlid, 400, 1);
        
        WdatePicker({eCont:'DivDate',el:'d523',dateFmt:'yyyy-MM-dd',onpicked:function(dp){
        
        dp.$('d523_y').value=dp.cal.getP('y');
        dp.$('d523_M').value=dp.cal.getP('M');
        dp.$('d523_d').value=dp.cal.getP('d');
        $("SpanDate").innerHTML=dp.cal.getP('y') + "年" + dp.cal.getP('M') + "月" + dp.cal.getP('d')+"日";
        
        }})
        
        $dp.$('d523_y').value=$dp.cal.getP('y');
        $dp.$('d523_M').value=$dp.cal.getP('M');
        $dp.$('d523_d').value=$dp.cal.getP('d');
        $("SpanDate").innerHTML=$dp.cal.getP('y') + "年" + $dp.cal.getP('M') + "月" + $dp.cal.getP('d')+"日";

}
function SendToStudentMssageBoxContent(uid,CTSId)
{
    var Title=$("spanTitle").innerText;
    var html='';
    html+='<h1>是否同意给该学生讲解辅导</h1><a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>';
    html+='<div class="popupmenu_inner" id="popupmenu_inner">';
     html+='<table width="400px"  border="0" align="center" cellpadding="3" cellspacing="5" class="kuang">';
       html+='<tr>';
         html+='<td>';
         html+='<table width="100%"  border="0" cellspacing="0" cellpadding="0">';
            html+=' <tr>';
              html+=' <td valign="top">　　你同意给学生讲解辅导【' + Title + '】，此讲解将收录到你的收费辅导栏目中。请在下面设置上课的时间。';
               html+='</td>';
            html+=' </tr>';
          html+=' </table>';
          html+='<br>';
         html+='<table width="100%"  border="0" cellspacing="0" cellpadding="0">';
            html+='<tr>';
              html+='<td valign="top"><div id="DivDate"></div></td>';
              html+='<td valign="top" ><table width="100%"  border="0" cellpadding="5" cellspacing="0" class="jl22">';
                html+='<tr>';
                  html+='<td><b>请选择左边日历的时间：</b></td>';
                  html+='</tr>';
                  html+='<tr><td>';
                  html+='日期：<span id="SpanDate">年　月　日</span>';
                  html+='</td>';
                  html+='</tr>';
                  html+='<tr><td>';
                     html+='<input style="display:none" type="text" id="d523_y" size="5"/>';
                     html+='<input style="display:none" type="text" id="d523_M" size="3"/>';
                     html+='<input style="display:none" type="text" id="d523_d" size="3"/>';
                     html+='</td>';
                html+='</tr>';
                 html+='<tr><td>';
                  html+='时间： <select name="select" id="SelectHour">';
                  html+='<option value=0>0</option>';
                  html+='<option value=1>1</option>';
                  html+='<option value=2>2</option>';
                  html+='<option value=3>3</option>';
                  html+='<option value=4>4</option>';
                  html+='<option value=5>5</option>';
                  html+='<option value=6>6</option>';
                  html+='<option value=7>7</option>';
                  html+='<option value=8>8</option>';
                  html+='<option value=9>9</option>';
                  html+='<option value=10>10</option>';
                  html+='<option value=11>11</option>';
                  html+='<option value=12>12</option>';
                  html+='<option value=13>13</option>';
                  html+='<option value=14>14</option>';
                  html+='<option value=15>15</option>';
                  html+='<option value=16>16</option>';
                  html+='<option value=17>17</option>';
                  html+='<option value=18>18</option>';
                  html+='<option value=19>19</option>';
                  html+='<option value=20>20</option>';
                  html+='<option value=21>21</option>';
                  html+='<option value=22>22</option>';
                  html+='<option value=23>23</option>';
                  html+='</select>时 <select id="SelectMinite" name="select">';
                  html+='<option value=0>00</option>';
                  html+='<option value=15>15</option>';
                  html+='<option value=30>30</option>';
                  html+='<option value=49>45</option>';
                  html+='<option value=59>59</option>';
                  html+='</select>分';
                  html+='</td>';
                  html+='</tr>';
              html+='</table>';
               html+=' </td>';
            html+='</tr>';
        html+='</table>';
        html+='</td>';
      html+=' </tr>';
    html+=' </table>';
    html+='<br>';
  html+='<table width="400px" border="0" cellspacing="0" cellpadding="0">';
    html+='<tr>';
     html+=' <td align="right"> <INPUT class=submit  type="button"  value="确 定" onclick="SendToStudent(' + uid + ',' + CTSId + ')"/> <input name="Submit2" onclick="hideMenu();" type="button" class="submit" value=" 取消 "></td>';
   html+='</tr>';
  html+='</table>';
	html+='</div>';
	return html;
}
function SendToStudent(uid,CTSId)
{
    var StrDate=$("d523_y").value + "-" + $("d523_M").value + "-" + $("d523_d").value + " " + $("SelectHour").options[$("SelectHour").selectedIndex].value + ":" + $("SelectMinite").options[$("SelectMinite").selectedIndex].value ;
    
    var R=AjaxController.SendToStudent(uid,CTSId,StrDate).value;
    if(R=="OK")
    {
        $("CT_" +CTSId).style.display="none";
        if((parseInt($("FriendCount").value)-1)==0)
        {
            $("AllFriend").style.display="none";
        }
        else
        {
            $("FriendCount").value=parseInt($("FriendCount").value)-1;
        }
        
        $("popupmenu_inner").innerHTML="成功为学生创建新的收费辅导。";
        setTimeout('hideMenu()', 2000);
    }
    else
    {
        alert(R);
    }
}
function SetScriptRecord(rid,IsSendMsg)
{
     var R=AjaxController.SetScriptRecord(rid,IsSendMsg).value;
    if(R=="OK")
    {
        $("SR_" +rid).style.display="none";
        if((parseInt($("FriendCount").value)-1)==0)
        {
            $("AllFriend").style.display="none";
        }
        else
        {
            $("FriendCount").value=parseInt($("FriendCount").value)-1;
        }
        alert("设置成功");
    }
    else
    {
        alert(R);
    }
}
function SetDelScriptRecord(rid)
{
     var R=AjaxController.SetDelScriptRecord(rid).value;
    if(R=="OK")
    {
        $("SR_" +rid).style.display="none";
        if((parseInt($("FriendCount").value)-1)==0)
        {
            $("AllFriend").style.display="none";
        }
        else
        {
            $("FriendCount").value=parseInt($("FriendCount").value)-1;
        }
    }
    else
    {
        alert(R);
    }
}
function DelThread_Student(CTSId)
{
    AjaxController.DelThread_Student(CTSId);
    $("CT_" +CTSId).style.display="none";
    if((parseInt($("FriendCount").value)-1)==0)
    {
        $("AllFriend").style.display="none";
    }
    else
    {
        $("FriendCount").value=parseInt($("FriendCount").value)-1;
    }
}
function  Select(id)
{
    if(id==0)
    {
        $("Select0").style.backgroundImage="url(" + "/images/syslogo/navBg.gif " + ")";
        $("Table_0").style.display="";
        $("Select1").style.background="";
        $("Table_1").style.display="none";
    }
    else
    {
        $("Select1").style.backgroundImage="url(" + "/images/syslogo/navBg.gif " + ")";
        $("Table_1").style.display="";
        $("Select0").style.background="";
        $("Table_0").style.display="none";
    }
}