try{
	xmlhttp=new XMLHttpRequest();
}catch(ee){
	try{
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			xml=false;
		}
	}
}
fila=[];
ifila=0;
function ajaxHTML(id,url,mensagem){
	document.getElementById(id).innerHTML=mensagem;
	fila[fila.length]=[id,url];
	if((ifila+1)==fila.length)ajaxRun();
}
function ajaxRun(){
	xmlhttp.open("GET",fila[ifila][1],true);
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4) {
			retorno=unescape(xmlhttp.responseText.replace(/\+/g," "));
			document.getElementById(fila[ifila][0]).innerHTML=retorno
			ifila++
			if(ifila<fila.length)setTimeout("ajaxRun()",20)
		}
	}
	xmlhttp.send(null);
}
function paginacao(path){
	path=(path.split('?')[1]).split('&');
	id=path[0].split('=')[1];
	pg=path[1].split('=')[1];
	type=path[2].split('=')[1];
	var paginacao=document.getElementById("pgpic");
	var links=paginacao.getElementsByTagName("a");
	for(var i=0;i<links.length;i++)
		links[i].className="";
	links[pg-1].className="pgdest";
	ajaxHTML("lthumbs","funcoes.php?album="+id+"&pg="+pg+"&type="+type+"&ajax","<li class=\"loading\">Carregando...</li>");
	return false;
}
function abrefoto(path){
	path=(path.split('?')[1]).split('&');
	id=path[0].split('=')[1];
	pg=path[1].split('=')[1];
	foto=path[2].split('=')[1];
	type=path[3].split('=')[1];
	ajaxHTML("viewpic","funcoes.php?album="+id+"&pg="+pg+"&foto="+foto+"&type="+type+"&ajax","<h4>Carregando...</h4>");
	return false;
}
/*function init(){
	var pag=document.getElementById("pgpic");
	var links=pag.getElementsByTagName("a");
	for(var i=0;i<links.length;i++)
		links[i].onclick=paginacao;
}
if(xmlhttp)window.onload=init;*/
