//project Scroll 

//jCarousel Plugin
$(document).ready(function () {
		
	//jCarousel Plugin
	$('#carousel').jcarousel({
		vertical: true,	//display vertical carousel
		scroll: 1,	//auto scroll
		auto: 1,	//the speed of scrolling
		wrap: 'last',	//go back to top when reach last item
		buttonNextHTML:null,
		buttonPrevHTML:null, 
		initCallback: mycarousel_initCallback	//extra called back function
	});


	//Front page Carousel - Initial Setup
	//set all the item to full opacity
   	$('div#slideshow-carousel a img').css({'opacity': '0.5'});
   	
   	//readjust the first item to 50% opacity
   	$('div#slideshow-carousel a img:first').css({'opacity': '1.0'});
   	
   	//append the arrow to the first item
	//$('div#slideshow-carousel li:last').css({'background': 'red'})


//append click event to the UL list anchor tag
$('#welcomeHero #slideshow-carousel li a').click(function () {
	
	//reset all the items
	$('#welcomeHero #slideshow-carousel li a').removeClass('selected');
		
	//set current item as active
	$(this).addClass('selected');	
		
	//scroll it to the right position
	$('.mask').scrollTo($(this).attr('rel'), 300);
		
	//disable click event
	   return false;		
		
});

});

//Carousel Tweaking
function mycarousel_initCallback(carousel) {
	
	// Pause autoscrolling if the user moves with the cursor over the clip.
	// resume otherwise
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
				$('.down').bind('click', function() {
			carousel.next();
			return false;
			});
			
			$('.up').bind('click', function() {
			carousel.prev();
			return false;
			});

}

//books Scroll 
    $(function() {
        $(".booksScroll").jCarouselLite({
        btnNext: ".booksCntrol",
        visible: 3,
		vertical:true,
		speed:700,
		easing:"swing", 
		auto:3000
    });
	
});


//Logo Hover
$(function () {
        if ($.browser.msie && $.browser.version < 7) return;
        $('.logo').removeClass('highlight')
		.find('a').append('<span class="hover" />').each(function () {
			var $span = $('> span.hover', this).css('opacity', 0);
			$(this).hover(function () {
					//on hover
					$span.stop().fadeTo(400, 1);
					}, function () { 
						//of Hover 
						$span.stop().fadeTo(400,0)
							
						});
			      
		});
    });
	
/*$(function() {

		$(setSelector).sortable({
		handle: 'h2',
		cursor: 'move',
		opacity: 0.7, 
       revert: true,
	   update: function() { getOrder(); } }); restoreOrder();
	  });


$(function() {
		$("#sidebar").sortable({handle: 'h2', cursor: 'move'});
	});

$(function() {
		$("#lsidebar").sortable({handle: 'h2', cursor: 'move'});

	});
	*/
	
