function eTrackerEvents()
{
	var init = function(){
		if($('a.download').length > 0)
			downloads();
	}; // function
	
	var downloads = function(){
		$('a.download').click(function(e){
			iId = parseInt($(this).attr('id').replace(/download-/, ''));
			downloadEvent(iId);
			return true;
		});
		
		$('form#downloadform').submit(function(e){
			var sFormData = $(this).serialize();
			var aDownloadMatches = sFormData.match(/downloads%5B%5D=[0-9]+/gi);
			
			if(aDownloadMatches)
			{
				$.each(aDownloadMatches, function(iKey, sVal){
					var aDownloadMatch = sVal.match(/downloads%5B%5D=([0-9]+)/);
					if(aDownloadMatch)
						downloadEvent(parseInt(aDownloadMatch[1]));
				});
			} // if
			return true;
		});
	}; // function
	
	var downloadEvent = function(iId){
		var sDownload = $('#download-' + iId).text();
		var sProduct = '';
		
		var aProduct = $('#download-' + iId).attr('class').split(' ');
		$.each(aProduct, function(iKey, sVal){
			if(sVal.match(/downloadproduct\-([0-9])+/));
			{
				sProduct = $('#' + sVal).text();
			} // if
		});
		
		ET_Event.eventStart('Downloads', sDownload, 'Download', sProduct)
	}; // function
	
	init();
} // class

$(document).ready(function(){
	new eTrackerEvents();
});
