$().ready(function(){

    var featureShow = $('#feature .feature').slideshow({
        delay: 6000
    });
    
    $('.ctrl-paginator').colorPaginator();
    
    
    $('.ctrl-slideshow').each(function(){
        var $this = $(this);
        var c = $this.children();
        var $overlay = $('<div class="overlay"><a class="prev" href="#">◄ Prev</a> / <a class="next" href="#">Next ►</a></div>');
        $this.parent().append($overlay).hover(function(){$overlay.fadeIn()}, function(){$overlay.fadeOut()});
        var s = c.slideshow({
        	duration: 400
        });
        $overlay.find('a').click(function(){
            if(this.className == 'next')
                s.stop().next();
            else
                s.stop().prev();
            
            return false;
        });
    });
    
    $('#next-feature').click(function(){
        featureShow.stop().next();
        return false;
    });
    
    $('#prev-feature').click(function(){
        featureShow.stop().prev();
        return false;
    });
    
   // init front page filter
    $('.post').each(function(){
        var $this = $(this);
        var $c = $this.children('h3');
        if($c.length) {
            var d = $c.attr('class').split(' ')
            if(d.length > 0) {
                Color.filter.add($this.closest('li').get(0), d);
            }
        }
    });

    
});

