$(document).ready(function() {
	
	// Prechargement des vignettes hover
	var aPhotos = new Array();
	$('#interface .video .lienVideo img').each(function(i) {
		
		if ($(this).attr('longdesc')) {
			var pic = new Image();
			pic.src = $(this).attr('longdesc');
			aPhotos[i] = pic;
		}
	});
	
	/**
	 * Rollover des vignettes video
	 */
	$('#interface .video .lienVideo img').mouseover(function() {
		
		imageRollover($(this));		
		return false;
	});
	
	$('#interface .video .lienVideo img').mouseout(function() {
		
		imageRollover($(this));		
		return false;
	});
	
	/**
	 * Click sur une vignette => lancement du video player
	 */
	$('#interface .video .lienVideo').click(function() {
		
		window.open($(this).attr('href'), 'videoplayer', 'menubar=no, status=no, scrollbars=no, width=620, height=357');
		return false;
	});
	
	/*
	 * ##### FONCTIONS COMMUNES #####
	 */
	 
	 /**
	  * Gestion du Rollover des vignettes video
	  */
	 function imageRollover(el) {
		
		if (el.attr('longdesc')) {
			var oldSrc = el.attr('src');
			el.attr('src', el.attr('longdesc'));
			el.attr('longdesc', oldSrc);
		}
	}
});