jQuery(document).ready(function() {
	getNext();
});

function getNext() {
	$('#website .side-pods p.full-link a').click(function(e) {
		e.preventDefault();
		loadPodContent( $(this) );
	});

	// track the Next Drink Tips interation
	$('#next-tip').click(function() {
		trackNextTipInteraction();
	});
	// track the Next Fact interation
	$('#next-fact').click(function() {
		trackNextFactInteraction();
	});
}

function loadPodContent( object ) {
	var a = object.attr('id');
	var tipId = gup( object.attr('href'), 't' );
	var factId = gup( object.attr('href'), 'f' );
	
	if( a == 'next-tip' ) {		
		$.get(includes_path + 'components/drink-tips.inc.php', { t: tipId },
			function(data) {
				$('#drink-tips').html( data );
				getNext();
			}
		);
	}
	else {	
		$.get(includes_path + 'components/drinking-facts.inc.php', { f: factId },
			function(data) {
				$('#drink-facts').html( data );
				getNext();
			}
		);
	}
	
}
