	function ProcessForm(fForm)	{
		var parameters='a=b';
		var sValue=null;
		
		for (i=0;i<fForm.elements.length;i++)	{
			if (fForm.elements[i].type=='select-one' || fForm.elements[i].type=='hidden' || fForm.elements[i].type=='text') parameters += '&' + fForm.elements[i].name + '=' + encodeURI(fForm.elements[i].value );
		}
		if (fForm.elements.PartecipaCena[0].checked) parameters += '&PartecipaCena=1';
		if (fForm.elements.VieneAccompagnato[0].checked) parameters += '&VieneAccompagnato=1';
		if (fForm.elements.RicevereInfo_elettronica.checked) parameters += '&RicevereInfo_elettronica=1';
		if (fForm.elements.RicevereInfo_noelettronica.checked) parameters += '&RicevereInfo_noelettronica=1';
		
	}

	
	function ProcessGetUserInfo (objHTTPRequester)	{
		var objStruct=null;
		var objReq=null;
		var i=0;
		
		var objPacket = new DataPacket (objHTTPRequester.responseText);
		if (! objPacket.IsValid)	{
			alert(objPacket.Status);
			elOutput.value=objHTTPRequester.responseText;
			return;
		}
		objStruct = new Struct (objPacket.Content);
		if (! objStruct.IsValid)	{
			alert(objStruct.Status);
			return;
		}
		if (objStruct.Values.Code > -1)	{
			alert(objStruct.Values.Message);
		}
		else		{
			if (objStruct.Values.GetUserInfoStatus !=0)	{
			}
			else	{
				fRegister.Nome.value=objStruct.Values.Nome;
				fRegister.Cognome.value=objStruct.Values.Cognome;
				fRegister.Azienda.value=objStruct.Values.Azienda;
				fRegister.Tel.value=objStruct.Values.Tel;
				fRegister.PrefTel.value=objStruct.Values.PrefTel;
				fRegister.email.value=objStruct.Values.email;
				fRegister.RappresentanteIBM.value=objStruct.Values.RappresentanteIBM;
				for (i=0;i<fRegister.QualificaID.options.length;i++) {
					if (fRegister.QualificaID.options[i].value==objStruct.Values.QualificaID) {
						fRegister.QualificaID.options[i].selected=true;
					}
				}
				alert('Le Sue informazioni sono state correttamente ritrovate.\nCompleti le informazioni mancanti nel form sottostante e selezioni la sede di suo interesse.');
			}
			
		}
	}

	function ProcessRegisterReservation (objHTTPRequester)	{
		var objPacket = new DataPacket (objHTTPRequester.responseText);
		if (! objPacket.IsValid)	{
			alert(objPacket.Status);
			elOutput.value=objHTTPRequester.responseText;
			return;
		}
		objStruct = new Struct (objPacket.Content);
		if (! objStruct.IsValid)	{
			alert(objStruct.Status);
			return;
		}
		
		
		if (objStruct.Values.Code == -1)	{
		
			switch(objStruct.Values.ActionName) { 
			  
			  case 'update_user': 
					alert ('Attenzione:\n'+ objStruct.Values.ActionName +  '\n' + objStruct.Values.Message);
	
	
			  break; //si ferma qui 
			
			  case 'register_user': 
					alert ('Attenzione:\n'+ objStruct.Values.ActionName +  '\n' + objStruct.Values.Message);
	
			  break; //si ferma qui 
			
			  case 'SubscribeEventIBM': 
				if (objStruct.Values.SubscribeStatus==0)	{
					alert ('Prenotazione effettuata !');
				}
				else	{
					alert ('Attenzione:\n'+objStruct.Values.Message);
				}
			  break; //si ferma qui 
	
	
			  default: 
			    alert('Messaggio di default'); 
			}
		}
		else	{
			alert ('Attenzione:\nSi e\' verificato un errore. Codice di errore: '+objStruct.Values.Code);
		}
		
	}
	
	function FillCompany(elSelect)	{
		var fForm=elSelect.form;
		//if (elSelect.selectedIndex==1)	fForm.Azienda.value='IBM Italia'; else fForm.Azienda.value='';
	}
	
	function FillAltro(elSelect)	{
		var fForm=elSelect.form;
		if (elSelect.options[elSelect.selectedIndex].value==0)	{
			fForm.QualificaAltro.disabled=false;
		}
		else	{
			fForm.QualificaAltro.value='';
			fForm.QualificaAltro.disabled=true;
		}
	}

	function RegisterReservation (fForm)	{
	
		var sMsg='';
		var sConditionalMsg='';
		var sConfirmMsg='';
		var bReservationWithoutDinner=false;
		var bReservationWithDinner=false;
		var sReservationWithoutDinnerDesc='';
		var bHasDinner=false;
		var sConfirmEmail='';
		var sElementName='';
		var objReq=null;
		var parameters='a=b';
		var sValue=null;
		var i=0;
		
		
		if (! HasValue(fForm.Nome)) sMsg+='\nIndicare il proprio nome';
		if (! HasValue(fForm.Cognome)) sMsg+='\nIndicare il proprio cognome';
		if (! HasValue(fForm.Azienda)) sMsg+='\nIndicare la propria Azienda';
		if (! HasValue(fForm.TypeID)) sMsg+='\nSelezionare la propria tipologia dall\'elenco.';
		if (! HasValue(fForm.QualificaID)) sMsg+='\nSelezionare la propria funzione selezionandola dall\'elenco.';
		if ((SubscriptionMode==1) || (SubscriptionMode==3))	{
			if (! HasValue(fForm.email)) sMsg+='\nIndicare il proprio indirizzo di posta elettronica.';
		}
		else	{
			if (! HasValue(fForm.email))	{
				sConfirmEmail= 'Attenzione! Non hai inserito l\'indirizzo email. Quest\'informazione per noi e\' molto importante.\nSe in tuo possesso, puoi per favore compilare il campo?\n\nPremi [OK] per indicare l\indirizzo di email o [Annulla] per proseguire con la registrazione.';
			}
		}
		
		
		aCheckboxes= new Array ();
		if (fForm.EventScheduleID.length > 0) {
			for (i=0;i<fForm.EventScheduleID.length;i++)	{
				aCheckboxes[i]=fForm.EventScheduleID[i];
			}			 
		}
		else	{	
			aCheckboxes[0]=fForm.EventScheduleID;
		}
		sValue='';
		for (i=0;i<aCheckboxes.length;i++)	{
			if (aCheckboxes[i].checked)	{
				sValue=i;
				sElementName='EventDescription-'+aCheckboxes[i].value;
				sConfirmMsg+='\n'+fForm.elements[sElementName].value;
				sElementHasDinnerName='HasDinner-'+i;
				bHasDinner=fForm.elements[sElementHasDinnerName].value;
				if (bHasDinner==0)	{
					bReservationWithoutDinner=true;
					sReservationWithoutDinnerDesc+='\n'+fForm.elements[sElementName].value;
				}
				else	{
					bReservationWithDinner=true;
				}
			}
		}			 
		
		
		if (bReservationWithoutDinner && (! bReservationWithDinner))	{
		}
		else	{
			if ( ! (fForm.VieneAccompagnato[0].checked || fForm.VieneAccompagnato[1].checked) ) sMsg+='\nIndicare se si verra\' accompagnati all\'evento da un\'altra persona.';
			if ( ! (fForm.PartecipaCena[0].checked || fForm.PartecipaCena[1].checked) ) sMsg+='\nIndicare se si desidera partecipare alla cena.';
		}

		if (sConfirmMsg.length > 0) sConfirmMsg='Ti sei iscritto alle seguenti sedi:\n'+sConfirmMsg;
		if (sValue.length == 0) sMsg+='\nIndicare la sede e la data di proprio interesse.';
		
		
		//Verifica tra iscrizione a cena e presenza cena per ogni location

		if ((fForm.PartecipaCena[0].checked || fForm.VieneAccompagnato[0].checked) && bReservationWithoutDinner)	{
			sReservationWithoutDinnerDesc = 'Hai indicato di voler partecipare alla cena e/o di farti acompagnare da altra persona.\nTi informiamo tuttavia che per la seguente sede queste due opzioni non sono previste:' + sReservationWithoutDinnerDesc;
			alert(sReservationWithoutDinnerDesc);
		}
		
		if (bReservationWithoutDinner && (! bReservationWithDinner))	{
			fForm.VieneAccompagnato[1].checked=true;
			fForm.PartecipaCena[1].checked=true;
		}
	
		
		
	
		if (sMsg.length > 0)	{
			alert(sMsg);
		}
		else	{
		
			//verifica anti-regola email
			if (fForm.email.value.toLowerCase().indexOf('ibm.com') > 0)	{
				//email con 'ibm.com': verifica se l'azienda contiene ibm
				if (fForm.Azienda.value.toLowerCase().indexOf('ibm') < 0)	{
					//email con 'ibm.com' e azienda non contiene ibm
					alert ('Attenzione: Se non conosci l\'indirizzo email inserisci un valore fittizio (come ad esempio: finta@finta.it)');
					fRegister.email.focus();
					return;					
				}
			}
		
			if (! fForm.elements['RicevereInfo_elettronica'].checked) sConfirmMsg+='\nHai indicato di non voler ricevere informazioni aggiuntive per mezzo di comunicazioni elettroniche.';
			if (! fForm.elements['RicevereInfo_noelettronica'].checked) sConfirmMsg+='\nHai indicato di non voler ricevere informazioni aggiuntive per mezzo di comunicazioni non elettroniche.';
			sConfirmMsg+='\n\nConfermi la tua prenotazione ?';
			
			if (sConfirmEmail.length > 0)	{
				if (confirm (sConfirmEmail))	{
					fRegister.email.focus();
					return;
				}
			}
			if (confirm (sConfirmMsg))	{
				fForm.submit();
			}
		}
	}
