/*
 * Fonctions pour afficher l'animation flash par dessus la page d'accueil.
 * Utilise le frameword javascript de mootools
 * 
 * programmeur: Jean-Claude Amyot
 */
window.addEvent('domready', function() {
	var delayBeforeShow = 500; // milliseconds
	var fadeInOutDuration = 500; // milliseconds
	
	var popupLayer = $('popupLayer');
	var popupLayerContent = $('popupLayerContent');
	
	var highlightBg = new Fx.Morph(popupLayer, {
		duration: fadeInOutDuration,
		link: 'cancel',
		transition: 'quad:out'
	});

	var highlightContent = new Fx.Morph(popupLayerContent, {
		duration: fadeInOutDuration,
		link: 'cancel',
		transition: 'quad:out'
	});
	
	popupLayer.addEvents({
		show: function() {
			highlightBg.start({opacity: [0, 0.70]});
		},
		
		hide: function() {
			highlightBg.start({opacity: [0.70, 0]});
			popupLayerContent.fireEvent('hide');
		}
		
	});
	
	popupLayerContent.addEvents({
		show: function() {
			highlightContent.start({opacity: [0, 1]});
		},
		
		hide: function() {
			popupLayerContent.removeEvents('click');
			popupLayerContent.style.visibility='hidden';
		},
		
		click: function() {
			popupLayer.fireEvent('hide');
		}

	});

	popupLayer.fireEvent('show', null, delayBeforeShow);
	popupLayerContent.fireEvent('show', null, delayBeforeShow);
});

/*
 * Fonctions appelées par le contenu flash du popup.
 */
function closePopup(timeDownload, timeViewed){
//	alert("close");
	$('popupLayer').fireEvent('hide');
}

/*
 * Fonctions appelée par le contenu flash du popup.
 * clickPopupLink est définie dans la page d'accueil
 */
function clickPopup(timeDownload, timeViewed){
	window.location = clickPopupLink;
}
