function setupAnalytics(view){
	// enlarge player
	$('a.enlarge').click(function(){
		pushEvent('Enlarge player', $(this).attr('href'));
	});
	
	$('a.social').click(function(){
		pushEvent('Click social icon', $(this).text());
	});
	
	// progress click
	$('span.progress').click(function(){
		var label = $(this).attr('title');
		var parent = $(this).parents('ul');
		if (parent.attr('id') == 'legend'){
			pushEvent('Click progress (legend)', label);
		} else {
			pushEvent('Click progress', label);
		}
	});
	
	// box title click
	$('.box h3').click(function(){
		pushEvent('Click box title', $(this).text());
	});
	
	// gallery image click
	$('#gallery img').click(function(){
		var num = $(this).index('#gallery img') + 1;
		pushEvent('Click gallery image', 'Image #'+num);
	});
	
	// RB & TL links
	$('a.rb, span.copyright a').click(function(){
		pushEvent('Visit company link', $(this).attr('title'));
	});
}

function pushEvent(action, label){
	if(typeof portal == "object") {
        if(portal.category && portal.knownLanguage) {
            label = portal.category.name + " (" + portal.knownLanguage.code + ") " + label;
        }
	}
	_gaq.push(['_trackEvent', 'TLIB', action, label]);
}
function pushView(page){
	_gaq.push(['_trackPageview', page]);
}
