/**
 * @author rbarrettsmall
 */

 $('document').ready(function() {
 	
	    $('ul.book-boxes').removeClass('book-boxes').addClass('widget-boxes');
		// Start widget on random item
		// Not working so well now!
		item_count = $('.widget ul.widget-boxes li').size();
	    item_start = 1 + Math.floor( item_count * Math.random() );
		
		$(".widget").addClass('widget-on').jCarouselLite({
        btnNext: ".next",
        btnPrev: ".last",
		circular: 1,
	    visible: 1,
		//start:item_start,
		easing: 'easeOutSine',
		speed:600
	 	});
    $('.last').show();
    $('.next').show();
	var img_re = /(\.[A-z]{3})$/i
	
	$('.last img, .next img').hover(
	function(){
		this.src = this.src.replace(img_re, '-on$1');
	},
	function(){
		this.src = this.src.replace('-on.', '.');
	});
	$('#sub_navigation').append($('.widget'));
	
 });

