 
	function  interpreteHTML(texte)
	{
 					 texte = texte.replace(/&euro;/g,''); // Caractere ne faisant mme pas partie de l'iso 8859-1
					 texte = texte.replace(/&quot;/g,'\"'); // 34 22
					 texte = texte.replace(/&amp;/g,'&'); // 38 26
					 texte = texte.replace(/&#39;/g,'\''); // 39 27
					 texte = texte.replace(/&lt;/g,'<'); // 60 3C
					 texte = texte.replace(/&gt;/g,'>'); // 62 3E
					 texte = texte.replace(/&circ;/g,'^'); // 94 5E
					 texte = texte.replace(/&lsquo;/g,''); // 145 91
					 texte = texte.replace(/&rsquo;/g,''); // 146 92
					 texte = texte.replace(/&ldquo;/g,''); // 147 93
					 texte = texte.replace(/&rdquo;/g,''); // 148 94
					 texte = texte.replace(/&bull;/g,''); // 149 95
					 texte = texte.replace(/&ndash;/g,''); // 150 96
					 texte = texte.replace(/&mdash;/g,''); // 151 97
					 texte = texte.replace(/&tilde;/g,''); // 152 98
					 texte = texte.replace(/&trade;/g,''); // 153 99
					 texte = texte.replace(/&scaron;/g,''); // 154 9A
					 texte = texte.replace(/&rsaquo;/g,''); // 155 9B
					 texte = texte.replace(/&oelig;/g,''); // 156 9C
					 texte = texte.replace(/&#357;/g,''); // 157 9D
					 texte = texte.replace(/&#382;/g,''); // 158 9E
					 texte = texte.replace(/&Yuml;/g,''); // 159 9F
					 texte = texte.replace(/&nbsp;/g,' '); // 160 A0
					 texte = texte.replace(/&iexcl;/g,''); // 161 A1
					 texte = texte.replace(/&cent;/g,''); // 162 A2
					 texte = texte.replace(/&pound;/g,''); // 163 A3
					 texte = texte.replace(/&curren;/g,''); // 164 A4
					 texte = texte.replace(/&yen;/g,''); // 165 A5
					 texte = texte.replace(/&brvbar;/g,''); // 166 A6
					 texte = texte.replace(/&sect;/g,''); // 167 A7
					 texte = texte.replace(/&uml;/g,''); // 168 A8
					 texte = texte.replace(/&copy;/g,''); // 169 A9
					 texte = texte.replace(/&ordf;/g,''); // 170 AA
					 texte = texte.replace(/&laquo;/g,''); // 171 AB
					 texte = texte.replace(/&not;/g,''); // 172 AC
					 texte = texte.replace(/&shy;/g,''); // 173 AD
					 texte = texte.replace(/&reg;/g,''); // 174 AE
					 texte = texte.replace(/&macr;/g,''); // 175 AF
					 texte = texte.replace(/&deg;/g,''); // 176 B0
					 texte = texte.replace(/&plusmn;/g,''); // 177 B1
					 texte = texte.replace(/&sup2;/g,''); // 178 B2
					 texte = texte.replace(/&sup3;/g,''); // 179 B3
					 texte = texte.replace(/&acute;/g,''); // 180 B4
					 texte = texte.replace(/&micro;/g,''); // 181 B5
					 texte = texte.replace(/&para/g,''); // 182 B6
					 texte = texte.replace(/&middot;/g,''); // 183 B7
					 texte = texte.replace(/&cedil;/g,''); // 184 B8
					 texte = texte.replace(/&sup1;/g,''); // 185 B9
					 texte = texte.replace(/&ordm;/g,''); // 186 BA
					 texte = texte.replace(/&raquo;/g,''); // 187 BB
					 texte = texte.replace(/&frac14;/g,''); // 188 BC
					 texte = texte.replace(/&frac12;/g,''); // 189 BD
					 texte = texte.replace(/&frac34;/g,''); // 190 BE
					 texte = texte.replace(/&iquest;/g,''); // 191 BF
					 texte = texte.replace(/&Agrave;/g,''); // 192 C0
					 texte = texte.replace(/&Aacute;/g,''); // 193 C1
					 texte = texte.replace(/&Acirc;/g,''); // 194 C2
					 texte = texte.replace(/&Atilde;/g,''); // 195 C3
					 texte = texte.replace(/&Auml;/g,''); // 196 C4
					 texte = texte.replace(/&Aring;/g,''); // 197 C5
					 texte = texte.replace(/&AElig;/g,''); // 198 C6
					 texte = texte.replace(/&Ccedil;/g,''); // 199 C7
					 texte = texte.replace(/&Egrave;/g,''); // 200 C8
					 texte = texte.replace(/&Eacute;/g,''); // 201 C9
					 texte = texte.replace(/&Ecirc;/g,''); // 202 CA
					 texte = texte.replace(/&Euml;/g,''); // 203 CB
					 texte = texte.replace(/&Igrave;/g,''); // 204 CC
					 texte = texte.replace(/&Iacute;/g,''); // 205 CD
					 texte = texte.replace(/&Icirc;/g,''); // 206 CE
					 texte = texte.replace(/&Iuml;/g,''); // 207 CF
					 texte = texte.replace(/&ETH;/g,''); // 208 D0
					 texte = texte.replace(/&Ntilde;/g,''); // 209 D1
					 texte = texte.replace(/&Ograve;/g,''); // 210 D2
					 texte = texte.replace(/&Oacute;/g,''); // 211 D3
					 texte = texte.replace(/&Ocirc;/g,''); // 212 D4
					 texte = texte.replace(/&Otilde;/g,''); // 213 D5
					 texte = texte.replace(/&Ouml;/g,''); // 214 D6
					 texte = texte.replace(/&times;/g,''); // 215 D7
					 texte = texte.replace(/&Oslash;/g,''); // 216 D8
					 texte = texte.replace(/&Ugrave;/g,''); // 217 D9
					 texte = texte.replace(/&Uacute;/g,''); // 218 DA
					 texte = texte.replace(/&Ucirc;/g,''); // 219 DB
					 texte = texte.replace(/&Uuml;/g,''); // 220 DC
					 texte = texte.replace(/&Yacute;/g,''); // 221 DD
					 texte = texte.replace(/&THORN;/g,''); // 222 DE
					 texte = texte.replace(/&szlig;/g,''); // 223 DF
					 texte = texte.replace(/&aacute;/g,''); // 224 E0
					 texte = texte.replace(/&aacute;/g,''); // 225 E1
					 texte = texte.replace(/&acirc;/g,''); // 226 E2
					 texte = texte.replace(/&atilde;/g,''); // 227 E3
					 texte = texte.replace(/&auml;/g,''); // 228 E4
					 texte = texte.replace(/&aring;/g,''); // 229 E5
					 texte = texte.replace(/&aelig;/g,''); // 230 E6
					 texte = texte.replace(/&ccedil;/g,''); // 231 E7
					 texte = texte.replace(/&egrave;/g,''); // 232 E8
					 texte = texte.replace(/&eacute;/g,''); // 233 E9
					 texte = texte.replace(/&ecirc;/g,''); // 234 EA
					 texte = texte.replace(/&euml;/g,''); // 235 EB
					 texte = texte.replace(/&igrave;/g,''); // 236 EC
					 texte = texte.replace(/&iacute;/g,''); // 237 ED
					 texte = texte.replace(/&icirc;/g,''); // 238 EE
					 texte = texte.replace(/&iuml;/g,''); // 239 EF
					 texte = texte.replace(/&eth;/g,''); // 240 F0
					 texte = texte.replace(/&ntilde;/g,''); // 241 F1
					 texte = texte.replace(/&ograve;/g,''); // 242 F2
					 texte = texte.replace(/&oacute;/g,''); // 243 F3
					 texte = texte.replace(/&ocirc;/g,''); // 244 F4
					 texte = texte.replace(/&otilde;/g,''); // 245 F5
					 texte = texte.replace(/&ouml;/g,''); // 246 F6
					 texte = texte.replace(/&divide;/g,''); // 247 F7
					 texte = texte.replace(/&oslash;/g,''); // 248 F8
					 texte = texte.replace(/&ugrave;/g,''); // 249 F9
					 texte = texte.replace(/&uacute;/g,''); // 250 FA
					 texte = texte.replace(/&ucirc;/g,''); // 251 FB
					 texte = texte.replace(/&uuml;/g,''); // 252 FC
					 texte = texte.replace(/&yacute;/g,''); // 253 FD
					 texte = texte.replace(/&thorn;/g,''); // 254 FE
					 texte = texte.replace(/&yuml;/g,''); // 255 FF
			 		return texte;
	}//interpreteHTML

 function retraitProduitBDD(idProduit)
 {
 	var srtPostBody=new Hash({Ref: idProduit});
	new Ajax.Request('RetraitPanierBddParAjax.asp?'+srtPostBody.toQueryString(),
	{
		method:'post',
		RequestHeader: ['Content-type', 'application/x-www-form-urlencoded'],
		postbody:srtPostBody.toQueryString(),
		//onFailure:function(requester){alert(requester.responseText);},
		onSuccess:function(requester){affichePanier("");}
		 
	});
 }
	
 function enleveDomPanier()
 {// Fonction qui va enlever tout le code HTML des produits du panier de l'arbre DOM
 	var boolFin=false;
	var elt=$("trPanierARemplir");// On se positionne au dernier tr non utilis par les produits
	while(boolFin==false) // Tant qu'il reste des produits on boucle
	{
		if(Element.next(elt))
		{
			Element.remove(Element.next(elt));// On enleve le tr d'un produit de l'arbre DOM
		}
		else
		{
			boolFin=true;
		}
	}
 }

 function enleveDomProduit(idProduit)
 {// Fonction qu va enlever de l'arbre DOM le produit  supprimer
 	id="fontQuantite-"+idProduit;
	Element.remove($(id).parentNode.parentNode);
	retraitProduitBDD(idProduit);
	enleveDomPanier();
 }
	
 function affichePanier(strPath)
 {// Fonction qui va afficher les produits dans le panier avec le total a la fin. En fait on ne fait que inserer le code HTML dans le panier
 		new Ajax.Updater({success: "trPanierARemplir" },""+strPath+"RetourProduitPanierParAjax.asp",
		{
			method:"post",
			RequestHeader: ["Content-type", "application/x-www-form-urlencoded"],
		 	insertion: Insertion.After
		});
 }//affichePanier
 
 
 function afficheProduitPanier(strReponse)
 {
 	if(strReponse == "True")
	{
		enleveDomPanier();
		affichePanier("");
	}
	else
	{
		alert("Stock insuffisant pour ajouter ce produit au panier.");
	}
 }//afficheProduitPanier
 
 function envoiRequeteAJAX(idProduit,textComment)
 {
 	var srtPostBody=new Hash({Ref: idProduit.replace("table_Puce_Produit_","")});
	srtPostBody.update({NomPage: document.getElementById("NomPage").value});
	srtPostBody.update({commentaire: textComment});
	if(document.getElementById("textareaComment-"+idProduit.replace("table_Puce_Produit_","")))
	{
			srtPostBody.update({commentaire: document.getElementById("textareaComment-"+idProduit.replace("table_Puce_Produit_","")).value});
	}
 	new Ajax.Request('MiseAuPanierenBddParAjax.asp?'+srtPostBody.toQueryString(),
	{
		method:'post',
		RequestHeader: ['Content-type', 'application/x-www-form-urlencoded'],
		postbody:srtPostBody.toQueryString(),
		//onFailure: function(requester) { alert(requester.responseText); },
		onSuccess:function(requester){afficheProduitPanier(requester.responseText);}
		 
	});
 }//envoiRequeteAJAX
 
 function flytoBasket(idProduit,refProduit,textComment)// fonction qui va faire voler l'objet depuis son emplacement jusqu'au panier
 {
 	// On commence par cr un clone du produit original
 	var objProduitClone=document.getElementById(idProduit).cloneNode(true);
	// On encastre le clone dans une balise div
	var objDiv=document.createElement("div");
	objDiv.setAttribute("style", "position:absolute");
	objDiv.appendChild(objProduitClone);
	var objDom=$(idProduit).parentNode;
	
 	if (navigator.appName =="Microsoft Internet Explorer") // version MSIE
	{
		// On insere ce clone dans l'arbre DOM
		objDom.appendChild(objDiv);
		new Effect.Opacity(objProduitClone,{ from: 1, to: 0, duration : 0});
		Position.absolutize(objDiv);
		//on stocke les coordonnes du panier
		var objPanier=Position.cumulativeOffset(Element.makePositioned("table_AperuPanier_Moliere"));
		//On fait bouger le clone instantanement jusqu'a la postion du produit original
		new Effect.Parallel(
		[
			new Effect.Move(objDiv,{sync:true, y: -Element.getHeight(idProduit),x: 0,mode: 'relative'})
			,new Effect.Opacity(objProduitClone,{sync:true, from: 0, to: 1})
		]
		,{
		duration: 1, afterFinish : function(){
			new Effect.Parallel(
			[
			new Effect.Opacity(objProduitClone,{sync:true, from: 1, to: 0})
			,new Effect.Move(objDiv,{y: objPanier.top,x: objPanier.left, sync: true, mode: 'absolute' })
			]
			,{
			duration: 2,afterFinish : function(){// Une fois fini on envoi la requete AJAX au serveur
													objDom.removeChild(objDiv);
													envoiRequeteAJAX(refProduit,textComment);
													
												}
			}); 
		}
		});
	}
	else // version Firefox et autres
	{
		// On insere ce clone dans l'arbre DOM
		objDiv.style.visibility="hidden";
		var objPanier=Position.cumulativeOffset(Element.makePositioned("table_AperuPanier_Moliere"));
		if(navigator.userAgent.indexOf("Firefox") > 0)
		{
			objDom.appendChild(objDiv);
			Position.absolutize(objDiv);
			//on stocke les coordonnes du panier
			new Effect.Move(objDiv,{duration: 0, y: -Element.getHeight(idProduit),x: 0,mode: 'relative', afterFinish: function(){objDiv.style.visibility="visible";} });
		}
		else
		{
			objDiv.innerHTML = "";
			objDom.appendChild(objDiv);
			objDiv.innerHTML = objProduitClone.outerHTML;
			Position.absolutize(objDiv);
			//on stocke les coordonnes du panier
			new Effect.Move(objDiv,{duration: 0, y: Position.cumulativeOffset(Element.makePositioned(idProduit)).top,x: Position.cumulativeOffset(Element.makePositioned(idProduit)).left,mode: 'relative', afterFinish: function(){objDiv.style.visibility="visible";} });
		}
		
		new Effect.Parallel(
			[
			new Effect.Opacity(objDiv,{sync:true, from: 1, to: 0})
			,new Effect.Move(objDiv,{y: objPanier.top,x: objPanier.left, sync: true, mode: 'absolute' })
			]
			,{
			duration: 2,afterFinish : function(){// Une fois fini on envoi la requete AJAX au serveur	
													if(navigator.userAgent.indexOf("Firefox") > 0)
													{
														objDom.removeChild(objDiv);
													}
													else
													{
														objDom.removeChild(objDiv);
													}
													envoiRequeteAJAX(refProduit);
												}
			}); 
	} 
		
 }//flytoBasket
 
 function MAJCheckPanier()
 {
 	var  etat = $("checkPanier").checked;
	var srtPostBody=new Hash({State: etat});
	var srtCheminAspDocs = "";
	if($("CheminAspDocs"))
	{
		srtCheminAspDocs = $("CheminAspDocs").value;
	}
	new Ajax.Request(srtCheminAspDocs+"MAJCheckPanierParAJAX.asp?"+srtPostBody.toQueryString(),
	{
		method:"post",
		RequestHeader: ["Content-type", "application/x-www-form-urlencoded"],
		postbody:srtPostBody.toQueryString(),
		onFailure: function(requester) { alert(requester.responseText);},
		onSuccess:function(requester){}
		 
	});
 }
 
function lanceGreyBoxDemo(strUrl,titreGreybox)
{
	GB_showCenter("",strUrl,650,850);
	$("GreyBox_Id").innerHTML=titreGreybox;
}
 
function lanceGreyBoxConfirm(strUrl,titreGreybox)
{
	GB_showCenter("",strUrl,300,800);
	$("GreyBox_Id").innerHTML=titreGreybox;
}

function autorisationCreationParagraphe()//fonction qui va aller verifier si on  le droit de creer un paragraphe
{
	var retour = "";
	var url = "";
	if ($("NomPage").value == "default" )
	{
		url = $("CheminFichier").value + "/";
	}
	new Ajax.Request(url + "CheckAutorisationCreationElement.asp?element=paragraphe&NomPage="+$("NomPage").value,
	{
		asynchronous:false,
		method:"post",
		RequestHeader: ["Content-type", "application/x-www-form-urlencoded"],
		//onFailure:function(requester){ alert(requester.responseText);},
		onSuccess:function(requester){retour = requester.responseText;}
	});
	return retour;
}

function creationParagrapheBDD(idParagraphe)//fonction qui va creer un paragraphe dans la bdd
{	
	var classeParagraphe;
	if (idParagraphe == "ParagrapheType1Edition") classeParagraphe=1;
	if (idParagraphe == "ParagrapheType2Edition") classeParagraphe=2;
	if (idParagraphe == "ParagrapheType3Edition" || idParagraphe == "ParagrapheTypeReservationEdition") classeParagraphe=3;
	if (idParagraphe == "ParagrapheType4Edition") classeParagraphe=4;
	var srtPostBody=new Hash({NomPage: $("NomPage").value});
	srtPostBody.update({LastNumParag:$("LastNumParag").value});
	srtPostBody.update({validation:"valider"});
	srtPostBody.update({Classe:classeParagraphe});
	srtPostBody.update({ajout:"oui" });
	srtPostBody.update({Numparag:""});
	if ($("NomPage").value == "default" )
	{
			strPageAspAppele=$("NomRepertoireSite").value+"/AspDocs/CreationParagrapheParAJAX.asp?";
	}
	else
	{
			strPageAspAppele="CreationParagrapheParAJAX.asp?";
	}
	new Ajax.Request(strPageAspAppele+srtPostBody.toQueryString(),
	{
		method:"post",
		RequestHeader: ["Content-type", "application/x-www-form-urlencoded"],
		postbody:srtPostBody.toQueryString(),
		//onFailure:function(requester){ alert(requester.responseText);},
		onSuccess:function(requester){}
		 
	});
}


function ajoutEventObserve(idParagraphe) // Fonction qui va rajouter les venements aux objets image titre et texte crer dans le nouveau paragraphe
{
	var classeParag;
	// On commence par stocker la valeur du numero du nouveau paragraphe 
	var LastNumParag=parseInt($("LastNumParag").value)+1;
	// Selon le type de paragraphe on a des traitements diffrents
	if( idParagraphe == "ParagrapheType1Edition")
	{
			var objStrImageInnerHtmlOuvert = $("clone").down().down().down().down().down().innerHTML.substring(0,$("clone").down().down().down().down().down().innerHTML.length-1);
			$("clone").down().down().down().down().down().innerHTML=objStrImageInnerHtmlOuvert+"onclick='javascript:lanceGreyBox(\"../../../AspDocs/ModifImage.asp?NomImage=Def__"+$("NomPage").value+"_Parag_"+LastNumParag+"\&reference=---\&NomPage="+$("NomPage").value+"\&ImgWidth=151\&ImgHeight=500\&Lien=KO\&Prod=Design\&TypeImage=Paragraphe\&Classe=1\",\"ModifImage\");' style='cursor:hand;'>";
			var objDomAManipuler = $("clone").down().down().down().down().down().next().down().down().down().down().down().down().down().down().next();
			var objStrTitreInnerHtmlOuvert = "Cliquez ici pour changer le titre ";
			objDomAManipuler.innerHTML="<div id='TitreParagrapheType1Edition' onclick='javscript:lanceGreyBoxPetiteHauteur(\"../../../AspDocs/ModifTexte.asp?Classe=1&NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&LastNumParag="+parseInt(LastNumParag)+"&Id_Texte=Paragraphe_"+parseInt(LastNumParag)+"_Titre&Lien=KO\",\"ModifTexte\");'>"+objStrTitreInnerHtmlOuvert+"</div>";
			objDomAManipuler = $("clone").down().down().down().down().down().next().down().down().down().next().down();
			var objStrTexteInnerHtmlOuvert= "Cliquez ici pour changer le texte ";
			objDomAManipuler.innerHTML="<div id='TexteParagrapheType1Edition' onclick='javscript:lanceGreyBox(\"../../../AspDocs/ModifTexte.asp?Classe=1&NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&LastNumParag="+parseInt(LastNumParag)+"&Id_Texte=Paragraphe_"+parseInt(LastNumParag)+"_Texte&Lien=KO\",\"ModifTexte\");'>"+objStrTexteInnerHtmlOuvert+"</div>";
			classeParag=1;
	}
	if ( idParagraphe == "ParagrapheType2Edition")
	{
			var objStrImageInnerHtmlOuvert = $("clone").down().down().down().down().down().next().innerHTML.substring(0,$("clone").down().down().down().down().down().next().innerHTML.length-1);
			$("clone").down().down().down().down().down().next().innerHTML=objStrImageInnerHtmlOuvert+"onclick='javascript:lanceGreyBox(\"../../../AspDocs/ModifImage.asp?NomImage=Def__"+$("NomPage").value+"_Parag_"+LastNumParag+"\&reference=---\&NomPage="+$("NomPage").value+"\&ImgWidth=151\&ImgHeight=500\&Lien=KO\&Prod=Design\&TypeImage=Paragraphe\&Classe=2\",\"ModifImage\");' style='cursor:hand;'>";
			var objDomAManipuler = $("clone").down().down().down().down().down().down().down().down().down().down().down().down().down().next();
			var objStrTitreInnerHtmlOuvert = "Cliquez ici pour changer le titre ";
			objDomAManipuler.innerHTML="<div id='TitreParagrapheType2Edition' onclick='javscript:lanceGreyBoxPetiteHauteur(\"../../../AspDocs/ModifTexte.asp?Classe=2&NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&LastNumParag="+parseInt(LastNumParag)+"&Id_Texte=Paragraphe_"+parseInt(LastNumParag)+"_Titre&Lien=KO\",\"ModifTexte\");'>"+objStrTitreInnerHtmlOuvert+"</div>";
			objDomAManipuler = $("clone").down().down().down().down().down().down().down().down().next().down();
			var objStrTexteInnerHtmlOuvert= "Cliquez ici pour changer le texte ";
			objDomAManipuler.innerHTML="<div id='TexteParagrapheType2Edition' onclick='javscript:lanceGreyBox(\"../../../AspDocs/ModifTexte.asp?Classe=2&NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&LastNumParag="+parseInt(LastNumParag)+"&Id_Texte=Paragraphe_"+parseInt(LastNumParag)+"_Texte&Lien=KO\",\"ModifTexte\");'>"+objStrTexteInnerHtmlOuvert+"</div>";
			classeParag=2;
	}
	if ( idParagraphe == "ParagrapheType3Edition" || idParagraphe=="ParagrapheTypeReservationEdition")
	{
			var objDomAManipuler = $("clone").down().down().down().down().down().down().down().down().down().next();
			var objStrTitreInnerHtmlOuvert = "Cliquez ici pour changer le titre ";
			objDomAManipuler.innerHTML="<div id='TitreParagrapheType3Edition' onclick='javscript:lanceGreyBoxPetiteHauteur(\"../../../AspDocs/ModifTexte.asp?Classe=3&NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&LastNumParag="+parseInt(LastNumParag)+"&Id_Texte=Paragraphe_"+parseInt(LastNumParag)+"_Titre&Lien=KO\",\"ModifTexte\");'>"+objStrTitreInnerHtmlOuvert+"</div>";
			objDomAManipuler = $("clone").down().down().down().down().next().down();
			var objStrTexteInnerHtmlOuvert= "Cliquez ici pour changer le texte ";
			objDomAManipuler.innerHTML="<div id='TexteParagrapheType3Edition' onclick='javscript:lanceGreyBox(\"../../../AspDocs/ModifTexte.asp?Classe=3&NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&LastNumParag="+parseInt(LastNumParag)+"&Id_Texte=Paragraphe_"+parseInt(LastNumParag)+"_Texte&Lien=KO\",\"ModifTexte\");'>"+objStrTexteInnerHtmlOuvert+"</div>";
			classeParag=3;
	}
	if ( idParagraphe == "ParagrapheType4Edition")
	{
			var objStrImageInnerHtmlOuvert = $("clone").down().down().down().down().next().down().innerHTML.substring(0,$("clone").down().down().down().down().next().down().innerHTML.length-1);
			$("clone").down().down().down().down().next().down().innerHTML = objStrImageInnerHtmlOuvert+"onclick='javascript:lanceGreyBox(\"../../../AspDocs/ModifImage.asp?NomImage=Def__"+$("NomPage").value+"_Parag_"+LastNumParag+"\&reference=---\&NomPage="+$("NomPage").value+"\&ImgWidth=151\&ImgHeight=500\&Lien=KO\&Prod=Design\&TypeImage=Paragraphe\&Classe=4\",\"ModifImage\");' style='cursor:hand;'>";
			var objDomAManipuler = $("clone").down().down().down().down().down().down().down().down().down().next();
			var objStrTitreInnerHtmlOuvert = "Cliquez ici pour changer le titre ";
			objDomAManipuler.innerHTML="<div id='TitreParagrapheType4Edition' onclick='javscript:lanceGreyBoxPetiteHauteur(\"../../../AspDocs/ModifTexte.asp?Classe=3&NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&LastNumParag="+parseInt(LastNumParag)+"&Id_Texte=Paragraphe_"+parseInt(LastNumParag)+"_Titre&Lien=KO\",\"ModifTexte\");'>"+objStrTitreInnerHtmlOuvert+"</div>";
			classeParag=4;
	}
	// On incrmente le numero du prochain paragraphe
	$("LastNumParag").value=parseInt(LastNumParag);
	// On incorpore le bouton supprimer et l'image pour uploader des documents
	if ( idParagraphe == "ParagrapheType4Edition" || idParagraphe == "ParagrapheType3Edition" || idParagraphe=="ParagrapheTypeReservationEdition")
	{
			var objInput = 	  "<div onclick=\"javascript:lanceGreyBox('../../../AspDocs/MiseEnLigneFichiers.asp?NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&Fichier1=&Fichier2=&Fichier3=&Fichier4=&Fichier5=&NomFichier1=&NomFichier2=&NomFichier3=&NomFichier4=&NomFichier5=','MiseEnLigneFichiers');\" style=\"cursor:pointer;\">";
			objInput=objInput+	"<img src=\""+$("cheminShared").value+"/fiche_technique.gif\">";
			objInput=objInput+	"&nbsp;<font face=\"verdana\" size=\"1\">Cliquez ici pour mettre en ligne des documents.</font>";
			objInput=objInput+"</div>";
			objInput=objInput+"<table>";
			objInput=objInput+	"<tr>";
			objInput=objInput+		"<td>";
			objInput=objInput+			"<input type='button' value='Supprimer ce paragraphe' onclick='javascript:lanceGreyBox(\"../../../AspDocs/Modif_Paragraphe.asp?NumParagSupp="+parseInt(LastNumParag)+"&NomImage=Def__"+$("NomPage").value+"_Parag_"+LastNumParag+"&TypeImage=Paragraphe&ajout=suppression&Classe="+classeParag+"&NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&LastNumParag="+parseInt(LastNumParag)+"&CouleurFond="+$("CouleurFond").value.replace("#","")+"\",\"ModifParagraphe\");'>";
			objInput=objInput+		"</td>";
			objInput=objInput+	"</tr>";
			objInput=objInput+"</table>";
			Insertion.After($("clone").down("table"),objInput);
	}
	if ( idParagraphe == "ParagrapheType1Edition" || idParagraphe == "ParagrapheType2Edition")
	{
			var objImg =  "<div onclick=\"javascript:lanceGreyBox('../../../AspDocs/MiseEnLigneFichiers.asp?NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&Fichier1=&Fichier2=&Fichier3=&Fichier4=&Fichier5=&NomFichier1=&NomFichier2=&NomFichier3=&NomFichier4=&NomFichier5=','MiseEnLigneFichiers');\" style=\"cursor:pointer;\">";
			objImg=objImg+	"<img src=\""+$("cheminShared").value+"/fiche_technique.gif\">";
			objImg=objImg+	"&nbsp;<font face=\"verdana\" size=\"1\">Cliquez ici pour mettre en ligne des documents.</font>";
			objImg=objImg+"</div>";
			var objInput="<table>";
			objInput=objInput+	"<tr>";
			objInput=objInput+		"<td>";
			objInput=objInput+			"<input type='button' value='Supprimer ce paragraphe' onclick='javascript:lanceGreyBox(\"../../../AspDocs/Modif_Paragraphe.asp?NumParagSupp="+parseInt(LastNumParag)+"&NomImage=Def__"+$("NomPage").value+"_Parag_"+LastNumParag+"&TypeImage=Paragraphe&ajout=suppression&Classe="+classeParag+"&NumParag="+parseInt(LastNumParag+1)+"&NomPage="+$("NomPage").value+"&LastNumParag="+parseInt(LastNumParag)+"&CouleurFond="+$("CouleurFond").value.replace("#","")+"\",\"ModifParagraphe\");'>";
			objInput=objInput+		"</td>";
			objInput=objInput+	"</tr>";
			objInput=objInput+"</table>";
			Insertion.After($("clone").down("table"),objInput);
			if ( idParagraphe == "ParagrapheType1Edition" )
			{
					Insertion.After($("clone").down().down().down().down().down().next().down().down().down().next().down().down(),objImg);
			}
			if ( idParagraphe == "ParagrapheType2Edition" )
			{
					Insertion.After($("clone").down().down().down().down().down().down().down().down().next().down().down(),objImg);
			}
	}
	var objTd=document.createElement("td");
	objTd.textAlign = "right";
	$("clone").down("tr").appendChild(objTd);
	var objTableFleche=			  "<table border=\"0\" height=\"100%\" cellpadding=\"3\">";
	objTableFleche=objTableFleche+	"<tr>";
	objTableFleche=objTableFleche+		"<td valign=\"bottom\">"
	objTableFleche=objTableFleche+			"<img src=\""+$("cheminShared").value+"/FlecheBas.gif\" style=\"cursor:pointer;\" alt=\" "+parseInt($("PositionMax").value-0+1)+" - Cliquez ici pour descendre ce paragraphe d'une place\" onclick=\"javascript:MoveParag('"+$("NomPage").value+"', '"+LastNumParag+"', '"+parseInt($("PositionMax").value-0+1)+"', 'Bas');\">";
	objTableFleche=objTableFleche+		"</td>";
	objTableFleche=objTableFleche+		"<td valign=\"bottom\">"
	objTableFleche=objTableFleche+			"<img src=\""+$("cheminShared").value+"/FlecheToutBas.gif\" style=\"cursor:pointer;\" alt=\" "+parseInt($("PositionMax").value-0+1)+" - Cliquez ici pour placer ce paragraphe tout en bas\" onclick=\"javascript:MoveParag('"+$("NomPage").value+"', '"+LastNumParag+"', '"+parseInt($("PositionMax").value-0+1)+"', 'ToutBas');\">";
	objTableFleche=objTableFleche+		"</td>";
	objTableFleche=objTableFleche+	"</tr>";
	objTableFleche=objTableFleche+"</table>";
	objTd.innerHTML=objTableFleche;
	$("PositionMax").value=parseInt($("PositionMax").value-0+1);
}//ajoutEventObserve

function creationNouveauParagraphe(idParagraphe)
{
	var boolAutorisation = "OK";
	boolAutorisation = autorisationCreationParagraphe();
	if(boolAutorisation != "OK")
	{
		if($("divNotification"))
		{
			if (navigator.appName =="Microsoft Internet Explorer")
			{
				$("divNotification").style.top = top.document.body.clientHeight/2 - 40 + top.document.body.scrollTop;
				$("divNotification").style.left = top.document.body.clientWidth/2 - 200 + top.document.body.scrollLeft;
			}
			else
			{
				$("divNotification").style.top = top.window.innerHeight/2 - 40 + top.window.scrollY;
				$("divNotification").style.left = top.window.innerWidth/2 - 200 + top.window.scrollX;
			}
			if($("divNotification").style.top < 0) $("divNotification").style.top = 0;
			if($("divNotification").style.left < 0) $("divNotification").style.left = 0;
			$("divNotification").style.display = "";
			window.setTimeout(function(){$("divNotification").style.display = "none";},5000);
		}
		else
		{
			var objDiv = document.createElement("div");
			objDiv.style.backgroundImage = "url(" + $("cheminShared").value + "/Notification400.png)";
			objDiv.style.width = 400;
			objDiv.style.height = 80;
			objDiv.style.position = "absolute";
			objDiv.style.zIndex = 150;
			objDiv.style.left = 0;
			objDiv.style.display = "";
			objDiv.id = "divNotification";
			objDiv.style.fontFamily = "Verdana";
			objDiv.style.fontSize = "12px";
			objDiv.style.color = "#000000";
			objDiv.style.verticalAlign = "middle";
			objDiv.innerHTML = "<table cellpading='0' cellspacing='0' border='0' width='100%'><tr><td style='width:10px;'></td><td style='width:374px;height:80px;vertical-align:middle;'>"+strTxtNotificationParagraphe+"</td><td style='width:16px;vertical-align:top;'><div style='height:16px;background-image:url(" + $("cheminShared").value + "/CroixRouge16.png);background-repeat:no-repeat;position:relative;top:5px;left:-5px;cursor:pointer;' onclick='javascript:$(\"divNotification\").style.display = \"none\"'></div></td></tr></table>";
			if (navigator.appName =="Microsoft Internet Explorer")
			{
				objDiv.style.top = top.document.body.clientHeight/2 - 24 + top.document.body.scrollTop;
				objDiv.style.left = top.document.body.clientWidth/2 - 200 + top.document.body.scrollLeft;
			}
			else
			{
				objDiv.style.top = top.window.innerHeight/2 - 40 + top.window.scrollY;
				objDiv.style.left = top.window.innerWidth/2 - 200 + top.window.scrollX;
			}
			if(objDiv.style.top < 0) objDiv.style.top = 0;
			if(objDiv.style.left < 0) objDiv.style.left = 0;
			document.body.appendChild(objDiv);
			window.setTimeout(function(){$("divNotification").style.display = "none";},5000);
		}
	}
	else
	{
		var objParagrapheClone=$(idParagraphe).cloneNode(true);
		var objInnerHTML=objParagrapheClone.innerHTML;
		var objDiv=document.createElement("div");
		objDiv.setAttribute("style", "position:absolute");
		objDiv.innerHTML=objInnerHTML;
		objParagrapheClone=objDiv;
		objParagrapheClone.id = "clone";
		var objParagraphe=$(idParagraphe);
		var objDom=$(idParagraphe).parentNode;
		objParagrapheClone.setAttribute("style", "position:absolute");
		objParagrapheClone.style.visibility="hidden";
		objDom.appendChild(objParagrapheClone);
		Position.absolutize(objParagrapheClone);
		
		//on stocke les coordonnes ou doit aller le paragraphe
		if($("table_AperuPanier_Moliere"))
		{
			var objPanier=Position.cumulativeOffset(Element.makePositioned("table_AperuPanier_Moliere"));
		}
		else
		{
			var objPanier=Position.cumulativeOffset(Element.makePositioned("debutPlacement"));
		}
		var objBarreRepereLeft=Position.cumulativeOffset(Element.makePositioned("barreRepereLeft"));
		new Effect.Move(objParagrapheClone,{duration: 0, y: Position.cumulativeOffset(Element.makePositioned(idParagraphe)).top, x: Position.cumulativeOffset(Element.makePositioned(idParagraphe)).left, mode: 'absolute', afterFinish: function(){objParagrapheClone.style.visibility="visible";} });
			
		new Effect.Parallel(
		[
		new Effect.Opacity(objParagrapheClone,{sync:true, from: 1, to: 1}),
		new Effect.Move(objParagrapheClone,{y: objPanier.top,x: objBarreRepereLeft.left, sync: true, mode: 'absolute' })
		]
		,{
		duration: 2,afterFinish : function(){// Une fois fini on envoi la requete AJAX au serveur	
												Position.relativize(objParagrapheClone);
												Insertion.After($("debutPlacement"),objParagrapheClone);
												objParagrapheClone.style.visibility="visible";
												objParagrapheClone.style.display="";
												new Effect.Move(objParagrapheClone,{y: 0,x: 0, duration: 0, mode: 'absolute' })
												creationParagrapheBDD(idParagraphe);
												ajoutEventObserve(idParagraphe);
											}
		}); 
	}
}

function autorisationCreationChamp()//fonction qui va aller verifier si on  le droit de creer un champ dans le formulaire
{
	var retour = "";
	var url = "";
	if ($("NomPage").value == "default" )
	{
		url = $("CheminFichier").value + "/";
	}
	new Ajax.Request(url +"CheckAutorisationCreationElement.asp?element=champ&NomPage="+$("NomPage").value,
	{
		asynchronous:false,
		method:"post",
		RequestHeader: ["Content-type", "application/x-www-form-urlencoded"],
		//onFailure:function(requester){ alert(requester.responseText);},
		onSuccess:function(requester){retour = requester.responseText;}
	});
	return retour;
}//autorisationCreationChamp

function AfficheNotificationFormulaire()
{
	if($("divNotification"))
	{
		if (navigator.appName =="Microsoft Internet Explorer")
		{
			$("divNotification").style.top = top.document.body.clientHeight/2 - 24 + top.document.body.scrollTop;
			$("divNotification").style.left = top.document.body.clientWidth/2 - 200 + top.document.body.scrollLeft;
		}
		else
		{
			$("divNotification").style.top = top.window.innerHeight/2 - 40 + top.window.scrollY;
			$("divNotification").style.left = top.window.innerWidth/2 - 200 + top.window.scrollX;
		}
		if($("divNotification").style.top < 0) $("divNotification").style.top = 0;
		if($("divNotification").style.left < 0) $("divNotification").style.left = 0;
		$("divNotification").style.display = "";
		window.setTimeout(function(){$("divNotification").style.display = "none";},5000);
	}
	else
	{
		var objDiv = document.createElement("div");
		objDiv.style.backgroundImage = "url(" + $("CheminFotolia").value + "/../../Shared/Notification400.png)";
		objDiv.style.width = 400;
		objDiv.style.height = 80;
		objDiv.style.position = "absolute";
		objDiv.style.zIndex = 150;
		objDiv.style.left = 0;
		objDiv.style.display = "";
		objDiv.id = "divNotification";
		objDiv.style.fontFamily = "Verdana";
		objDiv.style.fontSize = "12px";
		objDiv.style.color = "#000000";
		objDiv.style.verticalAlign = "middle";
		objDiv.innerHTML = "<table cellpading='0' cellspacing='0' border='0' width='100%'><tr><td style='width:10px;'></td><td style='width:374px;height:80px;vertical-align:middle;'>"+strTxtNotificationChamp+"</td><td style='width:16px;vertical-align:top;'><div style='height:16px;background-image:url(" + $("CheminFotolia").value + "/../../Shared/CroixRouge16.png);background-repeat:no-repeat;position:relative;top:5px;left:-5px;' onclick='javascript:$(\"divNotification\").style.display = \"none\"'></div></td></tr></table>";
		if (navigator.appName =="Microsoft Internet Explorer")
		{
			objDiv.style.top = top.document.body.clientHeight/2 - 24 + top.document.body.scrollTop;
			objDiv.style.left = top.document.body.clientWidth/2 - 200 + top.document.body.scrollLeft;
		}
		else
		{
			objDiv.style.top = top.window.innerHeight/2 - 40 + top.window.scrollY;
			objDiv.style.left = top.window.innerWidth/2 - 200 + top.window.scrollX;
		}
		if(objDiv.style.top < 0) objDiv.style.top = 0;
		if(objDiv.style.left < 0) objDiv.style.left = 0;
		document.body.appendChild(objDiv);
		window.setTimeout(function(){$("divNotification").style.display = "none";},5000);
	}
}//AfficheNotificationFormulaire

function AffichNotification(strMessage)//fonction qui va afficher la notification
{
	if($("divNotification"))
	{
		if (navigator.appName =="Microsoft Internet Explorer")
		{
			$("divNotification").style.top = top.document.body.clientHeight/2 - 40 + top.document.body.scrollTop;
			$("divNotification").style.left = top.document.body.clientWidth/2 - 200 + top.document.body.scrollLeft;
		}
		else
		{
			$("divNotification").style.top = top.window.innerHeight/2 - 40 + top.window.scrollY;
			$("divNotification").style.left = top.window.innerWidth/2 - 200 + top.window.scrollX;
		}
		if($("divNotification").style.top < 0) $("divNotification").style.top = 0;
		if($("divNotification").style.left < 0) $("divNotification").style.left = 0;
		$("divNotification").style.display = "";
		window.setTimeout(function(){$("divNotification").style.display = "none";},5000);
	}
	else
	{
		var objDiv = document.createElement("div");
		objDiv.style.backgroundImage = "url(" + $("cheminShared").value + "/Notification400.png)";
		objDiv.style.width = 400;
		objDiv.style.height = 80;
		objDiv.style.position = "absolute";
		objDiv.style.zIndex = 150;
		objDiv.style.left = 0;
		objDiv.style.display = "";
		objDiv.id = "divNotification";
		objDiv.style.fontFamily = "Verdana";
		objDiv.style.fontSize = "12px";
		objDiv.style.color = "#000000";
		objDiv.style.verticalAlign = "middle";
		objDiv.innerHTML = "<table cellpading='0' cellspacing='0' border='0' width='100%'><tr><td style='width:10px;'></td><td style='width:374px;height:80px;vertical-align:middle;font-size:1.2em;'>"+strMessage+"</td><td style='width:16px;vertical-align:top;'><div style='height:16px;background-image:url(" + $("cheminShared").value + "/CroixRouge16.png);background-repeat:no-repeat;position:relative;top:5px;left:-5px;' onclick='javascript:$(\"divNotification\").style.display = \"none\"'></div></td></tr></table>";
		if (navigator.appName =="Microsoft Internet Explorer")
		{
			objDiv.style.top = top.document.body.clientHeight/2 - 24 + top.document.body.scrollTop;
			objDiv.style.left = top.document.body.clientWidth/2 - 200 + top.document.body.scrollLeft;
		}
		else
		{
			objDiv.style.top = top.window.innerHeight/2 - 40 + top.window.scrollY;
			objDiv.style.left = top.window.innerWidth/2 - 200 + top.window.scrollX;
		}
		if(objDiv.style.top < 0) objDiv.style.top = 0;
		if(objDiv.style.left < 0) objDiv.style.left = 0;
		document.body.appendChild(objDiv);
		window.setTimeout(function(){$("divNotification").style.display = "none";},5000);
	}
}//AffichNotification