﻿    
    function StringBuffer(){
        this._strings_= new Array;
    }
    StringBuffer.prototype.append=function(str){
        this._strings_.push(str);
    };
    StringBuffer.prototype.toString=function(){
        return this._strings_.join('');
    };
    
    function numonly(n){ 
        n.value=n.value.replace(/\D/g,'') 
    } 

    /*FAQ查询*/    
    var classID = "";    
    function faqSearchByClassID(id){
        document.getElementById("keyword").value = "";
        classID = id;
        faqList(1);
    }
    
    function faqSearch(){
        classID = "";
        faqList(1);
    }
        
	function faqList(pagenow){
//	    if (classID){	        
//	    }
//	    else{
//	        classID = "";
//	    }
	
	    document.getElementById("page").value = pagenow;
	    var keyword=$.trim($("#keyword").val());
	    if(keyword.length == 0 && classID.length == 0 || keyword == "请输入关键字"){	
	        $("#keyword").val("请输入关键字").css("color","#626262");	        
	        return false;
	    }
	    	    
	    var param={ pagenow:pagenow,keyword:keyword,classID:classID }; 
        var url="/Faq/SearchOperation.aspx?action=faqList";

        $.ajax({
            beforeSend: AjaxBegin(),        
	        type: "post",
	        url:url,
	        data:param,
	        dataType:"text",
	        success: function(vars){
	            AjaxEnd();
	            if($.trim(vars).length>0){
		            document.getElementById("divSearchList").innerHTML = vars;
		            document.getElementById("tipMsg").innerHTML = "";		            
		            document.getElementById("page").value=pagenow;		            
		            document.getElementById("divSearchList").style.display = "";	                
		        }
		        else{
		            showFaqList();		            
		            document.getElementById("tipMsg").style.display = "";
		            document.getElementById("tipMsg").innerHTML = "<div style='text-align:center;vertical-align:middle;width:100%;height:200px;'><br/><br/><br/><font color='#456404'>很抱歉，没有找到您要搜索的结果:(<font></div>";
	            }
	            document.getElementById("btnShowFaq").style.display = "";
	            if(document.getElementById("NormalFaqList"))
	                document.getElementById("NormalFaqList").style.display = "none";
	            if(document.getElementById("GameFaqList")) 
	                document.getElementById("GameFaqList").style.display = "none";
	            if (document.getElementById("divRightBottom")){
	                document.getElementById("divRightBottom").style.display = "none";
	            }
	            if (document.getElementById("divFaqList")){
	                document.getElementById("divFaqList").style.display = "none";
	            }
	            document.documentElement.click();
	        }
        });		  	
	}
	function showFaqList(){
	    if (document.getElementById("divRightBottom")){
	        document.getElementById("divRightBottom").style.display = "";
	    }
	    document.getElementById("divSearchList").innerHTML = "";	
	    if(document.getElementById("NormalFaqList"))     
            document.getElementById("NormalFaqList").style.display = "";
        if(document.getElementById("GameFaqList"))
        document.getElementById("GameFaqList").style.display = "";  
            if (document.getElementById("divFaqList")){
                document.getElementById("divFaqList").style.display = "";
            }
	    document.getElementById("divSearchList").style.display = "none";
	    document.getElementById("btnShowFaq").style.display = "none";
	    document.getElementById("tipMsg").style.display = "none";
	}
	
	if (document.getElementById("keyword")){
	    document.getElementById("keyword").onkeyup = function(evt){
	        evt = window.event ? window.event:evt;
	        if(evt.keyCode == 13 ){
	            faqSearch();
	        }
	    }
	}
	
	function initKeyWord(){
	    if ($.trim($("#keyword").val())=="请输入关键字"){
	        $("#keyword")
	        .val("").end()
	        .focus();	        
	    }
	}   
            
    /*FAQ详细内容页面__初始化*/
    function initPage(){
        var newsID = document.getElementById("NDNewsCreateID").value;
        if (document.getElementById("subLi_"+newsID)){
            //所在层可见
            document.getElementById("subLi_"+newsID).parentNode.parentNode.style.display="";  
            //当前Li标签
            document.getElementById("subLi_"+newsID).className="on"; 
        }        	
    }    
    
    /*FAQ详细内容页面__左侧菜单操作*/
    function showOrHideMenu(id,count){    
        for(var i=1;i<=count;i++){
            $("#subDiv_"+i).slideUp();
        }        
        $("#subDiv_"+id).slideUp().slideDown("slow");
        
    		var obj_a = document.getElementById("catalog").getElementsByTagName("a");
    		for(var j=0;j<obj_a.length;j++){obj_a[j].className="";}
        document.getElementById(id).getElementsByTagName("a")[0].className="on"
    }