// set form action
if(typeof(realDomain) && realDomain)
    $('realstock-query-form').action = 'http://' + realDomain + '/stock/realstock.php';

// initialize query suggestion
queryInit();

var mb_codes = ["000001", "399001", "000300"];
var mb_names = ["上证", "深证", "沪深300"];
var mb_shorts = ["sh", "sz", "sh"];
var mb_swfs = ["Real", "Real", "Real"];

function znzRealStockMod(swfID)
{
    this.swfID = swfID;
    this.running = false;
}

znzRealStockMod.prototype._realURLGet = function()
{
    return rdmDataDomainNameGet();
}

znzRealStockMod.prototype.resetmod = function(stockCode, stockName, stockType){
    this.stockCode = stockCode || '000001';
    this.stockName = stockName || '上证';
    this.stockType = stockType || 'SH';
    this._start();
}

znzRealStockMod.prototype._start = function()
{
    var realSwf = document.getElementById(this.swfID);
    if(!realSwf)
        realSwf = document[this.swfID];
    
    try{
        var infoURL = this._realURLGet();
        realSwf.start(infoURL, this.stockCode, this.stockType, this.stockName, 
        	 ["real"],[], 214, 131, 4, [35, 18, 32, 20], [11, 11, 11, 12], [16,62,-1,118,-1,170],
        	 true, 'http://' + realDomain + '/stock/' + 'realstock.php?code='+ this.stockType+this.stockCode);
        this.running = true;                
    }catch(E)
    {
        this.running = false;
        window.setTimeout(this._start.bind(this), 100);
    }

        
}

var znzReal = null;
znzReal = new znzRealStockMod('znzRealMod');

var mb_changeto = function (cid){
  for (var i = 0; i < 2; i ++){
    if (cid == i){
      $('mb-li'+i).className = "modblock-current";
      if (znzReal&&znzReal._start){
        znzReal.resetmod(mb_codes[i], mb_names[i], mb_shorts[i]);
      }
    }else{
      $('mb-li'+i).className = "modblock-normal";
    }
  }
}

setTimeout(function(){mb_changeto(0)}, 100);



