function cleanText(txt)
{
	var temp = txt;
	
	temp = temp.replace(/&lt;/gi, '<');
	temp = temp.replace(/&gt;/gi, '>');
	temp = temp.replace(/<br>/gi, '\n');
	temp = temp.replace(/&quot;/gi, '"');
	temp = temp.replace(/&apos;/gi, "'");
	temp = temp.replace(/&amp;/gi, '&');
	return temp;
}

function data(formato, date)
{
	var temp = new Array();
	var temp1 = new Array();
	var temp2 = new Array();
	temp = date.split(' ');
	temp1 = temp[0].split('-');
	if(temp.length > 1)
		temp2 = temp[1].split(':');
	
	var retorno = '';
	retorno = formato;

	retorno = retorno.replace('dd', temp1[2]);
	retorno = retorno.replace('mm', temp1[1]);
	retorno = retorno.replace('aaaa', temp1[0]);
	
	if(temp.length > 1)
	{
		retorno = retorno.replace('HH', temp2[0]);
		retorno = retorno.replace('MM', temp2[1]);
		retorno = retorno.replace('SS', temp2[2]);
	}
	
	return retorno;
}

function hora(formato, time)
{
	var temp = new Array();
	var temp1 = new Array();
	temp = time.split(':');
	
	var retorno = '';
	retorno = formato;

	retorno = retorno.replace('HH', temp[0]);
	retorno = retorno.replace('MM', temp[1]);
	retorno = retorno.replace('SS', temp[2]);
	
	return retorno;
}

function isDate(day, month, year)
{
	var date = new Date();
	var blnRet = false;
	var blnDay;
	var blnMonth;
	var blnYear;

	date.setFullYear(year, month -1, day);

	blnDay   = (date.getDate() == day);
	blnMonth = (date.getMonth() == month -1);
	blnYear  = (date.getFullYear() == year);

	if (blnDay && blnMonth && blnYear)
		blnRet = true;

	return blnRet;
}

function compareDates(day_i, month_i, year_i, day_f, month_f, year_f)
{
	var date_i = new Date();
	date_i.setFullYear(year_i, month_i -1, day_i);
	var date_f = new Date();
	date_f.setFullYear(year_f, month_f -1, day_f);

	if(date_i > date_f)
		return false;
	else
		return true;
}


