function exibe_mensagens(obj){
		obj.innerHTML = "Buscando novos avisos..."
		figura = ''
		mensagens = false
		strMensagens = '';
		for ( x = 0; x < aviso.length; x++) {
			adat_ini = aviso[x][0].split("/")
			adat_fim = aviso[x][1].split("/")
			quebra   = aviso[x][2]
			mensagem = aviso[x][3]
			dat_atual = new Date();
			dat_atual.setHours(0,0,0,0);
			dat_ini = new Date(adat_ini[1] + "/" + adat_ini[0] + "/" + adat_ini[2]);
			dat_fim = new Date(adat_fim[1] + "/" + adat_fim[0] + "/" + adat_fim[2]);			
			if (dat_atual >= dat_ini && dat_atual <= dat_fim ) {
				strMensagens += (mensagens?'<hr class=aviso_hr>':'') + figura + ' ' + (quebra > 0 ? quebrar_msg(mensagem,x, quebra) : mensagem)
				mensagens = true
			}
		}		
		obj.innerHTML = "<div id=avisoDestaque>Destaques</div><div id=avisoMensagem>" + (mensagens?strMensagens:'')	+ "</div>"
		for ( x = 0; x < aviso.length; x++) {

			if ( $('sub_aviso_compl_' + x) != null ) {
				$('sub_aviso_compl_' + x).style.display = 'none'
			}
		}
}

function exibir_sub_mensagem(qual) {
	obj_call = $('sub_aviso_call_' + qual)
	obj_compl = $('sub_aviso_compl_' + qual)	
	if ( obj_compl.style.display == 'none'){
		obj_compl.style.display = '';	
		obj_call.style.display = 'none';
	}
	else {
		obj_compl.style.display = 'none';	
		obj_call.style.display = '';
	}
}

function quebrar_msg(msg,x,quebra) {
	alert(podcast)	
	return  '<span id=sub_aviso_txt_' + x + ' onclick=\"exibir_sub_mensagem(' + x + ')\" style=\'cursor:hand\' >' + 
				  msg.substr(0,quebra,msg) + 				  
				  '<span id="sub_aviso_call_' + x + '"><b> - Veja mais...</a></b></span>' +				  
				  '<span id="sub_aviso_compl_' + x + '" style="display=\'none\';" >' + msg.substr(quebra, msg.length, msg) + 
				  '</span>' + 
			'</span>'
}

function montaLinkPodcast(arq) {
	return "<a href='/podcast/" + arq + "'><img src=/podcast/mp3.jpg border=0 valign='absmiddle'></a>"
}

function exibe_noticias(obj){
		obj.innerHTML = "Buscando notícias..."
		figura = ''
		mensagens = false
		strMensagens = '';
		for ( x = 0; x < noticia.length; x++) {
			adat_ini = noticia[x][0].split("/")
			adat_fim = noticia[x][1].split("/")
			quebra   = noticia[x][2]
			mensagem = noticia[x][3]
			podcast = ''
			if (noticia[x][4] != undefined){
				podcast = noticia[x][4] 	
			}
			dat_atual = new Date();
			dat_atual.setHours(0,0,0,0);
			dat_ini = new Date(adat_ini[1] + "/" + adat_ini[0] + "/" + adat_ini[2]);
			dat_fim = new Date(adat_fim[1] + "/" + adat_fim[0] + "/" + adat_fim[2]);			
			if (dat_atual >= dat_ini && dat_atual <= dat_fim ) {
				strMensagens += (mensagens?'<hr class=aviso_hr>':'') + figura + ' ' + (quebra > 0 ? quebrar_msg(mensagem,x, quebra) : mensagem)
				strMensagens += (podcast != ''? montaLinkPodcast(podcast) : '')
				mensagens = true
			}
		}		
		
		obj.innerHTML = (mensagens?strMensagens:'')	
		
		
}

function ajusta_tamanho() {

	obj1 = $('aviso')
	obj2 = $('noticia')
	obj3 = $('avisoMensagem')
	tam = tamanhoNoticias 

	if (stile == 1) {
	//  tamanho padrao
		tamDiv = 190
		tamDivNot = 10
	}
	else if (stile == 3) {
	//  tamanho padrao
		tamDiv = 265
		tamDivNot = 10
	}	
	else {
	//  tamanho reduzido
		tamDiv = 60
		tamDivNot = 0
		tam = (tam > tamDiv? tamDiv : tam)
	}

	obj1.style.height = (tamDiv - tam) 
	obj2.style.height = tam
	obj3.style.height = (tamDiv - tam - tamDivNot ) 

}
