$(document).ready(function () {
	
	// Wrap the headers in span tags for styling purposes
	$('h2').wrapInner('<span>');
	
	// Configure the navigation tabs (no effects for IE, because it's buggy)
	if (!$.browser.msie) {
		$('#main').tabs({
		fx: { 
			opacity: 'toggle', 
			height: 'toggle',
            duration: 600
 			}
		});
	}
	else {
		$('#main').tabs({
		});
	}
	
	// Latest tweet
	getTwitters('tweet', {
		id: 'ruanceli',		// twitter username goes here
		clearContents: true,
		count: 1,
		withFriends: true,
		ignoreReplies: true,
		enableLinks: true,
		template: '<p>%text% <span>%time%</span></p>'
	});
	
	// Activate the slider on the portfolio page
	$('#slides').slides({
		preload: true,
		generateNextPrev: true,
		generatePagination: true,
		autoHeight: true
	});
	
	// Social links animation
	$('#social li').hover(
		function () {
			$(this).stop().animate({paddingLeft: 6}, 160);
		},
		function () {
			$(this).stop().animate({paddingLeft: 0}, 160);
		}
	);

	// Tooltip on the vCard download icon
	$('#vcard').poshytip({
		className: 'poshytip',
		showTimeout: 1,
		alignTo: 'target',
		alignX: 'center',
		offsetY: 5,
		allowTipHover: false
	});
	
	// Form validation on the contact form
	$("form").validate({
		errorElement: "em"
	});

});
