
/* Classe che effettua chiamate periodiche ad un'action definita per evitare il timeout*/

var cTimeout = Class.create();
cTimeout.prototype = {
	max_time : 30,
	url : "",
	initialize : function(pTime,pUrl) 
	{
		var self = this;
		this.max_time = pTime;
		this.url = pUrl;
	
		this.creaDivs();
		this.avvia();
	},
	creaDivs : function() 
	{
		var eDivTimeout = document.createElement("div");
		eDivTimeout.setAttribute("id", "timeout");
		eDivTimeout.style.position = "absolute";
		eDivTimeout.style.top = "10px";
		eDivTimeout.style.left = "10px";
		eDivTimeout.style.width = '150px';
		eDivTimeout.style.height = '50px';
		eDivTimeout.style.zIndex = 99999;
		eDivTimeout.style.overflow = "auto";
		eDivTimeout.style.display = "none";
		/*
		eDivTimeout.style.backgroundColor = '#fff';
		eDivTimeout.style.opacity = '0.5';
		eDivTimeout.style.filter = 'alpha(opacity=50)';
		*/
		document.body.appendChild(eDivTimeout);
	},	
	avvia : function() 
	{
		new Ajax.PeriodicalUpdater("timeout",this.url, 
									{ 
										method: 'get', 
										frequency: this.max_time, 
										asynchronous: true,
									  	onCreate: function(o) { 
    										o.request.url += '?uid=' + (new Date().getTime());
  										}
									});
	}
}





