
function quadro(nom)
{
	var me = this;
	this.nome = nom;
	this.comando = "";
	this.dv = document.getElementById(nom);
	this.titulo = null;
	this.foto = null;
	this.aluno = null;
	this.texto = null;
	this.ban = new Object();
	this.arrBanners = new Array();
	this.indice = 0;
}
quadro.prototype.setArrBanner = function(arr)
{
	this.arrBanners = arr;
	this.buscaDivTitulo();
	this.buscaDivFoto();
	this.buscaDivAluno();
	this.buscaDivTexto();

	if(this.arrBanners.length >0)
	{
		this.parseBanner();
		tempo(this);
	} else {
		return;
	}
}
quadro.prototype.parseBanner = function()
{
//	startEffect(this);
	if(this.indice >= this.arrBanners.length)
		this.indice = 0;
	
	this.ban = this.arrBanners[this.indice];
	
	//link para o texto na integra
	this.dv.setAttribute("idaluno",this.ban.id_aluno);
	this.dv.setAttribute("idbanner",this.ban.id_ban);
	this.dv.setAttribute("idartigo",this.ban.id_artigo);
	if(this.ban.texto_integra != "")
	{
		this.dv.style.cursor = "pointer";
		
		this.dv.onclick = function()
		{
			familiacresce_pop(this.getAttribute("idbanner"),this.getAttribute("idaluno"));
		}

	} else {
		//link para algum artigo
		if(this.ban.id_artigo != 0 && this.ban.id_artigo != "")
		{
			this.dv.style.cursor = "pointer";
			this.dv.onclick = function()
			{
				document.location.href = "/ver_artigo.php?id_artigo="+this.getAttribute("idartigo");
			}
			
		} else {
			this.dv.style.cursor = "";
		}
		
	}
	this.appendTitulo();
	this.appendFoto();
	this.appendAluno();
	this.appendTexto();
	this.indice++;
//	resetEffect(this);
	//var TempoD = setTimeout(this.comando,5000);

}

quadro.prototype.appendTitulo = function()
{
	this.titulo.className= "tituloJanela";
	this.titulo.innerHTML = "";
	this.titulo.appendChild(document.createTextNode(this.ban.descricao_ban.toUpperCase()));
	
}
quadro.prototype.appendFoto = function()
{
	var img = new Image();
	img.src = "/includes/thumb.php?imagem=../imagens/fotoaluno/"+this.ban.id_aluno+"/fotobest.jpg&width=65&height=80";
	this.foto.innerHTML = "";
	
	this.foto.appendChild(img);
}
quadro.prototype.appendAluno = function()
{
	this.aluno.innerHTML = "";
	this.aluno.className = "alunoQuadro";
	this.align = "center";
	this.aluno.appendChild(document.createTextNode(this.ban.nome));
}
quadro.prototype.appendTexto = function()
{
	this.texto.innerHTML = "";
	this.texto.appendChild(document.createTextNode(this.ban.texto_chamada));
}
quadro.prototype.buscaDivTitulo = function()
{

	if(this.dv != null)
	{
		var arrDv = this.dv.getElementsByTagName("div");
		var i=0;
		for(i;i<arrDv.length;i++)
		{
			if(arrDv[i].id == "titulo")
			{
				this.titulo = arrDv[i];
				break;
			}
		}
	}
}
quadro.prototype.buscaDivFoto = function()
{
	if(this.dv != null)
	{
		var arrDv = this.dv.getElementsByTagName("div");
		var i=0;
		for(i;i<arrDv.length;i++)
		{
			if(arrDv[i].id == "foto")
			{
				this.foto = arrDv[i];
				break;
			}
		}
	}
}
quadro.prototype.buscaDivAluno = function()
{
	if(this.dv != null)
	{
		var arrDv = this.dv.getElementsByTagName("span");
		var i=0;
		for(i;i<arrDv.length;i++)
		{
			if(arrDv[i].id == "aluno")
			{
				this.aluno = arrDv[i];
				break;
			}
		}
	}
}
quadro.prototype.buscaDivTexto = function()
{
	if(this.dv != null)
	{
		//"imagens/fotoaluno/". $this->id_aluno . "/fotobest.jpg"
		var arrDv = this.dv.getElementsByTagName("div");
		var i=0;
		for(i;i<arrDv.length;i++)
		{
			if(arrDv[i].id == "texto")
			{
				this.texto = arrDv[i];
				break;
			}
		}
	}
}

