/** * @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 checkForm(nome_form){    var oForm = document.getElementById(nome_form);    var field;        for (var i = 0; i < oForm.elements.length; i++)    {        field = oForm.elements[i];        switch (field.type)        {        	case "text" :        	case "textarea" :        	case "select-one" :        	case "file" :	            if (field.value.length <= 0)	            {		            alert("Il campo non puo' essere vuoto");					field.style.backgroundColor = "#f0f0f0";					field.style.borderColor = "#ff0000";					field.focus();					return;	            }	            else if (field.id == "telefono" && isNaN(field.value))	            {	            	alert("Il campo puo' contenere solo numeri");	                field.style.backgroundColor = "#f0f0f0";					field.style.borderColor = "#ff0000";	                field.focus();	                return;	            }	            else if (field.id == "email" && !field.value.match(/^([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})){1}$/))	            {	            	alert("E' necessario inserire una e-mail valida");	                field.style.backgroundColor = "#f0f0f0";					field.style.borderColor = "#ff0000";	                field.focus();	                return;	            }	            else if ((field.id == 'giorno' || field.id == 'data' || field.name == 'giorno' || field.name == 'data'))	            {	            	var temp = field.value.split("/");	            	if (temp[0].length != 2 || temp[1].length != 2 || temp[2].length != 4)	            	{	            		alert("La data deve essere in formato GG/MM/AAAA");		                field.style.backgroundColor = "#f0f0f0";						field.style.borderColor = "#ff0000";		                field.focus();		                return;	            	}	            	else	            	{	            		field.style.backgroundColor = "";		            	field.style.borderColor = "";	            	}	            }	            else	            {	            	field.style.backgroundColor = "";	            	field.style.borderColor = "";	            }	            	            break;            case "checkbox" :				if (field.checked == false)				{					alert("Il campo deve essere selezionato");					field.focus();					return;				}				break;            case "radio" :				field = document.getElementsByName(field.name);				var checked = false;				for (var j in field)					if (field[j].checked)					{						checked = true;						break;					}				if (!checked)				{					alert("Deve essere selezionata almeno un'opzione");					field[0].focus();					return;				}            		            break;        }    }    document.getElementById(nome_form).submit();}function getById(id) {	return document.getElementById?document.getElementById(id):(document.all?document.all(id):null); }function hideDiv(id) {	var id_string = new String(id);	var temp = new Array();		getById(id).style.visibility = "hidden";        	getById(id).style.display = "none";		temp = id_string.split("_");		getById("link_" + temp[1]).onclick = function(){showDiv(id)};}	function showDiv(id){	var id_string = new String(id);	var temp = new Array();	getById(id).style.visibility = ""; 	getById(id).style.display = ""; 		temp = id_string.split("_");			getById("link_" + temp[1]).onclick = function(){hideDiv(id)};}function swapDiv(id){	if (getById(id).style.visibility == "hidden")		showDiv(id);	else hideDiv(id);}function inviaRichiesta(value){	makeRequest("include_html/mini_sito.php", redir2, "POST", "id=" + value);}redir2 = function(){	if (xmlhttp.readyState == 4)	{		if (xmlhttp.status == 200)		{			getById("php_response").innerHTML = xmlhttp.responseText;		}		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;		}	}}try { LLI.callBack("functions1_lib"); }catch (e) {}
