$(document).ready(function() {	
	
	//Offsite links
	$('a[target=_blank]').each(function() {
		$(this).attr('track', $(this).attr('href'));
	});
	
	//Setup helpers
	$('.product .offer-list a').each(function() {
		$(this).attr('track', 'offer attraction '+$(this).attr('track'));
	});
	$('#tab_whatis #attractions a').each(function() {
		$(this).attr('track', 'whatis '+$(this).attr('track'));
	});
	$('map[name=att_map_links] area').attr('track', 'maplink');
	  
	//faq		
	$('.product .question').each(function(fq) {
		$(this).attr('track', 'faqopen faq'+(fq+1));
	});
	//maps
	$('.product .map-att').each(function(mp) {
		$(this).attr('track', 'mapleftnav mapleft'+(mp+1));
	});
	
	//attraction videos
	$('.attraction img.video-screenshot').attr('track', 'attractionvideo');

	//Link click tracking
	$('[track]').click(function() {
		trackLabel = $(this).attr('track');
		//Google
		if (attId != "") { pageId = attId; }
		else { pageId = cityId; }
		_gaq.push(['_trackEvent', pageId, trackLabel ]);
		//Test & Target
		mboxUpdate('citypass_global', 'act='+trackLabel);
		
		//if (trackLabel == 'productvideo' || trackLabel == 'attractionvideo') {
		if (trackLabel.indexOf('video') != -1) {
			_gaq.push(['_setCustomVar', 1, 'Video Viewed', 'Yes', 1]);
		} else if (trackLabel.indexOf('price') != -1 ) {
			_gaq.push(['_setCustomVar', 2, 'Price Details Tab', 'Yes', 1]);
		}
		
	});
	
	
	$('.product .question').click(function() {
		$(this).attr('track', 'garbagefaq');
	});
	$('.product .map-att').click(function() {
		$(this).attr('track', 'garbagemap');
	});
	
});



