﻿// JScript 文件
window.IncludeFile={"header":"head.html","tailer":"tail.html"};
window.JsModule=["system/jqframe.js"];
function WebMain()
{ 
    $.SetFormat("zh","zjft","<li><a href=\"news.html?{'id':#0#}\" target=\"_blank\">#1#</a></li>","","");
    $.SetFormat("zh","zjwyh","<div class='zjnames'><div class='zjphoto'><a href=\"zj_xx.html?{'id':'#0#'}\" target=\"_blank\" style=\"background:none;height:94px;\"><img style=\"width:78px;height:94px;\" src='#1#' alt='专家照片' /></a></div><div class='zjxx'><p id='name' class='zjname'>姓名：#3#</p><p id='specialist' class='zjzc'>职称：#4#</p><p id='specialist' style=\"overflow:hidden;height:25px;line-height:25px;\">专业：#5#</p></div></div>","","");
    $.SetFormat("zh","askonline","<li><a style='width:430px;' href=\"specialdetail.html?{'id':#0#}\"><p style='float:left;width:320px;'>#1#</p><p style='float:left;width:50px;margin-left:15px;'>#2#</p><p style='float:left;width:30px;margin-left:10px;'>#3#</p></a></li>","","");
    $.SetFormat("zh","answer","<li><a style='width:430px;' href=\"#\">#1#</a></li>","","");
    $.SetFormat("zh","zj_blog","<li><a style='width:250px;' href=\"blog/article.php?type=#2#&itemid=#0#\" target=\"_blank\">#1#</a></li>","","");
    
    /*专家访谈*/$("#zjft").SendMessage({bLoading:false,type:"DBSelect",id:"zjft",pm :"<@ehai_detail%16Id%16Id,Title%16%16%16CreateTime desc%160%16MenuId=17 and IsCheck=1 and IsShow=1@>%16",format:"zjft",start:0,total:5});    
    /*专家委员会*/$("#zjwyh").SendMessage({bLoading:false,type:"DBSelect",id:"zjwyh",pm :"<@ehai_user%16Id%16Id,Photo,UserName,eName,TechPost,Major%16%16%16orderflag desc%160%16RoleType=3@>%16",format:"zjwyh",start:0,total:8});
    /*在线咨询问题*/$("#askonline").SendMessage({bLoading:false,type:"DBSelect",id:"askonline",pm :"<@ehai_askonline%16Id%16Id,QuestionContent,DATE_FORMAT(AskTime,'%m-%d'),Counts%16%16%16AskTime desc%160%16IsCheck=1@>%16",format:"askonline",start:0,total:8});  
    /*问题解答*/$("#answer").SendMessage({bLoading:false,type:"DBSelect",id:"answer",pm :"<@ehai_askonline%16Id%16Id,AnswerContent%16%16%16AskTime desc%160%16IsShow=1@>%16",format:"answer",start:0,total:6});  
    /*专家委员会详细*/$.SendMessage({bLoading:false,callback:zjwyhnews,type:"DBSelect",id:"zjwyhnews",pm :"<@ehai_user%16Id%16Id,Photo,UserName,eName,Sex,BirthY,BirthM,Position,Achievement,Major%16%16%16altertime desc%160%16RoleType=3 and IsRecommand=1@>%16",start:0,total:1});    
    $.SendMessage({bLoading:false,type:"DBSelect",pm :"<@ehai_typetable%16id%16LENGTH(Class)/2,eName%16%16%16Class asc%160%16Sort=6%16@>",callback:getwttypetree},true);
    ///*专家博客*/$("#zj_blog").SendMessage({bLoading:false,type:"DBSelect",id:"zj_blog",pm :"<@bg_items%16itemid%16itemid,subject,type%16%16%16postdate desc%160%16ifcheck='1' and ifhide='0'%16@>",format:"zj_blog",start:0,total:6});    

}
function zxbutton(id)
{
    window.location="specialist_zx.html?{'id':"+id+"}";
}
function zjblog()
{
    window.location="home/";
}
function zjwyhnews(re)
{ 
    $("#zj_photo").html("<a style='background:none;width:102px;height:122px;' href=\"zj_xx.html?{'id':'"+re[0][0]+"'}\"><img style=\"display:block;width:100px;height:120px;border:1px #D9D9D9 solid;\" src=\""+re[0][1]+"\" alt=\"专家照片\" /></a>");
    $("#zjxxname").html("<a style='background:none;' href=\"zj_xx.html?{'id':'"+re[0][0]+"'}\">"+"<b>专家姓名：</b><b>"+re[0][3]+"</b></a>");
    $("#tjzz").html("推荐专家："+re[0][3]);
    $("#zjxxzy").html("<b>专&nbsp;&nbsp;&nbsp;&nbsp;业：</b>"+re[0][9]);
    $("#zyyj").html("<b>主要业绩：</b>"+htmlreplacezj(re[0][8]));
    $("#askquestion").html("<a href=\"specialist_zx.html?{'id':'"+re[0][0]+"'}\" style=\"background:none;\"><input type=\"button\" value=\"我要咨询\" /></a>");
    
}
//专家委员会问题搜索
function gettypesort()
{
    var key=$("#wtkey").val();
    var type=$("#wttype").val();
    if(type=="")
    {
        window.location="special_online.html?{'wttj':'"+key+"','lbtj':'"+type+"'}";
    }else if(type!="")
    {
     $.SendMessage({bLoading:false,type:"DBSelect",pm :"<@ehai_typetable%16id%16Class%16%16%16%160%16Sort=6 and eName='@>"+type+"'%16",callback:getwttype},true);
    }
};
function getwttype(re)
{
    if(re&&re[0])
    {
        window.location="special_online.html?{'wttj':'"+$("#wtkey").val()+"','lbtj':'"+re[0][0]+"'}";
    }else{
        window.location="special_online.html?{'wttj':'"+$("#wtkey").val()+"'}";
    }
};
//问题类别显示
function getwttypetree(re)
{
    var h=classify(re,"<li><a href=\"#\">","</a>","</li>","<ul>","</ul></li>");
    $("input#wttype").popup("<ul class=\"treeview-popup\">"+h+"</ul>");
    $(".treeview-popup").treeview({	         
    persist: "location",
    cookieId: "treeview-popup"
    });
    $(".popupPanel").bgiframe();
};
function classify(re,fl,fr,sr,cs,ce)
{
    var html="";
    for(var i=0;i<re.length;i++)
    {
        html+=fl+re[i][1]+fr;
        if(re[i+1]&&re[i+1][0]>re[i][0])
            html+=cs;
        else if(re[i+1]&&re[i+1][0]==re[i][0])
            html+=sr;
        if(re[i][0]!=1)
        {
           if(re[i+1]&&re[i+1][0]<re[i][0])
                html+=sr+ce;
        }
    }
    return html;
};
function htmlreplacezj(text)
{
    if ( !text ) return '' ;
	var Summary = HTMLDecode(text);
	Summary = Summary.replace(/<\/?[^>]*>/g,''); //去除HTML tag
	Summary = Summary.replace(/[ | ]*\n/g,'\n'); //去除行尾空白
	Summary = Summary.replace(/\s/ig,""); 
    Summary = Summary.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
	Summary = Summary.replace(/<(.*?)>/g,''); //去除<>
    Summary = Summary.replace(/&nbsp;/g,''); //去除&nbsp;
    Summary=Summary.substring(0,130) + "...";
	return Summary ;
};
