
var iconExpand=new Image();iconExpand.src=commonImagesPath+ICON_EXPAND;var iconCollapse=new Image();iconCollapse.src=commonImagesPath+ICON_COLLAPSE;var pageHandler;function paintPage()
{pageHandler=new SecuritySearch(document.getElementById('pageTabContent'));pageHandler.run();}
function SecuritySearch(body)
{this.body=body;var commonCaller=new PinkCommonCalls();this.commonNav=new PinkCommonAppNav();this.otciqCaller=new OtcIQCalls();this.filter=undefined;this.filterWidget=new AdvancedSecuritySearchFilterSimple(commonCaller,new AdvancedSecuritySearchFilterDOM(),undefined,this);var decorator=new DecorateTradeInfo(this.otciqCaller,undefined);this.searchWidget=new AdvancedSecuritySearchWorklistSimple(commonCaller,new AdvancedSecuritySearchWorklistDOM(),undefined,this,decorator);this.tabberOptions={'ids':undefined,'defaultTab':0,'titles':[CAPTION_SEARCH,'Results'],'calls':['doFilterPage','doSearch'],'onClick':function(args){restartPageServices('/companySearch/'+this.calls[args.index]);if(!args.tab.isEmpty)
return true;try{this.callback[this.calls[args.index]](args.tab.body);}
catch(error){window.alert(error);return false;}
args.tab.isEmpty=false;return true;},'onLoad':function(args){this.onClick(args);}}
this.tabberOptions.callback=this;this.tabber=new Tabbers(this.tabberOptions);this.inputter=new InputField();}
SecuritySearch.prototype.TAB_SEARCH=0;SecuritySearch.prototype.TAB_RESULTS=1;SecuritySearch.prototype.run=function()
{this.tabber.run(this.body);this.tabber.hideTab(this.TAB_RESULTS);}
SecuritySearch.prototype.doFilterPage=function(body)
{this.filterWidget.doPage(body);}
SecuritySearch.prototype.doSearch=function(body)
{if(undefined==this.filter)
{body.innerHTML='Please use the '+CAPTION_SEARCH+' tab to perform the search first.';return;}
body.innerHTML='';var me=this;var a,b=document.createElement('div');body.appendChild(b);b.style.textAlign='right';b.appendChild(a=this.inputter.genButton('downloadAll','Download All OTC Securities Data',function(ev){me.commonNav.openOtcSecurities();}));body.appendChild(b=document.createElement('div'));b.style.paddingTop='10px';this.searchWidget.doFilter(this.filter,b);}
SecuritySearch.prototype.doAdvancedSecuritySearch=function(filter)
{filter.sortOn=FIELD_COMPANY_NAME;filter.sortDir=FIELD_ASCENDING;this.filter=filter;this.tabber.markEmpty(this.TAB_RESULTS);this.tabber.doTab(this.TAB_RESULTS);this.tabber.showTab(this.TAB_RESULTS);}
SecuritySearch.prototype.gotoQuote=function(symbol,securityId)
{appNav.gotoQuotePage(symbol,securityId);}