﻿// JScript 文件


        function redirectDL(srcid){
            if (confirm('确实要下载该资源吗？')){
                window.location='download.aspx?srcid=' + srcid             
            }            
        }
        
        function appendEmot(i) {
            var flag=0;
            if(flag==1){
                var ubb=document.getElementById("txtreplycontent");
            }else{
                var ubb=document.getElementById("txtreplycontent");
            }
            var ubbLength=ubb.value.length;
            ubb.focus();
            if(typeof document.selection !="undefined")
            {
                document.selection.createRange().select();  
                var   t   =   document.selection.createRange();  
                 t.text   =   "[f_"+i+"]";

             }
            else
            {
                ubb.value=ubb.value.substr(0,ubb.selectionStart)+a+ubb.value.substring(ubb.selectionStart,ubbLength);
            }
        }   



        function ReplaceImg(str){
    
            return str.replace(/\[(f_\d+?)\]/ig,function(c,d){return '<img src="/index/index_res/replyep/'+d+'.gif" />';})
        }
        
        function BtnReply(resuserid,srcid){
            var subUrl='tid='+srcid+'&name='+document.getElementById("txtusername").value+"&pw=" +document.getElementById("txtpassword").value+"&rsuid="+resuserid
            if (document.getElementById("chkisany").checked){
                subUrl +="&isany=1"
            }            
            Request.reSend('resreply.aspx?'+subUrl,'iType=10&contents='+escape(document.getElementById("txtreplycontent").value),ReturnBtnReply,"addReply","addReply");
            
        }
                       
        function ReturnBtnReply(Obj){
            var myDate = new Date();
            if(Obj.responseText=="-1"){
                alert('您还没有登录，请登录后重试！')
            }else if(Obj.responseText=="-2"){
                alert('登陆失败，请核对您的账号信息后重试!')
            }else if(Obj.responseText=="-3"){
                alert('添加评论失败,请稍候重试！')
            }else{
                var name=""
                if (document.getElementById("chkisany").checked){
                    name="匿名"
                }else{
                    name=Obj.responseText
                }
                var strHtml='<div class="tz_reply_02">\
                        <span class="tz_reply_2a">'+name+'</span><span style="float: right; padding-right: 10px">'+GetDateT()+' </span>\
                        </div>\
                        <div class="tz_reply_03">' + ReplaceImg(document.getElementById("txtreplycontent").value) +'</div>\
                        <div class="ptop5">\
                        </div>'
                document.getElementById("divReplyList").innerHTML=strHtml+document.getElementById("divReplyList").innerHTML
                document.getElementById("txtusername").value="";
                document.getElementById("txtpassword").value="";
                document.getElementById("txtreplycontent").value="";
            }
        }
        
        function GetDateT()
         {
          var d,s;
          d = new Date();
          s = d.getYear() + "-";             //取年份
          s = s + (d.getMonth() + 1) + "-";//取月份
          s += d.getDate() + " ";         //取日期
          s += d.getHours() + ":";       //取小时
          s += d.getMinutes() + ":";    //取分
          s += d.getSeconds();         //取秒          
          return(s);  
         
         } 
         
        function doSearch(){
            var hselectid
            if(document.getElementById("cmbfenlei").value=='5544a'){
                hselectid="7"
            }else{
                hselectid="2"
            }
            
            strUrl = 'searchp.aspx?hSelect='+ hselectid +'&dbselMode=' + document.getElementById("cmbfenlei").value 
            var strUrl;
            if(document.getElementById("txtkeyword").value!="关键字" && document.getElementById("txtkeyword").value!=""){
                strUrl +='&txtname=' +document.getElementById("txtkeyword").value;
            }
            window.location.href=strUrl;
        }