function mycarousel_initCallback(carousel) {
	jQuery('.jcarousel-control a').bind('click', function() {
		if(jQuery(this).text() != 'P'){
			carousel.stopAuto();
			carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
			carousel.startAuto();
		} else {
			carousel.toggleAuto();
		}
		
	return false;
	});
};

function mycarousel_FirstInCallback(carousel, object, index, state ) {
	// Get the Index
	// Find the Element
	// Remove the old graphic from the element
	// Add the new graphic to the element
	$("#newscarousel" + index).removeClass("NewsItemUnselected");
	$("#newscarousel" + index).addClass("NewsItemSelected");
	
}

function mycarousel_FirstOutCallback(carousel, object, index, state) {
	// Get the Index
	// Find the Element
	// Remove the old graphic from the element
	// Add the new graphic to the element
	$("#newscarousel" + index).removeClass("NewsItemSelected");
	$("#newscarousel" + index).addClass("NewsItemUnselected");
}


$(document).ready( function() {  
	
	jQuery('#mycarousel').jcarousel({
		scroll: 4,
		visible: 4,
		wrap: 'both'
	});
	
	jQuery('#newstestcarousel').jcarousel({
		scroll: 1,
		visible: 1,
		auto: 6,
		size: 6,
		wrap: 'last',
		initCallback: mycarousel_initCallback		
	});
	
	jQuery('#newscarousel').jcarousel({
		scroll: 1,
		visible: 1,
		auto: 8,
		size: 5,
		wrap: 'last',
		initCallback: mycarousel_initCallback,
		itemFirstInCallback: mycarousel_FirstInCallback,
		itemFirstOutCallback: mycarousel_FirstOutCallback
	});
		
	var FB_API_KEY = 'b4094162f65142fb5709c6ff0060bb30';
	var ZYNGA_API_KEY = 'd789f04b2dcbec511afb9ceeb0b9af7a58fc8cd6875548bb2c44fa92a9f01c90';
	var FB_SNID = '1';
	var USER_LOGIN_URL = 'http://bulldog.dev.zynga.com/accounts/www/login/';
	var GAME_IFRAME_URL = 'http://jchum.mwdev.zynga.com/mwfb_connect/?fb_sig_in_iframe=1&fb_sig_locale=en_US&fb_sig_in_new_facebook=1';
	
	function setupDD()
	{
		//var games_dropdown = new ZDropdown("games_dropdown_activator", "games_dropdown_content");
		//var settings_dropdown = new ZDropdown("settings_dropdown_activator", "settings_dropdown_content");
		
		var modal_options = {
			overlayCss: {  backgroundColor: '#000' },
		  containerCss: {
				padding: "1em",
				backgroundColor: '#fff',
				border: '3px solid #ccc',
				textAlign: "left"
			}
		};
		
		$("#account_modal_link").click(function() { jQuery("#account_modal_content").modal(modal_options); });
		$("#privacy_modal_link").click(function() { jQuery('#privacy_modal_content').modal(modal_options); });
		
		$('.modal_close').css({'text-align':'right'});
		$('.modal_close a').click(function() { jQuery.modal.close(); }).css({
				"text-decoration":"underline",
				"color":"#0000FF"
		});
	}
	
	//setupDD();					
});