$(document).ready(function(){
	// Initialize FTR announcements width
	//var getDivWidth = document.getElementById("ftrannouncements_carousel_container");
	//var announcementsWidth = getDivWidth.offsetWidth - 20 - 4; // Minus 4px for left and right borders, 20px for list items padding
	//$('.infiniteCarousel .ftrannouncements_wrapper ul li').css('width', announcementsWidth);
	//$('.infiniteCarousel .ftrannouncements_wrapper').css('width', announcementsWidth);
	//$('.ftrannouncements_newstitle a').css('max-width', announcementsWidth - 90);
	
	// Initialize Poker Forum Topics width
	//var getDivWidth = document.getElementById("pokerforumtopics_carousel_container");
	//var forumtopicsWidth = getDivWidth.offsetWidth -20 - 4; // Minus 4px for left and right borders, 20px for list items padding
	//$('.infiniteCarousel .pokerforumtopics_wrapper ul li').css('width', forumtopicsWidth);
	//$('.infiniteCarousel .pokerforumtopics_wrapper').css('width', forumtopicsWidth);
	//$('.pokerforumtopics_newstitle a').css('max-width', announcementsWidth - 90);
	
	// Initialize news width
	var getDivWidth = document.getElementById("pokercommunitynews_content_container_id");
	var newsWidth = getDivWidth.offsetWidth;
	$('.infiniteCarousel .pokercommunitynews_wrapper ul li').css('width', newsWidth-20); // 20px for padding
	$('.infiniteCarousel .pokercommunitynews_wrapper').css('width', newsWidth);
	
	// Initialize tabs
	//$("#pokerroomrankings_tabs ul").idTabs("!mouseover"); 
	//$("#upcomingevents_tabs ul").idTabs("!mouseover"); 

// Infinite Carousel - for Poker Community News
    // THIS IS NEW CODE FOR THE AUTOMATIC INFINITE CAROUSEL
    var autoscrolling = true;
    
	// Begin Poker Community News scroll
	$('.pokercommunitynewsCarousel').infiniteCarousel().mouseover(function () {
        autoscrolling = false;
    }).mouseout(function () {
        autoscrolling = true;
    });
    
    setInterval(function () {
        if (autoscrolling) {
            $('.pokercommunitynewsCarousel').trigger('next');
        }
    }, 8000);
	
// Setup other boxes
	//Initialize pager container width and position
	// Initialize news height
	var getDivHeight = document.getElementById("pokercommunitynews_carousel_list");
	var newsHeight = getDivHeight.offsetHeight;
	newsHeight = 144;
	
	$('.pokercommunitynews_content_container').css('height', newsHeight + 30 + 22 + 10 + 'px'); // footer 30px, pager 20px, margin 10px
	$('.pokercommunitynews_wrapper').css('height', (newsHeight + 22) + 'px');
	$('.pokercommunitynews_wrapper').css('margin-top', '-' + (newsHeight + 10) + 'px');
	$('.pokercommunitynews_content_footer').css('margin-top', (newsHeight + 22 + 10) + 'px');
	$('.pokercommunitynewsCarousel').css('bottom', '38px');

});

