var dull = {
        log : function(){},
        error: function(){}
    };
var out = typeof(console) == 'undefined' ? dull : console;

var MonthFilter = function()
{
    var self = this;
    this.grains = [];
    
    this.rice_Grains = function(evt)
    {
        var grains = $('.month-spectrum input:checked');
        grains = $(grains).map(function(i,o){return $(o).attr('name');});
        self.grains = grains;
        self.filter_Rice_Grains();
    }
    
    this.filter_Rice_Grains = function()
    {
        $('#news-block').addClass('hidden');
        $('.news-archive').each(self.topic_toggle);
        $('#news-block').removeClass('hidden');
    }
    
    this.topic_toggle = function(index, topic_block)
    {
        //out.log(self.grains);
        //out.log($.inArray($(topic_block).attr('title'), self.grains));
        if(self.grains.length == 0)
        {
            $(topic_block).show();
                return -1;
        }
        $.inArray($(topic_block).attr('title'), self.grains) == -1 ? $(topic_block).hide() : $(topic_block).show();//$(topic_block).addClass('hidden') : $(topic_block).removeClass('hidden');       
    }
    
    this._new = function()
    {   
        $('.month-spectrum').bind('click', self.rice_Grains)
    }
    
    
    
    

    self._new();
}


   new MonthFilter();



/* Html struct Backup. 
    <div class="cell-wrapper clearfix"> <!-- cell-wrapper -->
            	<div class="month-spectrum"> <!-- month-spectrum -->
                	<ul class="clearfix">
                    	<li class="january"><input type="checkbox" name="january" id="" value="" /><a href="#" title="Январь" class="deep-blue">Январь</a></li>
                        <li><input type="checkbox" name="february" id="" value="" /><a href="#" title="Февраль" class="blue">Февраль</a></li>
                        <li><input type="checkbox" name="march" id="" value="" /><a href="#" title="Март" class="sky-blue">Март</a></li>
                        <li><input type="checkbox" name="april" id="" value="" /><a href="#" title="Апрель" class="motton-blue">Апрель</a></li>
                        <li><input type="checkbox" name="may" id="" value="" /><a href="#" title="Май" class="green">Май</a></li>
                        <li><input type="checkbox" name="june" id="" value="" /><a href="#" title="Июнь" class="light-green">Июнь</a></li>
                        <li><input type="checkbox" name="july" id="" value="" /><a href="#" title="Июль" class="lettuce-green">Июль</a></li>
                        <li><input type="checkbox" name="august" id="" value="" /><a href="#" title="Август" class="yellow">Август</a></li>
                        <li><input type="checkbox" name="september" id="" value="" /><a href="#" title="Сентябрь" class="orange">Сентябрь</a></li>
                        <li><input type="checkbox" name="octomber" id="" value="" /><a href="#" title="Октябрь" class="red">Октябрь</a></li>
                        <li><input type="checkbox" name="november" id="" value="" /><a href="#" title="Ноябрь" class="bordeaux">Ноябрь</a></li>
                        <li><input type="checkbox" name="december" id="" value="" /><a href="#" title="Декабрь" class="dark-green-grey">Декабрь</a></li>
                    </ul>
                </div> <!-- // month-spectrum -->
            </div> <!-- // cell-wrapper -->
*/
