//-------------------------VARIABILI-----------------------------
var form_message01='Si sono verificati i seguenti errori';
var form_message02='deve contenere un indirizzo e-mail';
var form_message03='deve contenere un numero';
var form_message04='deve contenere un numero compreso tra';
var form_message05='e';
var form_message06='e\' richiesto';
var form_message07='deve essere una Partita Iva valida';
var form_message08='deve essere accettata';
var form_message09='devono essere uguali';

var form_societa_txtdesc_reg=new Array('Societa*','Partita IVA*','Sito WEB','Indirizzo*','CAP*','Cittą*','Provincia*','Frazione','Telefono*','Cellulare','Fax*','Settore*','Nome*','Cognome*','Sesso','Codice fiscale','Indirizzo','CAP','Cittą','Provincia','Frazione','Telefono','Cellulare','Fax','E-mail*','Professione','Password*','Conferma password*');
var form_user_txtdesc_reg=new Array('Societa*','Partita IVA*','Sito WEB','Indirizzo*','CAP*','Cittą*','Provincia*','Frazione','Telefono*','Cellulare','Fax*','Settore*','Nome*','Cognome*','Sesso','Codice fiscale','Indirizzo*','CAP*','Cittą*','Provincia*','Frazione','Telefono*','Cellulare','Fax','E-mail*','Professione*','Password*','Conferma password*');
var form_nomedesc_reg=new Array('soc01','soc02','soc03','soc04','soc05','soc06','soc07','soc08','soc09','soc10','soc11','soc12','usr13','usr14','usr15','usr16','usr17','usr18','usr19','usr20','usr21','usr22','usr23','usr24','usr25','usr26','psw28','psw29');
var NameDivError_reg='helperror';
var NamePassCmp_reg=new Array('mypass','myrepass');

var form_txtdesc_work=new Array('Nome *','Cognome *','Indirizzo','Cittą','Provincia','Nazione','Telefono','Cellulare','Fax','E-mail *','Info','Accetto*','Non accetto');
var form_nomedesc_work=new Array('dsc01','dsc02','dsc03','dsc04','dsc05','dsc06','dsc07','dsc08','dsc09','dsc10','dsc11','dsc12','dsc13');
var NameDivError_work='helperror';

var form_txtdesc_contactus=new Array('Nome *','Cognome *','Azienda *','Indirizzo *','Cap *','Cittą *','Nazione *','Telefono','Fax','E-mail *','Info *','File','Accetto*','Non accetto');
var form_nomedesc_contactus=new Array('dsc01','dsc02','dsc03','dsc04','dsc05','dsc06','dsc07','dsc08','dsc09','dsc10','dsc11','dsc12','dsc13','dsc14');
var NameDivError_contactus='helperror';

var form_txtdesc_cdcalcolo=new Array('Username *','Password *');
var form_nomedesc_cdcalcolo=new Array('dsc01','dsc02');
var NameDivError_cdcalcolo='helperror';

var form_txtdesc_login=new Array('USERNAME *','PASSWORD *');
var form_nomedesc_login=new Array('log01','log02');
var NameDivError_login='logerror_message';
//-------------------------VARIABILI-----------------------------

function controllaform_login(){
	pg=document.forms.login;
	var campi=new Array();
	//------------------
	campi['nome_campi']=new Array('username','password');
	campi['txt_desc']=new Array('USERNAME *','PASSWORD *');
	campi['nome_desc']=form_nomedesc_login;
	campi['desc_error']=new Array('Username','Password');
	campi['type_value']=new Array('R','R');
	campi['message']=new Array(form_message01,form_message02,form_message03,form_message04,form_message05,form_message06,form_message07);
	campi['css']=new Array('testo10-black01','testo10-red01');
	campi['div']=new Array(NameDivError_login,'155','#F5F5F5','testo12-red01','testo10-black01');
	campi['sign_request']='';
	campi['other_error']=new Array();
	//------------------
	MM_validateFormHTML_lingua(campi);
	//-------------------
	if(document.MM_returnValue==true){
		pg.submit();
		}
	else{
		if(document.getElementById('logerror').style.visibility=='hidden'){
			DivErrorPage('');
			}
		}
	}


function controllaform_reminder(myid){
	x=document.getElementById(myid);
	pg=document.forms.reminderpassword;
	//alert(pg);
	MM_validateForm_lingua('email','','RisEmail');
	if(document.MM_returnValue==true){
		pg.target='mailreminder';
		pg.action=window.mailreminder.location.href;
		pg.submit();
		}
	}


function controllaform_work(){
	pg=document.forms.work;
	var campi=new Array();
	//------------------
	campi['nome_campi']=new Array('nome','cognome','indirizzo','citta','provincia','nazione','telefono','cellulare','fax','mail','info');
	campi['txt_desc']=new Array('Nome *','Cognome *','Indirizzo','Cittą','Provincia','Nazione','Telefono','Cellulare','Fax','E-mail *','Info*');
	campi['nome_desc']=form_nomedesc_work;
	campi['desc_error']=new Array('Nome','Cognome','Indirizzo','Cittą','Provincia','Nazione','Telefono','Cellulare','Fax','E-mail','Richiesta informazioni');
	campi['type_value']=new Array('R','R','','','','','','','','R','R');
	campi['message']=new Array(form_message01,form_message02,form_message03,form_message04,form_message05,form_message06,form_message07);
	campi['css']=new Array('testo10-black01','testo10-red01');
	campi['div']=new Array(NameDivError_work,'156','#F5F5F5','testo12-red01','testo10-black01');
	campi['sign_request']='';
	campi['other_error']=new Array();
	//------------------
	if(document.getElementById('privacy').checked==false){
		campi['other_error'][campi['other_error'].length]=new Array(1,'Accetto*','- La Legge sulla Privacy',form_message08,'dsc13');
		}
	else{
		campi['other_error'][campi['other_error'].length]=new Array(0,'Accetto*','','','dsc13');
		}
	//------------------
	MM_validateFormHTML_lingua(campi);
	//-------------------
	if(document.MM_returnValue==true){
		pg.submit();
		}
	}
	
	
function controllaform_contactus(){
	pg=document.forms.contactus;
	var campi=new Array();
	//------------------
	campi['nome_campi']=new Array('nome','cognome','azienda','indirizzo','cap','citta','nazione','telefono','fax','mail','info');
	campi['txt_desc']=new Array('Nome *','Cognome *','Azienda *','Indirizzo *','Cap *','Cittą *','Nazione *','Telefono','Fax','E-mail *','Info *');
	campi['nome_desc']=form_nomedesc_work;
	campi['desc_error']=new Array('Nome','Cognome','Azienda','Indirizzo','Cap','Cittą','Nazione','Telefono','Fax','E-mail','Richiesta informazioni');
	campi['type_value']=new Array('R','R','R','R','RisNumy','R','R','','','R','R');
	campi['message']=new Array(form_message01,form_message02,form_message03,form_message04,form_message05,form_message06,form_message07);
	campi['css']=new Array('testo10-black01','testo10-red01');
	campi['div']=new Array(NameDivError_work,'156','#F5F5F5','testo12-red01','testo10-black01');
	campi['sign_request']='';
	campi['other_error']=new Array();
	//------------------
	if(document.getElementById('privacy').checked==false){
		campi['other_error'][campi['other_error'].length]=new Array(1,'Accetto*','- La Legge sulla Privacy',form_message08,'dsc12');
		}
	else{
		campi['other_error'][campi['other_error'].length]=new Array(0,'Accetto*','','','dsc12');
		}
	//------------------
	MM_validateFormHTML_lingua(campi);
	//-------------------
	if(document.MM_returnValue==true){
		pg.submit();
		}
	}
	
	
function controllaform_cdcalcolo(){
	pg=document.forms.chiedicd;
	var campi=new Array();
	//------------------
	campi['nome_campi']=new Array('username_cd','password_cd');
	campi['txt_desc']=new Array('Username *','Password *');
	campi['nome_desc']=form_nomedesc_work;
	campi['desc_error']=new Array('Username','Password');
	campi['type_value']=new Array('R','R');
	campi['message']=new Array(form_message01,form_message02,form_message03,form_message04,form_message05,form_message06,form_message07);
	campi['css']=new Array('testo10-black01','testo10-red01');
	campi['div']=new Array(NameDivError_work,'300','#F5F5F5','testo12-red01','testo10-black01');
	campi['sign_request']='';
	campi['other_error']=new Array();
	//------------------
	MM_validateFormHTML_lingua(campi);
	//-------------------
	if(document.MM_returnValue==true){
		pg.submit();
		}
	}		


function controllaform_register(){
	pg=document.forms.register;
		
	if((pg.mytype[0].checked==true)||(pg.mytype[1].checked==true)){
		var campi=new Array();
		if(pg.mytype[0].checked==true){
			campi['nome_campi']=new Array('societa','partitaivasocieta','sitowebsocieta','indirizzosocieta','capsocieta','cittasocieta','provinciasocieta','frazionesocieta','telefonosocieta','cellularesocieta','faxsocieta','settoresocieta','nome','cognome','sesso','codicefiscale','indirizzo','cap','citta','provincia','frazione','telefono','cellulare','fax','emailuser','professione','mypass','myrepass');
			campi['txt_desc']=new Array('Societa*','Partita IVA*','Sito WEB','Indirizzo*','CAP*','Cittą*','Provincia*','Frazione','Telefono','Cellulare','Fax','Settore*','Nome*','Cognome*','Sesso','Codice fiscale','Indirizzo','CAP','Cittą','Provincia','Frazione','Telefono','Cellulare','Fax','E-mail*','Professione','Password*','Conferma password*');
			campi['nome_desc']=form_nomedesc_reg;
			campi['desc_error']=new Array('Societą','Partita IVA societą','Sito WEB societą','Indirizzo societą','CAP societą','Cittą societą','Provincia societą','Frazione societą','Telefono societą','Cellulare societą','Fax societą','Settore societą','Nome utente','Cognome utente','Sesso utente','Codice fiscale utente','Indirizzo utente','CAP utente','Cittą utente','Provincia utente','Frazione utente','Telefono utente','Cellulare utente','Fax utente','E-mail utente','Professione utente','Password','Conferma password');
			//campi['type_value']=new Array('R','RisIva','','R','R','R','R','','','','','R','R','R','','','','','','','','','','RisEmail','','R','R');
			campi['type_value']=new Array('R','RisIva','','R','R','R','R','','','','','','R','R','','','','','','','','','','','RisEmail','','R','R');
			campi['message']=new Array(form_message01,form_message02,form_message03,form_message04,form_message05,form_message06,form_message07);
			campi['css']=new Array('testo10-black01','testo10-red01');
			campi['div']=new Array(NameDivError_reg,'156','#F5F5F5','testo12-red01','testo10-black01');
			campi['sign_request']='';
			campi['other_error']=new Array();
			//-------------------
			if((document.getElementById('settoresocieta0').checked==false)&&(document.getElementById('settoresocieta1').checked==false)&&(document.getElementById('settoresocieta2').checked==false)&&(document.getElementById('settoresocieta3').checked==false)&&(document.getElementById('settoresocieta4').checked==false)&&(document.getElementById('settoresocieta5').checked==false)&&(document.getElementById('settoresocieta6').checked==false)&&(document.getElementById('settoresocieta7').checked==false)){
				campi['other_error'][campi['other_error'].length]=new Array(1,'Settore*','- Settore societą',form_message08,'soc12');
				}
			else{
				campi['other_error'][campi['other_error'].length]=new Array(0,'Settore*','','','soc12');
				}
			//-------------------			
			if(document.getElementById(NamePassCmp_reg[0]).value!=document.getElementById(NamePassCmp_reg[1]).value){
				campi['other_error'][campi['other_error'].length]=new Array(1,'Password*','- I campi '+campi['desc_error'][25]+' e '+campi['desc_error'][26],form_message09,'psw28');
				campi['other_error'][campi['other_error'].length]=new Array(1,'Conferma password*','',form_message09,'psw29','testo10-red01');
				}
			//-------------------
			if(document.getElementById('privacy').checked==false){
				campi['other_error'][campi['other_error'].length]=new Array(1,'Accetto*','- La Legge sulla Privacy',form_message08,'prv30');
				}
			else{
				campi['other_error'][campi['other_error'].length]=new Array(0,'Accetto*','','','prv30');
				}
			//-------------------
			MM_validateFormHTML_lingua(campi);
			//-------------------
			if(document.MM_returnValue==true){
				pg.submit();
				}
			else
			{
				alert("Non hai compilato interamente il modulo di registrazione!");	
			}
			}
		else{
			campi['nome_campi']=new Array('societa','partitaivasocieta','sitowebsocieta','indirizzosocieta','capsocieta','cittasocieta','provinciasocieta','frazionesocieta','telefonosocieta','cellularesocieta','faxsocieta','settoresocieta','nome','cognome','sesso','codicefiscale','indirizzo','cap','citta','provincia','frazione','telefono','cellulare','fax','emailuser','professione','mypass','myrepass');
			campi['txt_desc']=new Array('Societa*','Partita IVA*','Sito WEB','Indirizzo*','CAP*','Cittą*','Provincia*','Frazione','Telefono','Cellulare','Fax','Settore*','Nome*','Cognome*','Sesso','Codice fiscale','Indirizzo*','CAP*','Cittą*','Provincia*','Frazione','Telefono*','Cellulare','Fax','E-mail*','Professione*','Password*','Conferma password*');
			campi['nome_desc']=form_nomedesc_reg;
			campi['desc_error']=new Array('Societą','Partita IVA societą','Sito WEB societą','Indirizzo societą','CAP societą','Cittą societą','Provincia societą','Frazione societą','Telefono societą','Cellulare societą','Fax societą','Settore societą','Nome utente','Cognome utente','Sesso utente','Codice fiscale utente','Indirizzo utente','CAP utente','Cittą utente','Provincia utente','Frazione utente','Telefono utente','Cellulare utente','Fax utente','E-mail utente','Professione utente','Password','Conferma password');
			campi['type_value']=new Array('','','','','','','','','','','','','R','R','','','R','RisNum','R','R','','RisNum','','','RisEmail','R','R','R');
			campi['message']=new Array(form_message01,form_message02,form_message03,form_message04,form_message05,form_message06,form_message07);
			campi['css']=new Array('testo10-black01','testo10-red01');
			campi['div']=new Array(NameDivError_reg,'156','#F5F5F5','testo12-red01','testo10-black01');
			campi['sign_request']='';
			campi['other_error']=new Array();
			//-------------------			
			if(document.getElementById(NamePassCmp_reg[0]).value!=document.getElementById(NamePassCmp_reg[1]).value){
				campi['other_error'][campi['other_error'].length]=new Array(1,'Password*','- I campi '+campi['desc_error'][25]+' e '+campi['desc_error'][26],form_message09,'psw28');
				campi['other_error'][campi['other_error'].length]=new Array(1,'Conferma password*','',form_message09,'psw29','testo10-red01');
				}
			//-------------------
			if(document.getElementById('privacy').checked==false){
				campi['other_error'][campi['other_error'].length]=new Array(1,'Accetto*','- La Legge sulla Privacy',form_message08,'prv30');
				}
			else{
				campi['other_error'][campi['other_error'].length]=new Array(0,'Accetto*','','','prv30');
				}
			//-------------------
			MM_validateFormHTML_lingua(campi);
			//-------------------
			if(document.MM_returnValue==true){
				pg.submit();
				}
			else
			{
				alert("Non hai compilato interamente il modulo di registrazione!");	
			}
			}
		}
	}
	
	
function GestFormRegister(){
	pg=document.forms.register;
	if(pg.mytype[0].checked==true){
		pg.reset();
		pg.mytype[0].checked=true;
		
		document.getElementById("societamodule").style.top='0px';
		document.getElementById("societamodule").style.visibility='visible';
		//document.getElementById("usermodule").style.top='0px';
		//document.getElementById('usermodule').style.visibility='visible';
		//document.getElementById("finalmodule").style.top='0px';
		//document.getElementById('finalmodule').style.visibility='visible';
		ReplaceDescCampi(form_nomedesc_reg,form_societa_txtdesc_reg,'testo10-black01',NameDivError_reg);
		
		}
	if(pg.mytype[1].checked==true){
		pg.reset();
		pg.mytype[1].checked=true;
		
		document.getElementById('societamodule').style.visibility='hidden';
		document.getElementById('societamodule').style.top='-350px';
		document.getElementById('usermodule').style.visibility='visible';
		document.getElementById('usermodule').style.top='-326px';
		document.getElementById('finalmodule').style.visibility='visible';
		document.getElementById('finalmodule').style.top='-326px';
		ReplaceDescCampi(form_nomedesc_reg,form_user_txtdesc_reg,'testo10-black01',NameDivError_reg);
		
		}
	}
	

function controllaform_logout(){
	document.forms.login.submit();
	}
	
function finder(){
	/*if(document.getElementById('q').value==''){
		DivErrorPage('PER AVVIARE LA RICERCA E\' NECESSARIO COMPILARE IL RELATIVO BOX.');
		}*/
	if(document.getElementById('q').value!=''){
		//document.getElementById('ricerca').submit();
		if(document.getElementById('site').options[document.getElementById('site').selectedIndex].value=='catalogo'){
			document.getElementById('w').value=document.getElementById('q').value;
			//document.getElementById('ricerca').action='http://europe.hbc.honeywell.com/spain/ssearch/index.php';
			document.getElementById('ricerca').action='http://212.184.23.188/view/IT.IT/IT/pub/HC2006/online/ssearch/index.php';
			document.getElementById('ricerca').submit();
			}
		else{
			document.getElementById('ricerca').action='http://search.honeywell.com/search';
			document.getElementById('ricerca').submit();
			}
		}
	}
