$(document).ready(function(){
	
});

function addStaffMember() {
	// Increment the number of staff member sub-forms.
	var newStaffMemberNumber = parseInt($('#staffMemberCount').val()) + 1;
	
	// Update the counter in the form.
	$('#staffMemberCount').val('' + newStaffMemberNumber);
	
	// Clone the staffMember div.
	$staffMemberTemplate = $('#staffMember_staffMemberNumber');
		
	$cloned = $staffMemberTemplate.clone(true);

	// Fix the html for the next staff member count number.
	$cloned.html($cloned.html().replace('staffMemberNumber',newStaffMemberNumber,'g'));
	$cloned.html($cloned.html().replace('staff_name_value',''));
	$cloned.html($cloned.html().replace('staff_title_value',''));
	$cloned.html($cloned.html().replace('staff_email_value',''));
	$cloned.html($cloned.html().replace('staff_role_value',''));

	// Append the cloned HTML to the staffMemberList div.
	$('#staffMemberList').append($cloned.html());	
}