// JavaScript Document

function error_login(tipo) {
		if (tipo == "bloccato") {
		alert("Il tuo account è stato temporaneamente bloccato");
		} else {
		alert("Nome utente e/o password errati");
		}
	}
	
	function re_login() {
		document.frm_login.step.value="";
		likeSubmit('login_operatori.php?rand=' + escape(Math.random()), 'POST', 'frm_login', 'loginarea', 'no');	
	}
	
	function login() {
	
		if (document.frm_login.username.value=="" || document.frm_login.username.value=="username") {
			alert('Inserisci la username');
			document.frm_login.username.value="username";
			return false;
		} 
		
		if (document.frm_login.password.value=="" || document.frm_login.password.value=="password") {
			alert('Inserisci la password');
			document.frm_login.password.value="password";
			return false;
		} 
		
		document.frm_login.step.value="login";
		likeSubmit('login_operatori.php?rand=' + escape(Math.random()), 'POST', 'frm_login', 'loginarea', 'no');	
		
	}
	
	function logout() {
		
		document.frm_login.step.value="logout";
		likeSubmit('login_operatori.php?and=' + escape(Math.random()), 'POST', 'frm_login', 'loginarea', 'no');	
		
	}
	
	function recupera_login() {
		likeSubmit('recupera_login.php?and=' + escape(Math.random()), 'POST', 'frm_login', 'loginarea', 'no');	
	}
	
	function reinvia_pass() {
		document.frm_login.step.value="send_pass";
		likeSubmit('recupera_login.php?and=' + escape(Math.random()), 'POST', 'frm_login', 'loginarea', 'no');
	}
	
	function check_email()		{
	   EmailAddr = document.frm_login.email.value;
	   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	   if (Filtro.test(EmailAddr))
		  return true;
	   else
		  {
		  
		  alert("Formato email non valido");
		  
		  document.frm_login.email.value = "";
		  document.frm_login.email.focus();
		  return false;
		  }
	   }