﻿	if(!window.Superformulario){
		window.Superformulario = {};
	}
 
	// Tipo del campo, define parámetros asociados
	Superformulario.tipoCampo = {
			texto : 0,
			seleccion : 1,
			multiseleccion : 2,
			oculto : 3,
			areatexto : 4
	};
	
	// Tipos de formularios
	Superformulario.formType = {
			producto : 0,
			grupoProductos : 1,
			solGeneral : 2,
			corporativo : 3
	};
	
	// Condiciones de aplicación de visibilidad
	// y obligatoriedad de campos en función del 
	// tipo del documento
	Superformulario.condition = {
			none : 0,
			indi : 1,
			corp : 2,
			both : 3
	};

	// Etiquetas de los fieldsets del formulario
	Superformulario.fieldsets = {
			personalInformation : {
				cat : "Les seves dades",
				eng : "Your information",
				cas : "Sus datos",
				pt : "Seus detalhes"
			},			
			formationInfo : {
				cat : "Com podem ajudar-lo?",
				eng : "How may we help you?",
				cas : "¿Cómo podemos ayudarle?",
				pt : "Como podemos ajudar?"
			},
			contactPreferences : {
				cat : "Com prefereix que el contactem?",
				eng : "How do you prefer to be contacted?",
				cas : "¿Cómo prefiere ser contactado?",
				pt : "Como você prefere ser contactado?"			
			}
	};
	
	
Superformulario.config = function(){

		var requiredFieldsIdsArray = new Array();
		// Tipo de formulario seleccionado
		var selectedFormType;
		
		//Id´s de los campos ocultos cuyo valor se establece
		//en función del tipo de formulario y otras consideraciones
		var casesSubjectHiddenFieldId = "Cases_Subject_14000018523268___1";
		var casesDescriptionHiddenFieldId = "Cases_Description_14000018523268___1";
		var sourceHiddenFieldId = "Contacts_Source_14000018523266___1";
		var sourceComboHiddenFieldId = "comboValue_Contacts_Source_14000018523266___1";
		var sourceCommentsHiddenFieldId = "Contacts_Source comments_14000018523266___1";
		var customerTypeHiddenFieldId = "Contacts_Customer Type_14000018523266___1";
		var languageComboHiddenFieldId= "comboValue_Contacts_Preferred Language_14000018523266___1";
		var languageHiddenFieldId= "Contacts_Preferred Language_14000018523266___1";
		
		//Id del selector que indica si el cliente quiere el folleto impreso
		var getProgramSelectId = "getProgram";
		
		var fields = {
				currentPage : {
					name : "currentPage",
					tipo : Superformulario.tipoCampo.oculto,
					value : "1"
				},
				nextPage : {
					name : "nextPage",
					tipo : Superformulario.tipoCampo.oculto,
					value : "1"
				},
				saveSecureFormValues : {
					name : "saveSecureFormValues",
					tipo : Superformulario.tipoCampo.oculto,
					value : "saveValues"
				},
				doServerSidevalidation : {
					name : "doServerSidevalidation",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				sectionType_1 : {
					name : "sectionType_1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "Contacts"
				},
				sectionType_secId_1 : {
					name : "sectionType_secId_1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "14000018523266"
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},	
				Contacts_First_Name_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.personalInformation,
					name : "Contacts_First Name_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],					
					required : [Superformulario.formType.producto,
					            Superformulario.formType.grupoProductos,
					            Superformulario.formType.solGeneral,
					            Superformulario.formType.corporativo],
					tipo : Superformulario.tipoCampo.texto,
					maxlength : 40,
					label : {
						cat : "Nom",
						eng : "First Name",
						cas : "Nombre",
						pt : "Nome"
					}
				},

				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				Contacts_Last_Name_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.personalInformation,
					name : "Contacts_Last Name_14000018523266___1",					
					//visible : Superformulario.condition.both,
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],
					required : [Superformulario.formType.producto,
					            Superformulario.formType.grupoProductos,
					            Superformulario.formType.solGeneral,
					            Superformulario.formType.corporativo],
					tipo : Superformulario.tipoCampo.texto,
					maxlength : 80,
					label : {
						cat : "Primer cognom",
						eng : "Last Name",
						cas : "Primer apellido",
						pt : "Primeiro Apelido"
					}
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				Contacts_Second_Last_Name_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.personalInformation,
					name : "Contacts_Second Last Name_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],
					required : [],
					tipo : Superformulario.tipoCampo.texto,
					maxlength : 60,
					label : {
						cat : "Segon cognom",
						eng : "Second Last Name",
						cas : "Segundo apellido",
						pt : "Segundo Apelido"
					}
				},				
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				Contacts_Email_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.personalInformation,
					name : "Contacts_Email_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],
					required : [Superformulario.formType.producto,
					            Superformulario.formType.grupoProductos,
					            Superformulario.formType.solGeneral,
					            Superformulario.formType.corporativo],
					tipo : Superformulario.tipoCampo.texto,
					maxlength : 100,
					label : {
						cat : "Adreça electrònica",
						eng : "Email",
						cas : "Correo electrónico",
						pt : "E-mail"
					}
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				
				Contacts_Phone_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.personalInformation,
					name : "Contacts_Phone_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],
					required : [Superformulario.formType.producto,
					            Superformulario.formType.grupoProductos,
					            Superformulario.formType.solGeneral,
					            Superformulario.formType.corporativo],
					tipo : Superformulario.tipoCampo.texto,
					maxlength : 50,
					label : {
						cat : "Telèfon",
						eng : "Phone",
						cas : "Teléfono",
						pt : "Telefone"
					}
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				fieldContacts_Contact__Country_14000018523266___1 : {
					name : "fieldContacts_Contact  Country_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : ""
				},
				selectValueContacts_Contact__Country_14000018523266___1 : {
					name : "selectValueContacts_Contact  Country_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "-None-;Polonia;Puerto Rico;Republica Dominicana;Suecia;Tailandia;Turquia;Uganda;Uzbekistan;Vietnam;Yugoslavia;Austria;Armenia;Bangladesh;Canada;Eritrea;Ghana;Guatemala;Islas Feroe;Kenya;Kuwait;Letonia;Liberia;Micronesia;Mozambique;Nepal;Nueva Caledonia;Qatar;Republica Centroafricana;Senegal;Sierra Leona;Somalia;Sudan;Swazilandia;Togo;Turkmenistan;Guyana Francesa;Brunei;Oceania Australiana;Oceania Americana;Kiribati;Vanuatu;Islas Marianas Del Norte;Rajastan;Albania;Andorra;Angola;Antillas;Arabia Saudita;Argelia;Australia;Bahrein (Islas);Belgica;Belice;Bolivia;Bulgaria;Camerun;Colombia;Costa Rica;Cuba;Chad;Chile;China;Chipre;Ecuador;Estados Unidos de America;Etiopia;Federacion Malaya;Francia;Gabon;Reino Unido;Grecia;Guyana;Paises Bajos;Honduras;India;Iran;Irlanda;Italia;Jamaica;Jordania;Laos;Malawi;Mauricio;Mauritania;Nicaragua;Noruega;Panama;Paraguay;Portugal;Congo;Rep. Malgache;Sudafrica;Rep. Volta;Zimbabwe;Ruanda;Rumania;Singapur;Siria;Suiza;Tanzania;Tunez;Venezuela;Yemen;Zambia;Hong Kong;Croacia;Estonia;Eslovenia;Egipto;Eslovaquia;Afganistan;Serbia;Georgia;Islas Cayman;Kazajstan;Antillas Holandesas;Gibraltar;Bielorrusia;Moldavia;Tayikistan;Isla De Man;Guinea-Bissau;Santa Helena;Djibouti;Madagascar;Reunion;Comores;Namibia;Lesotho;Groenlandia;Bermudas;Bahamas;Islas Turks y Caicos;Guadalupe;Martinica;Santa Lucia;Burundi;Benin;Bhutan;Guayanas;Mali;Oceania Neozelandesa;Rep. Democratica del Congo;Barbados;Checoslovaquia;Republica Arabe Unida;Liechtenstein;Archipielago Svalbard;Islas Anglonormandas;Santo Tome Y Principe;Seychelles;Mayotte;San Pedro y Miquelon;Saint Christopher y Nevis;Antigua Y Barbuda;Timor Oriental;San Vicente;Montserrat;Granada;Aruba;Surinam;Islas Malvinas;Gaza Y Jerico;Maldivas;Macao;Papua Nueva Guinea;Islas Salomon;Tuvalu;Islas Wallis y Futuna;Pitcairn;Fiji;Tonga;Polinesia Francesa;Islas Marshall;Palau;El Salvador;Filipinas;Gambia;Haiti;Hungria;Indonesia;Israel;Japon;Libano;Libia;Marruecos;Mexico;Nigeria;Oman;Pakistan;Peru;Azerbaiyan;Kirguizistan;Burkina-Faso;Islas Cook;Sri Lanka;Taiwan;Republica Checa;Rusia;Ucrania;Bosnia y Herzegovina;Malta;Macedonia;Myanmar;Camboya;Emiratos Arabes Unidos;Corea del Norte;Corea del Sur;Union Sovietica;Guinea;Palestina;Formosa;Argentina;Alemania;Brasil;Costa de Marfil;Dinamarca;Finlandia;Guinea Ecuatorial;Irak;Islandia;Luxemburgo;Malasia;Mongolia;Nueva Zelanda;Niger;Trinidad y Tobago;Uruguay;Monaco;Lituania;Ciudad Del Vaticano;Cabo Verde;Dominica;Nauru;Samoa;Botswana;Islas Virgenes Britanicas;España;SIN PAÍS"
				},
				Contacts_Contact__Country_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.personalInformation,
					name : "Contacts_Contact  Country_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],
					required : [Superformulario.formType.producto,
					            Superformulario.formType.grupoProductos,
					            Superformulario.formType.solGeneral,
					            Superformulario.formType.corporativo],
					tipo : Superformulario.tipoCampo.seleccion,
					label : {
						cat : "País",
						eng : "Country",
						cas : "País",
						pt : "País"
					},
					options : Superformulario.paises
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				Contacts_Organización_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.personalInformation,
					name : "Contacts_Organización_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],
					required : [Superformulario.formType.corporativo],
					tipo : Superformulario.tipoCampo.texto,
					maxlength : 50,
					label : {
						cat : "Nom de la seva organització",
						eng : "Company",
						cas : "Nombre de su organización",
						pt : "Nome da sua empresa"
					}
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				Contacts_Title_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.personalInformation,
					name : "Contacts_Title_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],
					required : [Superformulario.formType.corporativo],
					tipo : Superformulario.tipoCampo.texto,
					maxlength : 100,
					label : {
						cat : "Càrrec",
						eng : "Job title",
						cas : "Cargo",
						pt : "Cargo"
					},
					value : {
						cat : "",
						eng : "",
						cas : "",
						pt : ""
					}
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				fieldContacts_Experience_14000018523266___1 : {
					name : "fieldContacts_Experience_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto					
				},
				selectValueContacts_Experience_14000018523266___1 : {
					name : "selectValueContacts_Experience_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "-None-;Less than 5 years;5 to 9 years;9 to 15 years;15 to 25 years;More than 25 years"
				},
				Contacts_Experience_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.personalInformation,
					name : "Contacts_Experience_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral],
					required : [],
					tipo : Superformulario.tipoCampo.seleccion,
					label : {
						cat : "Anys d'experiència",
						eng : "Years of experience",
						cas : "Años de experiencia",
						pt : "Anos de experiência"
					},
					options : [
							   {
								   value : "-None-",
								   label : {
								      cat : "-None-",
									  eng : "-None-",
									  cas : "-None-",
									  pt : "-None-"
							       },
							       selected : false
							   },
							   {
								   value : "Less than 5 years",
								   label : {
								      cat : "Menys de 5 anys",
									  eng : "Less than 5 years",
									  cas : "Menos de 5 años",
									  pt : "Menos de 5 anos"
							       },
							       selected : false
							   },
							   {
								   value : "5 to 9 years",
								   label : {
								      cat : "Entre 5 i 9 anys",
									  eng : "5 to 9 years",
									  cas : "Entre 5 y 9 años",
									  pt : "Entre 5 e 9 anos"
							       },
							       selected : false
							   },
							   {
								   value : "9 to 15 years",
								   label : {
								      cat : "Entre 9 i 15 anys",
									  eng : "9 to 15 years",
									  cas : "Entre 9 y 15 años",
									  pt : "Entre 9 e 15 anos"
							       },
							       selected : false
							   },
							   {
								   value : "15 to 25 years",
								   label : {
										cat : "Entre 15 i 25 anys",
										eng : "15 to 25 years",
										cas : "Entre 15 y 25 años",
										pt : "Entre 15 e 25 anos"
							       },
							       selected : false
							   },
							   {
								   value : "More than 25 years",
								   label : {
								      cat : "Més de 25 anys",
									  eng : "More than 25 years",
									  cas : "Más de 25 años",
									  pt : "Mais de 25 anos"
							       },
							       selected : false
							   }
					]
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				fieldContacts_Campus_preferences_14000018523266___1 : {
					name : "fieldContacts_Campus preferences_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto					
				},
				selectValueContacts_Campus_preferences_14000018523266___1 : {
					name : "selectValueContacts_Campus preferences_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "-None-;Spain - BCN;Spain - MAD;Buenos Aires;Other"					
				},
				Contacts_Campus_preferences_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.formationInfo,
					name : "Contacts_Campus preferences_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral],
					required : [Superformulario.formType.producto,
						        Superformulario.formType.grupoProductos,
						        Superformulario.formType.solGeneral],
					tipo : Superformulario.tipoCampo.seleccion,
					label : {
						cat : "Campus de preferència",
						eng : "Campus of choice",
						cas : "Campus de preferencia",
						pt : "Campos de prefência"
					},
					options : [
									{value : "-None-",
									label : {
									cat : "-None-",
									eng : "-None-",
									cas : "-None-",
									pt : "-None-"
									},
									selected : false},

									{value : "Spain - BCN",
									label : {
									cat : "Campus Barcelona",
									eng : "Barcelona Campus ",
									cas : "Campus Barcelona",
									pt : "Campus Barcelona"
									},
									selected : false},

									{value : "Spain - MAD",
									label : {
									cat : "Campus Madrid",
									eng : "Madrid Campus ",
									cas : "Campus Madrid",
									pt : "Campus Madrid"
									},
									selected : false},

									{value : "Buenos Aires",
									label : {
									cat : "Campus Buenos Aires",
									eng : "Buenos Aires Campus",
									cas : "Campus Buenos Aires",
									pt : "Campus Buenos Aires"
									},
									selected : false},

									{value : "Other",
									label : {
									cat : "Altres",
									eng : "Other",
									cas : "Otro",
									pt : "Outros"
									},
									selected : false}
					]
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				selectValueContacts_Time_availability_14000018523266___1 : {
					name : "selectValueContacts_Time availability_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,	
					value : "Full-time;Part-time;Short Programs;Seminars"				
				},
				comboValue_Contacts_Time_availability_14000018523266___1 : {
					name : "comboValue_Contacts_Time availability_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto									
				},
				Contacts_Time_availability_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.formationInfo,
					name : "Contacts_Time availability_14000018523266___1",
					visible : [Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral],
					required : [],
					tipo : Superformulario.tipoCampo.multiseleccion,
					comboValue : "comboValue_Contacts_Time availability_14000018523266___1",
					size : 5,
					label : {
						cat : "Disponibilitat de temps",
						eng : "Duration of program",
						cas : "Disponibilidad de tiempo",
						pt : "Disponibilidade de tempo"
					},
					options : [
					
					
									{value : "Full-time",
									label : {
									cat : "Dedicació completa",
									eng : "Full-time",
									cas : "Dedicación Completa",
									pt : "Dedicação completa"
									},
									selected : false},

									{value : "Part-time",
									label : {
									cat : "Dedicació parcial",
									eng : "Part-time",
									cas : "Dedicación Parcial",
									pt : "Dedicação parcial"
									},
									selected : false},

									{value : "Short Programs",
									label : {
									cat : "Programes de curta durada",
									eng : "Short Programs",
									cas : "Programas de Corta Duración",
									pt : "Programas de Curta Duração"
									},
									selected : false},

									{value : "Seminars",
									label : {
									cat : "Seminaris",
									eng : "Seminars",
									cas : "Seminarios",
									pt : "Seminários"
									},
									selected : false}
					]
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				selectValueContacts_Formation_purposes_14000018523266___1 : {
					name : "selectValueContacts_Formation purposes_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,	
					value : "Update;Develop management skills;Specialization;Professional development;Networking"				
				},
				comboValue_Contacts_Formation_purposes_14000018523266___1 : {
					name : "comboValue_Contacts_Formation purposes_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto										
				},
				Contacts_Formation_purposes_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.formationInfo,
					name : "Contacts_Formation purposes_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral],
					required : [Superformulario.formType.producto,
						           Superformulario.formType.grupoProductos,
						           Superformulario.formType.solGeneral],
					tipo : Superformulario.tipoCampo.multiseleccion,
					comboValue : "comboValue_Contacts_Formation purposes_14000018523266___1",
					size : 5,
					label : {
						cat : "Motius de la formació",
						eng : "Training purposes",
						cas : "Motivos de la formación",
						pt : "Motivos da formação"
					},
					options : [
							   
							   
									{value : "Update",
									label : {
									cat : "Actualització",
									eng : "Update",
									cas : "Actualización",
									pt : "Actualização"
									},
									selected : false},
									
									{value : "Develop management skills",
									label : {
									cat : "Desenvolupament d'habilitats",
									eng : "Develop management skills",
									cas : "Desarrollo de Habilidades",
									pt : "Desenvolvimento de Habilidades"
									},
									selected : false},
									
									{value : "Specialization",
									label : {
									cat : "Especialització",
									eng : "Specialization",
									cas : "Especialización",
									pt : "Especialização"
									},
									selected : false},
									
									{value : "Professional development",
									label : {
									cat : "Desenvolupament professional",
									eng : "Professional development",
									cas : "Desarrollo Profesional",
									pt : "Desenvolvimento Profissional"
									},
									selected : false},
									
									{value : "Networking",
									label : {
									cat : "Establiment de contactes",
									eng : "Networking",
									cas : "Establecimiento de Contactos",
									pt : "Estabelecimento de Contactos"
									},
									selected : false}
					]
				},
				Cases_Description_14000018523268___1 : {
					fieldset : Superformulario.fieldsets.formationInfo,
					name : "Cases_Description_14000018523268___1",
					visible : [Superformulario.formType.corporativo],
					required : [Superformulario.formType.corporativo],
					tipo : Superformulario.tipoCampo.areatexto,
					cols : 5,
					rows : 5,
					label : {
						cat : "Descriviu les seves necessitats específiques",
						eng : "Describe your specifc needs",
						cas : "Describa sus necesidades específicas",
						pt : "Descreva as suas necessidades específicas"
					},
					value : {
						cat : "",
						eng : "",
						cas : "",
						pt : ""
					}
				},
				Cases_Comments_14000018523268___1 : {
					fieldset : Superformulario.fieldsets.formationInfo,
					name : "Cases_Comments_14000018523268___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],
					required : [],
					tipo : Superformulario.tipoCampo.areatexto,
					cols : 5,
					rows : 5,
					label : {
						cat : "Comentaris",
						eng : "Comments",
						cas : "Comentarios",
						pt : "Comentários"
					},
					value : {
						cat : "",
						eng : "",
						cas : "",
						pt : ""
					}
				},
				selectValueContacts_Contact_Preferences_14000018523266___1 : {
					name : "selectValueContacts_Contact Preferences_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,	
					value : "All channels without problem;Consult Owner before;Contact only by Phone;Contact only by Postal Mail;Contact through Assistant;No Campaign E-Mail;No Campaign Mail;No Phone Campaign;No Communication Plans Mail;Contact only by E-Mail;Email Preferred;Phone Preferred;Contact Forbidden (Opt-Out)"				
				},
				comboValue_Contacts_Contact_Preferences_14000018523266___1 : {
					name : "comboValue_Contacts_Contact Preferences_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto										
				},				
				Contacts_Contact_Preferences_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.contactPreferences,
					name : "Contacts_Contact Preferences_14000018523266___1",
					visible : [Superformulario.formType.producto,
					           Superformulario.formType.grupoProductos,
					           Superformulario.formType.solGeneral,
					           Superformulario.formType.corporativo],
					required : [],
					tipo : Superformulario.tipoCampo.multiseleccion,
					comboValue : "comboValue_Contacts_Contact Preferences_14000018523266___1",
					size : 5,
					label : {
						cat : "Preferències de contacte",
						eng : "Contact preferences",
						cas : "Canales de comunicación preferidos",
						pt : "Canais de comunicação preferidos"
					},
					options : [
							   {
								   value : "All channels without problem",
								   label : {
								      cat : "Disponible per a tots els canals",
									  eng : "All channels without problem",
									  cas : "Disponible para todos los canales",
									  pt : "Disponível para todos os canais"
							       },
							       selected : false
							   },
							   {
								   value : "Email Preferred",
								   label : {
								      cat : "Prefereixo el correu electrònic",
									  eng : "E-Mail preferred",
									  cas : "Prefiero correo electrónico",
									  pt : "Prefiro e-mail"
							       },	
							       selected : false
							   },
							   {
								   value : "Phone Preferred",
								   label : {
								      cat : "Prefereixo una trucada telefònica",
									  eng : "Phone preferred",
									  cas : "Prefiero llamada telefónica",
									  pt : "Prefiro chamada telefónica"
							       },
							       selected : false
							   },
							   {
								   value : "Visit preferred",
								   label : {
								      cat : "Prefereixo una visita d'empresa",
									  eng : "Visit preferred",
									  cas : "Prefiero una visita de empresa",
									  pt : "Prefiro reunião de empresa"
							       },
							       selected : false
							   }
					]
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,					
					value : "true"
				},
				fieldContacts_Customer_Type_14000018523266___1 : {
					name : "fieldContacts_Customer Type_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : ""					
				},
				selectValueContacts_Customer_Type_14000018523266___1 : {
					name : "selectValueContacts_Customer Type_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "-None-;Individual;Corporate"					
				},
				Contacts_Customer_Type_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.contactPreferences,
					name : "Contacts_Customer Type_14000018523266___1",
					visible : [],
					required : [],
					tipo : Superformulario.tipoCampo.seleccion,
					label : {
						cat : "Customer Type",
						eng : "Customer Type",
						cas : "Customer Type",
						pt : "Customer Type"
					},
					options : [
									{value : "-None-",
									label : {
									cat : "-None-",
									eng : "-None-",
									cas : "-None-",
									pt : "-None-"
									},
									selected : false},

									{value : "Individual",
									label : {
									cat : "Individual",
									eng : "Individual",
									cas : "Individual",
									pt : "Individual"
									},
									selected : false},

									{value : "Corporate",
									label : {
									cat : "Corporate",
									eng : "Corporate",
									cas : "Corporate",
									pt : "Corporate"
									},
									selected : false}
					]
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				},
				selectValueContacts_Source_14000018523266___1 : {
					name : "selectValueContacts_Source_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,	
					value : "Alumni Recommendation;Application/Request Information Form;BD or PdM Activity;Bolsa Informacion Oracle;ESADE Department;Educational Fair;Human Resources Dep.;Internet Ads;Internet Search Engine;Job Colleague;Open Day;Other;Partner;Peterson's;Professor Recommendation;Ranking List or Report;Referral;Sector-Specific Publication;US News and World Report;Written Ads;Website Exed - Landing Pages - Add Words;WEB FORM (read comments)"
					//value : ""				
				},
				comboValue_Contacts_Source_14000018523266___1 : {
					name : "comboValue_Contacts_Source_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto										
				},				
				Contacts_Source_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.contactPreferences,
					name : "Contacts_Source_14000018523266___1",
					visible : [],
					required : [],
					tipo : Superformulario.tipoCampo.multiseleccion,
					comboValue : "comboValue_Contacts_Source_14000018523266___1",
					size : 5,
					label : {
						cat : "Source",
						eng : "Source",
						cas : "Source",
						pt : "Source"
					},
					options : [
							   {
								   value : "Alumni Recommendation",
								   label : {
								      cat : "Alumni Recommendation",
									  eng : "Alumni Recommendation",
									  cas : "Alumni Recommendation",
									  pt : "Alumni Recommendation"
							       },
							       selected : false
							   },
							   {
								   value : "Application/Request Information Form",
								   label : {
								      cat : "Application/Request Information Form",
									  eng : "Application/Request Information Form",
									  cas : "Application/Request Information Form",
									  pt : "Application/Request Information Form"
							       },
							       selected : false
							   },
							   {
								   value : "BD or PdM Activity",
								   label : {
								      cat : "BD or PdM Activity",
									  eng : "BD or PdM Activity",
									  cas : "BD or PdM Activity",
									  pt : "BD or PdM Activity"
							       },
							       selected : false
							   },
							   {
								   value : "Bolsa Informacion Oracle",
								   label : {
								      cat : "Bolsa Informacion Oracle",
									  eng : "Bolsa Informacion Oracle",
									  cas : "Bolsa Informacion Oracle",
									  pt : "Bolsa Informacion Oracle"
							       },
							       selected : false
							   },
							   {
								   value : "ESADE Department",
								   label : {
								      cat : "ESADE Department",
									  eng : "ESADE Department",
									  cas : "ESADE Department",
									  pt : "ESADE Department"
							       },
							       selected : false
							   },
							   {
								   value : "Educational Fair",
								   label : {
								      cat : "Educational Fair",
									  eng : "Educational Fair",
									  cas : "Educational Fair",
									  pt : "Educational Fair"
							       },
							       selected : false
							   },
							   {
								   value : "Human Resources Dep.",
								   label : {
								      cat : "Human Resources Dep.",
									  eng : "Human Resources Dep.",
									  cas : "Human Resources Dep.",
									  pt : "Human Resources Dep."
							       },
							       selected : false
							   },
							   {
								   value : "Internet Ads",
								   label : {
								      cat : "Internet Ads",
									  eng : "Internet Ads",
									  cas : "Internet Ads",
									  pt : "Internet Ads"
							       },
							       selected : false
							   },
							   {
								   value : "Internet Search Engine",
								   label : {
								      cat : "Internet Search Engine",
									  eng : "Internet Search Engine",
									  cas : "Internet Search Engine",
									  pt : "Internet Search Engine"
							       },
							       selected : false
							   },
							   {
								   value : "Job Colleague",
								   label : {
								      cat : "Job Colleague",
									  eng : "Job Colleague",
									  cas : "Job Colleague",
									  pt : "Job Colleague"
							       },
							       selected : false
							   },
							   {
								   value : "Open Day",
								   label : {
								      cat : "Open Day",
									  eng : "Open Day",
									  cas : "Open Day",
									  pt : "Open Day"
							       },
							       selected : false
							   },
							   {
								   value : "Other",
								   label : {
								      cat : "Other",
									  eng : "Other",
									  cas : "Other",
									  pt : "Other"
							       },
							       selected : false
							   },
							   {
								   value : "Partner",
								   label : {
								      cat : "Partner",
									  eng : "Partner",
									  cas : "Partner",
									  pt : "Partner"
							       },
							       selected : false
							   },
							   {
								   value : "Peterson\'s",
								   label : {
								      cat : "Peterson\'s",
									  eng : "Peterson\'s",
									  cas : "Peterson\'s",
									  pt : "Peterson\'s"
							       },
							       selected : false
							   },
							   {
								   value : "Professor Recommendation",
								   label : {
								      cat : "Professor Recommendation",
									  eng : "Professor Recommendation",
									  cas : "Professor Recommendation",
									  pt : "Professor Recommendation"
							       },
							       selected : false
							   },
							   {
								   value : "Ranking List or Report",
								   label : {
								      cat : "Ranking List or Report",
									  eng : "Ranking List or Report",
									  cas : "Ranking List or Report",
									  pt : "Ranking List or Report"
							       },
							       selected : false
							   },
							   {
								   value : "Referral",
								   label : {
								      cat : "Referral",
									  eng : "Referral",
									  cas : "Referral",
									  pt : "Referral"
							       },
							       selected : false
							   },
							   {
								   value : "Sector-Specific Publication",
								   label : {
								      cat : "Sector-Specific Publication",
									  eng : "Sector-Specific Publication",
									  cas : "Sector-Specific Publication",
									  pt : "Sector-Specific Publication"
							       },
							       selected : false
							   },
							   {
								   value : "US News and World Report",
								   label : {
								      cat : "US News and World Report",
									  eng : "US News and World Report",
									  cas : "US News and World Report",
									  pt : "US News and World Report"
							       },
							       selected : false
							   },
							   {
								   value : "WEB FORM (read comments)",
								   label : {
								      cat : "WEB FORM (read comments)",
									  eng : "WEB FORM (read comments)",
									  cas : "WEB FORM (read comments)",
									  pt : "WEB FORM (read comments)"
							       },
							       selected : false
							   },
							   {
								   value : "Website Exed - Landing Pages - Add Words",
								   label : {
								      cat : "Website Exed - Landing Pages - Add Words",
									  eng : "Website Exed - Landing Pages - Add Words",
									  cas : "Website Exed - Landing Pages - Add Words",
									  pt : "Website Exed - Landing Pages - Add Words"
							       },
							       selected : false
							   },
							   {
								   value : "Written Ads",
								   label : {
								      cat : "Written Ads",
									  eng : "Written Ads",
									  cas : "Written Ads",
									  pt : "Written Ads"
							       },
							       selected : false
							   }							   
					]
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,					
					value : "true"
				},
				Contacts_Source_comments_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.contactPreferences,
					name : "Contacts_Source comments_14000018523266___1",
					visible : [],
					required : [],
					tipo : Superformulario.tipoCampo.texto,
					maxlength : 100,
					label : {
						cat : "Source Comments",
						eng : "Source Comments",
						cas : "Source Comments",
						pt : "Source Comments"
					},
					value : {
						cat : "",
						eng : "",
						cas : "",
						pt : ""
					}
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,					
					value : "true"
				},
				
				selectValueContacts_Preferred_Language_14000018523266___1 : {
					name : "selectValueContacts_Preferred Language_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto,	
					value : "English;Catalan;Spanish;Portuguese"				
				},
				comboValue_Contacts_Preferred_Language_14000018523266___1 : {
					name : "comboValue_Contacts_Preferred Language_14000018523266___1",
					tipo : Superformulario.tipoCampo.oculto									
				},
				Contacts_Preferred_Language_14000018523266___1 : {
					fieldset : Superformulario.fieldsets.contactPreferences,
					name : "Contacts_Preferred Language_14000018523266___1",
					visible : [],
					required : [],
					tipo : Superformulario.tipoCampo.multiseleccion,
					comboValue : "comboValue_Contacts_Preferred Language_14000018523266___1",
					overwriteValue : true,
					size : 5,
					label : {
						cat : "Preferred Language",
						eng : "Preferred Language",
						cas : "Preferred Language",
						pt : "Preferred Language"
					},
					options : [					
									{value : "English",
									label : {
									cat : "English",
									eng : "English",
									cas : "English",
									pt : "English"
									},
									selected : false},

									{value : "Catalan",
									label : {
									cat : "Catalan",
									eng : "Catalan",
									cas : "Catalan",
									pt : "Catalan"
									},
									selected : false},

									{value : "Spanish",
									label : {
									cat : "Spanish",
									eng : "Spanish",
									cas : "Spanish",
									pt : "Spanish"
									},
									selected : false},

									{value : "Portuguese",
									label : {
									cat : "Portuguese",
									eng : "Portuguese",
									cas : "Portuguese",
									pt : "Portuguese"
									},
									selected : false}
					]
				},
				
				
				Contacts_mandFields___1 : {
					name : "Contacts_mandFields___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "null"
				},
				Contacts_nonMandFields___1 : {
					name : "Contacts_nonMandFields___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "null"
				},
				Contacts_comboFields_1___1 : {
					name : "Contacts_comboFields_1___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "Contacts_Time availability_14000018523266___1:##:Contacts_Formation purposes_14000018523266___1:##:Contacts_Contact Preferences_14000018523266___1:##:Contacts_Source_14000018523266___1:##:Contacts_Preferred Language_14000018523266___1"
				},
				addResponseCount_Contacts : {
					name : "addResponseCount_Contacts",
					tipo : Superformulario.tipoCampo.oculto,
					value : "1"					
				},
				sectionType_2 : {
					name : "sectionType_2",
					tipo : Superformulario.tipoCampo.oculto,
					value : "Cases"					
				}, 
				sectionType_secId_2 : {
					name : "sectionType_secId_2",
					tipo : Superformulario.tipoCampo.oculto,
					value : "14000018523268"					
				},   
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				}, 
				Cases_Subject_14000018523268___1 : {
					fieldset : Superformulario.fieldsets.contactPreferences,
					name : "Cases_Subject_14000018523268___1",
					visible : [],
					tipo : Superformulario.tipoCampo.texto,
					maxlength : 300,
					label : {
						cat : "",
						eng : "",
						cas : "",
						pt : "" 
					},
					value : {
						cat : "",
						eng : "",
						cas : "",
						pt : ""
					}
				},
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				}, 
				
				secCountFieldLabel : {
					name : "secCountFieldLabel",
					tipo : Superformulario.tipoCampo.oculto,
					value : "true"
				}, 

				Cases_mandFields___1 : {
					name : "Cases_mandFields___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "Cases_Subject_14000018523268___1"
				},
				Cases_nonMandFields___1 : {
					name : "Cases_nonMandFields___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "Cases_Description_14000018523268___1:##:Cases_Comments_14000018523268___1"
				},
				Cases_comboFields_2___1 : {
					name : "Cases_comboFields_2___1",
					tipo : Superformulario.tipoCampo.oculto,
					value : "null"
				},
				addResponseCount_Cases : {
					name : "addResponseCount_Cases",
					tipo : Superformulario.tipoCampo.oculto,
					value : "1"
				},
				gmultiselect : {
					name : "gmultiselect",
					tipo : Superformulario.tipoCampo.oculto
				},
				sectionCountTotal : {
					name : "sectionCountTotal",
					tipo : Superformulario.tipoCampo.oculto,
					value : "2"
				},
		
				i_tc : {
					name : "i_tc",
					tipo : Superformulario.tipoCampo.oculto,
					value : "34sd2390756q2q23"
				}				
		};// config
		
		var submit = {
			name : "submitButtonId",
			value : {
				cat : "Enviar",
				eng : "Submit",
				cas : "Enviar",
				pt : "Enviar"
			}
		};
		var submitNoValidate= {
			name : "submitNoValidate",
			value : {
				cat : "Los campos marcados con * son obligatorios.",
				eng : "Fields marked with * are required.",
				cas : "Los campos marcados con * son obligatorios.",
				pt : "Os campos marcados com * são obrigatórios."
			}
		};
		var language="cas";
		
        // Dada una condición (Superformulario.condition) y un tipo
        // de formulario (de 0 a 3) devuelve cierto si se solapan
        function checkCondition(condition, formType){
              for(var cond in condition){            	 
                  if (condition[cond] == formType) return true;
              }
              return false;
        }
        		
		// Devuelve el código html asociado a un objeto field
		function createField(fieldConfig, lang, formType){

			var label;
			var name;
			var id;
			var fieldLevel;
			var className;
			var showLabel;
			var required;
			var value, html, options, optionsTxt;
			if (fieldConfig.label){
				label = eval("fieldConfig.label." + lang);
			}
			
			language = lang;
			
			value="";
			name = fieldConfig.name;
			id = name;
			fieldLevel = fieldConfig.nivel;
			if (fieldConfig.visible)
				showLabel = checkCondition(fieldConfig.visible, formType);
			if (fieldConfig.required)
				required = checkCondition(fieldConfig.required, formType);
			if (showLabel){
				//className = "visiblefield";
				className = "textField";
			}else{
				className = "hiddenfield";
			}
			if (required && label)
				label = "* " + label;
			
			if (required && showLabel)
				requiredFieldsIdsArray[requiredFieldsIdsArray.length] = id;
			
			switch(fieldConfig.tipo){
				case Superformulario.tipoCampo.texto:
					var maxlength;
					value = "";
					if (fieldConfig.maxlength){
						maxlength = fieldConfig.maxlength;
					}
					if (fieldConfig.value){
						if ((fieldConfig.value == undefined) || fieldConfig.value == null ){
							value= "";
						}
						else {
						value = eval("fieldConfig.value." + lang);
						}
					}
					html = "";
					if (label && showLabel){
						html += "<LABEL for=\""+id+"\">" + label + ":</LABEL>";
					}
					html += "<INPUT TYPE=\"text\" ";
					html += "class=\"" + className + "\" ";
					html += "name=\"" + name + "\" ";
					html += "id=\"" + id + "\" ";
					html += "value=\"" + value + "\" ";
					if (maxlength){
	    				html += "maxlength=\"" + maxlength + "\" ";
					}
					html += "></INPUT>";
					
					if (showLabel)
						html += "</BR>";
					
					return html;
				
				case Superformulario.tipoCampo.areatexto:
					var rows;
					var cols;
					value = "";
					if (fieldConfig.rows){
						rows = fieldConfig.rows;
					}
					if (fieldConfig.cols){
						cols = fieldConfig.cols;
					}
					if (fieldConfig.value){
						if ((fieldConfig.value == undefined) || fieldConfig.value == null ){
							value= "";
						}
						else {
						value = eval("fieldConfig.value." + lang);
						}						
					}
					html = "";
					if (label && showLabel){
						html += "<LABEL for=\""+id+"\">" + label + ":</LABEL>";
					}
					html += "<TEXTAREA ";
					html += "name=\"" + name + "\" ";
					html += "class=\"" + className + "\" ";
					html += "id=\"" + id + "\" ";
					html += "rows=\"" + rows + "\" ";
					html += "cols=\"" + cols + "\">";
					html += value;
					html += "</TEXTAREA>";

					if (showLabel)
						html += "</BR>";
					return html;
				
				case Superformulario.tipoCampo.seleccion:
					options = fieldConfig.options;
					optionsTxt = "";
					options.sort(optionsSort);
					
					for (var i = 0; i<options.length; i++){
						var optionValue = options[i].value;
						var optionLabel = eval("options[i].label." + lang);
						var selected = "";
						if (options[i].selected){
							selected = "selected";
						}
						optionsTxt += "<OPTION "+selected+" value=\"" + optionValue + "\">";
						optionsTxt += optionLabel;
						optionsTxt += "</OPTION>";
					}
					html = "";
					if (label && showLabel){
						html += "<LABEL for=\""+id+"\">" + label + ":</LABEL>";
					}
					html += "<SELECT ";
					html += "class=\"" + className + "\" ";
					html += "id=\"" + id + "\" ";
					html += "name=\"" + name + "\">";
					html += optionsTxt;
					html += "</SELECT>";

					if (showLabel)
						html += "</BR>";
					return html;
				
				case Superformulario.tipoCampo.multiseleccion:
					options = fieldConfig.options;
					options.sort(optionsSort);
					optionsTxt = "";
					var size = fieldConfig.size;
					for (i = 0; i<options.length; i++){
						optionValue = options[i].value;
						optionLabel = eval("options[i].label." + lang);
						selected = "";
						if (options[i].selected){
							selected = "selected";
						}
						optionsTxt += "<OPTION "+selected+" value=\"" + optionValue + "\">";
						optionsTxt += optionLabel;
						optionsTxt += "</OPTION>";
					}
					html = "";
					if (label && showLabel){
						html += "<LABEL for=\""+id+"\">" + label + ":</LABEL>";
					}
					html += "<SELECT multiple=\"multiple\" ";
					html += "class=\"" + className + "\" ";
					html += "id=\"" + id + "\" ";
					html += "name=\"" + name + "\" size=\"" + size + "\">";
					html += optionsTxt;
					html += "</SELECT>";

					if (showLabel)
						html += "</BR>";
					return html;
				
				case Superformulario.tipoCampo.oculto:
					//value = fieldConfig.value;
					value= "";
					if (fieldConfig.value){
						if ((fieldConfig.value == undefined) || fieldConfig.value == null ){
							value= "";
						}
						else {
							//value = eval("fieldConfig.value." + lang);
							value = fieldConfig.value;
						}
					}
					html = "";
					if (label){
						html += label + ": ";
					}
					html += "<INPUT type=\"hidden\" name=\"" + name + "\" id=\"" + id + "\" value=\""+value+"\">";
						
					return html;
			}
		}//createField
			
		function optionsSort (a,b){
			var optionLabelA = eval("a.label." + this.Superformulario.config.language);
			var optionLabelB = eval("b.label." + this.Superformulario.config.language);
			//console.log("Ordenando " + optionLabelA + "" + optionLabelB);
			return (optionLabelA > optionLabelB);		
		}			
		
	    return {
			getFields: function(lang, formType){
	    		//console.log("Set language " + language);
	    		this.language = lang;
	    		selectedFormType = formType;
		    	var configArray = {};				
				var configArr = fields;
				var configArrLength = configArr.length;
				var fieldSetTitle = "";
				var fieldSetContent = "";
				var fieldSetClass;
				var formHtml = "";
				var numCamposVisiblesFieldSet = 0;
				var visible = false;
				for (i in configArr){
					var fieldConfig = configArr[i];
					//¿es visible el campo?
					if (fieldConfig.visible) 
					{
						visible = checkCondition(fieldConfig.visible, formType);
						if (visible) {
							numCamposVisiblesFieldSet += 1;
						}
					}
					//Si hay fieldset en el campo
					if (eval("fields." + i + ".fieldset")){
						var componentFieldSetTitle = eval("fields." + i + ".fieldset." + lang);
						//Cambiamos de fieldset
						if (componentFieldSetTitle && componentFieldSetTitle != fieldSetTitle){							
							if (fieldSetTitle && fieldSetTitle != ""){
								//campo visible
								if (numCamposVisiblesFieldSet >0 ) {
									//fieldSetClass = "visiblefield";
									fieldSetClass = "textField";
								}
								else {
									fieldSetClass = "hiddenfield";
								}
								formHtml += "<FIELDSET class=\"" +fieldSetClass + "\"><LEGEND>" + fieldSetTitle + "</LEGEND>";
								formHtml += fieldSetContent;
								formHtml += "</FIELDSET>";
								fieldSetTitle = componentFieldSetTitle;
								fieldSetContent = "";
								if (visible){
									// el primer campo del nuevo fieldset es visible
									numCamposVisiblesFieldSet = 1;
								}
								else {
									numCamposVisiblesFieldSet = 0;
								}
							}else{
								fieldSetTitle = componentFieldSetTitle;
							}
						}
					}
					fieldSetContent += createField(fieldConfig, lang, formType);
				}
				if (numCamposVisiblesFieldSet >0){	
					//fieldSetClass = "visiblefield";
					fieldSetClass = "textField";
				}
				else {
					fieldSetClass = "hiddenfield";
				}
				formHtml += "<FIELDSET class=\"" +fieldSetClass + "\"><LEGEND>" + fieldSetTitle + "</LEGEND>";
				formHtml += fieldSetContent;
				formHtml += "</FIELDSET>";
				
				return formHtml;
			},
			
			getSubmitButton: function(lang){
				var submitValue = eval("submit.value." + lang);
				var html = "<INPUT type=\"submit\" name=\"" + submit.name + "\" id=\"" + submit.name + "\" value=\"" + submitValue +"\" class=\"formSubmitButton\"/>";
				return html;
			},
			
			validateForm: function(){
				//validamos los campos requeridos
				for (var index in requiredFieldsIdsArray){
					var field = document.getElementById(requiredFieldsIdsArray[index]);
					if (field){
						if (field.value == null || field.value == ""){
							alert (eval("submitNoValidate.value." + language));
							return false;
						}
					}
				}
				
				//actualizamos el campo de idioma del formulario según el idioma del formulario
				switch(language){
					case "cas":
					{
						document.getElementById(languageHiddenFieldId).value = 'Spanish';
						/*document.getElementById(languageComboHiddenFieldId).value = 'Spanish';*/
						break;
					}
					case "eng":
					{
						document.getElementById(languageHiddenFieldId).value = 'English';
						//document.getElementById(languageComboHiddenFieldId).value = 'English';
						break;
					}
					case "cat":
					{
						document.getElementById(languageHiddenFieldId).value = 'Catalan';
						//document.getElementById(languageComboHiddenFieldId).value = 'Catalan';
						break;
					}
					case "pt":
					{
						document.getElementById(languageHiddenFieldId).value = 'Portuguese';
						//document.getElementById(languageComboHiddenFieldId).value = 'Portuguese';
						break;
					}
				
				}//switch
				
				//preparamos los campos multiselección con lo seleccionado
				//los campos multiseleccion se componen de 3 campos, entre ellos el "combo", el cual hay que poner en su
				//value los valores seleccionados
				var configArr = fields;			
				//recorremos todos los campos
				for (i in configArr){
					var fieldConfig = configArr[i];
					//el campo es multiseleccion
					if (fieldConfig.tipo == Superformulario.tipoCampo.multiseleccion){
						var campoMulti;
						campoMulti = document.getElementById(fieldConfig.name);
						campoCombo = document.getElementById(fieldConfig.comboValue);
							var numOpciones = 0;
							//recorremos los valores del campo
							for (var j=0; j<campoMulti.options.length; j++)
								{	
									//está seleccionada la opción
									if (campoMulti.options[j].selected){
										if ((numOpciones == 0) || (campoCombo.value == '') || (campoCombo.value == ';') || fieldConfig.overwriteValue){
											campoCombo.value = campoMulti.options[j].value;
										}
										else{
											campoCombo.value = campoCombo.value + ';' + campoMulti.options[j].value;
										}
									}
									numOpciones++;
								}						
					}//if
				}//for
				
				
				
				switch(selectedFormType){
					case Superformulario.formType.producto : 
						document.getElementById(casesSubjectHiddenFieldId).value = 'Solicitud de información Web ' + document.title;
						var descriptionField = document.getElementById(casesDescriptionHiddenFieldId);
						descriptionField.value = '' /*+ getProgram*/;
						//Completamos los campos ocultos con los valores predefinidos
						//para el campo source es necesario completar también el campo comboValue pues es un campo Multiselección
						document.getElementById(sourceComboHiddenFieldId).value = 'WEB FORM (read comments)';
						document.getElementById(sourceHiddenFieldId).value = 'WEB FORM (read comments)';						
						document.getElementById(sourceCommentsHiddenFieldId).value = 'Producto';
						document.getElementById(customerTypeHiddenFieldId).value = 'Individual';
						break;
					case Superformulario.formType.grupoProductos : 
						document.getElementById(casesSubjectHiddenFieldId).value = document.title;
						var selectedPrograms = "";
						var allPrograms = document.getElementsByName(Superformulario.InterestAreas.getCheckBoxName());
						for (var i = 0; i<allPrograms.length; i++){
							var cb = allPrograms[i];
							if (cb.checked){
								selectedPrograms += cb.getAttribute("associatedname") + ";";
							}
						}
						var descriptionField = document.getElementById(casesDescriptionHiddenFieldId);
						descriptionField.value = selectedPrograms /*+ getProgram*/;
						//Completamos los campos ocultos con los valores predefinidos
						//para el campo source es necesario completar también el campo comboValue pues es un campo Multiselección
						document.getElementById(sourceComboHiddenFieldId).value = 'WEB FORM (read comments)';
						document.getElementById(sourceHiddenFieldId).value = 'WEB FORM (read comments)';						
						document.getElementById(sourceCommentsHiddenFieldId).value = 'Grupo de Productos';
						document.getElementById(customerTypeHiddenFieldId).value = 'Individual';
						break;
					case Superformulario.formType.solGeneral : 
						//Completamos los campos ocultos con los valores predefinidos
						//para el campo source es necesario completar también el campo comboValue pues es un campo Multiselección
						document.getElementById(casesSubjectHiddenFieldId).value = 'Solicitud de información general';
						document.getElementById(sourceComboHiddenFieldId).value = 'WEB FORM (read comments)';
						document.getElementById(sourceHiddenFieldId).value = 'WEB FORM (read comments)';
						document.getElementById(sourceCommentsHiddenFieldId).value = 'Solicitud General';
						document.getElementById(customerTypeHiddenFieldId).value = 'Individual';
						break;
					case Superformulario.formType.corporativo : 
						document.getElementById(casesSubjectHiddenFieldId).value = 'Solicitud de información Cliente Corporativo';
						var selectedPrograms = "";
						var allPrograms = document.getElementsByName(Superformulario.InterestAreas.getCheckBoxName());
						for (var i = 0; i<allPrograms.length; i++){
							var cb = allPrograms[i];
							if (cb.checked){
								selectedPrograms += cb.getAttribute("associatedname") + ";";
							}
						}
						var descriptionField = document.getElementById(casesDescriptionHiddenFieldId);
						descriptionField.value = descriptionField.value + ';' + selectedPrograms /*+ getProgram*/;
						//Completamos los campos ocultos con los valores predefinidos
						//para el campo source es necesario completar también el campo comboValue pues es un campo Multiselección
						document.getElementById(sourceComboHiddenFieldId).value = 'WEB FORM (read comments)';
						document.getElementById(sourceHiddenFieldId).value = 'WEB FORM (read comments)';
						document.getElementById(sourceCommentsHiddenFieldId).value = 'Corporativo';
						document.getElementById(customerTypeHiddenFieldId).value = 'Corporate';
						break;
				}
				return true;
			}
		};
	}();
