var $j = jQuery.noConflict();

$j(document).ready(function() {	
	// --------------------------------------------------------------------------------------
	// iE6 Hover function
	// --------------------------------------------------------------------------------------
	$j('#nav-main li').hover(
		function(){
			$j(this).addClass('hover');
		}, 
		function() {
			$j(this).removeClass('hover');
		}
    );

	// --------------------------------------------------------------------------------------
	// XHTML 1.0 Strict external links function
	// --------------------------------------------------------------------------------------
	$j('a.external').click(function(){
        window.open(this.href);
        return false;
    });

	// --------------------------------------------------------------------------------------
	// Rounded Corners
	// --------------------------------------------------------------------------------------
	$j('#body').corner('bottom 16px');
	$j('#sidebar').corner('br 16px');
	$j('a.button, a.button-join').corner();

	
	// --------------------------------------------------------------------------------------
	// Readjust tournament sidebar panel
	// --------------------------------------------------------------------------------------
	$j('#home-sticky .list').cycle({
		fx: 'fade',
		speed: 'slow',
		pager: '#nav-sticky'
	});


	// --------------------------------------------------------------------------------------
	// Carousel
	// --------------------------------------------------------------------------------------
	function mycarousel_initCallback(carousel)
	{
		// Disable autoscrolling if the user clicks the prev or next button.
		carousel.buttonNext.bind('click', function() {
			carousel.startAuto(0);
		});

		carousel.buttonPrev.bind('click', function() {
			carousel.startAuto(0);
		});

		// Pause autoscrolling if the user moves with the cursor over the clip.
		carousel.clip.hover(function() {
			carousel.stopAuto();
		}, function() {
			carousel.startAuto();
		});
	};
	$j('#tournament-carousel').jcarousel({
		vertical: true,
		scroll: 3,
		initCallback: mycarousel_initCallback
	});
	
	$j('#home-sponsors ul').cycle({
		fx: 'fade',
		speed: 'slow'
	});
	$j('#home-partners ul').cycle({
		fx: 'fade',
		speed: 'slow'
	});

});
