function featuredEvents_initCallback(carousel) {
    jQuery('.featured-events .slider-nav a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });
};

function featuredEvents_firstInCallback(carousel, item, idx, state) {
	$('.featured-events .slider-nav a').removeClass('active');
	$('.featured-events .slider-nav a').eq(idx-1).addClass('active');
}

function tv_initCallback(carousel) {
    jQuery('.tv .slider-nav a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });
};

function tv_firstInCallback(carousel, item, idx, state) {
	$('.tv .slider-nav a').removeClass('active');
	$('.tv .slider-nav a').eq(idx-1).addClass('active');
}

function otherServices_initCallback(carousel) {
    jQuery('.other-services .slider-nav a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });
};

function otherServices_firstInCallback(carousel, item, idx, state) {
	$('.other-services .slider-nav a').removeClass('active');
	$('.other-services .slider-nav a').eq(idx-1).addClass('active');
}

$(function(){ 
	
	$('.member-tools .slider ul').jcarousel({
		scroll: 1,
		visible: 1,
		wrap: "both"
	});

	$('.affiliates-featured .slider ul').jcarousel({
		scroll: 1,
		visible: 5,
		wrap: "both"
	});
	
	$('.featured-events .slider-list ul').jcarousel({
		auto: 3,
		visible: 1,
		scroll: 1,
		wrap: "both",
		initCallback: featuredEvents_initCallback,
		itemFirstInCallback: featuredEvents_firstInCallback,
		buttonNextHTML: null,
        buttonPrevHTML: null
	});
	
	$('.tv .slider-list ul').jcarousel({
		visible: 1,
		scroll: 1,
		wrap: "both",
		initCallback: tv_initCallback,
		itemFirstInCallback: tv_firstInCallback,
		buttonNextHTML: null,
        buttonPrevHTML: null
	});
	
	$('.other-services .slider-list ul').jcarousel({
		visible: 1,
		scroll: 1,
		wrap: "both",
		initCallback: otherServices_initCallback,
		itemFirstInCallback: otherServices_firstInCallback,
		buttonNextHTML: null,
        buttonPrevHTML: null
	});
	
	if($.browser.msie && $.browser.version.substr(0,1) == 6) {
		DD_belatedPNG.fix('h1#logo a, #login-panel, #page, #secondary-navigation, .bottom-content .col-3 a img');	
	}
	
	
	$('#navigation ul li').hover(
		function(){ $(this).find('.dd').slideDown(); },
		function(){ $(this).find('.dd').hide(); }
	);
	
	$('.alert .close a').click(function(){ 
		$(this).parents('.alert').fadeOut();
		return false;
	 })
	
});
