//------------------------------------------
// Fonctions génériques
//------------------------------------------
var jz = {
		
	$ : function (id_el, tag)
	{
		return (typeof tag == "undefined") ? document.getElementById(id_el) : 
		(typeof id_el == "object") ? id_el.getElementsByTagName(tag) :
		document.getElementById(id_el).getElementsByTagName(tag);
	},
	
	addev : function (el, ev, fn)
	{
		return el.addevListener ? el.addevListener(ev, fn, false) :
		el.attachEvent ? el.attachEvent('on' + ev, fn) : el['on' + ev] = fn;
	},
	
	extend : function (target, ob)
	{
		for(var el in ob) {target[el] = ob[el];}
	},
	
	ev_target : function (ev) {return ev.target || ev.srcElement;},
	
	rollver : function (ev) //qqchose1.abc devient qqchose2.abc et vice-versa
	{
		var elsrc = jz.ev_target(ev);
		var sext = elsrc.src.substring((elsrc.src.length-4), (elsrc.src.length)).toString();
		var xnum = (elsrc.src.substring((elsrc.src.length-5), (elsrc.src.length-4)).toString() == "1") ? 2 : 1;
		elsrc.src = elsrc.src.substring(0, (elsrc.src.length-5)) + xnum + sext;
	},
	
	precharg : function (imgsource) //jz.precharg(["img/edit2.gif", "img/supp2.gif"]);
	{
		var imgprecharge = new Array();
		
		for(var i = 0; i< imgsource.length; i++)
		{
			imgprecharge[i] = new Image();
			imgprecharge[i].src = imgsource[i];
		}
	}
};
		
//------------------------------------------
// DOM chargé
//------------------------------------------
$(document).ready(function()
{	
	jQuery.fn.extend({
	   findPos : function()
	   {
		   obj = jQuery(this).get(0);
		   var curleft = obj.offsetLeft || 0;
		   var curtop = obj.offsetTop || 0;
		   while (obj = obj.offsetParent)
		   {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
		   }
		   return {x:curleft,y:curtop};
	   }
	});
	
	jz.changeCaptcha = function()
	{
		var nimg = '/js/crypt//cryptographp.php?cfg=0&&'+Math.round(Math.random(0)*1000)+1;
		$(".cryptogram").attr("src", nimg);
	}
	
	//----------------------------------------------------------------------------
	// GERE les erreurs de formulaire
	//----------------------------------------------------------------------------
	if($(".contest .errors").get()[0])
	{
		$(".contest .errors").each(function() {
			var pos = $(this).findPos();
			$(this).css({
				"background-color" : "#fff5f5",
				"border" : "1px solid #c4b1b1",
				"padding" : "5px 5px 5px 18px",
				"z-index" : "666",
				"position" : "absolute",
				"top" : pos.y - 198,
				"left" : pos.x + 10
			})
			.bind("mouseover", function() {
				$(this).css("display", "none");
			});
			
			setTimeout(function() {
				$(".contest .errors").animate({
					opacity : "0"
				}, 1500, function() {
							$(this).css("display", "none");
						});
			}, 3000);
		});
	}
	
	//------------------------------------------
	//Page complètement chargée
	//------------------------------------------
	$(window).bind("load", function()
	{
		//----------------------------------------------------------------------------
		// GERE le rollver des éléments via la propriété src
		//----------------------------------------------------------------------------
		var elmrol = jz.$(document.body, "img");
			
		for(var cp1 = 0, cl1 = elmrol.length; cp1 < cl1; cp1++)
		{
			if(elmrol[cp1].className.indexOf("nzrollver", 0) != -1)
			{
				jz.addev(elmrol[cp1], "mouseover", jz.rollver);
				jz.addev(elmrol[cp1], "mouseout", jz.rollver);
				elmrol[cp1].style.cursor = "pointer";
			}
		}
		
		//----------------------------------------------------------------------------
		// GERE l'effacement de l'input de la newsletter
		//----------------------------------------------------------------------------
		var el_input = {
			el : [
				".newsletter_text"
			],
			txt : [
				"Votre email"
			]
		}
		for(var cp1 = 0, cl1 = el_input.el.length; cp1 < cl1; cp1++)
		{
			if($(el_input.el[cp1] + ":not(.noinfo)").get()[0])
			{					
				$(el_input.el[cp1] + ":not(.noinfo)").bind("focus", {input : el_input, cp : cp1}, function(ev)
				{
					var cp1 = ev.data.cp;
					if($(ev.data.input.el[cp1] + ":not(.noinfo)").attr("value") == ev.data.input.txt[cp1])
					{
						$(ev.data.input.el[cp1] + ":not(.noinfo)").attr("value", "");
					}
				});
				$(el_input.el[cp1] + ":not(.noinfo)").bind("blur", {input : el_input, cp : cp1}, function(ev)
				{
					var cp1 = ev.data.cp;
					if($(ev.data.input.el[cp1] + ":not(.noinfo)").attr("value") == "")
					{
						$(ev.data.input.el[cp1] + ":not(.noinfo)").attr("value", ev.data.input.txt[cp1]);
					}
				});
			}
		}
		
		//----------------------------------------------------------------------------
		//le browser est IE6
		//----------------------------------------------------------------------------
		if(/MSIE ([0-9]{1,})/.exec(navigator.userAgent) != null && RegExp.$1 == "6")
		{
			$(".footer_separator").css("position", "static");
			$(".footer").css("position", "static");
			
			//------------------------------------------
			//correction du menu
			//------------------------------------------
			$(".menu_main a").hover(
			function()
			{
				$("span", $(this)).css("visibility", "visible");
			},
			function()
			{
				$("span", $(this)).css("visibility", "hidden");
			});
		}
		//----------------------------------------------------------------------------
		//le browser est IE7
		//----------------------------------------------------------------------------
		if(/MSIE ([0-9]{1,})/.exec(navigator.userAgent) != null && RegExp.$1 == "7")
		{
			//------------------------------------------
			//correction des input text
			//------------------------------------------
			$(".header .header_r_bottom .search_text").css("padding", "0px 0px 0px 4px");
			$(".header .header_r_bottom .search_submit").css("top", "-3px");
			$(".footer_separator .quick_newsletter .newsletter_text").css({"top" : "2px", "padding" : "4px 0px 0px 4px"});
		}
		//----------------------------------------------------------------------------
		//le browser est IE8
		//----------------------------------------------------------------------------
		if(/MSIE ([0-9]{1,})/.exec(navigator.userAgent) != null && RegExp.$1 == "8")
		{
			//------------------------------------------
			//correction des input text
			//------------------------------------------
			$(".header .header_r_bottom .search_text").css("top", "-8px");
			$(".header .header_r_bottom span").css("top", "-5px");
			$(".footer_separator .quick_newsletter .newsletter_text").css({"top" : "-3px", "padding" : "4px 0px 0px 4px"});
			$(".footer_separator .quick_newsletter .newsletter_submit").css({"top" : "4px"});
		}
		
		//----------------------------------------------------------------------------
		// GERE le switch du block twitter/facebook
		//----------------------------------------------------------------------------
		if($("#quick_conversation").get()[0])
		{			
			$("#button_twitter").bind("click", function() {
			
				$("#button_twitter")
					.removeClass("button_twitter1")
					.addClass("button_twitter2");
				
				$("#button_facebook")
					.removeClass("button_facebook2")
					.addClass("button_facebook1");
					
				$(".quick_facebook").css({"display" : "none"});
				$(".quick_twitter").css({"display" : "block"});	

				//mise à jour de la scrollbar
				$('.quick_twitter').data('jsp').reinitialise();
				setTimeout(
					function() {
						$('.quick_twitter').data('jsp').reinitialise();
					},
					1000
				);				
			});
						
			$("#button_facebook").bind("click", function() {
			
				$("#button_twitter")
					.removeClass("button_twitter2")
					.addClass("button_twitter1");
				
				$("#button_facebook")
					.removeClass("button_facebook1")
					.addClass("button_facebook2");
					
				$(".quick_facebook").css({"display" : "block"});
				$(".quick_twitter").css({"display" : "none"});
				
				//mise à jour de la scrollbar
				$('.quick_facebook').data('jsp').reinitialise();
				setTimeout(
					function() {
						$('.quick_facebook').data('jsp').reinitialise();
					},
					1000
				);
			});
		}
		
		//----------------------------------------------------------------------------
		// GERE le switch du block + lu / + commenté
		//----------------------------------------------------------------------------
		if($("#quick_lucommente").get()[0])
		{
			var el_contener = $("#quick_lucommente");
			
			$(".button_pluslus", el_contener).bind("click", function() {
			
				$(".button_pluslus", el_contener).addClass("selected");
				$(".button_pluscommente", el_contener).removeClass("selected");
					
				$(".quick_pluslu", el_contener).css({"display" : "block"});
				$(".quick_pluscommente", el_contener).css({"display" : "none"});
			});
			
			$(".button_pluscommente", el_contener).bind("click", function() {
			
				$(".button_pluslus", el_contener).removeClass("selected");
				$(".button_pluscommente", el_contener).addClass("selected");
					
				$(".quick_pluslu", el_contener).css({"display" : "none"});
				$(".quick_pluscommente", el_contener).css({"display" : "block"});
								
			});
		}
		
		if(window.location.href.indexOf('.local', 0) == -1 || true)
		{
			//----------------------------------------------------------------------------
			// GERE l'affichage du mur facebook
			//----------------------------------------------------------------------------
			
			/*$('.quick_facebook_in').fbWall({
				id : '188403914532397',
				accessToken:'206158599425293|1df31a8727c3377cea29f485.1-100000221135225|YRxEUQA5gDlA4yFvGCBI3IMYO8U',
				max : 10,
				showComments : true,
				showGuestEntries : true
			});*/
			
			$('.quick_facebook_in').fbWall({
				id:'TousAuVert',
				accessToken:'AAAC7gAoWDQ0BAOzwyKrOZBUZCBTg0gwPwPcHuN8rSu6OaF3sAwPJ3OaWBnD2p7fLzwdkB6p8ZBVKE7u3FFARBB51zt9x4mtIIP1JCUlcgZDZD',
				showGuestEntries:false,
				showComments:false,
				max:10
			});

			
			//----------------------------------------------------------------------------
			// GERE l'affichage des derniers tweet
			//----------------------------------------------------------------------------
			 jz.twitter_feed_callback = function()
			 {
				 $.ajax({
				   type: "POST",
				   url: "/medias/twitter/twitter.php",
				   data: "twitter_data=" + encodeURIComponent($("#juitterContainer").html())
				 });
			 }
			 
			 $.ajax({
				url: "/medias/twitter/twitter.php",
				async: true,
				data: '',
				success: function(reponse) {
					if(reponse != "")
					{
						$("#juitterContainer").html(reponse);
					}
					else
					{
						$("#juitterContainer").getTwitter({
							userName: "TousauVert",
							numTweets: 20,
							loaderText: "<br/>&nbsp;&nbsp;&nbsp;Chargement ...",
							slideIn: false,
							slideDuration: 750,
							showHeading: false,
							headingText: "Dernier Tweets",
							showProfileLink: false,
							showTimestamp: true
						});
					}
				}
			 });
			 
			//----------------------------------------------------------------------------
			// GERE le scroll personnalisé sur le bloc conversation
			//----------------------------------------------------------------------------
			//$('.quick_facebook').jScrollPane();
			
			$('.quick_facebook').jScrollPane({
				showArrows: false,
				verticalDragMinHeight: 96,
				verticalDragMaxHeight: 96
			});
			$('.quick_twitter').jScrollPane({
				showArrows: false,
				verticalDragMinHeight: 96,
				verticalDragMaxHeight: 96
			});
			//met à jour une fois le contenu chargé
			for(var cp1 = 1; cp1 < 4; cp1++)
			{
				setTimeout (function() {
								$('.quick_facebook').data('jsp').reinitialise();
								$('.quick_twitter').data('jsp').reinitialise();
							}, cp1 * 1000);
			}
			
		} //fin local
		
		//----------------------------------------------------------------------------
		// GERE shadowbox
		//----------------------------------------------------------------------------
				
		//----------------------------------------------------------------------------
		//Object ayant le nom "open" -> shadowbox
		//----------------------------------------------------------------------------
		var vid = $('object:has(param[value="open"])');
		
		vid.each(function() {
		
			//----------------------------------------------------------------------------
			//récupère les informations
			//----------------------------------------------------------------------------
			var pos_vid = $(this).findPos();
			var info = {
				"width" : parseInt($(this).attr("width")),
				"height" : parseInt($(this).attr("height")),
				"real_width" : parseInt($(this).attr("width")),
				"real_height" : parseInt($(this).attr("height")),
				"top" : parseInt(pos_vid.y),
				"left" : parseInt(pos_vid.x),
				"link" : $(this).attr("data"),
				"flashvars" : $(this).find('> param[name="flashvars"]')
			};
			//----------------------------------------------------------------------------
			//récupère les paramètres supplémentaires (facultatif)
			//----------------------------------------------------------------------------
			if(info.flashvars.get()[0])
			{
				var fval = info.flashvars.attr("value");
				if(fval.indexOf("x", 0) != -1)
				{
					fval = fval.split("x");
					if(fval.length == 2)
					{
						info.real_width = parseInt(fval[0]);
						if(info.real_width < 2) info.real_width = info.width;
						
						info.real_height = parseInt(fval[1]);
						if(info.real_height < 2) info.real_height = info.height;
					}
				}
			}
			//----------------------------------------------------------------------------
			//création du lien qui vient par dessus l'object pour ouvrir shadowbox
			//----------------------------------------------------------------------------
			$("body").append(
				
				//déclancheur principal
				$('<a onclick="_gaq.push([\'_trackEvent\', \'Lecture video\', \'' + info.link + '\'])" href="' + info.link + '" rel="shadowbox;width=' + info.real_width + ';height=' + info.real_height + '"></a>')
					.attr("class", (info.link.indexOf(".swf", 0) == -1) ? "vid_trigger" : "vid_trigger vid_nofond")
					.css({
						"height" : info.height + "px",
						"width" : info.width + "px",
						"top" : parseInt(info.top) + "px",
						"left" : parseInt(info.left) + "px"
					}),
				
				//button play
				$('<a onclick="_gaq.push([\'_trackEvent\', \'Lecture video\', \'' + info.link + '\'])" href="' + info.link + '" rel="shadowbox;width=' + info.real_width + ';height=' + info.real_height + '"></a>')
					.attr("class", "vid_play")
					.css({
						"top" : parseInt(info.top + (info.height / 2) - 31 + 5) + "px",
						"left" : parseInt(info.left + (info.width / 2) - 31) + "px"
					})
			);
		
		});
		
		//----------------------------------------------------------------------------
		//Lien ayant la class "openvideo" -> shadowbox
		//----------------------------------------------------------------------------
		var vid = $('.openvideo');
		
		vid.each(function() {
		
			//----------------------------------------------------------------------------
			//récupère les informations
			//----------------------------------------------------------------------------
			var vimg = $(this).find("img");
			if(!vimg.get()[0]) return;
			$(this)
				.bind("click", function() {return false;})
				.css("cursor", "normal");
			
			var pos_vid = vimg.findPos();
			var info = {
				"width" : parseInt(vimg.attr("width")),
				"height" : parseInt(vimg.attr("height")),
				"real_width" : parseInt(vimg.attr("width")),
				"real_height" : parseInt($(this).attr("height")),
				"top" : parseInt(pos_vid.y),
				"left" : parseInt(pos_vid.x),
				"link" : $(this).attr("href")
			};
			//----------------------------------------------------------------------------
			//récupère les paramètres supplémentaires (facultatif)
			//----------------------------------------------------------------------------
			if($(this).attr("title") != "")
			{
				var fval = $(this).attr("title");
				if(fval.indexOf("x", 0) != -1)
				{
					fval = fval.split("x");
					if(fval.length == 2)
					{
						info.real_width = parseInt(fval[0]);
						if(info.real_width < 2) info.real_width = info.width;
						
						info.real_height = parseInt(fval[1]);
						if(info.real_height < 2) info.real_height = info.height;
					}
				}
			}
			//----------------------------------------------------------------------------
			//création du lien qui vient par dessus l'object pour ouvrir shadowbox
			//----------------------------------------------------------------------------
			$("body").append(
				
				//déclancheur principal
				$('<a onclick="_gaq.push([\'_trackEvent\', \'Lecture video\', \'' + info.link + '\'])" href="' + info.link + '" rel="shadowbox;width=' + info.real_width + ';height=' + info.real_height + '"></a>')
					.attr("class", (info.link.indexOf(".swf", 0) == -1) ? "vid_trigger" : "vid_trigger vid_nofond")
					.css({
						"height" : info.height + "px",
						"width" : info.width + "px",
						"top" : parseInt(info.top) + "px",
						"left" : parseInt(info.left) + "px"
					}),
				
				//button play
				$('<a onclick="_gaq.push([\'_trackEvent\', \'Lecture video\', \'' + info.link + '\'])" href="' + info.link + '" rel="shadowbox;width=' + info.real_width + ';height=' + info.real_height + '"></a>')
					.attr("class", "vid_play")
					.css({
						"top" : parseInt(info.top + (info.height / 2) - 31 + 5) + "px",
						"left" : parseInt(info.left + (info.width / 2) - 31) + "px"
					})
			);
		
		});
		//----------------------------------------------------------------------------
		//Initialise shadowbox
		//----------------------------------------------------------------------------
		Shadowbox.init({
			overlayOpacity: 0.8,
			continuous:true,
			counterType:'skip',
			autoplayMovies: true
			//flashParams: {flashVars: 'image=/medias/images/block_commentmarche_example2.jpg'}
			//http://gdumas.developpez.com/temp/shadowbox/
		});
		
		//----------------------------------------------------------------------------
		//Ouvre une box en cliquant sur lampiris du footer
		//----------------------------------------------------------------------------
		$(".lampiris").bind("click", function(ev)
		{
			var lampiris_msg =
				'<div class="lampiris_msg">' +
				'<h3>Pourquoi est-ce que Lampiris soutient Tous au Vert ?</h3>' +
				'<p>Parce que Lampiris a envie de faire avancer le débat sur l’environnement, sans langue de bois (mais avec quelques jeux de mots).</p>' +
				'<p>Parce que le meilleur moyen de faire bouger les choses est de donner la parole à tous.</p>' +
				'<p>Parce qu’on peut être un fournisseur d’énergie et avoir des principes.</p>' +
				'<p>Parce que partager, dialoguer, rire et sourire ensemble, c’est aussi une forme d’énergie verte.</p>' +
				'<a href="javascript:Shadowbox.close()" class="but1">Revenir au site</a>' +
				'<a onclick="javascript:Shadowbox.close()" target="_blank" href="http://www.lampiris.be" class="but2">Aller sur lampiris.be</a>' +
				'</div>';

			Shadowbox.open({
				content:    lampiris_msg,
				player:     "html",
				title:      "",
				width:      670,
				height:     290,
				displayNav : false,
				displayCounter : false
			});
			ev.stopPropagation(ev);
			return false;
		});
		
		//----------------------------------------------------------------------------
		//Ouvre une box pour le concours
		//----------------------------------------------------------------------------
		if($(".contest_box_trigger").get()[0])
		{
			var contest_msg = $(".contest_box_trigger").html();

			Shadowbox.open({
				content:    contest_msg,
				player:     "html",
				title:      "",
				width:      570,
				height:     315,
				displayNav : false,
				displayCounter : false
			});
		}
		
		//----------------------------------------------------------------------------
		// GERE l'apparition du bloc de partage social
		//----------------------------------------------------------------------------
		/*
		var content = 
			'<div class="psocial">' + 
				'<a target="_blank" class="facebook" href="http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=' + window.location.href + '"></a>' +
				'<a target="_blank" class="twitter" href="http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url=' + window.location.href + '"></a>' +
				'<a target="_blank" class="flikr" href="#"></a>' +
				'<a target="_blank" class="netlog" href="http://api.addthis.com/oexchange/0.8/forward/netlog/offer?url=' + window.location.href + '"></a>' +
				'<a target="_blank" class="youtube" href="#"></a>' +
				'<a target="_blank" class="dailymotion" href="#"></a>' +
			'</div>';
		*/
		
		exit_partage = 2;
		
		//----------------------------------------------------------------------------
		// Place le txt twitter dans le lien footer
		//----------------------------------------------------------------------------
		if($('meta[name="twitter"]').get()[0]) //texte à envoyer à twitter disponible
		{
			var twitter_text = $('meta[name="twitter"]').attr("content");
			if(twitter_text != "")
			{
				var el = $(".footer_twitter");
				el.attr("href", el.attr("href") + "&title=" + twitter_text);
			}
		}
		
		//----------------------------------------------------------------------------
		// Ouvre le bulle au survol des boutons partages
		//----------------------------------------------------------------------------
		$(".button_partager").bind("mouseover", function() {
			
			if(exit_partage == 2)
			{
				//----------------------------------------------------------------------------
				// Bulle pour partage existante
				//----------------------------------------------------------------------------
				if($(this).find(".psocial").get()[0])
				{
					//----------------------------------------------------------------------------
					//Place le txt twitter
					//----------------------------------------------------------------------------
					/*
					if($('meta[name="twitter"]').get()[0]) //texte à envoyer à twitter disponible
					{
						var el = $(this).find('a[class="twitter"]')
						if(el.attr("href").indexOf("&title", 0) == -1 )
						{
							el.attr("href", el.attr("href") + "&title=SUPER TEXTE DELUE ICI")
						}
					}
					*/
					$(this).find(".psocial")
						.css({
							opacity : "0",
							display : "block"
						})
						.animate({
							opacity : "1"
						}, 400);
				}
				//----------------------------------------------------------------------------
				// Bulle pour partage à créer
				//----------------------------------------------------------------------------
				else
				{
					//----------------------------------------------------------------------------
					//Place le txt twitter
					//----------------------------------------------------------------------------
					if($('meta[name="twitter"]').get()[0])
					{
						var twitter_text = $('meta[name="twitter"]').attr("content");
						if(twitter_text != "")
						{
							var content = 
							'<div class="psocial">' + 
								'<a title="Facebook" target="_blank" class="facebook" href="http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=' + window.location.href + '"></a>' +
								'<a title="Twitter" target="_blank" class="twitter" href="http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url=' + window.location.href + '&title=' + twitter_text + '"></a>' +
								'<a title="Netlog" target="_blank" class="netlog" href="http://api.addthis.com/oexchange/0.8/forward/netlog/offer?url=' + window.location.href + '"></a>'
							'</div>';
						}
					}
					else //pas de texte twitter disponible
					{	
						var content = 
							'<div class="psocial">' + 
								'<a title="Facebook" target="_blank" class="facebook" href="http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=' + window.location.href + '"></a>' +
								'<a title="Twitter" target="_blank" class="twitter" href="http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url=' + window.location.href + '"></a>' +
								'<a title="Netlog" target="_blank" class="netlog" href="http://api.addthis.com/oexchange/0.8/forward/netlog/offer?url=' + window.location.href + '"></a>'
							'</div>';
					}
					$(content).appendTo(this)
						.css({
							opacity : "0",
							display : "block"
						})
						.animate({
							opacity : "1"
						}, 400);
				}
				
			}
			exit_partage = 0;
		});
		
		$(".button_partager").bind("mouseout", function() {
		
			exit_partage = 1;
			setTimeout(function() {
				
				if(exit_partage == 1)
				{
					exit_partage = 2;
					$(".psocial")
						.stop()
						.animate({
							opacity : "0"
						}, 200);
				}
			}, 100);
		});
		
		//----------------------------------------------------------------------------
		// GERE le menu horizontal de la gallerie
		//----------------------------------------------------------------------------
		if($("#carousel").get()[0])
		{
			var pos = $("#carousel").get()[0].className;
			pos = pos.substring(
						pos.indexOf("current_", 0) + 8,
						pos.indexOf("_show", 0));
			
			jQuery('#carousel').jcarousel({
				start: pos - 1,
				vertical: false,
				visible : 5,
				scroll : 3
			});
		}
		
		//----------------------------------------------------------------------------
		// Remplace les <hr> par un div ayant la class .hr
		//----------------------------------------------------------------------------
		$('<div class="hr"></div>').replaceAll("hr");
		
		//----------------------------------------------------------------------------
		// Ouvre la zone d'envoie de photo sur la page snapshot
		//----------------------------------------------------------------------------
		$(".#share_picture #submit").css("display", "none");
		if($("#share_trigger").get()[0])
		{
			$("#share_trigger").bind("click", function(ev)
			{
				$(this)
					.css({
						"border-top" : "none",
						"border-bottom" : "none"
					})
					.animate({
						'height' : '0px'
					}, 200, function() {
							$(this).css("display", "none");
						});
				
				$(".#share_picture #submit").css("display", "block");
				
				$("#share_picture")
					.animate({
						'height' : '457px'
					}, 1000);
				
				ev.stopPropagation(ev);
				return false;
			});
		}
		
		//----------------------------------------------------------------------------
		// Ouvre la liste des commentaires
		//----------------------------------------------------------------------------
		if($(".view_com").get()[0])
		{
			$(".view_com").bind("click", function(ev)
			{
				$(this)
					.css({
						"border-top" : "none",
						"border-bottom" : "none",
						"overflow" : "hidden"
					})
					.animate({
						'height' : '0px'
					}, 200, function() {
							$(this).css("display", "none");
						});
				
				$(".comment_hidden").css("display", "block");
				ev.stopPropagation(ev);
				return false;
			});
		}
		
		//----------------------------------------------------------------------------
		// Ouvre le formulaire d'envois de commentaire
		//----------------------------------------------------------------------------
		if($(".comment_form").get()[0])
		{
			$(".comment_form").css({
									"overflow" : "hidden",
									"height" : "0px"
								});
			$(".sent_com").bind("click", function(ev)
			{
				$(".sent_com")
					.css({
						"border-top" : "none",
						"border-bottom" : "none",
						"overflow" : "hidden"
					})
					.animate({
						'height' : '0px'
					}, 200, function() {
							$(this).css("display", "none");
						});
				
				$(".comment_form")
					.animate({
						'height' : '345px'
					}, 1000);
					
				ev.stopPropagation(ev);
				return false;
			});
		}
		
		//----------------------------------------------------------------------------
		// Rend semi transparent certains éléments du bloc quick_snapshot colonne droite
		//----------------------------------------------------------------------------
		$(".quick_snapshot .detail").css("opacity", "0.75");
		$(".quick_snapshot .leaf_separator").css("opacity", "0.6");
		
		//----------------------------------------------------------------------------
		// iPhone ou iPad
		//----------------------------------------------------------------------------
		if(	navigator.userAgent.match(/iPhone/i) ||
			navigator.userAgent.match(/iPod/i) ||
			navigator.userAgent.match(/iPad/i))
		{
			$(".header")
				.css("width", "1275px");
			
			$(".menu_main")
				.css("width", "1275px")
				.css("height", "53px")
				.css("margin-bottom", "-1px")
				.css("overflow-x", "hidden")
				.css("background-position", "left -2px")
				.css("overflow", "hidden");
			
			$(".footer_separator")
				.css("width", "1275px");
			
			$(".footer")
				.css("width", "1275px");
			
			$(".content_column_left")
				.css("margin-left", "-1px");
		}
		
		//----------------------------------------------------------------------------
		// Opera
		//----------------------------------------------------------------------------
		if(navigator.userAgent.match(/Opera/i))
		{
			$(".block_comment .headband1 strong")
				.css("padding-left", "10px");
		}
	});
});




















