//popup privacy

var usescroll='no'
function loadwindow(url,wid,hei,wtit){
var sW = (window.screen.width-wid)/2;
var sH = (window.screen.height-hei)/2;
	var miawin=window.open(url,wtit,
"toolbar=no,menubar=no,location=no,scrollbars="+usescroll+",resizable=no,height="+hei+",width="+wid+",top="+sH+",left="+sW);
miawin.focus();
}

//convalida form contatti

function formValidate() {
	if(document.forms[1].nome.value == ""){
		alert("Il campo 'Nome' è obbligatorio");
		document.forms[1].nome.focus();
		return false;		
	}
		else if(document.forms[1].cognome.value == ""){
		alert("Il campo 'Cognome' è obbligatorio");
		document.forms[1].cognome.focus();
		return false;		
	}
		else if(document.forms[1].citta.value == ""){
		alert("Il campo 'Città' è obbligatorio");
		document.forms[1].citta.focus();
		return false;		
	}
		else if(document.forms[1].provincia.value == ""){
		alert("Il campo 'Provincia' è obbligatorio");
		document.forms[1].provincia.focus();
		return false;		
	}
		else if(document.forms[1].paese.value == ""){
		alert("Il campo 'Paese' è obbligatorio");
		document.forms[1].paese.focus();
		return false;		
	}
		else if(document.forms[1].mail.value == ""){
		alert("Il campo 'E-mail' è obbligatorio");
		document.forms[1].mail.focus();
		return false;		
	}
		else if(document.forms[1].richiesta.value == ""){
		alert("Il campo 'Richiesta' è obbligatorio");
		document.forms[1].richiesta.focus();
		return false;		
	}
	else { return true }
}

//formModificaDati
function formModificaDati() {
	if(document.forms[0].cel.value == ""){
		alert("Il campo 'Cellulare' è obbligatorio.");
		document.forms[0].cel.focus();
		return false;		
	}
		else if(document.forms[0].tel.value == ""){
		alert("Il campo 'Telefono' è obbligatorio.");
		document.forms[0].tel.focus();
		return false;		
	}
		else if(document.forms[0].azienda.value == ""){
		alert("Il campo 'Azienda' è obbligatorio.");
		document.forms[0].azienda.focus();
		return false;		
	}
		else if(document.forms[0].ruolo.value == ""){
		alert("Il campo 'Ruolo' è obbligatorio.");
		document.forms[0].ruolo.focus();
		return false;		
	}
		else if(document.forms[0].pass_old.value == ""){
		alert("Il campo 'Vecchia Password' è obbligatorio.");
		document.forms[0].pass_old.focus();
		return false;		
	}
		else if(document.forms[0].pass_old.value != document.forms[0].pass_ora.value){
		alert("Il campo 'Vecchia Password' non coincide con la password attuale.");
		document.forms[0].pass_old.focus();
		return false;		
	}	
		else if(document.forms[0].pass.value == ""){
		alert("Il campo 'Nuova Password' è obbligatorio.");
		document.forms[0].pass.focus();
		return false;		
	}
		else if(document.forms[0].pass.value.length <= 3){
		alert("Password deve avere almeno 4 caratteri.");
		document.forms[0].pass.focus();
		return false;		
	}	
		else if(document.forms[0].pass.value.length >= 9){
		alert("Password deve avere al massimo 8 caratteri.");
		document.forms[0].pass.focus();
		return false;		
	}	
		else if(document.forms[0].pass_conferma.value == ""){
		alert("Il campo 'Conferma Password' è obbligatorio.");
		document.forms[0].pass_conferma.focus();
		return false;		
	}
		else if(document.forms[0].pass.value != document.forms[0].pass_conferma.value){
		alert("Le password non coincidono.");
		document.forms[0].pass.focus();
		return false;		
	}
	else { return true }
}



//menutendina
function slideMenu(obj) {
	document.getElementById('menu_tendina_zincatura_1').style.visibility='hidden';
	document.getElementById('menu_tendina_zincatura_2').style.visibility='hidden';
	document.getElementById(obj).style.visibility='visible';
}
function slideMenuOut() {
	document.getElementById('menu_tendina_zincatura_1').style.visibility='hidden';
	document.getElementById('menu_tendina_zincatura_2').style.visibility='hidden';
}

//conto alla rovescia
function countdown(i) {
   Tempo_Mancante = 600 - i;
   if (Tempo_Mancante==0) {
		alert('Sessione scaduta. Accedere tramite login.');  
		location.href='http://www.bisolzinco.it/ita/intranet/login.php?act=logout';
   }
   if(Tempo_Mancante < 0)
   Tempo_Mancante = 0;
   ore = Math.floor(Tempo_Mancante / (60 * 60));
   Tempo_Mancante %= (60 * 60);
   minuti = Math.floor(Tempo_Mancante / 60);
   Tempo_Mancante %= 60;
   secondi = Tempo_Mancante;
   cMin  = document.getElementById("counter_min");
   cSec  = document.getElementById("counter_sec");
   cMin.innerHTML    = GetFormated(minuti);
   cSec.innerHTML    = GetFormated(secondi);
   b = i + 1;
   setTimeout('countdown(b);', 1000);
}

//conto alla rovescia
function countdown_minisito(i) {
   Tempo_Mancante = 600 - i;
   if (Tempo_Mancante==0) {
		alert('Sessione scaduta. Accedere tramite login.');  
		location.href='download.php?act=logout';
   }
   if(Tempo_Mancante < 0)
   Tempo_Mancante = 0;
   ore = Math.floor(Tempo_Mancante / (60 * 60));
   Tempo_Mancante %= (60 * 60);
   minuti = Math.floor(Tempo_Mancante / 60);
   Tempo_Mancante %= 60;
   secondi = Tempo_Mancante;
   cMin  = document.getElementById("counter_min_minisito");
   cSec  = document.getElementById("counter_sec_minisito");
   cMin.innerHTML    = GetFormated(minuti);
   cSec.innerHTML    = GetFormated(secondi);
   b = i + 1;
   setTimeout('countdown_minisito(b);', 1000);
}
 
function GetFormated(i) {
   if(i<10) { return "0"+i; }
   return i;
}


//carica file esterni
function scriviFILE(file,nome) {
	document.getElementById(nome).value = file;	
}

//carica immagini esterni
function scriviIMG(file,nome,quale) {
	document.getElementById(nome).value = file;
	
}

//cancella file
function cancellaFILE(nome) {
	document.getElementById(nome).value = "";
}

//cancella immagine
function cancellaIMG(nome,quale) {
	document.getElementById(nome).value = "";
}
