// JavaScript Document
var xmlhttp;
function ajax(pagina, idConteiner) {
	try {
	    xmlhttp = new XMLHttpRequest();
	} catch(ee) {
    	try {
        	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	    } catch(e) {
    	    try {
            	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      	 	} catch(E) {
	            xmlhttp = false;
			}
    	}
	}
}

function carregar(imagem, conteiner) {
	url = "imagens/" + imagem;  
    // Abre a url
    xmlhttp.open("GET", url, true);

	var imgCarregando = document.createElement("img");
	imgCarregando.setAttribute("align", "center");
	imgCarregando.setAttribute("src", "imagens/carregando.gif");
	document.getElementById(conteiner).appendChild (imgCarregando);

    //Executada quando o navegador obtiver o código
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState==4) {
            // Lê o texto
            var texto = xmlhttp.responseText;

            // Exibe o texto no div conteúdo
            document.getElementById(conteiner).innerHTML = texto
        }
    }
    xmlhttp.send(null)
}

function abrirFoto(projeto) {
	ajax();

	switch (projeto) {
		case "projeto1":
			projeto1();
		break;
		default:
			projeto1();
	}
}

function projeto1() {
	document.getElementById("divParaFoto").style.display = "block";	
	carregar("fotos/brasilia.html", "abrirFotos");
	criarArea();
}

var tamanhoW = 0;
var tamanhoH = 0;

function criarArea() {
	document.getElementById("abrirFotos").style.width = tamanhoW + "px";
	document.getElementById("abrirFotos").style.height =  tamanhoH + "px";
	
	tamanhoW += 10;
	tamanhoH += 10;
	
	if (tamanhoW != 400 && tamanhoH != 400) {
		setTimeout("criarArea()", 1);	
	}
	
}

