<!--
//javascript document

var previousError = false;

function validate(x)
{

	var error = new Array;
	var i = 0;
	var emailRE = /^[0-9a-zA-Z._]+@[0-9a-zA-Z.-]+.([a-zA-Z][a-zA-Z]|[a-zA-Z][a-zA-Z][a-zA-Z])$/;
	var stringRE = /^[a-zA-Z,-. ]+$/;
	
	if (document.forms[x].txtEmail){	
		var email = document.forms[x].txtEmail.value;
		
		if (!email.match(emailRE)){
		error[i] = 'a valid e-mail address'; i+=1;
		}
	}
	
	if ((document.forms[x].txtPassword)&&(document.forms[x].txtPassword.value == "")){
		error[i] = 'your password'; i+=1;
	}

	if ((document.forms[x].txtFirstName)&&(document.forms[x].txtFirstName.value == "")){
		error[i] = 'your first name'; i+=1;
	}
	
	if ((document.forms[x].txtLastName)&&(document.forms[x].txtLastName.value == "")){
		error[i] = 'your last name'; i+=1;
	}	
		
	if ((document.forms[x].txtCompanyName)&&(document.forms[x].txtCompanyName.value == "")){
		error[i] = 'your company name'; i+=1;
	} 
	
	if ((document.forms[x].txtConfirm)&&(document.forms[x].txtConfirm.value == "")){
		error[i] = 'your password confirmation'; i+=1;
	}
	
	if ((document.forms[x].txtPassword)&&(document.forms[x].txtConfirm)&&(!(document.forms[x].txtPassword.value).match(document.forms[x].txtConfirm.value))){
		error[i] = 'the same value for your password and password confirmation'; i+=1;
	}

	if ((document.forms[x].txtReminder)&&(document.forms[x].txtReminder.value == "")){
		error[i] = 'your password reminder'; i+=1;
	}

	if (error.length)
	{	
		var errorDiv = document.getElementById('error_div'+ x);
		var errorList = document.createElement('ul');
		var errorListItem_tn = new Array;
		var errorListItem = new Array;
		
		if (previousError){
			errorDiv.innerHTML = '';
		}
			
		for (i=0; i<error.length; i++)
		{
			errorListItem_tn[i] = document.createTextNode(error[i]);
			errorListItem[i] = document.createElement('li');
			errorListItem[i].appendChild(errorListItem_tn[i]);
			errorList.appendChild(errorListItem[i]);
		}
		
		var errorPrefix = document.createElement ('span');
		var errorPrefix_tn = document.createTextNode ('In order for the form to be submitted please enter:');

		errorPrefix.appendChild(errorPrefix_tn);
		errorPrefix.style.fontWeight='bold';
		
		errorDiv.appendChild(errorPrefix);
		errorDiv.appendChild(errorList);
		
		errorDiv.style.display = 'block';
		
		previousError = true;
		
		return(false);
	}

return (true);
}


//-->

