
$(document).ready(function(){
    

	triggerDocumentReady_FooterBasket();
	
})


//this document ready trigger is Footer Basket specific
function triggerDocumentReady_FooterBasket () {

    $('#mini-cart-detail').fadeOut(1);
    
    
    // Change 'click' to what ever triggers the tooltip to appear
//    $('#mini-cart-summary span').click(function(){
//        $(this).parent().find('.tooltip').fadeIn();
//        return false
//    });
    $('.tool-close').click(function(){
        $(this).parent().fadeOut();
        return false;
    });
    
    
    // View basket
    $('#view-basket').click(function(){
        $('#mini-cart').animate({
            height: 170
        }, 500, function(){
            $('#mini-cart-detail').fadeIn();
        });
        $('#mini-cart-inner .big-btn').toggleClass('hidden');
        return false;
    });
    $('#hide-basket').click(function(){
        $('#mini-cart-detail').fadeOut(500, function(){
            $('#mini-cart').animate({
                height: 54
            }, 500);
            $('#mini-cart-inner .big-btn').toggleClass('hidden');
        })
        return false;
    });
    
    
    // Carousel - see http://www.gmarwaha.com/jquery/jcarousellite/#doc for options
    $("#carousel").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        visible: 9,
        speed: 750,
        easing: 'swing',
        circular: false
    });
    
        // Hide carousel nav if there are less than 10 items
        $cartItems = $("#carousel ul li").length;
        if($cartItems < 10){
            $("#caro-nav").hide();
        }else{
            $("#caro-nav").show();
        }
        
//        // Show 'item' if there is only one - we do this in the jsp instead
//        $itemCount = $('#itemCount').html();
//        if($itemCount == 1){
//            $summaryHtml = $('#mini-cart-summary-span').html();
//            $summaryHtml = $summaryHtml.replace('Items', 'Item');
//            $('#mini-cart-summary-span').html($summaryHtml);
//        }
    
}
