function htmlEncode(html) {
	return html.replace(/&/gi, '&amp;').replace(/\"/gi, '&quot;').replace(/</gi, '&lt;').replace(/>/gi, '&gt;').replace(/ /gi, '&nbsp;');
}

function htmlDecode(html) {
	return html.replace(/&amp;/gi, '&').
		replace(/&quot;/gi, '"').
		replace(/&lt;/gi, '<').
		replace(/&gt;/gi, '>').
		replace(/&nbsp;/gi, ' ').
		replace(/&#231;/gi, 'ç').
		replace(/&#227;/gi, 'ã').
		replace(/&#243;/gi, 'ó').
		replace(/&#237;/gi, 'í').
		replace(/&#234;/gi, 'ê').
		replace(/&#201;/gi, 'É').
		replace(/&#250;/gi, 'ú')
		;
}
