var cTitle = ["股票名称","今开盘","昨收盘","现价","最高价","最低价","买一价","卖一价","成交量","成交额"];

function CreateHTTPObject()
{
    var xmlhttp;
    
    try
    {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try
        {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e)
        {
            xmlhttp = false;
        }
    }
    
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
    {
        try
        {
            xmlhttp = new XMLHttpRequest();
        }
        catch (e)
        {
            xmlhttp=false;
        }
    }
    
    if (!xmlhttp && window.createRequest)
    {
        try
        {
            xmlhttp = window.createRequest();
        }
        catch (e)
        {
            xmlhttp = false;
        }
    }
    
    return xmlhttp;
}

function OnReadyStateChng(xmlhttp, a)
{
    if (xmlhttp.readyState == 4)
    {
        if (xmlhttp.status == 200)
        {
            //document.getElementById("GpIDHtml").innerHTML = xmlhttp.responseText;
			document.write(xmlhttp.responseText);
        }
        else
        {
            alert("HTTP 错误，状态码：" + xmlhttp.status);
        }
    }
}

function SubmitMsg(a)
{
    var xmlhttp = CreateHTTPObject();
    if (!xmlhttp)
    {
        return; //无法创建 xmlhttp 对象
    }
    
    //Ajax 提交
    xmlhttp.open("GET", a, true);
    xmlhttp.onreadystatechange = function () { OnReadyStateChng(xmlhttp, a); };
    xmlhttp.send(null);
}

function $() 
{ 
  var Felements = new Array(); 
  for (var i = 0; i < arguments.length; i++) 
  { 
    var Felement = arguments[i]; 
    if (typeof Felement == 'string') 
        Felement = document.getElementById(Felement); 
    if (arguments.length == 1) 
        return Felement; 
    Felements.push(Felement); 
  }
  return Felements; 
}

function ForDight(Dight)  
{  
    Dight  = parseInt(Dight,10);  
    return  Dight;  
}  

/*  
*    FD(Dight,How):数值格式化函数，Dight要  
*    格式化的  数字，How要保留的小数位数。  
*/  
function FD(Dight,How)  
{  
    Dight  =  Math.round  (Dight*Math.pow(10,How))/Math.pow(10,How);  
    return  Dight;  
}  

//多按钮切换
function Show(di,num,divn,activecss,unactivecss)
{
   var obj = document.getElementById(divn+di);
   obj.className = activecss;
   var divobj = document.getElementById(divn+di+'_nr');
   divobj.style.display = 'block';
   
   for(i=0;i<num;i++)
   {
     if(di!=i)
	   {
	     temobj = document.getElementById(divn+i);
		 temobj.className = unactivecss;
		 divobj = document.getElementById(divn+i+'_nr');
		 divobj.style.display = 'none';
	    }
	}
}
		
//填充单支股票数据
function FillSymbolData()
{
	$("tdcodenum").innerHTML=fullcode;
	for (var FillSymbolDataj=0;FillSymbolDataj<=elements.length-1;FillSymbolDataj++)
	{
		$("td"+FillSymbolDataj).innerHTML=elements[FillSymbolDataj];
	}
	for (var FillSymbolDataj=10;FillSymbolDataj<=29;FillSymbolDataj=FillSymbolDataj+2)
	{
		$("td"+FillSymbolDataj).innerHTML=ForDight(elements[FillSymbolDataj]/100);
	}
}