﻿
    function GetInfo(){
        var ctm=(new Date()).getTime();
        if(!GetInfo.ctm){GetInfo.ctm=0;}
        if(ctm-GetInfo.ctm<5000){
            alert("回复间隔至少5秒！");return 10;
        }
       var nr=FCKeditorAPI.GetInstance("content").GetXHTML();   
        if(nr.length<5){
            alert("回复内容必须大于5个字！");return 10;
        }
//        SendData("AddAnswer|"+nr,document.getElementById("answerDiv"));
        GetInfo.ctm=ctm;
    }
    function ShowData(result,context){
        var sn=result.split("@");
        if(sn.length>1){
            context.innerHTML=sn[1];
            var txtda=document.getElementById("tb_DaContent");
            txtda.innerHTML="";
        }
        alert(sn[0]);
    }
    function DelDa(id){
        SendData("DelDa|"+id,document.getElementById("answerDiv"));
    }
   
    function AddScore(url,id){
        var fs=document.getElementById(frtname+"lb_Reward");
        var rtn=window.showModalDialog(url+".aspx?lsh="+id, "提高悬赏分", "dialogWidth:260px;dialogHeight:180px;help:no;scroll:no;status:no");
        if(rtn)
        {
            var kw=document.getElementById(frtname+"lb_Reward");
            var hasMark=kw.innerHTML;
            var d=praseInt(hasMark)+praseInt(rtn);
            kw.innerHTML=d;
        }
    }
    function SearchQuest()
    {
        var kw=document.getElementById(frtname+"SearchQuestionText");
        location.href="searchList.aspx?k="+kw.value;
    }
    function  showanswerByAnswerID(answerid)
    {      
      CallServer(answerid,document.getElementById("gv"),"showAnsByID");
      // alert(answerid);
    }    
    function CallServer(obj,contextName,FunName)
    {
        arg = FunName+"|" + obj;
        sendData2(arg,contextName);
    }
   function getData2(result,contextName){
       contextName.innerHTML = result;
      // alert("result"); 
    }
   function chgSct(obj,idx){
     if(obj.checked){
        var mc=obj.id,bc,b;
        var smc=mc.substring(0,mc.length-6);
        var pos=parseInt(mc.substring(mc.length-6,mc.length-4)),mi;
        for(var i=idx;i>0;i--){
            mi=pos-i;
            if(mi<10) bc="0";
            else bc="";
            b=document.getElementById(smc+bc+mi+"_chk");
            if(b) b.checked=false;
        }
        while(true){pos++;
            if(pos<10) bc="0";
            else bc="";
            b=document.getElementById(smc+bc+pos+"_chk");
            if(b) b.checked=false;
            else return;
        }
     }
   }
    function $(obj)
    {
	    return document.getElementById(obj);
    }

    function collapse(pic){	
	    pic.src = ( pic.src.indexOf("no")>-1 ) ? pic.src.replace("no","yes") : pic.src.replace("yes","no");	
	    var box = pic.parentNode.parentNode;	
	    var table = box.getElementsByTagName("table")[0];
	    if(table.style.display==""){
		    table.style.display = "none";
		    box.style.paddingBottom = "20px"
	    }
	    else{
		    table.style.display = "";
		    box.style.paddingBottom = "0px"
	    }	
    }

    function collapse_onlinelist(pic){	
	    pic.src = ( pic.src.indexOf("no")>-1 ) ? pic.src.replace("no","yes") : pic.src.replace("yes","no");		
	    var list = $("onlinelist");
	    list.style.display = list.style.display=="" ? "none" : "";
    }
    
    function linto(ationtype)
    {
        try
        {
            var AcValue=document.getElementById("hflsh").value
            var urlstr="adminoperate.aspx?id="+AcValue+"&type="+ationtype;
            //location.href=urlstr;
            window.open(urlstr);
        }catch(e){alert(e.message);}
    }
    
    function   insertHTMLToEditor(codeStr) 
    { 
        oEditor=FCKeditorAPI.GetInstance( 'tb_DaContent'); 
        if(oEditor   &&   oEditor.EditorWindow)
        { 
        oEditor.InsertHtml(codeStr); 
       } 
    }
       function   clearHTMLToEditor() 
    { 
        oEditor=FCKeditorAPI.GetInstance( 'tb_DaContent'); 
        if(oEditor   &&   oEditor.EditorWindow)
        { 
        oEditor.SetHTML("",true); ;
       } 
    }
     function copyToClipBoard(str){
   
    window.clipboardData.setData("Text",str);
    alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友");
}



