
function RTTradeStatsSnapshotDOM(hasPaging)
{this.hasPaging=(undefined==hasPaging)?false:hasPaging;}
RTTradeStatsSnapshotDOM.prototype.CAPTIONS=['Price','Pct Chg','$ Volume','Share Volume','# Trades'];RTTradeStatsSnapshotDOM.prototype.generate=function(value,callback)
{value.latest=undefined;var output=document.createElement('div');output.className='widgetPackage';var records=value.records;if((undefined==records)||(0==records.length))
{var elem=document.createElement('div');elem.className='tabNoData';elem.appendChild(document.createTextNode('No data found.'));output.appendChild(elem);return output;}
var criteria=value.criteria;var itemCaption=(value.bySymbol)?CAPTION_SYMBOL:CAPTION_MARKET_MAKER;var latest=records[0];var container=document.createElement('div');container.className='listingContainer';output.appendChild(container);var table=document.createElement('table');table.className='listing';table.cellSpacing=0;var cellIndex=0;var row=table.insertRow(0);row.className='listingHeader';this.createHeaderCell(row,cellIndex++,itemCaption);if(criteria.showQuoted)
this.toRight(this.createHeaderCell(row,cellIndex++,CAPTION_UPDATES));if(value.bySymbol)
{this.toRight(this.createHeaderCell(row,cellIndex++,this.CAPTIONS[0]));this.toRight(this.createHeaderCell(row,cellIndex++,this.CAPTIONS[1]));}
this.toRight(this.createHeaderCell(row,cellIndex++,this.CAPTIONS[2]));this.toRight(this.createHeaderCell(row,cellIndex++,this.CAPTIONS[3]));this.toRight(this.createHeaderCell(row,cellIndex++,this.CAPTIONS[4]));for(var i=0;i<records.length;i++)
{cellIndex=0;row=table.insertRow(i+1);row.className=alternateCssParentListingClasses(i)+((value.bySymbol)?'':' topMMRealTime');var record=records[i];if(record.calcTime.getTime()>latest.calcTime.getTime())
latest=record;var td=row.insertCell(cellIndex++);td.className=row.className;if(callback.gotoQuote)
{var a=document.createElement('a');a.href='javascript:void(null);';a.appendChild(document.createTextNode(record.item));a.onclick=callback.gotoQuote;a.myRecord=record;a.myCallback=callback;td.appendChild(a);}
else
td.appendChild(document.createTextNode(record.itemDesc));if(criteria.showQuoted)
this.toRight(this.createDetailCell(row,cellIndex++,this.toDisplayable(Formatter.toNumber(record.numOfQuotes))));if(value.bySymbol)
{if(0==record.price)
{this.toRight(this.createDetailCell(row,cellIndex++,CAPTION_NA));this.toRight(this.createDetailCell(row,cellIndex++,CAPTION_NA));}
else
{var isPositive=(0<record.pricePct);var color=isPositive?COLOR_POSITIVE:COLOR_NEGATIVE;var sign=isPositive?'+':'';this.toRight(this.createDetailCell(row,cellIndex++,Formatter.toPrice(record.price)));this.enhancePriceCell(this.createDetailCell(row,cellIndex++,sign+Formatter.toPercent(record.pricePct)),color);}}
this.toRight(this.createDetailCell(row,cellIndex++,Formatter.toVolume(record.dollarVolume)));this.toRight(this.createDetailCell(row,cellIndex++,Formatter.toVolume(record.volume)));this.toRight(this.createDetailCell(row,cellIndex++,this.toDisplayable(Formatter.toNumber(record.numOfTrades))));}
container.appendChild(table);value.latest=latest;if(undefined!=value.footnotes)
{output.appendChild(document.createElement('hr'));var footnote=document.createElement('div');footnote.className='footnote';for(var i=0;i<value.footnotes.length;i++)
{if(0<i)
footnote.appendChild(document.createElement('br'));var sup=document.createElement('sup');sup.appendChild(document.createTextNode((i+1)));footnote.appendChild(sup);footnote.appendChild(document.createTextNode(value.footnotes[i]));}
output.appendChild(footnote);}
if(this.hasPaging&&(PAGE_SIZE_WORKLIST<=criteria.pageSize))
output.appendChild((new PagingLinksDOM()).generate(value,callback));return output;}
RTTradeStatsSnapshotDOM.prototype.toDisplayable=function(value)
{if(undefined==value)
return CAPTION_NA;return value;}
RTTradeStatsSnapshotDOM.prototype.createHeaderCell=function(row,index,caption)
{var output=row.insertCell(index);output.className='listingHeader';output.style.whiteSpace='nowrap';output.appendChild(document.createTextNode(caption));return output;}
RTTradeStatsSnapshotDOM.prototype.createDetailCell=function(row,index,value)
{var output=row.insertCell(index);output.className=row.className;output.innerHTML=value;return output;}
RTTradeStatsSnapshotDOM.prototype.toRight=function(elem)
{elem.style.textAlign='right';return elem;}
RTTradeStatsSnapshotDOM.prototype.enhancePriceCell=function(cell,color)
{this.toRight(cell).style.color=color;}