

 
var page_id = { idx: 0,cartella: '',maxfoto: 20}
 


function modifica_id(id){
page_id.idx=id;

}

function modifica_cartella(id){
page_id.cartella=id;

}

function modifica_maxfoto(id){
page_id.maxfoto=id;

}
 

/* Connessione Ajax */
function fl_connect() {
			var
				httpx = null,
				browser = navigator.userAgent.toUpperCase();
				
			if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
			
			httpx = new XMLHttpRequest(); /* Connessione Standard */
		
		else if(window.ActiveXObject && browser.indexOf("MSIE 4") < 0) {
				if(browserUtente.indexOf("MSIE 5") < 0)
					httpx = new ActiveXObject("Msxml2.XMLHTTP");
				else
					httpx = new ActiveXObject("Microsoft.XMLHTTP");
			}
			return httpx;
		};	
		
		<!--//

var testo_src = { unavariabile: ''}


function caricaTesto(testo) {
var  elemento = getElement("contenuto-dinamico");
if(testo.length > 3 && testo != testo_src.unavariabile && testo != testo_src.unavariabile+" "){
testo_src.unavariabile = testo;
return fl_cerca(testo,elemento);
} else {
elemento.style['display'] = "none";
return false;
}}



function sticazzi(counter,cartella,maxfoto){
	modifica_id(counter);
	var  elemento = getElement("contenuto-dinamico");
	modifica_id(counter);
	modifica_maxfoto(maxfoto);
	modifica_cartella(cartella);
	elemento.innerHTML = '<iframe src="commenti.php?cartella='+cartella+'&amp;id='+counter+'&amp;maxfoto='+maxfoto+'" scrolling="no" frameborder="0" style="border:none; overflow: y-scroll; width:774px; height:900px;" allowTransparency="true"></iframe>'; 
	
	}
	
	
function caricaPagina(aumenta) {

if(1){
	
var next = page_id.idx;
if(aumenta == 1){
modifica_id(Number(next)+1);
next++;
} else {
modifica_id(Number(next)-1);
next--;
}

if(next <=0) {
next = 1;
modifica_id(1);	
} else if(next >= page_id.maxfoto-1){
next = 1;
modifica_id(1);	
}


return fl_pagina(next,'');

} else {
elemento.style['display'] = "none";
return false;
}}

function fl_pagina(id,cartella) {

 	
  var  http = fl_connect();
  var  usaLink = true;
  var  elemento = getElement("contenuto-dinamico");

    
 
  if(http) {
	var cart = page_id.cartella;
	var maxfoto = page_id.maxfoto;
	var url = "prova.php";
	var params = "cartella="+cart+"&id="+id+"&maxfoto="+maxfoto;
	http.open("POST", url, true);
	
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = function() {
	if(http.readyState == 2) {
	//(confirm("Sicuro di Voler Procedere?")) ? "" : http.abort() ;
	//alert(readyState[http.readyState]);
	}
	
	if(http.readyState == 4 && http.status == 200) {
			elemento.style['display'] = "block";
			elemento.innerHTML = http.responseText;
		}
	}
	http.send(params);
	usaLink = false;
  }
   
  return usaLink;
} 

function fl_cerca(testo,elemento) {

 	
  var  http = fl_connect();
  var  usaLink = true;
  
  
  
 
  if(http) {

	var url = "prova.php";
	var params = "cerca="+testo;
	http.open("POST", url, true);
	
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = function() {
	if(http.readyState == 2) {
	//(confirm("Sicuro di Voler Procedere?")) ? "" : http.abort() ;
	//alert(readyState[http.readyState]);
	}
	
	if(http.readyState == 4 && http.status == 200) {
			elemento.style['display'] = "block";
			elemento.innerHTML = http.responseText;
		}
	}
	http.send(params);
	usaLink = false;
  }
   
  return usaLink;
} 

//-->
		
		function getElement(id_elemento) {
			var element;
			if(document.getElementById)
				element = document.getElementById(id_elemento);
			else
				element = document.all[id_elemento];
			return element;
		};
	



		var readyState = new Object();
		readyState[0] = "Inattivo";
		readyState[1] = "Inizializzato";
		readyState[2] = "Richiesta";
		readyState[3] = "Risposta";
		readyState[4] = "Completato";
		
		var statusTxt = new Array();
		statusTxt[100] = "Continue";
		statusTxt[101] = "Switching Protocols";
		statusTxt[200] = "OK";
		statusTxt[201] = "Created";
		statusTxt[202] = "Accepted";
		statusTxt[203] = "Non-Authoritative Information";
		statusTxt[204] = "No Content";
		statusTxt[205] = "Reset Content";
		statusTxt[206] = "Partial Content";
		statusTxt[300] = "Multiple Choices";
		statusTxt[301] = "Moved Permanently";
		statusTxt[302] = "Found";
		statusTxt[303] = "See Other";
		statusTxt[304] = "Not Modified";
		statusTxt[305] = "Use Proxy";
		statusTxt[306] = "(unused, but reserved)";
		statusTxt[307] = "Temporary Redirect";
		statusTxt[400] = "Bad Request";
		statusTxt[401] = "Unauthorized";
		statusTxt[402] = "Payment Required";
		statusTxt[403] = "Forbidden";
		statusTxt[404] = "Not Found";
		statusTxt[405] = "Method Not Allowed";
		statusTxt[406] = "Not Acceptable";
		statusTxt[407] = "Proxy Authentication Required";
		statusTxt[408] = "Request Timeout";
		statusTxt[409] = "Conflict";
		statusTxt[410] = "Gone";
		statusTxt[411] = "Length Required";
		statusTxt[412] = "Precondition Failed";
		statusTxt[413] = "Request Entity Too Large";
		statusTxt[414] = "Request-URI Too Long";
		statusTxt[415] = "Unsupported Media Type";
		statusTxt[416] = "Requested Range Not Satisfiable";
		statusTxt[417] = "Expectation Failed";
		statusTxt[500] = "Internal Server Error";
		statusTxt[501] = "Not Implemented";
		statusTxt[502] = "Bad Gateway";
		statusTxt[503] = "Service Unavailable";
		statusTxt[504] = "Gateway Timeout";
		statusTxt[505] = "HTTP Version Not Supported";
		statusTxt[509] = "Bandwidth Limit Exceeded";
