/* Copyright 2009 Palm, Inc.  All rights reserved. */

var NamedetailsAssistant = Class.create({
	initialize: function(oldController, params) {
		this.contact = params.contact;
		this.oldController = oldController;
	},
	
	setup: function() {
		var that = this;
		["prefix", "firstName", "middleName", "lastName", "suffix"].each(function(part) {
			that.controller.setupWidget(part, {
				modelProperty: part,
				textCase: Mojo.Widget.steModeTitleCase,
				autoReplace: false
			}, that.contact);
		});
		
	},
	
	cleanup: function() {
		this.contact.freeformName = this.contact.getFullName();
		this.contact.dirty = true;
		this.oldController.modelChanged(this.contact);
	}
})
