function validate() {
  at = document.forms[0].email.value.indexOf('@');
  if (document.forms[0].firstname.value == '') {
    alert('You did not enter your first name.');
    document.forms[0].firstname.focus();
	exit;
  } else if (document.forms[0].lastname.value == '') {
    alert('You did not enter your last name.');
    document.forms[0].lastname.focus();
	exit;
  } else if (document.forms[0].checkpayable.value == '') {
    alert('You must enter who to make checks payable to or a Paxum email address.');
    document.forms[0].checkpayable.focus();
	exit;
  } else if (document.forms[0].age.value == '') {
    alert('You did not enter your age.');
    document.forms[0].age.focus();
	exit;
  } else if (document.forms[0].age.value <= 17 ) {
    alert('You must be at least eighteen to twenty-one (18 - 21) years of age, depending on the age of majority in your jurisdiction.');
    document.forms[0].age.select();
    document.forms[0].age.focus();
	exit;
  } else if (document.forms[0].email.value == '' || at == -1) {
    alert('Please enter a valid email address, example: someone@yourdomain.com.');
    document.forms[0].email.focus();
	exit;
  } else if (document.forms[0].account.value == '') {
    alert('Please enter an account ID to track your sales.');
    document.forms[0].account.focus();
	exit;
  } else if (document.forms[0].account.value.length < 4) {
    alert('Your Account ID must be at least 4 - 12 alpha numberic characters consisting of lower case letters and/or numbers. No spaces or strange characters');
    document.forms[0].account.select();
    document.forms[0].account.focus();
	exit;
  } else if (document.forms[0].password.value == '') {
    alert('Please enter password to protect your statistics.');
    document.forms[0].password.focus();
	exit;
  } else if (document.forms[0].password.value.length < 6) {
    alert('Your password must be at least 6 - 12 alpha numberic characters consisting of lower case letters and/or numbers. No spaces or strange characters');
    document.forms[0].password.select();
    document.forms[0].password.focus();
	exit;
  } else if (document.forms[0].street.value == '') {
    alert('You did not enter your street address.');
    document.forms[0].street.focus();
	exit;
  } else if (document.forms[0].city.value == '' ) {
    alert('You did not enter your city.');
    document.forms[0].city.select();
    document.forms[0].city.focus();
	exit;
  } else if (document.forms[0].state.value == '' ) {
    alert('You did not enter your state or territory.');
    document.forms[0].state.select();
    document.forms[0].state.focus();
	exit;
  } else if (document.forms[0].zip.value == '' ) {
    alert('You did not enter your zip or postal code.');
    document.forms[0].zip.select();
    document.forms[0].zip.focus();
	exit;
  } else if (document.forms[0].country.value == 'SELECT' ) {
    alert('You did not select your Country.');
    document.forms[0].country.select();
    document.forms[0].country.focus();
	exit;
  } else if (document.forms[0].taxid.value == '' ) {
    alert('U.S. Residence must enter either a Tax ID or Social Security Number. If you live outside the U.S. please enter NA');
    document.forms[0].taxid.select();
    document.forms[0].taxid.focus();
	exit;
  } else if (document.forms[0].taxid.value.length < 2 ) {
    alert('Your Tax ID or Social Security Number is incorrect.');
    document.forms[0].taxid.select();
    document.forms[0].taxid.focus();
	exit;
  } else if (document.forms[0].url.value.length < 12) {
    alert('The URL you entered as your primary URL is invalid.');
    document.forms[0].url.select();
    document.forms[0].url.focus();
	exit;
  } else if (document.forms[0].terms.value == 'No' ) {
    alert('You must agree to Mount Equinoxs terms and conditions to become a member.');
    document.forms[0].terms.select();
    document.forms[0].terms.focus();
	exit;
  } else {
	document.forms[0].account.value=ignoreSpaces(document.forms[0].account.value);
	document.forms[0].password.value=ignoreSpaces(document.forms[0].password.value);
  }
}

function checkCapsLock( e ) {
	var myKeyCode=0;
	var myShiftKey=false;
	var myMsg='Check to make sure CAPS LOCK isn\'t on or that the shift key hasn\'t been pressed.\n\nThis field must contain lower case letters and/or numbers only. No Capitals, Strange characters or Spaces.';
	// Internet Explorer 4+
	if ( document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;
	// Netscape 4
	} else if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;
	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;
	}
	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
		alert( myMsg );
	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
		alert( myMsg );
	}
			if (event.shiftKey) {
		alert( myMsg );
	}
	return false;
}

function ignoreSpaces(string) {
	var temp = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	temp += splitstring[i];
	return temp;
}

function accountdAlphaNumeric(val)
{
	if (val.match(/^[a-zA-Z0-9]+$/))
	{
		//return true;
		//document.forms[0].submit(); 
		passworddAlphaNumeric(document.forms[0].password.value);
	}
	else
	{
	alert('Your Account ID must be alpha numberic characters consisting of lower case letters and/or numbers. No spaces or strange characters');
	document.forms[0].account.select();
	document.forms[0].account.focus();
	exit;
	}	
}

function passworddAlphaNumeric(val)
{
	if (val.match(/^[a-zA-Z0-9]+$/))
	{
		//return true;
		document.forms[0].password.value=document.forms[0].password.value.toLowerCase();
   		document.forms[0].account.value=document.forms[0].account.value.toLowerCase();
		document.forms[0].submit(); 
	}
	else
	{
	alert('Your Password must be alpha numberic characters consisting of lower case letters and/or numbers. No spaces or strange characters');
	document.forms[0].password.select();
	document.forms[0].password.focus();
	exit;
	}	
}

