// Validar a autenticação.
function login (frm, optRetURL) {
	if (!navigator.cookieEnabled) {
		wnd.location = "/asp/semcookies.asp"
		return false
	}

	with (frm) {
		if (!isEMailField (txtUtilz, true)) return false
		if (!reqField (txtPwd)) return false
		
		runHook (top.saveDataHook)
		// Enviar mensagem.
		new WebMsg ()
			.newItem ("txtUtilz", txtUtilz.value)
			.newItem ("txtPwd", txtPwd.value)
			.newItem ("ru", optRetURL || getPageAddr ())
			.newItem ("rep", "x")
			.send ("/asp/clis/login.asp")
	}	

	return false
}

// Esquecer a identificação do utilizador.
function logout () {
	runHook (top.saveDataHook)
	new WebMsg ().newItem ("lo", "x").send ()
}

// Vai para OPTURL ou para a página inicial dentro de NSECS.
function redirIn (nsecs, optURL) {	setTimeout (function () {	wnd.location = optURL || KRootAddr	}, nsecs * 1000)	}

// Vai para URL, mas permite-lhe voltar à página actual.
function gotoPg (url) {	new WebMsg ().newItem ("ru", getPageAddr ()).send (url)	}
