$(document).ready( function() {
	
	/* Here are all the functions related to setting up and displaying the 
	 * peel-back feature in the top-right corner of the widget
	 */
	function setupReveal()
	{
		$('#reveal').bind( 'mouseenter', showReveal );
		$('#reveal').bind( 'mouseleave', hideReveal );
		$('#reveal').bind( 'click', function(){ $('#reveal input').focus().select(); return false; });
	}

	function showReveal()
	{
		$('#reveal').animate( { width: 200, height: 200 }, 1200 );
	}

	function hideReveal( easing )
	{
		if ( typeof(easing) == 'object' ) 
		{
			easing = 1200;
		}

		$('#reveal').animate( { width: 30, height: 30 }, easing );
	}
	/* Setting up the jcarousel widget to display the top posters
	 */
	function setupCarousel() 
	{
		$('#carousel').jcarousel({ scroll: 3,
									size:18, 
									buttonPrevHTML: "<div id='prev' class='jc'></div>",
									buttonNextHTML: "<div id='next' class='jc'></div>"
									});
	}
	
	setupCarousel();

	setupReveal();
	hideReveal(4000);

	$('#sayfie_btn').click( function() {
		$('#tweetment_floridapols').fadeOut('normal', function() {
			$('#tweetment_sayfie').fadeIn();
		});
		$('#twidgets_floridapols').fadeOut('normal', function(){
			$('#twidgets_sayfie').fadeIn();
		});
	});
	
	$('#floridapols_btn').click( function() {
		$('#tweetment_sayfie').fadeOut('normal' , function() {
			$('#tweetment_floridapols').fadeIn();
		});
		$('#twidgets_sayfie').fadeOut('normal', function() {
			$('#twidgets_floridapols').fadeIn();
		});

	});
	
	
});
