/*jslint white: true, onevar: true, undef: true, newcap: true, regexp: true, plusplus: true, bitwise: true, maxerr: 50, indent: 4 */
/*global Vontoo, _gat, document, jQuery, setTimeout, window */

window.Vontoo    = window.Vontoo    || {};
Vontoo.Analytics = Vontoo.Analytics || {};

/**
 * Object: Vontoo.Analytics
 * 
 * Holds Vontoo-specific analytics objects and function
 */
jQuery.extend(Vontoo.Analytics, {
	
	/**
	 * Function: Vontoo.Analytics.recordOutboundLink
	 * 
	 * Parameters:
	 *		link     - link DOM object
	 *		category - category for Google Analytics
	 *		action   - action for Google Analytics
	 *
	 * Google Analytics asynchronous outbound link click.  Details can be
	 * found at: http://www.google.com/support/analytics/bin/answer.py?answer=55527
	 */
	recordOutboundLink : function (link, category, action) {
		_gat._getTrackerByName()._trackEvent(category, action);
		setTimeout('document.location = "' + link.href + '"', 100);
	}
});


/******************************************************************************
 * Section: Document Ready
 * 
 * Special rules to apply for when the document has loaded.
 */

jQuery(document).ready(function () {
	
	/**
	 * Adds an onclick function to the Login button in the header
	 * to track clicks for Google Analytics.
	 */
	jQuery('#menu-item-26').find('a').live('click', function () {
		Vontoo.Analytics.recordOutboundLink(this, 'Outbound Links', 'Log In');
		return false;
	});
});
