<!--
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}

// registration verification functions start here
// email verification has been upgraded

function checkRegUsername(username)
{
	// check length, no whitespace
	// var reg = new RegExp("/\s/g");
	// alert (reg.test(username));
	return (username.length >= 4)&&(!(/\s/g.test(username)));
}

function checkRegPassword(password)
{
	return (password.length >= 4);
}

function checkRegConfirm(password, confirm)
{
	return (password==confirm);
}

function checkRegEmail(email)
{
    var re = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b/;
    return re.test(email);
	// var atpos=email.indexOf("@");
	// var dotpos=email.lastIndexOf(".");
	// return(!(atpos<1 || dotpos<atpos+2 || dotpos+2>=email.length));
}

function checkRegZipcode(zipcode)
{
	//alert(isNaN(zipcode) + "\n" + ((zipcode.length != 5)));
	//alert("zipcode");
	//alert(isNaN(zipcode) + "\n" + (zipcode.length!=5) + "\n" + (!(isNaN(zipcode)||((zipcode.length != 5)))));
	//return false;
	return (!(isNaN(zipcode)||((zipcode.length != 5))));
}

function validateForm()
{
	var username=document.forms["register"]["username"].value;
	var password=document.forms["register"]["password"].value;
	var confirm=document.forms["register"]["password2"].value;
	var email=document.forms["register"]["email"].value;
	var zip=document.forms["register"]["zip"].value;
	var msg = "";
	var isValid = true;
	
	if (!(checkRegUsername(username)))
	{
		msg += "Please enter a new username.\nUsername must be at least four characters long\nand contain no spaces.\n";
		isValid = false;
	}

	if (!(checkRegPassword(password)))
	{
		msg += "Please enter a new password.\nPassword must be at least four characters long.\n";
		isValid = false;
	}
	else
	{
		if (!(checkRegConfirm(password, confirm)))
		{
			msg+="The passwords you entered do not match. Please re-enter.\n";
			isValid = false;
		}
	}

	if (!(checkRegEmail(email)))
	{
		msg+="Your e-mail address is invalid. Please re-enter.\n";
		isValid = false;
	}

	if (!(checkRegZipcode(zip)))
	{
		msg+="Your zipcode is invalid. Please re-enter.\n";
		isValid = false;
	}
	
	if (!(isValid))
	{
		alert(msg);
	}

	return isValid;
}

function validateForgotForm()
{
	var email=document.forms["forgot"]["email"].value;
	var msg = "";
	var isValid = true;
	if (!(checkRegEmail(email)))
	{
		msg+="Your e-mail address is invalid. Please re-enter.\n";
		isValid = false;
	}
	if (!(isValid))
	{
		alert(msg);
	}
	return isValid;
}

//-->