// 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_NeulastaPatientEducationSpanish_6',
    'body#questions a.linkPDFQuestions': 'http://view.atdmt.com/action/deineu_checklist_6',
    'body#pi #linkPPI': 'http://view.atdmt.com/action/deineu_NeulastaProductInformationPDF_6',
	'body# .linkSpanishBrochurePDF': 'http://view.atdmt.com/action/deineu_NeulastaPatientEducationSpanish_6',
	'body#neulasta_neupogen #linkPrint': 'http://view.atdmt.com/action/deineu_NeulastaandNeupogenPRINT_6',
    
    // Professional section
    'body#pi-pro #linkPPI': 'http://view.atdmt.com/action/deineu_NeulastaProductInformationPDF_6',
	
	 // Myths or Facts section
	'.linkImportantSafetyInformation': 'http://view.atdmt.com/action/deineu_MOFImportantSafetyInformation_1',
	'.linkPrescribingInformation': 'http://view.atdmt.com/action/deineu_MOFPrescribingInformation_1',
	'.linkPatientProductInformation': 'http://view.atdmt.com/action/deineu_MOFPatientProductInformation_1',
	'.linkNeulasta': 'http://view.atdmt.com/action/deineu_MOFNeulastacomlink_1',
	'body#low-white-blood-cell-counts .linkTalktoyourDoctorPDF': 'http://view.atdmt.com/action/deineu_MOFTalktoyourDoctorPDF_1',
	'body#camelia-story .linkCameliasStoryPDF': 'http://view.atdmt.com/action/deineu_MOFCameliasStoryPDF_1',
	'body#what-ask-your-doctor .linkWhattoaskyourDoctorPDF': 'http://view.atdmt.com/action/deineu_MOFWhattoaskyourDoctorPDF_1',
	'.linkAmgen': 'http://view.atdmt.com/action/deineu_MOFAmgencomlink_1',
	'.linkChemotherapy': 'http://view.atdmt.com/action/deineu_MOFChemotherapycomlink_1',
	'.linkPrivacyStatement': 'http://view.atdmt.com/action/deineu_MOFPrivacyStatement_1',
	'.linkTermsofUse': 'http://view.atdmt.com/action/deineu_MOFTermsofUse_1'
};
// ------------------- 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); }); 
		});
	}
});
