function validate_registration_form()
{
	//initialization
	
	var errors = "";
	
	//get form data
	
	var name 				= $( "#name_tf" ).val();
	
	var email				= $( "#email_tf" ).val();
	
	var password1			= $( "#password1_tf" ).val();
	
	var password2			= $( "#password2_tf" ).val();
	
	var phone				= $( "#phone_tf" ).val();
	
	var address1			= $( "#address1_tf" ).val();
	
	//check form data
		
	if ( !validate_required_field( name, "" ) )
	{
		errors += "- \"Name\" is required.\n";
	}
	
	if ( !validate_required_field( email, "" ) )
	{
		errors += "- \"Email address\" is required.\n";
	}
	else if ( !validate_email( email ) )
	{
		errors += "- \"Email address\" field has invalid format.\n";
	}
	
	if ( !validate_required_field( password1, "" ) )
	{
		errors += "- \"New password\" is required.\n";
	}
	else if ( password1 != password2 )
	{
		errors += "- Passwords are not the same.\n";
	}
	
	if ( !validate_required_field( phone, "" ) )
	{
		errors += "- \"Telephone\" is required.\n";
	}
	else if ( !validate_phone( phone ) )
	{
		errors += "- \"Telephone\" field has invalid format.\n";
	}
	
	if ( !validate_required_field( address1, "" ) )
	{
		errors += "- \"Address line 1\" is required.";
	}
	
	if( errors.length > 0 )
	{
		alert( "The following error(s) occured:\n" + errors );
		
		return false;
	}
	
	//form data are correct
	
	return true;
}

function showhide(cb) 
{
 	var cont = document.getElementById('deliveryaddress');
	
 	if (cb.checked) 
	{
		cont.style.display = 'block';
	} 
	else 
	{
		cont.style.display = 'none';
		
		document.getElementById('ea1_tf').value = '';
		
		document.getElementById('ea2_tf').value = '';
		
		document.getElementById('epc_tf').value = '';
	}
}
