

$(document).ready(function () {

	$("a.trackclick").click(function(){
		$id = $(this).attr("id");
		JACKBE_track_whitepaper_download($id);
	});

});


function JACKBE_track_whitepaper_download(whitepaper_key) {
	//var jb_queryString = jb_url.replace(/^[^\?]+\??/,'');
	//#var jb_params = TB_parseQuery( jb_queryString );
	//#var jb_view_key = jb_params['inlineId'];
	
	jQuery.get("/tv/views/view.php", {view_key: whitepaper_key}, function(txt) {
		//now need to take the text and update it in to the span
		var $span_views = txt.split("=");
		var $target_span = "#" + $span_views[0] + "_viewed";
		var $views = $span_views[1];
		$($target_span).html($views);
	});
}