
function TradeStatsWorklistDOM(paging)
{this.paging=(undefined==paging)?false:paging;}
TradeStatsWorklistDOM.prototype=new WorklistDOM();TradeStatsWorklistDOM.prototype.CAPTIONS=['Price','Pct Chg','$ Volume','Share Volume','# Trades'];TradeStatsWorklistDOM.prototype.generate=function(value,callback)
{var output=document.createElement('div');output.className='widgetPackage listingContainer';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 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++,'Symbol');if(criteria.sortOn=='updateCount')
this.toRight(this.createHeaderCell(row,cellIndex++,'Updates'));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);var record=records[i];var td=row.insertCell(cellIndex++);td.className=row.className;var a=document.createElement('a');a.href='javascript:void(null);';a.appendChild(document.createTextNode(record.symbol));a.onclick=callback.gotoQuote;a.myRecord=record;a.myCallback=callback;td.appendChild(a);if(criteria.sortOn=='updateCount')
this.toRight(this.createDetailCell(row,cellIndex++,Formatter.toVolume(record.updateCount)));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.toPercentX(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.toVolume(record.tradeCount))));}
output.appendChild(table);if(this.paging||(PAGE_SIZE_SUBLISTING<value.pageSize))
output.appendChild((new PagingLinksDOM()).generate(value,callback));if(undefined==value.footnotes)
return output;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);return output;}
TradeStatsWorklistDOM.prototype.toDisplayable=function(value)
{if(undefined==value)
return CAPTION_NA;return value;}
TradeStatsWorklistDOM.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;}
TradeStatsWorklistDOM.prototype.createDetailCell=function(row,index,value)
{var output=row.insertCell(index);output.className=row.className;output.innerHTML=value;return output;}
TradeStatsWorklistDOM.prototype.toRight=function(elem)
{elem.style.textAlign='right';return elem;}
TradeStatsWorklistDOM.prototype.enhancePriceCell=function(cell,color)
{this.toRight(cell).style.color=color;}