/*
* vertical news ticker
* Tadas Juozapaitis ( kasp3rito@gmail.com )
* http://www.jugbit.com/jquery-vticker-vertical-news-ticker/
*/
(function($){
$.fn.vTicker = function(options) {
	var defaults = {
		speed: 700,
		pause: 4000,
		showItems: 3,
		animation: '',
		mousePause: true,
		isPaused: false,
		direction: 'up',
		height: 0
	};

	var options = $.extend(defaults, options);

	moveUp = function(obj2, height, options){
		if(options.isPaused)
			return;
		
		var obj = obj2.children('ul');
		
    	var clone = obj.children('li:first').clone(true);
		
		if(options.height > 0)
		{
			height = obj.children('li:first').height();
		}		
		
    	obj.animate({top: '-=' + height + 'px'}, options.speed, function() {
        	$(this).children('li:first').remove();
        	$(this).css('top', '0px');
        });
		
		if(options.animation == 'fade')
		{
			obj.children('li:first').fadeOut(options.speed);
			if(options.height == 0)
			{
			obj.children('li:eq(' + options.showItems + ')').hide().fadeIn(options.speed).show();
			}
		}

    	clone.appendTo(obj);
	};
	
	moveDown = function(obj2, height, options){
		if(options.isPaused)
			return;
		
		var obj = obj2.children('ul');
		
    	var clone = obj.children('li:last').clone(true);
		
		if(options.height > 0)
		{
			height = obj.children('li:first').height();
		}
		
		obj.css('top', '-' + height + 'px')
			.prepend(clone);
			
    	obj.animate({top: 0}, options.speed, function() {
        	$(this).children('li:last').remove();
        });
		
		if(options.animation == 'fade')
		{
			if(options.height == 0)
			{
				obj.children('li:eq(' + options.showItems + ')').fadeOut(options.speed);
			}
			obj.children('li:first').hide().fadeIn(options.speed).show();
		}
	};
	
	return this.each(function() {
		var obj = $(this);
		var maxHeight = 0;

		obj.css({overflow: 'hidden', position: 'relative'})
			.children('ul').css({position: 'absolute', margin: 0, padding: 0})
			.children('li').css({margin: 0, padding: 0});

		if(options.height == 0)
		{
			obj.children('ul').children('li').each(function(){
				if($(this).height() > maxHeight)
				{
					maxHeight = $(this).height();
				}
			});

			obj.children('ul').children('li').each(function(){
				$(this).height(maxHeight);
			});

			obj.height(maxHeight * options.showItems);
		}
		else
		{
			obj.height(options.height);
		}
		
    	var interval = setInterval(function(){ 
			if(options.direction == 'up')
			{ 
				moveUp(obj, maxHeight, options); 
			}
			else
			{ 
				moveDown(obj, maxHeight, options); 
			} 
		}, options.pause);
		
		if(options.mousePause)
		{
			obj.bind("mouseenter",function(){
				options.isPaused = true;
			}).bind("mouseleave",function(){
				options.isPaused = false;
			});
		}
	});
};
})(jQuery);


jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*/////////////////////////////////////////////////////////////////////////////////////////
						PRECHARGEMENT DES IMAGES
/////////////////////////////////////////////////////////////////////////////////////////*/
i1=new Image();
i1.src="/images/fond-item-menu-on.png";
i2=new Image();
i2.src="/images/puce-menu-petite-on.png";
i3=new Image();
i3.src="/images/btn-projet-cuisine-on.jpg";
i4=new Image();
i4.src="/images/btn-projet-sdb-on.jpg";
i5=new Image();
i5.src="/images/btn-projet-salon-on.jpg";
i6=new Image();
i6.src="/images/btn-projet-chambre-on.jpg";
i7=new Image();
i7.src="/images/btn-projet-cuisine.jpg";
i8=new Image();
i8.src="/images/btn-projet-sdb.jpg";
i9=new Image();
i9.src="/images/btn-projet-salon.jpg";
i10=new Image();
i10.src="/images/btn-projet-chambre.jpg";
i11=new Image();
i11.src="/images/cuisine-projet-titre.png";
i12=new Image();
i12.src="/images/cuisine-projet-nouveau.png";
i13=new Image();
i13.src="/images/cuisine-projet-ouvrir.png";
i14=new Image();
i14.src="/images/sdb-projet-titre.png";
i15=new Image();
i15.src="/images/sdb-projet-nouveau.png";
i16=new Image();
i16.src="/images/sdb-projet-ouvrir.png";
i17=new Image();
i17.src="/images/salon-projet-titre.png";
i18=new Image();
i18.src="/images/salon-projet-nouveau.png";
i19=new Image();
i19.src="/images/salon-projet-ouvrir.png";
i20=new Image();
i20.src="/images/chambre-projet-titre.png";
i21=new Image();
i21.src="/images/chambre-projet-nouveau.png";
i22=new Image();
i22.src="/images/cui-off.jpg";
i23=new Image();
i23.src="/images/cui-on.jpg";
i24=new Image();
i24.src="/images/sdb-off.jpg";
i25=new Image();
i25.src="/images/sdb-on.jpg";
i26=new Image();
i26.src="/images/ch-on.jpg";
i27=new Image();
i27.src="/images/ch-off.jpg";
i28=new Image();
i28.src="/images/sal-on.jpg";
i29=new Image();
i29.src="/images/sal-on.jpg";
i30=new Image();

var transition;

/*/////////////////////////////////////////////////////////////////////////////////////////
						OPTIMISATION IE6
/////////////////////////////////////////////////////////////////////////////////////////*/
$(function()
{	
	//IE6
	if($.browser.version=='6.0')
	{
		$("#fondDecoration").css("background", "none");
		$("#fondDecoration").css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"/images/fond-decoration.png\", sizingMethod=\"image\")");
		$("#menuProjetOmbreHaut").css("background", "none");
		$("#menuProjetOmbreHaut").css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"/images/ombre-menu-projet-haut.png\", sizingMethod=\"image\")");
		$("#menuProjetOmbreDroite").css("background", "none");
		$("#menuProjetOmbreDroite").css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"/images/ombre-menu-projet-droite.png\", sizingMethod=\"image\")");
		$("#menuProjetOmbreBas").css("background", "none");
		$("#menuProjetOmbreBas").css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"/images/ombre-menu-projet-bas.png\", sizingMethod=\"image\")");
		$("#menuProjetOmbreGauche").css("background", "none");
		$("#menuProjetOmbreGauche").css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"/images/ombre-menu-projet-gauche.png\", sizingMethod=\"image\")");
		$("#dockComplet").css("margin-left", "22px");
	}

	//IE7
	if($.browser.version=='7.0')
	{
		$("#dockComplet").css("margin-left", "22px");
	}

});
/*/////////////////////////////////////////////////////////////////////////////////////////
						**Changement dans le formulaire d'inscription**
/////////////////////////////////////////////////////////////////////////////////////////*/


$(function()
{
	
	$("#statut1").click(function()
	{
		$("#statutpro2").css("display" , "none");
		$("#statutvisiteur2").css("display" , "block");

	});

	$("#statut2").click(function()
	{
		$("#statutpro2").css("display" , "block");
		$("#statutvisiteur2").css("display" , "none");
	});	
	
});

// ajoute une liste deroulante contenant les catégories de pro								
function liste_deroulante_categ(idliste){

	var new_id_liste = parseInt(idliste)+1;
	var button_ajout = '<input type="hidden" name="nb_categ" value="'+idliste+'"><span style="color:#9D2C2D;font-size:13px;" class="hand" onclick="liste_deroulante_categ(\''+new_id_liste+'\');"><img src="images/picto_add_categ_pro.png" class="picto_add_categ"><span style="margin-left:20px;"> Ajouter une cat&eacute;gorie </span></span>';
		
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_inscription", 
		   data: "type=2&idliste="+idliste, 
		   success: function(msg){ 
				$('#les_liste_categ').append(msg); 
				$('#ajout_categ').html(button_ajout); 
			}
		});
}
function fermerlightbox()
{
	document.getElementById("conditions").style.display="none";
}

// affiche les conditions générales d'utilisation lightbox
function ouvrirlightbox(){
	$.ajax({ 
	   type: "POST", 
	   url: "spip.php?page=Ajax_inscription", 
		data: "type=1", 
	   success: function(msg){ 
			$("#les_conditions").html(""+msg+"");
			var hauteur =document.documentElement.scrollHeight;
			document.getElementById("conditions").style.height=parseInt(hauteur)+'px';
			document.getElementById("conditions").style.display="block";
		}
	});
}



// modifie le css des champs erronées lors de l'inscription
function couleur(obj) {
	obj.style.backgroundColor = "#CFCBC3";
	obj.style.color = "#9D2C2D";
	obj.style.borderColor = "#9D2C2D";
}
/*/////////////////////////////////////////////////////////////////////////////////////////
						MODIFICATION EN AJAX DE SES INFOS DANS MON COMPTE
/////////////////////////////////////////////////////////////////////////////////////////*/
function masquer_msg_infos(nom_div)
{
	$("div#"+nom_div+"").html('');
	//$("#"+nom_div+"").animate({height:0}, 500);
	//document.getElementById(""+nom_div+"").style.display="none";
}
$(function ()
{
	$("#ModifCompteGenerale").submit(function() {
			
			//$("#messageInfos").height('15');
			
			//$("#messageInfos").css({  background: "white" });
			$("#messageInfos").html('<img id="ajaxloader" src="/IMG/gif/ajax-loader_Mon_Compte.gif" alt="Modifications en cours">');
			//$("#messageInfos").fadeIn();
			
			
			//document.getElementById("messageInfos").style.display="block";
			document.getElementById("coordonnees").style["filter"] = "alpha(opacity='50')";
			document.getElementById("coordonnees").style["-moz-opacity"] = '0.5';
			document.getElementById("coordonnees").style["-khtml-opacity"] =' 0.5';
			document.getElementById("coordonnees").style["opacity"] = '0.5';

			$.ajax({
				type: "POST",
				url: "spip.php?page=Ajax_modifDonneesCompte&var_mode=recalcul",
				data:"statut="+$("#statut").val()+"&pays="+$("#pays_modif").val()+"&TypeCompte="+$("#TypeCompte").val()+"&id_auteur="+$("#idAuteur").val()+"&nom="+$("#nom").val()+"&prenom="+$("#prenom").val()+"&adresse="+$("#adresse").val()+"&adresse2="+$("#adresse2").val()+"&cp="+$("#code_postal_modif").val()+"&ville="+$("#ville").val()+"&telephone="+$("#telephone").val()+"&email="+$("#email").val(),
				success: function(retour){			
				
					$("div#messageInfos").html(retour);
					
					document.getElementById("coordonnees").style["filter"] = "";
					document.getElementById("coordonnees").style["-moz-opacity"] = '';
					document.getElementById("coordonnees").style["-khtml-opacity"] ='';
					document.getElementById("coordonnees").style["opacity"] = '';
					//document.getElementById("messageInfos").style.display="none";
					setTimeout("masquer_msg_infos('messageInfos')",1000);
   

				}

		});
	return false;
	});
});

$(function ()
{
	$("#ModifCompteEntreprise").submit(function() {
			
			zoneAlert=($('input[type=radio][name=lieu_alert]:checked').attr('value'));
			
			var nbActivite=document.forms['ModifCompteEntreprise'].elements['activite[]'].length;
			var lienSuite='';
			for(i=0; i<nbActivite; i++)
			{
				valeurCheck=0;
				if(document.forms['ModifCompteEntreprise'].elements['activite[]'][i].checked!='')
				{
					valeurCheck=1;
				}				
				lienSuite+='&act'+document.forms['ModifCompteEntreprise'].elements['activite[]'][i].value+'='+valeurCheck;
			}			
			
			$("#messageInfosEntreprise").html('<img id="ajaxloader" src="/IMG/gif/ajax-loader_Mon_Compte.gif" alt="Modifications en cours">');
			document.getElementById("messageInfosEntreprise").style.display="block";
			document.getElementById("infosEntreprise").style["filter"] = "alpha(opacity='50')";
			document.getElementById("infosEntreprise").style["-moz-opacity"] = '0.5';
			document.getElementById("infosEntreprise").style["-khtml-opacity"] =' 0.5';
			document.getElementById("infosEntreprise").style["opacity"] = '0.5';
			var compte = "entreprise";
			
			if($('input[type=checkbox][name=alert]').attr('checked')==true)
			{
				alerteCond='on';
			}
			else
			{
				alerteCond='';
			}
		
			$.ajax({
			
				type: "POST",
				url: "spip.php?page=Ajax_modifDonneesCompte&var_mode=recalcul",
				data:"description_societe="+$('#description_societe').val()+"&raisonSociale="+$("#raisonSociale").val()+"&alerte="+alerteCond+"&lieuAlert="+zoneAlert+"&zoneCha="+$("#zone_chalandise").val()+"&TypeCompte="+compte+"&id_auteur="+$("#idAuteur").val()+"&siren="+$("#siren").val()+"&nomSiteWeb="+$("#nomSiteWeb").val()+"&UrlSiteWeb="+$("#UrlSiteWeb").val()+lienSuite,
				success: function(retour){
				
					$("div#messageInfosEntreprise").html(retour);
					document.getElementById("infosEntreprise").style["filter"] = "";
					document.getElementById("infosEntreprise").style["-moz-opacity"] = '';
					document.getElementById("infosEntreprise").style["-khtml-opacity"] ='';
					document.getElementById("infosEntreprise").style["opacity"] = '';
					//document.getElementById("messageInfos").style.display="none";
					setTimeout("masquer_msg_infos('messageInfosEntreprise')",1000);
				}

		});
	return false;
	});
});


$(function ()
{
	$("#ModifCompteMdp").submit(function() {
			$("#messageInfosMdp").html('<img id="ajaxloader" src="/IMG/gif/ajax-loader_Mon_Compte.gif" alt="Modifications en cours">');
			//document.getElementById("messageInfosMdp").style.display="block";
			document.getElementById("ModifMdp").style["filter"] = "alpha(opacity='50')";
			document.getElementById("ModifMdp").style["-moz-opacity"] = '0.5';
			document.getElementById("ModifMdp").style["-khtml-opacity"] =' 0.5';
			document.getElementById("ModifMdp").style["opacity"] = '0.5';

			$.ajax({			
				type: "POST",
				url: "spip.php?page=Ajax_modifDonneesCompte",
				data:"AncienMdp="+$("#AncienMdp").val()+"&TypeCompte=motDePasse&NewMdp="+$("#NewMdp").val()+"&id_auteur="+$("#idAuteur").val()+"&NewMdpBis="+$("#NewMdpBis").val(),

				success: function(retour){

					$("div#messageInfosMdp").html(retour);
					document.getElementById("ModifMdp").style["filter"] = "";
					document.getElementById("ModifMdp").style["-moz-opacity"] = '';
					document.getElementById("ModifMdp").style["-khtml-opacity"] ='';
					document.getElementById("ModifMdp").style["opacity"] = '';
					//document.getElementById("messageInfos").style.display="none";
					setTimeout("masquer_msg_infos('messageInfosMdp')",1000);

				}

		});
	return false;
	});
});

/*/////////////////////////////////////////////////////////////////////////////////////////
						ENREGISTREMENT D'UN NOUVEAU COMMENTAIRE
/////////////////////////////////////////////////////////////////////////////////////////*/
$(function ()
{
	$("#PosterCommentaire").submit( function() {
	
	
	// à la soumission du formulaire
	tinyMCE.triggerSave(true, true);
	var nbrCarct = document.getElementById("message").value.length;
		if(nbrCarct != 0)
		{
			//alert(escape(document.getElementById("message").value));
			$.ajax({ 
			   type: "POST", 
			   url: "spip.php?page=Ajax_posterCommentaire", 
			   data: "message="+escape(document.getElementById("message").value)+"&id_auteur="+$("#idAuteur").val()+"&id_document="+$("#idDocument").val(),
			   success: function(msg){ 
			 
					// on insere le commentaire qui vient d'etre posté
					tinyMCE.execCommand('mceCleanup');
					tinyMCE.execCommand("mceInsertContent", false, '');
					$("#listeCom").html(msg);
					document.getElementById("Mode").value = '2';
					$("#dernierMsg").hide();
					$("#dernierMsg").css('height', 'auto');
					var hauteurMess=$("#dernierMsg").height();
					$("#dernierMsg").css('height', '0px');
					$("#dernierMsg").show();
					if(hauteurMess>120)
					{
						$("#dernierMsg").animate({height:hauteurMess}, 1000);
					}
					else
					{
						$("#dernierMsg").animate({height:120}, 1000);
					}
			   }

			});
		}
		else
		{
			alert('Votre message est vide');
		}
		return false; // permet de rester sur la même page à la soumission du formulaire
	});
});


/*/////////////////////////////////////////////////////////////////////////////////////////
						FORMULAIRE CONNEXION
/////////////////////////////////////////////////////////////////////////////////////////*/
function validerFormulaire()
{
	document.forms['formulaire_login'].submit();
}

function appui(){
	var entree = false;
	$("#password").keydown(function (e) {
		if(e.which == 13) {
			entree=true;
			document.forms['formulaire_login'].submit();
		}
	});
}
/*/////////////////////////////////////////////////////////////////////////////////////////
						MENU + TROPHES
/////////////////////////////////////////////////////////////////////////////////////////*/
$(function()
{	
	if($.browser.version=='7.0')
	{
		$(".menuItem").mouseover(function()
		{
			$(".menuItem",this).css("backgroundPosition","0px 3px");
		});
	}
	
	$(".menuItem").mouseover(function()
	{
		$("img", this).attr("src", "/images/puce-menu-petite-on.png");
	});

	$(".menuItem").mouseout(function()
	{
		$("img", this).attr("src", "/images/puce-menu-petite.png");
	});
	
	$(".menuSelected").mouseover(function()
	{
		$("img", this).attr("src", "/images/puce-menu-petite-selected.png");
	});
	
	$(".menuSelected").mouseout(function()
	{
		$("img", this).attr("src", "/images/puce-menu-petite-selected.png");
	});	
});

$(function()
{
	$(".tropheImgOmbre img").mouseover(function()
	{
		couleur=$(this).css("color");

		switch(couleur)
		{
			case '#e0e17b':
			case 'rgb(224, 225, 123)':
				bordure='1px solid #c9ca5b';
				couleurTexte='#575824';
				break;
			case '#97d2db':
			case 'rgb(151, 210, 219)':
				bordure='1px solid #72b8c3';
				couleurTexte='#316d76';
				break;
			case '#d9b488':
			case 'rgb(217, 180, 136)':
				bordure='1px solid #c29661';
				couleurTexte='#7e5627';
				break;
			case '#b698d6':
			case 'rgb(182, 152, 214)':
				bordure='1px solid #9c77c2';
				couleurTexte='#593382';
				break;
			case '#9B3769':
			case 'rgb(157, 44, 45)':
				bordure='1px solid #740F41';
				couleurTexte='#A4517A';
				couleur='#A4517A';
				break;
			default:
				bordure='1px solid #740F41';
				couleurTexte='#A4517A';
				break;
		}

		$("#tropheInfos").css("background-color", couleur);
		$("#tropheInfos").css("border", bordure);
		$("#tropheInfos").css("color", couleurTexte);
		infoTrophe=$(this).parent().next().html();
		$("#tropheInfos").html(infoTrophe);
		$("#tropheInfos").show();
	});

	$(".tropheImgOmbre img").mousemove(function(e)
	{
		oTop=e.pageY;
		oLeft=e.pageX;
		oTop+=20;
		oLeft+=15;
		$("#tropheInfos").css("top", oTop);
		$("#tropheInfos").css("left", oLeft);
	});

	$(".tropheImgOmbre img").mouseout(function()
	{
		$("#tropheInfos").hide();
	});

	//DOCK (Besoin de 2 déclarations...)
	function dock(dock, sMin, sMax)
	{
		this.icons = document.getElementById(dock).getElementsByTagName('img');
		this.N = this.icons.length;
		this.s = sMin;
		this.ovk = 0;
		this.pxLeft = function(o)
		{
			for(var x=-document.documentElement.scrollLeft; o != null; o = o.offsetParent) x+=o.offsetLeft;
			return x;
		}
		for(var i=0;i<this.N;i++)
		{
			with(this.icons[i])
			{
				style.width = sMin+"px";
				style.height = sMin+"px";
				className = "dockicon";
			}
		}
		this.run = function()
		{
			with(this)
			{
				for(var i=0;i<N;i++)
				{
					var o = icons[i];
					var W = parseInt(o.style.width);
					if(ov && ov.className=="dockicon")
					{
						if(ov!=ovk)
						{
							ovk=ov;
						}
						if(M) W = Math.max((s*Math.cos(((pxLeft(o)+W/2)-xm)/sMax)),sMin);
						s = Math.min(sMax,s+1);
					}
					else
					{
						s = Math.max(s-1,sMin);
						W = Math.max(W-N,sMin);
					}
					o.style.width = W+"px";
					o.style.height = W+"px";
				}
				if(s >= sMax) M = false;
			}
		}
	}

	//Définition des variables
	cuisineClick=0;
	sdbClick=0;
	salonClick=0;
	chambreClick=0;
	transition=0;
	

	//Cuisine
	$("#menuProjetCuisine").mouseover(function()
	{
		$("#menuProjetCuisine").css("background-image", "url('/images/btn-projet-cuisine-on.jpg')");
	});

	$("#menuProjetCuisine").click(function()
	{
		if(cuisineClick==0)
		{
			transition=1;
			$("#fondTropheTitre").fadeOut('fast');
			$("#menuProjetInt").css("background-color", "#e0e17b");
			$("#menuFondDefilant").animate({marginLeft:0}, 900);

			$("#menuProjetMenu").animate({marginTop:200}, 450, function()
			{
				if($("#lienProjetImgBandeau").attr("href")!='/spip.php?page=inscription')
				{
					$("#lienProjetImgBandeau").attr("href", "/spip.php?page=mes_projets&laCat=1");
				}
				//$("#lienNouveauProjet").attr("hidden", "1");
				$("#lienNouveauProjetHidden").val("1");
				$("#menuProjetMenuImgTitre").attr("src", "/images/cuisine-projet-titre.png");
				$("#menuProjetMenuImgNouveau").attr("src", "/images/cuisine-projet-nouveau.png");
				$("#menuProjetMenuImgOuvrir").attr("src", "/images/cuisine-projet-ouvrir.png");
				$("#menuProjetMenuImgTitre").css("padding-right", 135);
				$("#menuProjetMenuImgNouveau").css("padding-right", 35);
				$("#menuProjetMenu").animate({marginTop:20}, 450);
			});

			cuisineClick=1;
			sdbClick=0;
			salonClick=0;
			chambreClick=0;
			
			$("#menuProjetTitre h3").html('<img src="/images/ico-plume-blanche.png" alt="Cr\351ez votre cuisine en 3D" /> Cr\351ez votre cuisine en 3D');

			$("#dock").fadeOut(450, function()
				{
					$.ajax({
						type: "POST",
						url: "/spip.php?page=Ajax_trophe",
						data: "idCatProjet=1",
						success: function(msg){
							$("#fondTropheTitre").text('Les meilleurs projets : cuisine');
							$("#fondTropheTitre").fadeIn('fast');
							document.getElementById('dock').innerHTML=msg;
							$("#dock").css("margin-left", 0);
							$("#dock").fadeIn(450, function(){transition=0;});

							if($.browser.version!='6.0')
							{
								clearInterval(myTimer);
								var xm = xmb = ov = 0;
								var M = true;
								dock2 = new dock("dock", 61, 95);
								myTimer=setInterval("dock2.run()", 16);
							}

							$(".tropheImgOmbre img").mouseover(function()
							{
								couleur=$(this).css("color");

								switch(couleur)
								{
									case '#e0e17b':
									case 'rgb(224, 225, 123)':
										bordure='1px solid #c9ca5b';
										couleurTexte='#575824';
										break;
									case '#97d2db':
									case 'rgb(151, 210, 219)':
										bordure='1px solid #72b8c3';
										couleurTexte='#316d76';
										break;
									case '#d9b488':
									case 'rgb(217, 180, 136)':
										bordure='1px solid #c29661';
										couleurTexte='#7e5627';
										break;
									case '#b698d6':
									case 'rgb(182, 152, 214)':
										bordure='1px solid #9c77c2';
										couleurTexte='#593382';
										break;
									case '#9B3769':
									case 'rgb(157, 44, 45)':
										bordure='1px solid #740F41';
										couleurTexte='#A4517A';
										couleur='#A4517A';
										break;
									default:
										bordure='1px solid #740F41';
										couleurTexte='#A4517A';
										break;
									break;
								}

								$("#tropheInfos").css("background-color", couleur);
								$("#tropheInfos").css("border", bordure);
								$("#tropheInfos").css("color", couleurTexte);
								infoTrophe=$(this).parent().next().html();
								$("#tropheInfos").html(infoTrophe);
								$("#tropheInfos").show();
							});

							$(".tropheImgOmbre img").mousemove(function(e)
							{
								oTop=e.pageY;
								oLeft=e.pageX;
								oTop+=20;
								oLeft+=15;
								$("#tropheInfos").css("top", oTop);
								$("#tropheInfos").css("left", oLeft);
							});

							$(".tropheImgOmbre img").mouseout(function()
							{
								$("#tropheInfos").hide();
							});

						}
					});
				}
			);
		}
	});

	$("#lienNouveauProjet").click(function()
	{
	
		//var tampon_categorie = $(this).attr("hidden");
		var tampon_categorie = $("#lienNouveauProjetHidden").val();
		var tampon_session = $("#id_auteur_session").attr("value");
		
		if(tampon_session != "" || tampon_session == "0")
		{
			 open_appli('0',tampon_categorie,tampon_session);
		}
		else
		{
			window.location = "spip.php?page=inscription";
		}
	
	});

	
	//Sdb
	$("#menuProjetSdb").mouseover(function()
	{
		$("#menuProjetSdb").css("background-image", "url('/images/btn-projet-sdb-on.jpg')");
	});

	$("#menuProjetSdb").click(function()
	{
		if(sdbClick==0)
		{
			transition=1;
			$("#fondTropheTitre").fadeOut('fast');
			$("#menuProjetInt").css("background-color", "#8ad4d5");
			$("#menuFondDefilant").animate({marginLeft:-572}, 900);

			$("#menuProjetMenu").animate({marginTop:200}, 450, function()
			{
				if($("#lienProjetImgBandeau").attr("href")!='/spip.php?page=inscription')
				{
					$("#lienProjetImgBandeau").attr("href", "/spip.php?page=mes_projets&laCat=3");			
				}
				//$("#lienNouveauProjet").attr("hidden", "3");
				$("#lienNouveauProjetHidden").val("3");
				$("#menuProjetMenuImgTitre").attr("src", "/images/sdb-projet-titre.png");
				$("#menuProjetMenuImgNouveau").attr("src", "/images/sdb-projet-nouveau.png");
				$("#menuProjetMenuImgOuvrir").attr("src", "/images/sdb-projet-ouvrir.png");
				$("#menuProjetMenuImgTitre").css("padding-right", 34);
				$("#menuProjetMenuImgNouveau").css("padding-right", 34);
				$("#menuProjetMenu").animate({marginTop:20}, 450);
			});

			cuisineClick=0;
			sdbClick=1;
			salonClick=0;
			chambreClick=0;
			
			$("#menuProjetTitre h3").html('<img src="/images/ico-plume-blanche.png" alt="Cr\351ez votre salle de bain en 3D" /> Cr\351ez votre salle de bain en 3D');

			$("#dock").fadeOut(450, function()
				{
					$.ajax({
						type: "POST",
						url: "/spip.php?page=Ajax_trophe",
						data: "idCatProjet=3",
						success: function(msg){
							$("#fondTropheTitre").text('Les meilleurs projets : salle de bains');
							$("#fondTropheTitre").fadeIn('fast');
							document.getElementById('dock').innerHTML=msg;
							$("#dock").css("margin-left", 0);
							$("#dock").fadeIn(450, function(){transition=0;});

							if($.browser.version!='6.0')
							{
								clearInterval(myTimer);
								var xm = xmb = ov = 0;
								var M = true;
								dock2 = new dock("dock", 61, 95);
								myTimer=setInterval("dock2.run()", 16);
							}

							$(".tropheImgOmbre img").mouseover(function()
							{
								couleur=$(this).css("color");

								switch(couleur)
								{
									case '#e0e17b':
									case 'rgb(224, 225, 123)':
										bordure='1px solid #c9ca5b';
										couleurTexte='#575824';
										break;
									case '#97d2db':
									case 'rgb(151, 210, 219)':
										bordure='1px solid #72b8c3';
										couleurTexte='#316d76';
										break;
									case '#d9b488':
									case 'rgb(217, 180, 136)':
										bordure='1px solid #c29661';
										couleurTexte='#7e5627';
										break;
									case '#b698d6':
									case 'rgb(182, 152, 214)':
										bordure='1px solid #9c77c2';
										couleurTexte='#593382';
										break;
									case '#9B3769':
									case 'rgb(157, 44, 45)':
										bordure='1px solid #740F41';
										couleurTexte='#A4517A';
										couleur='#A4517A';
										break;
									default:
										bordure='1px solid #740F41';
										couleurTexte='#A4517A';
										break;
									break;
								}

								$("#tropheInfos").css("background-color", couleur);
								$("#tropheInfos").css("border", bordure);
								$("#tropheInfos").css("color", couleurTexte);
								infoTrophe=$(this).parent().next().html();
								$("#tropheInfos").html(infoTrophe);
								$("#tropheInfos").show();
							});

							$(".tropheImgOmbre img").mousemove(function(e)
							{
								oTop=e.pageY;
								oLeft=e.pageX;
								oTop+=20;
								oLeft+=15;
								$("#tropheInfos").css("top", oTop);
								$("#tropheInfos").css("left", oLeft);
							});

							$(".tropheImgOmbre img").mouseout(function()
							{
								$("#tropheInfos").hide();
							});
						}
					});
				}
			);
		}
	});


	//Salon
	$("#menuProjetSalon").mouseover(function()
	{
		$("#menuProjetSalon").css("background-image", "url('/images/btn-projet-salon-on.jpg')");
	});

	$("#menuProjetSalon").click(function()
	{
		if(salonClick==0)
		{
			transition=1;
			$("#fondTropheTitre").fadeOut('fast');
			$("#menuProjetInt").css("background-color", "#d9b488");
			$("#menuFondDefilant").animate({marginLeft:-1144}, 900);

			$("#menuProjetMenu").animate({marginTop:200}, 450, function()
			{
				$("#menuProjetMenu").animate({marginTop:20}, 450);
				if($("#lienProjetImgBandeau").attr("href")!='/spip.php?page=inscription')
				{
					$("#lienProjetImgBandeau").attr("href", "/spip.php?page=mes_projets&laCat=2");			
				}
				//$("#lienNouveauProjet").attr("hidden", "2");
				$("#lienNouveauProjetHidden").val("2");
				$("#menuProjetMenuImgTitre").attr("src", "/images/salon-projet-titre.png");
				$("#menuProjetMenuImgNouveau").attr("src", "/images/salon-projet-nouveau.png");
				$("#menuProjetMenuImgOuvrir").attr("src", "/images/salon-projet-ouvrir.png");
				$("#menuProjetMenuImgTitre").css("padding-right", 32);
				$("#menuProjetMenuImgNouveau").css("padding-right", 35);
			});

			cuisineClick=0;
			sdbClick=0;
			salonClick=1;
			chambreClick=0;
			
			$("#menuProjetTitre h3").html('<img src="/images/ico-plume-blanche.png" alt="Cr\351ez votre salon en 3D" /> Cr\351ez votre salon en 3D');

			$("#dock").fadeOut(450, function()
				{
					$.ajax({
						type: "POST",
						url: "/spip.php?page=Ajax_trophe",
						data: "idCatProjet=2",
						success: function(msg){
							$("#fondTropheTitre").text('Les meilleurs projets : salon - sejour');
							$("#fondTropheTitre").fadeIn('fast');
							document.getElementById('dock').innerHTML=msg;
							$("#dock").css("margin-left", 0);
							$("#dock").fadeIn(450, function(){transition=0;});

							if($.browser.version!='6.0')
							{
								clearInterval(myTimer);
								var xm = xmb = ov = 0;
								var M = true;
								dock2 = new dock("dock", 61, 95);
								myTimer=setInterval("dock2.run()", 16);
							}

							$(".tropheImgOmbre img").mouseover(function()
							{
								couleur=$(this).css("color");

								switch(couleur)
								{
									case '#e0e17b':
									case 'rgb(224, 225, 123)':
										bordure='1px solid #c9ca5b';
										couleurTexte='#575824';
										break;
									case '#97d2db':
									case 'rgb(151, 210, 219)':
										bordure='1px solid #72b8c3';
										couleurTexte='#316d76';
										break;
									case '#d9b488':
									case 'rgb(217, 180, 136)':
										bordure='1px solid #c29661';
										couleurTexte='#7e5627';
										break;
									case '#b698d6':
									case 'rgb(182, 152, 214)':
										bordure='1px solid #9c77c2';
										couleurTexte='#593382';
										break;
									case '#9B3769':
									case 'rgb(157, 44, 45)':
										bordure='1px solid #740F41';
										couleurTexte='#A4517A';
										couleur='#A4517A';
										break;
									default:
										bordure='1px solid #740F41';
										couleurTexte='#A4517A';
										break;
									break;
								}

								$("#tropheInfos").css("background-color", couleur);
								$("#tropheInfos").css("border", bordure);
								$("#tropheInfos").css("color", couleurTexte);
								infoTrophe=$(this).parent().next().html();
								$("#tropheInfos").html(infoTrophe);
								$("#tropheInfos").show();
							});

							$(".tropheImgOmbre img").mousemove(function(e)
							{
								oTop=e.pageY;
								oLeft=e.pageX;
								oTop+=20;
								oLeft+=15;
								$("#tropheInfos").css("top", oTop);
								$("#tropheInfos").css("left", oLeft);
							});

							$(".tropheImgOmbre img").mouseout(function()
							{
								$("#tropheInfos").hide();
							});
						}
					});
				}
			);
		}
	});


	//Chambre
	$("#menuProjetChambre").mouseover(function()
	{
		$("#menuProjetChambre").css("background-image", "url('/images/btn-projet-chambre-on.jpg')");
	});

	/*
	$("#menuProjetChambre").click(function()
	{
		if(chambreClick==0)
		{
			transition=1;
			$("#fondTropheTitre").fadeOut('fast');
			$("#menuProjetInt").css("background-color", "#b698d6");
			$("#menuFondDefilant").animate({marginLeft:-1716}, 900);

			$("#menuProjetMenu").animate({marginTop:200}, 450, function()
			{
				$("#menuProjetMenu").animate({marginTop:20}, 450);
				if($("#lienProjetImgBandeau").attr("href")!='/spip.php?page=inscription')
				{
					$("#lienProjetImgBandeau").attr("href", "/spip.php?page=mes_projets&laCat=4");
				}
				//$("#lienNouveauProjet").attr("hidden", "4");
				$("#lienNouveauProjetHidden").val("4");
				//alert('test 2 : '+$("#lienNouveauProjetHidden").val());
				$("#menuProjetMenuImgTitre").attr("src", "/images/chambre-projet-titre.png");
				$("#menuProjetMenuImgNouveau").attr("src", "/images/chambre-projet-nouveau.png");
				$("#menuProjetMenuImgOuvrir").attr("src", "/images/chambre-projet-ouvrir.png");
				$("#menuProjetMenuImgTitre").css("padding-right", 14);
				$("#menuProjetMenuImgNouveau").css("padding-right", 35);
			});

			cuisineClick=0;
			sdbClick=0;
			salonClick=0;
			chambreClick=1;

			$("#menuProjetTitre h3").html('<img src="/images/ico-plume-blanche.png" alt="Cr\351ez votre pi\350ce en 3D" /> Cr\351ez votre pi\350ce en 3D');
			
			$("#dock").fadeOut(450, function()
				{
					$.ajax({
						type: "POST",
						url: "/spip.php?page=Ajax_trophe",
						data: "idCatProjet=4",
						success: function(msg){
							document.getElementById('dock').innerHTML=msg;
							$("#fondTropheTitre").text('Les meilleurs projets : chambre - bureau');
							$("#fondTropheTitre").fadeIn('fast');
							$("#dock").css("margin-left", 0);
							$("#dock").fadeIn(450, function(){transition=0;});

							if($.browser.version!='6.0')
							{
								clearInterval(myTimer);
								var xm = xmb = ov = 0;
								var M = true;
								dock2 = new dock("dock", 61, 95);
								myTimer=setInterval("dock2.run()", 16);
							}

							$(".tropheImgOmbre img").mouseover(function()
							{
								couleur=$(this).css("color");

								switch(couleur)
								{
									case '#e0e17b':
									case 'rgb(224, 225, 123)':
										bordure='1px solid #c9ca5b';
										couleurTexte='#575824';
										break;
									case '#97d2db':
									case 'rgb(151, 210, 219)':
										bordure='1px solid #72b8c3';
										couleurTexte='#316d76';
										break;
									case '#d9b488':
									case 'rgb(217, 180, 136)':
										bordure='1px solid #c29661';
										couleurTexte='#7e5627';
										break;
									case '#b698d6':
									case 'rgb(182, 152, 214)':
										bordure='1px solid #9c77c2';
										couleurTexte='#593382';
										break;
									default:
										bordure='';
										couleurTexte='';
									break;
								}

								$("#tropheInfos").css("background-color", couleur);
								$("#tropheInfos").css("border", bordure);
								$("#tropheInfos").css("color", couleurTexte);
								infoTrophe=$(this).parent().next().html();
								$("#tropheInfos").html(infoTrophe);
								$("#tropheInfos").show();
							});

							$(".tropheImgOmbre img").mousemove(function(e)
							{
								oTop=e.pageY;
								oLeft=e.pageX;
								oTop+=20;
								oLeft+=15;
								$("#tropheInfos").css("top", oTop);
								$("#tropheInfos").css("left", oLeft);
							});

							$(".tropheImgOmbre img").mouseout(function()
							{
								$("#tropheInfos").hide();
							});
						}
					});
				}
			);
		}
	});*/
	

	//Mouseout
	$(".menuProjetItem").mouseout(function()
	{
	
		if(cuisineClick==0)
		{
			$("#menuProjetCuisine").css("background-image", "url('/images/btn-projet-cuisine.jpg')");
		}

		if(sdbClick==0)
		{
			$("#menuProjetSdb").css("background-image", "url('/images/btn-projet-sdb.jpg')");
		}

		if(salonClick==0)
		{
			$("#menuProjetSalon").css("background-image", "url('/images/btn-projet-salon.jpg')");
		}

		if(chambreClick==0)
		{
			$("#menuProjetChambre").css("background-image", "url('/images/btn-projet-chambre.jpg')");
		}
	});


	//Clic
	/* $(".menuProjetItem").click(function()
	{
		$("#menuProjetDefault").animate({marginTop:-80}, 900);
	}); */
	
	/*$("#menuProjetChambre").click(function()
	{
		$("#menuProjetDefault").animate({marginTop:-80}, 900);
	});*/
	
	var animationTrophee=0;
	var animationObjet;

	//Trophes
	$("#fondTrophe").mouseover(function()
	{
		if(animationTrophee==0)
		{
			animationTrophee=1;
			$("#fondTropheTitre").fadeOut('fast',function()
			{
				animationObjet=$("#dock").animate({paddingTop:5}, 100, function()
				{
					animationTrophee=0;
				});
			});			
		}
	});

	$("#colonneCentre").mouseover(function()
	{
		animationObjet.stop();
		animationTrophee=1;		
		$("#dock").animate({paddingTop:35}, 100, function()
		{
			$("#fondTropheTitre").fadeIn('fast',function()
			{
				animationTrophee=0;
			});
		});
	});
	
	$("#menuConnexion").mouseover(function()
	{
		animationObjet.stop();
		animationTrophee=1;		
		$("#dock").animate({paddingTop:35}, 100, function()
		{
			$("#fondTropheTitre").fadeIn('fast',function()
			{
				animationTrophee=0;
			});
		});
	});
	
	$("#menuProjetInt").mouseover(function()
	{
		animationObjet.stop();
		animationTrophee=1;		
		$("#dock").animate({paddingTop:35}, 100, function()
		{
			$("#fondTropheTitre").fadeIn('fast',function()
			{
				animationTrophee=0;
			});
		});
	});

	$("#colonneDroite").mouseover(function()
	{
		animationObjet.stop();
		animationTrophee=1;		
		$("#dock").animate({paddingTop:35}, 100, function()
		{
			$("#fondTropheTitre").fadeIn('fast',function()
			{
				animationTrophee=0;
			});
		});	
	});

	$("#colonneGauche").mouseover(function()
	{
		animationObjet.stop();
		animationTrophee=1;		
		$("#dock").animate({paddingTop:35}, 100, function()
		{
			$("#fondTropheTitre").fadeIn('fast',function()
			{
				animationTrophee=0;
			});
		});
	});

	var animationTropheGaucheDroite=0;
	
	$("#fondTropheGauche").click(function()
	{
		if(animationTropheGaucheDroite==0)
		{
			animationTropheGaucheDroite=1;
			marginLeft=$("#dock").css("margin-left");
			marginLeft=parseInt(marginLeft);
			if(isNaN(marginLeft) || marginLeft==0)
			{
				marginLeft=0;
			}
			else
			{
				marginLeft+=63;
			}
			$("#dock").animate({marginLeft:marginLeft}, 400,function()
			{
				animationTropheGaucheDroite=0;
			});
		}
	});

	$("#fondTropheDroite").click(function()
	{
		if(animationTropheGaucheDroite==0)
		{
			animationTropheGaucheDroite=1;
			marginLeft=$("#dock").css("margin-left");
			marginLeft=parseInt(marginLeft);
			mode='';

			if(cuisineClick==1)
			{
				mode=1;
			}

			if(sdbClick==1)
			{
				mode=2;
			}

			if(salonClick==1)
			{
				mode=3;
			}

			if(chambreClick==1)
			{
				mode=4;
			}

			$.ajax({
				type: "POST",
				url: "/spip.php?page=Ajax_tropheAjout",
				data: "idCatProjet="+mode,
				success: function(msg){
					$("#dock").html($("#dock").html()+msg);
					if(isNaN(marginLeft) || marginLeft==0)
					{
						marginLeft=-63;
					}
					else
					{
						marginLeft-=63;
					}
					$("#dock").animate({marginLeft:marginLeft}, 400, function()
					{
						animationTropheGaucheDroite=0;
						if($.browser.version!='6.0')
						{
							clearInterval(myTimer);
							var xm = xmb = ov = 0;
							var M = true;
							dock2 = new dock("dock", 61, 95);
							myTimer=setInterval("dock2.run()", 16);
						}
						
						$(".tropheImgOmbre img").mouseover(function()
						{
							couleur=$(this).parent().css("color");

							switch(couleur)
							{
								case '#e0e17b':
								case 'rgb(224, 225, 123)':
									bordure='1px solid #c9ca5b';
									couleurTexte='#575824';
									break;
								case '#97d2db':
								case 'rgb(151, 210, 219)':
									bordure='1px solid #72b8c3';
									couleurTexte='#316d76';
									break;
								case '#d9b488':
								case 'rgb(217, 180, 136)':
									bordure='1px solid #c29661';
									couleurTexte='#7e5627';
									break;
								case '#b698d6':
								case 'rgb(182, 152, 214)':
									bordure='1px solid #9c77c2';
									couleurTexte='#593382';
									break;
								case '#9B3769':
								case 'rgb(157, 44, 45)':
									bordure='1px solid #740F41';
									couleurTexte='#A4517A';
									couleur='#A4517A';
									break;
								default:
									bordure='1px solid #740F41';
									couleurTexte='#A4517A';
									break;
							}

							$("#tropheInfos").css("background-color", couleur);
							$("#tropheInfos").css("border", bordure);
							$("#tropheInfos").css("color", couleurTexte);
							infoTrophe=$(this).parent().next().html();
							$("#tropheInfos").html(infoTrophe);
							$("#tropheInfos").show();
						});

						$(".tropheImgOmbre img").mousemove(function(e)
						{
							oTop=e.pageY;
							oLeft=e.pageX;
							oTop+=20;
							oLeft+=15;
							$("#tropheInfos").css("top", oTop);
							$("#tropheInfos").css("left", oLeft);
						});

						$(".tropheImgOmbre img").mouseout(function()
						{
							$("#tropheInfos").hide();
						});
					});
				}
			});
		}
	});	
});

$(document).ready(function()
{
	$("#menuProjetDefault").animate({marginTop:-80}, 900);
	$("#menuProjetChambre").css("background-image", "url('/images/btn-projet-chambre-on.jpg')");
	
	//$("#fondTropheTitre").fadeOut('fast');
	//$("#menuProjetInt").css("background-color", "#b698d6");
	$("#menuProjetInt").css("background-color", "#9B3769");
	$("#fondTropheTitre").text('Les meilleurs projets');
	$("#menuFondDefilant").animate({marginLeft:-1716}, 900, function()
	{		
		/*$.ajax({
			type: "POST",
			url: "/spip.php?page=Ajax_trophe&var_mode=recalcul",
			async: false,
			data: "idCatProjet=4",
			success: function(msg){
				
				$("#fondTropheTitre").fadeIn('fast');
				$("#dock").css("margin-left", "0px");
				$('#dock').html(msg);
			}
		});*/
	});

	$("#menuProjetMenu").animate({marginTop:200}, 450, function()
	{
		$("#menuProjetMenu").animate({marginTop:20}, 450);
		if($("#lienProjetImgBandeau").attr("href")!='/spip.php?page=inscription')
		{
			$("#lienProjetImgBandeau").attr("href", "/spip.php?page=mes_projets&laCat=5");
		}
		$("#lienNouveauProjetHidden").val("5");
		$("#menuProjetMenuImgTitre").attr("src", "/images/img-beta.png");
		$("#menuProjetMenuImgNouveau").attr("src", "/images/menu-btn-projet-nouveau.png");
		$("#menuProjetMenuImgOuvrir").attr("src", "/images/menu-btn-projet-ouvrir.png");
		$("#menuProjetMenuImgTitre").css("padding-right", 14);
		//$("#menuProjetMenuImgNouveau").css("padding-right", 35);
	});
	
	$("#menuProjetTitre h3").html('<img src="/images/ico-plume-blanche.png" alt="Cr\351ez votre pi\350ce en 3D" /> Cr\351ez votre pi\350ce en 3D');
	
	cuisineClick=0;
	sdbClick=0;
	salonClick=0;
	chambreClick=1;	
});


//DOCK (Besoin de 2 déclarations...)
var xm = xmb = ov = 0;
var M = true;

function dock(dock, sMin, sMax)
{
	this.icons = document.getElementById(dock).getElementsByTagName('img');
	this.N = this.icons.length;
	this.s = sMin;
	this.ovk = 0;
	this.pxLeft = function(o)
	{
		for(var x=-document.documentElement.scrollLeft; o != null; o = o.offsetParent) x+=o.offsetLeft;
		return x;
	}
	for(var i=0;i<this.N;i++)
	{
		with(this.icons[i])
		{
			style.width = sMin+"px";
			style.height = sMin+"px";
			className = "dockicon";
		}
	}
	this.run = function()
	{
		with(this)
		{
			for(var i=0;i<N;i++)
			{
				var o = icons[i];
				var W = parseInt(o.style.width);
				if(ov && ov.className=="dockicon")
				{
					if(ov!=ovk)
					{
						ovk=ov;
					}
					if(M) W = Math.max((s*Math.cos(((pxLeft(o)+W/2)-xm)/sMax)),sMin);
					s = Math.min(sMax,s+1);
				}
				else
				{
					s = Math.max(s-1,sMin);
					W = Math.max(W-N,sMin);
				}
				o.style.width = W+"px";
				o.style.height = W+"px";
			}
			if(s >= sMax) M = false;
		}
	}
}

document.onmousemove = function(e)
{
	if(window.event) e=window.event;
	xm = (e.x || e.clientX);
	if(xm!=xmb){
		M = true;
		xmb = xm;
	}
	ov = (e.target)?e.target:((e.srcElement)?e.srcElement:null);
}
$(window).load(function()
{
	dock = new dock("dock", 61, 95);
	if($.browser.version!="6.0")
	{
		myTimer=setInterval("dock.run()", 16);
	}
});
/*////////////////////////////////////////////////////////////////////////////////////////
							TRIE GALERIE IMAGE
/////////////////////////////////////////////////////////////////////////////////////////*/
function trier(TypeTri,categ,url)
{
	/*var urlCourante=url;
	var reg=new RegExp("(&amp;)", "g");
	//permet de ne pas cumuler les critéres de tri dans l'url
	var reg2=new RegExp("?tri=((date)|(id_auteur)|(nb_visites))", "g");
	urlCourante=urlCourante.replace(reg,"&");
	urlCourante=urlCourante.replace(reg2,"");*/
	
	switch(categ)
	{
		case 1:
			nomCateg='cuisine';
			break;
		case 2:
			nomCateg='sejour';
			break;
		case 3:
			nomCateg='salle-de-bains';
			break;
		case 4:
			nomCateg='chambre-bureaux';
			break;
	}

	document.location='/galerie/'+nomCateg+'/p1/c'+categ+'.html?tri='+TypeTri;

}

/*/////////////////////////////////--Trie dans la librairie--////////////////////////////////////////*/
function trieobjet(TypeTri,url)
{
	var urlCourante=url;

	//alert(urlCourante);
	
	//var reg=new RegExp("(&amp;)", "g");
	//permet de ne pas cumuler les critéres de tri dans l'url
	//var reg2=new RegExp("\\?tri=((constructeur)|(marque)|(prix_moyen)|(revendeur)|(stats_utilisations)|(hauteur)|(largeur)|(profondeur)|(date_ajout))", "g");
	//urlCourante=urlCourante.replace(reg,"&");
	
	tabUrl=explode('.html', urlCourante)
	//urlCourante=urlCourante.replace(reg2,"");
	document.location=tabUrl[0]+".html?tri="+TypeTri;
	
}

function explode(delimiter,string,limit){var emptyArray={0:''};if(arguments.length<2||typeof arguments[0]=='undefined'||typeof arguments[1]=='undefined')
{return null;}
if(delimiter===''||delimiter===false||delimiter===null)
{return false;}
if(typeof delimiter=='function'||typeof delimiter=='object'||typeof string=='function'||typeof string=='object')
{return emptyArray;}
if(delimiter===true){delimiter='1';}
if(!limit){return string.toString().split(delimiter.toString());}else{var splitted=string.toString().split(delimiter.toString());var partA=splitted.splice(0,limit-1);var partB=splitted.join(delimiter.toString());partA.push(partB);return partA;}}

/*////////////////////////////////////////////////////////////////////////////////////////
							DEMANDE AMI
/////////////////////////////////////////////////////////////////////////////////////////*/


function send_demande_ami(user,membre){
		
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_demande_ami", 
		   data: "user="+user+"&id_auteur="+membre,
		   success: function(msg){ 

				$("div#une_demande_ami").html(""+msg+"");
				//var hauteur =document.documentElement.scrollHeight;
				var hauteur=$('#corps').height();
				hauteur = parseInt(hauteur)+430;
				
				//alert(hauteur);
				document.getElementById("new_ami").style.height=parseInt(hauteur)+'px';
				document.getElementById("new_ami").style.display="block";
				centrer_lightbox('fond_lightbox_ami');
				
		   }

		});		
}
function centrer_lightbox(div)
{
	
		
	hauteurForm=$("#"+div).height();
	hauteurFenetre=$(window).height();
	
	hauteurEspace=(hauteurFenetre-hauteurForm)/2;
	$("#"+div).css('margin-top', (hauteurEspace-40+document.documentElement.scrollTop)+'px');
	
}	
function send_demande_ami_bis(user,membre){
			
$("div#une_demande_ami").html("<p style='padding-bottom:20px;padding-top:30px;text-align:center'><img style='margin-top:40px;' src='/images/ajax-loader_ami.gif'></p>");
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_demande_ami", 
		   data: "user="+user+"&id_auteur="+membre+"&type=envoi",
		   success: function(msg){ 

				$("div#une_demande_ami").html(""+msg+"");
				document.getElementById("amities").style.display="none";
				
				
		   }

		});		
}	
/*////////////////////////////////////////////////////////////////////////////////////////
							INSCRIPTION CONCOURS
/////////////////////////////////////////////////////////////////////////////////////////*/
function fermer_lightbox(nom_du_div)
{
	document.getElementById("nom_du_div").style.display="none";
}


function inscrip_concours(image,auteur) {
			var concours = document.getElementById("liste_concours").value;
			$("div#text_concours").html("<p style='padding-bottom:20px;padding-top:30px;text-align:center'><img style='margin-left:-10px;margin-top:40px;' src='/images/ajax-loader_ami.gif'></p>");
			
			$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_Inscrire_concours", 
		   data: "image="+image+"&auteur="+auteur+"&concours="+concours,
		   success: function(msg){ 

				$("div#text_concours").html(""+msg+"");
				document.getElementById("lien_concourir").style.display="none";
				setTimeout("fermer_lightbox('concourir')",3000);
		   }

		});

return false;
}


function InscriptionConcours(image,categorie)
{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_Inscrire_concours", 
		   data: "image="+image+"&categorie="+categorie,
		   success: function(msg){ 

				//$("div#les_concours").html(""+msg+"");
				//var hauteur = window.innerHeight;
				//alert(hauteur);
				//alert(document);
				/* var hauteur =document.documentElement.scrollHeight; */
				
				/* document.getElementById("concourir").style.height=parseInt(hauteur)+'px'; */
			//	document.getElementById("concourir").style.display="block";
				// var hauteur =document.documentElement.scrollHeight; 
				
				
				$("div#message_lightbox").html(msg);
				show_lightbox();
				centrer_lightbox('contenu_lightbox');
		   }

		});
		
		
}
/*/////////////////////////////////////////////////////////////////////////////////////////
						CHOIX AVATAR
/////////////////////////////////////////////////////////////////////////////////////////*/
$(function ()
{
	afficherPrec();
});

function afficherPrec(marginLeft)
{
	if(marginLeft != "0" )
	{
	
		$("#prec").show();

	}
	else
	{

		$("#prec").hide();
	}

};

function afficherSuiv(marginLeft)
{
	
	if(marginLeft == "-4606")
	{
		$("#suiv").hide();
	}
	else
	{
		$("#suiv").show();
	}
}; 

$(function ()
{
	$("#prec").click(function() {
	
		var temp_id_val = $('#avatar_choisi').val();
		if(isNaN(temp_id_val) || temp_id_val=='') temp_id_val=94
		else
		{
			temp_id_val = parseInt(temp_id_val)-1;
		}
		$('#avatar_choisi').val(temp_id_val);
		
		$("#prec").hide();
		marginLeft=$("#unAvatar").css("margin-left");

		marginLeft=parseInt(marginLeft);

		if(isNaN(marginLeft))
		{
			marginLeft+=98;
		}
		else
		{
			marginLeft+=98;
		}
		
		$("#unAvatar").animate({marginLeft:marginLeft},400,function(){afficherPrec(marginLeft);
		afficherSuiv(marginLeft);})

		
		return false;
	});
});

$(function ()
{
	$("#suiv").click(function() {
	
		var temp_id_val = $('#avatar_choisi').val();
		if(isNaN(temp_id_val) || temp_id_val=='') temp_id_val=96
		else
		{
			temp_id_val = parseInt(temp_id_val)+1;
		}
		$('#avatar_choisi').val(temp_id_val);
		
		$("#suiv").hide();
		marginLeft=$("#unAvatar").css("margin-left");
		
		marginLeft=parseInt(marginLeft);

		if(isNaN(marginLeft))
		{
			marginLeft-=98;
		}
		else
		{
			marginLeft-=98;
		}
		
		$("#unAvatar").animate({marginLeft:marginLeft},400,function(){afficherPrec(marginLeft);
		afficherSuiv(marginLeft);})
		
		return false;
	});
});		


/*/////////////////////////////////////////////////////////////////////////////////////////
						CHOIX AVATAR PRO INSCRIPTION
/////////////////////////////////////////////////////////////////////////////////////////*/
$(function ()
{
	afficherPrec_pro();
});

function afficherPrec_pro(marginLeft)
{
	if(marginLeft != "0" )
	{
	
		$("#prec_pro").show();

	}
	else
	{

		$("#prec_pro").hide();
	}

};

function afficherSuiv_pro(marginLeft)
{
	
	if(marginLeft == "-4606")
	{
		$("#suiv_pro").hide();
	}
	else
	{
		$("#suiv_pro").show();
	}
}; 

$(function ()
{
	$("#prec_pro").click(function() {
	
		var temp_id_val = $('#avatar_choisi_pro').val();
		if(isNaN(temp_id_val) || temp_id_val=='') temp_id_val=94;
		else
		{
			temp_id_val = parseInt(temp_id_val)-1;
		}
		$('#avatar_choisi_pro').val(temp_id_val);
		
		$("#prec_pro").hide();
		marginLeft=$("#unAvatar_pro").css("margin-left");

		marginLeft=parseInt(marginLeft);

		if(isNaN(marginLeft))
		{
			marginLeft+=98;
		}
		else
		{
			marginLeft+=98;
		}
		
		$("#unAvatar_pro").animate({marginLeft:marginLeft},400,function(){afficherPrec_pro(marginLeft);
		afficherSuiv_pro(marginLeft);})

		
		return false;
	});
});

$(function ()
{
	$("#suiv_pro").click(function() {
		
		var temp_id_val = $('#avatar_choisi_pro').val();
		if(isNaN(temp_id_val) || temp_id_val=='') temp_id_val=96;
		else
		{
			temp_id_val = parseInt(temp_id_val)+1;
		}
		$('#avatar_choisi_pro').val(temp_id_val);
	
		$("#suiv_pro").hide();
		marginLeft=$("#unAvatar_pro").css("margin-left");

		marginLeft=parseInt(marginLeft);

		if(isNaN(marginLeft))
		{
			marginLeft-=98;
		}
		else
		{
			marginLeft-=98;
		}

		
		$("#unAvatar_pro").animate({marginLeft:marginLeft},400,function(){afficherPrec_pro(marginLeft);
		afficherSuiv_pro(marginLeft);})
		
		return false;
	});
});	

function afficher_form_pro(statut)
{
	if(statut == '2')
	{
	document.getElementById('statutpro2').style.display='block';
	document.getElementById('statutvisiteur2').style.display='none';
	document.getElementById('vendeurpro').checked='checked';
	}
}

var dernier_valide_pro;
var dernier_valide;

function choix_avatar_dispo(avatar,doc_img)
{
	$("#valide_avatar_"+dernier_valide).fadeOut("slow");
	document.getElementById('avatar_choisi').value=avatar;
	$("#valide_avatar_"+doc_img).fadeIn("slow");
	dernier_valide = doc_img;

}
function choix_avatar_dispo_pro(avatar,doc_img)
{
	$("#valide_avatar_pro_"+dernier_valide_pro).fadeOut("slow");
	document.getElementById('avatar_choisi_pro').value=avatar;
	$("#valide_avatar_pro_"+doc_img).fadeIn("slow");
	dernier_valide_pro = doc_img;

}
function onglet(affiche,disparait)
{
	document.getElementById(affiche).style.display='block';
	document.getElementById(disparait).style.display='none';
}

/*///////////////////////Recherche d'un membre ////////////////////////*/


function consulter(value) {
	if(value.length == 0) { // si le champs txte est vide
		$('#suggestions').hide(); // on cache les suggestions
	} else {
		$.post("spip.php?page=Ajax_recherche_membre", {requete: ""+value+""}, function(msg){ // on envoit la valeur du champ texte dans la variable post queryString au fichier ajax
			
			if(msg.length >0) {
				//si au moins un résultat
				var resultat = msg.search(' href');
				
				if(resultat != -1)
				{
					$('#suggestions').show(); // si il y a un retour, on affiche la liste
					$('#autoSuggestionsList').html(msg); // et on remplit la liste des données
					
				}
				
			}
		});
	}
}

function remplir(thisValue,auteur) { // remplir le champ texte si une suggestion est cliquée
	$('#value').val(thisValue);
	document.forms['rechmembre'].elements['auteur'].value=auteur;
	setTimeout("$('#suggestions').hide();", 200);
}

$(document).ready( function () {
	$("#rechmembre").submit( function() {
		return $("#auteur", this).val() != "";
	});

	$("input#value").keyup( function() { // si on presse une touche du clavier en étant dans le champ texte qui a pour id value
		consulter($(this).val()) 
	});
	
	$("input#value").blur( function() { // si le champs texte perd le focus
		remplir(thisValue,auteur) 
	});
});

/*--------------Analyse champ inscription----------------*/ 

$(function ()
{
	$("#verifemail").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_email_valide", 
		   data: "email="+$("#verifemail").val(),
		   success: function(msg){ 

				$("div#profilresemail").html(msg);
			 }
		});
	});
	return false;
});

$(function ()
{
	$("#verifemail2").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_email_valide2", 
		   data: "email2="+$("#verifemail2").val(),
		   success: function(msg2){ 

				$("div#profilresemail2").html(msg2);
			 }
		});
	});
	return false;
});

$(function ()
{
	$("#verifmdp").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_mdp_valide", 
		   data: "mdp="+$("#verifmdp").val(),
		   success: function(msg){ 
				$("div#profilresmdp").html(msg);
			 }
		});
	});
	return false;
});

$(function ()
{
	$("#verifmdp2").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_mdp_valide2", 
		   data: "mdp2="+$("#verifmdp2").val(),
		   success: function(msg2){ 

				$("div#profilresmdp2").html(msg2);
			 }
		});
	});
	return false;
});


$(function ()
{
	$("#verifmdpconfirm").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_verifconfirmmdp_valide", 
		   data: "confirmmdp="+$("#verifmdpconfirm").val(),
		   success: function(msg){ 

				$("div#profilresconfirmmdp").html(msg);
			 }
		});
	});
	return false;
});

$(function ()
{
	$("#verifmdpconfirm2").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_verifunetdeux2", 
		   data: "confirmmdp2="+$("#verifmdpconfirm2").val()+"&mdp2="+$("#verifmdp2").val(),
		   success: function(msg3){ 
				$("div#profilresunetdeux2").html(msg3);
			}
		});
	});
	return false;
});

$(function ()
{
	$("#verifmdpconfirm").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_verifunetdeux", 
		   data: "confirmmdp="+$("#verifmdpconfirm").val()+"&mdp="+$("#verifmdp").val(),
		   success: function(msg4){ 
				$("div#profilresunetdeux").html(msg4);
			}
		});
	});
	return false;
});
$(function ()
{
	$("#choixAvatar").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_choix_avatar&var_mode=recalcul", 
		   data: "email="+$("#verifemail").val(),
		   success: function(msg){ 

				$("div#profilresemail").html(msg);
			 }
		});
	});
	return false;
});

$(function ()
{
	$("#veriflogin").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_login", 
		   data: "login="+$("#veriflogin").val(),
		   success: function(msg5){ 
				$("div#profillogin").html(msg5);
			}
		});
	});
	return false;
});
$(function ()
{
	$("#veriflogin2").keyup(function()
	{
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_login2", 
		   data: "login2="+$("#veriflogin2").val(),
		   success: function(msg5){ 
				$("div#profillogin2").html(msg5);
			}
		});
	});
	return false;
});

/*
				FONCTIONS QUI APPEL EN AJAX UN FICHIER (formulaire_recherche-pro.html)
			  QUI INSÉRE DANS DES LISTES DÉROULANTES LES RÉGIONS ET DÉPARTEMENTS D'UN PAYS 
		AFFICHE SEULEMENT LES RÉGIONS ET DÉPARTEMENTS PRÉSENT DANS LA TABLE spip_auteurs ==> CHAMP (CP)

FONCTIONS UTILISÉES DANS (annuaire_pro.html)		
========================================================================================================

											FONCTIONS 

========================================================================================================
*/	

function GetXmlHttpObject()
{
        var objXMLHttp=null;
        if (window.XMLHttpRequest)
                objXMLHttp=new XMLHttpRequest();
        else if (window.ActiveXObject)
                objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
        return objXMLHttp;
} 

function effacerRegionDptm()
{
	
	document.getElementById("region").innerHTML = "<option value='' selected='selected'>- - choisissez - -</option>";
	document.getElementById("departement").innerHTML ="<option value='' selected='selected'>- - choisissez - -</option>";
	//document.getElementById("ligneRegion").style.display="block";
	CalculListeRegionDptm();
}


function CalculListeRegionDptm()
{		var xmlHttp;
		
        var choixRegion = document.getElementById("region").value;
		var choixPays = document.getElementById("pays").value;
		var choixCateg = document.getElementById("categorie").value;
		
		if(choixPays=="be")
		{
				document.getElementById("libelle_departement").innerHTML = "Cantons";
		}
		else
		{
				document.getElementById("libelle_departement").innerHTML = "D&eacute;partement";
		}

        xmlHttp = GetXmlHttpObject();
        if (xmlHttp == null)
        {
                alert("Votre navigateur ne supporte pas les requêtes HTTP.");
                return false;
        }
		
        var url="spip.php?page=Ajax_formulaire_recherche_pro&var_mode=recalcul"; 
		var params = "numregion="+choixRegion+"&pays="+choixPays+"&categ="+choixCateg;
        xmlHttp.open("POST", url, true);
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
        xmlHttp.send(params);
		
		
		
        xmlHttp.onreadystatechange = function (){
                if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
                {
					if(choixRegion == "")
					{
					document.getElementById("ligneRegion").style.display="block";
					document.getElementById("regionDiv").innerHTML = xmlHttp.responseText;
					
					}
					else
					{
					document.getElementById("ligneDptm").display="block";
					document.getElementById("DptmDiv").innerHTML = xmlHttp.responseText;
					}
                }
                else
                {
					if(choixRegion == "")
					{
					document.getElementById("ligneRegion").style.display="block";
					document.getElementById("regionDiv").innerHTML = "<select><option selected='selected'>Chargement en cours...</option></select>";
					}
					else
					{
					document.getElementById("ligneDptm").style.display="block";
					document.getElementById("ligneVoisinage").style.display="block";
					document.getElementById("BtnRechercher").style.display="block";
					
					document.getElementById("DptmDiv").innerHTML = "<select><option selected='selected'>Chargement en cours...</option></select>";
					}
                }
        }
      /*  var params = "numregion="+choixRegion+"&pays="+choixPays;
        xmlHttp.open("POST", url, true);
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
        xmlHttp.send(params);*/
        return true;
}
function choix_categ(la_categ)
{	
	$("#region").html("<option value='' selected='selected'>- - choisissez - -</option>");	
	$("#departement").html("<option value='' selected='selected'>- - choisissez - -</option>");	
		$.ajax({ 
	   type: "POST", 
	   url: "spip.php?page=Ajax_formulaire_recherche_pro", 
	   data: "categ="+la_categ,
	   success: function(msg){ 

			$("#les_pays").html(""+msg+"");	
			
	   }

	});
}
/*///////////////////////////////////////////////////////////////

MOTEUR DE RECHERCHE LIBRAIRIE

//////////////////////////////////////////////////////////////*/
/*function dessus(type,type2)
{
	if(type2 == 'projet')
	{
	var img = document.getElementById(type).src;
	var search = img.search('off');
		if(search != -1)
		{
		
			document.getElementById(type).src="images/btn-lib-"+type+"-on.png";
		}
	}
	else if(type2 == 'ambiance')
	{
	
		var img = document.getElementById("amb_"+type).src;
		var search = img.search('off');
		if(search != -1)
		{
		
			document.getElementById("amb_"+type).src="IMG/png/btn_amb_"+type+"_on.png";
		}
	}
}*/
function dessus(type,type2)
{
	if(type2 == 'projet')
	{
		document.getElementById(type).src="images/btn-lib-"+type+"-on.png";
		
	}
	else if(type2 == 'ambiance')
	{
		document.getElementById("amb_"+type).src="IMG/png/btn_amb_"+type+"_on.png";
		
	}
}

function dessous(type,type2)
{
	if(type2 == 'projet')
	{
	var search = critere_projet.search(type);
		if(document.getElementById(type+'pc'+type).value != '')
		{
			document.getElementById(type).src="images/btn-lib-"+type+"-on.png";
		}
		else
		{
			document.getElementById(type).src="images/btn-lib-"+type+"-off.png";
		}
	}
	else if(type2 == 'ambiance')
	{
		var search = critere_ambiance.search(type);
		if(document.getElementById(type+'a'+type).value != '')
		{
			document.getElementById("amb_"+type).src="IMG/png/btn_amb_"+type+"_on.png";
		}
		else
		{
			document.getElementById("amb_"+type).src="IMG/png/btn_amb_"+type+"_off.png";
		}
	}
}

/*function dessous(type,type2)
{
	if(type2 == 'projet')
	{
	var search = critere_projet.search(type);
		if(search != -1)
		{
		
			document.getElementById(type).src="images/btn-lib-"+type+"-on.png";
		}
		else
		{
		
			document.getElementById(type).src="images/btn-lib-"+type+"-off.png";
		
		}
	}
	else if(type2 == 'ambiance')
	{
		
		var search = critere_ambiance.search(type);
		if(search != -1)
		{
		
			document.getElementById("amb_"+type).src="IMG/png/btn_amb_"+type+"_on.png";
		}
		else
		{
		
			document.getElementById("amb_"+type).src="IMG/png/btn_amb_"+type+"_off.png";
		
		}
	
	}
}*/
/*
function critere_on(les_projet_categ1,les_projet_categ2,les_projet_categ3,les_projet_categ4,les_ambiance1,les_ambiance2,les_ambiance3,les_ambiance4)
{
	//alert('toto');
var longueur = les_projet_categ.length;
	
	
	for(i=0;i<longueur;i++)
	{
	
		var tampon = les_projet_categ.substring(i,i+1);
		document.getElementById(tampon).src="images/btn-lib-"+tampon+"-on.png";
		critere_projet = critere_projet+tampon;
	
	}
	
	
	longueur = les_ambiance.length;
					
	for(i=0;i<longueur;i++)
	{
	
		tampon = les_ambiance.substring(i,i+1);
	
		document.getElementById("amb_"+tampon).src="IMG/png/btn_amb_"+tampon+"_on.png";
		
		critere_ambiance = critere_ambiance+tampon;
	} 
	
}*/
var critere_projet = '';
var critere_ambiance = '';
function criter_librairie(new_critere,type_recherche)
{
	
	if(type_recherche == 'projet')
	{
		var trouver;
		//trouver = critere_projet.search(new_critere)
		trouver = document.getElementById(new_critere+'pc'+new_critere).value;
		
		if(trouver == new_critere)
		{
		
			//var reg=new RegExp(""+new_critere+"", "g");
			//critere_projet = critere_projet.replace(reg,"");
			document.getElementById(new_critere+'pc'+new_critere).value = '';
			//document.getElementById('1pc').value = '';
			
			
			document.getElementById(new_critere).src="images/btn-lib-"+new_critere+"-off.png";
			
			document.form_librairie.submit();
			//alert('toto'+critere_projet);
		}
		else
		{
			document.getElementById(new_critere+'pc'+new_critere).value=new_critere;
			document.getElementById(new_critere).src="images/btn-lib-"+new_critere+"-on.png";
			//critere_projet = critere_projet + new_critere;
			//alert('toto'+critere_projet);
			
			document.form_librairie.submit();
		
			
		}
	}
	else if(type_recherche == 'ambiance')
	{
		
		var trouver;
		//trouver = critere_ambiance.search(new_critere)
		trouver = document.getElementById(new_critere+'a'+new_critere).value
	
		if(trouver != "")
		{
			//var reg=new RegExp(""+new_critere+"", "g");
			//critere_ambiance = critere_ambiance.replace(reg,"");
			document.getElementById(new_critere+'a'+new_critere).value="";
			document.getElementById("amb_"+new_critere).src="IMG/png/btn_amb_"+new_critere+"_off.png";
			document.form_librairie.submit();
		}
		else
		{
			document.getElementById(new_critere+'a'+new_critere).value=new_critere;
			document.getElementById("amb_"+new_critere).src="IMG/png/btn_amb_"+new_critere+"_on.png";
			//critere_ambiance = critere_ambiance + new_critere;
			
			
			document.form_librairie.submit();
		}
	
	}

}
function critere_on(pc1,pc2,pc3,pc4,a1,a2,a3,a4)
{

if(pc1 != ""){document.getElementById('1').src="images/btn-lib-1-on.png";document.getElementById('1pc1').value=pc1;}
if(pc2 != ""){document.getElementById('2').src="images/btn-lib-2-on.png";document.getElementById('2pc2').value=pc2;}
if(pc3 != ""){document.getElementById('3').src="images/btn-lib-3-on.png";document.getElementById('3pc3').value=pc3;}
if(pc4 != ""){document.getElementById('4').src="images/btn-lib-4-on.png";document.getElementById('4pc4').value=pc4;}


if(a1 != ""){document.getElementById("amb_1").src="IMG/png/btn_amb_1_on.png";document.getElementById('1a1').value=a1;}
if(a2 != ""){document.getElementById("amb_2").src="IMG/png/btn_amb_2_on.png";document.getElementById('2a2').value=a2;}
if(a3 != ""){document.getElementById("amb_3").src="IMG/png/btn_amb_3_on.png";document.getElementById('3a3').value=a3;}
if(a4 != ""){document.getElementById("amb_4").src="IMG/png/btn_amb_4_on.png";document.getElementById('4a4').value=a4;}

}


function critere_ambiance()
{	
	var a1='';
	var a2='';
	var a3='';
	var a4='';
	var a5='';
		$("#loader").html("<img src='../images/ajax-loader_librairie.gif'>");	
		var le_critere_projet=document.getElementById("type_projet").value;
		
		if (document.getElementById("a1").checked ){ a1='1';} else {a1='';}
		if (document.getElementById("a2").checked ){ a2='2';} else {a2='';}
		if (document.getElementById("a3").checked ){ a3='3';} else {a3='';}
		if (document.getElementById("a4").checked ){ a4='4';} else {a4='';}
		if (document.getElementById("a4").checked ){ a5='5';} else {a5='';}
		
		$.ajax({ 
	   type: "GET", 
	   url: "spip.php?page=Ajax_librairie",  
	   data: "1pc="+le_critere_projet+"&1a="+a1+"&2a="+a2+"&3a="+a3+"&4a="+a4+"&5a="+a5, 
	   success: function(msg){ 
			$("#loader").html("");	
			$("div#resultat_ajax").html(""+msg+"");	
	   }

	});
}
 /*///////////////////////////////////////////////////////////////////
 
 LIGHTBOX APPLI 3D
 
 ///////////////////////////////////////////////////////////////////*/
function open_appli(la_variante_projet,la_categ_projet,l_auteur)
{
	/* var hauteur=document.documentElement.scrollHeight;
	window.scrollTo('0','0');
	document.getElementById('appli').style.height=parseInt(hauteur)+'px';
	document.getElementById('appli_2').innerHTML =  stkobject('100%', '70%','http://www.lotissement-midi-pyrenees.com/appli3d/lotissement_teyssode.stk', null , '' , null , null , null , null , 0 , 1 , 'undefined' , 0 , 0 , 0 , 0 , 1 );
	document.getElementById('appli').style.display='block'; */
	/*$.ajax({ 
		type: "GET", 
		url: "/spip.php?page=application",  
		data: "id_variante="+la_variante_projet+"&id_utilisateur="+l_auteur+"&id_projet_categorie="+la_categ_projet+"&var_mode=recalcul", 
		success: function(msg)
		{ 
			$('#appli_2').html(msg);
			$('#appli').show();
			valHauteur=$('#page').height();
			$('#appli').css('height', (valHauteur+20)+'px');
			window.location.replace('#');
			$('#pub728X90').hide();
			$('#pub300X250').hide();
			$('#pub120X600').hide();
		}
	});*/
	
	
	if(la_categ_projet=='')
	{
		//la_categ_projet=$('#lienNouveauProjet').attr('hidden');
		la_categ_projet=$("#lienNouveauProjetHidden").val();
	}
	if(la_categ_projet==1 || la_categ_projet==3)
	{
		$("div#message_lightbox").html('Cette cat\351gorie de projet sera disponible tr\350s prochainement. En attendant, vous pouvez d\351j\340 tester les cat\351gories de "Chambre-Bureau" et "Salon-S\351jour" !');
		show_lightbox();	
		centrer_lightbox('contenu_lightbox');
	}
	else
	{
		//document.location.href="/spip.php?page=application&id_variante="+la_variante_projet+"&id_utilisateur="+l_auteur+"&id_projet_categorie="+la_categ_projet+"&var_mode=recalcul";
			$('#pub728X90').hide();
			$('#pub300X250').hide();
			$('#pub120X600').hide();
			
	var contenu = '<iframe src="http://www.decomanie.com/spip.php?page=application&id_variante='+la_variante_projet+'&id_utilisateur='+l_auteur+'&id_projet_categorie='+la_categ_projet+'&var_mode=recalcul" frameborder="0" width="850px" height="650px">';
		$.nyroModalManual({
		  content: contenu
		});
   
	}
}

function close_appli(){
	
	$('#appli').hide();
	$('#pub728X90').show();
	$('#pub300X250').show();
	$('#pub120X600').show();
}

/*////////////////////////////////////////////////////////////////

RECHERCHE LIBRAIRIE AJAX

/////////////////////////////////////////////////////////////////*/

function critere_ambiance()
{	
var a1='';
var a2='';
var a3='';
var a4='';
var a5='';
	var le_critere_projet=document.getElementById("type_projet").value;
	
	if (document.getElementById("a1").checked ){ a1='1';} else {a1='';}
	if (document.getElementById("a2").checked ){ a2='2';} else {a2='';}
	if (document.getElementById("a3").checked ){ a3='3';} else {a3='';}
	if (document.getElementById("a4").checked ){ a4='4';} else {a4='';}
	if (document.getElementById("a4").checked ){ a5='5';} else {a5='';}
	
	
	$.ajax({ 
   type: "GET", 
   url: "spip.php?page=Ajax_librairie&var_mode=recalcul", 
   data: "1pc="+le_critere_projet+"&1a="+a1+"&2a="+a2+"&3a="+a3+"&4a="+a4+"&5a="+a5,
   success: function(msg){ 

		$("div#resultat_ajax").html(""+msg+"");	
   }

});
	
}
function nouveau_critere_type_projet(le_critere){
var a1='';
var a2='';
var a3='';
var a4='';	
var a5='';	

	$("#loader").html("<img src='../images/ajax-loader_librairie.gif'>");
	if (document.getElementById("a1").checked == true){ a1='1';}
	if (document.getElementById("a2").checked  == true ){ a2='2';}
	if (document.getElementById("a3").checked  == true ){ a3='3';}
	if (document.getElementById("a4").checked  == true ){ a4='4';}
	if (document.getElementById("a5").checked  == true ){ a5='5';}

	$.ajax({ 
		type: "GET", 
		url: "spip.php?page=Ajax_librairie&var_mode=recalcul", 
		data: "1pc="+le_critere+"&1a="+a1+"&2a="+a2+"&3a="+a3+"&4a="+a4+"&4a="+a4+"&5a="+a5,
		success: function(msg){ 
				$("#loader").html("");
			$("div#resultat_ajax").html(""+msg+"");	
		}

	});		
}

/*////////////////////////////////////////////////////////////////
CONTRIBUER A UN PROJET

/////////////////////////////////////////////////////////////////*/
$(document).ready(function(){

	$("#but_contrib").click( function() { 
	var tampon_id_document = $("#tampon_id_variante").attr("value");
	
		$.ajax({ 
			type: "GET", 
			url: "spip.php?page=Ajax_creer_variante&var_mode=recalcul", 
			data: "id_document="+tampon_id_document,
			success: function(msg){ 

				if(msg != '0')
				{
					var reg=new RegExp("[:]+", "g");
					var tableau=msg.split(reg);
					var tampon_url = '/spip.php?page=application&id_variante='+tableau[0]+'&id_utilisateur='+tableau[2]+'&id_projet_categorie='+tableau[1]+'&var_mode=recalcul';
					//window.location.href=tampon_url;
					open_appli(tableau[0],tableau[1],tableau[2]);
				}
				else
				{
					var message_erreur = "Une erreur est survenue lors de la duplication du projet veuillez r&eacute;essayer.<br /> <br /> Si le problème persiste  contacter l'&eacute;quipe de D&eacute;coManie  <br /><br /> Merci."
						$("div#message_lightbox").html(message_erreur);
						show_lightbox();
				}
			}

		});
	});
});
/*////////////////////////////////////////////////////////////////

LIGHTBOX GENERALISTE

/////////////////////////////////////////////////////////////////*/
function show_lightbox()
{
	
	var hauteur =document.documentElement.scrollHeight;
	$("#light_box").css({ height: hauteur+'px' });
	$("#light_box").css({ display: "block" });
	//location.href='#';
}


$(function ()
{
	$("#but_close_ligthbox").click(function() {
	
	$("#light_box").css({ display: "none" });
	$("div#message_lightbox").html('');
	});
});

function close_lightbox()
{
	
	$("#light_box").css({ display: "none" });
	$("div#message_lightbox").html('');
}

/* ---- Proposer un concours --------*/
$(function ()
{
	$("#prop_concours").click(function() {

		$.ajax({
	
		type: "POST",
		url: "spip.php?page=Ajax_prop_concours&var_mode=recalcul",
		data:"type=1",
		success: function(retour){
			$("div#message_lightbox").html(retour);
			$("div#message_lightbox").html(retour);
			show_lightbox();
			centrer_lightbox('contenu_lightbox');
		}

		});
		return false;	
	
	
	
	});
});	



/* ---- - Effectuer une demande de credits de publicité --------*/
$(function ()
{
	$("#add_pub_accueil").click(function() {

		$.ajax({
	
		type: "POST",
		url: "spip.php?page=Ajax_add_cred_pub&var_mode=recalcul",
		data:"type=1",
		success: function(retour){
			$("div#message_lightbox").html(retour);
			show_lightbox();
			centrer_lightbox('contenu_lightbox');
		}

		});
		return false;	
	
	
	
	});
});	


/* ---- - Effectuer une demande de credits d'alertes pros--------*/
$(function ()
{
	$("#add_alert_pro").click(function() {

		$.ajax({
	
		type: "POST",
		url: "spip.php?page=Ajax_add_cred_alerte&var_mode=recalcul",
		data:"type=1",
		success: function(retour){
			$("div#message_lightbox").html(retour);
			show_lightbox();
			centrer_lightbox('contenu_lightbox');
		}

		});
		return false;	
	
	
	
	});
});


function afficherCarteRevendeur(idObjet)
{
	var cp=$('#revendeur_cp').val();
	$.ajax({
	
		type: "POST",
		url: "spip.php?page=Ajax_afficher_revendeur&var_mode=recalcul",
		data:"codePostal="+cp+"&idObjet="+idObjet,
		success: function(msg)
		{
			$("div#fondFormulaireCodePostal").html(msg);			
		}

	});
}

/*////////////////////////////////////////////////////////////////
Inscription (localisation)
/////////////////////////////////////////////////////////////////*/
var cpSvg=0;
var reSvg=0;

$(function ()
{
	$("#un_pays").change(function() 
	{
		valPays=$(this).val();
		
		if(valPays=='')
		{
			/*$("#formDivVille2").html('');
			$('#formIdVille2').val('');
			$('#formIdCP2').val('');
			$('#formDivVille2').hide();
			$('#formDivCp2').hide();*/
		}
		else if(valPays=='fr')
		{
			//$("#formDivVille2").html('');
			//$('#formIdCP2').val('');
			$('#formIdCP2').attr('maxlength', '5');
			//$('#formDivVille2').hide();
			//$('#formDivCp2').show();
		}
		else if(valPays=='be')
		{
			//$("#formDivVille2").html('');
			//$('#formIdCP2').val('');
			$('#formIdCP2').attr('maxlength', '4');
			//$('#formDivVille2').hide();
			//$('#formDivCp2').show();
		}
		else
		{
			$('#formIdCP2').attr('maxlength', '50');
		}
	});
	
	$("#formIdCP2").keyup(function() 
	{
		valPays=$("#un_pays").val();
		valCode=$(this).val();
		
		if(valPays=='fr')
		{
			nbCarac=5;
		}
		else if(valPays=='be')
		{
			nbCarac=4;
		}	

		if(valCode.length<nbCarac)
		{
			reSvg=0;
		}
		
		if(valCode.length==nbCarac && (cpSvg!=valCode || reSvg==0))
		{
			cpSvg=valCode;
			reSvg=1;
			$("#loaderVille").show();
			$.ajax({
				type: "POST",
				url: "spip.php?page=Ajax_ville_inscription&var_mode=recalcul",
				data:"cp="+valCode+"&pays="+valPays,
				success: function(msg)
				{
					$("#loaderVille").hide();
					$("#formDivVille2").html(msg);
					$("#formDivVille2").show();					
				}
			});
		}
		else if(valCode.length<nbCarac)
		{
			//$("#formDivVille2").html('');
			//$("#formDivVille2").hide();
		}
		
	});	
	
	$("#un_pays_part").change(function() 
	{
		valPays=$(this).val();
		
		if(valPays=='')
		{
			$("#formDivVille").html('');
			$('#formIdVille').val('');
			$('#formIdCP').val('');
			//$('#formDivVille').hide();
			//$('#formDivCp').hide();
		}
		else if(valPays=='fr')
		{
			//$("#formDivVille").html('');
			$('#formIdCP').val('');
			$('#formIdCP').attr('maxlength', '5');
			//$('#formDivVille').hide();
			//$('#formDivCp').show();
		}
		else if(valPays=='be')
		{
			//$("#formDivVille").html('');
			$('#formIdCP').val('');
			$('#formIdCP').attr('maxlength', '4');
			//$('#formDivVille').hide();
			//$('#formDivCp').show();
		}
		else
		{
			$('#formIdCP').attr('maxlength', '50');
		}
	});
	
	$("#formIdCP").keyup(function() 
	{
		valPays=$("#un_pays_part").val();
		valCode=$(this).val();
		
		if(valPays=='fr')
		{
			nbCarac=5;
		}
		else if(valPays=='be')
		{
			nbCarac=4;
		}	

		if(valCode.length<nbCarac)
		{
			reSvg=0;
		}
		
		if(valCode.length==nbCarac && (cpSvg!=valCode || reSvg==0))
		{
			cpSvg=valCode;
			reSvg=1;
			$("#loaderVille").show();
			$.ajax({
				type: "POST",
				url: "spip.php?page=Ajax_ville_inscription_part&var_mode=recalcul",
				data:"cp="+valCode+"&pays="+valPays,
				success: function(msg)
				{
					$("#loaderVille").hide();
					$("#formDivVille").html(msg);
					$("#formDivVille").show();					
				}
			});
		}
		else if(valCode.length<nbCarac)
		{
			//$("#formDivVille").html('');
			//$("#formDivVille").hide();
		}
		
	});	
	
	
	
	$("#pays_modif").change(function() 
	{
		valPays=$(this).val();
		
		if(valPays=='')
		{
			$("#ville_modif").html('');
			$('#ville').val('');
			$('#code_postal_modif').val('');
			$('#ville_modif').hide();
			$('#cp_modif').hide();
		}
		else if(valPays=='fr')
		{
			$("#ville_modif").html('');
			$('#code_postal_modif').val('');
			$('#code_postal_modif').attr('maxlength', '5');
			$('#ville_modif').hide();
			$('#cp_modif').show();
		}
		else if(valPays=='be')
		{
			$("#ville_modif").html('');
			$('#code_postal_modif').val('');
			$('#code_postal_modif').attr('maxlength', '4');
			$('#ville_modif').hide();
			$('#cp_modif').show();
		}
	});
	
	$("#code_postal_modif").keyup(function() 
	{
		valPays=$("#pays_modif").val();
		valCode=$(this).val();
		
		if(valPays=='fr')
		{
			nbCarac=5;
		}
		else if(valPays=='be')
		{
			nbCarac=4;
		}	

		if(valCode.length<nbCarac)
		{
			reSvg=0;
		}
		
		if(valCode.length==nbCarac && (cpSvg!=valCode || reSvg==0))
		{
			cpSvg=valCode;
			reSvg=1;
			$.ajax({
				type: "POST",
				url: "spip.php?page=Ajax_ville_inscription_modif&var_mode=recalcul",
				data:"cp="+valCode+"&pays="+valPays,
				success: function(msg)
				{
					$("#ville_modif").html(msg);
					$("#ville_modif").show();					
				}
			});
		}
		else if(valCode.length<nbCarac)
		{
			$("#ville_modif").html('');
			$("#ville_modif").hide();
		}
		
	});	
	
});
/*////////////////////////////////////////////////////////////////

PARTAGE DE PROJET

/////////////////////////////////////////////////////////////////*/
function partage_projet(id_projet)
{
	$.ajax({					
		type: "GET",
		url: "spip.php?page=Ajax_partage_projet&var_mode=recalcul",
		data:"type=1&id_projet="+id_projet,
		error:function(msg){
			alert( "Error !: " + msg );
		},
		success: function(retour){
			$("div#message_lightbox").html(retour);
			show_lightbox();	
			centrer_lightbox('contenu_lightbox');
		}
	}); 
	 return false;

	
}
$(document).ready( function () {
		$('.yes').click(function()
		{
			
			var tampon_id = $(this).attr("id");
			tampon_id = tampon_id.replace("but_yes_", ""); 
			
				
			$("#set_rep_"+tampon_id).val('y');
			$("#set_variante_"+tampon_id).val(tampon_id);
			$("#contrib_"+tampon_id).submit();
				
		});
		
		$('.no').click(function()
		{
			var tampon_id = $(this).attr("id");
			tampon_id = tampon_id.replace("but_no_", ""); 
			
				
			$("#set_rep_"+tampon_id).val('n');
			$("#set_variante_"+tampon_id).val(tampon_id);
			$("#contrib_"+tampon_id).submit();
			
		});
	});
	
/*Formualire de contact*/
$(document).ready( function () {
	$('#set_domaine').change(function(){
		var tampon_val = $('#set_domaine').val();
		
		if(tampon_val == 'Autre')
		{
			$('#ligne_autre').removeClass('off');
		}
		else
		{
			$('#ligne_autre').addClass('off');
		}
		
	});
});


function supprimer_variante(id_variante)
{
	
	$.ajax({ 
	   type: "POST", 
	   url: "spip.php?page=Ajax_supprimer_variante", 
	   data: "id_variante="+id_variante,
	   success: function(msg)
		{ 
			$("div#message_lightbox").html(msg);
			show_lightbox();
			centrer_lightbox('contenu_lightbox');
			window.scrollTo(0,0);
		}
	});
}
function confirm_supprimer_variante(id_variante)
{
	document.forms['supprimer_variante_'+id_variante+''].submit();
}

function supprimer_image(id_image)
{
	
	$.ajax({ 
	   type: "POST", 
	   url: "spip.php?page=Ajax_supprimer_image", 
	   data: "id_image="+id_image,
	   success: function(msg)
		{ 
			
			$("div#message_lightbox").html(msg);
			show_lightbox();
			centrer_lightbox('contenu_lightbox');
		}
	});
}
function confirm_supprimer_image(id_image)
{
	document.forms['supprimer_image_'+id_image+''].submit();
}

$(document).ready( function () {
	
	
	/*$("#lien_inscription").click( function() { 
		var msg ='Le site D&eacute;comanie.com est pour le moment en inscription beta. <br /><br />Veuillez suivre ce lien pour une premi&egrave;re inscription : <br />  <div style="width:200px;margin:auto;margin-top:15px;>"<a target="_blank"style="text-align:center;" href="http://www.decoration-3d.net/beta-decomanie/" title="Blog D&eacute;comanie">Blog D&eacute;comanie</a></div>';
		$("div#message_lightbox").html(msg);
		show_lightbox();
		centrer_lightbox('contenu_lightbox');
		return false;
	});
	
	$("#lien_picto_ctlg_inscription").click( function() { 
		var msg ='Le site D&eacute;comanie.com est pour le moment en inscription beta. <br /><br />Veuillez suivre ce lien pour une premi&egrave;re inscription : <br />  <div style="width:200px;margin:auto;margin-top:15px;>"<a target="_blank"style="text-align:center;" href="http://www.decoration-3d.net/beta-decomanie/" title="Blog D&eacute;comanie">Blog D&eacute;comanie</a></div>';
		$("div#message_lightbox").html(msg);
		show_lightbox();
		centrer_lightbox('contenu_lightbox');
		return false;
	});*/
	
});
$(document).ready(function () 
{
	$('.picto_ajout_favoris').click(function()
	{
		
		var tampon_href  = $(this).attr('href');
		var tampon_titre = $(this).attr('title');
		if ( navigator.appName != 'Microsoft Internet Explorer' )
		{ 
			window.sidebar.addPanel(tampon_titre,tampon_href,""); 
		}
		else
		{
			window.external.AddFavorite(tampon_href,tampon_titre); 
		} 
		
		
		return false;
	});
	
});

/*--------------------------------------
Onglets catalogue
--------------------------------------*/
$(document).ready( function () 
{

	$('.onglet_ctgr_obj').mouseover(function()
	{
		var tampon_id;
		tampon_id = $(this).attr('id');
		tampon_id = tampon_id.replace('parent_','');
		
		$('#enfant_'+tampon_id).removeClass('off_deroul');
		$('#bas_enfant_'+tampon_id).removeClass('off_deroul');
		
	});
	
	$('.onglet_ctgr_obj').mouseout(function()
	{
		var tampon_id;
		tampon_id = $(this).attr('id');
		tampon_id = tampon_id.replace('parent_','');
		
		$('#enfant_'+tampon_id).addClass('off_deroul');
		$('#bas_enfant_'+tampon_id).addClass('off_deroul');
		
	});
	
});

$(document).ready(function()
{
	edit_nom_projet();
});
function edit_nom_projet()
{
	$(".edit_nprjet").hover(function(){
		$(this).children('.edit_nom').removeClass("off_");
	   
	 },function(){
	   $(this).children('.edit_nom').addClass("off_");
	 });
	 
	$(".edit_nom").click(function(){
		var temp_id = $(this).attr('id');
		temp_id = temp_id.replace('edit_nom_','');
		$('#change_nom_'+temp_id).removeClass('off_');
		$('#ok_edit_'+temp_id).removeClass('off_');
		return false;
	});
	
	$('.ok_edit').click(function()
	{
		var temp_id = $(this).attr('id');
		temp_id = temp_id.replace('ok_edit_','');
		//alert(temp_id);
		var nouveau_nom = $('#change_nom_'+temp_id).val();
		if(nouveau_nom != '')
		{
			$.ajax({
			type: "POST",
			url: "spip.php?page=Ajax_changer_nom_projet&var_mode=recalcul",
			complete: function(){
				edit_nom_projet();
			},
			data:"id_projet="+temp_id+'&nom_projet='+nouveau_nom,
			success: function(retour){
				
				$('#change_nom_'+temp_id).addClass('off_');
				$('#ok_edit_'+temp_id).addClass('off_');
				$('#nom_actuel_'+temp_id).html(nouveau_nom+' <span style="color:black;" class="edit_nom off_" id="edit_nom_'+temp_id+'">Edit <img style="position:absolute;z-index:3;margin-top:-2px;margin-left : 3px;" src="/images/pen-edit.gif"></span>');
				
			}
			});
		}
		
		return false;
	});
}
$(document).ready(function()
{
	
	$('#abonne').change(function()
	{
		
		$('#suiv_forum').submit();
	});
	
});
$(document).ready(function()
{
	
	
		$('#flD').live("click",function()
		{
			
			var control = $('#control').val();
			if(control == 0)
			{
				
				$('#control').val(1);
				var nbImg = $('#nbrec').val()
				nbImg = parseInt(55*nbImg)-(13*55);
				
				nbImg = nbImg*-1
				
				var marginTemp = parseInt($('.feinte').css('margin-left'));
				
				if(marginTemp > nbImg)
				{
					marginTemp = marginTemp-165;
					marginTemp = marginTemp+'px';
					$('.feinte').stop().animate({marginLeft: marginTemp},  1000, function()
					{
						$('#control').val(0);
					});
				}
				else $('#control').val(0);
			}
		});
	
	
	
		$('#flG').live("click",function()
		{
			var control = $('#control').val();
			if(control == 0)
			{
				$('#control').val(1);
				var marginTemp = parseInt($('.feinte').css('margin-left'));
		
				if(marginTemp < 0)
				{
					marginTemp = marginTemp+165;
					marginTemp = marginTemp+'px';
					$('.feinte').stop().animate({marginLeft: marginTemp},  1000, function()
					{
						$('#control').val(0);
					});
				}
				else $('#control').val(0);
			}
		});	
			
	
		
		
	

	
	
	
	


	
	
	
	 $('#onglNote').click(function()
	 {	
		
		var imageMini = $(this);
		if($(this).css('color') == 'rgb(141, 123, 116)' || $(this).css('color')== '#8d7b74')
		{
			$.ajax({ 
			   type: "POST", 
			   url: "spip.php?page=Ajax_carousel_notes", 
			   success: function(msg)
				{ 
					$('#galPlusRec').html(msg);
					imageMini.css('color','#9D2C2D');
					$('#onglRec').css('color','#8D7B74');
					$('#onglRec').addClass('hand');
					
					var i=0;
					$('.miniRecente').each(function()
					{	i++;
						if(i==1) $(this).click();
						else return false;
					});
				}
			});
		}
		else return false;
	 });
	 
	  $('#onglRec').click(function()
	 {	
		var imageMini = $(this);
		if($(this).css('color') == 'rgb(141, 123, 116)' || $(this).css('color')== '#8d7b74')
		{
			$.ajax({ 
			   type: "POST", 
			   url: "spip.php?page=Ajax_carousel_recentes", 
			   success: function(msg)
				{ 
					$('#galPlusRec').html(msg);
					imageMini.css('color','#9D2C2D');
					$('#onglNote').css('color','#8D7B74');
					
						var i=0;
					$('.miniRecente').each(function()
					{	i++;
						if(i==1) $(this).click();
						else return false;
					});
				}
			});
		}
		else return false;
	 });
	 
	 
	 
	$(".miniRecente").live("click", function()
	{
		var imageMini = $(this);
		$('#parentBlHome').css('height',parseInt($('#blHomeRecent').height())+'px');
		$('#blHomeRecent').fadeOut();
		$.ajax({ 
		   type: "POST", 
		   url: "spip.php?page=Ajax_img_recente", 
		   data: "id="+$(this).attr('id'),
		   success: function(msg)
			{ 
			
				$('#blHomeRecent').html(msg);
				$('.miniRecente').css('border','none');
				imageMini.css('border-bottom','2px solid #9D2C2D');
				imageMini.css('border-top','2px solid #9D2C2D');
				imageMini.css('border-right','2px solid #9D2C2D');
				imageMini.css('border-left','2px solid #9D2C2D');
				$('#blHomeRecent').fadeIn();
				$('#parentBlHome').css('height','auto');
				$('.comSlide').vTicker();
			}
		});
		
	});
	
	
	$('.comSlide').vTicker();



	
	$('#ContribBis').live("click",function()
	{
		var msg ='<div style="text-align:center;line-height:25px;">Connecter vous &agrave; votre compte <br/>ou <a href="/inscription.html">inscrivez-vous</a>  <br/>pour contribuer &agrave; ce projet</div>';
		$("div#message_lightbox").html(msg);
		show_lightbox();
		centrer_lightbox('contenu_lightbox');
		return false;
	});
	
	$('#ContribBisFr').live("click",function()
	{
		
		var msg ='<div style="text-align:center;line-height:25px;">Vous devez &ecirc;tre ami avec '+$('#lienLoginContribHome').html()+' ou <a href="/spip.php?page=migration">Coach D&eacute;co</a> pour pouvoir contribuer &agrave; ce projet</div><div><div style="margin-top:30px;width : 120px;text-align:left;margin-left : 65px;" class="gauche newBut">'+$('#lienAddAmi').html()+'</div> <div style="margin-top:30px;width : 180px;text-align:left;margin-left : 20px;" class="newBut gauche"><a href="/spip.php?page=migration"><img src="/images/puce_blanche.png">&nbsp;&nbsp;  Devenir Coach D&eacute;co</a></div></div>';
		$("div#message_lightbox").html(msg); 
		show_lightbox();
		centrer_lightbox('contenu_lightbox');
		return false;
	});
	
});
