
function AdvancedSecuritySearchWorklistSimple(caller,viewer,body,callback,tradeDecorator)
{this.caller=caller;this.viewer=viewer;this.body=body;this.callback=callback;this.tradeDecorator=tradeDecorator;}
AdvancedSecuritySearchWorklistSimple.prototype=new WorklistSimple('Processing search request');AdvancedSecuritySearchWorklistSimple.prototype.doFilter=function(filter,body)
{this.run({filter:filter},body);}
AdvancedSecuritySearchWorklistSimple.prototype.makeCall=function(filter,dataHandler)
{this.caller.getAdvancedSecuritySearchWorklist(filter,dataHandler);}
AdvancedSecuritySearchWorklistSimple.prototype.gotoQuote=function(ev)
{var record=this.myRecord;this.myCallback.callback.gotoQuote(record.symbol,record.securityId);return false;}
AdvancedSecuritySearchWorklistSimple.prototype.populateFilter=function(criteria){var dataHandler=new AjaxDataHandler(this,criteria);dataHandler.handleRequestData=this.doPageInfo;this.caller.getAdvancedSecuritySearchPO(criteria.onlyOtc,dataHandler);}
AdvancedSecuritySearchWorklistSimple.prototype.removeGreyMarketVenue=function(listItem){var index;for(var i=0;i<listItem.totalRecords;i++){if(listItem.ids[i]=='GM'){index=i;break;}}
listItem.ids.splice(index,1);listItem.values.splice(index,1);return listItem;}
AdvancedSecuritySearchWorklistSimple.prototype.doPageInfo=function(value){var criteria=this.criteria;var elem,me=this.callback,filter=criteria.filter;elem=criteria.myVenueList;elem.options[0]=new Option('Select Venue','');if(criteria.noGreyMarketVenue)
value.venueOptions=me.removeGreyMarketVenue(value.venueOptions);SelectListDOM.populate(elem.options,value.venueOptions);elem.onchange=function(ev){me.onVenueChange(criteria,this);};if(filter.venues)
elem.value=filter.venues[0];elem=criteria.myTypeList;elem.options[0]=new Option('Select Type','');SelectListDOM.populate(elem.options,value.typeOptions);elem.onchange=function(ev){me.onTypeChange(criteria,this);};if(filter.type)
elem.value=filter.type;elem=criteria.myCountryList;elem.options[0]=new Option('Select Country','');SelectListDOM.populate(elem.options,value.countryOptions);elem.onchange=function(ev){me.onCountryChange(criteria,this);};if(filter.countryId)
elem.value=filter.countryId;}
AdvancedSecuritySearchWorklistSimple.prototype.doTradeInfoDecorator=function(table){var criteria={tagName:'tr'};this.tradeDecorator.run(criteria,table);}
AdvancedSecuritySearchWorklistSimple.prototype.onVenueChange=function(criteria,elem)
{criteria.filter.venues=[elem.value];this.run(criteria);}
AdvancedSecuritySearchWorklistSimple.prototype.onTierChange=function(criteria,elem)
{criteria.filter.tierId=[elem.value];this.run(criteria);}
AdvancedSecuritySearchWorklistSimple.prototype.onCountryChange=function(criteria,elem)
{criteria.filter.countryId=elem.value;criteria.filter.includeGreyMarket=(criteria.myVenueList.value=='')?true:undefined;this.run(criteria);}
AdvancedSecuritySearchWorklistSimple.prototype.onTypeChange=function(criteria,elem)
{criteria.filter.type=elem.value;criteria.filter.includeGreyMarket=(criteria.myVenueList.value=='')?true:undefined;this.run(criteria);}
AdvancedSecuritySearchWorklistSimple.prototype.doExport=function(criteria)
{window.open('/common/ViewSecurities.xls?'+this.caller.createPostMapData(criteria.filter));}