$.headJS('/js/popup-filter-list.js');

$(function(){
  new PopupFilter({
    id        : 'filter-region',
    url       : '/json.geo.list/',
    depth     : 1,
    columns   : 3,
    name      : 'region',
    activator : '#filter .fContent .region',
    onload    : function(PopupFilter)
    {
      geoSuggestPrepare(PopupFilter, $('#filter-region'), $('#filter .fContent .region'), '/projects/filter/region/');
    },
    popup     : {
      title     : 'Регион',
      width     : 550,
      height    : 225,
      overflow  : 'auto'
    }
  });
  var subject_url = '/json.tender.subjects/';
  var height = 0;
  var depth = 0;
  if (location.href.search(/\/tenders\/commercial\//i) == -1) {
    subject_url+= '?budget=1';
    height = 300;
  } else {
    subject_url+= '?budget=0';
    height = 150;
  }
  new PopupFilter({
    id        : 'filter-subject',
    url       : subject_url,
    depth     : 1,
    columns   : 2,
    volatile  : 0.2,
    name      : 'subject',
    activator : '#filter .fContent .subject',
    popup     : {
      title     : 'Рубрика',
      width     : 600,
      height    : height,
      overflow  : 'auto'
    }
  });
  new PopupFilter({
    id        : 'filter-type',
    url       : '/json.tender.types/',
    depth     : 1,
    columns   : 2,
    name      : 'type',
    activator : '#filter .fContent .type',
    popup     : {
      title     : 'Способ размещения',
      width     : 300,
      height    : 100,
      overflow  : 'auto'
    }
  });
})
