// Java que faz os mouse serem over
/*******************************************************************
 * soopa-rollovers.js
 * 7/28/2001
 * www.youngpup.net
 *
 * easiest rollovers on earth, baby!
 * see www.youngpup.net for documentation.
 *******************************************************************/


function soopaSetup() {
	var img, sh, sn, sd
	for (var i = 0; (img = document.images[i]); i++) {
		if (img.getAttribute) {

			sn = img.getAttribute("src");
			sh = img.getAttribute("hsrc");
			sd = img.getAttribute("dsrc");

			if (sn != "" && sn != null) {
				img.n = new Image();
				img.n.src = img.src;
			
				if (sh != "" && sh != null) {
					img.h = new Image();
					img.h.src = sh;
					img.onmouseover = soopaSwapOn
					img.onmouseout  = soopaSwapOff
				}

				if (sd != "" && sd != null) {
					img.d = new Image();
					img.d.src = sd;
					img.onmousedown = soopaSwapDown
				}
			}
		}
	}
}

function soopaSwapOn() {
	this.src = this.h.src;
}

function soopaSwapOff() {
	this.src  = this.n.src;
}

function soopaSwapDown() {
	this.src  = this.d.src;
	this.temp = typeof(document.onmouseup) != 'undefined' && typeof(document.onmouseup) != 'unknown' ? document.onmouseup : "";
	soopaSwapUp.img = this;
	document.onmouseup = soopaSwapUp;
}

function soopaSwapUp() {
	var ths = soopaSwapUp.img;
	ths.src = ths.n.src;
	if (ths.temp) document.onmouseup = ths.temp;
}

function MostraEsconde(idMostra, idEsconde) {
	if (idMostra) {
		var a = idMostra.split(/\W/);
		for (var i in a) {
			var e = document.all && document.all[a[i]] || document.getElementById && document.getElementById(a[i]);
			if (e)
				e.style.display = '';
		}
	}
	if (idEsconde) {
		var a = idEsconde.split(/\W/);
		for (var i in a) {
			var e = document.all && document.all[a[i]] || document.getElementById && document.getElementById(a[i]);
			if (e)
				e.style.display = 'none';
		}
	}
}


function MontaTitFlash(w,estilo,titulo) {
	
	var strFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="30"><param name="movie" value="swf/titulo.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="FlashVars" value="varEstiloASP='+estilo+'&amp;strTituloASP='+titulo.toString()+'" /><embed src="swf/titulo.swf" width="'+w+'" height="30" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" flashvars="varEstiloASP='+estilo+'&amp;strTituloASP='+titulo.toString()+'"></embed></object><span>'+titulo+'</span>';

	document.write(strFlash)

}

function MontaSubTitFlash(w,estilo,titulo) {
	
	var strFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="22"><param name="movie" value="swf/subtitulo.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="FlashVars" value="varEstiloASP='+estilo+'&amp;strTituloASP='+titulo.toString()+'" /><embed src="swf/subtitulo.swf" width="'+w+'" height="22" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" flashvars="varEstiloASP='+estilo+'&amp;strTituloASP='+titulo.toString()+'"></embed></object><span>'+titulo+'</span>';

	document.write(strFlash)

}

function loadXMLDoc(url,registro,secao){
	req = null;
	varsecao = secao;
	// Procura por um objeto nativo (Mozilla/Safari)
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url+'?nrSecao='+registro, true);		
		req.send(null);
	// Procura por uma versao ActiveX (IE)
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChange;			
			req.open("GET", url+'?nrSecao='+registro, true);
			req.send();
		}
	}
}

function processReqChange(){
	// apenas quando o estado for "completado"
	if (req.readyState == 4) {
		// apenas se o servidor retornar "OK"
		if (req.status == 200) {
			var span = document.getElementById(varsecao);
			span.innerHTML = req.responseText;
		} else {
			alert('O servidor está instável, tente novamete mais tarde');
			//alert("Estamos com uma dificuldade técnica. Tente novamente, por favor.");
			//alert("Houve um problema ao obter os dados:\n" + req.statusText);
		}
	}
}

function abrePerfil(nrSecao,liAtiva){
	loadXMLDoc('ajax_equipe_fertilitat.asp',nrSecao,'conteudo_perfil');
	for(var i = 1; i <= document.getElementById('lista_ul').childNodes.length; i++)
	{
		document.getElementById('lista_'+i).className = '';	
		document.getElementById('lista_'+liAtiva).className = 'ativo';
	}
}

function AbreItem(num) {
	var numItens = document.getElementById("mostraEsconde").getElementsByTagName("p").length;
	var itemAtual = "item"+num;
	var itemAtualAberto = "itemAberto"+num;
	for (var n = 1; n<=numItens; n++) {
		var itemLista = "item"+n;
		var itemListaAberto = "itemAberto"+n;
		if (document.getElementById(itemLista)) {
			if (document.getElementById(itemLista).className == "aberto") {
				
				document.getElementById(itemListaAberto).style.display = "none";
				document.getElementById(itemLista).className = "";
				document.getElementById("img"+n).src = "img/setaLarBas.gif";
				document.getElementById(itemLista).href = "javascript:AbreItem("+n+");";
			}
		} 
	}
	document.getElementById("img"+num).src = "img/setaLarTop.gif";
	document.getElementById(itemAtual).href = "javascript:fechaItem("+num+");";
	document.getElementById(itemAtual).className = "aberto";
	document.getElementById(itemAtualAberto).style.display = "";
}
function fechaItem(num) {
	var itemAtual = "item"+num;
	var itemAtualAberto = "itemAberto"+num;
	document.getElementById("img"+num).src = "img/setaLarBas.gif";
	document.getElementById(itemAtual).href = "javascript:AbreItem("+num+");";
	document.getElementById(itemAtual).className = "";
	document.getElementById(itemAtualAberto).style.display = "none";
}
