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 == "principal.html"){
		background = "url(imagens/img_vetor01.jpg)";	
		backgroundRepeat = "no-repeat";
		backgroundPosition = "820px 300px";
		
	}else if(plink == "quemsomos.html"){
		background = "url(imagens/img_vetor03.jpg)";
		backgroundPosition = "800px 250px";
		backgroundRepeat = "no-repeat";	
	
	}else if(plink == "missao.html"){
		background = "url(imagens/img_vetor04.jpg)";
		backgroundPosition = "720px 240px";
		backgroundRepeat = "no-repeat";	
	
	}else if(plink == "programa.html"){
		background = "";
		backgroundPosition = "";
		backgroundRepeat = "";
	
	}else if(plink == "caracteristicas.html"){
		background = "url(imagens/img_vetor06.jpg)";
		backgroundPosition = "800px 650px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "escolas.html"){
		background = "";
		backgroundPosition = "";
		backgroundRepeat = "";
	
	}else if(plink == "faq.html"){
		background = "url(imagens/img_vetor02.jpg)";
		backgroundPosition = "250px 950px";
		backgroundRepeat = "no-repeat";	
	
	}else if(plink == "com_anuncios.html"){
		background = "url(imagens/img_vetor05.jpg)";
		backgroundPosition = "800px 200px";
		backgroundRepeat = "no-repeat";		
	
	}else if(plink == "com_clipping.html"){
		background = "url(imagens/img_vetor05.jpg)";
		backgroundPosition = "800px 200px";
		backgroundRepeat = "no-repeat";		
	
	}else if(plink == "com_institucional.html"){
		background = "url(imagens/img_vetor05.jpg)";
		backgroundPosition = "800px 200px";
		backgroundRepeat = "no-repeat";		
	
	}else if(plink == "com_legislacao.html"){
		background = "url(imagens/img_vetor05.jpg)";
		backgroundPosition = "800px 200px";
		backgroundRepeat = "no-repeat";		
	
	}else if(plink == "com_publicitarios.html"){
		background = "url(imagens/img_vetor05.jpg)";
		backgroundPosition = "800px 200px";
		backgroundRepeat = "no-repeat";			
	
	}else if(plink == "com_publicacoes.html"){
		background = "url(imagens/img_vetor05.jpg)";
		backgroundPosition = "800px 200px";
		backgroundRepeat = "no-repeat";	
	
	}else if(plink == "eventos.html"){
		backgroundImage = "url(imagens/img_vetor05.jpg)";
		backgroundPosition = "1000px 400px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "conselho.html"){
		background = "url(imagens/img_vetor01.jpg)";
		backgroundPosition = "800px 420px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "participar.html"){
		background = "url(imagens/img_vetor08.jpg)";
		backgroundPosition = "315px 420px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "part_escola.php"){
		background = "url(imagens/img_vetor08.jpg)";
		backgroundPosition = "835px 600px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "part_empresa.php"){
		background = "url(imagens/img_vetor08.jpg)";
		backgroundPosition = "835px 420px";
		backgroundRepeat = "no-repeat";
	
	}else if(plink == "contato.php"){
		background = "url(imagens/img_vetor08.jpg)";
		backgroundPosition = "835px 280px";
		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;
				Mediabox.scanPage();
				callExternalInterface();
			}
		}
	}
	ajax.send(null);
}

function toggleMenu(objID) {
	if (!document.getElementById) return;
	var ob = document.getElementById(objID).style;
	ob.display = (ob.display == 'block')?'none': 'block';
}