/*-------------------------------------
boardBlock.js
    @Copyright compass.cn P.R.China, All rights resevered
    @Description
        show boardBlock list
    @History
        2008/07/23 by liang huang create
---------------------------------------*/
var tiltes = ["首页 > 板块监测 > 指数板块",
              "首页 > 板块监测 > 地域板块",
              "首页 > 板块监测 > 概念板块",
              "首页 > 板块监测 > 行业板块 > 指南针行业板块",
              "首页 > 板块监测 > 行业板块 > 300行业板块",
              "首页 > 板块监测 > 行业板块 > 深市行业板块"];
              
var boardInstance = ['index', 'region', 'concept', 'industry', 'industry300', 'industry399'];
var boardName = ['指数板块', '地域板块', '概念板块', '指南针行业板块', '300行业板块', '深市行业板块'];
var boardNameStart = ['SHHQ', '3', '2', '1', 'SHHQ0009', 'SZHQ399'];
var boardstockInterval = 30000;
var znzDS = null;
var znzIdx = null;
var znzLast = null;
var ppboardId = -1;
var ts;

//行情网板块页所调用
function start()
{
    ppboardName = "";
    znzIdx = new znzIdxSummary('stock-index-all', 10 * 1000, idxsumry_data);
    //查询框初始化
    queryInit();
    scrollDiv('stock-index-all', 3*1000, 3, 22);
    if (up) up = true;
    var indexNum = boardInstance.indexOf(boardNo);
    if(indexNum == -1)
        indexNum = 3;
    ts = new cateBoards("stockblock-body", boardInstance[indexNum],  boardstockInterval, "sortData", preBoardData, 0, boardName[indexNum], up);
    boardInstance[indexNum] = ts;
    ts.start();
}

function changeBoard(idx)
{
    ts.running = false;
    if (boardInstance[idx])
    {
        if (boardInstance[idx].showTable)
        {
            ts = boardInstance[idx];
            $("stockblock-body").innerHTML = "加载中...";
            ts.running = true;
            ts.showTable();
        }
        else
        {
            ts = new cateBoards("stockblock-body", boardInstance[idx],  boardstockInterval, "sortData", null, 0, boardName[idx], false);
            ts.running = true;
            ts.start();
            $("stockblock-body").innerHTML = "加载中...";
            boardInstance[idx] = ts;
        }    
    }
    resetTab(idx);
}

function resetTab(idx, hideTab){
    $('title').innerHTML = tiltes[idx];
}

function sortData(colNum, colId)
{
    if (ts && ts.sort)
    {
        ts.startid = 0;
        ts.sort(colNum);
        ts.showTable();
    }
}

window.onload = start;

