$(document).ready(function() 
{	
	$("a").click(function(event) 
		{	if ($(this).hasClass('TrackMe') || $(this).hasClass('TrackMePDF'))
			{	var itemID = this.rel;
				var href = this.href.toLowerCase();
				var clickType = 1;
				if ($(this).hasClass('TrackMePDF'))
					clickType = 2;
				if (href.indexOf("cart_add") > 0)
					clickType = 2;
				//alert("Tracking stuff goes here! " + itemID + ' ' + href);
				$.ajax(
					{
	        		type: "POST",
	        		url: "TrackClick/TrackClick.cfm?APID=" + itemID + "&T=" + clickType,
	        		datatype: "html",
	        		//data: ,
	        		success: 	function(data) 
								{	//alert("No problems reported");
	    							//$('.result').html(data);
	    							//alert(data);
									// We don't really care about success 
	        					},
	        		error: 	function()
								{	// We don't really care about failure 
									//alert("Error: check the CF logs");
	        					}
	    			});
					//event.preventDefault();
			}
   		}
	 );
 });


