
	var video = {
		// images gauche
		imgVideoImprimerie : './img/gallery/video_imprimerie.png',
		imgVideoMarketing  : './img/gallery/video_marketing.png',
		imgVideoPackaging  : './img/gallery/video_packaging.png',
		imgVideoInnovations : './img/gallery/video_innovations.png',
		imgPlayIcon : './img/gallery/play_icon.png',
		
		// contenu des videos
		interviewPresentation : {
			lien : 'http://www.dailymotion.com/embed/video/xljh5m?autoPlay=1',
			title : 'Pierre Jean Comelli<br />présentation',
			content : ''
		},
		
		interviewCreativite : {
			lien : 'http://www.dailymotion.com/embed/video/xljh59?autoPlay=1',
			title : 'Des solutions pour la créativité',
			content : ''
		},
		
		interviewEfficacite : {
			lien : 'http://www.dailymotion.com/embed/video/xljh51?autoPlay=1',
			title : 'Des solutions pour l\'efficacité économique',
			content : ''	
		},
		
		interviewTimeToMarket : {
			lien : 'http://www.dailymotion.com/embed/video/xljh4k?autoPlay=1',
			title : 'Des solutions pour le time to market',
			content : ''
		},
		
		interviewEnvironnement : {
			lien : 'http://www.dailymotion.com/embed/video/xljh45?autoPlay=1',
			title : 'Des solutions pour l\'environnement',
			content : ''	
		},
		
		nouvelle8Couleurs : {
			lien : 'http://www.dailymotion.com/embed/video/xljh3n?autoPlay=1',
			title : 'Nouvelle Heidelberg Speedmaster XL 105-8 P',
			content : ''	
		},
		
		cadratDOr : {
			lien : 'http://www.dailymotion.com/embed/video/xm5o6e?autoPlay=1',
			title : 'Le Cadrat d\'or 2005',
			content : '15 octobre 2005 : réception au Pavillon d\'Armenonville pour la remise du 49<sup style="font-size: 0.6em">e</sup> Cadrat d\'Or<br /><br /><a href="#cadrat-d-or-suite" class="video imprimerie">Le Cadrat d\'or 2005 - soirée</a>'
		},
		
		cadratDOr2 : {
			lien : 'http://www.dailymotion.com/embed/video/xm5k6w?autoPlay=1',
			title : 'Le Cadrat d\'or 2005 - soirée',
			content : ''
		},
		
		passionCreatifs : {
			lien : 'http://www.dailymotion.com/embed/video/xm60dm?autoPlay=1',
			title : 'Une même passion au service des créatifs',
			content : ''	
		},

		bilanBouygues : {
			lien : 'http://www.youtube.com/embed/Jkp1xP39OQM?autoplay=1',
			title : 'Bilan social personnalisé<br /> pour Bouygues Construction',
			content : '<a href="#bilan-social-personnalise-bouygues-suite" class="video marketing">American Express et la géolocalisation - suite</a>'
		},
		
		bilanBouygues2 : {
			lien : 'http://www.youtube.com/embed/1UPVnvUNrio?autoplay=1',
			title : 'Bilan social personnalisé<br /> pour Bouygues Construction - suite',
			content : ''
		},
		
		amexGeolocalisation : {
			lien : 'http://www.youtube.com/embed/GPUnA31S5Ag?autoplay=1',
			title : 'American Express<br /> et la géolocalisation',
			content : '<a href="#american-express-geolocalisation-suite" class="video marketing">American Express et la géolocalisation - suite</a>'	
		},
		
		amexGeolocalisation2 : {
			lien : 'http://www.youtube.com/embed/KO0K2-lpV2E?autoplay=1',
			title : 'American Express<br /> et la géolocalisation - suite',
			content : ''	
		},
		
		groupeComelli : {
			lien : 'http://www.youtube.com/embed/-wWrdM2VqHk?autoplay=1',
			title : 'Offre du groupe Comelli<br /> par Pierre-Jean Comelli',
			content : ''	
		},
		
		offreCms : {
			lien : 'http://www.youtube.com/embed/3_jD1ca95TU?autoplay=1',
			title : 'Offre de CMS<br /> par Sylvain Pellieux',
			content : ''	
		},
		
		introductionComelli : {
			lien : 'http://www.youtube.com/embed/ZB589g3GHco?autoplay=1',
			title : 'Ateliers du Marketing :<br /> Introduction de Pierre-Jean Comelli',
			content : ''
		},
		
		maitriseCouleur : {
			lien : 'http://www.dailymotion.com/embed/video/xm60dd?autoPlay=1',
			title : 'La maîtrise industrielle<br />de la couleur',
			content : ''	
		},
		
		trameAleatoire : {
			lien : 'http://www.dailymotion.com/embed/video/xm5xur?autoPlay=1',
			title : 'Trame aléatoire :<br /> une expertise',
			content : ''
		},
		
		departementNumerique : {
			lien : 'http://www.dailymotion.com/embed/video/xln1zj?autoPlay=1',
			title : 'Hyper-réactivité<br />avec le département numérique',
			content : ''	
		},
		
		interviewAComelli : {
			lien : 'http://www.dailymotion.com/embed/video/xln1zj?autoPlay=1', 
			title : 'Interview d\'Antonin Comelli',
			content : ''
		},
		
		/*
		insite : {
			lien : 'http://www.dailymotion.com/embed/video/xljh3n',
			title : 'À propos d\'InSite',
			content : ''
		},
		*/
		
		switchLink: function(hash){
			var me = this;
			var video;
			
			switch(hash){
				case 'pj-comelli-presentation' : 
					video = me.interviewPresentation;
				break;
				case 'pj-comelli-creativite' :
					video = me.interviewCreativite;
				break;
				case 'pj-comelli-efficacite-economique' :
					video = me.interviewEfficacite;
				break;
				case 'pj-comelli-time-to-market' :
					video = me.interviewTimeToMarket;
				break;
				case 'pj-comelli-environnement' :
					video = me.interviewEnvironnement;
				break;
				case 'nouvelle-8-couleurs' :
					video = me.nouvelle8Couleurs;
				break;
				case 'cadrat-d-or' :
					video = me.cadratDOr;
				break;
				case 'cadrat-d-or-suite' :
					video = me.cadratDOr2;
				break;
				case 'passion-au-service-des-creatifs' :
					video = me.passionCreatifs;
				break;
				case 'interview-a-comelli' :
					video = me.interviewAComelli;
				break;
				case 'bilan-social-personnalise-bouygues' :
					video = me.bilanBouygues;
				break;
				case 'bilan-social-personnalise-bouygues-suite' :
					video = me.bilanBouygues2;
				break;
				case 'american-express-geolocalisation' :
					video = me.amexGeolocalisation;
				break;
				case 'american-express-geolocalisation-suite' :
					video = me.amexGeolocalisation2;
				break;
				case 'le-groupe-comelli' :
					video = me.groupeComelli;
				break;
				case 'offre-de-cms' :
					video = me.offreCms;
				break;
				case 'introduction-pj-comelli' :
					video = me.introductionComelli;
				break;
				case 'maitrise-industrielle-de-la-couleur' :
					video = me.maitriseCouleur;
				break;
				case 'trame-aleatoire-expertise' :
					video = me.trameAleatoire;
				break;
				case 'le-departement-numerique' :
					video = me.departementNumerique;
				break;
				case 'a-propos-d-insite' :
					video = me.insite;
				break;
				default :
					video = me.interviewPresentation;
				break;
			}
			
			return video;
		},
		
		init: function(){
			var me = this;
			
			$('#gallery, #content, .sub-nav').delegate('.video', 'click', function(){
				var hash, video, conteneur;
				
				hash = $(this).attr('href');
				hash = hash.replace('#', '');
				
				// define content
				conteneur = me.defineConteneur($(this));
				video = me.switchLink(hash);
				
				// insertion du contenu
				me.insertVideo(video, conteneur);
			});
			
			// insertion bouton lecture dans la gallerie
			if($('#gallery .video, #content .video').length > 0){
				me.definePlayIcon();	
			}
		},
		
		definePlayIcon: function(){
			var me = this;
			var $links = $('.video');
			var testInterview = new RegExp(/pj-comelli/);
			var videoLink;
			
			$links.each(function(){
				if(testInterview.test($(this).attr('href'))){
					if($(this).attr('href') == '#pj-comelli-creativite'){
						videoLink = $links.filter('a[href=#passion-au-service-des-creatifs]').clone();
						me.insertPlayIcon(videoLink);
						return false;
					} else if($(this).attr('href') == '#pj-comelli-presentation'){
						videoLink = videoLink = $('<a href="#cadrat-d-or-suite" class="video imprimerie" />');
						me.insertPlayIcon(videoLink);
						return false;
					} else {
						videoLink = $(this).clone();
						me.insertPlayIcon(videoLink);
						return false;	
					}
				} else {
					videoLink = $(this).clone();
					me.insertPlayIcon(videoLink);
					return false;
				}
			});
			
			
		},
		
		insertPlayIcon: function(videoLink){
			var me = this;
			var $playDiv = $('<div id="play_icon" />');
			videoLink.text('');
			
			$playDiv
				.append($(videoLink))
					// .append($('<img src="'+me.imgPlayIcon+'" />')))
			.appendTo('#gallery');
		},
		
		insertVideo: function(video, conteneur){
			var me = this;
			var gallery = $('#gallery');
			
			gallery.empty();
			
			$('<iframe />')
				.attr('width', 485)
				.attr('height', 273)
				.attr('frameborder', 0)
				.attr('src', video.lien)
				.addClass('video')
				.appendTo(conteneur);
			$('<div />')
				.addClass('video-content')
				.append($('<h5 />').html(video.title))
				.append($('<p />').html(video.content))
				.appendTo(conteneur);
			
				
			conteneur.appendTo(gallery);
			$('<div />')
				.attr('id', 'gallery-filet')
				.appendTo(gallery);
			
		},
		
		defineConteneur: function(objet){
			var me = this;
			var conteneur = $('<div />').attr('id', 'video-conteneur');
			
			if(objet.hasClass('imprimerie')){ conteneur.addClass('imprimerie') }
			if(objet.hasClass('marketing')){ conteneur.addClass('marketing') }
			if(objet.hasClass('plv-packaging')){ conteneur.addClass('plv-packaging') }
			if(objet.hasClass('innovations')){ conteneur.addClass('innovations') }
			if(objet.hasClass('actualites')){ conteneur.addClass('actualites') }
			
			return conteneur;
		}

	}
