function exibirBgBody() {
	var objBody = gE('estMeio');
	var boxImg = document.createElement('div');
	
	boxImg.setAttribute('id','boxMalukooo');
	objBody.insertBefore(boxImg, objBody.firstChild);
	
	exibirBgImg();
}

function exibirBgImg() {
	var objBody = gE('estMeio');
	var boxImg = document.createElement('div');
	
	boxImg.setAttribute('id','boxInstrutores');
	boxImg.onclick = function(){ removerDivs(); }
	objBody.insertBefore(boxImg, objBody.firstChild);
}

function CarregaInstrutor(ins_id) {
	var ajax = openAjax();
	var conteudo = gE('boxInstrutores'+ins_id);
	var texto = gE('maismenos'+ins_id);
	if(texto.innerHTML == '- menos'){
		conteudo.innerHTML = '';
		MaisMenos(ins_id);
		return false;
	}
	
	MaisMenos(ins_id);
	//exibirBgBody();
	//loading();
	ajax.open('GET', 'bib_ajax/instrutores.php?function=1&ins_id='+ins_id, true);
	ajax.onreadystatechange = function() {
		if (ajax.readyState == 1) {
			document.body.style.cursor = 'wait';
		}
		if (ajax.readyState == 4) {
			if (ajax.status == 200) {
				document.body.style.cursor = 'default';
				conteudo.innerHTML = ajax.responseText;
			} 
		}
	}
	ajax.send(null);
}

function MaisMenos(ins_id){
	var texto = gE('maismenos'+ins_id);
	if(texto.innerHTML == '+ mais'){
		texto.innerHTML = '- menos';	
	}else{
		texto.innerHTML = '+ mais';	
	}
	
	return false;
}

function loading(){
	var carregador = gE('boxInstrutores');
	carregador.innerHTML = "<div style=\"text-align:center; margin-top:100px;\"><img src=\"imagens/load.gif\" /><br />Carregando...</div>";	
}

function removerDivs(){
	var bgBody = gE('boxMalukooo');
	var boxImg = gE('boxInstrutores');
	bgBody.parentNode.removeChild(bgBody);
	if (boxImg) { // Por que ao clicar X (para deletar um registro) cria-se somente o encobridor e não o boxCad	
		boxImg.parentNode.removeChild(boxImg);
	}
}