// This code uses JQuery library and it has to be included before this code
// Mapping format: 'body#[pageID] #[linkID]' : '[Atlas http or https URL]'
var atlasTags = {
	// Patient section
	//'body#about_whitecell #linkPrint': 'http://switch.atdmt.com/action/deineu_aboutwhitecellsprint_10', 
	'body#about_whitecell #linkPrint': 'http://view.atdmt.com/action/deineu_NewAboutLowWhiteBloodCellCountsPrintTES_6', // XXX Tmp Test URL from MediaEdge
	'body#at_risk #linkPrint': 'http://switch.atdmt.com/action/deineu_atriskprint_10',
    'body#blood_counts #linkPrint': 'http://switch.atdmt.com/action/deineu_bloodcountsprint_10',
    'body#how_canhelp #linkPrint': 'http://switch.atdmt.com/action/deineu_howcanhelpprint_10',
    'body#pi #linkPrint': 'http://switch.atdmt.com/action/deineu_productinfoprint_10',
    'body#product_safety #linkPrint': 'http://switch.atdmt.com/action/deineu_productsafetyprint_10',
    'body#against_infection #linkPrint': 'http://switch.atdmt.com/action/deineu_againstinfectionprint_10',
    'body#questions #linkPrint': 'http://switch.atdmt.com/action/deineu_askdoctorprint_10',
    'body#info #linkPrint': 'http://switch.atdmt.com/action/deineu_linksprint_10',
    'body#support #linkPrint': 'http://view.atdmt.com/action/deineu_PatientSupportPrint_6',
    'body#pi a.linkPDFSpanishBrochure': 'http://view.atdmt.com/action/deineu_NeulastaProductInformationPDF_6',
    'body#questions a.linkPDFQuestions': 'http://view.atdmt.com/action/deineu_checklist_6',
    'body#pi #linkPPI': 'http://view.atdmt.com/action/deineu_NeulastaProductInformationPDF_6',
    
    // Professional section
    'body#pi-pro #linkPPI': 'http://view.atdmt.com/action/deineu_NeulastaProductInformationPDF_6'
};
// ------------------- DO NOT MODIFY BELOW THIS LINE -------------------------------------------------------------------------------------
var atlasDivId = "atlasTags";
function trackInAtlas(url) {
	var timestamp = Number(new Date());
	var img = new Image();
	$(img).attr("src",url+"?time="+timestamp);
	$('#'+atlasDivId).css("display", "block");
	$('#'+atlasDivId).html($(img));
	$('#'+atlasDivId).css("display", "none");
}

$(document).ready(function(){
	// Add placeholder for images
	if(!($('#'+atlasDivId).length)) {
		div = $("<div>");
		div.attr("id",atlasDivId);
		$("body").append(div);
	}
	if (atlasTags != null) {
		$.each(atlasTags, function(key, value) {
			$(key).click(function () { trackInAtlas(value); }); 
		});
	}
});