                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

if(!window.__td){window.__MT=100;window.__ti=0;window.__td=[];window.__td.length=__MT;window.__noTrace=false;}
if(!vp)
{var vp={};}
if(!vp.gallery)
{vp.gallery={};}
vp.gallery.typeAhead=function gallery_typeAhead(){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}};vp.gallery.typeAhead.SEARCH_LOCATION_ALL="All";vp.gallery.typeAhead.SEARCH_LOCATION_GALLERY="Gallery";vp.gallery.typeAhead.SEARCH_LOCATION_STUDIO="Studio";vp.gallery.typeAhead.menus={};vp.gallery.typeAhead.searchLocations={};vp.gallery.typeAhead.cache={};vp.gallery.typeAhead.initTypeAhead=function gallery_typeAhead_initTypeAhead(sTextFieldId,iProductGroupId,sPfId,sSearchLocation,fnOnMenuItemSelect)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!sSearchLocation)
{sSearchLocation=vp.gallery.typeAhead.SEARCH_LOCATION_ALL;}
var oMenu=new vp.widget.AutoSuggestMenu(sTextFieldId);vp.gallery.typeAhead.menus[sTextFieldId]=oMenu;vp.gallery.typeAhead.searchLocations[sTextFieldId]=sSearchLocation;var fnPopulate=function pv_fnPopulate(e)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.gallery.typeAhead.populateMenu(e,sTextFieldId,iProductGroupId,sPfId);};oMenu.ondelaychange.addHandler(fnPopulate);var fnSelect=function pv_fnSelect(e)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
document.getElementById(sTextFieldId).value=e.elementText;fnOnMenuItemSelect();};oMenu.onselectsuggestion.addHandler(fnSelect);oMenu.prefillTextBoxOnKeyActions=true;oMenu.dropDownDelay=50;oMenu.maxHeight=212;oMenu.menuWidth=vp.ui.getRect(document.getElementById(sTextFieldId)).width;oMenu.itemStyle={textAlign:"left",fontSize:"12px",fontWeight:"bold"};oMenu.prefixStyle={fontWeight:"normal"};};vp.gallery.typeAhead.populateMenu=function gallery_typeAhead_populateMenu(e,sTextFieldId,iProductGroupId,sPfId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var sSearchTerm=e.value;var oMenu=vp.gallery.typeAhead.menus[sTextFieldId];if(vp.gallery.typeAhead.cache[sSearchTerm])
{oMenu.setData(vp.gallery.typeAhead.cache[sSearchTerm],sSearchTerm);return;}
var oRequest=new vp.gallery.WebRequest();oRequest.addParameter("request_type",8);if(sPfId)
{oRequest.addParameter("pf_id",sPfId);}
if(typeof(iProductGroupId)!="undefined")
{oRequest.addParameter("pg",iProductGroupId);}
if(iProductGroupId===0)
{oRequest.addParameter("location",vp.gallery.typeAhead.searchLocations[sTextFieldId]);}
oRequest.addParameter("prefix",encodeURI(sSearchTerm));oRequest.enableNoCache=false;var fnSuccessHandler=function pv_fnSuccessHandler(oContent)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oData=oContent.suggestions;vp.gallery.typeAhead.cache[sSearchTerm]=oData;oMenu.setData(oData,sSearchTerm);};var fnErrorHandler=function pv_fnErrorHandler(e)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}};oRequest.callbackFunction=fnSuccessHandler;oRequest.errorHandlerFunction=fnErrorHandler;try
{oRequest.executeAsync();}
catch(e)
{fnErrorHandler(e);}};