﻿// JScript 文件

    function searchChang(t)
    {        
        getObj("purchas").style.fontWeight="";
        getObj("suppliers").style.fontWeight="";
        getObj("buyers").style.fontWeight="";
        getObj(t).style.fontWeight="bold";
        
        getObj("searchPur").style.display="none";
        getObj("searchSup").style.display="none";
        getObj("searchBuy").style.display="none";
        
      
        switch(t)
        {
            case "purchas":
                getObj("searchPur").style.display="";
                break;
            case "suppliers":
                getObj("searchSup").style.display="";
                break;
            case "buyers":
                getObj("searchBuy").style.display="";
                break;
        }
    
    }

    
    function search()
    {            
        var val=getObj("txtSearch").value;       

        var path="";
        switch ("bold")
        {
            case getObj("purchas").style.fontWeight:
                
                path= getObj("searchPur").value==""?"Purchase/?k=":"Purchase/?ptid="+getObj("searchPur").value+"&k=";
                break;
            case  getObj("suppliers").style.fontWeight:
                path=getObj("searchSup").value==""?"Suppliers/SuppliersList.aspx?cn=":"Suppliers/SuppliersList.aspx?stid="+getObj("searchSup").value+"&cn=";
                break;
            case  getObj("buyers").style.fontWeight:
                path=getObj("searchBuy").value==""?"Buyers/?k=":"Buyers/?t="+encodeURI(getObj("searchBuy").value)+"&k=";
                break;
        } 
        
        if(val!="请输入您要查询的关键词")
        {
            path=path+encodeURI(val);
        }         
        location.href=root+"/"+path;        
    }
    
    function searchall()
    {        
        var key=getTrim(getObj("txtKey").value);
        if((key!="")&&(key!="请输入关键词"))
        {
            var select=getObj("select").value;   
            switch(select)
            {
                case "pur":
                    location.href=root+"/Purchase/?k="+encodeURI(key);
                    break;
                case "sup":
                    location.href=root+"/Suppliers/SuppliersList.aspx?cn="+encodeURI(key);
                    break;
                case "buy":
                    location.href=root+"/Buyers/?t="+encodeURI(key);
                    break;
            }
        }
        else
        {
            setTipHTML("<br>请输入您要查询的关键词!");            
        }
    }
    function searchForProductKey(key)
    {
        window.location.href="Product/ProductList.aspx?k="+encodeURI(key);
    }