/* * Imperitrade Financial Stock Quote Ticker, version 1.5 * (c) 1998-2019 Imperial Network, Todd Schlomer /*--------------------------------------------------------------------------*/ var pe_IMTF_QUOTE_bf25a5e3 = 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_bf25a5e3'); stockQuoteDiv.innerHTML = "
15 Most Active Stocks
ICMF557.78+18.13
VEX190.40+2.08
VEBND94.29+1.88
IACF2,199.21+1.09
STORMB169.24+0.54
IMPX376.86+0.37
CNET50.07+0.33
AIIF619.74-0.28
ECBND64.69-0.52
ICS197.81-0.77
IVE308.11-0.84
VPA1,457.09-0.90
NAVALB79.79-1.30
IMC139.70-1.56
STCX166.97-3.84
"; 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_bf25a5e3"; 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_bf25a5e3'); 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_bf25a5e3 != null) { pe_IMTF_QUOTE_bf25a5e3.stop(); } } /* Load the stock quotes once the javascript finishes loading */ loadScript("https://quotes.imperitrade.com/scripts/prototype.js", function() { pe_IMTF_QUOTE_bf25a5e3 = new PeriodicalExecuter(updateStockQuotes, 20); });