// JavaScript CBCD
// Criado por Marcos Vinicius - Groupweb - 26/05/09

function menu(id,tam){
	for(x=1;x<=tam;x++){
		if(x==1){
			stringVetor = x; 
		}else{
			stringVetor += ','+x;
		}
	}
	
	var ids = stringVetor.split(",");
	
	for(i=0;i<ids.length;i++){
		var off = "aberto"+ids[i];
		var on = "fechado"+ids[i];
		if(id != (i + 1)){
			document.getElementById(off).style.display = "none";
			document.getElementById(on).style.display = "block";
		}else{
			document.getElementById(on).style.display = "none";
			document.getElementById("aberto"+id).style.display = "block";
		}
	}
	
}

function fecha(id){
	document.getElementById("aberto"+id).style.display = "none";
	document.getElementById("fechado"+id).style.display = "block";
}

function fotos(id,tam){
	for(x=1;x<=tam;x++){
		if(x==1){
			stringVetor = x; 
		}else{
			stringVetor += ','+x;
		}
	}
	
	var ids = stringVetor.split(",");
	
	for(i=0;i<ids.length;i++){
		var some = "foto"+ids[i];
		if(id != (i + 1)){
			document.getElementById(some).style.display = "none";
		}else{
			document.getElementById("foto"+id).style.display = "block";
		}
	}
}

function abcd(espaco){
	self.location.href=espaco+"publicacoes/revista_abcd.php";
}
function gastro(espaco){
	self.location.href=espaco+"publicacoes/arquivos_gastroentereologia.php";
}
function ged(espaco){
	window.open(espaco+"publicacoes/revista_ged.pdf");
}

function capitulos(espaco,uf){
	self.location.href=espaco+"associados/relacao_associados.php?estado="+uf;
}

function zerar(campo, texto){
	if (campo.value==texto){
		campo.value="";
	}
}
function campoVazio(campo, texto){
	if (campo.value==""){
		campo.value=texto;
	}
}

function checaNewsletter(){
	var obj = document.fr_newsletter;
	if(obj.nomeNewsletter.value == "Nome") {
		alert('Preencha o campo Nome');
		obj.nomeNewsletter.focus();
	}
	else if(obj.emailNewsletter.value == "E-mail") {
		alert('Preencha o campo Email');
		obj.emailNewsletter.focus();
	}
	else if(obj.emailNewsletter.value.indexOf('@') < 1 ){
		alert('Email incorreto!');
		obj.emailNewsletter.focus();
	}else{
		obj.submit();
		}
}
