// JavaScript Document
function ShowSub (sbm, id) {
	if (sbm != null && !sbm.match('selecionado') && id != null) {
		document.getElementById(sbm).id = sbm + '_selecionado';
		document.getElementById(id).style.display = 'block';
	}
}

function HideSub(sbm, id) {
	if (sbm != null && sbm.match('selecionado') && id != null) {
		document.getElementById(sbm).id = sbm.replace('_selecionado','');
		document.getElementById(id).style.display = 'none';
	}
}

function OpenPopup() {
	var purl = document.URL;
	var cname = purl.substring(purl.lastIndexOf('/') + 1);
	purl = purl.substring(0, purl.length - cname.length);
	purl += "popup.htm";
	window.open(purl,'','width=610,height=265,scrollbars=no,resizable=no,toolbar=no,directories=no,menubar=no,Status=no');
}

function NoticiaAleatoria() {
	
	if (!document.getElementById)
		return;
	
	
	var divNoticia = document.getElementById("noticiaAleatoria");
	
	if (!divNoticia)
	    return;
	
	
	var i = Math.floor(Math.random()*4);
	
	switch (i)
	{
		case 0:
			divNoticia.innerHTML = '<img src="img/imgNoticiaSaude.jpg" alt="A AES Eletropaulo foi responsável..."  style="margin-left:12px;" /><p class="texto" style="width:220px; margin-left:27px; margin-top:16px; margin-bottom:70px;"><a href="projetosSaude.htm" style="color:#FFFFFF; font-weight:normal">A AES Eletropaulo foi responsável pela instalação do novo sistema de ar-condicionado do Hospital Beneficência Portuguesa.</a></p>'
			break;
		case 1:
		    divNoticia.innerHTML = '<img src="img/imgNoticiaPredios.jpg" alt="Investimentos da AES Eletropaulo..."  style="margin-left:12px;" /><p class="texto" style="width:220px; margin-left:27px; margin-top:16px; margin-bottom:70px;"><a href="projetosPublicos.htm" style="color:#FFFFFF; font-weight:normal">Investimentos da AES Eletropaulo em mais de 100 prédios públicos da Grande São Paulo geram economia de aproximadamente R$ 2,3 milhões/ano.</a></p>'
			break;
		default:
		    divNoticia.innerHTML = '<img src="img/imgNoticiaFatec.jpg" alt="AES Eletropaulo investe..."  style="margin-left:12px;" /><p class="texto" style="width:220px; margin-left:27px; margin-top:16px; margin-bottom:70px;"><a href="projetosEducacao.htm" style="color:#FFFFFF; font-weight:normal">AES Eletropaulo investe R$ 2,3 milhões na modernização dos sistemas de iluminação de 21 ETECs e FATECs.</a></p>'
			break;
	}
}