<!-- SCRIPT INFOBULLE
	function GetId(id)
	{
		return document.getElementById(id);
	}
	var i=false; // La variable i nous dit si la bulle est visible ou non
	 
	function move(e) {
	  if(i) {  // Si la bulle est visible, on calcul en temps reel sa position ideale
		if (navigator.appName!="Microsoft Internet Explorer") { // Si on est pas sous IE
		GetId("curseur").style.left=e.pageX + 5+"px";
		GetId("curseur").style.top=e.pageY + 10+"px";
		}
		else { // Modif proposAC par TeDeum, merci A   lui
		if(document.documentElement.clientWidth>0) {
	GetId("curseur").style.left=20+event.x+document.documentElement.scrollLeft+"px";
	GetId("curseur").style.top=10+event.y+document.documentElement.scrollTop+"px";
		} else {
	GetId("curseur").style.left=20+event.x+document.body.scrollLeft+"px";
	GetId("curseur").style.top=10+event.y+document.body.scrollTop+"px";
			 }
		}
	  }
	}
	 
	function montre(text) {
	  if(i==false) {
	  GetId("curseur").style.visibility="visible"; // Si il est cacher (la verif n'est qu'une securitAC) on le rend visible.
	  GetId("curseur").innerHTML = text; // on copie notre texte dans l'AClACment html
	  i=true;
	  }
	}
	function cache() {
	if(i==true) {
	GetId("curseur").style.visibility="hidden"; // Si la bulle est visible on la cache
	i=false;
	}
	}
	document.onmousemove=move; // dA¨s que la souris bouge, on appelle la fonction move pour mettre A  jour la position de la bulle.
// FIN SCRIPT INFOBULLE -->


<!-- SCRIPT VERIFICATION PSEUDONYME
	function writediv(texte)
		 {
			 document.getElementById('pseudobox').innerHTML = texte;
		 }
	
	function verifPseudo(pseudo)
		 {
		 if(pseudo != '')
				   {
				   if(pseudo.length<4)
							 writediv('<span style="color:#cc0000;background:#FFF;"><b>'+pseudo+' :</b> ce pseudo est trop court !</span>');
				   else if(pseudo.length>30)
							 writediv('<span style="color:#cc0000;background:#FFF;"><b>'+pseudo+' :</b> ce pseudo est trop long !</span>');
				   else if(texte = file('Includes/ajax_verifpseudo.php?pseudo='+escape(pseudo)))
							 {
								  
								if(pseudo.match('[^a-zA-Z0-9]'))
								{ 
										   writediv('<span style="color:#cc0000;background:#FFF;"><b>'+pseudo+' :</b> Seul les caractères alpha-numériques sont acceptés</span>');
								}
								  
								  else
								  {
									  if(texte == 1)
										   writediv('<span style="color:#cc0000;background:#FFF;"><b>'+pseudo+' :</b> ce pseudo est deja pris</span>');
									  else if(texte == 2)
										   writediv('<span style="color:#1A7917;background:#FFF;"><b>'+pseudo+' :</b> ce pseudo est libre</span>');
									  else
										   writediv(texte);
								  }
							 }
				   }
	
		 }
	
	function file(fichier)
		 {
		 if(window.XMLHttpRequest) // FIREFOX
			  xhr_object = new XMLHttpRequest();
		 else if(window.ActiveXObject) // IE
			  xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		 else
			  return(false);
		 xhr_object.open("GET", fichier, false);
		 xhr_object.send(null);
		 if(xhr_object.readyState == 4) return(xhr_object.responseText);
		 else return(false);
		 }
// FIN SCRIPT VERIFICATION PSEUDONYME -->


<!-- SCRIPT INFOBULLE
	function storeCaret (textarea) { 
	if (document.getElementById(textarea).createTextRange) document.getElementById(textarea).caretPos = document.selection.createRange().duplicate(); 
	}
		
	
	function insertAtCaret (textarea, icon) { 
	if (document.getElementById(textarea).createTextRange && document.getElementById(textarea).caretPos) { 
	var caretPos = document.getElementById(textarea).caretPos; 
	selectedtext = caretPos.text; 
	caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '' ? icon + '' : icon; 
	caretPos.text = caretPos.text + selectedtext; }
	else if (document.getElementById(textarea).textLength > 0){
	Deb = document.getElementById(textarea).value.substring( 0 , document.getElementById(textarea).selectionStart );
	Fin = document.getElementById(textarea).value.substring( document.getElementById(textarea).selectionEnd , document.getElementById(textarea).textLength );
	document.getElementById(textarea).value = Deb + icon + Fin; }
	else{ document.getElementById(textarea).value = document.getElementById(textarea).value + icon; }
	document.getElementById(textarea).focus(); 
	}
	
	
	function PopupinsertAtCaret (textarea, icon) { 
	if (opener.document.getElementById(textarea).createTextRange && opener.document.getElementById(textarea).caretPos) { 
	var caretPos = opener.document.getElementById(textarea).caretPos; 
	selectedtext = caretPos.text; 
	caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '' ? icon + '' : icon; 
	caretPos.text = caretPos.text + selectedtext; }
	else if (opener.document.getElementById(textarea).textLength > 0){
	Deb = opener.document.getElementById(textarea).value.substring( 0 , opener.document.getElementById(textarea).selectionStart );
	Fin = opener.document.getElementById(textarea).value.substring( opener.document.getElementById(textarea).selectionEnd , opener.document.getElementById(textarea).textLength );
	opener.document.getElementById(textarea).value = Deb + icon + Fin; }
	else{ opener.document.getElementById(textarea).value = opener.document.getElementById(textarea).value + icon; }
	}
	
	
	function substr_count(str, ssstr) {
	num = 0;
	while(str.indexOf(ssstr) != -1) 
	{
	str = str.substr(str.indexOf(ssstr) + ssstr.length, str.length - (str.indexOf(ssstr)+ssstr.length));
	num++;
	}
	return num;
	}
	
	
	function backslash(textarea) {
	texte = document.getElementById(textarea).value;
	texte = texte.replace(/\\/g,"\\");
	document.getElementById(textarea).value=texte;
	}
	
	function BBcode_close(textarea) {
	texte = document.getElementById(textarea).value;
	bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote','[/quote]','[code]','[/code]','[li]','[/li]','[img','[/img]','[url','[/url]','[email]','[/email]','[center]','[/center]','[flash','[/flash]','[color','[/color]','[font','[/font]','[size','[/size]','[align','[/align]','[blink]','[/blink]','[strike]','[/strike]','[marquee]','[/marquee]','[updown]','[/updown]','[flip]','[/flip]','[blink]','[/blink]','[blur]','[/blur]','[glow','[/glow]','[shadow','[/shadow]');
	size= bbtags.length;
	
	for (var i =0; i < size; i+=2) {
	nb_open=substr_count(texte, bbtags[i]);
	nb_close=substr_count(texte, bbtags[i+1]);
							 
	if (nb_open>nb_close) {
	for (var z =nb_open; z > nb_close; z--){
	texte+=bbtags[i+1];}
	}
	if (nb_open < nb_close) {
	for (var a =nb_open; a < nb_close; a++){
	texte=bbtags[i]+texte;}
	}
	}  
	document.getElementById(textarea).value=texte;    
	}
	
	
	function ajout_url(textarea, texturl, textname){
	VarUrl = window.prompt(texturl,'http://');
	VarNom = window.prompt(textname,'');
	if (VarUrl.indexOf('http://') == -1) VarUrl = 'http://'+VarUrl;
	if ((VarUrl != null) && (VarUrl != '') && (VarNom != null) && (VarNom != '')) {
	insertAtCaret(textarea, '[url='+VarUrl+']'+VarNom+'[/url]');}
	
	
	}
		
	
	function ajout_img(textarea, textimgturl){
	VarImg = window.prompt( textimgturl,'http://' );
	if (VarImg.indexOf('http://') == -1) VarImg = 'http://'+VarImg;
	if ((VarImg != null) && (VarImg != '')) {
	insertAtCaret(textarea, '[img]'+VarImg+'[/img]');}
	}
	
		
	function ajout_flash(textarea, textflashurl, textflashwidth, textflashheight){
	Varflash = window.prompt(textflashurl,'http://');
	VarFWidth = window.prompt(textflashwidth,'100');
	VarFHeight = window.prompt(textflashheight,'100');
	if (Varflash.indexOf('http://') == -1) Varflash = 'http://'+Varflash;
	if ((Varflash != null) && (Varflash != '')) {
	insertAtCaret(textarea, '[flash='+VarFWidth+'x'+VarFHeight+']'+Varflash+'[/flash]');}
	} 
	
	function balise(c,f,e){
		var h=document.getElementById(e);
		var b=h.scrollTop;
		c=remplace(c,"<br />","\n");
		
		if(f==""){c=" "+c+" "}
		
		if(h.curseur){
			h.curseur.text=c+h.curseur.text+f}
			else{
				if(h.selectionStart>=0&&h.selectionEnd>=0){
					if(h.selectionStart==h.selectionEnd&&empty(trim(h.value.substring(h.selectionEnd,h.value.length)))){
						h.setSelectionRange(h.value.length,h.value.length)}
						var a=h.value.substring(0,h.selectionStart);
						var d=h.value.substring(h.selectionStart,h.selectionEnd);
						var g=h.value.substring(h.selectionEnd);
						h.value=a+c+d+f+g;h.focus();
						h.setSelectionRange(a.length+c.length,h.value.length-g.length-f.length)}
					else{h.value+=c+f;h.focus()}
				}
				h.scrollTop=b
			}
	
	function ajout_text(textarea, entertext, tapetext, balise){
		
		var position = document.getElementById(textarea).scrollTop;
		
	if (document.getElementById(textarea).selectionEnd && (document.getElementById(textarea).selectionEnd - document.getElementById(textarea).selectionStart > 0))
	{
		valeurDebutSelection = document.getElementById(textarea).selectionStart+(balise.length+2);
		valeurFinSelection = document.getElementById(textarea).selectionEnd+(balise.length+2);
	}
	else
	{
		valeurDebutSelection = 5;
		valeurFinSelection = 10;
	}
	
	if (document.selection && document.selection.createRange().text != ''){
	document.getElementById(textarea).focus();
	VarTxt = document.selection.createRange().text;
	document.selection.createRange().text = '['+balise+']'+VarTxt+'[/'+balise+']';}
	
	else if (document.getElementById(textarea).selectionEnd && (document.getElementById(textarea).selectionEnd - document.getElementById(textarea).selectionStart > 0)){
	valeurDeb = document.getElementById(textarea).value.substring( 0 , document.getElementById(textarea).selectionStart );
	valeurFin = document.getElementById(textarea).value.substring( document.getElementById(textarea).selectionEnd , document.getElementById(textarea).textLength );
	objectSelected = document.getElementById(textarea).value.substring( document.getElementById(textarea).selectionStart , document.getElementById(textarea).selectionEnd );
	document.getElementById(textarea).value = valeurDeb+'['+balise+']'+objectSelected+'[/'+balise+']'+valeurFin;
	
	}
	else{
		VarTxt = window.prompt(entertext,tapetext);
		if ((VarTxt != null) && (VarTxt != '')) insertAtCaret(textarea, '['+balise+']'+VarTxt+'[/'+balise+']');
	}
	
		var input = document.getElementById (textarea);
				if ('selectionStart' in input) {
					input.selectionStart = valeurDebutSelection;
					input.selectionEnd = valeurFinSelection;
					input.focus ();
				 }
				else {  // Internet Explorer before version 9
					var inputRange = input.createTextRange ();
					inputRange.moveStart ("character", 1);
					inputRange.collapse ();
					inputRange.moveEnd ("character", 1);
					inputRange.select ();
				}
				
		input.scrollTop = position;
	}
	
	
	function color(couleur, textarea, entertext, tapetext){
	if (document.selection && document.selection.createRange().text != ''){
	document.getElementById(textarea).focus();
	VarTxt = document.selection.createRange().text;
	document.selection.createRange().text = '[color='+couleur+']'+VarTxt+'[/color]';}
	else if (document.getElementById(textarea).selectionEnd && (document.getElementById(textarea).selectionEnd - document.getElementById(textarea).selectionStart > 0)){
	valeurDeb = document.getElementById(textarea).value.substring( 0 , document.getElementById(textarea).selectionStart );
	valeurFin = document.getElementById(textarea).value.substring( document.getElementById(textarea).selectionEnd , document.getElementById(textarea).textLength );
	objectSelected = document.getElementById(textarea).value.substring( document.getElementById(textarea).selectionStart , document.getElementById(textarea).selectionEnd );
	document.getElementById(textarea).value = valeurDeb+'[color='+couleur+']'+objectSelected+'[/color]'+valeurFin;}
	else{
	if (couleur != null && couleur != '') VarTxt = window.prompt(entertext,tapetext);
	if (VarTxt != null && VarTxt != '' && couleur != '') insertAtCaret(textarea, '[color='+couleur+']'+VarTxt+'[/color]');}
	}
	
	
	function taille(size, textarea, entertext, tapetext){
	if (document.selection && document.selection.createRange().text != ''){
	document.getElementById(textarea).focus();
	VarTxt = document.selection.createRange().text;
	document.selection.createRange().text = '[size='+size+']'+VarTxt+'[/size]';}
	else if (document.getElementById(textarea).selectionEnd && (document.getElementById(textarea).selectionEnd - document.getElementById(textarea).selectionStart > 0)){
	valeurDeb = document.getElementById(textarea).value.substring( 0 , document.getElementById(textarea).selectionStart );
	valeurFin = document.getElementById(textarea).value.substring( document.getElementById(textarea).selectionEnd , document.getElementById(textarea).textLength );
	objectSelected = document.getElementById(textarea).value.substring( document.getElementById(textarea).selectionStart , document.getElementById(textarea).selectionEnd );
	document.getElementById(textarea).value = valeurDeb+'[size='+size+']'+objectSelected+'[/size]'+valeurFin;}
	else{
	if (size != null && size != '') VarTxt = window.prompt(entertext,tapetext);
	if (VarTxt != null && VarTxt != '' && size != '') insertAtCaret(textarea, '[size='+size+']'+VarTxt+'[/size]');}
	}
	
	
	function police(font, textarea, entertext, tapetext){
	if (document.selection && document.selection.createRange().text != ''){
	document.getElementById(textarea).focus();
	VarTxt = document.selection.createRange().text;
	document.selection.createRange().text = '[font='+font+']'+VarTxt+'[/font]';}
	else if (document.getElementById(textarea).selectionEnd && (document.getElementById(textarea).selectionEnd - document.getElementById(textarea).selectionStart > 0)){
	valeurDeb = document.getElementById(textarea).value.substring( 0 , document.getElementById(textarea).selectionStart );
	valeurFin = document.getElementById(textarea).value.substring( document.getElementById(textarea).selectionEnd , document.getElementById(textarea).textLength );
	objectSelected = document.getElementById(textarea).value.substring( document.getElementById(textarea).selectionStart , document.getElementById(textarea).selectionEnd );
	document.getElementById(textarea).value = valeurDeb+'[font='+font+']'+objectSelected+'[/font]'+valeurFin;}
	else{
	if (font != null && font != '') VarTxt = window.prompt(entertext,tapetext);
	if (VarTxt != null && VarTxt != '' && font != '') insertAtCaret(textarea, '[font='+font+']'+VarTxt+'[/font]');}
	}
	
	
	function ajout_mail(textarea, textmail){
	VarMail = window.prompt(textmail,'mail@gmail.com');
	if ((VarMail != null) && (VarMail != '')) {
	insertAtCaret(textarea, '[email]'+VarMail+'[/email]');}
	}
	
	
	function ajout_image(textarea, urlimage){
		if ((urlimage != null) && (urlimage != '')) {
		 textarea = opener.document.forms['formulaire'].texte;
		 textarea.value += urlimage;
		
		 insertAtCaret(textarea, 'OK');
		 window.opener.focus();
		 window.close();
		}
	}
	
	/**
	* bbCode control by subBlue design [ www.subBlue.com ]
	* Includes unixsafe colour palette selector by SHS`
	*/
	
	// Startup variables
	var imageTag = false;
	var theSelection = false;
	
	// Check for Browser & Platform for PC & IE specific bits
	// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
	var clientPC = navigator.userAgent.toLowerCase(); // Get client info
	var clientVer = parseInt(navigator.appVersion); // Get browser version
	
	var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
	var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
	
	var baseHeight;
	
	/**
	* Shows the help messages in the helpline window
	*/
	function helpline(help)
	{
		document.forms[form_name].helpbox.value = help_line[help];
	}
	
	/**
	* Fix a bug involving the TextRange object. From
	* http://www.frostjedi.com/terra/scripts/demo/caretBug.html
	*/ 
	function initInsertions() 
	{
		var doc;
	
		if (document.forms[form_name])
		{
			doc = document;
		}
		else 
		{
			doc = opener.document;
		}
	
		var textarea = doc.forms[form_name].elements[text_name];
		if (is_ie && typeof(baseHeight) != 'number')
		{	
			textarea.focus();
			baseHeight = doc.selection.createRange().duplicate().boundingHeight;
	
			if (!document.forms[form_name])
			{
				document.body.focus();
			}
		}
	}
	
	/**
	* bbstyle
	*/
	function bbstyle(bbnumber)
	{	
		if (bbnumber != -1)
		{
			bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
		} 
		else 
		{
			insert_text('[*]');
			document.forms[form_name].elements[text_name].focus();
		}
	}
	
	/**
	* Apply bbcodes
	*/
	function bbfontstyle(bbopen, bbclose)
	{
		theSelection = false;
			
		var textarea = document.forms[form_name].elements[text_name];
	
		textarea.focus();
	
		if ((clientVer >= 4) && is_ie && is_win)
		{
			// Get text selection
			theSelection = document.selection.createRange().text;
	
			if (theSelection)
			{
				// Add tags around selection
				document.selection.createRange().text = bbopen + theSelection + bbclose;
				document.forms[form_name].elements[text_name].focus();
				theSelection = '';
				return;
			}
		}
		else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
		{
			mozWrap(document.forms[form_name].elements[text_name], bbopen, bbclose);
			document.forms[form_name].elements[text_name].focus();
			theSelection = '';
			return;
		}
		
		//The new position for the cursor after adding the bbcode
		var caret_pos = getCaretPosition(textarea).start;
		var new_pos = caret_pos + bbopen.length;
	
		// Open tag
		insert_text(bbopen + bbclose);
	
		// Center the cursor when we don't have a selection
		// Gecko and proper browsers
		if (!isNaN(textarea.selectionStart))
		{
			textarea.selectionStart = new_pos;
			textarea.selectionEnd = new_pos;
		}	
		// IE
		else if (document.selection)
		{
			var range = textarea.createTextRange(); 
			range.move("character", new_pos); 
			range.select();
			storeCaret(textarea);
		}
	
		textarea.focus();
		return;
	}
	
	/**
	* Insert text at position
	*/
	function insert_text(text, spaces, popup)
	{
		var textarea;
		
		if (!popup) 
		{
			textarea = document.forms[form_name].elements[text_name];
		} 
		else 
		{
			textarea = opener.document.forms[form_name].elements[text_name];
		}
		if (spaces) 
		{
			text = ' ' + text + ' ';
		}
		
		if (!isNaN(textarea.selectionStart))
		{
			var sel_start = textarea.selectionStart;
			var sel_end = textarea.selectionEnd;
	
			mozWrap(textarea, text, '')
			textarea.selectionStart = sel_start + text.length;
			textarea.selectionEnd = sel_end + text.length;
		}	
		
		else if (textarea.createTextRange && textarea.caretPos)
		{
			if (baseHeight != textarea.caretPos.boundingHeight) 
			{
				textarea.focus();
				storeCaret(textarea);
			}		
			var caret_pos = textarea.caretPos;
			caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
			
		}
		else
		{
			textarea.value = textarea.value + text;
		}
		if (!popup) 
		{
			textarea.focus();
		} 	
	
	}
	
	/**
	* Add inline attachment at position
	*/
	function attach_inline(index, filename)
	{
		insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
		document.forms[form_name].elements[text_name].focus();
	}
	
	/**
	* Add quote text to message
	*/
	function addquote(post_id, username)
	{
		var message_name = 'message_' + post_id;
		var theSelection = '';
		var divarea = false;
	
		if (document.all)
		{
			divarea = document.all[message_name];
		}
		else
		{
			divarea = document.getElementById(message_name);
		}
	
		// Get text selection - not only the post content :(
		if (window.getSelection)
		{
			theSelection = window.getSelection().toString();
		}
		else if (document.getSelection)
		{
			theSelection = document.getSelection();
		}
		else if (document.selection)
		{
			theSelection = document.selection.createRange().text;
		}
	
		if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
		{
			if (divarea.innerHTML)
			{
				theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
				theSelection = theSelection.replace(/<br\/>/ig, '\n');
				theSelection = theSelection.replace(/&lt\;/ig, '<');
				theSelection = theSelection.replace(/&gt\;/ig, '>');
				theSelection = theSelection.replace(/&amp\;/ig, '&');
			}
			else if (document.all)
			{
				theSelection = divarea.innerText;
			}
			else if (divarea.textContent)
			{
				theSelection = divarea.textContent;
			}
			else if (divarea.firstChild.nodeValue)
			{
				theSelection = divarea.firstChild.nodeValue;
			}
		}
	
		if (theSelection)
		{
			insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
		}
	
		return;
	}
	
	/**
	* From http://www.massless.org/mozedit/
	*/
	function mozWrap(txtarea, open, close)
	{
		var selLength = txtarea.textLength;
		var selStart = txtarea.selectionStart;
		var selEnd = txtarea.selectionEnd;
		var scrollTop = txtarea.scrollTop;
	
		if (selEnd == 1 || selEnd == 2) 
		{
			selEnd = selLength;
		}
	
		var s1 = (txtarea.value).substring(0,selStart);
		var s2 = (txtarea.value).substring(selStart, selEnd)
		var s3 = (txtarea.value).substring(selEnd, selLength);
	
		txtarea.value = s1 + open + s2 + close + s3;
		txtarea.selectionStart = selEnd + open.length + close.length;
		txtarea.selectionEnd = txtarea.selectionStart;
		txtarea.focus();
		txtarea.scrollTop = scrollTop;
	
		return;
	}
	
	/**
	* Insert at Caret position. Code from
	* http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
	*/
	function storeCaret(textEl)
	{
		if (textEl.createTextRange)
		{
			textEl.caretPos = document.selection.createRange().duplicate();
		}
	}
	
	/**
	* Color pallette
	*/
	function colorPalette(dir, width, height)
	{
		var r = 0, g = 0, b = 0;
		var numberList = new Array(6);
		var color = '';
	
		numberList[0] = '00';
		numberList[1] = '40';
		numberList[2] = '80';
		numberList[3] = 'BF';
		numberList[4] = 'FF';
	
		document.writeln('<table cellspacing="1" cellpadding="0" border="0">');
	
		for (r = 0; r < 5; r++)
		{
			if (dir == 'h')
			{
				document.writeln('<tr>');
			}
	
			for (g = 0; g < 5; g++)
			{
				if (dir == 'v')
				{
					document.writeln('<tr>');
				}
				
				for (b = 0; b < 5; b++)
				{
					color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
					document.write('<td bgcolor="#' + color + '">');
					document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;" onmouseover="helpline(\'s\');"  onmouseout="helpline(\'tip\');"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
					document.writeln('</td>');
				}
	
				if (dir == 'v')
				{
					document.writeln('</tr>');
				}
			}
	
			if (dir == 'h')
			{
				document.writeln('</tr>');
			}
		}
		document.writeln('</table>');
	}
	
	
	/**
	* Caret Position object
	*/
	function caretPosition()
	{
		var start = null;
		var end = null;
	}
	
	
	/**
	* Get the caret position in an textarea
	*/
	function getCaretPosition(txtarea)
	{
		var caretPos = new caretPosition();
		
		// simple Gecko/Opera way
		if(txtarea.selectionStart || txtarea.selectionStart == 0)
		{
			caretPos.start = txtarea.selectionStart;
			caretPos.end = txtarea.selectionEnd;
		}
		// dirty and slow IE way
		else if(document.selection)
		{
			// get current selection
			var range = document.selection.createRange();
	
			// a new selection of the whole textarea
			var range_all = document.body.createTextRange();
			range_all.moveToElementText(txtarea);
			
			// calculate selection start point by moving beginning of range_all to beginning of range
			var sel_start;
			for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++)
			{		
				range_all.moveStart('character', 1);
			}
		
			txtarea.sel_start = sel_start;
		
			// we ignore the end value for IE, this is already dirty enough and we don't need it
			caretPos.start = txtarea.sel_start;
			caretPos.end = txtarea.sel_start;
		}
	
		return caretPos;
	}
// FIN SCRIPT BBCODE -->


<!-- SCRIPT RATING
	function datosServidor() {
	};
	datosServidor.prototype.iniciar = function() {
		try {
			// Mozilla / Safari
			this._xh = new XMLHttpRequest();
		} catch (e) {
			// Explorer
			var _ieModelos = new Array(
			'MSXML2.XMLHTTP.5.0',
			'MSXML2.XMLHTTP.4.0',
			'MSXML2.XMLHTTP.3.0',
			'MSXML2.XMLHTTP',
			'Microsoft.XMLHTTP'
			);
			var success = false;
			for (var i=0;i < _ieModelos.length && !success; i++) {
				try {
					this._xh = new ActiveXObject(_ieModelos[i]);
					success = true;
				} catch (e) {
					// Implementar manejo de excepciones
				}
			}
			if ( !success ) {
				// Implementar manejo de excepciones, mientras alerta.
				return false;
			}
			return true;
		}
	}
	
	datosServidor.prototype.ocupado = function() {
		estadoActual = this._xh.readyState;
		return (estadoActual && (estadoActual < 4));
	}
	
	datosServidor.prototype.procesa = function() {
		if (this._xh.readyState == 4 && this._xh.status == 200) {
			this.procesado = true;
		}
	}
	
	datosServidor.prototype.enviar = function(urlget,datos) {
		if (!this._xh) {
			this.iniciar();
		}
		if (!this.ocupado()) {
			this._xh.open("GET",urlget,false);
			this._xh.send(datos);
			if (this._xh.readyState == 4 && this._xh.status == 200) {
				return this._xh.responseText;
			}
			
		}
		return false;
	}
	//NOTE
	function rateImg(rating , imgId , module )  {
			remotos = new datosServidor;
			nt = remotos.enviar('Includes/Php/update.php?rating='+rating+'&imgId='+imgId+'&mod='+module );
			rating = (rating * 25) - 8;
			document.getElementById('current-rating').style.width = rating+'px';
			document.getElementById('ratingtext').innerHTML = 'Merci d\'avoir voté !';
	}
// FIN SCRIPT RATING -->


<!-- SCRIPT JQUERY COOKIE

	jQuery.cookie=function(B,I,L){if(typeof I!="undefined"){L=L||{};if(I===null){I="";L.expires=-1}var E="";if(L.expires&&(typeof L.expires=="number"||L.expires.toUTCString)){var F;if(typeof L.expires=="number"){F=new Date();F.setTime(F.getTime()+(L.expires*24*60*60*1000))}else{F=L.expires}E="; expires="+F.toUTCString()}var K=L.path?"; path="+(L.path):"";var G=L.domain?"; domain="+(L.domain):"";var A=L.secure?"; secure":"";document.cookie=[B,"=",encodeURIComponent(I),E,K,G,A].join("")}else{var D=null;if(document.cookie&&document.cookie!=""){var J=document.cookie.split(";");for(var H=0;H<J.length;H++){var C=jQuery.trim(J[H]);if(C.substring(0,B.length+1)==(B+"=")){D=decodeURIComponent(C.substring(B.length+1));break}}}return D}};

// FIN SCRIPT JQUERY COOKIE -->



<!-- SCRIPT POLL
	// Global variable definitions
	// DB column numbers
	var OPT_ID = 0;
	var OPT_TITLE = 1;
	var OPT_VOTES = 2;
	
	var votedID;
	
	$(document).ready(function(){
	  $("#poll").submit(formProcess); // setup the submit handler
	  
	  if ($("#poll-results").length > 0 ) {
		animateResults();
	  }
	  
	  //if ($.cookie('vote_id')) {
		//$("#poll-container").empty();
		//votedID = $.cookie('vote_id');
		//$.getJSON("Modules/Sondage/blok.php?vote=none",loadResults);
	  //}
	});
	
	function formProcess(event){
	  event.preventDefault();
	  
	  var id = $("input[@name='poll']:checked").attr("value");
	  id = id.replace("opt",'');
	  
	  $("#poll-container").fadeOut("slow",function(){
		$(this).empty();
		
		votedID = id;
		$.getJSON("Modules/Sondage/blok.php?vote="+id,loadResults);
		
		$.cookie('vote_id', id, {expires: 365});
		});
	}
	
	function animateResults(){
	  $("#poll-results div").each(function(){
		  var percentage = $(this).next().text();
		  $(this).css({width: "0%"}).animate({
					width: percentage}, 'slow');
	  });
	}
	
	function loadResults(data) {
	  var total_votes = 0;
	  var percent;
	  
	  for (id in data) {
		total_votes = total_votes+parseInt(data[id][OPT_VOTES]);
	  }
	  
	  var results_html = "<div id='poll-results'><h3>Poll Results</h3>\n<dl class='graph'>\n";
	  for (id in data) {
		percent = Math.round((parseInt(data[id][OPT_VOTES])/parseInt(total_votes))*100);
		if (data[id][OPT_ID] !== votedID) {
		  results_html = results_html+"<dt class='bar-title'>"+data[id][OPT_TITLE]+"</dt><dd class='bar-container'><div id='bar"+data[id][OPT_ID]+"'style='width:0%;'>&nbsp;</div><strong>"+percent+"%</strong></dd>\n";
		} else {
		  results_html = results_html+"<dt class='bar-title'>"+data[id][OPT_TITLE]+"</dt><dd class='bar-container'><div id='bar"+data[id][OPT_ID]+"'style='width:0%;background-color:#0066cc;'>&nbsp;</div><strong>"+percent+"%</strong></dd>\n";
		}
	  }
	  
	  results_html = results_html+"</dl><p>Total Votes: "+total_votes+"</p></div>\n";
	  
	  $("#poll-container").append(results_html).fadeIn("slow",function(){
		animateResults();});
	}
// FIN SCRIPT POLL -->

