function iniciaAjax(){
	
	if(window.ActiveXObject) var ajax = new ActiveXObject('Microsoft.XMLHTTP');
    else var ajax = new XMLHttpRequest();

	return ajax;
}

function carregaPagina(plink){
	
	var background = "";
	var backgroundRepeat = "";
	var backgroundPosition = "";
	
	if(plink == "historico.html"){
		background = "url(imagens/img_vetor02.jpg)";	
		backgroundRepeat = "no-repeat";
		backgroundPosition = "255px 950px";
		
	}else if(plink == "biblioteca.html"){
		background = "url(imagens/img_vetor09.jpg)";
		backgroundPosition = "700px 600px";
		backgroundRepeat = "no-repeat";	
	
	}else if(plink == "case.html"){
		background = "url(imagens/img_vetor06.jpg)";
		backgroundPosition = "800px 750px";
		backgroundRepeat = "no-repeat";	
	
	}else if(plink == "clipping.html"){
		background = "url(imagens/img_vetor04.jpg)";
		backgroundPosition = "780px 550px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "comunicacao.html"){
		background = "url(imagens/img_vetor03.jpg)";
		backgroundPosition = "820px 550px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "contato.php"){
		background = "url(imagens/img_vetor03.jpg)";
		backgroundPosition = "820px 600px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "depoimentos.php"){
		background = "url(imagens/img_vetor04.jpg)";
		backgroundPosition = "650px 500px";
		backgroundRepeat = "no-repeat";	
	
	}else if(plink == "depoimentos_2.php"){
		background = "url(imagens/img_vetor04.jpg)";
		backgroundPosition = "650px 500px";
		backgroundRepeat = "no-repeat";	
	
	}else if(plink == "escolas.html"){
		backgroundImage = "url(imagens/img_vetor05.jpg)";
		backgroundPosition = "1000px 400px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "historico.html"){
		background = "url(imagens/img_vetor02.jpg)";
		backgroundPosition = "255px 950px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "informativos.html"){
		background = "url(imagens/img_vetor07.jpg)";
		backgroundPosition = "585px 350px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "legislacao.html"){
		background = "url(imagens/img_vetor09.jpg)";
		backgroundPosition = "700px 600px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "metodologia.html"){
		background = "url(imagens/img_vetor07.jpg)";
		backgroundPosition = "835px 800px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "missao.html"){
		background = "url(imagens/img_vetor01.jpg)";
		backgroundPosition = "467px 410px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "parceiros.html"){
		background = "url(imagens/img_vetor08.jpg)";
		backgroundPosition = "1000px 400px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "part_empresa.php"){
		background = "url(imagens/img_vetor03.jpg)";
		backgroundPosition = "820px 600px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "part_escola.php"){
		background = "url(imagens/img_vetor03.jpg)";
		backgroundPosition = "820px 600px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "participar.html"){
		background = "url(imagens/img_vetor09.jpg)";
		backgroundPosition = "600px 550px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "principios.html"){
		background = "url(imagens/img_vetor02.jpg)";
		backgroundPosition = "255px 550px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "programa.html"){
		background = "url(imagens/img_vetor07.jpg)";
		backgroundPosition = "835px 550px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "quemsomos.html"){
		background = "url(imagens/img_vetor04.jpg)";
		backgroundPosition = "650px 400px";
		backgroundRepeat = "no-repeat";
	
	}
	
	document.getElementById("fundo").style.background = background;	
	document.getElementById("fundo").style.backgroundRepeat = backgroundRepeat;
	document.getElementById("fundo").style.backgroundPosition = backgroundPosition;

	var divCarregando = document.getElementById('carregando');
	var divResposta = document.getElementById('principal');
	var ajax = iniciaAjax();
	ajax.open('GET', plink, true);
	ajax.onreadystatechange = function(){
		if (ajax.readyState < 4){
			divCarregando.style.display = 'block';
		}
		if (ajax.readyState == 4){
			if (ajax.status == 200){ // Para testes internet
			//if (ajax.status == 0){ // Para testes locais
				divCarregando.style.display = 'none';
				divResposta.innerHTML = ajax.responseText;
				callExternalInterface()
			}
		}
	}
	ajax.send(null);
}

function toggleMenu(objID) {
	if (!document.getElementById) return;
	var ob = document.getElementById(objID).style;
	ob.display = (ob.display == 'block')?'none': 'block';
}