var xmlhttp,alerted,url,refreshtime

//var date = new Date();
//var timestamp = date.getTime();
var ref=1;
var link='';

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
  try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  } catch (E) {
   alert("You must have Microsofts XML parsers available")
  }
 }
@else
 alert("You must have JScript version 5 or above.")
 xmlhttp=false
 alerted=true
@end @*/
if (!xmlhttp && !alerted) {
 // Non ECMAScript Ed. 3 will error here (IE<5 ok), nothing I can 
 // realistically do about it, blame the w3c or ECMA for not
 // having a working versioning capability in  <SCRIPT> or
 // ECMAScript.
 try {
  xmlhttp = new XMLHttpRequest();
 } catch (e) {
  alert("You need a browser which supports an XMLHttpRequest Object.\nMozilla build 0.9.5 has this Object and IE5 and above, others may do, I don't know, any info jim@jibbering.com")
 }
}

function RSchange() {
 if (xmlhttp.readyState==4) {
	var indexresult = xmlhttp.responseText.split("\;");
if(indexresult.length<10)
{
	return
}
if(link=='')
{
var idarray=['hsiindex','hsichange','hsipercent','turnover','hsceiindex','hsceichange','hsceipercent','fhsiindex','fhsichange','fhsicomp','fhsceiindex','fhsceichange','fhsceicomp','fnikkeiindex','fnikkeichange','fnikkeicomp','nikkeiindex','nikkeichange','nikkeipercent','sheungindex','sheungchange','sheungpercent','samindex','samchange','sampercent','wuindex','wuchange','wupercent','minidowindex','minidowchange','minidowpercent','japus','ausjap','nzdus','adrratio','adrindex','adrchange','adrpercent','dowindex','dowchange','dowpercent','nasaqindex','nasaqchange','nasaqpercent','spindex','spchange','sppercent','ftseindex','ftsechange','ftsepercent','daxindex','daxchange','daxpercent','taiwanindex','taiwanchange','taiwanpercent','singindex','singchange','singpercent','bangindex','bangchange','bangpercent','philipindex','philipchange','philippercent','indoindex','indochange','indopercent','malyindex','malychange','malypercent','time','chhkd','spfindex','spfchange','spfpercent','usgold','dxyind','dxyindchange','dxyindpercent']
}
else if(link=='&act=adr')
{
	var idarray=['hsbagbp','hsbahkd','hsbachange','hsbahklast','hsbahkchange','hsbapoint','hsbaratio','hsbaupdate','hbcusd','hbchkd','hbcchange','hbchklast','hbchkchange','hbcpoint','hbcratio','hbcupdate','chlusd','chlhkd','chlchange','chlhklast','chlhkchange','chlpoint','chlratio','chlupdate','ceousd','ceohkd','ceochange','ceohklast','ceohkchange','ceopoint','ceoratio','ceoupdate','snpusd','snphkd','snpchange','snphklast','snphkchange','snppoint','snpratio','snpupdate','chuusd','chuhkd','chuchange','chuhklast','chuhkchange','chupoint','churatio','chuupdate','lfcusd','lfchkd','lfcchange','lfchklast','lfchkchange','lfcpoint','lfcratio','lfcupdate','ptrusd','ptrhkd','ptrchange','ptrhklast','ptrhkchange','ptrpoint','ptrratio','ptrupdate','adrpoint','adrtotal','chausd','chahkd','chachange','chahklast','chahkchange','chaupdate','yzcusd','yzchkd','yzcchange','yzchklast','yzchkchange','yzcupdate','achusd','achhkd','achchange','achhklast','achhkchange','achupdate','hnpusd','hnphkd','hnpchange','hnphklast','hnphkchange','hnpupdate','snpusd2','snphkd2','snpchange2','snphklast2','snphkchange2','snpupdate2','shiusd','shihkd','shichange','shihklast','shihkchange','shiupdate','gshusd','gshhkd','gshchange','gshhklast','gshhkchange','gshupdate']
}
else
{
	var idarray=['code0','code0name','code0last','code0buysell','code0change','code0highlow','code0volume','code1','code1name','code1last','code1buysell','code1change','code1highlow','code1volume','code2','code2name','code2last','code2buysell','code2change','code2highlow','code2volume','code3','code3name','code3last','code3buysell','code3change','code3highlow','code3volume','code4','code4name','code4last','code4buysell','code4change','code4highlow','code4volume','code5','code5name','code5last','code5buysell','code5change','code5highlow','code5volume','code6','code6name','code6last','code6buysell','code6change','code6highlow','code6volume','code7','code7name','code7last','code7buysell','code7change','code7highlow','code7volume','code8','code8name','code8last','code8buysell','code8change','code8highlow','code8volume','code9','code9name','code9last','code9buysell','code9change','code9highlow','code9volume']
document.getElementById('loadimg').innerHTML='';
}
for (var x = 0; x < idarray.length; x++)
   {
	if(idarray[x]=='code0' || idarray[x]=='code1' || idarray[x]=='code2' || idarray[x]=='code3' || idarray[x]=='code4' || idarray[x]=='code5' || idarray[x]=='code6' || idarray[x]=='code7' || idarray[x]=='code8' || idarray[x]=='code9')
	{
		document.getElementById(idarray[x]).value=indexresult[x];
	}
	else
	{
	   document.getElementById(idarray[x]).innerHTML = indexresult[x];
	}
   }
//document.write(x+'test2')
//document.write(idarray.length+'test')
  //alert(xmlhttp.responseText);
 }
}
function go(url) {
var date = new Date();
var timestamp = date.getTime();
if (xmlhttp) { 
  d=document
	if(url=='realdata/combine.php' && link!='&act=combine')
	{
		document.getElementById('loadimg').innerHTML='<img src="i_animated_loading_32_2.gif" height="20"></img>';
	}
  xmlhttp.open("GET", url+"?time="+timestamp+link,true);
  xmlhttp.onreadystatechange=RSchange
  xmlhttp.send(null)
 }
}
function start(url, refreshtime)
{
	if(ref)
	{
		go(url, link)
	}
    window.setTimeout("start('"+url+"', '"+refreshtime+"')", refreshtime)
}
