/**
* CRIA REQUISIÇÃO
**/
function requisicao(){
	try{
		rq = new XMLHttpRequest();
	}
	catch(erro1){
		try{
			rq = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(erro2){
			try{
				rq = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(erro3){
				window.alert('Seu navegador não tem suporte a Ajax');
				rq = false;
			}
		}
	}
	return rq;
}
var ajax = requisicao();

/**
* INCLUIR CORRIGIR NOMES, DEIXAR RECADO
**/
function incluir(pagina){
	var url = pagina;
	ajax.open("GET", url, true);
	ajax.onreadystatechange = respostaIncluir;
	ajax.send(null);
}
function respostaIncluir(){
	if(ajax.readyState == 4){
		if(ajax.status == 200){
			var Resp = ajax.responseText;
			if(document.getElementById('include')){
				document.getElementById('include').innerHTML = Resp;
			}
		}else{
			window.alert('ERRO: Corrigir nomes\n '+ ajax.statusText);
		}
	}else{
		if(document.getElementById('include')){
			document.getElementById('include').innerHTML = "<p style='display:block;width:100px;margin:auto;font-size:10px;font-weight:bold;text-align:center;'><img src='../images/loading.gif' alt='' border='0' width='50' height='50' /><br />Carregando...</p>";
		}
	}
}

/**
* CONTAR CLIQUES DA FOTO
**/
function abreCLIQUE(pag){
	var url = pag;
	ajax.open("GET", url, true);
	ajax.onreadystatechange = respostaCliques;
	ajax.send(null);
}
function respostaCliques(){
	if(ajax.readyState == 4){
		if(ajax.status == 200){
			var Resp = ajax.responseText;
			if(document.getElementById('cliq')){
				document.getElementById('cliq').innerHTML = Resp;
			}
		}else{
			window.alert('ERRO: Cliques fotos\n '+ ajax.statusText);
		}
	}else{
		if(document.getElementById('cliq')){
			document.getElementById('cliq').innerHTML = "";
		}
	}
}

/**
* OUTRA REQUISIÇÃO
**/
function devolveRq2() {
	try {
		rq2 = new XMLHttpRequest();
	}
	catch(erro1){
		try	{
			rq2 = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(erro2){
			try	{
				rq2 = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(erro3){
				window.alert('Seu navegador não tem suporte a Ajax');
				rq2 = false;
			}
		}
	}
	return rq2;
}
var recados = devolveRq2();

/* RECADOS NAS FOTOS */
function abreREC(pag){
	var url = pag;
	recados.open("GET", url, true);
	recados.onreadystatechange = respostaRecados;
	recados.send(null);
}
function respostaRecados(){
	if(recados.readyState == 4){
		if(recados.status == 200){
			var Resp = recados.responseText;
			if(document.getElementById('rec')){
				document.getElementById('rec').innerHTML = '<a href="javascript:verRecados()">'+Resp+'</a>';
			}
		}else{
			window.alert('ERRO: Recados fotos\n '+ recados.statusText);
		}
	}else{
		if(document.getElementById('rec')){
			document.getElementById('rec').innerHTML = "";
		}
	}
}

/**/
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
