/* marketCharts.js */
//Assign event handlers to tab buttons
function initTabs(){
for (var x=0; x < 6; x++){
var btnObj = document.getElementById("btn" + x);
btnObj.onclick = changeTimeFrame;
}
}
//Function sets the select controls in the hidden DIV to initial values.
function initSelectCtrls() {
// initial indices can be overridden by client js
var initialIndices = (typeof gMarketSummaryInitialIndices == "object")?gMarketSummaryInitialIndices:new Array("", "US&DJI", "US;COMP", "US;VIX");
var i, j, indexSelector;
for(i=1; i<=3; i++) {
indexSelector = document.getElementById("index" + i + "Selector");
for(j=0; j';
}
else {
document.getElementById("index" + boxNum + "Chart").innerHTML = 'Chart not available';
}
if(quoteStatus) {
document.getElementById("index" + boxNum + "Quote").innerHTML = quoteStr;
document.getElementById("index" + boxNum + "Timestamp").innerHTML = timestamp;
}
else {
document.getElementById("index" + boxNum + "Quote").innerHTML = "Quote not available "; //Non-breaking space to maintain height
}
//Update real-time/delayed array and if all three indices have updated, update text. Note that responses do not necessarily come back in order requested so can't do it when boxNum is 3.
indexRealtime[boxNum - 1] = realtime;
if(indexRealtime[0] != -1 && indexRealtime[1] != -1 && indexRealtime[2] != -1)
updateChartsTxt();
}
//Function to update real-time/delayed quote text on successful call to marketChartsTxtBuffer.asp
function updateChartsTxt() {
var txt = "*Quotes delayed by at least 15 minutes; all other quotes real-time.";
if(indexRealtime[0] && indexRealtime[1] && indexRealtime[2])
txt = "Real-time quotes";
else if(! indexRealtime[0] && ! indexRealtime[1] && ! indexRealtime[2])
txt = "*Quotes delayed by at least 15 minutes";
document.getElementById("delayed").innerHTML = txt;
}
//Function called on content buffer failure
function defaultTxt() {
document.getElementById("delayed").innerHTML = "*Quotes delayed by at least 15 minutes; all other quotes real-time.";
}
//When window loads, intialize tab buttons, select controls and load index details
addEvent(window, "load", initTabs);
addEvent(window, "load", initSelectCtrls);