/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  *
  * Title : 		Form Validation Example
  * Author : 		Vito Tardia
  * URL : 			http://www.vtardia.com
  *
  * Description :	Includes functions from HackerJournal magazine
  *					(http://www.hackerjournal.it)
  *				- 	filled
  *				- 	canSubmit
  *
  * Created : 	27/03/2006
  * Modified : 	27/11/2006
  *
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

	var loginForm;

	//Attach an "onLoad" event to the current window
	window.onload = init;
	
	//Initialization function
	function init() {
		//Attaching the onSubmit event to the login form
		loginForm = document.getElementById('login');
		loginForm.onsubmit = function () {
			return canSubmit(this);
		}
		
		//Setting focus to the user field
	}

	function filled(field) {
		if (field.value == "" || field.value == null) {
			return false;
		} else {
			return true;
		}
	}
	function fillederror(field) {
		if (field.value != "inverno") {
			return false;
		} else {
			return true;
		}
	}
	
	function canSubmit(form) {
		if (!filled(form.password)) {
			alert("Embolsar la password.");
			form.password.focus();
			return false;
		}
		if (!fillederror(form.password)) {
			alert("Password falsa.");
			form.password.focus();
			return false;
		}
		return true;
	}
