dojo.require('pepper.util.OnLeave');

// last modified : April 12, 2011 (P.L.)

// abbott.ca

dojo.addOnLoad(function() {
	// Set a locale so some strings can be translated
	var DEFAULT_LOCALE = 'en_CA';
	var locale = dojo.attr(dojo.body(), 'locale') || DEFAULT_LOCALE;
	
	// "Yes" and "Oui" and "No" and "Non" buttons
	var yesButton = {
		en_CA: '<img src="/static/images/yes.gif" />',
		fr_CA: '<img src="/static/cms_workspace/fr_CA/application/image/yes.gif" />'
	};
	
	var noButton = {
		en_CA: '<img src="/static/images/no.gif" />',
		fr_CA: '<img src="/static/cms_workspace/fr_CA/application/image/no.gif" />'
	};



	// External link popup
	// -------------------

	var familySites = [
		location.hostname,
		'abbott.ca', 
		'abbottanimalhealth.com',
		'abbottdiabetescare.ca', 
		'abbottdiagnostics.com', 
		'abbottmolecular.com', 
		'abbottnutrition.ca', 
		'abbottvascular.com', 
		'alphatrakmeter.com',
		'anesthesia-network.ca', 
		'diabetescontrolforlife.ca', 
		'ensure.ca',
		'freestyleabbott.ca',
		'freestylefreedomlitevirtualproductmanual.ca', 
		'glucerna.ca',
		'humira-progres.ca', 
		'ihaveprostatecancer.ca',
		'jobs.brassring.com',
		'kaletra.ca', 
		'lecancerdelaprostateetmoi.ca',
		'lowt.ca',
		'masantemonavenir.ca',
		'mavikontrol.ca', 
		'myhealthmyfuture.ca', 
		'patientsacoeur.com', 
		'patientsatheart.com',
		'pediasure.ca', 
		'pharmacommunications.ca', 
		'pickyeating.ca', 
		'questcequimarrive.ca', 
		'rossrapidresponse.ca',
		'rsvshield.ca', 
		'similac.ca', 
		'trucsnutrition.ca', 
		'whatswrongwithme.ca', 
		'xiencemediakit.com', 
		'xiencev.com' 
	];

	var externalLinkMessage = {
		en_CA: ([
			'<p>You are about to leave an Abbott Canada site, a Web site maintained by Abbott Laboratories, Limited.</p>',
			'<p>This link is provided for your convenience only. Abbott Laboratories, Limited takes no responsibility for the content of any Web site maintained by any third party and makes no representation as to the accuracy or completeness of any information contained on this or any subsequent link.</p>',
			'<p>Do you wish to leave this site?</p>'
		]).join(''),

		fr_CA: ([
			'<p>Vous êtes sur le point de quitter un site Web d\'Abbott Canada dont la maintenance est assurée par Laboratoires Abbott, Limitée.</p>',
			'<p>Ce lien vous a été fourni uniquement pour plus de commodité. Laboratoires Abbott, Limitée n\'assume aucune responsabilité pour ce qui est du contenu de tout site Web offert par un tiers et ne fait aucune déclaration pour ce qui est de l\'exactitude ou de l\'intégralité des renseignements contenus sur ce site ou d\'autres sites.</p>',
			'<p>Désirez-vous continuer?</p>'
		]).join('')
	};
	
	// Set up the normal on-leave dialog
	ol = new pepper.util.OnLeave({
		hostLacks: familySites,
		title: 'Exit Abbott.ca',
		content: externalLinkMessage[locale],
		type: 'popup',
		width: 420,
		height: 280,
		stay: noButton[locale],
		go: yesButton[locale]
	});
	


	// HR link popup
	// -------------

	var hrSites = [
		'brassring.com'
	];

	var hrLinkMessage = {
		en_CA: ([
			'<p>You are now leaving the Abbott Laboratories Web sites.</p>',
			'<p>Do you wish to leave this site?</p>'
		]).join(''),
		
		fr_CA: ([
			'<p>Vous quittez maintenant les sites Web des Laboratoires Abbott.</p>',
			'<p>Désirez-vous continuer?</p>'
		]).join('')
	};

	// Set up the HR on-leave dialog
	olHr = new pepper.util.OnLeave({
		hostContains: hrSites,
		title: 'Exit Abbott.ca',
		content: hrLinkMessage[locale],
		type: 'popup',
		width: 420,
		height: 280,
		stay: noButton[locale],
		go: yesButton[locale]
	});
	


	// Product site link popup
	// -----------------------

	var productSites = [
		'alphatrakmeter.com', 'abbottdiagnostics.com', 'abbottvascular.com',
		'abbottanimalhealth.com', 'abbottmolecular.com', 'xiencev.com'
	];

	var externalProductSiteMessage = {
		en_CA: ([
			'<p>The product-specific Internet site that you have requested is intended for the residents of a particular country or countries, as noted on that site.</p>',
			'<p>As a result, the site may contain information on pharmaceuticals, medical devices and other products or uses of those products that are not approved in Canada. If you are a resident of a country other than those to which the site is directed, please contact your local Abbott affiliate to obtain the appropriate product information for your country of residence.</p>',
			'<p>Do you wish to continue to this product-specific site?</p>'
		]).join(''),
		
		fr_CA: ([
			'<p>Le site Web que vous voulez consulter concernant le produit en question est conçu pour les résidents du ou des pays indiqués dans ce site Web.</p>',
			'<p>Ce site Web peut donc contenir des renseignements sur des produits pharmaceutiques, des dispositifs médicaux ou sur d\'autres produits ou encore sur l\'emploi de ces derniers qui ne sont pas autorisés au Canada. Si vous êtes un résident d\'un pays autre que le ou les pays pour lequel le site Web est destiné, veuillez communiquer avec la filiale d\'Abbott de votre pays pour obtenir les renseignements appropriés à votre pays concernant le ou les produits en question.</p>',
			'<p>Désirez-vous tout de même être redirigé vers le site Web concernant ce produit en particulier?</p>'
		]).join('')
	};

	// Set up the products on-leave dialog
	olProduct = new pepper.util.OnLeave({
		hostContains: productSites,
		title: 'Exit Abbott.ca',
		content: externalProductSiteMessage[locale],
		type: 'popup',
		width: 420,
		height: 280,
		stay: noButton[locale],
		go: yesButton[locale]
	});
});

