<!--
var badFirstName='Invalid first name';
var shortFirstName='First name must be at least 2 characters';
var badLastName='Invalid last name';
var shortLastName='Last name must be at least 2 characters';
var badUserName='Invalid Username';
var shortUserName='Username must be at least 3 characters';
var longUserName='Username must be no more than 10 characters';
var noPassMatch='Passwords do not match';
var shortPass='Password is too short';
var shortDomain='Domain is too short';
var domainNeedsDot='Domain needs a dot';
var invalidDomain='Invalid Domain';
var badIP='Invalid IP';
var badEmail='Invalid E-Mail Address';
var choosePlan='Choose a hosting plan';
var choosePayment='Choose a payment plan';

function nameOK(name)
{
	var ch;
	var i;

	if (name.length < 3) return false;
	if (name.length > 10) return false;

	for (i=0; i<name.length; i++)
	{
		ch=name.charAt(i);
		if ( i==0 && !((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')) || ch==' ' ) return false;
		else if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || (ch=='_') || (ch=='-')) || ch==' ') return false;
	}

	return true;
}

function realNameOK(name)
{
	var ch;
	var i;

	if (name.length < 2) return false;

	for (i=0; i<name.length; i++)
	{
		ch=name.charAt(i);
		if ( i==0 && !((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) || ch==' ' ) return false;
		else if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch=='-')) || ch==' ') return false;
	}

	return true;
}

function checkName()
{
	with (document.orderform)
	{
		if (username.value.length < 3)
		{
			username.focus();
			username.select();
			alert(shortUserName);
			return false;
		}
		else
		if (username.value.length > 10 )
		{
			username.focus();
			username.select();
			alert(longUserName);
			return false;
		}
		else
		if (nameOK(username.value)) return true;
		else
		{
			username.focus();
			username.select();
			alert(badUserName);
			return false;
		}
	}
	return false;
}

function checkFname()
{
	with (document.orderform)
	{
		if (firstname.value.length < 2)
		{
			firstname.focus();
			firstname.select();
			alert(shortFirstName);
			return false;
		}
		else
		if (realNameOK(firstname.value)) return true;
		else
		{
			firstname.focus();
			firstname.select();
			alert(badFirstName);
			return false;
		}
	}
	return false;
}

function checkLname()
{
	with (document.orderform)
	{
		if (lastname.value.length < 2)
		{
			lastname.focus();
			lastname.select();
			alert(shortLastName);
			return false;
		}
		else
		if (realNameOK(lastname.value)) return true;
		else
		{
			lastname.focus();
			lastname.select();
			alert(badLastName);
			return false;
		}
	}
	return false;
}

function domainOK(domain)
{
	var ch;
	var i;
	var dotCount = 0;

	if (domain.length < 3)
	{
		alert(shortDomain);
		return 0;
	}

	if (domain.charAt(domain.length-1) == '.')
	{
		alert(invalidDomain);
		return 0;
	}

	for (i=0; i<domain.length; i++)
	{
		if ((ch = domain.charAt(i)) == '.') dotCount++;
	}

	if (dotCount == 0)
	{
		alert(domainNeedsDot);
		return 0;
	}

	return 1;
}

function checkDomain()
{
	with (document.orderform)
	{
		if (!domainOK(domain.value))
		{
			domain.focus();
			domain.select();
			return 0;
		}
	}
	return 1;
}

function emailOK(email)
{

	//var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	//original: var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+(,\s?([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+)*$/;


	if (filter.test(email))
		return 1;
	else
		return 0;
}

function checkEmail()
{
	with (document.orderform)
	{
		if (!emailOK(email.value))
		{
			email.focus();
			email.select();
			alert(badEmail);

			return 0;
		}
	}
	return 1;
}

function formOK()
{
	with (document.orderform)
	{
		if (checkFname() && checkLname() && checkName() && checkDomain() && checkEmail())
			return true;
	}
	return false;
}

// -->