function trim(chaine) {		return chaine.replace(/^\s+/, '').replace(/\s+$/, '');	}/*plugin jquery a placer dans un autre fichier après*/jQuery.fn.extend({  preview: function(opt) {  return this.each(function(){    opt = $.extend({	width:100, // a revoir  xOffset: 10,  yOffset:30,  title:""	}, opt);  	$(this).hover(function(e){		this.t = this.title;		this.title = "";			var c = (this.t != "") ? "<br/>" + this.t: "";		if (opt.title !="")		  c =  "<br/>" + opt.title;		$("body").append("<div style='color:white;text-align:center' id='screenshot'><img width='"+opt.width+"' src='"+ this.rel +"' alt='No Image' />"+ c +"</div>");								 		$("#screenshot")			.css("position","absolute")			.css("top",(e.pageY - opt.xOffset) + "px")			.css("left",(e.pageX + opt.yOffset) + "px")			.css("border", "5px inset #77807F")			.css("padding", "10px")			.css("background-color","black")			.fadeIn("fast");						    },	function(){		this.title = this.t;			$("#screenshot").remove();    });		$("a.screenshot").mousemove(function(e){		$("#screenshot")			.css("top",(e.pageY - opt.xOffset) + "px")			.css("left",(e.pageX + opt.yOffset) + "px");	});            });  }});jQuery.fn.extend({  generic: function(opt) {  	var size = this.find("li").length;	var tabLi = new Array();	var current = this;	var timer;    opt = $.extend({	visible:3,	height:190, // a revoir	width:190, // a revoir 	interval: 1000,	speed: 1000	}, opt);		opt.visible = Math.min(opt.visible, size);		function animList()	{	  clearInterval(timer);	  current.append(current.find("li:first").clone());	  current.find("li:last").css("opacity", "0.1");	  current.find("li:eq("+(opt.visible)+")").animate({opacity: "1"}, opt.speed * (1.3));	  current.find("li:first").each(function() {		$(this).animate({marginTop:  -$(this).height() + "px", opacity:"0.1"}, opt.speed, function () {			current.find("li:first").each(function(){				$(this).remove();				timer = setInterval(animList, opt.interval);			})		});	  })	}		this.css("overflow", "hidden");	var max = 0;	var min = 0;	this.find("li").each(function() {		max = Math.max(max, $(this).height());	});	$(this).find("li").height(max);	this.css("height", opt.visible * (max + 11));    this.css("width", opt.width);	this.find("li:gt("+(opt.visible - 1)+")").css("opacity", "0.1");		timer = setInterval(animList,  opt.interval);	/*this.hover(function() {		clearInterval(timer);	},	function() {		timer = setInterval(animList,  opt.interval);	}	)*/	return this;	 /**END is here***/	}});/*******FIN  DES PLUGINS JQUERY**********/function pagingHTML(pageActu, pageMax){  $(".table_border:lt("+((pageActu - 1)*10)+"), .table_border:gt("+((pageActu)*10 - 1)+")").parent().parent().hide();    $(".table_border:gt("+((pageActu - 1)*10)+"):lt("+((pageActu)*10 - 1)+")").parent().parent().show();}function pagingNewsMedia(pageActu, pageMax){    //newsMediaCount - newsMediaSpace - newsMediaContent    //console.log("nb = " + $(".newsMediaCount:lt("+((pageActu - 1) * pageMax)+")", ".newsMediaCount:gt("+((pageActu)*pageMax - 1)+")").length);        //console.log("nbHideMax" + $(".newsMediaCount:gt("+((pageActu)*pageMax - 1)+")").length);                $(".newsMediaCount:lt("+((pageActu - 1) * pageMax)+")", ".newsMediaCount:gt("+((pageActu)*pageMax - 1)+")").hide();    $(".newsMediaCount:gt("+((pageActu - 1) * pageMax)+"):lt("+((pageActu)*pageMax - 1)+")").show();            $(".newsMediaSpace:lt("+((pageActu - 1) * pageMax)+")", ".newsMediaSpace:gt("+((pageActu)*pageMax - 1)+")").hide();    $(".newsMediaSpace:gt("+((pageActu - 1) * pageMax)+"):lt("+((pageActu)*pageMax - 1)+")").hide();            $(".newsMediaContent:lt("+((pageActu - 1) * pageMax)+")", ".newsMediaContent:gt("+((pageActu)*pageMax - 1)+")").hide();    $(".newsMediaContent:gt("+((pageActu - 1) * pageMax)+"):lt("+((pageActu)*pageMax - 1)+")").show();}/***************fonction pour la seconde partie de propositions*******************/function newsPropModif2(){	$(".popupInfoProd").each(function(){			$(this).click(function(){			if ($(".infoPropProd ."+$(this).attr("rel")+":eq(0)").text() != "Autre...")         simplePopupModal("Information sur le produit", "<p>Nom du produit: "+$(this).text()+"</p><p>Catégorie:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(0)").text()+"</p><p>Description:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(1)").text()+"</p><p>Nombre:"+$(this).parent().next().next().text()+"</p><p>Valeur de dotation:"+$(this).parent().next().next().next().text()+"</p>", 500, 200,true,false);			else			   simplePopupModal("Information sur le produit", "<p>Nom du produit: "+$(this).text()+"</p><p>Catégorie:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(2)").text()+"</p><p>Description:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(1)").text()+"</p><p>Nombre:"+$(this).parent().next().next().text()+"</p><p>Valeur de dotation:"+$(this).parent().next().next().next().text()+"</p>", 500, 200,true,false);			return false;			})		});				$(".modifPropProd").each(function(){			$(this).click(function(){				modifLink = $(this);				var cloneTab = $("#formProdProduit table:first").clone();		// select + textarea				cloneTab.find("input[type='text']").each(function(index) {					switch (index)					{						case 0:								this.defaultValue = modifLink.parents("tr:first").children("td:eq(0)").text();								break;						case 1:								this.defaultValue = $(".infoPropProd ."+modifLink.attr("rel")+":eq(2)").text();								break;						case 2:								this.defaultValue = modifLink.parents("tr:first").children("td:eq(2)").text();								break;						case 3:								this.defaultValue = modifLink.parents("tr:first").children("td:eq(3)").text();								break;					}				});								cloneTab.find("textarea").each(function(){					$(this).text($(".infoPropProd ."+modifLink.attr("rel")+":eq(1)").text());				});								cloneTab.find("input[type='image']").attr("src", "../images/bt_modifier.png");				cloneTab.find("input[type='image']").addClass("modifier");				cloneTab.find("input[type='image']").removeClass("ajoutProdProduct");				cloneTab.find("input[type='image']").attr("id", "modifier");				cloneTab.find("input[type='image']").attr("rel", modifLink.attr("rel"));								simplePopupModal("Modification du produit",cloneTab.html(), 500, 300);				$("#simplePopupModal p.popupParagraph").wrapInner("<form class='modifPropProdPopup'></form>"); //modif ici				$(".modifPropProdPopup select[name='Cat_prod']").each(function(){				$(this).val($(".infoPropProd ."+modifLink.attr("rel")+":eq(0)").text());				});				if ($(".modifPropProdPopup select[name='Cat_prod']").length != 0)				{					if ($(".modifPropProdPopup select[name='Cat_prod']").val() != "Autre")					{						$(".modifPropProdPopup input[name='Cat_prod_autre']").hide();						$(".modifPropProdPopup input[name='Cat_prod_autre']").parent().prev().hide();					}					else					{						$(".modifPropProdPopup input[name='Cat_prod_autre']").show();						$(".modifPropProdPopup input[name='Cat_prod_autre']").parent().prev().show();					}										$(".modifPropProdPopup select[name='Cat_prod']").change(function() {						if ($(this).val() == "Autre")						{							$(".modifPropProdPopup input[name='Cat_prod_autre']").show();							$(".modifPropProdPopup input[name='Cat_prod_autre']").parent().prev().show();						}						else						{						  $(".modifPropProdPopup input[name='Cat_prod_autre']").hide();						  $(".modifPropProdPopup input[name='Cat_prod_autre']").parent().prev().hide();						}					})				}				$(".modifPropProdPopup").validate({					submitHandler: function(){											$.ajax({							url:"/librairies/PropProduct.php",							type:"post",							dataType: "text",							data: $("#simplePopupModal").find("form").formSerialize()+"&action=modif&prod=" + modifLink.attr("rel"),							success:function (text){								$("#tabResultPropProduit").find("a[rel='"+modifLink.attr("rel")+"']:first").each(function() {																	$(this).parents("tr:first").children("td:eq(0)").find("a").text($("#simplePopupModal input:eq(0)").val());														if ($("#simplePopupModal select").val() != "Autre")							     $(this).parents("tr:first").children("td:eq(1)").text($("#simplePopupModal select :selected").text());							else							     $(this).parents("tr:first").children("td:eq(1)").text($("#simplePopupModal input:eq(1)").val());														$(this).parents("tr:first").children("td:eq(2)").text($("#simplePopupModal input:eq(2)").val());							$(this).parents("tr:first").children("td:eq(3)").text($("#simplePopupModal input:eq(3)").val());								});								$(".infoPropProd ."+ modifLink.attr("rel")+":eq(0)").text($("#simplePopupModal select :selected").val());								$(".infoPropProd ."+ modifLink.attr("rel")+":eq(1)").text($("#simplePopupModal textarea").val());								$(".infoPropProd ."+ modifLink.attr("rel")+":eq(2)").text($("#simplePopupModal input:eq(1)").val());								$("#simplePopupModal").dialog("close");								//alert(text);							}						});											},					rules: {								produit: {required:true, maxlength:50},								Cat_prod: {maxlength:50},								produit2: {required:true},								produit3: {number:true, maxlength:50},								produit4: {required:true, number:true, maxlength:50}						}				});				return false;				})			});												$(".suppProdProduct").click(function(){					ligne = $(this);					$.ajax({							url:"/librairies/PropProduct.php",							type:"post",							data: "action=supprim&prod=" + $(this).attr("rel"),							success:function(text){							ligne.parents("tr:first").remove();							$("." + ligne.attr("rel")).remove();							//alert(text);							if ($(".infoPropProd").children().length === 0)								$("#erreurAjout").show();							else								$("#erreurAjout").hide();							}						});					return false;					});}function newsProp2(){	$(".popupInfoProd").each(function(){			$(this).click(function(){			if ($(".infoPropProd ."+$(this).attr("rel")+":eq(0)").text() != "Autre...")				simplePopupModal("Information sur le produit", "<p>Nom du produit: "+$(this).text()+"</p><p>Catégorie:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(0)").text()+"</p><p>Description:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(1)").text()+"</p><p>Nombre:"+$(this).parent().next().next().text()+"</p><p>Valeur de dotation:"+$(this).parent().next().next().next().text()+"</p>", 500, 200,true,false);			else			   simplePopupModal("Information sur le produit", "<p>Nom du produit: "+$(this).text()+"</p><p>Catégorie:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(2)").text()+"</p><p>Description:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(1)").text()+"</p><p>Nombre:"+$(this).parent().next().next().text()+"</p><p>Valeur de dotation:"+$(this).parent().next().next().next().text()+"</p>", 500, 200,true,false);			return false;			})		});	$(".modifPropProd:last").click(function() {		modifLink = $(this);		var cloneTab = $("#formProdProduit table:first").clone();// select + textarea		cloneTab.find("input[type='text']").each(function(index) {			switch (index)			{				case 0:						this.defaultValue = modifLink.parents("tr:first").children("td:eq(0)").text();						break;				case 1:						this.defaultValue = $(".infoPropProd ."+modifLink.attr("rel")+":eq(2)").text();						break;				case 2:						this.defaultValue = modifLink.parents("tr:first").children("td:eq(2)").text();						break;				case 3:						this.defaultValue = modifLink.parents("tr:first").children("td:eq(3)").text();						break;			}		});				cloneTab.find("textarea").each(function(){			$(this).text($(".infoPropProd ."+modifLink.attr("rel")+":eq(1)").text());		});				cloneTab.find("input[type='image']").attr("src", "../images/bt_modifier.png");		cloneTab.find("input[type='image']").addClass("modifier");		cloneTab.find("input[type='image']").removeClass("ajoutProdProduct");		cloneTab.find("input[type='image']").attr("id", "modifier");		cloneTab.find("input[type='image']").attr("rel", modifLink.attr("rel"));				simplePopupModal("Modification du produit",cloneTab.html(), 500, 300);		$("#simplePopupModal p.popupParagraph").wrapInner("<form class='modifPropProdPopup'></form>"); //modif ici		$(".modifPropProdPopup select[name='Cat_prod']").each(function(){		$(this).val($(".infoPropProd ."+modifLink.attr("rel")+":eq(0)").text());		});		if ($(".modifPropProdPopup select[name='Cat_prod']").length != 0)		{			if ($(".modifPropProdPopup select[name='Cat_prod']").val() != "Autre")			{				$(".modifPropProdPopup input[name='Cat_prod_autre']").hide();				$(".modifPropProdPopup input[name='Cat_prod_autre']").parent().prev().hide();			}			else			{				$(".modifPropProdPopup input[name='Cat_prod_autre']").show();				$(".modifPropProdPopup input[name='Cat_prod_autre']").parent().prev().show();			}						$(".modifPropProdPopup select[name='Cat_prod']").change(function() {				if ($(this).val() == "Autre")				{					$(".modifPropProdPopup input[name='Cat_prod_autre']").show();					$(".modifPropProdPopup input[name='Cat_prod_autre']").parent().prev().show();				}				else				{				  $(".modifPropProdPopup input[name='Cat_prod_autre']").hide();				  $(".modifPropProdPopup input[name='Cat_prod_autre']").parent().prev().hide();				}			})		}		$(".modifPropProdPopup").validate({			submitHandler: function(){							$.ajax({					url:"/librairies/PropProduct.php",					type:"post",					dataType: "text",					data: $("#simplePopupModal").find("form").formSerialize()+"&action=modif&prod=" + modifLink.attr("rel"),					success:function (text){						$("#tabResultPropProduit").find("a[rel='"+modifLink.attr("rel")+"']:first").each(function() {													$(this).parents("tr:first").children("td:eq(0)").find("a").text($("#simplePopupModal input:eq(0)").val());							if ($("#simplePopupModal select").val() != "Autre")							 $(this).parents("tr:first").children("td:eq(1)").text($("#simplePopupModal select :selected").text());							else							$(this).parents("tr:first").children("td:eq(1)").text($("#simplePopupModal input:eq(1)").val());														$(this).parents("tr:first").children("td:eq(2)").text($("#simplePopupModal input:eq(2)").val());							$(this).parents("tr:first").children("td:eq(3)").text($("#simplePopupModal input:eq(3)").val());						});						$(".infoPropProd ."+ modifLink.attr("rel")+":eq(0)").text($("#simplePopupModal select :selected").val());						$(".infoPropProd ."+ modifLink.attr("rel")+":eq(1)").text($("#simplePopupModal textarea").val());						$(".infoPropProd ."+ modifLink.attr("rel")+":eq(2)").text($("#simplePopupModal input:eq(1)").val());						$("#simplePopupModal").dialog("close");						//alert(text);					}				});									},			rules: {						produit: {required:true, maxlength:50},						Cat_prod: {maxlength:50},						produit2: {required:true},						produit3: {number:true, maxlength:50},						produit4: {required:true, number:true, maxlength:50}				}		});		return false;			});		$(".suppProdProduct:last").click(function(){	ligne = $(this);	$.ajax({			url:"/librairies/PropProduct.php",			type:"post",			data: "action=supprim&prod=" + $(this).attr("rel"),			success:function(text){			ligne.parents("tr:first").remove();			$("." + ligne.attr("rel")).remove();			//alert(text);			if ($(".infoPropProd").children().length === 0)				$("#erreurAjout").show();			else				$("#erreurAjout").hide();			}		});	return false;	})}/*ici les options generales des popups*/function defaultClose(){	$(this).dialog("close");}function contactManip(){  if ($(".boxContact").length != 0)  {    $(".boxContact").each(function() {      $(this).click(function() {        if (this.checked)        {          if (trim($("#to").val()).length != 0)          {            $("#to").val($("#to").val() + ";" + $(this).parent("td:first").next().text());            $("#destinataire").val($("#destinataire").val() + ";" + $(this).val()+":"+$(this).next().val());          }          else          {            $("#to").val($(this).parent("td:first").next().text());            $("#destinataire").val($(this).val() +":"+$(this).next().val());          }        }        else        {            $("#to").val("");            $("#destinataire").val("");            $(".boxContact:checked").each(function() {             if (trim($("#to").val()).length != 0)                {                  $("#to").val($("#to").val() + ";" + $(this).parent("td:first").next().text());                  $("#destinataire").val($("#destinataire").val() + ";" + $(this).val()+":"+$(this).next().val());                }                else                {                  $("#to").val($(this).parent("td:first").next().text());                  $("#destinataire").val($(this).val()+":"+$(this).next().val());                }          });        }      });      });  }}function reloadCheckbox(){  if ($(".boxContact").length != 0)  {    var tabCheckbox = $("#destinataire").val().split(";");        if ((tabCheckbox.length > 0) && (tabCheckbox[0].length > 0))    {            for (key in tabCheckbox)      {        valeur = tabCheckbox[key].split(":");                  if ($(".boxContact[value='"+valeur[0]+"']").get(0))          $(".boxContact[value='"+valeur[0]+"']").get(0).checked = "true";       }        }  }}function contactPopupModal(titre, hauteur, largeur,buttonOk,functionOk,buttonCancel,functionCancel){/* $(document).ready(function() {            $("#pager").pager({ pagenumber: 1, pagecount: 15, buttonClickCallback: PageClick });        });        PageClick = function(pageclickednumber) {            $("#pager").pager({ pagenumber: pageclickednumber, pagecount: 15, buttonClickCallback: PageClick });            $("#result").html("Clicked Page " + pageclickednumber);        }*/	if ($("#contactPopupModal").length == 0)		$("body").append("<div id='contactPopupModal'><p></p></div>");	else		$("#contactPopupModal").dialog("destroy");		var opt = {height: largeur,width:largeur, autoOpen: false, bgiframe:true, modal:true ,overlay: true, position: new Array('center', 128), title:titre, buttons : {}};				if ($.browser.msie)			 opt = {height: largeur,width:hauteur,autoOpen: false, bgiframe:true, modal:true,position: new Array('center', 128), title:titre, buttons : {}};			 			 		if (buttonCancel == true)		{			opt.buttons = $.extend(opt.buttons, 			{				Cancel:function ()						{							$(this).dialog("close");							if (functionCancel)								functionCancel();						}			})		}				if (buttonOk == true)		{			opt.buttons = $.extend(opt.buttons, 			{				Ok:function ()						{							$(this).dialog("close");							if (functionOk)								functionOk();						}			})		}				$("#contactPopupModal").dialog(opt);		$("#contactPopupModal p").empty();				$.ajax({			async:false,			url: "/librairies/contact_list.php",			type: "POST",			dataType:"html",			data: {page:'1'},			beforeSend: function(xml)						{							$("#contactPopupModal p").append("<img class='loadingImage' src='/images/loading.gif' alt='Image d'attente'/>");						},			success: function(html)					{						$("#contactPopupModal p").empty();;						$("#contactPopupModal p").append(html);						if (($("#contactTable tbody").children().length != 0))	           $("#contactTable").tablesorter({cssHeader:"normalHeader", widthFixed: true, widgets: ['zebra']}).tablesorterPager({container: $("#pager"),  positionFixed: false});	           reloadCheckbox();	           contactManip();					}		});				$("#contactPopupModal p").children().show();		$("#contactPopupModal").dialog("open");		return $("#contactPopupModal");}function forgetPopupModal(titre, ajaxFile, info, hauteur, largeur, message, object){	var annuler = false;	if ($("#submitPopupModal").length == 0)		$("body").append("<div id='submitPopupModal'><p></p></div>");	else		$("#submitPopupModal").dialog("destroy");		var opt = {width:hauteur, height: largeur, autoOpen: false, bgiframe:true, modal:true ,overlay: true, position: new Array('center', 128),title:titre, buttons : {}, close: function(e,a){				if (object)					$(object).children("input:checkbox")[0].checked = false; // TODO change ici quand tu aura trouver un solution				}};						if ($.browser.msie)			 opt = {width:hauteur, height: largeur,autoOpen: false, bgiframe:true, modal:true, position: new Array('center', 128), title:titre, buttons : {}, close: function(e,a){				if (object)					$(object).children("input:checkbox")[0].checked = false; // TODO change ici quand tu aura trouver un solution				}};			 		$("#submitPopupModal").dialog(opt);		$("#submitPopupModal p").empty();		//$("#submitPopupModal p").html(contenu);		var fenetreAttente = null;		$.ajax(			{				async:false,				url: "/ajax/" + ajaxFile + ".php",				dataType:"html",				data: info,				success: function(data) {					$("#submitPopupModal").html(data);					$("#submitPopupModal form #Annuler").click(function(){					$("#submitPopupModal").dialog("close");						return false;					});										$("#submitPopupModal form input[type='reset']").click(function(){							$("#submitPopupModal form").clearForm();							return false;					});							}			})		$("#submitPopupModal p").children().show();		$("#submitPopupModal").dialog("open");		$("#formEmailForget").validate({			submitHandler: function(formulaire){				$(formulaire).ajaxSubmit({					beforeSubmit:function(){					$("#submitPopupModal").dialog("close");					simplePopupModal("Envoi en cours", "<img class='loadingImage' src='/images/loading.gif' alt='Image d'attente'/>", 500, 200,false,false);									},					success: function(){						$("#simplePopupModal").dialog("close");													simplePopupModal("Envoi Terminée",  "<div class='confimEnvoi'><h3>Vos identifiants ont été envoyé à l'adresse suivante:</h3> <br/>"+$("#submitPopupModal form #emailForget").fieldValue()+"</div>", 500, 200,true,false);					}				})				return false;			},			rules:{				emailForget:{required:true,email:true,emailExist:true, noTag:true}				},			onkeyup:false		})		return annuler;}function submitPopupModal(titre, ajaxFile, info, hauteur, largeur, message, object){	var annuler = false;	if ($("#submitPopupModal").length == 0)		$("body").append("<div id='submitPopupModal'><p></p></div>");	else		$("#submitPopupModal").dialog("destroy");		var opt = {width:hauteur, height: largeur, autoOpen: false, bgiframe:true, modal:true ,overlay: true, position: new Array('center', 128),title:titre, buttons : {}, close: function(e,a){			//	if (object)				//	$(object).children("input:checkbox")[0].checked = false; // TODO change ici quand tu aura trouver un solution				}};						if ($.browser.msie)			 opt = {width:hauteur, height: largeur,autoOpen: false, bgiframe:true, modal:true, position: new Array('center', 128), title:titre, buttons : {}, close: function(e,a){				//if (object)					//$(object).children("input:checkbox")[0].checked = false; // TODO change ici quand tu aura trouver un solution				}};			 		$("#submitPopupModal").dialog(opt);		$("#submitPopupModal p").empty();		//$("#submitPopupModal p").html(contenu);		var fenetreAttente = null;		$.ajax(			{				async:false,				url: "/ajax/" + ajaxFile + ".php",				dataType:"html",				data: info,				success: function(data) {					$("#submitPopupModal").html(data);					$("#submitPopupModal form #Annuler").click(function(){					$("#submitPopupModal").dialog("close");						return false;					});										$("#submitPopupModal form input[type='reset']").click(function(){							$("#submitPopupModal form").clearForm();							return false;					});										$("#submitPopupModal form").submit(function() {						var formulaire = $(this);						var dataSend = info +"&"+$(this).formSerialize(); 						$.ajax({							url: formulaire.attr("action"),							data:dataSend,							beforeSend:function(){							$("#submitPopupModal").dialog("close");fenetreAttente = simplePopupModal("Envoi en cours", "<img class='loadingImage' src='/images/loading.gif' alt='Image d'attente'/>", 500, 200,false,false);							},							success: function(){								fenetreAttente.dialog("close");															fenetreAttente = simplePopupModal("Envoi Terminée",  "<div class='confimEnvoi'><h3>Email envoyé à l'adresse suivante:</h3> <br/>"+$("#submitPopupModal form #Destinataire").fieldValue()+"</div>", 500, 200,true,false);						//if (object)    					//$(object).children("input:checkbox")[0].checked = false; // TODO change ici quand tu aura trouver un solution							}						})						return false;					})				}			}		)		$("#submitPopupModal p").children().show();		$("#submitPopupModal").dialog("open");		return annuler;}function simplePopupModal(titre, contenu, hauteur, largeur,buttonOk,functionOk,buttonCancel,functionCancel){	if ($("#simplePopupModal").length == 0)		$("body").append("<div id='simplePopupModal'><p class='popupParagraph'></p></div>");	else		$("#simplePopupModal").dialog("destroy");		var opt = {width:hauteur, height: largeur, autoOpen: false, bgiframe:true, modal:true ,overlay: true, position: new Array('center', 128), title:titre, buttons : {}};						if ($.browser.msie)			 opt = {width:hauteur, height: largeur,autoOpen: false, bgiframe:true, modal:true,position: new Array('center', 128), title:titre, buttons : {}};			 			 		if (buttonCancel == true)		{			opt.buttons = $.extend(opt.buttons, 			{				Annuler:function ()						{							$(this).dialog("close");							if (functionCancel)								functionCancel();						}			})		}				if (buttonOk == true)		{			opt.buttons = $.extend(opt.buttons, 			{				Ok:function ()						{							$(this).dialog("close");							if (functionOk)								functionOk();						}			})		}				$("#simplePopupModal").dialog(opt);								$("#simplePopupModal p").empty();				$("#simplePopupModal p").html(contenu);		$("#simplePopupModal p").children().show();		$("#simplePopupModal").dialog("open");		return $("#simplePopupModal");}function ajaxPopupModal(titre, ajaxFile, hauteur, largeur,buttonOk,functionOk,buttonCancel,functionCancel){	if ($("#ajaxPopupModal").length == 0)		$("body").append("<div id='ajaxPopupModal'><p></p></div>");	else		$("#ajaxPopupModal").dialog("destroy");		var opt = {width:hauteur, height: largeur, autoOpen: false, bgiframe:true, modal:true ,overlay: true, position: new Array('center', 128), title:titre, buttons : {}};						if ($.browser.msie)			 opt = {width:hauteur, height: largeur,autoOpen: false, bgiframe:true, modal:true,position: new Array('center', 128), title:titre, buttons : {}};			 			 		if (buttonCancel == true)		{			opt.buttons = $.extend(opt.buttons, 			{				Cancel:function ()						{							$(this).dialog("close");							if (functionCancel)								functionCancel();						}			})		}				if (buttonOk == true)		{			opt.buttons = $.extend(opt.buttons, 			{				Ok:function ()						{							$(this).dialog("close");							if (functionOk)								functionOk();						}			})		}				$("#ajaxPopupModal").dialog(opt);		$("#ajaxPopupModal p").empty();		$.ajax({		  async:false,		  url:ajaxFile,		  type: "GET",		  dataType:"html",		  success: function(html)		  {				if ($(".centre", html).length != 0)					$(".centre",html).appendTo($("#ajaxPopupModal p"));				else					$("#ajaxPopupModal p").append(html);		  },		  error: function()		  {}		})				$("#ajaxPopupModal p").children().show();		$("#ajaxPopupModal").dialog("open");		return $("#ajaxPopupModal");}function sendProdRequestErase(){	$.ajax({		url:"/librairies/supprim.php",		type: "GET",		data: {id: idProd, alternative: "prodProd"},		success: function(){				$(".supprimProdProp[rel='"+idProd+"']").parents("tr:first").remove();				idProd="0";		}	})}function sendPropRequestErase(){	$.ajax({		url:"/librairies/supprim.php",		type: "GET",		data: {id: idProp, alternative: "prop"},		success: function(){					$(".supprimProp[rel='"+idProp+"']").parents("tr:first").next().remove();					$(".supprimProp[rel='"+idProp+"']").parents("tr:first").next().remove();					$(".supprimProp[rel='"+idProp+"']").parents("tr:first").remove();				idProp="0";		}	})}$(document).ready(function (){ 	$.validator.addMethod("emailNotExist", function (value,element) {		var result = new Object();		result.check = "true";		$.ajax({			async:false,			timeout:300,			type: "post",			url: "/librairies/checkForm.php",			data: {testEmail:value},			dataType: "text",			success:function(msg){				result.check = msg;			}		});		return (result.check != "true");	}, "Cette email existe d&eacute;ja");		$.validator.addMethod("emailExist", function (value,element) {		var result = new Object();		result.check = "true";		$.ajax({			async:false,			timeout:300,			type: "post",			url: "/librairies/checkForm.php",			data: {testEmail:value},			dataType: "text",			success:function(msg){				result.check = msg;			}		});		return (result.check == "true");		return (result.check == "true");	}, "Cette email n'existe pas");					$.validator.addMethod("captcha", function (value,element) {		var result = new Object();		result.check = "false";		$.ajax({			async:false,			timeout:300,			type: "post",			url: "/librairies/checkForm.php",			data: {testRobot:value},			dataType: "text",			success:function(msg){				result.check = msg;			}		});		return (result.check == "true");	}, "Le code entré est érroné");		$.validator.addMethod("socExist", function (value,element) {		var result = new Object();		soctype = "";		if ($("input[name='type']").length != 0)		{  		$("input[name='type']").each(function() {	  			if (this.checked === true)  			{  				socType = $(this).attr('value');  				return false;  			}  		});		}		else		{      socType = $("#mySoc").attr("class");    }		$.ajax({			async:false,			timeout:300,			type: "post",			url: "/librairies/checkForm.php",			data: {testSoc:value, type:socType},			dataType: "text",			success:function(msg){				result.check = msg;			}		});		return (result.check !== "true");	}, "Cette société existé déja");		$.validator.addMethod("myEmail", function (value,element) {		regular = new RegExp("[a-z0-9!#$%&'*+\\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+\\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?","g");		return (regular.test(value));	}, "L'email est mal construit");		$.validator.addMethod("noTag", function (value,element) {		regular = new RegExp("<.*>*","g");		return (!regular.test(value));	}, "Le signe < et les balises sont interdites");			$.validator.addMethod("dateAfterNow", function (value,element) {		var result = new Object();		$.ajax({			async:false,			timeout:300,			type: "post",			url: "/librairies/checkForm.php",			data: {testDateAfterNow:value},			dataType: "text",			success:function(msg){				result.check = msg;			}		});		return (result.check === "true");	}, "Veuillez entrer une date &eacute;gal ou superieur à la date actuelle");		$.validator.addMethod("dateAfterDate", function (value,element, params) {		var result = new Object();		$.ajax({			async:false,			timeout:300,			type: "post",			url: "/librairies/checkForm.php",			data: {dateInf: $("input[name='" +params+"']").val(), dateSup:value},			dataType: "text",			success:function(msg){				result.check = msg;			}		});		return (result.check === "true");	}, "Veuillez entrer une date &eacute;gal ou superieur à la date de début");		$.validator.addMethod("propExist", function (value,element) {		var result = new Object();		$.ajax({			async:false,			timeout:300,			type: "post",			url: "/librairies/checkForm.php",			data: {checkNameProp: value},			dataType: "text",			success:function(msg){				result.check = msg;			}		});		return (result.check !== "true");	}, "Cette proposition existe déja");			/* Affichage des differentes partie dans l'interface admin*/		$("#contactUs").validate({		rules:{			votreNom:{required:true, noTag:true},			votrePrenom:{required:true, noTag:true},			votreMail:{required:true, email:true, noTag:true}		}	})				if ($("#connu").length != 0)	{		if ($("#connu").val() != "Autre")		{			$("#precision").hide();			$("#precision").parent().prev().hide();		} 				$("#connu").change(function() {			if ($(this).val() == "Autre")			{				$("#precision").show();				$("#precision").parent().prev().show();			}			else			{			  $("#precision").hide();			  $("#precision").parent().prev().hide();			}		})	}		if ($("#newProp2").length != 0)	{		if ($("#typeProp").val() != "Autre")		{			$("#autre").hide();			$("#autre").parent().prev().hide();		} 				$("#typeProp").change(function() {			if ($(this).val() == "Autre")			{				$("#autre").show();				$("#autre").parent().prev().show();			}			else			{			  $("#autre").hide();			  $("#autre").parent().prev().hide();			}		});		 //$("#datepicker").datepicker("dialog", "test");	};		if ($("#Type_propos").length != 0)	{		if ($("#Type_propos").val() != "Autre")		{			$("#AutreProposition").hide();			$("#AutreProposition").parent().prev().hide();		} 				$("#Type_propos").change(function() {			if ($(this).val() == "Autre")			{				$("#AutreProposition").show();				$("#AutreProposition").parent().prev().show();			}			else			{			  $("#AutreProposition").hide();			  $("#AutreProposition").parent().prev().hide();			}		})	}		if ($("#Cat_prod").length != 0)	{		if ($("#Cat_prod").val() != "Autre")		{			$("#Cat_prod_autre").hide();			$("#Cat_prod_autre").parent().prev().hide();		} 				$("#Cat_prod").change(function() {			if ($(this).val() == "Autre")			{				$("#Cat_prod_autre").show();				$("#Cat_prod_autre").parent().prev().show();			}			else			{			  $("#Cat_prod_autre").hide();			  $("#Cat_prod_autre").parent().prev().hide();			}		})	}		/*Pour regenerer un captcha cliquez-ici*/	$("#regenerate").click(function(){			$("#captchaImage").attr("src", "/librairies/anti-robots.php?strlen=5&name=checkIns&rndCache="+Math.random());		return false;	});		$("#regenerate2").click(function(){			$("#captchaImage").attr("src", "/librairies/anti-robots.php?strlen=5&name=checkIns&rndCache="+Math.random());		return false;	});		if ($("#Secteur").length != 0)	{				$("#Secteur").change(function() {			if ($(this).val() == "Autre")			{				$(this).parents("tr:first").next().find("input").val("");				$(this).parents("tr:first").next().show();			}			else			{			  $(this).parents("tr:first").next().hide();			}				})				if ($("#Secteur").val() == "Autre")			$(this).parents("tr:first").next().show();		else			$("#Secteur").parents("tr:first").next().hide();			}			$("#type_media").change(function() {		$(".showPart").toggleClass("hiddenPart");		$(".showPart").toggleClass("showPart");		$("." + $(this).val() + "Inscrit").toggleClass("hiddenPart");		$("." + $(this).val() + "Inscrit").toggleClass("showPart");	});	     $("#autrePresse").hide();	 $("#autrePresse").parent().prev().children().hide();	 $("#autreTV").hide();	 $("#autreTV").parent().prev().children().hide();	 $("#autreRadio").hide();	 $("#autreRadio").parent().prev().children().hide();	 $("#autreSite").hide();	 $("#autreSite").parent().prev().children().hide();	 $("#preciser").hide();	 $("#preciser").parent().prev().children().hide();	$("#type_site").change(function() {	     if ($(this).val() == "Autre_thematique")		 {			$("#preciser").parent().prev().children().show();			$("#preciser").show();		 }		else		{			$("#preciser").parent().prev().children().hide();			$("#preciser").hide();		}	})	 	$("#DomainePresse").change(function() {	     if ($(this).val() == "Autre")		 {			$("#autrePresse").parent().prev().children().show();			$("#autrePresse").show();		 }		else		{			$("#autrePresse").parent().prev().children().hide();			$("#autrePresse").hide();		}	})		$("#genre").change(function() {	     if ($(this).val() == "Autre")		 {			$("#autreTV").parent().prev().children().show();			$("#autreTV").show();		}		else		{			$("#autreTV").parent().prev().children().hide();			$("#autreTV").hide();		}	})		$("#type_radio").change(function() {	     if ($(this).val() == "Autre")		 {			$("#autreRadio").parent().prev().children().show();			$("#autreRadio").show();		}		else		{			$("#autreRadio").parent().prev().children().hide();			$("#autreRadio").hide();		}	})		$("#DomaineSite").change(function() {	     if ($(this).val() == "Autre")		 {			$("#autreSite").parent().prev().children().show();			$("#autreSite").show();		}		else		{			$("#autreSite").parent().prev().children().hide();			$("#autreSite").hide();		}	})			$(".formMediaModif").validate({		rules: 		    {				nom_media:{required:true, maxlength:64, noTag:true},				description:{required:true, noTag:true},				mots_cles:{required:true, noTag:true}, // to check to remove					audience_media:{maxlength:64, noTag:true}, // to check to remove					diffusion_media:{maxlength:64, noTag:true}, // to check to remove					fileUploads: {accept:"png|jpeg|gif|jpg", noTag:true}			},		messages:		{				fileUploads: {accept:"Seul les images sont autoris&eacute;es (png,jpeg,jpg,gif)"}		}		})			if ($("#formAjoutSupport").length != 0)		{    	$("#formAjoutSupport").validate({    		rules:     		    {    				nom_media:{required:true, maxlength:64, noTag:true},    				description:{required:true, noTag:true},    				mots_cles:{required:true, noTag:true}, // to check to remove	    				audience_media:{maxlength:64, noTag:true}, // to check to remove	    				diffusion_media:{maxlength:64, noTag:true}, // to check to remove	    				fileUploads: {accept:"png|jpeg|gif|jpg", noTag:true}    			},    		messages:    		{    				fileUploads: {accept:"Seul les images sont autoris&eacute;es (png,jpeg,jpg,gif)"}    		}    	})	}		$("#formModifProduit").validate({		rules: 		    {				nom:{required:true, noTag:true},				marque:{required:true, noTag:true},				description:{required:true, noTag:true},				categorie:{required:true, noTag:true},				mots_cles: {required: true, noTag:true},				"cible_individu[]":{required: true, noTag:true},				"cible_age[]":{required: true, noTag:true},				quantite:{required:true, number:true, noTag:true},				prix:{required:true, number:true, noTag:true},				imageProduit: {accept:"png|jpeg|gif|jpg", noTag:true}			},			messages:		{				imageProduit: {accept:"Seul les images sont autoris&eacute;es (png,jpeg,jpg,gif)"}		}	})			$("#formAjoutProduit").validate({		rules: 		    {				nom:{required:true,maxlength:64, noTag:true},				marque:{required:true,maxlength:64, noTag:true},				categorie:{required:true, maxlength:64, noTag:true},				"cible_individu[]":{required: true, noTag:true},				"cible_age[]":{required: true, noTag:true},				description:{required:true, noTag:true},				mots_cles:{required:true, noTag:true},				quantite:{required:true,maxlength:9,number:true, noTag:true},				prix:{required:true,maxlength:9,number:true, noTag:true},				imageProduit: {accept:"png|jpeg|gif|jpg", noTag:true}			},			messages:		{				imageProduit: {accept:"Seul les images sont autoris&eacute;es (png,jpeg,jpg,gif)"}		}	})			$("#formAjoutSupportBis").validate({		rules: 		    {				description:{required:true, noTag:true},				mots_cles: {required: true, noTag:true},				imageMedia: {required:true, accept:"png|jpeg|gif|jpg", noTag:true}			},			messages:		{				imageMedia: {accept:"Seul les images sont autoris&eacute;es (png,jpeg,jpg,gif)"}		}	})				$("#formModifProduit").validate({		rules: 		    {				nom_media:{required:true, noTag:true}			}	});		if ($("#forgetPassword").length != 0)	{		$("#forgetPassword").click(function(){		result = forgetPopupModal("Mot de passe oublié", "formEmailForget",{}, 300,100);		});	}			if ($(".formMediaModif").length != 0)	{			$(".showPart").addClass('hiddenPart');			$(".showPart").removeClass('showPart');						$("." +$("#type_media").val()+"Inscrit").each(function() {$(this).removeClass('hiddenPart').addClass('showPart')});			$('.formMediaModif .validText').each(function () {			$(this).show();			$(this).parent().show();			$(this).parent().prev().children().show();			});			}		/*formulaire dinscription 1 en ajax*/			$("#inscriptionGen").validate({		rules: {				nom:{required:true, maxlength:32, noTag:true},				fonction:{required:true, maxlength:50, noTag:true},				email:{required:true,myEmail:true,maxlength:64,emailNotExist:true, noTag:true},				emailconfirm:{required:true,equalTo:"#email",maxlength:64, noTag:true},				prenom:{required:true,maxlength:32, noTag:true},				site:{maxlength:128, noTag:true},				societe:{required:true,maxlength:48, noTag:true, socExist:true},				indicatif:{minlength:10, maxlength:10, number:true, required:true, noTag:true},				fax:{minlength:10, maxlength:10, number:true, noTag:true},				code_postal:{minlength:4,maxlength:5,number:true, noTag:true},				mot_de_passe:{required:true, minlength:6,maxlength:32, noTag:true},				pass:{required:true, equalTo:"#mot_de_passe",minlength:6,maxlength:32, noTag:true},				adresse:{minlength:5,maxlength:200, noTag:true},				//password:{required:true,},				ville:{maxlength:70, noTag:true},				connu:{required:true, noTag:true},				pays:{noTag:true},				precisions:{maxlength:128, noTag:true},				langue:{noTag:true},				checksRobots:{required:true,captcha:true, noTag:true},				type:{required:true, noTag:true},				cgu: {required:true, noTag:true}		},		messages: {			cgu: {required:"Veuillez cochez cette case pour accepter les conditions"}		},		onkeyup:false	});			if ($('.annonceurForm').length == 0)	{		if ($(".formMediaModif").length != 0)		{			$(".finalForm").validate({				rules:{					nom_media:{required:true, noTag:true}				}			})			}		else		{			$(".finalForm").validate({				rules:{					nom_media:{required:true, noTag:true}				}			})			}			}	else	{		$("#finalForm").validate({			rules:{				Secteur:{required:true},				AutreSecteur:{maxlength:128, noTag:true},				description:{required:true, noTag:true},				mots_cles:{required:true, noTag:true}			}		})			}		if ($("#formAjoutMediaDernier").length != 0)		{			$("#formAjoutMediaDernier").validate({				rules:{					description:{required:true, noTag:true},					mots_cles:{required:true, noTag:true}				}			})		}			/*modification de l'inscription*/	if ($("#formAjoutNews").length != 0)	{		$("#formAjoutNews").validate({			rules:{				newsSubject:{required:true, maxlength:50},				contentNews:{required:true}			}		})	}	if ($("#formModifNews").length != 0)	{		$("#formModifNews").validate({			rules:{				newsSubject:{required:true, maxlength:50},				contentNews:{required:true}			}		})	}			/*Partie une de nouvelle proposition*/		if ($("#addPropPartOne").length != 0)	{	 if ($("#modifExist").length == 0)	 {		$("#addPropPartOne").validate({			submitHandler: function(form)			{			if ($(".fileAdded").length !== 0)				simplePopupModal("Fichiers en cours d'envoi", "<h4 style='text-align:center;margin-top:20px'>Vos fichiers sont en cours d'envoi, veuillez patienter...</h4>", 500, 100,false);				form.submit();			},			rules:{				support:{required:true, maxlength:50},				Type_propos:{required:true, maxlength:50},				AutreProposition:{minlength:1,maxlength:50},				Nom_proposition:{required:true, propExist:true, maxlength:50},				debut:{date:true,maxlength:12, dateAfterNow:true},				fin:{date:true,maxlength:12,dateAfterNow:true, dateAfterDate:"debut"},				description2:{minlength:1},				Valo_propos_M:{minlength:1}			},			onfocusout:false,			onkeyup: false,			focusInvalid: false		});	 }	 else	 {      $("#addPropPartOne").validate({			submitHandler: function(form)			{			if ($(".fileAdded").length !== 0)				simplePopupModal("Fichiers en cours d'envoi", "<h4 style='text-align:center;margin-top:20px'>Vos fichiers sont en cours d'envoi, veuillez patienter...</h4>", 500, 100,false);				form.submit();			},			rules:{				support:{required:true, maxlength:50},				Type_propos:{required:true, maxlength:50},				AutreProposition:{minlength:1,maxlength:50},				Nom_proposition:{required:true, maxlength:50},				debut:{date:true,maxlength:12},				fin:{date:true,maxlength:12, dateAfterDate:"debut"},				description2:{minlength:1},				Valo_propos_M:{minlength:1}			},			onfocusout:false,			onkeyup: false,			focusInvalid: false		});   }	}			/*Partie user modif*/	$("#inscriptionGenUpdateUser").validate({	submitHandler: function(form){	//$("#inscriptionGenUpdateUser  #mot_de_passe").val(MD5($("#inscriptionGenUpdateUser  #email").val() + $("#inscriptionGenUpdateUser  #mot_de_passe").val()));	//$("#inscriptionGenUpdateUser  #pass").val(MD5($("#inscriptionGenUpdateUser  #email").val() + $("#inscriptionGenUpdateUser  #pass").val()));	$(form).ajaxSubmit({success:function (){	window.location = "societe_admin.php";	}		});	},		rules: {				nom:{required:true, noTag:true},				fonction:{required:true, noTag:true},				indicatif:{minlength:10, number:true, required:true, noTag:true},				gsm:{minlength:10, number:true, noTag:true},				fax:{minlength:10, number:true, noTag:true},				email:{required:true,email:true, noTag:true},				prenom:{required:true, noTag:true},				fonction:{required:true, noTag:true},				mot_de_passe:{required:true, minlength:6, noTag:true},				pass:{required:true, equalTo:"#mot_de_passe", noTag:true},				adresse:{required:true, noTag:true}		}	});		/*Partie Societe modif*/	$("#inscriptionGenUpdateSoc").validate({	rules: {				societe:{required:true, noTag:true},				code_postal:{required:true, noTag:true},				adresse:{required:true, noTag:true},				ville:{required:true, noTag:true},				//connu:{required:true},				pays:{required:true, noTag:true}				//precisions:{required:true},				//langue:{required:true},		}	});	$("#inscriptionGenUpdateSoc .activConnu").each(function() {		$(this).show();		$(this).parent().prev().show();	})			if ($("#contentLoginDev").length != 0)		$("#compteRebours").countdown({until:new Date(2009,02,25,14,14,28)});	$("#compteur #imageEnvoie").click(function(){		$("#compteur form").submit();		return false;	})	$("#checksRobots").focus(function(){		$(this).val('');	});		$("#left form").submit(function(){	  //$(this).find('#passVerif').val(MD5($(this).find('#userVerif').val() +$(this).find('#passVerif').val()));	});			/*simple accordion for admin menu*/		$(".subMenuAdmin").hide();	$(".linkSociete").click(function(){		$(this).parent().parent().next().toggle();		$(this).parent().parent().next().next().toggle();		return false;	})	/*This partis for the send email */	if ($("#sendEmail").length != 0)	{		$(".texteMessage").hide();		$("#sendEmail a").each(function(){			$(this).click(function(){						//$("." + $(this).attr("rel")).toggle();				simplePopupModal("Email", $("." + $(this).attr("rel")).html(), 500, 400,true);			return false;		})		})		;	}		/*This partis for the news */	if ($("#sendNews").length != 0)	{		$(".texteMessage").hide();		$("#sendNews a").each(function(){			$(this).click(function(){						//$("." + $(this).attr("rel")).toggle();				simplePopupModal("News", $("." + $(this).attr("rel")).html(), 500, 200,true);			return false;		})		})		;	}			//$("#adminPage .formActivate").ajaxForm();	$("#adminPage .formActivate").submit(function() {	var result = false;		if ($(this).children("input:checkbox")[0].checked)		 result = submitPopupModal("Email a envoyer", "formEmailAdmin", $(this).formSerialize(), 560,400,"", this);		 else			$(this).ajaxSubmit();		 return false;	});		$("#adminPage .formActivate input").click(function(){								$(this).parent().submit();		});			/*Check all the boxes in admin interfaces*/	$(".toggleUser input").click(function() {	  var checked = this.checked;	  $(this).parent().parent().parent().next().show();	  $(this).parent().parent().parent().next().find(".formActivate input").each(function(){	    this.checked = checked;	  });	  $(this).parent().parent().parent().next().find(".formActivate").submit();	})		/*Les differentes popup*/		 	//$("#alertUn").dialog(opt);					/*Gestion des fichier multiple*/		if ($(".socFile").length != 0)	{		var num = 0;			$(".socFile a.addFile").click(function() {				++num;				  var addFile = $(this).parent().parent().siblings(".fileAdded:last");				  if ($(this).parent().parent().siblings(".fileAdded:last").length == 0)					 addFile = $(this).parent().parent();			if ($("input[type='file']").length < 3)			{				addFile.after("<tr class='fileAdded'><td width='150px'><label for='filesoc'>Fichier : </label></td><td width='150px'><input class='fileInsert' type='file' name='filesoc"+num+"' id='filesoc"+num+"'  size='21'><span class='errorFile' style='margin-left:5px;display:none; color:red'>Fichier déja present sur le serveur</span></td><td><a class='removeFile' href='#'>Supprimer</a></td></tr><tr class='socFileSecond'><td><a class='addFileSecond' href='#'>Ajouter un Fichier</a></td><td width='45'>&nbsp;</td></tr>");				$(".fileInsert").load(function() {									});				$(this).parent().parent().siblings(".fileAdded:last").find("a.removeFile").click(function() {					$(".socFileSecond").find("a.addFileSecond").show();					$(this).parent().parent().remove();				})			}			if ($("input[type='file']").length == 3)				$(this).parent().parent().siblings(".socFileSecond").find("a.addFileSecond").hide();			$(this).parent().parent().siblings(".socFileSecond").find("a.addFileSecond").click(function() {				if ($("input[type='file']").length < 3)				{					$(".socFile a.addFile:last").click();					$(this).parent().parent().remove(); // a vérifier				}				return false;				})			if ($("input[type='file']").length != 0)				$(this).parent().parent().hide(); // a vérifier			else				$(this).parent().parent().show(); // a vérifier			return false;		});			};	$(".suppFileLink").each(function(){	 	 $(this).click(function(){		link = $(this);		$.ajax({				type:"GET",				url:$(this).attr("href"),				success:function(html){					link.prev().remove();					link.remove();				}			})			return false;	 	 })		})		/*dans le cas d'une validation exacte afficher un popup ici même*/		if ($(".lanceur_index #loginOk").length != 0)	{		simplePopupModal("Confirmation d'inscription", $(".lanceur_index #loginOk").html(), 500,400, true, false);		//alert(1);	};			/*Ici le lien de suppresion en ajax pour les prduit et les media, pour l'instant*/		$(".eraseLink").click(function(){		var link = $(this);		$.ajax({			url:$(this).attr("href"),			success: function(){				location.reload();			}		})		return false;	});		$(".eraseLinkStay img").click(function(){		var link = $(this).parent();		$.ajax({			url:link.attr("href"),			success: function(){				//location.reload();				link.parents("tr:first").remove();			}		})			return false;	});		/*Ici nous gerons le système de retour dans le formulaire d'inscription */	/*Ici nous traitons le tri des tables, pour les differentes pages*/	/*Email envoyés*/					      //alert($("#emailTable tbody").children().length);              			/*Mon generique*/	$("#newsBox").generic({visible:1, speed:4000,interval:5000});			/*Popup d'envoie de d'emai oublié*/	/***test alert***/	//if ($("#myNewEmail").length != 0)		//$("#envoyer").click(function() {alert($("#myNewEmail").val()); return false});		//$("#envoyer").click(function() {alert($("#myNewEmail").val()); return false});		/*Affichage contact*/	if ($("#contactShow").length == 1)	{		$("#contactShow:first").click(function(){		contactPopupModal("Contact", 230, 500, true);		});	}	if ($("#cancelButton").length != 0)	{		$("#cancelButton").click(function() {			window.location = "/index.php";			return false;		});	}		/*Popup condition général*/	if ($("#cguLink").length != 0)	{		$("#cguLink").click(function(){			ajaxPopupModal("Conditions Légales", "/cgu.php", 789, 350,true);			return false;		})	}		if ($("#checkMaintenance").length !== 0)	{		$(".maintenance").ajaxForm();			$("#checkMaintenance").click(function(){				$(".maintenance").submit();		})	}		if ($("#addSupportOk").length !== 0)	{		simplePopupModal("Confirmation de rajout de produit", $("#addSupportOk").html(), 320, 128,true);	}			if ($("#debut").length !== 0)	{		var now = new Date();		$("#debut").datepicker();		var month = "";		if (now.getMonth() < 9)			month = "0" + (now.getMonth() + 1);		else if (now.getMonth >= 9);			month = "" + (now.getMonth() + 1);		//$("#debut").val(now.getDate()+"/"+ month +"/"+now.getFullYear());			}	if ($(".allActivite").length !==0)	{		//$(".allActivite").draggable({cursor:'crosshair', opacity:'0.70'});	}		if ($("#fin").length !== 0)	{		$("#fin").datepicker();	}		/*Systeme de rajout - modification et supression de produit dans les nouvelles propositions*/				if ($("#ajoutProdProduct").length !== 0)	{		var valuePropProd = 0;				if ($(".infoPropProd").length != 0)		{			valuePropProd = Math.ceil($(".infoPropProd").children().length / 2);			newsPropModif2();		}				$("#ajoutProdProduct").click(function() {			if ($(".infoPropProd").children().length === 0)			{				$("#erreurAjout").show();				return false;			}			return true;		});				$("#formProdProduit").validate({			submitHandler:function(form){				$.ajax({				url:"/librairies/PropProduct.php",				type:"post",				data: $("#formProdProduit").formSerialize() + "&action=add&prod=produit_"+valuePropProd,				dataType:"text",				success:function(text){				    if ($("#formProdProduit #Cat_prod").val() == "Autre")				      categorie = $("#Cat_prod_autre").val();				    else				      categorie = $("#formProdProduit #Cat_prod :selected").text();				      						$("#tabResultPropProduit").append('<tr><td width="130"><a href="#" class="popupInfoProd" rel="produit_'+valuePropProd+'">'+$("#formProdProduit #produit").val()+'</a><br /></td><td width="110" align="right">'+categorie+'</td><td width="80" align="right">'+$("#formProdProduit #produit4").val()+'</td><td width="80" align="right">'+$("#formProdProduit #produit3").val()+'</td><td width="70"><a href="#" rel="produit_'+ valuePropProd +'" class="modifPropProd">Modifier</a><br /><a class="suppProdProduct" id="suppProdProduct" href="#" rel="produit_'+ valuePropProd +'">Supprimer</a></td></tr>');						$(".infoPropProd").append("<span class='produit_"+valuePropProd+"' >"+ $("#formProdProduit #Cat_prod :selected").text() +"</span>");						$(".infoPropProd").append("<span class='produit_"+valuePropProd+"'>"+ $("#formProdProduit #produit2").val() +"</span>");						$(".infoPropProd").append("<span class='produit_"+valuePropProd+"'>"+ $("#formProdProduit #Cat_prod_autre").val() +"</span>");						$("#erreurAjout").hide();						++valuePropProd;						newsProp2();					}				});			},			rules: {					produit: {required:true, maxlength:50},					Cat_prod: {maxlength:50},					produit2: {required:true},					produit3: {number:true, maxlength:50},					produit4: {number:true, maxlength:50}			}		})	}		/* Affichage des popups pour la confirmation de la validation des données rentrées lors d'une nouvelle proposition */		if ($(".produitConfirmPopup").length != 0)	{		$(".produitConfirmPopup").click(function() { simplePopupModal("Information sur le produit", "<p>Nom du produit: "+$(this).text()+"</p><p>Catégorie:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(0)").text()+"</p><p>Description:"+$(".infoPropProd ."+$(this).attr("rel")+":eq(1)").text()+"</p><p>Valeur de dotation:"+$(this).parent().next().next().text()+"</p><p>Nombre:"+$(this).parent().next().next().next().text()+"</p>", 500, 200,true,false);return false;});	}			if (($("input[type='file']").length != 0))	{		//$(this).blur(function(){alert(2)});	}		$("#search").draggable({cursor:"move"});		/*Gestion des popup dans propositions_en_cours*/	if ($(".infoSupportLink").length != 0)	{		$(".infoSupportLink").click(function() {			$popup = ajaxPopupModal("Description du support", "/ajax/detailSupport.php?infoSupport", 768, 408, true);			return false;		})	}	if ($(".infoPropLink").length != 0)	{		$(".infoPropLink").click(function() {			$popup = ajaxPopupModal("Description du support", "/ajax/detailSupport.php?infoProp", 768, 250, true);			return false;		})	}	if ($(".ProduitProposition").length != 0)	{		$(".ProduitProposition").hide();		$(".openProdPros").click(function(){			$(this).parents("table:first").parents("tr:first").prev().find(".ProduitProposition").toggle();			$(this).toggle();			return false;		});		$(".closeProdPros").click(function(){			$(this).parents("table:first").parents("tr:first").next().find(".openProdPros").toggle();			$(this).parents("table:first").prev().toggle();			$(this).parents("table:first").find(".ProduitProposition").toggle();			return false;		});		$(".printAllProd").click(function() {			$(".openProdPros").click();			return false;		});		$(".addNewProdProp").click(function(){			proposition = $(this).attr("rel");			propAddButton = $(this);			ajaxPopupModal("Description du support", "/ajax/ajaxFormAddProd", 400, 310, false);			$("#ajaxPopupModal").find("form").each(function(){				$(this).append("<input type='hidden' name='id' value='"+proposition+"'/>");					$("#popupFormPropProdAdd").validate({						submitHandler: function(form){							$(form).ajaxSubmit({								dataType: "text",								success: function (text) {								//alert($("#addProductHere").length);							  propAddButton.parents("table:first").prev().append("<tr valign='top'><td width='221'><a href='#'>"+$("#ajaxPopupModal").find("form").find("#produit").val()+"</a></td><td align='right' width='221'>"+$("#ajaxPopupModal").find("form").find("#produit3").val()+"&euro;</td><td align='right' width='221'>"+$("#ajaxPopupModal").find("form").find("#produit4").val()+"</td><td><a href='#' class='supprimProdProp' rel='"+text+"'>Supprimer</a></td></tr>");								$(".supprimProdProp:last").click(function(){									idProd = $(this).attr("rel");									simplePopupModal("Confirmation de suppression", "<h4 style='margin:24px auto 0 43px'>Supprimer le produit \""+$(this).parents("tr:first").children("td:first").text()+"\" de votre proposition?</h4>", 500, 100,true,sendProdRequestErase,true,false);									return false;								})		//						$("#addProductHere").append("<tr valign='top'><td width='221'>ok</td><td width='221'>ok</td><td width='221'>dqsdqs</td></tr>");							//	$("#addProductHere").append("<tr valign='top'><td>dqdqdqdqdqsdqsdq</td></tr>");								$("#ajaxPopupModal").dialog("close");}							})						},						rules: {						produit: {required:true, maxlength:50},						Cat_prod: {maxlength:50},						produit2: {required:true},						produit3: {number:true, maxlength:50},						produit4: {required:true, number:true, maxlength:50}					}				});			})			return false;		});				$(".supprimProdProp").click(function(){		idProd = $(this).attr("rel");		simplePopupModal("Confirmation de suppression", "<h4 style='margin:24px auto 0 43px'>Supprimer le produit \""+$(this).parents("tr:first").children("td:first").text()+"\" de votre proposition?</h4>", 500, 100,true,sendProdRequestErase,true,false);		return false;		})				$(".supprimProp").click(function() {			idProp = $(this).attr("rel");			simplePopupModal("Confirmation de suppression", "<h4 style='margin:24px auto 0 43px'>Supprimer la proposition \""+$(this).parents("tr:first").children("td:eq(1)").text()+"\" de votre liste?</h4>", 500, 100,true,sendPropRequestErase,true,false);		});	}		if ($(".propValidAdmin").length !== 0)	{		$(".propValidAdmin").click(function() {			Coche = 0;			if (this.checked)				Coche = 1;			idProp = $(this).val();			$.ajax({				type:"POST",				url:"/librairies/action.php",				data:{validProp:idProp, validPropCoch:Coche},				success: function()				{					/*if (Coche == 1)						simplePopupModal("Confirmation d'activation", "La proposition est active", 500, 200,true);					else						simplePopupModal("Confirmation d'activation", "La proposition est desactive", 500, 200,true);*/				}			});		});	}		if ($(".autoLinkAnnonceurRepOk").length !== 0)	{		$(".autoLinkAnnonceurRepOk").click(function() {			idProp = $(this).attr("value");			idRep = $(this).attr("rel");			currentLink = $(this);			simplePopupModal("Confirmation de validation", "<h4 style='margin:18px 0 0 148px'>Accepter cette r&eacute;ponse? </h4>", 500, 100,true,function() {      $.ajax({				type:"POST",				url:"/librairies/action.php",				data:{Encours:idProp, validPropCoch:1, reponse:idRep},				success: function()				{				  idProp = 0;			    idRep = 0;				  currentLink.parents("tr:first").remove();				}			});      },true,false);				return false;		});	}			if ($(".autoLinkAnnonceurRepKo").length !== 0)	{		$(".autoLinkAnnonceurRepKo").click(function() {			idProp = $(this).attr("value");			idRep = $(this).attr("rel");			currentLink = $(this);						simplePopupModal("Confirmation de supression", "<h4 style='margin:18px 0 0 148px'>Supprimer cette r&eacute;ponse?</h4>", 500, 100,true,function() {      $.ajax({				type:"POST",				url:"/librairies/action.php",				data:{Encours:idProp, validPropCoch:0, reponse:idRep},				success: function()				{				  idProp = 0;			    idRep = 0;				  currentLink.parents("tr:first").remove();				}			});      },true,false);				return false;		});	}			if ($(".autoLinkMediaRepOk").length !== 0)	{		$(".autoLinkMediaRepOk").click(function() {			idProp = $(this).attr("value");			idRep = $(this).attr("rel");			currentLink = $(this);			simplePopupModal("Confirmation de validation", "<h4 style='margin:18px 0 0 148px'>Valider cette r&eacute;ponse?</h4>", 500, 100,true,function() {      $.ajax({				type:"POST",				url:"/librairies/action.php",				data:{assocMediaOk:idProp, validPropCoch:1, reponse:idRep},				success: function()				{				  idProp = 0;          idRep = 0;          currentLink.parents("tr:first").remove();				}			});      },true,false);				return false;		});	}			if ($(".autoLinkMediaRepKo").length !== 0)	{		$(".autoLinkMediaRepKo").click(function() {			idProp = $(this).attr("value");			idRep = $(this).attr("rel");			currentLink = $(this);			simplePopupModal("Confirmation de supression", "<h4 style='margin:18px 0 0 148px'>Supprimer cette r&eacute;ponse?</h4>", 500, 100,true,function() {      $.ajax({				type:"POST",				url:"/librairies/action.php",				data:{assocMediaOk:idProp, validPropCoch:0, reponse:idRep},				success: function()				{					idProp = 0;          idRep = 0;          currentLink.parents("tr:first").remove();				}			});      },true,false);				return false;		});	}			if ($(".autoLinkMediaNegatifRepOk").length !== 0)	{		$(".autoLinkMediaNegatifRepOk").click(function() {			idProp = $(this).attr("value");			idRep = $(this).attr("rel");			currentLink = $(this);			simplePopupModal("Confirmation de validation", "<h4 style='margin:18px 0 0 148px'>Valider cette r&eacute;ponse?</h4>", 500, 100,true,function() {      $.ajax({				type:"POST",				url:"/librairies/action.php",				data:{assocMediaKo:idProp, validPropCoch:1, reponse:idRep},				success: function()				{				  idProp = 0;          idRep = 0;          currentLink.parents("tr:first").remove();				}			});      },true,false);				return false;		});	}		if ($(".autoLinkMediaNegatifRepKo").length !== 0)	{		$(".autoLinkMediaNegatifRepKo").click(function() {			idProp = $(this).attr("value");			idRep = $(this).attr("rel");			currentLink = $(this);			simplePopupModal("Confirmation de supression", "<h4 style='margin:18px 0 0 148px'>Supprimer cette r&eacute;ponse?</h4>", 500, 100,true,function() {      $.ajax({				type:"POST",				url:"/librairies/action.php",				data:{assocMediaKo:idProp, validPropCoch:0, reponse:idRep},				success: function()				{					idProp = 0;          idRep = 0;          currentLink.parents("tr:first").remove();				}			});      },true,false);				return false;		});	}			//mediaEnCours mediaAssocOk	if ($(".infoSupport").length != 0)	{		$(".infoSupport").click(function() {			$idProp = $(this).attr("rel");			$popup = ajaxPopupModal("Description du support", "/ajax/detailSupport.php?infoProp="+$idProp, 768, 408, true);			return false;		})	}		if ($(".infoProposition").length != 0)	{		$(".infoProposition").click(function() {			$idProp = $(this).attr("rel");			$popup = ajaxPopupModal("Description du support", "/ajax/infoReponse.php?id="+$idProp, 768, 408, true);			return false;		})	}		/*Ici coté annnonceur: validation d'un proposition partie 1*/		if ($(".checkBoxProduitProp").length !== 0)	{		//erreurProduitPasSelection		$("#repondre").click(function() {			checkedHere = false;			$(".checkBoxProduitProp").each(function(){				if (this.checked)				{					checkedHere = true;					return false;				}			});						if (checkedHere === false)			{				$("#erreurProduitPasSelection").show();				return false;			}	 });	}	if ($(".proposition").length != 0)	{	 	$("#valider").click(function() {			checkedHere = false;			$(".proposition").each(function(){				if (this.checked)				{					checkedHere = true;					return false;				}			});						if (checkedHere === false)			{				$("#erreurProduitPasSelection").show();				return false;			}	 });  }    if ($(".annonceurAccept").length != 0)  {        $(".Accepter").click(function() {			idReponse = $(this).attr("rel");			currentLink = $(this);			mySoc = $(this).attr("rel2");				simplePopupModal("Confirmation d'association", "<p>Votre association avec l'annonceur va être envoyée.</p> <p>Après acceptation de l'administrateur, vous serez mis en contact avec l'interressé.</p><p> Votre proposition sera ranger dans votre historique </p>", 500, 100,true,function() {         $.ajax({				type:"POST",				url:"/librairies/action.php",				data:{acceptAnnonceurReponse:1, reponse:idReponse, texte:"L association avec cette société est accepté", idSoc:mySoc},				success: function()				{				  idReponse = 0;				  currentLink.parents("tr:eq(1)").prev().remove();				  currentLink.parents("tr:eq(1)").remove();				}			 });			 return false;		  }, true, false);      });							$(".Refuser").click(function() {			idReponse = $(this).attr("rel");			currentLink = $(this);			mySoc = $(this).attr("rel2");				simplePopupModal("Refus d'association", "<p>Vous avez &eacute;mis un refus d'association.</p> <p>Veuillez preciser votre motif dans l'encadr&eacute; ci-dessous:</p><br/><div><textarea id='confirmRefus'  cols='45' rows='5'></textarea></div>", 500, 270,true,function() {        	$.ajax({				type:"POST",				url:"/librairies/action.php",				data:{acceptAnnonceurReponse:0, reponse:idReponse,texte:$("#confirmRefus").val(), idSoc:mySoc},				success: function()				{				  idReponse = 0;				  currentLink.parents("tr:eq(1)").prev().remove();				  currentLink.parents("tr:eq(1)").remove();				}			 });			 return false;		  }, true, false);			return false;		});    }    if ($(".annulationEchange").length != 0)	{     $(".annulationEchange").click(function() {     			idReponse = $(this).attr("rel");			currentLink = $(this);		  				simplePopupModal("Confirmation d'annulation", "<h4 style='margin:18px 0 0 91px'>Voulez-vous annuler cette op&eacute;ration?</h4>", 500, 100,true,function() {      $.ajax({				type:"POST",				url:"/librairies/action.php",				data:{annuleAnnonceur:true, reponse:idReponse},				success: function()				{				  idReponse = 0;			    currentLink.parents("tr:eq(1)").remove();				}			 });      },true,false);				 return false;     });  }    if ($("#addPropositionOk").length != 0)  {    ajaxPopupModal("Confirmation d'ajout de prospition", "/ajax/propositionOk.php", 500, 300,true);  }    if ($("#addProdPropOk").length != 0)  {    ajaxPopupModal("Confirmation d'ajout de proposition", "/ajax/repPropositionProduitOk.php", 500, 300,true);  }      if ($("#formAjoutProduit select[name='categorie']").length != 0)  {  	if ($("#formAjoutProduit select[name='categorie']").val() != "Autre")  	{  		$("#formAjoutProduit input[name='AutreCategorie']").hide();  		$("#formAjoutProduit input[name='AutreCategorie']").parent().prev().hide();  	}  	else  	{  		$("#formAjoutProduit input[name='AutreCategorie']").show();  		$("#formAjoutProduit input[name='AutreCategorie']").parent().prev().show();  	}  	  	$("#formAjoutProduit select[name='categorie']").change(function() {  		if ($(this).val() == "Autre")  		{  			$("#formAjoutProduit input[name='AutreCategorie']").show();  			$("#formAjoutProduit input[name='AutreCategorie']").parent().prev().show();  		}  		else  		{  		  $("#formAjoutProduit input[name='AutreCategorie']").hide();  		  $("#formAjoutProduit input[name='AutreCategorie']").parent().prev().hide();  		}  	})  }        if ($("#formModifProduit select[name='categorie']").length != 0)  {  	if ($("#formModifProduit select[name='categorie']").val() != "Autre")  	{  		$("#formModifProduit input[name='AutreCategorie']").hide();  		$("#formModifProduit input[name='AutreCategorie']").parent().prev().hide();  	}  	else  	{  		$("#formModifProduit input[name='AutreCategorie']").show();  		$("#formModifProduit input[name='AutreCategorie']").parent().prev().show();  	}  	  	$("#formModifProduit select[name='categorie']").change(function() {  		if ($(this).val() == "Autre")  		{  			$("#formModifProduit input[name='AutreCategorie']").show();  			$("#formModifProduit input[name='AutreCategorie']").parent().prev().show();  		}  		else  		{  		  $("#formModifProduit input[name='AutreCategorie']").hide();  		  $("#formModifProduit input[name='AutreCategorie']").parent().prev().hide();  		}  	})  }      //addProdPropOk       // alert($('.preview').length);  /*$('.preview').tooltip({     delay: 0,     showURL: false,     bodyHandler: function() {         return $("<img/>").attr("src", this.src);     }   })*/  $('.screenshot').preview({width:"120"});      /* Popup pour l'ajout d'un logo societe*/  if ($("#modifLink").length !== 0)  {    $("#modifAccountForm").validate({		rules: {				site_web:{maxlength:128, noTag:true},				//raison_sociale:{required:true,maxlength:48, noTag:true, socExist:true},				telephone:{minlength:10, maxlength:10, number:true, required:true, noTag:true},				fax:{minlength:10, maxlength:10, number:true, noTag:true},				code_postal:{required:true,minlength:4,maxlength:5,number:true, noTag:true},				mot_de_passe:{required:true, minlength:6,maxlength:32, noTag:true},				mot_de_passe_verification:{required:true, equalTo:"#mot_de_passe",minlength:6,maxlength:32, noTag:true},				adresse:{required:true,minlength:5,maxlength:200, noTag:true},				//password:{required:true,},				ville:{required:true,maxlength:70, noTag:true},				pays:{required:true, noTag:true},				description:{minlength:5, noTag:true},				mots_cles:{noTag:true}				//langue:{required:true, noTag:true},				//checksRobots:{required:true,captcha:true, noTag:true},				//type:{required:true, noTag:true},				//cgu: {required:true, noTag:true}		}	});	    $("#modifLink").click(function(){          ajaxPopupModal("Modifier votre logo", "/ajax/logo_soc.php", "500", "100");          $("#annulerFileAccount").click(function(){            $("#ajaxPopupModal").dialog("close");            return false;          })          return false;      });          $("#supprimLink").click(function(){      simplePopupModal("Suppression de votre logo", "<h5>Voulez-vous supprimer le logo de votre société?</5>", "500","100", true,function(){       $.ajax({    		url:"/librairies/supprim.php",    		type: "GET",    		data: {id: 0, alternative: "Logo_soc"}, //TODO àà changer     		success: function(){    				$("#logoSocImg").attr("src", "../images/default_image.png");    		}    	})       },true,function(){        $("#simplePopupModal").dialog("close");      });      return false;    });        $("#addFileSoc").click(function() {      if ($(".countFile").length >= 3)      {        simplePopupModal("Ajouter un fichier", "<h5>Nombre maximum de fichiers atteint</h5>", "500","100", true);        return false;      }      ajaxPopupModal("Ajouter un fichier", "/ajax/fileSocAdd.php", "500", "100");          $("#annulerFileAccount").click(function(){            $("#ajaxPopupModal").dialog("close");            return false;          })          return false;      });          if ($("#validModif").length !== 0)    {      simplePopupModal("Mis à jour du compte", "<h5>Votre compte à été mis à jour avec succès </h5>", "500","100", true);        return false;    }        $(".suppFileUser").click(function() {     idFile = $(this).attr("rel");    nameFile = $(this).attr("href");    link = $(this);  simplePopupModal("Confirmation de suppression de fichier", "Voulez-vous supprimez definitivement ce fichier?", 500, 100,true,function(){                     $.ajax({                            type: "POST",                            url: "/librairies/supfFileSoc.php",                            data: {idFichier:idFile, fileSoc:nameFile},                            success: function() {                              link.parents("table:first").remove();                              simplePopupModal("Confirmation de suppression de fichier", "Le fichier a été supprimé", 500, 100, true);                            }                          });                        },true);                      return false;              });  }    if ($("#addUserSoc").length != 0)  {      $(".toggleUser").click(function(){        $(this).parents("tr:first").next().show();        if ($(this).parents("tr:first").next().hasClass('openUser'))          return false;        $(".openUser").hide();        $(".openUser").removeClass("openUser");        $(this).parents("tr:first").next().addClass("openUser");        return false;      });                        $("form").each(function() {        $(this).validate({        submitHandler: function(form){          myForm = form;          $(form).ajaxSubmit({            success: function(text)            {              simplePopupModal("Modification de données utilisateurs", "Les informations ont été correctement mis-à-jour", 500,100,true);              nom = $(form).children(":first").find(".toggleUser:first");              prenom = $(form).children(":first").find(".toggleUser:eq(1)");              nom.text($(form).find("#Nom:first").val());              prenom.text($(form).find("#Prenom:first").val());            }          });        },        rules: {        				Nom:{required:true, maxlength:32, noTag:true},        				Prenom:{required:true,maxlength:32, noTag:true},        				Fonction:{required:true, maxlength:50, noTag:true},        				tel:{minlength:10, maxlength:10, number:true, required:true, noTag:true},        				fax:{minlength:10, maxlength:10, number:true, noTag:true},        				mdp:{required:true, minlength:6,maxlength:32, noTag:true},        				mdp_confirm:{required:true, equalTo:".openUser .mdp",minlength:6,maxlength:32, noTag:true}            },            onkeyup:false            });      });                  $("#addUserSoc").click(function(){        ajaxPopupModal("Ajouter un utilisateur", "/ajax/addNewUser.php", 430, 250);        	$("#addUserSocForm").validate({        		rules: {        				nom:{required:true, maxlength:32, noTag:true},        				fonction:{required:true, maxlength:50, noTag:true},        				email:{required:true,myEmail:true,maxlength:64,emailNotExist:true, noTag:true},        				emailconfirm:{required:true,equalTo:"#email",maxlength:64, noTag:true},        				prenom:{required:true,maxlength:32, noTag:true},        				indicatif:{minlength:10, maxlength:10, number:true, required:true, noTag:true},        				//fax:{minlength:10, maxlength:10, number:true, noTag:true},        				mot_de_passe:{required:true, minlength:6,maxlength:32, noTag:true},        				pass:{required:true, equalTo:"#mot_de_passe",minlength:6,maxlength:32, noTag:true}        		},        		onkeyup:false        	});        $("#annulerDialog").click(function(){          $("#ajaxPopupModal").dialog("close");          return false;        });        return false;      });            $("#supprimUser").click(function() {      if ($(".validUser:checked").length == 0)      {        simplePopupModal("Avertissement", "Aucun compte utilisateur n'a été sélectionné", 500, 100,true);        return false;      }              simplePopupModal("Confirmation de suppression de comptes utilisateur", "Voulez-vous supprimez definitivement ces comptes utilisateur?", 500, 100,true,function(){                     $.ajax({                            type: "POST",                            url: "/librairies/suppUser.php",                            data: $(".validUser").fieldSerialize(),                            success: function() {                              $(".validUser:checked").each(function(){                                $(this).parents("table:first").remove();                              });                              simplePopupModal("Confirmation de suppression de comptes utilisateur", "Les comptes utilisateur ont été supprimés", 500, 100, true);                            }                          });                        }, true);                      return false;              });    if ($("#userAdded").length != 0)    {      simplePopupModal("Confirmation d'ajout de compte utilisteur", "Le compte utilisateur a bien été rajouté", 500, 100,true);    };   }    if ($("#addProductForReponse").length != 0)  {    $("#addProductForReponse").click(function(){      window.location = "/backend/ajout_produit.php?reponseAnn=true&" + $("input[type='hidden']").fieldSerialize();      return false;     });  }     if ($("#goToReponse").length != 0)  {    $("#goToReponse").click(function(){      window.location = "/backend/reponse_proposition.php";      return false;     });  }    if ($("#linkSupportOk").length != 0)    simplePopupModal("Confirmation de proposition", "<br/><center><p>Votre produit a &eacute;t&eacute; propos&eacute; au M&eacute;dia</p></center>", 500, 100, true);      if ($("#messageSend").length != 0)    simplePopupModal("Confirmation d'envoi", "<br/><center><p>Votre message a bien &eacute;t&eacute; envoy&eacute;</p></center>", 500, 100, true);        if ($("#linkProdOk").length != 0)    simplePopupModal("Confirmation de proposition", "<br/><center><p>Votre support m&eacute;dia a &eacute;t&eacute; propos&eacute; &agrave; l'annonceur </p></center>", 500, 100, true);            if ($(".magicP").length != 0)    {        $(".table_border:gt(9)").parent().parent().hide();        $(".magicP").magicPaging({numberItem:$(".table_border").length, numberPage:10, callback:pagingHTML,        leftButton : "/images/prev.png",        rightButton : "/images/next.png",        extraLeftButton : "/images/first.png",        extraRightButton : "/images/last.png"});    }        if ($("#contactForm").length != 0)    {      $("#contactForm").validate({        errorElement: "em",        rules: {          societe:{required:true},          nom:{required:true},          mail: {required:true},          telephone: {required:true},          message: {required:true},				  checksRobots:{required:true,captcha:true, noTag:true}		      },    		onkeyup:false      });    }        if ($("#to").length != 0)    {      $("#to").focus(function(){        $("#contactShow").click();      });    }        if ($("#continueSansSupport").length != 0)    {        $("#continueSansSupport").click(function() {       //   $(".finalForm").rules("remove");         // $("#nom_media").val("");           //$("test").lalalala();        });    }        /*Checkbox des news pour l'activation de la news*/    if ($(".newsActivate").length != 0)    {      $(".newsActivate").each(function() {             $(this).click(function(){            var isChecked = (this.checked)?"1":"0";            var newsID = this.value;                        $.ajax({        							url:"/librairies/newsActivate.php",        							type:"post",        							dataType: "text",        							data: {newsActivate: isChecked, id:newsID},        							success:function (text){        							}        						});              });        });      $(".newsType").each(function() {             $(this).click(function(){                       var infoNews = this.value.split(":");                        var newsSoc = infoNews[0];            var newsID = infoNews[1];                        $.ajax({        							url:"/librairies/newsActivate.php",        							type:"post",        							dataType: "text",        							data: {newsType: newsSoc, id:newsID},        							success:function (text){        							}        						});              });        });             };        if ($(".newsInfoPrint").length != 0)    {      $("#mediaNewsClick").click(function(){              if ($(".newsMediaPrint").hasClass("invisible"))        {          $(".newsAnnonceurPrint").fadeOut("slow", function(){            $(".newsMediaPrint").fadeIn();            $(".newsMediaPrint").remove("invisible");            $(".newsAnnonceurPrint").addClass("invisible");          });                  }        return false;      });            $("#annonceurNewsClick").click(function(){        if ($(".newsAnnonceurPrint").hasClass("invisible"))        {        $(".newsMediaPrint").fadeOut("slow", function(){          $(".newsAnnonceurPrint").fadeIn();          $(".newsAnnonceurPrint").remove("invisible");            $(".newsMediaPrint").addClass("invisible");          });        }        return false;      });            $(".newsMediaPrint").magicPaging({numberItem:$(".newsMediaCount").length, numberPage:1, callback:pagingNewsMedia,        leftButton : "/images/prev.png",        rightButton : "/images/next.png",        extraLeftButton : "/images/first.png",        extraRightButton : "/images/last.png"        })    }        	if (($("#emailTable tbody").children().length != 0) || ($("#logTable tbody").children().length != 0) || ($("#newsTable tbody").children().length != 0) || ($("#propTable tbody").children().length != 0) || ($("#contactTable tbody").children().length != 0))	   $("#emailTable, #logTable, #newsTable, #propTable, #contactTable").tablesorter({cssHeader:"normalHeader", widthFixed: true, widgets: ['zebra']}).tablesorterPager({container: $("#pager"),  positionFixed: false});  });
