/* 
UbikLib - some usefull Javascript functions
Copyright 2007 Ubik SA

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
/*
 * getNavigatorLang
 * Purpose:
 * -  Récupération de la langue du navigateur
 * In:
 * 
 * Out:
 * - lang: 2 chars detected language (fr,de,en,it)
 *         or "?" if not identified
 * Modification history:
 * 2007.09.03 Function's doc
 * 2007.09.19 checkRequired & checkEmail
 * 2007.10.04 limité au ctrl des champs; le reste exporté vers UbikLayout.js
 */ 
//alert ("dans UbikLib.js")

function checkRequired (v_Field, v_s_Message) {
// v_Field: field 2 be checked
// v_s_Message: display when empty
  with (v_Field) {
    if (value==null||value=="") {
      alert (v_s_Message);
      return false
    }
    else {
      return true
    }
  }
}
//
 function checkEmail (v_Field,v_s_Message) {
   //
 with (v_Field) {
   i_len = value.length;
   i_apos = value.indexOf("@") ;
   i_dotpos = value.lastIndexOf(".");
   if (i_apos<1 || i_dotpos-i_apos<2 || i_len-i_dotpos <3) {
     alert (v_s_Message);
     return false
   }
   else {
     return true
   }
 }
}
//
function simple (text2show)
{
alert (text2show);
return true;
}
