/*
    Behaviours for the Publications index page 
*/

Site.Pages.Press_Releases = Class.create
(
    Site.Page,
    {
        initialize: function($super)
        {
            $super();
            
            this.addBlocks("richSelectOnChange");
            //this.addBlocks("sendRequestOnComplete", "richSelectOnChange", "richCheckboxOnClick", "_sortData");
            //this.addObservers("clearAllLocationsOnClick");
            
        },
        
        calendarOnDayChange: function(day)
        {
            //this.setDay(day);
        },
          
        domOnLoad: function($super, event)
        {
            $super(event);            
            
            this.collapsePanelController = new Site.Controllers.CollapsePanel($('criteria'));
         
            //this.listLocations = new Site.Widgets.RichCheckboxList($('list-locations'), { richCheckboxOnClick: this.blocks.richCheckboxOnClick } );

           // addEvent($('clear-all-locations'), "click", this.observers.clearAllLocationsOnClick);
            
            //this.list = $('list-items');
            
            if ($('filter-by-month'))
                this.selectFilterByLocation = new Site.Widgets.RichSelect($('filter-by-month'), { width: 100, optionsWidth: 100, onChange: this.blocks.richSelectOnChange } );
            
            if ($('filter-by-year'))
                this.selectFilterBySales = new Site.Widgets.RichSelect($('filter-by-year'), { width: 100, optionsWidth: 100, onChange: this.blocks.richSelectOnChange } );            

        },
        
        richSelectOnChange: function(select)
        {
            //alert(select.value)
            document.location = select.value;
            
            //this.sendRequest();
        },
    
        windowOnLoad: function($super, event)
        {
            $super(event);
            
        },
        
        clearAllCategoriesOnClick: function(event)
        {
            //this.listCategories.uncheckAll();
            //this.sendRequest();

            Event.stop(event);
        },
        
        clearAllLocationsOnClick: function(event)
        {
            //this.listLocations.uncheckAll();
            //this.sendRequest();

            Event.stop(event);
        },
        
        richCheckboxOnClick: function(element, checked)
        {
            //this.sendRequest();
        },

                
        destroy: function($super)
        {
            this.collapsePanelController.destroy();
            //this.listCategories.destroy();
            //this.listLocations.destroy();
           
            
            //removeEvent($('clear-all-categories'), "click", this.observers.clearAllCategoriesOnClick);
            //removeEvent($('clear-all-locations'), "click", this.observers.clearAllLocationsOnClick);

            $super();
        }
    }
);