$(function() {
	
	$('#cycle').cycle({ 
	    fx: 'scrollLeft',
	    speed:   200, 
	    timeout: 6000
	});
	 
		
	// Twitter	
	$('.twitter_item').jTweetsAnywhere({
        username: 'vico_news',
        count: 1,
        
        tweetFeedDecorator: function(options)
    	{
    		return '<div></div>';
    	},
    	
    	tweetDecorator: function(tweet, options)
    	{
    		// the default tweet is made of the optional user's profile image and the
    		// tweet body inside a list item element
    		var html = '';

    		if (options.tweetBodyDecorator)
    			html += options.tweetBodyDecorator(tweet, options);

    		return '<div>' + html + '</div>';

    	},
        
        tweetBodyDecorator: function(tweet, options)
    	{
    		// the default tweet body contains the tweet text and the tweet's creation date
    		var html = '';
    		
    		if (options.tweetTimestampDecorator)
    			html += options.tweetTimestampDecorator(tweet, options);
    		
    		if (options.tweetTextDecorator)
    			html += options.tweetTextDecorator(tweet, options);
    		
    		return '<div>' + html + '</div>';
    	},
        
        tweetTimestampDecorator: function(tweet, options){
    		
    		var createdAt = formatDate(tweet.created_at);
	        var date = new Date(createdAt);		
	
	        var dateString =
	        	(date.getDate() < 10 ? '0' : '') +
	        	date.getDate() + '.' +
	        	
	        	(date.getMonth() < 9 ? '0' : '') +
	        	(date.getMonth() + 1) + '.' +
	        	
	        	date.getFullYear() + ' | ' +
	        	
	        	(date.getHours() < 10 ? '0' : '') +
	        	date.getHours() + ':' +
	        	
	            (date.getMinutes() < 10 ? '0' : '') +
	            date.getMinutes();
	        	
	        return '<div class="item_date">' + dateString + '</div>';
	    }

    });
    
	
	// Box Animation
	$('#left_box').hide();
	$('#center_box').hide();
	$('#right_box').hide();

	$('#left_box').fadeIn('slow', function() {
		$('#center_box').fadeIn('slow', function() {
			$('#right_box').fadeIn('slow', function() {
				
			});
		});	
	});
		
	// Search Tooltip
	$('.tooltip').hide();
	
	$('#search_intro a').hover(
		function() {
			$('.tooltip').show();
		},			
		function() {
			$('.tooltip').hide();
		}
	);
	
 });

