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

var Contact = Class.create({ 
	initialize: function() { 
	}
});

Contact.recordHasNames = function(record) {
	   return (record && (record.firstName || record.lastName || record.suffix || record.prefix));
};

Contact.formatPersonName = function(record) {
	var personAtts = {};
	// use spaces for missing values in order to properly collapse in regex 
	// also use personAtts obj so that we don't modify original record
	personAtts.prefix = (record.prefix) ?  (record.prefix) : " ";
	personAtts.firstName = (record.firstName) ?  (record.firstName) : " ";
	personAtts.lastName = (record.lastName) ?  (record.lastName) : " ";
	personAtts.suffix = (record.suffix) ? (record.suffix) : " ";
	return $L("#{prefix} #{firstName} #{lastName} #{suffix}").interpolate(personAtts).replace(/  /g, "");
};