	function loadXML(xmlFile)
	{

	try //Internet Explorer
	  {
	  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	  }
	catch(e)
	  {
	  try //Firefox, Mozilla, Opera, etc.
	    {
	    xmlDoc=document.implementation.createDocument("","",null);
	    }
	  catch(e) {alert(e.message)}
	  }
	try
	  {
	  xmlDoc.async=false;
	  xmlDoc.load(xmlFile);
	  }
	catch(e) {alert(e.message)}
	}

function im () {
var imagem = new Array(6);
var texto = new Array(6);
 
//imagem[1] = '<img src="imagens/fotos/caravana1.jpg" width="295" height="171"> Saiba mais sobre a Caravana da Espera&ccedil;<br/>';
imagem[1]='caravana1.jpg';
texto[1]='Saiba mais sobre a Caravana da Esperan&ccedil;a';
imagem[2]='livros1.jpg';
texto[2]='Conhe&ccedil;a mais sobre a doutrina esp&iacute;rita';
imagem[3]='bazar1.jpg';
texto[3]='Doe e ajude o nosso Bazar com o que puder';
imagem[4]='meimei1.jpg';
texto[4]='Colabore com a Obra do Ber&ccedil;o e ajude as gestantes';
imagem[5]='gesj1.jpg';
texto[5]='Conhe&ccedil;a nossa casa';
imagem[6]='palestra1.jpg';
texto[6]='Assista as nossas palestras';

//imagem[2] = '<img src="imagens/fotos/livros1.jpg" width="295" height="170"> Saiba mais sobre os nossos livros<br/>';

//imagem[3] = '<img src="imagens/fotos/bazar1.jpg" width="295" height="170"> Doe e compre no nosso Bazar<br/>';



var numero=Math.floor(Math.random()*6)+1;
imtex = '<img src="/imagens/fotos/'+imagem[numero]+'" width="295 height="170"><span class="textolegenda"> '+texto[numero]+'</span>';
document.write (imtex);
}


function livroEspirito(numeroRandom){
	conteudo = "<h3>livro dos espíritos</h3>";
	
	if (numeroRandom==0) {
		numeroRandom = Math.floor(Math.random()*40)+1;
	}
	
	$.ajax({
		type: "GET",
		url: '/xml/livroesp/livroesp'+numeroRandom+'.xml',
		dataType: "xml",
		async: false,
		success: function(xml) {
			$(xml).find('item').each(function(){
				$('<ul></ul>').appendTo('#shopping');
				$('<a class="ver-todos" href="http://www.comprafacil.com.br/radioglobo">ver todos os produtos</a>').appendTo('#shopping');
					capitulo = $(this).find('capitulo').text();
					pergunta = $(this).find('pergunta').text();
					resposta = $(this).find('resposta').text();

					conteudo += '<p class="texto"><span class="textolegenda">'+capitulo+'</span><br/>';
					conteudo += '<b>'+numeroRandom+'. '+pergunta+'</b><br/>';
					conteudo += resposta+' <i>(Livro dos Espíritos)</i></p>';
			});
			
			
				if (numeroRandom>1) {
				conteudo +='<a class="textolegenda"  href="javascript:livroEspirito('+(numeroRandom-1)+');">< Anterior | </a>';
				}
				if (numeroRandom<60) {
					conteudo +='<a class="textolegenda" href="javascript:livroEspirito('+(numeroRandom+1)+');">Próximo ></a><br/>';
				}
				if ($(xml).length>0) {
					$("#livro").html(conteudo);
				}
			
		}
	});
}

function programacaoHoje() { 
	
	hoje = new Date();
	d = document;	
	$.ajax({
		type: "GET",
		url: '/xml/programacao.xml',
		dataType: "xml",
		async: false,
		success: function(xml) {
			$(xml).find('atividade').each(function(){
				for (j=0;j<7;j++) { 
					d.write('<div id="sc'+j+'" class="tabcontent">')
					d.write('<table width="100%">');
					$(xml).find('atividade').each(function(){
						if($(this).attr("dia") == j) {
							atividadeNome 	=  $(this).find('atividadeNome').text();
							horaIni			=  $(this).find('horaIni').text();
							horaFim			=  $(this).find('horaFim').text();
							//document.write(horaIni+'-'+horaFim+'-'+atividadeNome+'<br/>');
							d.write('<tr><td class="tabelaAtividadeHora" align="center">');
							d.write(horaIni);
							d.write('</td><td class="tabelaAtividade">');
							d.write(atividadeNome);
							d.write('</td></tr>');
						}
					})
					d.write('</table>');
					d.write('</div>');
				};
			});
			ddtabmenu.definemenu("ddtabs1",hoje.getDay() ) //initialize Tab Menu with ID "ddtabs1" and select 1st tab by default
		}

	});
}


function palestras() {
		d = document;
		html='';
	$.ajax({
		type: "GET",
		url: '/xml/palestras.xml',
		dataType: "xml",
		async: false,
		success: function(xml) {
			i = 0;
			$(xml).find('palestra').each(function(){
				tempData = $(this).find('dataHoraCSV').text();
				tempData = tempData.split(",");
				dataHoraPalestra = new Date(tempData[0],tempData[1]-1,tempData[2],tempData[3],tempData[4],tempData[5]);

				if (dataHoraServidor < dataHoraPalestra) {
					nome 		= $(this).find('nome').text();;
					diaSemana	= $(this).find('diaSemana').text();;
					palestrante	= $(this).find('palestrante').text();;
					
					if ((i+2)<($(xml).length)) {
						html+="<li class=\"linha\">";
					} else {
						html+="<li>";
					}
					html+=diaSemana+" ("+tempData[2]+"/"+tempData[1]+" às ";
					html+=tempData[3]+":"+tempData[4]+")<br>";
					html+="<strong>Tema:</strong> "+nome+"<br>";
					html+="<strong>Palestrante: </strong>"+palestrante;
					html+="</li>";
					
				}
				i++;
			});
		}
	});
	if (html!='') {
		d.write("<div id=\"palestras\">");
		d.write("<h3>palestras</h3>");
		d.write("<ul>");
		d.write(html);
		d.write("</ul>");
		d.write("</div>");
	}
	
}
function abrePlayer(playlist) {
	url	= '/player/'+playlist+'.htm';
	void(window.open(url,'audio','width=235,height=176,resizable=no,status=no,menubar=no,scrollbars=no,location=0'));
}

