﻿function buildProfList(sender)
{
    var oProf=document.getElementById("profDict");
    var oLang = sender;
    var oProfName,pProfCode;
    if(oProf==null || oLang==null) return;
    if(oLang.selectedIndex == -1) return;
    
    var oSelLan=oLang.options[oLang.selectedIndex].text;
    if(oSelLan.indexOf("英汉")>=0)
    {// 英汉通用和专业库名称：
        oProfName=["通用","企管","体育","交通","传感","食品","餐饮","通信","光纤","军事","农业","冶金","化工","医学","商贸","地质","工程","广告","广播","建筑","教育","新闻",	"旅游","机械","机电","水利","汽车","法律","环境",	"电信","电力","石油","社科","程控","纺织","编缉","美术","能源","航空","船舶","计算机","金融"];
        pProfCode=["TYK","QiG","TiY","JiT","CuG","SiP","CaY","ToX","GuX","JuS","NoY","YiJ","HuG","YiX","SaM","DiZ","GoC","GuG","GuB","JiZ","JiY","XiW","LuY","JiX","JiD","SuL","QiC","FaL","HuJ","DiX","DiL","SiY","SeK","CeK","FaZ","BiJ","MeS","NeY","HAK","CaB","JSJ","JiR"];
    }else if(oSelLan.indexOf("汉英")>=0)
    {//汉英通用和专业库名称：
        oProfName=["通用","法律","机械","交通","金融","审计","税收"];
        pProfCode=["TYK","FaL","JiX","JiT","JiR","SeJ","SuS"];
     }else if(oSelLan.indexOf("汉俄")>=0)
     {//汉俄通用和专业库名称：
	    oProfName=["通用","商贸","船舶"];
	    pProfCode=["TYK","HaK","CuB","Sam"];
    }else{
        oProfName=["通用"];
        pProfCode=["TYK"];
    }
    var selectCount = oProf.options.length-1;
    for(i=selectCount;i>=0;i--)
    {
       var oOpt=oProf.options[i];
       oOpt.removeNode(true);
     }  
    //alert(selectCount);
    for(i=0;i<oProfName.length;i++)
    {
        var oOption = document.createElement("Option");
        oProf.options.add(oOption);
        oOption.text = oProfName[i];
        oOption.value = pProfCode[i];  
        //oOption.setAttribute("style","color:red;");
     }     
}

function dictFind_Click(id) {
    var oUrl=$(id);
    var oProf=$("profDict");
    var oSelProf;
    if(oProf)
    {
        oSelProf=oProf.options[oProf.selectedIndex].value;
    }else    return;
    var oSrc=$("textFind").value;
    if(StringIsNull(oSrc))
    {
        alert("请输入查询词!");
        return;
    }
    
    var oSvr=oUrl.value.replace("{0}",escape(oSrc));
    oSvr=oSvr.replace("{1}",oSelProf);
    $("dictTrans").contentWindow.location=oSvr;
}

