/*							*/				
/* PRECHARGEMENT DES IMAGES	*/
/*							*/
		
		// Si toutes les images sont dans le même répertoire
		// Chemin vers le répertoire des images
		var chemin_global =  "../images/global/";
		var chemin_home =  "../images/home/";
		var chemin_projets = "../images/projets/";
		var chemin_big_img = "../images/projets/big_img/";
		var chemin_entreprise = "../images/entreprise/";
		
		// Si toutes les images ont la même extension
		// L'extension de toutes les images
		var ext = ".png";
		
		// Si toutes les images sont dans le même répertoire et ont la même extension
		// Le nom de chaque image à précharger, peu importe l'ordre
		var liste_global = new Array('fleche_bleue_double_rollover');
		var liste_home = new Array('fleche_jaune_double_rollover');
		var liste_projets = new Array('button_dl_rollover', 'close_rollover');
		var liste_big_img = new Array('big_img_1','big_img_2','big_img_3','big_img_4','big_img_5','big_img_6','big_img_7','big_img_8','big_img_9','big_img_10','big_img_11','big_img_12','big_img_13','big_img_14','big_img_15','big_img_16','big_img_17','big_img_18','big_img_19','big_img_20','big_img_21','big_img_22');
		var liste_entreprise = new Array('equipe','explication_1','explication_2','fleche_bleue','fleche_grise');
				
		// Si les images sont dans des répertoires différents ou ont des extensions différentes, 
		//indiquer dans le tableau précédent le chemin et l'extension de chaque image
		
		// Un tableau qui permettra le stockage 'virtuel' des images pour les précharger
		document.images_global_chargees = new Array();
		document.images_home_chargees = new Array();
		document.images_projets_chargees = new Array();
		document.big_img_chargees = new Array();
		document.images_entreprise_chargees = new Array();
		
		// La fonction de préchargement GLOBAL
		function prechargement_global() {
			// Pour chaque image
			for ( i = 0; i < liste_global.length; i++ ) {			
			// on créé virtuellement une image
			document.images_global_chargees[i] = new Image;			
			// On en indique la source en assemblant le chemin, le nom et l'extension
			document.images_global_chargees[i].src = chemin_global + liste_global[i] + ext;			
			//Si les images sont dans des répertoires différents ou ont des extensions différentes, ne pas mettre 'chemin + liste_images[i] + extension' mais uniquement les variables nécessaires
			}
		}
		
		// La fonction de préchargement HOME
		function prechargement_home() {
			// Pour chaque image
			for ( i = 0; i < liste_home.length; i++ ) {			
			// on créé virtuellement une image
			document.images_home_chargees[i] = new Image;			
			// On en indique la source en assemblant le chemin, le nom et l'extension
			document.images_home_chargees[i].src = chemin_home + liste_home[i] + ext;			
			//Si les images sont dans des répertoires différents ou ont des extensions différentes, ne pas mettre 'chemin + liste_images[i] + extension' mais uniquement les variables nécessaires
			}
		}
		
		// La fonction de préchargement PROJETS
		function prechargement_projets() {
			// Pour chaque image
			for ( i = 0; i < liste_projets.length; i++ ) {			
			// on créé virtuellement une image
			document.images_projets_chargees[i] = new Image;			
			// On en indique la source en assemblant le chemin, le nom et l'extension
			document.images_projets_chargees[i].src = chemin_projets + liste_projets[i] + ext;			
			//Si les images sont dans des répertoires différents ou ont des extensions différentes, ne pas mettre 'chemin + liste_images[i] + extension' mais uniquement les variables nécessaires
			}
		}
		
		// La fonction de préchargement BIG_IMG
		function prechargement_big_img() {
			// Pour chaque image
			for ( i = 0; i < liste_big_img.length; i++ ) {			
			// on créé virtuellement une image
			document.big_img_chargees[i] = new Image;			
			// On en indique la source en assemblant le chemin, le nom et l'extension
			document.big_img_chargees[i].src = chemin_big_img + liste_big_img[i] + ext;			
			//Si les images sont dans des répertoires différents ou ont des extensions différentes, ne pas mettre 'chemin + liste_images[i] + extension' mais uniquement les variables nécessaires
			}
		}
		
		// La fonction de préchargement IMAGES PAGE ENTREPRISE
		function prechargement_entreprise() {		
			// Pour chaque image
			for ( i = 0; i < liste_entreprise.length; i++ ) {			
			// on créé virtuellement une image
			document.images_entreprise_chargees[i] = new Image;			
			// On en indique la source en assemblant le chemin, le nom et l'extension
			document.images_entreprise_chargees[i].src = chemin_entreprise + liste_entreprise[i] + ext;			
			//Si les images sont dans des répertoires différents ou ont des extensions différentes, ne pas mettre 'chemin + liste_images[i] + extension' mais uniquement les variables nécessaires
			}
		}

		/*	FONCTION ALL PRELOADS : LANCE TOUS LES PRECHARGEMENTS	*/
		
		function all_preloads() {		
			prechargement_global();
			prechargement_home();
			prechargement_projets();
			prechargement_big_img();
			prechargement_entreprise();
		}



$(document).ready(function() {

	/*	Corrige la mauvaise qualité des png sur IE7	*/
	if(navigator.appName == 'Microsoft Internet Explorer'){
		$(".mini").css('background-color', '#f3f3f3');
	}


/*						*/
/*	ANIMATION DU MENU	*/
/*						*/
	
	$("#topnav .li_unactive").prepend("<span></span>"); //Throws an empty span tag right before the a tag

	$("#topnav .li_unactive").each(function() { //For each list item...
		var linkText = $(this).find("a").html(); //Find the text inside of the <a> tag
		$(this).find("span").show().html(linkText); //Add the text in the <span> tag
	}); 

	
	if(navigator.appName !== 'Microsoft Internet Explorer'){
	
		$("#topnav .li_unactive").hover(function() {	//On hover...
			$(this).find("span").stop().animate({
				marginTop: "-104" //Find the <span> tag and move it up 104 pixels
			}, 450);
			$("ul#topnav .li_unactive a").css('opacity', '1');
			$("ul#topnav .li_unactive a").css('filter', 'alpha(opacity=100)');
			} , function() { //On hover out...
			$(this).find("span").stop().animate({
				marginTop: "0"  //Move the <span> back to its original state (0px)
			}, 400);
		});
		
	}
	
	if(navigator.appName == 'Microsoft Internet Explorer'){

		$("#topnav .li_unactive").hover(function() {	//On hover...
			$(this).find("span").stop().animate({
				marginTop: "-52" //Find the <span> tag and move it up 52 pixels
			}, 225);
			$("ul#topnav .li_unactive a").css('opacity', '1');
			$("ul#topnav .li_unactive a").css('filter', 'alpha(opacity=100)');
			} , function() { //On hover out...
			$(this).find("span").stop().animate({
				marginTop: "0px"  //Move the <span> back to its original state (0px)
			}, 200);
		});
	
	}
	
	
/*							*/
/*	ANIMATION DES SLOGANS	*/
/*							*/

/*	$(".slogans").stop().animate({marginLeft: "0"}, 700);	*/

	
/*							*/
/*		CURSOR POINTER		*/
/*							*/

	$(".cursor").css('cursor', 'pointer');


/*										*/
/*	ROLLOVER DES FLECHES DANS LES LIENS	*/
/*										*/
	
	$('.lien').mouseover(function() {
		$(".lien_fleche", this).css('background-image', 'url(../images/global/fleche_bleue_double_rollover.png)');
	});
	
	$('.lien').mouseout(function() {
		$(".lien_fleche", this).css('background-image', 'url(../images/global/fleche_bleue_double_default.png)');
	});



/*										*/
/*	ROLLOVER DES FLECHES RECRUTEMENT	*/
/*										*/

	$('#lien_recrutement').mouseover(function() {
		$("#lien_fleche_recrutement").css('background-image', 'url(../images/home/fleche_jaune_double_rollover.png)');
		$('#lien_recrutement p').css('color', '#5a4502');
	});
	
	$('#lien_recrutement').mouseout(function() {
		$("#lien_fleche_recrutement").css('background-image', 'url(../images/home/fleche_jaune_double_default.png)');
		$('#lien_recrutement p').css('color', '#846403');
	});
	
	

/*									*/
/*		LIEN DANS QUOI DE NEUF		*/
/*									*/
	
	$('#lien_quoi_de_neuf').mouseover(function() {
		$(this).css('color', '#00333b');
	});
	
	$('#lien_quoi_de_neuf').mouseout(function() {
		$(this).css('color', 'white');
	});



/*						*/
/*	PAGE ENTREPRISE		*/
/*						*/
	

	$('div[alt]').qtip({
		position: {
			at: 'top left', 
  		 },
   		content: {
      		attr: 'alt'
   		}
   	});	




/*					*/
/*	PAGE PROJETS	*/
/*					*/
	
	

	/*		LIEN DANS QUOI DE NEUF		*/
		
		$('.button_download').mouseover(function() {
			$(this).css('background-image', 'url(../images/projets/button_dl_rollover.png)');
			$('.center_vertical').css('margin-top', '14px');
		});
		
		$('.button_download').mouseout(function() {
			$(this).css('background-image', 'url(../images/projets/button_dl_default.png)');
			$('.center_vertical').css('margin-top', '12px');
		});


	/*		ROLLOVER BUTTON CLOSE (BLOC QR CODES)		*/
		
		$('#button_close').mouseover(function() {
			$(this).css('background-image', 'url(../images/projets/close_rollover.png)');
		});
		
		$('#button_close').mouseout(function() {
			$(this).css('background-image', 'url(../images/projets/close_default.png)');
		});


	
	/* 	TRI DYNAMIQUE DES MINIATURES DES PROJETS	*/


	// get the action filter option item on page load
	var $filterType = $('#filterOptions li.active a').attr('class');
	
	// get and assign the ourHolder element to the $holder varible for use later
	var $miniatures = $('ul.allMiniatures');
	
	// clone all items within the pre-assigned $holder element
	var $data = $miniatures.clone();
	
	// attempt to call Quicksand when a filter option item is clicked
	$('#filterOptions li a').click(function(e) {
		// reset the active class on all the buttons
		$('#filterOptions li').removeClass('active');
		
		// assign the class of the clicked filter option element to our $filterType variable
		var $filterType = $(this).attr('class');
		$(this).parent().addClass('active');
		
		if ($filterType == 'tous') {
			// assign all li items to the $filteredData var when the 'All' filter option is clicked
			var $filteredData = $data.find('li');
		} 
		else {
			// find all li elements that have our required $filterType values for the data-type element
			var $filteredData = $data.find('li[data-type=' + $filterType + ']');
		}
		
		// call quicksand and assign transition parameters
		$miniatures.quicksand(
			$filteredData,
			{
				duration: 600,
				easing: 'jswing'
			},
			// for a reason we don't know, when quicksand is done, it removes all event listeners from the objects 
			// used in the animation so we need to reapply the previous setup (adding event listeners mostly)
			setupProject 
		);
		return true; 
	});

	setupProject();    
	
});


	var var_current_big_img = 16 ;

	
	/* 	AFFICHAGE DES PROJETS EN GRAND EN CLIQUANT SUR LES MINIATURES	*/
	
	function img_change(numProjet)
	{

		if(numProjet == var_current_big_img){
			
			}
		
		else{
			
			if(navigator.appName !== 'Microsoft Internet Explorer'){
			
				$("#big_img").stop().animate({'opacity':'0', filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=0)','margin-left': '-40px'}, {duration : 300, easing: 'easeInBack'});
				
				setTimeout(function()
					{
						$("#big_img").css({'margin-left': '30px'});
						$("#big_img").css('background-image', 'url(../images/projets/big_img/big_img_' + numProjet + '.png)');
						$("#big_img").stop().animate({opacity:'1', filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=100)', 'margin-left': '0px'}, {duration : 300, easing: 'jswing'});														
						
						//$("#block").animate({width: "70%", opacity: 0.4, marginLeft: "0.6in", fontSize: "3em", borderWidth: "10px"}, 1500 );
						
					}, 350);
			
			}
			
			if(navigator.appName == 'Microsoft Internet Explorer'){
			
				$("#big_img").css('background-image', 'url(../images/projets/big_img/big_img_' + numProjet + '.png)');
							
			} 
			
			$(".explication_projets").css('display', 'none');
			$("#projet_" + numProjet).css('display', 'block');
			
			$('#bloc_download').css('display', 'none');		 
			
			//$(".mini").css('background-color', 'transparent');
			//$("#mini_projet_" + numProjet).css('background-color', 'white');
			
			$("#launch_icon").css('background-image', 'url(../images/projets/launch_icons/launch_icon_' + numProjet + '.png)');
			
			/*	CONTENU DE BLOC_DOWNLOAD	*/
			$('.all_downloads').css('display', 'none');	
			$('.download_' + numProjet).css('display', 'block');
			
			var_current_big_img = numProjet;

		}

	}


/* 	if(navigator.appName == 'Microsoft Internet Explorer'){

		function img_change(numProjet)
		{

			if(numProjet == var_current_big_img){
				
				}
			
			else{
			
				$("#big_img").css('background-image', 'url(../images/projets/big_img/big_img_' + numProjet + '.png)');
				
				$(".explication_projets").css('display', 'none');
				$("#projet_" + numProjet).css('display', 'block');
				
							
				$("#launch_icon").css('background-image', 'url(../images/projets/launch_icons/launch_icon_' + numProjet + '.png)');
				
				
				var_current_big_img = numProjet;

		}

	} */

	
	
function setupProject()
{
	$("ul.allMiniatures").css('height', '600px');

	
	/*		AFFICHER / ENLEVER BLOC QR CODES		*/
			
	$('.button_download').click(function() {
		$('#bloc_download').css('display', 'block');
	});
	
	$('#button_close').click(function() {
		$('#bloc_download').css('display', 'none');
	});
	


}



		//$(this).animate({scale: '+=0.33'}, {queue: false, duration: 1000});
		
		//	$('.mini').each(function(index,element)
		//		 {
		//		 	//alert(element);
		//		 	element.click(function () { alert('toto');});
		//		 });













































