bloc = true;

function hexa(couleur) {
	if(bloc)
		document.form.hexval.value = couleur;
}

function palette() { 
	document.write("<TABLE border='0' cellpadding='0' cellspacing='0' ><TR>"); 
	var h=new Array('00','33','66','99','CC','FF'); 
	var col=""; 
	
	for(var i=0;i<6;i++) { 
		for(var j=0;j<6;j++) { 
			for(var k=0;k<6;k++) { 
				col="#"+h[i]+h[j]+h[k]; 
				document.write("<TD width='10' height='10' bgcolor='"+col+"' onMouseOver=\"hexa('"+col+"')\" onClick=\"if(bloc) { bloc = false; } else { bloc = true; }\"></TD>"); 
			} 
		} 
		document.write("</tr>"); 
	} 
	document.write("</TABLE>"); 
}

function quickedit(post_id) {
	var text = document.getElementById(post_id+'_textarea').value;
	simple_query('quickedit','post_id='+encodeURIComponent(Number(post_id))+'&text='+encodeURIComponent(text), post_id+'_content');
	
	return false;
}

function quickedit_form(post_id) {
	document.getElementById(post_id+'_content').innerHTML = '<textarea id="'+post_id+'_textarea" style="width: 95%; height: 200px;"></textarea>';
	document.getElementById(post_id+'_content').innerHTML += '<p class="envoi"><input type="submit" class="grandbouton" value="Editer le message" onclick="quickedit('+post_id+');" /><input type="submit" class="grandbouton" value="Annuler" onclick="cancel_quickedit('+post_id+');" /></p>';
	
	simple_query('post_text','post_id='+encodeURIComponent(Number(post_id)), post_id+'_textarea');
}

function cancel_quickedit(post_id) {
	simple_query('post_text','post_id='+encodeURIComponent(Number(post_id))+'&bbcode=1', post_id+'_content');
}

