function borrar_informe()
{
	document.form1.informe.value = '';
	document.form1.informe.focus();	
}

function seleccionar_batalla()
{
	document.form1.compactado.focus();
	document.form1.compactado.select();	
}

function convertir(bgcolor, txcolor, nombre_ventana)
{
	var txt = document.form1.compactado.value;
	var cod;
	var salto = /\n/g;
	var ab_tam = /\[size=(\d){1,2}(pt){0,1}\]/gi;
	var ce_tam= /\[\/size]/gi;
	var neg = /\[(\/){0,1}b\]/gi;
	var ab_color = /\[color=(#\d{6}|\w+){0,}\]/gi;
	var ce_color = /\[\/color\]/gi;
	var ab_url = /\[url=(http:\/\/[a-zA-Z0-9\.\/_-]{1,})\]/gi;
	var ce_url = /\[\/url\]/gi;
	//var img = /\[IMG]((\w){1,}\?ancho=(\d){1,}\&cf=\)\[\/IMG\]/gi;
	
	txt = txt.replace(salto,'<br>');
	txt = txt.replace(ab_tam,'');
	txt = txt.replace(ce_tam,'');
	txt = txt.replace(neg,'<$1strong>');
	txt = txt.replace(ab_color,'<span style=\'color:$1\'>');
	txt = txt.replace(ce_color,'</span>');
	txt = txt.replace(ab_url,'<a href="$1" target="_blank">');
	txt = txt.replace(ce_url,'</a>');
	//txt = txt.replace(img,'<img src="$1" border="0">');
	
	estilo='<style type="text/css"><!-- body { background-color: '+bgcolor+'; color:'+txcolor+'; font-size:14px; }--></style>';
	cod='<html><head><title>' + nombre_ventana + '</title>' + estilo + '</head><body>' + txt + '</body></html>';
	return cod;
}

function previsualiza(bgcolor, txcolor, nombre_ventana) 
{
	var prev = window.open('', 'Ventana', 'width=450,height=500,scrollbars=yes');
	var batalla=convertir(bgcolor, txcolor, nombre_ventana);
	prev.document.open();
	prev.document.write(batalla);
	prev.document.close();
	prev.focus();
}