﻿jQuery(function () {
	try {
		jQuery('a').click(function () {
			if (typeof currentPageName !== 'undefined') {
				var category = jQuery(this).closest('div[gat-category]').attr('gat-category');
				if (typeof category !== 'undefined') {
					var action = jQuery(this).attr('gat-action');
					if (typeof action === 'undefined' || action == null) {
						if (jQuery(this).children().length == 0) {
							action = jQuery(this).text();
						}
						else {
							var imgOfAnchor = jQuery(this).find('img:first');
							if (imgOfAnchor.length > 0) {
								action = imgOfAnchor.attr('alt');
								if (typeof action === 'undefined' || action == null || action == '') {
									action = imgOfAnchor.attr('src');
								}
							}
						}
					}
					if (category != null && action != null && action != '') {
						if (typeof _gaq !== 'undefined' && currentPageName != '') {
							var pageCategory = currentPageName + ':' + category;
							_gaq.push(['_trackEvent', pageCategory, action]);
						}
					}
				}
			}
		});
	}
	catch (ex) {
	}
});

