/**
 * @author francesco
 */
var pagina_redir = "";

function Logout(page, red, div)
{
	this.t_page = page;
	this.target = div;
	this.redtarget = red;

	this.exec = function()
	{
		try
		{
			pagina_redir = this.t_page;
			document.getElementById(this.target).innerHTML = "Uscendo ...";
			makeRequest("include_user/php/" + this.redtarget, this.redir, "POST", "");
		} catch (e) { document.getElementById(this.target).innerHTML = e.message; }
	}

	this.redir = function()
	{
		if (xmlhttp.readyState == 4)
		{
			if (xmlhttp.status == 200) window.location.replace(pagina_redir);
			else
			{
				var contentHTML = "<b>Errore durante il trasferimento dati.</b>";
				contentHTML += "<br />Stato : " + xmlhttp.status;
				document.getElementById(user_target).innerHTML = contentHTML;
			}
		}
	}
}

function handlePhp()
{
	if (xmlhttp.readyState == 4)
	{
		if (xmlhttp.status == 200) document.getElementById(user_target).innerHTML = xmlhttp.responseText;
		else
		{
			var contentHTML = "<b>Errore durante il trasferimento dati.</b>";
			contentHTML += "<br />Stato : " + xmlhttp.status;
			document.getElementById(user_target).innerHTML = contentHTML;
		}
	}
}
