(function($){

	$(document).ready(function(){
    	
        // table
    	$('.wysiwyg table')
    		.not('.reset')
    		.wrap('<div class="table-wrap"></div>')
    		.find('tbody tr:odd')
    			.addClass('even')
    			.end()
    		.find('tr>:first-child')
    			.addClass('table-cell-first')
    			.end()
    		.find('tr>:last-child')
    			.addClass('table-cell-last')
    			.end();
    			
    	$('.wysiwyg hr')
    		.wrap('<div class="separator"></div>')
    		.hide();

		$('.side-menu ul').each(function(){
			var row = $(this).is('.third') ? 3 : $(this).is('.half') ? 2 : 0;
			if(row && $(this).children().length % row > 0){
				var li = '<li class="empty"></li>'
				for(var i = 0, l = row - $(this).children().length % row; i<l; i++){
					$(this).append(li);
				}
			}
		});
		
		// Carousel init
		$('.collection-box ul').each(function(i){
			var carousel = new fb.widgets.Carousel(this, {
				visible: 3,
				animation: 350
			});
			carousel.init();
			$(this).data('carousel', carousel)	
		});
    });

})(this.jQuery);



