/* Scripts pour l'équipe GX
 * Utilise jQuery 1.3.2
 * Dernière modification : Gabriel 5 novembre 2009
 */

	shuffle = function(o){
		for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
		return o;
	};

	$(document).ready(function(){

		//alert(shuffle([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]));

		if(swfobject.hasFlashPlayerVersion("9.0.0")) {
			var params = {};
			params.wmode = "transparent";
			swfobject.embedSWF("/images/fr/gx_photos.swf", "photo", "470", "575", "9.0.0", "expressInstall.swf", null, params);
		}
		else {
			//* Chargement de la page
			var qui = shuffle(["yan","gab","marienoel","luc","mickael","kevin","sonia","jf","gaetan","michelle", ]);
			var qui_nom = $("#thumbs").find("div[img=gx_" + qui[0] + "]").attr('nom');
			var attr_courriel = $("#thumbs").find("div[img=gx_" + qui[0] + "]").attr('courriel');
			
			$("#nom").html(qui_nom);
			courriel = (attr_courriel != "null"?attr_courriel + "<em>@</em>gxcommunication.com":null);
			courriellien = (attr_courriel != "null"?attr_courriel:null);
			$("#courriel a").html(courriel);
			$("#courriel a").attr("href", "mailto:" + courriellien + "@gxcommunication.com");
			$("#photo").css("background", "url(/images/fr/gx_" + qui[0] + ".png) 122px 30px no-repeat");

			//* Clic sur l'équipe
			$(".th").click(function(){
				$("#nom").html($(this).attr("nom"));
				$("#nom").fadeIn("slow");
				$("#courriel a").hide();
				var attr_courriel = $(this).attr("courriel");
				courriel = (attr_courriel != "null"?attr_courriel + "<em>@</em>gxcommunication.com":null);
				courriellien = (attr_courriel != "null"?attr_courriel:null);
				if (courriel){
					$("#courriel a").fadeIn("slow");
					$("#courriel a").html(courriel);
					$("#courriel a").attr("href", "mailto:" + courriellien + "@gxcommunication.com");
				}
				img = $(this).attr("img");
				$("#photo").css("background", "url(/images/fr/" + img + ".png) 122px 30px no-repeat");
			});
		}
	});
