

function validate(theForm)
{
	log = '';
	
	window.defaultStatus = 'Configuring your new Elixir Safelist account ... Please wait ...';
	tmp = theForm.btnJoin.value;
	theForm.btnJoin.value = 'Please wait ...';
	theForm.btnJoin.disabled = true;
	
	if ( theForm.refid.value == '' )
	{
		log += '\tYour referrer information is missing and you MUST join with a referrer. You will have to close the window and come back with your referrer\'s affiliate link in a new window. If you did not have a referrer, still close the window and come back to www.ElixirSafelist.com and you will get a random referrer. This is the only way to assign you to a referrer. We appologize for this, but there is a bug in the system causing this to happen infrequently. We are working to pin point this issue.\n\n';
	}
		
	
	if ( theForm.fname.value == '' )
		log += '\tFirst Name is required.\n';
	if ( theForm.lname.value == '' )
		log += '\tLast Name is required.\n';
	
	if ( theForm.email.value == '' )
		log += '\tYour contact email address is required.\n';
	else if ( !isValidEmailFormat(theForm.email.value) )
		log += '\tInvalid contact email format.\n';
	
	if ( theForm.subscribe.value == '' )
		log += '\tYour subscribe email address is required.\n';
	else if ( !isValidEmailFormat(theForm.subscribe.value) )
		log += '\tInvalid subscribe email format.\n';
				
	if ( (theForm.email.value != '' && theForm.subscribe.value != '') && theForm.email.value == theForm.subscribe.value )
		log += '\tYour contact email address must be different than your subscribe email address.\n';

	// PAYPAL	
	if ( theForm.paypal.value != '' && !isValidEmailFormat(theForm.paypal.value) )
		log += '\tInvalid PayPal email format.\n';
		
	// STORMPAY
	if ( theForm.stormpay.value != '' && !isValidEmailFormat(theForm.stormpay.value) )
		log += '\tInvalid StormPay email format.\n';
		
	if( theForm.country.value == '' )
		log += '\tYou must select your country.\n';		
	if( theForm.login.value == '' )
		log += '\tYou must specify a login.\n';
	if ( theForm.pw.value == '' )
		log += '\tYou must specify a password.\n';
	else if ( theForm.pw2.value == '' )
		log += '\tYou must confirm your password.\n';
	else if ( theForm.pw.value != theForm.pw2.value )	
		log += '\tThe passwords do not match.\n';
	if ( ! theForm.agree.checked )
		log += '\tYou must Agree to the rules before joining.\n';
			
	if ( log == '' )
	{
		return true;
	}
	else {
		window.defaultStatus = 'Elixir Safelist';
		theForm.btnJoin.disabled = false;
		theForm.btnJoin.value = tmp;
		alert('Please correct the following problems:\n\n' + log);
		return false;
	}
}
