
﻿var jqok=false;var flok=false;(function($){$.fn.extend({atlasTicker:function(options){var defaults={symbols:"EURUSD,GBPUSD,USDCHF,USDJPY,AUDUSD,USDCAD,NZDUSD,EURCHF,EURGBP,EURJPY,GBPJPY,GBPCHF",directionUpSymbolClass:"dirup",directionDownSymbolClass:"dirdown"};this.options=$.extend(defaults,options);this.hash=new Object();this.dataTable({"bPaginate":false,"bLengthChange":false,"bFilter":false,"bSort":false,"bInfo":false,"bAutoWidth":false,"oLanguage":{"sZeroRecords":"The symbols are currenlty loading..."}});tickerTables.push(this);this.Quote=function(symbol,bid,ask,direction,strLastUpdate,high,low){if(this.options.symbols.search(symbol.toUpperCase())!=-1){var row=[symbol,bid,ask];if(this.hash[symbol]||this.hash[symbol]==0){this.fnUpdate(row,this.hash[symbol],0);}
else{var i=this.fnAddData(row);this.hash[symbol]=i[0];}
var therow=this.find('tr:eq('+(this.hash[symbol]+1)+')');therow.removeClass(this.options.directionDownSymbolClass);therow.removeClass(this.options.directionUpSymbolClass);if(direction=='U')
therow.addClass(this.options.directionUpSymbolClass);else
therow.addClass(this.options.directionDownSymbolClass);$.each(therow.children('td'),function(i){$(this).addClass('tickercell_'+i);});}}
jqok=true;if(flok)
InitTickers();return this;}});})(jQuery);var tickerTables=new Array();function OnConnected(){}
function OnDisconnected(){ConnectTicker();}
function OnError(msg,desc){}
function OnQuote(symbol,bid,ask,direction,strLastUpdate,high,low){$.each(tickerTables,function(){this.Quote(symbol,bid,ask,direction,strLastUpdate,high,low);});}
function ConnectTicker(){var tickerConn=document.Ticker||window.Ticker;tickerConn.Connect();}
function SubscribeTicker(symbols){var tickerConn=document.Ticker||window.Ticker;tickerConn.Subscribe(symbols);}
function InitTickers(){var symbols='';if(tickerTables.length>0){if(tickerTables.length==1){symbols=tickerTables[0].options.symbols;}
else{symbolsArr=new Array();$.each(tickerTables,function(i){$.merge(symbolsArr,$.each(tickerTables.options.symbols.split(','),function(){$.trim(this);}));});$.each(symbolsArr,function(i){if(i!=0)
symbols+=",";symbols+=this;});}
SubscribeTicker(symbols);ConnectTicker();}}
function OnInit(){flok=true;if(jqok)
InitTickers();}
