$(document).ready(function () {
	
	// Show & Hide on click
	$('#the-new-gx-tooltip li.tooltip dl dt.heading a').click(function(){ 
		if($(this).parent().next('.box-content').is(':visible')) {
			$(this).parents('#the-new-gx-tooltip').children('li.tooltip').removeClass('active');
			$('#the-new-gx-tooltip li.tooltip dl dd.box-content').hide();
		} else {
			$('#the-new-gx-tooltip li.tooltip dl dd.box-content').hide();
			$(this).parents('#the-new-gx-tooltip').children('li.tooltip').removeClass('active');
			$(this).parents('li.tooltip').addClass('active');
			$(this).parent().next('.box-content').fadeIn(300, function() {
				// Tracking code
				var WTTRACK = $(this).prev('dt.heading').children('a').attr("rel");
				hh_WT.trackEvent({'WT.ac': WTTRACK}, true);
				return false;
			});
		}
	});
	
	// Close button
	$('#the-new-gx-tooltip li.tooltip dl dd.box-content dl dd.close a').click(function() {
		$(this).parents('dd.box-content').hide();
		$(this).parents('#the-new-gx-tooltip').children('li.tooltip').removeClass('active');
	});
	
	// First click tracking code
    var firstInt = true;
    $('#the-new-gx-tooltip li.tooltip dl dt.heading a').click(function () {
        if (firstInt) {
            hh_WT.trackEvent({ 'WT.ac': 'VH_LC200_HPB_TheNewGX_Firstinteraction' }, true);
            firstInt = false;
        }
    });
	
});
