window.addEvent('domready', function(){
  var searchInput = $('tx_siggwheretobuy_pi1[zipsearch]');
  
  if (searchInput) {
  
    var completer = new Autocompleter.Ajax.Json(searchInput, 'index.php?eID=tx_siggwheretobuy_zipsearch', {
        'inheritWidth': false,
  		  'fixedWidth': 200,
        'postVar': 'tx_siggwheretobuy_pi1[zipsearch]',
        'postData': {
                      'tx_siggwheretobuy_pi1[country]': window.document.searchform.elements['tx_siggwheretobuy_pi1[country]'].value,
                      'tx_siggwheretobuy_pi1[region]': window.document.searchform.elements['tx_siggwheretobuy_pi1[region]'].value
                    },
        'onRequest': function(el) {
          searchInput.addClass('autocompleter-loading');
        },
        'onComplete': function(el) {
          searchInput.removeClass('autocompleter-loading');
        },
        'onFailure': function(el) {
            alert('onFailure');
        },
        'onSelect': function(el) {
            searchRetailerByZIP();
        }
    });
  
  }
  
});
