LMI.SearchForm=(function(){var options={arrowSrc:LMI.Data.Urls.ddArrow};function createTip(){var d=document.createElement('div'),t=document.createElement('strong');d.className='LMIMessages tip';t.appendChild(document.createTextNode(LMI.Strings.getString('js.dropdown.tip')));d.appendChild(t);t=document.createElement('span');t.appendChild(document.createTextNode(LMI.Strings.getString('js.dropdown.tip.text')));d.appendChild(t);return d;}
function elemExists(id){var d=document.getElementById(id);return d&&d.id===id;}
function createTip(){var d=document.createElement('div'),t=document.createElement('strong');d.className='LMIMessages tip';t.appendChild(document.createTextNode(LMI.Strings.getString('js.dropdown.tip')));d.appendChild(t);t=document.createElement('span');t.appendChild(document.createTextNode(LMI.Strings.getString('js.dropdown.tip.text')));d.appendChild(t);return d;}
function getClearFunc(dd,a,url){return function(evt){var e=evt||window.event;LMI.MinEvents.stopEvent(e);(document.createElement('img')).src=url+";jsessionid="+LMI.Data.state.sessionId+"?"+"noresponse=1";dd.clearSection('recent');};}
function getClearLink(dd,url){var a=document.createElement('a');a.href='#';LMI.MinEvents.addEvent(a,'click',getClearFunc(dd,a,url));a.appendChild(document.createTextNode(LMI.Strings.getString('js.dropdown.clear')));return a;}
function createWhatDropDown(id){var i,what,a,s=LMI.Data.recentSearches;if(elemExists(id)){what=new LMI.DropDown(id,options);what.addSection('suggest',LMI.Strings.getString('js.dropdown.suggestions'));what.addModule(LMI.DropDown.Throttle);what.addModule(LMI.DropDown.Hint);what.addModule(LMI.DropDown.Suggest);a=getClearLink(what,LMI.Data.Urls.removeSearches);what.addSection('recent',LMI.Strings.getString('js.titles.recent'),{hint:a});what.menu.appendChild(createTip());if(s){for(i in s){if(s.hasOwnProperty(i)&&s[i].searchTerms){what.addItem(s[i].searchTerms,'recent');}}}}}
function createWhereDropDown(id){var i,len,where,a,D=LMI.Data,v=D.state.visitorVO,l=D.recentLocations;if(elemExists(id)){where=new LMI.DropDown(id,options);if(id!='dirsWhere'){where.addSection('suggest',LMI.Strings.getString('js.dropdown.suggestions'));where.addModule(LMI.DropDown.Throttle);where.addModule(LMI.DropDown.Hint);where.addModule(LMI.DropDown.Suggest);}
a=getClearLink(where,D.Urls.removeLocations);where.addSection('recent',LMI.Strings.getString('js.titles.recentlocs'),{hint:a});if(l){for(i in l){if(l.hasOwnProperty(i)){where.addItem(l[i].locationValue,'recent');}}}
if(!v.loggedInVisitor){a=document.createElement('p');a.className='signin';a.innerHTML=LMI.Strings.getString('js.dropdown.where.sign.in',D.Urls.signin);where.menu.appendChild(a);}else if(v.savedLocations&&v.savedLocations.length){where.addSection('saved',LMI.Strings.getString('js.titles.saved'));for(i=0,len=v.savedLocations.length;i<len;++i){where.addItem(v.savedLocations[i].locationName,'saved');}}}}
return{createWhatDropDown:createWhatDropDown,createWhereDropDown:createWhereDropDown};})();