
var iconExpand=new Image();iconExpand.src=commonImagesPath+ICON_EXPAND;var iconCollapse=new Image();iconCollapse.src=commonImagesPath+ICON_COLLAPSE;var pageHandler;function paintPage()
{pageHandler=new RTTradeStatsPageHandler();pageHandler.init(document.getElementById('pageTabContent'),document.getElementById('pageTitle'));}
function RTTradeStatsPageHandler()
{this.latestTradeStat=new Object();}
RTTradeStatsPageHandler.prototype.ACTIONS=['doTradingStats','doMarketMakerStats'];RTTradeStatsPageHandler.prototype.CAPTIONS=['Current OTC Market Activity','Current Market Maker Data'];RTTradeStatsPageHandler.prototype.init=function(body,titleBody)
{var actionId=window.isMarketMakerMode?1:0;this.hasInitFull=false;this.hasInitMM=false;this.titleBody=titleBody;this.titleBody.innerHTML=':: '+this.CAPTIONS[actionId];var me=this;var iqCaller=new OtcIQCalls();this.fullBody=document.createElement('div');this.fullBody.className='widgetPackage';body.appendChild(this.fullBody);this.mmBody=document.createElement('div');this.mmBody.className='widgetPackage';body.appendChild(this.mmBody);var startAction=this.ACTIONS[actionId];var anchorList=new AnchorList();var anchorCriteria=new AnchorListCriteria({ids:me.ACTIONS,values:me.CAPTIONS},startAction,this,undefined,' | ');anchorList.run(anchorCriteria,document.getElementById('pageNav'));this.handler=new RTTradeStatsDashboardManager(iqCaller,this,PAGE_SIZE_SUBLISTING,APPLICATION_ID_PINKSHEETS,new PinkContentCalls());this[startAction](window.dashboardStartTab);}
RTTradeStatsPageHandler.prototype.handlePostLoad=function(value)
{var elem=document.getElementById('realTimeTimestamp');var tierGroupId=(undefined==value.criteria.tierGroupId)?'all':value.criteria.tierGroupId;var latestTradeStat=this.latestTradeStat[tierGroupId];if((undefined!=value.latest)&&((undefined==latestTradeStat)||(value.latest.calcTime.getTime()>latestTradeStat.calcTime.getTime())))
{elem.innerHTML=Formatter.toTimestamp(value.latest.calcTime);this.latestTradeStat[tierGroupId]=value.latest;}}
RTTradeStatsPageHandler.prototype.handleTabbed=function(value)
{restartPageServices('/marketactivity/realtime/'+this.currentSection+'/'+value);}
RTTradeStatsPageHandler.prototype.handleAnchorSelect=function(id,caption,criteria)
{this[id]();this.titleBody.innerHTML=':: '+caption;}
RTTradeStatsPageHandler.prototype.doTradingStats=function(startTab)
{this.currentSection='tradingStats';this.fullBody.style.display='block';this.mmBody.style.display='none';if(!this.hasInitFull)
{this.handler.initFull(this.fullBody,startTab);this.hasInitFull=true;}
restartPageServices('/marketactivity/realtime/'+this.currentSection);}
RTTradeStatsPageHandler.prototype.doMarketMakerStats=function(startTab)
{this.currentSection='marketMakerStats';this.fullBody.style.display='none';this.mmBody.style.display='block';if(!this.hasInitMM)
{this.handler.initMM(this.mmBody,startTab);this.hasInitMM=true;}
restartPageServices('/marketactivity/realtime/'+this.currentSection);}
RTTradeStatsPageHandler.prototype.gotoQuote=function(symbol,securityId)
{appNav.gotoQuotePage(symbol,securityId);}