// 
//	home.js
//	Javascript for the home pages
// 

function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a[class=button]').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).attr('href')));
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

function mycarousel_itemFirstInCallback(carousel, item, idx, state) {
	$("a[href="+idx+"]").addClass('on');
};

function mycarousel_itemFirstOutCallback(carousel, item, idx, state) {
	$("a[href="+idx+"]").removeClass('on');
};

jQuery(document).ready(function() {
	
	jQuery(function() {
		jQuery('#slideshow').cycle();
	});
	
	jQuery("#news-content").jcarousel({
			scroll: 1,
			visible: 1,
			auto: 10,
			wrap: 'both',
			initCallback: mycarousel_initCallback,
			itemFirstInCallback:  mycarousel_itemFirstInCallback,
			itemFirstOutCallback: mycarousel_itemFirstOutCallback,
			// This tells jCarousel NOT to autobuild prev/next buttons
			buttonNextHTML: null,
			buttonPrevHTML: null
	});
});

