 	// go through titles to make sure that any very long ones are handled as such.
	$(".featuredTitle").each(function(that){
			//console.log($(this)[that]);
		}
	);

	$(document).ready( function() {
		
		$('#topCarouselWrapper')[0].innerHTML = $('#topCarouselWrapperData')[0].innerHTML;		
		$('#topCarouselWrapperData')[0].innerHTML = '';
		
		//set up our two carousels
		$("#featuredLarge").jCarouselLite({
				btnPrev: "#featuredNext",
				btnNext: "#featuredPrev",
				btnDoubleNext: "#featuredPrev2",
				circular: "true",
				visible:1,
				scroll:1,
				easing: "expoinout",
				speed: 500
		});
 
		$("#featuredSmall").jCarouselLite({
				btnPrev: "#featuredNext",
				btnNext: "#featuredPrev",
				circular: "true",
				btnDoubleNext: "#featuredPrev2",
				visible:2,
				scroll:1,
				easing: "expoinout",
				speed: 500,
				onBuild : setupFeaturedClicks,
				afterEnd : setupFeaturedClicks
			});

		//once the carousel is built, take off the overflow hiding which is required for safari to render the rest of the page properly
		$('#topCarouselWrapper > div').css({
			'overflow':'visible',
			'top':'0'
			}
		);
		
		// now make sure the blurb is truncated if needed
		truncateCopyToParent('#featuredLarge ul li .featuredItemCopy .featuredItemBlurb', 48, 35);

		/////////////////////////////
		// FUNCTIONS
		/////////////////////////////
		
		
		function setupFeaturedClicks(a) {
			// clear any possibly conflicting actions
			$(a).unbind();
			// make sure the book panel appears clickable
			$(a).addClass('clickable');
			// set up the first book to move one step
			$(a[0]).click(function(){
				$('#featuredPrev').click();
			});
			// set up the 2nd book to move two steps
			$(a[1]).click(function(){
				$('#featuredPrev2').click();
			});
		}
	
		// and do a little cleanup for layout purposes
		$("#featuredSmall").width(299);
		$('a').click(function() {this.blur();});
		
		$('#topCarouselWrapper').css('visibility','visible');
		
	});



