/* form_validation.js
   * CREATED BY: Martin Paczynski
   * Copyright (c) 2001-2003 Martin Paczynski. All Rights Reserved.
   * Originally published and documented at http://www.paczynski.net/
   * License to use is granted if and only if this entire copyright notice
   * is included.
   * 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.
  */
// LAST MODIFIED: 07/07/03


//**************** General email verifier


// The script will validate any 2 or 3 letter suffix (e.g. "com", "uk") but not anything longer or shorter
// that is not listed in the Array below
var validEmailExt = new Array("info","aero","museum","name");

function checkIfEmail(formEl){
	this.formEl = formEl;
	formElV=formEl.value
	
	var pat = new RegExp("^(\\w|-|\\w\\.\\w)+@(\\w|-|\\w\\.\\w)+\\.\\w{2,3}$") ;
	patmatch = pat.test(formElV);
	if(patmatch)
		{return true;}
	else
		{
		for(a=0;a<validEmailExt.length;a++)
			{
			pat.compile("^(\\w|-|\\w\\.\\w)+@(\\w|-|\\w\\.\\w)+\\."+ validEmailExt[a] +"$");
			patmatch = pat.test(formElV);
			if(patmatch)
				{return true;}
			else
				{continue;}
			}
		}
	alert("Please specify a valid e-mail address.");
	return false;	
}