/*
* Imperitrade Financial Stock Quote Ticker, version 1.5
* (c) 1998-2024 Imperial Network, Todd Schlomer
/*--------------------------------------------------------------------------*/
var pe_IMTF_QUOTE_b07e66a7 = null;
var _IMTF_LOAD_JS = false;
if (typeof _IMTF_STOCK_JS_LOADED == "undefined") {
_IMTF_STOCK_JS_LOADED = true;
_IMTF_LOAD_JS = true;
}
if (_IMTF_LOAD_JS) {
var scriptTags = document.getElementsByTagName('script');
for (var i = 0; i < scriptTags.length; i++) {
if ((scriptTags[i].src != null) && scriptTags[i].src.match('prototype.js')) {
_IMTF_LOAD_JS = false;
scriptTags[i].id = "_IMTF_PrototypeJS";
break;
}
}
}
/* Display the section that will contain the stock quotes */
var stockQuoteDiv = document.createElement('div');
stockQuoteDiv.setAttribute('id', 'IMTF_QUOTE_b07e66a7');
stockQuoteDiv.innerHTML = "
";
var scripts = document.getElementsByTagName('script');
for (var i = 0; i < scripts.length; i++) {
var scriptSrcStr = String(scripts[i].src);
if ((scriptSrcStr.indexOf('quotes.imperitrade.com') > 0)
&& (scriptSrcStr.indexOf('.js') < 0)
&& (scripts[i].id == "")) {
scripts[i].parentNode.insertBefore(stockQuoteDiv, scripts[i]);
scripts[i].id = "_IMTF_IMTF_QUOTE_b07e66a7";
break;
}
}
/* Function to load scripts dynamically and call a function once its completed */
function loadScript(src, callback) {
var script = null;
if (_IMTF_LOAD_JS) {
script = document.createElement("script");
if (script.addEventListener) {
script.addEventListener("load", callback, false);
} else if (script.attachEvent) {
script.attachEvent("onreadystatechange",
function() { loadScript.callbackIE(callback); }
);
}
script.type = 'text/javascript';
script.src = src;
script.id = "_IMTF_PrototypeJS";
document.getElementsByTagName("head")[0].appendChild(script);
} else {
try {
script = $('_IMTF_PrototypeJS');
} catch (err) {
}
if (script == null) {
setTimeout(loadScript(src, callback), 50);
}
callback();
}
}
loadScript.callbackIE = function(callback) {
var target = window.event.srcElement;
if (target.readyState == "loaded")
callback.call(target);
};
/* Function to generate a random number */
function generateRandom() { return parseInt(Math.random() * 99999999); }
/* Function to update the stock quotes */
function updateStockQuotes() {
new Ajax.Request('/proxy.php?url=' + encodeURIComponent('https://quotes.imperitrade.com/dsp_quote.cfm'), {
method: 'get', parameters: {
cnt: 15,
header: '1',
volume: '0',
width: '100%',
symbols: '',
type: 'stock',
tableHeader: '0',
ajaxMember: 1,
rand: generateRandom()
}, onSuccess: function(transport) {
var stockTicker = $('IMTF_QUOTE_b07e66a7');
if (transport.responseText.match('Imperitrade Stock Ticker 1.5')) {
stockTicker.update(transport.responseText);
} else {
stopStockQuotes();
}
}, onFailure: function(transport) {
stopStockQuotes();
}, onException: function(transport) {
stopStockQuotes();
}
});
}
function stopStockQuotes() {
if (pe_IMTF_QUOTE_b07e66a7 != null) {
pe_IMTF_QUOTE_b07e66a7.stop();
}
}
/* Load the stock quotes once the javascript finishes loading */
loadScript("https://quotes.imperitrade.com/scripts/prototype.js", function() {
pe_IMTF_QUOTE_b07e66a7 = new PeriodicalExecuter(updateStockQuotes, 20);
});