function get_xml(id,url)
{
//	var dpbar=document.getElementById(id);	
	var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
	xmldoc.async=true;
	xmldoc.onreadystatechange = function()
	{
		if(xmldoc.readyState == 4)
		{
			handlexml(id,xmldoc);			
		}
	}
	xmldoc.load(url);
/*
	var root = xmldoc.documentElement;
	if(root != null){
		var c=root.childNodes;
		var str=c[0].text;
		if(str.length > 10)
			dpbar.innerHTML = str;
	}
*/
}
function handlexml(id,xmldoc)
{
	var dpbar=document.getElementById(id);
	var root = xmldoc.documentElement;
	if(root != null)
	{
		var c=root.childNodes;
		var str=c[0].text;
		if(str.length > 10)
			dpbar.innerHTML = str;
	}												
}

function showrtable()
{
	//var ti=new Date();
	var stockid=document.getElementById("stkcode").value;
	var src="http://99.1.101.87/hqrt/rt_"+stockid+".html";
	get_xml("rtable",src);
	//setTimeout("showrtable('"+cc+"','"+m+"')",20000)
}


	var g_element = window.document.all;
	function OpenSub (name)
	{
		if (g_element[name].style.display == "none")
		{
			g_element[name].style.display = "";
			g_element[name+"_img"].src = "../../images/t_minus.gif";
		}
		else
		{
			g_element[name].style.display = "none";
			g_element[name+"_img"].src = "../../images/t_add.gif";
		}
	}
//Open  New Window
	function popupwin(url,l,t,w,h)
	{
		open(url,'','menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes,width='+w+',height='+h+',top='+l+',left='+t);
	}
	
	function popupOpen(url,l,t,w,h)
	{
		open(url,'','menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,width='+w+',height='+h+',top='+l+',left='+t);
	}
//
	function openCont(URL)
	{
 		open(URL,'','menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes,width=640,height=400,top=100,left=40');
	}
	
//获取焦点
	function GetFocus()
	{
	  document.getElementById("TextBox1").focus();
	}
   // 个股查询输入股票代码错误提示
function errorAlert_Stock()
 { 
       var curStockIdName=document.getElementById("stockIDTextBox").value  
      if (curStockIdName=="")
      { 
         alert("请输入股票代码!") 
         document.getElementById("stockIDTextBox").focus() 
         window.event.returnValue = false; 
         return
      }
      else
      {
      if ((curStockIdName.length!=6)&(!isNaN(curStockIdName)))
         {
         alert("股票代码有误，请重新输入!") 
         document.getElementById("stockIDTextBox").focus() 
         window.event.returnValue = false; 
         return
         }
       }
    } 
	  // 基金代码为空提示
function Alert_Empty_Fund()
 { 
      var curFundId=document.getElementById("fundIDText").value  
      if (curFundId=="")
      { 
         alert("请输入基金代码!") 
         document.getElementById("fundIDText").focus() 
         window.event.returnValue = false; 
         return
      }
      else
      {
      if ((curFundId.length!=6)&(!isNaN(curFundId)))
         {
         alert("基金代码有误，请重新输入!") 
         document.getElementById("fundIDText").focus() ;
         window.event.returnValue = false; 
         return
         }
       }
    } 
    // 债券代码为空提示
function Alert_Empty_Bond()
 { 
      var curBondId=document.getElementById("bondIDTextBox").value  
      if (curBondId=="")
      { 
         alert("请输入债券代码!") 
         document.getElementById("bondIDTextBox").focus() 
         window.event.returnValue = false; 
         return
      }
      else
      {
      if ((curBondId.length<6)||(curBondId.length>7))
         {
         alert("债券代码有误，请重新输入!") 
         document.getElementById("bondIDTextBox").focus() ;
         window.event.returnValue = false; 
         return
         }
       }
  } 
  function webSearch()
	{
		
		var keyword=document.getElementById("searchStr").value;
		if (document.getElementById("searchStr").value == "")
			document.getElementById("searchStr").value="请输入关键字"
		else
			open('http://218.17.246.170/cgi-bin/wstsearch?tn=wst&ch_id=0&query='+keyword,'cmbwebsearch','');
}
//singlestockquery
	 function SingleStockQuery()
	{
		
		var keyword=document.getElementById("stockIDTextBox").value;
		if (document.getElementById("stockIDTextBox").value == "")
			document.getElementById("stockIDTextBox").value="请输入股票代码"
		else
			open('http://info.cmbchina.com/cmb2005stock/investaspxbin/stock/SingleStkHQ.aspx?channel=SSHQ&&stockid='+keyword,'SingleStockQuery','');
	}
	//singlesFundquery
	 function SingleFundQuery()
	{
		
		var keyword=document.getElementById("fundIDTextBox").value;
		if (document.getElementById("fundIDTextBox").value == "")
			document.getElementById("fundIDTextBox").value="请输入基金代码"
		else
			open('http://fund.cmbchina.com/CmbFund/FundAspxBin/OpenFund/SingleOpenFundInfo.aspx?lm=JJZL&&fundid='+keyword,'SingleFundQuery','');
	}
	//singleBondquery
	 function SingleBondQuery()
	{
		
		var keyword=document.getElementById("bondIDTextBox").value;
		if (document.getElementById("bondIDTextBox").value == "")
			document.getElementById("bondIDTextBox").value="请输入债券代码"
		else
			open('http://info.cmbchina.com/cmb2005stock/investaspxbin/bond/BondSwitch.aspx?bondid='+keyword,'SingleBondQuery','');
	}
	
	
	function cmbcal(url,w,h)
		{
 			open(url,'cmbcalculator','menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=yes,width='+w+',height='+h+',top=50,left=130');
		}
		
		function scrollAdv(url,param)
		{
 			open(url,'cmbscrolladv',param);
		}
		
		function noticeOpen(url,title,param)
		{
 			open(url,title,param);
		}
		
function leaveMessage()
{
	open('http://www.cmbchina.com/cmb2005web/cmbaspxbin/common/cmbcustomer.aspx','cmbjibao','menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=yes,width=634,height=450,top=100,left=40');
}

function popprintwin(url)
	{
		open(url,'','menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes,width=620,height=500,top=40,left=40');
	}