/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

onload = function(){
    pagecss('SearchPage')
}
function selectforum(ob,select){

       if(select == 'forum'){
            $('#forumid').val($(ob).next().val());
            //alert($(ob).next().val());
            
            $('.seek_t').attr('href','/find/Consultation/AddQuestion/plant/'+$(ob).next().val());
            //alert($('#linyu').attr('href'));
            $('#linyu').html($(ob).html());
       }

       if(select == 'start'){
           $('#start').val($(ob).next().val());
       }
       if(select == 'commentcount'){
           $('#count').val($(ob).next().val());
       }
       var provice = $('#provice').val();
       var city = $('#city').val();
       var county = $('#county').val();
       if(select == 'provice'){
            city = '';
            county = '';
        }
        if(select == 'city'){
            //city = '';
            county = '';
        }

       var forumid = $('#forumid').val();
       var start = $('#start').val();
       var count = $('#count').val();    
              var url = "/find/looking/ExpertList";
       if(provice != '' && typeof(provice) != 'undefined'){
           url+= "/province/"+provice;
       }
       if(city != '' && typeof(city) != 'undefined'){
           url+= "/city/"+city;
       }
       if(county != '' && typeof(county) != 'undefined'){
           url+= "/county/"+county;
       }
       if(forumid != '' && typeof(forumid) != 'undefined'){
           url+= "/forumid/"+forumid;
       }
       if(start != '' && typeof(start) != 'undefined'){
           url+= "/start/"+start;
       }
       if(count != '' && typeof(count) != 'undefined'){
           url+= "/count/"+count;
       }
       //alert(url);
       location.href = url;
   }
   
   function selectforum1(type){
       
       var provice = $('#provice').val();
       var city = $('#city').val();
       var county = $('#county').val();
       if(type == 'city'){
           county = ''
       }
       var forumid = $('#forumid').val();
       var start = $('#start').val();
       var count = $('#count').val();    
       //alert("Start:"+start+",forumid:"+forumid+",count:"+count);
       $.ajax({
        url:'/Find/Looking/ExpertsPage',
        data:{'forumid':forumid,'start':start,'provice':provice,'city':city,'county':county},
        type:'post',
        success:function (e){    
            //alert(e);return false;
            if(e != 1){
                var data = eval('('+e+')');
                var str = '';                
                for(var i in data['list']){
                    //alert(data['list'][i]['anwser']);
                    str += "<li><a class=\"specialist_img\" href=\"http://user.nsyh001.com/user/show/Personal/expertid/"+data['list'][i]['user_id']+"\"><img src=\""+data['list'][i]['user_face'].replace('30.jpg','60.jpg')+"\"></a><div class=\"specialist_content\"> <a href=\"http://user.nsyh001.com/user/show/Personal/expertid/"+data['list'][i]['user_id']+"\" class=\"specialist_title_name\">"+data['list'][i]['user_real_name']+"</a>";
                    if(data['list'][i]['anwsercount']['star']*2 != 0){
                        str += "";
                    }
                    str += "<p class=\"specialist_professor\">"+data['list'][i]['expertTitle']+" "+data['list'][i]['life']+"年工作经验</p><div class=\"specialist_text\">"+data['list'][i]['expertDesc']+"</div><div class=\"fleft\"><a href=\"#\" class=\"icon answer\">"+data['list'][i].anwsercount+"解答</a><span class=\"icon icon9 hui1\">感谢</span></div><a href=\"/find/looking/GotoExpert/expert/"+data['list'][i].user_id+"\" class=\"p_an1\">立即咨询（"+data['list'][i].fees+"金豆）</a></div><div class=\"clear\"></div></li>";
                }
                
                $('#question_info').html(str)
                $('.p_pages').html(data['page']);
                pagecss('SearchPage');
            }else{
                $('#question_info').html('无数据')
                $('.p_pages').html('');
            }
        }
       });
   }
   
   
   function consult(){}
   //页码样式
   function pagecss(name){
    var page = $('.p_pages').find('a'); 


    $('.p_pages').find('.current').toggleClass("a-x a_cut"); 
    $('.p_pages').find('.current').toggleClass('current'); 
 
    $('.p_pages').find('.num').toggleClass("a-x"); 
    $('.p_pages').find('.num').toggleClass('num'); 
 
    $('.p_pages').find('.next').toggleClass("p_next"); 
    $('.p_pages').find('.next').toggleClass('next'); 
    
    $('.p_pages').find('.prev').toggleClass("p_prev"); 
    $('.p_pages').find('.prev').toggleClass('prev'); 
}