﻿var typenum=0;

function fundnumbytype(type)
{
    var tt=0;
    var filterfundinfo2 = new Array();
    var temparray2 = fundinfos.split("_");
    if(type==1)   //全部 2,3,4,1
    {
        for(var i=0; i<temparray2.length; i++)
        {
            var tempstr = temparray2[i].toString();
            var returntype = FilterType(tempstr.substr(0,tempstr.indexOf("|")),1);
            if(returntype=="1" || returntype=="2" ||returntype=="3"||returntype=="4"||returntype=="5")
            {
                filterfundinfo2[tt] = temparray2[i].split("|");
                tt++;
            }
        }
    }
    if(type==2)   //股票
    {
        for(var i=0; i<temparray2.length; i++)
        {
            var tempstr = temparray2[i].toString();
            var returntype = FilterType(tempstr.substr(0,tempstr.indexOf("|")),2);
            if(returntype=="1" || returntype=="2" ||returntype=="3"||returntype=="4")
            {
                filterfundinfo2[tt] = temparray2[i].split("|");
                tt++;
            }
        }
    }
    if(type==3)  //混合
    {
        for(var i=0; i<temparray2.length; i++)
        {
            var tempstr = temparray2[i].toString();
            var returntype = FilterType(tempstr.substr(0,tempstr.indexOf("|")),2);
            if(returntype=="5" || returntype=="6" ||returntype=="7")
            {
                filterfundinfo2[tt] = temparray2[i].split("|");
                tt++;
            }
        }
    }
    if(type==4)  //债券
    {
        for(var i=0; i<temparray2.length; i++)
        {
            var tempstr = temparray2[i].toString();
            var returntype = FilterType(tempstr.substr(0,tempstr.indexOf("|")),2);
            if(returntype=="8" || returntype=="9")
            {
                filterfundinfo2[tt] = temparray2[i].split("|");
                tt++;
            }
        }
    }
    if(type==5)  //QDII
    {
        for(var i=0; i<temparray2.length; i++)
        {
            var tempstr = temparray2[i].toString();
            var returntype = FilterType(tempstr.substr(0,tempstr.indexOf("|")),3);
            if(returntype=="2")
            {
                filterfundinfo2[tt] = temparray2[i].split("|");
                tt++;
            }
        }
    }
    if(type==6)  //保本
    {
        for(var i=0; i<temparray2.length; i++)
        {
            var tempstr = temparray2[i].toString();
            var returntype = FilterType(tempstr.substr(0,tempstr.indexOf("|")),4);
            if(returntype=="4")
            {
                filterfundinfo2[tt] = temparray2[i].split("|");
                tt++;
            }
        }
    }
     if(type==7)  //指数
    {
        for(var i=0; i<temparray2.length; i++)
        {
            var tempstr = temparray2[i].toString();
            var returntype = FilterType(tempstr.substr(0,tempstr.indexOf("|")),2);
            if(returntype=="4")
            {
                filterfundinfo2[tt] = temparray2[i].split("|");
                tt++;
            }
        }
    }
     if(type==8)  //ETF
    {
        for(var i=0; i<temparray2.length; i++)
        {
            var tempstr = temparray2[i].toString();
            var returntype = FilterType(tempstr.substr(0,tempstr.indexOf("|")),1);
            if(returntype=="2")
            {
                filterfundinfo2[tt] = temparray2[i].split("|");
                tt++;
            }
        }
    }
     if(type==9)  //LOF
    {
        for(var i=0; i<temparray2.length; i++)
        {
            var tempstr = temparray2[i].toString();
            var returntype = FilterType(tempstr.substr(0,tempstr.indexOf("|")),1);
            if(returntype=="3")
            {
                filterfundinfo2[tt] = temparray2[i].split("|");
                tt++;
            }
        }
    }
    typenum = filterfundinfo2.length;
    info2 = filterfundinfo2;
    return typenum;
}
