/*
* $Id: isValidEmail.js,v 1.1 2008-03-29 10:08:29 build Exp $
*
* (C) Copyright 2008 Jaxo Systems.  All rights reserved.
* This work contains confidential trade secrets of Jaxo Systems.
* Use, examination, copying, transfer and disclosure to others
* are prohibited, except with the express written agreement of Jaxo.
*
* Author:  Pierre G. Richard
* Written: 3/29/2008
*/
function isValidEmail(str)
{
   var sResult = "";
   if (str.indexOf(" ") != -1) {
      return false;
   }
   at = str.indexOf("@");
   if (at < 1) {
      return false;
   }
   dot = str.lastIndexOf(".");
   if (dot < 3 || dot < at+2 || dot == str.length-1) {
      return false;
   }
   for (var i=0; i < str.length; ++i) {
      ch = str.substring(i, i + 1);
      if (
         ((ch < 'A') || (ch > 'Z')) &&
         ((ch < 'a') || (ch > 'z')) &&
         (ch != '@') &&
         (ch != '.') &&
         (ch != '_') &&
         (ch != '-') &&
         ((ch < '0') || (ch > '9'))
      ) {
         return false;
      }
   }
   return true;
}

