$('#navigation a[href*=giving/icampus]').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'donate_give', 'the red "Donate" button in the top right navigation']);
});

$('#navigation a[href*=/get-a-bible]').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'get_a_free_bible', 'the "Get a Free Bible" link in the top right navigation']);
});

$('#navigation a[href$=whatsnextkit.tv]').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'whats_next', 'the "What’s Next?" link in the top right navigation']);
});

$('#account-bar .initial-links a.sign-in-link').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'sign_in_static', 'the "Sign In" link above the chat window']);
});

$('#account-bar .initial-links a.sign-up-link').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'sign_up_static', 'the "Sign Up" link above the chat window']);
});

$('#chat-nickname-buttons .sign-up-bttn').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'sign_in_modal', 'The "Sign up" button in the welcome modal over the chat area']);
});

$('#nick-input .sign-up-bttn').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'sign_up_modal', 'The "Sign up" button in the welcome modal over the chat area']);
});

$('#nick-input .chat-sign-in').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'sign_in_modal', 'The "Sign in" link in the welcome modal over the chat area']);
});

$('#video-sub a.request-prayer.bttn').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'request_prayer', 'The "Request Prayer" button when there isn’t an event live on the site, under video']);
});

$("#video-sub a.offline-prayer.bttn").click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'request_prayer_nochat', 'The "Request Prayer" button when there is a "No Chat" event.'])
});

$('#video-sub a.live-prayer.bttn').click(function(e){
	_gaq.push(['_trackEvent', 'connection', 'live_prayer', 'The "Live Prayer" button when there is an live event.']);
});

$('#video-quality a.high.bttn').click(function(e){
	_gaq.push(['_trackEvent', 'experience', 'high_quality_video', 'when a user clicks on "Watch in High Quality" ']);
});
$('#video-quality a.low.bttn').click(function(e){
	_gaq.push(['_trackEvent', 'experience', 'low_quality_video', 'when a user clicks on "Watch in Low Quality"']);
});
$('#enter-nickname .enter-nickname-bttn').click(function(e){
	_gaq.push(['_trackEvent', 'experience', 'enternickname_modal', 'when a user clicks on "Enter a Nickname" in the welcome modal']);
});
$('#video-switch a').click(function(e){
	_gaq.push(['_trackEvent', 'experience', 'disable_video', 'a click on "disable video" in the footer during a live experience']);
});
$('#chat-switch a').click(function(e){
	_gaq.push(['_trackEvent', 'experience', 'disable_chat', 'a click on "disable chat" in the footer during a live experience']);
});
$('.tabs .tab-map').click(function(e){
	_gaq.push(['_trackEvent', 'experience', 'tab_map', 'a click on the "Map" tab']);
});
$('.tabs .tab-notes').click(function(e){
	_gaq.push(['_trackEvent', 'experience', 'tab_notes', 'a click on the "Note" tab']);
});
$('.tabs .tab-times').click(function(e){
	_gaq.push(['_trackEvent', 'experience', 'tab_times', 'a click on the "Times" tab']);
});
$('#navigation a[href*=twitter.com]').click(function(e){
	_gaq.push(['_trackEvent', 'social', 'findus_twitter', 'a click on the "Find us on Twitter" link']);
});
$('#navigation a[href*=facebook.com]').click(function(e){
	_gaq.push(['_trackEvent', 'social', 'findus_facebook', 'a click on the "Find us on Facebook" link']);
});
$('.sharing-options a.icon-facebook').click(function(e){
	_gaq.push(['_trackEvent', 'social', 'social_facebook', 'when a user clicks on the Twitter social share icon under the video']);
});
$('.sharing-options a.icon-twitter').click(function(e){
	_gaq.push(['_trackEvent', 'social', 'social_twitter', 'when a user clicks on the Facebook social share icon under the video']);
});
$('.sharing-options a.icon-email').click(function(e){
	_gaq.push(['_trackEvent', 'social', 'social_email', 'when a user clicks on the Email social share icon under the video']);
});

$('body').ajaxSend(function(evt, request, settings){
	if( settings.url.indexOf('/channel_slides/pollResponse') > -1 )
	{
		_gaq.push(['_trackEvent', 'connection', 'poll']);
	}
});

function onYouTubePlayerReady(playerId){ $('#video-box object')[0].addEventListener("onStateChange", "onYtPlayerStateChange");}

function onYtPlayerStateChange(newState){
	if( newState == 1 ) {
		_gaq.push(['_trackEvent', 'experience', 'click_preview', '* when a user clicks on the preview YouTube video when an event isn’t live']);
	}
}

(function(){
	if(
		$('#video-box object').length
		&&
		$('#video-box object param[name=movie]').attr('value').indexOf('youtube.com')
	) {
		var src = $('#video-box embed').attr('src').split('?')[0] + '?enablejsapi=1';
		$('#video-box object').attr('data', src);
		$('#video-box object param[name=movie]').attr('value', src);
		$('#video-box object embed').attr('src', src);
	}
})();

