
function HTMLentities(texte) {

texte = texte.replace(/"/g,'&quot;'); // 34 22
texte = texte.replace(/&/g,'&amp;'); // 38 26
texte = texte.replace(/\'/g,'&#39;'); // 39 27
texte = texte.replace(/</g,'&lt;'); // 60 3C
texte = texte.replace(/>/g,'&gt;'); // 62 3E
texte = texte.replace(/\^/g,'&circ;'); // 94 5E
texte = texte.replace(//g,'&lsquo;'); // 145 91
texte = texte.replace(//g,'&rsquo;'); // 146 92
texte = texte.replace(//g,'&ldquo;'); // 147 93
texte = texte.replace(//g,'&rdquo;'); // 148 94
texte = texte.replace(//g,'&bull;'); // 149 95
texte = texte.replace(//g,'&ndash;'); // 150 96
texte = texte.replace(//g,'&mdash;'); // 151 97
texte = texte.replace(//g,'&tilde;'); // 152 98
texte = texte.replace(//g,'&trade;'); // 153 99
texte = texte.replace(//g,'&scaron;'); // 154 9A
texte = texte.replace(//g,'&rsaquo;'); // 155 9B
texte = texte.replace(//g,'&oelig;'); // 156 9C
texte = texte.replace(//g,'&#357;'); // 157 9D
texte = texte.replace(//g,'&#382;'); // 158 9E
texte = texte.replace(//g,'&Yuml;'); // 159 9F
// texte = texte.replace(/ /g,'&nbsp;'); // 160 A0
texte = texte.replace(//g,'&iexcl;'); // 161 A1
texte = texte.replace(//g,'&cent;'); // 162 A2
texte = texte.replace(//g,'&pound;'); // 163 A3
//texte = texte.replace(/ /g,'&curren;'); // 164 A4
texte = texte.replace(//g,'&yen;'); // 165 A5
texte = texte.replace(//g,'&brvbar;'); // 166 A6
texte = texte.replace(//g,'&sect;'); // 167 A7
texte = texte.replace(//g,'&uml;'); // 168 A8
texte = texte.replace(//g,'&copy;'); // 169 A9
texte = texte.replace(//g,'&ordf;'); // 170 AA
texte = texte.replace(//g,'&laquo;'); // 171 AB
texte = texte.replace(//g,'&not;'); // 172 AC
texte = texte.replace(/ /g,'&shy;'); // 173 AD
texte = texte.replace(//g,'&reg;'); // 174 AE
texte = texte.replace(//g,'&macr;'); // 175 AF
texte = texte.replace(//g,'&deg;'); // 176 B0
texte = texte.replace(//g,'&plusmn;'); // 177 B1
texte = texte.replace(//g,'&sup2;'); // 178 B2
texte = texte.replace(//g,'&sup3;'); // 179 B3
texte = texte.replace(//g,'&acute;'); // 180 B4
texte = texte.replace(//g,'&micro;'); // 181 B5
texte = texte.replace(//g,'&para'); // 182 B6
texte = texte.replace(//g,'&middot;'); // 183 B7
texte = texte.replace(//g,'&cedil;'); // 184 B8
texte = texte.replace(//g,'&sup1;'); // 185 B9
texte = texte.replace(//g,'&ordm;'); // 186 BA
texte = texte.replace(//g,'&raquo;'); // 187 BB
texte = texte.replace(//g,'&frac14;'); // 188 BC
texte = texte.replace(//g,'&frac12;'); // 189 BD
texte = texte.replace(//g,'&frac34;'); // 190 BE
texte = texte.replace(//g,'&iquest;'); // 191 BF
texte = texte.replace(//g,'&Agrave;'); // 192 C0
texte = texte.replace(//g,'&Aacute;'); // 193 C1
texte = texte.replace(//g,'&Acirc;'); // 194 C2
texte = texte.replace(//g,'&Atilde;'); // 195 C3
texte = texte.replace(//g,'&Auml;'); // 196 C4
texte = texte.replace(//g,'&Aring;'); // 197 C5
texte = texte.replace(//g,'&AElig;'); // 198 C6
texte = texte.replace(//g,'&Ccedil;'); // 199 C7
texte = texte.replace(//g,'&Egrave;'); // 200 C8
texte = texte.replace(//g,'&Eacute;'); // 201 C9
texte = texte.replace(//g,'&Ecirc;'); // 202 CA
texte = texte.replace(//g,'&Euml;'); // 203 CB
texte = texte.replace(//g,'&Igrave;'); // 204 CC
texte = texte.replace(//g,'&Iacute;'); // 205 CD
texte = texte.replace(//g,'&Icirc;'); // 206 CE
texte = texte.replace(//g,'&Iuml;'); // 207 CF
texte = texte.replace(//g,'&ETH;'); // 208 D0
texte = texte.replace(//g,'&Ntilde;'); // 209 D1
texte = texte.replace(//g,'&Ograve;'); // 210 D2
texte = texte.replace(//g,'&Oacute;'); // 211 D3
texte = texte.replace(//g,'&Ocirc;'); // 212 D4
texte = texte.replace(//g,'&Otilde;'); // 213 D5
texte = texte.replace(//g,'&Ouml;'); // 214 D6
texte = texte.replace(//g,'&times;'); // 215 D7
texte = texte.replace(//g,'&Oslash;'); // 216 D8
texte = texte.replace(//g,'&Ugrave;'); // 217 D9
texte = texte.replace(//g,'&Uacute;'); // 218 DA
texte = texte.replace(//g,'&Ucirc;'); // 219 DB
texte = texte.replace(//g,'&Uuml;'); // 220 DC
texte = texte.replace(//g,'&Yacute;'); // 221 DD
texte = texte.replace(//g,'&THORN;'); // 222 DE
texte = texte.replace(//g,'&szlig;'); // 223 DF
texte = texte.replace(//g,'&aacute;'); // 224 E0
texte = texte.replace(//g,'&aacute;'); // 225 E1
texte = texte.replace(//g,'&acirc;'); // 226 E2
texte = texte.replace(//g,'&atilde;'); // 227 E3
texte = texte.replace(//g,'&auml;'); // 228 E4
texte = texte.replace(//g,'&aring;'); // 229 E5
texte = texte.replace(//g,'&aelig;'); // 230 E6
texte = texte.replace(//g,'&ccedil;'); // 231 E7
texte = texte.replace(//g,'&egrave;'); // 232 E8
texte = texte.replace(//g,'&eacute;'); // 233 E9
texte = texte.replace(//g,'&ecirc;'); // 234 EA
texte = texte.replace(//g,'&euml;'); // 235 EB
texte = texte.replace(//g,'&igrave;'); // 236 EC
texte = texte.replace(//g,'&iacute;'); // 237 ED
texte = texte.replace(//g,'&icirc;'); // 238 EE
texte = texte.replace(//g,'&iuml;'); // 239 EF
texte = texte.replace(//g,'&eth;'); // 240 F0
texte = texte.replace(//g,'&ntilde;'); // 241 F1
texte = texte.replace(//g,'&ograve;'); // 242 F2
texte = texte.replace(//g,'&oacute;'); // 243 F3
texte = texte.replace(//g,'&ocirc;'); // 244 F4
texte = texte.replace(//g,'&otilde;'); // 245 F5
texte = texte.replace(//g,'&ouml;'); // 246 F6
texte = texte.replace(//g,'&divide;'); // 247 F7
texte = texte.replace(//g,'&oslash;'); // 248 F8
texte = texte.replace(//g,'&ugrave;'); // 249 F9
texte = texte.replace(//g,'&uacute;'); // 250 FA
texte = texte.replace(//g,'&ucirc;'); // 251 FB
texte = texte.replace(//g,'&uuml;'); // 252 FC
texte = texte.replace(//g,'&yacute;'); // 253 FD
texte = texte.replace(//g,'&thorn;'); // 254 FE
texte = texte.replace(//g,'&yuml;'); // 255 FF
return texte;
}
(function(){

	// Regular Expressions for parsing tags and attributes
	var startTag = /^<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
		endTag = /^<\/(\w+)[^>]*>/,
		attr = /(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
		
	// Empty Elements - HTML 4.01
	var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed");

	// Block Elements - HTML 4.01
	var block = makeMap("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul");

	// Inline Elements - HTML 4.01
	var inline = makeMap("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");

	// Elements that you can, intentionally, leave open
	// (and which close themselves)
	var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");

	// Attributes that have their values filled in disabled="disabled"
	var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");

	// Special Elements (can contain anything)
	var special = makeMap("script,style");

	var HTMLParser = this.HTMLParser = function( html, handler ) {
		var index, chars, match, stack = [], last = html;
		stack.last = function(){
			return this[ this.length - 1 ];
		};

		while ( html ) {
			chars = true;

			// Make sure we're not in a script or style element
			if ( !stack.last() || !special[ stack.last() ] ) {

				// Comment
				if ( html.indexOf("<!--") == 0 ) {
					index = html.indexOf("-->");
	
					if ( index >= 0 ) {
						if ( handler.comment )
							handler.comment( html.substring( 4, index ) );
						html = html.substring( index + 3 );
						chars = false;
					}
	
				// end tag
				} else if ( html.indexOf("</") == 0 ) {
					match = html.match( endTag );
	
					if ( match ) {
						html = html.substring( match[0].length );
						match[0].replace( endTag, parseEndTag );
						chars = false;
					}
	
				// start tag
				} else if ( html.indexOf("<") == 0 ) {
					match = html.match( startTag );
	
					if ( match ) {
						html = html.substring( match[0].length );
						match[0].replace( startTag, parseStartTag );
						chars = false;
					}
				}

				if ( chars ) {
					index = html.indexOf("<");
					
					var text = index < 0 ? html : html.substring( 0, index );
					html = index < 0 ? "" : html.substring( index );
					
					if ( handler.chars )
						handler.chars( text );
				}

			} else {
				html = html.replace(new RegExp("(.*)<\/" + stack.last() + "[^>]*>"), function(all, text){
					text = text.replace(/<!--(.*?)-->/g, "$1")
						.replace(/<!\[CDATA\[(.*?)]]>/g, "$1");

					if ( handler.chars )
						handler.chars( text );

					return "";
				});

				parseEndTag( "", stack.last() );
			}

			if ( html == last )
				throw "Parse Error: " + html;
			last = html;
		}
		
		// Clean up any remaining tags
		parseEndTag();

		function parseStartTag( tag, tagName, rest, unary ) {
			if ( block[ tagName ] ) {
				while ( stack.last() && inline[ stack.last() ] ) {
					parseEndTag( "", stack.last() );
				}
			}

			if ( closeSelf[ tagName ] && stack.last() == tagName ) {
				parseEndTag( "", tagName );
			}

			unary = empty[ tagName ] || !!unary;

			if ( !unary )
				stack.push( tagName );
			
			if ( handler.start ) {
				var attrs = [];
	
				rest.replace(attr, function(match, name) {
					var value = arguments[2] ? arguments[2] :
						arguments[3] ? arguments[3] :
						arguments[4] ? arguments[4] :
						fillAttrs[name] ? name : "";
					
					attrs.push({
						name: name,
						value: value,
						escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //"
					});
				});
	
				if ( handler.start )
					handler.start( tagName, attrs, unary );
			}
		}

		function parseEndTag( tag, tagName ) {
			// If no tag name is provided, clean shop
			if ( !tagName )
				var pos = 0;
				
			// Find the closest opened tag of the same type
			else
				for ( var pos = stack.length - 1; pos >= 0; pos-- )
					if ( stack[ pos ] == tagName )
						break;
			
			if ( pos >= 0 ) {
				// Close all the open elements, up the stack
				for ( var i = stack.length - 1; i >= pos; i-- )
					if ( handler.end )
						handler.end( stack[ i ] );
				
				// Remove the open elements from the stack
				stack.length = pos;
			}
		}
	};
	
	this.HTMLtoXML = function( html ) {
		var results = "";
		
		HTMLParser(html, {
			start: function( tag, attrs, unary ) {
				results += "<" + tag;
		
				for ( var i = 0; i < attrs.length; i++ )
					results += " " + attrs[i].name + '="' + attrs[i].escaped + '"';
		
				results += (unary ? "/" : "") + ">";
			},
			end: function( tag ) {
				results += "</" + tag + ">";
			},
			chars: function( text ) {
				results += text;
			},
			comment: function( text ) {
				results += "<!--" + text + "-->";
			}
		});
		
		return results;
	};
	
	this.HTMLtoDOM = function( html, doc ) {
		// There can be only one of these elements
		var one = makeMap("html,head,body,title");
		
		// Enforce a structure for the document
		var structure = {
			link: "head",
			base: "head"
		};
	
		if ( !doc ) {
			if ( typeof DOMDocument != "undefined" )
				doc = new DOMDocument();
			else if ( typeof document != "undefined" && document.implementation && document.implementation.createDocument )
				doc = document.implementation.createDocument("", "", null);
			else if ( typeof ActiveX != "undefined" )
				doc = new ActiveXObject("Msxml.DOMDocument");
			
		} else
			doc = doc.ownerDocument ||
				doc.getOwnerDocument && doc.getOwnerDocument() ||
				doc;
		
		var elems = [],
			documentElement = doc.documentElement ||
				doc.getDocumentElement && doc.getDocumentElement();
				
		// If we're dealing with an empty document then we
		// need to pre-populate it with the HTML document structure
		if ( !documentElement && doc.createElement ) (function(){
			var html = doc.createElement("html");
			var head = doc.createElement("head");
			head.appendChild( doc.createElement("title") );
			html.appendChild( head );
			html.appendChild( doc.createElement("body") );
			doc.appendChild( html );
		})();
		
		// Find all the unique elements
		if ( doc.getElementsByTagName )
			for ( var i in one )
				one[ i ] = doc.getElementsByTagName( i )[0];
		
		// If we're working with a document, inject contents into
		// the body element
		var curParentNode = one.body;
		
		HTMLParser( html, {
			start: function( tagName, attrs, unary ) {
				// If it's a pre-built element, then we can ignore
				// its construction
				if ( one[ tagName ] ) {
					curParentNode = one[ tagName ];
					return;
				}
			
				var elem = doc.createElement( tagName );
				
				for ( var attr in attrs )
					elem.setAttribute( attrs[ attr ].name, attrs[ attr ].value );
				
				if ( structure[ tagName ] && typeof one[ structure[ tagName ] ] != "boolean" )
					one[ structure[ tagName ] ].appendChild( elem );
				
				else if ( curParentNode && curParentNode.appendChild )
					curParentNode.appendChild( elem );
					
				if ( !unary ) {
					elems.push( elem );
					curParentNode = elem;
				}
			},
			end: function( tag ) {
				elems.length -= 1;
				
				// Init the new parentNode
				curParentNode = elems[ elems.length - 1 ];
			},
			chars: function( text ) {
				curParentNode.appendChild( doc.createTextNode( text ) );
			},
			comment: function( text ) {
				// create comment node
			}
		});
		
		return doc;
	};

	function makeMap(str){
		var obj = {}, items = str.split(",");
		for ( var i = 0; i < items.length; i++ )
			obj[ items[i] ] = true;
		return obj;
	}
})();
function change(element)
{

		if($('center_menu').visible())
		{
			$('center_menu').hide();
			$('menu').setStyle({width : '5%', minWidth:'0%'});
			$('header').setStyle({margin : '0 0 0 6%'});
			$('contenu').setStyle({width :'92%', maxWidth: '92%', margin : '75px 0 0 6%'});
		}
		else
		{
			$('center_menu').show();
			$('menu').setStyle({width : '26%', minWidth:'260px'});
			$('header').setStyle({margin : '0 0 0 26%'});
			$('contenu').setStyle({width :'73%', maxWidth: '100%', margin : '75px 0 0 26%'});
		}

}
function whoRequest()
{
	new Ajax.Request('/v3/index.php?req&action=who',
	{
		method : 'get',
				
		onSuccess: function(buffer)
		{
			var get = buffer.responseText || "La requte n'a pas aboutie";
			$('toolbox-who').update(get);
		},
	});
}
function AjaxInternRequest(hash)
{
	var loading = '<div style="position : relative; clear : both"><img src="SonicLoadingAjax.gif"/><br/><p>Chargement en cours...</p></div>'
	var $j = jQuery.noConflict();	
	
	if(hash != null && hash != "")
	{	
			var getHash = hash.charAt(0) + hash.charAt(1) + hash.charAt(2);
			if(getHash == "top" || getHash == "boa" || getHash == "act" || getHash == "ind")
			{
				hash = hash.replace(/,/g, '=');
				var scrollto = hash.replace(/^.*#/, '');
				hash = hash.replace(/#/g, '');
				
				new Ajax.Request('/v3/index.php?'+hash+'&req',
					{
						method : 'get',
						
						 onSuccess: function(buffer)
						 {
							
							$j('#body').scrollTo($j('#contenu'), 0, {axis:'y'});
							var get = buffer.responseText || "La requete n\'a pas aboutie"+hash;
							$('contenu').update(get);
							if(scrollto != "")
								$j('#body').scrollTo($j('#'+scrollto), 800, {axis:'y'});
						 },
						 onFailure : function()
						 {
							$('contenu').update("La requete n\'a pas aboutie");
						 }
					}
					);
			}
	}
	
}

//Fiches.fonction
	function Switch(id_ul, effect)
	{
		if(effect == null)
		{
			if($(id_ul).visible())
				$(id_ul).hide();
			else
				$(id_ul).show();
		}
		if(effect == 'slide')
		{
			if($(id_ul).visible())
				Effect.SlideUp(id_ul);
			else
				Effect.SlideDown(id_ul);
		}
	}
	function faq(id_element)
	{
		var id = id_element.identify();
		if($("faq-"+id) != null)
			var faq = $("faq-"+id).innerHTML;
		else
			var faq = "";
		if($('faq') != null)
			$('faq').update(faq);
		
	}

		function preview(id_txt, form)
		{
			if(form == null)
			{
				var field = $F($('fiche')[id_txt]);
				field = field.replace(/\n/g, '<br />').replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
				if($('prev_'+id_txt) != null)
				{
					id_prev = $('prev_'+id_txt);
					id_prev.update(field);
				}
			}
			else
			{
				var field = $F($(form)[id_txt]);
				field = field.replace(/\n/g, '<br />').replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
				if($('prev_'+id_txt) != null)
				{
					id_prev = $('prev_'+id_txt);
					id_prev.update(field);
				}
			}
		}
		function changeStep(id)
		{
			
				if(id <= 0)
					id_prev = 0;
				else 
					id_prev = id - 1;
						
				if(ficheValidation(id_prev))
				{
					$('error').update("");
	
					for(var i = 0; i <= id_prev ; i++)
					{
						if($('STEP_'+i).visible())
							Switch('STEP_'+i);
					}
					$('STEP_'+id).show();
					$("STEP").update("Etape n&deg;"+id);	
					
					for(var i = id + 1; i <= $('max_step').innerHTML; i++)
					{
						if($('STEP_'+i).visible() && $('STEP_'+i) != null)
							Switch('STEP_'+i);
					}
				}
		}
			function otherCamp()
			{
				if(document.getElementById("camp").options[document.getElementById("camp").selectedIndex].value == "Autre")
					$("div-other_camp").appear();
				else
				{
					if($("div-other_camp").visible())
						$("div-other_camp").fade();
				}
			}
			function selectWithInput(select, choice_to_input)
			{
				if(document.getElementById(select).options[document.getElementById(select).selectedIndex].value == choice_to_input)
					$('div_input_'+select).appear();
				else
				{
					if($('div_input_'+select).visible())
						$('div_input_'+select).fade();
				}
			}
			function ficheValidation(id)
			{
				var arr = null;
				var form = $('form');
				if($('STEP_'+id) == "")
					return false;
				else
				{
					arr = $('STEP_'+id).childElements();
					
					for(var i = 0; i < arr.length; i++)
					{
						if(form[arr[i].identify()] != null)
						{
							var field = form[arr[i].identify()];
							if(arr[i].hasClassName("obligatoire"))
							{
								//Si cet lment est un lment Select avec Input en cas de Autres
								if(arr[i].hasClassName("select_with_input"))
								{
									var arr_options = arr[i].childElements();
									for(var j = 0; j < arr_options.length; j++)
									{
										if(arr_options[j].hasClassName("choice_to_input"))
										{
											var field3 = form['input_'+arr[i].identify()];
											if(field.getValue() == arr_options[j].identify() && $F(field3) == "")
											{
												$('error').update("Certains champs obligatoires ne sont pas remplis.");
												return false;
											}
										}
									}
	
								}
								else if($F(field) == "")
								{
									$('error').update("Certains champs obligatoires ne sont pas remplis.");
									return false;
								}

							}
							 
						}
						
					}
				}
				return true;
			}
	function createSubFiche(fiche_div, name_pnj, list_balise)
	{
		
		if(name_pnj != 'name' && name_pnj != '' && $(name_pnj) == null)
			{
			
			var fieldset_form = new Element('fieldset', {'id' : 'fieldset_'+name_pnj, 'style' : 'display : none;', 'class' : 'div-subfiche' });
			fieldset_form.appear();
			$(fiche_div).appendChild(fieldset_form);
			
			fieldset_form.appendChild(new Element('label', { 'for' : 'pseudo_'+name_pnj}).update("Nom :"));
			fieldset_form.appendChild(new Element('input', { 'type' : 'text', 'name' : 'pseudo_'+name_pnj, 'id' : 'pseudo_'+name_pnj, 'value' : name_pnj}));
			fieldset_form.appendChild(new Element('br'));
			
			fieldset_form.appendChild(new Element('label', { 'for' : 'url_avatar_'+name_pnj}).update("Avatar :"));

			fieldset_form.appendChild(new Element('input', { 'type' : 'text', 'name' : 'url_avatar_'+name_pnj, 'id' : 'url_avatar_'+name_pnj, 'onChange' : 'setImgFromInput(\'avatar_'+name_pnj+'\', \'fiche\', \'url_avatar_'+name_pnj+'\')'}));
			
			fieldset_form.appendChild(new Element('br'));
			fieldset_form.appendChild(new Element('img', {'src' : '', 'name' : 'avatar_'+name_pnj, 'id' : 'avatar_'+name_pnj}));
			
			fieldset_form.appendChild(new Element('br'));
			fieldset_form.appendChild(new Element('label', { 'for' : 'race_'+name_pnj}).update("Race :"));
			fieldset_form.appendChild(new Element('input', { 'type' : 'text', 'name' : 'race_'+name_pnj, 'id' : 'race_'+name_pnj}));
			fieldset_form.appendChild(new Element('br'));
			
			fieldset_form.appendChild(new Element('label', { 'for' : 'story_'+name_pnj}).update("Histoire :"));
			fieldset_form.appendChild(new Element('br'));
			
			fieldset_form.appendChild(new Element('textarea', {'name' : 'story_'+name_pnj, 'id' : 'story_'+name_pnj, 'rows' : '20', 'cols' : '100'}));
			fieldset_form.appendChild(new Element('br'));
			
			fieldset_form.appendChild(new Element('label', { 'for' : 'phy_desc_'+name_pnj}).update("Description Physique :"));
			fieldset_form.appendChild(new Element('br'));
			
			fieldset_form.appendChild(new Element('textarea', {'name' : 'phy_desc_'+name_pnj, 'id' : 'phy_desc_'+name_pnj, 'rows' : '20', 'cols' : '100'}));
			fieldset_form.appendChild(new Element('br'));
			
			fieldset_form.appendChild(new Element('label', { 'for' : 'mind_desc_'+name_pnj}).update("Description Mentale :"));
			fieldset_form.appendChild(new Element('br'));
			fieldset_form.appendChild(new Element('textarea', {'name' : 'mind_desc_'+name_pnj, 'id' : 'mind_desc_'+name_pnj, 'rows' : '20', 'cols' : '100'}));
			fieldset_form.appendChild(new Element('br'));
			
			var valide = new Element('input', {'value' : 'Valider', 'type' : 'button'});
			valide.onclick = function()
			{
				checkSubFiche(name_pnj);
			}
			
			
			fieldset_form.appendChild(valide);
			var cancel = new Element('input', {'onClick' : 'javascript:removeSubFiche(\''+name_pnj+'\');', 'value' : 'Annuler', 'type' : 'button'});
			cancel.onclick = function()
			{
				removeSubFiche(name_pnj);
			}
			fieldset_form.appendChild(cancel);
			fieldset_form.appendChild(new Element('br'));
			
			fieldset_form.appendChild(new Element('div', {'id' : 'error_'+name_pnj}));
			if($(list_balise) != null)
				$(list_balise).appendChild(new Element('option', { 'value' : name_pnj, 'id' : name_pnj }).update(name_pnj));
			
		}

	}
		function removeSubFiche(Html_Element)
		{
			if($(Html_Element) != null)
				$(Html_Element).remove();
			if($('fieldset_'+Html_Element) != null)
				$('fieldset_'+Html_Element).remove();
			
		}
		
		function checkSubFiche(name_Fiche)
		{
			Error('error_'+name_Fiche, 'reset');
			
			var b = true;
			var form = $('fiche');
			
			if($F(form['pseudo_'+name_Fiche]) == '')
			{
				Error('error_'+name_Fiche, 'add', 'pseudo_error_'+name_Fiche, '<b>Le nom est manquant !</b>');
				b = false;
			
			}
			if($F(form['race_'+name_Fiche]) == '')
			{
				Error('error_'+name_Fiche, 'add', 'race_error_'+name_Fiche, '<b>La race est manquante !</b>');
				b = false;
			}
			if($F(form['story_'+name_Fiche]) == '')
			{
				Error('error_'+name_Fiche, 'add', 'story_error_'+name_Fiche, '<b>L\'histoire est manquante !</b>');
				b = false;
			}
			if($F(form['phy_desc_'+name_Fiche]) == '')
			{
				Error('error_'+name_Fiche, 'add', 'phy_error_'+name_Fiche, '<b>La description physique est manquante !</b>');
				b = false;
			}
			if($F(form['mind_desc_'+name_Fiche]) == '')
			{
				Error('error_'+name_Fiche, 'add', 'mind_error_'+name_Fiche, '<b>La description mentale est manquante !</b>');
				b = false;
			}
			if(b)
				Switch('fieldset_'+name_Fiche);
			else
			{
				if($('fieldset_'+name_Fiche) != null && !$('fieldset_'+name_Fiche).visible())
					$('fieldset_'+name_Fiche).show();
			}
				
		}
		function Error(div_error, type, id_error , string)
		{
			if(type == "add")
			{
				if($(id_error) == null)
				{
					if(!$(div_error).visible())
						$(div_error).show();
					var element_error = new Element('p', {'id' : id_error}).update(string);
					$(div_error).appendChild(element_error);
				}
			}
			else if(type == "reset")
			{
				if($(div_error) != null)
				{
					$(div_error).update('');
					if($(div_error).visible())
						$(div_error).fade();
				}
			}
			else if(type == "suppr")
			{
				if($(id_error) != null)
					$(id_error).remove();
			}
		}
		
		function insertTag(startTag, endTag, textareaId, tagType)
		{
					var field = document.getElementById(textareaId);
					field.focus();
					/* === Partie 1 : on rcupre la slection === */
					if (window.ActiveXObject) 
					{
						var textRange = document.selection.createRange();            
						var currentSelection = textRange.text;
					} 
					else 
					{
						var startSelection   = field.value.substring(0, field.selectionStart);
						var currentSelection = field.value.substring(field.selectionStart, field.selectionEnd);
						var endSelection     = field.value.substring(field.selectionEnd);               
					}
        
					/* === Partie 2 : on analyse le tagType === */
					if (tagType) 
					{
						switch (tagType) 
						{
							case "lien": 
							break;
							case "citation":       
							break;
						
						}
					}

				/* === Partie 3 : on insre le tout === */
				if (window.ActiveXObject) 
				{
					textRange.text = startTag + currentSelection + endTag;
					textRange.moveStart("character", -endTag.length - currentSelection.length);
					textRange.moveEnd("character", -endTag.length);
					textRange.select();     
				}	 
				else 
				{
					field.value = startSelection + startTag + currentSelection + endTag + endSelection;
					field.focus();
					field.setSelectionRange(startSelection.length + startTag.length, startSelection.length + startTag.length + currentSelection.length);
				}  
		}


		
				
			function setImgFromInput(img_balise, form_url, element_url)
			{

				var form = $(form_url);
				var element_url = form[element_url];	
				
					if($F(element_url) != "")
					{
						var img_element = $(img_balise);
						 img_element.show();
						 img_element.setAttribute( 'src', $F(element_url));
						
					}
					else
						$(img_balise).hide();
			}
			

	

			