
var pageHandler=undefined;var dropdown=undefined;function paintPage()
{pageHandler=new SearchEventHandler(new PinkCommonCalls(),appNav);pageHandler.run();}
function SearchEventHandler(caller,appNav)
{this.caller=caller;this.appNav=appNav;}
SearchEventHandler.prototype.run=function()
{this.searchWidget=new AdvancedSecuritySearchWorklistSimple(this.caller,new AdvancedSecuritySearchSnapshotDOM(undefined,5),document.getElementById('searchResults'),this);this.isMoreOptionsClosed=true;this.qxHandler=new QXNarrowWorklistSimple(this.caller,new QXNarrowWorklistDOM(undefined,3),document.getElementById('qxSecurities'),this,PAGE_SIZE_SUBLISTING);this.qxHandler.doAll();this.l2Handler=new Level2SecuritiesWorklistSimple(this.caller,new Level2SecuritiesWorklistDOM(undefined,3),document.getElementById('level2Securities'),this,PAGE_SIZE_SUBLISTING);this.l2Handler.doAll();}
SearchEventHandler.prototype.moreOptions_onclick=function(elem)
{if(this.isMoreOptionsClosed)
{document.getElementById('moreSearchOptions').style.display='block';elem.innerHTML='&lt;&lt; Less Options';}
else
{document.getElementById('moreSearchOptions').style.display='none';elem.innerHTML='More Options &gt;&gt;';}
this.isMoreOptionsClosed=!this.isMoreOptionsClosed;}
SearchEventHandler.prototype.allStocks_onclick=function(elem)
{var theForm=elem.form;theForm.onlyOtc.disabled=elem.checked;theForm.onlyOtc.checked=!elem.checked;return this.onlyOtc_onclick(theForm.onlyOtc);}
SearchEventHandler.prototype.onlyOtc_onclick=function(elem)
{var theForm=elem.form;var disable=!elem.checked;theForm.onlyPinkQuote.disabled=disable;theForm.excludeGreyMarket.disabled=disable;if(disable)
{theForm.onlyPinkQuote.checked=false;theForm.excludeGreyMarket.checked=false;}
return true;}
SearchEventHandler.prototype.doSearch=function(theForm)
{var pageError=document.getElementById('pageError');if(undefined!=pageError)
pageError.parentNode.removeChild(pageError);var compSymbol=theForm.symbol.value;if((undefined==compSymbol)||(0==compSymbol.length))
{window.alert('Please supply a '+CAPTION_SYMBOL+' and/or '+CAPTION_COMPANY_NAME+'.');theForm.symbol.focus();return false;}
var filter={};filter.compSymbol=compSymbol;filter.onlyOtc=theForm.onlyOtc.checked;if(theForm.onlyPinkQuote.checked)
filter.venues=[VENUE_PINK_SHEETS_CODE];filter.includeGreyMarket=!theForm.excludeGreyMarket.checked;filter.page=1;filter.pageSize=PAGE_SIZE_WORKLIST;filter.sortOn=FIELD_COMPANY_NAME;this.searchWidget.doFilter(filter);restartPageServices('/qoute/search?compSymbol='+compSymbol);return true;}
SearchEventHandler.prototype.gotoQuote=function(symbol,securityId)
{this.appNav.gotoQuotePage(symbol,securityId);}