
function AdvancedSecuritySearchFilterDOM()
{this.inputField=new InputField();}
AdvancedSecuritySearchFilterDOM.prototype.URL_OTC_MARKET_TIERS='/pink/otcguide/investors_market_tiers.jsp';AdvancedSecuritySearchFilterDOM.prototype.generate=function(value,callback)
{var me=this,output=document.createElement('form');output.onsubmit=function(ev){callback.handleSubmit(value,this);return false;};var a,v,selectList=new SelectListDOM();var table,tr,td,elem,last;var row=0;output.className='widgetPackage';table=document.createElement('table');table.className='detail';tr=table.insertRow(row++);this.createCaptionCell(tr,CAPTION_SYMBOL);elem=this.createTextBox('symbol',10,10);this.createElementCell(tr,elem);last=tr.insertCell(2);last.style.verticalAlign='top';last.style.paddingTop='10px';tr=table.insertRow(row++);this.createCaptionCell(tr,CAPTION_COMPANY_NAME);elem=this.createTextBox('companyName',20,20);elem.autocomplete='off';this.createElementCell(tr,elem);tr=table.insertRow(row++);this.createCaptionCell(tr,CAPTION_SIC_CODE);elem=this.createTextBox('sicCode',10,10);elem.autocomplete='off';this.createElementCell(tr,elem);tr=table.insertRow(row++);this.createCaptionCell(tr,'Security Locale');this.createElementCell(tr,selectList.generate('localeId',value.localeOptions,'All Locales'));tr=table.insertRow(row++);td=this.createCaptionCell(tr,'OTC Market Tier');elem=document.createElement('a');elem.href=this.URL_OTC_MARKET_TIERS;elem.appendChild(document.createTextNode('What is this?'));td.appendChild(document.createElement('br'));td.appendChild(document.createElement('br'));td.appendChild(elem);td.appendChild(document.createElement('br'));td.appendChild(document.createElement('br'));td.appendChild(elem=document.createElement('a'));elem.href='javascript:void(null)';elem.innerHTML='Select All';elem.myChecked=false;elem.onclick=function(ev){me.handleSelectAll(output,this);return false;};td=this.createElementCell(tr);td.appendChild(elem=this.createCheckBox('tierId',1,false));td.appendChild(document.createTextNode(' OTCQX'));td.appendChild(document.createElement('br'));v=[];a=value.tierOptions;for(var i=0;i<a.ids.length;i++)
{if(10>a.ids[i])
{v[v.length]=a.ids[i];continue;}
td.appendChild(this.createCheckBox('tierId',a.ids[i],false));td.appendChild(document.createTextNode(' '+a.values[i]));td.appendChild(document.createElement('br'));}
elem.myValues=v;tr=table.insertRow(row++);this.createCaptionCell(tr,'Only ADRs');this.createElementCell(tr,this.createCheckBox('onlyAdr','1',false));tr=table.insertRow(row++);this.createCaptionCell(tr,'Only Banks & Trusts');this.createElementCell(tr,this.createCheckBox('onlyBanksAndTrusts','1',false));tr=table.insertRow(row++);this.createCaptionCell(tr,'Only '+CAPTION_CAVEAT_EMPTOR);this.createElementCell(tr,this.createCheckBox('onlyCaveatEmptor','1',false));tr=table.insertRow(row++);cell=this.createCaptionCell(tr,'Only Yellow Sheets');cell.appendChild(document.createElement('br'));cell.appendChild(elem=document.createElement('span'));elem.className='footnote';elem.innerHTML='(bonds)';this.createElementCell(tr,this.createCheckBox('yellowSheets','1',false));tr=table.insertRow(row++);tr.insertCell(0);td=tr.insertCell(1);td.className='detailValue';td.appendChild(this.inputField.genSubmit('submit','Find Securities'));last.rowSpan=table.rows.length;last.appendChild(this.inputField.genButton('download','Download All OTC Securities Data',function(ev){callback.handleDownloadAll(value,this.form);}));output.appendChild(table);return output;}
AdvancedSecuritySearchFilterDOM.prototype.createCaptionCell=function(tr,caption)
{var td=tr.insertCell(0);td.className='detailCaption';td.style.width='1%';td.style.whiteSpace='nowrap';td.innerHTML=caption;return td;}
AdvancedSecuritySearchFilterDOM.prototype.createElementCell=function(tr,elem)
{var td=tr.insertCell(1);td.className='detailValue';if(undefined!=elem)
td.appendChild(elem);return td;}
AdvancedSecuritySearchFilterDOM.prototype.createTextBox=function(name,maxLength,size)
{var output=this.inputField.genTextBox(name,maxLength,size);output.autocomplete='off';return output;}
AdvancedSecuritySearchFilterDOM.prototype.createCheckBox=function(name,value,isChecked)
{return this.inputField.genCheckBox(name,value,isChecked);}
AdvancedSecuritySearchFilterDOM.prototype.handleSelectAll=function(form,elem)
{var checked=!elem.myChecked;var elems=form.tierId;for(var i=0;i<elems.length;i++)
elems[i].checked=checked;elem.myChecked=checked;elem.innerHTML=checked?'Deselect All':'Select All';}